|
Revision 3529, 1.3 kB
(checked in by don, 9 years ago)
|
|
Namespaced Rect and Frame to osgfxbrowser::Rect/Frame, as this was causing
a namespace collision with CGL
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 | #ifndef FRAME_H_ |
|---|
| 2 | #define FRAME_H_ |
|---|
| 3 | |
|---|
| 4 | #include <osg/Geode> |
|---|
| 5 | #include <osg/Geometry> |
|---|
| 6 | |
|---|
| 7 | namespace osgfxbrowser { |
|---|
| 8 | |
|---|
| 9 | struct Rect { |
|---|
| 10 | float x0, y0, x1, y1; |
|---|
| 11 | Rect() {} |
|---|
| 12 | Rect(float x0_, float y0_, float x1_, float y1_): x0(x0_), y0(y0_), x1(x1_), y1(y1_) {} |
|---|
| 13 | inline float width() const { return x1 - x0; } |
|---|
| 14 | inline float height() const { return y0 - y1; } |
|---|
| 15 | }; |
|---|
| 16 | |
|---|
| 17 | class Frame: public osg::Geode { |
|---|
| 18 | public: |
|---|
| 19 | Frame(); |
|---|
| 20 | Frame(const Frame ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY); |
|---|
| 21 | |
|---|
| 22 | META_Node(osgfxbrowser, Frame); |
|---|
| 23 | |
|---|
| 24 | inline const std::string &getCaption() const { return caption_; } |
|---|
| 25 | inline void setCaption(const std::string &caption) { caption_ = caption; } |
|---|
| 26 | |
|---|
| 27 | inline const osg::Vec4 &getBackgroundColor() const { return bgcolor_; } |
|---|
| 28 | inline void setBackgroundColor(const osg::Vec4 &bgcolor) { bgcolor_ = bgcolor; } |
|---|
| 29 | |
|---|
| 30 | inline const Rect &getRect() const { return rect_; } |
|---|
| 31 | inline void setRect(const Rect &rect) { rect_ = rect; } |
|---|
| 32 | |
|---|
| 33 | static osg::Geometry *build_quad(const Rect &rect, const osg::Vec4 &color, bool shadow = true, float z = 0); |
|---|
| 34 | |
|---|
| 35 | virtual void rebuild(); |
|---|
| 36 | |
|---|
| 37 | protected: |
|---|
| 38 | virtual ~Frame() {} |
|---|
| 39 | Frame &operator()(const Frame &) { return *this; } |
|---|
| 40 | |
|---|
| 41 | virtual void rebuild_client_area(const Rect & ) {} |
|---|
| 42 | |
|---|
| 43 | private: |
|---|
| 44 | osg::Vec4 bgcolor_; |
|---|
| 45 | Rect rect_; |
|---|
| 46 | std::string caption_; |
|---|
| 47 | }; |
|---|
| 48 | |
|---|
| 49 | } |
|---|
| 50 | |
|---|
| 51 | #endif |
|---|