From bda5ec4875b0e3fee261ae572c87516c58af5f4d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 22 May 2014 10:02:35 +0000 Subject: [PATCH] Added osgUI::Widget::set/getGraphicsSubgraph() to hold the subgraph that does the rendering portion of widgets --- include/osgUI/Widget | 17 ++++++++ src/osgUI/ComboBox.cpp | 3 +- src/osgUI/Dialog.cpp | 39 +++++++----------- src/osgUI/LineEdit.cpp | 29 +++----------- src/osgUI/Popup.cpp | 6 +-- src/osgUI/PushButton.cpp | 42 ++++++++------------ src/osgUI/Widget.cpp | 17 ++++++++ src/osgWrappers/serializers/osgUI/Widget.cpp | 2 + 8 files changed, 77 insertions(+), 78 deletions(-) diff --git a/include/osgUI/Widget b/include/osgUI/Widget index ca2235d8f..fb37fd8a4 100644 --- a/include/osgUI/Widget +++ b/include/osgUI/Widget @@ -42,7 +42,18 @@ public: virtual void dirty(); + + /** Set the subgraph to be used to erndering the widget.*/ + void setGraphicsSubgraph(osg::Node* node) { _graphicsSubgraph = node; _graphicsInitialized = true; } + /** Get the subgraph to be used to erndering the widget.*/ + osg::Node* getGraphicsSubgraph() { return _graphicsSubgraph.get(); } + /** Get the const subgraph to be used to erndering the widget.*/ + const osg::Node* getGraphicsSubgraph() const { return _graphicsSubgraph.get(); } + + /** createGraphics entry method, calls either callback object named "createGraphics" or the createGraphicsImplementation() method.*/ virtual void createGraphics(); + + /** createGraphicsImplementation method that creates the subgraph that will render the widget and assigns it to the Widget via the Widet::setGraphicsSubgraph() method.*/ virtual void createGraphicsImplementation(); @@ -104,6 +115,10 @@ public: virtual void leave(); virtual void leaveImplementation(); + /** resize all GLObjectBuffers.*/ + virtual void resizeGLObjectBuffers(unsigned int maxSize); + /** resize all GLObjectBuffers.*/ + virtual void releaseGLObjects(osg::State* = 0) const; protected: virtual ~Widget() {} @@ -112,6 +127,8 @@ protected: bool _hasEventFocus; bool _graphicsInitialized; + osg::ref_ptr _graphicsSubgraph; + osg::BoundingBoxf _extents; osg::ref_ptr