gtkIOStream  1.6.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Widget Class Reference

#include <Widget.H>

Inheritance diagram for Widget:
[legend]

Public Member Functions

 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)
 

Protected Member Functions

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)
 

Protected Attributes

GtkWidget * widget
 The container based widget. More...
 

Private Member Functions

virtual void dragUnhighlight (GtkWidget *w)
 
virtual void dragHighlight (GtkWidget *w)
 

Static Private Member Functions

static void dragDataReceivedStatic (GtkWidget *w, GdkDragContext *dragContext, gint x, gint y, GtkSelectionData *selectionData, guint info, guint time, gpointer data)
 
static void dragLeaveStatic (GtkWidget *w, GdkDragContext *dragContext, guint time, gpointer data)
 
static gboolean dragMotionStatic (GtkWidget *w, GdkDragContext *dragContext, gint x, gint y, guint time, gpointer data)
 
static bool dragDropStatic (GtkWidget *w, GdkDragContext *dragContext, gint x, gint y, guint time, gpointer data)
 
static void dragDataGetStatic (GtkWidget *w, GdkDragContext *dragContext, GtkSelectionData *selectionData, guint info, guint time, gpointer data)
 
static void dragDataDeleteStatic (GtkWidget *w, GdkDragContext *dragContext, gpointer data)
 
static void dragBeginStatic (GtkWidget *w, GdkDragContext *dragContext, gpointer data)
 
static void dragEndStatic (GtkWidget *w, GdkDragContext *dragContext, gpointer data)
 

Detailed Description

Encapsulates the GtkWidget object

Examples:
DragNDropNowindowTest.C, DragNDropSimpleTest.C, DragNDropTest.C, and WidgetTest.C.

Definition at line 31 of file Widget.H.

Constructor & Destructor Documentation

Widget::Widget ( )
inline

Construcotr.

Definition at line 36 of file Widget.H.

Here is the caller graph for this function:

Widget::Widget ( GtkWidget *  w)
inline

Construct this class given a widget.

Parameters
wThe widget to use.

Definition at line 43 of file Widget.H.

virtual Widget::~Widget ( )
inlinevirtual

Destructor.

Definition at line 47 of file Widget.H.

Member Function Documentation

virtual bool Widget::checkDropValidity ( GtkWidget *  w,
GtkWidget *  sourceWidget,
int  info,
const unsigned char *  selectionStoredData 
)
inlineprotectedvirtual

Executed when a motion even requests knowledge from dragDataReceivedStatic as to whether the data is valid or not.

Parameters
wthe GtkWidget which is the destination of the drag.
infothe info that has been registered with the target in the GtkTargetList.
selectionStoredDataThe raw data which is sent by the other side, cast to a unsigned char pointer.
Returns
true if the data will be accepted or false on failure

Definition at line 530 of file Widget.H.

virtual int Widget::chooseTheTargetToUse ( GtkWidget *  w,
GtkWidget *  sourceWidget,
DragNDrop dnd 
)
inlineprotectedvirtual

Executed when the target is dropped. This method specifies which target of all of the known targets to use. If there are zero known targets, the error is returned. If there is only one target, it is returned. Otherwise, you must overload this method. If you overload this method, be sure to check for and return <0 when the known target list is empty, like so :

if (dnd.size()==0) // if there are no known targets, report error.
if (dnd.size()==1) // There can be only one
return 0;
Parameters
wthe GtkWidget which is the destination of the drag.
sourceWidgetThe widget being dragged.
dndThe drag and drop data contexts
Returns
the number matching the desired target data record from the DragNDrop::targets class. Returns <0 on error.

Reimplemented in JackBaseWithPortNamesGui.

Definition at line 582 of file Widget.H.

Here is the call graph for this function:

Here is the caller graph for this function:

void Widget::connect ( const char *  event,
GCallback  callback,
gpointer  data 
)
inline

Connect a signal callback.

Parameters
eventthe signal to generate the callback e.g. "expose-event"
callbackthe callback to call
datathe user data to pass to the callback

Definition at line 224 of file Widget.H.

Here is the caller graph for this function:

void Widget::connectAfter ( const char *  event,
GCallback  callback,
gpointer  data 
)
inline

Connect a signal callback after the other callbacks have run.

Parameters
eventthe signal to generate the callback e.g. "expose-event"
callbackthe callback to call
datathe user data to pass to the callback

Definition at line 233 of file Widget.H.

Here is the caller graph for this function:

void Widget::connectConfigureEventCallback ( GCallback  callback,
void *  data 
)
inline

Connect a callback function for when the widget is configured. This includes size, position and stacking changes.

Your expose event should be of the following definition : static gboolean callback(GtkWidget *widget, GdkEventConfigure *event, gpointer data);

The callback returns true to stop/complete processing of the expose signal or false to continue.

Parameters
callbackThe callback to execute
dataThe user data to pass to the callback

Definition at line 270 of file Widget.H.

Here is the caller graph for this function:

void Widget::connectConfigureEventCallback ( GtkWidget *  w,
GCallback  callback,
void *  data 
)
inline

Connect a callback function for when the widget is configured. This includes size, position and stacking changes.

Your expose event should be of the following definition : static gboolean callback(GtkWidget *widget, GdkEventConfigure *event, gpointer data);

The callback returns true to stop/complete processing of the expose signal or false to continue.

Parameters
wThe widget to connect the signal handler to.
callbackThe callback to execute
dataThe user data to pass to the callback

Definition at line 283 of file Widget.H.

void Widget::connectExposeEventCallback ( GCallback  callback,
void *  data 
)
inline

Connect a callback function for when the widget is exposed.

Your expose event should be of the following definition : static gboolean callback(GtkWidget *widget, GdkEventExpose *event, gpointer data);

The callback returns true to stop/complete processing of the expose signal or false to continue.

Parameters
callbackThe callback to execute
dataThe user data to pass to the callback

Definition at line 245 of file Widget.H.

Here is the caller graph for this function:

void Widget::connectExposeEventCallback ( GtkWidget *  w,
GCallback  callback,
void *  data 
)
inline

Connect a callback function for when the widget is exposed.

Your expose event should be of the following definition : static gboolean callback(GtkWidget *widget, GdkEventExpose *event, gpointer data);

The callback returns true to stop/complete processing of the expose signal or false to continue.

Parameters
wThe widget to connect the signal handler to.
callbackThe callback to execute
dataThe user data to pass to the callback

Definition at line 258 of file Widget.H.

virtual void Widget::dragBegin ( GtkWidget *  w)
inlineprotectedvirtual

Executed on the drag source when a drag is started. A typical reason to connect to this signal is to set up a custom drag icon with gtk_drag_source_set_icon().

Parameters
wthe object which is the source of the drag.

Definition at line 621 of file Widget.H.

Here is the caller graph for this function:

static void Widget::dragBeginStatic ( GtkWidget *  w,
GdkDragContext *  dragContext,
gpointer  data 
)
inlinestaticprivate

Executed on the drag source when a drag is started. A typical reason to connect to this signal is to set up a custom drag icon with gtk_drag_source_set_icon().

Parameters
wthe object which is the source of the drag.
dragContextthe drag context.
datauser data set when the signal handler was connected, typically the widget which executed the operator>>

Definition at line 506 of file Widget.H.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void Widget::dragDataDelete ( GtkWidget *  w)
inlineprotectedvirtual

Executed for deleting the data that has been dropped. Overload this method to execute something when something has to change to your application once the data has been successfully dropped.

Parameters
wthe object which is the source of the drag.

Definition at line 613 of file Widget.H.

Here is the caller graph for this function:

static void Widget::dragDataDeleteStatic ( GtkWidget *  w,
GdkDragContext *  dragContext,
gpointer  data 
)
inlinestaticprivate

Executed for deleting the data that has been dropped.

Parameters
wthe object which is sending the data.
dragContextthe drag context.
datauser data set when the signal handler was connected, typically the widget which executed the operator>>

Definition at line 495 of file Widget.H.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void Widget::dragDataGet ( GtkWidget *  w,
GtkSelectionData *  selectionData,
guint  info 
)
inlineprotectedvirtual

Overload this to allow your source to send data. This method is executed when the destination requests the data. You can send data by loading in to the selectionData using one of the gtk_selection_data_set methods, which include the following functions : gtk_selection_data_set, gtk_selection_data_set_text, gtk_selection_data_set_pixbuf, gtk_selection_data_set_uris. Executed by the drag source when the drop site requests the data which is dragged. It fulls the selectionData. An example use of the function is :

gtk_selection_data_set(selectionData, gtk_selection_data_get_target(selectionData), sizeof(gunsigned char), (gunsigned char*) string_data, strlen(string_data));
Parameters
wthe object which is the source of the drag.
selectionDatathe data to send.
infothe info that has been registered with the target in the GtkTargetList.

Reimplemented in ClientIOGui.

Examples:
DragNDropTest.C.

Definition at line 605 of file Widget.H.

Here is the caller graph for this function:

static void Widget::dragDataGetStatic ( GtkWidget *  w,
GdkDragContext *  dragContext,
GtkSelectionData *  selectionData,
guint  info,
guint  time,
gpointer  data 
)
inlinestaticprivate

Executed by the drag source when the drop site requests the data which is dragged. It fulls the selectionData.

Parameters
wthe object which is sending the data.
dragContextthe drag context.
selectionDatathe data to send.
infothe info that has been registered with the target in the GtkTargetList.
timethe time stamp at which the data was requested.
datauser data set when the signal handler was connected, typically the widget which executed the operator>>

Definition at line 484 of file Widget.H.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool Widget::dragDataReceived ( GtkWidget *  w,
GtkWidget *  sourceWidget,
int  info,
const unsigned char *  selectionStoredData,
int  length 
)
inlineprotectedvirtual

Executed when the user drops and completes. You must overload this method to execute on the data passed during the drop.

Parameters
wthe GtkWidget which is the destination of the drag.
infothe info that has been registered with the target in the GtkTargetList.
selectionStoredDataThe raw data which is sent by the other side, cast to a unsigned char pointer.
lengthThe length of the stored data
Returns
true on success or false on failure

Reimplemented in JackBaseWithPortNamesGui.

Examples:
DragNDropTest.C.

Definition at line 542 of file Widget.H.

Here is the caller graph for this function:

static void Widget::dragDataReceivedStatic ( GtkWidget *  w,
GdkDragContext *  dragContext,
gint  x,
gint  y,
GtkSelectionData *  selectionData,
guint  info,
guint  time,
gpointer  data 
)
inlinestaticprivate

Executed on the drop site when the dragged data has been received. Also executed when a drag motion event requests knowledge on whether the drop will be accepted successfully or not.

Parameters
wthe GtkWidget which is the destination of the drag.
dragContextthe drag context.
xwhere the drop happened.
ywhere the drop happened.
selectionDatathe received data.
infothe info that has been registered with the target in the GtkTargetList.
timethe timestamp at which the data was received.
datauser data set when the signal handler was connected, typically the widget which executed the operator<<

Definition at line 346 of file Widget.H.

Here is the call graph for this function:

Here is the caller graph for this function:

static bool Widget::dragDropStatic ( GtkWidget *  w,
GdkDragContext *  dragContext,
gint  x,
gint  y,
guint  time,
gpointer  data 
)
inlinestaticprivate

Executed when the user drops the data onto the widget. The user must determine whether is has been dropped onto a suitable drop zone.

Parameters
wthe GtkWidget which is the destination of the drag.
dragContextthe drag context.
xwhere the drop happened.
ywhere the drop happened.
timethe timestamp at which the data was received.
datauser data set when the signal handler was connected, typically the widget which executed the operator<<
Returns
true if in the drop zone, valid data and to be accepted, false otherwise.

Definition at line 450 of file Widget.H.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void Widget::dragEnd ( GtkWidget *  w)
inlineprotectedvirtual

Executed on the drag source when a drag is finished. A typical reason to connect to this signal is to undo things done in dragBegin.

Parameters
wthe object which is the source of the drag.

Definition at line 629 of file Widget.H.

Here is the caller graph for this function:

static void Widget::dragEndStatic ( GtkWidget *  w,
GdkDragContext *  dragContext,
gpointer  data 
)
inlinestaticprivate

Executed on the drag source when a drag is finished. A typical reason to connect to this signal is to undo things done in dragBegin.

Parameters
wthe object which is the source of the drag.
dragContextthe drag context.
datauser data set when the signal handler was connected, typically the widget which executed the operator>>

Definition at line 517 of file Widget.H.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void Widget::dragHighlight ( GtkWidget *  w)
inlineprivatevirtual

Executed when the widget must be highlighted.

Parameters
wthe GtkWidget which is the destination of the drag.

Definition at line 433 of file Widget.H.

Here is the caller graph for this function:

virtual void Widget::dragLeave ( GtkWidget *  w,
GtkWidget *  sourceWidget 
)
inlineprotectedvirtual

Executed when the cursor leaves the drop widget. A typical reason to execute this method is to undo things executed in dragMotion.

Parameters
wthe GtkWidget which is the destination of the drag.

Definition at line 551 of file Widget.H.

Here is the caller graph for this function:

static void Widget::dragLeaveStatic ( GtkWidget *  w,
GdkDragContext *  dragContext,
guint  time,
gpointer  data 
)
inlinestaticprivate

Executed when the cursor leaves the drop widget. A typical reason to exectue this method is to undo things executed in dragMotionStatic.

Parameters
wthe GtkWidget which is the destination of the drag.
dragContextthe drag context.
timethe timestamp at which the data was received.
datauser data set when the signal handler was connected, typically the widget which executed the operator<<

Definition at line 388 of file Widget.H.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool Widget::dragMotion ( GtkWidget *  w,
GtkWidget *  sourceWidget,
int  x,
int  y 
)
inlineprotectedvirtual

Executed to work out whether the drop action will be successful or not based on current location and the user data. This is currently executed when the user drops the widget on the target.

Parameters
wthe GtkWidget which is the destination of the drag.
xwhere the drop happened.
ywhere the drop happened.
Returns
true if in the drop zone and to be accepted. false otherwise and no more processing.

Definition at line 562 of file Widget.H.

Here is the caller graph for this function:

static gboolean Widget::dragMotionStatic ( GtkWidget *  w,
GdkDragContext *  dragContext,
gint  x,
gint  y,
guint  time,
gpointer  data 
)
inlinestaticprivate

Executed when the user moves the cursor over the drop widget during a drag.

Parameters
wthe GtkWidget which is the destination of the drag.
dragContextthe drag context.
xwhere the drop happened.
ywhere the drop happened.
timethe timestamp at which the data was received.
datauser data set when the signal handler was connected, typically the widget which executed the operator<<
Returns
true if in the drop zone and to be accepted. false otherwise and no more processing.

Definition at line 413 of file Widget.H.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void Widget::dragUnhighlight ( GtkWidget *  w)
inlineprivatevirtual

Executed when the widget must be 'unhighlighted'.

Parameters
wthe GtkWidget which is the destination of the drag.

Definition at line 397 of file Widget.H.

Here is the caller graph for this function:

void Widget::getLocationSize ( int &  x,
int &  y,
int &  width,
int &  height 
)
inline

Find the widgets location and size.

Parameters
[out]xThe x location
[out]yThe y location
[out]widthThe width
[out]heightThe height

Definition at line 142 of file Widget.H.

Here is the caller graph for this function:

bool Widget::getSensitive ( void  )
inline

Set whether the widget is sensitive or not.

Returns
True if sensitive or false if not.

Definition at line 98 of file Widget.H.

void Widget::getSize ( int &  width,
int &  height 
)
inline

Find the prefered size of the widget.

Parameters
[out]widththe width of the widget
[out]heightthe height of the widget
Examples:
SelectionAreaTest.C.

Definition at line 113 of file Widget.H.

Here is the caller graph for this function:

bool Widget::getVisible ( void  )
inline

Find whether a widget is visible.

Returns
true if visible, false if not.

Definition at line 80 of file Widget.H.

GtkWidget* Widget::getWidget ( void  )
inline

Method to get the GtkWidget

Returns
box The box GtkWidget
Examples:
AlignmentTest.C, CairoArrowTest.C, MessageDialogTest.C, NeuralNetworkFnTest.C, PlotTest.C, PlotTest2.C, ProgressBarTest.C, and ScaleTest.C.

Definition at line 91 of file Widget.H.

Here is the caller graph for this function:

GdkWindow* Widget::getWindow ( )
inline

Get the parent window of the widget

Definition at line 159 of file Widget.H.

Here is the caller graph for this function:

GtkWidget* Widget::hide ( void  )
inline

Method to hide the widget.

Returns
box the GtkWidget* to the box

Definition at line 72 of file Widget.H.

Widget& Widget::operator<< ( DragNDrop dnd)
inline

Make this widget a destination by adding a set of drag and drop targets to this widget. This widget becomes a drag and drop destination (sink)

Parameters
dndThe DragNDrop class specifying the set of targets.

Definition at line 293 of file Widget.H.

Here is the call graph for this function:

Widget& Widget::operator>> ( DragNDrop dnd)
inline

Make this widget a source by adding a set of drag and drop targets to this widget. This widget becomes a drag and drop source

Parameters
dndThe DragNDrop class specifying the set of targets.

Definition at line 318 of file Widget.H.

Here is the call graph for this function:

void Widget::queueDraw ( )
inline

queue the widget for redrawing

Definition at line 153 of file Widget.H.

GtkWidget* Widget::ref ( void  )
inline

Add a reference to the widget

Definition at line 51 of file Widget.H.

Here is the caller graph for this function:

void Widget::setSensitive ( bool  sens)
inline

Set whether the widget is sensitive or not.

Parameters
sensTrue if sensitive or false if not.

Definition at line 105 of file Widget.H.

virtual void Widget::setSize ( int  width,
int  height 
)
inlinevirtual

Put in a request to change the prefered size of the widget.

Parameters
widththe width of the widget
heightthe height of the widget
Examples:
SelectionAreaTest.C.

Definition at line 132 of file Widget.H.

Here is the caller graph for this function:

GtkWidget* Widget::show ( void  )
inline

Method to show the widget.

Returns
box the GtkWidget* to the box
Examples:
ButtonsFontTest.C, ButtonsTest.C, ButtonsTest2.C, ComboBoxTextTest.C, DragNDropNowindowTest.C, DragNDropSimpleTest.C, DragNDropTest.C, DrawingAreaTest.C, InlineTest.C, LabelsTest.C, LabelsTest2.C, LabelsTest3.C, MessageDialogTest.C, NeuralNetworkFnTest.C, PangoTest.C, PangoTest2.C, PixmapTest.C, ProgressBarTest.C, SelectionAreaTest.C, SelectionTest.C, SelectionTest2.C, SelectionTest3.C, SeparatorTest.C, TableTest.C, TextViewTest.C, and WidgetTest.C.

Definition at line 65 of file Widget.H.

Here is the caller graph for this function:

void Widget::unref ( void  )
inline

Remove a reference from the widget

Definition at line 58 of file Widget.H.

Here is the caller graph for this function:

Member Data Documentation

GtkWidget* Widget::widget
protected

The container based widget.

Definition at line 33 of file Widget.H.


The documentation for this class was generated from the following file:
gtkIOStream: Widget Class Reference
GTK+ IOStream  Beta
GTK+ << C++ IOStream operators for GTK+. Now with extra abilities ... like ORBing, numerical computation, audio clients and more...