From Jeremy Moles, updates to osgWidget

Merged my Robert Osfield from OpenSceneGraph-osgWidget-dev.
This commit is contained in:
Robert Osfield
2008-11-28 14:35:33 +00:00
parent d3b2d9b074
commit 9748fdd605
35 changed files with 1234 additions and 639 deletions

View File

@@ -11,8 +11,7 @@
* OpenSceneGraph Public License for more details.
*/
// -*-c++-*- osgWidget - Code by: Jeremy Moles (cubicool) 2007-2008
// $Id: Window 66 2008-07-14 21:54:09Z cubicool $
// Code by: Jeremy Moles (cubicool) 2007-2008
#ifndef OSGWIDGET_WINDOW
#define OSGWIDGET_WINDOW
@@ -73,7 +72,8 @@ class OSGWIDGET_EXPORT Window:
virtual void unmanaged (WindowManager*);
virtual void positioned ();
bool setWindow(Window*);
bool setWindow (Window*);
void updateSizeFromWindow ();
Window* getWindow() {
return _window.get();
@@ -139,7 +139,8 @@ class OSGWIDGET_EXPORT Window:
// This method wraps our Geode's addDrawable() method and returns the index of
// the newly-added Drawable.
unsigned int addDrawableAndGetIndex(osg::Drawable*);
unsigned int addDrawableAndGetIndex (osg::Drawable*);
unsigned int addChildAndGetIndex (osg::Node*);
bool isVisible () const;
bool isXYWithinVisible (float, float) const;
@@ -147,6 +148,7 @@ class OSGWIDGET_EXPORT Window:
void addVisibleArea (int = 0, int = 0, int = 0, int = 0);
bool setFocused (const Widget*);
bool setFocused (const std::string&);
bool grabFocus ();
bool setFirstFocusable ();
bool setNextFocusable ();
bool getFocusList (WidgetList&) const;
@@ -157,7 +159,11 @@ class OSGWIDGET_EXPORT Window:
XYCoord getAbsoluteOrigin () const;
// This method wraps the current Window in a EmbeddedWindow object and returns it.
EmbeddedWindow* embed();
EmbeddedWindow* embed(
const std::string& = "",
Widget::Layer = Widget::LAYER_MIDDLE,
unsigned int = 0
);
Widget* getFocused() {
return _focused.get();
@@ -313,6 +319,14 @@ class OSGWIDGET_EXPORT Window:
_y = y;
}
void setZ(matrix_type z) {
_z = z;
}
void setZRange(matrix_type zRange) {
_zRange = zRange;
}
void setPosition(matrix_type x, matrix_type y, matrix_type z) {
_x = x;
_y = y;
@@ -328,6 +342,10 @@ class OSGWIDGET_EXPORT Window:
_y = y;
}
void setOrigin(const XYCoord& xy) {
setOrigin(xy.x(), xy.y());
}
void setRotate(matrix_type r) {
_r = r;
}
@@ -382,19 +400,19 @@ class OSGWIDGET_EXPORT Window:
}
void attachMoveCallback() {
addCallback(Callback(&callbackWindowMove, EVENT_MOUSE_DRAG));
addCallback(new Callback(&callbackWindowMove, EVENT_MOUSE_DRAG));
}
void attachRotateCallback() {
addCallback(Callback(&callbackWindowRotate, EVENT_MOUSE_DRAG));
addCallback(new Callback(&callbackWindowRotate, EVENT_MOUSE_DRAG));
}
void attachScaleCallback() {
addCallback(Callback(&callbackWindowScale, EVENT_MOUSE_DRAG));
addCallback(new Callback(&callbackWindowScale, EVENT_MOUSE_DRAG));
}
void attachTabFocusCallback() {
addCallback(Callback(&callbackWindowTabFocus, EVENT_KEY_DOWN));
addCallback(new Callback(&callbackWindowTabFocus, EVENT_KEY_DOWN));
}
typedef point_type (Widget::*Getter)() const;