|
Revision 6941, 2.3 kB
(checked in by robert, 6 years ago)
|
|
From Martin Lavery and Robert Osfield, Updated examples to use a variation of the MIT License
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | #ifndef FRAME_H_ |
|---|
| 22 | #define FRAME_H_ |
|---|
| 23 | |
|---|
| 24 | #include <osg/Geode> |
|---|
| 25 | #include <osg/Geometry> |
|---|
| 26 | |
|---|
| 27 | namespace osgfxbrowser { |
|---|
| 28 | |
|---|
| 29 | struct Rect { |
|---|
| 30 | float x0, y0, x1, y1; |
|---|
| 31 | Rect() {} |
|---|
| 32 | Rect(float x0_, float y0_, float x1_, float y1_): x0(x0_), y0(y0_), x1(x1_), y1(y1_) {} |
|---|
| 33 | inline float width() const { return x1 - x0; } |
|---|
| 34 | inline float height() const { return y0 - y1; } |
|---|
| 35 | }; |
|---|
| 36 | |
|---|
| 37 | class Frame: public osg::Geode { |
|---|
| 38 | public: |
|---|
| 39 | Frame(); |
|---|
| 40 | Frame(const Frame ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY); |
|---|
| 41 | |
|---|
| 42 | META_Node(osgfxbrowser, Frame); |
|---|
| 43 | |
|---|
| 44 | inline const std::string &getCaption() const { return caption_; } |
|---|
| 45 | inline void setCaption(const std::string &caption) { caption_ = caption; } |
|---|
| 46 | |
|---|
| 47 | inline const osg::Vec4 &getBackgroundColor() const { return bgcolor_; } |
|---|
| 48 | inline void setBackgroundColor(const osg::Vec4 &bgcolor) { bgcolor_ = bgcolor; } |
|---|
| 49 | |
|---|
| 50 | inline const Rect &getRect() const { return rect_; } |
|---|
| 51 | inline void setRect(const Rect &rect) { rect_ = rect; } |
|---|
| 52 | |
|---|
| 53 | static osg::Geometry *build_quad(const Rect &rect, const osg::Vec4 &color, bool shadow = true, float z = 0); |
|---|
| 54 | |
|---|
| 55 | virtual void rebuild(); |
|---|
| 56 | |
|---|
| 57 | protected: |
|---|
| 58 | virtual ~Frame() {} |
|---|
| 59 | Frame &operator()(const Frame &) { return *this; } |
|---|
| 60 | |
|---|
| 61 | virtual void rebuild_client_area(const Rect & ) {} |
|---|
| 62 | |
|---|
| 63 | private: |
|---|
| 64 | osg::Vec4 bgcolor_; |
|---|
| 65 | Rect rect_; |
|---|
| 66 | std::string caption_; |
|---|
| 67 | }; |
|---|
| 68 | |
|---|
| 69 | } |
|---|
| 70 | |
|---|
| 71 | #endif |
|---|