
GTK– v1.2 Tutorial > < > by Guillaume Laurent <[email protected] , Karl Nelson [email protected] and > Michael Ashton <[email protected] Chapter on "Timeouts" contributed by Bernhard Rieder > < > <[email protected] Adapted from the GTK Tutorial by Tony Gale [email protected] Ian Main > <[email protected] August 2000 This is a tutorial on how to use GTK– (the C++ bindings to GTK). This tutorial is a work in progress. Not all of the sections have been completed; some have not been started. Some chapters have been written, but not edited or proofread. Since they do contain helpful information, they have been included, and are marked "draft". We are working hard to make this tutorial helpful and accurate. We would very much appreciate any reports of inaccuracies or other errors in this document. Contributions are also most welcome. Post your suggestions, critiques or addenda to the GTK– mailing list. – The GTK– Development Team Contents 1 Introduction 5 2 Getting Started 6 2.1TheoryofSignalsandCallbacks..................................... 8 2.2OverridingMemberFunctions...................................... 11 2.3HelloWorldinGTK–........................................... 13 3MovingOn 17 3.1DataTypes................................................ 17 3.2UsingXevents.............................................. 18 3.3MoreonSignalHandlers......................................... 19 3.4AnUpgradedHelloWorld........................................ 19 4 Widget Overview 22 4.1Packing(light).............................................. 22 4.2UsingaGTK–widget........................................... 23 4.3WidgetHierarchy............................................. 23 4.4 Widgets Without Windows . ...................................... 25 5 The Button Widget 25 5.1Pushbuttons................................................ 26 5.2 Toggle Buttons . .......................................... 28 5.3 Checkboxes . .......................................... 28 5.4RadioButtons .............................................. 28 6 Adjustments 31 6.1CreatinganAdjustment.......................................... 32 6.2UsingAdjustmentstheEasyWay..................................... 32 6.3AdjustmentInternals........................................... 32 7 Range Widgets 34 7.1ScrollbarWidgets............................................. 34 7.2ScaleWidgets............................................... 34 7.2.1 CreatingaScaleWidget..................................... 34 7.2.2 Methods and Signals (well, methods, at least) . ....................... 35 7.3CommonFunctions............................................ 35 7.3.1 Setting the Update Policy . .................................. 36 7.4KeyandMousebindings......................................... 36 7.4.1 VerticalRangeWidgets...................................... 36 7.4.2 HorizontalRangeWidgets.................................... 37 7.5Example:Rangewidgets......................................... 37 8 Miscellaneous Widgets 41 8.1Labels................................................... 41 8.2Arrows.................................................. 45 8.3 The Tooltips Widget . .......................................... 47 8.4ProgressBars............................................... 48 8.5Dialogs.................................................. 52 8.6Pixmaps.................................................. 53 8.7Rulers................................................... 60 8.8Statusbars................................................. 62 8.9TextEntries................................................ 64 8.10Spinbuttons................................................ 67 8.11Comboboxes............................................... 74 8.12ColourSelectionWidget......................................... 75 8.13FileSelectionWidget........................................... 76 9 Container widgets in GTK– 78 9.1TheGTK–containerwidgetsystem................................... 78 9.2 Using Gtk::Bin widgets........................................ 79 9.3 Understanding the GTK– multiple-item widgets . ........................... 80 9.4 Using the GTK– multiple-item widgets . ........................... 81 9.5 Container widgets: a rogues’ gallery . .................................. 83 10 Single-item widgets 84 10.1Frames.................................................. 84 10.2AspectFrames.............................................. 86 10.3TheEventBox .............................................. 88 10.4TheAlignmentwidget.......................................... 89 10.5Viewports................................................. 90 10.6ScrolledWindows ............................................ 91 10.7PanedWindowWidgets.......................................... 93 11 Packing widgets 97 11.1TheoryofPackingBoxes......................................... 97 11.2DetailsofBoxes.............................................. 97 11.3PackingUsingTables........................................... 102 12 Multiple-item widgets 105 12.1FixedContainer ............................................. 105 12.2 Layout Container . .......................................... 107 12.3Buttonboxes............................................... 108 12.4Toolbars ................................................. 113 12.5 Notebooks . .......................................... 117 13 Tree Widget (draft) 122 13.1CreatingaTree.............................................. 123 13.2AddingaSubtree............................................. 123 13.3HandlingtheSelectionList........................................ 123 13.4TreeWidgetInternals........................................... 124 13.4.1Signals.............................................. 125 13.4.2 Methods . .......................................... 125 13.5TreeItemWidget............................................. 127 13.5.1Signals.............................................. 127 13.5.2 Functions and Macros ...................................... 128 13.6TreeExample............................................... 129 14 Text Widget (draft) 133 14.1CreatingandConfiguringaTextbox................................... 133 14.2TextManipulation............................................. 134 14.3 Keyboard Shortcuts . .......................................... 135 14.3.1MotionShortcuts......................................... 136 14.3.2 Editing Shortcuts . ...................................... 136 14.3.3SelectionShortcuts........................................ 136 14.4Anexample................................................ 136 15 Timeouts, I/O and Idle Functions 140 15.1Timeouts................................................. 140 15.2MonitoringI/O.............................................. 143 15.3IdleFunctions............................................... 145 16 Advanced Event and Signal Handling (draft) 148 16.1SignalFunctions............................................. 148 16.1.1ConnectingandDisconnectingSignalHandlers......................... 148 16.1.2BlockingandUnblockingSignalHandlers............................ 149 16.1.3 Emitting and Stopping Signals .................................. 149 16.2SignalEmissionandPropagation..................................... 150 17 Tips For Writing Gtk– Applications (draft) 150 18 Contributing 150 19 Tutorial Copyright and Permissions Notice 151 A Gtk– Signals 151 A.1GtkObject................................................. 151 A.2GtkWidget................................................. 151 A.3GtkData.................................................. 154 A.4GtkContainer............................................... 155 A.5GtkCalendar................................................ 155 A.6GtkEditable................................................ 155 A.7GtkTipsQuery............................................... 156 A.8GtkCList................................................. 156 A.9 GtkNotebook . .......................................... 157 A.10Gtk::List.................................................. 158 A.11GtkMenuShell............................................... 158 A.12GtkToolbar................................................ 158 A.13Gtk::Tree................................................. 158 A.14GtkButton................................................. 158 A.15GtkItem.................................................. 159 A.16GtkWindow................................................ 159 A.17GtkHandleBox.............................................. 159 A.18 GtkToggleButton . .......................................... 159 A.19GtkMenuItem............................................... 159 A.20Gtk::ListItem............................................... 159 A.21Gtk::TreeItem............................................... 160 A.22GtkCheckMenuItem........................................... 160 A.23 GtkInputDialog . .......................................... 160 A.24GtkColorSelection............................................ 160 A.25GtkStatusBar............................................... 160 A.26GtkCTree................................................. 161 A.27GtkCurve................................................. 161 A.28GtkAdjustment.............................................. 161 B GDK Event Types 161 C Code Examples 169 C.1Tictactoe.................................................. 169 C.1.1tictactoe.h............................................. 169 C.1.2tictactoe.c............................................. 169 C.1.3 ttt_test.c . .......................................... 171 C.2GtkDial.................................................
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages188 Page
-
File Size-