CanvasGTK Class Reference
[Graphics]

Area in a window that can be drawn to using GTK GL. More...

#include <CanvasGTK.hpp>

Inheritance diagram for CanvasGTK:
Canvas

List of all members.

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

Detailed Description

Area in a window that can be drawn to using GTK GL.


Constructor & Destructor Documentation

CanvasGTK ( int  width = CANVAS_WIDTH,
int  height = CANVAS_HEIGHT 
)

Initializes the widget.


Member Function Documentation

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.

See also:
on_button_press_event
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.

Note:
This should usually return true so the event is consumed. That way if one of the arrow keys is pressed GTK doesn't change the focus to another widget.
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.


The documentation for this class was generated from the following files:
Generated on Wed Jun 9 01:36:35 2010 for Gander by  doxygen 1.6.3