19. GLib........................................................................................................................149
Definitions ..........................................................................................................149
Doubly Linked Lists..........................................................................................150
Singly Linked Lists............................................................................................151
Memory Management ......................................................................................151
Timers..................................................................................................................152
String Handling .................................................................................................152
Utility and Error Functions..............................................................................153
20. GTK’s rc Files........................................................................................................155
Functions For rc Files........................................................................................155
GTK’s rc File Format.........................................................................................155
Example rc file ...................................................................................................156
21. Writing Your Own Widgets................................................................................159
Overview ............................................................................................................159
The Anatomy Of A Widget..............................................................................159
Creating a Composite widget..........................................................................160
Introduction..............................................................................................160
Choosing a parent class ..........................................................................160
The header file..........................................................................................160
The
_get_type() function.....................................................................162
The
_class_init() function ................................................................162
The _init() function .............................................................................164
And the rest... ...........................................................................................164
Creating a widget from scratch .......................................................................166
Introduction..............................................................................................166
Displaying a widget on the screen ........................................................167
The origins of the Dial Widget...............................................................167
The Basics..................................................................................................168
gtk_dial_realize() .............................................................................171
Size negotiation........................................................................................172
gtk_dial_expose() ...............................................................................173
Event handling.........................................................................................174
Possible Enhancements...........................................................................178
Learning More ...................................................................................................178
22. Scribble, A Simple Example Drawing Program ............................................181
Overview ............................................................................................................181
Event Handling .................................................................................................181
The DrawingArea Widget, And Drawing .....................................................184
Adding XInput support....................................................................................186
Enabling extended device information ................................................187
Using extended device information......................................................188
Finding out more about a device...........................................................189
Further sophistications ...........................................................................190
23. Tips For Writing GTK Applications.................................................................193
24. Contributing .........................................................................................................195
25. Credits....................................................................................................................197
26. Tutorial Copyright and Permissions Notice ...................................................199
A. GTK Signals...........................................................................................................201
GtkObject............................................................................................................201
GtkWidget ..........................................................................................................201
GtkData...............................................................................................................203
GtkContainer .....................................................................................................203
GtkCalendar.......................................................................................................204
GtkEditable ........................................................................................................204
GtkNotebook......................................................................................................205
GtkList.................................................................................................................205
GtkMenuShell ....................................................................................................205
GtkToolbar..........................................................................................................205
GtkButton ...........................................................................................................205
GtkItem ...............................................................................................................206
GtkWindow........................................................................................................206
v
GtkHandleBox ...................................................................................................206
GtkToggleButton ...............................................................................................206
GtkMenuItem.....................................................................................................206
GtkCheckMenuItem..........................................................................................206
GtkInputDialog .................................................................................................206
GtkColorSelection .............................................................................................206
GtkStatusBar ......................................................................................................207
GtkCurve ............................................................................................................207
GtkAdjustment ..................................................................................................207
B. GDK Event Types..................................................................................................209
C. Code Examples ......................................................................................................215
Tictactoe ..............................................................................................................215
tictactoe.h ..................................................................................................215
tictactoe.c...................................................................................................216
ttt_test.c .....................................................................................................218
GtkDial................................................................................................................219
gtkdial.h ....................................................................................................219
gtkdial.c.....................................................................................................220
dial_test.c ..................................................................................................229
Scribble................................................................................................................230
scribble-simple.c ......................................................................................231
scribble-xinput.c.......................................................................................233
vi