Canvas widgets: Difference between revisions

Jump to navigation Jump to search
Line 157: Line 157:
The values are only valid for one single window (coordinates are relative to window origin).
The values are only valid for one single window (coordinates are relative to window origin).


=== Keyboard Handling ===
James was definitely right regarding osgGA: UI processing is really simplified compared to PUI.
Looking at the mouse handling code, the same technique we use for mouse handling could obviously also be used for keyboard handling:
* http://www.openscenegraph.org/documentation/NPSTutorials/osgKeyboardInput.htm
* http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/BasicKeyboardInput
So it just involves checking for osgGA::GUIEventAdapter::KEYDOWN and propagating the events to a handful of child properties for each canvas element that subscribed to keyboard events.
It'd make sense to also use a boolean property to enable/disable reception of keyboard events, that will allow us to set the "focus" of windows and widgets. And then we only need to expose some keyboard-specific events like key-up, key-down, key-value etc at the C++ level, which all boils down to just calling fgSet*Value().
The rest will be handled at the Nasal level, so that users can register their own listeners.
The nice thing is that once this is properly implemented, we'll already have a unified I/O handling system for GUIs, instruments, HUDs etc. and it moves all the implementation details to the base package again.
BTW: There is already a property to toggle the mouse cursor via setprop, so this could also be wrapped in gui.nas, obviously being able to use a canvas texture as the cursor would prove the point that "everything is a canvas" in the design.
=== Multiplatform Clipboard Support (native Copy/Paste) {{Pending}} ===
=== Multiplatform Clipboard Support (native Copy/Paste) {{Pending}} ===
{{Progressbar|60}}
{{Progressbar|60}}

Navigation menu