gtkIOStream  1.7.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
DrawingArea Class Reference

#include <DrawingArea.H>

Inheritance diagram for DrawingArea:
[legend]
Collaboration diagram for DrawingArea:
[legend]

Public Member Functions

 DrawingArea (void)
 
 DrawingArea (int width, int height)
 
virtual ~DrawingArea (void)
 
void connectDrawEvent (GCallback callBack, gpointer data)
 
- Public Member Functions inherited from Surface
 Surface ()
 
 Surface (int width, int height)
 
virtual ~Surface (void)
 
GtkWidget * getWidget (void)
 
cairo_surface_t * getSurface (void)
 
void setSurface (cairo_surface_t *surface_)
 
void clear ()
 
- Public Member Functions inherited from Widget
 Widget ()
 Construcotr. More...
 
 Widget (GtkWidget *w)
 
virtual ~Widget ()
 Destructor. More...
 
GtkWidget * ref (void)
 
void unref (void)
 
GtkWidget * show (void)
 
GtkWidget * hide (void)
 
bool getVisible (void)
 
GtkWidget * getWidget (void)
 
bool getSensitive (void)
 
void setSensitive (bool sens)
 
void getSize (int &width, int &height)
 
virtual void setSize (int width, int height)
 
void getLocationSize (int &x, int &y, int &width, int &height)
 
void queueDraw ()
 
GdkWindow * getWindow ()
 
void connect (const char *event, GCallback callback, gpointer data)
 
void connectAfter (const char *event, GCallback callback, gpointer data)
 
void connectExposeEventCallback (GCallback callback, void *data)
 
void connectExposeEventCallback (GtkWidget *w, GCallback callback, void *data)
 
void connectConfigureEventCallback (GCallback callback, void *data)
 
void connectConfigureEventCallback (GtkWidget *w, GCallback callback, void *data)
 
Widgetoperator<< (DragNDrop &dnd)
 
Widgetoperator>> (DragNDrop &dnd)
 

Private Member Functions

void init (void)
 
virtual void move (GtkWidget *widget, gdouble x, gdouble y)
 
virtual void leaveEvent ()
 
virtual void draw (GtkWidget *widget, gdouble x, gdouble y)
 
virtual void erase (GtkWidget *widget, gdouble x, gdouble y)
 

Static Private Member Functions

static gint buttonPressEvent (GtkWidget *widget, GdkEventButton *event, gpointer data)
 
static gint motionNotifyEvent (GtkWidget *widget, GdkEventMotion *event, gpointer data)
 
static gint leaveEventStatic (GtkWidget *widget, GdkEventMotion *event, gpointer data)
 

Additional Inherited Members

- Protected Member Functions inherited from Surface
virtual gboolean configureEvent (GdkEventConfigure *event)
 
virtual bool exposeEvent ()
 
void destroySurface (void)
 
void init (int width, int height)
 
void connectDamagedCallback (GCallback callback, void *data)
 
- Protected Member Functions inherited from Widget
virtual bool checkDropValidity (GtkWidget *w, GtkWidget *sourceWidget, int info, const unsigned char *selectionStoredData)
 
virtual bool dragDataReceived (GtkWidget *w, GtkWidget *sourceWidget, int info, const unsigned char *selectionStoredData, int length)
 
virtual void dragLeave (GtkWidget *w, GtkWidget *sourceWidget)
 
virtual bool dragMotion (GtkWidget *w, GtkWidget *sourceWidget, int x, int y)
 
virtual int chooseTheTargetToUse (GtkWidget *w, GtkWidget *sourceWidget, DragNDrop &dnd)
 
virtual void dragDataGet (GtkWidget *w, GtkSelectionData *selectionData, guint info)
 
virtual void dragDataDelete (GtkWidget *w)
 
virtual void dragBegin (GtkWidget *w)
 
virtual void dragEnd (GtkWidget *w)
 
- Static Protected Member Functions inherited from Surface
static gboolean configureEventStatic (GtkWidget *widget, GdkEventConfigure *event, gpointer data)
 
static gboolean exposeEventStatic (GtkWidget *widget, GdkEventExpose *event, gpointer data)
 
- Protected Attributes inherited from Surface
cairo_surface_t * surface
 The backing surface for the drawing area. More...
 
- Protected Attributes inherited from Widget
GtkWidget * widget
 The container based widget. More...
 

Detailed Description

DrawingArea

This class allows the user to draw within a window by moving the mouse. It uses a backing pixmap to store drawing strokes.

DrawingAreaTest.jpg
Examples:
DrawingAreaTest.C.

Definition at line 29 of file DrawingArea.H.

Constructor & Destructor Documentation

◆ DrawingArea() [1/2]

DrawingArea::DrawingArea ( void  )
inline

Constructor Create a drawing of default size (200 by 200)

Definition at line 152 of file DrawingArea.H.

Here is the call graph for this function:

◆ DrawingArea() [2/2]

DrawingArea::DrawingArea ( int  width,
int  height 
)
inline

Constructor Create a drawing area of particular size

Definition at line 159 of file DrawingArea.H.

Here is the call graph for this function:

◆ ~DrawingArea()

virtual DrawingArea::~DrawingArea ( void  )
inlinevirtual

Destructor

Definition at line 165 of file DrawingArea.H.

Member Function Documentation

◆ buttonPressEvent()

static gint DrawingArea::buttonPressEvent ( GtkWidget *  widget,
GdkEventButton *  event,
gpointer  data 
)
inlinestaticprivate

Handler for when the button is pressed

Parameters
widgetWhich widget the button is pressed in.
eventThe event to handle
dataThe user data which is a pointer to this class.
Returns
TRUE to continue processing the event

Definition at line 37 of file DrawingArea.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ connectDrawEvent()

void DrawingArea::connectDrawEvent ( GCallback  callBack,
gpointer  data 
)
inline

Definition at line 168 of file DrawingArea.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw()

virtual void DrawingArea::draw ( GtkWidget *  widget,
gdouble  x,
gdouble  y 
)
inlineprivatevirtual

Draw a rectangle on the screen

Parameters
widgetThe widget to draw on.
xThe ordinate to draw to.
yThe coordinate to draw to.

Reimplemented in SelectionArea.

Definition at line 110 of file DrawingArea.H.

Here is the caller graph for this function:

◆ erase()

virtual void DrawingArea::erase ( GtkWidget *  widget,
gdouble  x,
gdouble  y 
)
inlineprivatevirtual

Erase a rectangle on the screen

Parameters
widgetThe widget to draw on.
xThe ordinate to draw to.
yThe coordinate to draw to.

Reimplemented in SelectionArea.

Definition at line 133 of file DrawingArea.H.

Here is the caller graph for this function:

◆ init()

void DrawingArea::init ( void  )
inlineprivate

Create a valid drawing area of particular size

Definition at line 81 of file DrawingArea.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ leaveEvent()

virtual void DrawingArea::leaveEvent ( )
inlineprivatevirtual

The mouse has left.

Reimplemented in SelectionArea.

Definition at line 100 of file DrawingArea.H.

Here is the caller graph for this function:

◆ leaveEventStatic()

static gint DrawingArea::leaveEventStatic ( GtkWidget *  widget,
GdkEventMotion *  event,
gpointer  data 
)
inlinestaticprivate

Notifies when the mouse has left the widget.

Definition at line 72 of file DrawingArea.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ motionNotifyEvent()

static gint DrawingArea::motionNotifyEvent ( GtkWidget *  widget,
GdkEventMotion *  event,
gpointer  data 
)
inlinestaticprivate

Definition at line 48 of file DrawingArea.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ move()

virtual void DrawingArea::move ( GtkWidget *  widget,
gdouble  x,
gdouble  y 
)
inlineprivatevirtual

Move the brush. Moves the brush without drawing.

Parameters
widgetThe widget to move the brush on.
xThe ordinate to draw to.
yThe coordinate to draw to.

Reimplemented in SelectionArea.

Definition at line 94 of file DrawingArea.H.

Here is the caller graph for this function:

The documentation for this class was generated from the following file:
gtkIOStream: DrawingArea Class Reference
GTK+ IOStream  Beta