GTK+ 2.0 Tutorial

Tony Gale

Ian Main

& the GTK team


Table of Contents
Tutorial Availability
Introduction
Getting Started
Hello World in GTK
Compiling Hello World
Theory of Signals and Callbacks
Events
Stepping Through Hello World
Moving On
Data Types
More on Signal Handlers
An Upgraded Hello World
Packing Widgets
Theory of Packing Boxes
Details of Boxes
Packing Demonstration Program
Packing Using Tables
Table Packing Example
Widget Overview
Casting
Widget Hierarchy
Widgets Without Windows
The Button Widget
Normal Buttons
Toggle Buttons
Check Buttons
Radio Buttons
Adjustments
Creating an Adjustment
Using Adjustments the Easy Way
Adjustment Internals
Range Widgets
Scrollbar Widgets
Scale Widgets
Creating a Scale Widget
Functions and Signals (well, functions, at least)
Common Range Functions
Setting the Update Policy
Getting and Setting Adjustments
Key and Mouse bindings
Example
Miscellaneous Widgets
Labels
Arrows
The Tooltips Object
Progress Bars
Dialogs
Rulers
Statusbars
Text Entries
Spin Buttons
Combo Box
Calendar
Color Selection
File Selections
Container Widgets
The EventBox
The Alignment widget
Fixed Container
Layout Container
Frames
Aspect Frames
Paned Window Widgets
Viewports
Scrolled Windows
Button Boxes
Toolbar
Notebooks
Menu Widget
Manual Menu Creation
Manual Menu Example
Using ItemFactory
ItemFactory entries
Creating an ItemFactory
Making use of the menu and its menu items
Item Factory Example
Undocumented Widgets
Accel Label
Option Menu
Menu Items
Check Menu Item
Radio Menu Item
Separator Menu Item
Tearoff Menu Item
Curves
Drawing Area
Font Selection Dialog
Message Dialog
Gamma Curve
Image
Plugs and Sockets
Tree View
Text View
Setting Widget Attributes
Timeouts, IO and Idle Functions
Timeouts
Monitoring IO
Idle Functions
Advanced Event and Signal Handling
Signal Functions
Connecting and Disconnecting Signal Handlers
Blocking and Unblocking Signal Handlers
Emitting and Stopping Signals
Signal Emission and Propagation
Managing Selections
Overview
Retrieving the selection
Supplying the selection
Drag-and-drop (DND)
Overview
Properties
Functions
Setting up the source widget
Signals on the source widget:
Setting up a destination widget:
Signals on the destination widget:
GLib
Definitions
Doubly Linked Lists
Singly Linked Lists
Memory Management
Timers
String Handling
Utility and Error Functions
GTK's rc Files
Functions For rc Files
GTK's rc File Format
Example rc file
Writing Your Own Widgets
Overview
The Anatomy Of A Widget
Creating a Composite widget
Introduction
Choosing a parent class
The header file
The _get_type() function
The _class_init() function
The _init() function
And the rest...
Creating a widget from scratch
Introduction
Displaying a widget on the screen
The origins of the Dial Widget
The Basics
gtk_dial_realize()
Size negotiation
gtk_dial_expose()
Event handling
Possible Enhancements
Learning More
Scribble, A Simple Example Drawing Program
Overview
Event Handling
The DrawingArea Widget, And Drawing
Adding XInput support
Enabling extended device information
Using extended device information
Finding out more about a device
Further sophistications
Tips For Writing GTK Applications
Contributing
Credits
Tutorial Copyright and Permissions Notice
GTK Signals
GtkObject
GtkWidget
GtkData
GtkContainer
GtkCalendar
GtkEditable
GtkNotebook
GtkList
GtkMenuShell
GtkToolbar
GtkButton
GtkItem
GtkWindow
GtkHandleBox
GtkToggleButton
GtkMenuItem
GtkCheckMenuItem
GtkInputDialog
GtkColorSelection
GtkStatusBar
GtkCurve
GtkAdjustment
GDK Event Types
Code Examples
Tictactoe
tictactoe.h
tictactoe.c
ttt_test.c
GtkDial
gtkdial.h
gtkdial.c
dial_test.c
Scribble
scribble-simple.c
scribble-xinput.c