Area in a window that can be drawn to using GTK GL. More...
#include <CanvasGTK.hpp>
Public Member Functions | |
CanvasGTK (int width=CANVAS_WIDTH, int height=CANVAS_HEIGHT) | |
virtual void | flush () |
virtual bool | on_expose_event (GdkEventExpose *event) |
virtual void | on_realize () |
virtual bool | on_button_press_event (GdkEventButton *event) |
virtual bool | on_button_release_event (GdkEventButton *event) |
virtual bool | on_idle () |
virtual bool | on_key_press_event (GdkEventKey *event) |
virtual bool | on_map_event (GdkEventAny *event) |
virtual bool | on_motion_notify_event (GdkEventMotion *event) |
virtual bool | on_scroll_event (GdkEventScroll *event) |
virtual void | primeStart () |
virtual void | primeFinish () |
virtual void | refresh () |
virtual void | setAutomaticallyRefresh (bool automaticallyRefresh) |
virtual void | write (const string &text, int x=15, int y=30) |
Protected Member Functions | |
void | begin () |
void | end () |
void | connectIdle () |
void | disconnectIdle () |
void | updateModifer (guint state) |
Private Attributes | |
Gdk::GL::ConfigMode | mode |
Glib::RefPtr< Gdk::GL::Context > | glContext |
Glib::RefPtr< Gdk::GL::Config > | glConfig |
Glib::RefPtr< Gdk::GL::Drawable > | glDrawable |
Glib::RefPtr< Gdk::GL::Window > | glWindow |
Glib::RefPtr< Gdk::Window > | window |
Typeface | typeface |
sigc::connection | idle |
Area in a window that can be drawn to using GTK GL.
CanvasGTK | ( | int | width = CANVAS_WIDTH , |
|
int | height = CANVAS_HEIGHT | |||
) |
Initializes the widget.
void begin | ( | ) | [inline, protected] |
Signal start of OpenGL commands.
void end | ( | ) | [inline, protected] |
Signal end of OpenGL commands.
void flush | ( | ) | [inline, virtual] |
Forces the canvas to push all the pixels to the screen.
Implements Canvas.
bool on_button_press_event | ( | GdkEventButton * | event | ) | [virtual] |
When a mouse button is pressed.
Consider having it call grab_focus() so key presses will affect it.
Important parts of GdkEventButton are: button Button that was pressed (1-left, 2-middle, 3-right) x X location of the pointer relative to the widget y Y location of the pointer relative to the widget (top=0) state Bitmask state of modifier keys and buttons (GdkModifierType)
bool on_button_release_event | ( | GdkEventButton * | event | ) | [virtual] |
When a mouse button is released.
bool on_expose_event | ( | GdkEventExpose * | event | ) | [virtual] |
Widget needs to be redrawn.
bool on_key_press_event | ( | GdkEventKey * | event | ) | [virtual] |
When a key is pressed.
bool on_motion_notify_event | ( | GdkEventMotion * | event | ) | [virtual] |
When the mouse moves in the widget.
Because there is no distinct dragging event, we just return if no button is pressed. Because here we're listening for both button_press and button_release events and keeping track of the mouse state on each one, we could just use that.
Also, to avoid some unintened drags, we return if not enough time has passed between when the mouse was clicked and when the mouse is moved. The value could be adjusted depending on your taste.
Lastly, if the user drags past the widget boundaries the widget will still receive the values. For that reason this method may receive values outside of its allocation. In fact, if the user moves above or to the left of the widget it will receive negative values.
Important parts of GdkEventMotion are: x X location of the pointer relative to the widget y Y location of the pointer relative to the widget (top=0) state Bitmask state of modifier keys and buttons (GdkModifierType)
void on_realize | ( | ) | [virtual] |
Initializes OpenGL.
bool on_scroll_event | ( | GdkEventScroll * | event | ) | [virtual] |
When the user scrolls the mouse wheel in the widget.
Important parts of GdkEventScroll are: direction One of GDK_SCROLL_{UP|DOWN|LEFT|RIGHT} state Bitmask state of modifier keys and buttons (GdkModifierType)
void primeFinish | ( | ) | [inline, virtual] |
Allows the client to declare its setup is finished.
Implements Canvas.
void primeStart | ( | ) | [inline, virtual] |
Allows the client to do some setup before starting the canvas.
Implements Canvas.
void refresh | ( | ) | [inline, virtual] |
Forces the canvas to be redrawn.
Implements Canvas.
void setAutomaticallyRefresh | ( | bool | automaticallyRefresh | ) | [virtual] |
Determines if events should be continuously sent to display listeners.
Implements Canvas.
void updateModifer | ( | guint | state | ) | [protected] |
Assigns the modifer according to the state of a GDK event.