From Mathias Froelich, "have done an interface to change the mouse cursor in the X11 graphics

window.
The win32 implementation is still in its original shape since I have no win32
implementation available.

I have chosen the enum approach for the first cut. That is benefitial since
the user does not need to track creation of mouse cursors for different
windows and displays in presence of multiple viewer windows.

The default set of available mouse shapes is the same set that was available
with glut. That set served many OpenGL applications well, so the hope is that
this is enough.

Even though, that implementation is still extensible:
I have digged out the way SDL defines new mouse cursors and added a still
documented out function prototype in the GraphicsWindow that can be used to
extend the current implemtation for arbitrary mouse shapes. That is not
implemented yet.

I hope that somebody with a win32 test system can catch up that implementation
on win32."
This commit is contained in:
Robert Osfield
2007-06-01 19:43:28 +00:00
parent 604bd9b6d7
commit 822868ca31
3 changed files with 139 additions and 42 deletions

View File

@@ -61,8 +61,39 @@ class OSGVIEWER_EXPORT GraphicsWindow : public osg::GraphicsContext, public osgG
/** Get focus on if the pointer is in this window.*/
virtual void grabFocusIfPointerInWindow() { osg::notify(osg::NOTICE)<<"GraphicsWindow::grabFocusIfPointerInWindow(..) not implemented."<<std::endl; }
/** Mouse cursor types, the same ones already present with ancient glut ... */
enum MouseCursor {
InheritCursor,
NoCursor,
RightArrowCursor,
LeftArrowCursor,
InfoCursor,
DestroyCursor,
HelpCursor,
CycleCursor,
SprayCursor,
WaitCursor,
TextCursor,
CrosshairCursor,
UpDownCursor,
LeftRightCursor,
TopSideCursor,
BottomSideCursor,
LeftSideCursor,
RightSideCursor,
TopLeftCorner,
TopRightCorner,
BottomRightCorner,
BottomLeftCorner
};
/** Switch on/off the cursor.*/
virtual void useCursor(bool /*cursorOn*/) { osg::notify(osg::NOTICE)<<"GraphicsWindow::useCursor(..) not implemented."<<std::endl; }
virtual void useCursor(bool cursorOn) { setCursor(cursorOn ? InheritCursor : NoCursor); }
/** Set mouse cursor to a specific shape.*/
virtual void setCursor(MouseCursor /*mouseCursor*/) { osg::notify(osg::NOTICE)<<"GraphicsWindow::setCursor(..) not implemented."<<std::endl; }
/** Create a new mouse cursor from the usual bitmap data.*/
//virtual MouseCursor createCursor(const char *data, const char *mask, unsigned w, unsigned h, unsigned hotx, unsigned hoty) { osg::notify(osg::NOTICE)<<"GraphicsWindow::createCursor(..) not implemented."<<std::endl; }
public: