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

#include <SelectionArea.H>

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

Public Member Functions

 SelectionArea ()
 Constructor. More...
 
 SelectionArea (float boxWidth, float boxHeight)
 
virtual ~SelectionArea ()
 Destructor. More...
 
virtual void reDrawBoxes (cairo_t *cr)
 
CairoBox getStaticBox (void)
 
void centerStaticBox (void)
 
virtual bool expose ()
 
void setBoxWidths (int width)
 
void setBoxHeights (int height)
 
void setBoxsWidthHeight (int width, int height)
 
void keepAspectRatio (bool kAR)
 
void setStaticXY (float x, float y)
 
- Public Member Functions inherited from DrawingArea
 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 clearMovingBox (cairo_t *cr)
 
void clearBoxes (cairo_t *cr)
 Reraw the backing pixmap as appropriate. More...
 
virtual void move (GtkWidget *widget, gdouble x, gdouble y)
 
virtual void draw (GtkWidget *widget, gdouble x, gdouble y)
 
virtual void erase (GtkWidget *widget, gdouble x, gdouble y)
 
virtual void reSize (GtkWidget *widget, gdouble xIn, gdouble yIn)
 
virtual void leaveEvent ()
 
void init (float w, float h)
 

Private Attributes

CairoBox staticBox
 The box which is drawn on the mouse click. More...
 
CairoBox movingBox
 The box which highlights the current hover point. More...
 
ColourLineSpec backgroundColour
 The colour of the background. More...
 
ColourLineSpec staticColour
 The colour of the static button clicked box. More...
 
ColourLineSpec movingColour
 The colour of the static button clicked box. More...
 
cairo_surface_t * staticSurface
 The original pixmap rectangle for the static box. More...
 
cairo_surface_t * movingSurface
 The original pixmap rectangle for the moving box. More...
 
bool constrainAspectRatio
 If set, then retain the aspect ratio when setting the width or height. More...
 

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

Overloads the DrawingArea methods to show a moving selection box in a pixmap. Draws on the widget rather then the backing pixmap. This class is used to show a moving selection box (movingBox) when the mouse moves over the drawing area. When the user presses the button, then the static selection box (staticBox) is shown at the selected location.

SelectionAreaTest.png
Examples:
SelectionAreaTest.C.

Definition at line 38 of file SelectionArea.H.

Constructor & Destructor Documentation

◆ SelectionArea() [1/2]

SelectionArea::SelectionArea ( )
inline

Constructor.

Definition at line 182 of file SelectionArea.H.

Here is the call graph for this function:

◆ SelectionArea() [2/2]

SelectionArea::SelectionArea ( float  boxWidth,
float  boxHeight 
)
inline

Construct give box dimensions.

Parameters
boxWidthThe rectangular selection window width.
boxHeightThe rectangular selection window height.

Definition at line 190 of file SelectionArea.H.

Here is the call graph for this function:

◆ ~SelectionArea()

virtual SelectionArea::~SelectionArea ( )
inlinevirtual

Destructor.

Definition at line 196 of file SelectionArea.H.

Member Function Documentation

◆ centerStaticBox()

void SelectionArea::centerStaticBox ( void  )
inline

Move the static box to the centre of the image.

Definition at line 225 of file SelectionArea.H.

Here is the call graph for this function:

◆ clearBoxes()

void SelectionArea::clearBoxes ( cairo_t *  cr)
inlineprivate

Reraw the backing pixmap as appropriate.

Definition at line 65 of file SelectionArea.H.

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

◆ clearMovingBox()

void SelectionArea::clearMovingBox ( cairo_t *  cr)
inlineprivate

Clear only the moving box. Also sets up the source surface.

Definition at line 54 of file SelectionArea.H.

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

◆ draw()

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

Draw the static box on the screen. Redraw the backing pixmap and then the staticBox.

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

Reimplemented from DrawingArea.

Definition at line 100 of file SelectionArea.H.

Here is the call graph for this function:

◆ erase()

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

DrawingArea::erase is mapped to reSize Redraw the backing pixmap and then the staticBox.

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

Reimplemented from DrawingArea.

Definition at line 124 of file SelectionArea.H.

Here is the call graph for this function:

◆ expose()

virtual bool SelectionArea::expose ( )
inlinevirtual

On the expose event ensure that the boxes are redrawn.

Definition at line 237 of file SelectionArea.H.

Here is the call graph for this function:

◆ getStaticBox()

CairoBox SelectionArea::getStaticBox ( void  )
inline

Get a copy of the staticBox.

Returns
A copy of the staticBox
Examples:
SelectionAreaTest.C.

Definition at line 219 of file SelectionArea.H.

◆ init()

void SelectionArea::init ( float  w,
float  h 
)
inlineprivate

Initialise the member variables. constrainAspectRation is false, allowing arbitrary changes in width and height. The moving box colour is orange and the static box colour is red.

Parameters
wThe width of the rectangles
hThe height of the rectangles

Definition at line 170 of file SelectionArea.H.

Here is the call graph for this function:

◆ keepAspectRatio()

void SelectionArea::keepAspectRatio ( bool  kAR)
inline

Set whether the keep the aspect ratio (constrainAspectRatio).

Parameters
kARTrue to maintain and false to allow widths and heights to change as they wish.
Examples:
SelectionAreaTest.C.

Definition at line 333 of file SelectionArea.H.

◆ leaveEvent()

virtual void SelectionArea::leaveEvent ( )
inlineprivatevirtual

When the mouse leaves, clear the movingBox, and put it off screen but not the staticBox.

Reimplemented from DrawingArea.

Definition at line 156 of file SelectionArea.H.

Here is the call graph for this function:

◆ move()

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

Move the movingBox. Redraw the backing pixmap region of the last box and then draw the box on the widget.

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

Reimplemented from DrawingArea.

Definition at line 76 of file SelectionArea.H.

Here is the call graph for this function:

◆ reDrawBoxes()

virtual void SelectionArea::reDrawBoxes ( cairo_t *  cr)
inlinevirtual

Refresh (redraw) the static and mooving boxes.

Parameters
crthe cairo context to draw in.

Definition at line 208 of file SelectionArea.H.

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

◆ reSize()

virtual void SelectionArea::reSize ( GtkWidget *  widget,
gdouble  xIn,
gdouble  yIn 
)
inlineprivatevirtual

resize the boxes on the screen. Redraw the backing pixmap and then the staticBox.

Parameters
widgetThe widget to draw on.
xInThe ordinate for finding the new width size.
yInThe coordinate for finding the new height size.

Definition at line 134 of file SelectionArea.H.

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

◆ setBoxHeights()

void SelectionArea::setBoxHeights ( int  height)
inline

Resize the moving and static box's height

Parameters
heightThe new height.
Examples:
SelectionAreaTest.C.

Definition at line 270 of file SelectionArea.H.

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

◆ setBoxsWidthHeight()

void SelectionArea::setBoxsWidthHeight ( int  width,
int  height 
)
inline

Resize the moving and static box's width and height

Parameters
widthThe new width.
heightThe new height.
Examples:
SelectionAreaTest.C.

Definition at line 294 of file SelectionArea.H.

Here is the call graph for this function:

◆ setBoxWidths()

void SelectionArea::setBoxWidths ( int  width)
inline

Resize the moving and static box's width

Parameters
widthThe new width.
Examples:
SelectionAreaTest.C.

Definition at line 247 of file SelectionArea.H.

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

◆ setStaticXY()

void SelectionArea::setStaticXY ( float  x,
float  y 
)
inline

Set the static box's X and Y locations.

Parameters
xThe x location of the static box
yThe y location of the static box

Definition at line 341 of file SelectionArea.H.

Here is the call graph for this function:

Member Data Documentation

◆ backgroundColour

ColourLineSpec SelectionArea::backgroundColour
private

The colour of the background.

Definition at line 42 of file SelectionArea.H.

◆ constrainAspectRatio

bool SelectionArea::constrainAspectRatio
private

If set, then retain the aspect ratio when setting the width or height.

Definition at line 49 of file SelectionArea.H.

◆ movingBox

CairoBox SelectionArea::movingBox
private

The box which highlights the current hover point.

Definition at line 40 of file SelectionArea.H.

◆ movingColour

ColourLineSpec SelectionArea::movingColour
private

The colour of the static button clicked box.

Definition at line 44 of file SelectionArea.H.

◆ movingSurface

cairo_surface_t* SelectionArea::movingSurface
private

The original pixmap rectangle for the moving box.

Definition at line 47 of file SelectionArea.H.

◆ staticBox

CairoBox SelectionArea::staticBox
private

The box which is drawn on the mouse click.

Definition at line 39 of file SelectionArea.H.

◆ staticColour

ColourLineSpec SelectionArea::staticColour
private

The colour of the static button clicked box.

Definition at line 43 of file SelectionArea.H.

◆ staticSurface

cairo_surface_t* SelectionArea::staticSurface
private

The original pixmap rectangle for the static box.

Definition at line 46 of file SelectionArea.H.


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