From Jeremy Moles, updates to osgWidget
Merged my Robert Osfield from OpenSceneGraph-osgWidget-dev.
This commit is contained in:
@@ -11,8 +11,7 @@
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
// -*-c++-*- osgWidget - Code by: Jeremy Moles (cubicool) 2007-2008
|
||||
// $Id: WindowManager 66 2008-07-14 21:54:09Z cubicool $
|
||||
// Code by: Jeremy Moles (cubicool) 2007-2008
|
||||
|
||||
#ifndef OSGWIDGET_WINDOW_MANAGER
|
||||
#define OSGWIDGET_WINDOW_MANAGER
|
||||
@@ -40,11 +39,10 @@ typedef osgUtil::LineSegmentIntersector::Intersections Intersections;
|
||||
class OSGWIDGET_EXPORT WindowManager: public osg::Switch, public UIObjectParent<Window> {
|
||||
public:
|
||||
enum WmFlags {
|
||||
WM_USE_LUA = 0x00000001,
|
||||
WM_USE_PYTHON = 0x00000002,
|
||||
WM_PICK_DEBUG = 0x00000004,
|
||||
WM_NO_INVERT_Y = 0x00000008,
|
||||
WM_NO_BETA_WARN = 0x00000010
|
||||
WM_USE_LUA = 0x00000001,
|
||||
WM_USE_PYTHON = 0x00000002,
|
||||
WM_USE_RENDERBINS = 0x00000004,
|
||||
WM_PICK_DEBUG = 0x00000008
|
||||
};
|
||||
|
||||
enum PointerDirection {
|
||||
@@ -91,6 +89,9 @@ class OSGWIDGET_EXPORT WindowManager: public osg::Switch, public UIObjectParent<
|
||||
void setStyleManager (StyleManager*);
|
||||
void resizeAllWindows (bool = true);
|
||||
|
||||
XYCoord windowXY (double, double) const;
|
||||
XYCoord localXY (double, double) const;
|
||||
|
||||
// Methods all called by the ViewerEventHandlers::MouseHandler object, or
|
||||
// by some customer caller of your own. Examples of this to come...
|
||||
bool pointerMove (float, float);
|
||||
@@ -119,8 +120,8 @@ class OSGWIDGET_EXPORT WindowManager: public osg::Switch, public UIObjectParent<
|
||||
return (_flags & WM_USE_PYTHON) != 0;
|
||||
}
|
||||
|
||||
bool isInvertedY() const {
|
||||
return (_flags & WM_NO_INVERT_Y) == 0;
|
||||
bool isUsingRenderBins() const {
|
||||
return (_flags & WM_USE_RENDERBINS) != 0;
|
||||
}
|
||||
|
||||
int getMouseKeysDown() const {
|
||||
@@ -242,6 +243,11 @@ class OSGWIDGET_EXPORT WindowManager: public osg::Switch, public UIObjectParent<
|
||||
_height = h;
|
||||
}
|
||||
|
||||
void setWindowSize(point_type w, point_type h) {
|
||||
_windowWidth = w;
|
||||
_windowHeight = h;
|
||||
}
|
||||
|
||||
// Wrappers around the real calls. These only pertains to mouse buttons,
|
||||
// particularly 3-button mice, although there are other more generic
|
||||
// "pointer" API methods.
|
||||
@@ -282,10 +288,20 @@ class OSGWIDGET_EXPORT WindowManager: public osg::Switch, public UIObjectParent<
|
||||
}
|
||||
};
|
||||
|
||||
// A functor used to sort the Windows by their BinNum component in descending order.
|
||||
struct WindowBinNumberCompare: public std::binary_function<ptr_type, ptr_type, bool> {
|
||||
bool operator()(const ptr_type& x, const ptr_type& y) {
|
||||
return
|
||||
x.get()->getOrCreateStateSet()->getBinNumber() >
|
||||
y.get()->getOrCreateStateSet()->getBinNumber()
|
||||
;
|
||||
}
|
||||
};
|
||||
|
||||
point_type _width;
|
||||
point_type _height;
|
||||
point_type _zNear;
|
||||
point_type _zFar;
|
||||
point_type _windowWidth;
|
||||
point_type _windowHeight;
|
||||
matrix_type _numForeground;
|
||||
matrix_type _numBackground;
|
||||
unsigned int _flags;
|
||||
|
||||
Reference in New Issue
Block a user