|
gltk
0.3
a C++ widget library built on GLUT
|
A visual component. More...
#include <widget.hh>
Public Member Functions | |
| void | size_allocate (int x, int y, int width, int height) |
| allocate a size in parent's coordinates | |
| void | move_allocate (int x, int y) |
| change position of the widget within parent | |
| bool | contains (int x, int y) const |
| check if the widget area contains the point | |
| void | draw () |
| draw the widget | |
| void | show () |
| mark the widget visible | |
| void | hide () |
| mark the widget hidden | |
| void | make_focus () |
| make this widget the receiver of keyboard input | |
| void | button_event (int button, int state, int x, int y) |
| notify Widget of button action | |
| void | motion_event (int x, int y) |
| notify Widget of button grabbed mouse motion | |
| bool | keyboard_event (unsigned char key) |
| notify Widget of key press, return whether the key is processed | |
| bool | special_event (int key) |
| notify Widget of special key | |
| void | passive_event (int x, int y) |
| notify of ungrabbed mouse motion | |
| void | entry_event (bool enterred) |
| mouse enter or leave the Widget | |
| void | set_grabbing (bool v=true) |
| grab the mouse button hold | |
| bool | get_realized () const |
| if the Widget is realized | |
| int | get_shown () const |
| whether the Widget is marked visible | |
| int | get_width () const |
| width of allocated area | |
| int | get_height () const |
| height of allocated area | |
| void | get_absolute (int &x, int &y) const |
| get absolute coordinates in glutWindow | |
| void | queue_draw () |
| mark for re-draw | |
| void | queue_resize () |
| mark to renegotiate size | |
Geometry & Focus | |
used by Container to manage children | |
| virtual void | get_preferred_height (int &min, int &nat) const |
| obtain minimum & natural heights | |
| virtual void | get_preferred_height_for_width (int width, int &min, int &nat) const |
| obtain minimum & natural heights for given width | |
| virtual void | get_preferred_width (int &min, int &nat) const |
| obtain minimum & natural widths | |
| virtual void | get_preferred_width_for_height (int height, int &min, int &nat) const |
| obtain minimum & natural widths for given height | |
| virtual bool | focus_make () |
| make this Widget the focus | |
| virtual bool | focus_next () |
| shift to next focus, if N/A, return false and starts over | |
| virtual void | focus_end () |
| end the focus | |
Protected Member Functions | |
| virtual void | on_set_parent (Container *p) |
| parent is changed | |
| virtual void | on_set_window (Window *window) |
| window root is set | |
| virtual void | on_realize () |
| called when Widget is realized | |
| virtual void | on_unrealize () |
| called when Widget is unrealized | |
| virtual void | on_draw () |
| called to implement draw | |
| virtual void | on_size_allocate (int width, int height) |
| called when size is given | |
| virtual void | on_configure_event () |
| called when the window configuration is changed | |
| virtual void | on_button_event (int button, int state, int x, int y) |
| called for mouse button | |
| virtual void | on_motion_event (int x, int y) |
| called for grabbed movement | |
| virtual void | on_passive_event (int x, int y) |
| called for non-grabbed movement | |
| virtual bool | on_key_event (unsigned char key) |
| called for key press | |
| virtual bool | on_special_event (int key) |
| called for special key | |
| virtual void | on_entry_event (bool entered) |
| called when pointer enter/leave | |
| virtual void | on_show () |
| called when shown | |
| virtual void | on_hide () |
| called when hidden | |
| virtual bool | get_focus () |
| get focus from parent, overriden by Window | |
A visual component.
Widgets can be put in a Container which manages their layout. The states of a Widget is a combination of:
realized: has an actual window with associated context
configured: assigned a position and size within its parent's coodinate system
shown: additional visibility control
A Widget can be shown or hidden.