Using GTK+2 with the Free Pascal Compiler

This document is just an adaptation of the GTK+2 tutorial for C written by Tony Gale and Ian Main.

To get the Free Pascal Compiler (FPC) visit the official site http://www.freepascal.org.

Last modification was Saturday, April the 26th, 2014

Contents

1. Introduction

2. Getting Started
2.1 Hello World in GTK
2.2 Compiling Hello World
2.3 Theory of Signals and Callbacks
2.4 Events
2.5 Stepping Through Hello World
3. Moving On
3.1 Data types
3.2 More on signal handlers
3.3 An Upgraded Hello World
4. Packing Widgets
4.1 Theory of Packing Boxes
4.2 Details of Boxes
4.3 Box Packing Example
4.4 Packing Using Tables
4.5 Table Packing Example
5. Widget Overview
5.1 Casting
5.2 Widget Hierarchy
5.3 Widgets Without Windows
6. The Button Widget
6.1 Normal Buttons
6.2 Toggle Buttons
6.3 Check Buttons
6.4 Radio Buttons
7. Adjustments
7.1 Creating an Adjustment
7.2 Using Adjustments the Easy Way
7.3 Adjustment Internals
8 Range Widgets
8.1 Scrollbar Widgets
8.2 Scale Widgets
8.3 Common Range Functions
8.4 Key and Mouse bindings
8.5 Example
9 Miscellaneous Widgets
9.1 Labels
9.2 Arrows
9.3 The Tooltips Object
9.4 Progress Bars
9.5 Dialogs
9.6 Pixmaps and Images
9.7 Rulers
9.8 Statusbars
9.9 Text Entries
9.10 Spin Buttons
9.11 Combo Box
9.12 Calendar
9.13 Color Selection
9.14 File selections
10 Container Widgets
10.1 The Event Box
10.2 The Alignment Widget
10.3 Fixed Container
10.4 Layout Container
10.5 Frames
10.6 Aspect Frames
10.7 Paned Window Widgets
10.8 Viewports
10.9 Scrolled Windows
10.10 Button Boxes
10.11 Toolbar
10.12 Notebooks
11 CList Widget
11.1 Creating a CList Widget
11.2 Modes of Operation
11.3 Working with Titles
11.4 Manipulating the List Itself
11.5 Adding Rows to the List
11.6 Setting Text and Pixmaps in the Cells
11.7 Storing Data Pointers
11.8 Working with Selections
11.9 The Signals that Bring it Together
11.10 A CList Example
12 Tree Widget
12.1 Creating a Tree
12.2 Adding a Subtree
12.3 Handling the Selection List
12.4 Tree Widget Internals
12.5 Tree Item Widget
12.6 Tree Example
13. Menu Widget
13.1 Manual Menu Creation
13.2 Manual Menu Example
13.3 Using ItemFactory
13.4 Item Factory Example
14. Text Widget
14.1 Creating and Configuring a Text Box
14.2 Text Manipulation
14.3 Keyboard Shortcuts
14.4 A GtkText Example
15. Undocumented Widgets
15.1 AccelLabel
15.2 Menu Items
15.2 CTree
15.3 Curves
15.4 Drawing Area
15.5 Font Selection Dialog
15.6 Message Dialog
15.7 Gamma Curve
15.8 Image
15.9 Plugs and Sockets
16. Setting Widget Attributes
17. Timeouts, IO and Idle Functions
17.1 Timeouts
17.2 Monitoring IO
17.3 Idle Functions
18. Advanced Event and Signal Handling
18.1 Signal Functions
18.2 Signal Emission and Propagation
19. Managing Selections
19.1 Overview
19.2 Retrieving the Selection
19.3 Supplying the Selection
20. Drag-and-drop (DND)
20.1 Overview
20.2 Properties
20.3 Functions
21. GLib
21.1 Definitions
21.2 Doubly Linked Lists
21.3 Singly Linked Lists
21.4 Memory Management
21.5 Timers
21.6 String Handling
21.7 Utility and Error Functions
22. GTK's rc Files
22.1 Functions For rc Files
22.2 GTK's rc File Format
22.3 Example rc File
23. Writing Your Own Widgets
23.1 Overview
23.2 The Anatomy Of A Widget
23.3 Creating a Composite Widget
23.4 Creating a widget from scratch
23.5 Learning More
24. Scribble, A Simple Example Drawing Program
24.1 Overview
24.2 Event Handling
24.3 The DrawingArea Widget, and Drawing
24.4 Adding XInput support
25. Tips For Writing GTK Applications
26. Contributing
27. Credits 28. Tutorial Copyright and Permissions Notice