0% found this document useful (0 votes)
553 views

FLTK

FLTK 1.3. Programming Manual copyright 1998-2011 by Bill Spitzak and others. FLTK is a programming language written in c++. A manual is provided under the terms of the gnu library general public license.

Uploaded by

Josh Feng
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
553 views

FLTK

FLTK 1.3. Programming Manual copyright 1998-2011 by Bill Spitzak and others. FLTK is a programming language written in c++. A manual is provided under the terms of the gnu library general public license.

Uploaded by

Josh Feng
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1036

FLTK 1.3.

0 Programming Manual

Revision 9 by F. Costantini, D. Gibson, M. Melcher, A. Schlosser, B. Spitzak, and M. Sweet.

Copyright 1998-2011 by Bill Spitzak and others.


This software and manual are provided under the terms of the GNU Library General Public License. Permission is granted to reproduce this manual or any portion for any purpose, provided this copyright and permission notice are preserved.

Generated by Doxygen 1.7.5


August 26, 2011

Contents
1 2 FLTK Programming Manual Preface 2.1 Organization . . . . . . . . 2.2 Conventions . . . . . . . . 2.3 Abbreviations . . . . . . . 2.4 Copyrights and Trademarks 1 3 3 4 4 5 7 7 8 9 9 9 11 12 12 13 13 16 17 17 18 18 19 19 20 21 21 22 22 24 25 29 30 31 31 31 32 32

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

Introduction to FLTK 3.1 History of FLTK . . . . . . . . . . . . . . . . . . . . . . . 3.2 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3 Licensing . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4 What Does "FLTK" Mean? . . . . . . . . . . . . . . . . . . 3.5 Building and Installing FLTK Under UNIX and Apple OS X 3.6 Building FLTK Under Microsoft Windows . . . . . . . . . 3.7 Internet Resources . . . . . . . . . . . . . . . . . . . . . . 3.8 Reporting Bugs . . . . . . . . . . . . . . . . . . . . . . . . FLTK Basics 4.1 Writing Your First FLTK Program . . . . . . . . 4.2 Compiling Programs with Standard Compilers . . 4.3 Compiling Programs with Makeles . . . . . . . 4.4 Compiling Programs with Microsoft Visual C++ . 4.5 Naming . . . . . . . . . . . . . . . . . . . . . . 4.6 Header Files . . . . . . . . . . . . . . . . . . . . Common Widgets and Attributes 5.1 Buttons . . . . . . . . . . . . . . . . . 5.2 Text . . . . . . . . . . . . . . . . . . . 5.3 Valuators . . . . . . . . . . . . . . . . 5.4 Groups . . . . . . . . . . . . . . . . . . 5.5 Setting the Size and Position of Widgets 5.6 Colors . . . . . . . . . . . . . . . . . . 5.7 Box Types . . . . . . . . . . . . . . . . 5.8 Labels and Label Types . . . . . . . . . 5.9 Callbacks . . . . . . . . . . . . . . . . 5.10 Shortcuts . . . . . . . . . . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

Designing a Simple Text Editor 6.1 Determining the Goals of the Text Editor . 6.2 Designing the Main Window . . . . . . . 6.3 Variables . . . . . . . . . . . . . . . . . 6.4 Menubars and Menus . . . . . . . . . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

ii 6.5 6.6 6.7 6.8 6.9 6.10 6.11 6.12 7 Editing the Text . . . The Replace Dialog . Callbacks . . . . . . Other Functions . . . The main() Function Compiling the Editor The Final Product . . Advanced Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

CONTENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 33 33 38 39 40 40 41 47 47 47 49 59 65 65 65 66 67 67 68 68 69 70 71 73 73 73 73 74 76 78 78 78 80 80 80 83 83 83 85 86 87 88 91 91 92 93 93 93

Drawing Things in FLTK 7.1 When Can You Draw Things in FLTK? 7.2 Drawing Functions . . . . . . . . . . . 7.3 Colors . . . . . . . . . . . . . . . . . . 7.4 Drawing Images . . . . . . . . . . . . . Handling Events 8.1 The FLTK Event Model . . . . . . . 8.2 Mouse Events . . . . . . . . . . . . . 8.3 Focus Events . . . . . . . . . . . . . 8.4 Keyboard Events . . . . . . . . . . . 8.5 Widget Events . . . . . . . . . . . . . 8.6 Clipboard Events . . . . . . . . . . . 8.7 Drag and Drop Events . . . . . . . . 8.8 Fl::event_() methods . . . . . . . . . 8.9 Event Propagation . . . . . . . . . . . 8.10 FLTK Compose-Character Sequences Adding and Extending Widgets 9.1 Subclassing . . . . . . . . . . . . 9.2 Making a Subclass of Fl_Widget . 9.3 The Constructor . . . . . . . . . . 9.4 Protected Methods of Fl_Widget . 9.5 Handling Events . . . . . . . . . . 9.6 Drawing the Widget . . . . . . . . 9.7 Resizing the Widget . . . . . . . . 9.8 Making a Composite Widget . . . 9.9 Cut and Paste Support . . . . . . . 9.10 Drag And Drop Support . . . . . . 9.11 Making a subclass of Fl_Window .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

10 Using OpenGL 10.1 Using OpenGL in FLTK . . . . . . . . . . 10.2 Making a Subclass of Fl_Gl_Window . . . 10.3 Using OpenGL in Normal FLTK Windows 10.4 OpenGL Drawing Functions . . . . . . . . 10.5 Speeding up OpenGL . . . . . . . . . . . . 10.6 Using OpenGL Optimizer with FLTK . . . 11 Programming with FLUID 11.1 What is FLUID? . . . . . . . . . . . . . . 11.2 Running FLUID Under UNIX . . . . . . . 11.3 Running FLUID Under Microsoft Windows 11.4 Compiling . les . . . . . . . . . . . . . . 11.5 A Short Tutorial . . . . . . . . . . . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

CONTENTS 11.6 FLUID Reference . . . . . . . . 11.7 GUI Attributes . . . . . . . . . 11.8 Selecting and Moving Widgets . 11.9 Image Labels . . . . . . . . . . 11.10Internationalization with FLUID 11.11Known limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

iii 101 109 116 116 118 120

12 Advanced FLTK 121 12.1 Multithreading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 13 Unicode and UTF-8 Support 13.1 About Unicode, ISO 10646 and UTF-8 . 13.2 Unicode in FLTK . . . . . . . . . . . . 13.3 Illegal Unicode and UTF-8 sequences . 13.4 FLTK Unicode and UTF-8 functions . . 13.5 FLTK Unicode versions of system calls 14 FLTK Enumerations 14.1 Version Numbers . . . . . . 14.2 Events . . . . . . . . . . . . 14.3 Callback "When" Conditions 14.4 Fl::event_button() Values . . 14.5 Fl::event_key() Values . . . 14.6 Fl::event_state() Values . . . 14.7 Alignment Values . . . . . . 14.8 Fonts . . . . . . . . . . . . 14.9 Colors . . . . . . . . . . . . 14.10Cursors . . . . . . . . . . . 14.11FD "When" Conditions . . . 14.12Damage Masks . . . . . . . 123 123 125 125 126 129 131 131 131 132 133 133 134 134 135 136 137 138 138 139 139 139 140 141 143 143 143 144 146 149 149 149 155 158 161 161 161 161 161 162

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

15 GLUT Compatibility 15.1 Using the GLUT Compatibility Header File 15.2 Known Problems . . . . . . . . . . . . . . 15.3 Mixing GLUT and FLTK Code . . . . . . . 15.4 class Fl_Glut_Window . . . . . . . . . . . 16 Forms Compatibility 16.1 Importing Forms Layout Files . . . 16.2 Using the Compatibility Header File 16.3 Problems You Will Encounter . . . 16.4 Additional Notes . . . . . . . . . . 17 Operating System Issues 17.1 Accessing the OS Interfaces . . 17.2 The UNIX (X11) Interface . . . 17.3 The Windows (WIN32) Interface 17.4 The Apple OS X Interface . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

18 Migrating Code from FLTK 1.0 to 1.1 18.1 Color Values . . . . . . . . . . . . 18.2 Cut and Paste Support . . . . . . . 18.3 File Chooser . . . . . . . . . . . . 18.4 Function Names . . . . . . . . . . 18.5 Image Support . . . . . . . . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

iv

CONTENTS 18.6 Keyboard Navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162

19 Migrating Code from FLTK 1.1 to 1.3 19.1 Migrating From FLTK 1.0 . . . . 19.2 Fl_Scroll Widget . . . . . . . . . 19.3 Unicode (UTF-8) . . . . . . . . . 19.4 Widget Coordinate Representation 20 Developer Information 20.1 Non-ASCII Characters 20.2 Document Structure . . 20.3 Creating Links . . . . 20.4 Paragraph Layout . . . 20.5 Navigation Elements . 21 Software License

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

163 163 163 163 164 165 167 167 168 168 169 171

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

22 Example Source Code 179 22.1 Example Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 23 Todo List 24 Deprecated List 189 193

25 Module Index 195 25.1 Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 26 Class Index 197 26.1 Class Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 27 Class Index 201 27.1 Class List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 28 File Index 209 28.1 File List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 29 Module Documentation 29.1 Callback function typedefs . . . . . . . 29.2 Windows handling functions . . . . . . 29.3 Events handling functions . . . . . . . . 29.4 Selection & Clipboard functions . . . . 29.5 Screen functions . . . . . . . . . . . . . 29.6 Color & Font functions . . . . . . . . . 29.7 Drawing functions . . . . . . . . . . . 29.8 Multithreading support functions . . . . 29.9 Safe widget deletion support functions . 29.10Cairo support functions and classes . . . 29.11Unicode and UTF-8 functions . . . . . 29.12Mac OS X-specic symbols . . . . . . 29.13Common Dialogs classes and functions 29.14File names and URI utility functions . . 215 215 217 220 234 236 239 248 268 270 274 276 285 287 297

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

30 Class Documentation 305 30.1 Fl_Table_Row::CharVector Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . 305 30.2 Fl_Preferences::Entry Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

CONTENTS 30.3 Fl Class Reference . . . . . . . . . . . . 30.4 Fl_Adjuster Class Reference . . . . . . . 30.5 Fl_Bitmap Class Reference . . . . . . . . 30.6 Fl_BMP_Image Class Reference . . . . . 30.7 Fl_Box Class Reference . . . . . . . . . 30.8 Fl_Browser Class Reference . . . . . . . 30.9 Fl_Browser_ Class Reference . . . . . . . 30.10Fl_Button Class Reference . . . . . . . . 30.11Fl_Cairo_State Class Reference . . . . . 30.12Fl_Cairo_Window Class Reference . . . . 30.13Fl_Chart Class Reference . . . . . . . . . 30.14FL_CHART_ENTRY Struct Reference . 30.15Fl_Check_Browser Class Reference . . . 30.16Fl_Check_Button Class Reference . . . . 30.17Fl_Choice Class Reference . . . . . . . . 30.18Fl_Clock Class Reference . . . . . . . . . 30.19Fl_Clock_Output Class Reference . . . . 30.20Fl_Color_Chooser Class Reference . . . . 30.21Fl_Counter Class Reference . . . . . . . 30.22Fl_Device Class Reference . . . . . . . . 30.23Fl_Device_Plugin Class Reference . . . . 30.24Fl_Dial Class Reference . . . . . . . . . 30.25Fl_Display_Device Class Reference . . . 30.26Fl_Double_Window Class Reference . . . 30.27Fl_End Class Reference . . . . . . . . . . 30.28Fl_File_Browser Class Reference . . . . 30.29Fl_File_Chooser Class Reference . . . . . 30.30Fl_File_Icon Class Reference . . . . . . . 30.31Fl_File_Input Class Reference . . . . . . 30.32Fl_Fill_Dial Class Reference . . . . . . . 30.33Fl_Fill_Slider Class Reference . . . . . . 30.34Fl_Float_Input Class Reference . . . . . 30.35Fl_Font_Descriptor Class Reference . . . 30.36Fl_Fontdesc Struct Reference . . . . . . . 30.37Fl_FormsBitmap Class Reference . . . . 30.38Fl_FormsPixmap Class Reference . . . . 30.39Fl_Free Class Reference . . . . . . . . . 30.40Fl_GDI_Graphics_Driver Class Reference 30.41Fl_GIF_Image Class Reference . . . . . . 30.42Fl_Gl_Choice Class Reference . . . . . . 30.43Fl_Gl_Window Class Reference . . . . . 30.44Fl_Glut_Bitmap_Font Struct Reference . 30.45Fl_Glut_StrokeChar Struct Reference . . 30.46Fl_Glut_StrokeFont Struct Reference . . 30.47Fl_Glut_StrokeStrip Struct Reference . . 30.48Fl_Glut_StrokeVertex Struct Reference . 30.49Fl_Glut_Window Class Reference . . . . 30.50Fl_Graphics_Driver Class Reference . . . 30.51Fl_Group Class Reference . . . . . . . . 30.52Fl_Help_Block Struct Reference . . . . . 30.53Fl_Help_Dialog Class Reference . . . . . 30.54Fl_Help_Font_Stack Struct Reference . . 30.55Fl_Help_Font_Style Struct Reference . . 30.56Fl_Help_Link Struct Reference . . . . . .
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

v . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 327 329 332 333 335 356 372 377 378 379 384 385 388 390 393 395 399 403 407 408 409 411 413 416 417 419 427 432 435 435 436 437 438 438 439 441 444 448 449 449 456 457 457 457 458 458 460 486 496 497 500 501 501

vi 30.57Fl_Help_Target Struct Reference . . . . . . . . 30.58Fl_Help_View Class Reference . . . . . . . . . 30.59Fl_Hold_Browser Class Reference . . . . . . . 30.60Fl_Hor_Fill_Slider Class Reference . . . . . . 30.61Fl_Hor_Nice_Slider Class Reference . . . . . . 30.62Fl_Hor_Slider Class Reference . . . . . . . . . 30.63Fl_Hor_Value_Slider Class Reference . . . . . 30.64Fl_Image Class Reference . . . . . . . . . . . 30.65Fl_Input Class Reference . . . . . . . . . . . . 30.66Fl_Input_ Class Reference . . . . . . . . . . . 30.67Fl_Input_Choice Class Reference . . . . . . . 30.68Fl_Int_Input Class Reference . . . . . . . . . . 30.69Fl_JPEG_Image Class Reference . . . . . . . . 30.70Fl_Label Struct Reference . . . . . . . . . . . 30.71Fl_Light_Button Class Reference . . . . . . . . 30.72Fl_Line_Dial Class Reference . . . . . . . . . 30.73Fl_Mac_App_Menu Class Reference . . . . . . 30.74Fl_Menu_ Class Reference . . . . . . . . . . . 30.75Fl_Menu_Bar Class Reference . . . . . . . . . 30.76Fl_Menu_Button Class Reference . . . . . . . 30.77Fl_Menu_Item Struct Reference . . . . . . . . 30.78Fl_Menu_Window Class Reference . . . . . . 30.79Fl_Multi_Browser Class Reference . . . . . . . 30.80Fl_Multi_Label Struct Reference . . . . . . . . 30.81Fl_Multiline_Input Class Reference . . . . . . 30.82Fl_Multiline_Output Class Reference . . . . . 30.83Fl_Native_File_Chooser Class Reference . . . 30.84Fl_Nice_Slider Class Reference . . . . . . . . 30.85Fl_Output Class Reference . . . . . . . . . . . 30.86Fl_Overlay_Window Class Reference . . . . . 30.87Fl_Pack Class Reference . . . . . . . . . . . . 30.88Fl_Paged_Device Class Reference . . . . . . . 30.89Fl_Pixmap Class Reference . . . . . . . . . . . 30.90Fl_Plugin Class Reference . . . . . . . . . . . 30.91Fl_Plugin_Manager Class Reference . . . . . . 30.92Fl_PNG_Image Class Reference . . . . . . . . 30.93Fl_PNM_Image Class Reference . . . . . . . . 30.94Fl_Positioner Class Reference . . . . . . . . . 30.95Fl_PostScript_File_Device Class Reference . . 30.96Fl_PostScript_Graphics_Driver Class Reference 30.97Fl_PostScript_Printer Class Reference . . . . . 30.98Fl_Preferences Class Reference . . . . . . . . 30.99Fl_Printer Class Reference . . . . . . . . . . . 30.100 l_Progress Class Reference . . . . . . . . . . F 30.101 l_Quartz_Graphics_Driver Class Reference . F 30.102 l_Radio_Button Class Reference . . . . . . . F 30.103 l_Radio_Light_Button Class Reference . . . . F 30.104 l_Radio_Round_Button Class Reference . . . F 30.105 l_Repeat_Button Class Reference . . . . . . . F 30.106 l_Return_Button Class Reference . . . . . . . F 30.107 l_RGB_Image Class Reference . . . . . . . . F 30.108 l_Roller Class Reference . . . . . . . . . . . F 30.109 l_Round_Button Class Reference . . . . . . . F 30.110 l_Round_Clock Class Reference . . . . . . . F . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

CONTENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502 503 510 511 512 512 513 514 518 520 538 541 542 543 545 547 547 548 562 565 568 580 583 584 584 585 586 594 594 596 598 600 607 610 611 613 614 615 619 624 635 637 651 658 660 664 665 665 666 667 669 673 675 675

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

CONTENTS 30.111 l_Scroll Class Reference . . . . . . . . . . . . . . . . F 30.112 l_Scrollbar Class Reference . . . . . . . . . . . . . . F 30.113 l_Secret_Input Class Reference . . . . . . . . . . . . F 30.114 l_Select_Browser Class Reference . . . . . . . . . . F 30.115 l_Shared_Image Class Reference . . . . . . . . . . . F 30.116 l_Simple_Counter Class Reference . . . . . . . . . . F 30.117 l_Single_Window Class Reference . . . . . . . . . . F 30.118 l_Slider Class Reference . . . . . . . . . . . . . . . . F 30.119 l_Spinner Class Reference . . . . . . . . . . . . . . . F 30.120 l_Surface_Device Class Reference . . . . . . . . . . F 30.121 l_Sys_Menu_Bar Class Reference . . . . . . . . . . F 30.122 l_System_Printer Class Reference . . . . . . . . . . F 30.123 l_Table Class Reference . . . . . . . . . . . . . . . . F 30.124 l_Table_Row Class Reference . . . . . . . . . . . . . F 30.125 l_Tabs Class Reference . . . . . . . . . . . . . . . . F 30.126 l_Text_Buffer Class Reference . . . . . . . . . . . . F 30.127 l_Text_Display Class Reference . . . . . . . . . . . . F 30.128 l_Text_Editor Class Reference . . . . . . . . . . . . F 30.129 l_Text_Selection Class Reference . . . . . . . . . . . F 30.130 l_Tile Class Reference . . . . . . . . . . . . . . . . . F 30.131 l_Tiled_Image Class Reference . . . . . . . . . . . . F 30.132 l_Timer Class Reference . . . . . . . . . . . . . . . F 30.133 l_Toggle_Button Class Reference . . . . . . . . . . . F 30.134 l_Tooltip Class Reference . . . . . . . . . . . . . . . F 30.135 l_Tree Class Reference . . . . . . . . . . . . . . . . F 30.136 l_Tree_Item Class Reference . . . . . . . . . . . . . F 30.137 l_Tree_Item_Array Class Reference . . . . . . . . . F 30.138 l_Tree_Prefs Class Reference . . . . . . . . . . . . . F 30.139 l_Valuator Class Reference . . . . . . . . . . . . . . F 30.140 l_Value_Input Class Reference . . . . . . . . . . . . F 30.141 l_Value_Output Class Reference . . . . . . . . . . . F 30.142 l_Value_Slider Class Reference . . . . . . . . . . . . F 30.143 l_Widget Class Reference . . . . . . . . . . . . . . . F 30.144 l_Widget_Tracker Class Reference . . . . . . . . . . F 30.145 l_Window Class Reference . . . . . . . . . . . . . . F 30.146 l_Wizard Class Reference . . . . . . . . . . . . . . . F 30.147 l_XBM_Image Class Reference . . . . . . . . . . . . F 30.148 l_XColor Struct Reference . . . . . . . . . . . . . . F 30.149 l_Xlib_Graphics_Driver Class Reference . . . . . . . F 30.150 l_XPM_Image Class Reference . . . . . . . . . . . . F 30.151ActiveIMMApp Class Reference . . . . . . . . . . . I 30.152 l_Input_Choice::InputMenuButton Class Reference . F 30.153 l_Table::IntVector Class Reference . . . . . . . . . . F 30.154 l_Text_Editor::Key_Binding Struct Reference . . . . F 30.155 l_Graphics_Driver::matrix Struct Reference . . . . . F 30.156 l_Preferences::Name Class Reference . . . . . . . . . F 30.157 l_Preferences::Node Class Reference . . . . . . . . . F 30.158 l_Paged_Device::page_format Struct Reference . . . F 30.159 l_Preferences::RootNode Class Reference . . . . . . F 30.160 l_Scroll::ScrollInfo Struct Reference . . . . . . . . . F 30.161 l_Text_Display::Style_Table_Entry Struct Reference . F 30.162 Utf8FontStruct Struct Reference . . . . . . . . . . . X 31 File Documentation
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

vii . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676 681 685 686 687 691 692 695 698 703 705 709 713 732 735 739 753 784 790 792 795 797 800 801 804 833 843 845 849 854 858 862 864 899 901 915 916 917 917 922 923 925 925 926 926 927 928 929 929 930 930 931 933

viii 31.1 Enumerations.H File Reference . . . . . . 31.2 Fl.H File Reference . . . . . . . . . . . . 31.3 _arc.cxx File Reference . . . . . . . . . 31.4 _arci.cxx File Reference . . . . . . . . . 31.5 _boxtype.cxx File Reference . . . . . . 31.6 _color.cxx File Reference . . . . . . . . 31.7 Fl_Color_Chooser.H File Reference . . . 31.8 _curve.cxx File Reference . . . . . . . . 31.9 Fl_Device.H File Reference . . . . . . . 31.10_draw.H File Reference . . . . . . . . . 31.11_line_style.cxx File Reference . . . . . 31.12Fl_Native_File_Chooser.H File Reference 31.13Fl_Paged_Device.cxx File Reference . . . 31.14Fl_Paged_Device.H File Reference . . . . 31.15Fl_PostScript.H File Reference . . . . . . 31.16Fl_Printer.H File Reference . . . . . . . . 31.17_rect.cxx File Reference . . . . . . . . . 31.18Fl_Shared_Image.H File Reference . . . . 31.19_show_colormap.H File Reference . . . 31.20Fl_Tree.H File Reference . . . . . . . . . 31.21Fl_Tree_Item.H File Reference . . . . . . 31.22Fl_Tree_Item_Array.H File Reference . . 31.23Fl_Tree_Prefs.H File Reference . . . . . 31.24_types.h File Reference . . . . . . . . . 31.25_utf8.h File Reference . . . . . . . . . . 31.26_vertex.cxx File Reference . . . . . . . 31.27Fl_Widget.H File Reference . . . . . . . 31.28gl.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

CONTENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 933 953 954 954 955 956 957 958 958 959 965 965 965 966 966 967 967 967 968 969 969 970 970 972 972 974 974 975

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 1

FLTK Programming Manual

FLTK 1.3.0 Programming Manual Revision 9 by F. Costantini, D. Gibson, M. Melcher, A. Schlosser, B. Spitzak and M. Sweet. Copyright 1998-2011 by Bill Spitzak and others. This software and manual are provided under the terms of the GNU Library General Public License. Permission is granted to reproduce this manual or any portion for any purpose, provided this copyright and permission notice are preserved.

2 Preface Introduction to FLTK FLTK Basics Common Widgets and Attributes Colors Box Types Labels and Label Types Drawing Images Designing a Simple Text Editor Drawing Things in FLTK Handling Events Fl::event_() methods Event Propagation

FLTK Programming Manual Advanced FLTK Unicode and UTF-8 Support Appendices: FLTK Enumerations GLUT Compatibility class Fl_Glut_Window Forms Compatibility Operating System Issues Migrating Code from FLTK 1.0 to 1.1 Migrating Code from FLTK 1.1 to 1.3 Developer Information Adding and Extending Widgets Using OpenGL Programming with FLUID GUI Attributes Selecting and Moving Widgets Image Labels Software License Example Source Code

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 2

Preface
This manual describes the Fast Light Tool Kit ("FLTK") version 1.3.0, a C++ Graphical User Interface ("GUI") toolkit for UNIX, Microsoft Windows and Apple OS X. Each of the chapters in this manual is designed as a tutorial for using FLTK, while the appendices provide a convenient reference for all FLTK widgets, functions, and operating system interfaces. This manual may be printed, modied, and/or used under the terms of the FLTK license provided in Software License.

2.1

Organization

This manual is organized into the following chapters and appendices: Introduction to FLTK FLTK Basics Common Widgets and Attributes Designing a Simple Text Editor Drawing Things in FLTK Handling Events Adding and Extending Widgets Using OpenGL Programming with FLUID Advanced FLTK Unicode and UTF-8 Support FLTK Enumerations GLUT Compatibility Forms Compatibility Operating System Issues

4 Migrating Code from FLTK 1.0 to 1.1 Migrating Code from FLTK 1.1 to 1.3 Developer Information Software License Example Source Code

Preface

2.2

Conventions

This manual was generated using Doxygen (see http://www.doxygen.org/) to process the source code itself, special comments in the code, and additional documentation les. In general, Doxygen recognizes and denotes the following entities as shown: classes, such as Fl_Widget, methods, such as Fl_Widget::callback(Fl_Callback cb, void p), functions, such as _draw(const char str, int x, int y), internal links, such as Conventions, external links, such as http://www.stack.nl/dimitri/doxygen/ Other code samples and commands are shown in regular courier type.

2.3

Abbreviations

The following abbreviations are used in this manual: X11 The X Window System version 11. Xlib The X Window System interface library. MS Windows, WIN32 The Microsoft Windows Application Programmers Interface for Windows 2000, Windows XP, Windows Vista, and Windows 7. FLTK uses the preprocessor denition WIN32 for the 32 bit and 64 bit MS Windows API. OS X, APPLE The Apple desktop operating sytem OS X 10.0 and later. MacOS 8 and 9 support was dropped after FLTK 1.0.10. FLTK uses the preprocessor denition __APPLE__ for OS X.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

2.4 Copyrights and Trademarks

2.4

Copyrights and Trademarks

FLTK is Copyright 1998-2011 by Bill Spitzak and others. Use and distribution of FLTK is governed by the GNU Library General Public License with 4 exceptions, located in Software License. UNIX is a registered trademark of the X Open Group, Inc. Microsoft and Windows are registered trademarks of Microsoft Corporation. OpenGL is a registered trademark of Silicon Graphics, Inc. Apple, Macintosh, MacOS, and Mac OS X are registered trademarks of Apple Computer, Inc.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Preface

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 3

Introduction to FLTK
The Fast Light Tool Kit ("FLTK", pronounced "fulltick") is a cross-platform C++ GUI toolkit for UNIX/Linux(X11), MicrosoftWindows, and AppleOS X. FLTK provides modern GUI functionality without the bloat and supports 3D graphics via OpenGLand its built-in GLUT emulation. It was originally developed by Mr. Bill Spitzak and is currently maintained by a small group of developers across the world with a central repository in the US.

3.1

History of FLTK

It has always been Bills belief that the GUI API of all modern systems is much too high level. Toolkits (even FLTK) are not what should be provided and documented as part of an operating system. The system only has to provide arbitrary shaped but featureless windows, a powerful set of graphics drawing calls, and a simple unalterable method of delivering events to the owners of the windows. NeXT (if you ignored NextStep) provided this, but they chose to hide it and tried to push their own baroque toolkit instead. Many of the ideas in FLTK were developed on a NeXT (but not using NextStep) in 1987 in a C toolkit Bill called "views". Here he came up with passing events downward in the tree and having the handle routine return a value indicating whether it used the event, and the table-driven menus. In general he was trying to prove that complex UI ideas could be entirely implemented in a user space toolkit, with no knowledge or support by the system. After going to lm school for a few years, Bill worked at Sun Microsystems on the (doomed) NeWS project. Here he found an even better and cleaner windowing system, and he reimplemented "views" atop that. NeWS did have an unnecessarily complex method of delivering events which hurt it. But the designers did admit that perhaps the user could write just as good of a button as they could, and ofcially exposed the lower level interface. With the death of NeWS Bill realized that he would have to live with X. The biggest problem with X is the "window manager", which means that the toolkit can no longer control the window borders or drag the window around. At Digital Domain Bill discovered another toolkit, "Forms". Forms was similar to his work, but provided many more widgets, since it was used in many real applications, rather than as theoretical work. He decided to use Forms, except he integrated his table-driven menus into it. Several very large programs were created using this version of Forms. The need to switch to OpenGL and GLX, portability, and a desire to use C++ subclassing required a rewrite of Forms. This produced the rst version of FLTK. The conversion to C++ required so many changes it made it impossible to recompile any Forms objects. Since it was incompatible anyway, Bill decided to

Introduction to FLTK

incorporate his older ideas as much as possible by simplifying the lower level interface and the event passing mechanism. Bill received permission to release it for free on the Internet, with the GNU general public license. Response from Internet users indicated that the Linux market dwarfed the SGI and high-speed GL market, so he rewrote it to use X for all drawing, greatly speeding it up on these machines. That is the version you have now. Digital Domain has since withdrawn support for FLTK. While Bill is no longer able to actively develop it, he still contributes to FLTK in his free time and is a part of the FLTK development team.

3.2

Features

FLTK was designed to be statically linked. This was done by splitting it into many small objects and designing it so that functions that are not used do not have pointers to them in the parts that are used, and thus do not get linked in. This allows you to make an easy-to-install program or to modify FLTK to the exact requirements of your application without worrying about bloat. FLTK works ne as a shared library, though, and is now included with several Linux distributions. Here are some of the core features unique to FLTK: sizeof(Fl_Widget) == 64 to 92. The "core" (the "hello" program compiled & linked with a static FLTK library using gcc on a 486 and then stripped) is 114K. The FLUID program (which includes every widget) is 538k. Written directly atop core libraries (Xlib, WIN32 or Cocoa) for maximum speed, and carefully optimized for code size and performance. Precise low-level compatibility between the X11, WIN32 and MacOS versions - only about 10% of the code is different. Interactive user interface builder program. Output is human-readable and editable C++ source code. Support for overlay hardware, with emulation if none is available. Very small & fast portable 2-D drawing library to hide Xlib, WIN32, or QuickDraw. OpenGL/Mesa drawing area widget. Support for OpenGL overlay hardware on both X11 and WIN32, with emulation if none is available. Text widgets with cut & paste, undo, and support for Unicode text and international input methods. Compatibility header le for the GLUT library. Compatibility header le for the XForms library.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

3.3 Licensing

3.3

Licensing

FLTK comes with complete free source code. FLTK is available under the terms of the GNU Library General Public License with exceptions that allow for static linking. Contrary to popular belief, it can be used in commercial software - even Bill Gates could use it!

3.4

What Does FLTK Mean?

FLTK was originally designed to be compatible with the Forms Library written for SGI machines. In that library all the functions and structures started with "_". This naming was extended to all new methods and widgets in the C++ library, and this prex was taken as the name of the library. It is almost impossible to search for "FL" on the Internet, due to the fact that it is also the abbreviation for Florida. After much debating and searching for a new name for the toolkit, which was already in use by several people, Bill came up with "FLTK", including a bogus excuse that it stands for "The Fast Light Toolkit".

3.5

Building and Installing FLTK Under UNIX and Apple OS X

In most cases you can just type "make". This will run congure with the default of no options and then compile everything. For OS X, Xcode 3 project les can be found in the ide directory. FLTK uses GNU autoconf to congure itself for your UNIX platform. The main things that the congure script will look for are the X11 and OpenGL (or Mesa) header and library les. If these cannot be found in the standard include/library locations youll need to dene the CFLAGS, CXXFLAGS, and LDFLAGS environment variables. For the Bourne and Korn shells youd use:
CFLAGS=-Iincludedir; export CFLAGS CXXFLAGS=-Iincludedir; export CXXFLAGS LDFLAGS=-Llibdir; export LDFLAGS

For C shell and tcsh, use:


setenv CFLAGS "-Iincludedir" setenv CXXFLAGS "-Iincludedir" setenv LDFLAGS "-Llibdir"

By default congure will look for a C++ compiler named CC, c++, g++, or gcc in that order. To use another compiler you need to set the CXX environment variable:
CXX=xlC; export CXX setenv CXX "xlC"

The CC environment variable can also be used to override the default C compiler (cc or gcc), which is used for a few FLTK source les. You can run congure yourself to get the exact setup you need. Type "./congure <options>", where options are: --enable-cygwin Enable the Cygwin libraries under WIN32
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

10 --enable-debug Enable debugging code & symbols --disable-gl Disable OpenGL support --enable-shared Enable generation of shared libraries --enable-threads Enable multithreading support --enable-xdbe Enable the X double-buffer extension --enable-xft Enable the Xft library for anti-aliased fonts under X11 --enable-x11 When targeting cygwin, build with X11 GUI instead of windows GDI --enable-cp936 Under X11, enable use of the GB2312 locale --bindir=/path Set the location for executables [default = $prex/bin] --datadir=/path Set the location for data les. [default = $prex/share] --libdir=/path Set the location for libraries [default = $prex/lib] --includedir=/path Set the location for include les. [default = $prex/include] --mandir=/path Set the location for man pages. [default = $prex/man] --prex=/dir Set the directory prex for les [default = /usr/local]

Introduction to FLTK

When the congure script is done you can just run the "make" command. This will build the library, FLUID tool, and all of the test programs. To install the library, become root and type "make install". This will copy the "uid" executable to "bindir", the header les to "includedir", and the library les to "libdir".
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

3.6 Building FLTK Under Microsoft Windows

11

3.6

Building FLTK Under Microsoft Windows

NOTE: This documentation section is currently under review. More up-to-date information for this release may be available in the le "README.MSWindows.txt" and you should read that le to determine if there are changes that may be applicable to your build environment. FLTK 1.3 is ofcially supported on Windows (2000,) 2003, XP, and later. Older Windows versions prior to Windows 2000 are not ofcially supported, but may still work. The main reason is that the OS version needs to support UTF-8. FLTK 1.3 is known to work on recent versions of Windows such as Windows 7 and Vista and has been reported to work in both 32-bit and 64-bit versions of these. FLTK currently supports the following development environments on the Windows platform: CAUTION: Libraries built by any one of these build environments can not be mixed with object les from any of the other environments! (They use incompatible C++ conventions internally.) Free Microsoft Visual C++ 2008 Express and Visual C++ 2010 Express using the supplied workspace and project les. Older versions, and the commercial versions, can be used as well, if they can open the project les. Be sure to get your service packs! The project les can be found in the "ide/" directory. Please read "ide/README.IDE" for more info about this.

3.6.1

GNU toolsets (Cygwin or MinGW) hosted on Windows

If using Cygwin with the Cygwin shell, or MinGW with the Msys shell, these build environments behave very much like a Unix or OS X build and the notes above in the section on Building and Installing FLTK Under UNIX and Apple OS X apply, in particular the descriptions of using the "congure" script and its related options. In general for a build using these tools, e.g. for the Msys shell with MinGW, it should sufce to "cd" into the directory where you have extracted the tk tarball and type:
./configure make

This will build the tk libraries and they can then be utilised directly from the build location. NOTE: this may be simpler than "installing" them in many cases as different tool chains on Windows have different ideas about where the les should be "installed" to. For example, if you "install" the libraries using Msys/MinGW with the following command:
make install

Then Msys will "install" the libraries to where it thinks the path "/usr/local/" leads to. If you only ever build code from within the Msys environment this works well, but the actual "Windows path" these les are located in will be something like "C:\msys\1.0\local\lib", depending on where your Msys installation is rooted, which may not be useful to other tools. If you want to install your built tk libraries in a non-standard location you may do:
sh configure --prefix=C:/FLTK make

Where the value passed to "prex" is the path at which you would like tk to be installed. A subsequent invocation of "make install" will then place the tk libraries and header les into that path. The other options to "congure" may also be used to tailor the build to suit your environment.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

12

Introduction to FLTK

3.6.2

Using the Visual C++ DLL Library

The "tkdll.dsp" project le builds a DLL-version of the FLTK library. Because of name mangling differences between PC compilers (even between different versions of Visual C++!) you can only use the DLL that is generated with the same version compiler that you built it with. When compiling an application or DLL that uses the FLTK DLL, you will need to dene the FL_DLL preprocessor symbol to get the correct linkage commands embedded within the FLTK header les.

3.7

Internet Resources

FLTK is available on the net in a bunch of locations: WWW http://www.fltk.org/ http://www.fltk.org/str.php [for reporting bugs] http://www.fltk.org/software.php [source code] http://www.fltk.org/newsgroups.php [newsgroup/forums] FTP http://ftp.easysw.com/pub/fltk [California, USA, via http] ftp://ftp.easysw.com/pub/fltk [California, USA via ftp] ftp://ftp2.easysw.com/pub/fltk [Maryland, USA] ftp://ftp.funet.fi/pub/mirrors/ftp.easysw.com/pub/fltk [Espoo, Finland] NNTP Newsgroups news://news.easysw.com/ [NNTP interface] http://fltk.org/newsgroups.php [web interface] Point your NNTP news reader at news.easysw.com. At minimum, youll want to subscribe to the "tk.general" group for general FLTK questions and answers. You can also use the web interface to the newsgroup; just go to the main http://fltk.org/ page and click on "Forums".

3.8

Reporting Bugs

To report a bug in FLTK, or for feature requests, please use the form at http://www.fltk.org/str.php, and click on "Submit Bug or Feature Request". Youll be prompted for the FLTK version, operating system & version, and compiler that you are using. We will be unable to provide any kind of help without that basic information. For general support and questions, please use the tk.general newsgroup (see above, "NNTP Newsgroups") or the web interface to the newsgroups at http://fltk.org/newsgroups.php.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 4

FLTK Basics
This chapter teaches you the basics of compiling programs that use FLTK.

4.1

Writing Your First FLTK Program

All programs must include the le <FL/Fl.H>. In addition the program must include a header le for each FLTK class it uses. Listing 1 shows a simple "Hello, World!" program that uses FLTK to display the window. Listing 1 - hello.cxx
#include <FL/Fl.H> #include <FL/Fl_Window.H> #include <FL/Fl_Box.H> int main(int argc, char **argv) { Fl_Window *window = new Fl_Window(340,180); Fl_Box *box = new Fl_Box(20,40,300,100,"Hello, World!"); box->box(FL_UP_BOX); box->labelfont(FL_BOLD+FL_ITALIC); box->labelsize(36); box->labeltype(FL_SHADOW_LABEL); window->end(); window->show(argc, argv); return Fl::run(); }

After including the required header les, the program then creates a window. All following widgets will automatically be children of this window.
Fl_Window *window = new Fl_Window(340,180);

Then we create a box with the "Hello, World!" string in it. FLTK automatically adds the new box to window, the current grouping widget.
Fl_Box *box = new Fl_Box(20,40,300,100,"Hello, World!");

Next, we set the type of box and the font, size, and style of the label:

14
box->box(FL_UP_BOX); box->labelfont(FL_BOLD+FL_ITALIC); box->labelsize(36); box->labeltype(FL_SHADOW_LABEL);

FLTK Basics

We tell FLTK that we will not add any more widgets to window.
window->end();

Finally, we show the window and enter the FLTK event loop:
window->show(argc, argv); return Fl::run();

The resulting program will display the window in Figure 2-1. You can quit the program by closing the window or pressing the ESCape key.

Figure 4.1: The Hello, World! Window

4.1.1

Creating the Widgets

The widgets are created using the C++ new operator. For most widgets the arguments to the constructor are:
Fl_Widget(x, y, width, height, label)

The x and y parameters determine where the widget or window is placed on the screen. In FLTK the top left corner of the window or screen is the origin (i.e. x = 0, y = 0) and the units are in pixels. The width and height parameters determine the size of the widget or window in pixels. The maximum widget size is typically governed by the underlying window system or hardware. label is a pointer to a character string to label the widget with or NULL. If not specied the label defaults to NULL. The label string must be in static storage such as a string constant because FLTK does not make a copy of it - it just uses the pointer.

4.1.2

Creating Widget hierarchies

Widgets are commonly ordered into functional groups, which in turn may be grouped again, creating a hierarchy of widgets. FLTK makes it easy to ll groups by automatically adding all widgets that are created between a myGroup->begin() and myGroup->end(). In this example, myGroup would be the current group. Newly created groups and their derived widgets implicitly call begin() in the constructor, effectively adding all subsequently created widgets to itself until end() is called. Setting the current group to NULL will stop automatic hierarchies. New widgets can now be added manually using Fl_Group::add(...) and Fl_Group::insert(...).
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

4.1 Writing Your First FLTK Program

15

4.1.3

Get/Set Methods

box->box(FL_UP_BOX) sets the type of box the Fl_Box draws, changing it from the default of FL_NO_BOX, which means that no box is drawn. In our "Hello, World!" example we use FL_UP_BOX, which means that a raised button border will be drawn around the widget. More details are available in the Box Types section. You could examine the boxtype in by doing box->box(). FLTK uses method name overloading to make short names for get/set methods. A "set" method is always of the form "void name(type)", and a "get" method is always of the form "type name() const".

4.1.4

Redrawing After Changing Attributes

Almost all of the set/get pairs are very fast, short inline functions and thus very efcient. However, the "set" methods do not call redraw() - you have to call it yourself. This greatly reduces code size and execution time. The only common exceptions are value() which calls redraw() and label() which calls redraw_label() if necessary.

4.1.5

Labels

All widgets support labels. In the case of window widgets, the label is used for the label in the title bar. Our example program calls the labelfont(), labelsize(), and labeltype() methods. The labelfont() method sets the typeface and style that is used for the label, which for this example we are using FL_BOLD and FL_ITALIC. You can also specify typefaces directly. The labelsize() method sets the height of the font in pixels. The labeltype() method sets the type of label. FLTK supports normal, embossed, and shadowed labels internally, and more types can be added as desired. A complete list of all label options can be found in the section on Labels and Label Types.

4.1.6

Showing the Window

The show() method shows the widget or window. For windows you can also provide the command-line arguments to allow users to customize the appearance, size, and position of your windows.

4.1.7

The Main Event Loop

All FLTK applications (and most GUI applications in general) are based on a simple event processing model. User actions such as mouse movement, button clicks, and keyboard activity generate events that are sent to an application. The application may then ignore the events or respond to the user, typically by redrawing a button in the "down" position, adding the text to an input eld, and so forth. FLTK also supports idle, timer, and le pseudo-events that cause a function to be called when they occur. Idle functions are called when no user input is present and no timers or les need to be handled - in short, when the application is not doing anything. Idle callbacks are often used to update a 3D display or do other background processing. Timer functions are called after a specic amount of time has expired. They can be used to pop up a progress dialog after a certain amount of time or do other things that need to happen at more-or-less regular intervals. FLTK timers are not 100% accurate, so they should not be used to measure time intervals, for example.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

16

FLTK Basics

File functions are called when data is ready to read or write, or when an error condition occurs on a le. They are most often used to monitor network connections (sockets) for data-driven displays. FLTK applications must periodically check (Fl::check()) or wait (Fl::wait()) for events or use the Fl::run() method to enter a standard event processing loop. Calling Fl::run() is equivalent to the following code:
while (Fl::wait());

Fl::run() does not return until all of the windows under FLTK control are closed by the user or your program.

4.2

Compiling Programs with Standard Compilers

Under UNIX (and under Microsoft Windows when using the GNU development tools) you will probably need to tell the compiler where to nd the header les. This is usually done using the -I option:
CC -I/usr/local/include ... gcc -I/usr/local/include ...

The fltk-config script included with FLTK can be used to get the options that are required by your compiler:
CC fltk-config --cxxflags ...

Similarly, when linking your application you will need to tell the compiler to use the FLTK library:
CC ... -L/usr/local/lib -lfltk -lXext -lX11 -lm gcc ... -L/usr/local/lib -lfltk -lXext -lX11 -lm

Aside from the "tk" library, there is also a "tk_forms" library for the XForms compatibility classes, "tk_gl" for the OpenGL and GLUT classes, and "tk_images" for the image le classes, Fl_Help_Dialog widget, and system icon support. Note The libraries are named "tk.lib", "tkgl.lib", "tkforms.lib", and "tkimages.lib", respectively under Windows. As before, the fltk-config script included with FLTK can be used to get the options that are required by your linker:
CC ... fltk-config --ldflags

The forms, GL, and images libraries are included with the "--use-foo" options, as follows:
CC CC CC CC ... ... ... ... fltk-config fltk-config fltk-config fltk-config --use-forms --ldflags --use-gl --ldflags --use-images --ldflags --use-forms --use-gl --use-images --ldflags

Finally, you can use the fltk-config script to compile a single source le as a FLTK program:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

4.3 Compiling Programs with Makeles


fltk-config fltk-config fltk-config fltk-config fltk-config --compile filename.cpp --use-forms --compile filename.cpp --use-gl --compile filename.cpp --use-images --compile filename.cpp --use-forms --use-gl --use-images --compile filename.cpp

17

Any of these will create an executable named filename.

4.3

Compiling Programs with Makeles

The previous section described how to use fltk-config to build a program consisting of a single source le from the command line, and this is very convenient for small test programs. But fltk-config can also be used to set the compiler and linker options as variables within a Makefile that can be used to build programs out of multiple source les:
CXX DEBUG CXXFLAGS LDFLAGS LDSTATIC LINK = = = = = = $(shell -g $(shell $(shell $(shell $(CXX) fltk-config --cxx) fltk-config --use-gl --use-images --cxxflags ) -I. fltk-config --use-gl --use-images --ldflags ) fltk-config --use-gl --use-images --ldstaticflags )

TARGET = cube OBJS = CubeMain.o CubeView.o CubeViewUI.o SRCS = CubeMain.cxx CubeView.cxx CubeViewUI.cxx .SUFFIXES: .o .cxx %.o: %.cxx $(CXX) $(CXXFLAGS) $(DEBUG) -c $< all: $(TARGET) $(LINK) -o $(TARGET) $(OBJS) $(LDSTATIC) $(TARGET): $(OBJS) CubeMain.o: CubeMain.cxx CubeViewUI.h CubeView.o: CubeView.cxx CubeView.h CubeViewUI.h CubeViewUI.o: CubeViewUI.cxx CubeView.h clean: $(TARGET) $(OBJS) rm -f *.o 2> /dev/null rm -f $(TARGET) 2> /dev/null

4.4

Compiling Programs with Microsoft Visual C++

In Visual C++ you will need to tell the compiler where to nd the FLTK header les. This can be done by selecting "Settings" from the "Project" menu and then changing the "Preprocessor" settings under the "C/C++" tab. You will also need to add the FLTK (FLTK.LIB or FLTKD.LIB) and the Windows Common Controls (COMCTL32.LIB) libraries to the "Link" settings. You must also dene WIN32. More information can be found in README.MSWindows.txt. You can build your Microsoft Windows applications as Console or Desktop applications. If you want to use the standard C main() function as the entry point, FLTK includes a WinMain() function that will call your main() function for you.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

18

FLTK Basics

4.5

Naming

All public symbols in FLTK start with the characters F and L: Functions are either Fl::foo() or fl_foo(). Class and type names are capitalized: Fl_Foo. Constants and enumerations are uppercase: FL_FOO. All header les start with <FL/...>.

4.6

Header Files

The proper way to include FLTK header les is:


#include <FL/Fl_xyz.H>

Note Case is signicant on many operating systems, and the C standard uses the forward slash (/) to separate directories. Do not use any of the following include lines:
#include <FL\Fl_xyz.H> #include <fl/fl_xyz.h> #include <Fl/fl_xyz.h>

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 5

Common Widgets and Attributes


This chapter describes many of the widgets that are provided with FLTK and covers how to query and set the standard attributes.

5.1

Buttons

FLTK provides many types of buttons: Fl_Button - A standard push button. Fl_Check_Button - A button with a check box. Fl_Light_Button - A push button with a light. Fl_Repeat_Button - A push button that repeats when held. Fl_Return_Button - A push button that is activated by the Enter key. Fl_Round_Button - A button with a radio circle.

Figure 5.1: FLTK Button Widgets

All of these buttons just need the corresponding <FL/Fl_xyz_Button.H> header le. The constructor takes the bounding box of the button and optionally a label string:

20

Common Widgets and Attributes

Fl_Button *button = new Fl_Button(x, y, width, height, "label"); Fl_Light_Button *lbutton = new Fl_Light_Button(x, y, width, height); Fl_Round_Button *rbutton = new Fl_Round_Button(x, y, width, height, "label");

Each button has an associated type() which allows it to behave as a push button, toggle button, or radio button:
button->type(FL_NORMAL_BUTTON); lbutton->type(FL_TOGGLE_BUTTON); rbutton->type(FL_RADIO_BUTTON);

For toggle and radio buttons, the value() method returns the current button state (0 = off, 1 = on). The set() and clear() methods can be used on toggle buttons to turn a toggle button on or off, respectively. Radio buttons can be turned on with the setonly() method; this will also turn off other radio buttons in the same group.

5.2

Text

FLTK provides several text widgets for displaying and receiving text: Fl_Input - A one-line text input eld. Fl_Output - A one-line text output eld. Fl_Multiline_Input - A multi-line text input eld. Fl_Multiline_Output - A multi-line text output eld. Fl_Text_Display - A multi-line text display widget. Fl_Text_Editor - A multi-line text editing widget. Fl_Help_View - A HTML text display widget. The Fl_Output and Fl_Multiline_Output widgets allow the user to copy text from the output eld but not change it. The value() method is used to get or set the string that is displayed:
Fl_Input *input = new Fl_Input(x, y, width, height, "label"); input->value("Now is the time for all good men...");

The string is copied to the widgets own storage when you set the value() of the widget. The Fl_Text_Display and Fl_Text_Editor widgets use an associated Fl_Text_Buffer class for the value, instead of a simple string.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

5.3 Valuators

21

5.3

Valuators

Unlike text widgets, valuators keep track of numbers instead of strings. FLTK provides the following valuators: Fl_Counter - A widget with arrow buttons that shows the current value. Fl_Dial - A round knob. Fl_Roller - An SGI-like dolly widget. Fl_Scrollbar - A standard scrollbar widget. Fl_Slider - A scrollbar with a knob. Fl_Value_Slider - A slider that shows the current value.

Figure 5.2: FLTK valuator widgets

The value() method gets and sets the current value of the widget. The minimum() and maximum() methods set the range of values that are reported by the widget.

5.4

Groups

The Fl_Group widget class is used as a general purpose "container" widget. Besides grouping radio buttons, the groups are used to encapsulate windows, tabs, and scrolled windows. The following group classes are available with FLTK:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

22 Fl_Double_Window - A double-buffered window on the screen. Fl_Gl_Window - An OpenGL window on the screen.

Common Widgets and Attributes

Fl_Group - The base container class; can be used to group any widgets together. Fl_Pack - A collection of widgets that are packed into the group area. Fl_Scroll - A scrolled window area. Fl_Tabs - Displays child widgets as tabs. Fl_Tile - A tiled window area. Fl_Window - A window on the screen. Fl_Wizard - Displays one group of widgets at a time.

5.5

Setting the Size and Position of Widgets

The size and position of widgets is usually set when you create them. You can access them with the x(), y(), w(), and h() methods. You can change the size and position by using the position(), resize(), and size() methods:
button->position(x, y); group->resize(x, y, width, height); window->size(width, height);

If you change a widgets size or position after it is displayed you will have to call redraw() on the widgets parent.

5.6

Colors

FLTK stores the colors of widgets as an 32-bit unsigned number that is either an index into a color palette of 256 colors or a 24-bit RGB color. The color palette is not the X or MS Windows colormap, but instead is an internal table with xed contents. See the Colors section of Drawing Things in FLTK for implementation details. There are symbols for naming some of the more common colors: FL_BLACK FL_RED FL_GREEN FL_YELLOW FL_BLUE
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

5.6 Colors FL_MAGENTA FL_CYAN FL_WHITE FL_WHITE Other symbols are used as the default colors for all FLTK widgets. FL_FOREGROUND_COLOR FL_BACKGROUND_COLOR FL_INACTIVE_COLOR FL_SELECTION_COLOR The full list of named color values can be found in FLTK Enumerations.

23

A color value can be created from its RGB components by using the fl_rgb_color() function, and decomposed again with Fl::get_color():
Fl_Color c = fl_rgb_color(85, 170, 255); Fl::get_color(c, r, g, b); // RGB to Fl_Color // Fl_Color to RGB

The widget color is set using the color() method:


button->color(FL_RED); // set color using named value

Similarly, the label color is set using the labelcolor() method:


button->labelcolor(FL_WHITE);

The Fl_Color encoding maps to a 32-bit unsigned integer representing RGBI, so it is also possible to specify a color using a hex constant as a color map index:
button->color(0x000000ff); // colormap index #255 (FL_WHITE)

or specify a color using a hex constant for the RGB components:


button->color(0xff000000); button->color(0x00ff0000); button->color(0x0000ff00); button->color(0xffffff00); // // // // RGB: RGB: RGB: RGB: red green blue white

Note If TrueColor is not available, any RGB colors will be set to the nearest entry in the colormap.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

24

Common Widgets and Attributes

5.7

Box Types

The type Fl_Boxtype stored and returned in Fl_Widget::box() is an enumeration dened in Enumerations.H. Figure 3-3 shows the standard box types included with FLTK.

Figure 5.3: FLTK box types

FL_NO_BOX means nothing is drawn at all, so whatever is already on the screen remains. The FL_..._FRAME types only draw their edges, leaving the interior unchanged. The blue color in Figure 3-3 is the area that is not drawn by the frame types.

5.7.1

Making Your Own Boxtypes

You can dene your own boxtypes by making a small function that draws the box and adding it to the table of boxtypes. Note: This interface has changed in FLTK 2.0! The Drawing Function

The drawing function is passed the bounding box and background color for the widget:
void xyz_draw(int x, int y, int w, int h, Fl_Color c) { ... }
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

5.8 Labels and Label Types A simple drawing function might ll a rectangle with the given color and then draw a black outline:
void xyz_draw(int x, int y, int w, int h, Fl_Color c) { fl_color(c); fl_rectf(x, y, w, h); fl_color(FL_BLACK); fl_rect(x, y, w, h); }

25

Fl_Boxtype _down(Fl_Boxtype b)

_down() returns the "pressed" or "down" version of a box. If no "down" version of a given box exists, the behavior of this function is undened and some random box or frame is returned. See Drawing Functions for more details. Fl_Boxtype _frame(Fl_Boxtype b)

_frame() returns the unlled, frame-only version of a box. If no frame version of a given box exists, the behavior of this function is undened and some random box or frame is returned. See Drawing Functions for more details. Fl_Boxtype _box(Fl_Boxtype b)

_box() returns the lled version of a frame. If no lled version of a given frame exists, the behavior of this function is undened and some random box or frame is returned. See Drawing Functions for more details. Adding Your Box Type

The Fl::set_boxtype() method adds or replaces the specied box type:


#define XYZ_BOX FL_FREE_BOXTYPE Fl::set_boxtype(XYZ_BOX, xyz_draw, 1, 1, 2, 2);

The last 4 arguments to Fl::set_boxtype() are the offsets for the x, y, width, and height values that should be subtracted when drawing the label inside the box. A complete box design contains four box types in this order: a lled, neutral box (UP_BOX), a lled, depressed box (DOWN_BOX), and the same as outlines only (UP_FRAME and DOWN_FRAME). The function _down(Fl_Boxtype) expects the neutral design on a boxtype with a numerical value evenly dividable by two. _frame(Fl_Boxtype) expects the UP_BOX design at a value dividable by four.

5.8

Labels and Label Types

The label(), align(), labelfont(), labelsize(), labeltype(), image(), and deimage() methods control the labeling of widgets.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

26 label()

Common Widgets and Attributes

The label() method sets the string that is displayed for the label. Symbols can be included with the label string by escaping them using the "@" symbol - "@@" displays a single at sign. Figure 3-4 shows the available symbols.

Figure 5.4: FLTK label symbols

The @ sign may also be followed by the following optional "formatting" characters, in this order: # forces square scaling, rather than distortion to the widgets shape. +[1-9] or -[1-9] tweaks the scaling a little bigger or smaller. $ ips the symbol horizontally, % ips it vertically. [0-9] - rotates by a multiple of 45 degrees. 5 and 6 do no rotation while the others point in the direction of that key on a numeric keypad. 0, followed by four more digits rotates the symbol by that amount in degrees. Thus, to show a very large arrow pointing downward you would use the label string "@+92->". align()

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

5.8 Labels and Label Types

27

The align() method positions the label. The following constants are dened and may be ORd together as needed: FL_ALIGN_CENTER - center the label in the widget. FL_ALIGN_TOP - align the label at the top of the widget. FL_ALIGN_BOTTOM - align the label at the bottom of the widget. FL_ALIGN_LEFT - align the label to the left of the widget. FL_ALIGN_RIGHT - align the label to the right of the widget. FL_ALIGN_LEFT_TOP - The label appears to the left of the widget, aligned at the top. Outside labels only. FL_ALIGN_RIGHT_TOP - The label appears to the right of the widget, aligned at the top. Outside labels only. FL_ALIGN_LEFT_BOTTOM - The label appears to the left of the widget, aligned at the bottom. Outside labels only. FL_ALIGN_RIGHT_BOTTOM - The label appears to the right of the widget, aligned at the bottom. Outside labels only. FL_ALIGN_INSIDE - align the label inside the widget. FL_ALIGN_CLIP - clip the label to the widgets bounding box. FL_ALIGN_WRAP - wrap the label text as needed. FL_ALIGN_TEXT_OVER_IMAGE - show the label text over the image. FL_ALIGN_IMAGE_OVER_TEXT - show the label image over the text (default). FL_ALIGN_IMAGE_NEXT_TO_TEXT - The image will appear to the left of the text. FL_ALIGN_TEXT_NEXT_TO_IMAGE - The image will appear to the right of the text. FL_ALIGN_IMAGE_BACKDROP - The image will be used as a background for the widget.

labeltype()

The labeltype() method sets the type of the label. The following standard label types are included: FL_NORMAL_LABEL - draws the text. FL_NO_LABEL - does nothing. FL_SHADOW_LABEL - draws a drop shadow under the text. FL_ENGRAVED_LABEL - draws edges as though the text is engraved. FL_EMBOSSED_LABEL - draws edges as thought the text is raised. FL_ICON_LABEL - draws the icon associated with the text.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

28 image() and deimage()

Common Widgets and Attributes

The image() and deimage() methods set an image that will be displayed with the widget. The deimage() method sets the image that is shown when the widget is inactive, while the image() method sets the image that is shown when the widget is active. To make an image you use a subclass of Fl_Image. Making Your Own Label Types

Label types are actually indexes into a table of functions that draw them. The primary purpose of this is to use this to draw the labels in ways inaccessible through the _font() mechanism (e.g. FL_ENGRAVED_LABEL) or with program-generated letters or symbology. Note: This interface has changed in FLTK 2.0! Label Type Functions

To setup your own label type you will need to write two functions: one to draw and one to measure the label. The draw function is called with a pointer to a Fl_Label structure containing the label information, the bounding box for the label, and the label alignment:
void xyz_draw(const Fl_Label *label, int x, int y, int w, int h, Fl_Align align ) { ... }

The label should be drawn inside this bounding box, even if FL_ALIGN_INSIDE is not enabled. The function is not called if the label value is NULL. The measure function is called with a pointer to a Fl_Label structure and references to the width and height:
void xyz_measure(const Fl_Label *label, int &w, int &h) { ... }

The function should measure the size of the label and set w and h to the size it will occupy. Adding Your Label Type

The Fl::set_labeltype() method creates a label type using your draw and measure functions:
#define XYZ_LABEL FL_FREE_LABELTYPE Fl::set_labeltype(XYZ_LABEL, xyz_draw, xyz_measure);
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

5.9 Callbacks

29

The label type number n can be any integer value starting at the constant FL_FREE_LABELTYPE. Once you have added the label type you can use the labeltype() method to select your label type. The Fl::set_labeltype() method can also be used to overload an existing label type such as FL_NORMAL_LABEL. Making your own symbols

It is also possible to dene your own drawings and add them to the symbol list, so they can be rendered as part of any label. To create a new symbol, you implement a drawing function void drawit(Fl_Color c) which typically uses the functions described in Drawing Complex Shapes to generate a vector shape inside a two-bytwo units sized box around the origin. This function is then linked into the symbols table using _add_symbol():
int fl_add_symbol(const char *name, void (*drawit)(Fl_Color), int scalable)

name is the name of the symbol without the "@"; scalable must be set to 1 if the symbol is generated using scalable vector drawing functions.
int fl_draw_symbol(const char *name,int x,int y,int w,int h,Fl_Color col)

This function draws a named symbol tting the given rectangle.

5.9

Callbacks

Callbacks are functions that are called when the value of a widget changes. A callback function is sent a Fl_Widget pointer of the widget that changed and a pointer to data that you provide:
void xyz_callback(Fl_Widget *w, void *data) { ... }

The callback() method sets the callback function for a widget. You can optionally pass a pointer to some data needed for the callback:
int xyz_data; button->callback(xyz_callback, &xyz_data);

Normally callbacks are performed only when the value of the widget changes. You can change this using the Fl_Widget::when() method:
button->when(FL_WHEN_NEVER); button->when(FL_WHEN_CHANGED); button->when(FL_WHEN_RELEASE); button->when(FL_WHEN_RELEASE_ALWAYS); button->when(FL_WHEN_ENTER_KEY); button->when(FL_WHEN_ENTER_KEY_ALWAYS); button->when(FL_WHEN_CHANGED | FL_WHEN_NOT_CHANGED);

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30

Common Widgets and Attributes

Note: You cannot delete a widget inside a callback, as the widget may still be accessed by FLTK after your callback is completed. Instead, use the Fl::delete_widget() method to mark your widget for deletion when it is safe to do so. Hint: Many programmers new to FLTK or C++ try to use a non-static class method instead of a static class method or function for their callback. Since callbacks are done outside a C++ class, the this pointer is not initialized for class methods. To work around this problem, dene a static method in your class that accepts a pointer to the class, and then have the static method call the class method(s) as needed. The data pointer you provide to the callback() method of the widget can be a pointer to the instance of your class.
class Foo { void my_callback(Fl_Widget *w); static void my_static_callback(Fl_Widget *w, void *f) { ((Foo *)f)-> my_callback(w); } ... } ... w->callback(my_static_callback, (void *)this);

5.10

Shortcuts

Shortcuts are key sequences that activate widgets such as buttons or menu items. The shortcut() method sets the shortcut for a widget:
button->shortcut(FL_Enter); button->shortcut(FL_SHIFT + b); button->shortcut(FL_CTRL + b); button->shortcut(FL_ALT + b); button->shortcut(FL_CTRL + FL_ALT + b); button->shortcut(0); // no shortcut

The shortcut value is the key event value - the ASCII value or one of the special keys described in Fl::event_key() Values combined with any modiers like Shift , Alt , and Control.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 6

Designing a Simple Text Editor


This chapter takes you through the design of a simple FLTK-based text editor.

6.1

Determining the Goals of the Text Editor

Since this will be the rst big project youll be doing with FLTK, lets dene what we want our text editor to do: 1. Provide a menubar/menus for all functions. 2. Edit a single text le, possibly with multiple views. 3. Load from a le. 4. Save to a le. 5. Cut/copy/delete/paste functions. 6. Search and replace functions. 7. Keep track of when the le has been changed.

6.2

Designing the Main Window

Now that weve outlined the goals for our editor, we can begin with the design of our GUI. Obviously the rst thing that we need is a window, which well place inside a class called EditorWindow:
class EditorWindow : public Fl_Double_Window { public: EditorWindow(int w, int h, const char* t); ~EditorWindow(); Fl_Window Fl_Input Fl_Input Fl_Button Fl_Return_Button Fl_Button *replace_dlg; *replace_find; *replace_with; *replace_all; *replace_next; *replace_cancel;

32
Fl_Text_Editor char }; *editor; search[256];

Designing a Simple Text Editor

6.3

Variables

Our text editor will need some global variables to keep track of things:
int changed = 0; char filename[256] = ""; Fl_Text_Buffer *textbuf;

The textbuf variable is the text editor buffer for our window class described previously. Well cover the other variables as we build the application.

6.4

Menubars and Menus

The rst goal requires us to use a menubar and menus that dene each function the editor needs to perform. The Fl_Menu_Item structure is used to dene the menus and items in a menubar:
Fl_Menu_Item menuitems[] = { { "&File", 0, 0, 0, FL_SUBMENU }, { "&New File", 0, (Fl_Callback *)new_cb }, { "&Open File...", FL_COMMAND + o, (Fl_Callback *)open_cb }, { "&Insert File...", FL_COMMAND + i, (Fl_Callback *)insert_cb, 0, FL_MENU_DIVIDER }, { "&Save File", FL_COMMAND + s, (Fl_Callback *)save_cb }, { "Save File &As...", FL_COMMAND + FL_SHIFT + s, (Fl_Callback *)saveas_cb , 0, FL_MENU_DIVIDER }, { "New &View", FL_ALT + v, (Fl_Callback *)view_cb, 0 }, { "&Close View", FL_COMMAND + w, (Fl_Callback *)close_cb, 0, FL_MENU_DIVIDER }, { "E&xit", FL_COMMAND + q, (Fl_Callback *)quit_cb, 0 }, { 0 }, { "&Edit", 0, 0, 0, FL_SUBMENU }, { "&Undo", FL_COMMAND + z, (Fl_Callback FL_MENU_DIVIDER }, { "Cu&t", FL_COMMAND + x, (Fl_Callback { "&Copy", FL_COMMAND + c, (Fl_Callback { "&Paste", FL_COMMAND + v, (Fl_Callback { "&Delete", 0, (Fl_Callback *)delete_cb }, { 0 }, { "&Search", 0, 0, 0, { "&Find...", { "F&ind Again", { "&Replace...", { "Re&place Again", { 0 }, { 0 } }; FL_SUBMENU FL_COMMAND FL_COMMAND FL_COMMAND FL_COMMAND }, + f, + g, + r, + t,

*)undo_cb, 0, *)cut_cb }, *)copy_cb }, *)paste_cb },

(Fl_Callback *)find_cb }, find2_cb }, replace_cb }, replace2_cb },

Once we have the menus dened we can create the Fl_Menu_Bar widget and assign the menus to it with:
Fl_Menu_Bar *m = new Fl_Menu_Bar(0, 0, 640, 30); m->copy(menuitems);
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

6.5 Editing the Text Well dene the callback functions later.

33

6.5

Editing the Text

To keep things simple our text editor will use the Fl_Text_Editor widget to edit the text:
w->editor = new Fl_Text_Editor(0, 30, 640, 370); w->editor->buffer(textbuf);

So that we can keep track of changes to the le, we also want to add a "modify" callback:
textbuf->add_modify_callback(changed_cb, w); textbuf->call_modify_callbacks();

Finally, we want to use a mono-spaced font like FL_COURIER:


w->editor->textfont(FL_COURIER);

6.6

The Replace Dialog

We can use the FLTK convenience functions for many of the editors dialogs, however the replace dialog needs its own custom window. To keep things simple we will have a "nd" string, a "replace" string, and "replace all", "replace next", and "cancel" buttons. The strings are just Fl_Input widgets, the "replace all" and "cancel" buttons are Fl_Button widgets, and the "replace next " button is a Fl_Return_Button widget:

Figure 6.1: The search and replace dialog

Fl_Window *replace_dlg = new Fl_Window(300, 105, "Replace"); Fl_Input *replace_find = new Fl_Input(70, 10, 200, 25, "Find:"); Fl_Input *replace_with = new Fl_Input(70, 40, 200, 25, "Replace:"); Fl_Button *replace_all = new Fl_Button(10, 70, 90, 25, "Replace All"); Fl_Button *replace_next = new Fl_Button(105, 70, 120, 25, "Replace Next"); Fl_Button *replace_cancel = new Fl_Button(230, 70, 60, 25, "Cancel");

6.7

Callbacks

Now that weve dened the GUI components of our editor, we need to dene our callback functions.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

34

Designing a Simple Text Editor

6.7.1

changed cb()

This function will be called whenever the user changes any text in the editor widget:
void changed_cb(int, int nInserted, int nDeleted,int, const char*, void* v) { if ((nInserted || nDeleted) && !loading) changed = 1; EditorWindow *w = (EditorWindow *)v; set_title(w); if (loading) w->editor->show_insert_position(); }

The set_title() function is one that we will write to set the changed status on the current le. Were doing it this way because we want to show the changed status in the windows title bar.

6.7.2

copy cb()

This callback function will call Fl_Text_Editor::kf_copy() to copy the currently selected text to the clipboard:
void copy_cb(Fl_Widget*, void* v) { EditorWindow* e = (EditorWindow*)v; Fl_Text_Editor::kf_copy(0, e->editor); }

6.7.3

cut cb()

This callback function will call Fl_Text_Editor::kf_cut() to cut the currently selected text to the clipboard:
void cut_cb(Fl_Widget*, void* v) { EditorWindow* e = (EditorWindow*)v; Fl_Text_Editor::kf_cut(0, e->editor); }

6.7.4

delete cb()

This callback function will call Fl_Text_Buffer::remove_selection() to delete the currently selected text to the clipboard:
void delete_cb(Fl_Widget*, void* v) { textbuf->remove_selection(); }

6.7.5

nd cb()

This callback function asks for a search string using the _input() convenience function and then calls the find2_cb() function to nd the string:
void find_cb(Fl_Widget* w, void* v) { EditorWindow* e = (EditorWindow*)v; const char *val; val = fl_input("Search String:", e->search); if (val != NULL) { // User entered a string - go find it!
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

6.7 Callbacks
strcpy(e->search, val); find2_cb(w, v); }

35

6.7.6

nd2 cb()

This function will nd the next occurrence of the search string. If the search string is blank then we want to pop up the search dialog:
void find2_cb(Fl_Widget* w, void* v) { EditorWindow* e = (EditorWindow*)v; if (e->search[0] == \0) { // Search string is blank; get a new one... find_cb(w, v); return; } int pos = e->editor->insert_position(); int found = textbuf->search_forward(pos, e->search, &pos); if (found) { // Found a match; select and update the position... textbuf->select(pos, pos+strlen(e->search)); e->editor->insert_position(pos+strlen(e->search)); e->editor->show_insert_position(); } else fl_alert("No occurrences of \%s\ found!", e->search); }

If the search string cannot be found we use the _alert() convenience function to display a message to that effect.

6.7.7

new cb()

This callback function will clear the editor widget and current lename. It also calls the check_save() function to give the user the opportunity to save the current le rst as needed:
void new_cb(Fl_Widget*, void*) { if (!check_save()) return; filename[0] = \0; textbuf->select(0, textbuf->length()); textbuf->remove_selection(); changed = 0; textbuf->call_modify_callbacks(); }

6.7.8

open cb()

This callback function will ask the user for a lename and then load the specied le into the input widget and current lename. It also calls the check_save() function to give the user the opportunity to save the current le rst as needed:
void open_cb(Fl_Widget*, void*) { if (!check_save()) return; char *newfile = fl_file_chooser("Open File?", "*", filename); if (newfile != NULL) load_file(newfile, -1); }
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

36 We call the load_file() function to actually load the le.

Designing a Simple Text Editor

6.7.9

paste cb()

This callback function will call Fl_Text_Editor::kf_paste() to paste the clipboard at the current position:
void paste_cb(Fl_Widget*, void* v) { EditorWindow* e = (EditorWindow*)v; Fl_Text_Editor::kf_paste(0, e->editor); }

6.7.10

quit cb()

The quit callback will rst see if the current le has been modied, and if so give the user a chance to save it. It then exits from the program:
void quit_cb(Fl_Widget*, void*) { if (changed && !check_save()) return; exit(0); }

6.7.11

replace cb()

The replace callback just shows the replace dialog:


void replace_cb(Fl_Widget*, void* v) { EditorWindow* e = (EditorWindow*)v; e->replace_dlg->show(); }

6.7.12

replace2 cb()

This callback will replace the next occurrence of the replacement string. If nothing has been entered for the replacement string, then the replace dialog is displayed instead:
void replace2_cb(Fl_Widget*, void* v) { EditorWindow* e = (EditorWindow*)v; const char *find = e->replace_find->value(); const char *replace = e->replace_with->value(); if (find[0] == \0) { // Search string is blank; get a new one... e->replace_dlg->show(); return; } e->replace_dlg->hide(); int pos = e->editor->insert_position(); int found = textbuf->search_forward(pos, find, &pos); if (found) { // Found a match; update the position and replace text... textbuf->select(pos, pos+strlen(find));
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

6.7 Callbacks
textbuf->remove_selection(); textbuf->insert(pos, replace); textbuf->select(pos, pos+strlen(replace)); e->editor->insert_position(pos+strlen(replace)); e->editor->show_insert_position(); } else fl_alert("No occurrences of \%s\ found!", find); }

37

6.7.13

replall cb()

This callback will replace all occurrences of the search string in the file:
void replall_cb(Fl_Widget*, void* v) { EditorWindow* e = (EditorWindow*)v; const char *find = e->replace_find->value(); const char *replace = e->replace_with->value(); find = e->replace_find->value(); if (find[0] == \0) { // Search string is blank; get a new one... e->replace_dlg->show(); return; } e->replace_dlg->hide(); e->editor->insert_position(0); int times = 0; // Loop through the whole string for (int found = 1; found;) { int pos = e->editor->insert_position(); found = textbuf->search_forward(pos, find, &pos); if (found) { // Found a match; update the position and replace text... textbuf->select(pos, pos+strlen(find)); textbuf->remove_selection(); textbuf->insert(pos, replace); e->editor->insert_position(pos+strlen(replace)); e->editor->show_insert_position(); times++; } } if (times) fl_message("Replaced %d occurrences.", times); else fl_alert("No occurrences of \%s\ found!", find); }

6.7.14

replcan cb()

This callback just hides the replace dialog:


void replcan_cb(Fl_Widget*, void* v) { EditorWindow* e = (EditorWindow*)v; e->replace_dlg->hide(); }

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

38

Designing a Simple Text Editor

6.7.15

save cb()

This callback saves the current le. If the current lename is blank it calls the "save as" callback:
void save_cb(void) { if (filename[0] == \0) { // No filename - get one! saveas_cb(); return; } else save_file(filename); }

The save_file() function saves the current le to the specied lename.

6.7.16

saveas cb()

This callback asks the user for a lename and saves the current file:
void saveas_cb(void) { char *newfile; newfile = fl_file_chooser("Save File As?", "*", filename); if (newfile != NULL) save_file(newfile); }

The save_file() function saves the current le to the specied lename.

6.8

Other Functions

Now that weve dened the callback functions, we need our support functions to make it all work:

6.8.1

check save()

This function checks to see if the current le needs to be saved. If so, it asks the user if they want to save it:
int check_save(void) { if (!changed) return 1; int r = fl_choice("The current file has not been saved.\n" "Would you like to save it now?", "Cancel", "Save", "Discard"); if (r == 1) { save_cb(); // Save the file... return !changed; } return (r == 2) ? 1 : 0; }

6.8.2

load le()

This function loads the specied le into the textbuf variable:


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

6.9 The main() Function


int loading = 0; void load_file(char *newfile, int ipos) { loading = 1; int insert = (ipos != -1); changed = insert; if (!insert) strcpy(filename, ""); int r; if (!insert) r = textbuf->loadfile(newfile); else r = textbuf->insertfile(newfile, ipos); if (r) fl_alert("Error reading from file \%s\:\n%s.", newfile, strerror(errno)); else if (!insert) strcpy(filename, newfile); loading = 0; textbuf->call_modify_callbacks(); }

39

When loading the le we use the Fl_Text_Buffer::loadle() method to "replace" the text in the buffer, or the Fl_Text_Buffer::insertle() method to insert text in the buffer from the named le.

6.8.3

save le()

This function saves the current buffer to the specied file:


void save_file(char *newfile) { if (textbuf->savefile(newfile)) fl_alert("Error writing to file \%s\:\n%s.", newfile, strerror(errno)); else strcpy(filename, newfile); changed = 0; textbuf->call_modify_callbacks(); }

6.8.4

set title()

This function checks the changed variable and updates the window label accordingly:
void set_title(Fl_Window* w) { if (filename[0] == \0) strcpy(title, "Untitled"); else { char *slash; slash = strrchr(filename, /); #ifdef WIN32 if (slash == NULL) slash = strrchr(filename, \\); #endif if (slash != NULL) strcpy(title, slash + 1); else strcpy(title, filename); } if (changed) strcat(title, " (modified)"); w->label(title); }

6.9

The main() Function

Once weve created all of the support functions, the only thing left is to tie them all together with the main() function. The main() function creates a new text buffer, creates a new view (window) for the text, shows the window, loads the le on the command-line (if any), and then enters the FLTK event loop:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

40
int main(int argc, char **argv) { textbuf = new Fl_Text_Buffer; Fl_Window* window = new_view(); window->show(1, argv); if (argc > 1) load_file(argv[1], -1); return Fl::run(); }

Designing a Simple Text Editor

6.10

Compiling the Editor

The complete source for our text editor can be found in the test/editor.cxx source le. Both the Makele and Visual C++ workspace include the necessary rules to build the editor. You can also compile it using a standard compiler with:

CC -o editor editor.cxx -lfltk -lXext -lX11 -lm

or by using the fltk-config script with:

fltk-config --compile editor.cxx

As noted in Compiling Programs with Standard Compilers, you may need to include compiler and linker options to tell them where to nd the FLTK library. Also, the CC command may also be called gcc or c++ on your system. Congratulations, youve just built your own text editor!

6.11

The Final Product

The nal editor window should look like the image in Figure 4-2.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

6.12 Advanced Features

41

Figure 6.2: The completed editor window

6.12

Advanced Features

Now that weve implemented the basic functionality, it is time to show off some of the advanced features of the Fl_Text_Editor widget.

6.12.1

Syntax Highlighting

The Fl_Text_Editor widget supports highlighting of text with different fonts, colors, and sizes. The implementation is based on the excellent NEdit text editor core, from http://www.nedit.org/, which uses a parallel "style" buffer which tracks the font, color, and size of the text that is drawn. Styles are dened using the Fl_Text_Display::Style_Table_Entry structure dened in <FL/Fl_Text_Display.H>:
struct Style_Table_Entry { Fl_Color color; Fl_Font font; int size; unsigned attr; };

The color member sets the color for the text, the font member sets the FLTK font index to use, and the size member sets the pixel size of the text. The attr member is currently not used. For our text editor well dene 7 styles for plain code, comments, keywords, and preprocessor directives:
Fl_Text_Display::Style_Table_Entry styletable[] = { // Style table { FL_BLACK, FL_COURIER, FL_NORMAL_SIZE }, // A - Plain
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

42
{ { { { { { }; FL_DARK_GREEN, FL_DARK_GREEN, FL_BLUE, FL_DARK_RED, FL_DARK_RED, FL_BLUE, FL_COURIER_ITALIC, FL_COURIER_ITALIC, FL_COURIER, FL_COURIER, FL_COURIER_BOLD, FL_COURIER_BOLD, FL_NORMAL_SIZE FL_NORMAL_SIZE FL_NORMAL_SIZE FL_NORMAL_SIZE FL_NORMAL_SIZE FL_NORMAL_SIZE }, }, }, }, }, } // // // // // // B C D E F G

Designing a Simple Text Editor


Line comments Block comments Strings Directives Types Keywords

Youll notice that the comments show a letter next to each style - each style in the style buffer is referenced using a character starting with the letter A. You call the highlight_data() method to associate the style data and buffer with the text editor widget:
Fl_Text_Buffer *stylebuf; w->editor->highlight_data(stylebuf, styletable, sizeof(styletable) / sizeof(styletable[0]), A, style_unfinished_cb, 0);

Finally, you need to add a callback to the main text buffer so that changes to the text buffer are mirrored in the style buffer:
textbuf->add_modify_callback(style_update, w->editor);

The style_update() function, like the change_cb() function described earlier, is called whenever text is added or removed from the text buffer. It mirrors the changes in the style buffer and then updates the style data as necessary:
// // style_update() - Update the style buffer... // void style_update(int pos, int nInserted, int nDeleted, int nRestyled, const char *deletedText, void *cbArg) { int start, end; char last, *style, *text;

// // // // // // // // // // //

I - Position of update I - Number of inserted chars I - Number of deleted chars I - Number of restyled chars I - Text that was deleted I - Callback data Start of text End of text Last style on line Style data Text data

// If this is just a selection change, just unselect the style buffer... if (nInserted == 0 && nDeleted == 0) { stylebuf->unselect(); return; } // Track changes in the text buffer... if (nInserted > 0) { // Insert characters into the style buffer... style = new char[nInserted + 1]; memset(style, A, nInserted); style[nInserted] = \0; stylebuf->replace(pos, pos + nDeleted, style); delete[] style;
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

6.12 Advanced Features


} else { // Just delete characters in the style buffer... stylebuf->remove(pos, pos + nDeleted); } // Select the area that was just updated to avoid unnecessary // callbacks... stylebuf->select(pos, pos + nInserted - nDeleted); // Re-parse the changed region; we do this by parsing from the // beginning of the line of the changed region to the end of // the line of the changed region... Then we check the last // style character and keep updating if we have a multi-line // comment character... start = textbuf->line_start(pos); end = textbuf->line_end(pos + nInserted - nDeleted); text = textbuf->text_range(start, end); style = stylebuf->text_range(start, end); last = style[end - start - 1]; style_parse(text, style, end - start); stylebuf->replace(start, end, style); ((Fl_Text_Editor *)cbArg)->redisplay_range(start, end); if (last != style[end - start - 1]) { // The last character on the line changed styles, so reparse the // remainder of the buffer... free(text); free(style); end = textbuf->length(); text = textbuf->text_range(start, end); style = stylebuf->text_range(start, end); style_parse(text, style, end - start); stylebuf->replace(start, end, style); ((Fl_Text_Editor *)cbArg)->redisplay_range(start, end); } free(text); free(style); }

43

The style_parse() function scans a copy of the text in the buffer and generates the necessary style characters for display. It assumes that parsing begins at the start of a line:
// // style_parse() - Parse text and produce style data. // void style_parse(const char *text, char *style, int length) { char current; int col; int last; char buf[255], *bufptr; const char *temp; for (current = *style, col = 0, last = 0; length > 0; length --, text ++) { if (current == A) { // Check for directives, comments, strings, and keywords...
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

44

Designing a Simple Text Editor


if (col == 0 && *text == #) { // Set style to directive current = E; } else if (strncmp(text, "//", 2) == 0) { current = B; } else if (strncmp(text, "/*", 2) == 0) { current = C; } else if (strncmp(text, "\\\"", 2) == 0) { // Quoted quote... *style++ = current; *style++ = current; text ++; length --; col += 2; continue; } else if (*text == \") { current = D; } else if (!last && islower(*text)) { // Might be a keyword... for (temp = text, bufptr = buf; islower(*temp) && bufptr < (buf + sizeof(buf) - 1); *bufptr++ = *temp++); if (!islower(*temp)) { *bufptr = \0; bufptr = buf; if (bsearch(&bufptr, code_types, sizeof(code_types) / sizeof(code_types[0]), sizeof(code_types[0]), compare_keywords)) { while (text < temp) { *style++ = F; text ++; length --; col ++; } text --; length ++; last = 1; continue; } else if (bsearch(&bufptr, code_keywords, sizeof(code_keywords) / sizeof(code_keywords[0]), sizeof(code_keywords[0]), compare_keywords)) { while (text < temp) { *style++ = G; text ++; length --; col ++; } text --; length ++; last = 1; continue; } } } } else if (current == C && strncmp(text, "*/", 2) == 0) { // Close a C comment... *style++ = current; *style++ = current; text ++; length --; current = A; col += 2;

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

6.12 Advanced Features


continue; } else if (current == D) { // Continuing in string... if (strncmp(text, "\\\"", 2) == 0) { // Quoted end quote... *style++ = current; *style++ = current; text ++; length --; col += 2; continue; } else if (*text == \") { // End quote... *style++ = current; col ++; current = A; continue; } } // Copy style info... if (current == A && (*text == { || *text == })) *style++ = G; else *style++ = current; col ++; last = isalnum(*text) || *text == .; if (*text == \n) { // Reset column and possibly reset the style col = 0; if (current == B || current == E) current = A; } } }

45

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

46

Designing a Simple Text Editor

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 7

Drawing Things in FLTK


This chapter covers the drawing functions that are provided with FLTK.

7.1

When Can You Draw Things in FLTK?

There are only certain places you can execute drawing code in FLTK. Calling these functions at other places will result in undened behavior! The most common place is inside the virtual Fl_Widget::draw() method. To write code here, you must subclass one of the existing Fl_Widget classes and implement your own version of draw(). You can also create custom boxtypes and labeltypes. These involve writing small procedures that can be called by existing Fl_Widget::draw() methods. These "types" are identied by an 8-bit index that is stored in the widgets box(), labeltype(), and possibly other properties. You can call Fl_Window::make_current() to do incremental update of a widget. Use Fl_Widget::window() to nd the window.

7.2

Drawing Functions

To use the drawing functions you must rst include the <FL/_draw.H> header le. FLTK provides the following types of drawing functions: Boxes Clipping Colors Line Dashes and Thickness Drawing Fast Shapes Drawing Complex Shapes Drawing Text

48 Fonts Character Encoding Drawing Overlays Drawing Images Direct Image Drawing Direct Image Reading Image Classes Offscreen Drawing

Drawing Things in FLTK

7.2.1

Boxes

FLTK provides three functions that can be used to draw boxes for buttons and other UI controls. Each function uses the supplied upper-lefthand corner and width and height to determine where to draw the box. void _draw_box(Fl_Boxtype b, int x, int y, int w, int h, Fl_Color c);

The fl_draw_box() function draws a standard boxtype b in the specied color c. void _frame(const char s, int x, int y, int w, int h) void _frame2(const char s, int x, int y, int w, int h)

The fl_frame() and fl_frame2() functions draw a series of line segments around the given box. The string s must contain groups of 4 letters which specify one of 24 standard grayscale values, where A is black and X is white. The results of calling these functions with a string that is not a multiple of 4 characters in length are undened.

The only difference between fl_frame() and fl_frame2() is the order of the line segments: For fl_frame() the order of each set of 4 characters is: top, left, bottom, right. For fl_frame2() the order of each set of 4 characters is: bottom, right, top, left.

Note that _frame(Fl_Boxtype b) is described in the Box Types section.

7.2.2

Clipping

You can limit all your drawing to a rectangular region by calling fl_push_clip(), and put the drawings back by using fl_pop_clip(). This rectangle is measured in pixels and is unaffected by the current transformation matrix. In addition, the system may provide clipping when updating windows which may be more complex than a simple rectangle. void _push_clip(int x, int y, int w, int h) void _clip(int x, int y, int w, int h)
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

7.3 Colors

49

Intersect the current clip region with a rectangle and push this new region onto the stack.

The fl_clip() version is deprecated and will be removed from future releases. void _push_no_clip()

Pushes an empty clip region on the stack so nothing will be clipped. void _pop_clip()

Restore the previous clip region.

Note: You must call fl_pop_clip() once for every time you call fl_push_clip(). If you return to FLTK with the clip stack not empty unpredictable results occur. int _not_clipped(int x, int y, int w, int h)

Returns non-zero if any of the rectangle intersects the current clip region. If this returns 0 you dont have to draw the object.

Note: Under X this returns 2 if the rectangle is partially clipped, and 1 if it is entirely inside the clip region. int _clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H)

Intersect the rectangle x,y,w,h with the current clip region and returns the bounding box of the result in X,Y,W,H. Returns non-zero if the resulting rectangle is different than the original. This can be used to limit the necessary drawing to a rectangle. W and H are set to zero if the rectangle is completely outside the region. void _clip_region(Fl_Region r) Fl_Region _clip_region()

Replace the top of the clip stack with a clipping region of any shape. Fl_Region is an operating system specic type. The second form returns the current clipping region.

7.3

Colors

FLTK manages colors as 32-bit unsigned integers, encoded as RGBI. When the RGB bytes are non-zero, the value is treated as RGB. If these bytes are zero, the I byte will be used as an index into the colormap. Values from 0 to 255, i.e. the I index value, represent colors from the FLTK 1.3.x standard colormap and are allocated as needed on screens without TrueColor support. The Fl_Color enumeration type denes
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

50

Drawing Things in FLTK

the standard colors and color cube for the rst 256 colors. All of these are named with symbols in <FL/Enumerations.H>. Color values greater than 255 are treated as 24-bit RGB values. These are mapped to the closest color supported by the screen, either from one of the 256 colors in the FLTK 1.3.x colormap or a direct RGB value on TrueColor screens. Fl_Color _rgb_color(uchar r, uchar g, uchar b) Fl_Color _rgb_color(uchar grayscale)

Generate Fl_Color out of specied 8-bit RGB values or one 8-bit grayscale value. void _color(Fl_Color c) void _color(int c)

Sets the color for all subsequent drawing operations. Please use the rst form: the second form is only provided for back compatibility.

For colormapped displays, a color cell will be allocated out of fl_colormap the rst time you use a color. If the colormap lls up then a least-squares algorithm is used to nd the closest color. Fl_Color _color()

Returns the last color that was set using fl_color(). This can be used for state save/restore. void _color(uchar r, uchar g, uchar b)

Set the color for all subsequent drawing operations. The closest possible match to the RGB color is used. The RGB color is used directly on TrueColor displays. For colormap visuals the nearest index in the gray ramp or color cube is used. unsigned Fl::get_color(Fl_Color i) void Fl::get_color(Fl_Color i, uchar &red, uchar &green, uchar &blue)

Generate RGB values from a colormap index value i. The rst returns the RGB as a 32-bit unsigned integer, and the second decomposes the RGB into three 8-bit values. Todo work out why Fl::get_color() does not give links! Fl::get_system_colors() Fl::foreground() Fl::background() Fl::background2()
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

7.3 Colors

51

The rst gets color values from the user preferences or the system, and the other routines are used to apply those values. Fl::own_colormap() Fl::free_color(Fl_Color i, int overlay) Fl::set_color(Fl_Color i, unsigned c)

Fl::own_colormap() is used to install a local colormap [X11 only].

Fl::free_color() and Fl::set_color() are used to remove and replace entries from the colormap. Todo work out why these do not give links! There are two predened graphical interfaces for choosing colors. The function _show_colormap() shows a table of colors and returns an Fl_Color index value. The Fl_Color_Chooser widget provides a standard RGB color chooser. As the Fl_Color encoding maps to a 32-bit unsigned integer representing RGBI, it is also possible to specify a color using a hex constant as a color map index:
// COLOR MAP INDEX color(0x000000II) ------ | | | | Color map index (8 bits) Must be zero
button->color(0x000000ff); // colormap index #255 (FL_WHITE)

or specify a color using a hex constant for the RGB components:


// RGB COLOR ASSIGNMENTS color(0xRRGGBB00) | | | | | | | Must be zero | | Blue (8 bits) | Green (8 bits) Red (8 bits)
button->color(0xff000000); button->color(0x00ff0000); button->color(0x0000ff00); button->color(0xffffff00); // // // // RGB: RGB: RGB: RGB: red green blue white

Note If TrueColor is not available, any RGB colors will be set to the nearest entry in the colormap.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

52

Drawing Things in FLTK

7.3.1

Line Dashes and Thickness

FLTK supports drawing of lines with different styles and widths. Full functionality is not available under Windows 95, 98, and Me due to the reduced drawing functionality these operating systems provide. void _line_style(int style, int width, char dashes)

Set how to draw lines (the "pen"). If you change this it is your responsibility to set it back to the default with fl_line_style(0).

Note: Because of how line styles are implemented on MS Windows systems, you must set the line style after setting the drawing color. If you set the color after the line style you will lose the line style settings!

style is a bitmask which is a bitwise-OR of the following values. If you dont specify a dash type you will get a solid line. If you dont specify a cap or join type you will get a system-dened default of whatever value is fastest.

FL_SOLID FL_DASH FL_DOT FL_DASHDOT

------- - - ....... - . - . -

FL_DASHDOTDOT - .. FL_CAP_FLAT FL_CAP_ROUND

FL_CAP_SQUARE (extends past end point 1/2 line width) FL_JOIN_MITER (pointed) FL_JOIN_ROUND FL_JOIN_BEVEL (at)

width is the number of pixels thick to draw the lines. Zero results in the system-dened default, which on both X and Windows is somewhat different and nicer than 1.

dashes is a pointer to an array of dash lengths, measured in pixels. The rst location is how long to draw a solid portion, the next is how long to draw the gap, then the solid, etc. It is terminated with a zero-length entry. A NULL pointer or a zero-length array results in a solid line. Odd array sizes are not supported and result in undened behavior.

Note: The dashes array does not work under Windows 95, 98, or Me, since those operating systems do not support complex line styles.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

7.3 Colors

53

7.3.2

Drawing Fast Shapes

These functions are used to draw almost all the FLTK widgets. They draw on exact pixel boundaries and are as fast as possible. Their behavior is duplicated exactly on all platforms FLTK is ported. It is undened whether these are affected by the transformation matrix, so you should only call these while the matrix is set to the identity matrix (the default). void _point(int x, int y)

Draw a single pixel at the given coordinates. void _rectf(int x, int y, int w, int h) void _rectf(int x, int y, int w, int h)

Color a rectangle that exactly lls the given bounding box. void _rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b)

Color a rectangle with "exactly" the passed r,g,b color. On screens with less than 24 bits of color this is done by drawing a solid-colored block using _draw_image() so that the correct color shade is produced. void _rect(int x, int y, int w, int h) void _rect(int x, int y, int w, int h, Fl_Color c)

Draw a 1-pixel border inside this bounding box. void _line(int x, int y, int x1, int y1) void _line(int x, int y, int x1, int y1, int x2, int y2)

Draw one or two lines between the given points. void _loop(int x, int y, int x1, int y1, int x2, int y2) void _loop(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3)

Outline a 3 or 4-sided polygon with lines. void _polygon(int x, int y, int x1, int y1, int x2, int y2) void _polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3)

Fill a 3 or 4-sided polygon. The polygon must be convex.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

54 void _xyline(int x, int y, int x1) void _xyline(int x, int y, int x1, int y2) void _xyline(int x, int y, int x1, int y2, int x3)

Drawing Things in FLTK

Draw horizontal and vertical lines. A horizontal line is drawn rst, then a vertical, then a horizontal. void _yxline(int x, int y, int y1) void _yxline(int x, int y, int y1, int x2) void _yxline(int x, int y, int y1, int x2, int y3)

Draw vertical and horizontal lines. A vertical line is drawn rst, then a horizontal, then a vertical. void _arc(int x, int y, int w, int h, double a1, double a2) void _pie(int x, int y, int w, int h, double a1, double a2)

Draw ellipse sections using integer coordinates. These functions match the rather limited circle drawing code provided by X and MS Windows. The advantage over using _arc() with oating point coordinates is that they are faster because they often use the hardware, and they draw much nicer small circles, since the small sizes are often hard-coded bitmaps.

If a complete circle is drawn it will t inside the passed bounding box. The two angles are measured in degrees counter-clockwise from 3oclock and are the starting and ending angle of the arc, a2 must be greater or equal to a1.

fl_arc() draws a series of lines to approximate the arc. Notice that the integer version of fl_arc() has a different number of arguments to the other _arc() function described later in this chapter.

fl_pie() draws a lled-in pie slice. This slice may extend outside the line drawn by fl_arc(); to avoid this use w-1 and h-1. Todo add an Fl_Draw_Area_Cb typedef to allow _scroll(...) to be doxygenated? void _scroll(int X, int Y, int W, int H, int dx, int dy, void (draw_area)(void, int,int,int,int), void data)

Scroll a rectangle and draw the newly exposed portions. The contents of the rectangular area is rst shifted by dx and dy pixels. The callback is then called for every newly exposed rectangular area,

7.3.3

Drawing Complex Shapes

The complex drawing functions let you draw arbitrary shapes with 2-D linear transformations. The functionality matches that found in the AdobePostScriptlanguage. The exact pixels that are lled are less dened than for the fast drawing functions so that FLTK can take advantage of drawing hardware. On both
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

7.3 Colors

55

X and MS Windows the transformed vertices are rounded to integers before drawing the line segments: this severely limits the accuracy of these functions for complex graphics, so use OpenGL when greater accuracy and/or performance is required. void _push_matrix() void _pop_matrix()

Save and restore the current transformation. The maximum depth of the stack is 32 entries. void _scale(double x,double y) void _scale(double x) void _translate(double x,double y) void _rotate(double d) void _mult_matrix(double a,double b,double c,double d,double x,double y)

Concatenate another transformation onto the current one. The rotation angle is in degrees (not radians) and is counter-clockwise. double _transform_x(double x, double y) double _transform_y(double x, double y) double _transform_dx(double x, double y) double _transform_dy(double x, double y) void _transformed_vertex(double xf, double yf)

Transform a coordinate or a distance using the current transformation matrix. After transforming a coordinate pair, it can be added to the vertex list without any further translations using fl_transformed_vertex(). void _begin_points() void _end_points()

Start and end drawing a list of points. Points are added to the list with fl_vertex(). void _begin_line() void _end_line()

Start and end drawing lines. void _begin_loop() void _end_loop()

Start and end drawing a closed sequence of lines.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

56 void _begin_polygon() void _end_polygon()

Drawing Things in FLTK

Start and end drawing a convex lled polygon. void _begin_complex_polygon() void _gap() void _end_complex_polygon()

Start and end drawing a complex lled polygon. This polygon may be concave, may have holes in it, or may be several disconnected pieces. Call fl_gap() to separate loops of the path. It is unnecessary but harmless to call fl_gap() before the rst vertex, after the last one, or several times in a row.

fl_gap() should only be called between fl_begin_complex_polygon() and fl_end_complex_polygon(). To outline the polygon, use fl_begin_loop() and replace each fl_gap() with a fl_end_loop();_begin_loop() pair.

Note: For portability, you should only draw polygons that appear the same whether "even/odd" or "non-zero" winding rules are used to ll them. Holes should be drawn in the opposite direction of the outside loop. void _vertex(double x,double y)

Add a single vertex to the current path. void _curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3)

Add a series of points on a Bezier curve to the path. The curve ends (and two of the points) are at X0,Y0 and X3,Y3. void _arc(double x, double y, double r, double start, double end)

Add a series of points to the current path on the arc of a circle; you can get elliptical paths by using scale and rotate before calling fl_arc(). The center of the circle is given by x and y, and r is its radius. fl_arc() takes start and end angles that are measured in degrees counter-clockwise from 3 oclock. If end is less than start then it draws the arc in a clockwise direction. void _circle(double x, double y, double r)

fl_circle(...) is equivalent to fl_arc(...,0,360) but may be faster. It must be the only thing in the path: if you want a circle as part of a complex polygon you must use fl_arc().

Note: fl_circle() draws incorrectly if the transformation is both rotated and non-square scaled.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

7.3 Colors

57

7.3.4

Drawing Text

All text is drawn in the current font. It is undened whether this location or the characters are modied by the current transformation. void _draw(const char , int x, int y) void _draw(const char , int n, int x, int y)

Draw a nul-terminated string or an array of n characters starting at the given location. Text is aligned to the left and to the baseline of the font. To align to the bottom, subtract fl_descent() from y. To align to the top, subtract fl_descent() and add fl_height(). This version of fl_draw() provides direct access to the text drawing function of the underlying OS. It does not apply any special handling to control characters. void _draw(const char str, int x, int y, int w, int h, Fl_Align align, Fl_Image img, int draw_symbols)

Fancy string drawing function which is used to draw all the labels. The string is formatted and aligned inside the passed box. Handles \t and \n, expands all other control characters to X, and aligns inside or against the edges of the box described by x, y, w and h. See Fl_Widget::align() for values for align. The value FL_ALIGN_INSIDE is ignored, as this function always prints inside the box.

If img is provided and is not NULL, the image is drawn above or below the text as specied by the align value.

The draw_symbols argument species whether or not to look for symbol names starting with the "@" character.

The text length is limited to 1024 characters per line. void _measure(const char str, int& w, int& h, int draw_symbols)

Measure how wide and tall the string will be when printed by the fl_draw(...align) function. If the incoming w is non-zero it will wrap to that width. int _height()

Recommended minimum line spacing for the current font. You can also just use the value of size passed to _font(). int _descent()

Recommended distance above the bottom of a fl_height() tall box to draw the text at so it looks centered vertically in that box.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

58 double _width(const char txt) double _width(const char txt, int n) double _width(unsigned int unicode_char)

Drawing Things in FLTK

Return the pixel width of a nul-terminated string, a sequence of n characters, or a single character in the current font. const char _shortcut_label(int shortcut)

Unparse a shortcut value as used by Fl_Button or Fl_Menu_Item into a human-readable string like "Alt+N". This only works if the shortcut is a character key or a numbered function key. If the shortcut is zero an empty string is returned. The return value points at a static buffer that is overwritten with each call.

7.3.5

Fonts

FLTK supports a set of standard fonts based on the Times, Helvetica/Arial, Courier, and Symbol typefaces, as well as custom fonts that your application may load. Each font is accessed by an index into a font table. Initially only the rst 16 faces are lled in. There are symbolic names for them: FL_HELVETICA, FL_TIMES, FL_COURIER, and modier values FL_BOLD and FL_ITALIC which can be added to these, and FL_SYMBOL and FL_ZAPF_DINGBATS. Faces greater than 255 cannot be used in Fl_Widget labels, since Fl_Widget stores the index as a byte. void _font(int face, int size)

Set the current font, which is then used by the routines described above. You may call this outside a draw context if necessary to call _width(), but on X this will open the display.

The font is identied by a face and a size. The size of the font is measured in pixels and not "points". Lines should be spaced size pixels apart or more. int _font() int _size()

Returns the face and size set by the most recent call to fl_font(a,b). This can be used to save/restore the font.

7.3.6

Character Encoding

FLTK 1.3 expects all text in Unicode UTF-8 encoding. UTF-8 is ASCII compatible for the rst 128 characters. International characters are encoded in multibyte sequences. FLTK expects individual characters, characters that are not part of a string, in UCS-4 encoding, which is also ASCII compatible, but requires 4 bytes to store a Unicode character. For more information about character encodings, see the chapter on Unicode and UTF-8 Support.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

7.4 Drawing Images

59

7.3.7

Drawing Overlays

These functions allow you to draw interactive selection rectangles without using the overlay hardware. FLTK will XOR a single rectangle outline over a window. void _overlay_rect(int x, int y, int w, int h); void _overlay_clear();

fl_overlay_rect() draws a selection rectangle, erasing any previous rectangle by XORing it rst. fl_overlay_clear() will erase the rectangle without drawing a new one.

Using these functions is tricky. You should make a widget with both a handle() and draw() method. draw() should call fl_overlay_clear() before doing anything else. Your handle() method should call window()->make_current() and then fl_overlay_rect() after FL_DRAG events, and should call fl_overlay_clear() after a FL_RELEASE event.

7.4

Drawing Images

To draw images, you can either do it directly from data in your memory, or you can create a Fl_Image object. The advantage of drawing directly is that it is more intuitive, and it is faster if the image data changes more often than it is redrawn. The advantage of using the object is that FLTK will cache translated forms of the image (on X it uses a server pixmap) and thus redrawing is much faster.

7.4.1

Direct Image Drawing

The behavior when drawing images when the current transformation matrix is not the identity is not dened, so you should only draw images when the matrix is set to the identity. void _draw_image(const uchar buf,int X,int Y,int W,int H,int D,int L) void _draw_image_mono(const uchar buf,int X,int Y,int W,int H,int D,int L)

Draw an 8-bit per color RGB or luminance image. The pointer points at the "r" data of the top-left pixel. Color data must be in r,g,b order. The top left corner is given by X and Y and the size of the image is given by W and H. D is the delta to add to the pointer between pixels, it may be any value greater or equal to 3, or it can be negative to ip the image horizontally. L is the delta to add to the pointer between lines (if 0 is passed it uses WD). and may be larger than WD to crop data, or negative to ip the image vertically.

It is highly recommended that you put the following code before the rst show() of any window in your program to get rid of the dithering if possible:
Fl::visual(FL_RGB);

Gray scale (1-channel) images may be drawn. This is done if abs(D) is less than 3, or by calling fl_draw_image_mono(). Only one 8-bit sample is used for each pixel, and on screens with different numbers of bits for red, green, and blue only gray colors are used. Setting D greater than 1 will let you display one channel of a color image.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

60

Drawing Things in FLTK

Note: The X version does not support all possible visuals. If FLTK cannot draw the image in the current visual it will abort. FLTK supports any visual of 8 bits or less, and all common TrueColor visuals up to 32 bits. typedef void (Fl_Draw_Image_Cb)(void data,int x,int y,int w,uchar buf) void _draw_image(Fl_Draw_Image_Cb cb,void data,int X,int Y,int W,int H,int D) void _draw_image_mono(Fl_Draw_Image_Cb cb,void data,int X,int Y,int W,int H,int D)

Call the passed function to provide each scan line of the image. This lets you generate the image as it is being drawn, or do arbitrary decompression of stored data, provided it can be decompressed to individual scan lines easily.

The callback is called with the void user data pointer which can be used to point at a structure of information about the image, and the x, y, and w of the scan line desired from the image. 0,0 is the upper-left corner of the image, not X,Y. A pointer to a buffer to put the data into is passed. You must copy w pixels from scanline y, starting at pixel x, to this buffer.

Due to cropping, less than the whole image may be requested. So x may be greater than zero, the rst y may be greater than zero, and w may be less than W. The buffer is long enough to store the entire WD pixels, this is for convenience with some decompression schemes where you must decompress the entire line at once: decompress it into the buffer, and then if x is not zero, copy the data over so the xth pixel is at the start of the buffer.

You can assume the ys will be consecutive, except the rst one may be greater than zero.

If D is 4 or more, you must ll in the unused bytes with zero. int _draw_pixmap(char const data, int x, int y, Fl_Color bg) int _draw_pixmap(const char const cdata, int x, int y, Fl_Color bg)

Draws XPM image data, with the top-left corner at the given position. The image is dithered on 8bit displays so you wont lose color space for programs displaying both images and pixmaps. This function returns zero if there was any error decoding the XPM data.

To use an XPM, do:


#include "foo.xpm" ... fl_draw_pixmap(foo, X, Y);

Transparent colors are replaced by the optional Fl_Color argument. To draw with true transparency you must use the Fl_Pixmap class.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

7.4 Drawing Images int _measure_pixmap(char const data, int &w, int &h) int _measure_pixmap(const char const cdata, int &w, int &h)

61

An XPM image contains the dimensions in its data. This function nds and returns the width and height. The return value is non-zero if the dimensions were parsed ok and zero if there was any problem.

7.4.2

Direct Image Reading

FLTK provides a single function for reading from the current window or off-screen buffer into a RGB(A) image buffer. uchar _read_image(uchar p, int X, int Y, int W, int H, int alpha)

Read a RGB(A) image from the current window or off-screen buffer. The p argument points to a buffer that can hold the image and must be at least WH3 bytes when reading RGB images and WH4 bytes when reading RGBA images. If NULL, fl_read_image() will create an array of the proper size which can be freed using delete[].

The alpha parameter controls whether an alpha channel is created and the value that is placed in the alpha channel. If 0, no alpha channel is generated.

7.4.3

Image Classes

FLTK provides a base image class called Fl_Image which supports creating, copying, and drawing images of various kinds, along with some basic color operations. Images can be used as labels for widgets using the image() and deimage() methods or drawn directly. The Fl_Image class does almost nothing by itself, but is instead supported by three basic image types: Fl_Bitmap Fl_Pixmap Fl_RGB_Image The Fl_Bitmap class encapsulates a mono-color bitmap image. The draw() method draws the image using the current drawing color. The Fl_Pixmap class encapsulates a colormapped image. The draw() method draws the image using the colors in the le, and masks off any transparent colors automatically. The Fl_RGB_Image class encapsulates a full-color (or grayscale) image with 1 to 4 color components. Images with an even number of components are assumed to contain an alpha channel that is used for transparency. The transparency provided by the draw() method is either a 24-bit blend against the existing window contents or a "screen door" transparency mask, depending on the platform and screen color depth. char _can_do_alpha_blending()

fl_can_do_alpha_blending() will return 1, if your platform supports true alpha blending for RGBA images, or 0, if FLTK will use screen door transparency.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

62

Drawing Things in FLTK

FLTK also provides several image classes based on the three standard image types for common le formats: Fl_GIF_Image Fl_JPEG_Image Fl_PNG_Image Fl_PNM_Image Fl_XBM_Image Fl_XPM_Image Each of these image classes load a named le of the corresponding format. The Fl_Shared_Image class can be used to load any type of image le - the class examines the le and constructs an image of the appropriate type. Finally, FLTK provides a special image class called Fl_Tiled_Image to tile another image object in the specied area. This class can be used to tile a background image in a Fl_Group widget, for example. virtual void Fl_Tiled_Image::copy(); virtual Fl_Image Fl_Tiled_Image::copy(int w, int h);

The copy() method creates a copy of the image. The second form species the new size of the image - the image is resized using the nearest-neighbor algorithm. void Fl_Tiled_Image::draw(int x, int y, int w, int h, int ox, int oy);

The draw() method draws the image object. x,y,w,h indicates a destination rectangle. ox,oy,w,h is a source rectangle. This source rectangle is copied to the destination. The source rectangle may extend outside the image, i.e. ox and oy may be negative and w and h may be bigger than the image, and this area is left unchanged. void Fl_Tiled_Image::draw(int x, int y)

Draws the image with the upper-left corner at x,y. This is the same as doing draw(x,y,img->w(),img>h(),0,0).

7.4.4

Offscreen Drawing

Sometimes it can be very useful to generate a complex drawing in memory rst and copy it to the screen at a later point in time. This technique can signicantly reduce the amount of repeated drawing. Offscreen drawing functions are declared in <FL/x.H>. Fl_Double_Window uses offscreen rendering to avoid ickering on systems that dont support double-buffering natively. Fl_Offscreen _create_offscreen(int w, int h)

Create an RGB offscreen buffer with wh pixels. void _delete_offscreen(Fl_Offscreen)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

7.4 Drawing Images

63

Delete a previously created offscreen buffer. All drawings are lost. void _begin_offscreen(Fl_Offscreen)

Send all subsequent drawing commands to this offscreen buffer. FLTK can draw into a buffer at any time. There is no need to wait for an Fl_Widget::draw() to occur. void _end_offscreen()

Quit sending drawing commands to this offscreen buffer. void _copy_offscreen(int x, int y, int w, int h, Fl_Offscreen osrc, int srcx, int srcy)

Copy a rectangular area of the size wh from srcx,srcy in the offscreen buffer into the current buffer at x,y.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

64

Drawing Things in FLTK

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 8

Handling Events
This chapter discusses the FLTK event model and how to handle events in your program or widget.

8.1

The FLTK Event Model

Every time a user moves the mouse pointer, clicks a button, or presses a key, an event is generated and sent to your application. Events can also come from other programs like the window manager. Events are identied by the integer argument passed to a handle() method that overrides the Fl_Widget::handle() virtual method. Other information about the most recent event is stored in static locations and acquired by calling the Fl::event_() methods. This static information remains valid until the next event is read from the window system, so it is ok to look at it outside of the handle() method. Event numbers can be converted to their actual names using the _eventnames[] array dened in #include <FL/names.h>; see next chapter for details. In the next chapter, the MyClass::handle() example shows how to override the Fl_Widget::handle() method to accept and process specic events.

8.2
8.2.1

Mouse Events
FL PUSH

A mouse button has gone down with the mouse pointing at this widget. You can nd out what button by calling Fl::event_button(). You nd out the mouse position by calling Fl::event_x() and Fl::event_y(). A widget indicates that it "wants" the mouse click by returning non-zero from its handle() method, as in the MyClass::handle() example. It will then become the Fl::pushed() widget and will get FL_DRAG and the matching FL_RELEASE events. If handle() returns zero then FLTK will try sending the FL_PUSH to another widget.

8.2.2

FL DRAG

The mouse has moved with a button held down. The current button state is in Fl::event_state(). The mouse position is in Fl::event_x() and Fl::event_y(). In order to receive FL_DRAG events, the widget must return non-zero when handling FL_PUSH.

66

Handling Events

8.2.3

FL RELEASE

A mouse button has been released. You can nd out what button by calling Fl::event_button(). In order to receive the FL_RELEASE event, the widget must return non-zero when handling FL_PUSH.

8.2.4

FL MOVE

The mouse has moved without any mouse buttons held down. This event is sent to the Fl::belowmouse() widget. In order to receive FL_MOVE events, the widget must return non-zero when handling FL_ENTER.

8.2.5

FL MOUSEWHEEL

The user has moved the mouse wheel. The Fl::event_dx() and Fl::event_dy() methods can be used to nd the amount to scroll horizontally and vertically.

8.3
8.3.1

Focus Events
FL ENTER

The mouse has been moved to point at this widget. This can be used for highlighting feedback. If a widget wants to highlight or otherwise track the mouse, it indicates this by returning non-zero from its handle() method. It then becomes the Fl::belowmouse() widget and will receive FL_MOVE and FL_LEAVE events.

8.3.2

FL LEAVE

The mouse has moved out of the widget. In order to receive the FL_LEAVE event, the widget must return non-zero when handling FL_ENTER.

8.3.3

FL FOCUS

This indicates an attempt to give a widget the keyboard focus. If a widget wants the focus, it should change itself to display the fact that it has the focus, and return non-zero from its handle() method. It then becomes the Fl::focus() widget and gets FL_KEYDOWN, FL_KEYUP, and FL_UNFOCUS events. The focus will change either because the window manager changed which window gets the focus, or because the user tried to navigate using tab, arrows, or other keys. You can check Fl::event_key() to gure out why it moved. For navigation it will be the key pressed and for interaction with the window manager it will be zero.

8.3.4

FL UNFOCUS

This event is sent to the previous Fl::focus() widget when another widget gets the focus or the window loses focus.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

8.4 Keyboard Events

67

8.4
8.4.1

Keyboard Events
FL KEYBOARD, FL KEYDOWN, FL KEYUP

A key was pressed (FL_KEYDOWN) or released (FL_KEYUP). FL_KEYBOARD is a synonym for FL_KEYDOWN, and both names are used interchangeably in this documentation. The key can be found in Fl::event_key(). The text that the key should insert can be found with Fl::event_text() and its length is in Fl::event_length(). If you use the key, then handle() should return 1. If you return zero then FLTK assumes you ignored the key and will then attempt to send it to a parent widget. If none of them want it, it will change the event into a FL_SHORTCUT event. FL_KEYBOARD events are also generated by the character palette/map. To receive FL_KEYBOARD events you must also respond to the FL_FOCUS and FL_UNFOCUS events. If you are writing a text-editing widget you may also want to call the Fl::compose() function to translate individual keystrokes into characters. FL_KEYUP events are sent to the widget that currently has focus. This is not necessarily the same widget that received the corresponding FL_KEYDOWN event because focus may have changed between events.

8.4.2

FL SHORTCUT

If the Fl::focus() widget is zero or ignores an FL_KEYBOARD event then FLTK tries sending this event to every widget it can, until one of them returns non-zero. FL_SHORTCUT is rst sent to the Fl::belowmouse() widget, then its parents and siblings, and eventually to every widget in the window, trying to nd an object that returns non-zero. FLTK tries really hard to not to ignore any keystrokes! You can also make "global" shortcuts by using Fl::add_handler(). A global shortcut will work no matter what windows are displayed or which one has the focus.

8.5
8.5.1

Widget Events
FL DEACTIVATE

This widget is no longer active, due to deactivate() being called on it or one of its parents. Please note that although active() may still return true for this widget after receiving this event, it is only truly active if active() is true for both it and all of its parents. (You can use active_r() to check this).

8.5.2

FL ACTIVATE

This widget is now active, due to activate() being called on it or one of its parents.

8.5.3

FL HIDE

This widget is no longer visible, due to hide() being called on it or one of its parents, or due to a parent window being minimized. Please note that although visible() may still return true for this widget after receiving this event, it is only truly visible if visible() is true for both it and all of its parents. (You can use visible_r() to check this).
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

68

Handling Events

8.5.4

FL SHOW

This widget is visible again, due to show() being called on it or one of its parents, or due to a parent window being restored. A child Fl_Window will respond to this by actually creating the window if not done already, so if you subclass a window, be sure to pass FL_SHOW to the base class handle() method! Note The events in this chapter ("Widget Events"), i.e. FL_ACTIVATE, FL_DEACTIVATE, FL_SHOW, and FL_HIDE, are the only events deactivated and invisible widgets can usually get, depending on their states. Under certain circumstances, there may also be FL_LEAVE or FL_UNFOCUS events delivered to deactivated or hidden widgets.

8.6
8.6.1

Clipboard Events
FL PASTE

You should get this event some time after you call Fl::paste(). The contents of Fl::event_text() is the text to insert and the number of characters is in Fl::event_length().

8.6.2

FL SELECTIONCLEAR

The Fl::selection_owner() will get this event before the selection is moved to another widget. This indicates that some other widget or program has claimed the selection. Motif programs used this to clear the selection indication. Most modern programs ignore this.

8.7

Drag and Drop Events

FLTK supports drag and drop of text and les from any application on the desktop to an FLTK widget. Text is transferred using UTF-8 encoding. Files are received as a list of full path and le names, separated by newline. On some platforms, path names are prepended with file://. See Fl::dnd() for drag and drop from an FLTK widget. The drag and drop data is available in Fl::event_text() at the concluding FL_PASTE. On some platforms, the event text is also available for the FL_DND_ events, however application must not depend on that behavior because it depends on the protocol used on each platform. FL_DND_ events cannot be used in widgets derived from Fl_Group or Fl_Window.

8.7.1

FL DND ENTER

The mouse has been moved to point at this widget. A widget that is interested in receiving dragndrop data must return 1 to receive FL_DND_DRAG, FL_DND_LEAVE and FL_DND_RELEASE events.

8.7.2

FL DND DRAG

The mouse has been moved inside a widget while dragging data. A widget that is interested in receiving dragndrop data should indicate the possible drop position.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

8.8 Fl::event_() methods

69

8.7.3

FL DND LEAVE

The mouse has moved out of the widget.

8.7.4

FL DND RELEASE

The user has released the mouse button dropping data into the widget. If the widget returns 1, it will receive the data in the immediately following FL_PASTE event.

8.8

Fl::event () methods

FLTK keeps the information about the most recent event in static storage. This information is good until the next event is processed. Thus it is valid inside handle() and callback() methods. These are all trivial inline functions and thus very fast and small: Fl::event_button() Fl::event_clicks() Fl::event_dx() Fl::event_dy() Fl::event_inside() Fl::event_is_click() Fl::event_key() Fl::event_length() Fl::event_state() Fl::event_text() Fl::event_x() Fl::event_x_root() Fl::event_y() Fl::event_y_root() Fl::get_key() Fl::get_mouse() Fl::test_shortcut()
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

70

Handling Events

8.9

Event Propagation

Widgets receive events via the virtual handle() function. The argument indicates the type of event that can be handled. The widget must indicate if it handled the event by returning 1. FLTK will then remove the event and wait for further events from the host. If the widgets handle function returns 0, FLTK may redistribute the event based on a few rules. Most events are sent directly to the handle() method of the Fl_Window that the window system says they belong to. The window (actually the Fl_Group that Fl_Window is a subclass of) is responsible for sending the events on to any child widgets. To make the Fl_Group code somewhat easier, FLTK sends some events (FL_DRAG, FL_RELEASE, FL_KEYBOARD, FL_SHORTCUT, FL_UNFOCUS, and FL_LEAVE) directly to leaf widgets. These procedures control those leaf widgets: Fl::add_handler() Fl::belowmouse() Fl::focus() Fl::grab() Fl::modal() Fl::pushed() Fl::release() (deprecated, see Fl::grab(0)) Fl_Widget::take_focus() FLTK propagates events along the widget hierarchy depending on the kind of event and the status of the UI. Some events are injected directly into the widgets, others may be resent as new events to a different group of receivers. Mouse click events are rst sent to the window that caused them. The window then forwards the event down the hierarchy until it reaches the widget that is below the click position. If that widget uses the given event, the widget is marked "pushed" and will receive all following mouse motion (FL_DRAG) events until the mouse button is released. Mouse motion (FL_MOVE) events are sent to the Fl::belowmouse() widget, i.e. the widget that returned 1 on the last FL_ENTER event. Mouse wheel events are sent to the window that caused the event. The window propagates the event down the tree, rst to the widget that is below the mouse pointer, and if that does not succeed, to all other widgets in the group. This ensures that scroll widgets work as expected with the widget furthest down in the hierarchy getting the rst opportunity to use the wheel event, but also giving scroll bars, that are not directly below the mouse a chance. Keyboard events are sent directly to the widget that has keyboard focus. If the focused widget rejects the event, it is resent as a shortcut event, rst to the top-most window, then to the widget below the mouse pointer, propagating up the hierarchy to all its parents. Those send the event also to all widgets that are not below the mouse pointer. Now if that did not work out, the shortcut is sent to all registered shortcut handlers. If we are still unsuccessful, the event handler ips the case of the shortcut letter and starts over. Finally, if the key is "escape", FLTK sends a close event to the top-most window. All other events are pretty much sent right away to the window that created the event. Widgets can "grab" events. The grabbing window gets all events exclusively, but usually by the same rules as described above. Windows can also request exclusivity in event handling by making the window modal.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

8.10 FLTK Compose-Character Sequences

71

8.10

FLTK Compose-Character Sequences

The character composition done by Fl_Input widget requires that you call the Fl::compose() function if you are writing your own text editor widget. Currently, all characters made by single key strokes with or without modier keys, or by system-dened character compose sequences (that can involve dead keys or a compose key) can be input. You should call Fl::compose() in case any enhancements to this processing are done in the future. The interface has been designed to handle arbitrary UTF-8 encoded text. The following methods are provided for character composition: Fl::compose() Fl::compose_reset() Under Mac OS X, FLTK "previews" partially composed sequences.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

72

Handling Events

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 9

Adding and Extending Widgets


This chapter describes how to add your own widgets or extend existing widgets in FLTK.

9.1

Subclassing

New widgets are created by subclassing an existing FLTK widget, typically Fl_Widget for controls and Fl_Group for composite widgets. A control widget typically interacts with the user to receive and/or display a value of some sort. A composite widget holds a list of child widgets and handles moving, sizing, showing, or hiding them as needed. Fl_Group is the main composite widget class in FLTK, and all of the other composite widgets (Fl_Pack, Fl_Scroll, Fl_Tabs, Fl_Tile, and Fl_Window) are subclasses of it. You can also subclass other existing widgets to provide a different look or user-interface. For example, the button widgets are all subclasses of Fl_Button since they all interact with the user via a mouse button click. The only difference is the code that draws the face of the button.

9.2

Making a Subclass of Fl Widget

Your subclasses can directly descend from Fl_Widget or any subclass of Fl_Widget. Fl_Widget has only four virtual methods, and overriding some or all of these may be necessary.

9.3

The Constructor

The constructor should have the following arguments:


MyClass(int x, int y, int w, int h, const char *label = 0);

This will allow the class to be used in FLUID without problems. The constructor must call the constructor for the base class and pass the same arguments:
MyClass::MyClass(int x, int y, int w, int h, const char *label) : Fl_Widget(x, y, w, h, label) { // do initialization stuff... }

74

Adding and Extending Widgets

Fl_Widgets protected constructor sets x(), y(), w(), h(), and label() to the passed values and initializes the other instance variables to:
type(0); box(FL_NO_BOX); color(FL_BACKGROUND_COLOR); selection_color(FL_BACKGROUND_COLOR); labeltype(FL_NORMAL_LABEL); labelstyle(FL_NORMAL_STYLE); labelsize(FL_NORMAL_SIZE); labelcolor(FL_FOREGROUND_COLOR); align(FL_ALIGN_CENTER); callback(default_callback,0); flags(ACTIVE|VISIBLE); image(0); deimage(0);

9.4

Protected Methods of Fl Widget

The following methods are provided for subclasses to use: clear_visible() damage() draw_box() draw_focus() draw_label() set_ag() set_visible() test_shortcut() type() void Fl_Widget::damage(uchar mask) void Fl_Widget::damage(uchar mask, int x, int y, int w, int h) uchar Fl_Widget::damage()

The rst form indicates that a partial update of the object is needed. The bits in mask are ORd into damage(). Your draw() routine can examine these bits to limit what it is drawing. The public method Fl_Widget::redraw() simply does Fl_Widget::damage(FL_DAMAGE_ALL), but the implementation of your widget can call the public damage(n).

The second form indicates that a region is damaged. If only these calls are done in a window (no calls to damage(n)) then FLTK will clip to the union of all these calls before drawing anything. This can greatly speed up incremental displays. The mask bits are ORd into damage() unless this is a Fl_Window widget.

The third form returns the bitwise-OR of all damage(n) calls done since the last draw().
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

9.4 Protected Methods of Fl_Widget

75

When redrawing your widgets you should look at the damage bits to see what parts of your widget need redrawing. The handle() method can then set individual damage bits to limit the amount of drawing that needs to be done:
MyClass::handle(int event) { ... if (change_to_part1) damage(1); if (change_to_part2) damage(2); if (change_to_part3) damage(4); } MyClass::draw() { if (damage() & FL_DAMAGE_ALL) { ... draw frame/box and other static stuff ... } if (damage() & (FL_DAMAGE_ALL | 1)) draw_part1(); if (damage() & (FL_DAMAGE_ALL | 2)) draw_part2(); if (damage() & (FL_DAMAGE_ALL | 4)) draw_part3(); }

Todo Clarify Fl_Window::damage(uchar) handling - seems confused/wrong? ORing value doesnt match setting behaviour in FL_Widget.H! void Fl_Widget::draw_box() const void Fl_Widget::draw_box(Fl_Boxtype t, Fl_Color c) const

The rst form draws this widgets box(), using the dimensions of the widget. The second form uses t as the box type and c as the color for the box. void Fl_Widget::draw_focus() void Fl_Widget::draw_focus(Fl_Boxtype t, int x, int y, int w, int h) const

Draws a focus box inside the widgets bounding box. The second form allows you to specify a different bounding box. void Fl_Widget::draw_label() const void Fl_Widget::draw_label(int x, int y, int w, int h) const void Fl_Widget::draw_label(int x, int y, int w, int h, Fl_Align align) const

The rst form is the usual function for a draw() method to call to draw the widgets label. It does not draw the label if it is supposed to be outside the box (on the assumption that the enclosing group will draw those labels).

The second form uses the passed bounding box instead of the widgets bounding box. This is useful so "centered" labels are aligned with some feature, like a moving slider.

The third form draws the label anywhere. It acts as though FL_ALIGN_INSIDE has been forced on so the label will appear inside the passed bounding box. This is designed for parent groups to draw labels with.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

76 void Fl_Widget::set_ag(int c)

Adding and Extending Widgets

Calling set_flag(SHORTCUT_LABEL) modies the behavior of draw_label() so that & characters cause an underscore to be printed under the next letter. void Fl_Widget::set_visible() void Fl_Widget::clear_visible()

Fast inline versions of Fl_Widget::hide() and Fl_Widget::show(). These do not send the FL_HIDE and FL_SHOW events to the widget. int Fl_Widget::test_shortcut() static int Fl_Widget::test_shortcut(const char s)

The rst version tests Fl_Widget::label() against the current event (which should be a FL_SHORTCUT event). If the label contains a & character and the character after it matches the keypress, this returns true. This returns false if the SHORTCUT_LABEL ag is off, if the label is NULL, or does not have a & character in it, or if the keypress does not match the character.

The second version lets you do this test against an arbitrary string. Todo Clarify Fl_Widget::test_shortcut() explanations. Fl_Widget.h says Internal Use only, but subclassing chapter gives details! uchar Fl_Widget::type() const void Fl_Widget::type(uchar t)

The property Fl_Widget::type() can return an arbitrary 8-bit identier, and can be set with the protected method type(uchar t). This value had to be provided for Forms compatibility, but you can use it for any purpose you want. Try to keep the value less than 100 to not interfere with reserved values.

FLTK does not use RTTI (Run Time Typing Information), to enhance portability. But this may change in the near future if RTTI becomes standard everywhere.

If you dont have RTTI you can use the clumsy FLTK mechanism, by having type() use a unique value. These unique values must be greater than the symbol FL_RESERVED_TYPE (which is 100) and less than FL_WINDOW (unless you make a subclass of Fl_Window). Look through the header les for FL_RESERVED_TYPE to nd an unused number. If you make a subclass of Fl_Window you must use FL_WINDOW + n (where n must be in the range 1 to 7).

9.5

Handling Events

The virtual method Fl_Widget::handle(int event) is called to handle each event passed to the widget. It can:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

9.5 Handling Events Change the state of the widget. Call Fl_Widget::redraw() if the widget needs to be redisplayed.

77

Call Fl_Widget::damage(uchar c) if the widget needs a partial-update (assuming you provide support for this in your draw() method). Call Fl_Widget::do_callback() if a callback should be generated. Call Fl_Widget::handle() on child widgets. Events are identied by the integer argument. Other information about the most recent event is stored in static locations and acquired by calling the Fl::event_() methods. This information remains valid until another event is handled. Here is a sample handle() method for a widget that acts as a pushbutton and also accepts the keystroke x to cause the callback:
int MyClass::handle(int event) { switch(event) { case FL_PUSH: highlight = 1; redraw(); return 1; case FL_DRAG: { int t = Fl::event_inside(this); if (t != highlight) { highlight = t; redraw(); } } return 1; case FL_RELEASE: if (highlight) { highlight = 0; redraw(); do_callback(); // never do anything after a callback, as the callback // may delete the widget! } return 1; case FL_SHORTCUT: if (Fl::event_key() == x) { do_callback(); return 1; } return 0; default: return Fl_Widget::handle(event); } }

You must return non-zero if your handle() method uses the event. If you return zero, the parent widget will try sending the event to another widget. For debugging purposes, event numbers can be printed as their actual event names using the _eventnames[] array, e.g.:
#include <FL/names.h> // defines fl_eventnames[] [..] int MyClass::handle(int e) { printf("Event was %s (%d)\n", fl_eventnames[e], e); was FL_PUSH (1)" [..]

// e.g. "Event

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

78

Adding and Extending Widgets

9.6

Drawing the Widget

The draw() virtual method is called when FLTK wants you to redraw your widget. It will be called if and only if damage() is non-zero, and damage() will be cleared to zero after it returns. The draw() method should be declared protected so that it cant be called from non-drawing code. The damage() value contains the bitwise-OR of all the damage(n) calls to this widget since it was last drawn. This can be used for minimal update, by only redrawing the parts whose bits are set. FLTK will turn on the FL_DAMAGE_ALL bit if it thinks the entire widget must be redrawn, e.g. for an expose event. Expose events (and the damage(mask,x,y,w,h) function described above) will cause draw() to be called with FLTKs clipping turned on. You can greatly speed up redrawing in some cases by testing fl_not_clipped(x,y,w,h) or fl_clip_box() and skipping invisible parts. Besides the protected methods described above, FLTK provides a large number of basic drawing functions, which are described in the chapter Drawing Things in FLTK.

9.7

Resizing the Widget

The resize(x,y,w,h) method is called when the widget is being resized or moved. The arguments are the new position, width, and height. x(), y(), w(), and h() still remain the old size. You must call resize() on your base class with the same arguments to get the widget size to actually change. This should not call redraw(), at least if only the x() and y() change. This is because composite widgets like Fl_Scroll may have a more efcient way of drawing the new position.

9.8

Making a Composite Widget

A "composite" widget contains one or more "child" widgets. To make a composite widget you should subclass Fl_Group. It is possible to make a composite object that is not a subclass of Fl_Group, but youll have to duplicate the code in Fl_Group anyways. Instances of the child widgets may be included in the parent:
class MyClass : public Fl_Group { Fl_Button the_button; Fl_Slider the_slider; ... };

The constructor has to initialize these instances. They are automatically added to the group, since the Fl_Group constructor does Fl_Group::begin(). Dont forget to call Fl_Group::end() or use the Fl_End pseudo-class:
MyClass::MyClass(int x, int y, int w, int h) : Fl_Group(x, y, w, h), the_button(x + 5, y + 5, 100, 20), the_slider(x, y + 50, w, 20) { ...(you could add dynamically created child widgets here)... end(); // dont forget to do this! }

The child widgets need callbacks. These will be called with a pointer to the children, but the widget itself may be found in the parent() pointer of the child. Usually these callbacks can be static private methods, with a matching private method:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

9.8 Making a Composite Widget


void MyClass::static_slider_cb(Fl_Widget* v, void *) { // static method ((MyClass*)(v->parent())->slider_cb(); } void MyClass::slider_cb() { // normal method use(the_slider->value()); }

79

If you make the handle() method, you can quickly pass all the events to the children using the Fl_Group::handle() method. You dont need to override handle() if your composite widget does nothing other than pass events to the children:
int MyClass::handle(int event) { if (Fl_Group::handle(event)) return 1; ... handle events that children dont want ... }

If you override draw() you need to draw all the children. If redraw() or damage() is called on a child, damage(FL_DAMAGE_CHILD) is done to the group, so this bit of damage() can be used to indicate that a child needs to be drawn. It is fastest if you avoid drawing anything else in this case:
int MyClass::draw() { Fl_Widget *const*a = array(); if (damage() == FL_DAMAGE_CHILD) { // only redraw some children for (int i = children(); i --; a ++) update_child(**a); } else { // total redraw ... draw background graphics ... // now draw all the children atop the background: for (int i = children_; i --; a ++) { draw_child(**a); draw_outside_label(**a); // you may not need to do this } } }

Fl_Group provides some protected methods to make drawing easier: draw_child() draw_children() draw_outside_label() update_child() void Fl_Group::draw_child(Fl_Widget &widget) const

This will force the childs damage() bits all to one and call draw() on it, then clear the damage(). You should call this on all children if a total redraw of your widget is requested, or if you draw something (like a background box) that damages the child. Nothing is done if the child is not visible() or if it is clipped. void Fl_Group::draw_children()

A convenience function that draws all children of the group. This is useful if you derived a widget from Fl_Group and want to draw a special border or background. You can call draw_children() from the derived draw() method after drawing the box, border, or background.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

80 void Fl_Group::draw_outside_label(const Fl_Widget &widget) const

Adding and Extending Widgets

Draw the labels that are not drawn by draw_label(). If you want more control over the label positions you might want to call child->draw_label(x,y,w,h,a). void Fl_Group::update_child(Fl_Widget& widget) const Draws the child only if its damage() is non-zero. You should call this on all the children if your own damage is equal to FL_DAMAGE_CHILD. Nothing is done if the child is not visible() or if it is clipped.

9.9

Cut and Paste Support

FLTK provides routines to cut and paste 8-bit text (in the future this may be UTF-8) between applications: Fl::paste() Fl::selection() Fl::selection_owner() It may be possible to cut/paste non-text data by using Fl::add_handler(). Note that handling events beyond those provided by FLTK may be operating system specic. See Operating System Issues for more details.

9.10

Drag And Drop Support

FLTK provides routines to drag and drop 8-bit text between applications: Dragndrop operations are initiated by copying data to the clipboard and calling the function Fl::dnd(). Drop attempts are handled via the following events, already described under Drag and Drop Events in a previous chapter: FL_DND_ENTER FL_DND_DRAG FL_DND_LEAVE FL_DND_RELEASE FL_PASTE

9.11

Making a subclass of Fl Window

You may want your widget to be a subclass of Fl_Window, Fl_Double_Window, or Fl_Gl_Window. This can be useful if your widget wants to occupy an entire window, and can also be used to take advantage of system-provided clipping, or to work with a library that expects a system window ID to indicate where to draw. Subclassing Fl_Window is almost exactly like subclassing Fl_Group, and in fact you can easily switch a subclass back and forth. Watch out for the following differences:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

9.11 Making a subclass of Fl_Window

81

1. Fl_Window is a subclass of Fl_Group so make sure your constructor calls end() unless you actually want children added to your window. 2. When handling events and drawing, the upper-left corner is at 0,0, not x(),y() as in other Fl_Widgets. For instance, to draw a box around the widget, call draw_box(0,0,w(),h()), rather than draw_box(x(),y(),w(),h()). You may also want to subclass Fl_Window in order to get access to different visuals or to change other attributes of the windows. See the Operating System Issues chapter for more information.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

82

Adding and Extending Widgets

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 10

Using OpenGL
This chapter discusses using FLTK for your OpenGL applications.

10.1

Using OpenGL in FLTK

The easiest way to make an OpenGL display is to subclass Fl_Gl_Window. Your subclass must implement a draw() method which uses OpenGL calls to draw the display. Your main program should call redraw() when the display needs to change, and (somewhat later) FLTK will call draw(). With a bit of care you can also use OpenGL to draw into normal FLTK windows. This allows you to use Gouraud shading for drawing your widgets. To do this you use the gl_start() and gl_nish() functions around your OpenGL code. You must include FLTKs <FL/gl.h> header le. It will include the le <GL/gl.h>, dene some extra drawing functions provided by FLTK, and include the <windows.h> header le needed by WIN32 applications.

10.2

Making a Subclass of Fl Gl Window

To make a subclass of Fl_Gl_Window, you must provide: A class denition. A draw() method. A handle() method if you need to receive input from the user. If your subclass provides static controls in the window, they must be redrawn whenever the FL_DAMAGE_ALL bit is set in the value returned by damage(). For double-buffered windows you will need to surround the drawing code with the following code to make sure that both buffers are redrawn:
#ifndef MESA glDrawBuffer(GL_FRONT_AND_BACK); #endif // !MESA ... draw stuff here ... #ifndef MESA glDrawBuffer(GL_BACK); #endif // !MESA

84

Using OpenGL

Note: If you are using the Mesa graphics library, the call to glDrawBuffer() is not required and will slow down drawing considerably. The preprocessor instructions shown above will optimize your code based upon the graphics library used.

10.2.1

Dening the Subclass

To dene the subclass you just subclass the Fl_Gl_Window class:


class MyWindow : public Fl_Gl_Window { void draw(); int handle(int); public: MyWindow(int X, int Y, int W, int H, const char *L) : Fl_Gl_Window(X, Y, W, H, L) {} };

The draw() and handle() methods are described below. Like any widget, you can include additional private and public data in your class (such as scene graph information, etc.)

10.2.2

The draw() Method

The draw() method is where you actually do your OpenGL drawing:


void MyWindow::draw() { if (!valid()) { ... set up projection, viewport, etc ... ... window size is in w() and h(). ... valid() is turned on by FLTK after draw() returns } ... draw ... }

10.2.3

The handle() Method

The handle() method handles mouse and keyboard events for the window:
int MyWindow::handle(int event) { switch(event) { case FL_PUSH: ... mouse down event ... ... position in Fl::event_x() and Fl::event_y() return 1; case FL_DRAG: ... mouse moved while down event ... return 1; case FL_RELEASE: ... mouse up event ... return 1; case FL_FOCUS : case FL_UNFOCUS : ... Return 1 if you want keyboard events, 0 otherwise return 1; case FL_KEYBOARD: ... keypress, key is in Fl::event_key(), ascii in Fl::event_text()
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

10.3 Using OpenGL in Normal FLTK Windows


... Return 1 if you understand/use the keyboard event, 0 otherwise... return 1; case FL_SHORTCUT: ... shortcut, key is in Fl::event_key(), ascii in Fl::event_text() ... Return 1 if you understand/use the shortcut event, 0 otherwise... return 1; default: // pass other events to the base class... return Fl_Gl_Window::handle(event); } }

85

When handle() is called, the OpenGL context is not set up! If your display changes, you should call redraw() and let draw() do the work. Dont call any OpenGL drawing functions from inside handle()! You can call some OpenGL stuff like hit detection and texture loading functions by doing:
case FL_PUSH: make_current(); if (!valid()) {

// make OpenGL context current

... set up projection exactly the same as draw ... valid(1); // stop it from doing this next time } ... ok to call NON-DRAWING OpenGL code here, such as hit detection, loading textures, etc...

Your main program can now create one of your windows by doing new MyWindow(...). You can also use your new window class in FLUID by: 1. Putting your class denition in a MyWindow.H le. 2. Creating a Fl_Box widget in FLUID. 3. In the widget panel ll in the "class" eld with MyWindow. This will make FLUID produce constructors for your new class. 4. In the "Extra Code" eld put #include "MyWindow.H", so that the FLUID output le will compile. You must put glwindow->show() in your main code after calling show() on the window containing the OpenGL window.

10.3

Using OpenGL in Normal FLTK Windows

You can put OpenGL code into the draw() method, as described in Drawing the Widget in the previous chapter, or into the code for a boxtype or other places with some care. Most importantly, before you show any windows, including those that dont have OpenGL drawing, you must initialize FLTK so that it knows it is going to use OpenGL. You may use any of the symbols described for Fl_Gl_Window::mode() to describe how you intend to use OpenGL:
Fl::gl_visual(FL_RGB);
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

86

Using OpenGL

You can then put OpenGL drawing code anywhere you can draw normally by surrounding it with gl_start() and gl_nish() to set up, and later release, an OpenGL context with an orthographic projection so that 0,0 is the lower-left corner of the window and each pixel is one unit. The current clipping is reproduced with OpenGL glScissor() commands. These functions also synchronize the OpenGL graphics stream with the drawing done by other X, WIN32, or FLTK functions.
gl_start(); ... put your OpenGL code here ... gl_finish();

The same context is reused each time. If your code changes the projection transformation or anything else you should use glPushMatrix() and glPopMatrix() functions to put the state back before calling gl_finish(). You may want to use Fl_Window::current()->h() to get the drawable height so that you can ip the Y coordinates. Unfortunately, there are a bunch of limitations you must adhere to for maximum portability: You must choose a default visual with Fl::gl_visual(). You cannot pass FL_DOUBLE to Fl::gl_visual(). You cannot use Fl_Double_Window or Fl_Overlay_Window. Do not call gl_start() or gl_finish() when drawing into an Fl_Gl_Window !

10.4

OpenGL Drawing Functions

FLTK provides some useful OpenGL drawing functions. They can be freely mixed with any OpenGL calls, and are dened by including <FL/gl.h> which you should include instead of the OpenGL header <GL/gl.h>. void gl_color(Fl_Color)

Sets the current OpenGL color to a FLTK color. For color-index modes it will use fl_xpixel(c), which is only right if this window uses the default colormap! void gl_rect(int x, int y, int w, int h) void gl_rectf(int x, int y, int w, int h)

Outlines or lls a rectangle with the current color. If Fl_Gl_Window::ortho() has been called, then the rectangle will exactly ll the pixel rectangle passed. void gl_font(Fl_Font fontid, int size)

Sets the current OpenGL font to the same font you get by calling _font().
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

10.5 Speeding up OpenGL int gl_height() int gl_descent() oat gl_width(const char s) oat gl_width(const char s, int n) oat gl_width(uchar c)

87

Returns information about the current OpenGL font. void gl_draw(const char s) void gl_draw(const char s, int n)

Draws a nul-terminated string or an array of n characters in the current OpenGL font at the current raster position. void gl_draw(const char s, int x, int y) void gl_draw(const char s, int n, int x, int y) void gl_draw(const char s, oat x, oat y) void gl_draw(const char s, int n, oat x, oat y)

Draws a nul-terminated string or an array of n characters in the current OpenGL font at the given position. void gl_draw(const char s, int x, int y, int w, int h, Fl_Align)

Draws a string formatted into a box, with newlines and tabs expanded, other control characters changed to X, and aligned with the edges or center. Exactly the same output as _draw().

10.5

Speeding up OpenGL

Performance of Fl_Gl_Window may be improved on some types of OpenGL implementations, in particular MESA and other software emulators, by setting the GL_SWAP_TYPE environment variable. This variable declares what is in the backbuffer after you do a swapbuffers. setenv GL_SWAP_TYPE COPY This indicates that the back buffer is copied to the front buffer, and still contains its old data. This is true of many hardware implementations. Setting this will speed up emulation of overlays, and widgets that can do partial update can take advantage of this as damage() will not be cleared to -1. setenv GL_SWAP_TYPE NODAMAGE This indicates that nothing changes the back buffer except drawing into it. This is true of MESA and Win32 software emulation and perhaps some hardware emulation on systems with lots of memory.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

88

Using OpenGL All other values for GL_SWAP_TYPE, and not setting the variable, cause FLTK to assume that the back buffer must be completely redrawn after a swap.

This is easily tested by running the gl_overlay demo program and seeing if the display is correct when you drag another window over it or if you drag the window off the screen and back on. You have to exit and run the program again for it to see any changes to the environment variable.

10.6

Using OpenGL Optimizer with FLTK

OpenGL Optimizer is a scene graph toolkit for OpenGL available from Silicon Graphics for IRIX and Microsoft Windows. It allows you to view large scenes without writing a lot of OpenGL code. OptimizerWindow Class Denition

To use OpenGL Optimizer with FLTK youll need to create a subclass of Fl_Gl_Widget that includes several state variables:
class OptimizerWindow : public Fl_Gl_Window { csContext *context_; // Initialized to 0 and set by draw()... csDrawAction *draw_action_; // Draw action... csGroup *scene_; // Scene to draw... csCamara *camera_; // Viewport for scene... void draw(); public: OptimizerWindow(int X, int Y, int W, int H, const char *L) : Fl_Gl_Window(X, Y, W, H, L) { context_ = (csContext *)0; draw_action_ = (csDrawAction *)0; scene_ = (csGroup *)0; camera_ = (csCamera *)0; } void scene(csGroup *g) { scene_ = g; redraw(); } void camera(csCamera *c) { camera_ = c; if (context_) { draw_action_->setCamera(camera_); camera_->draw(draw_action_); redraw(); } } };

The camera() Method

The camera() method sets the camera (projection and viewpoint) to use when drawing the scene. The scene is redrawn after this call. The draw() Method

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

10.6 Using OpenGL Optimizer with FLTK

89

The draw() method performs the needed initialization and does the actual drawing:
void OptimizerWindow::draw() { if (!context_) { // This is the first time weve been asked to draw; create the // Optimizer context for the scene... #ifdef WIN32 context_ = new csContext((HDC)fl_getHDC()); context_->ref(); context_->makeCurrent((HDC)fl_getHDC()); #else context_ = new csContext(fl_display, fl_visual); context_->ref(); context_->makeCurrent(fl_display, fl_window); #endif // WIN32 ... perform other context setup as desired ... // Then create the draw action to handle drawing things... draw_action_ = new csDrawAction; if (camera_) { draw_action_->setCamera(camera_); camera_->draw(draw_action_); } } else { #ifdef WIN32 context_->makeCurrent((HDC)fl_getHDC()); #else context_->makeCurrent(fl_display, fl_window); #endif // WIN32 } if (!valid()) { // Update the viewport for this context... context_->setViewport(0, 0, w(), h()); } // Clear the window... context_->clear(csContext::COLOR_CLEAR | csContext::DEPTH_CLEAR, 0.0f, // Red 0.0f, // Green 0.0f, // Blue 1.0f); // Alpha // Then draw the scene (if any)... if (scene_) draw_action_->apply(scene_); }

The scene() Method

The scene() method sets the scene to be drawn. The scene is a collection of 3D objects in a csGroup. The scene is redrawn after this call.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

90

Using OpenGL

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 11

Programming with FLUID


This chapter shows how to use the Fast Light User-Interface Designer ("FLUID") to create your GUIs. Subchapters: What is FLUID? Running FLUID Under UNIX Running FLUID Under Microsoft Windows Compiling . les A Short Tutorial FLUID Reference Internationalization with FLUID Known limitations

11.1

What is FLUID?

The Fast Light User Interface Designer, or FLUID, is a graphical editor that is used to produce FLTK source code. FLUID edits and saves its state in .fl les. These les are text, and you can (with care) edit them in a text editor, perhaps to get some special effects. FLUID can "compile" the .fl le into a .cxx and a .h le. The .cxx le denes all the objects from the .fl le and the .h le declares all the global ones. FLUID also supports localization (Internationalization) of label strings using message les and the GNU gettext or POSIX catgets interfaces. A simple program can be made by putting all your code (including a main() function) into the .fl le and thus making the .cxx le a single source le to compile. Most programs are more complex than this, so you write other .cxx les that call the FLUID functions. These .cxx les must #include the .h le or they can #include the .cxx le so it still appears to be a single source le.

92

Programming with FLUID

Figure 11.1: FLUID organization

Normally the FLUID le denes one or more functions or classes which output C++ code. Each function denes a one or more FLTK windows, and all the widgets that go inside those windows. Widgets created by FLUID are either "named", "complex named" or "unnamed". A named widget has a legal C++ variable identier as its name (i.e. only alphanumeric and underscore). In this case FLUID denes a global variable or class member that will point at the widget after the function dening it is called. A complex named object has punctuation such as . or -> or any other symbols in its name. In this case FLUID assigns a pointer to the widget to the name, but does not attempt to declare it. This can be used to get the widgets into structures. An unnamed widget has a blank name and no pointer is stored. Widgets may either call a named callback function that you write in another source le, or you can supply a small piece of C++ source and FLUID will write a private callback function into the .cxx le.

11.2

Running FLUID Under UNIX

To run FLUID under UNIX, type:


fluid filename.fl &

to edit the .fl le filename.fl. If the le does not exist you will get an error pop-up, but if you dismiss it you will be editing a blank le of that name. You can run FLUID without any name, in which case you will be editing an unnamed blank setup (but you can use save-as to write it to a le). You can provide any of the standard FLTK switches before the lename:
-display host:n.n -geometry WxH+X+Y -title windowtitle -name classname -iconic -fg color -bg color -bg2 color -scheme schemename

Changing the colors may be useful to see what your interface will look at if the user calls it with the same switches. Similarly, using "-scheme plastic" will show how the interface will look using the "plastic" scheme. In the current version, if you dont put FLUID into the background with & then you will be able to abort FLUID by typing CTRL-C on the terminal. It will exit immediately, losing any changes.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

11.3 Running FLUID Under Microsoft Windows

93

11.3

Running FLUID Under Microsoft Windows

To run FLUID under WIN32, double-click on the FLUID.exe le. You can also run FLUID from the Command Prompt window. FLUID always runs in the background under WIN32.

11.4

Compiling . les

FLUID can also be called as a command-line "compiler" to create the .cxx and .h le from a .fl le. To do this type:

fluid -c filename.fl

This will read the filename.fl le and write filename.cxx and filename.h. Any leading directory on filename.fl will be stripped, so they are always written to the current directory. If there are any errors reading or writing the les, FLUID will print the error and exit with a non-zero code. You can use the following lines in a makele to automate the creation of the source and header les:

my_panels.h my_panels.cxx: my_panels.fl fluid -c my_panels.fl

Most versions of make support rules that cause .fl les to be compiled:

.SUFFIXES: .fl .cxx .h .fl.h .fl.cxx: fluid -c $<

11.5

A Short Tutorial

FLUID is an amazingly powerful little program. However, this power comes at a price as it is not always obvious how to accomplish seemingly simple tasks with it. This tutorial will show you how to generate a complete user interface class with FLUID that is used for the CubeView program provided with FLTK.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

94

Programming with FLUID

Figure 11.2: CubeView demo

The window is of class CubeViewUI, and is completely generated by FLUID, including class member functions. The central display of the cube is a separate subclass of Fl_Gl_Window called CubeView. CubeViewUI manages CubeView using callbacks from the various sliders and rollers to manipulate the viewing angle and zoom of CubeView. At the completion of this tutorial you will (hopefully) understand how to: 1. Use FLUID to create a complete user interface class, including constructor and any member functions necessary. 2. Use FLUID to set callbacks member functions of a custom widget classes. 3. Subclass an Fl_Gl_Window to suit your purposes.

11.5.1

The CubeView Class

The CubeView class is a subclass of Fl_Gl_Window. It has methods for setting the zoom, the x and y pan, and the rotation angle about the x and y axes. You can safely skip this section as long as you realize the CubeView is a sublass of Fl_Gl_Window and will respond to calls from CubeViewUI, generated by FLUID. The CubeView Class Denition

Here is the CubeView class denition, as given by its header le "test/CubeView.h":


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

11.5 A Short Tutorial


class CubeView : public Fl_Gl_Window { public: CubeView(int x,int y,int w,int h,const char *l=0); // this value determines the scaling factor used to draw the cube. double size; /* Set the rotation about the vertical (y ) axis. This function is called by the horizontal roller in CubeViewUI and the initialize button in CubeViewUI. */ void v_angle(float angle){vAng=angle;}; // Return the rotation about the vertical (y ) axis. float v_angle(){return vAng;}; /* Set the rotation about the horizontal (x ) axis. This function is called by the vertical roller in CubeViewUI and the initialize button in CubeViewUI. */ void h_angle(float angle){hAng=angle;}; // the rotation about the horizontal (x ) axis. float h_angle(){return hAng;}; /* Sets the x shift of the cube view camera. This function is called by the slider in CubeViewUI and the initialize button in CubeViewUI. */ void panx(float x){xshift=x;}; /* Sets the y shift of the cube view camera. This function is called by the slider in CubeViewUI and the initialize button in CubeViewUI. */ void pany(float y){yshift=y;}; /* The widget class draw() override. The draw() function initialize Gl for another round of drawing then calls specialized functions for drawing each of the entities displayed in the cube view. */ void draw(); private: /* Draw the cube boundaries Draw the faces of the cube using the boxv[] vertices, using GL_LINE_LOOP for the faces. The color is #defined by CUBECOLOR. */ void drawCube(); float vAng,hAng; float xshift,yshift; float boxv0[3];float boxv1[3]; float boxv2[3];float boxv3[3]; float boxv4[3];float boxv5[3]; float boxv6[3];float boxv7[3]; };

95

The CubeView Class Implementation

Here is the CubeView implementation. It is very similar to the "cube" demo included with FLTK.
#include "CubeView.h" #include <math.h> CubeView::CubeView(int x,int y,int w,int h,const char *l) : Fl_Gl_Window(x,y,w,h,l)
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

96
{

Programming with FLUID

vAng = 0.0; hAng=0.0; size=10.0; /* The cube definition. These are the vertices of a unit cube centered on the origin.*/ boxv0[0] = -0.5; boxv0[1] = -0.5; boxv0[2] = -0.5; boxv1[0] = 0.5; boxv1[1] = -0.5; boxv1[2] = -0.5; boxv2[0] = 0.5; boxv2[1] = 0.5; boxv2[2] = -0.5; boxv3[0] = -0.5; boxv3[1] = 0.5; boxv3[2] = -0.5; boxv4[0] = -0.5; boxv4[1] = -0.5; boxv4[2] = 0.5; boxv5[0] = 0.5; boxv5[1] = -0.5; boxv5[2] = 0.5; boxv6[0] = 0.5; boxv6[1] = 0.5; boxv6[2] = 0.5; boxv7[0] = -0.5; boxv7[1] = 0.5; boxv7[2] = 0.5; }; // The color used for the edges of the bounding cube. #define CUBECOLOR 255,255,255,255 void CubeView::drawCube() { /* Draw a colored cube */ #define ALPHA 0.5 glShadeModel(GL_FLAT); glBegin(GL_QUADS); glColor4f(0.0, 0.0, 1.0, ALPHA); glVertex3fv(boxv0); glVertex3fv(boxv1); glVertex3fv(boxv2); glVertex3fv(boxv3); glColor4f(1.0, 1.0, 0.0, ALPHA); glVertex3fv(boxv0); glVertex3fv(boxv4); glVertex3fv(boxv5); glVertex3fv(boxv1); glColor4f(0.0, 1.0, 1.0, ALPHA); glVertex3fv(boxv2); glVertex3fv(boxv6); glVertex3fv(boxv7); glVertex3fv(boxv3); glColor4f(1.0, 0.0, 0.0, ALPHA); glVertex3fv(boxv4); glVertex3fv(boxv5); glVertex3fv(boxv6); glVertex3fv(boxv7); glColor4f(1.0, 0.0, 1.0, ALPHA); glVertex3fv(boxv0); glVertex3fv(boxv3); glVertex3fv(boxv7); glVertex3fv(boxv4); glColor4f(0.0, 1.0, 0.0, ALPHA); glVertex3fv(boxv1); glVertex3fv(boxv5); glVertex3fv(boxv6); glVertex3fv(boxv2); glEnd(); glColor3f(1.0, 1.0, 1.0); glBegin(GL_LINES); glVertex3fv(boxv0); glVertex3fv(boxv1); glVertex3fv(boxv1); glVertex3fv(boxv2); glVertex3fv(boxv2);

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

11.5 A Short Tutorial


glVertex3fv(boxv3); glVertex3fv(boxv3); glVertex3fv(boxv0); glVertex3fv(boxv4); glVertex3fv(boxv5); glVertex3fv(boxv5); glVertex3fv(boxv6); glVertex3fv(boxv6); glVertex3fv(boxv7); glVertex3fv(boxv7); glVertex3fv(boxv4); glVertex3fv(boxv0); glVertex3fv(boxv4); glVertex3fv(boxv1); glVertex3fv(boxv5); glVertex3fv(boxv2); glVertex3fv(boxv6); glVertex3fv(boxv3); glVertex3fv(boxv7); glEnd(); };//drawCube void CubeView::draw() { if (!valid()) { glLoadIdentity(); glViewport(0,0,w(),h()); glOrtho(-10,10,-10,10,-20000,10000); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); glTranslatef(xshift, yshift, 0); glRotatef(hAng,0,1,0); glRotatef(vAng,1,0,0); glScalef(float(size),float(size),float(size)); drawCube(); glPopMatrix(); };

97

11.5.2

The CubeViewUI Class

We will completely construct a window to display and control the CubeView dened in the previous section using FLUID.

Dening the CubeViewUI Class

Once you have started FLUID, the rst step in dening a class is to create a new class within FLUID using the New->Code->Class menu item. Name the class "CubeViewUI" and leave the subclass blank. We do not need any inheritance for this window. You should see the new class declaration in the FLUID browser window.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

98

Programming with FLUID

Figure 11.3: FLUID le for CubeView

Adding the Class Constructor

Click on the CubeViewUI class in the FLUID window and add a new method by selecting New->Code>Function/Method. The name of the function will also be CubeViewUI. FLUID will understands that this will be the constructor for the class and will generate the appropriate code. Make sure you declare the constructor public. Then add a window to the CubeViewUI class. Highlight the name of the constructor in the FLUID browser window and click on New->Group->Window. In a similar manner add the following to the CubeViewUI constructor: A horizontal roller named hrot A vertical roller named vrot A horizontal slider named xpan A vertical slider named ypan A horizontal value slider named zoom None of these additions need be public. And they shouldnt be unless you plan to expose them as part of the interface for CubeViewUI. When you are nished you should have something like this:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

11.5 A Short Tutorial

99

Figure 11.4: FLUID window containing CubeView demo

We will talk about the show() method that is highlighted shortly.

Adding the CubeView Widget

What we have is nice, but does little to show our cube. We have already dened the CubeView class and we would like to show it within the CubeViewUI. The CubeView class inherits the Fl_Gl_Window class, which is created in the same way as a Fl_Box widget. Use New->Other->Box to add a square box to the main window. This will be no ordinary box, however. The Box properties window will appear. The key to letting CubeViewUI display CubeView is to enter CubeView in the Class: text entry box. This tells FLUID that it is not an Fl_Box, but a similar widget with the same constructor. In the Extra Code: eld enter #include "CubeView.h" This #include is important, as we have just included CubeView as a member of CubeViewUI, so any public CubeView methods are now available to CubeViewUI.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

100

Programming with FLUID

Figure 11.5: CubeView methods

Dening the Callbacks

Each of the widgets we dened before adding CubeView can have callbacks that call CubeView methods. You can call an external function or put in a short amount of code in the Callback eld of the widget panel. For example, the callback for the ypan slider is:
cube->pany(((Fl_Slider *)o)->value()); cube->redraw();

We call cube->redraw() after changing the value to update the CubeView window. CubeView could easily be modied to do this, but it is nice to keep this exposed in the case where you may want to do more than one view change only redrawing once saves a lot of time. There is no reason no wait until after you have added CubeView to enter these callbacks. FLUID assumes you are smart enough not to refer to members or functions that dont exist. Adding a Class Method

You can add class methods within FLUID that have nothing to do with the GUI. An an example add a show function so that CubeViewUI can actually appear on the screen. Make sure the top level CubeViewUI is selected and select New->Code->Function/Method. Just use the name show(). We dont need a return value here, and since we will not be adding any widgets to this method FLUID will assign it a return type of void.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

11.6 FLUID Reference

101

Figure 11.6: CubeView constructor

Once the new method has been added, highlight its name and select New->Code->Code. Enter the methods code in the code window.

11.5.3

Adding Constructor Initialization Code

If you need to add code to initialize class, for example setting initial values of the horizontal and vertical angles in the CubeView, you can simply highlight the Constructor and select New->Code->Code. Add any required code.

11.5.4

Generating the Code

Now that we have completely dened the CubeViewUI, we have to generate the code. There is one last trick to ensure this all works. Open the preferences dialog from Edit->Preferences. At the bottom of the preferences dialog box is the key: "Include Header from Code". Select that option and set your desired le extensions and you are in business. You can include the CubeViewUI.h (or whatever extension you prefer) as you would any other C++ class.

11.6

FLUID Reference

The following sections describe each of the windows in FLUID.

11.6.1

The Widget Browser

The main window shows a menu bar and a scrolling browser of all the dened widgets. The name of the .fl le being edited is shown in the window title. The widgets are stored in a hierarchy. You can open and close a level by clicking the "triangle" at the left of a widget. The leftmost widgets are the parents, and all the widgets listed below them are their children. Parents dont have to have any children.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

102

Programming with FLUID

The top level of the hierarchy is composed of functions and classes. Each of these will produce a single C++ public function or class in the output .cxx le. Calling the function or instantiating the class will create all of the child widgets. The second level of the hierarchy contains the windows. Each of these produces an instance of class Fl_Window. Below that are either widgets (subclasses of Fl_Widget) or groups of widgets (including other groups). Plain groups are for layout, navigation, and resize purposes. Tab groups provide the well-known le-card tab interface. Widgets are shown in the browser by either their name (such as "main_panel" in the example), or by their type and label (such as "Button "the green""). You select widgets by clicking on their names, which highlights them (you can also select widgets from any displayed window). You can select many widgets by dragging the mouse across them, or by using Shift+Click to toggle them on and off. To select no widgets, click in the blank area under the last widget. Note that hidden children may be selected even when there is no visual indication of this. You open widgets by double-clicking on them, or (to open several widgets you have picked) by typing the F1 key. A control panel will appear so you can change the widget(s).

11.6.2

Menu Items

The menu bar at the top is duplicated as a pop-up menu on any displayed window. The shortcuts for all the menu items work in any window. The menu items are: File/Open... (Ctrl+o)

Discards the current editing session and reads in a different .fl le. You are asked for conrmation if you have changed the current le.

FLUID can also read .fd les produced by the Forms and XForms "fdesign" programs. It is best to File/Merge them instead of opening them. FLUID does not understand everything in a .fd le, and will print a warning message on the controlling terminal for all data it does not understand. You will probably need to edit the resulting setup to x these errors. Be careful not to save the le without changing the name, as FLUID will write over the .fd le with its own format, which fdesign cannot read! File/Insert... (Ctrl+i)

Inserts the contents of another .fl le, without changing the name of the current .fl le. All the functions (even if they have the same names as the current ones) are added, and you will have to use cut/paste to put the widgets where you want. File/Save (Ctrl+s)

Writes the current data to the .fl le. If the le is unnamed then FLUID will ask for a lename.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

11.6 FLUID Reference File/Save As... (Ctrl+Shift+S)

103

Asks for a new lename and saves the le. File/Write Code (Ctrl+Shift+C)

"Compiles" the data into a .cxx and .h le. These are exactly the same as the les you get when you run FLUID with the -c switch. The output le names are the same as the .fl le, with the leading directory and trailing "." stripped, and ".h" or ".cxx" appended. File/Write Strings (Ctrl+Shift+W)

Writes a message le for all of the text labels dened in the current le.

The output le name is the same as the .fl le, with the leading directory and trailing "." stripped, and ".txt", ".po", or ".msg" appended depending on the Internationalization Mode. File/Quit (Ctrl+q)

Exits FLUID. You are asked for conrmation if you have changed the current le. Edit/Undo (Ctrl+z)

This isnt implemented yet. You should do save often so you can recover from any mistakes you make. Edit/Cut (Ctrl+x)

Deletes the selected widgets and all of their children. These are saved to a "clipboard" le and can be pasted back into any FLUID window. Edit/Copy (Ctrl+c)

Copies the selected widgets and all of their children to the "clipboard" le.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

104 Edit/Paste (Ctrl+c)

Programming with FLUID

Pastes the widgets from the clipboard le.

If the widget is a window, it is added to whatever function is selected, or contained in the current selection. If the widget is a normal widget, it is added to whatever window or group is selected. If none is, it is added to the window or group that is the parent of the current selection.

To avoid confusion, it is best to select exactly one widget before doing a paste.

Cut/paste is the only way to change the parent of a widget. Edit/Select All (Ctrl+a)

Selects all widgets in the same group as the current selection.

If they are all selected already then this selects all widgets in that groups parent. Repeatedly typing Ctrl+a will select larger and larger groups of widgets until everything is selected. Edit/Open... (F1 or double click)

Displays the current widget in the attributes panel. If the widget is a window and it is not visible then the window is shown instead. Edit/Sort

Sorts the selected widgets into left to right, top to bottom order. You need to do this to make navigation keys in FLTK work correctly. You may then ne-tune the sorting with "Earlier" and "Later". This does not affect the positions of windows or functions. Edit/Earlier (F2)

Moves all of the selected widgets one earlier in order among the children of their parent (if possible). This will affect navigation order, and if the widgets overlap it will affect how they draw, as the later widget is drawn on top of the earlier one. You can also use this to reorder functions, classes, and windows within functions.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

11.6 FLUID Reference Edit/Later (F3)

105

Moves all of the selected widgets one later in order among the children of their parent (if possible).

Edit/Group (F7)

Creates a new Fl_Group and make all the currently selected widgets children of it.

Edit/Ungroup (F8)

Deletes the parent group if all the children of a group are selected.

Edit/Overlays on/off (Ctrl+Shift+O)

Toggles the display of the red overlays off, without changing the selection. This makes it easier to see box borders and how the layout looks. The overlays will be forced back on if you change the selection.

Edit/Project Settings... (Ctrl+p)

Displays the project settings panel. The output lenames control the extensions or names of the les the are generated by FLUID. If you check the "Include .h from .cxx" button the code le will include the header le automatically.

The internationalization options are described later in this chapter.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

106

Programming with FLUID

Figure 11.7: FLUID Preferences Window Edit/GUI Settings... (Shift+Ctrl+p)

Displays the GUI settings panel. This panel is used to control the user interface settings. New/Code/Function

Creates a new C function. You will be asked for a name for the function. This name should be a legal C++ function template, without the return type. You can pass arguments which can be referred to by code you type into the individual widgets. If the function contains any unnamed windows, it will be declared as returning a Fl_Window pointer. The unnamed window will be returned from it (more than one unnamed window is useless). If the function contains only named windows, it will be declared as returning nothing (void ). It is possible to make the .cxx output be a self-contained program that can be compiled and executed. This is done by deleting the function name so main(argc,argv) is used. The function will call show() on all the windows it creates and then call Fl::run(). This can also be used to test resize behavior or other parts of the user interface. You can change the function name by double-clicking on the function.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

11.6 FLUID Reference New/Window

107

Creates a new Fl_Window widget. The window is added to the currently selected function, or to the function containing the currently selected item. The window will appear, sized to 100x100. You can resize it to whatever size you require.

The widget panel will also appear and is described later in this chapter. New/...

All other items on the New menu are subclasses of Fl_Widget. Creating them will add them to the currently selected group or window, or the group or window containing the currently selected widget. The initial dimensions and position are chosen by copying the current widget, if possible.

When you create the widget you will get the widgets control panel, which is described later in this chapter. Layout/Align/...

Align all selected widgets to the rst widget in the selection. Layout/Space Evenly/...

Space all selected widgets evenly inside the selected space. Widgets will be sorted from rst to last. Layout/Make Same Size/...

Make all selected widgets the same size as the rst selected widget. Layout/Center in Group/...

Center all selected widgets relative to their parent widget Layout/Grid... (Ctrl+g)

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

108

Programming with FLUID

Displays the grid settings panel. This panel controls the grid that all widgets snap to when you move and resize them, and for the "snap" which is how far a widget has to be dragged from its original position to actually change. Shell/Execute Command... (Alt+x)

Displays the shell command panel. The shell command is commonly used to run a make script to compile the FLTK output. Shell/Execute Again (Alt+g)

Run the shell command again. Help/About FLUID

Pops up a panel showing the version of FLUID. Help/On FLUID

Shows this chapter of the manual. Help/Manual

Shows the contents page of the manual

11.6.3

The Widget Panel

When you double-click on a widget or a set of widgets you will get the "widget attribute panel". When you change attributes using this panel, the changes are reected immediately in the window. It is useful to hit the "no overlay" button (or type Ctrl+Shift+O) to hide the red overlay so you can see the widgets more accurately, especially when setting the box type. If you have several widgets selected, they may have different values for the elds. In this case the value for one of the widgets is shown. But if you change this value, all of the selected widgets are changed to the new value. Hitting "OK" makes the changes permanent. Selecting a different widget also makes the changes permanent. FLUID checks for simple syntax errors such as mismatched parenthesis in any code before saving any text.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

11.7 GUI Attributes

109

"Revert" or "Cancel" put everything back to when you last brought up the panel or hit OK. However in the current version of FLUID, changes to "visible" attributes (such as the color, label, box) are not undone by revert or cancel. Changes to code like the callbacks are undone, however.

Figure 11.8: The FLUID widget GUI attributes

11.7

GUI Attributes

Label (text eld)

String to print next to or inside the button. You can put newlines into the string to make multiple lines. The easiest way is by typing Ctrl+j.

Symbols can be added to the label using the at sign ("@"). Label (pull down menu)

How to draw the label. Normal, shadowed, engraved, and embossed change the appearance of the text. Image

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

110

Programming with FLUID

The active image for the widget. Click on the Browse... button to pick an image le using the le chooser. Inactive

The inactive image for the widget. Click on the Browse... button to pick an image le using the le chooser. Alignment (buttons)

Where to draw the label. The arrows put it on that side of the widget, you can combine the to put it in the corner. The "box" button puts the label inside the widget, rather than outside.

The clip button clips the label to the widget box, the wrap button wraps any text in the label, and the text image button puts the text over the image instead of under the image. Position (text elds)

The position elds show the current position and size of the widget box. Enter new values to move and/or resize a widget. Values (text elds)

The values and limits of the current widget. Depending on the type of widget, some or all of these elds may be inactive. Shortcut

The shortcut key to activate the widget. Click on the shortcut button and press any key sequence to set the shortcut. Attributes (buttons)

The Visible button controls whether the widget is visible (on) or hidden (off) initially. Dont change this for windows or for the immediate children of a Tabs group.

The Active button controls whether the widget is activated (on) or deactivated (off) initially. Most widgets appear greyed out when deactivated.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

11.7 GUI Attributes

111

The Resizable button controls whether the window is resizeable. In addition all the size changes of a window or group will go "into" the resizable child. If you have a large data display surrounded by buttons, you probably want that data area to be resizable. You can get more complex behavior by making invisible boxes the resizable widget, or by using hierarchies of groups. Unfortunately the only way to test it is to compile the program. Resizing the FLUID window is not the same as what will happen in the user program.

The Hotspot button causes the parent window to be positioned with that widget centered on the mouse. This position is determined when the FLUID function is called, so you should call it immediately before showing the window. If you want the window to hide and then reappear at a new position, you should have your program set the hotspot itself just before show().

The Border button turns the window manager border on or off. On most window managers you will have to close the window and reopen it to see the effect. X Class (text eld)

The string typed into here is passed to the X window manager as the class. This can change the icon or window decorations. On most (all?) window managers you will have to close the window and reopen it to see the effect.

Figure 11.9: The FLUID widget Style attributes

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

112

Programming with FLUID

11.7.1

Style Attributes

Label Font (pulldown menu)

Font to draw the label in. Ignored by symbols, bitmaps, and pixmaps. Your program can change the actual font used by these "slots" in case you want some font other than the 16 provided. Label Size (pulldown menu)

Pixel size (height) for the font to draw the label in. Ignored by symbols, bitmaps, and pixmaps. To see the result without dismissing the panel, type the new number and then Tab. Label Color (button)

Color to draw the label. Ignored by pixmaps (bitmaps, however, do use this color as the foreground color). Box (pulldown menu)

The boxtype to draw as a background for the widget.

Many widgets will work, and draw faster, with a "frame" instead of a "box". A frame does not draw the colored interior, leaving whatever was already there visible. Be careful, as FLUID may draw this ok but the real program may leave unwanted stuff inside the widget.

If a window is lled with child widgets, you can speed up redrawing by changing the windows box type to "NO_BOX". FLUID will display a checkerboard for any areas that are not colored in by boxes. Note that this checkerboard is not drawn by the resulting program. Instead random garbage will be displayed. Down Box (pulldown menu)

The boxtype to draw when a button is pressed or for some parts of other widgets like scrollbars and valuators. Color (button)

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

11.7 GUI Attributes

113

The color to draw the box with. Select Color (button)

Some widgets will use this color for certain parts. FLUID does not always show the result of this: this is the color buttons draw in when pushed down, and the color of input elds when they have the focus. Text Font, Size, and Color

Some widgets display text, such as input elds, pull-down menus, and browsers.

Figure 11.10: The FLUID widget C++ attributes

11.7.2
Class

C++ Attributes

This is how you use your own subclasses of Fl_Widget. Whatever identier you type in here will be the class that is instantiated.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

114

Programming with FLUID

In addition, no #include header le is put in the .h le. You must provide a #include line as the rst line of the "Extra Code" which declares your subclass.

The class must be similar to the class you are spoong. It does not have to be a subclass. It is sometimes useful to change this to another FLTK class. Currently the only way to get a double-buffered window is to change this eld for the window to "Fl_Double_Window" and to add
#include <FL/Fl_Double_Window.h>

to the extra code. Type (upper-right pulldown menu)

Some classes have subtypes that modify their appearance or behavior. You pick the subtype off of this menu. Name (text eld)

Name of a variable to declare, and to store a pointer to this widget into. This variable will be of type "<class>". If the name is blank then no variable is created. You can name several widgets with "name[0]", "name[1]", "name[2]", etc. This will cause FLUID to declare an array of pointers. The array is big enough that the highest number found can be stored. All widgets that in the array must be the same type. Public (button)

Controls whether the widget is publicly accessible. When embedding widgets in a C++ class, this controls whether the widget is public or private in the class. Otherwise is controls whether the widget is declared static or global (extern ). Extra Code (text elds)

These four elds let you type in literal lines of code to dump into the .h or .cxx les.

If the text starts with a # or the word extern then FLUID thinks this is an "include" line, and it is written to the .h le. If the same include line occurs several times then only one copy is written.

All other lines are "code" lines. The current widget is pointed to by the local variable o. The window being constructed is pointed to by the local variable w. You can also access any arguments passed to the function here, and any named widgets that are before this one.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

11.7 GUI Attributes

115

FLUID will check for matching parenthesis, braces, and quotes, but does not do much other error checking. Be careful here, as it may be hard to gure out what widget is producing an error in the compiler. If you need more than four lines you probably should call a function in your own .cxx code. Callback (text eld)

This can either be the name of a function, or a small snippet of code. If you enter anything other than letters, numbers, and the underscore then FLUID treats it as code.

A name refers to a function in your own code. It must be declared as void name(<class>,void).

A code snippet is inserted into a static function in the .cxx output le. The function prototype is void name(class o, void v) so that you can refer to the widget as o and the user_data() as v. FLUID will check for matching parenthesis, braces, and quotes, but does not do much other error checking. Be careful here, as it may be hard to gure out what widget is producing an error in the compiler.

If the callback is blank then no callback is set. User Data (text eld)

This is a value for the user_data() of the widget. If blank the default value of zero is used. This can be any piece of C code that can be cast to a void pointer. Type (text eld)

The void in the callback function prototypes is replaced with this. You may want to use long for old XForms code. Be warned that anything other than void is not guaranteed to work! However on most architectures other pointer types are ok, and long is usually ok, too. When (pulldown menu)

When to do the callback. This can be Never, Changed, Release, or Enter Key. The value of Enter Key is only useful for text input elds.

There are other rare but useful values for the when() eld that are not in the menu. You should use the extra code elds to put these values in.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

116 No Change (button)

Programming with FLUID

The No Change button means the callback is done on the matching event even if the data is not changed.

11.8

Selecting and Moving Widgets

Double-clicking a window name in the browser will display it, if not displayed yet. From this display you can select widgets, sets of widgets, and move or resize them. To close a window either double-click it or type ESC. To select a widget, click it. To select several widgets drag a rectangle around them. Holding down shift will toggle the selection of the widgets instead. You cannot pick hidden widgets. You also cannot choose some widgets if they are completely overlapped by later widgets. Use the browser to select these widgets. The selected widgets are shown with a red "overlay" line around them. You can move the widgets by dragging this box. Or you can resize them by dragging the outer edges and corners. Hold down the Alt key while dragging the mouse to defeat the snap-to-grid effect for ne positioning. If there is a tab box displayed you can change which child is visible by clicking on the le tabs. The child you pick is selected. The arrow, tab, and shift+tab keys "navigate" the selection. Left, right, tab, or shift+tab move to the next or previous widgets in the hierarchy. Hit the right arrow enough and you will select every widget in the window. Up/down widgets move to the previous/next widgets that overlap horizontally. If the navigation does not seem to work you probably need to "Sort" the widgets. This is important if you have input elds, as FLTK uses the same rules when using arrow keys to move between input elds. To "open" a widget, double click it. To open several widgets select them and then type F1 or pick "Edit/Open" off the pop-up menu. Type Ctrl+o to temporarily toggle the overlay off without changing the selection, so you can see the widget borders. You can resize the window by using the window manager border controls. FLTK will attempt to round the window size to the nearest multiple of the grid size and makes it big enough to contain all the widgets (it does this using illegal X methods, so it is possible it will barf with some window managers!). Notice that the actual window in your program may not be resizable, and if it is, the effect on child widgets may be different. The panel for the window (which you get by double-clicking it) is almost identical to the panel for any other Fl_Widget. There are three extra items:

11.9

Image Labels

The contents of the image les in the Image and Inactive text elds are written to the .cxx le. If many widgets share the same image then only one copy is written. Since the image data is embedded in the generated source code, you need only distribute the C++ code and not the image les themselves. However, the lenames are stored in the .fl le so you will need the image les as well to read the .fl le. Filenames are relative to the location of the .fl le and not necessarily the current directory. We recommend you either put the images in the same directory as the .fl le, or use absolute path names.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

11.9 Image Labels Notes for All Image Types

117

FLUID runs using the default visual of your X server. This may be 8 bits, which will give you dithered images. You may get better results in your actual program by adding the code "Fl::visual(FL_RGB)" to your code right before the rst window is displayed.

All widgets with the same image on them share the same code and source X pixmap. Thus once you have put an image on a widget, it is nearly free to put the same image on many other widgets.

If you edit an image at the same time you are using it in FLUID, the only way to convince FLUID to read the image le again is to remove the image from all widgets that are using it or re-load the .fl le.

Dont rely on how FLTK crops images that are outside the widget, as this may change in future versions! The cropping of inside labels will probably be unchanged.

To more accurately place images, make a new "box" widget and put the image in that as the label. XBM (X Bitmap) Files

FLUID reads X bitmap les which use C source code to dene a bitmap. Sometimes they are stored with the ".h" or ".bm" extension rather than the standard ".xbm" extension.

FLUID writes code to construct an Fl_Bitmap image and use it to label the widget. The 1 bits in the bitmap are drawn using the label color of the widget. You can change this color in the FLUID widget attributes panel. The 0 bits are transparent.

The program "bitmap" on the X distribution does an adequate job of editing bitmaps. XPM (X Pixmap) Files

FLUID reads X pixmap les as used by the libxpm library. These les use C source code to dene a pixmap. The lenames usually have the ".xpm" extension.

FLUID writes code to construct an Fl_Pixmap image and use it to label the widget. The label color of the widget is ignored, even for 2-color images that could be a bitmap. XPM les can mark a single color as being transparent, and FLTK uses this information to generate a transparency mask for the image.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

118

Programming with FLUID

We have not found any good editors for small iconic pictures. For pixmaps we have used XPaint and the KDE icon editor. BMP Files

FLUID reads Windows BMP image les which are often used in WIN32 applications for icons. FLUID converts BMP les into (modied) XPM format and uses a Fl_BMP_Image image to label the widget. Transparency is handled the same as for XPM les. All image data is uncompressed when written to the source le, so the code may be much bigger than the .bmp le. GIF Files

FLUID reads GIF image les which are often used in HTML documents to make icons. FLUID converts GIF les into (modied) XPM format and uses a Fl_GIF_Image image to label the widget. Transparency is handled the same as for XPM les. All image data is uncompressed when written to the source le, so the code may be much bigger than the .gif le. Only the rst image of an animated GIF le is used. JPEG Files

If FLTK is compiled with JPEG support, FLUID can read JPEG image les which are often used for digital photos. FLUID uses a Fl_JPEG_Image image to label the widget, and writes uncompressed RGB or grayscale data to the source le. PNG (Portable Network Graphics) Files

If FLTK is compiled with PNG support, FLUID can read PNG image les which are often used in HTML documents. FLUID uses a Fl_PNG_Image image to label the widget, and writes uncompressed RGB or grayscale data to the source le. PNG images can provide a full alpha channel for partial transparency, and FLTK supports this as best as possible on each platform.

11.10

Internationalization with FLUID

FLUID supports internationalization (I18N for short) of label strings used by widgets. The preferences window (Ctrl+p) provides access to the I18N options.

11.10.1

I18N Methods

FLUID supports three methods of I18N: use none, use GNU gettext, and use POSIX catgets. The "use none" method is the default and just passes the label strings as-is to the widget constructors.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

11.10 Internationalization with FLUID

119

The "GNU gettext" method uses GNU gettext (or a similar text-based I18N library) to retrieve a localized string before calling the widget constructor. The "POSIX catgets" method uses the POSIX catgets function to retrieve a numbered message from a message catalog before calling the widget constructor.

11.10.2

Using GNU gettext for I18N

FLUIDs code support for GNU gettext is limited to calling a function or macro to retrieve the localized label; you still need to call setlocale() and textdomain() or bindtextdomain() to select the appropriate language and message le. To use GNU gettext for I18N, open the preferences window and choose "GNU gettext" from the Use: chooser. Two new input elds will then appear to control the include le and function/macro name to use when retrieving the localized label strings.

Figure 11.11: Internationalization using GNU gettext

The #include eld controls the header le to include for I18N; by default this is <libintl.h>, the standard I18N le for GNU gettext. The Function: eld controls the function (or macro) that will retrieve the localized message; by default the gettext function will be called.

11.10.3

Using POSIX catgets for I18N

FLUIDs code support for POSIX catgets allows you to use a global message le for all interfaces or a le specic to each .fl le; you still need to call setlocale() to select the appropriate language.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

120

Programming with FLUID

To use POSIX catgets for I18N, open the preferences window and choose "POSIX catgets" from the Use: chooser. Three new input elds will then appear to control the include le, catalog le, and set number for retrieving the localized label strings.

Figure 11.12: Internationalization using POSIX catgets

The #include eld controls the header le to include for I18N; by default this is <nl_types.h>, the standard I18N le for POSIX catgets. The File: eld controls the name of the catalog le variable to use when retrieving localized messages; by default the le eld is empty which forces a local (static) catalog le to be used for all of the windows dened in your .fl le. The Set: eld controls the set number in the catalog le. The default set is 1 and rarely needs to be changed.

11.11

Known limitations

Declaration Blocks can be used to temporarily block out already designed code using #if 0 and #endif type construction. This will effectively avoid compilation of blocks of code. However, static code and data generated by this segment (menu items, images, include statements, etc.) will still be generated and likely cause compile-time warnings.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 12

Advanced FLTK
This chapter explains advanced programming and design topics that will help you to get the most out of FLTK.

12.1

Multithreading

FLTK supports multithreaded applications using a locking mechanism based on "pthreads". We do not provide a threading interface as part of the library. However a simple example how threads can be implemented for all supported platforms can be found in test/threads.h and test/threads.cxx. To use the locking mechanism, FLTK must be compiled with --enable-threads set during the configure process. IDE-based versions of FLTK are automatically compiled with locking enabled if possible. In main(), call Fl::lock() before Fl::run() or Fl::wait() to start the runtime multithreading support for your program. All callbacks and derived functions like handle() and draw() will now be properly locked:
int main() { Fl::lock(); /* run thread */ while (Fl::wait() > 0) { if (Fl::thread_message()) { /* process your data */ } } }

You can now start as many threads as you like. From within a thread (other than the main thread) FLTK calls must be wrapped with calls to Fl::lock() and Fl::unlock():
Fl::lock(); ... Fl::unlock(); // avoid conflicting calls // your code here // allow other threads to access FLTK again

You can send messages from child threads to the main thread using Fl::awake(void message):
void *msg; Fl::awake(msg); // "msg" is a pointer to your message // send "msg" to main thread

A message can be anything you like. The main thread can retrieve the message by calling Fl::thread_message(). See example above.

122

Advanced FLTK

You can also tell the main thread to call a function for you as soon as possible by using Fl::awake(Fl_Awake_Handler cb, void userdata):
void do_something(void *userdata) { // running with the main thread } // running in another thread void *data; // "data" is a pointer to your user data Fl::awake(do_something, data); // call something in main thread

FLTK supports multiple platforms, some of which allow only the main thread to handle system events and open or close windows. The safe thing to do is to adhere to the following rules for threads on all operating systems: Dont show() or hide() anything that contains widgets derived from Fl_Window, including dialogs, le choosers, subwindows or those using Fl_Gl_Window. Dont call Fl::wait(), Fl::ush() or any related methods that will handle system messages Dont start or cancel timers Dont change window decorations or titles The make_current() method may or may not work well for regular windows, but should always work for a Fl_Gl_Window to allow for high speed rendering on graphics cards with multiple pipelines See also: Fl::awake(void message), Fl::lock(), Fl::thread_message(), Fl::unlock().

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 13

Unicode and UTF-8 Support


This chapter explains how FLTK handles international text via Unicode and UTF-8. Unicode support was only recently added to FLTK and is still incomplete. This chapter is Work in Progress, reecting the current state of Unicode support.

13.1

About Unicode, ISO 10646 and UTF-8

The summary of Unicode, ISO 10646 and UTF-8 given below is deliberately brief, and provides just enough information for the rest of this chapter. For further information, please see: http://www.unicode.org http://www.iso.org http://en.wikipedia.org/wiki/Unicode http://www.cl.cam.ac.uk/mgk25/unicode.html http://www.apps.ietf.org/rfc/rfc3629.html The Unicode Standard

The Unicode Standard was originally developed by a consortium of mainly US computer manufacturers and developers of multi-lingual software. It has now become a defacto standard for character encoding, and is supported by most of the major computing companies in the world. Before Unicode, many different systems, on different platforms, had been developed for encoding characters for different languages, but no single encoding could satisfy all languages. Unicode provides access to over 100,000 characters used in all the major languages written today, and is independent of platform and language. Unicode also provides higher-level concepts needed for text processing and typographic publishing systems, such as algorithms for sorting and comparing text, composite character and text rendering, right-toleft and bi-directional text handling. There are currently no plans to add this extra functionality to FLTK.

124 ISO 10646

Unicode and UTF-8 Support

The International Organisation for Standardization (ISO) had also been trying to develop a single unied character set. Although both ISO and the Unicode Consortium continue to publish their own standards, they have agreed to coordinate their work so that specic versions of the Unicode and ISO 10646 standards are compatible with each other. The international standard ISO 10646 denes the Universal Character Set (UCS) which contains the characters required for almost all known languages. The standard also denes three different implementation levels specifying how these characters can be combined. There are currently no plans for handling the different implementation levels or the combining characters in FLTK. In UCS, characters have a unique numerical code and an ofcial name, and are usually shown using U+ and the code in hexadecimal, e.g. U+0041 is the "Latin capital letter A". The UCS characters U+0000 to U+007F correspond to US-ASCII, and U+0000 to U+00FF correspond to ISO 8859-1 (Latin1). ISO 10646 was originally designed to handle a 31-bit character set from U+00000000 to U+7FFFFFFF, but the current idea is that 21-bits will be sufcient for all future needs, giving characters up to U+10FFFF. The complete character set is sub-divided into planes. Plane 0, also known as the Basic Multilingual Plane (BMP), ranges from U+0000 to U+FFFD and consists of the most commonly used characters from previous encoding standards. Other planes contain characters for specialist applications. Todo Do we need this info about planes? The UCS also denes various methods of encoding characters as a sequence of bytes. UCS-2 encodes Unicode characters into two bytes, which is wasteful if you are only dealing with ASCII or Latin1 text, and insufcient if you need characters above U+00FFFF. UCS-4 uses four bytes, which lets it handle higher characters, but this is even more wasteful for ASCII or Latin1. UTF-8

The Unicode standard denes various UCS Transformation Formats. UTF-16 and UTF-32 are based on units of two and four bytes. UCS characters requiring more than 16-bits are encoded using "surrogate pairs" in UTF-16. UTF-8 encodes all Unicode characters into variable length sequences of bytes. Unicode characters in the 7-bit ASCII range map to the same value and are represented as a single byte, making the transformation to Unicode quick and easy. All UCS characters above U+007F are encoded as a sequence of several bytes. The top bits of the rst byte are set to show the length of the byte sequence, and subseqent bytes are always in the range 0x80 to 0x8F. This combination provides some level of synchronisation and error detection. Unicode range U+00000000 U+00000080 U+00000800 U+00010000 U+0000007F U+000007FF U+0000FFFF U+001FFFFF Byte sequences 0xxxxxxx 110xxxxx 10xxxxxx 1110xxxx 10xxxxxx 11110xxx 10xxxxxx 10xxxxxx 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 1111110x 10xxxxxx 10xxxxxx 10xxxxxx

10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx

U+00200000 - U+03FFFFFF U+04000000 - U+7FFFFFFF

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

13.2 Unicode in FLTK

125

Moving from ASCII encoding to Unicode will allow all new FLTK applications to be easily internationalized and used all over the world. By choosing UTF-8 encoding, FLTK remains largely source-code compatible to previous iteration of the library.

13.2

Unicode in FLTK

Todo Work through the code and this documentation to harmonize the [OksiD] and [tk2] functions. FLTK will be entirely converted to Unicode using UTF-8 encoding. If a different encoding is required by the underlying operating system, FLTK will convert the string as needed. It is important to note that the initial implementation of Unicode and UTF-8 in FLTK involves three important areas: provision of Unicode character tables and some simple related functions; conversion of char variables and function parameters from single byte per character representation to UTF-8 variable length sequences; modications to the display font interface to accept general Unicode character or UCS code numbers instead of just ASCII or Latin1 characters. The current implementation of Unicode / UTF-8 in FLTK will impose the following limitations: An implementation note in the [OksiD] code says that all functions are LIMITED to 24 bit Unicode values, but also says that only 16 bits are really used under linux and win32. [Can we verify this?] The [tk2] _utf8encode() and _utf8decode() functions are designed to handle Unicode characters in the range U+000000 to U+10FFFF inclusive, which covers all UTF-16 characters, as specied in RFC 3629. Note that the user must rst convert UTF-16 surrogate pairs to UCS. FLTK will only handle single characters, so composed characters consisting of a base character and oating accent characters will be treated as multiple characters; FLTK will only compare or sort strings on a byte by byte basis and not on a general Unicode character basis; FLTK will not handle right-to-left or bi-directional text; Todo Verify 16/24 bit Unicode limit for different character sets? OksiDs code appears limited to 16bit whereas the FLTK2 code appears to handle a wider set. What about illegal characters? See comments in _utf8fromwc() and _utf8toUtf16().

13.3

Illegal Unicode and UTF-8 sequences

Three pre-processor variables are dened in the source code that determine how _utf8decode() handles illegal UTF-8 sequences:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

126

Unicode and UTF-8 Support if ERRORS_TO_CP1252 is set to 1 (the default), _utf8decode() will assume that a byte sequence starting with a byte in the range 0x80 to 0x9f represents a Microsoft CP1252 character, and will instead return the value of an equivalent UCS character. Otherwise, it will be processed as an illegal byte value as described below. if STRICT_RFC3629 is set to 1 (not the default!) then UTF-8 sequences that correspond to illegal UCS values are treated as errors. Illegal UCS values include those above U+10FFFF, or corresponding to UTF-16 surrogate pairs. Illegal byte values are handled as described below. if ERRORS_TO_ISO8859_1 is set to 1 (the default), the illegal byte value is returned unchanged, otherwise 0xFFFD, the Unicode REPLACEMENT CHARACTER, is returned instead.

_utf8encode() is less strict, and only generates the UTF-8 sequence for 0xFFFD, the Unicode REPLACEMENT CHARACTER, if it is asked to encode a UCS value above U+10FFFF. Many of the [tk2] functions below use _utf8decode() and _utf8encode() in their own implementation, and are therefore somewhat protected from bad UTF-8 sequences. The [OksiD] _utf8len() function assumes that the byte it is passed is the rst byte in a UTF-8 sequence, and returns the length of the sequence. Trailing bytes in a UTF-8 sequence will return -1. WARNING: _utf8len() can not distinguish between single bytes representing Microsoft CP1252 characters 0x80-0x9f and those forming part of a valid UTF-8 sequence. You are strongly advised not to use _utf8len() in your own code unless you know that the byte sequence contains only valid UTF-8 sequences. WARNING: Some of the [OksiD] functions below use still use _utf8len() in their implementations. These may need further validation. Please see the individual function description for further details about error handling and return values.

13.4

FLTK Unicode and UTF-8 functions

This section currently provides a brief overview of the functions. For more details, consult the main text for each function via its link. int _utf8locale() FLTK2

fl_utf8locale() returns true if the "locale" seems to indicate that UTF-8 encoding is used.

It is highly recommended that your change your system so this does return true! int _utf8test(const char src, unsigned len) FLTK2

fl_utf8test() examines the rst len bytes of src. It returns 0 if there are any illegal UTF-8 sequences; 1 if src contains plain ASCII or if len is zero; or 2, 3 or 4 to indicate the range of Unicode characters found. int _utf_nb_char(const unsigned char buf, int len) OksiD
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

13.4 FLTK Unicode and UTF-8 functions

127

Returns the number of UTF-8 character in the rst len bytes of buf. int _unichar_to_utf8_size(Fl_Unichar) int _utf8bytes(unsigned ucs)

Returns the number of bytes needed to encode ucs in UTF-8. int _utf8len(char c) OksiD

If c is a valid rst byte of a UTF-8 encoded character sequence, fl_utf8len() will return the number of bytes in that sequence. It returns -1 if c is not a valid rst byte. unsigned int _nonspacing(unsigned int ucs) OksiD

Returns true if ucs is a non-spacing character. [What are non-spacing characters?] const char _utf8back(const char p, const char start, const char end) FLTK2 const char _utf8fwd(const char p, const char start, const char end) FLTK2

If p already points to the start of a UTF-8 character sequence, these functions will return p. Otherwise fl_utf8back() searches backwards from p and fl_utf8fwd() searches forwards from p, within the start and end limits, looking for the start of a UTF-8 character. unsigned int _utf8decode(const char p, const char end, int len) FLTK2 int _utf8encode(unsigned ucs, char buf) FLTK2

fl_utf8decode() attempts to decode the UTF-8 character that starts at p and may not extend past end. It returns the Unicode value, and the length of the UTF-8 character sequence is returned via the len argument. fl_utf8encode() writes the UTF-8 encoding of ucs into buf and returns the number of bytes in the sequence. See the main documentation for the treatment of illegal Unicode and UTF-8 sequences. unsigned int _utf8froma(char dst, unsigned dstlen, const char src, unsigned srclen) FLTK2 unsigned int _utf8toa(const char src, unsigned srclen, char dst, unsigned dstlen) FLTK2

fl_utf8froma() converts a character string containing single bytes per character (i.e. ASCII or ISO-8859-1) into UTF-8. If the src string contains only ASCII characters, the return value will be the same as srclen.

fl_utf8toa() converts a string containing UTF-8 characters into single byte characters. UTF-8 characters do not correspond to ASCII or ISO-8859-1 characters below 0xFF are replaced with ?.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

128

Unicode and UTF-8 Support

Both functions return the number of bytes that would be written, not counting the null terminator. destlen provides a means of limiting the number of bytes written, so setting destlen to zero is a means of measuring how much storage would be needed before doing the real conversion. char _utf2mbcs(const char src) OksiD

converts a UTF-8 string to a local multi-byte character string. [More info required here!] unsigned int _utf8fromwc(char dst, unsigned dstlen, const wchar_t src, unsigned srclen) FLTK2 unsigned int _utf8towc(const char src, unsigned srclen, wchar_t dst, unsigned dstlen) FLTK2 unsigned int _utf8toUtf16(const char src, unsigned srclen, unsigned short dst, unsigned dstlen) FLTK2

These routines convert between UTF-8 and wchar_t or "wide character" strings. The difculty lies in the fact sizeof(wchar_t) is 2 on Windows and 4 on Linux and most other systems. Therefore some "wide characters" on Windows may be represented as "surrogate pairs" of more than one wchar_t.

fl_utf8fromwc() converts from a "wide character" string to UTF-8. Note that srclen is the number of wchar_t elements in the source string and on Windows and this might be larger than the number of characters. dstlen species the maximum number of bytes to copy, including the null terminator.

fl_utf8towc() converts a UTF-8 string into a "wide character" string. Note that on Windows, some "wide characters" might result in "surrogate pairs" and therefore the return value might be more than the number of characters. dstlen species the maximum number of wchar_t elements to copy, including a zero terminating element. [Is this all worded correctly?]

fl_utf8toUtf16() converts a UTF-8 string into a "wide character" string using UTF-16 encoding to handle the "surrogate pairs" on Windows. dstlen species the maximum number of wchar_t elements to copy, including a zero terminating element. [Is this all worded correctly?]

These routines all return the number of elements that would be required for a full conversion of the src string, including the zero terminator. Therefore setting dstlen to zero is a way of measuring how much storage would be needed before doing the real conversion. unsigned int _utf8from_mb(char dst, unsigned dstlen, const char src, unsigned srclen) FLTK2 unsigned int _utf8to_mb(const char src, unsigned srclen, char dst, unsigned dstlen) FLTK2

These functions convert between UTF-8 and the locale-specic multi-byte encodings used on some systems for lenames, etc. If _utf8locale() returns true, these functions dont do anything useful. [Is this all worded correctly?] int _tolower(unsigned int ucs) OksiD
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

13.5 FLTK Unicode versions of system calls int _toupper(unsigned int ucs) OksiD int _utf_tolower(const unsigned char str, int len, char buf) OksiD int _utf_toupper(const unsigned char str, int len, char buf) OksiD

129

fl_tolower() and fl_toupper() convert a single Unicode character from upper to lower case, and vice versa. fl_utf_tolower() and fl_utf_toupper() convert a string of bytes, some of which may be multi-byte UTF-8 encodings of Unicode characters, from upper to lower case, and vice versa.

Warning: to be safe, buf length must be at least 3len [for 16-bit Unicode] int _utf_strcasecmp(const char s1, const char s2) OksiD int _utf_strncasecmp(const char s1, const char s2, int n) OksiD

fl_utf_strcasecmp() is a UTF-8 aware string comparison function that converts the strings to lower case Unicode as part of the comparison. flt_utf_strncasecmp() only compares the rst n characters [bytes?]

13.5

FLTK Unicode versions of system calls

int _access(const char f, int mode) OksiD int _chmod(const char f, int mode) OksiD int _execvp(const char le, char const argv) OksiD FILE _fopen(cont char f, const char mode) OksiD char _getcwd(char buf, int maxlen) OksiD char _getenv(const char name) OksiD char _make_path(const char path) - returns char ? OksiD void _make_path_for_le(const char path) OksiD int _mkdir(const char f, int mode) OksiD int _open(const char f, int o, ...) OksiD int _rename(const char f, const char t) OksiD int _rmdir(const char f) OksiD int _stat(const char path, struct stat buffer) OksiD int _system(const char f) OksiD int _unlink(const char f) OksiD TODO:

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

130 more doc on unicode, add links write something about lename encoding on OS X... explain the _utf8_... commands explain issues with Fl_Preferences why FLTK has no Fl_String class

Unicode and UTF-8 Support

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 14

FLTK Enumerations
Note This le is not actively maintained any more, but is left here as a reference, until the doxygen documentation is completed.

See also FL/Enumerations.H. This appendix lists the enumerations provided in the <FL/Enumerations.H> header le, organized by section. Constants whose value are zero are marked with "(0)", this is often useful to know when programming.

14.1

Version Numbers

The FLTK version number is stored in a number of compile-time constants: FL_MAJOR_VERSION - The major release number, currently 1. FL_MINOR_VERSION - The minor release number, currently 3. FL_PATCH_VERSION - The patch release number, currently 0. FL_VERSION - A combined oating-point version number for the major, minor, and patch release numbers, currently 1.0300.

14.2

Events

Events are identied by an Fl_Event enumeration value. The following events are currently dened: FL_NO_EVENT - No event (or an event tk does not understand) occurred (0). FL_PUSH - A mouse button was pushed. FL_RELEASE - A mouse button was released.

132 FL_ENTER - The mouse pointer entered a widget. FL_LEAVE - The mouse pointer left a widget. FL_DRAG - The mouse pointer was moved with a button pressed. FL_FOCUS - A widget should receive keyboard focus. FL_UNFOCUS - A widget loses keyboard focus. FL_KEYBOARD - A key was pressed. FL_CLOSE - A window was closed. FL_MOVE - The mouse pointer was moved with no buttons pressed. FL_SHORTCUT - The user pressed a shortcut key. FL_DEACTIVATE - The widget has been deactivated. FL_ACTIVATE - The widget has been activated. FL_HIDE - The widget has been hidden. FL_SHOW - The widget has been shown. FL_PASTE - The widget should paste the contents of the clipboard.

FLTK Enumerations

FL_SELECTIONCLEAR - The widget should clear any selections made for the clipboard. FL_MOUSEWHEEL - The horizontal or vertical mousewheel was turned. FL_DND_ENTER - The mouse pointer entered a widget dragging data. FL_DND_DRAG - The mouse pointer was moved dragging data. FL_DND_LEAVE - The mouse pointer left a widget still dragging data. FL_DND_RELEASE - Dragged data is about to be dropped.

14.3

Callback When Conditions

The following constants determine when a callback is performed: FL_WHEN_NEVER - Never call the callback (0). FL_WHEN_CHANGED - Do the callback only when the widget value changes. FL_WHEN_NOT_CHANGED - Do the callback whenever the user interacts with the widget. FL_WHEN_RELEASE - Do the callback when the button or key is released and the value changes. FL_WHEN_ENTER_KEY - Do the callback when the user presses the ENTER key and the value changes. FL_WHEN_RELEASE_ALWAYS - Do the callback when the button or key is released, even if the value doesnt change. FL_WHEN_ENTER_KEY_ALWAYS - Do the callback when the user presses the ENTER key, even if the value doesnt change.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

14.4 Fl::event_button() Values

133

14.4

Fl::event button() Values

The following constants dene the button numbers for FL_PUSH and FL_RELEASE events: FL_LEFT_MOUSE - the left mouse button FL_MIDDLE_MOUSE - the middle mouse button FL_RIGHT_MOUSE - the right mouse button

14.5

Fl::event key() Values

The following constants dene the non-ASCII keys on the keyboard for FL_KEYBOARD and FL_SHORTCUT events: FL_Button - A mouse button; use Fl_Button + n for mouse button n. FL_BackSpace - The backspace key. FL_Tab - The tab key. FL_Enter - The enter key. FL_Pause - The pause key. FL_Scroll_Lock - The scroll lock key. FL_Escape - The escape key. FL_Home - The home key. FL_Left - The left arrow key. FL_Up - The up arrow key. FL_Right - The right arrow key. FL_Down - The down arrow key. FL_Page_Up - The page-up key. FL_Page_Down - The page-down key. FL_End - The end key. FL_Print - The print (or print-screen) key. FL_Insert - The insert key. FL_Menu - The menu key. FL_Num_Lock - The num lock key. FL_KP - One of the keypad numbers; use FL_KP + n for number n. FL_KP_Enter - The enter key on the keypad. FL_F - One of the function keys; use FL_F + n for function key n. FL_Shift_L - The lefthand shift key.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

134 FL_Shift_R - The righthand shift key. FL_Control_L - The lefthand control key. FL_Control_R - The righthand control key. FL_Caps_Lock - The caps lock key. FL_Meta_L - The left meta/Windows key. FL_Meta_R - The right meta/Windows key. FL_Alt_L - The left alt key. FL_Alt_R - The right alt key. FL_Delete - The delete key.

FLTK Enumerations

14.6

Fl::event state() Values

The following constants dene bits in the Fl::event_state() value: FL_SHIFT - One of the shift keys is down. FL_CAPS_LOCK - The caps lock is on. FL_CTRL - One of the ctrl keys is down. FL_ALT - One of the alt keys is down. FL_NUM_LOCK - The num lock is on. FL_META - One of the meta/Windows keys is down. FL_COMMAND - An alias for FL_CTRL on WIN32 and X11, or FL_META on MacOS X. FL_SCROLL_LOCK - The scroll lock is on. FL_BUTTON1 - Mouse button 1 is pushed. FL_BUTTON2 - Mouse button 2 is pushed. FL_BUTTON3 - Mouse button 3 is pushed. FL_BUTTONS - Any mouse button is pushed. FL_BUTTON(n) - Mouse button n ( where n > 0) is pushed.

14.7

Alignment Values

The following constants dene bits that can be used with Fl_Widget::alighn() to control the positioning of the label: FL_ALIGN_CENTER - The label is centered (0). FL_ALIGN_TOP - The label is top-aligned. FL_ALIGN_BOTTOM - The label is bottom-aligned.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

14.8 Fonts FL_ALIGN_LEFT - The label is left-aligned. FL_ALIGN_RIGHT - The label is right-aligned. FL_ALIGN_CLIP - The label is clipped to the widget. FL_ALIGN_WRAP - The label text is wrapped as needed. FL_ALIGN_TOP_LEFT - The label appears at the top of the widget, aligned to the left. FL_ALIGN_TOP_RIGHT - The label appears at the top of the widget, aligned to the right.

135

FL_ALIGN_BOTTOM_LEFT - The label appears at the bottom of the widget, aligned to the left. FL_ALIGN_BOTTOM_RIGHT - The label appears at the bottom of the widget, aligned to the right. FL_ALIGN_LEFT_TOP - The label appears to the left of the widget, aligned at the top. Outside labels only. FL_ALIGN_RIGHT_TOP - The label appears to the right of the widget, aligned at the top. Outside labels only. FL_ALIGN_LEFT_BOTTOM - The label appears to the left of the widget, aligned at the bottom. Outside labels only. FL_ALIGN_RIGHT_BOTTOM - The label appears to the right of the widget, aligned at the bottom. Outside labels only. FL_ALIGN_INSIDE - or this with other values to put label inside the widget. FL_ALIGN_TEXT_OVER_IMAGE - Label text will appear above the image. FL_ALIGN_IMAGE_OVER_TEXT - Label text will be below the image. FL_ALIGN_IMAGE_NEXT_TO_TEXT - The image will appear to the left of the text. FL_ALIGN_TEXT_NEXT_TO_IMAGE - The image will appear to the right of the text. FL_ALIGN_IMAGE_BACKDROP - The image will be used as a background for the widget.

14.8

Fonts

The following constants dene the standard FLTK fonts: FL_HELVETICA - Helvetica (or Arial) normal (0). FL_HELVETICA_BOLD - Helvetica (or Arial) bold. FL_HELVETICA_ITALIC - Helvetica (or Arial) oblique. FL_HELVETICA_BOLD_ITALIC - Helvetica (or Arial) bold-oblique. FL_COURIER - Courier normal. FL_COURIER_BOLD - Courier bold. FL_COURIER_ITALIC - Courier italic. FL_COURIER_BOLD_ITALIC - Courier bold-italic. FL_TIMES - Times roman.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

136 FL_TIMES_BOLD - Times bold. FL_TIMES_ITALIC - Times italic. FL_TIMES_BOLD_ITALIC - Times bold-italic. FL_SYMBOL - Standard symbol font. FL_SCREEN - Default monospaced screen font. FL_SCREEN_BOLD - Default monospaced bold screen font. FL_ZAPF_DINGBATS - Zapf-dingbats font.

FLTK Enumerations

14.9

Colors

The Fl_Color enumeration type holds a FLTK color value. Colors are either 8-bit indexes into a virtual colormap or 24-bit RGB color values. Color indices occupy the lower 8 bits of the value, while RGB colors occupy the upper 24 bits, for a byte organization of RGBI.

14.9.1

Color Constants

Constants are dened for the user-dened foreground and background colors, as well as specic colors and the start of the grayscale ramp and color cube in the virtual colormap. Inline functions are provided to retrieve specic grayscale, color cube, or RGB color values. The following color constants can be used to access the user-dened colors: FL_BACKGROUND_COLOR - the default background color FL_BACKGROUND2_COLOR - the default background color for text, list, and valuator widgets FL_FOREGROUND_COLOR - the default foreground color (0) used for labels and text FL_INACTIVE_COLOR - the inactive foreground color FL_SELECTION_COLOR - the default selection/highlight color The following color constants can be used to access the colors from the FLTK standard color cube: FL_BLACK FL_BLUE FL_CYAN FL_DARK_BLUE FL_DARK_CYAN FL_DARK_GREEN FL_DARK_MAGENTA FL_DARK_RED FL_DARK_YELLOW
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

14.10 Cursors FL_GREEN FL_MAGENTA FL_RED FL_WHITE FL_YELLOW The following are named values within the standard grayscale: FL_GRAY0 FL_DARK3 FL_DARK2 FL_DARK1 FL_LIGHT1 FL_LIGHT2 FL_LIGHT3

137

The inline methods for getting a grayscale, color cube, or RGB color value are described in the Colors section of the Drawing Things in FLTK chapter.

14.10

Cursors

The following constants dene the mouse cursors that are available in FLTK. The double-headed arrows are bitmaps provided by FLTK on X, the others are provided by system-dened cursors. FL_CURSOR_DEFAULT - the default cursor, usually an arrow (0) FL_CURSOR_ARROW - an arrow pointer FL_CURSOR_CROSS - crosshair FL_CURSOR_WAIT - watch or hourglass FL_CURSOR_INSERT - I-beam FL_CURSOR_HAND - hand (uparrow on MSWindows) FL_CURSOR_HELP - question mark FL_CURSOR_MOVE - 4-pointed arrow FL_CURSOR_NS - up/down arrow FL_CURSOR_WE - left/right arrow FL_CURSOR_NWSE - diagonal arrow FL_CURSOR_NESW - diagonal arrow FL_CURSOR_NONE - invisible
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

138

FLTK Enumerations

14.11

FD When Conditions

FL_READ - Call the callback when there is data to be read. FL_WRITE - Call the callback when data can be written without blocking. FL_EXCEPT - Call the callback if an exception occurs on the le.

14.12

Damage Masks

The following damage mask bits are used by the standard FLTK widgets: FL_DAMAGE_CHILD - A child needs to be redrawn. FL_DAMAGE_EXPOSE - The window was exposed. FL_DAMAGE_SCROLL - The Fl_Scroll widget was scrolled. FL_DAMAGE_OVERLAY - The overlay planes need to be redrawn. FL_DAMAGE_USER1 - First user-dened damage bit. FL_DAMAGE_USER2 - Second user-dened damage bit. FL_DAMAGE_ALL - Everything needs to be redrawn.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 15

GLUT Compatibility
This appendix describes the GLUT compatibility header le supplied with FLTK. FLTKs GLUT compatibility is based on the original GLUT 3.7 and the follow-on FreeGLUT 2.4.0 libraries.

15.1

Using the GLUT Compatibility Header File

You should be able to compile existing GLUT source code by including <FL/glut.H> instead of <GL/glut.h>. This can be done by editing the source, by changing the -I switches to the compiler, or by providing a symbolic link from GL/glut.h to FL/glut.H. All les calling GLUT procedures must be compiled with C++. You may have to alter them slightly to get them to compile without warnings, and you may have to rename them to get make to use the C++ compiler. You must link with the FLTK library. Most of FL/glut.H is inline functions. You should take a look at it (and maybe at test/glpuzzle.cxx in the FLTK source) if you are having trouble porting your GLUT program. This has been tested with most of the demo programs that come with the GLUT and FreeGLUT distributions.

15.2

Known Problems

The following functions and/or arguments to functions are missing, and you will have to replace them or comment them out for your code to compile: glutGet(GLUT_ELAPSED_TIME) glutGet(GLUT_SCREEN_HEIGHT_MM) glutGet(GLUT_SCREEN_WIDTH_MM) glutGet(GLUT_WINDOW_NUM_CHILDREN) glutInitDisplayMode(GLUT_LUMINANCE) glutLayerGet(GLUT_HAS_OVERLAY)

140 glutLayerGet(GLUT_LAYER_IN_USE) glutPushWindow() glutSetColor(), glutGetColor(), glutCopyColormap() glutVideoResize() missing. glutWarpPointer() glutWindowStatusFunc() Spaceball, buttonbox, dials, and tablet functions

GLUT Compatibility

Most of the symbols/enumerations have different values than GLUT uses. This will break code that relies on the actual values. The only symbols guaranteed to have the same values are true/false pairs like GLUT_DOWN and GLUT_UP, mouse buttons GLUT_LEFT_BUTTON, GLUT_MIDDLE_BUTTON, GLUT_RIGHT_BUTTON, and GLUT_KEY_F1 thru GLUT_KEY_F12. The strings passed as menu labels are not copied. glutPostRedisplay() does not work if called from inside a display function. You must use glutIdleFunc() if you want your display to update continuously. glutSwapBuffers() does not work from inside a display function. This is on purpose, because FLTK swaps the buffers for you. glutUseLayer() does not work well, and should only be used to initialize transformations inside a resize callback. You should redraw overlays by using glutOverlayDisplayFunc(). Overlays are cleared before the overlay display function is called. glutLayerGet(GLUT_OVERLAY_DAMAGED) always returns true for compatibility with some GLUT overlay programs. You must rewrite your code so that gl_color() is used to choose colors in an overlay, or you will get random overlay colors. glutSetCursor(GLUT_CURSOR_FULL_CROSSHAIR) just results in a small crosshair. The fonts used by glutBitmapCharacter() and glutBitmapWidth() may be different. glutInit(argc,argv) will consume different switches than GLUT does. It accepts the switches recognized by Fl::args(), and will accept any abbreviation of these switches (such as "-di" for "-display").

15.3

Mixing GLUT and FLTK Code

You can make your GLUT window a child of a Fl_Window with the following scheme. The biggest trick is that GLUT insists on a call to show() the window at the point it is created, which means the Fl_Window parent window must already be shown. Dont call glutInit(). Create your Fl_Window, and any FLTK widgets. Leave a blank area in the window for your GLUT window. show() the Fl_Window. Perhaps call show(argc,argv). Call window->begin() so that the GLUT window will be automatically added to it. Use glutInitWindowSize() and glutInitWindowPosition() to set the location in the parent window to put the GLUT window.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

15.4 class Fl_Glut_Window

141

Put your GLUT code next. It probably does not need many changes. Call window->end() immediately after the glutCreateWindow()!

You can call either glutMainLoop(), Fl::run(), or loop calling Fl::wait() to run the program.

15.4
15.4.1

class Fl Glut Window


Class Hierarchy

Fl_Gl_Window | +----Fl_Glut_Window

15.4.2

Include Files

#include <FL/glut.H>

15.4.3

Description

Each GLUT window is an instance of this class. You may nd it useful to manipulate instances directly rather than use GLUT window ids. These may be created without opening the display, and thus can t better into FLTKs method of creating windows. The current GLUT window is available in the global variable glut_window. new Fl_Glut_Window(...) is the same as glutCreateWindow() except it does not show() the window or make the window current. window->make_current() is the same as glutSetWindow(number). If the window has not had show() called on it yet, some functions that assumme an OpenGL context will not work. If you do show() the window, call make_current() again to set the context. Fl_Glut_Window() is the same as glutDestroyWindow().

15.4.4

Members

The Fl_Glut_Window class contains several public members that can be altered directly:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

142 member display entry keyboard menu[3] mouse motion overlaydisplay passivemotion reshape special visibility

GLUT Compatibility description A pointer to the function to call to draw the normal planes. A pointer to the function to call when the mouse moves into or out of the window. A pointer to the function to call when a regular key is pressed. The menu to post when one of the mouse buttons is pressed. A pointer to the function to call when a button is pressed or released. A pointer to the function to call when the mouse is moved with a button down. A pointer to the function to call to draw the overlay planes. A pointer to the function to call when the mouse is moved with no buttons down. A pointer to the function to call when the window is resized. A pointer to the function to call when a special key is pressed. A pointer to the function to call when the window is iconied or restored (made visible.)

15.4.5

Methods

Fl_Glut_Window::Fl_Glut_Window(int x, int y, int w, int h, const char title = 0) Fl_Glut_Window::Fl_Glut_Window(int w, int h, const char title = 0)

The rst constructor takes 4 int arguments to create the window with a preset position and size. The second constructor with 2 arguments will create the window with a preset size, but the window manager will choose the position according to its own whims. virtual Fl_Glut_Window::Fl_Glut_Window()

Destroys the GLUT window. void Fl_Glut_Window::make_current()

Switches all drawing functions to the GLUT window.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 16

Forms Compatibility
This appendix describes the Forms compatibility included with FLTK. Warning: The Forms compatility is deprecated and no longer maintained in FLTK1, and is likely to be removed completely after the next ofcial release.

16.1

Importing Forms Layout Files

FLUID can read the .fd les put out by all versions of Forms and XForms fdesign. However, it will mangle them a bit, but it prints a warning message about anything it does not understand. FLUID cannot write fdesign les, so you should save to a new name so you dont write over the old one. You will need to edit your main code considerably to get it to link with the output from FLUID. If you are not interested in this you may have more immediate luck with the forms compatibility header, <FL/forms.H>.

16.2

Using the Compatibility Header File

You should be able to compile existing Forms or XForms source code by changing the include directory switch to your compiler so that the forms.h le supplied with FLTK is included. The forms.h le simply pulls in <FL/forms.H> so you dont need to change your source code. Take a look at <FL/forms.H> to see how it works, but the basic trick is lots of inline functions. Most of the XForms demo programs work without changes. You will also have to compile your Forms or XForms program using a C++ compiler. The FLTK library does not provide C bindings or header les. Although FLTK was designed to be compatible with the GL Forms library (version 0.3 or so), XForms has bloated severely and its interface is X-specic. Therefore, XForms compatibility is no longer a goal of FLTK. Compatibility was limited to things that were free, or that would add code that would not be linked in if the feature is unused, or that was not X-specic. To use any new features of FLTK, you should rewrite your code to not use the inline functions and instead use "pure" FLTK. This will make it a lot cleaner and make it easier to gure out how to call the FLTK functions. Unfortunately this conversion is harder than expected and even Digital Domains inhouse code still uses forms.H a lot.

144

Forms Compatibility

16.3

Problems You Will Encounter

Many parts of XForms use X-specic structures like XEvent in their interface. I did not emulate these! Unfortunately these features (such as the "canvas" widget) are needed by most large programs. You will need to rewrite these to use FLTK subclasses. Fl_Free widgets emulate the old Forms "free" widget. It may be useful for porting programs that change the handle() function on widgets, but you will still need to rewrite things. Fl_Timer widgets are provided to emulate the XForms timer. These work, but are quite inefcient and inaccurate compared to using Fl::add_timeout(). All instance variables are hidden. If you directly refer to the x, y, w, h, label, or other elds of your Forms widgets you will have to add empty parenthesis after each reference. The easiest way to do this is to globally replace "->x" with "->x()", etc. Replace "boxtype" with "box()". const char arguments to most FLTK methods are simply stored, while Forms would strdup() the passed string. This is most noticable with the label of widgets. Your program must always pass static data such as a string constant or mallocd buffer to label(). If you are using labels to display program output you may want to try the Fl_Output widget. The default fonts and sizes are matched to the older GL version of Forms, so all labels will draw somewhat larger than an XForms program does. fdesign outputs a setting of a "fdui" instance variable to the main window. I did not emulate this because I wanted all instance variables to be hidden. You can store the same information in the user_data() eld of a window. To do this, search through the fdesign output for all occurances of "->fdui" and edit to use "->user_data()" instead. This will require casts and is not trivial. The prototype for the functions passed to fl_add_timeout() and fl_set_idle_callback() callback are different. All the following XForms calls are missing: FL_REVISION, fl_library_version() FL_RETURN_DBLCLICK (use Fl::event_clicks()) fl_add_signal_callback() fl_set_form_atactivate() fl_set_form_atdeactivate() fl_set_form_property() fl_set_app_mainform(), fl_get_app_mainform() fl_set_form_minsize(), fl_set_form_maxsize() fl_set_form_event_cmask(), fl_get_form_event_cmask() fl_set_form_dblbuffer(), fl_set_object_dblbuffer() (use an Fl_Double_Window instead) fl_adjust_form_size() fl_register_raw_callback() fl_set_object_bw(), fl_set_border_width() fl_set_object_resize(), fl_set_object_gravity() fl_set_object_shortcutkey()
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

16.3 Problems You Will Encounter fl_set_object_automatic() fl_get_object_bbox() (maybe FLTK should do this) fl_set_object_prehandler(), fl_set_object_posthandler() fl_enumerate_fonts() Most drawing functions fl_set_coordunit() (FLTK uses pixels all the time) fl_ringbell() fl_gettime() fl_win() (all these functions) fl_initialize(argc,argv,x,y,z) ignores last 3 arguments fl_read_bitmapfile(), fl_read_pixmapfile() fl_addto_browser_chars() FL_MENU_BUTTON just draws normally fl_set_bitmapbutton_file(), fl_set_pixmapbutton_file() FL_CANVAS objects FL_DIGITAL_CLOCK (comes out analog) fl_create_bitmap_cursor(), fl_set_cursor_color() fl_set_dial_angles() fl_show_oneliner() fl_set_choice_shortcut(a,b,c) command log Only some of le selector is emulated FL_DATE_INPUT fl_pup() (all these functions) textbox object (should be easy but I had no sample programs) xyplot object
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

145

146

Forms Compatibility

16.4

Additional Notes

These notes were written for porting programs written with the older IRISGL version of Forms. Most of these problems are the same ones encountered when going from old Forms to XForms: Does Not Run In Background

The IRISGL library always forked when you created the rst window, unless "foreground()" was called. FLTK acts like "foreground()" is called all the time. If you really want the fork behavior do "if (fork()) exit(0)" right at the start of your program. You Cannot Use IRISGL Windows or queue

If a Forms (not XForms) program if you wanted your own window for displaying things you would create a IRISGL window and draw in it, periodically calling Forms to check if the user hit buttons on the panels. If the user did things to the IRISGL window, you would nd this out by having the value FL_EVENT returned from the call to Forms. None of this works with FLTK. Nor will it compile, the necessary calls are not in the interface. You have to make a subclass of Fl_Gl_Window and write a draw() method and handle() method. This may require anywhere from a trivial to a major rewrite. If you draw into the overlay planes you will have to also write a draw_overlay() method and call redraw_overlay() on the OpenGL window. One easy way to hack your program so it works is to make the draw() and handle() methods on your window set some static variables, storing what event happened. Then in the main loop of your program, call Fl::wait() and then check these variables, acting on them as though they are events read from fl_queue. You Must Use OpenGL to Draw Everything

The le <FL/gl.h> denes replacements for a lot of IRISGL calls, translating them to OpenGL. There are much better translators available that you might want to investigate. You Cannot Make Forms Subclasses

Programs that call fl_make_object or directly setting the handle routine will not compile. You have to rewrite them to use a subclass of Fl_Widget. It is important to note that the handle() method is not exactly the same as the handle() function of Forms. Where a Forms handle() returned non-zero, your handle() must call do_callback(). And your handle() must return non-zero if it "understood" the event. An attempt has been made to emulate the "free" widget. This appears to work quite well. It may be quicker to modify your subclass into a "free" widget, since the "handle" functions match. If your subclass draws into the overlay you are in trouble and will have to rewrite things a lot.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

16.4 Additional Notes You Cannot Use <device.h>

147

If you have written your own "free" widgets you will probably get a lot of errors about "getvaluator". You should substitute: Forms MOUSE_X MOUSE_Y LEFTSHIFTKEY,RIGHTSHIFTKEY CAPSLOCKKEY LEFTCTRLKEY,RIGHTCTRLKEY LEFTALTKEY,RIGHTALTKEY MOUSE1,RIGHTMOUSE MOUSE2,MIDDLEMOUSE MOUSE3,LEFTMOUSE FLTK Fl::event_x_root() Fl::event_y_root() Fl::event_shift() Fl::event_capslock() Fl::event_ctrl() Fl::event_alt() Fl::event_state() Fl::event_state() Fl::event_state()

Anything else in getvaluator and you are on your own... Font Numbers Are Different

The "style" numbers have been changed because I wanted to insert bold-italic versions of the normal fonts. If you use Times, Courier, or Bookman to display any text you will get a different font out of FLTK. If you are really desperate to x this use the following code:
fl_font_name(3,"*courier-medium-r-no*"); fl_font_name(4,"*courier-bold-r-no*"); fl_font_name(5,"*courier-medium-o-no*"); fl_font_name(6,"*times-medium-r-no*"); fl_font_name(7,"*times-bold-r-no*"); fl_font_name(8,"*times-medium-i-no*"); fl_font_name(9,"*bookman-light-r-no*"); fl_font_name(10,"*bookman-demi-r-no*"); fl_font_name(11,"*bookman-light-i-no*");

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

148

Forms Compatibility

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 17

Operating System Issues


This appendix describes the operating system specic interfaces in FLTK: Accessing the OS Interfaces The UNIX (X11) Interface The Windows (WIN32) Interface The Apple OS X Interface

17.1

Accessing the OS Interfaces

All programs that need to access the operating system specic interfaces must include the following header file:
#include <FL/x.H>

Despite the name, this header le will dene the appropriate interface for your environment. The pages that follow describe the functionality that is provided for each operating system. WARNING: The interfaces provided by this header le may change radically in new FLTK releases. Use them only when an existing generic FLTK interface is not sufcient.

17.2

The UNIX (X11) Interface

The UNIX interface provides access to the X Window System state information and data structures.

17.2.1

Handling Other X Events

void Fl::add_handler(int (f)(int))

150

Operating System Issues

Installs a function to parse unrecognized events. If FLTK cannot gure out what to do with an event, it calls each of these functions (most recent rst) until one of them returns non-zero. If none of them returns non-zero then the event is ignored.

FLTK calls this for any X events it does not recognize, or X events with a window ID that FLTK does not recognize. You can look at the X event in the fl_xevent variable.

The argument is the FLTK event type that was not handled, or zero for unrecognized X events. These handlers are also called for global shortcuts and some other events that the widget they were passed to did not handle, for example FL_SHORTCUT. extern XEvent _xevent

This variable contains the most recent X event. extern ulong _event_time

This variable contains the time stamp from the most recent X event that reported it; not all events do. Many X calls like cut and paste need this value. Window _xid(const Fl_Window )

Returns the XID for a window, or zero if not shown(). Fl_Window _nd(ulong xid)

Returns the Fl_Window that corresponds to the given XID, or NULL if not found. This function uses a cache so it is slightly faster than iterating through the windows yourself. int _handle(const XEvent &)

This call allows you to supply the X events to FLTK, which may allow FLTK to cooperate with another toolkit or library. The return value is non-zero if FLTK understood the event. If the window does not belong to FLTK and the add_handler() functions all return 0, this function will return false.

Besides feeding events your code should call Fl::ush() periodically so that FLTK redraws its windows.

This function will call the callback functions. It will not return until they complete. In particular, if a callback pops up a modal window by calling _ask(), for instance, it will not return until the modal function returns.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

17.2 The UNIX (X11) Interface

151

17.2.2

Drawing using Xlib

The following global variables are set before Fl_Widget::draw() is called, or by Fl_Window::make_current():
extern extern extern extern extern extern Display *fl_display; Window fl_window; GC fl_gc; int fl_screen; XVisualInfo *fl_visual; Colormap fl_colormap;

You must use them to produce Xlib calls. Dont attempt to change them. A typical X drawing call is written like this:
XDrawSomething(fl_display, fl_window, fl_gc, ...);

Other information such as the position or size of the X window can be found by looking at Fl_Window::current(), which returns a pointer to the Fl_Window being drawn. unsigned long _xpixel(Fl_Color i) unsigned long _xpixel(uchar r, uchar g, uchar b)

Returns the X pixel number used to draw the given FLTK color index or RGB color. This is the X pixel that _color() would use. int _parse_color(const char p, uchar& r, uchar& g, uchar& b)

Convert a name into the red, green, and blue values of a color by parsing the X11 color names. On other systems, fl_parse_color() can only convert names in hexadecimal encoding, for example #ff8083. extern XFontStruct _xfont Points to the font selected by the most recent _font(). This is not necessarily the current font of fl_gc, which is not set until _draw() is called. If FLTK was compiled with Xft support, fl_xfont will usually be 0 and fl_xftfont will contain a pointer to the XftFont structure instead. extern void _xftfont If FLTK was compiled with Xft support enabled, fl_xftfont points to the xft font selected by the most recent _font(). Otherwise it will be 0. fl_xftfont should be cast to XftFont.

17.2.3

Changing the Display, Screen, or X Visual

FLTK uses only a single display, screen, X visual, and X colormap. This greatly simplies its internal structure and makes it much smaller and faster. You can change which it uses by setting global variables before the rst Fl_Window::show() is called. You may also want to call Fl::visual(), which is a portable interface to get a full color and/or double buffered visual. int Fl::display(const char )
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

152

Operating System Issues

Set which X display to use. This actually does putenv("DISPLAY=...") so that child programs will display on the same screen if called with exec(). This must be done before the display is opened. This call is provided under MacOS and WIN32 but it has no effect. extern Display _display

The open X display. This is needed as an argument to most Xlib calls. Dont attempt to change it! This is NULL before the display is opened. void _open_display()

Opens the display. Does nothing if it is already open. This will make sure fl_display is non-zero. You should call this if you wish to do X calls and there is a chance that your code will be called before the rst show() of a window.

This may call Fl::abort() if there is an error opening the display. void _close_display()

This closes the X connection. You do not need to call this to exit, and in fact it is faster to not do so! It may be useful to call this if you want your program to continue without the X connection. You cannot open the display again, and probably cannot call any FLTK functions. extern int _screen

Which screen number to use. This is set by fl_open_display() to the default screen. You can change it by setting this to a different value immediately afterwards. It can also be set by changing the last number in the Fl::display() string to "host:0.#". extern XVisualInfo _visual extern Colormap _colormap

The visual and colormap that FLTK will use for all windows. These are set by fl_open_display() to the default visual and colormap. You can change them before calling show() on the rst window. Typical code for changing the default visual is:
Fl::args(argc, argv); // do this first so $DISPLAY is set fl_open_display(); fl_visual = find_a_good_visual(fl_display, fl_screen); if (!fl_visual) Fl::abort("No good visual"); fl_colormap = make_a_colormap(fl_display, fl_visual->visual, fl_visual->depth); // it is now ok to show() windows: window->show(argc, argv);

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

17.2 The UNIX (X11) Interface

153

17.2.4

Using a Subclass of Fl Window for Special X Stuff

FLTK can manage an X window on a different screen, visual and/or colormap, you just cant use FLTKs drawing routines to draw into it. But you can write your own draw() method that uses Xlib (and/or OpenGL) calls only. FLTK can also manage XIDs provided by other libraries or programs, and call those libraries when the window needs to be redrawn. To do this, you need to make a subclass of Fl_Window and override some of these virtual functions: virtual void Fl_Window::show()

If the window is already shown() this must cause it to be raised, this can usually be done by calling Fl_Window::show(). If not shown() your implementation must call either Fl_X::set_xid() or Fl_X::make_xid().

An example:
void MyWindow::show() { if (shown()) {Fl_Window::show(); return;} // you must do this! fl_open_display(); // necessary if this is first window // we only calculate the necessary visual colormap once: static XVisualInfo *visual; static Colormap colormap; if (!visual) { visual = figure_out_visual(); colormap = XCreateColormap(fl_display, RootWindow(fl_display,fl_screen), vis->visual, AllocNone); } Fl_X::make_xid(this, visual, colormap); } Fl_X *Fl_X::set_xid(Fl_Window*, Window xid)

Allocate a hidden class called an Fl_X, put the XID into it, and set a pointer to it from the Fl_Window. This causes Fl_Window::shown() to return true. void Fl_X::make_xid(Fl_Window, XVisualInfo = _visual, Colormap = _colormap)

This static method does the most onerous parts of creating an X window, including setting the label, resize limitations, etc. It then does Fl_X::set_xid() with this new window and maps the window. virtual void Fl_Window::ush()

This virtual function is called by Fl::ush() to update the window. For FLTKs own windows it does this by setting the global variables fl_window and fl_gc and then calling the draw() method. For your own windows you might just want to put all the drawing code in here.

The X region that is a combination of all damage() calls done so far is in Fl_X::i(this)->region. If NULL then you should redraw the entire window. The undocumented function fl_clip_region(XRegion) will initialize the FLTK clip stack with a region or NULL for no clipping. You must set region to NULL afterwards as fl_clip_region() will own and delete it when done.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

154

Operating System Issues

If damage() & FL_DAMAGE_EXPOSE then only X expose events have happened. This may be useful if you have an undamaged image (such as a backing buffer) around.

Here is a sample where an undamaged image is kept somewhere:


void MyWindow::flush() { fl_clip_region(Fl_X::i(this)->region); Fl_X::i(this)->region = 0; if (damage() != 2) {... draw things into backing store ...} ... copy backing store to window ... }

virtual void Fl_Window::hide()

Destroy the window server copy of the window. Usually you will destroy contexts, pixmaps, or other resources used by the window, and then call Fl_Window::hide() to get rid of the main window identied by xid(). If you override this, you must also override the destructor as shown:
void MyWindow::hide() { if (mypixmap) { XFreePixmap(fl_display,mypixmap); mypixmap = 0; } Fl_Window::hide(); // you must call this }

virtual void Fl_Window::Fl_Window()

Because of the way C++ works, if you override hide() you must override the destructor as well (otherwise only the base class hide() is called):
MyWindow::~MyWindow() { hide(); }

Note Access to the Fl_X hidden class requires to #dene FL_INTERNALS before compilation.

17.2.5

Setting the Icon of a Window

FLTK currently supports setting a windows icon before it is shown using the Fl_Window::icon() method. void Fl_Window::icon(const void )

Sets the icon for the window to the passed pointer. You will need to cast the icon Pixmap to a char when calling this method. To set a monochrome icon using a bitmap compiled with your application use:
#include "icon.xbm" fl_open_display(); // needed if display has not been previously opened Pixmap p = XCreateBitmapFromData(fl_display, DefaultRootWindow(fl_display), icon_bits, icon_width, icon_height); window->icon((const void*)p);
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

17.3 The Windows (WIN32) Interface

155

To use a multi-colored icon, the XPM format and library should be used as follows:
#include <X11/xpm.h> #include "icon.xpm" fl_open_display(); opened Pixmap p, mask; XpmCreatePixmapFromData(fl_display, DefaultRootWindow(fl_display), icon_xpm, &p, &mask, NULL); window->icon((const void *)p); // needed if display has not been previously

When using the Xpm library, be sure to include it in the list of libraries that are used to link the application (usually "-lXpm"). NOTE: You must call Fl_Window::show(int argc, char argv) for the icon to be used. The Fl_Window::show() method does not bind the icon to the window.

17.2.6

X Resources

When the Fl_Window::show(int argc, char argv) method is called, FLTK looks for the following X resources: background - The default background color for widgets (color). dndTextOps - The default setting for drag and drop text operations (boolean). foreground - The default foreground (label) color for widgets (color). scheme - The default scheme to use (string). selectBackground - The default selection color for menus, etc. (color). Text.background - The default background color for text elds (color). tooltips - The default setting for tooltips (boolean). visibleFocus - The default setting for visible keyboard focus on non-text widgets (boolean). Resources associated with the rst windows Fl_Window::xclass() string are queried rst, or if no class has been specied then the class "tk" is used (e.g. fltk.background). If no match is found, a global search is done (e.g. background).

17.3

The Windows (WIN32) Interface

The Windows interface provides access to the WIN32 GDI state information and data structures.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

156

Operating System Issues

17.3.1

Handling Other WIN32 Messages

By default a single WNDCLASSEX called "FLTK" is created. All Fl_Window s are of this class unless you use Fl_Window::xclass(). The window class is created the rst time Fl_Window::show() is called. You can probably combine FLTK with other libraries that make their own WIN32 window classes. The easiest way is to call Fl::wait(), as it will call DispatchMessage() for all messages to the other windows. If necessary you can let the other library take over as long as it calls DispatchMessage(), but you will have to arrange for the function Fl::ush() to be called regularly so that widgets are updated, timeouts are handled, and the idle functions are called. extern MSG _msg This variable contains the most recent message read by GetMessage(), which is called by Fl::wait(). This may not be the most recent message sent to an FLTK window, because silly WIN32 calls the handle procedures directly for some events (sigh). void Fl::add_handler(int (f)(int)) Installs a function to parse unrecognized messages sent to FLTK windows. If FLTK cannot gure out what to do with a message, it calls each of these functions (most recent rst) until one of them returns non-zero. The argument passed to the functions is the FLTK event that was not handled or zero for unknown messages. If all the handlers return zero then FLTK calls DefWindowProc(). HWND _xid(const Fl_Window ) Returns the window handle for a Fl_Window, or zero if not shown(). Fl_Window _nd(HWND xid) Returns the Fl_Window that corresponds to the given window handle, or NULL if not found. This function uses a cache so it is slightly faster than iterating through the windows yourself.

17.3.2

Drawing Things Using the WIN32 GDI

When the virtual function Fl_Widget::draw() is called, FLTK stores all the extra arguments you need to make a proper GDI call in some global variables:
extern HINSTANCE fl_display; extern HWND fl_window; extern HDC fl_gc; COLORREF fl_RGB(); HPEN fl_pen(); HBRUSH fl_brush();

These global variables are set before Fl_Widget::draw() is called, or by Fl_Window::make_current(). You can refer to them when needed to produce GDI calls, but dont attempt to change them. The functions return GDI objects for the current color set by _color() and are created as needed and cached. A typical GDI drawing call is written like this:
DrawSomething(fl_gc, ..., fl_brush());

It may also be useful to refer to Fl_Window::current() to get the windows size or position.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

17.3 The Windows (WIN32) Interface

157

17.3.3

Setting the Icon of a Window

FLTK currently supports setting a windows icon before it is shown using the Fl_Window::icon() method. void Fl_Window::icon(const void )

Sets the icon for the window to the passed pointer. You will need to cast the HICON handle to a char when calling this method. To set the icon using an icon resource compiled with your application use:
window->icon((const void *)LoadIcon(fl_display, MAKEINTRESOURCE(IDI_ICON)));

You can also use the LoadImage() and related functions to load specic resolutions or create the icon from bitmap data. NOTE: You must call Fl_Window::show(int argc, char argv) for the icon to be used. The Fl_Window::show() method does not bind the icon to the window.

17.3.4

How to Not Get a MSDOS Console Window

WIN32 has a really stupid mode switch stored in the executables that controls whether or not to make a console window. To always get a console window you simply create a console application (the "/SUBSYSTEM:CONSOLE" option for the linker). For a GUI-only application create a WIN32 application (the "/SUBSYSTEM:WINDOWS" option for the linker). FLTK includes a WinMain() function that calls the ANSI standard main() entry point for you. This function creates a console window when you use the debug version of the library. WIN32 applications without a console cannot write to stdout or stderr, even if they are run from a console window. Any output is silently thrown away. Additionally, WIN32 applications are run in the background by the console, although you can use "start /wait program" to run them in the foreground.

17.3.5

Known WIN32 Bugs and Problems

The following is a list of known bugs and problems in the WIN32 version of FLTK: If a program is deactivated, Fl::wait() does not return until it is activated again, even though many events are delivered to the program. This can cause idle background processes to stop unexpectedly. This also happens while the user is dragging or resizing windows or otherwise holding the mouse down. We were forced to remove most of the efciency FLTK uses for redrawing in order to get windows to update while being moved. This is a design error in WIN32 and probably impossible to get around. Fl_Gl_Window::can_do_overlay() returns true until the rst time it attempts to draw an overlay, and then correctly returns whether or not there is overlay hardware. SetCapture (used by Fl::grab()) doesnt work, and the main window title bar turns gray while menus are popped up.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

158

Operating System Issues Compilation with gcc 3.4.4 and -Os exposes an optimisation bug in gcc. The symptom is that when drawing lled circles only the perimeter is drawn. This can for instance be seen in the symbols demo. Other optimisation options such as -O2 and -O3 seem to work OK. More details can be found in STR#1656

17.4

The Apple OS X Interface

FLTK supports Apple OS X using the Apple Cocoa library. Older versions of MacOS are no longer supported. Control, Option, and Command Modier Keys

FLTK maps the Mac control key to FL_CTRL, the option key to FL_ALT and the Apple key to FL_META. Furthermore, FL_COMMAND designates the Apple key on Mac OS X and the control key on other platforms. Keyboard events return the key name in Fl::event_key() and the keystroke translation in Fl::event_text(). For example, typing Option-Y on a Mac US keyboard will set FL_ALT in Fl::event_state(), set Fl::event_key() to y and return the Yen symbol in Fl::event_text(). Apple "Quit" Event

When the user presses Cmd-Q or requests a termination of the application, OS X will send a "Quit" Apple Event. FLTK handles this event by sending an FL_CLOSE event to all open windows. If all windows close, the application will terminate. Apple "Open" Event

Whenever the user drops a le onto an application icon, OS X generates an Apple Event of the type "Open". You can have FLTK notify you of an Open event by calling the _open_callback function. void _open_display()

Opens the display. Does nothing if it is already open. You should call this if you wish to do Cocoa or Quartz calls and there is a chance that your code will be called before the rst show() of a window. Window _xid(const Fl_Window )

Returns the window reference for an Fl_Window, or NULL if the window has not been shown. This reference is a pointer to an instance of the subclass FLWindow of Cocoas NSWindow class. Fl_Window _nd(Window xid)

Returns the Fl_Window that corresponds to the given window reference, or NULL if not found. FLTK windows that are children of top-level windows share the Window of the top-level window. void _mac_set_about( Fl_Callback cb, void user_data, int shortcut)
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

17.4 The Apple OS X Interface

159

Attaches the callback cb to the "About myprog" item of the system application menu. cb will be called with NULL rst argument and user_data second argument. Fl_Mac_App_Menu class The Fl_Mac_App_Menu class allows to localize the application menu. Fl_Sys_Menu_Bar class The Fl_Sys_Menu_Bar class allows to build menu bars that, on Mac OS X, are placed in the system menu bar (at top-left of display), and, on other platforms, at a user-chosen location of a user-chosen window.

17.4.1

Drawing Things Using Quartz

All code inside Fl_Widget::draw() is expected to call Quartz drawing functions. The Quartz coordinate system is ipped to match FLTKs coordinate system. The origin for all drawing is in the top left corner of the enclosing Fl_Window. The global variable fl_gc is the appropriate Quartz 2D drawing environment. Include FL/x.H to declare the fl_gc variable. Fl_Double_Window OS X double-buffers all windows automatically. On OS X, Fl_Window and Fl_Double_Window are handled internally in the same way.

17.4.2

Mac File System Specics

Resource Forks

FLTK does not access the resource fork of an application. However, a minimal resource fork must be created for OS X applications. Starting with OS X 10.6, resource forks are no longer needed. Caution (OS X 10.2 and older): When using UNIX commands to copy or move executables, OS X will NOT copy any resource forks! For copying and moving use CpMac and MvMac respectively. For creating a tar archive, all executables need to be stripped from their Resource Fork before packing, e.g. "DeRez uid > uid.r". After unpacking the Resource Fork needs to be reattached, e.g. "Rez uid.r -o uid". It is advisable to use the Finder for moving and copying and Mac archiving tools like Sit for distribution as they will handle the Resource Fork correctly. Mac File Paths

FLTK uses UTF-8-encoded UNIX-style lenames and paths. See also Mac OS X-specic symbols

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

160

Operating System Issues

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 18

Migrating Code from FLTK 1.0 to 1.1


This appendix describes the differences between the FLTK 1.0.x and FLTK 1.1.x functions and classes.

18.1

Color Values

Color values are now stored in a 32-bit unsigned integer instead of the unsigned character in 1.0.x. This allows for the specication of 24-bit RGB values or 8-bit FLTK color indices. FL_BLACK and FL_WHITE now remain black and white, even if the base color of the gray ramp is changed using Fl::background(). FL_DARK3 and FL_LIGHT3 can be used instead to draw a very dark or a very bright background hue. Widgets use the new color symbols FL_FORGROUND_COLOR, FL_BACKGROUND_COLOR, FL_BACKGROUND2_COLOR, FL_INACTIVE_COLOR, and FL_SELECTION_COLOR. More details can be found in the chapter FLTK Enumerations.

18.2

Cut and Paste Support

The FLTK clipboard is now broken into two parts - a local selection value and a cut-and-paste value. This allows FLTK to support things like highlighting and replacing text that was previously cut or copied, which makes FLTK applications behave like traditional GUI applications.

18.3

File Chooser

The le chooser in FLTK 1.1.x is signicantly different than the one supplied with FLTK 1.0.x. Any code that directly references the old FCB class or members will need to be ported to the new Fl_File_Chooser class.

18.4

Function Names

Some function names have changed from FLTK 1.0.x to 1.1.x in order to avoid name space collisions. You can still use the old function names by dening the FLTK_1_0_COMPAT symbol on the command-line when you compile (-DFLTK_1_0_COMPAT) or in your source, e.g.:

162
#define FLTK_1_0_COMPAT #include <FL/Fl.H> #include <FL/Enumerations.H> #include <FL/filename.H>

Migrating Code from FLTK 1.0 to 1.1

The following table shows the old and new function names: Old 1.0.x Name contrast() down() lename_absolute() lename_expand() lename_ext() lename_isdir() lename_list() lename_match() lename_name() lename_relative() lename_setext() frame() inactive() numericsort() New 1.1.x Name _contrast() _down() _lename_absolute() _lename_expand() _lename_ext() _lename_isdir() _lename_list() _lename_match() _lename_name() _lename_relative() _lename_setext() _frame() _inactive() _numericsort()

18.5

Image Support

Image support in FLTK has been signicantly revamped in 1.1.x. The Fl_Image class is now a proper base class, with the core image drawing functionality in the Fl_Bitmap, Fl_Pixmap, and Fl_RGB_Image classes. BMP, GIF, JPEG, PNG, XBM, and XPM image les can now be loaded using the appropriate image classes, and the Fl_Shared_Image class can be used to cache images in memory. Image labels are no longer provided as an add-on label type. If you use the old label() methods on an image, the widgets image() method is called to set the image as the label. Image labels in menu items must still use the old labeltype mechanism to preserve source compatibility.

18.6

Keyboard Navigation

FLTK 1.1.x now supports keyboard navigation and control with all widgets. To restore the old FLTK 1.0.x behavior so that only text widgets get keyboard focus, call the Fl::visible_focus() method to disable it:
Fl::visible_focus(0);

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 19

Migrating Code from FLTK 1.1 to 1.3


This appendix describes the differences between the FLTK 1.1.x and FLTK 1.3.x functions and classes.

19.1

Migrating From FLTK 1.0

If you want to migrate your code from FLTK 1.0 to FLTK 1.3, then you should rst consult Appendix Migrating Code from FLTK 1.0 to 1.1.

19.2

Fl Scroll Widget

Fl_Scroll::scroll_to(int x, int y) replaces Fl_Scroll::position(int x, int y). This change was needed because Fl_Scroll::position(int,int) redened Fl_Widget::position(int,int), but with a completely different function (moving the scrollbars instead of moving the widget). Please be aware that you need to change your applications code for all Fl_Scroll-derived widgets, if you used Fl_Scroll::position(int x, int y) to position the scrollbars (not the widget itself). The compiler will not detect any errors, because your calls to position(int x, int y) will be calling Fl_Widget::position(int x, int y).

19.3

Unicode (UTF-8)

FLTK 1.3 uses Unicode (UTF-8) encoding internally. If you are only using characters in the ASCII range (32-127), there is a high probability that you dont need to modify your code. However, if you use international characters (128-255), encoded as e.g. Windows codepage 1252, ISO-8859-1, ISO-8859-15 or any other encoding, then you will need to update your character string constants and widget input data accordingly. Please refer to the Unicode and UTF-8 Support chapter for more details.

164 Note

Migrating Code from FLTK 1.1 to 1.3

It is important that, although your software uses only ASCII characters for input to FLTK widgets, the user may enter non-ASCII characters, and FLTK will return these characters with UTF-8 encoding to your application, e.g. via Fl_Input::value(). You will need to re-encode them to your (non-UTF-8) encoding, otherwise you might see or print garbage in your data.

19.4

Widget Coordinate Representation

FLTK 1.3 changed all Widget coordinate variables and methods, e.g. Fl_Widget::x(), Fl_Widget::y(), Fl_Widget::w(), Fl_Widget::h(), from short (16-bit) to int (32-bit) representation. This should not affect any existing code, but makes it possible to use bigger scroll areas (e.g. Fl_Scroll widget).

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 20

Developer Information
This chapter describes FLTK development and documentation.

Example
/** \file Fl_Clock, Fl_Clock_Output widgets. */

/** \class Fl_Clock_Output \brief This widget can be used to display a program-supplied time. The time shown on the clock is not updated. To display the current time, use Fl_Clock instead. \image \image \image \image \image html clock.png latex clock.png "" width=10cm html round_clock.png latex clock.png "" width=10cm html round_clock.png "" width=10cm */

/** Returns the displayed time. Returns the time in seconds since the UNIX epoch (January 1, 1970). \see value(ulong) */ ulong value() const {return value_;} /** Set the displayed time. Set the time in seconds since the UNIX epoch (January 1, 1970). \param[in] v seconds since epoch \see value() */ void Fl_Clock_Output::value(ulong v) { [...] } /** Create an Fl_Clock widget using the given position, size, and label string. The default boxtype is \c FL_NO_BOX. \param[in] X, Y, W, H position and size of the widget \param[in] L widget label, default is no label */ Fl_Clock::Fl_Clock(int X, int Y, int W, int H, const char *L)

166
: Fl_Clock_Output(X, Y, W, H, L) {}

Developer Information

/** Create an Fl_Clock widget using the given boxtype, position, size, and label string. \param[in] t boxtype \param[in] X, Y, W, H position and size of the widget \param[in] L widget label, default is no label */ Fl_Clock::Fl_Clock(uchar t, int X, int Y, int W, int H, const char *L) : Fl_Clock_Output(X, Y, W, H, L) { type(t); box(t==FL_ROUND_CLOCK ? FL_NO_BOX : FL_UP_BOX); }

Note

From Duncan: (will be removed later, just for now as a reminder) Ive just added comments for the _color_chooser() functions, and in order to keep them and the general Function Reference information for them together, I created a new doxygen group, and used \ingroup in the three comment blocks. This creates a new Modules page (which may not be what we want) with links to it from the File Members and Fl_Color_Chooser.H pages. It needs a bit more experimentation on my part unless someone already knows how this should be handled. (Maybe we can add it to a functions.dox le that denes a functions group and do that for all of the function documentation?) Update: the trick is not to create duplicate entries in a new group, but to move the function information into the doxygen comments for the class, and use the navigation links provided. Simply using \relatesalso as the rst doxygen command in the functions comment puts it in the appropriate place. There is no need to have \defgroup and \ingroup as well, and indeed they dont work. So, to summarize:
Gizmo.H /** \class Gizmo A gizmo that does everything */ class Gizmo { etc }; extern int popup_gizmo(...); Gizmo.cxx: /** \relatesalso Gizmo Pops up a gizmo dialog with a Gizmo in it */ int popup_gizmo(...);

Comments Within Doxygen Comment Blocks: You can use HTML comment statements to embed comments in doxygen comment blocks. These comments will not be visible in the generated document.
The following text is a developer comment. <!-- *** This *** is *** invisible *** --> This will be visible again.

will be shown as: The following text is a developer comment. This will be visible again.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

20.1 Non-ASCII Characters Different Headlines:


<H1>Headline <H2>Headline <H3>Headline <H4>Headline in in in in big big big big text text text text (H1)</H1> (H2)</H2> (H3)</H3> (H4)</H4>

167

Headline in big text (H1)


Headline in big text (H2)
Headline in big text (H3) Headline in big text (H4)

20.1

Non-ASCII Characters

Doxygen understands many HTML quoting characters like &quot;, &uuml;, &ccedil;, &Ccedil;, but not all HTML quoting characters.

This will appear in the document: Doxygen understands many HTML quoting characters like ", , , , but not all HTML quoting characters. For further informations about HTML quoting characters see http://www.doxygen.org/htmlcmds.html Alternatively you can use UTF-8 encoding within Doxygen comments.

20.2

Document Structure

\page creates a named page \section creates a named section within that page \subsection creates a named subsection within the current section \subsubsection creates a named subsubsection within the current subsection All these statements take a "name" as their rst argument, and a title as their second argument. The title can contain spaces. The page, section, and subsection titles are formatted in blue color and a size like "<H1>", "<H2>", and "<H3>", and "<H4>", respectively. By FLTK documentation convention, a le like this one with a doxygen documentation chapter has the name "<chapter>.dox". The \page statement at the top of the page is "\page <chapter> This is the title". Sections within a documentation page must be called "<chapter>_<section>", where "<chapter>" is the name part of the le, and "<section>" is a unique section name within the page that can be referenced in links. The same for subsections and subsubsections. These doxygen page and section commands work only in special documentation chapters, not within normal source or header documentation blocks. However, links from normal (e.g. class) documentation to documentation sections do work. This page has
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

168
\page development I - Developer Information

Developer Information

at its top. This section is


\section development_structure Document structure

The following section is


\section development_links Creating Links

20.3

Creating Links

Links to other documents and external links can be embedded with doxygen \ref links to other doxygen \page, \section, \subsection and \anchor locations HTML links without markup - doxygen creates "http://..." links automatically standard, non-Doxygen, HTML links
see chapter \ref unicode creates a link to the named chapter unicode that has been created with a \page statement. For further informations about quoting see http://www.doxygen.org/htmlcmds.html see <a href="http://www.nedit.org/">Nedit</a> creates a standard HTML link

appears as: see chapter Unicode and UTF-8 Support creates a link to the named chapter unicode that has been created with a \page statement. For further informations about quoting see http://www.doxygen.org/htmlcmds.html see Nedit creates a standard HTML link

20.4

Paragraph Layout

There is no real need to use HTML <P> and </P> tags within the text to tell doxygen to start or stop a paragraph. In most cases, when doxygen encounters a blank line or some, but not all, \commands in the text it knows that it as reached the start or end of a paragraph. Doxygen also offers the \par command for special paragraph handling. It can be used to provide a paragraph title and also to indent a paragraph. Unfortunately \par wont do what you expect if you want to have doxygen links and sometimes html tags dont work either.
\par Normal Paragraph with title This paragraph will have a title, but because there is a blank line between the \par and the text, it will have the normal layout.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

20.5 Navigation Elements

169

\par Indented Paragraph with title This paragraph will also have a title, but because there is no blank line between the \par and the text, it will be indented. \par It is also possible to have an indented paragraph without title. This is how you indent subsequent paragraphs. \par No link to Fl_Widget::draw() Note that the paragraph title is treated as plain text. Doxygen type links will not work. HTML characters and tags may or may not work. Fl_Widget::draw() links and &quot;html&quot; tags work<br> \par Use a single line ending with <br> for complicated paragraph titles.

The above code produces the following paragraphs: Normal Paragraph with title

This paragraph will have a title, but because there is a blank line between the \par and the text, it will have the normal layout. Indented Paragraph with title This paragraph will also have a title, but because there is no blank line between the \par and the text, it will be indented.

It is also possible to have an indented paragraph without title. This is how you indent subsequent paragraphs. No link to Fl Widget::draw() Note that the paragraph title is treated as plain text. Doxygen type links will not work. HTML characters and tags may or may not work. Fl_Widget::draw() links and "html" tags work

Use a single line ending with <br> for complicated paragraph titles.

20.5

Navigation Elements

Each introduction (tutorial) page ends with navigation elements. These elements must only be included in the html documentation, therefore they must be separated with \htmlonly and \endhtmlonly. The following code gives the navigation bar at the bottom of this page:
\htmlonly <hr>
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

170
<table summary="navigation bar" width="100%" border="0"> <tr> <td width="45%" align="LEFT"> <a class="el" href="migration_1_3.html"> [Prev] Migrating Code from FLTK 1.1 to 1.3 </a> </td> <td width="10%" align="CENTER"> <a class="el" href="index.html">[Index]</a> </td> <td width="45%" align="RIGHT"> <a class="el" href="license.html"> Software License [Next] </a> </td> </tr> </table> \endhtmlonly

Developer Information

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 21

Software License
December 11, 2001

The FLTK library and included programs are provided under the terms of the GNU Library General Public License (LGPL) with the following exceptions: 1. Modications to the FLTK congure script, cong header le, and makeles by themselves to support a specic platform do not constitute a modied or derivative work. The authors do request that such modications be contributed to the FLTK project - send all contributions through the "Software Trouble Report" on the following page: http://www.fltk.org/str.php 2. Widgets that are subclassed from FLTK widgets do not constitute a derivative work. 3. Static linking of applications and widgets to the FLTK library does not constitute a derivative work and does not require the author to provide source code for the application or widget, use the shared FLTK libraries, or link their applications or widgets against a user-supplied version of FLTK. If you link the application or widget to a modied version of FLTK, then the changes to FLTK must be provided under the terms of the LGPL in sections 1, 2, and 4. 4. You do not have to provide a copy of the FLTK license with programs that are linked to the FLTK library, nor do you have to identify the FLTK license in your program or documentation as required by section 6 of the LGPL. However, programs must still identify their use of FLTK. The following example statement can be included in user documentation to satisfy this requirement: [program/widget] is based in part on the work of the FLTK project (http://www.fltk.org). GNU LIBRARY GENERAL PUBLIC LICENSE

Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

172

Software License

[This is the rst released version of the library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.] Preamble

The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link a program with the library, you must provide complete object les to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights. Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library. Also, for each distributors protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modied by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reect on the original authors reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyones free use or not licensed at all. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and dont assume that anything in it is the same as in the ordinary license. The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such. Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better. However, unrestricted linking of non-free programs would deprive the users of those programs of all benet from the free status of the libraries themselves. This Library General Public License is intended to permit
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

173 developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header les, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries. The precise terms and conditions for copying, distribution and modication follow. Pay close attention to the difference between a "work based on the libary" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library. Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modication".) "Source code" for a work means the preferred form of the work for making modications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface denition les, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modication are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Librarys complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modied work must itself be a software library. b) You must cause the les modied to carry prominent notices stating that you changed the les and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modied Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

174

Software License

make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-dened independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modied work as a whole. If identiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satises the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header le that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially signicant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely dened by law. If such an object le uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object le is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

175 of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modication of the work for the customers own use and reverse engineering for debugging such modications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modied executable containing the modied Library. (It is understood that the user who changes the contents of denitions les in the Library will not necessarily be able to recompile the application to use the modied denitions.) b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specied in Subsection 6a, above, for a charge no more than the cost of performing this distribution. c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specied materials from the same place. d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to nd the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

176

Software License

you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library species a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY

15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

177 THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

178

Software License

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 22

Example Source Code


The FLTK distribution contains over 60 sample applications written in, or ported to, FLTK. If the FLTK archive you received does not contain a test directory, you can download the complete FLTK distribution from http://fltk.org/software.php . Most of the example programs were created while testing a group of widgets. They are not meant to be great achievements in clean C++ programming, but merely a test platform to verify the functionality of the FLTK library. Note that extra example programs are also available in an additional examples directory, but these are NOT built automatically when you build FLTK, unlike those in the test directory shown below.

22.1

Example Applications
arc button cube editor fractals iconize label minimum pixmap shape tile ask buttons CubeView fast_slow fullscreen image line_style navigation preferences subwindow tiled_image bitmap checkers cursor le_chooser gl_overlay inactive list_visuals output radio sudoku valuators blocks clock curve uid glpuzzle input mandelbrot overlay resizebox symbols device boxtype colbrowser demo fonts hello input_choice menubar pack resize tabs

adjuster browser color_chooser doublebuffer forms help keyboard message pixmap_browser scroll threads

22.1.1

adjuster

adjuster shows a nifty little widget for quickly setting values in a great range.

180

Example Source Code

22.1.2

arc

The arc demo explains how to derive your own widget to generate some custom drawings. The sample drawings use the matrix based arc drawing for some fun effects.

22.1.3

ask

ask shows some of FLTKs standard dialog boxes. Click the correct answers or you may end up in a loop, or you may end up in a loop, or you... .

22.1.4

bitmap

This simple test shows the use of a single color bitmap as a label for a box widget. Bitmaps are stored in the X11 .bmp le format and can be part of the source code.

22.1.5

blocks

A wonderful and addictive game that shows the usage of FLTK timers, graphics, and how to implement sound on all platforms. blocks is also a good example for the Mac OS X specic bundle format.

22.1.6

boxtype

boxtype gives an overview of readily available boxes and frames in FLTK. More types can be added by the application programmer. When using themes, FLTK shufes boxtypes around to give your program a new look.

22.1.7

browser

browser shows the capabilities of the Fl_Browser widget. Important features tested are loading of les, line formatting, and correct positioning of the browser data window.

22.1.8

button

The button test is a simple demo of push-buttons and callbacks.

22.1.9

buttons

buttons shows a sample of FLTK button types.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

22.1 Example Applications

181

22.1.10

checkers

Written by Steve Poulsen in early 1979, checkers shows how to convert a VT100 text-terminal based program into a neat application with a graphical UI. Check out the code that drags the pieces, and how the pieces are drawn by layering. Then tell me how to beat the computer at Checkers.

22.1.11

clock

The clock demo shows two analog clocks. The innards of the Fl_Clock widget are pretty interesting, explaining the use of timeouts and matrix based drawing.

22.1.12

colbrowser

colbrowser runs only on X11 systems. It reads /usr/lib/X11/rgb.txt to show the color representation of every text entry in the le. This is beautiful, but only moderately useful unless your UI is written in Motif .

22.1.13

color chooser

The color_chooser gives a short demo of FLTKs palette based color chooser and of the RGB based color wheel.

22.1.14

cube

The cube demo shows the speed of OpenGL. It also tests the ability to render two OpenGL buffers into a single window, and shows OpenGL text.

22.1.15

CubeView

CubeView shows how to create a UI containing OpenGL with Fluid.

22.1.16

cursor

The cursor demo shows all mouse cursor shapes that come standard with FLTK. The fgcolor and bgcolor sliders work only on few systems (some version of Irix for example).

22.1.17

curve

curve draws a nice Bezier curve into a custom widget. The points option for splines is not supported on all platforms.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

182

Example Source Code

22.1.18

demo

This tool allows quick access to all programs in the test directory. demo is based on the visuals of the IrixGL demo program. The menu tree can be changed by editing test/demo.menu.

22.1.19

device

Shows how a wide variety of graphics requests can be printed using the Fl_Printer class.

22.1.20

doublebuffer

The doublebuffer demo shows the difference between a single buffered window, which may icker during a slow redraw, and a double buffered window, which never ickers, but uses twice the amount of RAM. Some modern OSs double buffer all windows automatically to allow transparency and shadows on the desktop. FLTK is smart enough to not tripple buffer a window in that case.

22.1.21

editor

FLTK has two very different text input widgets. Fl_Input and derived classes are rather light weight, however Fl_Text_Editor is a complete port of nedit (with permission). The editor test is almost a full application, showing custom syntax highlighting and dialog creation.

22.1.22

fast slow

fast_slow shows how an application can use the Fl_Widget::when() setting to receive different kinds of callbacks.

22.1.23

le chooser

The standard FLTK file_chooser is the result of many iterations, trying to nd a middle ground between a complex browser and a fast light implementation.

22.1.24

fonts

fonts shows all available text fonts on the host system. If your machine still has some pixmap based fonts, the supported sizes will be shown in bold face. Only the rst 256 fonts will be listed.

22.1.25

forms

forms is an XForms program with very few changes. Search for "tk" to nd all changes necessary to port to tk. This demo shows the different boxtypes. Note that some boxtypes are not appropriate for some objects.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

22.1 Example Applications

183

22.1.26

fractals

fractals shows how to mix OpenGL, Glut and FLTK code. FLTK supports a rather large subset of Glut, so that many Glut applications compile just ne.

22.1.27

fullscreen

This demo shows how to do many of the window manipulations that are popular for games. You can toggle the border on/off, switch between single- and double-buffered rendering, and take over the entire screen. More information in the source code.

22.1.28

gl overlay

gl_overlay shows OpenGL overlay plane rendering. If no hardware overlay plane is available, FLTK will simulate it for you.

22.1.29

glpuzzle

The glpuzzle test shows how most Glut source code compiles easily under FLTK.

22.1.30

hello

hello: Hello, World. Need I say more? Well, maybe. This tiny demo shows how little is needed to get a functioning application running with FLTK. Quite impressive, Id say.

22.1.31

help

help displays the built-in FLTK help browser. The Fl_Help_Dialog understands a subset of html and renders various image formats. This widget makes it easy to provide help pages to the user without depending on the operating systems html browser.

22.1.32

iconize

iconize demonstrates the effect of the window functions hide(), iconize(), and show().

22.1.33

image

The image demo shows how an image can be created on the y. This generated image contains an alpha (transparency) channel which lets previous renderings shine through, either via true transparency or by using screen door transparency (pixelation).
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

184

Example Source Code

22.1.34

inactive

inactive tests the correct rendering of inactive widgets. To see the inactive version of images, you can check out the pixmap or image test.

22.1.35

input

This tool shows and tests different types of text input elds based on Fl_Input_. The input program also tests various settings of Fl_Input::when().

22.1.36

input choice

input_choice tests the latest addition to FLTK1, a text input eld with an attached pulldown menu. Windows users will recognize similarities to the ComboBox. input_choice starts up in plastic scheme, but the traditional scheme is also supported.

22.1.37

keyboard

FLTK unies keyboard events for all platforms. The keyboard test can be used to check the return values of Fl::event_key() and Fl::event_text(). It is also great to see the modier buttons and the scroll wheel at work. Quit this application by closing the window. The ESC key will not work.

22.1.38

label

Every FLTK widget can have a label attached to it. The label demo shows alignment, clipping, and wrapping of text labels. Labels can contain symbols at the start and end of the text, like @FLTK or @circle uh-huh @square.

22.1.39

line style

Advanced line drawing can be tested with line_style. Not all platforms support all line styles.

22.1.40

list visuals

This little app nds all available pixel formats for the current X11 screen. But since you are now an FLTK user, you dont have to worry about any of this.

22.1.41

mandelbrot

mandelbrot shows two advanced topics in one test. It creates grayscale images on the y, updating them via the idle callback system. This is one of the few occasions where the idle callback is very useful by giving all available processor time to the application without blocking the UI or other apps.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

22.1 Example Applications

185

22.1.42

menubar

The menubar tests many aspects of FLTKs popup menu system. Among the features are radio buttons, menus taller than the screen, arbitrary sub menu depth, and global shortcuts.

22.1.43

message

message pops up a few of FLTKs standard message boxes.

22.1.44

minimum

The minimum test program veries that the update regions are set correctly. In a real life application, the trail would be avoided by choosing a smaller label or by setting label clipping differently.

22.1.45

navigation

navigation demonstrates how the text cursor moves from text eld to text eld when using the arrow keys, tab, and shift-tab.

22.1.46

output

output shows the difference between the single line and multi line mode of the Fl_Output widget. Fonts can be selected from the FLTK standard list of fonts.

22.1.47

overlay

The overlay test app shows how easy an FLTK window can be layered to display cursor and manipulator style elements. This example derives a new class from Fl_Overlay_Window and provides a new function to draw custom overlays.

22.1.48

pack

The pack test program demonstrates the resizing and repositioning of children of the Fl_Pack group. Putting an Fl_Pack into an Fl_Scroll is a useful way to create a browser for large sets of data.

22.1.49

pixmap browser

pixmap_browser tests the shared-image interface. When using the same image multiple times, Fl_Shared_Image will keep it only once in memory.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

186

Example Source Code

22.1.50

pixmap

This simple test shows the use of a LUT based pixmap as a label for a box widget. Pixmaps are stored in the X11 .xpm le format and can be part of the source code. Pixmaps support one transparent color.

22.1.51

preferences

I do have my preferences in the morning, but sometimes I just cant remember a thing. This is where the Fl_Preferences come in handy. They remember any kind of data between program launches.

22.1.52

radio

The radio tool was created entirely with uid. It shows some of the available button types and tests radio button behavior.

22.1.53

resizebox

resizebox shows some possible ways of FLTKs automatic resize behavior.

22.1.54

resize

The resize demo tests size and position functions with the given window manager.

22.1.55

scroll

scroll shows how to scroll an area of widgets, one of them being a slow custom drawing. Fl_Scroll uses clipping and smart window area copying to improve redraw speed. The buttons at the bottom of the window control decoration rendering and updates.

22.1.56

shape

shape is a very minimal demo that shows how to create your own OpenGL rendering widget. Now that you know that, go ahead and write that ight simulator you always dreamt of.

22.1.57

subwindow

The subwindow demo tests messaging and drawing between the main window and true sub windows. A sub window is different to a group by resetting the FLTK coordinate system to 0, 0 in the top left corner. On Win32 and X11, subwindows have their own operating system specic handle.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

22.1 Example Applications

187

22.1.58

sudoku

Another highly addictive game - dont play it, I warned you. The implementation shows how to create application icons, how to deal with OS specics, and how to generate sound.

22.1.59

symbols

symbols are a speciality of FLTK. These little vector drawings can be integrated into labels. They scale and rotate, and with a little patience, you can dene your own. The rotation number refers to 45 degree rotations if you were looking at a numeric keypad (2 is down, 6 is right, etc.).

22.1.60

tabs

The tabs tool was created with uid. It tests correct hiding and redisplaying of tabs, navigation across tabs, resize behavior, and no unneeded redrawing of invisible widgets.

The tabs application shows the Fl_Tabs widget on the left and the Fl_Wizard widget on the right side for direct comparison of these two panel management widgets.

22.1.61

threads

FLTK can be used in a multithreading environment. There are some limitations, mostly due to the underlying operating system. threads shows how to use Fl::lock(), Fl::unlock(), and Fl::awake() in secondary threads to keep FLTK happy. Although locking works on all platforms, this demo is not available on every machine.

22.1.62

tile

The tile tool shows a nice way of using Fl_Tile. To test correct resizing of subwindows, the widget for region 1 is created from an Fl_Window class.

22.1.63

tiled image

The tiled_image demo uses an image as the background for a window by repeating it over the full size of the widget. The window is resizable and shows how the image gets repeated.

22.1.64

valuators

valuators shows all of FLTKs nifty widgets to change numeric values.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

188

Example Source Code

22.1.65

uid

fluid is not only a big test program, but also a very useful visual UI designer. Many parts of fluid were created using fluid. See the Fluid Tutorial for more details.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 23

Todo List
Page Adding and Extending Widgets Clarify Fl_Window::damage(uchar) handling - seems confused/wrong? ORing value doesnt match setting behaviour in FL_Widget.H! Clarify Fl_Widget::test_shortcut() explanations. Fl_Widget.h says Internal Use only, but subclassing chapter gives details! Group Box Types Description of boxtypes is incomplete. See below for the dened enum Fl_Boxtype. Page Drawing Things in FLTK work out why Fl::get_color() does not give links! work out why these do not give links! add an Fl_Draw_Area_Cb typedef to allow _scroll(...) to be doxygenated? Member Fl_Browser_::scrollbar_width () const This method should eventually be removed in 1.4+ Member Fl_Browser_::scrollbar_width (int width) This method should eventually be removed in 1.4+ Member Fl_Browser_::sort (int ags=0) Add a ag to ignore case Class Fl_Button Refactor the doxygen comments for Fl_Button type() documentation. Refactor the doxygen comments for Fl_Button when() documentation. Class Fl_Chart Refactor Fl_Chart::type() information. Class Fl_Check_Button Refactor Fl_Check_Button doxygen comments (add color() info etc?) Generate Fl_Check_Button.gif with visible checkmark. Class Fl_Choice Refactor the doxygen comments for Fl_Choice changed() documentation. Class Fl_Counter Refactor the doxygen comments for Fl_Counter type() documentation.

190 Member Fl_Cursor enum Fl_Cursor needs maybe an image. Member Fl_File_Input::errorcolor () const Better docs for Fl_File_Input::errorcolor() - is it even used? Member Fl_Group::sizes () Should the internal representation of the sizes() array be documented?

Todo List

Member _height (int font, int size) In the future, when the XFT issues are resolved, this function should simply return the size value. Member Fl_Input_::handle_mouse (int, int, int, int, int keepmark=0) Add comment and parameters Member Fl_Input_::handletext (int e, int, int, int, int) Add comment and parameters Member Fl_Input_::maximum_size () const It is not clear if this function is actually required Member Fl_Input_::maximum_size (int m) It is not clear if this function is actually required Member _intptr_t typedefs _intptr_t and _uintptr_t should be documented. Class Fl_Label For FLTK 1.3, the Fl_Label type will become a widget by itself. That way we will be avoiding a lot of code duplication by handling labels in a similar fashion to widgets containing text. We also provide an easy interface for very complex labels, containing html or vector graphics. Member Fl_Labeltype The doxygen comments are incomplete, and some labeltypes are starting with an underscore. Also, there are three external functions undocumented (yet): _dene_FL_SHADOW_LABEL() _dene_FL_ENGRAVED_LABEL() _dene_FL_EMBOSSED_LABEL() Member Fl_Menu_::add (const char , int shortcut, Fl_Callback , void =0, int=0) Raw integer shortcut needs examples. Dependent on responses to http://fltk.org/newsgroups.php?gfltk.development+v:10086 and results of STR#2344 Member _nonspacing (unsigned int ucs) explain what non-spacing means. Member Fl_Preferences::get (const char entry, void value, const void defaultValue, int defaultSize, int maxSize) maxSize should receive the number of bytes that were read. Member _reset_spot (void) provide user documentation for _reset_spot function Member Fl_Scroll::bbox (int &, int &, int &, int &) The visibility of the scrollbars ought to be checked/calculated outside of the draw() method (STR #1895).
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

191 Member _set_spot (int font, int size, int X, int Y, int W, int H, Fl_Window win=0) provide user documentation for _set_spot function Member _set_status (int X, int Y, int W, int H) provide user documentation for _set_status function Member Fl_String FIXME: temporary (?) typedef to mark UTF8 and Unicode conversions Member Fl_Text_Display::display_insert () Unicode? Member Fl_Text_Display::extend_range_for_styles (int start, int end) Unicode? Member Fl_Text_Display::handle_vline (int mode, int lineStart, int lineLen, int leftChar, int rightChar, int topClip, int bottomClip, int leftClip, int rightClip) const we need to handle hidden hyphens and tabs here! we handle all styles and selections we must provide code to get pixel positions of the middle of a character as well Member Fl_Text_Display::overstrike (const char text) Unicode? Find out exactly what we do here and simplify. Member Fl_Text_Display::position_to_line (int pos, int lineNum) const What does this do? Member Fl_Text_Display::position_to_linecol (int pos, int lineNum, int column) const a column number makes little sense in the UTF-8/variable font width environment. We will have to further dene what exactly we want to return. Please check the functions that call this particular function. Member Fl_Text_Display::scroll (int topLineNum, int horizOffset) Column numbers make little sense here. Member Fl_Text_Display::shortcut () const FIXME : get set methods pointing on shortcut_ have no effects as shortcut_ is unused in this class and derived! Member Fl_Text_Display::shortcut (int s) FIXME : get set methods pointing on shortcut_ have no effects as shortcut_ is unused in this class and derived! Member Fl_Text_Display::wrap_mode (int wrap, int wrap_margin) we need new wrap modes to wrap at the window edge and based on pixel width or average character width. Member Fl_Text_Display::wrapped_column (int row, int column) const What does this do and how is it useful? Column numbers mean little in this context. Which functions depend on this one? Unicode? Member Fl_Text_Display::wrapped_row (int row) const What does this do and how is it useful? Column numbers mean little in this context. Which functions depend on this one? Member _utf_strcasecmp (const char s1, const char s2) Correct the incorrect logic where length of strings tested
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

192 Member _utf_strncasecmp (const char s1, const char s2, int n) Correct the incorrect logic where length of strings tested Clarify whether n means number of bytes, or characters. Member Fl_When doxygen comments for values are incomplete and maybe wrong or unclear

Todo List

Member Fl_Widget::argument (long v) The user data value must be implemented using intptr_t or similar to avoid 64-bit machine incompatibilities. Member Fl_Widget::type () const Explain "simulate RTTI" (currently only used to decide if a widget is a window, i.e. type()>=FL_WINDOW ?). Is type() really used in a way that ensures "Forms compatibility" ? Member Fl_Window::show (int argc, char argv) explain which system parameters are set up. Group Mouse and Keyboard Events FL_Button and FL_key... constants could be structured better (use an enum or some doxygen grouping ?) Page Unicode and UTF-8 Support Do we need this info about planes? Work through the code and this documentation to harmonize the [OksiD] and [tk2] functions. Verify 16/24 bit Unicode limit for different character sets? OksiDs code appears limited to 16-bit whereas the FLTK2 code appears to handle a wider set. What about illegal characters? See comments in _utf8fromwc() and _utf8toUtf16().

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 24

Deprecated List
Member Fl::release () Use Fl::grab(0) instead. Member Fl::set_idle (Fl_Old_Idle_Handler cb) This method is obsolete - use the add_idle() method instead. Member _clip _clip(int, int, int, int) is deprecated and will be removed from future releases. Please use _push_clip(int x, int y, int w, int h) instead. Member Fl_Group::focus (Fl_Widget W) This is for backwards compatibility only. Member Fl_Menu_Item::check () . Member Fl_Menu_Item::checked () const . Member Fl_Menu_Item::uncheck () . Member Fl_Spinner::maxinum () const Member Fl_Spinner::mininum () const Member Fl_Widget::color2 (unsigned a) Use selection_color(unsigned) instead. Member Fl_Widget::color2 () const Use selection_color() instead. Member Fl_Window::free_position () please use force_position(0) instead

194

Deprecated List

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 25

Module Index
25.1 Modules
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 217 220 234 236 239 248 268 270 274 276 285 287 297

Here is a list of all modules: Callback function typedefs . . . . . . . Windows handling functions . . . . . . Events handling functions . . . . . . . . Selection & Clipboard functions . . . . Screen functions . . . . . . . . . . . . . Color & Font functions . . . . . . . . . Drawing functions . . . . . . . . . . . . Multithreading support functions . . . . Safe widget deletion support functions . Cairo support functions and classes . . . Unicode and UTF-8 functions . . . . . Mac OS X-specic symbols . . . . . . . Common Dialogs classes and functions File names and URI utility functions . .

196

Module Index

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 26

Class Index
26.1 Class Hierarchy
305 305 305 377 384 407 460 444 624 660 917 703 411 600 619 635 651 709 416 419 427 437 438 449 456 457 457 457 458 496 497 500 501

This inheritance list is sorted roughly, but not completely, alphabetically: Fl_Table_Row::CharVector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Preferences::Entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Cairo_State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . FL_CHART_ENTRY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Graphics_Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_GDI_Graphics_Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_PostScript_Graphics_Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Quartz_Graphics_Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Xlib_Graphics_Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Surface_Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Display_Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Paged_Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_PostScript_File_Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_PostScript_Printer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Printer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_System_Printer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_End . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_File_Chooser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_File_Icon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Font_Descriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Fontdesc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Gl_Choice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Glut_Bitmap_Font . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Glut_StrokeChar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Glut_StrokeFont . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Glut_StrokeStrip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Glut_StrokeVertex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Help_Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Help_Dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Help_Font_Stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Help_Font_Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

198

Class Index 501 502 514 329 916 607 448 922 669 332 542 613 614 687 795 543 547 568 584 586 610 408 637 611 739 790 801 833 843 845 864 333 372 545 388 665 675 665 664 666 667 800 379 395 393 675 438 439 441 486 356 335

Fl_Help_Link . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Help_Target . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Bitmap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_XBM_Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Pixmap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_GIF_Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_XPM_Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_RGB_Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_BMP_Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_JPEG_Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_PNG_Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_PNM_Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Shared_Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Tiled_Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Mac_App_Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Menu_Item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Multi_Label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Native_File_Chooser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Device_Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Plugin_Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Text_Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Text_Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Tooltip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Tree_Item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Tree_Item_Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Tree_Prefs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Widget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Light_Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Check_Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Radio_Light_Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Round_Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Radio_Round_Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Radio_Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Repeat_Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Return_Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Toggle_Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Clock_Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Round_Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_FormsBitmap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_FormsPixmap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Free . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Browser_ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

26.1 Class Hierarchy Fl_File_Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Hold_Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Multi_Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Select_Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Check_Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Color_Chooser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Help_View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Input_Choice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Pack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Scroll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Spinner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Table_Row . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Tabs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Text_Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Text_Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Tile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Double_Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Cairo_Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Overlay_Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Gl_Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Glut_Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Single_Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Menu_Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Input_ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_File_Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Float_Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Int_Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Multiline_Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Multiline_Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Secret_Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Menu_ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Choice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Menu_Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Sys_Menu_Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Menu_Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Input_Choice::InputMenuButton . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Positioner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Progress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Valuator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Adjuster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Simple_Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Dial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Fill_Dial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Line_Dial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

199 417 510 583 686 385 399 503 538 598 676 698 713 732 735 753 784 792 804 901 413 378 596 449 458 692 580 915 520 518 432 436 541 584 594 585 685 548 390 562 705 565 925 615 658 797 849 327 403 691 409 435 547

200

Class Index 673 695 435 511 512 512 594 681 862 513 854 858 899 917 923 925 926 926 927 928 929 929 930 930 931

Fl_Roller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Slider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Fill_Slider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Hor_Fill_Slider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Hor_Nice_Slider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Hor_Slider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Nice_Slider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Scrollbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Value_Slider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Hor_Value_Slider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Value_Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Value_Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Widget_Tracker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_XColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . IActiveIMMApp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Table::IntVector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Text_Editor::Key_Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Graphics_Driver::matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Preferences::Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Preferences::Node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Paged_Device::page_format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Preferences::RootNode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Scroll::ScrollInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Text_Display::Style_Table_Entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XUtf8FontStruct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 27

Class Index
27.1 Class List

Here are the classes, structs, unions and interfaces with brief descriptions: Fl_Table_Row::CharVector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Preferences::Entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl The Fl is the FLTK global (static) class containing state information and global methods for the current application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Adjuster Was stolen from Prisms, and has proven to be very useful for values that need a large dynamic range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Bitmap Supports caching and drawing of mono-color (bitmap) images . . . . . . . . . . . . . Fl_BMP_Image Supports loading, caching, and drawing of Windows Bitmap (BMP) image les . . . . Fl_Box This widget simply draws its box, and possibly its label . . . . . . . . . . . . . . . . Fl_Browser Displays a scrolling list of text lines, and manages all the storage for the text . . . . . Fl_Browser_ This is the base class for browsers . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Button Buttons generate callbacks when they are clicked by the user . . . . . . . . . . . . . . Fl_Cairo_State Contains all the necessary info on the current cairo context . . . . . . . . . . . . . . . Fl_Cairo_Window This denes a pre-congured cairo tk window . . . . . . . . . . . . . . . . . . . . . Fl_Chart Fl_Chart displays simple charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . FL_CHART_ENTRY For internal use only . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Check_Browser Displays a scrolling list of text lines that may be selected and/or checked by the user . Fl_Check_Button A button with an "checkmark" to show its status . . . . . . . . . . . . . . . . . . . . 305 305

305

327 329 332 333 335 356 372 377 378 379 384 385 388

202

Class Index

Fl_Choice A button that is used to pop up a menu . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Clock This widget provides a round analog clock display . . . . . . . . . . . . . . . . . . . Fl_Clock_Output This widget can be used to display a program-supplied time . . . . . . . . . . . . . . Fl_Color_Chooser Standard RGB color chooser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Counter Controls a single oating point value with button (or keyboard) arrows . . . . . . . . Fl_Device All graphical output devices and all graphics systems . . . . . . . . . . . . . . . . . . Fl_Device_Plugin This plugin socket allows the integration of new device drivers for special window or screen types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Dial Circular dial to control a single oating point value . . . . . . . . . . . . . . . . . . . Fl_Display_Device A display to which the computer can draw . . . . . . . . . . . . . . . . . . . . . . . Fl_Double_Window The Fl_Double_Window provides a double-buffered window . . . . . . . . . . . . . . Fl_End This is a dummy class that allows you to end a Fl_Group in a constructor list of a class: Fl_File_Browser Displays a list of lenames, optionally with le-specic icons . . . . . . . . . . . . . Fl_File_Chooser Displays a standard le selection dialog that supports various selection modes . . . . . Fl_File_Icon Manages icon images that can be used as labels in other widgets and as icons in the FileBrowser widget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_File_Input This widget displays a pathname in a text input eld . . . . . . . . . . . . . . . . . . Fl_Fill_Dial Draws a dial with a lled arc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Fill_Slider Widget that draws a lled horizontal slider, useful as a progress or value meter . . . . Fl_Float_Input Subclass of Fl_Input that only allows the user to type oating point numbers (sign, digits, decimal point, more digits, E or e, sign, digits) . . . . . . . . . . . . . . . . Fl_Font_Descriptor This a structure for an actual system font, with junk to help choose it and info on character sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Fontdesc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_FormsBitmap Forms compatibility Bitmap Image Widget . . . . . . . . . . . . . . . . . . . . . . . Fl_FormsPixmap Forms pixmap drawing routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Free Emulation of the Forms "free" widget . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_GDI_Graphics_Driver The MSWindows-specic graphics class . . . . . . . . . . . . . . . . . . . . . . . . Fl_GIF_Image Supports loading, caching, and drawing of Compuserve GIFSM images . . . . . . . .

390 393 395 399 403 407

408 409 411 413 416 417 419

427 432 435 435

436

437 438 438 439 441 444 448

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

27.1 Class List Fl_Gl_Choice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Gl_Window Sets things up so OpenGL works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Glut_Bitmap_Font Fltk glut font/size attributes used in the glutXXX functions . . . . . . . . . . . . . . . Fl_Glut_StrokeChar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Glut_StrokeFont . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Glut_StrokeStrip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Glut_StrokeVertex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Glut_Window GLUT is emulated using this window class and these static variables (plus several more static variables hidden in glut_compatability.cxx): . . . . . . . . . . . . . . . . . . . Fl_Graphics_Driver A virtual class subclassed for each graphics driver FLTK uses . . . . . . . . . . . . . Fl_Group FLTK container widget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Help_Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Help_Dialog Displays a standard help dialog window using the Fl_Help_View widget . . . . . . . Fl_Help_Font_Stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Help_Font_Style Fl_Help_View font stack element denition . . . . . . . . . . . . . . . . . . . . . . . Fl_Help_Link Denition of a link for the html viewer . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Help_Target Fl_Help_Target structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Help_View Displays HTML text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Hold_Browser The Fl_Hold_Browser is a subclass of Fl_Browser which lets the user select a single item, or no items by clicking on the empty space . . . . . . . . . . . . . . . . . . . . Fl_Hor_Fill_Slider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Hor_Nice_Slider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Hor_Slider Horizontal Slider class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Hor_Value_Slider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Image Fl_Image is the base class used for caching and drawing all kinds of images in FLTK . Fl_Input This is the FLTK text input widget . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Input_ This class provides a low-overhead text input eld . . . . . . . . . . . . . . . . . . . Fl_Input_Choice A combination of the input widget and a menu button . . . . . . . . . . . . . . . . . Fl_Int_Input Subclass of Fl_Input that only allows the user to type decimal digits (or hex numbers of the form 0xaef) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_JPEG_Image Supports loading, caching, and drawing of Joint Photographic Experts Group (JPEG) File Interchange Format (JFIF) images . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Label This struct stores all information for a text or mixed graphics label . . . . . . . . . . . Fl_Light_Button This subclass displays the "on" state by turning on a light, rather than drawing pushed in
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

203 449 449 456 457 457 457 458

458 460 486 496 497 500 501 501 502 503

510 511 512 512 513 514 518 520 538

541

542 543 545

204

Class Index

Fl_Line_Dial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547 Fl_Mac_App_Menu Mac OS-specic class allowing to localize the application menu . . . . . . . . . . . . 547 Fl_Menu_ Base class of all widgets that have a menu in FLTK . . . . . . . . . . . . . . . . . . . 548 Fl_Menu_Bar This widget provides a standard menubar interface . . . . . . . . . . . . . . . . . . . 562 Fl_Menu_Button This is a button that when pushed pops up a menu (or hierarchy of menus) dened by an array of Fl_Menu_Item objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565 Fl_Menu_Item The Fl_Menu_Item structure denes a single menu item that is used by the Fl_Menu_ class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568 Fl_Menu_Window Window type used for menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580 Fl_Multi_Browser Subclass of Fl_Browser which lets the user select any set of the lines . . . . . . . . . 583 Fl_Multi_Label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 characters as new lines rather than J, and accepts the Return, Tab, and up and down arrow keys 584 Fl_Multiline_Output This widget is a subclass of Fl_Output that displays multiple lines of text . . . . . . . 585 Fl_Native_File_Chooser This class lets an FLTK application easily and consistently access the operating systems native le chooser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 586 Fl_Nice_Slider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594 Fl_Output This widget displays a piece of text . . . . . . . . . . . . . . . . . . . . . . . . . . . 594 Fl_Overlay_Window This window provides double buffering and also the ability to draw the "overlay" which is another picture placed on top of the main image . . . . . . . . . . . . . . . . . . . 596 Fl_Pack This widget was designed to add the functionality of compressing and aligning widgets 598 Fl_Paged_Device Represents page-structured drawing surfaces . . . . . . . . . . . . . . . . . . . . . . 600 Fl_Pixmap Supports caching and drawing of colormap (pixmap) images, including transparency . 607 Fl_Plugin Fl_Plugin allows link-time and run-time integration of binary modules . . . . . . . . . 610 Fl_Plugin_Manager Fl_Plugin_Manager manages link-time and run-time plugin binaries . . . . . . . . . . 611 Fl_PNG_Image Supports loading, caching, and drawing of Portable Network Graphics (PNG) image les . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613 Fl_PNM_Image Supports loading, caching, and drawing of Portable Anymap (PNM, PBM, PGM, PPM) image les . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614 Fl_Positioner This class is provided for Forms compatibility . . . . . . . . . . . . . . . . . . . . . 615 Fl_PostScript_File_Device To send graphical output to a PostScript le . . . . . . . . . . . . . . . . . . . . . . . 619 Fl_PostScript_Graphics_Driver PostScript graphical backend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624 Fl_PostScript_Printer Print support under Unix/Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

27.1 Class List Fl_Preferences Fl_Preferences provides methods to store user settings between application starts . . . Fl_Printer OS-independent print support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Progress Displays a progress bar for the user . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Quartz_Graphics_Driver The Mac OS X-specic graphics class . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Radio_Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Radio_Light_Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Radio_Round_Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Repeat_Button The Fl_Repeat_Button is a subclass of Fl_Button that generates a callback when it is pressed and then repeatedly generates callbacks as long as it is held down . . . . . . . Fl_Return_Button The Fl_Return_Button is a subclass of Fl_Button that generates a callback when it is pressed or when the user presses the Enter key . . . . . . . . . . . . . . . . . . . . . Fl_RGB_Image Supports caching and drawing of full-color images with 1 to 4 channels of color information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Roller "dolly" control commonly used to move 3D objects . . . . . . . . . . . . . . . . . . . Fl_Round_Button Buttons generate callbacks when they are clicked by the user . . . . . . . . . . . . . . Fl_Round_Clock A clock widget of type FL_ROUND_CLOCK . . . . . . . . . . . . . . . . . . . . . Fl_Scroll This container widget lets you maneuver around a set of widgets much larger than your window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Scrollbar Displays a slider with arrow buttons at the ends of the scrollbar . . . . . . . . . . . . Fl_Secret_Input Subclass of Fl_Input that displays its input as a string of placeholders . . . . . . . . . Fl_Select_Browser The class is a subclass of Fl_Browser which lets the user select a single item, or no items by clicking on the empty space . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Shared_Image This class supports caching, loading, and drawing of image les . . . . . . . . . . . . Fl_Simple_Counter This widget creates a counter with only 2 arrow buttons . . . . . . . . . . . . . . . . Fl_Single_Window This is the same as Fl_Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Slider Sliding knob inside a box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Spinner This widget is a combination of the input widget and repeat buttons . . . . . . . . . . Fl_Surface_Device A surface thats susceptible to receive graphical output . . . . . . . . . . . . . . . . . Fl_Sys_Menu_Bar A class to create, modify and delete menus that appear on Mac OS X in the menu bar at the top of the screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_System_Printer Print support under MSWindows and Mac OS . . . . . . . . . . . . . . . . . . . . . .
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

205

637 651 658 660 664 665 665

666

667

669 673 675 675

676 681 685

686 687 691 692 695 698 703

705 709

206 Fl_Table

Class Index

A table of widgets or other content . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Table_Row A table with row selection capabilities . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Tabs "le card tabs" interface that allows you to put lots and lots of buttons and switches in a panel, as popularized by many toolkits . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Text_Buffer This class manages unicode displayed in one or more Fl_Text_Display widgets . . . . Fl_Text_Display Rich text display widget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Text_Editor This is the FLTK text editor widget . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Text_Selection This is an internal class for Fl_Text_Buffer to manage text selections . . . . . . . . . Fl_Tile Lets you resize the children by dragging the border between them: . . . . . . . . . . . Fl_Tiled_Image This class supports tiling of images over a specied area . . . . . . . . . . . . . . . . Fl_Timer This is provided only to emulate the Forms Timer widget . . . . . . . . . . . . . . . . Fl_Toggle_Button The toggle button is a push button that needs to be clicked once to toggle on, and one more time to toggle off . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Tooltip Tooltip support for all FLTK widgets . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Tree Tree widget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Tree_Item Tree item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Tree_Item_Array Manages an array of Fl_Tree_Item pointers . . . . . . . . . . . . . . . . . . . . . . . Fl_Tree_Prefs Tree widgets preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Valuator Controls a single oating-point value and provides a consistent interface to set the value, range, and step, and insures that callbacks are done the same for every object . . . . . Fl_Value_Input Displays a numeric value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Value_Output Displays a oating point value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Value_Slider Fl_Slider widget with a box displaying the current value . . . . . . . . . . . . . . . . Fl_Widget Fl_Widget is the base class for all widgets in FLTK . . . . . . . . . . . . . . . . . . . Fl_Widget_Tracker This class should be used to control safe widget deletion . . . . . . . . . . . . . . . . Fl_Window This widget produces an actual window . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Wizard This widget is based off the Fl_Tabs widget, but instead of displaying tabs it only changes "tabs" under program control . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_XBM_Image Supports loading, caching, and drawing of X Bitmap (XBM) bitmap les . . . . . . .

713 732

735 739 753 784 790 792 795 797

800 801 804 833 843 845

849 854 858 862 864 899 901

915 916

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

27.1 Class List Fl_XColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Xlib_Graphics_Driver The Xlib-specic graphics class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_XPM_Image Supports loading, caching, and drawing of X Pixmap (XPM) images, including transparency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . IActiveIMMApp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Input_Choice::InputMenuButton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Table::IntVector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Text_Editor::Key_Binding Simple linked list associating a key/state to a function . . . . . . . . . . . . . . . . . Fl_Graphics_Driver::matrix A 2D coordinate transformation matrix . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Preferences::Name Name provides a simple method to create numerical or more complex procedural names for entries and groups on the y . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Preferences::Node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Paged_Device::page_format Width, height and name of a page format . . . . . . . . . . . . . . . . . . . . . . . . Fl_Preferences::RootNode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Scroll::ScrollInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Text_Display::Style_Table_Entry This structure associates the color, font, andsize of a string to draw with an attribute mask matching attr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XUtf8FontStruct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

207 917 917

922 923 925 925 926 926

927 928 929 929 930

930 931

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

208

Class Index

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 28

File Index
28.1 File List

Here is a list of all documented les with brief descriptions: aimm.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . armscii_8.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ascii.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . big5.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . big5_emacs.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . case.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . cgdebug.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . cp1133.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . cp1251.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . cp1255.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . cp1256.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . cp936ext.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dingbats_.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dirent.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Enumerations.H This le contains type denitions and general enumerations fastarrow.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . lename.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl.H Fl static class . . . . . . . . . . . . . . . . . . . . . . . . Fl_Adjuster.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . _arc.cxx Utility functions for drawing arcs and circles . . . . . . . _arci.cxx Utility functions for drawing circles using integers . . . . _ask.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Bitmap.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_BMP_Image.H . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Box.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . _boxtype.cxx Drawing code for common box types . . . . . . . . . . . Fl_Browser.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Browser_.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??

. . . . . . . . . . . . . . 933 . . . . . . . . . . . . . . . ?? . . . . . . . . . . . . . . . ?? . . . . . . . . . . . . . . . 953 . . . . . . . . . . . . . . . ?? . . . . . . . . . . . . . . . 954 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 954 . ?? . ?? . ?? . ??

. . . . . . . . . . . . . . . 955 . . . . . . . . . . . . . . . ?? . . . . . . . . . . . . . . . ??

210

File Index ?? ?? ?? ?? ?? ?? ?? ?? ?? 956 957 ??

Fl_Button.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Cairo.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Cairo_Window.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Chart.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Check_Browser.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Check_Button.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Choice.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Clock.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . _cmap.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . _color.cxx Color handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Color_Chooser.H Fl_Color_Chooser widget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Counter.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . _curve.cxx Utility for drawing Bezier curves, adding the points to the current _begin/_vertex/_end path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Device.H Declaration of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device, Fl_Device_Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Dial.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Double_Window.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . _draw.H Utility header to pull drawing functions together . . . . . . . . . . . . . . . . . . . . Fl_Export.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_File_Browser.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_File_Chooser.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_File_Icon.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_File_Input.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Fill_Dial.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Fill_Slider.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Float_Input.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Font.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_FormsBitmap.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_FormsPixmap.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Free.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_GIF_Image.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Gl_Choice.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Gl_Window.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Group.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Help_Dialog.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Help_View.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Hold_Browser.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Hor_Fill_Slider.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Hor_Nice_Slider.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Hor_Slider.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Hor_Value_Slider.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Image.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Input.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Input_.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Input_Choice.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Int_Input.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_JPEG_Image.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Light_Button.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

958

958 ?? ?? 959 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

28.1 File List Fl_Line_Dial.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . _line_style.cxx Line style drawing utility hiding different platforms . . . . . . . . . . . . . . . . . Fl_Menu.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Menu_.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Menu_Bar.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Menu_Button.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Menu_Item.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Menu_Window.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . _message.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Multi_Browser.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Multi_Label.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Multiline_Input.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Multiline_Output.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Native_File_Chooser.H Fl_Native_File_Chooser widget . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Nice_Slider.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Object.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Output.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Overlay_Window.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Pack.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Paged_Device.cxx Implementation of class Fl_Paged_Device . . . . . . . . . . . . . . . . . . . . . . Fl_Paged_Device.H Declaration of class Fl_Paged_Device . . . . . . . . . . . . . . . . . . . . . . . . Fl_Pixmap.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Plugin.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_PNG_Image.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_PNM_Image.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Positioner.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_PostScript.H Declaration of classes Fl_PostScript_Graphics_Driver, Fl_PostScript_File_Device Fl_Preferences.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Printer.H Declaration of classes Fl_Printer, Fl_System_Printer and Fl_PostScript_Printer . . Fl_Progress.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Radio_Button.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Radio_Light_Button.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Radio_Round_Button.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . _rect.cxx Drawing and clipping routines for rectangles . . . . . . . . . . . . . . . . . . . . Fl_Repeat_Button.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Return_Button.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_RGB_Image.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Roller.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Round_Button.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Round_Clock.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Scroll.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Scrollbar.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Secret_Input.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Select_Browser.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Shared_Image.H Fl_Shared_Image class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

211 . . . . . . . . . . . . . . . . . . . . ??

. 965 . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . 965 . ?? . ?? . ?? . ?? . ??

. . 965 . . . . . . . 966 . ?? . ?? . ?? . ?? . ??

. . 966 . . ?? . . . . . . . . . . . . . . . . . 967 . ?? . ?? . ?? . ?? . 967 . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ??

. . 967

212

File Index

_show_colormap.H The _show_colormap() function hides the implementation classes used to provide the popup window and color selection mechanism . . . . . . . . . . . . . . . . . . . . . _show_input.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Simple_Counter.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Single_Window.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Slider.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Spinner.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Sys_Menu_Bar.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Table.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Table_Row.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Tabs.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Text_Buffer.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Text_Display.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Text_Editor.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Tile.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Tiled_Image.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Timer.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Toggle_Button.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Toggle_Light_Button.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Toggle_Round_Button.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Tooltip.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Tree.H This le contains the denitions of the Fl_Tree class . . . . . . . . . . . . . . . . . . Fl_Tree_Item.H This le contains the denitions for Fl_Tree_Item . . . . . . . . . . . . . . . . . . . Fl_Tree_Item_Array.H This le denes a class that manages an array of Fl_Tree_Item pointers . . . . . . . . Fl_Tree_Prefs.H This le contains the denitions for Fl_Trees preferences . . . . . . . . . . . . . . . _types.h This le contains simple "C"-style type denitions . . . . . . . . . . . . . . . . . . . _utf8.h Header for Unicode and UTF8 chracter handling . . . . . . . . . . . . . . . . . . . . Fl_Valuator.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Value_Input.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Value_Output.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Value_Slider.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . _vertex.cxx Portable drawing code for drawing arbitrary shapes with simple 2D transformations . Fl_Widget.H Fl_Widget, Fl_Label classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Window.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_Wizard.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_XBM_Image.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_XColor.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fl_XPM_Image.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . string.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . forms.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . freeglut_teapot_data.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . gb2312.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . georgian_academy.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . georgian_ps.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

968 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 969 969 970 970 972 972 ?? ?? ?? ?? 974 974 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

28.1 File List gl.h This le denes wrapper functions for OpenGL in FLTK gl2opengl.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . gl_draw.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . glu.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . glut.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iso8859_1.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iso8859_10.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . iso8859_11.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . iso8859_13.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . iso8859_14.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . iso8859_15.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . iso8859_16.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . iso8859_2.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iso8859_3.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iso8859_4.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iso8859_5.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iso8859_6.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iso8859_7.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iso8859_8.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iso8859_9.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iso8859_9e.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . jisx0201.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . jisx0208.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . jisx0212.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . koi8_c.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . koi8_r.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . koi8_u.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ksc5601.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . mac.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . math.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . mediumarrow.h . . . . . . . . . . . . . . . . . . . . . . . . . . mulelao.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . names.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . print_panel.h . . . . . . . . . . . . . . . . . . . . . . . . . . . slowarrow.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . spacing.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . symbol_.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . tatar_cyr.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . tcvn.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . tis620.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ucs2be.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . utf8.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viscii.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . win32.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ximint.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Xlibint.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Xutf8.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

213

. 975 . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ?? . ??

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

214

File Index

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 29

Module Documentation
29.1 Callback function typedefs

Typedefs dened in <FL/Fl.H> for callback or handler functions passed as function parameters.

Typedefs
typedef void( Fl_Abort_Handler )(const char format,...)
Signature of set_abort functions passed as parameters.

typedef int( Fl_Args_Handler )(int argc, char argv, int &i)


Signature of args functions passed as parameters.

typedef void( Fl_Atclose_Handler )(Fl_Window window, void data)


Signature of set_atclose functions passed as parameters.

typedef void( Fl_Awake_Handler )(void data)


Signature of some wakeup callback functions passed as parameters.

typedef void( Fl_Box_Draw_F )(int x, int y, int w, int h, Fl_Color color)


Signature of some box drawing functions passed as parameters.

typedef int( Fl_Event_Dispatch )(int event, Fl_Window w)


Signature of event_dispatch functions passed as parameters.

typedef int( Fl_Event_Handler )(int event)


Signature of add_handler functions passed as parameters.

typedef void( Fl_FD_Handler )(int fd, void data)


Signature of add_fd functions passed as parameters.

typedef void( Fl_Idle_Handler )(void data)


Signature of add_idle callback functions passed as parameters.

typedef void( Fl_Label_Draw_F )(const Fl_Label label, int x, int y, int w, int h, Fl_Align align)
Signature of some label drawing functions passed as parameters.

typedef void( Fl_Label_Measure_F )(const Fl_Label label, int &width, int &height)
Signature of some label measurement functions passed as parameters.

typedef void( Fl_Old_Idle_Handler )()


Signature of set_idle callback functions passed as parameters.

typedef void( Fl_Timeout_Handler )(void data)


Signature of some timeout callback functions passed as parameters.

216

Module Documentation

29.1.1

Detailed Description

Typedefs dened in <FL/Fl.H> for callback or handler functions passed as function parameters. FLTK uses callback functions as parameters for some function calls, e.g. to set up global event handlers (Fl::add_handler()), to add a timeout handler (Fl::add_timeout()), and many more. The typedefs dened in this group describe the function parameters used to set up or clear the callback functions and should also be referenced to dene the callback function to handle such events in the users code. See also Fl::add_handler(), Fl::add_timeout(), Fl::repeat_timeout(), Fl::remove_timeout() and others

29.1.2
29.1.2.1

Typedef Documentation
typedef int( Fl_Event_Dispatch)(int event, Fl_Window w)

Signature of event_dispatch functions passed as parameters. See also Fl::event_dispatch(Fl_Event_Dispatch)

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.2 Windows handling functions

217

29.2

Windows handling functions

Windows and standard dialogs handling declared in <FL/Fl.H>

Functions
static void Fl::default_atclose (Fl_Window , void )
Default callback for window widgets.

static Fl_Window Fl::rst_window ()


Returns the rst top-level window in the list of shown() windows.

static void Fl::rst_window (Fl_Window )


Sets the window that is returned by rst_window().

static Fl_Window Fl::grab ()


Returns the window that currently receives all events.

static void Fl::grab (Fl_Window )


Selects the window to grab.

static Fl_Window Fl::modal ()


Returns the top-most modal() window currently shown.

static Fl_Window Fl::next_window (const Fl_Window )


Returns the next top-level window in the list of shown() windows.

static void Fl::set_abort (Fl_Abort_Handler f)


For back compatibility, sets the void Fl::fatal handler callback.

static void Fl::set_atclose (Fl_Atclose_Handler f)


For back compatibility, sets the Fl::atclose handler callback.

Variables
static void( Fl::atclose )(Fl_Window , void ) = default_atclose
Back compatibility: default window callback handler.

29.2.1

Detailed Description

Windows and standard dialogs handling declared in <FL/Fl.H>

29.2.2
29.2.2.1

Function Documentation
void Fl::default atclose ( Fl_Window window, void v ) [static]

Default callback for window widgets. It hides the window and then calls the default widget callback. 29.2.2.2 Fl_Window Fl::rst window ( ) [static] Returns the rst top-level window in the list of shown() windows. If a modal() window is shown this is the top-most modal window, otherwise it is the most recent window to get an event.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

218 29.2.2.3 void Fl::rst window ( Fl_Window window ) [static]

Module Documentation

Sets the window that is returned by rst_window(). The window is removed from wherever it is in the list and inserted at the top. This is not done if Fl::modal() is on or if the window is not shown(). Because the rst window is used to set the "parent" of modal windows, this is often useful. 29.2.2.4 static Fl_Window Fl::grab ( ) [inline, static]

Returns the window that currently receives all events. Returns The window that currently receives all events, or NULL if event grabbing is currently OFF.

29.2.2.5

void Fl::grab ( Fl_Window win ) [static]

Selects the window to grab. This is used when pop-up menu systems are active. Send all events to the passed window no matter where the pointer or focus is (including in other programs). The window does not have to be shown() , this lets the handle() method of a "dummy" window override all event handling and allows you to map and unmap a complex set of windows (under both X and WIN32 some window must be mapped because the system interface needs a window id). If grab() is on it will also affect show() of windows by doing system-specic operations (on X it turns on override-redirect). These are designed to make menus popup reliably and faster on the system. To turn off grabbing do Fl::grab(0). Be careful that your program does not enter an innite loop while grab() is on. On X this will lock up your screen! To avoid this potential lockup, all newer operating systems seem to limit mouse pointer grabbing to the time during which a mouse button is held down. Some OSs may not support grabbing at all. 29.2.2.6 static Fl_Window Fl::modal ( ) [inline, static]

Returns the top-most modal() window currently shown. This is the most recently shown() window with modal() true, or NULL if there are no modal() windows shown(). The modal() window has its handle() method called for all events, and no other windows will have handle() called (grab() overrides this). 29.2.2.7 Fl_Window Fl::next window ( const Fl_Window window ) [static] Returns the next top-level window in the list of shown() windows. You can use this call to iterate through all the windows that are shown(). Parameters in

window must be shown and not NULL

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.2 Windows handling functions 29.2.2.8 static void Fl::set atclose ( Fl_Atclose_Handler f ) [inline, static]

219

For back compatibility, sets the Fl::atclose handler callback. You can now simply change the callback for the window instead. See also Fl_Window::callback(Fl_Callback)

29.2.3
29.2.3.1

Variable Documentation
void( Fl::atclose)(Fl_Window , void ) = default atclose [static]

Back compatibility: default window callback handler. See also Fl::set_atclose()

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

220

Module Documentation

29.3

Events handling functions

Fl class events handling API declared in <FL/Fl.H>

Functions
static void Fl::add_handler (Fl_Event_Handler h)
Install a function to parse unrecognized events.

static Fl_Widget Fl::belowmouse ()


Gets the widget that is below the mouse.

static void Fl::belowmouse (Fl_Widget )


Sets the widget that is below the mouse.

static int Fl::compose (int &del)


Any text editing widget should call this for each FL_KEYBOARD event.

static void Fl::compose_reset ()


If the user moves the cursor, be sure to call Fl::compose_reset().

static int Fl::event ()


Returns the last event that was processed.

static int Fl::event_alt ()


Returns non-zero if the Alt key is pressed.

static int Fl::event_button ()


Gets which particular mouse button caused the current event.

static int Fl::event_button1 ()


Returns non-zero if mouse button 1 is currently held down.

static int Fl::event_button2 ()


Returns non-zero if button 2 is currently held down.

static int Fl::event_button3 ()


Returns non-zero if button 3 is currently held down.

static int Fl::event_buttons ()


Returns the mouse buttons state bits; if non-zero, then at least one button is pressed now.

static int Fl::event_clicks ()


Returns non zero if we had a double click event.

static void Fl::event_clicks (int i)


Manually sets the number returned by Fl::event_clicks().

static int Fl::event_command ()


Returns non-zero if the FL_COMMAND key is pressed, either FL_CTRL or on OSX FL_META.

static int Fl::event_ctrl ()


Returns non-zero if the Control key is pressed.

static void Fl::event_dispatch (Fl_Event_Dispatch d)


Set a new event dispatch function.

static Fl_Event_Dispatch Fl::event_dispatch ()


Return the current event dispatch function.

static int Fl::event_dx ()


Returns the current horizontal mouse scrolling associated with the FL_MOUSEWHEEL event.

static int Fl::event_dy ()


Returns the current vertical mouse scrolling associated with the FL_MOUSEWHEEL event.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.3 Events handling functions static int Fl::event_inside (int, int, int, int)
Returns whether or not the mouse event is inside the given rectangle.

221

static int Fl::event_inside (const Fl_Widget )


Returns whether or not the mouse event is inside a given child widget.

static int Fl::event_is_click ()


Returns non-zero if the mouse has not moved far enough and not enough time has passed since the last FL_PUSH or FL_KEYBOARD event for it to be considered a "drag" rather than a "click".

static void Fl::event_is_click (int i)


Clears the value returned by Fl::event_is_click().

static int Fl::event_key ()


Gets which key on the keyboard was last pushed.

static int Fl::event_key (int key)


Returns true if the given key was held down (or pressed) during the last event.

static int Fl::event_length ()


Returns the length of the text in Fl::event_text().

static int Fl::event_original_key ()


Returns the keycode of the last key event, regardless of the NumLock state.

static int Fl::event_shift ()


Returns non-zero if the Shift key is pressed.

static int Fl::event_state ()


This is a biteld of what shift states were on and what mouse buttons were held down during the most recent event.

static int Fl::event_state (int i)


See int event_state()

static const char Fl::event_text ()


Returns the text associated with the current event, including FL_PASTE or FL_DND_RELEASE events.

static int Fl::event_x ()


Returns the mouse position of the event relative to the Fl_Window it was passed to.

static int Fl::event_x_root ()


Returns the mouse position on the screen of the event.

static int Fl::event_y ()


Returns the mouse position of the event relative to the Fl_Window it was passed to.

static int Fl::event_y_root ()


Returns the mouse position on the screen of the event.

static Fl_Widget Fl::focus ()


Gets the current Fl::focus() widget.

static void Fl::focus (Fl_Widget )


Sets the widget that will receive FL_KEYBOARD events.

static int Fl::get_key (int key)


Returns true if the given key is held down now.

static void Fl::get_mouse (int &, int &)


Return where the mouse is on the screen by doing a round-trip query to the server.

static int Fl::handle (int, Fl_Window )


Handle events from the window system.

static int Fl::handle_ (int, Fl_Window )


Handle events from the window system.

static Fl_Widget Fl::pushed ()


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

222
Gets the widget that is being pushed.

Module Documentation

static void Fl::pushed (Fl_Widget )


Sets the widget that is being pushed.

static void Fl::remove_handler (Fl_Event_Handler h)


Removes a previously added event handler.

static int Fl::test_shortcut (Fl_Shortcut)


Tests the current event, which must be an FL_KEYBOARD or FL_SHORTCUT, against a shortcut value (described in Fl_Button).

Variables
const char const _eventnames [ ]
This is an array of event names you can use to convert event numbers into names.

const char const _fontnames [ ]


This is an array of font names you can use to convert font numbers into names.

29.3.1

Detailed Description

Fl class events handling API declared in <FL/Fl.H>

29.3.2
29.3.2.1

Function Documentation
void Fl::add handler ( Fl_Event_Handler ha ) [static]

Install a function to parse unrecognized events. If FLTK cannot gure out what to do with an event, it calls each of these functions (most recent rst) until one of them returns non-zero. If none of them returns non-zero then the event is ignored. Events that cause this to be called are: FL_SHORTCUT events that are not recognized by any widget. This lets you provide global shortcut keys. System events that FLTK does not recognize. See _xevent. Some other events when the widget FLTK selected returns zero from its handle() method. Exactly which ones may change in future versions, however. See also Fl::remove_handler(Fl_Event_Handler) Fl::event_dispatch(Fl_Event_Dispatch d) Fl::handle(int, Fl_Window)

29.3.2.2

static Fl_Widget Fl::belowmouse ( ) [inline, static]

Gets the widget that is below the mouse. See also belowmouse(Fl_Widget)

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.3 Events handling functions 29.3.2.3 void Fl::belowmouse ( Fl_Widget o ) [static]

223

Sets the widget that is below the mouse. This is for highlighting buttons. It is not used to send FL_PUSH or FL_MOVE directly, for several obscure reasons, but those events typically go to this widget. This is also the rst widget tried for FL_SHORTCUT events. If you change the belowmouse widget, the previous one and all parents (that dont contain the new widget) are sent FL_LEAVE events. Changing this does not send FL_ENTER to this or any widget, because sending FL_ENTER is supposed to test if the widget wants the mouse (by it returning non-zero from handle()). 29.3.2.4 int Fl::compose ( int & del ) [static]

Any text editing widget should call this for each FL_KEYBOARD event. Use of this function is very simple. If true is returned, then it has modied the Fl::event_text() and Fl::event_length() to a set of bytes to insert (it may be of zero length!). In will also set the "del" parameter to the number of bytes to the left of the cursor to delete, this is used to delete the results of the previous call to Fl::compose(). If false is returned, the keys should be treated as function keys, and del is set to zero. You could insert the text anyways, if you dont know what else to do. Though the current implementation returns immediately, future versions may take quite awhile, as they may pop up a window or do other user-interface things to allow characters to be selected. 29.3.2.5 void Fl::compose reset ( ) [static]

If the user moves the cursor, be sure to call Fl::compose_reset(). The next call to Fl::compose() will start out in an initial state. In particular it will not set "del" to non-zero. This call is very fast so it is ok to call it many times and in many places. 29.3.2.6 static int Fl::event ( ) [inline, static]

Returns the last event that was processed. This can be used to determine if a callback is being done in response to a keypress, mouse click, etc. 29.3.2.7 static int Fl::event alt ( ) [inline, static]

Returns non-zero if the Alt key is pressed. 29.3.2.8 static int Fl::event button ( ) [inline, static]

Gets which particular mouse button caused the current event. This returns garbage if the most recent event was not a FL_PUSH or FL_RELEASE event.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

224 Return values FL_LEFT_MOUSE FL_MIDDLE_MOUSE FL_RIGHT_MOUSE.

Module Documentation

See also Fl::event_buttons()

29.3.2.9

static int Fl::event button1 ( ) [inline, static]

Returns non-zero if mouse button 1 is currently held down. For more details, see Fl::event_buttons(). 29.3.2.10 static int Fl::event button2 ( ) [inline, static]

Returns non-zero if button 2 is currently held down. For more details, see Fl::event_buttons(). 29.3.2.11 static int Fl::event button3 ( ) [inline, static]

Returns non-zero if button 3 is currently held down. For more details, see Fl::event_buttons(). 29.3.2.12 static int Fl::event buttons ( ) [inline, static]

Returns the mouse buttons state bits; if non-zero, then at least one button is pressed now. This function returns the button state at the time of the event. During an FL_RELEASE event, the state of the released button will be 0. To nd out, which button caused an FL_RELEASE event, you can use Fl::event_button() instead. Returns a bit mask value like { [FL_BUTTON1] | [FL_BUTTON2] | [FL_BUTTON3] }

29.3.2.13

static int Fl::event clicks ( ) [inline, static]

Returns non zero if we had a double click event. Return values Non-zero if the most recent FL_PUSH or FL_KEYBOARD was a "double click". N-1 for N clicks. A double click is counted if the same button is pressed again while event_is_click() is true.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.3 Events handling functions 29.3.2.14 static void Fl::event clicks ( int i ) [inline, static]

225

Manually sets the number returned by Fl::event_clicks(). This can be used to set it to zero so that later code does not think an item was double-clicked. Parameters in

i corresponds to no double-click if 0, i+1 mouse clicks otherwise

See also int event_clicks()

29.3.2.15

static int Fl::event command ( ) [inline, static]

Returns non-zero if the FL_COMMAND key is pressed, either FL_CTRL or on OSX FL_META. 29.3.2.16 static int Fl::event ctrl ( ) [inline, static]

Returns non-zero if the Control key is pressed. 29.3.2.17 void Fl::event dispatch ( Fl_Event_Dispatch d ) [static]

Set a new event dispatch function. The event dispatch function is called after native events are converted to FLTK events, but before they are handled by FLTK. If the dispatch function Fl_Event_Dispatch d is set, it is up to the dispatch function to call Fl::handle_(int, Fl_Window) or to ignore the event. The dispatch function itself must return 0 if it ignored the event, or non-zero if it used the event. If you call Fl::handle_(), then this will return the correct value. The event dispatch can be used to handle exceptions in FLTK events and callbacks before they reach the native event handler:
int myHandler(int e, Fl_Window *w) { try { return Fl::handle_(e, w); } catch () { ... } } main() { Fl::event_dispatch(myHandler); ... Fl::run(); }

Parameters d new dispatch function, or NULL

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

226 See also Fl::add_handler(Fl_Event_Handler) Fl::handle(int, Fl_Window) Fl::handle_(int, Fl_Window)

Module Documentation

29.3.2.18

static int Fl::event dx ( ) [inline, static]

Returns the current horizontal mouse scrolling associated with the FL_MOUSEWHEEL event. Right is positive. 29.3.2.19 static int Fl::event dy ( ) [inline, static]

Returns the current vertical mouse scrolling associated with the FL_MOUSEWHEEL event. Down is positive. 29.3.2.20 int Fl::event inside ( int xx, int yy, int ww, int hh ) [static]

Returns whether or not the mouse event is inside the given rectangle. Returns non-zero if the current Fl::event_x() and Fl::event_y() put it inside the given arbitrary bounding box. You should always call this rather than doing your own comparison so you are consistent about edge effects. To nd out, whether the event is inside a child widget of the current window, you can use Fl::event_inside(const Fl_Widget ). Parameters in

xx,yy,ww,hh bounding box

Returns non-zero, if mouse event is inside

29.3.2.21

int Fl::event inside ( const Fl_Widget o ) [static]

Returns whether or not the mouse event is inside a given child widget. Returns non-zero if the current Fl::event_x() and Fl::event_y() put it inside the given child widgets bounding box. This method can only be used to check whether the mouse event is inside a child widget of the window that handles the event, and there must not be an intermediate subwindow (i.e. the widget must not be inside a subwindow of the current window). However, it is valid if the widget is inside a nested Fl_Group. You must not use it with the window itself as the o argument in a windows handle() method.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.3 Events handling functions Note

227

The mentioned restrictions are necessary, because this method does not transform coordinates of child widgets, and thus the given widget o must be within the same window that is handling the current event. Otherwise the results are undened. You should always call this rather than doing your own comparison so you are consistent about edge effects. See also Fl::event_inside(int, int, int, int)

Parameters in

o child widget to be tested

Returns non-zero, if mouse event is inside the widget

29.3.2.22

static int Fl::event is click ( ) [inline, static]

Returns non-zero if the mouse has not moved far enough and not enough time has passed since the last FL_PUSH or FL_KEYBOARD event for it to be considered a "drag" rather than a "click". You can test this on FL_DRAG, FL_RELEASE, and FL_MOVE events.

29.3.2.23

static void Fl::event is click ( int i ) [inline, static]

Clears the value returned by Fl::event_is_click(). Useful to prevent the next click from being counted as a double-click or to make a popup menu pick an item with a single click. Dont pass non-zero to this.

29.3.2.24

static int Fl::event key ( ) [inline, static]

Gets which key on the keyboard was last pushed. The returned integer key code is not necessarily a text equivalent for the keystroke. For instance: if someone presses 5 on the numeric keypad with numlock on, Fl::event_key() may return the key code for this key, and NOT the character 5. To always get the 5, use Fl::event_text() instead. Returns an integer key code, or 0 if the last event was not a key press or release.

See also int event_key(int), event_text(), compose(int&).

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

228 29.3.2.25 int Fl::event key ( int key ) [static]

Module Documentation

Returns true if the given key was held down (or pressed) during the last event. This is constant until the next event is read from the server. Fl::get_key(int) returns true if the given key is held down now. Under X this requires a round-trip to the server and is much slower than Fl::event_key(int). Keys are identied by the unshifted values. FLTK denes a set of symbols that should work on most modern machines for every key on the keyboard: All keys on the main keyboard producing a printable ASCII character use the value of that ASCII character (as though shift, ctrl, and caps lock were not on). The space bar is 32. All keys on the numeric keypad producing a printable ASCII character use the value of that ASCII character plus FL_KP. The highest possible value is FL_KP_Last so you can range-check to see if something is on the keypad. All numbered function keys use the number on the function key plus FL_F. The highest possible number is FL_F_Last, so you can range-check a value. Buttons on the mouse are considered keys, and use the button number (where the left button is 1) plus FL_Button. All other keys on the keypad have a symbol: FL_Escape, FL_BackSpace, FL_Tab, FL_Enter, FL_Print, FL_Scroll_Lock, FL_Pause, FL_Insert, FL_Home, FL_Page_Up, FL_Delete, FL_End, FL_Page_Down, FL_Left, FL_Up, FL_Right, FL_Down, FL_Shift_L, FL_Shift_R, FL_Control_L, FL_Control_R, FL_Caps_Lock, FL_Alt_L, FL_Alt_R, FL_Meta_L, FL_Meta_R, FL_Menu, FL_Num_Lock, FL_KP_Enter. Be careful not to confuse these with the very similar, but all-caps, symbols used by Fl::event_state(). On X Fl::get_key(FL_Button+n) does not work. On WIN32 Fl::get_key(FL_KP_Enter) and Fl::event_key(FL_KP_Enter) do not work.

29.3.2.26

static int Fl::event length ( ) [inline, static]

Returns the length of the text in Fl::event_text(). There will always be a nul at this position in the text. However there may be a nul before that if the keystroke translates to a nul character or you paste a nul character.

29.3.2.27

static int Fl::event original key ( ) [inline, static]

Returns the keycode of the last key event, regardless of the NumLock state. If NumLock is deactivated, FLTK translates events from the numeric keypad into the corresponding arrow key events. event_key() returns the translated key code, whereas event_original_key() returns the keycode before NumLock translation.

29.3.2.28

static int Fl::event shift ( ) [inline, static]

Returns non-zero if the Shift key is pressed.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.3 Events handling functions 29.3.2.29 static int Fl::event state ( ) [inline, static]

229

This is a biteld of what shift states were on and what mouse buttons were held down during the most recent event. The second version returns non-zero if any of the passed bits are turned on. The legal bits are: FL_SHIFT FL_CAPS_LOCK FL_CTRL FL_ALT FL_NUM_LOCK FL_META FL_SCROLL_LOCK FL_BUTTON1 FL_BUTTON2 FL_BUTTON3 X servers do not agree on shift states, and FL_NUM_LOCK, FL_META, and FL_SCROLL_LOCK may not work. The values were selected to match the XFree86 server on Linux. In addition there is a bug in the way X works so that the shift state is not correctly reported until the rst event after the shift key is pressed or released.

29.3.2.30

static const char Fl::event text ( ) [inline, static]

Returns the text associated with the current event, including FL_PASTE or FL_DND_RELEASE events. This can be used in response to FL_KEYUP, FL_KEYDOWN, FL_PASTE, FL_DND_RELEASE. When responding to FL_KEYUP/FL_KEYDOWN, use this function instead of Fl::event_key() to get the text equivalent of keystrokes suitable for inserting into strings and text widgets. The returned string is guaranteed to be be NULL terminated. However, see Fl::event_length() for the actual length of the string, in case the string itself contains NULLs that are part of the text data. Returns A NULL terminated text string equivalent of the last keystroke.

29.3.2.31

static int Fl::event x root ( ) [inline, static]

Returns the mouse position on the screen of the event. To nd the absolute position of an Fl_Window on the screen, use the difference between event_x_root(),event_y_root() and event_x(),event_y().
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

230 29.3.2.32 static int Fl::event y root ( ) [inline, static]

Module Documentation

Returns the mouse position on the screen of the event. To nd the absolute position of an Fl_Window on the screen, use the difference between event_x_root(),event_y_root() and event_x(),event_y(). 29.3.2.33 static Fl_Widget Fl::focus ( ) [inline, static]

Gets the current Fl::focus() widget. See also Fl::focus(Fl_Widget)

29.3.2.34

void Fl::focus ( Fl_Widget o ) [static]

Sets the widget that will receive FL_KEYBOARD events. If you change Fl::focus(), the previous widget and all parents (that dont contain the new widget) are sent FL_UNFOCUS events. Changing the focus does not send FL_FOCUS to this or any widget, because sending FL_FOCUS is supposed to test if the widget wants the focus (by it returning non-zero from handle()). See also Fl_Widget::take_focus()

29.3.2.35

int Fl::get key ( int key ) [static]

Returns true if the given key is held down now. Under X this requires a round-trip to the server and is much slower than Fl::event_key(int). See also event_key(int)

29.3.2.36

static void Fl::get mouse ( int & , int & ) [static]

Return where the mouse is on the screen by doing a round-trip query to the server. You should use Fl::event_x_root() and Fl::event_y_root() if possible, but this is necessary if you are not sure if a mouse event has been processed recently (such as to position your rst window). If the display is not open, this will open it. 29.3.2.37 int Fl::handle ( int e, Fl_Window window ) [static]

Handle events from the window system. This is called from the native event dispatch after native events have been converted to FLTK notation. This function calls Fl::handle_(int, Fl_Window) unless the user sets a dispatch function. If a user dispatch function is set, the user must make sure that Fl::handle_() is called, or the event will be ignored.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.3 Events handling functions Parameters e the event type (Fl::event_number() is not yet set) window the window that caused this event

231

Returns 0 if the event was not handled See also Fl::add_handler(Fl_Event_Handler) Fl::event_dispatch(Fl_Event_Dispatch)

29.3.2.38

int Fl::handle ( int e, Fl_Window window ) [static]

Handle events from the window system. This function is called from the native event dispatch, unless the user sets another dispatch function. In that case, the user dispatch function must decide when to call Fl::handle_(int, Fl_Window) Parameters e the event type (Fl::event_number() is not yet set) window the window that caused this event

Returns 0 if the event was not handled See also Fl::event_dispatch(Fl_Event_Dispatch)

29.3.2.39

static Fl_Widget Fl::pushed ( ) [inline, static]

Gets the widget that is being pushed. See also void pushed(Fl_Widget)

29.3.2.40

void Fl::pushed ( Fl_Widget o ) [static]

Sets the widget that is being pushed. FL_DRAG or FL_RELEASE (and any more FL_PUSH) events will be sent to this widget. If you change the pushed widget, the previous one and all parents (that dont contain the new widget) are sent FL_RELEASE events. Changing this does not send FL_PUSH to this or any widget, because sending FL_PUSH is supposed to test if the widget wants the mouse (by it returning non-zero from handle()).
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

232 29.3.2.41 void Fl::remove handler ( Fl_Event_Handler ha ) [static]

Module Documentation

Removes a previously added event handler. See also Fl::handle(int, Fl_Window)

29.3.2.42

int Fl::test shortcut ( Fl_Shortcut shortcut ) [static]

Tests the current event, which must be an FL_KEYBOARD or FL_SHORTCUT, against a shortcut value (described in Fl_Button). Not to be confused with Fl_Widget::test_shortcut(). Returns non-zero if there is a match.

29.3.3
29.3.3.1

Variable Documentation
const char const _eventnames[ ]

Initial value:

{ "FL_NO_EVENT", "FL_PUSH", "FL_RELEASE", "FL_ENTER", "FL_LEAVE", "FL_DRAG", "FL_FOCUS", "FL_UNFOCUS", "FL_KEYDOWN", "FL_KEYUP", "FL_CLOSE", "FL_MOVE", "FL_SHORTCUT", "FL_DEACTIVATE", "FL_ACTIVATE", "FL_HIDE", "FL_SHOW", "FL_PASTE", "FL_SELECTIONCLEAR", "FL_MOUSEWHEEL", "FL_DND_ENTER", "FL_DND_DRAG", "FL_DND_LEAVE", "FL_DND_RELEASE", }

This is an array of event names you can use to convert event numbers into names. The array gets dened inline wherever your #include <FL/names.h> appears. Example:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.3 Events handling functions


#include <FL/names.h> // array will be defined here int MyClass::handle(int e) { printf("Event was %s (%d)\n", fl_eventnames[e], e); // ..resulting output might be e.g. "Event was FL_PUSH (1)".. [..] }

233

29.3.3.2

const char const _fontnames[ ]

Initial value:

{ "FL_HELVETICA", "FL_HELVETICA_BOLD", "FL_HELVETICA_ITALIC", "FL_HELVETICA_BOLD_ITALIC", "FL_COURIER", "FL_COURIER_BOLD", "FL_COURIER_ITALIC", "FL_COURIER_BOLD_ITALIC", "FL_TIMES", "FL_TIMES_BOLD", "FL_TIMES_ITALIC", "FL_TIMES_BOLD_ITALIC", "FL_SYMBOL", "FL_SCREEN", "FL_SCREEN_BOLD", "FL_ZAPF_DINGBATS", }

This is an array of font names you can use to convert font numbers into names. The array gets dened inline wherever your #include <FL/names.h> appears. Example:
#include <FL/names.h> // array will be defined here int MyClass::my_callback(Fl_Widget *w, void*) { int fnum = w->labelfont(); // Resulting output might be e.g. "Labels font is FL_HELVETICA (0)" printf("Labels font is %s (%d)\n", fl_fontnames[fnum], fnum); // ..resulting output might be e.g. "Labels font is FL_HELVETICA (0)".. [..] }

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

234

Module Documentation

29.4

Selection & Clipboard functions

FLTK global copy/cut/paste functions declared in <FL/Fl.H>

Functions
static void Fl::copy (const char stuff, int len, int destination=0)
Copies the data pointed to by stuff to the selection buffer (destination is 0) or the clipboard (destination is 1); len is the number of relevant bytes in stuff.

static int Fl::dnd ()


Initiate a Drag And Drop operation.

static void Fl::paste (Fl_Widget &receiver, int source)


Pastes the data from the selection buffer (source is 0) or the clipboard (source is 1) into receiver.

static void Fl::paste (Fl_Widget &receiver)


Backward compatibility only.

static void Fl::selection (Fl_Widget &owner, const char , int len)


Changes the current selection.

static Fl_Widget Fl::selection_owner ()


back-compatibility only: Gets the widget owning the current selection

static void Fl::selection_owner (Fl_Widget )


Back-compatibility only: The single-argument call can be used to move the selection to another widget or to set the owner to NULL, without changing the actual text of the selection.

29.4.1

Detailed Description

FLTK global copy/cut/paste functions declared in <FL/Fl.H>

29.4.2
29.4.2.1

Function Documentation
static void Fl::copy ( const char stuff, int len, int destination = 0 ) [static]

Copies the data pointed to by stuff to the selection buffer (destination is 0) or the clipboard (destination is 1); len is the number of relevant bytes in stuff. The selection buffer is used for middle-mouse pastes and for drag-and-drop selections. The clipboard is used for traditional copy/cut/paste operations.

29.4.2.2

int Fl::dnd ( ) [static]

Initiate a Drag And Drop operation. The selection buffer should be lled with relevant data before calling this method. FLTK will then initiate the system wide drag and drop handling. Dropped data will be marked as text. Create a selection rst using: Fl::copy(const char stuff, int len, 0)
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.4 Selection & Clipboard functions 29.4.2.3 static void Fl::paste ( Fl_Widget & receiver, int source ) [static]

235

Pastes the data from the selection buffer (source is 0) or the clipboard (source is 1) into receiver. Set things up so the receiver widget will be called with an FL_PASTE event some time in the future with the data from the specied source in Fl::event_text() and the number of characters in Fl::event_length(). The receiver should be prepared to be called directly by this, or for it to happen later, or possibly not at all. This allows the window system to take as long as necessary to retrieve the paste buffer (or even to screw up completely) without complex and error-prone synchronization code in FLTK. The selection buffer is used for middle-mouse pastes and for drag-and-drop selections. The clipboard is used for traditional copy/cut/paste operations. 29.4.2.4 void Fl::paste ( Fl_Widget & receiver ) [static]

Backward compatibility only. This calls Fl::paste(receiver, 0); See also Fl::paste(Fl_Widget &receiver, int clipboard)

29.4.2.5

void Fl::selection ( Fl_Widget & owner, const char text, int len ) [static]

Changes the current selection. The block of text is copied to an internal buffer by FLTK (be careful if doing this in response to an FL_PASTE as this may be the same buffer returned by event_text()). The selection_owner() widget is set to the passed owner. 29.4.2.6 static Fl_Widget Fl::selection owner ( ) [inline, static]

back-compatibility only: Gets the widget owning the current selection See also Fl_Widget selection_owner(Fl_Widget)

29.4.2.7

void Fl::selection owner ( Fl_Widget owner ) [static]

Back-compatibility only: The single-argument call can be used to move the selection to another widget or to set the owner to NULL, without changing the actual text of the selection. FL_SELECTIONCLEAR is sent to the previous selection owner, if any. Copying the buffer every time the selection is changed is obviously wasteful, especially for large selections. An interface will probably be added in a future version to allow the selection to be made by a callback function. The current interface will be emulated on top of this.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

236

Module Documentation

29.5

Screen functions

global screen functions declared in <FL/Fl.H>

Functions
static int Fl::h ()
Returns the height of the screen work area in pixels.

static int Fl::screen_count ()


Gets the number of available screens.

static void Fl::screen_dpi (oat &h, oat &v, int n=0)


Gets the screen resolution in dots-per-inch for the given screen.

static void Fl::screen_xywh (int &X, int &Y, int &W, int &H)
Gets the bounding box of a screen that contains the mouse pointer.

static void Fl::screen_xywh (int &X, int &Y, int &W, int &H, int mx, int my)
Gets the bounding box of a screen that contains the specied screen position mx, my.

static void Fl::screen_xywh (int &X, int &Y, int &W, int &H, int n)
Gets the screen bounding rect for the given screen.

static void Fl::screen_xywh (int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh)
Gets the screen bounding rect for the screen which intersects the most with the rectangle dened by mx, my, mw, mh.

static int Fl::w ()


Returns the width of the screen work area in pixels.

static int Fl::x ()


Returns the origin of the current screen work area, where 0 indicates the left side of the screen.

static int Fl::y ()


Returns the origin of the current screen work area, where 0 indicates the top edge of the screen.

29.5.1

Detailed Description

global screen functions declared in <FL/Fl.H>

29.5.2
29.5.2.1

Function Documentation
static int Fl::h ( ) [static]

Returns the height of the screen work area in pixels. 29.5.2.2 void Fl::screen dpi ( oat & h, oat & v, int n = 0 ) [static]

Gets the screen resolution in dots-per-inch for the given screen. Parameters out in

h,v horizontal and vertical resolution n the screen number (0 to Fl::screen_count() - 1)

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.5 Screen functions See also void screen_xywh(int &x, int &y, int &w, int &h, int mx, int my)

237

29.5.2.3

static void Fl::screen xywh ( int & X, int & Y, int & W, int & H ) [inline, static]

Gets the bounding box of a screen that contains the mouse pointer. Parameters out

X,Y,W,H the corresponding screen bounding box

See also void screen_xywh(int &x, int &y, int &w, int &h, int mx, int my)

29.5.2.4

void Fl::screen xywh ( int & X, int & Y, int & W, int & H, int mx, int my ) [static]

Gets the bounding box of a screen that contains the specied screen position mx, my. Parameters out in

X,Y,W,H the corresponding screen bounding box mx,my the absolute screen position

29.5.2.5

void Fl::screen xywh ( int & X, int & Y, int & W, int & H, int n ) [static]

Gets the screen bounding rect for the given screen. Parameters out in

X,Y,W,H the corresponding screen bounding box n the screen number (0 to Fl::screen_count() - 1)

See also void screen_xywh(int &x, int &y, int &w, int &h, int mx, int my)

29.5.2.6

void Fl::screen xywh ( int & X, int & Y, int & W, int & H, int mx, int my, int mw, int mh ) [static]

Gets the screen bounding rect for the screen which intersects the most with the rectangle dened by mx, my, mw, mh. Parameters out in

X,Y,W,H the corresponding screen bounding box mx,my,mw,mh the rectangle to search for intersection with

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

238 See also void screen_xywh(int &X, int &Y, int &W, int &H, int n)

Module Documentation

29.5.2.7

static int Fl::w ( ) [static]

Returns the width of the screen work area in pixels. 29.5.2.8 static int Fl::x ( ) [static]

Returns the origin of the current screen work area, where 0 indicates the left side of the screen. 29.5.2.9 static int Fl::y ( ) [static]

Returns the origin of the current screen work area, where 0 indicates the top edge of the screen.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.6 Color & Font functions

239

29.6

Color & Font functions

global color, font functions.

Functions
void _color (Fl_Color c)
Sets the color for all subsequent drawing operations.

void _color (int c)


for back compatibility - use _color(Fl_Color c) instead

void _color (uchar r, uchar g, uchar b)


Sets the color for all subsequent drawing operations.

Fl_Color _color ()
Returns the last _color() that was set.

Fl_Color _color_average (Fl_Color color1, Fl_Color color2, oat weight)


Returns the weighted average color between the two given colors.

Fl_Color _contrast (Fl_Color fg, Fl_Color bg)


Returns a color that contrasts with the background color.

int _descent ()
Returns the recommended distance above the bottom of a _height() tall box to draw the text at so it looks centered vertically in that box.

void _font (Fl_Font face, Fl_Fontsize size)


Sets the current font, which is then used in various drawing routines.

Fl_Font _font ()
Returns the face set by the most recent call to _font().

int _height ()
Returns the recommended minimum line spacing for the current font.

FL_EXPORT int _height (int font, int size)


This function returns the actual height of the specied font and size.

Fl_Color _inactive (Fl_Color c)


Returns the inactive, dimmed version of the given color.

FL_EXPORT const char _latin1_to_local (const char t, int n=-1)


Converts text from Windows/X11 latin1 character set to local encoding.

FL_EXPORT const char _local_to_latin1 (const char t, int n=-1)


Converts text from local encoding to Windowx/X11 latin1 character set.

FL_EXPORT const char _local_to_mac_roman (const char t, int n=-1)


Converts text from local encoding to Mac Roman character set.

FL_EXPORT const char _mac_roman_to_local (const char t, int n=-1)


Converts text from Mac Roman character set to local encoding.

FL_EXPORT Fl_Color _show_colormap (Fl_Color oldcol)


Pops up a window to let the user pick a colormap entry.

Fl_Fontsize _size ()
Returns the size set by the most recent call to _font().

FL_EXPORT void _text_extents (const char , int &dx, int &dy, int &w, int &h)
Determines the minimum pixel dimensions of a nul-terminated string.

void _text_extents (const char t, int n, int &dx, int &dy, int &w, int &h)
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

240
Determines the minimum pixel dimensions of a sequence of n characters.

Module Documentation

FL_EXPORT double _width (const char txt)


Returns the typographical width of a nul-terminated string.

double _width (const char txt, int n)


Returns the typographical width of a sequence of n characters.

double _width (unsigned int c)


Returns the typographical width of a single character.

ulong _xpixel (uchar r, uchar g, uchar b)


Returns the X pixel number used to draw the given rgb color.

ulong _xpixel (Fl_Color i)


Returns the X pixel number used to draw the given FLTK color index.

static void Fl::free_color (Fl_Color i, int overlay=0)


Frees the specied color from the colormap, if applicable.

static unsigned Fl::get_color (Fl_Color i)


Returns the RGB value(s) for the given FLTK color index.

static void Fl::get_color (Fl_Color i, uchar &red, uchar &green, uchar &blue)
Returns the RGB value(s) for the given FLTK color index.

static const char Fl::get_font (Fl_Font)


Gets the string for this face.

static const char Fl::get_font_name (Fl_Font, int attributes=0)


Get a human-readable string describing the family of this face.

static int Fl::get_font_sizes (Fl_Font, int &sizep)


Return an array of sizes in sizep.

static void Fl::set_color (Fl_Color, uchar, uchar, uchar)


Sets an entry in the _color index table.

static void Fl::set_color (Fl_Color i, unsigned c)


Sets an entry in the _color index table.

static void Fl::set_font (Fl_Font, const char )


Changes a face.

static void Fl::set_font (Fl_Font, Fl_Font)


Copies one face to another.

static Fl_Font Fl::set_fonts (const char =0)


FLTK will open the display, and add every fonts on the server to the face table.

29.6.1

Detailed Description

global color, font functions. These functions are declared in <FL/Fl.H> or <FL/_draw.H>.

29.6.2
29.6.2.1

Function Documentation
void color ( Fl_Color c ) [inline]

Sets the color for all subsequent drawing operations. For colormapped displays, a color cell will be allocated out of fl_colormap the rst time you use a color. If the colormap lls up then a least-squares algorithm is used to nd the closest color. If no valid graphical context (_gc) is available, the foreground is not set for the current window.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.6 Color & Font functions Parameters in

241

c color

29.6.2.2

void color ( uchar r, uchar g, uchar b ) [inline]

Sets the color for all subsequent drawing operations. The closest possible match to the RGB color is used. The RGB color is used directly on TrueColor displays. For colormap visuals the nearest index in the gray ramp or color cube is used. If no valid graphical context (_gc) is available, the foreground is not set for the current window. Parameters in

r,g,b color components

29.6.2.3 Fl_Color color ( void ) [inline] Returns the last _color() that was set. This can be used for state save/restore. 29.6.2.4 Fl_Color color average ( Fl_Color color1, Fl_Color color2, oat weight ) Returns the weighted average color between the two given colors. The red, green and blue values are averages using the following formula:
color = color1 * weight + color2 * (1 - weight)

Thus, a weight value of 1.0 will return the rst color, while a value of 0.0 will return the second color. Parameters in in

color1,color2 boundary colors weight weighting factor

29.6.2.5 Fl_Color contrast ( Fl_Color fg, Fl_Color bg ) Returns a color that contrasts with the background color. This will be the foreground color if it contrasts sufciently with the background color. Otherwise, returns FL_WHITE or FL_BLACK depending on which color provides the best contrast. Parameters in

fg,bg foreground and background colors

Returns contrasting color

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

242 29.6.2.6 void font ( Fl_Font face, Fl_Fontsize size ) [inline]

Module Documentation

Sets the current font, which is then used in various drawing routines. You may call this outside a draw context if necessary to call _width(), but on X this will open the display. The font is identied by a face and a size. The size of the font is measured in pixels and not "points". Lines should be spaced size pixels apart or more. 29.6.2.7 Fl_Font font ( void ) [inline] Returns the face set by the most recent call to _font(). This can be used to save/restore the font. 29.6.2.8 int height ( ) [inline]

Returns the recommended minimum line spacing for the current font. You can also use the value of size passed to _font() 29.6.2.9 FL EXPORT int height ( int font, int size )

This function returns the actual height of the specied font and size. Normally the font height should always be size, but with the advent of XFT, there are (currently) complexities that seem to only be solved by asking the font what its actual font height is. (See STR#2115) This function was originally undocumented in 1.1.x, and was used only by Fl_Text_Display. Were now documenting it in 1.3.x so that apps that need precise height info can get it with this function. Returns the height of the font in pixels. Todo In the future, when the XFT issues are resolved, this function should simply return the size value.

29.6.2.10

FL EXPORT const char latin1 to local ( const char t, int n = -1 )

Converts text from Windows/X11 latin1 character set to local encoding. Parameters in in Returns pointer to internal buffer containing converted characters

t character string (latin1 encoding) n optional number of characters to convert (default is all)

29.6.2.11

FL EXPORT const char local to latin1 ( const char t, int n = -1 )

Converts text from local encoding to Windowx/X11 latin1 character set.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.6 Color & Font functions Parameters in in

243

t character string (local encoding) n optional number of characters to convert (default is all)

Returns pointer to internal buffer containing converted characters

29.6.2.12

FL EXPORT const char local to mac roman ( const char t, int n = -1 )

Converts text from local encoding to Mac Roman character set. Parameters in in

t character string (local encoding) n optional number of characters to convert (default is all)

Returns pointer to internal buffer containing converted characters

29.6.2.13

FL EXPORT const char mac roman to local ( const char t, int n = -1 )

Converts text from Mac Roman character set to local encoding. Parameters in in

t character string (Mac Roman encoding) n optional number of characters to convert (default is all)

Returns pointer to internal buffer containing converted characters

29.6.2.14

FL EXPORT Fl_Color show colormap ( Fl_Color oldcol )

Pops up a window to let the user pick a colormap entry.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

244

Module Documentation

Figure 29.1: _show_colormap

Parameters in

oldcol color to be highlighted when grid is shown.

Return values Fl_Color value of the chosen colormap entry.

See also Fl_Color_Chooser

29.6.2.15 Fl_Fontsize size ( ) [inline] Returns the size set by the most recent call to _font(). This can be used to save/restore the font. 29.6.2.16 FL EXPORT void text extents ( const char , int & dx, int & dy, int & w, int & h )

Determines the minimum pixel dimensions of a nul-terminated string. Usage: given a string "txt" drawn using _draw(txt, x, y) you would determine its pixel extents on the display using _text_extents(txt, dx, dy, wo, ho) such that a bounding box that exactly ts around the text
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.6 Color & Font functions

245

could be drawn with _rect(x+dx, y+dy, wo, ho). Note the dx, dy values hold the offset of the rst "colored in" pixel of the string, from the draw origin. 29.6.2.17 void text extents ( const char t, int n, int & dx, int & dy, int & w, int & h ) [inline]

Determines the minimum pixel dimensions of a sequence of n characters. See also _text_extents(const char, int& dx, int& dy, int& w, int& h)

29.6.2.18

double width ( unsigned int c ) [inline]

Returns the typographical width of a single character. Note if a valid _gc is NOT found then it uses the rst window gc, or the screen gc if no tk window is available when called.

29.6.2.19 ulong xpixel ( uchar r, uchar g, uchar b ) Returns the X pixel number used to draw the given rgb color. This is the X pixel that _color() would use. Parameters in

r,g,b color components

Returns X pixel number

29.6.2.20 ulong xpixel ( Fl_Color i ) Returns the X pixel number used to draw the given FLTK color index. This is the X pixel that _color() would use. Parameters in

i color index

Returns X pixel number

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

246 29.6.2.21 void Fl::free color ( Fl_Color i, int overlay = 0 ) [static]

Module Documentation

Frees the specied color from the colormap, if applicable. Free color i if used, and clear mapping table entry. If overlay is non-zero then the color is freed from the overlay colormap. Parameters in in

i color index overlay 0 for normal, 1 for overlay color

29.6.2.22

unsigned Fl::get color ( Fl_Color i ) [static]

Returns the RGB value(s) for the given FLTK color index. This form returns the RGB values packed in a 32-bit unsigned integer with the red value in the upper 8 bits, the green value in the next 8 bits, and the blue value in bits 8-15. The lower 8 bits will always be 0. 29.6.2.23 void Fl::get color ( Fl_Color i, uchar & red, uchar & green, uchar & blue ) [static]

Returns the RGB value(s) for the given FLTK color index. This form returns the red, green, and blue values separately in referenced variables. See also unsigned get_color(Fl_Color c) 29.6.2.24 const char Fl::get font ( Fl_Font fnum ) [static]

Gets the string for this face. This string is different for each face. Under X this value is passed to XListFonts to get all the sizes of this face. 29.6.2.25 const char Fl::get font name ( Fl_Font fnum, int attributes = 0 ) [static]

Get a human-readable string describing the family of this face. This is useful if you are presenting a choice to the user. There is no guarantee that each face has a different name. The return value points to a static buffer that is overwritten each call. The integer pointed to by attributes (if the pointer is not zero) is set to zero, FL_BOLD or FL_ITALIC or FL_BOLD | FL_ITALIC. To locate a "family" of fonts, search forward and back for a set with non-zero attributes, these faces along with the face with a zero attribute before them constitute a family. 29.6.2.26 int Fl::get font sizes ( Fl_Font fnum, int & sizep ) [static]

Return an array of sizes in sizep. The return value is the length of this array. The sizes are sorted from smallest to largest and indicate what sizes can be given to _font() that will be matched exactly (_font() will pick the closest size for other sizes). A zero in the rst location of the array indicates a scalable font, where any size works, although the array may list sizes that work "better" than others. Warning: the returned array points at a static buffer that is overwritten each call. Under X this will open the display.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.6 Color & Font functions 29.6.2.27 void Fl::set color ( Fl_Color i, uchar red, uchar green, uchar blue ) [static]

247

Sets an entry in the _color index table. You can set it to any 8-bit RGB color. The color is not allocated until _color(i) is used. 29.6.2.28 void Fl::set color ( Fl_Color i, unsigned c ) [static]

Sets an entry in the _color index table. Set color mapping table entry i to color c. You can set it to any 8-bit RGB color. The color is not allocated until _color(i) is used. Parameters in in

i color index c color

29.6.2.29

void Fl::set font ( Fl_Font fnum, const char name ) [static]

Changes a face. The string pointer is simply stored, the string is not copied, so the string must be in static memory. 29.6.2.30 void Fl::set font ( Fl_Font fnum, Fl_Font from ) [static]

Copies one face to another. 29.6.2.31 Fl_Font Fl::set fonts ( const char xstarname = 0 ) [static] FLTK will open the display, and add every fonts on the server to the face table. It will attempt to put "families" of faces together, so that the normal one is rst, followed by bold, italic, and bold italic. The optional argument is a string to describe the set of fonts to add. Passing NULL will select only fonts that have the ISO8859-1 character set (and are thus usable by normal text). Passing "-" will select all fonts with any encoding as long as they have normal X font names with dashes in them. Passing "" will list every font that exists (on X this may produce some strange output). Other values may be useful but are system dependent. With WIN32 NULL selects fonts with ISO8859-1 encoding and non-NULL selects all fonts. The return value is how many faces are in the table after this is done.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

248

Module Documentation

29.7

Drawing functions

FLTK global graphics and GUI drawing functions.

Denes
#dene _clip _push_clip
Intersects the current clip region with a rectangle and pushes this new region onto the stack (deprecated).

Enumerations
enum { FL_SOLID = 0, FL_DASH = 1, FL_DOT = 2, FL_DASHDOT = 3, FL_DASHDOTDOT = 4, FL_CAP_FLAT = 0x100, FL_CAP_ROUND = 0x200, FL_CAP_SQUARE = 0x300, FL_JOIN_MITER = 0x1000, FL_JOIN_ROUND = 0x2000, FL_JOIN_BEVEL = 0x3000 }

Functions
FL_EXPORT int _add_symbol (const char name, void(drawit)(Fl_Color), int scalable)
Adds a symbol to the system.

void _arc (int x, int y, int w, int h, double a1, double a2)
Draw ellipse sections using integer coordinates.

void _arc (double x, double y, double r, double start, double end)


Adds a series of points to the current path on the arc of a circle.

void _begin_complex_polygon ()
Starts drawing a complex lled polygon.

void _begin_line ()
Starts drawing a list of lines.

void _begin_loop ()
Starts drawing a closed sequence of lines.

void _begin_offscreen (Fl_Offscreen ctx)


Send all subsequent drawing commands to this offscreen buffer.

void _begin_points ()
Starts drawing a list of points.

void _begin_polygon ()
Starts drawing a convex lled polygon.

FL_EXPORT char _can_do_alpha_blending ()


Checks whether platform supports true alpha blending for RGBA images.

FL_EXPORT void _chord (int x, int y, int w, int h, double a1, double a2)
_chord declaration is a place holder - the function does not yet exist

void _circle (double x, double y, double r)


_circle() is equivalent to _arc(x,y,r,0,360), but may be faster.

int _clip_box (int x, int y, int w, int h, int &X, int &Y, int &W, int &H)
Intersects the rectangle with the current clip region and returns the bounding box of the result.

void _clip_region (Fl_Region r)


Replaces the top of the clipping stack with a clipping region of any shape.

Fl_Region _clip_region ()
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.7 Drawing functions


Returns the current clipping region.

249

void _copy_offscreen (int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy)
Copy a rectangular area of the given offscreen buffer into the current drawing destination.

Fl_Offscreen _create_offscreen (int w, int h)


Creation of an offscreen graphics buffer.

FL_EXPORT void _cursor (Fl_Cursor, Fl_Color fg=FL_BLACK, Fl_Color bg=FL_WHITE)


Sets the cursor for the current window to the specied shape and colors.

void _curve (double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3)
Adds a series of points on a Bezier curve to the path.

void _delete_offscreen (Fl_Offscreen ctx)


Deletion of an offscreen graphics buffer.

FL_EXPORT void _draw (const char str, int x, int y)


Draws a nul-terminated string starting at the given location.

FL_EXPORT void _draw (int angle, const char str, int x, int y)
Draws a nul-terminated string starting at the given location and rotating angle degrees counter-clockwise.

void _draw (const char str, int n, int x, int y)


Draws an array of n characters starting at the given location.

void _draw (int angle, const char str, int n, int x, int y)
Draws an array of n characters starting at the given location, rotating angle degrees counter-clockwise.

FL_EXPORT void _draw (const char str, int x, int y, int w, int h, Fl_Align align, Fl_Image img=0, int draw_symbols=1)
Fancy string drawing function which is used to draw all the labels.

FL_EXPORT void _draw (const char str, int x, int y, int w, int h, Fl_Align align, void(callthis)(const char , int, int, int), Fl_Image img=0, int draw_symbols=1)
The same as _draw(const char,int,int,int,int,Fl_Align,Fl_Image,int) with the addition of the callthis parameter, which is a pointer to a text drawing function such as _draw(const char, int, int, int) to do the real work.

FL_EXPORT void _draw_box (Fl_Boxtype, int x, int y, int w, int h, Fl_Color)


Draws a box using given type, position, size and color.

void _draw_image (const uchar buf, int X, int Y, int W, int H, int D=3, int L=0)
Draws an 8-bit per color RGB or luminance image.

void _draw_image (Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D=3)
Draws an image using a callback function to generate image data.

void _draw_image_mono (const uchar buf, int X, int Y, int W, int H, int D=1, int L=0)
Draws a gray-scale (1 channel) image.

FL_EXPORT void _draw_image_mono (Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D=1)
Draws a gray-scale image using a callback function to generate image data.

FL_EXPORT int _draw_pixmap (char const data, int x, int y, Fl_Color=FL_GRAY)


Draw XPM image data, with the top-left corner at the given position.

FL_EXPORT int _draw_pixmap (const char const cdata, int x, int y, Fl_Color=FL_GRAY)
Draw XPM image data, with the top-left corner at the given position.

FL_EXPORT int _draw_symbol (const char label, int x, int y, int w, int h, Fl_Color)
Draw the named symbol in the given rectangle using the given color.

void _end_complex_polygon ()
Ends complex lled polygon, and draws.

void _end_line ()
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

250
Ends list of lines, and draws.

Module Documentation

void _end_loop ()
Ends closed sequence of lines, and draws.

void _end_offscreen ()
Quit sending drawing commands to the current offscreen buffer.

void _end_points ()
Ends list of points, and draws.

void _end_polygon ()
Ends convex lled polygon, and draws.

FL_EXPORT const char _expand_text (const char from, char buf, int maxbuf, double maxw, int &n, double &width, int wrap, int draw_symbols=0)
Copy from to buf, replacing unprintable characters with X and \nnn.

FL_EXPORT void _frame (const char s, int x, int y, int w, int h)


Draws a series of line segments around the given box.

FL_EXPORT void _frame2 (const char s, int x, int y, int w, int h)


Draws a series of line segments around the given box.

void _gap ()
Call _gap() to separate loops of the path.

void _line (int x, int y, int x1, int y1)


Draws a line from (x,y) to (x1,y1)

void _line (int x, int y, int x1, int y1, int x2, int y2)
Draws a line from (x,y) to (x1,y1) and another from (x1,y1) to (x2,y2)

void _line_style (int style, int width=0, char dashes=0)


Sets how to draw lines (the "pen").

void _loop (int x, int y, int x1, int y1, int x2, int y2)
Outlines a 3-sided polygon with lines.

void _loop (int x, int y, int x1, int y1, int x2, int y2, int x3, int y3)
Outlines a 4-sided polygon with lines.

FL_EXPORT void _measure (const char str, int &x, int &y, int draw_symbols=1)
Measure how wide and tall the string will be when printed by the _draw() function with align parameter.

FL_EXPORT int _measure_pixmap (char const data, int &w, int &h)
Get the dimensions of a pixmap.

FL_EXPORT int _measure_pixmap (const char const cdata, int &w, int &h)
Get the dimensions of a pixmap.

void _mult_matrix (double a, double b, double c, double d, double x, double y)


Concatenates another transformation onto the current one.

int _not_clipped (int x, int y, int w, int h)


Does the rectangle intersect the current clip region?

FL_EXPORT unsigned int _old_shortcut (const char s)


Emulation of XForms named shortcuts.

FL_EXPORT void _overlay_clear ()


Erase a selection rectangle without drawing a new one.

FL_EXPORT void _overlay_rect (int x, int y, int w, int h)


Draws a selection rectangle, erasing a previous one by XORing it rst.

void _pie (int x, int y, int w, int h, double a1, double a2)
Draw lled ellipse sections using integer coordinates.

void _point (int x, int y)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.7 Drawing functions


Draws a single pixel at the given coordinates.

251

void _polygon (int x, int y, int x1, int y1, int x2, int y2)
Fills a 3-sided polygon.

void _polygon (int x, int y, int x1, int y1, int x2, int y2, int x3, int y3)
Fills a 4-sided polygon.

void _pop_clip ()
Restores the previous clip region.

void _pop_matrix ()
Restores the current transformation matrix from the stack.

void _push_clip (int x, int y, int w, int h)


Intersects the current clip region with a rectangle and pushes this new region onto the stack.

void _push_matrix ()
Saves the current transformation matrix on the stack.

void _push_no_clip ()
Pushes an empty clip region onto the stack so nothing will be clipped.

FL_EXPORT uchar _read_image (uchar p, int X, int Y, int W, int H, int alpha=0)
Reads an RGB(A) image from the current window or off-screen buffer.

void _rect (int x, int y, int w, int h)


Draws a 1-pixel border inside the given bounding box.

void _rect (int x, int y, int w, int h, Fl_Color c)


Draws with passed color a 1-pixel border inside the given bounding box.

void _rectf (int x, int y, int w, int h)


Colors with current color a rectangle that exactly lls the given bounding box.

void _rectf (int x, int y, int w, int h, Fl_Color c)


Colors with passed color a rectangle that exactly lls the given bounding box.

FL_EXPORT void _rectf (int x, int y, int w, int h, uchar r, uchar g, uchar b)
Colors a rectangle with "exactly" the passed r,g,b color.

FL_EXPORT void _reset_spot (void) void _restore_clip ()


Undoes any clobbering of clip done by your program.

void _rotate (double d)


Concatenates rotation transformation onto the current one.

void _rtl_draw (const char str, int n, int x, int y)


Draws an array of n characters right to left starting at given location.

void _scale (double x, double y)


Concatenates scaling transformation onto the current one.

void _scale (double x)


Concatenates scaling transformation onto the current one.

FL_EXPORT void _scroll (int X, int Y, int W, int H, int dx, int dy, void(draw_area)(void , int, int, int, int), void data)
Scroll a rectangle and draw the newly exposed portions.

FL_EXPORT void _set_spot (int font, int size, int X, int Y, int W, int H, Fl_Window win=0) FL_EXPORT void _set_status (int X, int Y, int W, int H) FL_EXPORT const char _shortcut_label (unsigned int shortcut)
Get a human-readable string from a shortcut value.

FL_EXPORT const char _shortcut_label (unsigned int shortcut, const char eom)
Get a human-readable string from a shortcut value.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

252 double _transform_dx (double x, double y)


Transforms distance using current transformation matrix.

Module Documentation

double _transform_dy (double x, double y)


Transforms distance using current transformation matrix.

double _transform_x (double x, double y)


Transforms coordinate using the current transformation matrix.

double _transform_y (double x, double y)


Transforms coordinate using the current transformation matrix.

void _transformed_vertex (double xf, double yf)


Adds coordinate pair to the vertex list without further transformations.

void _translate (double x, double y)


Concatenates translation transformation onto the current one.

void _vertex (double x, double y)


Adds a single vertex to the current path.

void _xyline (int x, int y, int x1)


Draws a horizontal line from (x,y) to (x1,y)

void _xyline (int x, int y, int x1, int y2)


Draws a horizontal line from (x,y) to (x1,y), then vertical from (x1,y) to (x1,y2)

void _xyline (int x, int y, int x1, int y2, int x3)
Draws a horizontal line from (x,y) to (x1,y), then a vertical from (x1,y) to (x1,y2) and then another horizontal from (x1,y2) to (x3,y2)

void _yxline (int x, int y, int y1)


Draws a vertical line from (x,y) to (x,y1)

void _yxline (int x, int y, int y1, int x2)


Draws a vertical line from (x,y) to (x,y1), then a horizontal from (x,y1) to (x2,y1)

void _yxline (int x, int y, int y1, int x2, int y3)
Draws a vertical line from (x,y) to (x,y1) then a horizontal from (x,y1) to (x2,y1), then another vertical from (x2,y1) to (x2,y3)

Variables
const int stack_max = 16

29.7.1

Detailed Description

FLTK global graphics and GUI drawing functions. These functions are declared in <FL/_draw.H>, and in <FL/x.H> for offscreen buffer-related ones.

29.7.2
29.7.2.1

Dene Documentation
#dene clip push clip

Intersects the current clip region with a rectangle and pushes this new region onto the stack (deprecated). Parameters in

x,y,w,h position and size

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.7 Drawing functions

253

Deprecated _clip(int, int, int, int) is deprecated and will be removed from future releases. Please use _push_clip(int x, int y, int w, int h) instead.

29.7.3
29.7.3.1

Enumeration Type Documentation


anonymous enum

Enumerator: FL_SOLID line style: ___________ FL_DASH line style: _ _ _ _ _ _ FL_DOT line style: . . . . . . . _ . _ . . FL_DASHDOT line style: _ . _ .

FL_DASHDOTDOT line style: _ . FL_CAP_FLAT cap style: end is at

FL_CAP_ROUND cap style: end is round FL_CAP_SQUARE cap style: end wraps end point FL_JOIN_MITER join style: line join extends to a point FL_JOIN_ROUND join style: line join is rounded FL_JOIN_BEVEL join style: line join is tidied

29.7.4
29.7.4.1

Function Documentation
FL EXPORT int add symbol ( const char name, void()(Fl_Color) drawit, int scalable )

Adds a symbol to the system. Parameters in in in

name name of symbol (without the "@") drawit function to draw symbol scalable set to 1 if drawit uses scalable vector drawing

Returns 1 on success, 0 on failure

29.7.4.2

void arc ( int x, int y, int w, int h, double a1, double a2 ) [inline]

Draw ellipse sections using integer coordinates. These functions match the rather limited circle drawing code provided by X and WIN32. The advantage over using _arc with oating point coordinates is that they are faster because they often use the hardware, and they draw much nicer small circles, since the small sizes are often hard-coded bitmaps. If a complete circle is drawn it will t inside the passed bounding box. The two angles are measured in degrees counter-clockwise from 3 oclock and are the starting and ending angle of the arc, a2 must be greater or equal to a1.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

254

Module Documentation

_arc() draws a series of lines to approximate the arc. Notice that the integer version of _arc() has a different number of arguments than the double version _arc(double x, double y, double r, double start, double end) Parameters in in

x,y,w,h bounding box of complete circle a1,a2 start and end angles of arc measured in degrees counter-clockwise from 3 oclock. a2 must be greater than or equal to a1.

29.7.4.3

void arc ( double x, double y, double r, double start, double end ) [inline]

Adds a series of points to the current path on the arc of a circle. You can get elliptical paths by using scale and rotate before calling _arc(). Parameters in in

x,y,r center and radius of circular arc start,end angles of start and end of arc measured in degrees counter-clockwise from 3 oclock. If end is less than start then it draws the arc in a clockwise direction.

29.7.4.4

void begin complex polygon ( ) [inline]

Starts drawing a complex lled polygon. The polygon may be concave, may have holes in it, or may be several disconnected pieces. Call _gap() to separate loops of the path. To outline the polygon, use _begin_loop() and replace each _gap() with _end_loop();_begin_loop() pairs. Note For portability, you should only draw polygons that appear the same whether "even/odd" or "non-zero" winding rules are used to ll them. Holes should be drawn in the opposite direction to the outside loop.

29.7.4.5

void begin offscreen ( Fl Offscreen ctx )

Send all subsequent drawing commands to this offscreen buffer. Parameters ctx the offscreen buffer.

29.7.4.6

void begin points ( ) [inline]

Starts drawing a list of points. Points are added to the list with _vertex()
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.7 Drawing functions 29.7.4.7 FL EXPORT char can do alpha blending ( )

255

Checks whether platform supports true alpha blending for RGBA images. Returns 1 if true alpha blending supported by platform 0 not supported so FLTK will use screen door transparency

29.7.4.8

void circle ( double x, double y, double r ) [inline]

_circle() is equivalent to _arc(x,y,r,0,360), but may be faster. It must be the only thing in the path: if you want a circle as part of a complex polygon you must use _arc() Parameters in

x,y,r center and radius of circle

29.7.4.9

int clip box ( int x, int y, int w, int h, int & X, int & Y, int & W, int & H ) [inline]

Intersects the rectangle with the current clip region and returns the bounding box of the result. Returns non-zero if the resulting rectangle is different to the original. This can be used to limit the necessary drawing to a rectangle. W and H are set to zero if the rectangle is completely outside the region. Parameters in out

x,y,w,h position and size of rectangle X,Y,W,H position and size of resulting bounding box.

Returns Non-zero if the resulting rectangle is different to the original.

29.7.4.10

void clip region ( Fl Region r ) [inline]

Replaces the top of the clipping stack with a clipping region of any shape. Fl_Region is an operating system specic type. Parameters in

r clipping region

29.7.4.11

void copy offscreen ( int x, int y, int w, int h, Fl Offscreen pixmap, int srcx, int srcy )

Copy a rectangular area of the given offscreen buffer into the current drawing destination.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

256 Parameters x,y w,h pixmap srcx,srcy position where to draw the copied rectangle size of the copied rectangle offscreen buffer containing the rectangle to copy origin in offscreen buffer of rectangle to copy

Module Documentation

29.7.4.12

Fl Offscreen create offscreen ( int w, int h )

Creation of an offscreen graphics buffer. Parameters w,h width and height in pixels of the buffer.

Returns the created graphics buffer.

29.7.4.13

FL EXPORT void cursor ( Fl_Cursor c, Fl_Color fg, Fl_Color bg )

Sets the cursor for the current window to the specied shape and colors. The cursors are dened in the <FL/Enumerations.H> header le. 29.7.4.14 void curve ( double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3 ) [inline]

Adds a series of points on a Bezier curve to the path. The curve ends (and two of the points) are at X0,Y0 and X3,Y3. Parameters in in in in

X0,Y0 X1,Y1 X2,Y2 X3,Y3

curve start point curve control point curve control point curve end point

29.7.4.15

void delete offscreen ( Fl Offscreen ctx )

Deletion of an offscreen graphics buffer. Parameters ctx the buffer to be deleted.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.7 Drawing functions 29.7.4.16 FL EXPORT void draw ( const char str, int x, int y )

257

Draws a nul-terminated string starting at the given location. Text is aligned to the left and to the baseline of the font. To align to the bottom, subtract _descent() from y. To align to the top, subtract _descent() and add _height(). This version of _draw provides direct access to the text drawing function of the underlying OS. It does not apply any special handling to control characters. 29.7.4.17 FL EXPORT void draw ( int angle, const char str, int x, int y )

Draws a nul-terminated string starting at the given location and rotating angle degrees counter-clockwise. This version of _draw provides direct access to the text drawing function of the underlying OS and is supported by Xft, Win32 and MacOS tk subsets. 29.7.4.18 FL EXPORT void draw ( const char str, int x, int y, int w, int h, Fl_Align align, Fl_Image img, int draw symbols )

Fancy string drawing function which is used to draw all the labels. The string is formatted and aligned inside the passed box. Handles \t and \n, expands all other control characters to X, and aligns inside or against the edges of the box. See Fl_Widget::align() for values of align. The value FL_ALIGN_INSIDE is ignored, as this function always prints inside the box. If img is provided and is not NULL, the image is drawn above or below the text as specied by the align value. The draw_symbols argument species whether or not to look for symbol names starting with the @ character The text length is limited to 1024 characters per line. 29.7.4.19 FL EXPORT void draw box ( Fl_Boxtype t, int x, int y, int w, int h, Fl_Color c )

Draws a box using given type, position, size and color. Parameters in in in

t box type x,y,w,h position and size c color

29.7.4.20

void draw image ( const uchar buf, int X, int Y, int W, int H, int D = 3, int L = 0 ) [inline]

Draws an 8-bit per color RGB or luminance image. Parameters in in in in

buf points at the "r" data of the top-left pixel. Color data must be in r,g,b order. Luminance data is only one gray byte. X,Y position where to put top-left corner of image W,H size of the image D delta to add to the pointer between pixels. It may be any value greater than or equal to 1, or it can be negative to ip the image horizontally

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

258

Module Documentation

in

L delta to add to the pointer between lines (if 0 is passed it uses W D), and may be larger than W D to crop data, or negative to ip the image vertically

It is highly recommended that you put the following code before the rst show() of any window in your program to get rid of the dithering if possible:
Fl::visual(FL_RGB);

Gray scale (1-channel) images may be drawn. This is done if abs(D) is less than 3, or by calling _draw_image_mono(). Only one 8-bit sample is used for each pixel, and on screens with different numbers of bits for red, green, and blue only gray colors are used. Setting D greater than 1 will let you display one channel of a color image. Note: The X version does not support all possible visuals. If FLTK cannot draw the image in the current visual it will abort. FLTK supports any visual of 8 bits or less, and all common TrueColor visuals up to 32 bits.

29.7.4.21

void draw image ( Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D = 3 ) [inline]

Draws an image using a callback function to generate image data. You can generate the image as it is being drawn, or do arbitrary decompression of stored data, provided it can be decompressed to individual scan lines easily. Parameters in in in in in See also _draw_image(const uchar buf, int X,int Y,int W,int H, int D, int L) The callback function cb is called with the void data user data pointer to allow access to a structure of information about the image, and the x, y, and w of the scan line desired from the image. 0,0 is the upper-left corner of the image, not x, y. A pointer to a buffer to put the data into is passed. You must copy w pixels from scanline y, starting at pixel x, to this buffer. Due to cropping, less than the whole image may be requested. So x may be greater than zero, the rst y may be greater than zero, and w may be less than W. The buffer is long enough to store the entire W D pixels, this is for convenience with some decompression schemes where you must decompress the entire line at once: decompress it into the buffer, and then if x is not zero, copy the data over so the xth pixel is at the start of the buffer. You can assume the ys will be consecutive, except the rst one may be greater than zero. If D is 4 or more, you must ll in the unused bytes with zero.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

cb data X,Y W,H D

callback function to generate scan line data user data passed to callback function screen position of top left pixel image width and height data size in bytes (must be greater than 0)

29.7 Drawing functions 29.7.4.22

259

void draw image mono ( const uchar buf, int X, int Y, int W, int H, int D = 1, int L = 0 ) [inline]

Draws a gray-scale (1 channel) image. See also _draw_image(const uchar buf, int X,int Y,int W,int H, int D, int L)

29.7.4.23

FL EXPORT void draw image mono ( Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D = 1 )

Draws a gray-scale image using a callback function to generate image data. See also _draw_image(Fl_Draw_Image_Cb cb, void data, int X,int Y,int W,int H, int D)

29.7.4.24

FL EXPORT int draw pixmap ( char const data, int x, int y, Fl_Color bg )

Draw XPM image data, with the top-left corner at the given position. The image is dithered on 8-bit displays so you wont lose color space for programs displaying both images and pixmaps. Parameters in in in

data pointer to XPM image data x,y position of top-left corner bg background color

Returns 0 if there was any error decoding the XPM data.

29.7.4.25

FL EXPORT int draw pixmap ( const char const cdata, int x, int y, Fl_Color bg )

Draw XPM image data, with the top-left corner at the given position. See also _draw_pixmap(char const data, int x, int y, Fl_Color bg)

29.7.4.26

FL EXPORT int draw symbol ( const char label, int x, int y, int w, int h, Fl_Color col )

Draw the named symbol in the given rectangle using the given color.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

260 Parameters in in in in

Module Documentation

label x,y w,h col

name of symbol position of symbol size of symbol color of symbox

Returns 1 on success, 0 on failure

29.7.4.27

FL EXPORT const char expand text ( const char from, char buf, int maxbuf, double maxw, int & n, double & width, int wrap, int draw symbols )

Copy from to buf, replacing unprintable characters with X and \nnn. Stop at a newline or if MAXBUF characters written to buffer. Also word-wrap if width exceeds maxw. Returns a pointer to the start of the next line of characters. Sets n to the number of characters put into the buffer. Sets width to the width of the string in the current font. 29.7.4.28 FL EXPORT void frame ( const char s, int x, int y, int w, int h )

Draws a series of line segments around the given box. The string s must contain groups of 4 letters which specify one of 24 standard grayscale values, where A is black and X is white. The order of each set of 4 characters is: top, left, bottom, right. The result of calling _frame() with a string that is not a multiple of 4 characters in length is undened. The only difference between this function and _frame2() is the order of the line segments. Parameters in in

s sets of 4 grayscale values in top, left, bottom, right order x,y,w,h position and size

29.7.4.29

FL EXPORT void frame2 ( const char s, int x, int y, int w, int h )

Draws a series of line segments around the given box. The string s must contain groups of 4 letters which specify one of 24 standard grayscale values, where A is black and X is white. The order of each set of 4 characters is: bottom, right, top, left. The result of calling _frame2() with a string that is not a multiple of 4 characters in length is undened. The only difference between this function and _frame() is the order of the line segments. Parameters in in

s sets of 4 grayscale values in bottom, right, top, left order x,y,w,h position and size

29.7.4.30

void gap ( ) [inline]

Call _gap() to separate loops of the path.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.7 Drawing functions

261

It is unnecessary but harmless to call _gap() before the rst vertex, after the last vertex, or several times in a row. 29.7.4.31 void line style ( int style, int width = 0, char dashes = 0 ) [inline]

Sets how to draw lines (the "pen"). If you change this it is your responsibility to set it back to the default using fl_line_style(0). Parameters in

in

in

style A bitmask which is a bitwise-OR of a line style, a cap style, and a join style. If you dont specify a dash type you will get a solid line. If you dont specify a cap or join type you will get a system-dened default of whatever value is fastest. width The thickness of the lines in pixels. Zero results in the system dened default, which on both X and Windows is somewhat different and nicer than 1. dashes A pointer to an array of dash lengths, measured in pixels. The rst location is how long to draw a solid portion, the next is how long to draw the gap, then the solid, etc. It is terminated with a zero-length entry. A NULL pointer or a zero-length array results in a solid line. Odd array sizes are not supported and result in undened behavior.

Note Because of how line styles are implemented on Win32 systems, you must set the line style after setting the drawing color. If you set the color after the line style you will lose the line style settings. The dashes array does not work under Windows 95, 98 or Me, since those operating systems do not support complex line styles.

29.7.4.32

FL EXPORT void measure ( const char str, int & w, int & h, int draw symbols )

Measure how wide and tall the string will be when printed by the _draw() function with align parameter. If the incoming w is non-zero it will wrap to that width. Parameters in out in

str nul-terminated string w,h width and height of string in current font draw_symbols non-zero to enable @symbol handling [default=1]

29.7.4.33

FL EXPORT int measure pixmap ( char const data, int & w, int & h )

Get the dimensions of a pixmap. An XPM image contains the dimensions in its data. This function returns te width and height. Parameters

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

262 in out data pointer to XPM image data. w,h width and height of image

Module Documentation

Returns non-zero if the dimensions were parsed OK 0 if there were any problems

29.7.4.34

FL EXPORT int measure pixmap ( const char const cdata, int & w, int & h )

Get the dimensions of a pixmap. See also _measure_pixmap(char const data, int &w, int &h)

29.7.4.35

void mult matrix ( double a, double b, double c, double d, double x, double y ) [inline]

Concatenates another transformation onto the current one. Parameters in

a,b,c,d,x,y transformation matrix elements such that X = aX + cY + x and Y = bX +dY + y

29.7.4.36

int not clipped ( int x, int y, int w, int h ) [inline]

Does the rectangle intersect the current clip region? Parameters in

x,y,w,h position and size of rectangle

Returns non-zero if any of the rectangle intersects the current clip region. If this returns 0 you dont have to draw the object.

Note Under X this returns 2 if the rectangle is partially clipped, and 1 if it is entirely inside the clip region.

29.7.4.37

FL EXPORT unsigned int old shortcut ( const char s )

Emulation of XForms named shortcuts. Converts ascii shortcut specications (eg. " c") into the FLTK integer equivalent (eg. FL_CTRL+c) These ascii characters are used to specify the various keyboard modier keys:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.7 Drawing functions


# - Alt + - Shift ^ - Control

263

29.7.4.38

void pie ( int x, int y, int w, int h, double a1, double a2 ) [inline]

Draw lled ellipse sections using integer coordinates. Like _arc(), but _pie() draws a lled-in pie slice. This slice may extend outside the line drawn by _arc(); to avoid this use w - 1 and h - 1. Parameters in in

x,y,w,h bounding box of complete circle a1,a2 start and end angles of arc measured in degrees counter-clockwise from 3 oclock. a2 must be greater than or equal to a1.

29.7.4.39

void polygon ( int x, int y, int x1, int y1, int x2, int y2 ) [inline]

Fills a 3-sided polygon. The polygon must be convex. 29.7.4.40 void polygon ( int x, int y, int x1, int y1, int x2, int y2, int x3, int y3 ) [inline]

Fills a 4-sided polygon. The polygon must be convex. 29.7.4.41 void pop clip ( ) [inline]

Restores the previous clip region. You must call _pop_clip() once for every time you call _push_clip(). Unpredictable results may occur if the clip stack is not empty when you return to FLTK. 29.7.4.42 void push clip ( int x, int y, int w, int h ) [inline]

Intersects the current clip region with a rectangle and pushes this new region onto the stack. Parameters in

x,y,w,h position and size

29.7.4.43

void push matrix ( ) [inline]

Saves the current transformation matrix on the stack. The maximum depth of the stack is 32.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

264 29.7.4.44

Module Documentation FL EXPORT uchar read image ( uchar p, int X, int Y, int W, int H, int alpha = 0 )

Reads an RGB(A) image from the current window or off-screen buffer. Parameters in in in in

p X,Y W,H alpha

pixel buffer, or NULL to allocate one position of top-left of image to read width and height of image to read alpha value for image (0 for none)

Returns pointer to pixel buffer, or NULL if allocation failed. The p argument points to a buffer that can hold the image and must be at least WH3 bytes when reading RGB images, or WH4 bytes when reading RGBA images. If NULL, _read_image() will create an array of the proper size which can be freed using delete[]. The alpha parameter controls whether an alpha channel is created and the value that is placed in the alpha channel. If 0, no alpha channel is generated. 29.7.4.45 void rect ( int x, int y, int w, int h ) [inline]

Draws a 1-pixel border inside the given bounding box. This function is meant for quick drawing of simple boxes. The behavior is undened for line widths that are not 1. 29.7.4.46 FL EXPORT void rectf ( int x, int y, int w, int h, uchar r, uchar g, uchar b )

Colors a rectangle with "exactly" the passed r,g,b color. On screens with less than 24 bits of color this is done by drawing a solid-colored block using _draw_image() so that the correct color shade is produced. 29.7.4.47 FL EXPORT void reset spot ( void )

Todo provide user documentation for _reset_spot function

29.7.4.48

void rotate ( double d ) [inline]

Concatenates rotation transformation onto the current one. Parameters in

d - rotation angle, counter-clockwise in degrees (not radians)

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.7 Drawing functions 29.7.4.49 void scale ( double x, double y ) [inline]

265

Concatenates scaling transformation onto the current one. Parameters in

x,y scale factors in x-direction and y-direction

29.7.4.50

void scale ( double x ) [inline]

Concatenates scaling transformation onto the current one. Parameters in

x scale factor in both x-direction and y-direction

29.7.4.51

FL EXPORT void scroll ( int X, int Y, int W, int H, int dx, int dy, void()(void , int, int, int, int) draw area, void data )

Scroll a rectangle and draw the newly exposed portions. Parameters in in in in in

X,Y W,H dx,dy draw_area data

position of top-left of rectangle size of rectangle pixel offsets for shifting rectangle callback function to draw rectangular areas pointer to user data for callback The contents of the rectangular area is rst shifted by dx and dy pixels. The draw_area callback is then called for every newly exposed rectangular area.

29.7.4.52

FL EXPORT void set spot ( int font, int size, int X, int Y, int W, int H, Fl_Window win = 0 )

Todo provide user documentation for _set_spot function

29.7.4.53

FL EXPORT void set status ( int X, int Y, int W, int H )

Todo provide user documentation for _set_status function

29.7.4.54

FL EXPORT const char shortcut label ( unsigned int shortcut )

Get a human-readable string from a shortcut value. Unparse a shortcut value as used by Fl_Button or Fl_Menu_Item into a human-readable string like "Alt+N". This only works if the shortcut is a character key or a numbered function key. If the shortcut is zero then an empty string is returned. The return value points at a static buffer that is overwritten with each call.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

266 Parameters in

Module Documentation

shortcut the integer value containing the ascii character or extended keystroke plus modiers

Returns a pointer to a static buffer containing human readable text for the shortcut

29.7.4.55

FL EXPORT const char shortcut label ( unsigned int shortcut, const char eom )

Get a human-readable string from a shortcut value. Parameters in in

shortcut the integer value containing the ascii character or extended keystroke plus modiers eom if this pointer is set, it will receive a pointer to the end of the modier text

Returns a pointer to a static buffer containing human readable text for the shortcut

See also _shortcut_label(unsigned int shortcut)

29.7.4.56

double transform dx ( double x, double y ) [inline]

Transforms distance using current transformation matrix. Parameters in

x,y coordinate

29.7.4.57

double transform dy ( double x, double y ) [inline]

Transforms distance using current transformation matrix. Parameters in

x,y coordinate

29.7.4.58

double transform x ( double x, double y ) [inline]

Transforms coordinate using the current transformation matrix.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.7 Drawing functions Parameters in

267

x,y coordinate

29.7.4.59

double transform y ( double x, double y ) [inline]

Transforms coordinate using the current transformation matrix. Parameters in

x,y coordinate

29.7.4.60

void transformed vertex ( double xf, double yf ) [inline]

Adds coordinate pair to the vertex list without further transformations. Parameters in

xf,yf transformed coordinate

29.7.4.61

void translate ( double x, double y ) [inline]

Concatenates translation transformation onto the current one. Parameters in

x,y translation factor in x-direction and y-direction

29.7.4.62

void vertex ( double x, double y ) [inline]

Adds a single vertex to the current path. Parameters in

x,y coordinate

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

268

Module Documentation

29.8

Multithreading support functions

multithreading support functions declared in <FL/Fl.H>

Functions
static void Fl::awake (void message=0)
Sends a message pointer to the main thread, causing any pending Fl::wait() call to terminate so that the main thread can retrieve the message and any pending redraws can be processed.

static int Fl::awake (Fl_Awake_Handler cb, void message=0)


See void awake(void message=0).

static int Fl::lock ()


The lock() method blocks the current thread until it can safely access FLTK widgets and data.

static void Fl::thread_message ()


The thread_message() method returns the last message that was sent from a child by the awake() method.

static void Fl::unlock ()


The unlock() method releases the lock that was set using the lock() method.

29.8.1

Detailed Description

multithreading support functions declared in <FL/Fl.H>

29.8.2
29.8.2.1

Function Documentation
void Fl::awake ( void msg = 0 ) [static]

Sends a message pointer to the main thread, causing any pending Fl::wait() call to terminate so that the main thread can retrieve the message and any pending redraws can be processed. Multiple calls to Fl::awake() will queue multiple pointers for the main thread to process, up to a systemdened (typically several thousand) depth. The default message handler saves the last message which can be accessed using the Fl::thread_message() function. In the context of a threaded application, a call to Fl::awake() with no argument will trigger event loop handling in the main thread. Since it is not possible to call Fl::ush() from a subsidiary thread, Fl::awake() is the best (and only, really) substitute. See also: Multithreading 29.8.2.2 int Fl::awake ( Fl_Awake_Handler func, void data = 0 ) [static]

See void awake(void message=0). Let the main thread know an update is pending and have it call a specic function. Registers a function that will be called by the main thread during the next message handling cycle. Returns 0 if the callback function was registered, and -1 if registration failed. Over a thousand awake callbacks can be registered simultaneously. See also Fl::awake(void message=0)

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.8 Multithreading support functions 29.8.2.3 int Fl::lock ( ) [static]

269

The lock() method blocks the current thread until it can safely access FLTK widgets and data. Child threads should call this method prior to updating any widgets or accessing data. The main thread must call lock() to initialize the threading support in FLTK. lock() will return non-zero if threading is not available on the platform. Child threads must call unlock() when they are done accessing FLTK. When the wait() method is waiting for input or timeouts, child threads are given access to FLTK. Similarly, when the main thread needs to do processing, it will wait until all child threads have called unlock() before processing additional data. Returns 0 if threading is available on the platform; non-zero otherwise. See also: Multithreading 29.8.2.4 void Fl::thread message ( ) [static]

The thread_message() method returns the last message that was sent from a child by the awake() method. See also: Multithreading 29.8.2.5 void Fl::unlock ( ) [static]

The unlock() method releases the lock that was set using the lock() method. Child threads should call this method as soon as they are nished accessing FLTK. See also: Multithreading

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

270

Module Documentation

29.9

Safe widget deletion support functions

These functions, declared in <FL/Fl.H>, support deletion of widgets inside callbacks.

Functions
static void Fl::clear_widget_pointer (Fl_Widget const w)
Clears a widget pointer in the watch list.

static void Fl::delete_widget (Fl_Widget w)


Schedules a widget for deletion at the next call to the event loop.

static void Fl::do_widget_deletion ()


Deletes widgets previously scheduled for deletion.

static void Fl::release_widget_pointer (Fl_Widget &w)


Releases a widget pointer from the watch list.

static void Fl::watch_widget_pointer (Fl_Widget &w)


Adds a widget pointer to the widget watch list.

29.9.1

Detailed Description

These functions, declared in <FL/Fl.H>, support deletion of widgets inside callbacks. Fl::delete_widget() should be called when deleting widgets or complete widget trees (Fl_Group, Fl_Window, ...) inside callbacks. The other functions are intended for internal use. The preferred way to use them is by using the helper class Fl_Widget_Tracker. The following is to show how it works ... There are three groups of related methods: 1. scheduled widget deletion Fl::delete_widget() schedules widgets for deletion Fl::do_widget_deletion() deletes all scheduled widgets 2. widget watch list ("smart pointers") Fl::watch_widget_pointer() adds a widget pointer to the watch list Fl::release_widget_pointer() removes a widget pointer from the watch list Fl::clear_widget_pointer() clears a widget pointer in the watch list 3. the class Fl_Widget_Tracker: the constructor calls Fl::watch_widget_pointer() the destructor calls Fl::release_widget_pointer() the access methods can be used to test, if a widget has been deleted See also Fl_Widget_Tracker.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.9 Safe widget deletion support functions

271

29.9.2
29.9.2.1

Function Documentation
void Fl::clear widget pointer ( Fl_Widget const w ) [static]

Clears a widget pointer in the watch list. This is called when a widget is destroyed (by its destructor). You should never call this directly. Note Internal use only ! This method searches the widget watch list for pointers to the widget and clears each pointer that points to it. Widget pointers can be added to the widget watch list by calling Fl::watch_widget_pointer() or by using the helper class Fl_Widget_Tracker (recommended). See also Fl::watch_widget_pointer() class Fl_Widget_Tracker

29.9.2.2

void Fl::delete widget ( Fl_Widget wi ) [static]

Schedules a widget for deletion at the next call to the event loop. Use this method to delete a widget inside a callback function. To avoid early deletion of widgets, this function should be called toward the end of a callback and only after any call to the event loop (Fl::wait(), Fl::ush(), Fl::check(), _ask(), etc.). When deleting groups or windows, you must only delete the group or window widget and not the individual child widgets. Since FLTK 1.3 it is not necessary to remove widgets from their parent groups or windows before calling this, because it will be done in the widgets destructor, but it is not a failure to do this nevertheless.

Note In FLTK 1.1 you must remove widgets from their parent group (or window) before deleting them.

See also Fl_Widget::Fl_Widget()

29.9.2.3

void Fl::do widget deletion ( ) [static]

Deletes widgets previously scheduled for deletion. This is for internal use only. You should never call this directly. Fl::do_widget_deletion() is called from the FLTK event loop or whenever you call Fl::wait(). The previously scheduled widgets are deleted in the same order they were scheduled by calling Fl::delete_widget().
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

272 See also Fl::delete_widget(Fl_Widget wi)

Module Documentation

29.9.2.4

void Fl::release widget pointer ( Fl_Widget & w ) [static]

Releases a widget pointer from the watch list. This is used to remove a widget pointer that has been added to the watch list with Fl::watch_widget_pointer(), when it is not needed anymore. Note Internal use only, please use class Fl_Widget_Tracker instead.

See also Fl::watch_widget_pointer()

29.9.2.5

void Fl::watch widget pointer ( Fl_Widget & w ) [static]

Adds a widget pointer to the widget watch list. Note Internal use only, please use class Fl_Widget_Tracker instead. This can be used, if it is possible that a widget might be deleted during a callback or similar function. The widget pointer must be added to the watch list before calling the callback. After the callback the widget pointer can be queried, if it is NULL. If it is NULL, then the widget has been deleted during the callback and must not be accessed anymore. If the widget pointer is not NULL, then the widget has not been deleted and can be accessed safely. After accessing the widget, the widget pointer must be released from the watch list by calling Fl::release_widget_pointer(). Example for a button that is clicked (from its handle() method):
Fl_Widget *wp = this; Fl::watch_widget_pointer(wp); set_changed(); do_callback(); if (!wp) { // // // // // save this in a pointer variable add the pointer to the watch list set the changed flag call the callback the widget has been deleted

// DO NOT ACCESS THE DELETED WIDGET ! } else { clear_changed(); } Fl::release_widget_pointer(wp); list // the widget still exists // reset the changed flag

// remove the pointer from the watch

This works, because all widgets call Fl::clear_widget_pointer() in their destructors.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.9 Safe widget deletion support functions See also Fl::release_widget_pointer() Fl::clear_widget_pointer()

273

An easier and more convenient method to control widget deletion during callbacks is to use the class Fl_Widget_Tracker with a local (automatic) variable. See also class Fl_Widget_Tracker

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

274

Module Documentation

29.10
Classes

Cairo support functions and classes

class Fl_Cairo_State
Contains all the necessary info on the current cairo context.

class Fl_Cairo_Window
This denes a pre-congured cairo tk window.

Functions
static void Fl::cairo_autolink_context (bool alink)
when FLTK_HAVE_CAIRO is dened and cairo_autolink_context() is true, any current window dc is linked to a current context.

static bool Fl::cairo_autolink_context ()


Gets the current autolink mode for cairo support.

static cairo_t Fl::cairo_cc ()


Gets the current cairo context linked with a tk window.

static void Fl::cairo_cc (cairo_t c, bool own=false)


Sets the current cairo context to c.

static cairo_t Fl::cairo_make_current (Fl_Window w)

29.10.1
29.10.1.1

Function Documentation
static void Fl::cairo autolink context ( bool alink ) [inline, static]

when FLTK_HAVE_CAIRO is dened and cairo_autolink_context() is true, any current window dc is linked to a current context. This is not the default, because it may not be necessary to add cairo support to all tk supported windows. When you wish to associate a cairo context in this mode, you need to call explicitly in your draw() overridden method, FL::cairo_make_current(Fl_Window). This will create a cairo context but only for this Window. Still in custom cairo application it is possible to handle completely this process automatically by setting alink to true. In this last case, you dont need anymore to call Fl::cairo_make_current(). You can use Fl::cairo_cc() to get the current cairo context anytime. Note Only available when congure has the --enable-cairo option

29.10.1.2

static bool Fl::cairo autolink context ( ) [inline, static]

Gets the current autolink mode for cairo support. Return values false if no cairo context autolink is made for each window. true if any tk window is attached a cairo context when it is current.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.10 Cairo support functions and classes See also void cairo_autolink_context(bool alink)

275

Note Only available when congure has the --enable-cairo option

29.10.1.3

static cairo t Fl::cairo cc ( ) [inline, static]

Gets the current cairo context linked with a tk window. 29.10.1.4 static void Fl::cairo cc ( cairo t c, bool own = false ) [inline, static]

Sets the current cairo context to c. Set own to true if you want tk to handle this cc deletion. Note Only available when congure has the --enable-cairo option

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

276

Module Documentation

29.11

Unicode and UTF-8 functions

global Unicode and UTF-8 handling functions declared in <FL/_utf8.h>

Denes
#dene ERRORS_TO_CP1252 1 #dene ERRORS_TO_ISO8859_1 1 #dene NBC 0xFFFF + 1 #dene STRICT_RFC3629 0

Functions
FL_EXPORT int _access (const char f, int mode) FL_EXPORT int _chmod (const char f, int mode) FL_EXPORT int _execvp (const char le, char const argv) FL_EXPORT FILE _fopen (const char f, const char mode) FL_EXPORT char _getcwd (char buf, int maxlen) FL_EXPORT char _getenv (const char name) FL_EXPORT char _make_path (const char path) FL_EXPORT void _make_path_for_le (const char path) FL_EXPORT int _mkdir (const char f, int mode) FL_EXPORT unsigned int _nonspacing (unsigned int ucs)
returns true if the character is non-spacing.

FL_EXPORT int _open (const char f, int o,...) FL_EXPORT int _rename (const char f, const char t) FL_EXPORT int _rmdir (const char f) FL_EXPORT int _stat (const char path, struct stat buffer) FL_EXPORT int _system (const char f) FL_EXPORT int _tolower (unsigned int ucs)
return the Unicode lower case value of ucs

FL_EXPORT int _toupper (unsigned int ucs)


return the Unicode upper case value of ucs

FL_EXPORT unsigned _ucs_to_Utf16 (const unsigned ucs, unsigned short dst, const unsigned dstlen) FL_EXPORT int _unlink (const char f) FL_EXPORT char _utf2mbcs (const char s)
converts UTF8 to a local multi-byte character string.

FL_EXPORT const char _utf8back (const char p, const char start, const char end) FL_EXPORT int _utf8bytes (unsigned ucs)
Return the number of bytes needed to encode the given UCS4 character in UTF8.

FL_EXPORT unsigned _utf8decode (const char p, const char end, int len) FL_EXPORT int _utf8encode (unsigned ucs, char buf) FL_EXPORT unsigned _utf8from_mb (char dst, unsigned dstlen, const char src, unsigned srclen) FL_EXPORT unsigned _utf8froma (char dst, unsigned dstlen, const char src, unsigned srclen) FL_EXPORT unsigned _utf8fromwc (char dst, unsigned dstlen, const wchar_t src, unsigned srclen)
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.11 Unicode and UTF-8 functions FL_EXPORT const char _utf8fwd (const char p, const char start, const char end) FL_EXPORT int _utf8len (char c)
return the byte length of the UTF-8 sequence with rst byte c, or -1 if c is not valid.

277

FL_EXPORT int _utf8len1 (char c)


Return the byte length of the UTF-8 sequence with rst byte c, or 1 if c is not valid.

FL_EXPORT int _utf8locale () FL_EXPORT int _utf8test (const char src, unsigned len) FL_EXPORT unsigned _utf8to_mb (const char src, unsigned srclen, char dst, unsigned dstlen) FL_EXPORT unsigned _utf8toa (const char src, unsigned srclen, char dst, unsigned dstlen) FL_EXPORT unsigned _utf8toUtf16 (const char src, unsigned srclen, unsigned short dst, unsigned dstlen) FL_EXPORT unsigned _utf8towc (const char src, unsigned srclen, wchar_t dst, unsigned dstlen)
Converts a UTF-8 string into a wide character string.

FL_EXPORT int _utf_nb_char (const unsigned char buf, int len)


returns the number of Unicode chars in the UTF-8 string

FL_EXPORT int _utf_strcasecmp (const char s1, const char s2)


UTF-8 aware strcasecmp - converts to Unicode and tests.

FL_EXPORT int _utf_strncasecmp (const char s1, const char s2, int n)
UTF-8 aware strncasecmp - converts to lower case Unicode and tests.

FL_EXPORT int _utf_tolower (const unsigned char str, int len, char buf)
converts the str string to the lower case equivalent into buf.

FL_EXPORT int _utf_toupper (const unsigned char str, int len, char buf)
converts the str string to the upper case equivalent into buf.

FL_EXPORT int _wcwidth (const char src)


extended wrapper around _wcwidth_(unsigned int ucs) function.

FL_EXPORT int _wcwidth_ (unsigned int ucs)


wrapper to adapt Markus Kuhns implementation of wcwidth() for FLTK

29.11.1

Detailed Description

global Unicode and UTF-8 handling functions declared in <FL/_utf8.h>

29.11.2
29.11.2.1

Dene Documentation
#dene ERRORS TO CP1252 1

Set to 1 to turn bad UTF8 bytes in the 0x80-0x9f range into the Unicode index for Microsofts CP1252 character set. You should also set ERRORS_TO_ISO8859_1. With this a huge amount of more available text (such as all web pages) are correctly converted to Unicode. 29.11.2.2 #dene ERRORS TO ISO8859 1 1

Set to 1 to turn bad UTF8 bytes into ISO-8859-1. If this is to zero they are instead turned into the Unicode REPLACEMENT CHARACTER, of value 0xfffd. If this is on _utf8decode() will correctly map most (perhaps all) human-readable text that is in ISO-8859-1. This may allow you to completely ignore character sets in your code because virtually everything is either ISO-8859-1 or UTF-8.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

278 29.11.2.3 #dene STRICT RFC3629 0

Module Documentation

A number of Unicode code points are in fact illegal and should not be produced by a UTF-8 converter. Turn this on will replace the bytes in those encodings with errors. If you do this then converting arbitrary 16-bit data to UTF-8 and then back is not an identity, which will probably break a lot of software.

29.11.3
29.11.3.1

Function Documentation
unsigned int nonspacing ( unsigned int ucs )

returns true if the character is non-spacing. Todo explain what non-spacing means.

29.11.3.2

unsigned ucs to Utf16 ( const unsigned ucs, unsigned short dst, const unsigned dstlen )

Convert a single 32-bit Unicode codepoint into an array of 16-bit characters. These are used by some system calls, especially on Windows. ucs is the value to convert. dst points at an array to write, and dstlen is the number of locations in this array. At most dstlen words will be written, and a 0 terminating word will be added if dstlen is large enough. Thus this function will never overwrite the buffer and will attempt return a zero-terminated string if space permits. If dstlen is zero then dst can be set to NULL and no data is written, but the length is returned. The return value is the number of 16-bit words that would be written to dst if it is large enough, not counting any terminating zero. If the return value is greater than dstlen it indicates truncation, you should then allocate a new array of size return+1 and call this again. Unicode characters in the range 0x10000 to 0x10ffff are converted to "surrogate pairs" which take two words each (in UTF-16 encoding). Typically, setting dstlen to 2 will ensure that any valid Unicode value can be converted, and setting dstlen to 3 or more will allow a NULL terminated sequence to be returned. 29.11.3.3 const char utf8back ( const char p, const char start, const char end )

Move p backward until it points to the start of a UTF-8 character. If it already points at the start of one then it is returned unchanged. Any UTF-8 errors are treated as though each byte of the error is an individual character. start is the start of the string and is used to limit the backwards search for the start of a UTF-8 character. end is the end of the string and is assumed to be a break between characters. It is assumed to be greater than p. If you wish to decrement a UTF-8 pointer, pass p-1 to this. 29.11.3.4 int utf8bytes ( unsigned ucs )

Return the number of bytes needed to encode the given UCS4 character in UTF8.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.11 Unicode and UTF-8 functions Parameters in

279

ucs UCS4 encoded character

Returns number of bytes required Returns number of bytes that utf8encode() will use to encode the character ucs. 29.11.3.5 unsigned utf8decode ( const char p, const char end, int len )

Decode a single UTF-8 encoded character starting at p. The resulting Unicode value (in the range 00x10ffff) is returned, and len is set to the number of bytes in the UTF-8 encoding (adding len to p will point at the next character). If p points at an illegal UTF-8 encoding, including one that would go past end, or where a code is uses more bytes than necessary, then (unsigned char)p is translated as though it is in the Microsoft CP1252 character set and len is set to 1. Treating errors this way allows this to decode almost any ISO-8859-1 or CP1252 text that has been mistakenly placed where UTF-8 is expected, and has proven very useful. If you want errors to be converted to error characters (as the standards recommend), adding a test to see if the length is unexpectedly 1 will work:
if (*p & 0x80) { // what should be a multibyte encoding code = fl_utf8decode(p,end,&len); if (len<2) code = 0xFFFD; // Turn errors into REPLACEMENT CHARACTER } else { // handle the 1-byte utf8 encoding: code = *p; len = 1; }

Direct testing for the 1-byte case (as shown above) will also speed up the scanning of strings where the majority of characters are ASCII. 29.11.3.6 int utf8encode ( unsigned ucs, char buf )

Write the UTF-8 encoding of ucs into buf and return the number of bytes written. Up to 4 bytes may be written. If you know that ucs is less than 0x10000 then at most 3 bytes will be written. If you wish to speed this up, remember that anything less than 0x80 is written as a single byte. If ucs is greater than 0x10ffff this is an illegal character according to RFC 3629. These are converted as though they are 0xFFFD (REPLACEMENT CHARACTER). RFC 3629 also says many other values for ucs are illegal (in the range 0xd800 to 0xdfff, or ending with 0xfffe or 0xffff). However I encode these as though they are legal, so that utf8encode/_utf8decode will be the identity for all codes between 0 and 0x10ffff. 29.11.3.7 unsigned utf8from mb ( char dst, unsigned dstlen, const char src, unsigned srclen )

Convert a lename from the locale-specic multibyte encoding used by Windows to UTF-8 as used by FLTK. Up to dstlen bytes are written to dst, including a null terminator. The return value is the number of bytes that would be written, not counting the null terminator. If greater or equal to dstlen then if you
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

280

Module Documentation

malloc a new array of size n+1 you will have the space needed for the entire string. If dstlen is zero then nothing is written and this call just measures the storage space needed. On Unix or on Windows when a UTF-8 locale is in effect, this does not change the data. You may also want to check if _utf8test() returns non-zero, so that the lesystem can store lenames in UTF-8 encoding regardless of the locale. 29.11.3.8 unsigned utf8froma ( char dst, unsigned dstlen, const char src, unsigned srclen )

Convert an ISO-8859-1 (ie normal c-string) byte stream to UTF-8. It is possible this should convert Microsofts CP1252 to UTF-8 instead. This would translate the codes in the range 0x80-0x9f to different characters. Currently it does not do this. Up to dstlen bytes are written to dst, including a null terminator. The return value is the number of bytes that would be written, not counting the null terminator. If greater or equal to dstlen then if you malloc a new array of size n+1 you will have the space needed for the entire string. If dstlen is zero then nothing is written and this call just measures the storage space needed. srclen is the number of bytes in src to convert. If the return value equals srclen then this indicates that no conversion is necessary, as only ASCII characters are in the string. 29.11.3.9 unsigned utf8fromwc ( char dst, unsigned dstlen, const wchar t src, unsigned srclen )

Turn "wide characters" as returned by some system calls (especially on Windows) into UTF-8. Up to dstlen bytes are written to dst, including a null terminator. The return value is the number of bytes that would be written, not counting the null terminator. If greater or equal to dstlen then if you malloc a new array of size n+1 you will have the space needed for the entire string. If dstlen is zero then nothing is written and this call just measures the storage space needed. srclen is the number of words in src to convert. On Windows this is not necessarily the number of characters, due to there possibly being "surrogate pairs" in the UTF-16 encoding used. On Unix wchar_t is 32 bits and each location is a character. On Unix if a src word is greater than 0x10ffff then this is an illegal character according to RFC 3629. These are converted as though they are 0xFFFD (REPLACEMENT CHARACTER). Characters in the range 0xd800 to 0xdfff, or ending with 0xfffe or 0xffff are also illegal according to RFC 3629. However I encode these as though they are legal, so that _utf8towc will return the original data. On Windows "surrogate pairs" are converted to a single character and UTF-8 encoded (as 4 bytes). Mismatched halves of surrogate pairs are converted as though they are individual characters. 29.11.3.10 const char utf8fwd ( const char p, const char start, const char end )

Move p forward until it points to the start of a UTF-8 character. If it already points at the start of one then it is returned unchanged. Any UTF-8 errors are treated as though each byte of the error is an individual character. start is the start of the string and is used to limit the backwards search for the start of a utf8 character. end is the end of the string and is assumed to be a break between characters. It is assumed to be greater than p. This function is for moving a pointer that was jumped to the middle of a string, such as when doing a binary search for a position. You should use either this or _utf8back() depending on which direction your
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.11 Unicode and UTF-8 functions algorithim can handle the pointer moving. Do not use this to scan strings, use _utf8decode() instead. 29.11.3.11 int utf8len ( char c )

281

return the byte length of the UTF-8 sequence with rst byte c, or -1 if c is not valid. This function is helpful for nding faulty UTF8 sequences. See also _utf8len1

29.11.3.12

int utf8len1 ( char c )

Return the byte length of the UTF-8 sequence with rst byte c, or 1 if c is not valid. This function can be used to scan faulty UTF8 sequence, albeit ignoring invalid codes. See also _utf8len

29.11.3.13

int utf8locale ( void )

Return true if the "locale" seems to indicate that UTF-8 encoding is used. If true the _utf8to_mb and _utf8from_mb dont do anything useful. It is highly recommended that you change your system so this does return true. On Windows this is done by setting the "codepage" to CP_UTF8. On Unix this is done by setting $LC_CTYPE to a string containing the letters "utf" or "UTF" in it, or by deleting all $LC and $LANG environment variables. In the future it is likely that all non-Asian Unix systems will return true, due to the compatibility of UTF-8 with ISO-8859-1.

29.11.3.14

int utf8test ( const char src, unsigned srclen )

Examines the rst srclen bytes in src and returns a verdict on whether it is UTF-8 or not. Returns 0 if there is any illegal UTF-8 sequences, using the same rules as _utf8decode(). Note that some UCS values considered illegal by RFC 3629, such as 0xffff, are considered legal by this. Returns 1 if there are only single-byte characters (ie no bytes have the high bit set). This is legal UTF-8, but also indicates plain ASCII. It also returns 1 if srclen is zero. Returns 2 if there are only characters less than 0x800. Returns 3 if there are only characters less than 0x10000. Returns 4 if there are characters in the 0x10000 to 0x10ffff range. Because there are many illegal sequences in UTF-8, it is almost impossible for a string in another encoding to be confused with UTF-8. This is very useful for transitioning Unix to UTF-8 lenames, you can simply test each lename with this to decide if it is UTF-8 or in the locale encoding. My hope is that if this is done we will be able to cleanly transition to a locale-less encoding.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

282 29.11.3.15

Module Documentation unsigned utf8to mb ( const char src, unsigned srclen, char dst, unsigned dstlen )

Convert the UTF-8 used by FLTK to the locale-specic encoding used for lenames (and sometimes used for data in les). Unfortunately due to stupid design you will have to do this as needed for lenames. This is a bug on both Unix and Windows. Up to dstlen bytes are written to dst, including a null terminator. The return value is the number of bytes that would be written, not counting the null terminator. If greater or equal to dstlen then if you malloc a new array of size n+1 you will have the space needed for the entire string. If dstlen is zero then nothing is written and this call just measures the storage space needed. If _utf8locale() returns true then this does not change the data. 29.11.3.16 unsigned utf8toa ( const char src, unsigned srclen, char dst, unsigned dstlen )

Convert a UTF-8 sequence into an array of 1-byte characters. If the UTF-8 decodes to a character greater than 0xff then it is replaced with ?. Errors in the UTF-8 are converted as individual bytes, same as _utf8decode() does. This allows ISO8859-1 text mistakenly identied as UTF-8 to be printed correctly (and possibly CP1512 on Windows). src points at the UTF-8, and srclen is the number of bytes to convert. Up to dstlen bytes are written to dst, including a null terminator. The return value is the number of bytes that would be written, not counting the null terminator. If greater or equal to dstlen then if you malloc a new array of size n+1 you will have the space needed for the entire string. If dstlen is zero then nothing is written and this call just measures the storage space needed. 29.11.3.17 unsigned utf8toUtf16 ( const char src, unsigned srclen, unsigned short dst, unsigned dstlen )

Convert a UTF-8 sequence into an array of 16-bit characters. These are used by some system calls, especially on Windows. src points at the UTF-8, and srclen is the number of bytes to convert. dst points at an array to write, and dstlen is the number of locations in this array. At most dstlen-1 words will be written there, plus a 0 terminating word. Thus this function will never overwrite the buffer and will always return a zero-terminated string. If dstlen is zero then dst can be null and no data is written, but the length is returned. The return value is the number of 16-bit words that would be written to dst if it were long enough, not counting the terminating zero. If the return value is greater or equal to dstlen it indicates truncation, you can then allocate a new array of size return+1 and call this again. Errors in the UTF-8 are converted as though each byte in the erroneous string is in the Microsoft CP1252 encoding. This allows ISO-8859-1 text mistakenly identied as UTF-8 to be printed correctly. Unicode characters in the range 0x10000 to 0x10ffff are converted to "surrogate pairs" which take two words each (this is called UTF-16 encoding). 29.11.3.18 unsigned utf8towc ( const char src, unsigned srclen, wchar t dst, unsigned dstlen )

Converts a UTF-8 string into a wide character string. This function generates 32-bit wchar_t (e.g. "ucs4" as it were) except on Windows where it is equivalent to _utf8toUtf16 and returns UTF-16.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.11 Unicode and UTF-8 functions src points at the UTF-8, and srclen is the number of bytes to convert.

283

dst points at an array to write, and dstlen is the number of locations in this array. At most dstlen-1 wchar_t will be written there, plus a 0 terminating wchar_t. The return value is the number of wchar_t that would be written to dst if it were long enough, not counting the terminating zero. If the return value is greater or equal to dstlen it indicates truncation, you can then allocate a new array of size return+1 and call this again. Notice that sizeof(wchar_t) is 2 on Windows and is 4 on Linux and most other systems. Where wchar_t is 16 bits, Unicode characters in the range 0x10000 to 0x10ffff are converted to "surrogate pairs" which take two words each (this is called UTF-16 encoding). If wchar_t is 32 bits this rather nasty problem is avoided. Note that Windows includes Cygwin, i.e. compiled with Cygwins POSIX layer (cygwin1.dll, --enablecygwin), either native (GDI) or X11. 29.11.3.19 int utf strcasecmp ( const char s1, const char s2 )

UTF-8 aware strcasecmp - converts to Unicode and tests. Todo Correct the incorrect logic where length of strings tested

29.11.3.20

int utf strncasecmp ( const char s1, const char s2, int n )

UTF-8 aware strncasecmp - converts to lower case Unicode and tests. Todo Correct the incorrect logic where length of strings tested Clarify whether n means number of bytes, or characters.

29.11.3.21

int utf tolower ( const unsigned char str, int len, char buf )

converts the str string to the lower case equivalent into buf. Warning: to be safe buf length must be at least 3 len [for 16-bit Unicode] 29.11.3.22 int utf toupper ( const unsigned char str, int len, char buf )

converts the str string to the upper case equivalent into buf. Warning: to be safe buf length must be at least 3 len [for 16-bit Unicode] 29.11.3.23 int wcwidth ( const char src )

extended wrapper around _wcwidth_(unsigned int ucs) function. Parameters in

src pointer to start of UTF-8 byte sequence

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

284 Returns width of character in columns

Module Documentation

Depending on build options, this function may map C1 control characters (0x80 to 0x9f) to CP1252, and return the width of that character instead. This is not the same behaviour as _wcwidth_(unsigned int ucs) . Note that other control characters and DEL will still return -1, so if you want different behaviour, you need to test for those characters before calling _wcwidth(), and handle them separately. 29.11.3.24 int wcwidth ( unsigned int ucs )

wrapper to adapt Markus Kuhns implementation of wcwidth() for FLTK Parameters in

ucs Unicode character value

Returns width of character in columns See http://www.cl.cam.ac.uk/mgk25/ucs/wcwidth.c for Markus Kuhns original implementation of wcwidth() and wcswidth() (dened in IEEE Std 1002.1-2001) for Unicode. WARNING: this function returns widths for "raw" Unicode characters. It does not even try to map C1 control characters (0x80 to 0x9F) to CP1252, and C0/C1 control characters and DEL will return -1. You are advised to use _width(const char src) instead.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.12 Mac OS X-specic symbols

285

29.12

Mac OS X-specic symbols

Mac OS X-specic symbols declared in <FL/x.H> or <FL/gl.h>

Classes
class Fl_Mac_App_Menu
Mac OS-specic class allowing to localize the application menu.

Functions
void _mac_set_about (Fl_Callback cb, void user_data, int shortcut=0)
Attaches a callback to the "About myprog" item of the system application menu.

void _open_callback (void(cb)(const char ))


Register a function called for each le dropped onto an application icon.

int gl_texture_pile_height (void)


Returns the current height of the pile of pre-computed string textures.

void gl_texture_pile_height (int max)


Changes the height of the pile of pre-computed string textures.

Variables
int _mac_os_version
The version number of the running Mac OS X (e.g., 100604 for 10.6.4)

29.12.1

Detailed Description

Mac OS X-specic symbols declared in <FL/x.H> or <FL/gl.h>

29.12.2
29.12.2.1

Function Documentation
void mac set about ( Fl_Callback cb, void user data, int shortcut = 0 )

Attaches a callback to the "About myprog" item of the system application menu. Parameters cb a callback that will be called by "About myprog" menu item with NULL 1st argument. user_data a pointer transmitted as 2nd argument to the callback. shortcut optional shortcut to attach to the "About myprog" menu item (e.g., FL_META+a)

29.12.2.2

void open callback ( void()(const char ) cb )

Register a function called for each le dropped onto an application icon. cb will be called with a single Unix-style le name and path. If multiple les were dropped, cb will be called multiple times.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

286 29.12.2.3 int gl texture pile height ( void )

Module Documentation

Returns the current height of the pile of pre-computed string textures. The default value is 100 29.12.2.4 void gl texture pile height ( int max )

Changes the height of the pile of pre-computed string textures. Strings that are often re-displayed can be processed much faster if this pile is set high enough to hold all of them. Parameters max Height of the texture pile

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.13 Common Dialogs classes and functions

287

29.13
Classes

Common Dialogs classes and functions

class Fl_Color_Chooser
The Fl_Color_Chooser widget provides a standard RGB color chooser.

class Fl_File_Chooser
The Fl_File_Chooser widget displays a standard le selection dialog that supports various selection modes.

Functions
void _alert (const char fmt,...)
Shows an alert message dialog box.

int _ask (const char fmt,...)


Shows a dialog displaying the fmt message, this dialog features 2 yes/no buttons.

void _beep (int type)


Emits a system beep message.

int _choice (const char fmt, const char b0, const char b1, const char b2,...)
Shows a dialog displaying the fmt message, this dialog features up to 3 customizable choice buttons.

int _color_chooser (const char name, double &r, double &g, double &b, int cmode)
Pops up a window to let the user pick an arbitrary RGB color.

int _color_chooser (const char name, uchar &r, uchar &g, uchar &b, int cmode)
Pops up a window to let the user pick an arbitrary RGB color.

char _dir_chooser (const char message, const char fname, int relative)
Shows a le chooser dialog and gets a directory.

char _le_chooser (const char message, const char pat, const char fname, int relative)
Shows a le chooser dialog and gets a lename.

void _le_chooser_callback (void(cb)(const char ))


Set the le chooser callback.

void _le_chooser_ok_label (const char l)


Set the "OK" button label.

const char _input (const char fmt, const char defstr,...)


Shows an input dialog displaying the fmt message.

void _message (const char fmt,...)


Shows an information message dialog box.

void _message_hotspot (int enable)


Sets whether or not to move the common message box used in many common dialogs like _message(), _alert(), _ask(), _choice(), _input(), _password() to follow the mouse pointer.

int _message_hotspot (void)


Gets whether or not to move the common message box used in many common dialogs like _message(), _alert(), _ask(), _choice(), _input(), _password() to follow the mouse pointer.

Fl_Widget _message_icon ()
Gets the Fl_Box icon container of the current default dialog used in many common dialogs like _message(), _alert(), _ask(), _choice(), _input(), _password()

void _message_title (const char title)


Sets the title of the dialog window used in many common dialogs.

void _message_title_default (const char title)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

288
Sets the default title of the dialog window used in many common dialogs.

Module Documentation

const char _password (const char fmt, const char defstr,...)


Shows an input dialog displaying the fmt message.

Variables
static void( Fl::error )(const char ,...) = ::error
FLTK calls Fl::error() to output a normal error message.

static void( Fl::fatal )(const char ,...) = ::fatal


FLTK calls Fl::fatal() to output a fatal error message.

const char _cancel = "Cancel"


string pointer used in common dialogs, you can change it to another language

const char _close = "Close"


string pointer used in common dialogs, you can change it to another language

const char _no = "No"


string pointer used in common dialogs, you can change it to another language

const char _ok = "OK"


string pointer used in common dialogs, you can change it to another language

const char _yes = "Yes"


string pointer used in common dialogs, you can change it to another language

static void( Fl::warning )(const char ,...) = ::warning


FLTK calls Fl::warning() to output a warning message.

29.13.1
29.13.1.1

Function Documentation
void alert ( const char fmt, ... )

Shows an alert message dialog box. Note Common dialog boxes are application modal. No more than one common dialog box can be open at any time. Requests for additional dialog boxes are ignored. #include <FL/_ask.H>

Parameters in

fmt can be used as an sprintf-like format and variables for the message text

29.13.1.2

int ask ( const char fmt, ... )

Shows a dialog displaying the fmt message, this dialog features 2 yes/no buttons. Note Common dialog boxes are application modal. No more than one common dialog box can be open at any time. Requests for additional dialog boxes are ignored. #include <FL/_ask.H>

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.13 Common Dialogs classes and functions Parameters in

289

fmt can be used as an sprintf-like format and variables for the message text

Return values 0 if the no button is selected or another dialog box is still open 1 if yes is selected

29.13.1.3

void beep ( int type )

Emits a system beep message. Note #include <FL/_ask.H>

29.13.1.4

int choice ( const char fmt, const char b0, const char b1, const char b2, ... )

Shows a dialog displaying the fmt message, this dialog features up to 3 customizable choice buttons. Note Common dialog boxes are application modal. No more than one common dialog box can be open at any time. Requests for additional dialog boxes are ignored. #include <FL/_ask.H>

Parameters in in in in

fmt b0 b1 b2

can be used as an sprintf-like format and variables for the message text text label of button 0 text label of button 1 text label of button 2

Return values 0 if the rst button with b0 text is selected or another dialog box is still open 1 if the second button with b1 text is selected 2 if the third button with b2 text is selected

29.13.1.5

int color chooser ( const char name, double & r, double & g, double & b, int cmode ) [related]

Pops up a window to let the user pick an arbitrary RGB color.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

290 Note #include <FL/Fl_Color_Chooser.H>

Module Documentation

Figure 29.2: _color_chooser

Parameters in in,out in

name Title label for the window r,g,b Color components in the range 0.0 to 1.0. cmode Optional mode for color chooser. See mode(int). Default -1 if none (rgb mode).

Return values 1 if user conrms the selection 0 if user cancels the dialog

29.13.1.6

int color chooser ( const char name, uchar & r, uchar & g, uchar & b, int cmode ) [related]

Pops up a window to let the user pick an arbitrary RGB color.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.13 Common Dialogs classes and functions Note #include <FL/Fl_Color_Chooser.H>

291

Figure 29.3: _color_chooser

Parameters in in,out in

name Title label for the window r,g,b Color components in the range 0 to 255. cmode Optional mode for color chooser. See mode(int). Default -1 if none (rgb mode).

Return values 1 if user conrms the selection 0 if user cancels the dialog

29.13.1.7

char dir chooser ( const char message, const char fname, int relative ) [related]

Shows a le chooser dialog and gets a directory. Note #include <FL/Fl_File_Chooser.H>

Parameters in in in

message title bar text fname initial/default directory name relative 0 for absolute path return, relative otherwise

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

292 Returns the directory path string chosen by the user or NULL if user cancels

Module Documentation

29.13.1.8

char le chooser ( const char message, const char pat, const char fname, int relative ) [related]

Shows a le chooser dialog and gets a lename. Note #include <FL/Fl_File_Chooser.H>

Figure 29.4: Fl_File_Chooser

Parameters in in in in

message pat fname relative

text in title bar lename pattern lter initial/default lename selection 0 for absolute path name, relative path name otherwise

Returns the user selected lename, in absolute or relative format or NULL if user cancels

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.13 Common Dialogs classes and functions 29.13.1.9 void le chooser callback ( void()(const char ) cb ) [related]

293

Set the le chooser callback. Note #include <FL/Fl_File_Chooser.H>

29.13.1.10

void le chooser ok label ( const char l ) [related]

Set the "OK" button label. Note #include <FL/Fl_File_Chooser.H>

29.13.1.11

const char input ( const char fmt, const char defstr, ... )

Shows an input dialog displaying the fmt message. Note Common dialog boxes are application modal. No more than one common dialog box can be open at any time. Requests for additional dialog boxes are ignored. #include <FL/_ask.H>

Parameters in in

fmt can be used as an sprintf-like format and variables for the message text defstr denes the default returned string if no text is entered

Returns the user string input if OK was pushed, NULL if Cancel was pushed or another dialog box was still open

29.13.1.12

void message ( const char fmt, ... )

Shows an information message dialog box. Note Common dialog boxes are application modal. No more than one common dialog box can be open at any time. Requests for additional dialog boxes are ignored. #include <FL/_ask.H>

Parameters in

fmt can be used as an sprintf-like format and variables for the message text

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

294 29.13.1.13 void message hotspot ( int enable )

Module Documentation

Sets whether or not to move the common message box used in many common dialogs like _message(), _alert(), _ask(), _choice(), _input(), _password() to follow the mouse pointer. The default is enabled, so that the default button is the hotspot and appears at the mouse position. Note #include <FL/_ask.H>

Parameters in

enable non-zero enables hotspot behavior, 0 disables hotspot

29.13.1.14

int message hotspot ( void )

Gets whether or not to move the common message box used in many common dialogs like _message(), _alert(), _ask(), _choice(), _input(), _password() to follow the mouse pointer. Note #include <FL/_ask.H> Returns 0 if disable, non-zero otherwise See also _message_hotspot(int)

29.13.1.15 Fl_Widget message icon ( ) Gets the Fl_Box icon container of the current default dialog used in many common dialogs like _message(), _alert(), _ask(), _choice(), _input(), _password() Note #include <FL/_ask.H>

29.13.1.16

void message title ( const char title )

Sets the title of the dialog window used in many common dialogs. This window title will be used in the next call of one of the common dialogs like _message(), _alert(), _ask(), _choice(), _input(), _password(). The title string is copied internally, so that you can use a local variable or free the string immediately after this call. It applies only to the next call of one of the common dialogs and will be reset to an empty title (the default for all dialogs) after that call.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.13 Common Dialogs classes and functions Note #include <FL/_ask.H>

295

Parameters in

title window label, string copied internally

29.13.1.17

void message title default ( const char title )

Sets the default title of the dialog window used in many common dialogs. This window title will be used in all subsequent calls of one of the common dialogs like _message(), _alert(), _ask(), _choice(), _input(), _password(), unless a specic title has been set with _message_title(const char title). The default is no title. You can override the default title for a single dialog with _message_title(const char title). The title string is copied internally, so that you can use a local variable or free the string immediately after this call. Note #include <FL/_ask.H>

Parameters in

title default window label, string copied internally

29.13.1.18

const char password ( const char fmt, const char defstr, ... )

Shows an input dialog displaying the fmt message. Like _input() except the input text is not shown, characters are displayed instead. Note Common dialog boxes are application modal. No more than one common dialog box can be open at any time. Requests for additional dialog boxes are ignored. #include <FL/_ask.H>

Parameters in in

fmt can be used as an sprintf-like format and variables for the message text defstr denes the default returned string if no text is entered

Returns the user string input if OK was pushed, NULL if Cancel was pushed or aother dialog box was still open

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

296

Module Documentation

29.13.2
29.13.2.1

Variable Documentation
void( Fl::error)(const char format,...) = ::error [static]

FLTK calls Fl::error() to output a normal error message. The default version on Windows displays the error message in a MessageBox window. The default version on all other platforms prints the error message to stderr. You can override the behavior by setting the function pointer to your own routine. Fl::error() means there is a recoverable error such as the inability to read an image le. The default implementation returns after displaying the message. Note #include <FL/Fl.H>

29.13.2.2

void( Fl::fatal)(const char format,...) = ::fatal [static]

FLTK calls Fl::fatal() to output a fatal error message. The default version on Windows displays the error message in a MessageBox window. The default version on all other platforms prints the error message to stderr. You can override the behavior by setting the function pointer to your own routine. Fl::fatal() must not return, as FLTK is in an unusable state, however your version may be able to use longjmp or an exception to continue, as long as it does not call FLTK again. The default implementation exits with status 1 after displaying the message. Note #include <FL/Fl.H>

29.13.2.3

void( Fl::warning)(const char format,...) = ::warning [static]

FLTK calls Fl::warning() to output a warning message. The default version on Windows returns without printing a warning message, because Windows programs normally dont have stderr (a console window) enabled. The default version on all other platforms prints the warning message to stderr. You can override the behavior by setting the function pointer to your own routine. Fl::warning() means that there was a recoverable problem, the display may be messed up, but the user can probably keep working - all X protocol errors call this, for example. The default implementation returns after displaying the message. Note #include <FL/Fl.H>

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.14 File names and URI utility functions

297

29.14

File names and URI utility functions

File names and URI functions dened in <FL/lename.H>

Denes
#dene _dirent_h_cyclic_include #dene FL_PATH_MAX 2048
all path buffers should use this length

Typedefs
typedef int( Fl_File_Sort_F )(struct dirent , struct dirent )
File sorting function.

Functions
FL_EXPORT int _lename_absolute (char to, int tolen, const char from)
Makes a lename absolute from a relative lename.

FL_EXPORT int _lename_expand (char to, int tolen, const char from)
Expands a lename containing shell variables and tilde ().

FL_EXPORT const char _lename_ext (const char buf)


Gets the extensions of a lename.

FL_EXPORT void _lename_free_list (struct dirent l, int n)


Free the list of lenames that is generated by _lename_list().

FL_EXPORT int _lename_isdir (const char name)


Determines if a le exists and is a directory from its lename.

FL_EXPORT int _lename_list (const char d, struct dirent l, Fl_File_Sort_F s=_numericsort)


Portable and const-correct wrapper for the scandir() function.

FL_EXPORT int _lename_match (const char name, const char pattern)


Checks if a string s matches a pattern p.

FL_EXPORT const char _lename_name (const char lename)


Gets the le name from a path.

FL_EXPORT int _lename_relative (char to, int tolen, const char from)
Makes a lename relative to the current working directory.

FL_EXPORT char _lename_setext (char to, int tolen, const char ext)
Replaces the extension in buf of max.

FL_EXPORT int _open_uri (const char uri, char msg, int msglen)
Opens the specied Uniform Resource Identier (URI).

29.14.1

Detailed Description

File names and URI functions dened in <FL/lename.H>


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

298

Module Documentation

29.14.2
29.14.2.1

Typedef Documentation
typedef int( Fl_File_Sort_F)(struct dirent , struct dirent )

File sorting function. See also _lename_list()

29.14.3
29.14.3.1

Function Documentation
FL EXPORT int lename absolute ( char to, int tolen, const char from )

Makes a lename absolute from a relative lename.


#include <FL/filename.H> [..] chdir("/var/tmp"); fl_filename_absolute(out, sizeof(out), "foo.txt"); // out="/var/tmp/foo.txt" fl_filename_absolute(out, sizeof(out), "./foo.txt"); // out="/var/tmp/foo.txt" fl_filename_absolute(out, sizeof(out), "../log/messages"); // out="/var/log/messages"

Parameters out in in

to resulting absolute lename tolen size of the absolute lename buffer from relative lename

Returns 0 if no change, non zero otherwise

29.14.3.2

FL EXPORT int lename expand ( char to, int tolen, const char from )

Expands a lename containing shell variables and tilde (). Currently handles these variants:
"~username" unchanged "~/file" "$VARNAME" // if username does not exist, result will be

// does NOT handle ${VARNAME}

Examples:
#include <FL/filename.H> [..] putenv("TMPDIR=/var/tmp"); fl_filename_expand(out, sizeof(out), "~fred/.cshrc"); out="/usr/fred/.cshrc" fl_filename_expand(out, sizeof(out), "~/.cshrc");

// //

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.14 File names and URI utility functions


out="/usr/<yourname>/.cshrc" fl_filename_expand(out, sizeof(out), "$TMPDIR/foo.txt"); out="/var/tmp/foo.txt"

299

//

Parameters out in in

to resulting expanded lename tolen size of the expanded lename buffer from lename containing shell variables

Returns 0 if no change, non zero otherwise

29.14.3.3

FL EXPORT const char lename ext ( const char buf )

Gets the extensions of a lename.


#include <FL/filename.H> [..] const char *out; out = fl_filename_ext("/some/path/foo.txt"); out = fl_filename_ext("/some/path/foo");

// result: ".txt" // result: NULL

Parameters in

buf the lename to be parsed

Returns a pointer to the extension (including .) if any or NULL otherwise

29.14.3.4

FL EXPORT void lename free list ( struct dirent list, int n )

Free the list of lenames that is generated by _lename_list(). Free everything that was allocated by a previous call to _lename_list(). Use the return values as parameters for this function. Parameters in,out in

list table containing the resulting directory listing n number of entries in the list

29.14.3.5

FL EXPORT int lename isdir ( const char n )

Determines if a le exists and is a directory from its lename.


#include <FL/filename.H> [..]
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

300
fl_filename_isdir("/etc"); fl_filename_isdir("/etc/hosts"); // returns non-zero // returns 0

Module Documentation

Parameters in

n the lename to parse

Returns non zero if le exists and is a directory, zero otherwise

29.14.3.6

FL EXPORT int lename list ( const char d, dirent list, Fl_File_Sort_F sort )

Portable and const-correct wrapper for the scandir() function. For each le in that directory a "dirent" structure is created. The only portable thing about a dirent is that dirent.d_name is the nul-terminated le name. An pointers array to these dirents is created and a pointer to the array is returned in list. The number of entries is given as a return value. If there is an error reading the directory a number less than zero is returned, and errno has the reason; errno does not work under WIN32. Include:
#include <FL/filename.H>

Parameters in out in

d the name of the directory to list. It does not matter if it has a trailing slash. list table containing the resulting directory listing sort sorting functor: _alphasort: The les are sorted in ascending alphabetical order; upper and lowercase letters are compared according to their ASCII ordering uppercase before lowercase. _casealphasort: The les are sorted in ascending alphabetical order; upper and lowercase letters are compared equally case is not signicant. _casenumericsort: The les are sorted in ascending "alphanumeric" order, where an attempt is made to put unpadded numbers in consecutive order; upper and lowercase letters are compared equally case is not signicant. _numericsort: The les are sorted in ascending "alphanumeric" order, where an attempt is made to put unpadded numbers in consecutive order; upper and lowercase letters are compared according to their ASCII ordering - uppercase before lowercase.

Returns the number of entries if no error, a negative value otherwise.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.14 File names and URI utility functions 29.14.3.7 FL EXPORT int lename match ( const char s, const char p )

301

Checks if a string s matches a pattern p. The following syntax is used for the pattern: matches any sequence of 0 or more characters. ? matches any single character. [set] matches any character in the set. Set can contain any single characters, or a-z to represent a range. To match ] or - they must be the rst characters. To match or ! they must not be the rst characters. [ set] or [!set] matches any character not in the set. {X|Y|Z} or {X,Y,Z} matches any one of the subexpressions literally. \x quotes the character x so it has no special meaning. x all other characters must be matched exactly. Include:
#include <FL/filename.H>

Parameters in in

s the string to check for a match p the string pattern

Returns non zero if the string matches the pattern

29.14.3.8

FL EXPORT const char lename name ( const char lename )

Gets the le name from a path. Similar to basename(3), exceptions shown below.
#include <FL/filename.H> [..] const char *out; out = fl_filename_name("/usr/lib"); out = fl_filename_name("/usr/"); "usr" instead) out = fl_filename_name("/usr"); out = fl_filename_name("/"); "/" instead) out = fl_filename_name("."); out = fl_filename_name("..");

// out="lib" // out="" // out="usr" // out="" // out="." // out=".."

(basename(3) returns

(basename(3) returns

Returns a pointer to the char after the last slash, or to filename if there is none.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

302 29.14.3.9

Module Documentation FL EXPORT int lename relative ( char to, int tolen, const char from )

Makes a lename relative to the current working directory.


#include <FL/filename.H> [..] chdir("/var/tmp/somedir"); // set cwd to /var/tmp/somedir [..] char out[FL_PATH_MAX]; fl_filename_relative(out, sizeof(out), "/var/tmp/somedir/foo.txt"); out="foo.txt", return=1 fl_filename_relative(out, sizeof(out), "/var/tmp/foo.txt"); out="../foo.txt", return=1 fl_filename_relative(out, sizeof(out), "foo.txt"); out="foo.txt", return=0 (no change) fl_filename_relative(out, sizeof(out), "./foo.txt"); out="./foo.txt", return=0 (no change) fl_filename_relative(out, sizeof(out), "../foo.txt"); out="../foo.txt", return=0 (no change)

// // // // //

Parameters out in in

to resulting relative lename tolen size of the relative lename buffer from absolute lename

Returns 0 if no change, non zero otherwise

29.14.3.10

FL EXPORT char lename setext ( char buf, int buen, const char ext )

Replaces the extension in buf of max. size buflen with the extension in ext. If theres no . in buf, ext is appended. If ext is NULL, behaves as if it were an empty string (""). Example
#include <FL/filename.H> [..] char buf[FL_PATH_MAX] = "/path/myfile.cxx"; fl_filename_setext(buf, sizeof(buf), ".txt"); "/path/myfile.txt"

// buf[] becomes

Returns buf itself for calling convenience.

29.14.3.11

int open uri ( const char uri, char msg, int msglen )

Opens the specied Uniform Resource Identier (URI).


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

29.14 File names and URI utility functions

303

Uses an operating-system dependent program or interface. For URIs using the "ftp", "http", or "https" schemes, the system default web browser is used to open the URI, while "mailto" and "news" URIs are typically opened using the system default mail reader and "le" URIs are opened using the le system navigator. On success, the (optional) msg buffer is lled with the command that was run to open the URI; on Windows, this will always be "open uri". On failure, the msg buffer is lled with an English error message. Example
#include <FL/filename.H> [..] char errmsg[512]; if ( !fl_open_uri("http://google.com/", errmsg, sizeof(errmsg)) ) { char warnmsg[768]; sprintf(warnmsg, "Error: %s", errmsg); fl_alert(warnmsg); }

Parameters uri The URI to open msg Optional buffer which contains the command or error message msglen Length of optional buffer

Returns 1 on success, 0 on failure

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

304

Module Documentation

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Chapter 30

Class Documentation
30.1 Fl Table Row::CharVector Class Reference

Public Member Functions


char back () CharVector (CharVector &o) CharVector & operator= (CharVector &o) char operator[ ] (int x) const char & operator[ ] (int x) char pop_back () void push_back (char val) int size () void size (int count)

The documentation for this class was generated from the following le: Fl_Table_Row.H

30.2

Fl Preferences::Entry Struct Reference

Public Attributes
char name char value The documentation for this struct was generated from the following le: Fl_Preferences.H

30.3

Fl Class Reference

The Fl is the FLTK global (static) class containing state information and global methods for the current application. #include <Fl.H>

306

Class Documentation

Public Types
enum Fl_Option { OPTION_ARROW_FOCUS = 0, OPTION_VISIBLE_FOCUS, OPTION_DND_TEXT, OPTION_SHOW_TOOLTIPS, OPTION_LAST }
Enumerator for global FLTK options.

Static Public Member Functions


static int add_awake_handler_ (Fl_Awake_Handler, void )
Adds an awake handler for use in awake().

static void add_check (Fl_Timeout_Handler, void =0)


FLTK will call this callback just before it ushes the display and waits for events.

static void add_fd (int fd, int when, Fl_FD_Handler cb, void =0)
Adds le descriptor fd to listen to.

static void add_fd (int fd, Fl_FD_Handler cb, void =0)


See void add_fd(int fd, int when, Fl_FD_Handler cb, void = 0)

static void add_handler (Fl_Event_Handler h)


Install a function to parse unrecognized events.

static void add_idle (Fl_Idle_Handler cb, void data=0)


Adds a callback function that is called every time by Fl::wait() and also makes it act as though the timeout is zero (this makes Fl::wait() return immediately, so if it is in a loop it is called repeatedly, and thus the idle fucntion is called repeatedly).

static void add_timeout (double t, Fl_Timeout_Handler, void =0)


Adds a one-shot timeout callback.

static int arg (int argc, char argv, int &i)


Parse a single switch from argv, starting at word i.

static int args (int argc, char argv, int &i, Fl_Args_Handler cb=0)
Parse command line switches using the cb argument handler.

static void args (int argc, char argv)


Parse all command line switches matching standard FLTK options only.

static void awake (void message=0)


Sends a message pointer to the main thread, causing any pending Fl::wait() call to terminate so that the main thread can retrieve the message and any pending redraws can be processed.

static int awake (Fl_Awake_Handler cb, void message=0)


See void awake(void message=0).

static void background (uchar, uchar, uchar)


Changes _color(FL_BACKGROUND_COLOR) to the given color, and changes the gray ramp from 32 to 56 to black to white.

static void background2 (uchar, uchar, uchar)


Changes the alternative background color.

static Fl_Widget belowmouse ()


Gets the widget that is below the mouse.

static void belowmouse (Fl_Widget )


Sets the widget that is below the mouse.

static int box_dh (Fl_Boxtype)


Returns the height offset for the given boxtype.

static int box_dw (Fl_Boxtype)


Returns the width offset for the given boxtype.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.3 Fl Class Reference static int box_dx (Fl_Boxtype)


Returns the X offset for the given boxtype.

307

static int box_dy (Fl_Boxtype)


Returns the Y offset for the given boxtype.

static void cairo_autolink_context (bool alink)


when FLTK_HAVE_CAIRO is dened and cairo_autolink_context() is true, any current window dc is linked to a current context.

static bool cairo_autolink_context ()


Gets the current autolink mode for cairo support.

static cairo_t cairo_cc ()


Gets the current cairo context linked with a tk window.

static void cairo_cc (cairo_t c, bool own=false)


Sets the current cairo context to c.

static cairo_t cairo_make_current (Fl_Window w) static int check ()


Same as Fl::wait(0).

static void clear_widget_pointer (Fl_Widget const w)


Clears a widget pointer in the watch list.

static int compose (int &del)


Any text editing widget should call this for each FL_KEYBOARD event.

static void compose_reset ()


If the user moves the cursor, be sure to call Fl::compose_reset().

static void copy (const char stuff, int len, int destination=0)
Copies the data pointed to by stuff to the selection buffer (destination is 0) or the clipboard (destination is 1); len is the number of relevant bytes in stuff.

static void damage (int d)


If true then ush() will do something.

static int damage ()


If true then ush() will do something.

static void default_atclose (Fl_Window , void )


Default callback for window widgets.

static void delete_widget (Fl_Widget w)


Schedules a widget for deletion at the next call to the event loop.

static void display (const char )


Sets the X display to use for all windows.

static int dnd ()


Initiate a Drag And Drop operation.

static void dnd_text_ops (int v)


Gets or sets whether drag and drop text operations are supported.

static int dnd_text_ops ()


Gets or sets whether drag and drop text operations are supported.

static void do_widget_deletion ()


Deletes widgets previously scheduled for deletion.

static int draw_box_active ()


Determines if the current draw box is active or inactive.

static int event ()


Returns the last event that was processed.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

308 static int event_alt ()


Returns non-zero if the Alt key is pressed.

Class Documentation

static int event_button ()


Gets which particular mouse button caused the current event.

static int event_button1 ()


Returns non-zero if mouse button 1 is currently held down.

static int event_button2 ()


Returns non-zero if button 2 is currently held down.

static int event_button3 ()


Returns non-zero if button 3 is currently held down.

static int event_buttons ()


Returns the mouse buttons state bits; if non-zero, then at least one button is pressed now.

static int event_clicks ()


Returns non zero if we had a double click event.

static void event_clicks (int i)


Manually sets the number returned by Fl::event_clicks().

static int event_command ()


Returns non-zero if the FL_COMMAND key is pressed, either FL_CTRL or on OSX FL_META.

static int event_ctrl ()


Returns non-zero if the Control key is pressed.

static void event_dispatch (Fl_Event_Dispatch d)


Set a new event dispatch function.

static Fl_Event_Dispatch event_dispatch ()


Return the current event dispatch function.

static int event_dx ()


Returns the current horizontal mouse scrolling associated with the FL_MOUSEWHEEL event.

static int event_dy ()


Returns the current vertical mouse scrolling associated with the FL_MOUSEWHEEL event.

static int event_inside (int, int, int, int)


Returns whether or not the mouse event is inside the given rectangle.

static int event_inside (const Fl_Widget )


Returns whether or not the mouse event is inside a given child widget.

static int event_is_click ()


Returns non-zero if the mouse has not moved far enough and not enough time has passed since the last FL_PUSH or FL_KEYBOARD event for it to be considered a "drag" rather than a "click".

static void event_is_click (int i)


Clears the value returned by Fl::event_is_click().

static int event_key ()


Gets which key on the keyboard was last pushed.

static int event_key (int key)


Returns true if the given key was held down (or pressed) during the last event.

static int event_length ()


Returns the length of the text in Fl::event_text().

static int event_original_key ()


Returns the keycode of the last key event, regardless of the NumLock state.

static int event_shift ()


Returns non-zero if the Shift key is pressed.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.3 Fl Class Reference static int event_state ()

309

This is a biteld of what shift states were on and what mouse buttons were held down during the most recent event.

static int event_state (int i)


See int event_state()

static const char event_text ()


Returns the text associated with the current event, including FL_PASTE or FL_DND_RELEASE events.

static int event_x ()


Returns the mouse position of the event relative to the Fl_Window it was passed to.

static int event_x_root ()


Returns the mouse position on the screen of the event.

static int event_y ()


Returns the mouse position of the event relative to the Fl_Window it was passed to.

static int event_y_root ()


Returns the mouse position on the screen of the event.

static Fl_Window rst_window ()


Returns the rst top-level window in the list of shown() windows.

static void rst_window (Fl_Window )


Sets the window that is returned by rst_window().

static void ush ()


Causes all the windows that need it to be redrawn and graphics forced out through the pipes.

static Fl_Widget focus ()


Gets the current Fl::focus() widget.

static void focus (Fl_Widget )


Sets the widget that will receive FL_KEYBOARD events.

static void foreground (uchar, uchar, uchar)


Changes _color(FL_FOREGROUND_COLOR).

static void free_color (Fl_Color i, int overlay=0)


Frees the specied color from the colormap, if applicable.

static int get_awake_handler_ (Fl_Awake_Handler &, void &)


Gets the last stored awake handler for use in awake().

static Fl_Box_Draw_F get_boxtype (Fl_Boxtype)


Gets the current box drawing function for the specied box type.

static unsigned get_color (Fl_Color i)


Returns the RGB value(s) for the given FLTK color index.

static void get_color (Fl_Color i, uchar &red, uchar &green, uchar &blue)
Returns the RGB value(s) for the given FLTK color index.

static const char get_font (Fl_Font)


Gets the string for this face.

static const char get_font_name (Fl_Font, int attributes=0)


Get a human-readable string describing the family of this face.

static int get_font_sizes (Fl_Font, int &sizep)


Return an array of sizes in sizep.

static int get_key (int key)


Returns true if the given key is held down now.

static void get_mouse (int &, int &)


Return where the mouse is on the screen by doing a round-trip query to the server.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

310 static void get_system_colors ()

Class Documentation

Read the user preference colors from the system and use them to call Fl::foreground(), Fl::background(), and Fl::background2().

static int gl_visual (int, int alist=0)


This does the same thing as Fl::visual(int) but also requires OpenGL drawing to work.

static Fl_Window grab ()


Returns the window that currently receives all events.

static void grab (Fl_Window )


Selects the window to grab.

static void grab (Fl_Window &win)


See grab(Fl_Window)

static int h ()
Returns the height of the screen work area in pixels.

static int handle (int, Fl_Window )


Handle events from the window system.

static int handle_ (int, Fl_Window )


Handle events from the window system.

static int has_check (Fl_Timeout_Handler, void =0)


Returns 1 if the check exists and has not been called yet, 0 otherwise.

static int has_idle (Fl_Idle_Handler cb, void data=0)


Returns true if the specied idle callback is currently installed.

static int has_timeout (Fl_Timeout_Handler, void =0)


Returns true if the timeout exists and has not been called yet.

static int lock ()


The lock() method blocks the current thread until it can safely access FLTK widgets and data.

static Fl_Window modal ()


Returns the top-most modal() window currently shown.

static Fl_Window next_window (const Fl_Window )


Returns the next top-level window in the list of shown() windows.

static bool option (Fl_Option opt)


FLTK library options management.

static void option (Fl_Option opt, bool val)


Override an option while the application is running.

static void own_colormap ()


Makes FLTK use its own colormap.

static void paste (Fl_Widget &receiver, int source)


Pastes the data from the selection buffer (source is 0) or the clipboard (source is 1) into receiver.

static void paste (Fl_Widget &receiver)


Backward compatibility only.

static Fl_Widget pushed ()


Gets the widget that is being pushed.

static void pushed (Fl_Widget )


Sets the widget that is being pushed.

static Fl_Widget readqueue ()


All Fl_Widgets that dont have a callback dened use a default callback that puts a pointer to the widget in this queue, and this method reads the oldest widget out of this queue.

static int ready ()


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.3 Fl Class Reference

311

This is similar to Fl::check() except this does not call Fl::ush() or any callbacks, which is useful if your program is in a state where such callbacks are illegal.

static void redraw ()


Redraws all widgets.

static void release ()


Releases the current grabbed window, equals grab(0).

static void release_widget_pointer (Fl_Widget &w)


Releases a widget pointer from the watch list.

static int reload_scheme ()


Called by scheme according to scheme name.

static void remove_check (Fl_Timeout_Handler, void =0)


Removes a check callback.

static void remove_fd (int, int when)


Removes a le descriptor handler.

static void remove_fd (int)


Removes a le descriptor handler.

static void remove_handler (Fl_Event_Handler h)


Removes a previously added event handler.

static void remove_idle (Fl_Idle_Handler cb, void data=0)


Removes the specied idle callback, if it is installed.

static void remove_timeout (Fl_Timeout_Handler, void =0)


Removes a timeout callback.

static void repeat_timeout (double t, Fl_Timeout_Handler, void =0)


Repeats a timeout callback from the expiration of the previous timeout, allowing for more accurate timing.

static int run ()


As long as any windows are displayed this calls Fl::wait() repeatedly.

static int scheme (const char )


Gets or sets the current widget scheme.

static const char scheme ()


See void scheme(const char name)

static int screen_count ()


Gets the number of available screens.

static void screen_dpi (oat &h, oat &v, int n=0)


Gets the screen resolution in dots-per-inch for the given screen.

static void screen_xywh (int &X, int &Y, int &W, int &H)
Gets the bounding box of a screen that contains the mouse pointer.

static void screen_xywh (int &X, int &Y, int &W, int &H, int mx, int my)
Gets the bounding box of a screen that contains the specied screen position mx, my.

static void screen_xywh (int &X, int &Y, int &W, int &H, int n)
Gets the screen bounding rect for the given screen.

static void screen_xywh (int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh)
Gets the screen bounding rect for the screen which intersects the most with the rectangle dened by mx, my, mw, mh.

static int scrollbar_size ()


Gets the default scrollbar size used by Fl_Browser_, Fl_Help_View, Fl_Scroll, and Fl_Text_Display widgets.

static void scrollbar_size (int W)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

312

Class Documentation
Sets the default scrollbar size that is used by the Fl_Browser_, Fl_Help_View, Fl_Scroll, and Fl_Text_Display widgets.

static void selection (Fl_Widget &owner, const char , int len)


Changes the current selection.

static Fl_Widget selection_owner ()


back-compatibility only: Gets the widget owning the current selection

static void selection_owner (Fl_Widget )


Back-compatibility only: The single-argument call can be used to move the selection to another widget or to set the owner to NULL, without changing the actual text of the selection.

static void set_abort (Fl_Abort_Handler f)


For back compatibility, sets the void Fl::fatal handler callback.

static void set_atclose (Fl_Atclose_Handler f)


For back compatibility, sets the Fl::atclose handler callback.

static void set_boxtype (Fl_Boxtype, Fl_Box_Draw_F , uchar, uchar, uchar, uchar)


Sets the function to call to draw a specic boxtype.

static void set_boxtype (Fl_Boxtype, Fl_Boxtype from)


Copies the from boxtype.

static void set_color (Fl_Color, uchar, uchar, uchar)


Sets an entry in the _color index table.

static void set_color (Fl_Color i, unsigned c)


Sets an entry in the _color index table.

static void set_font (Fl_Font, const char )


Changes a face.

static void set_font (Fl_Font, Fl_Font)


Copies one face to another.

static Fl_Font set_fonts (const char =0)


FLTK will open the display, and add every fonts on the server to the face table.

static void set_idle (Fl_Old_Idle_Handler cb)


Sets an idle callback.

static void set_labeltype (Fl_Labeltype, Fl_Label_Draw_F , Fl_Label_Measure_F )


Sets the functions to call to draw and measure a specic labeltype.

static void set_labeltype (Fl_Labeltype, Fl_Labeltype from)


Sets the functions to call to draw and measure a specic labeltype.

static int test_shortcut (Fl_Shortcut)


Tests the current event, which must be an FL_KEYBOARD or FL_SHORTCUT, against a shortcut value (described in Fl_Button).

static void thread_message ()


The thread_message() method returns the last message that was sent from a child by the awake() method.

static void unlock ()


The unlock() method releases the lock that was set using the lock() method.

static double version ()


Returns the compiled-in value of the FL_VERSION constant.

static void visible_focus (int v)


Gets or sets the visible keyboard focus on buttons and other non-text widgets.

static int visible_focus ()


Gets or sets the visible keyboard focus on buttons and other non-text widgets.

static int visual (int)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.3 Fl Class Reference


Selects a visual so that your graphics are drawn correctly.

313

static int w ()
Returns the width of the screen work area in pixels.

static int wait ()


Waits until "something happens" and then returns.

static double wait (double time)


See int Fl::wait()

static void watch_widget_pointer (Fl_Widget &w)


Adds a widget pointer to the widget watch list.

static int x ()
Returns the origin of the current screen work area, where 0 indicates the left side of the screen.

static int y ()
Returns the origin of the current screen work area, where 0 indicates the top edge of the screen.

Static Public Attributes


static void( atclose )(Fl_Window , void ) = default_atclose
Back compatibility: default window callback handler.

static void( error )(const char ,...) = ::error


FLTK calls Fl::error() to output a normal error message.

static void( fatal )(const char ,...) = ::fatal


FLTK calls Fl::fatal() to output a fatal error message.

static const char const help = helpmsg+13


Usage string displayed if Fl::args() detects an invalid argument.

static void( idle )()


The currently executing idle callback function: DO NOT USE THIS DIRECTLY!

static void( warning )(const char ,...) = ::warning


FLTK calls Fl::warning() to output a warning message.

30.3.1

Detailed Description

The Fl is the FLTK global (static) class containing state information and global methods for the current application.

30.3.2
30.3.2.1

Member Enumeration Documentation


enum Fl::Fl_Option

Enumerator for global FLTK options. These options can be set system wide, per user, or for the running application only.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

314 See also Fl::option(Fl_Option, bool) Fl::option(Fl_Option) Enumerator:

Class Documentation

OPTION_ARROW_FOCUS When switched on, moving the text cursor beyond the start or end of a text in a text widget will change focus to the next text widget. When switched off, the cursor will stop at the end of the text. Pressing Tab or Ctrl-Tab will advance the keyboard focus. OPTION_VISIBLE_FOCUS If visible focus is switched on, FLTK will draw a dotted rectangle inside the widget that will receive the next keystroke. If switched off, no such indicator will be drawn and keyboard navigation is disabled. OPTION_DND_TEXT If text drag-and-drop is enabled, the user can select and drag text from any text widget. If disabled, no dragging is possible, however dropping text from other applications still works. OPTION_SHOW_TOOLTIPS If tooltips are enabled, hovering the mouse over a widget with a tooltip text will open a little tooltip window until the mouse leaves the widget. If disabled, no tooltip is shown. OPTION_LAST For internal use only.

30.3.3
30.3.3.1

Member Function Documentation


int Fl::add awake handler ( Fl_Awake_Handler func, void data ) [static]

Adds an awake handler for use in awake(). void Fl::add check ( Fl_Timeout_Handler cb, void argp = 0 ) [static]

30.3.3.2

FLTK will call this callback just before it ushes the display and waits for events. This is different than an idle callback because it is only called once, then FLTK calls the system and tells it not to return until an event happens. This can be used by code that wants to monitor the applications state, such as to keep a display up to date. The advantage of using a check callback is that it is called only when no events are pending. If events are coming in quickly, whole blocks of them will be processed before this is called once. This can save signicant time and avoid the application falling behind the events. Sample code:
bool state_changed; // anything that changes the display turns this on void callback(void*) { if (!state_changed) return; state_changed = false; do_expensive_calculation(); widget-&gt;redraw(); } main() { Fl::add_check(callback); return Fl::run(); }

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.3 Fl Class Reference 30.3.3.3 static void Fl::add fd ( int fd, int when, Fl_FD_Handler cb, void = 0 ) [static]

315

Adds le descriptor fd to listen to. When the fd becomes ready for reading Fl::wait() will call the callback and then return. The callback is passed the fd and the arbitrary void argument. The second version takes a when biteld, with the bits FL_READ, FL_WRITE, and FL_EXCEPT dened, to indicate when the callback should be done. There can only be one callback of each type for a le descriptor. Fl::remove_fd() gets rid of all the callbacks for a given le descriptor. Under UNIX any le descriptor can be monitored (les, devices, pipes, sockets, etc.). Due to limitations in Microsoft Windows, WIN32 applications can only monitor sockets. 30.3.3.4 void Fl::add idle ( Fl_Idle_Handler cb, void data = 0 ) [static]

Adds a callback function that is called every time by Fl::wait() and also makes it act as though the timeout is zero (this makes Fl::wait() return immediately, so if it is in a loop it is called repeatedly, and thus the idle fucntion is called repeatedly). The idle function can be used to get background processing done. You can have multiple idle callbacks. To remove an idle callback use Fl::remove_idle(). Fl::wait() and Fl::check() call idle callbacks, but Fl::ready() does not. The idle callback can call any FLTK functions, including Fl::wait(), Fl::check(), and Fl::ready(). FLTK will not recursively call the idle callback. 30.3.3.5 void Fl::add timeout ( double t, Fl_Timeout_Handler cb, void argp = 0 ) [static]

Adds a one-shot timeout callback. The function will be called by Fl::wait() at t seconds after this function is called. The optional void argument is passed to the callback. You can have multiple timeout callbacks. To remove a timeout callback use Fl::remove_timeout(). If you need more accurate, repeated timeouts, use Fl::repeat_timeout() to reschedule the subsequent timeouts. The following code will print "TICK" each second on stdout with a fair degree of accuracy:
void callback(void*) { puts("TICK"); Fl::repeat_timeout(1.0, callback); } int main() { Fl::add_timeout(1.0, callback); return Fl::run(); }

30.3.3.6

int Fl::arg ( int argc, char argv, int & i ) [static]

Parse a single switch from argv, starting at word i.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

316

Class Documentation

Returns the number of words eaten (1 or 2, or 0 if it is not recognized) and adds the same value to i. This is the default argument handler used internally by Fl::args(...), but you can use this function if you prefer to step through the standard FLTK switches yourself. All standard FLTK switches except -bg2 may be abbreviated to just one letter and case is ignored: -bg color or -background color Sets the background color using Fl::background(). -bg2 color or -background2 color Sets the secondary background color using Fl::background2(). -display host:n.n Sets the X display to use; this option is silently ignored under WIN32 and MacOS. -dnd and -nodnd Enables or disables drag and drop text operations using Fl::dnd_text_ops(). -fg color or -foreground color Sets the foreground color using Fl::foreground(). -geometry WxH+X+Y Sets the initial window position and size according to the standard X geometry string. -iconic Iconies the window using Fl_Window::iconize(). -kbd and -nokbd Enables or disables visible keyboard focus for non-text widgets using Fl::visible_focus(). -name string Sets the window class using Fl_Window::xclass(). -scheme string Sets the widget scheme using Fl::scheme(). -title string Sets the window title using Fl_Window::label(). -tooltips and -notooltips Enables or disables tooltips using Fl_Tooltip::enable(). If your program requires other switches in addition to the standard FLTK options, you will need to pass your own argument handler to Fl::args(int,char,int&,Fl_Args_Handler) explicitly.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.3 Fl Class Reference 30.3.3.7 int Fl::args ( int argc, char argv, int & i, Fl_Args_Handler cb = 0 ) [static]

317

Parse command line switches using the cb argument handler. Returns 0 on error, or the number of words processed. FLTK provides this as an entirely optional command line switch parser. You dont have to call it if you dont want to. Everything it can do can be done with other calls to FLTK. To use the switch parser, call Fl::args(...) near the start of your program. This does not open the display, instead switches that need the display open are stashed into static variables. Then you must display your rst window by calling window->show(argc,argv), which will do anything stored in the static variables. Providing an argument handler callback cb lets you dene your own switches. It is called with the same argc and argv, and with i set to the index of the switch to be processed. The cb handler should return zero if the switch is unrecognized, and not change i. It should return non-zero to indicate the number of words processed if the switch is recognized, i.e. 1 for just the switch, and more than 1 for the switch plus associated parameters. i should be incremented by the same amount. The cb handler is called before any other tests, so you can also override any standard FLTK switch (this is why FLTK can use very short switches instead of the long ones all other toolkits force you to use). See Fl::arg() for descriptions of the standard switches. On return i is set to the index of the rst non-switch. This is either: The rst word that does not start with -. The word - (used by many programs to name stdin as a le) The rst unrecognized switch (return value is 0). argc The return value is i unless an unrecognized switch is found, in which case it is zero. If your program takes no arguments other than switches you should produce an error if the return value is less than argc. A usage string is displayed if Fl::args() detects an invalid argument on the command-line. You can change the message by setting the Fl::help pointer. A very simple command line parser can be found in examples/howto-parse-args.cxx The simpler Fl::args(int argc, char argv) form is useful if your program does not have command line switches of its own. 30.3.3.8 void Fl::args ( int argc, char argv ) [static]

Parse all command line switches matching standard FLTK options only. It parses all the switches, and if any are not recognized it calls Fl::abort(Fl::help), i.e. unlike the long form, an unrecognized switch generates an error message and causes the program to exit. 30.3.3.9 void Fl::background ( uchar r, uchar g, uchar b ) [static]

Changes _color(FL_BACKGROUND_COLOR) to the given color, and changes the gray ramp from 32 to 56 to black to white. These are the colors used as backgrounds by almost all widgets and used to draw the edges of all the boxtypes.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

318 30.3.3.10 void Fl::background2 ( uchar r, uchar g, uchar b ) [static]

Class Documentation

Changes the alternative background color. This color is used as a background by Fl_Input and other text widgets. This call may change _color(FL_FOREGROUND_COLOR) if it does not provide sufcient contrast to FL_BACKGROUND2_COLOR. 30.3.3.11 int Fl::box dh ( Fl_Boxtype t ) [static]

Returns the height offset for the given boxtype. See also box_dy().

30.3.3.12

int Fl::box dw ( Fl_Boxtype t ) [static]

Returns the width offset for the given boxtype. See also box_dy().

30.3.3.13

int Fl::box dx ( Fl_Boxtype t ) [static]

Returns the X offset for the given boxtype. See also box_dy()

30.3.3.14

int Fl::box dy ( Fl_Boxtype t ) [static]

Returns the Y offset for the given boxtype. These functions return the offset values necessary for a given boxtype, useful for computing the area inside a boxs borders, to prevent overdrawing the borders. For instance, in the case of a boxtype like FL_DOWN_BOX where the border width might be 2 pixels all around, the above functions would return 2, 2, 4, and 4 for box_dx, box_dy, box_dw, and box_dh respectively. An example to compute the area inside a widgets box():
int int int int X Y W H = = = = yourwidget->x() yourwidget->y() yourwidget->w() yourwidget->h() + + Fl::box_dx(yourwidget->box()); Fl::box_dy(yourwidget->box()); Fl::box_dw(yourwidget->box()); Fl::box_dh(yourwidget->box());

These functions are mainly useful in the draw() code for deriving custom widgets, where one wants to avoid drawing over the widgets own border box().
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.3 Fl Class Reference 30.3.3.15 int Fl::check ( ) [static]

319

Same as Fl::wait(0). Calling this during a big calculation will keep the screen up to date and the interface responsive:
while (!calculation_done()) { calculate(); Fl::check(); if (user_hit_abort_button()) break; }

This returns non-zero if any windows are displayed, and 0 if no windows are displayed (this is likely to change in future versions of FLTK).

30.3.3.16

static int Fl::damage ( ) [inline, static]

If true then ush() will do something.

30.3.3.17

void Fl::display ( const char d ) [static]

Sets the X display to use for all windows. Actually this just sets the environment variable $DISPLAY to the passed string, so this only works before you show() the rst window or otherwise open the display, and does nothing useful under WIN32.

30.3.3.18

static void Fl::dnd text ops ( int v ) [inline, static]

Gets or sets whether drag and drop text operations are supported. This specically affects whether selected text can be dragged from text elds or dragged within a text eld as a cut/paste shortcut.

30.3.3.19

static int Fl::dnd text ops ( ) [inline, static]

Gets or sets whether drag and drop text operations are supported. This specically affects whether selected text can be dragged from text elds or dragged within a text eld as a cut/paste shortcut.

30.3.3.20

int Fl::draw box active ( ) [static]

Determines if the current draw box is active or inactive. If inactive, the box color is changed by the inactive color.

30.3.3.21

void Fl::ush ( ) [static]

Causes all the windows that need it to be redrawn and graphics forced out through the pipes. This is what wait() does before looking for events.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

320

Class Documentation

Note: in multi-threaded applications you should only call Fl::ush() from the main thread. If a child thread needs to trigger a redraw event, it should instead call Fl::awake() to get the main thread to process the event queue. 30.3.3.22 void Fl::foreground ( uchar r, uchar g, uchar b ) [static]

Changes _color(FL_FOREGROUND_COLOR). 30.3.3.23 int Fl::get awake handler ( Fl_Awake_Handler & func, void & data ) [static]

Gets the last stored awake handler for use in awake(). 30.3.3.24 Fl_Box_Draw_F Fl::get boxtype ( Fl_Boxtype t ) [static] Gets the current box drawing function for the specied box type. 30.3.3.25 void Fl::get system colors ( ) [static]

Read the user preference colors from the system and use them to call Fl::foreground(), Fl::background(), and Fl::background2(). This is done by Fl_Window::show(argc,argv) before applying the -fg and -bg switches. On X this reads some common values from the Xdefaults database. KDE users can set these values by running the "krdb" program, and newer versions of KDE set this automatically if you check the "apply style to other X programs" switch in their control panel. 30.3.3.26 int Fl::gl visual ( int mode, int alist = 0 ) [static]

This does the same thing as Fl::visual(int) but also requires OpenGL drawing to work. This must be done if you want to draw in normal windows with OpenGL with gl_start() and gl_end(). It may be useful to call this so your X windows use the same visual as an Fl_Gl_Window, which on some servers will reduce colormap ashing. See Fl_Gl_Window for a list of additional values for the argument. 30.3.3.27 bool Fl::option ( Fl_Option opt ) [static]

FLTK library options management. This function needs to be documented in more detail. It can be used for more optional settings, such as using a native le chooser instead of the FLTK one wherever possible, disabling tooltips, disabling visible focus, disabling FLTK le chooser preview, etc. . There should be a command line option interface. There should be an application that manages options system wide, per user, and per application. Note As of FLTK 1.3.0, options can be managed within uid, using the menu Edit/Global FLTK Settings.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.3 Fl Class Reference Parameters opt which option

321

Returns true or false See also enum Fl::Fl_Option Fl::option(Fl_Option, bool)

Since FLTK 1.3.0

30.3.3.28

void Fl::option ( Fl_Option opt, bool val ) [static]

Override an option while the application is running. This function does not change any system or user settings. Parameters opt which option val set to true or false

See also enum Fl::Fl_Option bool Fl::option(Fl_Option)

30.3.3.29

void Fl::own colormap ( ) [static]

Makes FLTK use its own colormap. This may make FLTK display better and will reduce conicts with other programs that want lots of colors. However the colors may ash as you move the cursor between windows. This does nothing if the current visual is not colormapped. 30.3.3.30 int Fl::ready ( ) [static]

This is similar to Fl::check() except this does not call Fl::ush() or any callbacks, which is useful if your program is in a state where such callbacks are illegal. This returns true if Fl::check() would do anything (it will continue to return true until you call Fl::check() or Fl::wait()).
while (!calculation_done()) { calculate();
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

322
if (Fl::ready()) { do_expensive_cleanup(); Fl::check(); if (user_hit_abort_button()) break; } }

Class Documentation

30.3.3.31

static void Fl::release ( ) [inline, static]

Releases the current grabbed window, equals grab(0). Deprecated Use Fl::grab(0) instead.

See also grab(Fl_Window)

30.3.3.32

int Fl::reload scheme ( ) [static]

Called by scheme according to scheme name. Loads or reloads the current scheme selection. See void scheme(const char name)

30.3.3.33

void Fl::remove check ( Fl_Timeout_Handler cb, void argp = 0 ) [static]

Removes a check callback. It is harmless to remove a check callback that no longer exists.

30.3.3.34

static void Fl::remove fd ( int , int when ) [static]

Removes a le descriptor handler.

30.3.3.35

static void Fl::remove fd ( int ) [static]

Removes a le descriptor handler.

30.3.3.36

void Fl::remove timeout ( Fl_Timeout_Handler cb, void argp = 0 ) [static]

Removes a timeout callback. It is harmless to remove a timeout callback that no longer exists. Note This version removes all matching timeouts, not just the rst one. This may change in the future.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.3 Fl Class Reference 30.3.3.37

323

void Fl::repeat timeout ( double t, Fl_Timeout_Handler cb, void argp = 0 ) [static]

Repeats a timeout callback from the expiration of the previous timeout, allowing for more accurate timing. You may only call this method inside a timeout callback. The following code will print "TICK" each second on stdout with a fair degree of accuracy:
void callback(void*) { puts("TICK"); Fl::repeat_timeout(1.0, callback); } int main() { Fl::add_timeout(1.0, callback); return Fl::run(); }

30.3.3.38

int Fl::run ( ) [static]

As long as any windows are displayed this calls Fl::wait() repeatedly. When all the windows are closed it returns zero (supposedly it would return non-zero on any errors, but FLTK calls exit directly for these). A normal program will end main() with return Fl::run();. 30.3.3.39 int Fl::scheme ( const char s ) [static]

Gets or sets the current widget scheme. NULL will use the scheme dened in the FLTK_SCHEME environment variable or the scheme resource under X11. Otherwise, any of the following schemes can be used: "none" - This is the default look-n-feel which resembles old Windows (95/98/Me/NT/2000) and old GTK/KDE "plastic" - This scheme is inspired by the Aqua user interface on Mac OS X "gtk+" - This scheme is inspired by the Red Hat Bluecurve theme

30.3.3.40

int Fl::scrollbar size ( ) [static]

Gets the default scrollbar size used by Fl_Browser_, Fl_Help_View, Fl_Scroll, and Fl_Text_Display widgets. Returns The default size for widget scrollbars, in pixels.

30.3.3.41

void Fl::scrollbar size ( int W ) [static]

Sets the default scrollbar size that is used by the Fl_Browser_, Fl_Help_View, Fl_Scroll, and Fl_Text_Display widgets.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

324 Parameters in

Class Documentation

W The new default size for widget scrollbars, in pixels.

30.3.3.42

void Fl::set boxtype ( Fl_Boxtype t, Fl_Box_Draw_F f, uchar a, uchar b, uchar c, uchar d ) [static]

Sets the function to call to draw a specic boxtype.

30.3.3.43

void Fl::set boxtype ( Fl_Boxtype to, Fl_Boxtype from ) [static]

Copies the from boxtype.

30.3.3.44

static void Fl::set idle ( Fl_Old_Idle_Handler cb ) [inline, static]

Sets an idle callback. Deprecated This method is obsolete - use the add_idle() method instead.

30.3.3.45

void Fl::set labeltype ( Fl_Labeltype t, Fl_Label_Draw_F f, Fl_Label_Measure_F m ) [static]

Sets the functions to call to draw and measure a specic labeltype.

30.3.3.46

static void Fl::set labeltype ( Fl_Labeltype , Fl_Labeltype from ) [static]

Sets the functions to call to draw and measure a specic labeltype.

30.3.3.47

double Fl::version ( ) [static]

Returns the compiled-in value of the FL_VERSION constant. This is useful for checking the version of a shared library.

30.3.3.48

static void Fl::visible focus ( int v ) [inline, static]

Gets or sets the visible keyboard focus on buttons and other non-text widgets. The default mode is to enable keyboard focus for all widgets.

30.3.3.49

static int Fl::visible focus ( ) [inline, static]

Gets or sets the visible keyboard focus on buttons and other non-text widgets. The default mode is to enable keyboard focus for all widgets.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.3 Fl Class Reference 30.3.3.50 int Fl::visual ( int ags ) [static]

325

Selects a visual so that your graphics are drawn correctly. This is only allowed before you call show() on any windows. This does nothing if the default visual satises the capabilities, or if no visual satises the capabilities, or on systems that dont have such braindead notions. Only the following combinations do anything useful: Fl::visual(FL_RGB) Full/true color (if there are several depths FLTK chooses the largest). Do this if you use _draw_image for much better (non-dithered) output.

Fl::visual(FL_RGB8) Full color with at least 24 bits of color. FL_RGB will always pick this if available, but if not it will happily return a less-than-24 bit deep visual. This call fails if 24 bits are not available.

Fl::visual(FL_DOUBLE|FL_INDEX) Hardware double buffering. Call this if you are going to use Fl_Double_Window.

Fl::visual(FL_DOUBLE|FL_RGB) Fl::visual(FL_DOUBLE|FL_RGB8) Hardware double buffering and full color. This returns true if the system has the capabilities by default or FLTK suceeded in turing them on. Your program will still work even if this returns false (it just wont look as good).

30.3.3.51

int Fl::wait ( ) [static]

Waits until "something happens" and then returns. Call this repeatedly to "run" your program. You can also check what happened each time after this returns, which is quite useful for managing program state. What this really does is call all idle callbacks, all elapsed timeouts, call Fl::ush() to get the screen to update, and then wait some time (zero if there are idle callbacks, the shortest of all pending timeouts, or innity), for any events from the user or any Fl::add_fd() callbacks. It then handles the events and calls the callbacks and then returns. The return value of Fl::wait() is non-zero if there are any visible windows - this may change in future versions of FLTK. Fl::wait(time) waits a maximum of time seconds. It can return much sooner if something happens. The return value is positive if an event or fd happens before the time elapsed. It is zero if nothing happens (on Win32 this will only return zero if time is zero). It is negative if an error occurs (this will happen on UNIX if a signal happens).
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

326

Class Documentation

30.3.4
30.3.4.1

Member Data Documentation


const char const Fl::help = helpmsg+13 [static]

Usage string displayed if Fl::args() detects an invalid argument. This may be changed to point to customized text at run-time. 30.3.4.2 void( Fl::idle)() [static]

The currently executing idle callback function: DO NOT USE THIS DIRECTLY! This is now used as part of a higher level system allowing multiple idle callback functions to be called. See also add_idle(), remove_idle() The documentation for this class was generated from the following les: Fl.H Fl.cxx Fl_abort.cxx Fl_add_idle.cxx Fl_arg.cxx _boxtype.cxx _color.cxx _color_mac.cxx _color_win32.cxx Fl_compose.cxx Fl_display.cxx _dnd_win32.cxx _dnd_x.cxx Fl_get_key.cxx Fl_get_key_mac.cxx Fl_get_key_win32.cxx Fl_get_system_colors.cxx Fl_grab.cxx _labeltype.cxx Fl_lock.cxx Fl_own_colormap.cxx _set_font.cxx _set_fonts_mac.cxx _set_fonts_win32.cxx _set_fonts_x.cxx _set_fonts_xft.cxx _shortcut.cxx Fl_visual.cxx Fl_Widget.cxx Fl_Window.cxx gl_start.cxx screen_xywh.cxx
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.4 Fl_Adjuster Class Reference

327

30.4

Fl Adjuster Class Reference

The Fl_Adjuster widget was stolen from Prisms, and has proven to be very useful for values that need a large dynamic range. #include <Fl_Adjuster.H> Inheritance diagram for Fl_Adjuster:

Fl_Widget Fl_Valuator Fl_Adjuster

Public Member Functions


Fl_Adjuster (int X, int Y, int W, int H, const char l=0)
Creates a new Fl_Adjuster widget using the given position, size, and label string.

void soft (int s)


If "soft" is turned on, the user is allowed to drag the value outside the range.

int soft () const


If "soft" is turned on, the user is allowed to drag the value outside the range.

Protected Member Functions


void draw ()
Draws the widget.

int handle (int)


Handles the specied event.

void value_damage ()
Asks for partial redraw.

30.4.1

Detailed Description

The Fl_Adjuster widget was stolen from Prisms, and has proven to be very useful for values that need a large dynamic range.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

328

Class Documentation

Figure 30.1: Fl_Adjuster

When you press a button and drag to the right the value increases. When you drag to the left it decreases. The largest button adjusts by 100 step(), the next by 10 step() and that smallest button by step(). Clicking on the buttons increments by 10 times the amount dragging by a pixel does. Shift + click decrements by 10 times the amount.

30.4.2
30.4.2.1

Constructor & Destructor Documentation


Fl Adjuster::Fl Adjuster ( int X, int Y, int W, int H, const char l = 0 )

Creates a new Fl_Adjuster widget using the given position, size, and label string. It looks best if one of the dimensions is 3 times the other. Inherited destructor destroys the Valuator.

30.4.3
30.4.3.1

Member Function Documentation


void Fl Adjuster::draw ( ) [protected, virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Implements Fl_Widget. 30.4.3.2 int Fl Adjuster::handle ( int event ) [protected, virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.5 Fl_Bitmap Class Reference

329

When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted

See also Fl_Event

Reimplemented from Fl_Widget.

30.4.3.3

void Fl Adjuster::soft ( int s ) [inline]

If "soft" is turned on, the user is allowed to drag the value outside the range. If they drag the value to one of the ends, let go, then grab again and continue to drag, they can get to any value. Default is one.

30.4.3.4

int Fl Adjuster::soft ( ) const [inline]

If "soft" is turned on, the user is allowed to drag the value outside the range. If they drag the value to one of the ends, let go, then grab again and continue to drag, they can get to any value. Default is one. The documentation for this class was generated from the following les: Fl_Adjuster.H Fl_Adjuster.cxx

30.5

Fl Bitmap Class Reference

The Fl_Bitmap class supports caching and drawing of mono-color (bitmap) images. #include <Fl_Bitmap.H> Inheritance diagram for Fl_Bitmap:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

330

Class Documentation

Fl_Image Fl_Bitmap Fl_XBM_Image

Public Member Functions


virtual Fl_Image copy (int W, int H)
The copy() method creates a copy of the specied image.

Fl_Image copy ()
The copy() method creates a copy of the specied image.

virtual void draw (int X, int Y, int W, int H, int cx=0, int cy=0)
Draws the image with a bounding box.

void draw (int X, int Y)


Draws the image.

Fl_Bitmap (const uchar bits, int W, int H)


The constructors create a new bitmap from the specied bitmap data.

Fl_Bitmap (const char bits, int W, int H)


The constructors create a new bitmap from the specied bitmap data.

virtual void label (Fl_Widget w)


The label() methods are an obsolete way to set the image attribute of a widget or menu item.

virtual void label (Fl_Menu_Item m)


The label() methods are an obsolete way to set the image attribute of a widget or menu item.

virtual void uncache ()


If the image has been cached for display, delete the cache data.

virtual Fl_Bitmap ()
The destructor free all memory and server resources that are used by the bitmap.

Public Attributes
int alloc_array
Non-zero if array points to bitmap data allocated internally.

const uchar array


pointer to raw bitmap data

Friends
class Fl_GDI_Graphics_Driver class Fl_Quartz_Graphics_Driver class Fl_Xlib_Graphics_Driver
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.5 Fl_Bitmap Class Reference

331

30.5.1

Detailed Description

The Fl_Bitmap class supports caching and drawing of mono-color (bitmap) images. Images are drawn using the current color.

30.5.2
30.5.2.1

Constructor & Destructor Documentation


Fl Bitmap::Fl Bitmap ( const uchar bits, int W, int H ) [inline]

The constructors create a new bitmap from the specied bitmap data.

30.5.2.2

Fl Bitmap::Fl Bitmap ( const char array, int W, int H ) [inline]

The constructors create a new bitmap from the specied bitmap data.

30.5.3

Member Function Documentation

30.5.3.1 Fl_Image Fl Bitmap::copy ( int W, int H ) [virtual] The copy() method creates a copy of the specied image. If the width and height are provided, the image is resized to the specied size. The image should be deleted (or in the case of Fl_Shared_Image, released) when you are done with it. Reimplemented from Fl_Image.

30.5.3.2 Fl_Image Fl Bitmap::copy ( ) [inline] The copy() method creates a copy of the specied image. If the width and height are provided, the image is resized to the specied size. The image should be deleted (or in the case of Fl_Shared_Image, released) when you are done with it. Reimplemented from Fl_Image.

30.5.3.3

void Fl Bitmap::draw ( int X, int Y, int W, int H, int cx = 0, int cy = 0 ) [virtual]

Draws the image with a bounding box. This form species a bounding box for the image, with the origin (upper-lefthand corner) of the image offset by the cx and cy arguments. Reimplemented from Fl_Image.

30.5.3.4

void Fl Bitmap::draw ( int X, int Y ) [inline]

Draws the image. This form species the upper-lefthand corner of the image. Reimplemented from Fl_Image.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

332 30.5.3.5 void Fl Bitmap::label ( Fl_Widget widget ) [virtual]

Class Documentation

The label() methods are an obsolete way to set the image attribute of a widget or menu item. Use the image() or deimage() methods of the Fl_Widget and Fl_Menu_Item classes instead. Reimplemented from Fl_Image.

30.5.3.6

void Fl Bitmap::label ( Fl_Menu_Item m ) [virtual]

The label() methods are an obsolete way to set the image attribute of a widget or menu item. Use the image() or deimage() methods of the Fl_Widget and Fl_Menu_Item classes instead. Reimplemented from Fl_Image.

30.5.3.7

void Fl Bitmap::uncache ( ) [virtual]

If the image has been cached for display, delete the cache data. This allows you to change the data used for the image and then redraw it without recreating an image object. Reimplemented from Fl_Image. The documentation for this class was generated from the following les: Fl_Bitmap.H Fl_Bitmap.cxx

30.6

Fl BMP Image Class Reference

The Fl_BMP_Image class supports loading, caching, and drawing of Windows Bitmap (BMP) image les. #include <Fl_BMP_Image.H> Inheritance diagram for Fl_BMP_Image:

Fl_Image Fl_RGB_Image Fl_BMP_Image

Public Member Functions


Fl_BMP_Image (const char lename)
The constructor loads the named BMP image from the given bmp lename.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.7 Fl_Box Class Reference

333

30.6.1

Detailed Description

The Fl_BMP_Image class supports loading, caching, and drawing of Windows Bitmap (BMP) image les.

30.6.2
30.6.2.1

Constructor & Destructor Documentation


Fl BMP Image::Fl BMP Image ( const char bmp )

The constructor loads the named BMP image from the given bmp lename. The inherited destructor free all memory and server resources that are used by the image. The destructor free all memory and server resources that are used by the image The documentation for this class was generated from the following les: Fl_BMP_Image.H Fl_BMP_Image.cxx

30.7

Fl Box Class Reference

This widget simply draws its box, and possibly its label. #include <Fl_Box.H> Inheritance diagram for Fl_Box:

Fl_Widget Fl_Box

Public Member Functions


Fl_Box (int X, int Y, int W, int H, const char l=0) Fl_Box (Fl_Boxtype b, int X, int Y, int W, int H, const char l)
See Fl_Box::Fl_Box(int x, int y, int w, int h, const char = 0)

virtual int handle (int)


Handles the specied event.

Protected Member Functions


void draw ()
Draws the widget.

30.7.1

Detailed Description

This widget simply draws its box, and possibly its label.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

334

Class Documentation

Putting it before some other widgets and making it big enough to surround them will let you draw a frame around them.

30.7.2
30.7.2.1

Constructor & Destructor Documentation


Fl Box::Fl Box ( int X, int Y, int W, int H, const char l = 0 ) [inline]

The rst constructor sets box() to FL_NO_BOX, which means it is invisible. However such widgets are useful as placeholders or Fl_Group::resizable() values. To change the box to something visible, use box(n). The second form of the constructor sets the box to the specied box type. The destructor removes the box.

30.7.3
30.7.3.1

Member Function Documentation


void Fl Box::draw ( ) [protected, virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Implements Fl_Widget. 30.7.3.2 int Fl Box::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.8 Fl_Browser Class Reference See also Fl_Event Reimplemented from Fl_Widget. The documentation for this class was generated from the following les: Fl_Box.H Fl_Box.cxx

335

30.8

Fl Browser Class Reference

The Fl_Browser widget displays a scrolling list of text lines, and manages all the storage for the text. #include <Fl_Browser.H> Inheritance diagram for Fl_Browser:
Fl_Widget Fl_Group Fl_Browser_ Fl_Browser Fl_File_Browser Fl_Hold_Browser Fl_Multi_Browser Fl_Select_Browser

Public Types
enum Fl_Line_Position { TOP, BOTTOM, MIDDLE }
For internal use only?

Public Member Functions


void add (const char newtext, void d=0)
Adds a new line to the end of the browser.

void bottomline (int line)


Scrolls the browser so the bottom item in the browser is showing the specied line.

void clear ()
Removes all the lines in the browser.

char column_char () const


Gets the current column separator character.

void column_char (char c)


Sets the column separator to c.

const int column_widths () const


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

336
Gets the current column width array.

Class Documentation

void column_widths (const int arr)


Sets the current array to arr.

void data (int line) const


Returns the user data() for specied line.

void data (int line, void d)


Sets the user data for specied line to d.

void display (int line, int val=1)


For back compatibility.

int displayed (int line) const


Returns non-zero if line has been scrolled to a position where it is being displayed.

Fl_Browser (int X, int Y, int W, int H, const char L=0)


The constructor makes an empty browser.

char format_char () const


Gets the current format code prex character, which by default is @.

void format_char (char c)


Sets the current format code prex character to c.

void hide (int line)


Makes line invisible, preventing selection by the user.

void hide ()
Hides the entire Fl_Browser widget -- opposite of show().

void icon (int line, Fl_Image icon)


Set the image icon for line to the value icon.

Fl_Image icon (int line) const


Returns the icon currently dened for line.

void insert (int line, const char newtext, void d=0)


Insert a new entry whose label is newtext above given line, optional data d.

void lineposition (int line, Fl_Line_Position pos)


Updates the browser so that line is shown at position pos.

int load (const char lename)


Clears the browser and reads the le, adding each line from the le to the browser.

void make_visible (int line)


Make the item at the specied line visible().

void middleline (int line)


Scrolls the browser so the middle item in the browser is showing the specied line.

void move (int to, int from)


Line from is removed and reinserted at to.

void remove (int line)


Remove entry for given line number, making the browser one line shorter.

void remove_icon (int line)


Removes the icon for line.

void replace (int a, const char b)


For back compatibility only.

int select (int line, int val=1)


Sets the selection state of the item at line to the value val.

int selected (int line) const


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.8 Fl_Browser Class Reference


Returns 1 if specied line is selected, 0 if not.

337

void show (int line)


Makes line visible, and available for selection by user.

void show ()
Shows the entire Fl_Browser widget -- opposite of hide().

int size () const


Returns how many lines are in the browser.

void size (int W, int H)


Changes the size of the widget.

void swap (int a, int b)


Swaps two browser lines a and b.

const char text (int line) const


Returns the label text for the specied line.

void text (int line, const char newtext)


Sets the text for the specied line to newtext.

int topline () const


Returns the line that is currently visible at the top of the browser.

void topline (int line)


Scrolls the browser so the top item in the browser is showing the specied line.

int value () const


Returns the line number of the currently selected line, or 0 if none.

void value (int line)


Sets the browsers value(), which selects the specied line.

int visible (int line) const


Returns non-zero if the specied line is visible, 0 if hidden.

Fl_Browser ()
The destructor deletes all list items and destroys the browser.

Protected Member Functions


FL_BLINE _remove (int line)
Removes the item at the specied line.

FL_BLINE nd_line (int line) const


Returns the item for specied line.

int full_height () const


The height of the entire list of all visible() items in pixels.

int incr_height () const


The default average item height (including inter-item spacing) in pixels.

void insert (int line, FL_BLINE item)


Insert specied item above line.

void item_at (int line) const


Return the item at specied line.

void item_draw (void item, int X, int Y, int W, int H) const


Draws item at the position specied by X Y W H.

void item_rst () const


Returns the very rst item in the list.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

338 int item_height (void item) const


Returns height of item in pixels.

Class Documentation

void item_last () const


Returns the very last item in the list.

void item_next (void item) const


Returns the next item after item.

void item_prev (void item) const


Returns the previous item before item.

void item_select (void item, int val)


Change the selection state of item to the value val.

int item_selected (void item) const


See if item is selected.

void item_swap (void a, void b)


Swap the items a and b.

const char item_text (void item) const


Returns the label text for item.

int item_width (void item) const


Returns width of item in pixels.

int lineno (void item) const


Returns line number corresponding to item, or zero if not found.

void swap (FL_BLINE a, FL_BLINE b)


Swap the two items a and b.

30.8.1

Detailed Description

The Fl_Browser widget displays a scrolling list of text lines, and manages all the storage for the text. This is not a text editor or spreadsheet! But it is useful for showing a vertical list of named objects to the user. Each line in the browser is identied by number. The numbers start at one (this is so that zero can be reserved for "no line" in the selective browsers). Unless otherwise noted, the methods do not check to see if the passed line number is in range and legal. It must always be greater than zero and <= size(). Each line contains a null-terminated string of text and a void data pointer. The text string is displayed, the void pointer can be used by the callbacks to reference the object the text describes. The base class does nothing when the user clicks on it. The subclasses Fl_Select_Browser, Fl_Hold_Browser, and Fl_Multi_Browser react to user clicks to select lines in the browser and do callbacks. The base class Fl_Browser_ provides the scrolling and selection mechanisms of this and all the subclasses, but the dimensions and appearance of each item are determined by the subclass. You can use Fl_Browser_ to display information other than text, or text that is dynamically produced from your own data structures. If you nd that loading the browser is a lot of work or is inefcient, you may want to make a subclass of Fl_Browser_. Some common coding patterns used for working with Fl_Browser:
// How to loop through all the items in the browser for ( int t=1; t<=browser->size(); t++ ) { // index 1 based..! printf("item #%d, label=%s\n", t, browser->text(t)); }
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.8 Fl_Browser Class Reference

339

Note: If you are subclassing Fl_Browser, its more efcient to use the protected methods item_rst() and item_next(), since Fl_Browser internally uses linked lists to manage the browsers items. For more info, see nd_item(int).

30.8.2
30.8.2.1

Constructor & Destructor Documentation


Fl Browser::Fl Browser ( int X, int Y, int W, int H, const char L = 0 )

The constructor makes an empty browser. Parameters in in

X,Y,W,H position and size. L label string, may be NULL.

30.8.3
30.8.3.1

Member Function Documentation


FL BLINE Fl Browser:: remove ( int line ) [protected]

Removes the item at the specied line. Caveat: See efciency note in nd_line(). You must call redraw() to make any changes visible. Parameters in

line The line number to be removed. (1 based) Must be in range!

Returns Pointer to browser item that was removed (and is no longer valid).

See also add(), insert(), remove(), swap(int,int), clear()

30.8.3.2

void Fl Browser::add ( const char newtext, void d = 0 )

Adds a new line to the end of the browser. The text string newtext may contain format characters; see format_char() for details. newtext is copied using the strdup() function, and can be NULL to make a blank line. The optional void argument d will be the data() for the new item. Parameters in in

newtext The label text used for the added item d Optional user data() for the item (0 if unspecied)

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

340 See also add(), insert(), remove(), swap(int,int), clear()

Class Documentation

30.8.3.3

void Fl Browser::bottomline ( int line ) [inline]

Scrolls the browser so the bottom item in the browser is showing the specied line. Parameters in

line The line to be displayed at the bottom.

See also topline(), middleline(), bottomline(), displayed(), lineposition()

30.8.3.4

void Fl Browser::clear ( )

Removes all the lines in the browser. See also add(), insert(), remove(), swap(int,int), clear() Reimplemented from Fl_Group.

30.8.3.5

char Fl Browser::column char ( ) const [inline]

Gets the current column separator character. The default is \t (tab). See also column_char(), column_widths()

30.8.3.6

void Fl Browser::column char ( char c ) [inline]

Sets the column separator to c. This will only have an effect if you also set column_widths(). The default is \t (tab). See also column_char(), column_widths()

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.8 Fl_Browser Class Reference 30.8.3.7 const int Fl Browser::column widths ( ) const [inline]

341

Gets the current column width array. This array is zero-terminated and species the widths in pixels of each column. The text is split at each column_char() and each part is formatted into its own column. After the last column any remaining text is formatted into the space between the last column and the right edge of the browser, even if the text contains instances of column_char() . The default value is a one-element array of just a zero, which means there are no columns. Example:
Fl_Browser *b = new Fl_Browser(..); int widths[] = { 50, 50, 50, 70, 70, 40, 40, 70, 70, 50, 0 }; // widths for each column b->column_widths(widths); // assign array to widget b->column_char(\t); // use tab as the column character b->add("USER\tPID\tCPU\tMEM\tVSZ\tRSS\tTTY\tSTAT\tSTART\tTIME\tCOMMAND"); b->add("root\t2888\t0.0\t0.0\t1352\t0\ttty3\tSW\tAug15\t0:00\t @b@f/sbin/mingetty tty3"); b->add("root\t13115\t0.0\t0.0\t1352\t0\ttty2\tSW\tAug30\t0:00\t @b@f/sbin/mingetty tty2"); [..]

See also column_char(), column_widths()

30.8.3.8

void Fl Browser::column widths ( const int arr ) [inline]

Sets the current array to arr. Make sure the last entry is zero. See also column_char(), column_widths()

30.8.3.9

void Fl Browser::data ( int line ) const

Returns the user data() for specied line. Return value can be NULL if line is out of range or no user data() was dened. The parameter line is 1 based (1 will be the rst item in the list). Parameters in

line The line number of the item whose data() is returned. (1 based)

Returns The user data pointer (can be NULL)

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

342 30.8.3.10 void Fl Browser::data ( int line, void d )

Class Documentation

Sets the user data for specied line to d. Does nothing if line is out of range. Parameters in in

line The line of the item whose data() is to be changed. (1 based) d The new data to be assigned to the item. (can be NULL)

30.8.3.11

void Fl Browser::display ( int line, int val = 1 )

For back compatibility. This calls show(line) if val is true, and hide(line) otherwise. If val is not specied, the default is 1 (makes the line visible). See also show(int), hide(int), display(), visible(), make_visible()

30.8.3.12

int Fl Browser::displayed ( int line ) const [inline]

Returns non-zero if line has been scrolled to a position where it is being displayed. Checks to see if the items vertical position is within the top and bottom edges of the display window. This does NOT take into account the hide()/show() status of the widget or item. Parameters in

line The line to be checked

Returns 1 if visible, 0 if not visible.

See also topline(), middleline(), bottomline(), displayed(), lineposition()

30.8.3.13

FL BLINE Fl Browser::nd line ( int line ) const [protected]

Returns the item for specied line. Note: This call is slow. Its ne for e.g. responding to user clicks, but slow if called often, such as in a tight sorting loop. Finding an item by line involves a linear lookup on the internal linked list. The performance hit can be signicant if the browsers contents is large, and the method is called often (e.g. during a sort). If youre writing a subclass, use the protected methods item_rst(), item_next(), etc. to access the internal linked list more efciently.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.8 Fl_Browser Class Reference Parameters in

343

line The line number of the item to return. (1 based)

Return values item that was found. NULL if line is out of range.

See also item_at(), nd_line(), lineno()

30.8.3.14

char Fl Browser::format char ( ) const [inline]

Gets the current format code prex character, which by default is @. A string of formatting codes at the start of each column are stripped off and used to modify how the rest of the line is printed: @. Print rest of line, dont look for more @ signs @@ Print rest of line starting with @ @l Use a LARGE (24 point) font @m Use a medium large (18 point) font @s Use a small (11 point) font @b Use a bold font (adds FL_BOLD to font) @i Use an italic font (adds FL_ITALIC to font) @f or @t Use a xed-pitch font (sets font to FL_COURIER) @c Center the line horizontally @r Right-justify the text @B0, @B1, ... @C0, @C1, ... @B255 Fill the backgound with _color(n) @C255 Use _color(n) to draw the text

@F0, @F1, ... Use _font(n) to draw the text @S1, @S2, ... Use point size n to draw the text @u or @_ Underline the text. @- draw an engraved line through the middle. Notice that the @. command can be used to reliably terminate the parsing. To print a random string in a random color, use sprintf("@C%d@.%s", color, string) and it will work even if the string starts with a digit or has the format character in it.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

344 30.8.3.15 void Fl Browser::format char ( char c ) [inline]

Class Documentation

Sets the current format code prex character to c. The default prex is @. Set the prex to 0 to disable formatting. See also format_char() for list of @ codes

30.8.3.16

int Fl Browser::full height ( ) const [protected, virtual]

The height of the entire list of all visible() items in pixels. This returns the accumulated height of all the items in the browser that are not hidden with hide(), including items scrolled off screen. Returns The accumulated size of all the visible items in pixels.

See also item_height(), item_width(), incr_height(), full_height() Reimplemented from Fl_Browser_. 30.8.3.17 void Fl Browser::hide ( int line )

Makes line invisible, preventing selection by the user. The line can still be selected under program control. This changes the full_height() if the state was changed. When a line is made invisible, lines below it are moved up in the display. redraw() is called automatically if a change occurred. Parameters in

line The line to be hidden. (1 based)

See also show(int), hide(int), display(), visible(), make_visible()

30.8.3.18

void Fl Browser::hide ( ) [inline, virtual]

Hides the entire Fl_Browser widget -- opposite of show(). Reimplemented from Fl_Widget.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.8 Fl_Browser Class Reference 30.8.3.19 void Fl Browser::icon ( int line, Fl_Image icon )

345

Set the image icon for line to the value icon. Caller is responsible for keeping the icon allocated. The line is automatically redrawn. Parameters in in

line The line to be modied. If out of range, nothing is done. icon The image icon to be assigned to the line. If NULL, any previous icon is removed.

30.8.3.20 Fl_Image Fl Browser::icon ( int line ) const Returns the icon currently dened for line. If no icon is dened, NULL is returned. Parameters in

line The line whose icon is returned.

Returns The icon dened, or NULL if none.

30.8.3.21

int Fl Browser::incr height ( ) const [protected, virtual]

The default average item height (including inter-item spacing) in pixels. This currently returns textsize() + 2. Returns The value in pixels.

See also item_height(), item_width(), incr_height(), full_height() Reimplemented from Fl_Browser_. 30.8.3.22 void Fl Browser::insert ( int line, FL BLINE item ) [protected]

Insert specied item above line. If line > size() then the line is added to the end. Caveat: See efciency note in nd_line(). Parameters in line The new line will be inserted above this line (1 based). in on Fri Aug 26 2011 19:16:35 for The item by Doxygen item FLTK 1.3.0 to be added. Generated

346 30.8.3.23 void Fl Browser::insert ( int line, const char newtext, void d = 0 )

Class Documentation

Insert a new entry whose label is newtext above given line, optional data d. Text may contain format characters; see format_char() for details. newtext is copied using the strdup() function, and can be NULL to make a blank line. The optional void argument d will be the data() of the new item. Parameters in in in

line Line position for insert. (1 based) If line > size(), the entry will be added at the end. newtext The label text for the new line. d Optional pointer to user data to be associated with the new line.

30.8.3.24

void Fl Browser::item at ( int line ) const [inline, protected, virtual]

Return the item at specied line. Parameters in

line The line of the item to return. (1 based)

Returns The item, or NULL if line out of range.

See also item_at(), nd_line(), lineno() Reimplemented from Fl_Browser_. 30.8.3.25 void Fl Browser::item draw ( void item, int X, int Y, int W, int H ) const [protected, virtual]

Draws item at the position specied by X Y W H. The W and H values are used for clipping. Should only be called within the context of an FLTK draw(). Parameters in in

item The item to be drawn X,Y,W,H position and size.

Implements Fl_Browser_. 30.8.3.26 void Fl Browser::item rst ( ) const [protected, virtual]

Returns the very rst item in the list. Example of use:


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.8 Fl_Browser Class Reference


// Walk the browser from beginning to end for ( void *i=item_first(); i; i=item_next(i) ) { printf("item label=%s\n", item_text(i)); }

347

Returns The rst item, or NULL if list is empty.

See also item_rst(), item_last(), item_next(), item_prev() Implements Fl_Browser_. 30.8.3.27 int Fl Browser::item height ( void item ) const [protected, virtual]

Returns height of item in pixels. This takes into account embedded @ codes within the text() label. Parameters in Returns The height of the item in pixels. See also item_height(), item_width(), incr_height(), full_height() Implements Fl_Browser_. 30.8.3.28 void Fl Browser::item last ( ) const [protected, virtual]

item The item whose height is returned.

Returns the very last item in the list. Example of use:


// Walk the browser in reverse, from end to start for ( void *i=item_last(); i; i=item_prev(i) ) { printf("item label=%s\n", item_text(i)); }

Returns The last item, or NULL if list is empty. See also item_rst(), item_last(), item_next(), item_prev() Reimplemented from Fl_Browser_.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

348 30.8.3.29

Class Documentation void Fl Browser::item next ( void item ) const [protected, virtual]

Returns the next item after item. Parameters in

item The current item

Returns The next item after item, or NULL if there are none after this one.

See also item_rst(), item_last(), item_next(), item_prev() Implements Fl_Browser_. 30.8.3.30 void Fl Browser::item prev ( void item ) const [protected, virtual]

Returns the previous item before item. Parameters in

item The current item

Returns The previous item before item, or NULL if there none before this one.

See also item_rst(), item_last(), item_next(), item_prev() Implements Fl_Browser_. 30.8.3.31 void Fl Browser::item select ( void item, int val ) [protected, virtual]

Change the selection state of item to the value val. Parameters in in

item The item to be changed. val The new selection state: 1 selects, 0 de-selects.

See also select(), selected(), value(), item_select(), item_selected() Reimplemented from Fl_Browser_.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.8 Fl_Browser Class Reference 30.8.3.32 int Fl Browser::item selected ( void item ) const [protected, virtual]

349

See if item is selected. Parameters in

item The item whose selection state is to be checked.

Returns 1 if selected, 0 if not.

See also select(), selected(), value(), item_select(), item_selected() Reimplemented from Fl_Browser_. 30.8.3.33 void Fl Browser::item swap ( void a, void b ) [inline, protected, virtual]

Swap the items a and b. You must call redraw() to make any changes visible. Parameters in

a,b the items to be swapped.

See also swap(int,int), item_swap() Reimplemented from Fl_Browser_. 30.8.3.34 const char Fl Browser::item text ( void item ) const [protected, virtual]

Returns the label text for item. Parameters in

item The item whose label text is returned.

Returns The items text string. (Can be NULL) Reimplemented from Fl_Browser_. 30.8.3.35 int Fl Browser::item width ( void item ) const [protected, virtual]

Returns width of item in pixels.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

350 This takes into account embedded @ codes within the text() label. Parameters in

Class Documentation

item The item whose width is returned.

Returns The width of the item in pixels.

See also item_height(), item_width(), incr_height(), full_height() Implements Fl_Browser_. 30.8.3.36 int Fl Browser::lineno ( void item ) const [protected]

Returns line number corresponding to item, or zero if not found. Caveat: See efciency note in nd_line(). Parameters in

item The item to be found

Returns The line number of the item, or 0 if not found.

See also item_at(), nd_line(), lineno()

30.8.3.37

void Fl Browser::lineposition ( int line, Fl_Line_Position pos )

Updates the browser so that line is shown at position pos. Parameters in in

line line number. (1 based) pos position.

See also topline(), middleline(), bottomline()

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.8 Fl_Browser Class Reference 30.8.3.38 int Fl Browser::load ( const char lename )

351

Clears the browser and reads the le, adding each line from the le to the browser. If the lename is NULL or a zero-length string then this just clears the browser. This returns zero if there was any error in opening or reading the le, in which case errno is set to the system error. The data() of each line is set to NULL. Parameters in

lename The lename to load

Returns 1 if OK, 0 on error (errno has reason)

See also add()

30.8.3.39

void Fl Browser::make visible ( int line ) [inline]

Make the item at the specied line visible(). Functionally similar to show(int line). If line is out of range, redisplay top or bottom of list as appropriate. Parameters in

line The line to be made visible.

See also show(int), hide(int), display(), visible(), make_visible()

30.8.3.40

void Fl Browser::middleline ( int line ) [inline]

Scrolls the browser so the middle item in the browser is showing the specied line. Parameters in See also topline(), middleline(), bottomline(), displayed(), lineposition()

line The line to be displayed in the middle.

30.8.3.41

void Fl Browser::move ( int to, int from )

Line from is removed and reinserted at to. Note: to is calculated after line from gets removed.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

352 Parameters in in

Class Documentation

to Destination line number (calculated after line from is removed) from Line number of item to be moved

30.8.3.42

void Fl Browser::remove ( int line )

Remove entry for given line number, making the browser one line shorter. You must call redraw() to make any changes visible. Parameters in

line Line to be removed. (1 based) If line is out of range, no action is taken.

See also add(), insert(), remove(), swap(int,int), clear() Reimplemented from Fl_Group. 30.8.3.43 void Fl Browser::remove icon ( int line )

Removes the icon for line. Its ok to remove an icon if none has been dened. Parameters in

line The line whose icon is to be removed.

30.8.3.44

void Fl Browser::replace ( int a, const char b ) [inline]

For back compatibility only. 30.8.3.45 int Fl Browser::select ( int line, int val = 1 )

Sets the selection state of the item at line to the value val. If val is not specied, the default is 1 (selects the item). Parameters in in

line The line number of the item to be changed. (1 based) val The new selection state (1=select, 0=de-select).

Returns 1 if the state changed, 0 if not.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.8 Fl_Browser Class Reference See also select(), selected(), value(), item_select(), item_selected()

353

30.8.3.46

int Fl Browser::selected ( int line ) const

Returns 1 if specied line is selected, 0 if not. Parameters in

line The line being checked (1 based)

Returns 1 if item selected, 0 if not.

See also select(), selected(), value(), item_select(), item_selected()

30.8.3.47

void Fl Browser::show ( int line )

Makes line visible, and available for selection by user. Opposite of hide(int). This changes the full_height() if the state was changed. redraw() is called automatically if a change occurred. Parameters in

line The line to be shown. (1 based)

See also show(int), hide(int), display(), visible(), make_visible()

30.8.3.48

void Fl Browser::show ( ) [inline, virtual]

Shows the entire Fl_Browser widget -- opposite of hide(). Reimplemented from Fl_Widget. 30.8.3.49 int Fl Browser::size ( ) const [inline]

Returns how many lines are in the browser. The last line number is equal to this. Returns 0 if browser is empty. 30.8.3.50 void Fl Browser::size ( int W, int H ) [inline]

Changes the size of the widget.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

354 size(W, H) is a shortcut for resize(x(), y(), W, H). Parameters in

Class Documentation

W,H new size

See also position(int,int), resize(int,int,int,int) Reimplemented from Fl_Widget. 30.8.3.51 void Fl Browser::swap ( FL BLINE a, FL BLINE b ) [protected]

Swap the two items a and b. Uses swapping() to ensure list updates correctly. Parameters in

a,b The two items to be swapped.

See also swap(int,int), item_swap()

30.8.3.52

void Fl Browser::swap ( int a, int b )

Swaps two browser lines a and b. You must call redraw() to make any changes visible. Parameters in

a,b The two lines to be swapped. (both 1 based)

See also swap(int,int), item_swap()

30.8.3.53

const char Fl Browser::text ( int line ) const

Returns the label text for the specied line. Return value can be NULL if line is out of range or unset. The parameter line is 1 based. Parameters in

line The line number of the item whose text is returned. (1 based)

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.8 Fl_Browser Class Reference Returns The text string (can be NULL)

355

30.8.3.54

void Fl Browser::text ( int line, const char newtext )

Sets the text for the specied line to newtext. Text may contain format characters; see format_char() for details. newtext is copied using the strdup() function, and can be NULL to make a blank line. Does nothing if line is out of range. Parameters in in

line The line of the item whose text will be changed. (1 based) newtext The new string to be assigned to the item.

30.8.3.55

int Fl Browser::topline ( ) const

Returns the line that is currently visible at the top of the browser. If there is no vertical scrollbar then this will always return 1. Returns The lineno() of the top() of the browser.

30.8.3.56

void Fl Browser::topline ( int line ) [inline]

Scrolls the browser so the top item in the browser is showing the specied line. Parameters in See also topline(), middleline(), bottomline(), displayed(), lineposition()

line The line to be displayed at the top.

30.8.3.57

int Fl Browser::value ( ) const

Returns the line number of the currently selected line, or 0 if none. Returns The line number of current selection, or 0 if none selected. See also select(), selected(), value(), item_select(), item_selected()

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

356 30.8.3.58 void Fl Browser::value ( int line ) [inline]

Class Documentation

Sets the browsers value(), which selects the specied line. This is the same as calling select(line). See also select(), selected(), value(), item_select(), item_selected()

30.8.3.59

int Fl Browser::visible ( int line ) const

Returns non-zero if the specied line is visible, 0 if hidden. Use show(int), hide(int), or make_visible(int) to change an items visible state. Parameters in

line The line in the browser to be tested. (1 based)

See also show(int), hide(int), display(), visible(), make_visible() The documentation for this class was generated from the following les: Fl_Browser.H Fl_Browser.cxx Fl_Browser_load.cxx

30.9

Fl Browser Class Reference

This is the base class for browsers. #include <Fl_Browser_.H> Inheritance diagram for Fl_Browser_:
Fl_Widget Fl_Group Fl_Browser_ Fl_Browser Fl_File_Browser Fl_Hold_Browser Fl_Check_Browser Fl_Select_Browser

Fl_Multi_Browser

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.9 Fl_Browser_ Class Reference

357

Public Types
enum { HORIZONTAL = 1, VERTICAL = 2, BOTH = 3, ALWAYS_ON = 4, HORIZONTAL_ALWAYS = 5, VERTICAL_ALWAYS = 6, BOTH_ALWAYS = 7 }
Values for has_scrollbar().

Public Member Functions


int deselect (int docallbacks=0)
Deselects all items in the list and returns 1 if the state changed or 0 if it did not.

void display (void item)


Displays the item, scrolling the list as necessary.

int handle (int event)


Handles the event within the normal widget bounding box.

uchar has_scrollbar () const


Returns the current scrollbar mode, see Fl_Browser_::has_scrollbar(uchar)

void has_scrollbar (uchar mode)


Sets whether the widget should have scrollbars or not (default Fl_Browser_::BOTH).

int hposition () const


Gets the horizontal scroll position of the list as a pixel position pos.

void hposition (int)


Sets the horizontal scroll position of the list to pixel position pos.

int position () const


Gets the vertical scroll position of the list as a pixel position pos.

void position (int pos)


Sets the vertical scroll position of the list to pixel position pos.

void resize (int X, int Y, int W, int H)


Repositions and/or resizes the browser.

void scrollbar_left ()
Moves the vertical scrollbar to the lefthand side of the list.

void scrollbar_right ()
Moves the vertical scrollbar to the righthand side of the list.

int scrollbar_size () const


Gets the current size of the scrollbars troughs, in pixels.

void scrollbar_size (int size)


Sets the pixel size of the scrollbars troughs to the size, in pixels.

int scrollbar_width () const


This method has been deprecated, existing for backwards compatibility only.

void scrollbar_width (int width)


This method has been deprecated, existing for backwards compatibility only.

int select (void item, int val=1, int docallbacks=0)


Sets the selection state of item to val, and returns 1 if the state changed or 0 if it did not.

int select_only (void item, int docallbacks=0)


Selects item and returns 1 if the state changed or 0 if it did not.

void sort (int ags=0)


Sort the items in the browser based on flags.

Fl_Color textcolor () const


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

358
Gets the default text color for the lines in the browser.

Class Documentation

void textcolor (Fl_Color col)


Sets the default text color for the lines in the browser to color col.

Fl_Font textfont () const


Gets the default text font for the lines in the browser.

void textfont (Fl_Font font)


Sets the default text font for the lines in the browser to font.

Fl_Fontsize textsize () const


Gets the default text size (in pixels) for the lines in the browser.

void textsize (Fl_Fontsize size)


Sets the default text size (in pixels) for the lines in the browser to size.

Public Attributes
Fl_Scrollbar hscrollbar
Horizontal scrollbar.

Fl_Scrollbar scrollbar
Vertical scrollbar.

Protected Member Functions


void bbox (int &X, int &Y, int &W, int &H) const
Returns the bounding box for the interior of the lists display window, inside the scrollbars.

void deleting (void item)


This method should be used when item is being deleted from the list.

int displayed (void item) const


Returns non-zero if item has been scrolled to a position where it is being displayed.

void draw ()
Draws the list within the normal widget bounding box.

void nd_item (int ypos)


This method returns the item under mouse y position ypos.

Fl_Browser_ (int X, int Y, int W, int H, const char L=0)


The constructor makes an empty browser.

virtual int full_height () const


This method may be provided by the subclass to indicate the full height of the item list, in pixels.

virtual int full_width () const


This method may be provided by the subclass to indicate the full width of the item list, in pixels.

virtual int incr_height () const


This method may be provided to return the average height of all items to be used for scrolling.

void inserting (void a, void b)


This method should be used when an item is in the process of being inserted into the list.

virtual void item_at (int index) const


This method must be provided by the subclass to return the item for the specied index.

virtual void item_draw (void item, int X, int Y, int W, int H) const =0
This method must be provided by the subclass to draw the item in the area indicated by X, Y, W, H.

virtual void item_rst () const =0


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.9 Fl_Browser_ Class Reference


This method must be provided by the subclass to return the rst item in the list.

359

virtual int item_height (void item) const =0


This method must be provided by the subclass to return the height of item in pixels.

virtual void item_last () const


This method must be provided by the subclass to return the last item in the list.

virtual void item_next (void item) const =0


This method must be provided by the subclass to return the item in the list after item.

virtual void item_prev (void item) const =0


This method must be provided by the subclass to return the item in the list before item.

virtual int item_quick_height (void item) const


This method may be provided by the subclass to return the height of the item, in pixels.

virtual void item_select (void item, int val=1)


This method must be implemented by the subclass if it supports multiple selections; sets the selection state to val for the item.

virtual int item_selected (void item) const


This method must be implemented by the subclass if it supports multiple selections; returns the selection state for item.

virtual void item_swap (void a, void b)


This optional method should be provided by the subclass to efciently swap browser items a and b, such as for sorting.

virtual const char item_text (void item) const


This optional method returns a string (label) that may be used for sorting.

virtual int item_width (void item) const =0


This method must be provided by the subclass to return the width of the item in pixels.

int leftedge () const


This method returns the X position of the left edge of the list area after adjusting for the scrollbar and border, if any.

void new_list ()
This method should be called when the list data is completely replaced or cleared.

void redraw_line (void item)


This method should be called when the contents of item has changed, but not its height.

void redraw_lines ()
This method will cause the entire list to be redrawn.

void replacing (void a, void b)


This method should be used when item a is being replaced by item b.

void selection () const


Returns the item currently selected, or NULL if there is no selection.

void swapping (void a, void b)


This method should be used when two items a and b are being swapped.

void top () const


Returns the item that appears at the top of the list.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

360

Class Documentation

30.9.1

Detailed Description

This is the base class for browsers. To be useful it must be subclassed and several virtual functions dened. The Forms-compatible browser and the le choosers browser are subclassed off of this. This has been designed so that the subclass has complete control over the storage of the data, although because next() and prev() functions are used to index, it works best as a linked list or as a large block of characters in which the line breaks must be searched for. A great deal of work has been done so that the "height" of a data object does not need to be determined until it is drawn. This is useful if actually guring out the size of an object requires accessing image data or doing stat() on a le or doing some other slow operation.

30.9.2
30.9.2.1

Member Enumeration Documentation


anonymous enum

Values for has_scrollbar(). Anonymous enum bit ags for has_scrollbar(). bit 0: horizontal bit 1: vertical bit 2: always (to be combined with bits 0 and 1) bit 3-31: reserved for future use Enumerator: HORIZONTAL Only show horizontal scrollbar. VERTICAL Only show vertical scrollbar. BOTH Show both scrollbars. (default) ALWAYS_ON Specied scrollbar(s) should always be shown (to be used with HORIZONTAL/VERTICAL) HORIZONTAL_ALWAYS Horizontal scrollbar always on. VERTICAL_ALWAYS Vertical scrollbar always on. BOTH_ALWAYS Both scrollbars always on.

30.9.3
30.9.3.1

Constructor & Destructor Documentation


Fl Browser ::Fl Browser ( int X, int Y, int W, int H, const char L = 0 ) [protected]

The constructor makes an empty browser. Parameters in in

X,Y,W,H position and size. L The label string, may be NULL.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.9 Fl_Browser_ Class Reference

361

30.9.4
30.9.4.1

Member Function Documentation


void Fl Browser ::bbox ( int & X, int & Y, int & W, int & H ) const [protected]

Returns the bounding box for the interior of the lists display window, inside the scrollbars. Parameters out

X,Y,W,H The returned bounding box. (The original contents of these parameters are overwritten)

30.9.4.2

void Fl Browser ::deleting ( void item ) [protected]

This method should be used when item is being deleted from the list. It allows the Fl_Browser_ to discard any cached data it has on the item. This method does not actually delete the item, but handles the follow up bookkeeping after the item has just been deleted. Parameters in

item The item being deleted.

30.9.4.3

int Fl Browser ::deselect ( int docallbacks = 0 )

Deselects all items in the list and returns 1 if the state changed or 0 if it did not. If the optional docallbacks parameter is non-zero, deselect tries to call the callback function for the widget. Parameters in

docallbacks If 1, invokes widget callback if item changed. If 0, doesnt do callback (default).

30.9.4.4

void Fl Browser ::display ( void item )

Displays the item, scrolling the list as necessary. Parameters in

item The item to be displayed.

See also display(), displayed()

30.9.4.5

int Fl Browser ::displayed ( void item ) const [protected]

Returns non-zero if item has been scrolled to a position where it is being displayed.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

362

Class Documentation

Checks to see if the items vertical position is within the top and bottom edges of the display window. This does NOT take into account the hide()/show() status of the widget or item. Parameters in

item The item to check

Returns 1 if visible, 0 if not visible.

See also display(), displayed()

30.9.4.6

void Fl Browser ::nd item ( int ypos ) [protected]

This method returns the item under mouse y position ypos. NULL is returned if no item is displayed at that position. Parameters in

ypos The y position (eg. Fl::event_y()) to nd an item under.

Returns The item, or NULL if not found

30.9.4.7

int Fl Browser ::full height ( ) const [protected, virtual]

This method may be provided by the subclass to indicate the full height of the item list, in pixels. The default implementation computes the full height from the item heights. Includes the items that are scrolled off screen. Returns The height of the entire list, in pixels. Reimplemented in Fl_Browser. 30.9.4.8 int Fl Browser ::full width ( ) const [protected, virtual]

This method may be provided by the subclass to indicate the full width of the item list, in pixels. The default implementation computes the full width from the item widths. Returns The maximum width of all the items, in pixels.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.9 Fl_Browser_ Class Reference 30.9.4.9 int Fl Browser ::handle ( int event ) [virtual]

363

Handles the event within the normal widget bounding box. Parameters in

event The event to process.

Returns 1 if event was processed, 0 if not. Reimplemented from Fl_Group. Reimplemented in Fl_Check_Browser.

30.9.4.10

void Fl Browser ::has scrollbar ( uchar mode ) [inline]

Sets whether the widget should have scrollbars or not (default Fl_Browser_::BOTH). By default you can scroll in both directions, and the scrollbars disappear if the data will t in the widget. has_scrollbar() changes this based on the value of mode: 0 - No scrollbars. Fl_Browser_::HORIZONTAL - Only a horizontal scrollbar. Fl_Browser_::VERTICAL - Only a vertical scrollbar. Fl_Browser_::BOTH - The default is both scrollbars. Fl_Browser_::HORIZONTAL_ALWAYS - Horizontal scrollbar always on, vertical always off. Fl_Browser_::VERTICAL_ALWAYS - Vertical scrollbar always on, horizontal always off. Fl_Browser_::BOTH_ALWAYS - Both always on.

30.9.4.11

int Fl Browser ::hposition ( ) const [inline]

Gets the horizontal scroll position of the list as a pixel position pos. The position returned is how many pixels of the list are scrolled off the left edge of the screen. Example: A position of 18 indicates the left 18 pixels of the list are scrolled off the left edge of the screen. See also position(), hposition()

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

364 30.9.4.12 void Fl Browser ::hposition ( int pos )

Class Documentation

Sets the horizontal scroll position of the list to pixel position pos. The position is how many pixels of the list are scrolled off the left edge of the screen. Example: A position of 18 scrolls the left 18 pixels of the list off the left edge of the screen. Parameters in

pos The horizontal position (in pixels) to scroll the browser to.

See also position(), hposition()

30.9.4.13

int Fl Browser ::incr height ( ) const [protected, virtual]

This method may be provided to return the average height of all items to be used for scrolling. The default implementation uses the height of the rst item. Returns The average height of items, in pixels. Reimplemented in Fl_Browser. 30.9.4.14 void Fl Browser ::inserting ( void a, void b ) [protected]

This method should be used when an item is in the process of being inserted into the list. It allows the Fl_Browser_ to update its cache data as needed, scheduling a redraw for the affected lines. This method does not actually insert items, but handles the follow up bookkeeping after items have been inserted. Parameters in in

a The starting item position b The new item being inserted

30.9.4.15

virtual void Fl Browser ::item at ( int index ) const [inline, protected, virtual]

This method must be provided by the subclass to return the item for the specied index. Parameters in Returns The item at the specied index. Reimplemented in Fl_Browser.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

index The index of the item to be returned

30.9 Fl_Browser_ Class Reference 30.9.4.16 virtual void Fl Browser ::item rst ( ) const [protected, pure virtual]

365

This method must be provided by the subclass to return the rst item in the list. See also item_rst(), item_next(), item_last(), item_prev() Implemented in Fl_Browser. 30.9.4.17 virtual int Fl Browser ::item height ( void item ) const [protected, pure virtual]

This method must be provided by the subclass to return the height of item in pixels. Allow for two additional pixels for the list selection box. Parameters in

item The item whose height is returned.

Returns The height of the specied item in pixels.

See also item_height(), item_width(), item_quick_height() Implemented in Fl_Browser. 30.9.4.18 virtual void Fl Browser ::item last ( ) const [inline, protected, virtual]

This method must be provided by the subclass to return the last item in the list. See also item_rst(), item_next(), item_last(), item_prev() Reimplemented in Fl_Browser. 30.9.4.19 virtual void Fl Browser ::item next ( void item ) const [protected, pure virtual]

This method must be provided by the subclass to return the item in the list after item. See also item_rst(), item_next(), item_last(), item_prev() Implemented in Fl_Browser.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

366 30.9.4.20

Class Documentation virtual void Fl Browser ::item prev ( void item ) const [protected, pure virtual]

This method must be provided by the subclass to return the item in the list before item. See also item_rst(), item_next(), item_last(), item_prev() Implemented in Fl_Browser. 30.9.4.21 int Fl Browser ::item quick height ( void item ) const [protected, virtual]

This method may be provided by the subclass to return the height of the item, in pixels. Allow for two additional pixels for the list selection box. This method differs from item_height in that it is only called for selection and scrolling operations. The default implementation calls item_height. Parameters in

item The item whose height to return.

Returns The height, in pixels.

30.9.4.22

void Fl Browser ::item select ( void item, int val = 1 ) [protected, virtual]

This method must be implemented by the subclass if it supports multiple selections; sets the selection state to val for the item. Sets the selection state for item, where optional val is 1 (select, the default) or 0 (de-select). Parameters in in

item The item to be selected val The optional selection state; 1=select, 0=de-select. The default is to select the item (1).

Reimplemented in Fl_Browser. 30.9.4.23 int Fl Browser ::item selected ( void item ) const [protected, virtual]

This method must be implemented by the subclass if it supports multiple selections; returns the selection state for item. The method should return 1 if item is selected, or 0 otherwise. Parameters in

item The item to test.

Reimplemented in Fl_Browser.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.9 Fl_Browser_ Class Reference 30.9.4.24 virtual void Fl Browser ::item swap ( void a, void b ) [inline, protected, virtual]

367

This optional method should be provided by the subclass to efciently swap browser items a and b, such as for sorting. Parameters in

a,b The two items to be swapped.

Reimplemented in Fl_Browser. 30.9.4.25 virtual const char Fl Browser ::item text ( void item ) const [inline, protected, virtual]

This optional method returns a string (label) that may be used for sorting. Parameters in

item The item whose label text is returned.

Returns The items text label. (Can be NULL if blank) Reimplemented in Fl_Browser. 30.9.4.26 virtual int Fl Browser ::item width ( void item ) const [protected, pure virtual]

This method must be provided by the subclass to return the width of the item in pixels. Allow for two additional pixels for the list selection box. Parameters in

item The item whose width is returned.

Returns The width of the item in pixels. Implemented in Fl_Browser. 30.9.4.27 int Fl Browser ::leftedge ( ) const [protected]

This method returns the X position of the left edge of the list area after adjusting for the scrollbar and border, if any. Returns The X position of the left edge of the list, in pixels.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

368 See also Fl_Browser_::bbox()

Class Documentation

30.9.4.28

void Fl Browser ::new list ( ) [protected]

This method should be called when the list data is completely replaced or cleared. It informs the Fl_Browser_ widget that any cached information it has concerning the items is invalid. This method does not clear the list, it just handles the follow up bookkeeping after the list has been cleared. 30.9.4.29 int Fl Browser ::position ( ) const [inline]

Gets the vertical scroll position of the list as a pixel position pos. The position returned is how many pixels of the list are scrolled off the top edge of the screen. Example: A position of 3 indicates the top 3 pixels of the list are scrolled off the top edge of the screen. See also position(), hposition()

30.9.4.30

void Fl Browser ::position ( int pos )

Sets the vertical scroll position of the list to pixel position pos. The position is how many pixels of the list are scrolled off the top edge of the screen. Example: A position of 3 scrolls the top three pixels of the list off the top edge of the screen. Parameters in

pos The vertical position (in pixels) to scroll the browser to.

See also position(), hposition()

30.9.4.31

void Fl Browser ::redraw line ( void item ) [protected]

This method should be called when the contents of item has changed, but not its height. Parameters in

item The item that needs to be redrawn.

See also redraw_lines(), redraw_line()

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.9 Fl_Browser_ Class Reference 30.9.4.32 void Fl Browser ::redraw lines ( ) [inline, protected]

369

This method will cause the entire list to be redrawn. See also redraw_lines(), redraw_line()

30.9.4.33

void Fl Browser ::replacing ( void a, void b ) [protected]

This method should be used when item a is being replaced by item b. It allows the Fl_Browser_ to update its cache data as needed, schedules a redraw for the item being changed, and tries to maintain the selection. This method does not actually replace the item, but handles the follow up bookkeeping after the item has just been replaced. Parameters in in

a Item being replaced b Item to replace a

30.9.4.34

void Fl Browser ::resize ( int X, int Y, int W, int H ) [virtual]

Repositions and/or resizes the browser. Parameters in

X,Y,W,H The new position and size for the browser, in pixels.

Reimplemented from Fl_Group.

30.9.4.35

void Fl Browser ::scrollbar left ( ) [inline]

Moves the vertical scrollbar to the lefthand side of the list. For back compatibility.

30.9.4.36

void Fl Browser ::scrollbar right ( ) [inline]

Moves the vertical scrollbar to the righthand side of the list. For back compatibility.

30.9.4.37

int Fl Browser ::scrollbar size ( ) const [inline]

Gets the current size of the scrollbars troughs, in pixels. If this value is zero (default), this widget will use the Fl::scrollbar_size() value as the scrollbars width.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

370 Returns Scrollbar size in pixels, or 0 if the global Fl::scrollsize() is being used.

Class Documentation

See also Fl::scrollbar_size(int)

30.9.4.38

void Fl Browser ::scrollbar size ( int size ) [inline]

Sets the pixel size of the scrollbars troughs to the size, in pixels. Normally you should not need this method, and should use Fl::scrollbar_size(int) instead to manage the size of ALL your widgets scrollbars. This ensures your application has a consistent UI, is the default behavior, and is normally what you want. Only use THIS method if you really need to override the global scrollbar size. The need for this should be rare. Setting size to the special value of 0 causes the widget to track the global Fl::scrollbar_size(), which is the default. Parameters in

size Sets the scrollbar size in pixels. If 0 (default), scrollbar size tracks the global Fl::scrollbar_size()

See also Fl::scrollbar_size()

30.9.4.39

int Fl Browser ::scrollbar width ( ) const [inline]

This method has been deprecated, existing for backwards compatibility only. Use scrollbar_size() instead. This method always returns the global value Fl::scrollbar_size(). Returns Always returns the global value Fl::scrollbar_size(). Todo This method should eventually be removed in 1.4+

30.9.4.40

void Fl Browser ::scrollbar width ( int width ) [inline]

This method has been deprecated, existing for backwards compatibility only. Use scrollbar_size(int) instead. This method sets the global Fl::scrollbar_size(), and forces this instance of the widget to use it. Todo This method should eventually be removed in 1.4+

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.9 Fl_Browser_ Class Reference 30.9.4.41 int Fl Browser ::select ( void item, int val = 1, int docallbacks = 0 )

371

Sets the selection state of item to val, and returns 1 if the state changed or 0 if it did not. If docallbacks is non-zero, select tries to call the callback function for the widget. Parameters in in in

item The item whose selection state is to be changed val The new selection state (1=select, 0=de-select) docallbacks If 1, invokes widget callback if item changed. If 0, doesnt do callback (default).

Returns 1 if state was changed, 0 if not.

30.9.4.42

int Fl Browser ::select only ( void item, int docallbacks = 0 )

Selects item and returns 1 if the state changed or 0 if it did not. Any other items in the list are deselected. Parameters in in

item The item to select. docallbacks If 1, invokes widget callback if item changed. If 0, doesnt do callback (default).

30.9.4.43

void Fl Browser ::selection ( ) const [inline, protected]

Returns the item currently selected, or NULL if there is no selection. For multiple selection browsers this call returns the currently focused item, even if it is not selected. To nd all selected items, call Fl_Multi_Browser::selected() for every item in question. 30.9.4.44 void Fl Browser ::sort ( int ags = 0 )

Sort the items in the browser based on flags. item_swap(void, void) and item_text(void) must be implemented for this call. Parameters in

ags FL_SORT_ASCENDING -- sort in ascending order FL_SORT_DESCENDING -- sort in descending order Values other than the above will cause undened behavior Other ags may appear in the future.

Todo Add a ag to ignore case

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

372 30.9.4.45 void Fl Browser ::swapping ( void a, void b ) [protected]

Class Documentation

This method should be used when two items a and b are being swapped. It allows the Fl_Browser_ to update its cache data as needed, schedules a redraw for the two items, and tries to maintain the current selection. This method does not actually swap items, but handles the follow up bookkeeping after items have been swapped. Parameters in

a,b Items being swapped.

30.9.4.46 Fl_Font Fl Browser ::textfont ( ) const [inline] Gets the default text font for the lines in the browser. See also textfont(), textsize(), textcolor()

30.9.5

Member Data Documentation

30.9.5.1 Fl_Scrollbar Fl_Browser_::hscrollbar Horizontal scrollbar. Public, so that it can be accessed directly.

30.9.5.2 Fl_Scrollbar Fl_Browser_::scrollbar Vertical scrollbar. Public, so that it can be accessed directly. The documentation for this class was generated from the following les: Fl_Browser_.H Fl_Browser_.cxx

30.10

Fl Button Class Reference

Buttons generate callbacks when they are clicked by the user. #include <Fl_Button.H> Inheritance diagram for Fl_Button:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.10 Fl_Button Class Reference


Fl_Widget Fl_Button Fl_Light_Button Fl_Check_Button Fl_Radio_Light_Button Fl_Radio_Button Fl_Round_Button Fl_Radio_Round_Button Fl_Repeat_Button Fl_Return_Button Fl_Toggle_Button

373

Public Member Functions


int clear ()
Same as value(0).

Fl_Boxtype down_box () const


Returns the current down box type, which is drawn when value() is non-zero.

void down_box (Fl_Boxtype b)


Sets the down box type.

Fl_Color down_color () const


(for backwards compatibility)

void down_color (unsigned c)


(for backwards compatibility)

Fl_Button (int X, int Y, int W, int H, const char L=0)


The constructor creates the button using the given position, size and label.

virtual int handle (int)


Handles the specied event.

int set ()
Same as value(1).

void setonly ()
Turns on this button and turns off all other radio buttons in the group (calling value(1) or set() does not do this).

int shortcut () const


Returns the current shortcut key for the button.

void shortcut (int s)


Sets the shortcut key to s.

void shortcut (const char s)


(for backwards compatibility)

int value (int v)


Sets the current value of the button.

char value () const


Returns the current value of the button (0 or 1).

Protected Member Functions


virtual void draw ()
Draws the widget.

void simulate_key_action ()
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

374

Class Documentation

Static Protected Member Functions


static void key_release_timeout (void )

Static Protected Attributes


static Fl_Widget_Tracker key_release_tracker = 0

30.10.1

Detailed Description

Buttons generate callbacks when they are clicked by the user. You control exactly when and how by changing the values for type() and when(). Buttons can also generate callbacks in response to FL_SHORTCUT events. The button can either have an explicit shortcut(int s) value or a letter shortcut can be indicated in the label() with an & character before it. For the label shortcut it does not matter if Alt is held down, but if you have an input eld in the same window, the user will have to hold down the Alt key so that the input eld does not eat the event rst as an FL_KEYBOARD event. Todo Refactor the doxygen comments for Fl_Button type() documentation. For an Fl_Button object, the type() call returns one of: FL_NORMAL_BUTTON (0): value() remains unchanged after button press. FL_TOGGLE_BUTTON: value() is inverted after button press. FL_RADIO_BUTTON: value() is set to 1 after button press, and all other buttons in the current group with type() == FL_RADIO_BUTTON are set to zero. Todo Refactor the doxygen comments for Fl_Button when() documentation. For an Fl_Button object, the following when() values are useful, the default being FL_WHEN_RELEASE: 0: The callback is not done, instead changed() is turned on. FL_WHEN_RELEASE: The callback is done after the user successfully clicks the button, or when a shortcut is typed. FL_WHEN_CHANGED: The callback is done each time the value() changes (when the user pushes and releases the button, and as the mouse is dragged around in and out of the button).

30.10.2
30.10.2.1

Constructor & Destructor Documentation


Fl Button::Fl Button ( int X, int Y, int W, int H, const char L = 0 )

The constructor creates the button using the given position, size and label. Parameters in in

X,Y,W,H position and size of the widget L widget label, default is no label

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.10 Fl_Button Class Reference

375

30.10.3
30.10.3.1

Member Function Documentation


int Fl Button::clear ( ) [inline]

Same as value(0). See also value(int v)

30.10.3.2 Fl_Boxtype Fl Button::down box ( ) const [inline] Returns the current down box type, which is drawn when value() is non-zero. Return values Fl_Boxtype

30.10.3.3

void Fl Button::down box ( Fl_Boxtype b ) [inline]

Sets the down box type. The default value of 0 causes FLTK to gure out the correct matching down version of box(). Parameters in

b down box type

30.10.3.4

void Fl Button::draw ( ) [protected, virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Implements Fl_Widget. Reimplemented in Fl_Light_Button, and Fl_Return_Button. 30.10.3.5 int Fl Button::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

376

Class Documentation

When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted

See also Fl_Event Reimplemented from Fl_Widget. Reimplemented in Fl_Light_Button, Fl_Return_Button, and Fl_Repeat_Button. 30.10.3.6 int Fl Button::set ( ) [inline]

Same as value(1). See also value(int v)

30.10.3.7

int Fl Button::shortcut ( ) const [inline]

Returns the current shortcut key for the button. Return values int

30.10.3.8

void Fl Button::shortcut ( int s ) [inline]

Sets the shortcut key to s. Setting this overrides the use of & in the label(). The value is a bitwise OR of a key and a set of shift ags, for example: FL_ALT | a, or FL_ALT | (FL_F + 10), or just a. A value of 0 disables the shortcut. The key can be any value returned by Fl::event_key(), but will usually be an ASCII letter. Use a lower-case letter unless you require the shift key to be held down. The shift ags can be any set of values accepted by Fl::event_state(). If the bit is on, that shift key must be pushed. Meta, Alt, Ctrl, and Shift must be off if they are not in the shift ags (zero for the other bits indicates a "dont care" setting).
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.11 Fl_Cairo_State Class Reference Parameters in

377

s bitwise OR of key and shift ags

30.10.3.9

int Fl Button::value ( int v )

Sets the current value of the button. A non-zero value sets the button to 1 (ON), and zero sets it to 0 (OFF). Parameters in

v button value.

See also set(), clear() The documentation for this class was generated from the following les: Fl_Button.H Fl_Button.cxx

30.11

Fl Cairo State Class Reference

Contains all the necessary info on the current cairo context. #include <Fl_Cairo.H>

Public Member Functions


bool autolink () const
Gets the autolink option. See Fl::cairo_autolink_context(bool)

void autolink (bool b)


Sets the autolink option, only available with --enable-cairoext.

cairo_t cc () const
Gets the current cairo context.

void cc (cairo_t c, bool own=true)


Sets the current cairo context, own indicates cc deletion is handle externally by user.

void gc (void c)
Sets the gc c to keep track on.

void gc () const
Gets the last gc attached to a cc.

void window (void w)


Sets the window w to keep track on.

void window () const


Gets the last window attached to a cc.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

378

Class Documentation

30.11.1

Detailed Description

Contains all the necessary info on the current cairo context. A private internal & unique corresponding object is created to permit cairo context state handling while keeping it opaque. For internal use only. Note Only available when congure has the --enable-cairo option The documentation for this class was generated from the following le: Fl_Cairo.H

30.12

Fl Cairo Window Class Reference

This denes a pre-congured cairo tk window. #include <Fl_Cairo_Window.H> Inheritance diagram for Fl_Cairo_Window:
Fl_Widget Fl_Group Fl_Window Fl_Double_Window Fl_Cairo_Window

Public Types
typedef void( cairo_draw_cb )(Fl_Cairo_Window self, cairo_t def)
This denes the cairo draw callback prototype that you must further.

Public Member Functions


Fl_Cairo_Window (int w, int h) void set_draw_cb (cairo_draw_cb cb)
You must provide a draw callback which will implement your cairo rendering.

Protected Member Functions


void draw ()
Overloaded to provide cairo callback support.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.13 Fl_Chart Class Reference

379

30.12.1

Detailed Description

This denes a pre-congured cairo tk window. This class overloads the virtual draw() method for you, so that the only thing you have to do is to provide your cairo code. All cairo context handling is achieved transparently. Note You can alternatively dene your custom cairo tk window, and thus at least override the draw() method to provide custom cairo support. In this case you will probably use Fl::cairo_make_current(Fl_Window) to attach a context to your window. You should do it only when your window is the current window.

See also Fl_Window::current()

30.12.2
30.12.2.1

Member Function Documentation


void Fl Cairo Window::set draw cb ( cairo_draw_cb cb ) [inline]

You must provide a draw callback which will implement your cairo rendering. This method will permit you to set your cairo callback to cb. The documentation for this class was generated from the following le: Fl_Cairo_Window.H

30.13

Fl Chart Class Reference

Fl_Chart displays simple charts. #include <Fl_Chart.H> Inheritance diagram for Fl_Chart:

Fl_Widget Fl_Chart

Public Member Functions


void add (double val, const char str=0, unsigned col=0)
Add the data value val with optional label str and color col to the chart.

uchar autosize () const


Get whether the chart will automatically adjust the bounds of the chart.

void autosize (uchar n)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

380
Set whether the chart will automatically adjust the bounds of the chart.

Class Documentation

void bounds (double a, double b) const


Gets the lower and upper bounds of the chart values.

void bounds (double a, double b)


Sets the lower and upper bounds of the chart values.

void clear ()
Removes all values from the chart.

Fl_Chart (int X, int Y, int W, int H, const char L=0)


Create a new Fl_Chart widget using the given position, size and label string.

void insert (int ind, double val, const char str=0, unsigned col=0)
Inserts a data value val at the given position ind.

int maxsize () const


Gets the maximum number of data values for a chart.

void maxsize (int m)


Set the maximum number of data values for a chart.

void replace (int ind, double val, const char str=0, unsigned col=0)
Replace a data value val at the given position ind.

int size () const


Returns the number of data values in the chart.

void size (int W, int H)


Changes the size of the widget.

Fl_Color textcolor () const


Gets the charts text color.

void textcolor (Fl_Color n)


gets the charts text color to n.

Fl_Font textfont () const


Gets the charts text font.

void textfont (Fl_Font s)


Sets the charts text font to s.

Fl_Fontsize textsize () const


Gets the charts text size.

void textsize (Fl_Fontsize s)


gets the charts text size to s.

Fl_Chart ()
Destroys the Fl_Chart widget and all of its data.

Protected Member Functions


void draw ()
Draws the widget.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.13 Fl_Chart Class Reference

381

30.13.1

Detailed Description

Fl_Chart displays simple charts. It is provided for Forms compatibility.

Figure 30.2: Fl_Chart

Todo Refactor Fl_Chart::type() information. The type of an Fl_Chart object can be set using type(uchar t) to: FL_BAR_CHART: Each sample value is drawn as a vertical bar. FL_FILLED_CHART: The chart is lled from the bottom of the graph to the sample values. FL_HORBAR_CHART: Each sample value is drawn as a horizontal bar. FL_LINE_CHART: The chart is drawn as a polyline with vertices at each sample value. FL_PIE_CHART: A pie chart is drawn with each sample value being drawn as a proportionate slice in the circle. FL_SPECIALPIE_CHART: Like FL_PIE_CHART, but the rst slice is separated from the pie. FL_SPIKE_CHART: Each sample value is drawn as a vertical line.

30.13.2
30.13.2.1

Constructor & Destructor Documentation


Fl Chart::Fl Chart ( int X, int Y, int W, int H, const char L = 0 )

Create a new Fl_Chart widget using the given position, size and label string. The default boxstyle is FL_NO_BOX. Parameters in in

X,Y,W,H position and size of the widget L widget label, default is no label

30.13.3

Member Function Documentation

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

382 30.13.3.1 void Fl Chart::add ( double val, const char str = 0, unsigned col = 0 )

Class Documentation

Add the data value val with optional label str and color col to the chart. Parameters in in in

val data value str optional data label col optional data color

30.13.3.2 uchar Fl Chart::autosize ( ) const [inline] Get whether the chart will automatically adjust the bounds of the chart. Returns non-zero if auto-sizing is enabled and zero if disabled.

30.13.3.3

void Fl Chart::autosize ( uchar n ) [inline]

Set whether the chart will automatically adjust the bounds of the chart. Parameters in

n non-zero to enable automatic resizing, zero to disable.

30.13.3.4

void Fl Chart::bounds ( double a, double b ) const [inline]

Gets the lower and upper bounds of the chart values. Parameters out

a,b are set to lower, upper

30.13.3.5

void Fl Chart::bounds ( double a, double b )

Sets the lower and upper bounds of the chart values. Parameters in

a,b are used to set lower, upper

30.13.3.6

void Fl Chart::draw ( ) [protected, virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.13 Fl_Chart Class Reference Override this function to draw your own widgets.

383

If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Implements Fl_Widget. 30.13.3.7 void Fl Chart::insert ( int ind, double val, const char str = 0, unsigned col = 0 )

Inserts a data value val at the given position ind. Position 1 is the rst data value. Parameters in in in in

ind val str col

insertion position data value optional data label optional data color

30.13.3.8

void Fl Chart::maxsize ( int m )

Set the maximum number of data values for a chart. If you do not call this method then the chart will be allowed to grow to any size depending on available memory. Parameters in

m maximum number of data values allowed.

30.13.3.9

void Fl Chart::replace ( int ind, double val, const char str = 0, unsigned col = 0 )

Replace a data value val at the given position ind. Position 1 is the rst data value. Parameters in in in in

ind val str col

insertion position data value optional data label optional data color

30.13.3.10

void Fl Chart::size ( int W, int H ) [inline]

Changes the size of the widget. size(W, H) is a shortcut for resize(x(), y(), W, H).
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

384 Parameters in

Class Documentation

W,H new size

See also position(int,int), resize(int,int,int,int) Reimplemented from Fl_Widget.

30.13.3.11

void Fl Chart::textcolor ( Fl_Color n ) [inline]

gets the charts text color to n.

30.13.3.12

void Fl Chart::textfont ( Fl_Font s ) [inline]

Sets the charts text font to s.

30.13.3.13

void Fl Chart::textsize ( Fl_Fontsize s ) [inline]

gets the charts text size to s. The documentation for this class was generated from the following les: Fl_Chart.H Fl_Chart.cxx

30.14

FL CHART ENTRY Struct Reference

For internal use only. #include <Fl_Chart.H>

Public Attributes
unsigned col
For internal use only.

char str [FL_CHART_LABEL_MAX+1]


For internal use only.

oat val
For internal use only.

30.14.1

Detailed Description

For internal use only.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.15 Fl_Check_Browser Class Reference

385

30.14.2
30.14.2.1

Member Data Documentation


unsigned FL_CHART_ENTRY::col

For internal use only. 30.14.2.2 char FL_CHART_ENTRY::str[FL CHART LABEL MAX+1]

For internal use only. 30.14.2.3 oat FL_CHART_ENTRY::val

For internal use only. The documentation for this struct was generated from the following le: Fl_Chart.H

30.15

Fl Check Browser Class Reference

The Fl_Check_Browser widget displays a scrolling list of text lines that may be selected and/or checked by the user. #include <Fl_Check_Browser.H> Inheritance diagram for Fl_Check_Browser:
Fl_Widget Fl_Group Fl_Browser_ Fl_Check_Browser

Public Member Functions


int add (char s)
Add a new unchecked line to the end of the browser.

int add (char s, int b)


Add a new line to the end of the browser.

int add (const char s)


See int Fl_Check_Browser::add(char s)

int add (const char s, int b)


See int Fl_Check_Browser::add(char s)

void check_all ()
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

386
Sets all the items checked.

Class Documentation

void check_none ()
Sets all the items unchecked.

int checked (int item) const


Gets the current status of item item.

void checked (int item, int b)


Sets the check status of item item to b.

void clear ()
Remove every item from the browser.

Fl_Check_Browser (int x, int y, int w, int h, const char l=0)


The constructor makes an empty browser.

int nchecked () const


Returns how many items are currently checked.

int nitems () const


Returns how many lines are in the browser.

int remove (int item)


Remove line n and make the browser one line shorter.

void set_checked (int item)


Equivalent to Fl_Check_Browser::checked(item, 1).

char text (int item) const


Return a pointer to an internal buffer holding item items text.

int value () const


Returns the index of the currently selected item.

Fl_Check_Browser ()
The destructor deletes all list items and destroys the browser.

Protected Member Functions


int handle (int)
Handles the event within the normal widget bounding box.

30.15.1

Detailed Description

The Fl_Check_Browser widget displays a scrolling list of text lines that may be selected and/or checked by the user.

30.15.2
30.15.2.1

Constructor & Destructor Documentation


Fl Check Browser::Fl Check Browser ( int X, int Y, int W, int H, const char l = 0 )

The constructor makes an empty browser. 30.15.2.2 Fl Check Browser::Fl Check Browser ( ) [inline]

The destructor deletes all list items and destroys the browser.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.15 Fl_Check_Browser Class Reference

387

30.15.3
30.15.3.1

Member Function Documentation


int Fl Check Browser::add ( char s )

Add a new unchecked line to the end of the browser. See also add(char s, int b)

30.15.3.2

int Fl Check Browser::add ( char s, int b )

Add a new line to the end of the browser. The text is copied using the strdup() function. It may also be NULL to make a blank line. It can set the item checked if b is not 0. 30.15.3.3 void Fl Check Browser::check all ( )

Sets all the items checked. 30.15.3.4 void Fl Check Browser::check none ( )

Sets all the items unchecked. 30.15.3.5 int Fl Check Browser::checked ( int i ) const

Gets the current status of item item. 30.15.3.6 void Fl Check Browser::checked ( int i, int b )

Sets the check status of item item to b. 30.15.3.7 void Fl Check Browser::clear ( )

Remove every item from the browser. Reimplemented from Fl_Group. 30.15.3.8 int Fl Check Browser::handle ( int event ) [protected, virtual]

Handles the event within the normal widget bounding box. Parameters in

event The event to process.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

388 Returns 1 if event was processed, 0 if not. Reimplemented from Fl_Browser_.

Class Documentation

30.15.3.9

int Fl Check Browser::nchecked ( ) const [inline]

Returns how many items are currently checked.

30.15.3.10

int Fl Check Browser::nitems ( ) const [inline]

Returns how many lines are in the browser. The last line number is equal to this.

30.15.3.11

int Fl Check Browser::remove ( int item )

Remove line n and make the browser one line shorter. Returns the number of lines left in the browser. Reimplemented from Fl_Group.

30.15.3.12

void Fl Check Browser::set checked ( int item ) [inline]

Equivalent to Fl_Check_Browser::checked(item, 1).

30.15.3.13

char Fl Check Browser::text ( int i ) const

Return a pointer to an internal buffer holding item items text.

30.15.3.14

int Fl Check Browser::value ( ) const

Returns the index of the currently selected item. The documentation for this class was generated from the following les: Fl_Check_Browser.H Fl_Check_Browser.cxx

30.16

Fl Check Button Class Reference

A button with an "checkmark" to show its status. #include <Fl_Check_Button.H> Inheritance diagram for Fl_Check_Button:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.16 Fl_Check_Button Class Reference


Fl_Widget Fl_Button Fl_Light_Button Fl_Check_Button

389

Public Member Functions


Fl_Check_Button (int X, int Y, int W, int H, const char L=0)
Creates a new Fl_Check_Button widget using the given position, size and label string.

30.16.1

Detailed Description

A button with an "checkmark" to show its status.

Figure 30.3: Fl_Check_Button

Buttons generate callbacks when they are clicked by the user. You control exactly when and how by changing the values for type() and when(). The Fl_Check_Button subclass displays its "ON" state by showing a "checkmark" rather than drawing itself pushed in. Todo Refactor Fl_Check_Button doxygen comments (add color() info etc?) Generate Fl_Check_Button.gif with visible checkmark.

30.16.2
30.16.2.1

Constructor & Destructor Documentation


Fl Check Button::Fl Check Button ( int X, int Y, int W, int H, const char L = 0 )

Creates a new Fl_Check_Button widget using the given position, size and label string. Parameters in in

X,Y,W,H position and size of the widget L widget label, default is no label

The documentation for this class was generated from the following les: Fl_Check_Button.H Fl_Check_Button.cxx
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

390

Class Documentation

30.17

Fl Choice Class Reference

A button that is used to pop up a menu. #include <Fl_Choice.H> Inheritance diagram for Fl_Choice:

Fl_Widget Fl_Menu_ Fl_Choice

Public Member Functions


Fl_Choice (int X, int Y, int W, int H, const char L=0)
Create a new Fl_Choice widget using the given position, size and label string.

int handle (int)


Handles the specied event.

int value () const


Gets the index of the last item chosen by the user.

int value (int v)


Sets the currently selected value using the index into the menu item array.

int value (const Fl_Menu_Item v)


Sets the currently selected value using a pointer to menu item.

Protected Member Functions


void draw ()
Draws the widget.

30.17.1

Detailed Description

A button that is used to pop up a menu. This is a button that, when pushed, pops up a menu (or hierarchy of menus) dened by an array of Fl_Menu_Item objects. Motif calls this an OptionButton. The only difference between this and a Fl_Menu_Button is that the name of the most recent chosen menu item is displayed inside the box, while the label is displayed outside the box. However, since the use of this is most often to control a single variable rather than do individual callbacks, some of the Fl_Menu_Button methods are redescribed here in those terms. When the user picks an item off the menu the value() is set to that item and then the items callback is done with the menu_button as the Fl_Widget argument. If the item does not have a callback the menu_buttons callback is done instead. All three mouse buttons pop up the menu. The Forms behavior of the rst two buttons to increment/decrement the choice is not implemented. This could be added with a subclass, however.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.17 Fl_Choice Class Reference

391

The menu will also pop up in response to shortcuts indicated by putting a & character in the label(). See Fl_Button::shortcut(int s) for a description of this. Typing the shortcut() of any of the items will do exactly the same as when you pick the item with the mouse. The & character in item names are only looked at when the menu is popped up, however.

Figure 30.4: Fl_Choice

Todo Refactor the doxygen comments for Fl_Choice changed() documentation. int Fl_Widget::changed() const This value is true the user picks a different value. It is turned off by value() and just before doing a callback (the callback can turn it back on if desired). void Fl_Widget::set_changed() This method sets the changed() ag. void Fl_Widget::clear_changed() This method clears the changed() ag. Fl_Boxtype Fl_Choice::down_box() const Gets the current down box, which is used when the menu is popped up. The default down box type is FL_DOWN_BOX. void Fl_Choice::down_box(Fl_Boxtype b) Sets the current down box type to b.

30.17.2
30.17.2.1

Constructor & Destructor Documentation


Fl Choice::Fl Choice ( int X, int Y, int W, int H, const char L = 0 )

Create a new Fl_Choice widget using the given position, size and label string. The default boxtype is FL_UP_BOX. The constructor sets menu() to NULL. See Fl_Menu_ for the methods to set or change the menu. Parameters in in

X,Y,W,H position and size of the widget L widget label, default is no label

30.17.3
30.17.3.1

Member Function Documentation


void Fl Choice::draw ( ) [protected, virtual]

Draws the widget.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

392

Class Documentation

Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Implements Fl_Widget. 30.17.3.2 int Fl Choice::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted

See also Fl_Event Reimplemented from Fl_Widget. 30.17.3.3 int Fl Choice::value ( ) const [inline]

Gets the index of the last item chosen by the user. The index is zero initially. Reimplemented from Fl_Menu_. 30.17.3.4 int Fl Choice::value ( int v )

Sets the currently selected value using the index into the menu item array. Changing the selected value causes a redraw().

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.18 Fl_Clock Class Reference Parameters in

393

v index of value in the menu item array.

Returns non-zero if the new value is different to the old one. Reimplemented from Fl_Menu_. 30.17.3.5 int Fl Choice::value ( const Fl_Menu_Item v )

Sets the currently selected value using a pointer to menu item. Changing the selected value causes a redraw(). Parameters in Returns non-zero if the new value is different to the old one. Reimplemented from Fl_Menu_. The documentation for this class was generated from the following les: Fl_Choice.H Fl_Choice.cxx

v pointer to menu item in the menu item array.

30.18

Fl Clock Class Reference

This widget provides a round analog clock display. #include <Fl_Clock.H> Inheritance diagram for Fl_Clock:
Fl_Widget Fl_Clock_Output Fl_Clock Fl_Round_Clock

Public Member Functions


Fl_Clock (int X, int Y, int W, int H, const char L=0)
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

394
Create an Fl_Clock widget using the given position, size, and label string.

Class Documentation

Fl_Clock (uchar t, int X, int Y, int W, int H, const char L)


Create an Fl_Clock widget using the given boxtype, position, size, and label string.

int handle (int)


Handles the specied event.

Fl_Clock ()
The destructor removes the clock.

30.18.1

Detailed Description

This widget provides a round analog clock display. Fl_Clock is provided for Forms compatibility. It installs a 1-second timeout callback using Fl::add_timeout(). You can choose the rounded or square type of the clock with type(), see below.

Figure 30.5: FL_SQUARE_CLOCK type

Figure 30.6: FL_ROUND_CLOCK type

30.18.2
30.18.2.1

Constructor & Destructor Documentation


Fl Clock::Fl Clock ( int X, int Y, int W, int H, const char L = 0 )

Create an Fl_Clock widget using the given position, size, and label string. The default boxtype is FL_NO_BOX.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.19 Fl_Clock_Output Class Reference Parameters in in

395

X,Y,W,H position and size of the widget L widget label, default is no label

30.18.2.2

Fl Clock::Fl Clock ( uchar t, int X, int Y, int W, int H, const char L )

Create an Fl_Clock widget using the given boxtype, position, size, and label string. Parameters in in in

t boxtype X,Y,W,H position and size of the widget L widget label, default is no label

30.18.3
30.18.3.1

Member Function Documentation


int Fl Clock::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted See also Fl_Event Reimplemented from Fl_Widget. The documentation for this class was generated from the following les: Fl_Clock.H Fl_Clock.cxx

30.19

Fl Clock Output Class Reference

This widget can be used to display a program-supplied time.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

396 #include <Fl_Clock.H> Inheritance diagram for Fl_Clock_Output:


Fl_Widget Fl_Clock_Output Fl_Clock Fl_Round_Clock

Class Documentation

Public Member Functions


Fl_Clock_Output (int X, int Y, int W, int H, const char L=0)
Create a new Fl_Clock_Output widget with the given position, size and label.

int hour () const


Returns the displayed hour (0 to 23).

int minute () const


Returns the displayed minute (0 to 59).

int second () const


Returns the displayed second (0 to 60, 60=leap second).

void value (ulong v)


Set the displayed time.

void value (int H, int m, int s)


Set the displayed time.

ulong value () const


Returns the displayed time.

Protected Member Functions


void draw ()
Draw clock with current position and size.

void draw (int X, int Y, int W, int H)


Draw clock with the given position and size.

30.19.1

Detailed Description

This widget can be used to display a program-supplied time. The time shown on the clock is not updated. To display the current time, use Fl_Clock instead.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.19 Fl_Clock_Output Class Reference

397

Figure 30.7: FL_SQUARE_CLOCK type

Figure 30.8: FL_ROUND_CLOCK type

30.19.2
30.19.2.1

Constructor & Destructor Documentation


Fl Clock Output::Fl Clock Output ( int X, int Y, int W, int H, const char L = 0 )

Create a new Fl_Clock_Output widget with the given position, size and label. The default boxtype is FL_NO_BOX. Parameters in in

X,Y,W,H position and size of the widget L widget label, default is no label

30.19.3
30.19.3.1

Member Function Documentation


void Fl Clock Output::draw ( int X, int Y, int W, int H ) [protected]

Draw clock with the given position and size. Parameters in

X,Y,W,H position and size

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

398 30.19.3.2 int Fl Clock Output::hour ( ) const [inline]

Class Documentation

Returns the displayed hour (0 to 23). See also value(), minute(), second()

30.19.3.3

int Fl Clock Output::minute ( ) const [inline]

Returns the displayed minute (0 to 59). See also value(), hour(), second()

30.19.3.4

int Fl Clock Output::second ( ) const [inline]

Returns the displayed second (0 to 60, 60=leap second). See also value(), hour(), minute()

30.19.3.5

void Fl Clock Output::value ( ulong v )

Set the displayed time. Set the time in seconds since the UNIX epoch (January 1, 1970). Parameters in

v seconds since epoch

See also value()

30.19.3.6

void Fl Clock Output::value ( int H, int m, int s )

Set the displayed time. Set the time in hours, minutes, and seconds. Parameters in

H,m,s displayed time

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.20 Fl_Color_Chooser Class Reference See also hour(), minute(), second()

399

30.19.3.7 ulong Fl Clock Output::value ( ) const [inline] Returns the displayed time. Returns the time in seconds since the UNIX epoch (January 1, 1970). See also value(ulong) The documentation for this class was generated from the following les: Fl_Clock.H Fl_Clock.cxx

30.20

Fl Color Chooser Class Reference

The Fl_Color_Chooser widget provides a standard RGB color chooser. #include <Fl_Color_Chooser.H> Inheritance diagram for Fl_Color_Chooser:

Fl_Widget Fl_Group Fl_Color_Chooser

Public Member Functions


double b () const
Returns the current blue value.

Fl_Color_Chooser (int X, int Y, int W, int H, const char L=0)


Creates a new Fl_Color_Chooser widget using the given position, size, and label string.

double g () const
Returns the current green value.

int hsv (double H, double S, double V)


Set the hsv values.

double hue () const


Returns the current hue.

int mode ()
Returns which Fl_Color_Chooser variant is currently active.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

400 void mode (int newMode)


Set which Fl_Color_Chooser variant is currently active.

Class Documentation

double r () const
Returns the current red value.

int rgb (double R, double G, double B)


Sets the current rgb color values.

double saturation () const


Returns the saturation.

double value () const


Returns the value/brightness.

Static Public Member Functions


static void hsv2rgb (double H, double S, double V, double &R, double &G, double &B)
This static method converts HSV colors to RGB colorspace.

static void rgb2hsv (double R, double G, double B, double &H, double &S, double &V)
This static method converts RGB colors to HSV colorspace.

Related Functions
(Note that these are not member functions.) int _color_chooser (const char name, double &r, double &g, double &b, int cmode)
Pops up a window to let the user pick an arbitrary RGB color.

int _color_chooser (const char name, uchar &r, uchar &g, uchar &b, int cmode)
Pops up a window to let the user pick an arbitrary RGB color.

30.20.1

Detailed Description

The Fl_Color_Chooser widget provides a standard RGB color chooser.

Figure 30.9: _color_chooser()

You can place any number of the widgets into a panel of your own design. The diagram shows the widget as part of a color chooser dialog created by the _color_chooser() function. The Fl_Color_Chooser widget
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.20 Fl_Color_Chooser Class Reference

401

contains the hue box, value slider, and rgb input elds from the above diagram (it does not have the color chips or the Cancel or OK buttons). The callback is done every time the user changes the rgb value. It is not done if they move the hue control in a way that produces the same rgb value, such as when saturation or value is zero. The _color_chooser() function pops up a window to let the user pick an arbitrary RGB color. They can pick the hue and saturation in the "hue box" on the left (hold down CTRL to just change the saturation), and the brightness using the vertical slider. Or they can type the 8-bit numbers into the RGB Fl_Value_Input elds, or drag the mouse across them to adjust them. The pull-down menu lets the user set the input elds to show RGB, HSV, or 8-bit RGB (0 to 255). _color_chooser() returns non-zero if the user picks ok, and updates the RGB values. If the user picks cancel or closes the window this returns zero and leaves RGB unchanged. If you use the color chooser on an 8-bit screen, it will allocate all the available colors, leaving you no space to exactly represent the color the user picks! You can however use _rectf() to ll a region with a simulated color using dithering.

30.20.2
30.20.2.1

Constructor & Destructor Documentation


Fl Color Chooser::Fl Color Chooser ( int X, int Y, int W, int H, const char L = 0 )

Creates a new Fl_Color_Chooser widget using the given position, size, and label string. The recommended dimensions are 200x95. The color is initialized to black. Parameters in in

X,Y,W,H position and size of the widget L widget label, default is no label

30.20.3
30.20.3.1

Member Function Documentation


double Fl Color Chooser::b ( ) const [inline]

Returns the current blue value. 0 <= b <= 1. 30.20.3.2 double Fl Color Chooser::g ( ) const [inline]

Returns the current green value. 0 <= g <= 1. 30.20.3.3 int Fl Color Chooser::hsv ( double H, double S, double V )

Set the hsv values. The passed values are clamped (or for hue, modulus 6 is used) to get legal values. Does not do the callback. Parameters in

H,S,V color components.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

402 Returns 1 if a new hsv value was set, 0 if the hsv value was the previous one.

Class Documentation

30.20.3.4

void Fl Color Chooser::hsv2rgb ( double H, double S, double V, double & R, double & G, double & B ) [static]

This static method converts HSV colors to RGB colorspace. Parameters in out

H,S,V color components R,G,B color components

30.20.3.5

double Fl Color Chooser::hue ( ) const [inline]

Returns the current hue. 0 <= hue < 6. Zero is red, one is yellow, two is green, etc. This value is convenient for the internal calculations - some other systems consider hue to run from zero to one, or from 0 to 360. 30.20.3.6 int Fl Color Chooser::mode ( ) [inline]

Returns which Fl_Color_Chooser variant is currently active. Returns color modes are rgb(0), byte(1), hex(2), or hsv(3)

30.20.3.7

void Fl Color Chooser::mode ( int newMode )

Set which Fl_Color_Chooser variant is currently active. Parameters in

newMode color modes are rgb(0), byte(1), hex(2), or hsv(3)

30.20.3.8

double Fl Color Chooser::r ( ) const [inline]

Returns the current red value. 0 <= r <= 1. 30.20.3.9 int Fl Color Chooser::rgb ( double R, double G, double B )

Sets the current rgb color values. Does not do the callback. Does not clamp (but out of range values will produce psychedelic effects in the hue selector).
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.21 Fl_Counter Class Reference Parameters in

403

R,G,B color components.

Returns 1 if a new rgb value was set, 0 if the rgb value was the previous one.

30.20.3.10

void Fl Color Chooser::rgb2hsv ( double R, double G, double B, double & H, double & S, double & V ) [static]

This static method converts RGB colors to HSV colorspace. Parameters in out

R,G,B color components H,S,V color components

30.20.3.11

double Fl Color Chooser::saturation ( ) const [inline]

Returns the saturation. 0 <= saturation <= 1.

30.20.3.12

double Fl Color Chooser::value ( ) const [inline]

Returns the value/brightness. 0 <= value <= 1. The documentation for this class was generated from the following les:

Fl_Color_Chooser.H Fl_Color_Chooser.cxx

30.21

Fl Counter Class Reference

Controls a single oating point value with button (or keyboard) arrows. #include <Fl_Counter.H> Inheritance diagram for Fl_Counter:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

404
Fl_Widget Fl_Valuator Fl_Counter Fl_Simple_Counter

Class Documentation

Public Member Functions


Fl_Counter (int X, int Y, int W, int H, const char L=0)
Creates a new Fl_Counter widget using the given position, size, and label string.

int handle (int)


Handles the specied event.

void lstep (double a)


Sets the increment for the large step buttons.

void step (double a, double b)


Sets the increments for the normal and large step buttons.

void step (double a)


Sets the increment for the normal step buttons.

double step () const


Returns the increment for normal step buttons.

Fl_Color textcolor () const


Gets the font color.

void textcolor (Fl_Color s)


Sets the font color to s.

Fl_Font textfont () const


Gets the text font.

void textfont (Fl_Font s)


Sets the text font to s.

Fl_Fontsize textsize () const


Gets the font size.

void textsize (Fl_Fontsize s)


Sets the font size to s.

Fl_Counter ()
Destroys the valuator.

Protected Member Functions


void draw ()
Draws the widget.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.21 Fl_Counter Class Reference

405

30.21.1

Detailed Description

Controls a single oating point value with button (or keyboard) arrows. Double arrows buttons achieve larger steps than simple arrows. See also Fl_Spinner for value input with vertical step arrows.

Figure 30.10: Fl_Counter

Todo Refactor the doxygen comments for Fl_Counter type() documentation. The type of an Fl_Counter object can be set using type(uchar t) to: FL_NORMAL_COUNTER: Displays a counter with 4 arrow buttons. FL_SIMPLE_COUNTER: Displays a counter with only 2 arrow buttons.

30.21.2
30.21.2.1

Constructor & Destructor Documentation


Fl Counter::Fl Counter ( int X, int Y, int W, int H, const char L = 0 )

Creates a new Fl_Counter widget using the given position, size, and label string. The default type is FL_NORMAL_COUNTER. Parameters in in

X,Y,W,H position and size of the widget L widget label, default is no label

30.21.3
30.21.3.1

Member Function Documentation


void Fl Counter::draw ( ) [protected, virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

406
Fl_Widget *s = &scroll; s->draw();

Class Documentation
// scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Implements Fl_Widget. 30.21.3.2 int Fl Counter::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted

See also Fl_Event Reimplemented from Fl_Widget. 30.21.3.3 void Fl Counter::lstep ( double a ) [inline]

Sets the increment for the large step buttons. The default value is 1.0. Parameters in

a large step increment.

30.21.3.4

void Fl Counter::step ( double a, double b ) [inline]

Sets the increments for the normal and large step buttons. Parameters in

a,b normal and large step increments.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.22 Fl_Device Class Reference 30.21.3.5 void Fl Counter::step ( double a ) [inline]

407

Sets the increment for the normal step buttons. Parameters in

a normal step increment.

Reimplemented from Fl_Valuator. The documentation for this class was generated from the following les: Fl_Counter.H Fl_Counter.cxx

30.22

Fl Device Class Reference

All graphical output devices and all graphics systems. #include <Fl_Device.H> Inheritance diagram for Fl_Device:
Fl_Device Fl_Graphics_Driver Fl_GDI_Graphics_Driver Fl_PostScript_Graphics_Driver Fl_Quartz_Graphics_Driver Fl_Xlib_Graphics_Driver Fl_Surface_Device Fl_Display_Device Fl_PostScript_File_Device Fl_PostScript_Printer Fl_Paged_Device Fl_Printer Fl_System_Printer

Public Member Functions


virtual const char class_name ()
Returns the name of the class of this object.

virtual Fl_Device ()
Virtual destructor.

Static Public Attributes


static const char class_id = "Fl_Device"
A string that identies each subclass of Fl_Device.

30.22.1

Detailed Description

All graphical output devices and all graphics systems.

30.22.2

Constructor & Destructor Documentation

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

408 30.22.2.1 virtual Fl Device::Fl Device ( ) [inline, virtual]

Class Documentation

Virtual destructor. The destructor of Fl_Device must be virtual to make the destructors of derived classes being called correctly on destruction.

30.22.3
30.22.3.1

Member Function Documentation


virtual const char Fl Device::class name ( ) [inline, virtual]

Returns the name of the class of this object. The class of an instance of an Fl_Device subclass can be checked with code such as:
if ( instance->class_name() == Fl_Printer::class_id ) { ... }

Reimplemented in Fl_Display_Device, Fl_Surface_Device, Fl_Xlib_Graphics_Driver, Fl_GDI_Graphics_Driver, Fl_Quartz_Graphics_Driver, Fl_Graphics_Driver, Fl_PostScript_File_Device, Fl_Printer, Fl_Paged_Device, Fl_PostScript_Printer, Fl_System_Printer, and Fl_PostScript_Graphics_Driver.

30.22.4
30.22.4.1

Member Data Documentation


const char Fl_Device::class_id = Fl Device [static]

A string that identies each subclass of Fl_Device. Function class_name() applied to a device of this class returns this string. Reimplemented in Fl_Display_Device, Fl_Surface_Device, Fl_Xlib_Graphics_Driver, Fl_GDI_Graphics_Driver, Fl_Quartz_Graphics_Driver, Fl_Graphics_Driver, Fl_PostScript_File_Device, Fl_Printer, Fl_Paged_Device, Fl_PostScript_Printer, Fl_System_Printer, and Fl_PostScript_Graphics_Driver. The documentation for this class was generated from the following les: Fl_Device.H Fl_Device.cxx

30.23

Fl Device Plugin Class Reference

This plugin socket allows the integration of new device drivers for special window or screen types. #include <Fl_Device.H> Inheritance diagram for Fl_Device_Plugin:

Fl_Plugin Fl_Device_Plugin

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.24 Fl_Dial Class Reference

409

Public Member Functions


Fl_Device_Plugin (const char name)
The constructor.

virtual const char klass ()


Returns the class name.

virtual const char name ()=0


Returns the plugin name.

virtual int print (Fl_Widget w, int x, int y, int height)=0


Prints a widget.

30.23.1

Detailed Description

This plugin socket allows the integration of new device drivers for special window or screen types. It is currently used to provide an automated printing service for OpenGL windows, if linked with tk_gl.

30.23.2
30.23.2.1

Member Function Documentation


virtual int Fl Device Plugin::print ( Fl_Widget w, int x, int y, int height ) [pure virtual]

Prints a widget. Parameters w the widget x,y offsets where to print relatively to coordinates origin height height of the current drawing area

The documentation for this class was generated from the following le:

Fl_Device.H

30.24

Fl Dial Class Reference

The Fl_Dial widget provides a circular dial to control a single oating point value. #include <Fl_Dial.H> Inheritance diagram for Fl_Dial:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

410
Fl_Widget Fl_Valuator Fl_Dial Fl_Fill_Dial Fl_Line_Dial

Class Documentation

Public Member Functions


short angle1 () const
Sets Or gets the angles used for the minimum and maximum values.

void angle1 (short a)


See short angle1() const.

short angle2 () const


See short angle1() const.

void angle2 (short a)


See short angle1() const.

void angles (short a, short b)


See short angle1() const.

Fl_Dial (int x, int y, int w, int h, const char l=0)


Creates a new Fl_Dial widget using the given position, size, and label string.

int handle (int)


Allow subclasses to handle event based on current position and size.

Protected Member Functions


void draw (int X, int Y, int W, int H)
Draws dial at given position and size.

void draw ()
Draws dial at current position and size.

int handle (int event, int X, int Y, int W, int H)


Allows subclasses to handle event based on given position and size.

30.24.1

Detailed Description

The Fl_Dial widget provides a circular dial to control a single oating point value.

Figure 30.11: Fl_Dial

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.25 Fl_Display_Device Class Reference Use type() to set the type of the dial to: FL_NORMAL_DIAL - Draws a normal dial with a knob. FL_LINE_DIAL - Draws a dial with a line. FL_FILL_DIAL - Draws a dial with a lled arc.

411

30.24.2
30.24.2.1

Constructor & Destructor Documentation


Fl Dial::Fl Dial ( int X, int Y, int W, int H, const char l = 0 )

Creates a new Fl_Dial widget using the given position, size, and label string. The default type is FL_NORMAL_DIAL.

30.24.3
30.24.3.1

Member Function Documentation


short Fl Dial::angle1 ( ) const [inline]

Sets Or gets the angles used for the minimum and maximum values. The default values are 45 and 315 (0 degrees is straight down and the angles progress clockwise). Normally angle1 is less than angle2, but if you reverse them the dial moves counter-clockwise. 30.24.3.2 void Fl Dial::draw ( int X, int Y, int W, int H ) [protected]

Draws dial at given position and size. Parameters in

X,Y,W,H position and size

30.24.3.3

int Fl Dial::handle ( int event, int X, int Y, int W, int H ) [protected]

Allows subclasses to handle event based on given position and size. Parameters in

event,X,Y,W,H event to handle, related position and size.

The documentation for this class was generated from the following les: Fl_Dial.H Fl_Dial.cxx

30.25

Fl Display Device Class Reference

A display to which the computer can draw. #include <Fl_Device.H>


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

412 Inheritance diagram for Fl_Display_Device:

Class Documentation

Fl_Device Fl_Surface_Device Fl_Display_Device

Public Member Functions


const char class_name ()
Returns the name of the class of this object.

Fl_Display_Device (Fl_Graphics_Driver graphics_driver)


A constructor that sets the graphics driver used by the display.

Static Public Member Functions


static Fl_Display_Device display_device ()
Returns the platform display device.

Static Public Attributes


static const char class_id = "Fl_Display_Device"
A string that identies each subclass of Fl_Device.

30.25.1

Detailed Description

A display to which the computer can draw.

30.25.2
30.25.2.1

Member Function Documentation


const char Fl Display Device::class name ( ) [inline, virtual]

Returns the name of the class of this object. The class of an instance of an Fl_Device subclass can be checked with code such as:
if ( instance->class_name() == Fl_Printer::class_id ) { ... }

Reimplemented from Fl_Surface_Device. 30.25.2.2 static Fl_Display_Device Fl Display Device::display device ( ) [inline, static]

Returns the platform display device.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.26 Fl_Double_Window Class Reference

413

30.25.3
30.25.3.1

Member Data Documentation


const char Fl_Display_Device::class_id = Fl Display Device [static]

A string that identies each subclass of Fl_Device. Function class_name() applied to a device of this class returns this string. Reimplemented from Fl_Surface_Device. The documentation for this class was generated from the following les: Fl_Device.H Fl_Device.cxx

30.26

Fl Double Window Class Reference

The Fl_Double_Window provides a double-buffered window. #include <Fl_Double_Window.H> Inheritance diagram for Fl_Double_Window:
Fl_Widget Fl_Group Fl_Window Fl_Double_Window Fl_Cairo_Window Fl_Overlay_Window

Public Member Functions


Fl_Double_Window (int W, int H, const char l=0)
Creates a new Fl_Double_Window widget using the given position, size, and label (title) string.

Fl_Double_Window (int X, int Y, int W, int H, const char l=0)


See Fl_Double_Window::Fl_Double_Window(int w, int h, const char label = 0)

void ush ()
Forces the window to be redrawn.

void hide ()
Removes the window from the screen.

void resize (int, int, int, int)


Changes the size and position of the window.

void show ()
Puts the window on the screen.

void show (int a, char b)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

414
Puts the window on the screen and parses command-line arguments.

Class Documentation

Fl_Double_Window ()
The destructor also deletes all the children.

Protected Member Functions


void ush (int eraseoverlay)
Forces the window to be redrawn.

Protected Attributes
char force_doublebuffering_
Force double buffering, even if the OS already buffers windows (overlays need that on MacOS and Windows2000)

30.26.1

Detailed Description

The Fl_Double_Window provides a double-buffered window. If possible this will use the X double buffering extension (Xdbe). If not, it will draw the window data into an off-screen pixmap, and then copy it to the on-screen window. It is highly recommended that you put the following code before the rst show() of any window in your program:
Fl::visual(FL_DOUBLE|FL_INDEX)

This makes sure you can use Xdbe on servers where double buffering does not exist for every visual.

30.26.2
30.26.2.1

Constructor & Destructor Documentation


Fl Double Window::Fl Double Window ( )

The destructor also deletes all the children. This allows a whole tree to be deleted at once, without having to keep a pointer to all the children in the user code.

30.26.3
30.26.3.1

Member Function Documentation


void Fl Double Window::ush ( int eraseoverlay ) [protected]

Forces the window to be redrawn. Parameters in

eraseoverlay non-zero to erase overlay, zero to ignore

Fl_Overlay_Window relies on ush(1) copying the back buffer to the front everywhere, even if damage() == 0, thus erasing the overlay, and leaving the clip region set to the entire window.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.26 Fl_Double_Window Class Reference 30.26.3.2 void Fl Double Window::hide ( ) [virtual]

415

Removes the window from the screen. If the window is already hidden or has not been shown then this does nothing and is harmless. Reimplemented from Fl_Window. Reimplemented in Fl_Overlay_Window. 30.26.3.3 void Fl Double Window::resize ( int , int , int , int ) [virtual]

Changes the size and position of the window. If shown() is true, these changes are communicated to the window server (which may refuse that size and cause a further resize). If shown() is false, the size and position are used when show() is called. See Fl_Group for the effect of resizing on the child widgets. You can also call the Fl_Widget methods size(x,y) and position(w,h), which are inline wrappers for this virtual function. A top-level window can not force, but merely suggest a position and size to the operating system. The window manager may not be willing or able to display a window at the desired position or with the given dimensions. It is up to the application developer to verify window parameters after the resize request. Reimplemented from Fl_Window. Reimplemented in Fl_Overlay_Window. 30.26.3.4 void Fl Double Window::show ( ) [virtual]

Puts the window on the screen. Usually (on X) this has the side effect of opening the display. If the window is already shown then it is restored and raised to the top. This is really convenient because your program can call show() at any time, even if the window is already up. It also means that show() serves the purpose of raise() in other toolkits. Fl_Window::show(int argc, char argv) is used for top-level windows and allows standard arguments to be parsed from the command-line. See also Fl_Window::show(int argc, char argv) Reimplemented from Fl_Window. Reimplemented in Fl_Overlay_Window. 30.26.3.5 void Fl Double Window::show ( int argc, char argv ) [inline]

Puts the window on the screen and parses command-line arguments. Usually (on X) this has the side effect of opening the display. This form should be used for top-level windows, at least for the rst (main) window. It allows standard arguments to be parsed from the command-line. You can use argc and argv from main(int argc, char argv) for this call.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

416

Class Documentation

The rst call also sets up some system-specic internal variables like the system colors. Todo explain which system parameters are set up.

Parameters argc command-line argument count, usually from main() argv command-line argument vector, usually from main() See also virtual void Fl_Window::show() Reimplemented from Fl_Window. Reimplemented in Fl_Overlay_Window. The documentation for this class was generated from the following les: Fl_Double_Window.H Fl_Double_Window.cxx

30.27

Fl End Class Reference

This is a dummy class that allows you to end a Fl_Group in a constructor list of a class: #include <Fl_Group.H>

Public Member Functions


Fl_End ()
All it does is calling Fl_Group::current()->end()

30.27.1

Detailed Description

This is a dummy class that allows you to end a Fl_Group in a constructor list of a class:
class MyClass { Fl_Group group; Fl_Button button_in_group; Fl_End end; Fl_Button button_outside_group; MyClass(); }; MyClass::MyClass() : group(10,10,100,100), button_in_group(20,20,60,30), end(), button_outside_group(10,120,60,30) {}

The documentation for this class was generated from the following le: Fl_Group.H
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.28 Fl_File_Browser Class Reference

417

30.28

Fl File Browser Class Reference

The Fl_File_Browser widget displays a list of lenames, optionally with le-specic icons. #include <Fl_File_Browser.H> Inheritance diagram for Fl_File_Browser:
Fl_Widget Fl_Group Fl_Browser_ Fl_Browser Fl_File_Browser

Public Types
enum { FILES, DIRECTORIES }

Public Member Functions


int letype () const
Sets or gets the le browser type, FILES or DIRECTORIES.

void letype (int t)


Sets or gets the le browser type, FILES or DIRECTORIES.

void lter (const char pattern)


Sets or gets the lename lter.

const char lter () const


Sets or gets the lename lter.

Fl_File_Browser (int, int, int, int, const char =0)


The constructor creates the Fl_File_Browser widget at the specied position and size.

uchar iconsize () const


Sets or gets the size of the icons.

void iconsize (uchar s)


Sets or gets the size of the icons.

int load (const char directory, Fl_File_Sort_F sort=_numericsort)


Loads the specied directory into the browser.

Fl_Fontsize textsize () const


Gets the default text size (in pixels) for the lines in the browser.

void textsize (Fl_Fontsize s)


Sets the default text size (in pixels) for the lines in the browser to size.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

418

Class Documentation

30.28.1

Detailed Description

The Fl_File_Browser widget displays a list of lenames, optionally with le-specic icons.

30.28.2
30.28.2.1

Constructor & Destructor Documentation


Fl File Browser::Fl File Browser ( int X, int Y, int W, int H, const char l = 0 )

The constructor creates the Fl_File_Browser widget at the specied position and size. The destructor destroys the widget and frees all memory that has been allocated.

30.28.3
30.28.3.1

Member Function Documentation


int Fl File Browser::letype ( ) const [inline]

Sets or gets the le browser type, FILES or DIRECTORIES. When set to FILES, both les and directories are shown. Otherwise only directories are shown.

30.28.3.2

void Fl File Browser::letype ( int t ) [inline]

Sets or gets the le browser type, FILES or DIRECTORIES. When set to FILES, both les and directories are shown. Otherwise only directories are shown.

30.28.3.3

void Fl File Browser::lter ( const char pattern )

Sets or gets the lename lter. The pattern matching uses the _lename_match() function in FLTK.

30.28.3.4

const char Fl File Browser::lter ( ) const [inline]

Sets or gets the lename lter. The pattern matching uses the _lename_match() function in FLTK.

30.28.3.5 uchar Fl File Browser::iconsize ( ) const [inline] Sets or gets the size of the icons. The default size is 20 pixels.

30.28.3.6

void Fl File Browser::iconsize ( uchar s ) [inline]

Sets or gets the size of the icons. The default size is 20 pixels.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.29 Fl_File_Chooser Class Reference 30.28.3.7

419

int Fl File Browser::load ( const char directory, Fl_File_Sort_F sort = fl numericsort )

Loads the specied directory into the browser. If icons have been loaded then the correct icon is associated with each le in the list. The sort argument species a sort function to be used with _lename_list(). The documentation for this class was generated from the following les: Fl_File_Browser.H Fl_File_Browser.cxx

30.29

Fl File Chooser Class Reference

The Fl_File_Chooser widget displays a standard le selection dialog that supports various selection modes.

Public Types
enum { SINGLE = 0, MULTI = 1, CREATE = 2, DIRECTORY = 4 }

Public Member Functions


Fl_Widget add_extra (Fl_Widget gr)
Adds extra widget at the bottom of Fl_File_Chooser window.

void callback (void(cb)(Fl_File_Chooser , void ), void d=0)


Sets the le chooser callback cb and associated data d.

void color (Fl_Color c)


Sets the background color of the Fl_File_Browser list.

Fl_Color color ()
Gets the background color of the Fl_File_Browser list.

int count ()
Returns the number of selected les.

void directory (const char d)


Sets the current directory.

char directory ()
Gets the current directory.

void lter (const char p)


Sets or gets the current lename lter patterns.

const char lter ()


See void lter(const char pattern)

int lter_value ()
Gets the current lename lter selection.

void lter_value (int f)


Sets the current lename lter selection.

Fl_File_Chooser (const char d, const char p, int t, const char title)


The constructor creates the Fl_File_Chooser dialog shown.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

420 void hide ()


Hides the Fl_File_Chooser window.

Class Documentation

void iconsize (uchar s)


Sets the size of the icons in the Fl_File_Browser.

uchar iconsize ()
Gets the size of the icons in the Fl_File_Browser.

void label (const char l)


Sets the title bar text for the Fl_File_Chooser.

const char label ()


Gets the title bar text for the Fl_File_Chooser.

void ok_label (const char l)


Sets the label for the "ok" button in the Fl_File_Chooser.

const char ok_label ()


Gets the label for the "ok" button in the Fl_File_Chooser.

void preview (int e)


Enable or disable the preview tile.

int preview () const


Returns the current state of the preview box.

void rescan ()
Reloads the current directory in the Fl_File_Browser.

void rescan_keep_lename ()
Rescan the current directory without clearing the lename, then select the le if it is in the list.

void show ()
Shows the Fl_File_Chooser window.

int shown ()
Returns non-zero if the le chooser main window show() has been called (but not hide() see Fl_Window::shown()

void textcolor (Fl_Color c)


Sets the current Fl_File_Browser text color.

Fl_Color textcolor ()
Gets the current Fl_File_Browser text color.

void textfont (Fl_Font f)


Sets the current Fl_File_Browser text font.

Fl_Font textfont ()
Gets the current Fl_File_Browser text font.

void textsize (Fl_Fontsize s)


Sets the current Fl_File_Browser text size.

Fl_Fontsize textsize ()
Gets the current Fl_File_Browser text size.

void type (int t)


Sets the current type of Fl_File_Chooser.

int type ()
Gets the current type of Fl_File_Chooser.

void user_data () const


Gets the le chooser user data.

void user_data (void d)


Sets the le chooser user data d.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.29 Fl_File_Chooser Class Reference const char value (int f=1)


Gets the current value of the selected le(s).

421

void value (const char lename)


Sets the current value of the selected le.

int visible ()
Returns 1 if the Fl_File_Chooser window is visible.

Fl_File_Chooser ()
Destroys the widget and frees all memory used by it.

Public Attributes
Fl_Button newButton
The "new directory" button is exported so that application developers can control the appearance and use.

Fl_Check_Button previewButton
The "preview" button is exported so that application developers can control the appearance and use.

Fl_Check_Button showHiddenButton

Static Public Attributes


static const char add_favorites_label = "Add to Favorites"
[standard text may be customized at run-time]

static const char all_les_label = "All Files ()"


[standard text may be customized at run-time]

static const char custom_lter_label = "Custom Filter"


[standard text may be customized at run-time]

static const char existing_le_label = "Please choose an existing le!"


[standard text may be customized at run-time]

static const char favorites_label = "Favorites"


[standard text may be customized at run-time]

static const char lename_label = "Filename:"


[standard text may be customized at run-time]

static const char lesystems_label = "File Systems"


[standard text may be customized at run-time]

static const char hidden_label = "Show hidden les"


[standard text may be customized at run-time]

static const char manage_favorites_label = "Manage Favorites"


[standard text may be customized at run-time]

static const char new_directory_label = "New Directory?"


[standard text may be customized at run-time]

static const char new_directory_tooltip = "Create a new directory."


[standard text may be customized at run-time]

static const char preview_label = "Preview"


[standard text may be customized at run-time]

static const char save_label = "Save"


[standard text may be customized at run-time]

static const char show_label = "Show:"


[standard text may be customized at run-time]

static Fl_File_Sort_F sort = _numericsort


the sort function that is used when loading the contents of a directory.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

422

Class Documentation

Related Functions
(Note that these are not member functions.) char _dir_chooser (const char message, const char fname, int relative)
Shows a le chooser dialog and gets a directory.

char _le_chooser (const char message, const char pat, const char fname, int relative)
Shows a le chooser dialog and gets a lename.

void _le_chooser_callback (void(cb)(const char ))


Set the le chooser callback.

void _le_chooser_ok_label (const char l)


Set the "OK" button label.

30.29.1

Detailed Description

The Fl_File_Chooser widget displays a standard le selection dialog that supports various selection modes.

Figure 30.12: Fl_File_Chooser

The Fl_File_Chooser class also exports several static values that may be used to localize or customize the appearance of all le chooser dialogs:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.29 Fl_File_Chooser Class Reference Member add_favorites_label all_les_label custom_lter_label existing_le_label favorites_label lename_label lesystems_label hidden_label manage_favorites_label new_directory_label new_directory_tooltip preview_label save_label show_label sort Default value "Add to Favorites" "All Files ()" "Custom Filter" "Please choose an existing le!" "Favorites" "Filename:" "My Computer" (WIN32) "File Systems" (all others) "Show hidden les:" "Manage Favorites" "New Directory?" "Create a new directory." "Preview" "Save" "Show:" _numericsort

423

The Fl_File_Chooser::sort member species the sort function that is used when loading the contents of a directory and can be customized at run-time. The Fl_File_Chooser class also exports the Fl_File_Chooser::newButton and Fl_File_Chooser::previewButton widgets so that application developers can control their appearance and use. For more complex customization, consider copying the FLTK le chooser code and changing it accordingly.

30.29.2
30.29.2.1

Constructor & Destructor Documentation


Fl File Chooser::Fl File Chooser ( const char pathname, const char pattern, int type, const char title )

The constructor creates the Fl_File_Chooser dialog shown. The pathname argument can be a directory name or a complete le name (in which case the corresponding le is highlighted in the list and in the lename input eld.) The pattern argument can be a NULL string or "" to list all les, or it can be a series of descriptions and lter strings separated by tab characters (\t). The format of lters is either "Description text (patterns)" or just "patterns". A le chooser that provides lters for HTML and image les might look like:
"HTML Files (*.html)\tImage Files (*.{bmp,gif,jpg,png})"

The le chooser will automatically add the "All Files ()" pattern to the end of the string you pass if you do not provide one. The rst lter in the string is the default lter. See the FLTK documentation on _lename_match() for the kinds of pattern strings that are supported. The type argument can be one of the following: SINGLE - allows the user to select a single, existing le. MULTI - allows the user to select one or more existing les. CREATE - allows the user to select a single, existing le or specify a new lename. DIRECTORY - allows the user to select a single, existing directory. The title argument is used to set the title bar text for the Fl_File_Chooser window.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

424 30.29.2.2 Fl File Chooser::Fl File Chooser ( )

Class Documentation

Destroys the widget and frees all memory used by it.

30.29.3

Member Function Documentation

30.29.3.1 Fl_Widget Fl File Chooser::add extra ( Fl_Widget gr ) Adds extra widget at the bottom of Fl_File_Chooser window. Returns pointer for previous extra widget or NULL if not set previously. If argument is NULL only remove previous extra widget. Note Fl_File_Chooser does not delete extra widget in destructor! To prevent memory leakage, dont forget to delete unused extra widgets

30.29.3.2

void Fl File Chooser::color ( Fl_Color c )

Sets the background color of the Fl_File_Browser list. 30.29.3.3 Fl_Color Fl File Chooser::color ( ) Gets the background color of the Fl_File_Browser list. 30.29.3.4 int Fl File Chooser::count ( )

Returns the number of selected les. 30.29.3.5 void Fl File Chooser::directory ( const char pathname )

Sets the current directory. 30.29.3.6 const char Fl File Chooser::directory ( )

Gets the current directory. 30.29.3.7 void Fl File Chooser::lter ( const char pattern )

Sets or gets the current lename lter patterns. The lter patterns use _lename_match(). Multiple patterns can be used by separating them with tabs, like ".jpg\t.png\t.gif\t". In addition, you can provide human-readable labels with the patterns inside parenthesis, like "JPEG Files (.jpg)\tPNG Files (.png)\tGIF Files (.gif)\tAll Files ()" . Use lter(NULL) to show all les.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.29 Fl_File_Chooser Class Reference 30.29.3.8 int Fl File Chooser::lter value ( )

425

Gets the current lename lter selection.

30.29.3.9

void Fl File Chooser::lter value ( int f )

Sets the current lename lter selection.

30.29.3.10

void Fl File Chooser::hide ( )

Hides the Fl_File_Chooser window.

30.29.3.11

void Fl File Chooser::iconsize ( uchar s )

Sets the size of the icons in the Fl_File_Browser. By default the icon size is set to 1.5 times the textsize().

30.29.3.12 uchar Fl File Chooser::iconsize ( ) Gets the size of the icons in the Fl_File_Browser. By default the icon size is set to 1.5 times the textsize().

30.29.3.13

void Fl File Chooser::label ( const char l )

Sets the title bar text for the Fl_File_Chooser.

30.29.3.14

const char Fl File Chooser::label ( )

Gets the title bar text for the Fl_File_Chooser.

30.29.3.15

void Fl File Chooser::preview ( int e )

Enable or disable the preview tile. 1 = enable preview, 0 = disable preview.

30.29.3.16

int Fl File Chooser::preview ( ) const [inline]

Returns the current state of the preview box.

30.29.3.17

void Fl File Chooser::rescan ( )

Reloads the current directory in the Fl_File_Browser.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

426 30.29.3.18 void Fl File Chooser::show ( )

Class Documentation

Shows the Fl_File_Chooser window. 30.29.3.19 void Fl File Chooser::textcolor ( Fl_Color c )

Sets the current Fl_File_Browser text color. 30.29.3.20 Fl_Color Fl File Chooser::textcolor ( ) Gets the current Fl_File_Browser text color. 30.29.3.21 void Fl File Chooser::textfont ( Fl_Font f )

Sets the current Fl_File_Browser text font. 30.29.3.22 Fl_Font Fl File Chooser::textfont ( ) Gets the current Fl_File_Browser text font. 30.29.3.23 void Fl File Chooser::textsize ( Fl_Fontsize s )

Sets the current Fl_File_Browser text size. 30.29.3.24 Fl_Fontsize Fl File Chooser::textsize ( ) Gets the current Fl_File_Browser text size. 30.29.3.25 void Fl File Chooser::type ( int t )

Sets the current type of Fl_File_Chooser. 30.29.3.26 int Fl File Chooser::type ( )

Gets the current type of Fl_File_Chooser. 30.29.3.27 const char Fl File Chooser::value ( int f = 1 )

Gets the current value of the selected le(s). f is a 1-based index into a list of le names. The number of selected les is returned by Fl_File_Chooser::count(). This sample code loops through all selected les:
// Get list of filenames user selected from a MULTI chooser for ( int t=1; t<=chooser->count(); t++ ) { const char *filename = chooser->value(t); ... }

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.30 Fl_File_Icon Class Reference 30.29.3.28 int Fl File Chooser::visible ( )

427

Returns 1 if the Fl_File_Chooser window is visible. The documentation for this class was generated from the following les: Fl_File_Chooser.H Fl_File_Chooser.cxx Fl_File_Chooser2.cxx _le_dir.cxx

30.30

Fl File Icon Class Reference

The Fl_File_Icon class manages icon images that can be used as labels in other widgets and as icons in the FileBrowser widget. #include <Fl_File_Icon.H>

Public Types
enum { ANY, PLAIN, FIFO, DEVICE, LINK, DIRECTORY } enum { END, COLOR, LINE, CLOSEDLINE, POLYGON, OUTLINEPOLYGON, VERTEX }

Public Member Functions


short add (short d)
Adds a keyword value to the icon array, returning a pointer to it.

short add_color (Fl_Color c)


Adds a color value to the icon array, returning a pointer to it.

short add_vertex (int x, int y)


Adds a vertex value to the icon array, returning a pointer to it.

short add_vertex (oat x, oat y)


Adds a vertex value to the icon array, returning a pointer to it.

void clear ()
Clears all icon data from the icon.

void draw (int x, int y, int w, int h, Fl_Color ic, int active=1)
Draws an icon in the indicated area.

Fl_File_Icon (const char p, int t, int nd=0, short d=0)


Creates a new Fl_File_Icon with the specied information.

void label (Fl_Widget w)


Applies the icon to the widget, registering the Fl_File_Icon label type as needed.

void load (const char f)


Loads the specied icon image.

int load_fti (const char fti)


Loads an SGI icon le.

int load_image (const char i)


Load an image icon le from an image lename.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

428 Fl_File_Icon next ()


Returns next le icon object.

Class Documentation

const char pattern ()


Returns the lename matching pattern for the icon.

int size ()
Returns the number of words of data used by the icon.

int type ()
Returns the letype associated with the icon, which can be one of the following:

short value ()
Returns the data array for the icon.

Fl_File_Icon ()
The destructor destroys the icon and frees all memory that has been allocated for it.

Static Public Member Functions


static Fl_File_Icon nd (const char lename, int letype=ANY)
Finds an icon that matches the given lename and le type.

static Fl_File_Icon rst ()


Returns a pointer to the rst icon in the list.

static void labeltype (const Fl_Label o, int x, int y, int w, int h, Fl_Align a)
Draw the icon label.

static void load_system_icons (void)


Loads all system-dened icons.

30.30.1

Detailed Description

The Fl_File_Icon class manages icon images that can be used as labels in other widgets and as icons in the FileBrowser widget.

30.30.2
30.30.2.1

Constructor & Destructor Documentation


Fl File Icon::Fl File Icon ( const char p, int t, int nd = 0, short d = 0 )

Creates a new Fl_File_Icon with the specied information. Parameters in in in in

p t nd d

lename pattern le type number of data values data values

30.30.3
30.30.3.1

Member Function Documentation


short Fl File Icon::add ( short d )

Adds a keyword value to the icon array, returning a pointer to it.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.30 Fl_File_Icon Class Reference Parameters in

429

d data value

30.30.3.2

short Fl File Icon::add color ( Fl_Color c ) [inline]

Adds a color value to the icon array, returning a pointer to it. Parameters in

c color value

30.30.3.3

short Fl File Icon::add vertex ( int x, int y ) [inline]

Adds a vertex value to the icon array, returning a pointer to it. The integer version accepts coordinates from 0 to 10000. The origin (0.0) is in the lower-lefthand corner of the icon. Parameters in

x,y vertex coordinates

30.30.3.4

short Fl File Icon::add vertex ( oat x, oat y ) [inline]

Adds a vertex value to the icon array, returning a pointer to it. The oating point version goes from 0.0 to 1.0. The origin (0.0) is in the lower-lefthand corner of the icon. Parameters in

x,y vertex coordinates

30.30.3.5

void Fl File Icon::clear ( ) [inline]

Clears all icon data from the icon. 30.30.3.6 void Fl File Icon::draw ( int x, int y, int w, int h, Fl_Color ic, int active = 1 )

Draws an icon in the indicated area. Parameters in in in

x,y,w,h position and size ic icon color active status, default is active [non-zero]

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

430

Class Documentation

30.30.3.7 Fl_File_Icon Fl File Icon::nd ( const char lename, int letype = ANY ) [static] Finds an icon that matches the given lename and le type. Parameters in in

lename name of le letype enumerated le type

Returns matching le icon or NULL

30.30.3.8

static Fl_File_Icon Fl File Icon::rst ( ) [inline, static]

Returns a pointer to the rst icon in the list. 30.30.3.9 void Fl File Icon::label ( Fl_Widget w )

Applies the icon to the widget, registering the Fl_File_Icon label type as needed. Parameters in

w widget for which this icon will become the label

30.30.3.10

void Fl File Icon::labeltype ( const Fl_Label o, int x, int y, int w, int h, Fl_Align a ) [static]

Draw the icon label. Parameters in in in

o label data x,y,w,h position and size of label a label alignment [not used]

30.30.3.11

void Fl File Icon::load ( const char f )

Loads the specied icon image. The format is deduced from the lename. Parameters in

f lename

30.30.3.12

int Fl File Icon::load fti ( const char fti )

Loads an SGI icon le.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.30 Fl_File_Icon Class Reference Parameters in

431

fti icon lename

Returns 0 on success, non-zero on error

30.30.3.13

int Fl File Icon::load image ( const char ile )

Load an image icon le from an image lename. Parameters in

ile image lename

Returns 0 on success, non-zero on error

30.30.3.14

void Fl File Icon::load system icons ( void ) [static]

Loads all system-dened icons. This call is useful when using the FileChooser widget and should be used when the application starts:
Fl_File_Icon::load_system_icons();

30.30.3.15 Fl_File_Icon Fl File Icon::next ( ) [inline] Returns next le icon object. See Fl_File_Icon::rst() 30.30.3.16 const char Fl File Icon::pattern ( ) [inline]

Returns the lename matching pattern for the icon. 30.30.3.17 int Fl File Icon::size ( ) [inline]

Returns the number of words of data used by the icon. 30.30.3.18 int Fl File Icon::type ( ) [inline]

Returns the letype associated with the icon, which can be one of the following: Fl_File_Icon::ANY, any kind of le. Fl_File_Icon::PLAIN, plain les.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

432 Fl_File_Icon::FIFO, named pipes. Fl_File_Icon::DEVICE, character and block devices. Fl_File_Icon::LINK, symbolic links. Fl_File_Icon::DIRECTORY, directories.

Class Documentation

30.30.3.19

short Fl File Icon::value ( ) [inline]

Returns the data array for the icon. The documentation for this class was generated from the following les: Fl_File_Icon.H Fl_File_Icon.cxx Fl_File_Icon2.cxx

30.31

Fl File Input Class Reference

This widget displays a pathname in a text input eld. #include <Fl_File_Input.H> Inheritance diagram for Fl_File_Input:
Fl_Widget Fl_Input_ Fl_Input Fl_File_Input

Public Member Functions


Fl_Boxtype down_box () const
Gets the box type used for the navigation bar.

void down_box (Fl_Boxtype b)


Sets the box type to use for the navigation bar.

Fl_Color errorcolor () const


Gets the current error color.

void errorcolor (Fl_Color c)


Sets the current error color to c.

Fl_File_Input (int X, int Y, int W, int H, const char L=0)


Creates a new Fl_File_Input widget using the given position, size, and label string.

virtual int handle (int event)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.31 Fl_File_Input Class Reference


Handle events in the widget.

433

int value (const char str)


Sets the value of the widget given a new string value.

int value (const char str, int len)


Sets the value of the widget given a new string value and its length.

const char value ()


Returns the current value, which is a pointer to an internal buffer and is valid only until the next event is handled.

Protected Member Functions


virtual void draw ()
Draws the le input widget.

30.31.1

Detailed Description

This widget displays a pathname in a text input eld. A navigation bar located above the input eld allows the user to navigate upward in the directory tree. You may want to handle FL_WHEN_CHANGED events for tracking text changes and also FL_WHEN_RELEASE for button release when changing to parent dir. FL_WHEN_RELEASE callback wont be called if the directory clicked is the same as the current one.

Figure 30.13: Fl_File_Input

Note As all Fl_Input derived objects, Fl_File_Input may call its callback when losing focus (see FL_UNFOCUS) to update its state like its cursor shape. One resulting side effect is that you should call clear_changed() early in your callback to avoid reentrant calls if you plan to show another window or dialog box in the callback.

30.31.2
30.31.2.1

Constructor & Destructor Documentation


Fl File Input::Fl File Input ( int X, int Y, int W, int H, const char L = 0 )

Creates a new Fl_File_Input widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX. Parameters in in

X,Y,W,H position and size of the widget L widget label, default is no label

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

434

Class Documentation

30.31.3

Member Function Documentation

30.31.3.1 Fl_Boxtype Fl File Input::down box ( ) const [inline] Gets the box type used for the navigation bar. 30.31.3.2 void Fl File Input::down box ( Fl_Boxtype b ) [inline]

Sets the box type to use for the navigation bar. 30.31.3.3 Fl_Color Fl File Input::errorcolor ( ) const [inline] Gets the current error color. Todo Better docs for Fl_File_Input::errorcolor() - is it even used?

30.31.3.4

int Fl File Input::handle ( int event ) [virtual]

Handle events in the widget. Return non zero if event is handled. Parameters in

event

Reimplemented from Fl_Input. 30.31.3.5 int Fl File Input::value ( const char str )

Sets the value of the widget given a new string value. Returns non 0 on success. Parameters in

str new string value

Reimplemented from Fl_Input_. 30.31.3.6 int Fl File Input::value ( const char str, int len )

Sets the value of the widget given a new string value and its length. Returns non 0 on success. Parameters in in

str new string value len lengh of value

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.32 Fl_Fill_Dial Class Reference Reimplemented from Fl_Input_. The documentation for this class was generated from the following les: Fl_File_Input.H Fl_File_Input.cxx

435

30.32

Fl Fill Dial Class Reference

Draws a dial with a lled arc. #include <Fl_Fill_Dial.H> Inheritance diagram for Fl_Fill_Dial:
Fl_Widget Fl_Valuator Fl_Dial Fl_Fill_Dial

Public Member Functions


Fl_Fill_Dial (int x, int y, int w, int h, const char l=0)
Creates a lled dial, also setting its type to FL_FILL_DIAL.

30.32.1

Detailed Description

Draws a dial with a lled arc.

30.32.2
30.32.2.1

Constructor & Destructor Documentation


Fl Fill Dial::Fl Fill Dial ( int x, int y, int w, int h, const char l = 0 ) [inline]

Creates a lled dial, also setting its type to FL_FILL_DIAL. The documentation for this class was generated from the following le: Fl_Fill_Dial.H

30.33

Fl Fill Slider Class Reference

Widget that draws a lled horizontal slider, useful as a progress or value meter. #include <Fl_Fill_Slider.H>
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

436 Inheritance diagram for Fl_Fill_Slider:

Class Documentation

Fl_Widget Fl_Valuator Fl_Slider Fl_Fill_Slider

Public Member Functions


Fl_Fill_Slider (int x, int y, int w, int h, const char l=0)
Creates the slider from its position,size and optional title.

30.33.1

Detailed Description

Widget that draws a lled horizontal slider, useful as a progress or value meter.

30.33.2
30.33.2.1

Constructor & Destructor Documentation


Fl Fill Slider::Fl Fill Slider ( int x, int y, int w, int h, const char l = 0 ) [inline]

Creates the slider from its position,size and optional title. The documentation for this class was generated from the following le: Fl_Fill_Slider.H

30.34

Fl Float Input Class Reference

The Fl_Float_Input class is a subclass of Fl_Input that only allows the user to type oating point numbers (sign, digits, decimal point, more digits, E or e, sign, digits). #include <Fl_Float_Input.H> Inheritance diagram for Fl_Float_Input:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.35 Fl_Font_Descriptor Class Reference


Fl_Widget Fl_Input_ Fl_Input Fl_Float_Input

437

Public Member Functions


Fl_Float_Input (int X, int Y, int W, int H, const char l=0)
Creates a new Fl_Float_Input widget using the given position, size, and label string.

30.34.1

Detailed Description

The Fl_Float_Input class is a subclass of Fl_Input that only allows the user to type oating point numbers (sign, digits, decimal point, more digits, E or e, sign, digits).

30.34.2
30.34.2.1

Constructor & Destructor Documentation


Fl Float Input::Fl Float Input ( int X, int Y, int W, int H, const char l = 0 ) [inline]

Creates a new Fl_Float_Input widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX. Inherited destructor destroys the widget and any value associated with it. The documentation for this class was generated from the following le: Fl_Float_Input.H

30.35

Fl Font Descriptor Class Reference

This a structure for an actual system font, with junk to help choose it and info on character sizes. #include <Fl_Font.H>

Public Attributes
Fl_Font_Descriptor next
linked list for this Fl_Fontdesc

Fl_Fontsize size
font size
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

438

Class Documentation

30.35.1

Detailed Description

This a structure for an actual system font, with junk to help choose it and info on character sizes. Each Fl_Fontdesc has a linked list of these. These are created the rst time each system font/size combination is used. The documentation for this class was generated from the following le: Fl_Font.H

30.36

Fl Fontdesc Struct Reference

Public Attributes
Fl_Font_Descriptor rst char fontname [128] int n const char name char xlist

The documentation for this struct was generated from the following le: Fl_Font.H

30.37

Fl FormsBitmap Class Reference

Forms compatibility Bitmap Image Widget. #include <Fl_FormsBitmap.H> Inheritance diagram for Fl_FormsBitmap:

Fl_Widget Fl_FormsBitmap

Public Member Functions


void bitmap (Fl_Bitmap B)
Sets a new bitmap.

Fl_Bitmap bitmap () const


Gets a the current associated Fl_Bitmap objects.

Fl_FormsBitmap (Fl_Boxtype, int, int, int, int, const char =0)


Creates a bitmap widget from a box type, position, size and optional label specication.

void set (int W, int H, const uchar bits)


Sets a new bitmap bits with size W,H.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.38 Fl_FormsPixmap Class Reference

439

Protected Member Functions


void draw ()
Draws the bitmap and its associated box.

30.37.1

Detailed Description

Forms compatibility Bitmap Image Widget.

30.37.2
30.37.2.1

Member Function Documentation


void Fl FormsBitmap::bitmap ( Fl_Bitmap B ) [inline]

Sets a new bitmap. 30.37.2.2 Fl_Bitmap Fl FormsBitmap::bitmap ( ) const [inline] Gets a the current associated Fl_Bitmap objects. 30.37.2.3 void Fl FormsBitmap::draw ( void ) [protected, virtual]

Draws the bitmap and its associated box. Implements Fl_Widget. 30.37.2.4 void Fl FormsBitmap::set ( int W, int H, const uchar bits )

Sets a new bitmap bits with size W,H. Deletes the previous one. The documentation for this class was generated from the following les: Fl_FormsBitmap.H forms_bitmap.cxx

30.38

Fl FormsPixmap Class Reference

Forms pixmap drawing routines. #include <Fl_FormsPixmap.H> Inheritance diagram for Fl_FormsPixmap:

Fl_Widget Fl_FormsPixmap

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

440

Class Documentation

Public Member Functions


Fl_FormsPixmap (Fl_Boxtype t, int X, int Y, int W, int H, const char L=0)
Creates a new Fl_FormsPixmap widget using the given box type, position, size and label string.

void Pixmap (Fl_Pixmap B)


Set the internal pixmap pointer to an existing pixmap.

Fl_Pixmap Pixmap () const


Get the internal pixmap pointer.

void set (char const bits)


Set/create the internal pixmap using raw data.

Protected Member Functions


void draw ()
Draws the widget.

30.38.1

Detailed Description

Forms pixmap drawing routines.

30.38.2
30.38.2.1

Constructor & Destructor Documentation


Fl FormsPixmap::Fl FormsPixmap ( Fl_Boxtype t, int X, int Y, int W, int H, const char L = 0 )

Creates a new Fl_FormsPixmap widget using the given box type, position, size and label string. Parameters in in in

t box type X,Y,W,H position and size L widget label, default is no label

30.38.3
30.38.3.1

Member Function Documentation


void Fl FormsPixmap::draw ( ) [protected, virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Implements Fl_Widget.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.39 Fl_Free Class Reference 30.38.3.2 void Fl FormsPixmap::Pixmap ( Fl_Pixmap B ) [inline]

441

Set the internal pixmap pointer to an existing pixmap. Parameters in

B existing pixmap

30.38.3.3 Fl_Pixmap Fl FormsPixmap::Pixmap ( ) const [inline] Get the internal pixmap pointer. 30.38.3.4 void Fl FormsPixmap::set ( char const bits )

Set/create the internal pixmap using raw data. Parameters in

bits raw data

The documentation for this class was generated from the following les: Fl_FormsPixmap.H forms_pixmap.cxx

30.39

Fl Free Class Reference

Emulation of the Forms "free" widget. #include <Fl_Free.H> Inheritance diagram for Fl_Free:

Fl_Widget Fl_Free

Public Member Functions


Fl_Free (uchar t, int X, int Y, int W, int H, const char L, FL_HANDLEPTR hdl)
Create a new Fl_Free widget with type, position, size, label and handler.

int handle (int e)


Handles the specied event.

Fl_Free ()
The destructor will call the handle function with the event FL_FREE_MEM.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

442

Class Documentation

Protected Member Functions


void draw ()
Draws the widget.

30.39.1

Detailed Description

Emulation of the Forms "free" widget. This emulation allows the free demo to run, and appears to be useful for porting programs written in Forms which use the free widget or make subclasses of the Forms widgets. There are ve types of free, which determine when the handle function is called: FL_NORMAL_FREE normal event handling. FL_SLEEPING_FREE deactivates event handling (widget is inactive). FL_INPUT_FREE accepts FL_FOCUS events. FL_CONTINUOUS_FREE sets a timeout callback 100 times a second and provides an FL_STEP event. This has obvious detrimental effects on machine performance. FL_ALL_FREE same as FL_INPUT_FREE and FL_CONTINUOUS_FREE.

30.39.2
30.39.2.1

Constructor & Destructor Documentation


Fl Free::Fl Free ( uchar t, int X, int Y, int W, int H, const char L, FL HANDLEPTR hdl )

Create a new Fl_Free widget with type, position, size, label and handler. Parameters in in in in

t X,Y,W,H L hdl

type position and size widget label handler function

The constructor takes both the type and the handle function. The handle function should be declared as follows:
int handle_function(Fl_Widget *w, int event, float event_x, float event_y, char key)

This function is called from the handle() method in response to most events, and is called by the draw() method. The event argument contains the event type:
// old event names for compatibility: #define FL_MOUSE FL_DRAG #define FL_DRAW 0 #define FL_STEP 9 #define FL_FREEMEM 12
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.39 Fl_Free Class Reference


#define FL_FREEZE #define FL_THAW FL_UNMAP FL_MAP

443

30.39.3
30.39.3.1

Member Function Documentation


void Fl Free::draw ( ) [protected, virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Implements Fl_Widget. 30.39.3.2 int Fl Free::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted

See also Fl_Event Reimplemented from Fl_Widget. The documentation for this class was generated from the following les: Fl_Free.H forms_free.cxx
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

444

Class Documentation

30.40

Fl GDI Graphics Driver Class Reference

The MSWindows-specic graphics class. #include <Fl_Device.H> Inheritance diagram for Fl_GDI_Graphics_Driver:

Fl_Device Fl_Graphics_Driver Fl_GDI_Graphics_Driver

Public Member Functions


const char class_name ()
Returns the name of the class of this object.

void color (Fl_Color c)


see _color(Fl_Color c).

void color (uchar r, uchar g, uchar b)


see _color(uchar r, uchar g, uchar b).

int descent ()
see _descent().

void draw (const char str, int n, int x, int y)


see _draw(const char str, int n, int x, int y).

void draw (int angle, const char str, int n, int x, int y)
see _draw(int angle, const char str, int n, int x, int y).

void draw (Fl_Pixmap pxm, int XP, int YP, int WP, int HP, int cx, int cy)
Draws an Fl_Pixmap object to the device.

void draw (Fl_Bitmap pxm, int XP, int YP, int WP, int HP, int cx, int cy)
Draws an Fl_Bitmap object to the device.

void draw (Fl_RGB_Image img, int XP, int YP, int WP, int HP, int cx, int cy)
Draws an Fl_RGB_Image object to the device.

void draw_image (const uchar buf, int X, int Y, int W, int H, int D=3, int L=0)
see _draw_image(const uchar buf, int X,int Y,int W,int H, int D, int L).

void draw_image (Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D=3)
see _draw_image(Fl_Draw_Image_Cb cb, void data, int X,int Y,int W,int H, int D).

void draw_image_mono (const uchar buf, int X, int Y, int W, int H, int D=1, int L=0)
see _draw_image_mono(const uchar buf, int X,int Y,int W,int H, int D, int L).

void draw_image_mono (Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D=1)
see _draw_image_mono(Fl_Draw_Image_Cb cb, void data, int X,int Y,int W,int H, int D).

void font (Fl_Font face, Fl_Fontsize size)


see _font(Fl_Font face, Fl_Fontsize size).

int height ()
see _height().
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.40 Fl_GDI_Graphics_Driver Class Reference void rtl_draw (const char str, int n, int x, int y)
see _rtl_draw(const char str, int n, int x, int y).

445

void text_extents (const char , int n, int &dx, int &dy, int &w, int &h)
see _text_extents(const char, int n, int& dx, int& dy, int& w, int& h).

double width (const char str, int n)


see _width(const char str, int n).

double width (unsigned int c)


see _width(unsigned int n).

Static Public Attributes


static const char class_id = "Fl_GDI_Graphics_Driver"
A string that identies each subclass of Fl_Device.

30.40.1

Detailed Description

The MSWindows-specic graphics class. This class is implemented only on the MSWindows platform.

30.40.2
30.40.2.1

Member Function Documentation


const char Fl GDI Graphics Driver::class name ( ) [inline, virtual]

Returns the name of the class of this object. The class of an instance of an Fl_Device subclass can be checked with code such as:
if ( instance->class_name() == Fl_Printer::class_id ) { ... }

Reimplemented from Fl_Graphics_Driver. 30.40.2.2 void Fl GDI Graphics Driver::color ( Fl_Color c ) [virtual]

see _color(Fl_Color c). Reimplemented from Fl_Graphics_Driver. 30.40.2.3 void Fl GDI Graphics Driver::color ( uchar r, uchar g, uchar b ) [virtual]

see _color(uchar r, uchar g, uchar b). Implements Fl_Graphics_Driver. 30.40.2.4 int Fl GDI Graphics Driver::descent ( ) [virtual]

see _descent(). Implements Fl_Graphics_Driver.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

446 30.40.2.5

Class Documentation void Fl GDI Graphics Driver::draw ( const char str, int n, int x, int y ) [virtual]

see _draw(const char str, int n, int x, int y). Implements Fl_Graphics_Driver. 30.40.2.6 void Fl GDI Graphics Driver::draw ( int angle, const char str, int n, int x, int y ) [virtual]

see _draw(int angle, const char str, int n, int x, int y). Implements Fl_Graphics_Driver. 30.40.2.7 void Fl GDI Graphics Driver::draw ( Fl_Pixmap pxm, int XP, int YP, int WP, int HP, int cx, int cy ) [virtual]

Draws an Fl_Pixmap object to the device. Species a bounding box for the image, with the origin (upper left-hand corner) of the image offset by the cx and cy arguments. Implements Fl_Graphics_Driver. 30.40.2.8 void Fl GDI Graphics Driver::draw ( Fl_Bitmap bm, int XP, int YP, int WP, int HP, int cx, int cy ) [virtual]

Draws an Fl_Bitmap object to the device. Species a bounding box for the image, with the origin (upper left-hand corner) of the image offset by the cx and cy arguments. Implements Fl_Graphics_Driver. 30.40.2.9 void Fl GDI Graphics Driver::draw ( Fl_RGB_Image rgb, int XP, int YP, int WP, int HP, int cx, int cy ) [virtual]

Draws an Fl_RGB_Image object to the device. Species a bounding box for the image, with the origin (upper left-hand corner) of the image offset by the cx and cy arguments. Implements Fl_Graphics_Driver. 30.40.2.10 void Fl GDI Graphics Driver::draw image ( const uchar buf, int X, int Y, int W, int H, int D = 3, int L = 0 ) [virtual]

see _draw_image(const uchar buf, int X,int Y,int W,int H, int D, int L). Implements Fl_Graphics_Driver. 30.40.2.11 void Fl GDI Graphics Driver::draw image ( Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D = 3 ) [virtual]

see _draw_image(Fl_Draw_Image_Cb cb, void data, int X,int Y,int W,int H, int D).
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.40 Fl_GDI_Graphics_Driver Class Reference Implements Fl_Graphics_Driver. 30.40.2.12

447

void Fl GDI Graphics Driver::draw image mono ( const uchar buf, int X, int Y, int W, int H, int D = 1, int L = 0 ) [virtual]

see _draw_image_mono(const uchar buf, int X,int Y,int W,int H, int D, int L). Implements Fl_Graphics_Driver. 30.40.2.13 void Fl GDI Graphics Driver::draw image mono ( Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D = 1 ) [virtual]

see _draw_image_mono(Fl_Draw_Image_Cb cb, void data, int X,int Y,int W,int H, int D). Implements Fl_Graphics_Driver. 30.40.2.14 void Fl GDI Graphics Driver::font ( Fl_Font face, Fl_Fontsize size ) [virtual]

see _font(Fl_Font face, Fl_Fontsize size). Reimplemented from Fl_Graphics_Driver. 30.40.2.15 int Fl GDI Graphics Driver::height ( ) [virtual]

see _height(). Implements Fl_Graphics_Driver. 30.40.2.16 void Fl GDI Graphics Driver::rtl draw ( const char str, int n, int x, int y ) [virtual]

see _rtl_draw(const char str, int n, int x, int y). Implements Fl_Graphics_Driver. 30.40.2.17 void Fl GDI Graphics Driver::text extents ( const char t, int n, int & dx, int & dy, int & w, int & h ) [virtual]

see _text_extents(const char, int n, int& dx, int& dy, int& w, int& h). Reimplemented from Fl_Graphics_Driver. 30.40.2.18 double Fl GDI Graphics Driver::width ( const char str, int n ) [virtual]

see _width(const char str, int n). Implements Fl_Graphics_Driver. 30.40.2.19 double Fl GDI Graphics Driver::width ( unsigned int c ) [virtual]

see _width(unsigned int n). Reimplemented from Fl_Graphics_Driver.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

448

Class Documentation

30.40.3
30.40.3.1

Member Data Documentation


const char Fl_GDI_Graphics_Driver::class_id = Fl GDI Graphics Driver [static]

A string that identies each subclass of Fl_Device. Function class_name() applied to a device of this class returns this string. Reimplemented from Fl_Graphics_Driver. The documentation for this class was generated from the following les: Fl_Device.H _color_win32.cxx Fl_Device.cxx _draw_image_win32.cxx

30.41

Fl GIF Image Class Reference

The Fl_GIF_Image class supports loading, caching, and drawing of Compuserve GIFSM images. #include <Fl_GIF_Image.H> Inheritance diagram for Fl_GIF_Image:

Fl_Image Fl_Pixmap Fl_GIF_Image

Public Member Functions


Fl_GIF_Image (const char lename)
The constructor loads the named GIF image.

30.41.1

Detailed Description

The Fl_GIF_Image class supports loading, caching, and drawing of Compuserve GIFSM images. The class loads the rst image and supports transparency.

30.41.2
30.41.2.1

Constructor & Destructor Documentation


Fl GIF Image::Fl GIF Image ( const char infname )

The constructor loads the named GIF image. The inherited destructor free all memory and server resources that are used by the image.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.42 Fl_Gl_Choice Class Reference The documentation for this class was generated from the following les: Fl_GIF_Image.H Fl_GIF_Image.cxx

449

30.42

Fl Gl Choice Class Reference

Static Public Member Functions


static Fl_Gl_Choice nd (int mode, const int )

Public Attributes
Colormap colormap XVisualInfo vis The documentation for this class was generated from the following les: Fl_Gl_Choice.H Fl_Gl_Choice.cxx

30.43

Fl Gl Window Class Reference

The Fl_Gl_Window widget sets things up so OpenGL works. #include <Fl_Gl_Window.H> Inheritance diagram for Fl_Gl_Window:
Fl_Widget Fl_Group Fl_Window Fl_Gl_Window Fl_Glut_Window

Public Member Functions


virtual Fl_Gl_Window as_gl_window ()
Returns an Fl_Gl_Window pointer if this widget is an Fl_Gl_Window.

int can_do ()
Returns non-zero if the hardware supports the given or current OpenGL mode.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

450 int can_do_overlay ()


Returns true if the hardware overlay is possible.

Class Documentation

void context () const


void See void context(void v, int destroy_ag)

void context (void , int destroy_ag=0)


Returns or sets a pointer to the GLContext that this window is using.

char context_valid () const


Will only be set if the OpenGL context is created or recreated.

void context_valid (char v)


See char Fl_Gl_Window::context_valid() const.

Fl_Gl_Window (int W, int H, const char l=0)


Creates a new Fl_Gl_Window widget using the given size, and label string.

Fl_Gl_Window (int X, int Y, int W, int H, const char l=0)


Creates a new Fl_Gl_Window widget using the given position, size, and label string.

void ush ()
Forces the window to be drawn, this window is also made current and calls draw().

int handle (int)


Handle some FLTK events as needed.

void hide ()
Hides the window and destroys the OpenGL context.

void hide_overlay ()
Hides the window if it is not this window, does nothing in WIN32.

void invalidate ()
The invalidate() method turns off valid() and is equivalent to calling value(0).

void make_current ()
The make_current() method selects the OpenGL context for the widget.

void make_overlay_current ()
The make_overlay_current() method selects the OpenGL context for the widgets overlay.

Fl_Mode mode () const


Set or change the OpenGL capabilites of the window.

int mode (int a)


See Fl_Mode mode() const.

int mode (const int a)


See Fl_Mode mode() const.

void ortho ()
Sets the projection so 0,0 is in the lower left of the window and each pixel is 1 unit wide/tall.

void redraw_overlay ()
This method causes draw_overlay() to be called at a later time.

void resize (int, int, int, int)


Changes the size and position of the window.

void show ()
Puts the window on the screen.

void show (int a, char b)


Puts the window on the screen and parses command-line arguments.

void swap_buffers ()
The swap_buffers() method swaps the back and front buffers.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.43 Fl_Gl_Window Class Reference char valid () const

451

Is turned off when FLTK creates a new context for this window or when the window resizes, and is turned on after draw() is called.

void valid (char v)


See char Fl_Gl_Window::valid() const.

Fl_Gl_Window ()
The destructor removes the widget and destroys the OpenGL context associated with it.

Static Public Member Functions


static int can_do (int m)
Returns non-zero if the hardware supports the given or current OpenGL mode.

static int can_do (const int m)


Returns non-zero if the hardware supports the given or current OpenGL mode.

Protected Member Functions


virtual void draw ()
Draws the Fl_Gl_Window.

Friends
class _Fl_Gl_Overlay

30.43.1

Detailed Description

The Fl_Gl_Window widget sets things up so OpenGL works. It also keeps an OpenGL "context" for that window, so that changes to the lighting and projection may be reused between redraws. Fl_Gl_Window also ushes the OpenGL streams and swaps buffers after draw() returns. OpenGL hardware typically provides some overlay bit planes, which are very useful for drawing UI controls atop your 3D graphics. If the overlay hardware is not provided, FLTK tries to simulate the overlay. This works pretty well if your graphics are double buffered, but not very well for single-buffered. Please note that the FLTK drawing and clipping functions will not work inside an Fl_Gl_Window. All drawing should be done using OpenGL calls exclusively. Even though Fl_Gl_Window is derived from Fl_Group, it is not useful to add other FLTK Widgets as children, unless those widgets are modied to draw using OpenGL calls.

30.43.2
30.43.2.1

Constructor & Destructor Documentation


Fl Gl Window::Fl Gl Window ( int W, int H, const char l = 0 ) [inline]

Creates a new Fl_Gl_Window widget using the given size, and label string. The default boxtype is FL_NO_BOX. The default mode is FL_RGB|FL_DOUBLE|FL_DEPTH.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

452 30.43.2.2

Class Documentation Fl Gl Window::Fl Gl Window ( int X, int Y, int W, int H, const char l = 0 ) [inline]

Creates a new Fl_Gl_Window widget using the given position, size, and label string. The default boxtype is FL_NO_BOX. The default mode is FL_RGB|FL_DOUBLE|FL_DEPTH.

30.43.3
30.43.3.1

Member Function Documentation


virtual Fl_Gl_Window Fl Gl Window::as gl window ( ) [inline, virtual]

Returns an Fl_Gl_Window pointer if this widget is an Fl_Gl_Window. Use this method if you have a widget (pointer) and need to know whether this widget is derived from Fl_Gl_Window. If it returns non-NULL, then the widget in question is derived from Fl_Gl_Window. Return values NULL if this widget is not derived from Fl_Gl_Window.

Note This method is provided to avoid dynamic_cast.

See also Fl_Widget::as_group(), Fl_Widget::as_window() Reimplemented from Fl_Widget.

30.43.3.2

static int Fl Gl Window::can do ( int m ) [inline, static]

Returns non-zero if the hardware supports the given or current OpenGL mode.

30.43.3.3

static int Fl Gl Window::can do ( const int m ) [inline, static]

Returns non-zero if the hardware supports the given or current OpenGL mode.

30.43.3.4

int Fl Gl Window::can do ( ) [inline]

Returns non-zero if the hardware supports the given or current OpenGL mode.

30.43.3.5

int Fl Gl Window::can do overlay ( )

Returns true if the hardware overlay is possible. If this is false, FLTK will try to simulate the overlay, with signicant loss of update speed. Calling this will cause FLTK to open the display.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.43 Fl_Gl_Window Class Reference 30.43.3.6 void Fl Gl Window::context ( void v, int destroy ag = 0 )

453

Returns or sets a pointer to the GLContext that this window is using. This is a system-dependent structure, but it is portable to copy the context from one window to another. You can also set it to NULL, which will force FLTK to recreate the context the next time make_current() is called, this is useful for getting around bugs in OpenGL implementations. If destroy_ag is true the context will be destroyed by tk when the window is destroyed, or when the mode() is changed, or the next time context(x) is called. 30.43.3.7 char Fl Gl Window::context valid ( ) const [inline]

Will only be set if the OpenGL context is created or recreated. It differs from Fl_Gl_Window::valid() which is also set whenever the context changes size. 30.43.3.8 void Fl Gl Window::draw ( void ) [protected, virtual]

Draws the Fl_Gl_Window. You must subclass Fl_Gl_Window and provide an implementation for draw(). You must override the draw() method. You may also provide an implementation of draw_overlay() if you want to draw into the overlay planes. You can avoid reinitializing the viewport and lights and other things by checking valid() at the start of draw() and only doing the initialization if it is false. The draw() method can only use OpenGL calls. Do not attempt to call X, any of the functions in <FL/_draw.H>, or glX directly. Do not call gl_start() or gl_nish(). If double-buffering is enabled in the window, the back and front buffers are swapped after this function is completed. Reimplemented from Fl_Window. Reimplemented in Fl_Glut_Window. 30.43.3.9 void Fl Gl Window::ush ( ) [virtual]

Forces the window to be drawn, this window is also made current and calls draw(). Reimplemented from Fl_Window. 30.43.3.10 void Fl Gl Window::hide overlay ( )

Hides the window if it is not this window, does nothing in WIN32. 30.43.3.11 void Fl Gl Window::make current ( )

The make_current() method selects the OpenGL context for the widget. It is called automatically prior to the draw() method being called and can also be used to implement feedback and/or selection within the handle() method. Reimplemented from Fl_Window.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

454 Reimplemented in Fl_Glut_Window.

Class Documentation

30.43.3.12

void Fl Gl Window::make overlay current ( )

The make_overlay_current() method selects the OpenGL context for the widgets overlay. It is called automatically prior to the draw_overlay() method being called and can also be used to implement feedback and/or selection within the handle() method.

30.43.3.13 Fl_Mode Fl Gl Window::mode ( ) const [inline] Set or change the OpenGL capabilites of the window. The value can be any of the following ORd together: FL_RGB - RGB color (not indexed) FL_RGB8 - RGB color with at least 8 bits of each color FL_INDEX - Indexed mode FL_SINGLE - not double buffered FL_DOUBLE - double buffered FL_ACCUM - accumulation buffer FL_ALPHA - alpha channel in color FL_DEPTH - depth buffer FL_STENCIL - stencil buffer FL_MULTISAMPLE - multisample antialiasing FL_RGB and FL_SINGLE have a value of zero, so they are "on" unless you give FL_INDEX or FL_DOUBLE. If the desired combination cannot be done, FLTK will try turning off FL_MULTISAMPLE. If this also fails the show() will call Fl::error() and not show the window. You can change the mode while the window is displayed. This is most useful for turning double-buffering on and off. Under X this will cause the old X window to be destroyed and a new one to be created. If this is a top-level window this will unfortunately also cause the window to blink, raise to the top, and be de-iconized, and the xid() will change, possibly breaking other code. It is best to make the GL window a child of another window if you wish to do this! mode() must not be called within draw() since it changes the current context.

30.43.3.14

void Fl Gl Window::ortho ( )

Sets the projection so 0,0 is in the lower left of the window and each pixel is 1 unit wide/tall. If you are drawing 2D images, your draw() method may want to call this if valid() is false.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.43 Fl_Gl_Window Class Reference 30.43.3.15 void Fl Gl Window::redraw overlay ( )

455

This method causes draw_overlay() to be called at a later time. Initially the overlay is clear. If you want the window to display something in the overlay when it rst appears, you must call this immediately after you show() your window. 30.43.3.16 void Fl Gl Window::resize ( int , int , int , int ) [virtual]

Changes the size and position of the window. If shown() is true, these changes are communicated to the window server (which may refuse that size and cause a further resize). If shown() is false, the size and position are used when show() is called. See Fl_Group for the effect of resizing on the child widgets. You can also call the Fl_Widget methods size(x,y) and position(w,h), which are inline wrappers for this virtual function. A top-level window can not force, but merely suggest a position and size to the operating system. The window manager may not be willing or able to display a window at the desired position or with the given dimensions. It is up to the application developer to verify window parameters after the resize request. Reimplemented from Fl_Window. 30.43.3.17 void Fl Gl Window::show ( ) [virtual]

Puts the window on the screen. Usually (on X) this has the side effect of opening the display. If the window is already shown then it is restored and raised to the top. This is really convenient because your program can call show() at any time, even if the window is already up. It also means that show() serves the purpose of raise() in other toolkits. Fl_Window::show(int argc, char argv) is used for top-level windows and allows standard arguments to be parsed from the command-line. See also Fl_Window::show(int argc, char argv) Reimplemented from Fl_Window. 30.43.3.18 void Fl Gl Window::show ( int argc, char argv ) [inline]

Puts the window on the screen and parses command-line arguments. Usually (on X) this has the side effect of opening the display. This form should be used for top-level windows, at least for the rst (main) window. It allows standard arguments to be parsed from the command-line. You can use argc and argv from main(int argc, char argv) for this call. The rst call also sets up some system-specic internal variables like the system colors. Todo explain which system parameters are set up.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

456 Parameters argc command-line argument count, usually from main() argv command-line argument vector, usually from main() See also virtual void Fl_Window::show() Reimplemented from Fl_Window. 30.43.3.19 void Fl Gl Window::swap buffers ( )

Class Documentation

The swap_buffers() method swaps the back and front buffers. It is called automatically after the draw() method is called. 30.43.3.20 char Fl Gl Window::valid ( ) const [inline]

Is turned off when FLTK creates a new context for this window or when the window resizes, and is turned on after draw() is called. You can use this inside your draw() method to avoid unnecessarily initializing the OpenGL context. Just do this:
void mywindow::draw() { if (!valid()) { glViewport(0,0,w(),h()); glFrustum(...); ...other initialization... } if (!context_valid()) { ...load textures, etc. ... } ... draw your geometry here ... }

You can turn valid() on by calling valid(1). You should only do this after xing the transformation inside a draw() or after make_current(). This is done automatically after draw() returns. The documentation for this class was generated from the following les: Fl_Gl_Window.H Fl_Gl_Overlay.cxx Fl_Gl_Window.cxx

30.44

Fl Glut Bitmap Font Struct Reference

tk glut font/size attributes used in the glutXXX functions #include <glut.H>

Public Attributes
Fl_Font font Fl_Fontsize size
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.45 Fl_Glut_StrokeChar Struct Reference

457

30.44.1

Detailed Description

tk glut font/size attributes used in the glutXXX functions The documentation for this struct was generated from the following le: glut.H

30.45

Fl Glut StrokeChar Struct Reference

Public Attributes
int Number GLoat Right const Fl_Glut_StrokeStrip Strips The documentation for this struct was generated from the following le: glut.H

30.46

Fl Glut StrokeFont Struct Reference

Public Attributes
const Fl_Glut_StrokeChar Characters GLoat Height char Name int Quantity

The documentation for this struct was generated from the following le: glut.H

30.47

Fl Glut StrokeStrip Struct Reference

Public Attributes
int Number const Fl_Glut_StrokeVertex Vertices The documentation for this struct was generated from the following le: glut.H
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

458

Class Documentation

30.48

Fl Glut StrokeVertex Struct Reference

Public Attributes
GLoat X GLoat Y The documentation for this struct was generated from the following le: glut.H

30.49

Fl Glut Window Class Reference

GLUT is emulated using this window class and these static variables (plus several more static variables hidden in glut_compatability.cxx): #include <glut.H> Inheritance diagram for Fl_Glut_Window:
Fl_Widget Fl_Group Fl_Window Fl_Gl_Window Fl_Glut_Window

Public Member Functions


Fl_Glut_Window (int w, int h, const char )
Creates a glut window, registers to the glut windows list.

Fl_Glut_Window (int x, int y, int w, int h, const char )


Creates a glut window, registers to the glut windows list.

void make_current ()
The make_current() method selects the OpenGL context for the widget.

Fl_Glut_Window ()
Destroys the glut window, rst unregister it from the glut windows list.

Public Attributes
void( display )() void( entry )(int)
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.49 Fl_Glut_Window Class Reference void( keyboard )(uchar, int x, int y) int menu [3] void( motion )(int x, int y) void( mouse )(int b, int state, int x, int y) int number void( overlaydisplay )() void( passivemotion )(int x, int y) void( reshape )(int w, int h) void( special )(int, int x, int y) void( visibility )(int)

459

Protected Member Functions


void draw ()
Draws the Fl_Gl_Window.

void draw_overlay ()
You must implement this virtual function if you want to draw into the overlay.

int handle (int)


Handle some FLTK events as needed.

30.49.1

Detailed Description

GLUT is emulated using this window class and these static variables (plus several more static variables hidden in glut_compatability.cxx):

30.49.2
30.49.2.1

Constructor & Destructor Documentation


Fl Glut Window::Fl Glut Window ( int W, int H, const char t )

Creates a glut window, registers to the glut windows list. 30.49.2.2 Fl Glut Window::Fl Glut Window ( int X, int Y, int W, int H, const char t )

Creates a glut window, registers to the glut windows list.

30.49.3
30.49.3.1

Member Function Documentation


void Fl Glut Window::draw ( void ) [protected, virtual]

Draws the Fl_Gl_Window. You must subclass Fl_Gl_Window and provide an implementation for draw(). You must override the draw() method. You may also provide an implementation of draw_overlay() if you want to draw into the overlay planes. You can avoid reinitializing the viewport and lights and other things by checking valid() at the start of draw() and only doing the initialization if it is false.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

460

Class Documentation

The draw() method can only use OpenGL calls. Do not attempt to call X, any of the functions in <FL/_draw.H>, or glX directly. Do not call gl_start() or gl_nish(). If double-buffering is enabled in the window, the back and front buffers are swapped after this function is completed. Reimplemented from Fl_Gl_Window.

30.49.3.2

void Fl Glut Window::draw overlay ( ) [protected, virtual]

You must implement this virtual function if you want to draw into the overlay. The overlay is cleared before this is called. You should draw anything that is not clear using OpenGL. You must use gl_color(i) to choose colors (it allocates them from the colormap using system-specic calls), and remember that you are in an indexed OpenGL mode and drawing anything other than at-shaded will probably not work. Both this function and Fl_Gl_Window::draw() should check Fl_Gl_Window::valid() and set the same transformation. If you dont your code may not work on other systems. Depending on the OS, and on whether overlays are real or simulated, the OpenGL context may be the same or different between the overlay and main window. Reimplemented from Fl_Gl_Window.

30.49.3.3

void Fl Glut Window::make current ( )

The make_current() method selects the OpenGL context for the widget. It is called automatically prior to the draw() method being called and can also be used to implement feedback and/or selection within the handle() method. Reimplemented from Fl_Gl_Window. The documentation for this class was generated from the following les: glut.H glut_compatability.cxx

30.50

Fl Graphics Driver Class Reference

A virtual class subclassed for each graphics driver FLTK uses. #include <Fl_Device.H> Inheritance diagram for Fl_Graphics_Driver:
Fl_Device Fl_Graphics_Driver Fl_GDI_Graphics_Driver Fl_PostScript_Graphics_Driver Fl_Quartz_Graphics_Driver Fl_Xlib_Graphics_Driver

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.50 Fl_Graphics_Driver Class Reference

461

Classes
struct matrix
A 2D coordinate transformation matrix.

Public Member Functions


virtual const char class_name ()
Returns the name of the class of this object.

Fl_Color color ()
see _color(void).

virtual int descent ()=0


see _descent().

virtual void font (Fl_Font face, Fl_Fontsize size)


see _font(Fl_Font face, Fl_Fontsize size).

Fl_Font font ()
see _font(void).

Fl_Font_Descriptor font_descriptor ()
Returns a pointer to the current Fl_Font_Descriptor for the graphics driver.

void font_descriptor (Fl_Font_Descriptor d)


Sets the current Fl_Font_Descriptor for the graphics driver.

virtual int height ()=0


see _height().

Fl_Fontsize size ()
see _size().

virtual void text_extents (const char , int n, int &dx, int &dy, int &w, int &h)
see _text_extents(const char, int n, int& dx, int& dy, int& w, int& h).

virtual double width (const char str, int n)=0


see _width(const char str, int n).

virtual double width (unsigned int c)


see _width(unsigned int n).

virtual Fl_Graphics_Driver ()
The destructor.

Static Public Attributes


static const char class_id = "Fl_Graphics_Driver"
A string that identies each subclass of Fl_Device.

Protected Member Functions


virtual void arc (double x, double y, double r, double start, double end)
see _arc(double x, double y, double r, double start, double end).

virtual void arc (int x, int y, int w, int h, double a1, double a2)
see _arc(int x, int y, int w, int h, double a1, double a2).

virtual void begin_complex_polygon ()


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

462
see _begin_complex_polygon().

Class Documentation

virtual void begin_line ()


see _begin_line().

virtual void begin_loop ()


see _begin_loop().

virtual void begin_points ()


see _begin_points().

virtual void begin_polygon ()


see _begin_polygon().

virtual void circle (double x, double y, double r)


see _circle(double x, double y, double r).

virtual int clip_box (int x, int y, int w, int h, int &X, int &Y, int &W, int &H)
see _clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H).

Fl_Region clip_region ()
see _clip_region().

void clip_region (Fl_Region r)


see _clip_region(Fl_Region r).

virtual void color (Fl_Color c)


see _color(Fl_Color c).

virtual void color (uchar r, uchar g, uchar b)=0


see _color(uchar r, uchar g, uchar b).

virtual void curve (double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3)
see _curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3).

virtual void draw (const char str, int n, int x, int y)=0
see _draw(const char str, int n, int x, int y).

virtual void draw (int angle, const char str, int n, int x, int y)=0
see _draw(int angle, const char str, int n, int x, int y).

virtual void draw (Fl_RGB_Image rgb, int XP, int YP, int WP, int HP, int cx, int cy)=0
Draws an Fl_RGB_Image object to the device.

virtual void draw (Fl_Pixmap pxm, int XP, int YP, int WP, int HP, int cx, int cy)=0
Draws an Fl_Pixmap object to the device.

virtual void draw (Fl_Bitmap bm, int XP, int YP, int WP, int HP, int cx, int cy)=0
Draws an Fl_Bitmap object to the device.

virtual void draw_image (const uchar buf, int X, int Y, int W, int H, int D=3, int L=0)=0
see _draw_image(const uchar buf, int X,int Y,int W,int H, int D, int L).

virtual void draw_image (Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D=3)=0
see _draw_image(Fl_Draw_Image_Cb cb, void data, int X,int Y,int W,int H, int D).

virtual void draw_image_mono (const uchar buf, int X, int Y, int W, int H, int D=1, int L=0)=0
see _draw_image_mono(const uchar buf, int X,int Y,int W,int H, int D, int L).

virtual void draw_image_mono (Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D=1)=0
see _draw_image_mono(Fl_Draw_Image_Cb cb, void data, int X,int Y,int W,int H, int D).

virtual void end_complex_polygon ()


see _end_complex_polygon().

virtual void end_line ()


see _end_line().
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.50 Fl_Graphics_Driver Class Reference virtual void end_loop ()


see _end_loop().

463

virtual void end_points ()


see _end_points().

virtual void end_polygon ()


see _end_polygon().

Fl_Graphics_Driver ()
The constructor.

virtual void gap ()


see _gap().

virtual void line (int x, int y, int x1, int y1)


see _line(int x, int y, int x1, int y1).

virtual void line (int x, int y, int x1, int y1, int x2, int y2)
see _line(int x, int y, int x1, int y1, int x2, int y2).

virtual void line_style (int style, int width=0, char dashes=0)


see _line_style(int style, int width, char dashes).

virtual void loop (int x0, int y0, int x1, int y1, int x2, int y2)
see _loop(int x0, int y0, int x1, int y1, int x2, int y2).

virtual void loop (int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3)
see _loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3).

void mult_matrix (double a, double b, double c, double d, double x, double y)


see _mult_matrix(double a, double b, double c, double d, double x, double y).

virtual int not_clipped (int x, int y, int w, int h)


see _not_clipped(int x, int y, int w, int h).

virtual void pie (int x, int y, int w, int h, double a1, double a2)
see _pie(int x, int y, int w, int h, double a1, double a2).

virtual void point (int x, int y)


see _point(int x, int y).

virtual void polygon (int x0, int y0, int x1, int y1, int x2, int y2)
see _polygon(int x0, int y0, int x1, int y1, int x2, int y2).

virtual void polygon (int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3)
see _polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3).

virtual void pop_clip ()


see _pop_clip().

void pop_matrix ()
see _pop_matrix().

virtual void push_clip (int x, int y, int w, int h)


see _push_clip(int x, int y, int w, int h).

void push_matrix ()
see _push_matrix().

virtual void push_no_clip ()


see _push_no_clip().

virtual void rect (int x, int y, int w, int h)


see _rect(int x, int y, int w, int h).

virtual void rectf (int x, int y, int w, int h)


see _rectf(int x, int y, int w, int h).
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

464 void restore_clip ()


see _restore_clip().

Class Documentation

void rotate (double d)


see _rotate(double d).

virtual void rtl_draw (const char str, int n, int x, int y)=0
see _rtl_draw(const char str, int n, int x, int y).

void scale (double x, double y)


see _scale(double x, double y).

void scale (double x)


see _scale(double x).

double transform_dx (double x, double y)


see _transform_dx(double x, double y).

double transform_dy (double x, double y)


see _transform_dy(double x, double y).

double transform_x (double x, double y)


see _transform_x(double x, double y).

double transform_y (double x, double y)


see _transform_y(double x, double y).

virtual void transformed_vertex (double xf, double yf)


see _transformed_vertex(double xf, double yf).

void translate (double x, double y)


see _translate(double x, double y).

virtual void vertex (double x, double y)


see _vertex(double x, double y).

virtual void xyline (int x, int y, int x1)


see _xyline(int x, int y, int x1).

virtual void xyline (int x, int y, int x1, int y2)


see _xyline(int x, int y, int x1, int y2).

virtual void xyline (int x, int y, int x1, int y2, int x3)
see _xyline(int x, int y, int x1, int y2, int x3).

virtual void yxline (int x, int y, int y1)


see _yxline(int x, int y, int y1).

virtual void yxline (int x, int y, int y1, int x2)


see _yxline(int x, int y, int y1, int x2).

virtual void yxline (int x, int y, int y1, int x2, int y3)
see _yxline(int x, int y, int y1, int x2, int y3).

Protected Attributes
matrix _matrix
Points to the current coordinate transformation matrix.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.50 Fl_Graphics_Driver Class Reference

465

Friends
void _arc (double x, double y, double r, double start, double end)
Adds a series of points to the current path on the arc of a circle.

void _arc (int x, int y, int w, int h, double a1, double a2)
Draw ellipse sections using integer coordinates.

void _begin_complex_polygon ()
Starts drawing a complex lled polygon.

void _begin_line ()
Starts drawing a list of lines.

void _begin_loop ()
Starts drawing a closed sequence of lines.

void _begin_points ()
Starts drawing a list of points.

void _begin_polygon ()
Starts drawing a convex lled polygon.

class Fl_Bitmap void _circle (double x, double y, double r)


_circle() is equivalent to _arc(x,y,r,0,360), but may be faster.

int _clip_box (int x, int y, int w, int h, int &X, int &Y, int &W, int &H)
Intersects the rectangle with the current clip region and returns the bounding box of the result.

Fl_Region _clip_region ()
Returns the current clipping region.

void _clip_region (Fl_Region r)


Replaces the top of the clipping stack with a clipping region of any shape.

void _color (Fl_Color c)


Sets the color for all subsequent drawing operations.

void _color (uchar r, uchar g, uchar b)


Sets the color for all subsequent drawing operations.

void _curve (double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3)
Adds a series of points on a Bezier curve to the path.

void _draw (const char str, int n, int x, int y)


Draws an array of n characters starting at the given location.

void _draw (int angle, const char str, int n, int x, int y)
Draws an array of n characters starting at the given location, rotating angle degrees counter-clockwise.

void _draw_image (const uchar buf, int X, int Y, int W, int H, int D, int L)
Draws an 8-bit per color RGB or luminance image.

void _draw_image (Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D)
Draws an image using a callback function to generate image data.

void _draw_image_mono (const uchar buf, int X, int Y, int W, int H, int D, int L)
Draws a gray-scale (1 channel) image.

FL_EXPORT void _draw_image_mono (Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D)
Draws a gray-scale image using a callback function to generate image data.

void _end_complex_polygon ()
Ends complex lled polygon, and draws.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

466 void _end_line ()


Ends list of lines, and draws.

Class Documentation

void _end_loop ()
Ends closed sequence of lines, and draws.

void _end_points ()
Ends list of points, and draws.

void _end_polygon ()
Ends convex lled polygon, and draws.

void _font (Fl_Font face, Fl_Fontsize size)


Sets the current font, which is then used in various drawing routines.

void _gap ()
Call _gap() to separate loops of the path.

void _line (int x, int y, int x1, int y1)


Draws a line from (x,y) to (x1,y1)

void _line (int x, int y, int x1, int y1, int x2, int y2)
Draws a line from (x,y) to (x1,y1) and another from (x1,y1) to (x2,y2)

void _line_style (int style, int width, char dashes)


Sets how to draw lines (the "pen").

void _loop (int x0, int y0, int x1, int y1, int x2, int y2)
Outlines a 3-sided polygon with lines.

void _loop (int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3)
Outlines a 4-sided polygon with lines.

void _mult_matrix (double a, double b, double c, double d, double x, double y)


Concatenates another transformation onto the current one.

int _not_clipped (int x, int y, int w, int h)


Does the rectangle intersect the current clip region?

void _pie (int x, int y, int w, int h, double a1, double a2)
Draw lled ellipse sections using integer coordinates.

class Fl_Pixmap void _point (int x, int y)


Draws a single pixel at the given coordinates.

void _polygon (int x0, int y0, int x1, int y1, int x2, int y2)
Fills a 3-sided polygon.

void _polygon (int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3)
Fills a 4-sided polygon.

void _pop_clip ()
Restores the previous clip region.

void _pop_matrix ()
Restores the current transformation matrix from the stack.

void _push_clip (int x, int y, int w, int h)


Intersects the current clip region with a rectangle and pushes this new region onto the stack.

void _push_matrix ()
Saves the current transformation matrix on the stack.

void _push_no_clip ()
Pushes an empty clip region onto the stack so nothing will be clipped.

void _rect (int x, int y, int w, int h)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.50 Fl_Graphics_Driver Class Reference


Draws a 1-pixel border inside the given bounding box.

467

void _rectf (int x, int y, int w, int h)


Colors with current color a rectangle that exactly lls the given bounding box.

void _restore_clip ()
Undoes any clobbering of clip done by your program.

class Fl_RGB_Image void _rotate (double d)


Concatenates rotation transformation onto the current one.

void _rtl_draw (const char str, int n, int x, int y)


Draws an array of n characters right to left starting at given location.

void _scale (double x, double y)


Concatenates scaling transformation onto the current one.

void _scale (double x)


Concatenates scaling transformation onto the current one.

double _transform_dx (double x, double y)


Transforms distance using current transformation matrix.

double _transform_dy (double x, double y)


Transforms distance using current transformation matrix.

double _transform_x (double x, double y)


Transforms coordinate using the current transformation matrix.

double _transform_y (double x, double y)


Transforms coordinate using the current transformation matrix.

void _transformed_vertex (double xf, double yf)


Adds coordinate pair to the vertex list without further transformations.

void _translate (double x, double y)


Concatenates translation transformation onto the current one.

void _vertex (double x, double y)


Adds a single vertex to the current path.

void _xyline (int x, int y, int x1)


Draws a horizontal line from (x,y) to (x1,y)

void _xyline (int x, int y, int x1, int y2)


Draws a horizontal line from (x,y) to (x1,y), then vertical from (x1,y) to (x1,y2)

void _xyline (int x, int y, int x1, int y2, int x3)
Draws a horizontal line from (x,y) to (x1,y), then a vertical from (x1,y) to (x1,y2) and then another horizontal from (x1,y2) to (x3,y2)

void _yxline (int x, int y, int y1)


Draws a vertical line from (x,y) to (x,y1)

void _yxline (int x, int y, int y1, int x2)


Draws a vertical line from (x,y) to (x,y1), then a horizontal from (x,y1) to (x2,y1)

void _yxline (int x, int y, int y1, int x2, int y3)
Draws a vertical line from (x,y) to (x,y1) then a horizontal from (x,y1) to (x2,y1), then another vertical from (x2,y1) to (x2,y3)

FL_EXPORT void gl_start ()


Creates an OpenGL context.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

468

Class Documentation

30.50.1

Detailed Description

A virtual class subclassed for each graphics driver FLTK uses. The virtual methods of this class are those that a graphics driver should implement to support all of FLTK drawing functions. The public API for drawing operations is functionally presented in Drawing Things in FLTK and as function lists in the Drawing functions and Color & Font functions modules.

30.50.2
30.50.2.1

Constructor & Destructor Documentation


Fl Graphics Driver::Fl Graphics Driver ( ) [protected]

The constructor.

30.50.3
30.50.3.1

Member Function Documentation


void Fl Graphics Driver::arc ( double x, double y, double r, double start, double end ) [protected, virtual]

see _arc(double x, double y, double r, double start, double end). Reimplemented in Fl_PostScript_Graphics_Driver.

30.50.3.2

void Fl Graphics Driver::arc ( int x, int y, int w, int h, double a1, double a2 ) [protected, virtual]

see _arc(int x, int y, int w, int h, double a1, double a2). Reimplemented in Fl_PostScript_Graphics_Driver.

30.50.3.3

void Fl Graphics Driver::begin complex polygon ( ) [protected, virtual]

see _begin_complex_polygon(). Reimplemented in Fl_PostScript_Graphics_Driver.

30.50.3.4

void Fl Graphics Driver::begin line ( ) [protected, virtual]

see _begin_line(). Reimplemented in Fl_PostScript_Graphics_Driver.

30.50.3.5

void Fl Graphics Driver::begin loop ( ) [protected, virtual]

see _begin_loop(). Reimplemented in Fl_PostScript_Graphics_Driver.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.50 Fl_Graphics_Driver Class Reference 30.50.3.6 void Fl Graphics Driver::begin points ( ) [protected, virtual]

469

see _begin_points(). Reimplemented in Fl_PostScript_Graphics_Driver. 30.50.3.7 void Fl Graphics Driver::begin polygon ( ) [protected, virtual]

see _begin_polygon(). Reimplemented in Fl_PostScript_Graphics_Driver. 30.50.3.8 void Fl Graphics Driver::circle ( double x, double y, double r ) [protected, virtual]

see _circle(double x, double y, double r). Reimplemented in Fl_PostScript_Graphics_Driver. 30.50.3.9 virtual const char Fl Graphics Driver::class name ( ) [inline, virtual]

Returns the name of the class of this object. The class of an instance of an Fl_Device subclass can be checked with code such as:
if ( instance->class_name() == Fl_Printer::class_id ) { ... }

Reimplemented from Fl_Device. Reimplemented in Fl_Xlib_Graphics_Driver, Fl_GDI_Graphics_Driver, Fl_Quartz_Graphics_Driver, and Fl_PostScript_Graphics_Driver. 30.50.3.10 int Fl Graphics Driver::clip box ( int x, int y, int w, int h, int & X, int & Y, int & W, int & H ) [protected, virtual]

see _clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H). Reimplemented in Fl_PostScript_Graphics_Driver. 30.50.3.11 Fl Region Fl Graphics Driver::clip region ( ) [protected]

see _clip_region(). 30.50.3.12 void Fl Graphics Driver::clip region ( Fl Region r ) [protected]

see _clip_region(Fl_Region r). 30.50.3.13 virtual void Fl Graphics Driver::color ( Fl_Color c ) [inline, protected, virtual]

see _color(Fl_Color c). Reimplemented in Fl_Xlib_Graphics_Driver, Fl_GDI_Graphics_Driver, Fl_Quartz_Graphics_Driver, and Fl_PostScript_Graphics_Driver.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

470 30.50.3.14

Class Documentation virtual void Fl Graphics Driver::color ( uchar r, uchar g, uchar b ) [protected, pure virtual]

see _color(uchar r, uchar g, uchar b). Implemented in Fl_Xlib_Graphics_Driver, Fl_GDI_Graphics_Driver, Fl_Quartz_Graphics_Driver, and Fl_PostScript_Graphics_Driver. 30.50.3.15 Fl_Color Fl Graphics Driver::color ( ) [inline] see _color(void). 30.50.3.16 void Fl Graphics Driver::curve ( double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3 ) [protected, virtual]

see _curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3). Reimplemented in Fl_PostScript_Graphics_Driver. 30.50.3.17 virtual int Fl Graphics Driver::descent ( ) [pure virtual]

see _descent(). Implemented in Fl_Xlib_Graphics_Driver, Fl_GDI_Graphics_Driver, Fl_Quartz_Graphics_Driver, and Fl_PostScript_Graphics_Driver. 30.50.3.18 virtual void Fl Graphics Driver::draw ( const char str, int n, int x, int y ) [protected, pure virtual]

see _draw(const char str, int n, int x, int y). Implemented in Fl_Xlib_Graphics_Driver, Fl_GDI_Graphics_Driver, Fl_Quartz_Graphics_Driver, and Fl_PostScript_Graphics_Driver. 30.50.3.19 virtual void Fl Graphics Driver::draw ( int angle, const char str, int n, int x, int y ) [protected, pure virtual]

see _draw(int angle, const char str, int n, int x, int y). Implemented in Fl_Xlib_Graphics_Driver, Fl_GDI_Graphics_Driver, Fl_Quartz_Graphics_Driver, and Fl_PostScript_Graphics_Driver. 30.50.3.20 virtual void Fl Graphics Driver::draw ( Fl_RGB_Image rgb, int XP, int YP, int WP, int HP, int cx, int cy ) [protected, pure virtual]

Draws an Fl_RGB_Image object to the device. Species a bounding box for the image, with the origin (upper left-hand corner) of the image offset by the cx and cy arguments. Implemented in Fl_Xlib_Graphics_Driver, Fl_GDI_Graphics_Driver, Fl_Quartz_Graphics_Driver, and Fl_PostScript_Graphics_Driver.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.50 Fl_Graphics_Driver Class Reference 30.50.3.21

471

virtual void Fl Graphics Driver::draw ( Fl_Pixmap pxm, int XP, int YP, int WP, int HP, int cx, int cy ) [protected, pure virtual]

Draws an Fl_Pixmap object to the device. Species a bounding box for the image, with the origin (upper left-hand corner) of the image offset by the cx and cy arguments. Implemented in Fl_Xlib_Graphics_Driver, Fl_GDI_Graphics_Driver, Fl_Quartz_Graphics_Driver, and Fl_PostScript_Graphics_Driver.

30.50.3.22

virtual void Fl Graphics Driver::draw ( Fl_Bitmap bm, int XP, int YP, int WP, int HP, int cx, int cy ) [protected, pure virtual]

Draws an Fl_Bitmap object to the device. Species a bounding box for the image, with the origin (upper left-hand corner) of the image offset by the cx and cy arguments. Implemented in Fl_Xlib_Graphics_Driver, Fl_GDI_Graphics_Driver, Fl_Quartz_Graphics_Driver, and Fl_PostScript_Graphics_Driver.

30.50.3.23

virtual void Fl Graphics Driver::draw image ( const uchar buf, int X, int Y, int W, int H, int D = 3, int L = 0 ) [protected, pure virtual]

see _draw_image(const uchar buf, int X,int Y,int W,int H, int D, int L). Implemented in Fl_Xlib_Graphics_Driver, Fl_GDI_Graphics_Driver, Fl_Quartz_Graphics_Driver, and Fl_PostScript_Graphics_Driver.

30.50.3.24

virtual void Fl Graphics Driver::draw image ( Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D = 3 ) [protected, pure virtual]

see _draw_image(Fl_Draw_Image_Cb cb, void data, int X,int Y,int W,int H, int D). Implemented in Fl_Xlib_Graphics_Driver, Fl_GDI_Graphics_Driver, Fl_Quartz_Graphics_Driver, and Fl_PostScript_Graphics_Driver.

30.50.3.25

virtual void Fl Graphics Driver::draw image mono ( const uchar buf, int X, int Y, int W, int H, int D = 1, int L = 0 ) [protected, pure virtual]

see _draw_image_mono(const uchar buf, int X,int Y,int W,int H, int D, int L). Implemented in Fl_Xlib_Graphics_Driver, Fl_GDI_Graphics_Driver, Fl_Quartz_Graphics_Driver, and Fl_PostScript_Graphics_Driver.

30.50.3.26

virtual void Fl Graphics Driver::draw image mono ( Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D = 1 ) [protected, pure virtual]

see _draw_image_mono(Fl_Draw_Image_Cb cb, void data, int X,int Y,int W,int H, int D). Implemented in Fl_Xlib_Graphics_Driver, Fl_GDI_Graphics_Driver, Fl_Quartz_Graphics_Driver, and Fl_PostScript_Graphics_Driver.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

472 30.50.3.27

Class Documentation void Fl Graphics Driver::end complex polygon ( ) [protected, virtual]

see _end_complex_polygon(). Reimplemented in Fl_PostScript_Graphics_Driver. 30.50.3.28 void Fl Graphics Driver::end line ( ) [protected, virtual]

see _end_line(). Reimplemented in Fl_PostScript_Graphics_Driver. 30.50.3.29 void Fl Graphics Driver::end loop ( ) [protected, virtual]

see _end_loop(). Reimplemented in Fl_PostScript_Graphics_Driver. 30.50.3.30 void Fl Graphics Driver::end points ( ) [protected, virtual]

see _end_points(). Reimplemented in Fl_PostScript_Graphics_Driver. 30.50.3.31 void Fl Graphics Driver::end polygon ( ) [protected, virtual]

see _end_polygon(). Reimplemented in Fl_PostScript_Graphics_Driver. 30.50.3.32 virtual void Fl Graphics Driver::font ( Fl_Font face, Fl_Fontsize size ) [inline, virtual]

see _font(Fl_Font face, Fl_Fontsize size). Reimplemented in Fl_Xlib_Graphics_Driver, Fl_GDI_Graphics_Driver, Fl_Quartz_Graphics_Driver, and Fl_PostScript_Graphics_Driver. 30.50.3.33 Fl_Font Fl Graphics Driver::font ( ) [inline] see _font(void). 30.50.3.34 void Fl Graphics Driver::gap ( ) [protected, virtual]

see _gap(). Reimplemented in Fl_PostScript_Graphics_Driver. 30.50.3.35 virtual int Fl Graphics Driver::height ( ) [pure virtual]

see _height().
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.50 Fl_Graphics_Driver Class Reference

473

Implemented in Fl_Xlib_Graphics_Driver, Fl_GDI_Graphics_Driver, Fl_Quartz_Graphics_Driver, and Fl_PostScript_Graphics_Driver.

30.50.3.36

void Fl Graphics Driver::line ( int x, int y, int x1, int y1 ) [protected, virtual]

see _line(int x, int y, int x1, int y1). Reimplemented in Fl_PostScript_Graphics_Driver.

30.50.3.37

void Fl Graphics Driver::line ( int x, int y, int x1, int y1, int x2, int y2 ) [protected, virtual]

see _line(int x, int y, int x1, int y1, int x2, int y2). Reimplemented in Fl_PostScript_Graphics_Driver.

30.50.3.38

void Fl Graphics Driver::line style ( int style, int width = 0, char dashes = 0 ) [protected, virtual]

see _line_style(int style, int width, char dashes). Reimplemented in Fl_PostScript_Graphics_Driver.

30.50.3.39

void Fl Graphics Driver::loop ( int x0, int y0, int x1, int y1, int x2, int y2 ) [protected, virtual]

see _loop(int x0, int y0, int x1, int y1, int x2, int y2). Reimplemented in Fl_PostScript_Graphics_Driver.

30.50.3.40

void Fl Graphics Driver::loop ( int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3 ) [protected, virtual]

see _loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3). Reimplemented in Fl_PostScript_Graphics_Driver.

30.50.3.41

void Fl Graphics Driver::mult matrix ( double a, double b, double c, double d, double x, double y ) [protected]

see _mult_matrix(double a, double b, double c, double d, double x, double y).

30.50.3.42

int Fl Graphics Driver::not clipped ( int x, int y, int w, int h ) [protected, virtual]

see _not_clipped(int x, int y, int w, int h). Reimplemented in Fl_PostScript_Graphics_Driver.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

474 30.50.3.43

Class Documentation void Fl Graphics Driver::pie ( int x, int y, int w, int h, double a1, double a2 ) [protected, virtual]

see _pie(int x, int y, int w, int h, double a1, double a2). Reimplemented in Fl_PostScript_Graphics_Driver. 30.50.3.44 void Fl Graphics Driver::point ( int x, int y ) [protected, virtual]

see _point(int x, int y). Reimplemented in Fl_PostScript_Graphics_Driver. 30.50.3.45 void Fl Graphics Driver::polygon ( int x0, int y0, int x1, int y1, int x2, int y2 ) [protected, virtual]

see _polygon(int x0, int y0, int x1, int y1, int x2, int y2). Reimplemented in Fl_PostScript_Graphics_Driver. 30.50.3.46 void Fl Graphics Driver::polygon ( int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3 ) [protected, virtual]

see _polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3). Reimplemented in Fl_PostScript_Graphics_Driver. 30.50.3.47 void Fl Graphics Driver::pop clip ( ) [protected, virtual]

see _pop_clip(). Reimplemented in Fl_PostScript_Graphics_Driver. 30.50.3.48 void Fl Graphics Driver::pop matrix ( ) [protected]

see _pop_matrix(). 30.50.3.49 void Fl Graphics Driver::push clip ( int x, int y, int w, int h ) [protected, virtual]

see _push_clip(int x, int y, int w, int h). Reimplemented in Fl_PostScript_Graphics_Driver. 30.50.3.50 void Fl Graphics Driver::push matrix ( ) [protected]

see _push_matrix(). 30.50.3.51 void Fl Graphics Driver::push no clip ( ) [protected, virtual]

see _push_no_clip(). Reimplemented in Fl_PostScript_Graphics_Driver.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.50 Fl_Graphics_Driver Class Reference 30.50.3.52 void Fl Graphics Driver::rect ( int x, int y, int w, int h ) [protected, virtual]

475

see _rect(int x, int y, int w, int h). Reimplemented in Fl_PostScript_Graphics_Driver.

30.50.3.53

void Fl Graphics Driver::rectf ( int x, int y, int w, int h ) [protected, virtual]

see _rectf(int x, int y, int w, int h). Reimplemented in Fl_PostScript_Graphics_Driver.

30.50.3.54

void Fl Graphics Driver::restore clip ( ) [protected]

see _restore_clip().

30.50.3.55

void Fl Graphics Driver::rotate ( double d ) [protected]

see _rotate(double d).

30.50.3.56

virtual void Fl Graphics Driver::rtl draw ( const char str, int n, int x, int y ) [protected, pure virtual]

see _rtl_draw(const char str, int n, int x, int y). Implemented in Fl_Xlib_Graphics_Driver, Fl_GDI_Graphics_Driver, Fl_Quartz_Graphics_Driver, and Fl_PostScript_Graphics_Driver.

30.50.3.57

void Fl Graphics Driver::scale ( double x, double y ) [inline, protected]

see _scale(double x, double y).

30.50.3.58

void Fl Graphics Driver::scale ( double x ) [inline, protected]

see _scale(double x).

30.50.3.59 Fl_Fontsize Fl Graphics Driver::size ( ) [inline] see _size().

30.50.3.60

void Fl Graphics Driver::text extents ( const char t, int n, int & dx, int & dy, int & w, int & h ) [virtual]

see _text_extents(const char, int n, int& dx, int& dy, int& w, int& h). Reimplemented in Fl_Xlib_Graphics_Driver, Fl_GDI_Graphics_Driver, Fl_Quartz_Graphics_Driver, and Fl_PostScript_Graphics_Driver.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

476 30.50.3.61

Class Documentation double Fl Graphics Driver::transform dx ( double x, double y ) [protected]

see _transform_dx(double x, double y).

30.50.3.62

double Fl Graphics Driver::transform dy ( double x, double y ) [protected]

see _transform_dy(double x, double y).

30.50.3.63

double Fl Graphics Driver::transform x ( double x, double y ) [protected]

see _transform_x(double x, double y).

30.50.3.64

double Fl Graphics Driver::transform y ( double x, double y ) [protected]

see _transform_y(double x, double y).

30.50.3.65

void Fl Graphics Driver::transformed vertex ( double xf, double yf ) [protected, virtual]

see _transformed_vertex(double xf, double yf). Reimplemented in Fl_PostScript_Graphics_Driver.

30.50.3.66

void Fl Graphics Driver::translate ( double x, double y ) [inline, protected]

see _translate(double x, double y).

30.50.3.67

void Fl Graphics Driver::vertex ( double x, double y ) [protected, virtual]

see _vertex(double x, double y). Reimplemented in Fl_PostScript_Graphics_Driver.

30.50.3.68

virtual double Fl Graphics Driver::width ( const char str, int n ) [pure virtual]

see _width(const char str, int n). Implemented in Fl_Xlib_Graphics_Driver, Fl_GDI_Graphics_Driver, Fl_Quartz_Graphics_Driver, and Fl_PostScript_Graphics_Driver.

30.50.3.69

virtual double Fl Graphics Driver::width ( unsigned int c ) [inline, virtual]

see _width(unsigned int n). Reimplemented in Fl_Xlib_Graphics_Driver, Fl_GDI_Graphics_Driver, and Fl_Quartz_Graphics_Driver.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.50 Fl_Graphics_Driver Class Reference 30.50.3.70 void Fl Graphics Driver::xyline ( int x, int y, int x1 ) [protected, virtual]

477

see _xyline(int x, int y, int x1). Reimplemented in Fl_PostScript_Graphics_Driver. 30.50.3.71 void Fl Graphics Driver::xyline ( int x, int y, int x1, int y2 ) [protected, virtual]

see _xyline(int x, int y, int x1, int y2). Reimplemented in Fl_PostScript_Graphics_Driver. 30.50.3.72 void Fl Graphics Driver::xyline ( int x, int y, int x1, int y2, int x3 ) [protected, virtual]

see _xyline(int x, int y, int x1, int y2, int x3). Reimplemented in Fl_PostScript_Graphics_Driver. 30.50.3.73 void Fl Graphics Driver::yxline ( int x, int y, int y1 ) [protected, virtual]

see _yxline(int x, int y, int y1). Reimplemented in Fl_PostScript_Graphics_Driver. 30.50.3.74 void Fl Graphics Driver::yxline ( int x, int y, int y1, int x2 ) [protected, virtual]

see _yxline(int x, int y, int y1, int x2). Reimplemented in Fl_PostScript_Graphics_Driver. 30.50.3.75 void Fl Graphics Driver::yxline ( int x, int y, int y1, int x2, int y3 ) [protected, virtual]

see _yxline(int x, int y, int y1, int x2, int y3). Reimplemented in Fl_PostScript_Graphics_Driver.

30.50.4
30.50.4.1

Friends And Related Function Documentation


void arc ( double x, double y, double r, double start, double end ) [friend]

Adds a series of points to the current path on the arc of a circle. You can get elliptical paths by using scale and rotate before calling _arc(). Parameters in in

x,y,r center and radius of circular arc start,end angles of start and end of arc measured in degrees counter-clockwise from 3 oclock. If end is less than start then it draws the arc in a clockwise direction.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

478 30.50.4.2

Class Documentation void arc ( int x, int y, int w, int h, double a1, double a2 ) [friend]

Draw ellipse sections using integer coordinates. These functions match the rather limited circle drawing code provided by X and WIN32. The advantage over using _arc with oating point coordinates is that they are faster because they often use the hardware, and they draw much nicer small circles, since the small sizes are often hard-coded bitmaps. If a complete circle is drawn it will t inside the passed bounding box. The two angles are measured in degrees counter-clockwise from 3 oclock and are the starting and ending angle of the arc, a2 must be greater or equal to a1. _arc() draws a series of lines to approximate the arc. Notice that the integer version of _arc() has a different number of arguments than the double version _arc(double x, double y, double r, double start, double end) Parameters in in

x,y,w,h bounding box of complete circle a1,a2 start and end angles of arc measured in degrees counter-clockwise from 3 oclock. a2 must be greater than or equal to a1.

30.50.4.3

void begin complex polygon ( ) [friend]

Starts drawing a complex lled polygon. The polygon may be concave, may have holes in it, or may be several disconnected pieces. Call _gap() to separate loops of the path. To outline the polygon, use _begin_loop() and replace each _gap() with _end_loop();_begin_loop() pairs. Note For portability, you should only draw polygons that appear the same whether "even/odd" or "non-zero" winding rules are used to ll them. Holes should be drawn in the opposite direction to the outside loop.

30.50.4.4

void begin points ( ) [friend]

Starts drawing a list of points. Points are added to the list with _vertex() 30.50.4.5 void circle ( double x, double y, double r ) [friend]

_circle() is equivalent to _arc(x,y,r,0,360), but may be faster. It must be the only thing in the path: if you want a circle as part of a complex polygon you must use _arc() Parameters in

x,y,r center and radius of circle

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.50 Fl_Graphics_Driver Class Reference 30.50.4.6 int clip box ( int x, int y, int w, int h, int & X, int & Y, int & W, int & H ) [friend]

479

Intersects the rectangle with the current clip region and returns the bounding box of the result. Returns non-zero if the resulting rectangle is different to the original. This can be used to limit the necessary drawing to a rectangle. W and H are set to zero if the rectangle is completely outside the region. Parameters in out

x,y,w,h position and size of rectangle X,Y,W,H position and size of resulting bounding box.

Returns Non-zero if the resulting rectangle is different to the original.

30.50.4.7

void clip region ( Fl Region r ) [friend]

Replaces the top of the clipping stack with a clipping region of any shape. Fl_Region is an operating system specic type. Parameters in

r clipping region

30.50.4.8

void color ( Fl_Color c ) [friend]

Sets the color for all subsequent drawing operations. For colormapped displays, a color cell will be allocated out of fl_colormap the rst time you use a color. If the colormap lls up then a least-squares algorithm is used to nd the closest color. If no valid graphical context (_gc) is available, the foreground is not set for the current window. Parameters in

c color

30.50.4.9

void color ( uchar r, uchar g, uchar b ) [friend]

Sets the color for all subsequent drawing operations. The closest possible match to the RGB color is used. The RGB color is used directly on TrueColor displays. For colormap visuals the nearest index in the gray ramp or color cube is used. If no valid graphical context (_gc) is available, the foreground is not set for the current window. Parameters in

r,g,b color components

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

480 30.50.4.10

Class Documentation void curve ( double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3 ) [friend]

Adds a series of points on a Bezier curve to the path. The curve ends (and two of the points) are at X0,Y0 and X3,Y3. Parameters in in in in

X0,Y0 X1,Y1 X2,Y2 X3,Y3

curve start point curve control point curve control point curve end point

30.50.4.11

void draw image ( const uchar buf, int X, int Y, int W, int H, int D = 3, int L = 0 ) [friend]

Draws an 8-bit per color RGB or luminance image. Parameters in in in in in

buf points at the "r" data of the top-left pixel. Color data must be in r,g,b order. Luminance data is only one gray byte. X,Y position where to put top-left corner of image W,H size of the image D delta to add to the pointer between pixels. It may be any value greater than or equal to 1, or it can be negative to ip the image horizontally L delta to add to the pointer between lines (if 0 is passed it uses W D), and may be larger than W D to crop data, or negative to ip the image vertically

It is highly recommended that you put the following code before the rst show() of any window in your program to get rid of the dithering if possible:
Fl::visual(FL_RGB);

Gray scale (1-channel) images may be drawn. This is done if abs(D) is less than 3, or by calling _draw_image_mono(). Only one 8-bit sample is used for each pixel, and on screens with different numbers of bits for red, green, and blue only gray colors are used. Setting D greater than 1 will let you display one channel of a color image. Note: The X version does not support all possible visuals. If FLTK cannot draw the image in the current visual it will abort. FLTK supports any visual of 8 bits or less, and all common TrueColor visuals up to 32 bits.

30.50.4.12

void draw image ( Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D = 3 ) [friend]

Draws an image using a callback function to generate image data. You can generate the image as it is being drawn, or do arbitrary decompression of stored data, provided it can be decompressed to individual scan lines easily.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.50 Fl_Graphics_Driver Class Reference Parameters in in in in in

481

cb data X,Y W,H D

callback function to generate scan line data user data passed to callback function screen position of top left pixel image width and height data size in bytes (must be greater than 0)

See also _draw_image(const uchar buf, int X,int Y,int W,int H, int D, int L) The callback function cb is called with the void data user data pointer to allow access to a structure of information about the image, and the x, y, and w of the scan line desired from the image. 0,0 is the upper-left corner of the image, not x, y. A pointer to a buffer to put the data into is passed. You must copy w pixels from scanline y, starting at pixel x, to this buffer. Due to cropping, less than the whole image may be requested. So x may be greater than zero, the rst y may be greater than zero, and w may be less than W. The buffer is long enough to store the entire W D pixels, this is for convenience with some decompression schemes where you must decompress the entire line at once: decompress it into the buffer, and then if x is not zero, copy the data over so the xth pixel is at the start of the buffer. You can assume the ys will be consecutive, except the rst one may be greater than zero. If D is 4 or more, you must ll in the unused bytes with zero. 30.50.4.13 void draw image mono ( const uchar buf, int X, int Y, int W, int H, int D = 1, int L = 0 ) [friend]

Draws a gray-scale (1 channel) image. See also _draw_image(const uchar buf, int X,int Y,int W,int H, int D, int L)

30.50.4.14

FL EXPORT void draw image mono ( Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D ) [friend]

Draws a gray-scale image using a callback function to generate image data. See also _draw_image(Fl_Draw_Image_Cb cb, void data, int X,int Y,int W,int H, int D)

30.50.4.15

void font ( Fl_Font face, Fl_Fontsize size ) [friend]

Sets the current font, which is then used in various drawing routines. You may call this outside a draw context if necessary to call _width(), but on X this will open the display. The font is identied by a face and a size. The size of the font is measured in pixels and not "points". Lines should be spaced size pixels apart or more.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

482 30.50.4.16 void gap ( ) [friend]

Class Documentation

Call _gap() to separate loops of the path. It is unnecessary but harmless to call _gap() before the rst vertex, after the last vertex, or several times in a row. 30.50.4.17 void line style ( int style, int width = 0, char dashes = 0 ) [friend]

Sets how to draw lines (the "pen"). If you change this it is your responsibility to set it back to the default using fl_line_style(0). Parameters in

in

in

style A bitmask which is a bitwise-OR of a line style, a cap style, and a join style. If you dont specify a dash type you will get a solid line. If you dont specify a cap or join type you will get a system-dened default of whatever value is fastest. width The thickness of the lines in pixels. Zero results in the system dened default, which on both X and Windows is somewhat different and nicer than 1. dashes A pointer to an array of dash lengths, measured in pixels. The rst location is how long to draw a solid portion, the next is how long to draw the gap, then the solid, etc. It is terminated with a zero-length entry. A NULL pointer or a zero-length array results in a solid line. Odd array sizes are not supported and result in undened behavior.

Note Because of how line styles are implemented on Win32 systems, you must set the line style after setting the drawing color. If you set the color after the line style you will lose the line style settings. The dashes array does not work under Windows 95, 98 or Me, since those operating systems do not support complex line styles.

30.50.4.18

void mult matrix ( double a, double b, double c, double d, double x, double y ) [friend]

Concatenates another transformation onto the current one. Parameters in

a,b,c,d,x,y transformation matrix elements such that X = aX + cY + x and Y = bX +dY + y

30.50.4.19

int not clipped ( int x, int y, int w, int h ) [friend]

Does the rectangle intersect the current clip region?

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.50 Fl_Graphics_Driver Class Reference Parameters in

483

x,y,w,h position and size of rectangle

Returns non-zero if any of the rectangle intersects the current clip region. If this returns 0 you dont have to draw the object.

Note Under X this returns 2 if the rectangle is partially clipped, and 1 if it is entirely inside the clip region.

30.50.4.20

void pie ( int x, int y, int w, int h, double a1, double a2 ) [friend]

Draw lled ellipse sections using integer coordinates. Like _arc(), but _pie() draws a lled-in pie slice. This slice may extend outside the line drawn by _arc(); to avoid this use w - 1 and h - 1. Parameters in in

x,y,w,h bounding box of complete circle a1,a2 start and end angles of arc measured in degrees counter-clockwise from 3 oclock. a2 must be greater than or equal to a1.

30.50.4.21

void polygon ( int x0, int y0, int x1, int y1, int x2, int y2 ) [friend]

Fills a 3-sided polygon. The polygon must be convex.

30.50.4.22

void polygon ( int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3 ) [friend]

Fills a 4-sided polygon. The polygon must be convex.

30.50.4.23

void pop clip ( ) [friend]

Restores the previous clip region. You must call _pop_clip() once for every time you call _push_clip(). Unpredictable results may occur if the clip stack is not empty when you return to FLTK.

30.50.4.24

void push clip ( int x, int y, int w, int h ) [friend]

Intersects the current clip region with a rectangle and pushes this new region onto the stack.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

484 Parameters in

Class Documentation

x,y,w,h position and size

30.50.4.25

void push matrix ( ) [friend]

Saves the current transformation matrix on the stack. The maximum depth of the stack is 32. 30.50.4.26 void rect ( int x, int y, int w, int h ) [friend]

Draws a 1-pixel border inside the given bounding box. This function is meant for quick drawing of simple boxes. The behavior is undened for line widths that are not 1. 30.50.4.27 void rotate ( double d ) [friend]

Concatenates rotation transformation onto the current one. Parameters in

d - rotation angle, counter-clockwise in degrees (not radians)

30.50.4.28

void scale ( double x, double y ) [friend]

Concatenates scaling transformation onto the current one. Parameters in

x,y scale factors in x-direction and y-direction

30.50.4.29

void scale ( double x ) [friend]

Concatenates scaling transformation onto the current one. Parameters in

x scale factor in both x-direction and y-direction

30.50.4.30

double transform dx ( double x, double y ) [friend]

Transforms distance using current transformation matrix. Parameters in

x,y coordinate

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.50 Fl_Graphics_Driver Class Reference 30.50.4.31 double transform dy ( double x, double y ) [friend]

485

Transforms distance using current transformation matrix. Parameters in

x,y coordinate

30.50.4.32

double transform x ( double x, double y ) [friend]

Transforms coordinate using the current transformation matrix. Parameters in

x,y coordinate

30.50.4.33

double transform y ( double x, double y ) [friend]

Transforms coordinate using the current transformation matrix. Parameters in

x,y coordinate

30.50.4.34

void transformed vertex ( double xf, double yf ) [friend]

Adds coordinate pair to the vertex list without further transformations. Parameters in

xf,yf transformed coordinate

30.50.4.35

void translate ( double x, double y ) [friend]

Concatenates translation transformation onto the current one. Parameters in

x,y translation factor in x-direction and y-direction

30.50.4.36

void vertex ( double x, double y ) [friend]

Adds a single vertex to the current path. Parameters in

x,y coordinate

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

486

Class Documentation

30.50.5
30.50.5.1

Member Data Documentation


const char Fl_Graphics_Driver::class_id = Fl Graphics Driver [static]

A string that identies each subclass of Fl_Device. Function class_name() applied to a device of this class returns this string. Reimplemented from Fl_Device. Reimplemented in Fl_Xlib_Graphics_Driver, Fl_GDI_Graphics_Driver, Fl_Quartz_Graphics_Driver, and Fl_PostScript_Graphics_Driver. The documentation for this class was generated from the following les:

Fl_Device.H

_arc.cxx

_arci.cxx

_curve.cxx

Fl_Device.cxx

_line_style.cxx

_rect.cxx

_vertex.cxx

30.51

Fl Group Class Reference

The Fl_Group class is the FLTK container widget. #include <Fl_Group.H> Inheritance diagram for Fl_Group:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.51 Fl_Group Class Reference


Fl_Widget Fl_Group Fl_Browser_ Fl_Color_Chooser Fl_Help_View Fl_Input_Choice Fl_Pack Fl_Scroll Fl_Spinner Fl_Table Fl_Tabs Fl_Text_Display Fl_Tile Fl_Tree Fl_Window Fl_Wizard

487

Public Member Functions


Fl_Widget & _ddfdesign_kludge ()
This is for forms compatibility only.

void add (Fl_Widget &)


The widget is removed from its current group (if any) and then added to the end of this group.

void add (Fl_Widget o)


See void Fl_Group::add(Fl_Widget &w)

void add_resizable (Fl_Widget &o)


Adds a widget to the group and makes it the resizable widget.

Fl_Widget const array () const


Returns a pointer to the array of children.

virtual Fl_Group as_group ()


Returns an Fl_Group pointer if this widget is an Fl_Group.

void begin ()
Sets the current group so you can build the widget tree by just constructing the widgets.

Fl_Widget child (int n) const


Returns array()[n].

int children () const


Returns how many child widgets the group has.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

488 void clear ()


Deletes all child widgets from memory recursively.

Class Documentation

void clip_children (int c)


Controls whether the group widget clips the drawing of child widgets to its bounding box.

unsigned int clip_children ()


Returns the current clipping mode.

void end ()
Exactly the same as current(this->parent()).

int nd (const Fl_Widget ) const


Searches the child array for the widget and returns the index.

int nd (const Fl_Widget &o) const


See int Fl_Group::nd(const Fl_Widget w) const.

Fl_Group (int, int, int, int, const char =0)


Creates a new Fl_Group widget using the given position, size, and label string.

void focus (Fl_Widget W) void forms_end ()


This is for forms compatibility only.

int handle (int)


Handles the specied event.

void init_sizes ()
Resets the internal array of widget sizes and positions.

void insert (Fl_Widget &, int i)


The widget is removed from its current group (if any) and then inserted into this group.

void insert (Fl_Widget &o, Fl_Widget before)


This does insert(w, nd(before)).

void remove (int index)


Removes the widget at index from the group but does not delete it.

void remove (Fl_Widget &)


Removes a widget from the group but does not delete it.

void remove (Fl_Widget o)


Removes the widget o from the group.

void resizable (Fl_Widget &o)


See void Fl_Group::resizable(Fl_Widget box)

void resizable (Fl_Widget o)


The resizable widget denes the resizing box for the group.

Fl_Widget resizable () const


See void Fl_Group::resizable(Fl_Widget box)

void resize (int, int, int, int)


Resizes the Fl_Group widget and all of its children.

virtual Fl_Group ()
The destructor also deletes all the children.

Static Public Member Functions


static Fl_Group current ()
Returns the currently active group.

static void current (Fl_Group g)


Sets the current group.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.51 Fl_Group Class Reference

489

Protected Member Functions


void draw ()
Draws the widget.

void draw_child (Fl_Widget &widget) const


Forces a child to redraw.

void draw_children ()
Draws all children of the group.

void draw_outside_label (const Fl_Widget &widget) const


Parents normally call this to draw outside labels of child widgets.

int sizes ()
Returns the internal array of widget sizes and positions.

void update_child (Fl_Widget &widget) const


Draws a child only if it needs it.

30.51.1

Detailed Description

The Fl_Group class is the FLTK container widget. It maintains an array of child widgets. These children can themselves be any widget including Fl_Group. The most important subclass of Fl_Group is Fl_Window, however groups can also be used to control radio buttons or to enforce resize behavior.

30.51.2
30.51.2.1

Constructor & Destructor Documentation


Fl Group::Fl Group ( int X, int Y, int W, int H, const char l = 0 )

Creates a new Fl_Group widget using the given position, size, and label string. The default boxtype is FL_NO_BOX. 30.51.2.2 Fl Group::Fl Group ( ) [virtual]

The destructor also deletes all the children. This allows a whole tree to be deleted at once, without having to keep a pointer to all the children in the user code. It is allowed that the Fl_Group and all of its children are automatic (local) variables, but you must declare the Fl_Group rst, so that it is destroyed last. If you add static or automatic (local) variables to an Fl_Group, then it is your responsibility to remove (or delete) all such static or automatic child widgets before destroying the group - otherwise the child widgets destructors would be called twice!

30.51.3

Member Function Documentation

30.51.3.1 Fl_Widget const Fl Group::array ( ) const Returns a pointer to the array of children. This pointer is only valid until the next time a child is added or removed.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

490 30.51.3.2 virtual Fl_Group Fl Group::as group ( ) [inline, virtual]

Class Documentation

Returns an Fl_Group pointer if this widget is an Fl_Group. Use this method if you have a widget (pointer) and need to know whether this widget is derived from Fl_Group. If it returns non-NULL, then the widget in question is derived from Fl_Group, and you can use the returned pointer to access its children or other Fl_Group-specic methods. Example:
void my_callback (Fl_Widget *w, void *) { Fl_Group *g = w->as_group(); if (g) printf ("This group has %d children\n",g->children()); else printf ("This widget is not a group!\n"); }

Return values NULL if this widget is not derived from Fl_Group. Note This method is provided to avoid dynamic_cast. See also Fl_Widget::as_window(), Fl_Widget::as_gl_window() Reimplemented from Fl_Widget. 30.51.3.3 void Fl Group::begin ( )

Sets the current group so you can build the widget tree by just constructing the widgets. begin() is automatically called by the constructor for Fl_Group (and thus for Fl_Window as well). begin() is exactly the same as current(this). Dont forget to end() the group or window! Reimplemented in Fl_Table. 30.51.3.4 Fl_Widget Fl Group::child ( int n ) const [inline] Returns array()[n]. No range checking is done! Reimplemented in Fl_Table. 30.51.3.5 void Fl Group::clear ( )

Deletes all child widgets from memory recursively. This method differs from the remove() method in that it affects all child widgets and deletes them from memory. Reimplemented in Fl_Table, Fl_Tree, Fl_Table_Row, Fl_Input_Choice, Fl_Scroll, Fl_Browser, and Fl_Check_Browser.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.51 Fl_Group Class Reference 30.51.3.6 void Fl Group::clip children ( int c ) [inline]

491

Controls whether the group widget clips the drawing of child widgets to its bounding box. Set c to 1 if you want to clip the child widgets to the bounding box. The default is to not clip (0) the drawing of child widgets. 30.51.3.7 unsigned int Fl Group::clip children ( ) [inline]

Returns the current clipping mode. Returns true, if clipping is enabled, false otherwise. See also void Fl_Group::clip_children(int c)

30.51.3.8 Fl_Group Fl Group::current ( ) [static] Returns the currently active group. The Fl_Widget constructor automatically does current()->add(widget) if this is not null. To prevent new widgets from being added to a group, call Fl_Group::current(0). Reimplemented in Fl_Window. 30.51.3.9 void Fl Group::current ( Fl_Group g ) [static]

Sets the current group. See also Fl_Group::current()

30.51.3.10

void Fl Group::draw ( ) [protected, virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Implements Fl_Widget. Reimplemented in Fl_Table, Fl_Text_Display, Fl_Gl_Window, Fl_Tree, Fl_Browser_, Fl_Scroll, Fl_Window, Fl_Tabs, Fl_Cairo_Window, Fl_Pack, and Fl_Glut_Window.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

492 30.51.3.11

Class Documentation void Fl Group::draw child ( Fl_Widget & widget ) const [protected]

Forces a child to redraw. This draws a child widget, if it is not clipped. The damage bits are cleared after drawing. 30.51.3.12 void Fl Group::draw children ( ) [protected]

Draws all children of the group. This is useful, if you derived a widget from Fl_Group and want to draw a special border or background. You can call draw_children() from the derived draw() method after drawing the box, border, or background.

30.51.3.13

void Fl Group::draw outside label ( const Fl_Widget & widget ) const [protected]

Parents normally call this to draw outside labels of child widgets. 30.51.3.14 void Fl Group::end ( )

Exactly the same as current(this->parent()). Any new widgets added to the widget tree will be added to the parent of the group. Reimplemented in Fl_Table. 30.51.3.15 int Fl Group::nd ( const Fl_Widget o ) const

Searches the child array for the widget and returns the index. Returns children() if the widget is NULL or not found. Reimplemented in Fl_Table. 30.51.3.16 void Fl Group::focus ( Fl_Widget W ) [inline]

Deprecated This is for backwards compatibility only. You should use W->take_focus() instead. See also Fl_Widget::take_focus();

30.51.3.17

int Fl Group::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.51 Fl_Group Class Reference

493

Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted

See also Fl_Event Reimplemented from Fl_Widget. Reimplemented in Fl_Table, Fl_Tree, Fl_Browser_, Fl_Window, Fl_Spinner, Fl_Scroll, Fl_Table_Row, Fl_Text_Display, Fl_Check_Browser, Fl_Gl_Window, Fl_Tile, Fl_Tabs, Fl_Text_Editor, and Fl_Glut_Window.

30.51.3.18

void Fl Group::init sizes ( )

Resets the internal array of widget sizes and positions. The Fl_Group widget keeps track of the original widget sizes and positions when resizing occurs so that if you resize a window back to its original size the widgets will be in the correct places. If you rearrange the widgets in your group, call this method to register the new arrangement with the Fl_Group that contains them. If you add or remove widgets, this will be done automatically. Note The internal array of widget sizes and positions will be allocated and lled when the next resize() occurs.

See also sizes() Reimplemented in Fl_Table.

30.51.3.19

void Fl Group::insert ( Fl_Widget & o, int index )

The widget is removed from its current group (if any) and then inserted into this group. It is put at index n - or at the end, if n >= children(). This can also be used to rearrange the widgets inside a group. Reimplemented in Fl_Table.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

494 30.51.3.20

Class Documentation void Fl Group::insert ( Fl_Widget & o, Fl_Widget before ) [inline]

This does insert(w, nd(before)). This will append the widget if before is not in the group. Reimplemented in Fl_Table. 30.51.3.21 void Fl Group::remove ( int index )

Removes the widget at index from the group but does not delete it. This method does nothing if index is out of bounds. This method differs from the clear() method in that it only affects a single widget and does not delete it from memory. Since FLTK 1.3.0 Reimplemented in Fl_Browser, and Fl_Check_Browser. 30.51.3.22 void Fl Group::remove ( Fl_Widget & o )

Removes a widget from the group but does not delete it. This method does nothing if the widget is not a child of the group. This method differs from the clear() method in that it only affects a single widget and does not delete it from memory. Note If you have the childs index anyway, use remove(int index) instead, because this doesnt need a child lookup in the groups table of children. This can be much faster, if there are lots of children. Reimplemented in Fl_Table. 30.51.3.23 void Fl Group::remove ( Fl_Widget o ) [inline]

Removes the widget o from the group. See also void remove(Fl_Widget&)

30.51.3.24

void Fl Group::resizable ( Fl_Widget o ) [inline]

The resizable widget denes the resizing box for the group. When the group is resized it calculates a new size and position for all of its children. Widgets that are horizontally or vertically inside the dimensions of the box are scaled to the new size. Widgets outside the box are moved.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.51 Fl_Group Class Reference In these examples the gray area is the resizable:

495

Figure 30.14: before resize

Figure 30.15: after resize

The resizable may be set to the group itself, in which case all the contents are resized. This is the default value for Fl_Group, although NULL is the default for Fl_Window and Fl_Pack. If the resizable is NULL then all widgets remain a xed size and distance from the top-left corner. It is possible to achieve any type of resize behavior by using an invisible Fl_Box as the resizable and/or by using a hierarchy of child Fl_Groups. 30.51.3.25 void Fl Group::resize ( int X, int Y, int W, int H ) [virtual]

Resizes the Fl_Group widget and all of its children. The Fl_Group widget rst resizes itself, and then it moves and resizes all its children according to the rules documented for Fl_Group::resizable(Fl_Widget) See also Fl_Group::resizable(Fl_Widget) Fl_Group::resizable() Fl_Widget::resize(int,int,int,int) Reimplemented from Fl_Widget.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

496

Class Documentation

Reimplemented in Fl_Table, Fl_Help_View, Fl_Text_Display, Fl_Browser_, Fl_Spinner, Fl_Input_Choice, Fl_Window, Fl_Scroll, Fl_Tile, Fl_Gl_Window, Fl_Double_Window, and Fl_Overlay_Window. 30.51.3.26 int Fl Group::sizes ( ) [protected]

Returns the internal array of widget sizes and positions. If the sizes() array does not exist, it will be allocated and lled with the current widget sizes and positions. Note You should never need to use this method directly, unless you have special needs to rearrange the children of a Fl_Group. Fl_Tile uses this to rearrange its widget positions. See also init_sizes() Todo Should the internal representation of the sizes() array be documented?

30.51.3.27

void Fl Group::update child ( Fl_Widget & widget ) const [protected]

Draws a child only if it needs it. This draws a child widget, if it is not clipped and if any damage() bits are set. The damage bits are cleared after drawing. See also Fl_Group::draw_child(Fl_Widget& widget) const The documentation for this class was generated from the following les: Fl_Group.H Fl_Group.cxx forms_compatability.cxx

30.52

Fl Help Block Struct Reference

Public Attributes
Fl_Color bgcolor uchar border const char end int h int line [32] const char start int w int x int y

The documentation for this struct was generated from the following le: Fl_Help_View.H
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.53 Fl_Help_Dialog Class Reference

497

30.53

Fl Help Dialog Class Reference

The Fl_Help_Dialog widget displays a standard help dialog window using the Fl_Help_View widget.

Public Member Functions


Fl_Help_Dialog ()
The constructor creates the dialog pictured above.

int h ()
Returns the position and size of the help dialog.

void hide ()
Hides the Fl_Help_Dialog window.

void load (const char f)


Loads the specied HTML le into the Fl_Help_View widget.

void position (int xx, int yy)


Set the screen position of the dialog.

void resize (int xx, int yy, int ww, int hh)
Change the position and size of the dialog.

void show ()
Shows the Fl_Help_Dialog window.

void show (int argc, char argv)


Shows the main Help Dialog Window Delegates call to encapsulated window_ void Fl_Window::show(int argc, char argv) instance method.

void textsize (Fl_Fontsize s)


Sets or gets the default text size for the help view.

Fl_Fontsize textsize ()
Sets or gets the default text size for the help view.

void topline (const char n)


Sets the top line in the Fl_Help_View widget to the named or numbered line.

void topline (int n)


Sets the top line in the Fl_Help_View widget to the named or numbered line.

void value (const char f)


The rst form sets the current buffer to the string provided and reformats the text.

const char value () const


The rst form sets the current buffer to the string provided and reformats the text.

int visible ()
Returns 1 if the Fl_Help_Dialog window is visible.

int w ()
Returns the position and size of the help dialog.

int x ()
Returns the position and size of the help dialog.

int y ()
Returns the position and size of the help dialog.

Fl_Help_Dialog ()
The destructor destroys the widget and frees all memory that has been allocated for the current le.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

498

Class Documentation

30.53.1

Detailed Description

The Fl_Help_Dialog widget displays a standard help dialog window using the Fl_Help_View widget.

Figure 30.16: Fl_Help_Dialog

30.53.2
30.53.2.1

Constructor & Destructor Documentation


Fl Help Dialog::Fl Help Dialog ( )

The constructor creates the dialog pictured above.

30.53.3
30.53.3.1

Member Function Documentation


int Fl Help Dialog::h ( )

Returns the position and size of the help dialog.

30.53.3.2

void Fl Help Dialog::hide ( )

Hides the Fl_Help_Dialog window.

30.53.3.3

void Fl Help Dialog::load ( const char f )

Loads the specied HTML le into the Fl_Help_View widget. The lename can also contain a target name ("lename.html#target").

30.53.3.4

void Fl Help Dialog::position ( int x, int y )

Set the screen position of the dialog.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.53 Fl_Help_Dialog Class Reference 30.53.3.5 void Fl Help Dialog::resize ( int xx, int yy, int ww, int hh )

499

Change the position and size of the dialog.

30.53.3.6

void Fl Help Dialog::show ( )

Shows the Fl_Help_Dialog window. Shows the main Help Dialog Window Delegates call to encapsulated window_ void Fl_Window::show() method.

30.53.3.7

void Fl Help Dialog::textsize ( Fl_Fontsize s )

Sets or gets the default text size for the help view. Sets the internal Fl_Help_View instance text size. Delegates call to encapsulated view_ void Fl_Help_View::textsize(Fl_Fontsize s) instance method

30.53.3.8 uchar Fl Help Dialog::textsize ( ) Sets or gets the default text size for the help view.

30.53.3.9

void Fl Help Dialog::value ( const char v )

The rst form sets the current buffer to the string provided and reformats the text. It also clears the history of the "back" and "forward" buttons. The second form returns the current buffer contents.

30.53.3.10

const char Fl Help Dialog::value ( ) const

The rst form sets the current buffer to the string provided and reformats the text. It also clears the history of the "back" and "forward" buttons. The second form returns the current buffer contents.

30.53.3.11

int Fl Help Dialog::visible ( )

Returns 1 if the Fl_Help_Dialog window is visible.

30.53.3.12

int Fl Help Dialog::w ( )

Returns the position and size of the help dialog.

30.53.3.13

int Fl Help Dialog::x ( )

Returns the position and size of the help dialog.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

500 30.53.3.14 int Fl Help Dialog::y ( )

Class Documentation

Returns the position and size of the help dialog. The documentation for this class was generated from the following les: Fl_Help_Dialog.H Fl_Help_Dialog.cxx Fl_Help_Dialog_Dox.cxx

30.54

Fl Help Font Stack Struct Reference

Public Member Functions


size_t count () const
Gets the current count of font style elements in the stack.

Fl_Help_Font_Stack ()
font stack construction, initialize attributes.

void init (Fl_Font f, Fl_Fontsize s, Fl_Color c) void pop (Fl_Font &f, Fl_Fontsize &s, Fl_Color &c)
Pops from the stack the font style triplet and calls _font() & _color() adequately.

void push (Fl_Font f, Fl_Fontsize s, Fl_Color c)


Pushes the font style triplet on the stack, also calls _font() & _color() adequately.

void top (Fl_Font &f, Fl_Fontsize &s, Fl_Color &c)


Gets the top (current) element on the stack.

Protected Attributes
Fl_Help_Font_Style elts_ [100]
font elements

size_t nfonts_
current number of fonts in stack

30.54.1
30.54.1.1

Constructor & Destructor Documentation


Fl Help Font Stack::Fl Help Font Stack ( ) [inline]

font stack construction, initialize attributes.

30.54.2
30.54.2.1

Member Function Documentation


size t Fl Help Font Stack::count ( ) const [inline]

Gets the current count of font style elements in the stack.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.55 Fl_Help_Font_Style Struct Reference 30.54.2.2 void Fl Help Font Stack::top ( Fl_Font & f, Fl_Fontsize & s, Fl_Color & c ) [inline]

501

Gets the top (current) element on the stack. The documentation for this struct was generated from the following le: Fl_Help_View.H

30.55

Fl Help Font Style Struct Reference

Fl_Help_View font stack element denition. #include <Fl_Help_View.H>

Public Member Functions


Fl_Help_Font_Style (Fl_Font afont, Fl_Fontsize asize, Fl_Color acolor) void get (Fl_Font &afont, Fl_Fontsize &asize, Fl_Color &acolor)
Gets current font attributes.

void set (Fl_Font afont, Fl_Fontsize asize, Fl_Color acolor)


Sets current font attributes.

Public Attributes
Fl_Color c
Font Color.

Fl_Font f
Font.

Fl_Fontsize s
Font Size.

30.55.1

Detailed Description

Fl_Help_View font stack element denition. The documentation for this struct was generated from the following le: Fl_Help_View.H

30.56

Fl Help Link Struct Reference

Denition of a link for the html viewer. #include <Fl_Help_View.H>


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

502

Class Documentation

Public Attributes
char lename [192]
Reference lename.

int h
Height of link text.

char name [32]


Link target (blank if none)

int w
Width of link text.

int x
X offset of link text.

int y
Y offset of link text.

30.56.1

Detailed Description

Denition of a link for the html viewer. The documentation for this struct was generated from the following le: Fl_Help_View.H

30.57

Fl Help Target Struct Reference

Fl_Help_Target structure. #include <Fl_Help_View.H>

Public Attributes
char name [32]
Target name.

int y
Y offset of target.

30.57.1

Detailed Description

Fl_Help_Target structure. The documentation for this struct was generated from the following le: Fl_Help_View.H
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.58 Fl_Help_View Class Reference

503

30.58

Fl Help View Class Reference

The Fl_Help_View widget displays HTML text. #include <Fl_Help_View.H> Inheritance diagram for Fl_Help_View:

Fl_Widget Fl_Group Fl_Help_View

Public Member Functions


void clear_selection ()
Removes the current text selection.

const char directory () const


Returns the current directory for the text in the buffer.

const char lename () const


Returns the current lename for the text in the buffer.

int nd (const char s, int p=0)


Finds the specied string s at starting position p.

Fl_Help_View (int xx, int yy, int ww, int hh, const char l=0)
The constructor creates the Fl_Help_View widget at the specied position and size.

void leftline (int)


Scrolls the text to the indicated position, given a pixel column.

int leftline () const


Gets the left position in pixels.

void link (Fl_Help_Func fn)


This method assigns a callback function to use when a link is followed or a le is loaded (via Fl_Help_View::load()) that requires a different le or path.

int load (const char f)


Loads the specied le.

void resize (int, int, int, int)


Resizes the help widget.

int scrollbar_size () const


Gets the current size of the scrollbars troughs, in pixels.

void scrollbar_size (int size)


Sets the pixel size of the scrollbars troughs to the size, in pixels.

void select_all ()
Selects all the text in the view.

int size () const


Gets the size of the help view.

void size (int W, int H)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

504
Changes the size of the widget.

Class Documentation

void textcolor (Fl_Color c)


Sets the default text color.

Fl_Color textcolor () const


Returns the current default text color.

void textfont (Fl_Font f)


Sets the default text font.

Fl_Font textfont () const


Returns the current default text font.

void textsize (Fl_Fontsize s)


Sets the default text size.

Fl_Fontsize textsize () const


Gets the default text size.

const char title ()


Returns the current document title, or NULL if there is no title.

void topline (const char n)


Scrolls the text to the indicated position, given a named destination.

void topline (int)


Scrolls the text to the indicated position, given a pixel line.

int topline () const


Returns the current top line in pixels.

void value (const char val)


Sets the current help text buffer to the string provided and reformats the text.

const char value () const


Returns the current buffer contents.

Fl_Help_View ()
Destroys the Fl_Help_View widget.

30.58.1

Detailed Description

The Fl_Help_View widget displays HTML text. Most HTML 2.0 elements are supported, as well as a primitive implementation of tables. GIF, JPEG, and PNG images are displayed inline. Supported HTML tags: A: HREF/NAME B BODY: BGCOLOR/TEXT/LINK BR CENTER CODE DD DL
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.58 Fl_Help_View Class Reference DT EM FONT: COLOR/SIZE/FACE=(helvetica/arial/sans/times/serif/symbol/courier) H1/H2/H3/H4/H5/H6 HEAD HR I IMG: SRC/WIDTH/HEIGHT/ALT KBD LI OL P PRE STRONG TABLE: TH/TD/TR/BORDER/BGCOLOR/COLSPAN/ALIGN=CENTER|RIGHT|LEFT TITLE TT U UL VAR Supported color names:

505

black,red,green,yellow,blue,magenta,fuchsia,cyan,aqua,white,gray,grey,lime,maroon,navy,olive,purple,silver,teal. Supported urls: Internal: file: External: http: ftp: https: ipp: mailto: news: Quoted char names: Aacute aacute Acirc acirc acute AElig aelig Agrave agrave amp Aring aring Atilde atilde Auml auml brvbar bull Ccedil ccedil cedil cent copy curren deg divide Eacute eacute Ecirc ecirc Egrave egrave ETH eth Euml euml euro
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

506 frac12 frac14 frac34 gt Iacute iacute Icirc icirc iexcl Igrave igrave iquest Iuml iuml laquo lt macr micro middot nbsp not Ntilde ntilde

Class Documentation

Oacute oacute Ocirc ocirc Ograve ograve ordf ordm Oslash oslash Otilde otilde Ouml ouml para premil plusmn pound quot raquo reg sect shy sup1 sup2 sup3 szlig THORN thorn times trade Uacute uacute Ucirc ucirc Ugrave ugrave uml Uuml uuml Yacute yacute yen Yuml yuml

30.58.2
30.58.2.1

Constructor & Destructor Documentation


Fl Help View::Fl Help View ( )

Destroys the Fl_Help_View widget. The destructor destroys the widget and frees all memory that has been allocated for the current document.

30.58.3
30.58.3.1

Member Function Documentation


void Fl Help View::clear selection ( )

Removes the current text selection.

30.58.3.2

const char Fl Help View::directory ( ) const [inline]

Returns the current directory for the text in the buffer.

30.58.3.3

const char Fl Help View::lename ( ) const [inline]

Returns the current lename for the text in the buffer.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.58 Fl_Help_View Class Reference 30.58.3.4 int Fl Help View::nd ( const char s, int p = 0 )

507

Finds the specied string s at starting position p. Returns the matching position or -1 if not found

30.58.3.5

void Fl Help View::leftline ( int left )

Scrolls the text to the indicated position, given a pixel column. If the given pixel value left is out of range, then the text is scrolled to the left or right side of the document, resp. Parameters in

left left column number in pixels (0 = left side)

30.58.3.6

int Fl Help View::leftline ( ) const [inline]

Gets the left position in pixels. 30.58.3.7 void Fl Help View::link ( Fl Help Func fn ) [inline]

This method assigns a callback function to use when a link is followed or a le is loaded (via Fl_Help_View::load()) that requires a different le or path. The callback function receives a pointer to the Fl_Help_View widget and the URI or full pathname for the le in question. It must return a pathname that can be opened as a local le or NULL:
const char *fn(Fl_Widget *w, const char *uri);

The link function can be used to retrieve remote or virtual documents, returning a temporary le that contains the actual data. If the link function returns NULL, the value of the Fl_Help_View widget will remain unchanged. If the link callback cannot handle the URI scheme, it should return the uri value unchanged or set the value() of the widget before returning NULL. 30.58.3.8 int Fl Help View::load ( const char f )

Loads the specied le. This method loads the specied le or URL. 30.58.3.9 void Fl Help View::resize ( int xx, int yy, int ww, int hh ) [virtual]

Resizes the help widget. Reimplemented from Fl_Group.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

508 30.58.3.10 int Fl Help View::scrollbar size ( ) const [inline]

Class Documentation

Gets the current size of the scrollbars troughs, in pixels. If this value is zero (default), this widget will use the Fl::scrollbar_size() value as the scrollbars width. Returns Scrollbar size in pixels, or 0 if the global Fl::scrollbar_size() is being used.

See also Fl::scrollbar_size(int)

30.58.3.11

void Fl Help View::scrollbar size ( int size ) [inline]

Sets the pixel size of the scrollbars troughs to the size, in pixels. Normally you should not need this method, and should use Fl::scrollbar_size(int) instead to manage the size of ALL your widgets scrollbars. This ensures your application has a consistent UI, is the default behavior, and is normally what you want. Only use THIS method if you really need to override the global scrollbar size. The need for this should be rare. Setting size to the special value of 0 causes the widget to track the global Fl::scrollbar_size(), which is the default. Parameters in

size Sets the scrollbar size in pixels. If 0 (default), scrollbar size tracks the global Fl::scrollbar_size()

See also Fl::scrollbar_size()

30.58.3.12

void Fl Help View::select all ( )

Selects all the text in the view. 30.58.3.13 int Fl Help View::size ( ) const [inline]

Gets the size of the help view. 30.58.3.14 void Fl Help View::size ( int W, int H ) [inline]

Changes the size of the widget. size(W, H) is a shortcut for resize(x(), y(), W, H).

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.58 Fl_Help_View Class Reference Parameters in

509

W,H new size

See also position(int,int), resize(int,int,int,int) Reimplemented from Fl_Widget. 30.58.3.15 void Fl Help View::textcolor ( Fl_Color c ) [inline]

Sets the default text color. 30.58.3.16 Fl_Color Fl Help View::textcolor ( ) const [inline] Returns the current default text color. 30.58.3.17 void Fl Help View::textfont ( Fl_Font f ) [inline]

Sets the default text font. 30.58.3.18 Fl_Font Fl Help View::textfont ( ) const [inline] Returns the current default text font. 30.58.3.19 void Fl Help View::textsize ( Fl_Fontsize s ) [inline]

Sets the default text size. 30.58.3.20 Fl_Fontsize Fl Help View::textsize ( ) const [inline] Gets the default text size. 30.58.3.21 const char Fl Help View::title ( ) [inline]

Returns the current document title, or NULL if there is no title. 30.58.3.22 void Fl Help View::topline ( const char n )

Scrolls the text to the indicated position, given a named destination. Parameters in

n target name

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

510 30.58.3.23 void Fl Help View::topline ( int top )

Class Documentation

Scrolls the text to the indicated position, given a pixel line. If the given pixel value top is out of range, then the text is scrolled to the top or bottom of the document, resp. Parameters in

top top line number in pixels (0 = start of document)

30.58.3.24

int Fl Help View::topline ( ) const [inline]

Returns the current top line in pixels.

30.58.3.25

void Fl Help View::value ( const char val )

Sets the current help text buffer to the string provided and reformats the text. The provided character string val is copied internally and will be freed when value() is called again, or when the widget is destroyed. If val is NULL, then the widget is cleared.

30.58.3.26

const char Fl Help View::value ( ) const [inline]

Returns the current buffer contents. The documentation for this class was generated from the following les:

Fl_Help_View.H Fl_Help_View.cxx

30.59

Fl Hold Browser Class Reference

The Fl_Hold_Browser is a subclass of Fl_Browser which lets the user select a single item, or no items by clicking on the empty space. #include <Fl_Hold_Browser.H> Inheritance diagram for Fl_Hold_Browser:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.60 Fl_Hor_Fill_Slider Class Reference


Fl_Widget Fl_Group Fl_Browser_ Fl_Browser Fl_Hold_Browser

511

Public Member Functions


Fl_Hold_Browser (int X, int Y, int W, int H, const char L=0)
Creates a new Fl_Hold_Browser widget using the given position, size, and label string.

30.59.1

Detailed Description

The Fl_Hold_Browser is a subclass of Fl_Browser which lets the user select a single item, or no items by clicking on the empty space. As long as the mouse button is held down the item pointed to by it is highlighted, and this highlighting remains on when the mouse button is released. Normally the callback is done when the user releases the mouse, but you can change this with when(). See Fl_Browser for methods to add and remove lines from the browser.

30.59.2
30.59.2.1

Constructor & Destructor Documentation


Fl Hold Browser::Fl Hold Browser ( int X, int Y, int W, int H, const char L = 0 ) [inline]

Creates a new Fl_Hold_Browser widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX. The constructor specializes Fl_Browser() by setting the type to FL_HOLD_BROWSER. The destructor destroys the widget and frees all memory that has been allocated. The documentation for this class was generated from the following le: Fl_Hold_Browser.H

30.60

Fl Hor Fill Slider Class Reference

Inheritance diagram for Fl_Hor_Fill_Slider:


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

512
Fl_Widget Fl_Valuator Fl_Slider Fl_Hor_Fill_Slider

Class Documentation

Public Member Functions


Fl_Hor_Fill_Slider (int x, int y, int w, int h, const char l=0) The documentation for this class was generated from the following le: Fl_Hor_Fill_Slider.H

30.61

Fl Hor Nice Slider Class Reference

Inheritance diagram for Fl_Hor_Nice_Slider:


Fl_Widget Fl_Valuator Fl_Slider Fl_Hor_Nice_Slider

Public Member Functions


Fl_Hor_Nice_Slider (int x, int y, int w, int h, const char l=0) The documentation for this class was generated from the following le: Fl_Hor_Nice_Slider.H

30.62

Fl Hor Slider Class Reference

Horizontal Slider class. #include <Fl_Hor_Slider.H>


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.63 Fl_Hor_Value_Slider Class Reference Inheritance diagram for Fl_Hor_Slider:


Fl_Widget Fl_Valuator Fl_Slider Fl_Hor_Slider

513

Public Member Functions


Fl_Hor_Slider (int X, int Y, int W, int H, const char l=0)
Creates a new Fl_Hor_Slider widget using the given position, size, and label string.

30.62.1

Detailed Description

Horizontal Slider class. See also class Fl_Slider. The documentation for this class was generated from the following le: Fl_Hor_Slider.H

30.63

Fl Hor Value Slider Class Reference

Inheritance diagram for Fl_Hor_Value_Slider:


Fl_Widget Fl_Valuator Fl_Slider Fl_Value_Slider Fl_Hor_Value_Slider

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

514

Class Documentation

Public Member Functions


Fl_Hor_Value_Slider (int X, int Y, int W, int H, const char l=0) The documentation for this class was generated from the following le: Fl_Hor_Value_Slider.H

30.64

Fl Image Class Reference

Fl_Image is the base class used for caching and drawing all kinds of images in FLTK. #include <Fl_Image.H> Inheritance diagram for Fl_Image:
Fl_Image Fl_Bitmap Fl_XBM_Image Fl_Pixmap Fl_GIF_Image Fl_XPM_Image Fl_BMP_Image Fl_RGB_Image Fl_JPEG_Image Fl_Shared_Image Fl_Tiled_Image

Fl_PNG_Image

Fl_PNM_Image

Public Member Functions


virtual void color_average (Fl_Color c, oat i)
The color_average() method averages the colors in the image with the FLTK color value c.

virtual Fl_Image copy (int W, int H)


The copy() method creates a copy of the specied image.

Fl_Image copy ()
The copy() method creates a copy of the specied image.

int count () const


The count() method returns the number of data values associated with the image.

int d () const
Returns the current image depth.

const char const data () const


Returns a pointer to the current image data array.

virtual void desaturate ()


The desaturate() method converts an image to grayscale.

virtual void draw (int X, int Y, int W, int H, int cx=0, int cy=0)
Draws the image with a bounding box.

void draw (int X, int Y)


Draws the image.

Fl_Image (int W, int H, int D)


The constructor creates an empty image with the specied width, height, and depth.

int h () const
Returns the current image height in pixels.

void inactive ()
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.64 Fl_Image Class Reference

515

The inactive() method calls color_average(FL_BACKGROUND_COLOR, 0.33f) to produce an image that appears grayed out.

virtual void label (Fl_Widget w)


The label() methods are an obsolete way to set the image attribute of a widget or menu item.

virtual void label (Fl_Menu_Item m)


The label() methods are an obsolete way to set the image attribute of a widget or menu item.

int ld () const
Returns the current line data size in bytes.

virtual void uncache ()


If the image has been cached for display, delete the cache data.

int w () const
Returns the current image width in pixels.

virtual Fl_Image ()
The destructor is a virtual method that frees all memory used by the image.

Protected Member Functions


void d (int D)
Sets the current image depth.

void data (const char const p, int c)


Sets the current array pointer and count of pointers in the array.

void draw_empty (int X, int Y)


The protected method draw_empty() draws a box with an X in it.

void h (int H)
Sets the current image height in pixels.

void ld (int LD)


Sets the current line data size in bytes.

void w (int W)
Sets the current image width in pixels.

Static Protected Member Functions


static void labeltype (const Fl_Label lo, int lx, int ly, int lw, int lh, Fl_Align la) static void measure (const Fl_Label lo, int &lw, int &lh)

30.64.1

Detailed Description

Fl_Image is the base class used for caching and drawing all kinds of images in FLTK. This class keeps track of common image data such as the pixels, colormap, width, height, and depth. Virtual methods are used to provide type-specic image handling. Since the Fl_Image class does not support image drawing by itself, calling the draw() method results in a box with an X in it being drawn instead.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

516

Class Documentation

30.64.2
30.64.2.1

Constructor & Destructor Documentation


Fl Image::Fl Image ( int W, int H, int D ) [inline]

The constructor creates an empty image with the specied width, height, and depth. The width and height are in pixels. The depth is 0 for bitmaps, 1 for pixmap (colormap) images, and 1 to 4 for color images.

30.64.3
30.64.3.1

Member Function Documentation


void Fl Image::color average ( Fl_Color c, oat i ) [virtual]

The color_average() method averages the colors in the image with the FLTK color value c. The i argument species the amount of the original image to combine with the color, so a value of 1.0 results in no color blend, and a value of 0.0 results in a constant image of the specied color. The original image data is not altered by this method. Reimplemented in Fl_RGB_Image, Fl_Shared_Image, Fl_Pixmap, and Fl_Tiled_Image.

30.64.3.2 Fl_Image Fl Image::copy ( int W, int H ) [virtual] The copy() method creates a copy of the specied image. If the width and height are provided, the image is resized to the specied size. The image should be deleted (or in the case of Fl_Shared_Image, released) when you are done with it. Reimplemented in Fl_RGB_Image, Fl_Shared_Image, Fl_Pixmap, Fl_Bitmap, and Fl_Tiled_Image.

30.64.3.3 Fl_Image Fl Image::copy ( ) [inline] The copy() method creates a copy of the specied image. If the width and height are provided, the image is resized to the specied size. The image should be deleted (or in the case of Fl_Shared_Image, released) when you are done with it. Reimplemented in Fl_RGB_Image, Fl_Shared_Image, Fl_Pixmap, Fl_Bitmap, and Fl_Tiled_Image.

30.64.3.4

int Fl Image::count ( ) const [inline]

The count() method returns the number of data values associated with the image. The value will be 0 for images with no associated data, 1 for bitmap and color images, and greater than 2 for pixmap images.

30.64.3.5

int Fl Image::d ( ) const [inline]

Returns the current image depth. The return value will be 0 for bitmaps, 1 for pixmaps, and 1 to 4 for color images.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.64 Fl_Image Class Reference 30.64.3.6 const char const Fl Image::data ( ) const [inline]

517

Returns a pointer to the current image data array. Use the count() method to nd the size of the data array.

30.64.3.7

void Fl Image::desaturate ( ) [virtual]

The desaturate() method converts an image to grayscale. If the image contains an alpha channel (depth = 4), the alpha channel is preserved. This method does not alter the original image data. Reimplemented in Fl_RGB_Image, Fl_Shared_Image, Fl_Pixmap, and Fl_Tiled_Image.

30.64.3.8

void Fl Image::draw ( int X, int Y, int W, int H, int cx = 0, int cy = 0 ) [virtual]

Draws the image with a bounding box. This form species a bounding box for the image, with the origin (upper-lefthand corner) of the image offset by the cx and cy arguments. Reimplemented in Fl_RGB_Image, Fl_Shared_Image, Fl_Pixmap, Fl_Bitmap, and Fl_Tiled_Image.

30.64.3.9

void Fl Image::draw ( int X, int Y ) [inline]

Draws the image. This form species the upper-lefthand corner of the image. Reimplemented in Fl_RGB_Image, Fl_Shared_Image, Fl_Pixmap, Fl_Bitmap, and Fl_Tiled_Image.

30.64.3.10

void Fl Image::draw empty ( int X, int Y ) [protected]

The protected method draw_empty() draws a box with an X in it. It can be used to draw any image that lacks image data.

30.64.3.11

void Fl Image::inactive ( ) [inline]

The inactive() method calls color_average(FL_BACKGROUND_COLOR, 0.33f) to produce an image that appears grayed out. This method does not alter the original image data.

30.64.3.12

void Fl Image::label ( Fl_Widget widget ) [virtual]

The label() methods are an obsolete way to set the image attribute of a widget or menu item. Use the image() or deimage() methods of the Fl_Widget and Fl_Menu_Item classes instead. Reimplemented in Fl_RGB_Image, Fl_Pixmap, and Fl_Bitmap.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

518 30.64.3.13 void Fl Image::label ( Fl_Menu_Item m ) [virtual]

Class Documentation

The label() methods are an obsolete way to set the image attribute of a widget or menu item. Use the image() or deimage() methods of the Fl_Widget and Fl_Menu_Item classes instead. Reimplemented in Fl_RGB_Image, Fl_Pixmap, and Fl_Bitmap. 30.64.3.14 int Fl Image::ld ( ) const [inline]

Returns the current line data size in bytes. Line data is extra data that is included after each line of color image data and is normally not present. 30.64.3.15 void Fl Image::uncache ( ) [virtual]

If the image has been cached for display, delete the cache data. This allows you to change the data used for the image and then redraw it without recreating an image object. Reimplemented in Fl_RGB_Image, Fl_Pixmap, Fl_Shared_Image, and Fl_Bitmap. The documentation for this class was generated from the following les: Fl_Image.H Fl_Image.cxx

30.65

Fl Input Class Reference

This is the FLTK text input widget. #include <Fl_Input.H> Inheritance diagram for Fl_Input:
Fl_Widget Fl_Input_ Fl_Input Fl_File_Input Fl_Float_Input Fl_Int_Input Fl_Multiline_Input Fl_Output Fl_Multiline_Output Fl_Secret_Input

Public Member Functions


Fl_Input (int, int, int, int, const char =0)
Creates a new Fl_Input widget using the given position, size, and label string.

int handle (int)


Handles the specied event.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.65 Fl_Input Class Reference

519

Protected Member Functions


void draw ()
Draws the widget.

30.65.1

Detailed Description

This is the FLTK text input widget. It displays a single line of text and lets the user edit it. Normally it is drawn with an inset box and a white background. The text may contain any characters, and will correctly display any UTF text, using X notation for unprintable control characters. It assumes the font can draw any characters of the used scripts, which is true for standard fonts under MSWindows and Mac OS X. Characters can be input using the keyboard or the character palette/map. Character composition is done using dead keys and/or a compose key as dened by the operating system. Mouse button 1 Moves the cursor to this point. Drag selects characters. Double click selects words. Triple click selects all line. Shift+click extends the selection. When you select text it is automatically copied to the selection buffer. Insert the selection buffer at the point clicked. You can also select a region and replace it with the selection buffer by selecting the region with mouse button 2. Currently acts like button 1. Deletes one character to the left, or deletes the selected region. Deletes one character to the right, or deletes the selected region. Combine with Shift for equivalent of X (copy+cut). May cause the callback, see when(). Table 30.183: Fl_Input keyboard and mouse bindings.

Mouse button 2

Mouse button 3 Backspace Delete

Enter

30.65.2
30.65.2.1

Constructor & Destructor Documentation


Fl Input::Fl Input ( int X, int Y, int W, int H, const char l = 0 )

Creates a new Fl_Input widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX.

30.65.3
30.65.3.1

Member Function Documentation


void Fl Input::draw ( ) [protected, virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

520

Class Documentation

If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Implements Fl_Widget. Reimplemented in Fl_File_Input. 30.65.3.2 int Fl Input::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted

See also Fl_Event Reimplemented from Fl_Widget. Reimplemented in Fl_File_Input. The documentation for this class was generated from the following les: Fl_Input.H Fl_Input.cxx

30.66

Fl Input Class Reference

This class provides a low-overhead text input eld. #include <Fl_Input_.H> Inheritance diagram for Fl_Input_:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.66 Fl_Input_ Class Reference


Fl_Widget Fl_Input_ Fl_Input Fl_File_Input Fl_Float_Input Fl_Int_Input Fl_Multiline_Input Fl_Output Fl_Multiline_Output Fl_Secret_Input

521

Public Member Functions


int copy (int clipboard)
Put the current selection into the clipboard.

int copy_cuts ()
Copies the yank buffer to the clipboard.

Fl_Color cursor_color () const


Gets the color of the cursor.

void cursor_color (Fl_Color n)


Sets the color of the cursor.

int cut ()
Deletes the current selection.

int cut (int n)


Deletes the next n bytes rounded to characters before or after the cursor.

int cut (int a, int b)


Deletes all characters between index a and b.

Fl_Input_ (int, int, int, int, const char =0)


Creates a new Fl_Input_ widget.

Fl_Char index (int i) const


Returns the character at index i.

int input_type () const


Gets the input eld type.

void input_type (int t)


Sets the input eld type.

int insert (const char t, int l=0)


Inserts text at the cursor position.

int mark () const


Gets the current selection mark.

int mark (int m)


Sets the current selection mark.

int maximum_size () const


Gets the maximum length of the input eld.

void maximum_size (int m)


Sets the maximum length of the input eld.

int position () const


Gets the position of the text cursor.

int position (int p, int m)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

522
Sets the index for the cursor and mark.

Class Documentation

int position (int p)


Set the cursor position and mark.

int readonly () const


Gets the read-only state of the input eld.

void readonly (int b)


Sets the read-only state of the input eld.

int replace (int, int, const char , int=0)


Deletes text from b to e and inserts the new string text.

void resize (int, int, int, int)


Changes the size of the widget.

int shortcut () const


Return the shortcut key associated with this widget.

void shortcut (int s)


Sets the shortcut key associated with this widget.

int size () const


Returns the number of bytes in value().

void size (int W, int H)


Sets the width and height of this widget.

int static_value (const char )


Changes the widget text.

int static_value (const char , int)


Changes the widget text.

void tab_nav (int val)


Sets whether the Tab key does focus navigation, or inserts tab characters into Fl_Multiline_Input.

int tab_nav () const


Gets whether the Tab key causes focus navigation in multiline input elds or not.

Fl_Color textcolor () const


Gets the color of the text in the input eld.

void textcolor (Fl_Color n)


Sets the color of the text in the input eld.

Fl_Font textfont () const


Gets the font of the text in the input eld.

void textfont (Fl_Font s)


Sets the font of the text in the input eld.

Fl_Fontsize textsize () const


Gets the size of the text in the input eld.

void textsize (Fl_Fontsize s)


Sets the size of the text in the input eld.

int undo ()
Undoes previous changes to the text buffer.

int value (const char )


Changes the widget text.

int value (const char , int)


Changes the widget text.

const char value () const


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.66 Fl_Input_ Class Reference


Returns the text displayed in the widget.

523

int wrap () const


Gets the word wrapping state of the input eld.

void wrap (int b)


Sets the word wrapping state of the input eld.

Fl_Input_ ()
Destroys the widget.

Protected Member Functions


void drawtext (int, int, int, int)
Draws the text in the passed bounding box.

void handle_mouse (int, int, int, int, int keepmark=0)


Handles mouse clicks and mouse moves.

int handletext (int e, int, int, int, int)


Handles all kinds of text eld related events.

int line_end (int i) const


Finds the end of a line.

int line_start (int i) const


Finds the start of a line.

int linesPerPage () void maybe_do_callback () int up_down_position (int, int keepmark=0)


Moves the cursor to the column given by up_down_pos.

int word_end (int i) const


Finds the end of a word.

int word_start (int i) const


Finds the start of a word.

int xscroll () const int yscroll () const void yscroll (int y)

30.66.1

Detailed Description

This class provides a low-overhead text input eld. This is a virtual base class below Fl_Input. It has all the same interfaces, but lacks the handle() and draw() method. You may want to subclass it if you are one of those people who likes to change how the editing keys work. It may also be useful for adding scrollbars to the input eld. This can act like any of the subclasses of Fl_Input, by setting type() to one of the following values:
#define #define #define #define #define #define #define #define #define FL_NORMAL_INPUT FL_FLOAT_INPUT FL_INT_INPUT FL_MULTILINE_INPUT FL_SECRET_INPUT FL_INPUT_TYPE FL_INPUT_READONLY FL_NORMAL_OUTPUT FL_MULTILINE_OUTPUT 0 1 2 4 5 7 8 (FL_NORMAL_INPUT | FL_INPUT_READONLY) (FL_MULTILINE_INPUT | FL_INPUT_READONLY)

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

524

Class Documentation

#define FL_INPUT_WRAP 16 #define FL_MULTILINE_INPUT_WRAP (FL_MULTILINE_INPUT | FL_INPUT_WRAP) #define FL_MULTILINE_OUTPUT_WRAP (FL_MULTILINE_INPUT | FL_INPUT_READONLY | FL_INPUT_WRAP)

All variables that represent an index into a text buffer are byte-oriented, not character oriented. Since UTF-8 characters can be up to six bytes long, simply incrementing such an index will not reliably advance to the next character in the text buffer. Indices and pointers into the text buffer should always point at a 7 bit ASCII character or the beginning of a UTF-8 character sequence. Behavior for false UTF-8 sequences and pointers into the middle of a sequence are undened. See also Fl_Text_Display, Fl_Text_Editor for more powerful text handling widgets

30.66.2
30.66.2.1

Constructor & Destructor Documentation


Fl Input ::Fl Input ( int X, int Y, int W, int H, const char l = 0 )

Creates a new Fl_Input_ widget. This function creates a new Fl_Input_ widget and adds it to the current Fl_Group. The value() is set to NULL. The default boxtype is FL_DOWN_BOX. Parameters X,Y,W,H the dimensions of the new widget l an optional label text

30.66.2.2

Fl Input ::Fl Input ( )

Destroys the widget. The destructor clears all allocated buffers and removes the widget from the parent Fl_Group.

30.66.3
30.66.3.1

Member Function Documentation


int Fl Input ::copy ( int clipboard )

Put the current selection into the clipboard. This function copies the current selection between mark() and position() into the specied clipboard. This does not replace the old clipboard contents if position() and mark() are equal. Clipboard 0 maps to the current text selection and clipboard 1 maps to the cut/paste clipboard. Parameters clipboard the clipboard destination 0 or 1

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.66 Fl_Input_ Class Reference Returns 0 if no text is selected, 1 if the selection was copied

525

See also Fl::copy(const char , int, int)

30.66.3.2

int Fl Input ::copy cuts ( )

Copies the yank buffer to the clipboard. This method copies all the previous contiguous cuts from the undo information to the clipboard. This function implements the K shortcut key. Returns 0 if the operation did not change the clipboard

See also copy(int), cut()

30.66.3.3 Fl_Color Fl Input ::cursor color ( ) const [inline] Gets the color of the cursor. Returns the current cursor color

30.66.3.4

void Fl Input ::cursor color ( Fl_Color n ) [inline]

Sets the color of the cursor. The default color for the cursor is FL_BLACK. Parameters in

n the new cursor color

30.66.3.5

int Fl Input ::cut ( ) [inline]

Deletes the current selection. This function deletes the currently selected text without storing it in the clipboard. To use the clipboard, you may call copy() rst or copy_cuts() after this call.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

526 Returns 0 if no data was copied

Class Documentation

30.66.3.6

int Fl Input ::cut ( int n ) [inline]

Deletes the next n bytes rounded to characters before or after the cursor. This function deletes the currently selected text without storing it in the clipboard. To use the clipboard, you may call copy() rst or copy_cuts() after this call. Parameters n number of bytes rounded to full characters and clamped to the buffer. A negative number will cut characters to the left of the cursor.

Returns 0 if no data was copied

30.66.3.7

int Fl Input ::cut ( int a, int b ) [inline]

Deletes all characters between index a and b. This function deletes the currently selected text without storing it in the clipboard. To use the clipboard, you may call copy() rst or copy_cuts() after this call. Parameters a,b range of bytes rounded to full characters and clamped to the buffer

Returns 0 if no data was copied

30.66.3.8

void Fl Input ::drawtext ( int X, int Y, int W, int H ) [protected]

Draws the text in the passed bounding box. If damage() & FL_DAMAGE_ALL is true, this assumes the area has already been erased to color(). Otherwise it does minimal update and erases the area itself. Parameters X,Y,W,H area that must be redrawn

30.66.3.9

void Fl Input ::handle mouse ( int X, int Y, int , int , int drag = 0 ) [protected]

Handles mouse clicks and mouse moves. Todo Add comment and parameters
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.66 Fl_Input_ Class Reference 30.66.3.10 int Fl Input ::handletext ( int event, int X, int Y, int W, int H ) [protected]

527

Handles all kinds of text eld related events. This is called by derived classes. Todo Add comment and parameters

30.66.3.11

unsigned int Fl Input ::index ( int i ) const

Returns the character at index i. This function returns the UTF-8 character at i as a ucs4 character code. Parameters in

i index into the value eld

Returns the character at index i

30.66.3.12

int Fl Input ::input type ( ) const [inline]

Gets the input eld type. Returns the current input type

30.66.3.13

void Fl Input ::input type ( int t ) [inline]

Sets the input eld type. A redraw() is required to reformat the input eld. Parameters in

t new input type

30.66.3.14

int Fl Input ::insert ( const char t, int l = 0 ) [inline]

Inserts text at the cursor position. This function inserts the string in t at the cursor position() and moves the new position and mark to the end of the inserted text. Parameters in in

t text that will be inserted l length of text, or 0 if the string is terminated by nul.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

528 Returns 0 if no text was inserted

Class Documentation

30.66.3.15

int Fl Input ::line end ( int i ) const [protected]

Finds the end of a line. This call calculates the end of a line based on the given index i. Parameters in

i starting index for the search

Returns end of the line

30.66.3.16

int Fl Input ::line start ( int i ) const [protected]

Finds the start of a line. This call calculates the start of a line based on the given index i. Parameters in

i starting index for the search

Returns start of the line

30.66.3.17

int Fl Input ::mark ( ) const [inline]

Gets the current selection mark. Returns index into the text

30.66.3.18

int Fl Input ::mark ( int m ) [inline]

Sets the current selection mark. mark(n) is the same as position(position(),n). Parameters m new index of the mark

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.66 Fl_Input_ Class Reference Returns 0 if the mark did not change

529

See also position(), position(int, int)

30.66.3.19

int Fl Input ::maximum size ( ) const [inline]

Gets the maximum length of the input eld. Todo It is not clear if this function is actually required

30.66.3.20

void Fl Input ::maximum size ( int m ) [inline]

Sets the maximum length of the input eld. Todo It is not clear if this function is actually required

30.66.3.21

int Fl Input ::position ( ) const [inline]

Gets the position of the text cursor. Returns the cursor position as an index

See also position(int, int)

30.66.3.22

int Fl Input ::position ( int p, int m )

Sets the index for the cursor and mark. The input widget maintains two pointers into the string. The position (p) is where the cursor is. The mark (m) is the other end of the selected text. If they are equal then there is no selection. Changing this does not affect the clipboard (use copy() to do that). Changing these values causes a redraw(). The new values are bounds checked. Parameters p index for the cursor position m index for the mark

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

530 Returns 0 if no positions changed

Class Documentation

See also position(int), position(), mark(int) Reimplemented from Fl_Widget. 30.66.3.23 int Fl Input ::position ( int p ) [inline]

Set the cursor position and mark. position(n) is the same as position(n, n). Parameters p new index for cursor and mark

Returns 0 if no positions changed

See also position(int, int), position(), mark(int)

30.66.3.24

int Fl Input ::readonly ( ) const [inline]

Gets the read-only state of the input eld. Returns non-zero if this widget is read-only

30.66.3.25

void Fl Input ::readonly ( int b ) [inline]

Sets the read-only state of the input eld. Parameters in

b if b is 0, the text in this widget can be edited by the user

30.66.3.26

int Fl Input ::replace ( int b, int e, const char text, int ilen = 0 )

Deletes text from b to e and inserts the new string text. All changes to the text buffer go through this function. It deletes the region between a and b (either one may be less or equal to the other), and then inserts the string text at that point and moves the mark() and
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.66 Fl_Input_ Class Reference

531

position() to the end of the insertion. Does the callback if when() & FL_WHEN_CHANGED and there is a change. Set b and e equal to not delete anything. Set text to NULL to not insert anything. ilen can be zero or strlen(text), which saves a tiny bit of time if you happen to already know the length of the insertion, or can be used to insert a portion of a string. b and e are clamped to the 0..size() range, so it is safe to pass any values. cut() and insert() are just inline functions that call replace(). Parameters in in in in

b e text ilen

beginning index of text to be deleted ending index of text to be deleted and insertion position string that will be inserted length of text or 0 for nul terminated strings

Returns 0 if nothing changed

30.66.3.27

void Fl Input ::resize ( int X, int Y, int W, int H ) [virtual]

Changes the size of the widget. This call updates the text layout so that the cursor is visible. Parameters in

X,Y,W,H new size of the widget

See also Fl_Widget::resize(int, int, int, int) Reimplemented from Fl_Widget.

30.66.3.28

int Fl Input ::shortcut ( ) const [inline]

Return the shortcut key associated with this widget. Returns shortcut keystroke

See also Fl_Button::shortcut()

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

532 30.66.3.29 void Fl Input ::shortcut ( int s ) [inline]

Class Documentation

Sets the shortcut key associated with this widget. Pressing the shortcut key gives text editing focus to this widget. Parameters in

s new shortcut keystroke

See also Fl_Button::shortcut()

30.66.3.30

int Fl Input ::size ( ) const [inline]

Returns the number of bytes in value(). This may be greater than strlen(value()) if there are nul characters in the text. Returns number of bytes in the text

30.66.3.31

void Fl Input ::size ( int W, int H ) [inline]

Sets the width and height of this widget. Parameters in

W,H new width and height

See also Fl_Widget::size(int, int) Reimplemented from Fl_Widget. 30.66.3.32 int Fl Input ::static value ( const char str )

Changes the widget text. This function changes the text and sets the mark and the point to the end of it. The string is not copied. If the user edits the string it is copied to the internal buffer then. This can save a great deal of time and memory if your program is rapidly changing the values of text elds, but this will only work if the passed string remains unchanged until either the Fl_Input is destroyed or value() is called again. Parameters in

str the new text

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.66 Fl_Input_ Class Reference Returns non-zero if the new value is different than the current one

533

30.66.3.33

int Fl Input ::static value ( const char str, int len )

Changes the widget text. This function changes the text and sets the mark and the point to the end of it. The string is not copied. If the user edits the string it is copied to the internal buffer then. This can save a great deal of time and memory if your program is rapidly changing the values of text elds, but this will only work if the passed string remains unchanged until either the Fl_Input is destroyed or value() is called again. You can use the len parameter to directly set the length if you know it already or want to put nul characters in the text. Parameters in in

str the new text len the length of the new text

Returns non-zero if the new value is different than the current one

30.66.3.34

void Fl Input ::tab nav ( int val ) [inline]

Sets whether the Tab key does focus navigation, or inserts tab characters into Fl_Multiline_Input. By default this ag is enabled to provide the normal behavior most users expect; Tab navigates focus to the next widget. To inserting an actual Tab character, users can use Ctrl-I or copy/paste. Disabling this ag gives the old FLTK behavior where Tab inserts a tab character into the text eld, in which case only the mouse can be used to navigate to the next eld. History: This ag was provided for backwards support of FLTKs old 1.1.x behavior where Tab inserts a tab character instead of navigating focus to the next widget. This behavior was unique to Fl_Multiline_Input. With the advent of Fl_Text_Editor, this old behavior has been deprecated. Parameters in

val If val is 1, Tab advances focus (default). If val is 0, Tab inserts a tab character (old FLTK behavior).

30.66.3.35

int Fl Input ::tab nav ( ) const [inline]

Gets whether the Tab key causes focus navigation in multiline input elds or not. If enabled (default), hitting Tab causes focus navigation to the next widget. If disabled, hitting Tab inserts a tab character into the text eld.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

534 Returns 1 if Tab advances focus (default), 0 if Tab inserts tab characters.

Class Documentation

See also tab_nav(int)

30.66.3.36 Fl_Color Fl Input ::textcolor ( ) const [inline] Gets the color of the text in the input eld. Returns the text color See also textcolor(Fl_Color)

30.66.3.37

void Fl Input ::textcolor ( Fl_Color n ) [inline]

Sets the color of the text in the input eld. The text color defaults to FL_FOREGROUND_COLOR. Parameters in

n new text color

See also textcolor()

30.66.3.38 Fl_Font Fl Input ::textfont ( ) const [inline] Gets the font of the text in the input eld. Returns the current Fl_Font index

30.66.3.39

void Fl Input ::textfont ( Fl_Font s ) [inline]

Sets the font of the text in the input eld. The text font defaults to FL_HELVETICA. Parameters
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.66 Fl_Input_ Class Reference

535

in

s the new text font

30.66.3.40 Fl_Fontsize Fl Input ::textsize ( ) const [inline] Gets the size of the text in the input eld. Returns the text height in pixels

30.66.3.41

void Fl Input ::textsize ( Fl_Fontsize s ) [inline]

Sets the size of the text in the input eld. The text height defaults to FL_NORMAL_SIZE. Parameters in

s the new font height in pixel units

30.66.3.42

int Fl Input ::undo ( )

Undoes previous changes to the text buffer. This call undoes a number of previous calls to replace(). Returns non-zero if any change was made.

30.66.3.43

int Fl Input ::up down position ( int i, int keepmark = 0 ) [protected]

Moves the cursor to the column given by up_down_pos. This function is helpful when implementing up and down cursor movement. It moves the cursor from the beginning of a line to the column indicated by the global variable up_down_pos in pixel units. Parameters in in Returns index to new cursor position

i index into the beginning of a line of text keepmark if set, move only the cursor, but not the mark

30.66.3.44

int Fl Input ::value ( const char str )

Changes the widget text.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

536

Class Documentation

This function changes the text and sets the mark and the point to the end of it. The string is copied to the internal buffer. Passing NULL is the same as "". Parameters in

str the new text

Returns non-zero if the new value is different than the current one See also Fl_Input_::value(const char str, int len), Fl_Input_::value() Reimplemented in Fl_File_Input. 30.66.3.45 int Fl Input ::value ( const char str, int len )

Changes the widget text. This function changes the text and sets the mark and the point to the end of it. The string is copied to the internal buffer. Passing NULL is the same as "". You can use the length parameter to directly set the length if you know it already or want to put nul characters in the text. Parameters in in

str the new text len the length of the new text

Returns non-zero if the new value is different than the current one

See also Fl_Input_::value(const char str), Fl_Input_::value() Reimplemented in Fl_File_Input. 30.66.3.46 const char Fl Input ::value ( ) const [inline]

Returns the text displayed in the widget. This function returns the current value, which is a pointer to the internal buffer and is valid only until the next event is handled. Returns pointer to an internal buffer - do not free() this

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.66 Fl_Input_ Class Reference See also Fl_Input_::value(const char)

537

30.66.3.47

int Fl Input ::word end ( int i ) const [protected]

Finds the end of a word. This call calculates the end of a word based on the given index i. Calling this function repeatedly will move forwards to the end of the text. Parameters in

i starting index for the search

Returns end of the word

30.66.3.48

int Fl Input ::word start ( int i ) const [protected]

Finds the start of a word. This call calculates the start of a word based on the given index i. Calling this function repeatedly will move backwards to the beginning of the text. Parameters in

i starting index for the search

Returns start of the word

30.66.3.49

int Fl Input ::wrap ( ) const [inline]

Gets the word wrapping state of the input eld. Word wrap is only functional with multi-line input elds.

30.66.3.50

void Fl Input ::wrap ( int b ) [inline]

Sets the word wrapping state of the input eld. Word wrap is only functional with multi-line input elds. The documentation for this class was generated from the following les: Fl_Input_.H Fl_Input_.cxx
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

538

Class Documentation

30.67

Fl Input Choice Class Reference

A combination of the input widget and a menu button. #include <Fl_Input_Choice.H> Inheritance diagram for Fl_Input_Choice:

Fl_Widget Fl_Group Fl_Input_Choice

Classes
class InputMenuButton

Public Member Functions


void add (const char s)
Adds an item to the menu.

int changed () const


Checks if the widget value changed since the last callback.

void clear ()
Removes all items from the menu.

void clear_changed ()
Marks the value of the widget as unchanged.

Fl_Boxtype down_box () const


Gets the box type of the menu button.

void down_box (Fl_Boxtype b)


Sets the box type of the menu button.

Fl_Input_Choice (int x, int y, int w, int h, const char l=0)


Creates a new Fl_Input_Choice widget using the given position, size, and label string.

Fl_Input input ()
Returns a reference to the internal Fl_Input widget.

const Fl_Menu_Item menu ()


Gets the Fl_Menu_Item array used for the menu.

void menu (const Fl_Menu_Item m)


Sets the Fl_Menu_Item array used for the menu.

Fl_Menu_Button menubutton ()
Returns a reference to the internal Fl_Menu_Button widget.

void resize (int X, int Y, int W, int H)


Resizes the Fl_Group widget and all of its children.

void set_changed ()
Marks the value of the widget as changed.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.67 Fl_Input_Choice Class Reference Fl_Color textcolor () const


Gets the encapsulated input text color attributes.

539

void textcolor (Fl_Color c)


Sets the encapsulated input text color attributes.

Fl_Font textfont () const


Gets the encapsulated input text font attributes.

void textfont (Fl_Font f)


Sets the encapsulated input text font attributes.

Fl_Fontsize textsize () const


Gets the encapsulated input size attributes.

void textsize (Fl_Fontsize s)


Sets the encapsulated input size attributes.

const char value () const


See void Fl_Input_Choice::value(const char s)

void value (const char val)


Sets or returns the input widgets current contents.

void value (int val)


See void Fl_Input_Choice::value(const char s)

30.67.1

Detailed Description

A combination of the input widget and a menu button. The user can either type into the input area, or use the menu button chooser on the right, which loads the input area with predened text. Normally it is drawn with an inset box and a white background. The application can directly access both the input and menu widgets directly, using the menubutton() and input() accessor methods.

30.67.2
30.67.2.1

Constructor & Destructor Documentation


Fl Input Choice::Fl Input Choice ( int x, int y, int w, int h, const char l = 0 ) [inline]

Creates a new Fl_Input_Choice widget using the given position, size, and label string. Inherited destructor Destroys the widget and any value associated with it.

30.67.3
30.67.3.1

Member Function Documentation


void Fl Input Choice::add ( const char s ) [inline]

Adds an item to the menu. 30.67.3.2 int Fl Input Choice::changed ( ) const [inline]

Checks if the widget value changed since the last callback. "Changed" is a ag that is turned on when the user changes the value stored in the widget. This is only used by subclasses of Fl_Widget that store values, but is in the base class so it is easier to scan all the widgets in a panel and do_callback() on the changed ones in response to an "OK" button.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

540

Class Documentation

Most widgets turn this ag off when they do the callback, and when the program sets the stored value. Return values 0 if the value did not change

See also set_changed(), clear_changed() Reimplemented from Fl_Widget. 30.67.3.3 void Fl Input Choice::clear ( ) [inline]

Removes all items from the menu. Reimplemented from Fl_Group. 30.67.3.4 void Fl Input Choice::clear changed ( ) [inline]

Marks the value of the widget as unchanged. See also changed(), set_changed() Reimplemented from Fl_Widget. 30.67.3.5 Fl_Input Fl Input Choice::input ( ) [inline] Returns a reference to the internal Fl_Input widget. 30.67.3.6 const Fl_Menu_Item Fl Input Choice::menu ( ) [inline]

Gets the Fl_Menu_Item array used for the menu. 30.67.3.7 void Fl Input Choice::menu ( const Fl_Menu_Item m ) [inline]

Sets the Fl_Menu_Item array used for the menu. 30.67.3.8 Fl_Menu_Button Fl Input Choice::menubutton ( ) [inline] Returns a reference to the internal Fl_Menu_Button widget. 30.67.3.9 void Fl Input Choice::resize ( int X, int Y, int W, int H ) [inline, virtual]

Resizes the Fl_Group widget and all of its children. The Fl_Group widget rst resizes itself, and then it moves and resizes all its children according to the rules documented for Fl_Group::resizable(Fl_Widget)
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.68 Fl_Int_Input Class Reference See also Fl_Group::resizable(Fl_Widget) Fl_Group::resizable() Fl_Widget::resize(int,int,int,int) Reimplemented from Fl_Group. 30.67.3.10 void Fl Input Choice::set changed ( ) [inline]

541

Marks the value of the widget as changed. See also changed(), clear_changed() Reimplemented from Fl_Widget. 30.67.3.11 void Fl Input Choice::value ( const char val ) [inline]

Sets or returns the input widgets current contents. The second form sets the contents using the index into the menu which you can set as an integer. Setting the value effectively chooses this menu item, and sets it as the new input text, deleting the previous text. The documentation for this class was generated from the following le: Fl_Input_Choice.H

30.68

Fl Int Input Class Reference

The Fl_Int_Input class is a subclass of Fl_Input that only allows the user to type decimal digits (or hex numbers of the form 0xaef). #include <Fl_Int_Input.H> Inheritance diagram for Fl_Int_Input:
Fl_Widget Fl_Input_ Fl_Input Fl_Int_Input

Public Member Functions


Fl_Int_Input (int X, int Y, int W, int H, const char l=0)
Creates a new Fl_Int_Input widget using the given position, size, and label string.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

542

Class Documentation

30.68.1

Detailed Description

The Fl_Int_Input class is a subclass of Fl_Input that only allows the user to type decimal digits (or hex numbers of the form 0xaef).

30.68.2
30.68.2.1

Constructor & Destructor Documentation


Fl Int Input::Fl Int Input ( int X, int Y, int W, int H, const char l = 0 ) [inline]

Creates a new Fl_Int_Input widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX. Inherited destructor destroys the widget and any value associated with it. The documentation for this class was generated from the following le: Fl_Int_Input.H

30.69

Fl JPEG Image Class Reference

The Fl_JPEG_Image class supports loading, caching, and drawing of Joint Photographic Experts Group (JPEG) File Interchange Format (JFIF) images. #include <Fl_JPEG_Image.H> Inheritance diagram for Fl_JPEG_Image:

Fl_Image Fl_RGB_Image Fl_JPEG_Image

Public Member Functions


Fl_JPEG_Image (const char lename)
The constructor loads the JPEG image from the given jpeg lename.

Fl_JPEG_Image (const char name, const unsigned char data)


The constructor loads the JPEG image from memory.

30.69.1

Detailed Description

The Fl_JPEG_Image class supports loading, caching, and drawing of Joint Photographic Experts Group (JPEG) File Interchange Format (JFIF) images. The class supports grayscale and color (RGB) JPEG image les.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.70 Fl_Label Struct Reference

543

30.69.2
30.69.2.1

Constructor & Destructor Documentation


Fl JPEG Image::Fl JPEG Image ( const char lename )

The constructor loads the JPEG image from the given jpeg lename. The inherited destructor frees all memory and server resources that are used by the image. There is no error function in this class. If the image has loaded correctly, w(), h(), and d() should return values greater zero. Parameters in

lename a full path and name pointing to a valid jpeg le.

30.69.2.2

Fl JPEG Image::Fl JPEG Image ( const char name, const unsigned char data )

The constructor loads the JPEG image from memory. Construct an image from a block of memory inside the application. Fluid offers "binary Data" chunks as a great way to add image data into the C++ source code. name_png can be NULL. If a name is given, the image is added to the list of shared images (see: Fl_Shared_Image) and will be available by that name. The inherited destructor frees all memory and server resources that are used by the image. There is no error function in this class. If the image has loaded correctly, w(), h(), and d() should return values greater zero. Parameters name A unique name or NULL data A pointer to the memory location of the JPEG image

The documentation for this class was generated from the following les: Fl_JPEG_Image.H Fl_JPEG_Image.cxx

30.70

Fl Label Struct Reference

This struct stores all information for a text or mixed graphics label. #include <Fl_Widget.H>

Public Member Functions


void draw (int, int, int, int, Fl_Align) const
Draws the label aligned to the given box.

void measure (int &w, int &h) const


Measures the size of the label.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

544

Class Documentation

Public Attributes
Fl_Align align_
alignment of label

Fl_Color color
text color

Fl_Image deimage
optional image for a deactivated label

Fl_Font font
label font used in text

Fl_Image image
optional image for an active label

Fl_Fontsize size
size of label font

uchar type
type of label.

const char value


label text

30.70.1

Detailed Description

This struct stores all information for a text or mixed graphics label. Todo For FLTK 1.3, the Fl_Label type will become a widget by itself. That way we will be avoiding a lot of code duplication by handling labels in a similar fashion to widgets containing text. We also provide an easy interface for very complex labels, containing html or vector graphics.

30.70.2
30.70.2.1

Member Function Documentation


void Fl Label::draw ( int X, int Y, int W, int H, Fl_Align align ) const

Draws the label aligned to the given box. Draws a label with arbitrary alignment in an arbitrary box. 30.70.2.2 void Fl Label::measure ( int & W, int & H ) const

Measures the size of the label. Parameters in,out

W,H : this is the requested size for the label text plus image; on return, this will contain the size needed to t the label

30.70.3

Member Data Documentation

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.71 Fl_Light_Button Class Reference 30.70.3.1 uchar Fl_Label::type type of label. See also Fl_Labeltype The documentation for this struct was generated from the following les: Fl_Widget.H _labeltype.cxx

545

30.71

Fl Light Button Class Reference

This subclass displays the "on" state by turning on a light, rather than drawing pushed in. #include <Fl_Light_Button.H> Inheritance diagram for Fl_Light_Button:
Fl_Widget Fl_Button Fl_Light_Button Fl_Check_Button Fl_Radio_Light_Button Fl_Round_Button Fl_Radio_Round_Button

Public Member Functions


Fl_Light_Button (int x, int y, int w, int h, const char l=0)
Creates a new Fl_Light_Button widget using the given position, size, and label string.

virtual int handle (int)


Handles the specied event.

Protected Member Functions


virtual void draw ()
Draws the widget.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

546

Class Documentation

30.71.1

Detailed Description

This subclass displays the "on" state by turning on a light, rather than drawing pushed in. The shape of the "light" is initially set to FL_DOWN_BOX. The color of the light when on is controlled with selection_color(), which defaults to FL_YELLOW. Buttons generate callbacks when they are clicked by the user. You control exactly when and how by changing the values for type() and when().

Figure 30.17: Fl_Light_Button

30.71.2
30.71.2.1

Constructor & Destructor Documentation


Fl Light Button::Fl Light Button ( int X, int Y, int W, int H, const char l = 0 )

Creates a new Fl_Light_Button widget using the given position, size, and label string. The destructor deletes the check button.

30.71.3
30.71.3.1

Member Function Documentation


void Fl Light Button::draw ( ) [protected, virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Reimplemented from Fl_Button. 30.71.3.2 int Fl Light Button::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.72 Fl_Line_Dial Class Reference Parameters in

547

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted

See also Fl_Event Reimplemented from Fl_Button. The documentation for this class was generated from the following les: Fl_Light_Button.H Fl_Light_Button.cxx

30.72

Fl Line Dial Class Reference

Inheritance diagram for Fl_Line_Dial:


Fl_Widget Fl_Valuator Fl_Dial Fl_Line_Dial

Public Member Functions


Fl_Line_Dial (int x, int y, int w, int h, const char l=0) The documentation for this class was generated from the following le: Fl_Line_Dial.H

30.73

Fl Mac App Menu Class Reference

Mac OS-specic class allowing to localize the application menu. #include <x.H>
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

548

Class Documentation

Static Public Attributes


static const char about = "About "
Localizable text for the "About xxx" application menu item.

static const char hide = "Hide "


Localizable text for the "Hide xxx" application menu item.

static const char hide_others = "Hide Others"


Localizable text for the "Hide Others" application menu item.

static const char print = "Print Front Window"


Localizable text for the "Print Front Window" application menu item.

static const char quit = "Quit "


Localizable text for the "Quit xxx" application menu item.

static const char services = "Services"


Localizable text for the "Services" application menu item.

static const char show = "Show All"


Localizable text for the "Show All" application menu item.

30.73.1

Detailed Description

Mac OS-specic class allowing to localize the application menu. These character strings are used to build the application menu. They can be localized at run time to any UTF-8 text by placing instructions such as this very early in the program:
Fl_Mac_App_Menu::print = "Imprimer la fentre";

30.73.2
30.73.2.1

Member Data Documentation


const char Fl_Mac_App_Menu::print = Print Front Window [static]

Localizable text for the "Print Front Window" application menu item. This menu item wont be displayed if Fl_Mac_App_Menu::print is set to an empty string. The documentation for this class was generated from the following les: mac.H Fl.cxx

30.74

Fl Menu Class Reference

Base class of all widgets that have a menu in FLTK. #include <Fl_Menu_.H> Inheritance diagram for Fl_Menu_:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.74 Fl_Menu_ Class Reference

549

Fl_Widget Fl_Menu_ Fl_Choice Fl_Menu_Bar Fl_Sys_Menu_Bar Fl_Menu_Button Fl_Input_Choice::InputMenuButton

Public Member Functions


int add (const char , int shortcut, Fl_Callback , void =0, int=0)
Adds a new menu item.

int add (const char a, const char b, Fl_Callback c, void d=0, int e=0)
See int Fl_Menu_::add(const char label, int shortcut, Fl_Callback, void user_data=0, int ags=0)

int add (const char )


This is a Forms (and SGI GL library) compatible add function, it adds many menu items, with | separating the menu items, and tab separating the menu item names from an optional shortcut string.

void clear ()
Same as menu(NULL), set the array pointer to null, indicating a zero-length menu.

int clear_submenu (int index)


Clears the specied submenu pointed to by index of all menu items.

void copy (const Fl_Menu_Item m, void user_data=0)


Sets the menu array pointer with a copy of m that will be automatically deleted.

Fl_Boxtype down_box () const


This box type is used to surround the currently-selected items in the menus.

void down_box (Fl_Boxtype b)


See Fl_Boxtype Fl_Menu_::down_box() const.

Fl_Color down_color () const


For back compatibility, same as selection_color()

void down_color (unsigned c)


For back compatibility, same as selection_color()

int nd_index (const char name) const


Find the menu item index for a given menu pathname, such as "Edit/Copy".

int nd_index (const Fl_Menu_Item item) const


Find the index the menu array for given item.

int nd_index (Fl_Callback cb) const


Find the index into the menu array for a given callback cb.

const Fl_Menu_Item nd_item (const char name)


Find the menu item for a given menu pathname, such as "Edit/Copy".

const Fl_Menu_Item nd_item (Fl_Callback )


Find the menu item for the given callback cb.

Fl_Menu_ (int, int, int, int, const char =0)


Creates a new Fl_Menu_ widget using the given position, size, and label string.

void global ()
Make the shortcuts for this menu work no matter what window has the focus when you type it.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

550

Class Documentation int insert (int index, const char , int shortcut, Fl_Callback , void =0, int=0)
Inserts a new menu item at the specied index position.

int insert (int index, const char a, const char b, Fl_Callback c, void d=0, int e=0)
See int Fl_Menu_::insert(const char label, int shortcut, Fl_Callback, void user_data=0, int ags=0)

int item_pathname (char name, int namelen, const Fl_Menu_Item nditem=0) const
Get the menu pathname for the specied menuitem.

const Fl_Menu_Item menu () const


Returns a pointer to the array of Fl_Menu_Items.

void menu (const Fl_Menu_Item m)


Sets the menu array pointer directly.

void mode (int i, int )


Sets the ags of item i.

int mode (int i) const


Gets the ags of item i.

const Fl_Menu_Item mvalue () const


Returns a pointer to the last menu item that was picked.

const Fl_Menu_Item picked (const Fl_Menu_Item )


When user picks a menu item, call this.

void remove (int)


Deletes item i from the menu.

void replace (int, const char )


Changes the text of item i.

void shortcut (int i, int s)


Changes the shortcut of item i to n.

int size () const


This returns the number of Fl_Menu_Item structures that make up the menu, correctly counting submenus.

void size (int W, int H)


Changes the size of the widget.

const Fl_Menu_Item test_shortcut ()


Returns the menu item with the entered shortcut (key value).

const char text () const


Returns the title of the last item chosen.

const char text (int i) const


Returns the title of item i.

Fl_Color textcolor () const


Get the current color of menu item labels.

void textcolor (Fl_Color c)


Sets the current color of menu item labels.

Fl_Font textfont () const


Gets the current font of menu item labels.

void textfont (Fl_Font c)


Sets the current font of menu item labels.

Fl_Fontsize textsize () const


Gets the font size of menu item labels.

void textsize (Fl_Fontsize c)


Sets the font size of menu item labels.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.74 Fl_Menu_ Class Reference int value () const


Returns the index into menu() of the last item chosen by the user.

551

int value (const Fl_Menu_Item )


The value is the index into menu() of the last item chosen by the user.

int value (int i)


The value is the index into menu() of the last item chosen by the user.

Protected Attributes
uchar alloc uchar down_box_ Fl_Color textcolor_ Fl_Font textfont_ Fl_Fontsize textsize_

30.74.1

Detailed Description

Base class of all widgets that have a menu in FLTK. Currently FLTK provides you with Fl_Menu_Button, Fl_Menu_Bar, and Fl_Choice. The class contains a pointer to an array of structures of type Fl_Menu_Item. The array may either be supplied directly by the user program, or it may be "private": a dynamically allocated array managed by the Fl_Menu_.

30.74.2
30.74.2.1

Constructor & Destructor Documentation


Fl Menu ::Fl Menu ( int X, int Y, int W, int H, const char l = 0 )

Creates a new Fl_Menu_ widget using the given position, size, and label string. menu() is initialized to null.

30.74.3
30.74.3.1

Member Function Documentation


int Fl Menu ::add ( const char label, int shortcut, Fl_Callback callback, void userdata = 0, int ags = 0 )

Adds a new menu item. Parameters in in in in in

label The text label for the menu item. shortcut Optional keyboard shortcut that can be an int or string; (FL_CTRL+a) or " a". Default 0 if none. callback Optional callback invoked when user clicks the item. Default 0 if none. userdata Optional user data passed as an argument to the callback. Default 0 if none. ags Optional ags that control the type of menu item; see below. Default is 0 for none.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

552 Returns The index into the menu() array, where the entry was added. Description

Class Documentation

If the menu array was directly set with menu(x), then copy() is done to make a private array.

Since this method can change the internal menu array, any menu item pointers or indecies the application may have cached can become stale, and should be recalculated/refreshed.

A menu items callback must not add() items to its parent menu during the callback. Detailed Description of Parameters label The menu items label. This option is required.

The characters "&", "/", "\", and "_" are treated as special characters in the label string. The "&" character species that the following character is an accelerator and will be underlined. The "\" character is used to escape the next character in the string. Labels starting with the "_" character cause a divider to be placed after that menu item.

A label of the form "File/Quit" will create the submenu "File" with a menu item called "Quit". The "/" character is ignored if it appears as the rst character of the label string, e.g. "/File/Quit".

The label string is copied to new memory and can be freed. The other arguments (including the shortcut) are copied into the menu item unchanged.

If an item exists already with that name then it is replaced with this new one. Otherwise this new one is added to the end of the correct menu or submenu. The return value is the offset into the array that the new entry was placed at. shortcut The keyboard shortcut for this menu item.

This parameter is optional, and defaults to 0 to indicate no shortcut.

The shortcut can either be a raw integer value (eg. FL_CTRL+A) or a string (eg. " c" or " 97").

Raw integer shortcuts can be a combination of keyboard chars (eg. A) and optional keyboard modiers (see Fl::event_state(), e.g. FL_SHIFT, etc). In addition, FL_COMMAND can be used to denote FL_META under Mac OS X and FL_CTRL under other platforms.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.74 Fl_Menu_ Class Reference

553

String shortcuts can be specied in one of two ways:

[#+^]<ascii_value> [#+^]<ascii_char>

e.g. "97", "^97", "+97", "#97" e.g. "a", "^a", "+a", "#a"

..where <ascii_value> is a decimal value representing an ascii character (eg. 97 is the ascii code for a), and the optional prexes enhance the value that follows. Multiple prexes must appear in the order below.
# - Alt + - Shift ^ - Control

Internally, the text shortcuts are converted to integer values using _old_shortcut(const char). callback The callback to invoke when this menu item is selected. This parameter is optional, and defaults to 0 for no callback. userdata The callbacks user data that is passed to the callback. This parameter is optional, and defaults to 0. ags These are bit ags to dene what kind of menu item this is. This parameter is optional, and defaults to 0 to dene a regular menu item. These ags can be ORed together:
FL_MENU_INACTIVE // Deactivate menu item (gray out) FL_MENU_TOGGLE // Item is a checkbox toggle (shows checkbox for on/off state) FL_MENU_VALUE // The on/off state for checkbox/radio buttons (if set, state is on) FL_MENU_RADIO // Item is a radio button (one checkbox of many can be on) FL_MENU_INVISIBLE // Item will not show up (shortcut will work) FL_SUBMENU_POINTER // Indicates user_data() is a pointer to another menu array FL_SUBMENU // This item is a submenu to other items FL_MENU_DIVIDER // Creates divider line below this item. Also ends a group of radio buttons.

Todo Raw integer shortcut needs examples. Dependent on responses to http://fltk.org/newsgroups.php?gfltk.development+v:10086 and results of STR#2344 Reimplemented in Fl_Sys_Menu_Bar.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

554 30.74.3.2 int Fl Menu ::add ( const char str )

Class Documentation

This is a Forms (and SGI GL library) compatible add function, it adds many menu items, with | separating the menu items, and tab separating the menu item names from an optional shortcut string. The passed string is split at any | characters and then add(s,0,0,0,0) is done with each section. This is often useful if you are just using the value, and is compatible with Forms and other GL programs. The section strings use the same special characters as described for the long version of add(). No items must be added to a menu during a callback to the same menu. Parameters str string containing multiple menu labels as described above

Returns the index into the menu() array, where the entry was added

30.74.3.3

void Fl Menu ::clear ( )

Same as menu(NULL), set the array pointer to null, indicating a zero-length menu. Menus must not be cleared during a callback to the same menu. Reimplemented in Fl_Sys_Menu_Bar. 30.74.3.4 int Fl Menu ::clear submenu ( int index )

Clears the specied submenu pointed to by index of all menu items. This method is useful for clearing a submenu so that it can be re-populated with new items. Example: a "File/Recent Files/..." submenu that shows the last few les that have been opened. The specied index must point to a submenu. The submenu is cleared with remove(). If the menu array was directly set with menu(x), then copy() is done to make a private array. Warning Since this method can change the internal menu array, any menu item pointers or indecies the application may have cached can become stale, and should be recalculated/refreshed. Example:
int index = menubar->find_index("File/Recent"); "File/Recent" submenu if ( index != -1 ) menubar->clear_submenu(index); menubar->add("File/Recent/Aaa"); menubar->add("File/Recent/Bbb"); [..] // get index of // clear the submenu

Parameters index The index of the submenu to be cleared

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.74 Fl_Menu_ Class Reference Returns 0 on success, -1 if the index is out of range or not a submenu

555

See also remove(int) Reimplemented in Fl_Sys_Menu_Bar. 30.74.3.5 void Fl Menu ::copy ( const Fl_Menu_Item m, void ud = 0 )

Sets the menu array pointer with a copy of m that will be automatically deleted. If userdata ud is not NULL, then all user data pointers are changed in the menus as well. See void Fl_Menu_::menu(const Fl_Menu_Item m). 30.74.3.6 Fl_Boxtype Fl Menu ::down box ( ) const [inline] This box type is used to surround the currently-selected items in the menus. If this is FL_NO_BOX then it acts like FL_THIN_UP_BOX and selection_color() acts like FL_WHITE, for back compatibility. 30.74.3.7 int Fl Menu ::nd index ( const char pathname ) const

Find the menu item index for a given menu pathname, such as "Edit/Copy". This method nds a menu items index position for the given menu pathname, also traversing submenus, but not submenu pointers. To get the menu item pointer for a pathname, use nd_item() Parameters pathname The path and name of the menu item index to nd

Returns The index of the matching item, or -1 if not found.

See also item_pathname()

30.74.3.8

int Fl Menu ::nd index ( const Fl_Menu_Item item ) const

Find the index the menu array for given item. A way to convert a menu item pointer into an index. Current implementation is fast and not expensive.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

556
// Convert an index-to-item int index = 12; const Fl_Menu_Item *item = mymenu->menu() + index; // Convert an item-to-index int index = mymenu->find_index(item); if ( index == -1 ) { ..error.. }

Class Documentation

Parameters item The item to be found

Returns The index of the item, or -1 if not found.

See also menu()

30.74.3.9

int Fl Menu ::nd index ( Fl_Callback cb ) const

Find the index into the menu array for a given callback cb. This method nds a menu items index position, also traversing submenus, but not submenu pointers. This is useful if an application uses internationalisation and a menu item can not be found using its label. This search is also much faster. Parameters cb Find the rst item with this callback

Returns The index of the item with the specic callback, or -1 if not found

See also nd_index(const char)

30.74.3.10

const Fl_Menu_Item Fl Menu ::nd item ( const char pathname )

Find the menu item for a given menu pathname, such as "Edit/Copy". This method nds a menu item in the menu array, also traversing submenus, but not submenu pointers. To get the menu items index, use nd_index(const char) Example:
Fl_Menu_Bar *menubar = new Fl_Menu_Bar(..); menubar->add("File/&Open"); menubar->add("File/&Save"); menubar->add("Edit/&Copy");
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.74 Fl_Menu_ Class Reference


// [..] Fl_Menu_Item *item; if ( ( item = (Fl_Menu_Item*)menubar->find_item("File/&Open") ) != NULL ) { item->labelcolor(FL_RED); } if ( ( item = (Fl_Menu_Item*)menubar->find_item("Edit/&Copy") ) != NULL ) { item->labelcolor(FL_GREEN); }

557

Parameters pathname The path and name of the menu item

Returns The item found, or NULL if not found

See also nd_index(const char), nd_item(Fl_Callback), item_pathname()

30.74.3.11

const Fl_Menu_Item Fl Menu ::nd item ( Fl_Callback cb )

Find the menu item for the given callback cb. This method nds a menu item in a menu array, also traversing submenus, but not submenu pointers. This is useful if an application uses internationalisation and a menu item can not be found using its label. This search is also much faster. Parameters cb nd the rst item with this callback

Returns The item found, or NULL if not found

See also nd_item(const char)

30.74.3.12

void Fl Menu ::global ( )

Make the shortcuts for this menu work no matter what window has the focus when you type it. This is done by using Fl::add_handler(). This Fl_Menu_ widget does not have to be visible (ie the window it is in can be hidden, or it does not have to be put in a window at all). Currently there can be only one global()menu. Setting a new one will replace the old one. There is no way to remove the global() setting (so dont destroy the widget!)

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

558 30.74.3.13

Class Documentation int Fl Menu ::insert ( int index, const char label, int shortcut, Fl_Callback callback, void userdata = 0, int ags = 0 )

Inserts a new menu item at the specied index position. If index is -1, the menu item is appended; same behavior as add(). To properly insert a menu item, label must be the name of the item (eg. "Quit"), and not a menu pathname (eg. "File/Quit"). If a menu pathname is specied, the value of index is ignored, the new items position dened by the pathname. For more details, see add(). Except for the index parameter, add() has more detailed information on parameters and behavior, and is functionally equivalent. Parameters in in in in in in

index The menu arrays index position where the new item is inserted. If -1, behavior is the same as add(). label The text label for the menu item. If the label is a menu pathname, index is ignored, and the pathname indicates the position of the new item. shortcut Optional keyboard shortcut. Can be an int (FL_CTRL+a) or a string (" a"). Default is 0. callback Optional callback invoked when user clicks the item. Default 0 if none. userdata Optional user data passed as an argument to the callback. Default 0 if none. ags Optional ags that control the type of menu item; see add() for more info. Default is 0 for none.

Returns The index into the menu() array, where the entry was added.

See also add() Reimplemented in Fl_Sys_Menu_Bar. 30.74.3.14 int Fl Menu ::item pathname ( char name, int namelen, const Fl_Menu_Item nditem = 0 ) const

Get the menu pathname for the specied menuitem. If nditem==NULL, mvalue() is used (the most recently picked menuitem). Example:
Fl_Menu_Bar *menubar = 0; void my_menu_callback(Fl_Widget*,void*) { char name[80]; if ( menubar->item_pathname(name, sizeof(name)-1) == 0 ) { recently picked item if ( strcmp(name, "File/&Open") == 0 ) { .. } invoked if ( strcmp(name, "File/&Save") == 0 ) { .. } invoked if ( strcmp(name, "Edit/&Copy") == 0 ) { .. }

// // open // save // copy

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.74 Fl_Menu_ Class Reference


invoked } } int main() { [..] menubar = new Fl_Menu_Bar(..); menubar->add("File/&Open", 0, my_menu_callback); menubar->add("File/&Save", 0, my_menu_callback); menubar->add("Edit/&Copy", 0, my_menu_callback); [..] }

559

Returns 0 : OK (name has menuitems pathname) -1 : item not found (name="") -2 : name not large enough (name="")

See also nd_item()

30.74.3.15

const Fl_Menu_Item Fl Menu ::menu ( ) const [inline]

Returns a pointer to the array of Fl_Menu_Items. This will either be the value passed to menu(value) or the private copy. 30.74.3.16 void Fl Menu ::menu ( const Fl_Menu_Item m )

Sets the menu array pointer directly. If the old menu is private it is deleted. NULL is allowed and acts the same as a zero-length menu. If you try to modify the array (with add(), replace(), or remove()) a private copy is automatically done. Reimplemented in Fl_Sys_Menu_Bar. 30.74.3.17 void Fl Menu ::mode ( int i, int ) [inline]

Sets the ags of item i. For a list of the ags, see Fl_Menu_Item. 30.74.3.18 int Fl Menu ::mode ( int i ) const [inline]

Gets the ags of item i. For a list of the ags, see Fl_Menu_Item. 30.74.3.19 const Fl_Menu_Item Fl Menu ::mvalue ( ) const [inline]

Returns a pointer to the last menu item that was picked.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

560 30.74.3.20 const Fl_Menu_Item Fl Menu ::picked ( const Fl_Menu_Item v )

Class Documentation

When user picks a menu item, call this. It will do the callback. Unfortunately this also casts away const for the checkboxes, but this was necessary so non-checkbox menus can really be declared const... 30.74.3.21 void Fl Menu ::remove ( int i )

Deletes item i from the menu. If the menu array was directly set with menu(x) then copy() is done to make a private array. No items must be removed from a menu during a callback to the same menu. Parameters i index into menu array Reimplemented in Fl_Sys_Menu_Bar. 30.74.3.22 void Fl Menu ::replace ( int i, const char str )

Changes the text of item i. This is the only way to get slash into an add()ed menu item. If the menu array was directly set with menu(x) then copy() is done to make a private array. Parameters i index into menu array str new label for menu item at index i Reimplemented in Fl_Sys_Menu_Bar. 30.74.3.23 void Fl Menu ::shortcut ( int i, int s ) [inline]

Changes the shortcut of item i to n. 30.74.3.24 int Fl Menu ::size ( ) const

This returns the number of Fl_Menu_Item structures that make up the menu, correctly counting submenus. This includes the "terminator" item at the end. To copy a menu array you need to copy size()sizeof(Fl_Menu_Item) bytes. If the menu is NULL this returns zero (an empty menu will return 1). 30.74.3.25 void Fl Menu ::size ( int W, int H ) [inline]

Changes the size of the widget. size(W, H) is a shortcut for resize(x(), y(), W, H).

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.74 Fl_Menu_ Class Reference Parameters in

561

W,H new size

See also position(int,int), resize(int,int,int,int) Reimplemented from Fl_Widget.

30.74.3.26

const Fl_Menu_Item Fl Menu ::test shortcut ( ) [inline]

Returns the menu item with the entered shortcut (key value). This searches the complete menu() for a shortcut that matches the entered key value. It must be called for a FL_KEYBOARD or FL_SHORTCUT event. If a match is found, the menus callback will be called. Returns matched Fl_Menu_Item or NULL. Reimplemented from Fl_Widget.

30.74.3.27

const char Fl Menu ::text ( ) const [inline]

Returns the title of the last item chosen.

30.74.3.28

const char Fl Menu ::text ( int i ) const [inline]

Returns the title of item i.

30.74.3.29 Fl_Color Fl Menu ::textcolor ( ) const [inline] Get the current color of menu item labels.

30.74.3.30

void Fl Menu ::textcolor ( Fl_Color c ) [inline]

Sets the current color of menu item labels.

30.74.3.31 Fl_Font Fl Menu ::textfont ( ) const [inline] Gets the current font of menu item labels.

30.74.3.32

void Fl Menu ::textfont ( Fl_Font c ) [inline]

Sets the current font of menu item labels.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

562 30.74.3.33 Fl_Fontsize Fl Menu ::textsize ( ) const [inline] Gets the font size of menu item labels.

Class Documentation

30.74.3.34

void Fl Menu ::textsize ( Fl_Fontsize c ) [inline]

Sets the font size of menu item labels.

30.74.3.35

int Fl Menu ::value ( ) const [inline]

Returns the index into menu() of the last item chosen by the user. It is zero initially. Reimplemented in Fl_Choice.

30.74.3.36

int Fl Menu ::value ( const Fl_Menu_Item m )

The value is the index into menu() of the last item chosen by the user. It is zero initially. You can set it as an integer, or set it with a pointer to a menu item. The set routines return non-zero if the new value is different than the old one. Reimplemented in Fl_Choice.

30.74.3.37

int Fl Menu ::value ( int i ) [inline]

The value is the index into menu() of the last item chosen by the user. It is zero initially. You can set it as an integer, or set it with a pointer to a menu item. The set routines return non-zero if the new value is different than the old one. Reimplemented in Fl_Choice. The documentation for this class was generated from the following les: Fl_Menu_.H Fl_Menu_.cxx Fl_Menu_add.cxx Fl_Menu_global.cxx

30.75

Fl Menu Bar Class Reference

This widget provides a standard menubar interface. #include <Fl_Menu_Bar.H> Inheritance diagram for Fl_Menu_Bar:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.75 Fl_Menu_Bar Class Reference


Fl_Widget Fl_Menu_ Fl_Menu_Bar Fl_Sys_Menu_Bar

563

Public Member Functions


Fl_Menu_Bar (int X, int Y, int W, int H, const char l=0)
Creates a new Fl_Menu_Bar widget using the given position, size, and label string.

int handle (int)


Handles the specied event.

Protected Member Functions


void draw ()
Draws the widget.

30.75.1

Detailed Description

This widget provides a standard menubar interface. Usually you will put this widget along the top edge of your window. The height of the widget should be 30 for the menu titles to draw correctly with the default font. The items on the bar and the menus they bring up are dened by a single Fl_Menu_Item array. Because a Fl_Menu_Item array denes a hierarchy, the top level menu denes the items in the menubar, while the submenus dene the pull-down menus. Sub-sub menus and lower pop up to the right of the submenus.

Figure 30.18: menubar

If there is an item in the top menu that is not a title of a submenu, then it acts like a "button" in the menubar. Clicking on it will pick it. When the user picks an item off the menu, the items callback is done with the menubar as the Fl_Widget argument. If the item does not have a callback the menubars callback is done instead. Submenus will also pop up in response to shortcuts indicated by putting a & character in the name eld of the menu item. If you put a & character in a top-level "button" then the shortcut picks it. The & character in submenus is ignored until the menu is popped up. Typing the shortcut() of any of the menu items will cause callbacks exactly the same as when you pick the item with the mouse.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

564

Class Documentation

30.75.2
30.75.2.1

Constructor & Destructor Documentation


Fl Menu Bar::Fl Menu Bar ( int X, int Y, int W, int H, const char l = 0 ) [inline]

Creates a new Fl_Menu_Bar widget using the given position, size, and label string. The default boxtype is FL_UP_BOX. The constructor sets menu() to NULL. See Fl_Menu_ for the methods to set or change the menu. labelsize(), labelfont(), and labelcolor() are used to control how the menubar items are drawn. They are initialized from the Fl_Menu static variables, but you can change them if desired. label() is ignored unless you change align() to put it outside the menubar. The destructor removes the Fl_Menu_Bar widget and all of its menu items.

30.75.3
30.75.3.1

Member Function Documentation


void Fl Menu Bar::draw ( ) [protected, virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Implements Fl_Widget. Reimplemented in Fl_Sys_Menu_Bar. 30.75.3.2 int Fl Menu Bar::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.76 Fl_Menu_Button Class Reference See also Fl_Event Reimplemented from Fl_Widget. The documentation for this class was generated from the following les: Fl_Menu_Bar.H Fl_Menu_Bar.cxx

565

30.76

Fl Menu Button Class Reference

This is a button that when pushed pops up a menu (or hierarchy of menus) dened by an array of Fl_Menu_Item objects. #include <Fl_Menu_Button.H> Inheritance diagram for Fl_Menu_Button:
Fl_Widget Fl_Menu_ Fl_Menu_Button Fl_Input_Choice::InputMenuButton

Public Types
enum popup_buttons { POPUP1 = 1, POPUP2, POPUP12, POPUP3, POPUP13, POPUP23, POPUP123 }
indicate what mouse buttons pop up the menu.

Public Member Functions


Fl_Menu_Button (int, int, int, int, const char =0)
Creates a new Fl_Menu_Button widget using the given position, size, and label string.

int handle (int)


Handles the specied event.

const Fl_Menu_Item popup ()


Act exactly as though the user clicked the button or typed the shortcut key.

Protected Member Functions


void draw ()
Draws the widget.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

566

Class Documentation

30.76.1

Detailed Description

This is a button that when pushed pops up a menu (or hierarchy of menus) dened by an array of Fl_Menu_Item objects.

Figure 30.19: menu_button

Normally any mouse button will pop up a menu and it is lined up below the button as shown in the picture. However an Fl_Menu_Button may also control a pop-up menu. This is done by setting the type(). If type() is zero a normal menu button is produced. If it is nonzero then this is a pop-up menu. The bits in type() indicate what mouse buttons pop up the menu (see Fl_Menu_Button::popup_buttons). The menu will also pop up in response to shortcuts indicated by putting a & character in the label(). Typing the shortcut() of any of the menu items will cause callbacks exactly the same as when you pick the item with the mouse. The & character in menu item names are only looked at when the menu is popped up, however. When the user picks an item off the menu, the items callback is done with the menu_button as the Fl_Widget argument. If the item does not have a callback the menu_buttons callback is done instead.

30.76.2
30.76.2.1

Member Enumeration Documentation


enum Fl_Menu_Button::popup_buttons

indicate what mouse buttons pop up the menu. Values for type() used to indicate what mouse buttons pop up the menu. Fl_Menu_Button::POPUP3 is usually what you want. Enumerator: POPUP1 pops up with the mouse 1st button. POPUP2 pops up with the mouse 2nd button. POPUP12 pops up with the mouse 1st or 2nd buttons.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.76 Fl_Menu_Button Class Reference POPUP3 pops up with the mouse 3rd button. POPUP13 pops up with the mouse 1st or 3rd buttons. POPUP23 pops up with the mouse 2nd or 3rd buttons. POPUP123 pops up with any mouse button.

567

30.76.3
30.76.3.1

Constructor & Destructor Documentation


Fl Menu Button::Fl Menu Button ( int X, int Y, int W, int H, const char l = 0 )

Creates a new Fl_Menu_Button widget using the given position, size, and label string. The default boxtype is FL_UP_BOX. The constructor sets menu() to NULL. See Fl_Menu_ for the methods to set or change the menu.

30.76.4
30.76.4.1

Member Function Documentation


void Fl Menu Button::draw ( ) [protected, virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Implements Fl_Widget. 30.76.4.2 int Fl Menu Button::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

568 See also Fl_Event Reimplemented from Fl_Widget. 30.76.4.3 const Fl_Menu_Item Fl Menu Button::popup ( )

Class Documentation

Act exactly as though the user clicked the button or typed the shortcut key. The menu appears, it waits for the user to pick an item, and if they pick one it sets value() and does the callback or sets changed() as described above. The menu item is returned or NULL if the user dismisses the menu. The documentation for this class was generated from the following les: Fl_Menu_Button.H Fl_Menu_Button.cxx

30.77

Fl Menu Item Struct Reference

The Fl_Menu_Item structure denes a single menu item that is used by the Fl_Menu_ class. #include <Fl_Menu_Item.H>

Public Member Functions


void activate ()
Allows a menu item to be picked.

int active () const


Gets whether or not the item can be picked.

int activevisible () const


Returns non 0 if FL_INACTIVE and FL_INVISIBLE are cleared, 0 otherwise.

int add (const char , int shortcut, Fl_Callback , void =0, int=0)
Adds an item.

int add (const char a, const char b, Fl_Callback c, void d=0, int e=0)
See int add(const char, int shortcut, Fl_Callback, void, int)

long argument () const


Gets the user_data() argument that is sent to the callback function.

void argument (long v)


Sets the user_data() argument that is sent to the callback function.

Fl_Callback_p callback () const


Returns the callback function that is set for the menu item.

void callback (Fl_Callback c, void p)


Sets the menu items callback function and userdata() argument.

void callback (Fl_Callback c)


Sets the menu items callback function.

void callback (Fl_Callback0 c)


Sets the menu items callback function.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.77 Fl_Menu_Item Struct Reference void callback (Fl_Callback1 c, long p=0)


Sets the menu items callback function and userdata() argument.

569

void check ()
back compatibility only

int checkbox () const


Returns true if a checkbox will be drawn next to this item.

int checked () const


back compatibility only

void clear ()
Turns the check or radio item "off" for the menu item.

void deactivate ()
Prevents a menu item from being picked.

void do_callback (Fl_Widget o) const


Calls the Fl_Menu_Item items callback, and provides the Fl_Widget argument.

void do_callback (Fl_Widget o, void arg) const


Calls the Fl_Menu_Item items callback, and provides the Fl_Widget argument.

void do_callback (Fl_Widget o, long arg) const


Calls the Fl_Menu_Item items callback, and provides the Fl_Widget argument.

void draw (int x, int y, int w, int h, const Fl_Menu_ , int t=0) const
Draws the menu item in bounding box x,y,w,h, optionally selects the item.

const Fl_Menu_Item nd_shortcut (int ip=0, const bool require_alt=false) const


Search only the top level menu for a shortcut.

const Fl_Menu_Item rst () const


Returns the rst menu item, same as next(0).

Fl_Menu_Item rst ()
Returns the rst menu item, same as next(0).

void hide ()
Hides an item in the menu.

void image (Fl_Image a)


compatibility api for FLUID, same as a->label(this)

void image (Fl_Image &a)


compatibility api for FLUID, same as a.label(this)

int insert (int, const char , int, Fl_Callback , void =0, int=0)
Inserts an item at position index.

const char label () const


Returns the title of the item.

void label (const char a)


See const char Fl_Menu_Item::label() const.

void label (Fl_Labeltype a, const char b)


See const char Fl_Menu_Item::label() const.

Fl_Color labelcolor () const


Gets the menu items label color.

void labelcolor (Fl_Color a)


Sets the menu items label color.

Fl_Font labelfont () const


Gets the menu items label font.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

570 void labelfont (Fl_Font a)


Sets the menu items label font.

Class Documentation

Fl_Fontsize labelsize () const


Gets the label font pixel size/height.

void labelsize (Fl_Fontsize a)


Sets the label font pixel size/height.

Fl_Labeltype labeltype () const


Returns the menu items labeltype.

void labeltype (Fl_Labeltype a)


Sets the menu items labeltype.

int measure (int h, const Fl_Menu_ ) const


Measures width of label, including effect of & characters.

const Fl_Menu_Item next (int=1) const


Advance a pointer by n items through a menu array, skipping the contents of submenus and invisible items.

Fl_Menu_Item next (int i=1)


Advances a pointer by n items through a menu array, skipping the contents of submenus and invisible items.

const Fl_Menu_Item popup (int X, int Y, const char title=0, const Fl_Menu_Item picked=0, const Fl_Menu_ =0) const
This method is called by widgets that want to display menus.

const Fl_Menu_Item pulldown (int X, int Y, int W, int H, const Fl_Menu_Item picked=0, const Fl_Menu_ =0, const Fl_Menu_Item title=0, int menubar=0) const
Pulldown() is similar to popup(), but a rectangle is provided to position the menu.

int radio () const


Returns true if this item is a radio item.

void set ()
Turns the check or radio item "on" for the menu item.

void setonly ()
Turns the radio item "on" for the menu item and turns off adjacent radio items set.

int shortcut () const


Gets what key combination shortcut will trigger the menu item.

void shortcut (int s)


Sets exactly what key combination will trigger the menu item.

void show ()
Makes an item visible in the menu.

int size () const


Size of the menu starting from this menu item.

int submenu () const


Returns true if either FL_SUBMENU or FL_SUBMENU_POINTER is on in the ags.

const Fl_Menu_Item test_shortcut () const


This is designed to be called by a widgets handle() method in response to a FL_SHORTCUT event.

void uncheck ()
back compatibility only

void user_data () const


Gets the user_data() argument that is sent to the callback function.

void user_data (void v)


Sets the user_data() argument that is sent to the callback function.

int value () const


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.77 Fl_Menu_Item Struct Reference


Returns the current value of the check or radio item.

571

int visible () const


Gets the visibility of an item.

Public Attributes
Fl_Callback callback_
menu item callback

int ags
menu item ags like FL_MENU_TOGGLE, FL_MENU_RADIO

Fl_Color labelcolor_
menu item text color

Fl_Font labelfont_
which font for this menu item text

Fl_Fontsize labelsize_
size of menu item text

uchar labeltype_
how the menu item text looks like

int shortcut_
menu item shortcut

const char text


menu item text, returned by label()

void user_data_
menu item user_data for the menus callback

30.77.1

Detailed Description

The Fl_Menu_Item structure denes a single menu item that is used by the Fl_Menu_ class.
struct Fl_Menu_Item { const char* text; // label() ulong shortcut_; Fl_Callback* callback_; void* user_data_; int flags; uchar labeltype_; uchar labelfont_; uchar labelsize_; uchar labelcolor_; }; enum { // values for flags: FL_MENU_INACTIVE = 1, // Deactivate menu item (gray out) FL_MENU_TOGGLE = 2, // Item is a checkbox toggle (shows checkbox for on/off state) FL_MENU_VALUE = 4, // The on/off state for checkbox/radio buttons (if set, state is on) FL_MENU_RADIO = 8, // Item is a radio button (one checkbox of many can be on) FL_MENU_INVISIBLE = 0x10, // Item will not show up (shortcut will work) FL_SUBMENU_POINTER = 0x20, // Indicates user_data() is a pointer to another menu array FL_SUBMENU = 0x40, // This item is a submenu to other items FL_MENU_DIVIDER = 0x80, // Creates divider line below this item. Also
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

572
ends a group of radio buttons. FL_MENU_HORIZONTAL = 0x100 // ??? -- reserved };

Class Documentation

Typically menu items are statically dened; for example:


Fl_Menu_Item popup[] = { {"&alpha", FL_ALT+a, the_cb, (void*)1}, {"&beta", FL_ALT+b, the_cb, (void*)2}, {"gamma", FL_ALT+c, the_cb, (void*)3, FL_MENU_DIVIDER}, {"&strange", 0, strange_cb}, {"&charm", 0, charm_cb}, {"&truth", 0, truth_cb}, {"b&eauty", 0, beauty_cb}, {"sub&menu", 0, 0, 0, FL_SUBMENU}, {"one"}, {"two"}, {"three"}, {0}, {"inactive", FL_ALT+i, 0, 0, FL_MENU_INACTIVE|FL_MENU_DIVIDER}, {"invisible",FL_ALT+i, 0, 0, FL_MENU_INVISIBLE}, {"check", FL_ALT+i, 0, 0, FL_MENU_TOGGLE|FL_MENU_VALUE}, {"box", FL_ALT+i, 0, 0, FL_MENU_TOGGLE}, {0}};

produces:

Figure 30.20: menu

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.77 Fl_Menu_Item Struct Reference

573

A submenu title is identied by the bit FL_SUBMENU in the ags eld, and ends with a label() that is NULL. You can nest menus to any depth. A pointer to the rst item in the submenu can be treated as an Fl_Menu array itself. It is also possible to make separate submenu arrays with FL_SUBMENU_POINTER ags. You should use the method functions to access structure members and not access them directly to avoid compatibility problems with future releases of FLTK.

30.77.2
30.77.2.1

Member Function Documentation


void Fl Menu Item::activate ( ) [inline]

Allows a menu item to be picked.

30.77.2.2

int Fl Menu Item::active ( ) const [inline]

Gets whether or not the item can be picked.

30.77.2.3

int Fl Menu Item::activevisible ( ) const [inline]

Returns non 0 if FL_INACTIVE and FL_INVISIBLE are cleared, 0 otherwise.

30.77.2.4

int Fl Menu Item::add ( const char mytext, int sc, Fl_Callback cb, void data = 0, int myags = 0 )

Adds an item. The text is split at / characters to automatically produce submenus (actually a totally unnecessary feature as you can now add submenu titles directly by setting SUBMENU in the ags):

30.77.2.5

long Fl Menu Item::argument ( ) const [inline]

Gets the user_data() argument that is sent to the callback function. For convenience you can also dene the callback as taking a long argument. This method casts the stored userdata() argument to long and returns it as a long value.

30.77.2.6

void Fl Menu Item::argument ( long v ) [inline]

Sets the user_data() argument that is sent to the callback function. For convenience you can also dene the callback as taking a long argument. This method casts the given argument v to void and stores it in the menu items userdata() member. This may not be portable to some machines.

30.77.2.7 Fl_Callback_p Fl Menu Item::callback ( ) const [inline] Returns the callback function that is set for the menu item.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

574

Class Documentation

Each item has space for a callback function and an argument for that function. Due to back compatibility, the Fl_Menu_Item itself is not passed to the callback, instead you have to get it by calling ((Fl_Menu_)w)->mvalue() where w is the widget argument. 30.77.2.8 void Fl Menu Item::callback ( Fl_Callback c, void p ) [inline]

Sets the menu items callback function and userdata() argument. See also Fl_Callback_p Fl_MenuItem::callback() const

30.77.2.9

void Fl Menu Item::callback ( Fl_Callback c ) [inline]

Sets the menu items callback function. This method does not set the userdata() argument. See also Fl_Callback_p Fl_MenuItem::callback() const

30.77.2.10

void Fl Menu Item::callback ( Fl_Callback0 c ) [inline]

Sets the menu items callback function. This method does not set the userdata() argument. See also Fl_Callback_p Fl_MenuItem::callback() const

30.77.2.11

void Fl Menu Item::callback ( Fl_Callback1 c, long p = 0 ) [inline]

Sets the menu items callback function and userdata() argument. This method does not set the userdata() argument. The argument is cast to void and stored as the userdata() for the menu items callback function. See also Fl_Callback_p Fl_MenuItem::callback() const

30.77.2.12

void Fl Menu Item::check ( ) [inline]

back compatibility only Deprecated .

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.77 Fl_Menu_Item Struct Reference 30.77.2.13 int Fl Menu Item::checkbox ( ) const [inline]

575

Returns true if a checkbox will be drawn next to this item. This is true if FL_MENU_TOGGLE or FL_MENU_RADIO is set in the ags.

30.77.2.14

int Fl Menu Item::checked ( ) const [inline]

back compatibility only Deprecated .

30.77.2.15

void Fl Menu Item::clear ( ) [inline]

Turns the check or radio item "off" for the menu item.

30.77.2.16

void Fl Menu Item::deactivate ( ) [inline]

Prevents a menu item from being picked. Note that this will also cause the menu item to appear grayed-out.

30.77.2.17

void Fl Menu Item::do callback ( Fl_Widget o ) const [inline]

Calls the Fl_Menu_Item items callback, and provides the Fl_Widget argument. The callback is called with the stored user_data() as its second argument. You must rst check that callback() is non-zero before calling this.

30.77.2.18

void Fl Menu Item::do callback ( Fl_Widget o, void arg ) const [inline]

Calls the Fl_Menu_Item items callback, and provides the Fl_Widget argument. This call overrides the callbacks second argument with the given value arg. You must rst check that callback() is non-zero before calling this.

30.77.2.19

void Fl Menu Item::do callback ( Fl_Widget o, long arg ) const [inline]

Calls the Fl_Menu_Item items callback, and provides the Fl_Widget argument. This call overrides the callbacks second argument with the given value arg. long arg is cast to void when calling the callback. You must rst check that callback() is non-zero before calling this.

30.77.2.20

void Fl Menu Item::draw ( int x, int y, int w, int h, const Fl_Menu_ m, int selected = 0 ) const

Draws the menu item in bounding box x,y,w,h, optionally selects the item.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

576 30.77.2.21

Class Documentation const Fl_Menu_Item Fl Menu Item::nd shortcut ( int ip = 0, const bool require alt = false ) const

Search only the top level menu for a shortcut. Either &x in the label or the shortcut elds are used. This tests the current event, which must be an FL_KEYBOARD or FL_SHORTCUT, against a shortcut value. Parameters ip returns the index of the item, if ip is not NULL. require_alt if true: match only if Alt key is pressed.

Returns found Fl_Menu_Item or NULL

30.77.2.22

const Fl_Menu_Item Fl Menu Item::rst ( ) const [inline]

Returns the rst menu item, same as next(0). 30.77.2.23 Fl_Menu_Item Fl Menu Item::rst ( ) [inline] Returns the rst menu item, same as next(0). 30.77.2.24 void Fl Menu Item::hide ( ) [inline]

Hides an item in the menu. 30.77.2.25 int Fl Menu Item::insert ( int index, const char mytext, int sc, Fl_Callback cb, void data = 0, int myags = 0 )

Inserts an item at position index. If index is -1, the item is added the same way as Fl_Menu_Item::add(). If mytext contains any un-escaped front slashes (/), its assumed a menu pathname is being specied, and the value of index will be ignored. In all other aspects, the behavior of insert() is the same as add(). Parameters index mytext sc cb data myags insert new items here new label string, details see above keyboard shortcut for new item callback function for new item user data for new item menu ags as described in FL_Menu_Item

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.77 Fl_Menu_Item Struct Reference Returns the index into the menu() array, where the entry was added

577

30.77.2.26

const char Fl Menu Item::label ( ) const [inline]

Returns the title of the item. A NULL here indicates the end of the menu (or of a submenu). A & in the item will print an underscore under the next letter, and if the menu is popped up that letter will be a "shortcut" to pick that item. To get a real & put two in a row. 30.77.2.27 Fl_Color Fl Menu Item::labelcolor ( ) const [inline] Gets the menu items label color. This color is passed to the labeltype routine, and is typically the color of the label text. This defaults to FL_BLACK. If this color is not black tk will not use overlay bitplanes to draw the menu - this is so that images put in the menu draw correctly. 30.77.2.28 void Fl Menu Item::labelcolor ( Fl_Color a ) [inline]

Sets the menu items label color. See also Fl_Color Fl_Menu_Item::labelcolor() const

30.77.2.29 Fl_Font Fl Menu Item::labelfont ( ) const [inline] Gets the menu items label font. Fonts are identied by small 8-bit indexes into a table. See the enumeration list for predened fonts. The default value is a Helvetica font. The function Fl::set_font() can dene new fonts. 30.77.2.30 void Fl Menu Item::labelfont ( Fl_Font a ) [inline]

Sets the menu items label font. Fonts are identied by small 8-bit indexes into a table. See the enumeration list for predened fonts. The default value is a Helvetica font. The function Fl::set_font() can dene new fonts. 30.77.2.31 Fl_Fontsize Fl Menu Item::labelsize ( ) const [inline] Gets the label font pixel size/height. 30.77.2.32 void Fl Menu Item::labelsize ( Fl_Fontsize a ) [inline]

Sets the label font pixel size/height.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

578 30.77.2.33 Fl_Labeltype Fl Menu Item::labeltype ( ) const [inline] Returns the menu items labeltype.

Class Documentation

A labeltype identies a routine that draws the label of the widget. This can be used for special effects such as emboss, or to use the label() pointer as another form of data such as a bitmap. The value FL_NORMAL_LABEL prints the label as text.

30.77.2.34

void Fl Menu Item::labeltype ( Fl_Labeltype a ) [inline]

Sets the menu items labeltype. A labeltype identies a routine that draws the label of the widget. This can be used for special effects such as emboss, or to use the label() pointer as another form of data such as a bitmap. The value FL_NORMAL_LABEL prints the label as text.

30.77.2.35

int Fl Menu Item::measure ( int hp, const Fl_Menu_ m ) const

Measures width of label, including effect of & characters. Optionally, can get height if hp is not NULL.

30.77.2.36

const Fl_Menu_Item Fl Menu Item::next ( int n = 1 ) const

Advance a pointer by n items through a menu array, skipping the contents of submenus and invisible items. There are two calls so that you can advance through const and non-const data.

30.77.2.37 Fl_Menu_Item Fl Menu Item::next ( int i = 1 ) [inline] Advances a pointer by n items through a menu array, skipping the contents of submenus and invisible items. There are two calls so that you can advance through const and non-const data.

30.77.2.38

const Fl_Menu_Item Fl Menu Item::popup ( int X, int Y, const char title = 0, const Fl_Menu_Item picked = 0, const Fl_Menu_ button = 0 ) const

This method is called by widgets that want to display menus. The menu stays up until the user picks an item or dismisses it. The selected item (or NULL if none) is returned. This does not do the callbacks or change the state of check or radio items. X,Y is the position of the mouse cursor, relative to the window that got the most recent event (usually you can pass Fl::event_x() and Fl::event_y() unchanged here). title is a character string title for the menu. If non-zero a small box appears above the menu with the title in it. The menu is positioned so the cursor is centered over the item picked. This will work even if picked is in a submenu. If picked is zero or not in the menu item table the menu is positioned with the cursor in the top-left corner. button is a pointer to an Fl_Menu_ from which the color and boxtypes for the menu are pulled. If NULL then defaults are used.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.77 Fl_Menu_Item Struct Reference 30.77.2.39

579

const Fl_Menu_Item Fl Menu Item::pulldown ( int X, int Y, int W, int H, const Fl_Menu_Item initial item = 0, const Fl_Menu_ pbutton = 0, const Fl_Menu_Item t = 0, int menubar = 0 ) const

Pulldown() is similar to popup(), but a rectangle is provided to position the menu. The menu is made at least W wide, and the picked item is centered over the rectangle (like Fl_Choice uses). If picked is zero or not found, the menu is aligned just below the rectangle (like a pulldown menu). The title and menubar arguments are used internally by the Fl_Menu_Bar widget.

30.77.2.40

int Fl Menu Item::radio ( ) const [inline]

Returns true if this item is a radio item. When a radio button is selected all "adjacent" radio buttons are turned off. A set of radio items is delimited by an item that has radio() false, or by an item with FL_MENU_DIVIDER turned on.

30.77.2.41

void Fl Menu Item::set ( ) [inline]

Turns the check or radio item "on" for the menu item. Note that this does not turn off any adjacent radio items like set_only() does.

30.77.2.42

void Fl Menu Item::setonly ( )

Turns the radio item "on" for the menu item and turns off adjacent radio items set.

30.77.2.43

int Fl Menu Item::shortcut ( ) const [inline]

Gets what key combination shortcut will trigger the menu item.

30.77.2.44

void Fl Menu Item::shortcut ( int s ) [inline]

Sets exactly what key combination will trigger the menu item. The value is a logical or of a key and a set of shift ags, for instance FL_ALT+a or FL_ALT+FL_F+10 or just a. A value of zero disables the shortcut. The key can be any value returned by Fl::event_key(), but will usually be an ASCII letter. Use a lower-case letter unless you require the shift key to be held down. The shift ags can be any set of values accepted by Fl::event_state(). If the bit is on that shift key must be pushed. Meta, Alt, Ctrl, and Shift must be off if they are not in the shift ags (zero for the other bits indicates a "dont care" setting).

30.77.2.45

void Fl Menu Item::show ( ) [inline]

Makes an item visible in the menu.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

580 30.77.2.46 int Fl Menu Item::submenu ( ) const [inline]

Class Documentation

Returns true if either FL_SUBMENU or FL_SUBMENU_POINTER is on in the ags. FL_SUBMENU indicates an embedded submenu that goes from the next item through the next one with a NULL label(). FL_SUBMENU_POINTER indicates that user_data() is a pointer to another menu array.

30.77.2.47

const Fl_Menu_Item Fl Menu Item::test shortcut ( ) const

This is designed to be called by a widgets handle() method in response to a FL_SHORTCUT event. If the current event matches one of the items shortcut, that item is returned. If the keystroke does not match any shortcuts then NULL is returned. This only matches the shortcut() elds, not the letters in the title preceeded by

30.77.2.48

void Fl Menu Item::uncheck ( ) [inline]

back compatibility only

Deprecated .

30.77.2.49

int Fl Menu Item::value ( ) const [inline]

Returns the current value of the check or radio item.

30.77.2.50

int Fl Menu Item::visible ( ) const [inline]

Gets the visibility of an item. The documentation for this struct was generated from the following les: Fl_Menu_Item.H Fl_Menu.cxx Fl_Menu_.cxx Fl_Menu_add.cxx

30.78

Fl Menu Window Class Reference

The Fl_Menu_Window widget is a window type used for menus. #include <Fl_Menu_Window.H> Inheritance diagram for Fl_Menu_Window:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.78 Fl_Menu_Window Class Reference


Fl_Widget Fl_Group Fl_Window Fl_Single_Window Fl_Menu_Window

581

Public Member Functions


void clear_overlay ()
Tells FLTK to use normal drawing planes instead of overlay planes.

void erase ()
Erases the window, does nothing if HAVE_OVERLAY is not dened cong.h.

Fl_Menu_Window (int W, int H, const char l=0)


Creates a new Fl_Menu_Window widget using the given size, and label string.

Fl_Menu_Window (int X, int Y, int W, int H, const char l=0)


Creates a new Fl_Menu_Window widget using the given position, size, and label string.

void ush ()
Forces the window to be drawn, this window is also made current and calls draw().

void hide ()
Removes the window from the screen.

unsigned int overlay ()


Tells if hardware overlay mode is set.

void set_overlay ()
Tells FLTK to use hardware overlay planes if they are available.

void show ()
Puts the window on the screen.

Fl_Menu_Window ()
Destroys the window and all of its children.

30.78.1

Detailed Description

The Fl_Menu_Window widget is a window type used for menus. By default the window is drawn in the hardware overlay planes if they are available so that the menu dont force the rest of the window to redraw.

30.78.2
30.78.2.1

Constructor & Destructor Documentation


Fl Menu Window::Fl Menu Window ( )

Destroys the window and all of its children.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

582 30.78.2.2

Class Documentation Fl Menu Window::Fl Menu Window ( int W, int H, const char l = 0 ) [inline]

Creates a new Fl_Menu_Window widget using the given size, and label string. 30.78.2.3 Fl Menu Window::Fl Menu Window ( int X, int Y, int W, int H, const char l = 0 ) [inline]

Creates a new Fl_Menu_Window widget using the given position, size, and label string.

30.78.3
30.78.3.1

Member Function Documentation


void Fl Menu Window::clear overlay ( ) [inline]

Tells FLTK to use normal drawing planes instead of overlay planes. This is usually necessary if your menu contains multi-color pixmaps. 30.78.3.2 void Fl Menu Window::ush ( ) [virtual]

Forces the window to be drawn, this window is also made current and calls draw(). Reimplemented from Fl_Single_Window. 30.78.3.3 void Fl Menu Window::hide ( ) [virtual]

Removes the window from the screen. If the window is already hidden or has not been shown then this does nothing and is harmless. Reimplemented from Fl_Window. 30.78.3.4 void Fl Menu Window::set overlay ( ) [inline]

Tells FLTK to use hardware overlay planes if they are available. 30.78.3.5 void Fl Menu Window::show ( ) [virtual]

Puts the window on the screen. Usually (on X) this has the side effect of opening the display. If the window is already shown then it is restored and raised to the top. This is really convenient because your program can call show() at any time, even if the window is already up. It also means that show() serves the purpose of raise() in other toolkits. Fl_Window::show(int argc, char argv) is used for top-level windows and allows standard arguments to be parsed from the command-line. See also Fl_Window::show(int argc, char argv) Reimplemented from Fl_Single_Window. The documentation for this class was generated from the following les:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.79 Fl_Multi_Browser Class Reference Fl_Menu_Window.H Fl_Menu_Window.cxx

583

30.79

Fl Multi Browser Class Reference

The Fl_Multi_Browser class is a subclass of Fl_Browser which lets the user select any set of the lines. #include <Fl_Multi_Browser.H> Inheritance diagram for Fl_Multi_Browser:
Fl_Widget Fl_Group Fl_Browser_ Fl_Browser Fl_Multi_Browser

Public Member Functions


Fl_Multi_Browser (int X, int Y, int W, int H, const char L=0)
Creates a new Fl_Multi_Browser widget using the given position, size, and label string.

30.79.1

Detailed Description

The Fl_Multi_Browser class is a subclass of Fl_Browser which lets the user select any set of the lines. The user interface is Macintosh style: clicking an item turns off all the others and selects that one, dragging selects all the items the mouse moves over, and shift + click toggles the items. This is different then how forms did it. Normally the callback is done when the user releases the mouse, but you can change this with when(). See Fl_Browser for methods to add and remove lines from the browser.

30.79.2
30.79.2.1

Constructor & Destructor Documentation


Fl Multi Browser::Fl Multi Browser ( int X, int Y, int W, int H, const char L = 0 ) [inline]

Creates a new Fl_Multi_Browser widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX. The constructor specializes Fl_Browser() by setting the type to FL_MULTI_BROWSER. The destructor destroys the widget and frees all memory that has been allocated. The documentation for this class was generated from the following le: Fl_Multi_Browser.H
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

584

Class Documentation

30.80

Fl Multi Label Struct Reference

Public Member Functions


void label (Fl_Widget ) void label (Fl_Menu_Item )

Public Attributes
const char labela const char labelb uchar typea uchar typeb

The documentation for this struct was generated from the following les: Fl_Multi_Label.H Fl_Multi_Label.cxx

30.81

Fl Multiline Input Class Reference

This input eld displays characters as new lines rather than J, and accepts the Return, Tab, and up and down arrow keys. #include <Fl_Multiline_Input.H> Inheritance diagram for Fl_Multiline_Input:
Fl_Widget Fl_Input_ Fl_Input Fl_Multiline_Input

Public Member Functions


Fl_Multiline_Input (int X, int Y, int W, int H, const char l=0)
Creates a new Fl_Multiline_Input widget using the given position, size, and label string.

30.81.1

Detailed Description

This input eld displays characters as new lines rather than J, and accepts the Return, Tab, and up and down arrow keys.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.82 Fl_Multiline_Output Class Reference This is for editing multiline text.

585

This is far from the nirvana of text editors, and is probably only good for small bits of text, 10 lines at most. Note that this widget does not support scrollbars or per-character color control. If you are presenting large amounts of text and need scrollbars or full color control of characters, you probably want Fl_Text_Editor instead. In FLTK 1.3.x, the default behavior of the Tab key was changed to support consistent focus navigation. To get the older FLTK 1.1.x behavior, set Fl_Input_::tab_nav() to 0. Newer programs should consider using Fl_Text_Editor.

30.81.2
30.81.2.1

Constructor & Destructor Documentation


Fl Multiline Input::Fl Multiline Input ( int X, int Y, int W, int H, const char l = 0 ) [inline]

Creates a new Fl_Multiline_Input widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX. Inherited destructor destroys the widget and any value associated with it. The documentation for this class was generated from the following le: Fl_Multiline_Input.H

30.82

Fl Multiline Output Class Reference

This widget is a subclass of Fl_Output that displays multiple lines of text. #include <Fl_Multiline_Output.H> Inheritance diagram for Fl_Multiline_Output:
Fl_Widget Fl_Input_ Fl_Input Fl_Output Fl_Multiline_Output

Public Member Functions


Fl_Multiline_Output (int X, int Y, int W, int H, const char l=0)
Creates a new Fl_Multiline_Output widget using the given position, size, and label string.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

586

Class Documentation

30.82.1

Detailed Description

This widget is a subclass of Fl_Output that displays multiple lines of text. It also displays tab characters as whitespace to the next column. Note that this widget does not support scrollbars, or per-character color control. If you are presenting large amounts of read-only text and need scrollbars, or full color control of characters, then use Fl_Text_Display. If you want to display HTML text, use Fl_Help_View.

30.82.2
30.82.2.1

Constructor & Destructor Documentation


Fl Multiline Output::Fl Multiline Output ( int X, int Y, int W, int H, const char l = 0 ) [inline]

Creates a new Fl_Multiline_Output widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX. Inherited destructor destroys the widget and any value associated with it. The documentation for this class was generated from the following le: Fl_Multiline_Output.H

30.83

Fl Native File Chooser Class Reference

This class lets an FLTK application easily and consistently access the operating systems native le chooser. #include <Fl_Native_File_Chooser.H>

Public Types
enum Option { NO_OPTIONS = 0x0000, SAVEAS_CONFIRM = 0x0001, NEW_FOLDER = 0x0002, PREVIEW = 0x0004 } enum Type { BROWSE_FILE = 0, BROWSE_DIRECTORY, BROWSE_MULTI_FILE, BROWSE_MULTI_DIRECTORY, BROWSE_SAVE_FILE, BROWSE_SAVE_DIRECTORY }

Public Member Functions


int count () const
Returns the number of lenames (or directory names) the user selected.

void directory (const char val)


Preset the directory the browser will show when opened.

const char directory () const


Returns the current preset directory() value.

const char errmsg () const


Returns a system dependent error message for the last method that failed.

const char lename () const


Return the lename the user choose.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.83 Fl_Native_File_Chooser Class Reference const char lename (int i) const


Return one of the lenames the user selected.

587

const char lter () const


Returns the lter string last set.

void lter (const char )


Sets the lename lters used for browsing.

void lter_value (int i)


Sets which lter will be initially selected.

int lter_value () const


Returns which lter value was last selected by the user.

int lters () const


Gets how many lters were available, not including "All Files".

Fl_Native_File_Chooser (int val=BROWSE_FILE)


The constructor.

void options (int)


Sets the platform specic chooser options to val.

int options () const


Gets the platform specic Fl_Native_File_Chooser::Option ags.

void preset_le (const char )


Sets the default lename for the chooser.

const char preset_le () const


Get the preset lename.

int show ()
Post the choosers dialog.

void title (const char )


Set the title of the le choosers dialog window.

const char title () const


Get the title of the le choosers dialog window.

void type (int)


Sets the current Fl_Native_File_Chooser::Type of browser.

int type () const


Gets the current Fl_Native_File_Chooser::Type of browser.

Fl_Native_File_Chooser ()
Destructor.

Static Public Attributes


static const char le_exists_message = "File exists. Are you sure you want to overwrite?"
Localizable message.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

588

Class Documentation

30.83.1

Detailed Description

This class lets an FLTK application easily and consistently access the operating systems native le chooser. Some operating systems have very complex and specic le choosers that many users want access to specically, instead of FLTKs default le chooser(s). In cases where there is no native le browser, FLTKs own le browser is used instead. To use this widget, use the following include in your code:

#include <FL/Fl_Native_File_Chooser.H>

The following example shows how to pick a single file:

// Create and post the local native file chooser #include <FL/Fl_Native_File_Chooser.H> [..] Fl_Native_File_Chooser fnfc; fnfc.title("Pick a file"); fnfc.type(Fl_Native_File_Chooser::BROWSE_FILE); fnfc.filter("Text\t*.txt\n" "C Files\t*.{cxx,h,c}"); fnfc.directory("/var/tmp"); // default directory to use // Show native chooser switch ( fnfc.show() ) { case -1: printf("ERROR: %s\n", fnfc.errmsg()); break; // ERROR case 1: printf("CANCEL\n"); break; // CANCEL default: printf("PICKED: %s\n", fnfc.filename()); break; // FILE CHOSEN }

Platform Specic Caveats

Under X windows, its best if you call Fl_File_Icon::load_system_icons() at the start of main(), to enable the nicer looking le browser widgets. Use the static public attributes of class Fl_File_Chooser to localize the browser.

Some operating systems support certain OS specic options; see Fl_Native_File_Chooser::options() for a list.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.83 Fl_Native_File_Chooser Class Reference

589

Figure 30.21: The Fl_Native_File_Chooser on different platforms

Some operating systems have very complex and specic le choosers that many users want access to specically, instead of FLTKs default le chooser(s). In cases where there is no native le browser, FLTKs own le browser is used instead. To use this widget correctly, use the following include in your code:
#include <FL/Fl_Native_File_Chooser.H>

Do not include the other Fl_Native_File_Choser_XXX.H les in your code; those are platform specic les that will be included automatically depending on your build platform. The following example shows how to pick a single file:
// Create and post the local native file chooser #include <FL/Fl_Native_File_Chooser.H> [..] Fl_Native_File_Chooser fnfc; fnfc.title("Pick a file"); fnfc.type(Fl_Native_File_Chooser::BROWSE_FILE); fnfc.filter("Text\t*.txt\n" "C Files\t*.{cxx,h,c}"); fnfc.directory("/var/tmp"); // default directory to use // Show native chooser switch ( fnfc.show() ) { case -1: printf("ERROR: %s\n", fnfc.errmsg()); break; // ERROR case 1: printf("CANCEL\n"); break; // CANCEL default: printf("PICKED: %s\n", fnfc.filename()); break; // FILE CHOSEN }

Platform Specic Caveats Under X windows, its best if you call Fl_File_Icon::load_system_icons() at the start of main(), to enable the nicer looking le browser widgets. Use the static public attributes of class Fl_File_Chooser to localize the browser.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

590

Class Documentation Some operating systems support certain OS specic options; see Fl_Native_File_Chooser::options() for a list.

Figure 30.22: The Fl_Native_File_Chooser on different platforms

30.83.2
30.83.2.1

Member Enumeration Documentation


enum Fl_Native_File_Chooser::Option

Enumerator: NO_OPTIONS no options enabled SAVEAS_CONFIRM Show native Save As overwrite conrm dialog (if supported) NEW_FOLDER Show New Folder icon (if supported) PREVIEW enable preview mode

30.83.2.2

enum Fl_Native_File_Chooser::Type

Enumerator: BROWSE_FILE browse les (lets user choose one le) BROWSE_DIRECTORY browse directories (lets user choose one directory) BROWSE_MULTI_FILE browse les (lets user choose multiple les) BROWSE_MULTI_DIRECTORY browse directories (lets user choose multiple directories) BROWSE_SAVE_FILE browse to save a le BROWSE_SAVE_DIRECTORY browse to save a directory
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.83 Fl_Native_File_Chooser Class Reference

591

30.83.3
30.83.3.1

Constructor & Destructor Documentation


Fl Native File Chooser::Fl Native File Chooser ( int val = BROWSE FILE )

The constructor. Internally allocates the native widgets. Optional val presets the type of browser this will be, which can also be changed with type().

30.83.3.2 Destructor.

Fl Native File Chooser::Fl Native File Chooser ( )

Deallocates any resources allocated to this widget.

30.83.4
30.83.4.1

Member Function Documentation


int Fl Native File Chooser::count ( ) const

Returns the number of lenames (or directory names) the user selected. Example:
if ( fnfc->show() == 0 ) { // Print all filenames user selected for (int n=0; n<fnfc->count(); n++ ) { printf("%d) %s\n", n, fnfc->filename(n)); } }

30.83.4.2

void Fl Native File Chooser::directory ( const char val )

Preset the directory the browser will show when opened. If val is NULL, or no directory is specied, the chooser will attempt to use the last non-cancelled folder.

30.83.4.3

const char Fl Native File Chooser::errmsg ( ) const

Returns a system dependent error message for the last method that failed. This message should at least be agged to the user in a dialog box, or to some kind of error log. Contents will be valid only for methods that document errmsg() will have info on failures.

30.83.4.4

const char Fl Native File Chooser::lename ( ) const

Return the lename the user choose. Use this if only expecting a single lename. If more than one lename is expected, use lename(int) instead. Return value may be "" if no lename was chosen (eg. user cancelled).
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

592 30.83.4.5 const char Fl Native File Chooser::lename ( int i ) const

Class Documentation

Return one of the lenames the user selected. Use count() to determine how many lenames the user selected. Example:
if ( fnfc->show() == 0 ) { // Print all filenames user selected for (int n=0; n<fnfc->count(); n++ ) { printf("%d) %s\n", n, fnfc->filename(n)); } }

30.83.4.6

const char Fl Native File Chooser::lter ( ) const

Returns the lter string last set. Can be NULL if no lter was set. 30.83.4.7 void Fl Native File Chooser::lter ( const char val )

Sets the lename lters used for browsing. The default is NULL, which browses all les. The lter string can be any of: A single wildcard (eg. ".txt") Multiple wildcards (eg. ".{cxx,h,H}") A descriptive name followed by a "\t" and a wildcard (eg. "Text Files\t.txt") A list of separate wildcards with a "\n" between each (eg. ".{cxx,H}\n.txt") A list of descriptive names and wildcards (eg. "C++ Files\t.{cxx,H}\nTxt Files\t.txt") The format of each lter is a wildcard, or an optional user description followed by \t and the wildcard. On most platforms, each lter is available to the user via a pulldown menu in the le chooser. The All Files option is always available to the user. 30.83.4.8 void Fl Native File Chooser::lter value ( int val )

Sets which lter will be initially selected. The rst lter is indexed as 0. If lter_value()==lters(), then "All Files" was chosen. If lter_value() > lters(), then a custom lter was set. 30.83.4.9 int Fl Native File Chooser::lter value ( ) const

Returns which lter value was last selected by the user. This is only valid if the chooser returns success.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.83 Fl_Native_File_Chooser Class Reference 30.83.4.10 void Fl Native File Chooser::options ( int val )

593

Sets the platform specic chooser options to val. val is expected to be one or more Fl_Native_File_Chooser::Option ags ORed together. Some platforms have OS-specic functions that can be enabled/disabled via this method.
Flag Mac -------------------NEW_FOLDER Used PREVIEW Ignored SAVEAS_CONFIRM Used Description Other ----------------------------------------------------Shows the New Folder button. Used Enables the Preview mode by default. Used Confirm dialog if BROWSE_SAVE_FILE file exists. Used Win ------Ignored Ignored Ignored

30.83.4.11

void Fl Native File Chooser::preset le ( const char val )

Sets the default lename for the chooser. Use directory() to set the default directory. Mainly used to preset the lename for save dialogs, and on most platforms can be used for opening les as well. 30.83.4.12 int Fl Native File Chooser::show ( )

Post the choosers dialog. Blocks until dialog has been completed or cancelled. Returns 0 -- user picked a le 1 -- user cancelled -1 -- failed; errmsg() has reason

30.83.4.13

void Fl Native File Chooser::title ( const char val )

Set the title of the le choosers dialog window. Can be NULL if no title desired. The default title varies according to the platform, so you are advised to set the title explicitly. 30.83.4.14 const char Fl Native File Chooser::title ( ) const

Get the title of the le choosers dialog window. Return value may be NULL if no title was set. The documentation for this class was generated from the following les: Fl_Native_File_Chooser.H Fl_Native_File_Chooser.cxx Fl_Native_File_Chooser_FLTK.cxx
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

594

Class Documentation

30.84

Fl Nice Slider Class Reference

Inheritance diagram for Fl_Nice_Slider:


Fl_Widget Fl_Valuator Fl_Slider Fl_Nice_Slider

Public Member Functions


Fl_Nice_Slider (int x, int y, int w, int h, const char l=0) The documentation for this class was generated from the following le: Fl_Nice_Slider.H

30.85

Fl Output Class Reference

This widget displays a piece of text. #include <Fl_Output.H> Inheritance diagram for Fl_Output:
Fl_Widget Fl_Input_ Fl_Input Fl_Output Fl_Multiline_Output

Public Member Functions


Fl_Output (int X, int Y, int W, int H, const char l=0)
Creates a new Fl_Output widget using the given position, size, and label string.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.85 Fl_Output Class Reference

595

30.85.1

Detailed Description

This widget displays a piece of text. When you set the value() , Fl_Output does a strcpy() to its own storage, which is useful for programgenerated values. The user may select portions of the text using the mouse and paste the contents into other elds or programs.

Figure 30.23: Fl_Output

There is a single subclass, Fl_Multiline_Output, which allows you to display multiple lines of text. Fl_Multiline_Output does not provide scroll bars. If a more complete text editing widget is needed, use Fl_Text_Display instead. The text may contain any characters except \0, and will correctly display anything, using X notation for unprintable control characters and \nnn notation for unprintable characters with the high bit set. It assumes the font can draw any characters in the ISO-Latin1 character set.

30.85.2
30.85.2.1

Constructor & Destructor Documentation


Fl Output::Fl Output ( int X, int Y, int W, int H, const char l = 0 ) [inline]

Creates a new Fl_Output widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX. Inherited destructor destroys the widget and any value associated with it. The documentation for this class was generated from the following le: Fl_Output.H

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

596

Class Documentation

30.86

Fl Overlay Window Class Reference

This window provides double buffering and also the ability to draw the "overlay" which is another picture placed on top of the main image. #include <Fl_Overlay_Window.H> Inheritance diagram for Fl_Overlay_Window:
Fl_Widget Fl_Group Fl_Window Fl_Double_Window Fl_Overlay_Window

Public Member Functions


int can_do_overlay () Fl_Overlay_Window (int W, int H, const char l=0)
Creates a new Fl_Overlay_Window widget using the given position, size, and label (title) string.

Fl_Overlay_Window (int X, int Y, int W, int H, const char l=0)


See Fl_Overlay_Window::Fl_Overlay_Window(int W, int H, const char l=0)

void ush ()
Forces the window to be redrawn.

void hide ()
Removes the window from the screen.

void redraw_overlay ()
Call this to indicate that the overlay data has changed and needs to be redrawn.

void resize (int, int, int, int)


Changes the size and position of the window.

void show ()
Puts the window on the screen.

void show (int a, char b)


Puts the window on the screen and parses command-line arguments.

Fl_Overlay_Window ()
Destroys the window and all child widgets.

Friends
class _Fl_Overlay
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.86 Fl_Overlay_Window Class Reference

597

30.86.1

Detailed Description

This window provides double buffering and also the ability to draw the "overlay" which is another picture placed on top of the main image. The overlay is designed to be a rapidly-changing but simple graphic such as a mouse selection box. Fl_Overlay_Window uses the overlay planes provided by your graphics hardware if they are available. If no hardware support is found the overlay is simulated by drawing directly into the on-screen copy of the double-buffered window, and "erased" by copying the backbuffer over it again. This means the overlay will blink if you change the image in the window.

30.86.2
30.86.2.1

Constructor & Destructor Documentation


Fl Overlay Window::Fl Overlay Window ( int W, int H, const char l = 0 ) [inline]

Creates a new Fl_Overlay_Window widget using the given position, size, and label (title) string. If the positions (x,y) are not given, then the window manager will choose them.

30.86.3
30.86.3.1

Member Function Documentation


void Fl Overlay Window::hide ( ) [virtual]

Removes the window from the screen. If the window is already hidden or has not been shown then this does nothing and is harmless. Reimplemented from Fl_Double_Window.

30.86.3.2

void Fl Overlay Window::redraw overlay ( )

Call this to indicate that the overlay data has changed and needs to be redrawn. The overlay will be clear until the rst time this is called, so if you want an initial display you must call this after calling show().

30.86.3.3

void Fl Overlay Window::resize ( int , int , int , int ) [virtual]

Changes the size and position of the window. If shown() is true, these changes are communicated to the window server (which may refuse that size and cause a further resize). If shown() is false, the size and position are used when show() is called. See Fl_Group for the effect of resizing on the child widgets. You can also call the Fl_Widget methods size(x,y) and position(w,h), which are inline wrappers for this virtual function. A top-level window can not force, but merely suggest a position and size to the operating system. The window manager may not be willing or able to display a window at the desired position or with the given dimensions. It is up to the application developer to verify window parameters after the resize request. Reimplemented from Fl_Double_Window.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

598 30.86.3.4 void Fl Overlay Window::show ( ) [virtual]

Class Documentation

Puts the window on the screen. Usually (on X) this has the side effect of opening the display. If the window is already shown then it is restored and raised to the top. This is really convenient because your program can call show() at any time, even if the window is already up. It also means that show() serves the purpose of raise() in other toolkits. Fl_Window::show(int argc, char argv) is used for top-level windows and allows standard arguments to be parsed from the command-line. See also Fl_Window::show(int argc, char argv) Reimplemented from Fl_Double_Window. 30.86.3.5 void Fl Overlay Window::show ( int argc, char argv ) [inline]

Puts the window on the screen and parses command-line arguments. Usually (on X) this has the side effect of opening the display. This form should be used for top-level windows, at least for the rst (main) window. It allows standard arguments to be parsed from the command-line. You can use argc and argv from main(int argc, char argv) for this call. The rst call also sets up some system-specic internal variables like the system colors. Todo explain which system parameters are set up.

Parameters argc command-line argument count, usually from main() argv command-line argument vector, usually from main()

See also virtual void Fl_Window::show() Reimplemented from Fl_Double_Window. The documentation for this class was generated from the following les: Fl_Overlay_Window.H Fl_Overlay_Window.cxx

30.87

Fl Pack Class Reference

This widget was designed to add the functionality of compressing and aligning widgets. #include <Fl_Pack.H>
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.87 Fl_Pack Class Reference Inheritance diagram for Fl_Pack:

599

Fl_Widget Fl_Group Fl_Pack

Public Types
enum { VERTICAL = 0, HORIZONTAL = 1 }

Public Member Functions


Fl_Pack (int x, int y, int w, int h, const char l=0)
Creates a new Fl_Pack widget using the given position, size, and label string.

uchar horizontal () const


Same as Fl_Group::type()

int spacing () const


Gets the number of extra pixels of blank space that are added between the children.

void spacing (int i)


Sets the number of extra pixels of blank space that are added between the children.

Protected Member Functions


void draw ()
Draws the widget.

30.87.1

Detailed Description

This widget was designed to add the functionality of compressing and aligning widgets. If type() is Fl_Pack::HORIZONTAL all the children are resized to the height of the Fl_Pack, and are moved next to each other horizontally. If type() is not Fl_Pack::HORIZONTAL then the children are resized to the width and are stacked below each other. Then the Fl_Pack resizes itself to surround the child widgets. This widget is needed for the Fl_Tabs. In addition you may want to put the Fl_Pack inside an Fl_Scroll. The resizable for Fl_Pack is set to NULL by default. See also: Fl_Group::resizable()

30.87.2
30.87.2.1

Constructor & Destructor Documentation


Fl Pack::Fl Pack ( int X, int Y, int W, int H, const char l = 0 )

Creates a new Fl_Pack widget using the given position, size, and label string.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

600 The default boxtype is FL_NO_BOX.

Class Documentation

The destructor also deletes all the children. This allows a whole tree to be deleted at once, without having to keep a pointer to all the children in the user code. A kludge has been done so the Fl_Pack and all of its children can be automatic (local) variables, but you must declare the Fl_Packrst, so that it is destroyed last.

30.87.3
30.87.3.1

Member Function Documentation


void Fl Pack::draw ( ) [protected, virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Reimplemented from Fl_Group. The documentation for this class was generated from the following les: Fl_Pack.H Fl_Pack.cxx

30.88

Fl Paged Device Class Reference

Represents page-structured drawing surfaces. #include <Fl_Paged_Device.H> Inheritance diagram for Fl_Paged_Device:
Fl_Device Fl_Surface_Device Fl_Paged_Device Fl_PostScript_File_Device Fl_PostScript_Printer Fl_Printer Fl_System_Printer

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.88 Fl_Paged_Device Class Reference

601

Classes
struct page_format
width, height and name of a page format

Public Types
enum Page_Format { A0 = 0, A1, A2, A3, A4, A5, A6, A7, A8, A9, B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, C5E, DLE, EXECUTIVE, FOLIO, LEDGER, LEGAL, LETTER, TABLOID, ENVELOPE, MEDIA = 0x1000 }
Possible page formats.

enum Page_Layout { PORTRAIT = 0, LANDSCAPE = 0x100, REVERSED = 0x200, ORIENTATION = 0x300 }


Possible page layouts.

Public Member Functions


const char class_name ()
Returns the name of the class of this object.

virtual void end_job (void)


To be called at the end of a print job.

virtual int end_page (void)


To be called at the end of each page.

virtual void margins (int left, int top, int right, int bottom)
Computes the dimensions of margins that lie between the printable page area and the full page.

virtual void origin (int x, int y)


Sets the position in page coordinates of the origin of graphics functions.

virtual void origin (int x, int y)


Computes the page coordinates of the current origin of graphics functions.

virtual void print_widget (Fl_Widget widget, int delta_x=0, int delta_y=0)


Draws the widget on the printed page.

void print_window (Fl_Window win, int x_offset=0, int y_offset=0)


Prints a window with its title bar and frame if any.

virtual void print_window_part (Fl_Window win, int x, int y, int w, int h, int delta_x=0, int delta_y=0)
Prints a rectangular part of an on-screen window.

virtual int printable_rect (int w, int h)


Computes the width and height of the printable area of the page.

virtual void rotate (oat angle)


Rotates the graphics operations relatively to paper.

virtual void scale (oat scale_x, oat scale_y=0.)


Changes the scaling of page coordinates.

virtual int start_job (int pagecount, int frompage=NULL, int topage=NULL)


Starts a print job.

virtual int start_page (void)


Starts a new printed page.

virtual void translate (int x, int y)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

602
Translates the current graphics origin accounting for the current rotation.

Class Documentation

virtual void untranslate (void)


Undoes the effect of a previous translate() call.

Static Public Attributes


static const char class_id = "Fl_Paged_Device"
A string that identies each subclass of Fl_Device.

static const page_format page_formats [NO_PAGE_FORMATS]


width, height and name of all elements of the enum Page_Format.

Protected Member Functions


Fl_Paged_Device ()
The constructor.

virtual Fl_Paged_Device ()
The destructor.

Protected Attributes
int x_offset
horizontal offset to the origin of graphics coordinates

int y_offset
vertical offset to the origin of graphics coordinates

30.88.1

Detailed Description

Represents page-structured drawing surfaces. This class has no public constructor: dont instantiate it; use Fl_Printer or Fl_PostScript_File_Device instead.

30.88.2
30.88.2.1

Member Enumeration Documentation


enum Fl_Paged_Device::Page_Format

Possible page formats. All paper formats with pre-dened width and height. Enumerator: A0 A0 format. A4 A4 format. LETTER Letter format.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.88 Fl_Paged_Device Class Reference 30.88.2.2 enum Fl_Paged_Device::Page_Layout

603

Possible page layouts. Enumerator: PORTRAIT Portrait orientation. LANDSCAPE Landscape orientation. REVERSED Reversed orientation. ORIENTATION orientation

30.88.3
30.88.3.1

Member Function Documentation


const char Fl Paged Device::class name ( ) [inline, virtual]

Returns the name of the class of this object. The class of an instance of an Fl_Device subclass can be checked with code such as:
if ( instance->class_name() == Fl_Printer::class_id ) { ... }

Reimplemented from Fl_Surface_Device. Reimplemented in Fl_PostScript_File_Device, Fl_Printer, Fl_PostScript_Printer, and Fl_System_Printer. 30.88.3.2 int Fl Paged Device::end page ( void ) [virtual]

To be called at the end of each page. Returns 0 if OK, non-zero if any error. Reimplemented in Fl_PostScript_File_Device, Fl_Printer, and Fl_System_Printer. 30.88.3.3 void Fl Paged Device::margins ( int left, int top, int right, int bottom ) [virtual]

Computes the dimensions of margins that lie between the printable page area and the full page. Values are in the same unit as that used by FLTK drawing functions. They are changed by scale() calls. Parameters out out out out

left top right bottom

If non-null, left is set to the left margin size. If non-null, top is set to the top margin size. If non-null, right is set to the right margin size. If non-null, bottom is set to the bottom margin size.

Reimplemented in Fl_PostScript_File_Device, Fl_Printer, and Fl_System_Printer.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

604 30.88.3.4 void Fl Paged Device::origin ( int x, int y ) [virtual]

Class Documentation

Sets the position in page coordinates of the origin of graphics functions. Arguments should be expressed relatively to the result of a previous printable_rect() call. That is, printable_rect(&w, &h); origin(w/2, 0); sets the graphics origin at the top center of the page printable area. Origin() calls are not affected by rotate() calls. Successive origin() calls dont combine their effects. Parameters in in

x Horizontal position in page coordinates of the desired origin of graphics functions. y Same as above, vertically.

Reimplemented in Fl_PostScript_File_Device, Fl_Printer, and Fl_System_Printer. 30.88.3.5 void Fl Paged Device::origin ( int x, int y ) [virtual]

Computes the page coordinates of the current origin of graphics functions. Parameters out out

x If non-null, x is set to the horizontal page offset of graphics origin. y Same as above, vertically.

Reimplemented in Fl_PostScript_File_Device, Fl_Printer, and Fl_System_Printer. 30.88.3.6 void Fl Paged Device::print widget ( Fl_Widget widget, int delta x = 0, int delta y = 0 ) [virtual]

Draws the widget on the printed page. The widgets position on the printed page is determined by the last call to origin() and by the optional delta_x and delta_y arguments. Its dimensions are in points unless there was a previous call to scale(). Parameters in in in

widget Any FLTK widget (e.g., standard, custom, window). delta_x Optional horizontal offset for positioning the widget relatively to the current origin of graphics functions. delta_y Same as above, vertically.

Reimplemented in Fl_Printer.

30.88.3.7

void Fl Paged Device::print window ( Fl_Window win, int x offset = 0, int y offset = 0 )

Prints a window with its title bar and frame if any. x_offset and y_offset are optional coordinates of where to position the window top left. Equivalent to print_widget() if win is a subwindow or has no border. Use Fl_Window::decorated_w() and Fl_Window::decorated_h() to get the size of the printed window.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.88 Fl_Paged_Device Class Reference 30.88.3.8 void Fl Paged Device::print window part ( Fl_Window win, int x, int y, int w, int h, int delta x = 0, int delta y = 0 ) [virtual]

605

Prints a rectangular part of an on-screen window. Parameters The window from where to capture. The rectangle left The rectangle top The rectangle width The rectangle height Optional horizontal offset from current graphics origin where to print the captured rectangle. delta_y As above, vertically. win x y w h delta_x Reimplemented in Fl_Printer. 30.88.3.9 int Fl Paged Device::printable rect ( int w, int h ) [virtual]

Computes the width and height of the printable area of the page. Values are in the same unit as that used by FLTK drawing functions, are unchanged by calls to origin(), but are changed by scale() calls. Values account for the user-selected paper type and print orientation. Returns 0 if OK, non-zero if any error Reimplemented in Fl_PostScript_File_Device, Fl_Printer, and Fl_System_Printer. 30.88.3.10 void Fl Paged Device::rotate ( oat angle ) [virtual]

Rotates the graphics operations relatively to paper. The rotation is centered on the current graphics origin. Successive rotate() calls dont combine their effects. Parameters angle Rotation angle in counter-clockwise degrees. Reimplemented in Fl_PostScript_File_Device, Fl_Printer, and Fl_System_Printer.

30.88.3.11

void Fl Paged Device::scale ( oat scale x, oat scale y = 0. ) [virtual]

Changes the scaling of page coordinates. This function also resets the origin of graphics functions at top left of printable page area. After a scale() call, do a printable_rect() call to get the new dimensions of the printable page area. Successive scale() calls dont combine their effects.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

606

Class Documentation

Parameters scale_x Horizontal dimensions of plot are multiplied by this quantity. scale_y Same as above, vertically. The value 0. is equivalent to setting scale_y = scale_x. Thus, scale(factor); is equivalent to scale(factor, factor); Reimplemented in Fl_PostScript_File_Device, Fl_Printer, and Fl_System_Printer. 30.88.3.12 int Fl Paged Device::start job ( int pagecount, int frompage = NULL, int topage = NULL ) [virtual]

Starts a print job. Parameters in out out

pagecount the total number of pages of the job frompage if non-null, frompage is set to the rst page the user wants printed topage if non-null, topage is set to the last page the user wants printed

Returns 0 if OK, non-zero if any error Reimplemented in Fl_Printer, Fl_PostScript_Printer, and Fl_System_Printer. 30.88.3.13 int Fl Paged Device::start page ( void ) [virtual]

Starts a new printed page. The page coordinates are initially in points, i.e., 1/72 inch, and with origin at the top left of the printable page area. Returns 0 if OK, non-zero if any error Reimplemented in Fl_PostScript_File_Device, Fl_Printer, and Fl_System_Printer. 30.88.3.14 void Fl Paged Device::translate ( int x, int y ) [virtual]

Translates the current graphics origin accounting for the current rotation. This function is only useful after a rotate() call. Each translate() call must be matched by an untranslate() call. Successive translate() calls add up their effects. Reimplemented in Fl_PostScript_File_Device, Fl_Printer, and Fl_System_Printer.

30.88.4
30.88.4.1

Member Data Documentation


const char Fl_Paged_Device::class_id = Fl Paged Device [static]

A string that identies each subclass of Fl_Device.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.89 Fl_Pixmap Class Reference Function class_name() applied to a device of this class returns this string. Reimplemented from Fl_Surface_Device.

607

Reimplemented in Fl_PostScript_File_Device, Fl_Printer, Fl_PostScript_Printer, and Fl_System_Printer. The documentation for this class was generated from the following les: Fl_Paged_Device.H Fl_Paged_Device.cxx

30.89

Fl Pixmap Class Reference

The Fl_Pixmap class supports caching and drawing of colormap (pixmap) images, including transparency. #include <Fl_Pixmap.H> Inheritance diagram for Fl_Pixmap:
Fl_Image Fl_Pixmap Fl_GIF_Image Fl_XPM_Image

Public Member Functions


virtual void color_average (Fl_Color c, oat i)
The color_average() method averages the colors in the image with the FLTK color value c.

virtual Fl_Image copy (int W, int H)


The copy() method creates a copy of the specied image.

Fl_Image copy ()
The copy() method creates a copy of the specied image.

virtual void desaturate ()


The desaturate() method converts an image to grayscale.

virtual void draw (int X, int Y, int W, int H, int cx=0, int cy=0)
Draws the image with a bounding box.

void draw (int X, int Y)


Draws the image.

Fl_Pixmap (char const D)


The constructors create a new pixmap from the specied XPM data.

Fl_Pixmap (uchar const D)


The constructors create a new pixmap from the specied XPM data.

Fl_Pixmap (const char const D)


The constructors create a new pixmap from the specied XPM data.

Fl_Pixmap (const uchar const D)


The constructors create a new pixmap from the specied XPM data.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

608 virtual void label (Fl_Widget w)

Class Documentation

The label() methods are an obsolete way to set the image attribute of a widget or menu item.

virtual void label (Fl_Menu_Item m)


The label() methods are an obsolete way to set the image attribute of a widget or menu item.

virtual void uncache ()


If the image has been cached for display, delete the cache data.

virtual Fl_Pixmap ()
The destructor free all memory and server resources that are used by the pixmap.

Public Attributes
int alloc_data

Protected Member Functions


void measure ()

Friends
class Fl_GDI_Graphics_Driver class Fl_Quartz_Graphics_Driver class Fl_Xlib_Graphics_Driver

30.89.1

Detailed Description

The Fl_Pixmap class supports caching and drawing of colormap (pixmap) images, including transparency.

30.89.2
30.89.2.1

Constructor & Destructor Documentation


Fl Pixmap::Fl Pixmap ( char const D ) [inline, explicit]

The constructors create a new pixmap from the specied XPM data. 30.89.2.2 Fl Pixmap::Fl Pixmap ( uchar const D ) [inline, explicit]

The constructors create a new pixmap from the specied XPM data. 30.89.2.3 Fl Pixmap::Fl Pixmap ( const char const D ) [inline, explicit]

The constructors create a new pixmap from the specied XPM data. 30.89.2.4 Fl Pixmap::Fl Pixmap ( const uchar const D ) [inline, explicit]

The constructors create a new pixmap from the specied XPM data.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.89 Fl_Pixmap Class Reference

609

30.89.3
30.89.3.1

Member Function Documentation


void Fl Pixmap::color average ( Fl_Color c, oat i ) [virtual]

The color_average() method averages the colors in the image with the FLTK color value c. The i argument species the amount of the original image to combine with the color, so a value of 1.0 results in no color blend, and a value of 0.0 results in a constant image of the specied color. The original image data is not altered by this method. Reimplemented from Fl_Image.

30.89.3.2 Fl_Image Fl Pixmap::copy ( int W, int H ) [virtual] The copy() method creates a copy of the specied image. If the width and height are provided, the image is resized to the specied size. The image should be deleted (or in the case of Fl_Shared_Image, released) when you are done with it. Reimplemented from Fl_Image.

30.89.3.3 Fl_Image Fl Pixmap::copy ( ) [inline] The copy() method creates a copy of the specied image. If the width and height are provided, the image is resized to the specied size. The image should be deleted (or in the case of Fl_Shared_Image, released) when you are done with it. Reimplemented from Fl_Image.

30.89.3.4

void Fl Pixmap::desaturate ( ) [virtual]

The desaturate() method converts an image to grayscale. If the image contains an alpha channel (depth = 4), the alpha channel is preserved. This method does not alter the original image data. Reimplemented from Fl_Image.

30.89.3.5

void Fl Pixmap::draw ( int X, int Y, int W, int H, int cx = 0, int cy = 0 ) [virtual]

Draws the image with a bounding box. This form species a bounding box for the image, with the origin (upper-lefthand corner) of the image offset by the cx and cy arguments. Reimplemented from Fl_Image.

30.89.3.6

void Fl Pixmap::draw ( int X, int Y ) [inline]

Draws the image. This form species the upper-lefthand corner of the image. Reimplemented from Fl_Image.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

610 30.89.3.7 void Fl Pixmap::label ( Fl_Widget widget ) [virtual]

Class Documentation

The label() methods are an obsolete way to set the image attribute of a widget or menu item. Use the image() or deimage() methods of the Fl_Widget and Fl_Menu_Item classes instead. Reimplemented from Fl_Image.

30.89.3.8

void Fl Pixmap::label ( Fl_Menu_Item m ) [virtual]

The label() methods are an obsolete way to set the image attribute of a widget or menu item. Use the image() or deimage() methods of the Fl_Widget and Fl_Menu_Item classes instead. Reimplemented from Fl_Image.

30.89.3.9

void Fl Pixmap::uncache ( ) [virtual]

If the image has been cached for display, delete the cache data. This allows you to change the data used for the image and then redraw it without recreating an image object. Reimplemented from Fl_Image. The documentation for this class was generated from the following les: Fl_Pixmap.H Fl_Pixmap.cxx

30.90

Fl Plugin Class Reference

Fl_Plugin allows link-time and run-time integration of binary modules. #include <Fl_Plugin.H> Inheritance diagram for Fl_Plugin:

Fl_Plugin Fl_Device_Plugin

Public Member Functions


Fl_Plugin (const char klass, const char name)
Create a plugin.

virtual Fl_Plugin ()
Clear the plugin and remove it from the database.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.91 Fl_Plugin_Manager Class Reference

611

30.90.1

Detailed Description

Fl_Plugin allows link-time and run-time integration of binary modules. Fl_Plugin and Fl_Plugin_Manager provide a small and simple solution for linking C++ classes at run-time, or optionally linking modules at compile time without the need to change the main application. Fl_Plugin_Manager uses static initialisation to create the plugin interface early during startup. Plugins are stored in a temporary database, organized in classes. Plugins should derive a new class from Fl_Plugin as a base:
class My_Plugin : public Fl_Plugin { public: My_Plugin() : Fl_Plugin("effects", "blur") { } void do_something(...); }; My_Plugin blur_plugin();

Plugins can be put into modules and either linked before distribution, or loaded from dynamically linkable les. An Fl_Plugin_Manager is used to list and access all currently loaded plugins.
Fl_Plugin_Manager mgr("effects"); int i, n = mgr.plugins(); for (i=0; i<n; i++) { My_Plugin *pin = (My_Plugin*)mgr.plugin(i); pin->do_something(); }

30.90.2
30.90.2.1

Constructor & Destructor Documentation


Fl Plugin::Fl Plugin ( const char klass, const char name )

Create a plugin. Parameters in in

klass plugins are grouped in classes name every plugin should have a unique name

The documentation for this class was generated from the following les:

Fl_Plugin.H Fl_Preferences.cxx

30.91

Fl Plugin Manager Class Reference

Fl_Plugin_Manager manages link-time and run-time plugin binaries. #include <Fl_Plugin.H> Inheritance diagram for Fl_Plugin_Manager:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

612

Class Documentation

Fl_Preferences Fl_Plugin_Manager

Public Member Functions


Fl_Preferences::ID addPlugin (const char name, Fl_Plugin plugin)
This function adds a new plugin to the database.

Fl_Plugin_Manager (const char klass)


Manage all plugins belonging to one class.

Fl_Plugin plugin (int index)


Return the address of a plugin by index.

Fl_Plugin plugin (const char name)


Return the address of a plugin by name.

int plugins ()
Return the number of plugins in the klass.

Fl_Plugin_Manager ()
Remove the plugin manager.

Static Public Member Functions


static int load (const char lename)
Load a module from disk.

static int loadAll (const char lepath, const char pattern=0)


Use this function to load a whole directory full of modules.

static void removePlugin (Fl_Preferences::ID id)


Remove any plugin.

30.91.1

Detailed Description

Fl_Plugin_Manager manages link-time and run-time plugin binaries. See also Fl_Plugin

30.91.2
30.91.2.1

Constructor & Destructor Documentation


Fl Plugin Manager::Fl Plugin Manager ( )

Remove the plugin manager. Calling this does not remove the database itself or any plugins. It just removes the reference to the database.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.92 Fl_PNG_Image Class Reference

613

30.91.3

Member Function Documentation

30.91.3.1 Fl_Preferences::ID Fl Plugin Manager::addPlugin ( const char name, Fl_Plugin plugin ) This function adds a new plugin to the database. There is no need to call this function explicitly. Every Fl_Plugin constructor will call this function at initialization time. 30.91.3.2 int Fl Plugin Manager::load ( const char lename ) [static]

Load a module from disk. A module must be a dynamically linkable le for the given operating system. When loading a module, its +init function will be called which in turn calls the constructor of all statically initialized Fl_Plugin classes and adds them to the database. 30.91.3.3 void Fl Plugin Manager::removePlugin ( Fl_Preferences::ID id ) [static]

Remove any plugin. There is no need to call this function explicitly. Every Fl_Plugin destructor will call this function at destruction time. The documentation for this class was generated from the following les: Fl_Plugin.H Fl_Preferences.cxx

30.92

Fl PNG Image Class Reference

The Fl_PNG_Image class supports loading, caching, and drawing of Portable Network Graphics (PNG) image les. #include <Fl_PNG_Image.H> Inheritance diagram for Fl_PNG_Image:

Fl_Image Fl_RGB_Image Fl_PNG_Image

Public Member Functions


Fl_PNG_Image (const char lename)
The constructor loads the named PNG image from the given png lename.

Fl_PNG_Image (const char name_png, const unsigned char buffer, int datasize)
Constructor that reads a PNG image from memory.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

614

Class Documentation

30.92.1

Detailed Description

The Fl_PNG_Image class supports loading, caching, and drawing of Portable Network Graphics (PNG) image les. The class loads colormapped and full-color images and handles color- and alpha-based transparency.

30.92.2
30.92.2.1

Constructor & Destructor Documentation


Fl PNG Image::Fl PNG Image ( const char lename )

The constructor loads the named PNG image from the given png lename. The destructor frees all memory and server resources that are used by the image. Parameters in

lename Name of PNG le to read

30.92.2.2

Fl PNG Image::Fl PNG Image ( const char name png, const unsigned char buffer, int maxsize )

Constructor that reads a PNG image from memory. Construct an image from a block of memory inside the application. Fluid offers "binary Data" chunks as a great way to add image data into the C++ source code. name_png can be NULL. If a name is given, the image is added to the list of shared images (see: Fl_Shared_Image) and will be available by that name. Parameters name_png A name given to this image or NULL buffer Pointer to the start of the PNG image in memory maxsize Size in bytes of the memory buffer containing the PNG image

The documentation for this class was generated from the following les:

Fl_PNG_Image.H Fl_PNG_Image.cxx

30.93

Fl PNM Image Class Reference

The Fl_PNM_Image class supports loading, caching, and drawing of Portable Anymap (PNM, PBM, PGM, PPM) image les. #include <Fl_PNM_Image.H> Inheritance diagram for Fl_PNM_Image:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.94 Fl_Positioner Class Reference

615

Fl_Image Fl_RGB_Image Fl_PNM_Image

Public Member Functions


Fl_PNM_Image (const char lename)
The constructor loads the named PNM image.

30.93.1

Detailed Description

The Fl_PNM_Image class supports loading, caching, and drawing of Portable Anymap (PNM, PBM, PGM, PPM) image les. The class loads bitmap, grayscale, and full-color images in both ASCII and binary formats.

30.93.2
30.93.2.1

Constructor & Destructor Documentation


Fl PNM Image::Fl PNM Image ( const char name )

The constructor loads the named PNM image. The inherited destructor free all memory and server resources that are used by the image. The documentation for this class was generated from the following les: Fl_PNM_Image.H Fl_PNM_Image.cxx

30.94

Fl Positioner Class Reference

This class is provided for Forms compatibility. #include <Fl_Positioner.H> Inheritance diagram for Fl_Positioner:

Fl_Widget Fl_Positioner

Public Member Functions


Fl_Positioner (int x, int y, int w, int h, const char l=0)
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

616

Class Documentation
Creates a new Fl_Positioner widget using the given position, size, and label string.

int handle (int)


Handles the specied event.

int value (double, double)


Returns the current position in x and y.

void xbounds (double, double)


Sets the X axis bounds.

double xmaximum () const


Gets the X axis maximum.

void xmaximum (double a)


Same as xbounds(xminimum(), a)

double xminimum () const


Gets the X axis minimum.

void xminimum (double a)


Same as xbounds(a, xmaximum())

void xstep (double a)


Sets the stepping value for the X axis.

double xvalue () const


Gets the X axis coordinate.

int xvalue (double)


Sets the X axis coordinate.

void ybounds (double, double)


Sets the Y axis bounds.

double ymaximum () const


Gets the Y axis maximum.

void ymaximum (double a)


Same as ybounds(ymininimum(), a)

double yminimum () const


Gets the Y axis minimum.

void yminimum (double a)


Same as ybounds(a, ymaximum())

void ystep (double a)


Sets the stepping value for the Y axis.

double yvalue () const


Gets the Y axis coordinate.

int yvalue (double)


Sets the Y axis coordinate.

Protected Member Functions


void draw (int, int, int, int) void draw ()
Draws the widget.

int handle (int, int, int, int, int)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.94 Fl_Positioner Class Reference

617

30.94.1

Detailed Description

This class is provided for Forms compatibility. It provides 2D input. It would be useful if this could be put atop another widget so that the crosshairs are on top, but this is not implemented. The color of the crosshairs is selection_color().

Figure 30.24: Fl_Positioner

30.94.2
30.94.2.1

Constructor & Destructor Documentation


Fl Positioner::Fl Positioner ( int X, int Y, int W, int H, const char l = 0 )

Creates a new Fl_Positioner widget using the given position, size, and label string. The default boxtype is FL_NO_BOX.

30.94.3
30.94.3.1

Member Function Documentation


void Fl Positioner::draw ( ) [protected, virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Implements Fl_Widget. 30.94.3.2 int Fl Positioner::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

618 Parameters in

Class Documentation

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted

See also Fl_Event Reimplemented from Fl_Widget. 30.94.3.3 int Fl Positioner::value ( double X, double Y )

Returns the current position in x and y. 30.94.3.4 void Fl Positioner::xbounds ( double a, double b )

Sets the X axis bounds. 30.94.3.5 void Fl Positioner::xstep ( double a ) [inline]

Sets the stepping value for the X axis. 30.94.3.6 double Fl Positioner::xvalue ( ) const [inline]

Gets the X axis coordinate. 30.94.3.7 int Fl Positioner::xvalue ( double X )

Sets the X axis coordinate. 30.94.3.8 void Fl Positioner::ybounds ( double a, double b )

Sets the Y axis bounds. 30.94.3.9 void Fl Positioner::ystep ( double a ) [inline]

Sets the stepping value for the Y axis. 30.94.3.10 double Fl Positioner::yvalue ( ) const [inline]

Gets the Y axis coordinate.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.95 Fl_PostScript_File_Device Class Reference 30.94.3.11 int Fl Positioner::yvalue ( double Y )

619

Sets the Y axis coordinate. The documentation for this class was generated from the following les: Fl_Positioner.H Fl_Positioner.cxx

30.95

Fl PostScript File Device Class Reference

To send graphical output to a PostScript le. #include <Fl_PostScript.H> Inheritance diagram for Fl_PostScript_File_Device:
Fl_Device Fl_Surface_Device Fl_Paged_Device Fl_PostScript_File_Device Fl_PostScript_Printer

Public Member Functions


const char class_name ()
Returns the name of the class of this object.

void end_job (void)


To be called at the end of a print job.

int end_page (void)


To be called at the end of each page.

Fl_PostScript_File_Device ()
The constructor.

void margins (int left, int top, int right, int bottom)
Computes the dimensions of margins that lie between the printable page area and the full page.

void origin (int x, int y)


Computes the page coordinates of the current origin of graphics functions.

void origin (int x, int y)


Sets the position in page coordinates of the origin of graphics functions.

int printable_rect (int w, int h)


Computes the width and height of the printable area of the page.

void rotate (oat angle)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

620
Rotates the graphics operations relatively to paper.

Class Documentation

void scale (oat scale_x, oat scale_y=0.)


Changes the scaling of page coordinates.

int start_job (int pagecount, enum Fl_Paged_Device::Page_Format format=Fl_Paged_Device::A4, enum Fl_Paged_Device::Page_Layout layout=Fl_Paged_Device::PORTRAIT)
Begins the session where all graphics requests will go to a local PostScript le.

int start_job (FILE ps_output, int pagecount, enum Fl_Paged_Device::Page_Format format=Fl_Paged_Device::A4, enum Fl_Paged_Device::Page_Layout layout=Fl_Paged_Device::PORTRAIT)
Begins the session where all graphics requests will go to FILE pointer.

int start_page (void)


Starts a new printed page.

void translate (int x, int y)


Translates the current graphics origin accounting for the current rotation.

void untranslate (void)


Undoes the effect of a previous translate() call.

Fl_PostScript_File_Device ()
The destructor.

Static Public Attributes


static const char class_id = "Fl_PostScript_File_Device"
A string that identies each subclass of Fl_Device.

static const char le_chooser_title = "Select a .ps le"


Label of the PostScript le chooser window.

Protected Member Functions


Fl_PostScript_Graphics_Driver driver ()
Returns the PostScript driver of this drawing surface.

30.95.1

Detailed Description

To send graphical output to a PostScript le.

30.95.2
30.95.2.1

Member Function Documentation


const char Fl PostScript File Device::class name ( ) [inline, virtual]

Returns the name of the class of this object. The class of an instance of an Fl_Device subclass can be checked with code such as:
if ( instance->class_name() == Fl_Printer::class_id ) { ... }

Reimplemented from Fl_Paged_Device. Reimplemented in Fl_PostScript_Printer.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.95 Fl_PostScript_File_Device Class Reference 30.95.2.2 int Fl PostScript File Device::end page ( void ) [virtual]

621

To be called at the end of each page. Returns 0 if OK, non-zero if any error. Reimplemented from Fl_Paged_Device. 30.95.2.3 void Fl PostScript File Device::margins ( int left, int top, int right, int bottom ) [virtual]

Computes the dimensions of margins that lie between the printable page area and the full page. Values are in the same unit as that used by FLTK drawing functions. They are changed by scale() calls. Parameters out out out out

left top right bottom

If non-null, left is set to the left margin size. If non-null, top is set to the top margin size. If non-null, right is set to the right margin size. If non-null, bottom is set to the bottom margin size.

Reimplemented from Fl_Paged_Device. 30.95.2.4 void Fl PostScript File Device::origin ( int x, int y ) [virtual]

Computes the page coordinates of the current origin of graphics functions. Parameters out out

x If non-null, x is set to the horizontal page offset of graphics origin. y Same as above, vertically.

Reimplemented from Fl_Paged_Device. 30.95.2.5 void Fl PostScript File Device::origin ( int x, int y ) [virtual]

Sets the position in page coordinates of the origin of graphics functions. Arguments should be expressed relatively to the result of a previous printable_rect() call. That is, printable_rect(&w, &h); origin(w/2, 0); sets the graphics origin at the top center of the page printable area. Origin() calls are not affected by rotate() calls. Successive origin() calls dont combine their effects. Parameters in in

x Horizontal position in page coordinates of the desired origin of graphics functions. y Same as above, vertically.

Reimplemented from Fl_Paged_Device.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

622 30.95.2.6

Class Documentation int Fl PostScript File Device::printable rect ( int w, int h ) [virtual]

Computes the width and height of the printable area of the page. Values are in the same unit as that used by FLTK drawing functions, are unchanged by calls to origin(), but are changed by scale() calls. Values account for the user-selected paper type and print orientation. Returns 0 if OK, non-zero if any error Reimplemented from Fl_Paged_Device. 30.95.2.7 void Fl PostScript File Device::rotate ( oat angle ) [virtual]

Rotates the graphics operations relatively to paper. The rotation is centered on the current graphics origin. Successive rotate() calls dont combine their effects. Parameters angle Rotation angle in counter-clockwise degrees. Reimplemented from Fl_Paged_Device. 30.95.2.8 void Fl PostScript File Device::scale ( oat scale x, oat scale y = 0. ) [virtual]

Changes the scaling of page coordinates. This function also resets the origin of graphics functions at top left of printable page area. After a scale() call, do a printable_rect() call to get the new dimensions of the printable page area. Successive scale() calls dont combine their effects. Parameters scale_x Horizontal dimensions of plot are multiplied by this quantity. scale_y Same as above, vertically. The value 0. is equivalent to setting scale_y = scale_x. Thus, scale(factor); is equivalent to scale(factor, factor); Reimplemented from Fl_Paged_Device. 30.95.2.9 int Fl PostScript File Device::start job ( int pagecount, enum Fl_Paged_Device::Page_Format format = Fl Paged Device::A4, enum Fl_Paged_Device::Page_Layout layout = Fl Paged Device::PORTRAIT )

Begins the session where all graphics requests will go to a local PostScript le. Opens a le dialog entitled with Fl_PostScript_File_Device::le_chooser_title to select an output PostScript le. Parameters pagecount The total number of pages to be created. format Desired page format. layout Desired page layout.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.95 Fl_PostScript_File_Device Class Reference Returns 0 if OK, 1 if user cancelled the le dialog, 2 if fopen failed on user-selected output le.

623

30.95.2.10

int Fl PostScript File Device::start job ( FILE ps output, int pagecount, enum Fl_Paged_Device::Page_Format format = Fl Paged Device::A4, enum Fl_Paged_Device::Page_Layout layout = Fl Paged Device::PORTRAIT )

Begins the session where all graphics requests will go to FILE pointer. Parameters ps_output A writable FILE pointer that will receive PostScript output and that should not be closed until after end_job() has been called. pagecount The total number of pages to be created. format Desired page format. layout Desired page layout.

Returns always 0.

30.95.2.11

int Fl PostScript File Device::start page ( void ) [virtual]

Starts a new printed page. The page coordinates are initially in points, i.e., 1/72 inch, and with origin at the top left of the printable page area. Returns 0 if OK, non-zero if any error Reimplemented from Fl_Paged_Device. 30.95.2.12 void Fl PostScript File Device::translate ( int x, int y ) [virtual]

Translates the current graphics origin accounting for the current rotation. This function is only useful after a rotate() call. Each translate() call must be matched by an untranslate() call. Successive translate() calls add up their effects. Reimplemented from Fl_Paged_Device.

30.95.3
30.95.3.1

Member Data Documentation


const char Fl_PostScript_File_Device::class_id = Fl PostScript File Device [static]

A string that identies each subclass of Fl_Device. Function class_name() applied to a device of this class returns this string. Reimplemented from Fl_Paged_Device.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

624 Reimplemented in Fl_PostScript_Printer. The documentation for this class was generated from the following les: Fl_PostScript.H Fl_PostScript.cxx

Class Documentation

30.96

Fl PostScript Graphics Driver Class Reference

PostScript graphical backend. #include <Fl_PostScript.H> Inheritance diagram for Fl_PostScript_Graphics_Driver:

Fl_Device Fl_Graphics_Driver Fl_PostScript_Graphics_Driver

Public Member Functions


void arc (double x, double y, double r, double start, double a)
see _arc(double x, double y, double r, double start, double end).

void arc (int x, int y, int w, int h, double a1, double a2)
see _arc(int x, int y, int w, int h, double a1, double a2).

void begin_complex_polygon ()
see _begin_complex_polygon().

void begin_line ()
see _begin_line().

void begin_loop ()
see _begin_loop().

void begin_points ()
see _begin_points().

void begin_polygon ()
see _begin_polygon().

void circle (double x, double y, double r)


see _circle(double x, double y, double r).

const char class_name ()


Returns the name of the class of this object.

int clip_box (int x, int y, int w, int h, int &X, int &Y, int &W, int &H)
see _clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H).

void color (Fl_Color c)


see _color(Fl_Color c).

void color (uchar r, uchar g, uchar b)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.96 Fl_PostScript_Graphics_Driver Class Reference


see _color(uchar r, uchar g, uchar b).

625

void curve (double x, double y, double x1, double y1, double x2, double y2, double x3, double y3)
see _curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3).

int descent ()
see _descent().

void draw (const char s, int n, int x, int y)


see _draw(const char str, int n, int x, int y).

void draw (int angle, const char str, int n, int x, int y)
see _draw(int angle, const char str, int n, int x, int y).

void draw (Fl_Pixmap pxm, int XP, int YP, int WP, int HP, int cx, int cy)
Draws an Fl_Pixmap object to the device.

void draw (Fl_Bitmap bitmap, int XP, int YP, int WP, int HP, int cx, int cy)
Draws an Fl_Bitmap object to the device.

void draw (Fl_RGB_Image rgb, int XP, int YP, int WP, int HP, int cx, int cy)
Draws an Fl_RGB_Image object to the device.

void draw_image (const uchar d, int x, int y, int w, int h, int delta=3, int ldelta=0)
see _draw_image(const uchar buf, int X,int Y,int W,int H, int D, int L).

void draw_image (Fl_Draw_Image_Cb call, void data, int x, int y, int w, int h, int delta=3)
see _draw_image(Fl_Draw_Image_Cb cb, void data, int X,int Y,int W,int H, int D).

void draw_image_mono (const uchar d, int x, int y, int w, int h, int delta=1, int ld=0)
see _draw_image_mono(const uchar buf, int X,int Y,int W,int H, int D, int L).

void draw_image_mono (Fl_Draw_Image_Cb call, void data, int x, int y, int w, int h, int delta=1)
see _draw_image_mono(Fl_Draw_Image_Cb cb, void data, int X,int Y,int W,int H, int D).

void end_complex_polygon ()
see _end_complex_polygon().

void end_line ()
see _end_line().

void end_loop ()
see _end_loop().

void end_points ()
see _end_points().

void end_polygon ()
see _end_polygon().

Fl_PostScript_Graphics_Driver ()
The constructor.

void font (int face, int size)


see _font(Fl_Font face, Fl_Fontsize size).

void gap ()
see _gap().

int height ()
see _height().

void line (int x1, int y1, int x2, int y2)
see _line(int x, int y, int x1, int y1).

void line (int x1, int y1, int x2, int y2, int x3, int y3)
see _line(int x, int y, int x1, int y1, int x2, int y2).

void line_style (int style, int width=0, char dashes=0)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

626
see _line_style(int style, int width, char dashes).

Class Documentation

void loop (int x0, int y0, int x1, int y1, int x2, int y2)
see _loop(int x0, int y0, int x1, int y1, int x2, int y2).

void loop (int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3)
see _loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3).

int not_clipped (int x, int y, int w, int h)


see _not_clipped(int x, int y, int w, int h).

void pie (int x, int y, int w, int h, double a1, double a2)
see _pie(int x, int y, int w, int h, double a1, double a2).

void point (int x, int y)


see _point(int x, int y).

void polygon (int x0, int y0, int x1, int y1, int x2, int y2)
see _polygon(int x0, int y0, int x1, int y1, int x2, int y2).

void polygon (int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3)
see _polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3).

void pop_clip ()
see _pop_clip().

void push_clip (int x, int y, int w, int h)


see _push_clip(int x, int y, int w, int h).

void push_no_clip ()
see _push_no_clip().

void rect (int x, int y, int w, int h)


see _rect(int x, int y, int w, int h).

void rectf (int x, int y, int w, int h)


see _rectf(int x, int y, int w, int h).

void rtl_draw (const char s, int n, int x, int y)


see _rtl_draw(const char str, int n, int x, int y).

void text_extents (const char c, int n, int &dx, int &dy, int &w, int &h)
see _text_extents(const char, int n, int& dx, int& dy, int& w, int& h).

void transformed_vertex (double x, double y)


see _transformed_vertex(double xf, double yf).

void vertex (double x, double y)


see _vertex(double x, double y).

double width (const char , int)


see _width(const char str, int n).

void xyline (int x, int y, int x1)


see _xyline(int x, int y, int x1).

void xyline (int x, int y, int x1, int y2)


see _xyline(int x, int y, int x1, int y2).

void xyline (int x, int y, int x1, int y2, int x3)
see _xyline(int x, int y, int x1, int y2, int x3).

void yxline (int x, int y, int y1)


see _yxline(int x, int y, int y1).

void yxline (int x, int y, int y1, int x2)


see _yxline(int x, int y, int y1, int x2).

void yxline (int x, int y, int y1, int x2, int y3)
see _yxline(int x, int y, int y1, int x2, int y3).

Fl_PostScript_Graphics_Driver ()
The destructor.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.96 Fl_PostScript_Graphics_Driver Class Reference

627

Static Public Attributes


static const char class_id = "Fl_PostScript_Graphics_Driver"
A string that identies each subclass of Fl_Device.

30.96.1

Detailed Description

PostScript graphical backend. PostScript text uses vectorial fonts for the latin alphabet (exactly: all unicode characters between U+0020 and U+017F, that is, ASCII, Latin-1 Supplement and Latin Extended-A charts) plus a few other characters: Char ^ Name Codepoint U+0192 orin U+02C6 U+02C7 U+02D8 U+02D9 U+02DA U+02DB U+02DC U+02DD U+2013 U+2014 U+2018 U+2019 quoteleft quoteright circumex caron breve dotaccent ring ogonek tilde hungarumlaut endash emdash Char ... % Name Char Codepoint U+201 A quotesinglbase U+201C quotedblleft U+201quotedD blright U+201E quotedblbase U+2020 dagger U+2021 U+2022 U+2026 U+2030 daggerdbl bullet ellipsis perthousand guilsinglleft guilsinglright fraction Euro Name Codepoint U+2122 trademark U+2202 partialdiff U+2206 Delta U+2211 U+221A U+221E U+2260 U+2264 U+2265 greaterequal U+25CA U+FB01 U+FB02 U+F8FF lozenge apple (Mac OS only) summation radical innity notequal lessequal

/ C

U+2039 U+203A U+2044 U+20AC

All other unicode characters are output as a bitmap. FLTK standard fonts are output using PostScript standard fonts: Helvetica, Courier, Times (and their bold, oblique, italic variants).

30.96.2

Constructor & Destructor Documentation

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

628 30.96.2.1 Fl PostScript Graphics Driver::Fl PostScript Graphics Driver ( )

Class Documentation

The destructor.

30.96.3
30.96.3.1

Member Function Documentation


void Fl PostScript Graphics Driver::arc ( double x, double y, double r, double start, double end ) [virtual]

see _arc(double x, double y, double r, double start, double end). Reimplemented from Fl_Graphics_Driver.

30.96.3.2

void Fl PostScript Graphics Driver::arc ( int x, int y, int w, int h, double a1, double a2 ) [virtual]

see _arc(int x, int y, int w, int h, double a1, double a2). Reimplemented from Fl_Graphics_Driver.

30.96.3.3

void Fl PostScript Graphics Driver::begin complex polygon ( ) [inline, virtual]

see _begin_complex_polygon(). Reimplemented from Fl_Graphics_Driver.

30.96.3.4

void Fl PostScript Graphics Driver::begin line ( ) [virtual]

see _begin_line(). Reimplemented from Fl_Graphics_Driver.

30.96.3.5

void Fl PostScript Graphics Driver::begin loop ( ) [virtual]

see _begin_loop(). Reimplemented from Fl_Graphics_Driver.

30.96.3.6

void Fl PostScript Graphics Driver::begin points ( ) [virtual]

see _begin_points(). Reimplemented from Fl_Graphics_Driver.

30.96.3.7

void Fl PostScript Graphics Driver::begin polygon ( ) [virtual]

see _begin_polygon(). Reimplemented from Fl_Graphics_Driver.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.96 Fl_PostScript_Graphics_Driver Class Reference 30.96.3.8 void Fl PostScript Graphics Driver::circle ( double x, double y, double r ) [virtual]

629

see _circle(double x, double y, double r). Reimplemented from Fl_Graphics_Driver. 30.96.3.9 const char Fl PostScript Graphics Driver::class name ( ) [inline, virtual]

Returns the name of the class of this object. The class of an instance of an Fl_Device subclass can be checked with code such as:
if ( instance->class_name() == Fl_Printer::class_id ) { ... }

Reimplemented from Fl_Graphics_Driver. 30.96.3.10 int Fl PostScript Graphics Driver::clip box ( int x, int y, int w, int h, int & X, int & Y, int & W, int & H ) [virtual]

see _clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H). Reimplemented from Fl_Graphics_Driver. 30.96.3.11 void Fl PostScript Graphics Driver::color ( Fl_Color c ) [virtual]

see _color(Fl_Color c). Reimplemented from Fl_Graphics_Driver. 30.96.3.12 void Fl PostScript Graphics Driver::color ( uchar r, uchar g, uchar b ) [virtual]

see _color(uchar r, uchar g, uchar b). Implements Fl_Graphics_Driver. 30.96.3.13 void Fl PostScript Graphics Driver::curve ( double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3 ) [virtual]

see _curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3). Reimplemented from Fl_Graphics_Driver. 30.96.3.14 int Fl PostScript Graphics Driver::descent ( ) [virtual]

see _descent(). Implements Fl_Graphics_Driver. 30.96.3.15 void Fl PostScript Graphics Driver::draw ( const char str, int n, int x, int y ) [inline, virtual]

see _draw(const char str, int n, int x, int y). Implements Fl_Graphics_Driver.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

630 30.96.3.16

Class Documentation void Fl PostScript Graphics Driver::draw ( int angle, const char str, int n, int x, int y ) [virtual]

see _draw(int angle, const char str, int n, int x, int y). Implements Fl_Graphics_Driver.

30.96.3.17

void Fl PostScript Graphics Driver::draw ( Fl_Pixmap pxm, int XP, int YP, int WP, int HP, int cx, int cy ) [virtual]

Draws an Fl_Pixmap object to the device. Species a bounding box for the image, with the origin (upper left-hand corner) of the image offset by the cx and cy arguments. Implements Fl_Graphics_Driver.

30.96.3.18

void Fl PostScript Graphics Driver::draw ( Fl_Bitmap bm, int XP, int YP, int WP, int HP, int cx, int cy ) [virtual]

Draws an Fl_Bitmap object to the device. Species a bounding box for the image, with the origin (upper left-hand corner) of the image offset by the cx and cy arguments. Implements Fl_Graphics_Driver.

30.96.3.19

void Fl PostScript Graphics Driver::draw ( Fl_RGB_Image rgb, int XP, int YP, int WP, int HP, int cx, int cy ) [virtual]

Draws an Fl_RGB_Image object to the device. Species a bounding box for the image, with the origin (upper left-hand corner) of the image offset by the cx and cy arguments. Implements Fl_Graphics_Driver.

30.96.3.20

void Fl PostScript Graphics Driver::draw image ( const uchar buf, int X, int Y, int W, int H, int D = 3, int L = 0 ) [virtual]

see _draw_image(const uchar buf, int X,int Y,int W,int H, int D, int L). Implements Fl_Graphics_Driver.

30.96.3.21

void Fl PostScript Graphics Driver::draw image ( Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D = 3 ) [virtual]

see _draw_image(Fl_Draw_Image_Cb cb, void data, int X,int Y,int W,int H, int D). Implements Fl_Graphics_Driver.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.96 Fl_PostScript_Graphics_Driver Class Reference 30.96.3.22

631

void Fl PostScript Graphics Driver::draw image mono ( const uchar buf, int X, int Y, int W, int H, int D = 1, int L = 0 ) [virtual]

see _draw_image_mono(const uchar buf, int X,int Y,int W,int H, int D, int L). Implements Fl_Graphics_Driver.

30.96.3.23

void Fl PostScript Graphics Driver::draw image mono ( Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D = 1 ) [virtual]

see _draw_image_mono(Fl_Draw_Image_Cb cb, void data, int X,int Y,int W,int H, int D). Implements Fl_Graphics_Driver.

30.96.3.24

void Fl PostScript Graphics Driver::end complex polygon ( ) [inline, virtual]

see _end_complex_polygon(). Reimplemented from Fl_Graphics_Driver.

30.96.3.25

void Fl PostScript Graphics Driver::end line ( ) [virtual]

see _end_line(). Reimplemented from Fl_Graphics_Driver.

30.96.3.26

void Fl PostScript Graphics Driver::end loop ( ) [virtual]

see _end_loop(). Reimplemented from Fl_Graphics_Driver.

30.96.3.27

void Fl PostScript Graphics Driver::end points ( ) [virtual]

see _end_points(). Reimplemented from Fl_Graphics_Driver.

30.96.3.28

void Fl PostScript Graphics Driver::end polygon ( ) [virtual]

see _end_polygon(). Reimplemented from Fl_Graphics_Driver.

30.96.3.29

void Fl PostScript Graphics Driver::font ( int face, int size ) [virtual]

see _font(Fl_Font face, Fl_Fontsize size). Reimplemented from Fl_Graphics_Driver.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

632 30.96.3.30 void Fl PostScript Graphics Driver::gap ( ) [inline, virtual]

Class Documentation

see _gap(). Reimplemented from Fl_Graphics_Driver.

30.96.3.31

int Fl PostScript Graphics Driver::height ( ) [virtual]

see _height(). Implements Fl_Graphics_Driver.

30.96.3.32

void Fl PostScript Graphics Driver::line ( int x, int y, int x1, int y1 ) [virtual]

see _line(int x, int y, int x1, int y1). Reimplemented from Fl_Graphics_Driver.

30.96.3.33

void Fl PostScript Graphics Driver::line ( int x, int y, int x1, int y1, int x2, int y2 ) [virtual]

see _line(int x, int y, int x1, int y1, int x2, int y2). Reimplemented from Fl_Graphics_Driver.

30.96.3.34

void Fl PostScript Graphics Driver::line style ( int style, int width = 0, char dashes = 0 ) [virtual]

see _line_style(int style, int width, char dashes). Reimplemented from Fl_Graphics_Driver.

30.96.3.35

void Fl PostScript Graphics Driver::loop ( int x0, int y0, int x1, int y1, int x2, int y2 ) [virtual]

see _loop(int x0, int y0, int x1, int y1, int x2, int y2). Reimplemented from Fl_Graphics_Driver.

30.96.3.36

void Fl PostScript Graphics Driver::loop ( int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3 ) [virtual]

see _loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3). Reimplemented from Fl_Graphics_Driver.

30.96.3.37

int Fl PostScript Graphics Driver::not clipped ( int x, int y, int w, int h ) [virtual]

see _not_clipped(int x, int y, int w, int h). Reimplemented from Fl_Graphics_Driver.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.96 Fl_PostScript_Graphics_Driver Class Reference 30.96.3.38 void Fl PostScript Graphics Driver::pie ( int x, int y, int w, int h, double a1, double a2 ) [virtual]

633

see _pie(int x, int y, int w, int h, double a1, double a2). Reimplemented from Fl_Graphics_Driver.

30.96.3.39

void Fl PostScript Graphics Driver::point ( int x, int y ) [virtual]

see _point(int x, int y). Reimplemented from Fl_Graphics_Driver.

30.96.3.40

void Fl PostScript Graphics Driver::polygon ( int x0, int y0, int x1, int y1, int x2, int y2 ) [virtual]

see _polygon(int x0, int y0, int x1, int y1, int x2, int y2). Reimplemented from Fl_Graphics_Driver.

30.96.3.41

void Fl PostScript Graphics Driver::polygon ( int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3 ) [virtual]

see _polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3). Reimplemented from Fl_Graphics_Driver.

30.96.3.42

void Fl PostScript Graphics Driver::pop clip ( ) [virtual]

see _pop_clip(). Reimplemented from Fl_Graphics_Driver.

30.96.3.43

void Fl PostScript Graphics Driver::push clip ( int x, int y, int w, int h ) [virtual]

see _push_clip(int x, int y, int w, int h). Reimplemented from Fl_Graphics_Driver.

30.96.3.44

void Fl PostScript Graphics Driver::push no clip ( ) [virtual]

see _push_no_clip(). Reimplemented from Fl_Graphics_Driver.

30.96.3.45

void Fl PostScript Graphics Driver::rect ( int x, int y, int w, int h ) [virtual]

see _rect(int x, int y, int w, int h). Reimplemented from Fl_Graphics_Driver.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

634 30.96.3.46

Class Documentation void Fl PostScript Graphics Driver::rectf ( int x, int y, int w, int h ) [virtual]

see _rectf(int x, int y, int w, int h). Reimplemented from Fl_Graphics_Driver.

30.96.3.47

void Fl PostScript Graphics Driver::rtl draw ( const char str, int n, int x, int y ) [virtual]

see _rtl_draw(const char str, int n, int x, int y). Implements Fl_Graphics_Driver.

30.96.3.48

void Fl PostScript Graphics Driver::text extents ( const char t, int n, int & dx, int & dy, int & w, int & h ) [virtual]

see _text_extents(const char, int n, int& dx, int& dy, int& w, int& h). Reimplemented from Fl_Graphics_Driver.

30.96.3.49

void Fl PostScript Graphics Driver::transformed vertex ( double xf, double yf ) [virtual]

see _transformed_vertex(double xf, double yf). Reimplemented from Fl_Graphics_Driver.

30.96.3.50

void Fl PostScript Graphics Driver::vertex ( double x, double y ) [virtual]

see _vertex(double x, double y). Reimplemented from Fl_Graphics_Driver.

30.96.3.51

double Fl PostScript Graphics Driver::width ( const char str, int n ) [virtual]

see _width(const char str, int n). Implements Fl_Graphics_Driver.

30.96.3.52

void Fl PostScript Graphics Driver::xyline ( int x, int y, int x1 ) [virtual]

see _xyline(int x, int y, int x1). Reimplemented from Fl_Graphics_Driver.

30.96.3.53

void Fl PostScript Graphics Driver::xyline ( int x, int y, int x1, int y2 ) [virtual]

see _xyline(int x, int y, int x1, int y2). Reimplemented from Fl_Graphics_Driver.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.97 Fl_PostScript_Printer Class Reference 30.96.3.54

635

void Fl PostScript Graphics Driver::xyline ( int x, int y, int x1, int y2, int x3 ) [virtual]

see _xyline(int x, int y, int x1, int y2, int x3). Reimplemented from Fl_Graphics_Driver.

30.96.3.55

void Fl PostScript Graphics Driver::yxline ( int x, int y, int y1 ) [virtual]

see _yxline(int x, int y, int y1). Reimplemented from Fl_Graphics_Driver.

30.96.3.56

void Fl PostScript Graphics Driver::yxline ( int x, int y, int y1, int x2 ) [virtual]

see _yxline(int x, int y, int y1, int x2). Reimplemented from Fl_Graphics_Driver.

30.96.3.57

void Fl PostScript Graphics Driver::yxline ( int x, int y, int y1, int x2, int y3 ) [virtual]

see _yxline(int x, int y, int y1, int x2, int y3). Reimplemented from Fl_Graphics_Driver.

30.96.4
30.96.4.1

Member Data Documentation


const char Fl_PostScript_Graphics_Driver::class_id = Fl PostScript Graphics Driver [static]

A string that identies each subclass of Fl_Device. Function class_name() applied to a device of this class returns this string. Reimplemented from Fl_Graphics_Driver. The documentation for this class was generated from the following les: Fl_PostScript.H Fl_PostScript.cxx

30.97

Fl PostScript Printer Class Reference

Print support under Unix/Linux. #include <Fl_Printer.H> Inheritance diagram for Fl_PostScript_Printer:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

636
Fl_Device Fl_Surface_Device Fl_Paged_Device Fl_PostScript_File_Device Fl_PostScript_Printer

Class Documentation

Public Member Functions


const char class_name ()
Returns the name of the class of this object.

int start_job (int pages, int rstpage=NULL, int lastpage=NULL)


Starts a print job.

Static Public Attributes


static const char class_id = Fl_Printer::class_id
A string that identies each subclass of Fl_Device.

Protected Member Functions


Fl_PostScript_Printer (void)
The constructor.

Friends
class Fl_Printer

30.97.1

Detailed Description

Print support under Unix/Linux. Class Fl_PostScript_Printer is implemented only on the Unix/Linux platform. It has no public constructor. Use Fl_Printer instead that is cross-platform and has the same API.

30.97.2
30.97.2.1

Member Function Documentation


const char Fl PostScript Printer::class name ( ) [inline, virtual]

Returns the name of the class of this object. The class of an instance of an Fl_Device subclass can be checked with code such as:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.98 Fl_Preferences Class Reference


if ( instance->class_name() == Fl_Printer::class_id ) { ... }

637

Reimplemented from Fl_PostScript_File_Device. 30.97.2.2 int Fl PostScript Printer::start job ( int pagecount, int frompage = NULL, int topage = NULL ) [virtual]

Starts a print job. Parameters in out out

pagecount the total number of pages of the job frompage if non-null, frompage is set to the rst page the user wants printed topage if non-null, topage is set to the last page the user wants printed

Returns 0 if OK, non-zero if any error Reimplemented from Fl_Paged_Device.

30.97.3
30.97.3.1

Member Data Documentation


const char Fl_PostScript_Printer::class_id = Fl_Printer::class_id [static]

A string that identies each subclass of Fl_Device. Function class_name() applied to a device of this class returns this string. Reimplemented from Fl_PostScript_File_Device. The documentation for this class was generated from the following les: Fl_Printer.H Fl_Printer.cxx

30.98

Fl Preferences Class Reference

Fl_Preferences provides methods to store user settings between application starts. #include <Fl_Preferences.H> Inheritance diagram for Fl_Preferences:

Fl_Preferences Fl_Plugin_Manager

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

638

Class Documentation

Classes
struct Entry class Name
Name provides a simple method to create numerical or more complex procedural names for entries and groups on the y.

class Node class RootNode

Public Types
typedef void ID
Every Fl_Preferences-Group has a uniqe ID.

enum Root { SYSTEM = 0, USER }


Dene the scope of the preferences.

Public Member Functions


char clear ()
Delete all groups and all entries.

char deleteAllEntries ()
Delete all entries.

char deleteAllGroups ()
Delete all groups.

char deleteEntry (const char entry)


Deletes a single name/value pair.

char deleteGroup (const char group)


Deletes a group.

int entries ()
Returns the number of entries (name/value pairs) in a group.

const char entry (int index)


Returns the name of an entry.

char entryExists (const char key)


Returns non-zero if an entry with this name exists.

Fl_Preferences (Root root, const char vendor, const char application)


The constructor creates a group that manages name/value pairs and child groups.

Fl_Preferences (const char path, const char vendor, const char application)
Use this constructor to create or read a preferences le at an arbitrary position in the le system.

Fl_Preferences (Fl_Preferences &parent, const char group)


Generate or read a new group of entries within another group.

Fl_Preferences (Fl_Preferences parent, const char group)


Create or access a group of preferences using a name.

Fl_Preferences (Fl_Preferences &parent, int groupIndex)


Open a child group using a given index.

Fl_Preferences (Fl_Preferences parent, int groupIndex) Fl_Preferences (const Fl_Preferences &)


Create another reference to a Preferences group.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.98 Fl_Preferences Class Reference Fl_Preferences (ID id)


Create a new dataset access point using a dataset ID.

639

void ush ()
Writes all preferences to disk.

char get (const char entry, int &value, int defaultValue)


Reads an entry from the group.

char get (const char entry, oat &value, oat defaultValue)


Reads an entry from the group.

char get (const char entry, double &value, double defaultValue)


Reads an entry from the group.

char get (const char entry, char &value, const char defaultValue)
Reads an entry from the group.

char get (const char entry, char value, const char defaultValue, int maxSize)
Reads an entry from the group.

char get (const char entry, void &value, const void defaultValue, int defaultSize)
Reads an entry from the group.

char get (const char entry, void value, const void defaultValue, int defaultSize, int maxSize)
Reads an entry from the group.

char getUserdataPath (char path, int pathlen)


Creates a path that is related to the preferences le and that is usable for additional application data.

const char group (int num_group)


Returns the name of the Nth (num_group) group.

char groupExists (const char key)


Returns non-zero if a group with this name exists.

int groups ()
Returns the number of groups that are contained within a group.

ID id ()
Return an ID that can later be reused to open more references to this dataset.

const char name ()


Return the name of this entry.

const char path ()


Return the the full path to this entry.

char set (const char entry, int value)


Sets an entry (name/value pair).

char set (const char entry, oat value)


Sets an entry (name/value pair).

char set (const char entry, oat value, int precision)


Sets an entry (name/value pair).

char set (const char entry, double value)


Sets an entry (name/value pair).

char set (const char entry, double value, int precision)


Sets an entry (name/value pair).

char set (const char entry, const char value)


Sets an entry (name/value pair).

char set (const char entry, const void value, int size)
Sets an entry (name/value pair).
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

640 int size (const char entry)


Returns the size of the value part of an entry.

Class Documentation

virtual Fl_Preferences ()
The destructor removes allocated resources.

Static Public Member Functions


static const char newUUID ()
Returns a UUID as generated by the system.

static char remove (ID id_)


Remove the group with this ID from a database.

Protected Attributes
Node node RootNode rootNode

Friends
class Node class RootNode

30.98.1

Detailed Description

Fl_Preferences provides methods to store user settings between application starts. It is similar to the Registry on WIN32 and Preferences on MacOS, and provides a simple conguration mechanism for UNIX. Fl_Preferences uses a hierarchy to store data. It bundles similar data into groups and manages entries into those groups as name/value pairs. Preferences are stored in text les that can be edited manually. The le format is easy to read and relatively forgiving. Preferences les are the same on all platforms. User comments in preference les are preserved. Filenames are unique for each application by using a vendor/application naming scheme. The user must provide default values for all entries to ensure proper operation should preferences be corrupted or not yet exist. Entries can be of any length. However, the size of each preferences le should be kept small for performance reasons. One application can have multiple preferences les. Extensive binary data however should be stored in separate les: see getUserdataPath(). Note Starting with FLTK 1.3, preference databases are expected to be in utf8 encoding. Previous databases were stored in the current chracter set or code page which renders them incompatible for text entries using international characters.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.98 Fl_Preferences Class Reference

641

30.98.2
30.98.2.1

Member Typedef Documentation


typedef void Fl_Preferences::ID

Every Fl_Preferences-Group has a uniqe ID. IDs can be retrieved from an Fl_Preferences-Group and can then be used to create more Fl_Preference references to the same data set, as long as the database remains open.

30.98.3
30.98.3.1

Member Enumeration Documentation


enum Fl_Preferences::Root

Dene the scope of the preferences. Enumerator: SYSTEM Preferences are used system-wide. USER Preferences apply only to the current user.

30.98.4
30.98.4.1

Constructor & Destructor Documentation


Fl Preferences::Fl Preferences ( Root root, const char vendor, const char application )

The constructor creates a group that manages name/value pairs and child groups. Groups are ready for reading and writing at any time. The root argument is either Fl_Preferences::USER or Fl_Preferences::SYSTEM. This constructor creates the base instance for all following entries and reads existing databases into memory. The vendor argument is a unique text string identifying the development team or vendor of an application. A domain name or an EMail address are great unique names, e.g. "researchATmatthiasm.com" or "tk.org". The application argument can be the working title or nal name of your application. Both vendor and application must be valid relative UNIX pathnames and may contain /s to create deeper le structures. A set of Preferences marked "run-time" exists exactly one per application and only as long as the application runs. It can be used as a database for volatile information. FLTK uses it to register plugins at run-time. Parameters in in in

root can be USER or SYSTEM for user specic or system wide preferences vendor unique text describing the company or author of this le application unique text describing the application

30.98.4.2

Fl Preferences::Fl Preferences ( const char path, const char vendor, const char application )

Use this constructor to create or read a preferences le at an arbitrary position in the le system. The le name is generated in the form path/application.prefs. If application is NULL, path must contain the full le name.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

642 Parameters in in in

Class Documentation

path path to the directory that contains the preferences le vendor unique text describing the company or author of this le application unique text describing the application

30.98.4.3

Fl Preferences::Fl Preferences ( Fl_Preferences & parent, const char group )

Generate or read a new group of entries within another group. Use the group argument to name the group that you would like to access. Group can also contain a path to a group further down the hierarchy by separating group names with a forward slash /. Parameters in in

parent reference object for the new group group name of the group to access (may contain /s)

30.98.4.4

Fl Preferences::Fl Preferences ( Fl_Preferences parent, const char group )

Create or access a group of preferences using a name. Parameters in

in

parent the parameter parent is a pointer to the parent group. Parent may be NULL. It then refers to an application internal database which exists only once, and remains in RAM only until the application quits. This database is used to manage plugins and other data indexes by strings. group a group name that is used as a key into the database

See also Fl_Preferences( Fl_Preferences&, const char group )

30.98.4.5

Fl Preferences::Fl Preferences ( Fl_Preferences & parent, int groupIndex )

Open a child group using a given index. Use the groupIndex argument to nd the group that you would like to access. If the given index is invalid (negative or too high), a new group is created with a UUID as a name. The index needs to be xed. It is currently backward. Index 0 points to the last member in the list of preferences. Parameters in in

parent reference object for the new group groupIndex zero based index into child groups

30.98.4.6

Fl Preferences::Fl Preferences ( Fl_Preferences parent, int groupIndex )

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.98 Fl_Preferences Class Reference See also Fl_Preferences( Fl_Preferences&, int groupIndex )

643

30.98.4.7

Fl Preferences::Fl Preferences ( Fl_Preferences::ID id )

Create a new dataset access point using a dataset ID. IDs are a great way to remember shortcuts to database entries that are deeply nested in a preferences database, as long as the database root is not deleted. An ID can be retrieved from any Fl_Preferences dataset, and can then be used to create multiple new references to the same dataset. IDs can be put very helpful when put into the user_data() eld of widget callbacks. 30.98.4.8 Fl Preferences::Fl Preferences ( ) [virtual]

The destructor removes allocated resources. When used on the base preferences group, the destructor ushes all changes to the preferences le and deletes all internal databases. The destructor does not remove any data from the database. It merely deletes your reference to the database.

30.98.5
30.98.5.1

Member Function Documentation


char Fl Preferences::deleteEntry ( const char key )

Deletes a single name/value pair. This function removes the entry key from the database. Parameters in

key name of entry to delete

Returns 0 if deleting the entry failed

30.98.5.2

char Fl Preferences::deleteGroup ( const char group )

Deletes a group. Removes a group and all keys and groups within that group from the database. Parameters in

group name of the group to delete

Returns 0 if call failed

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

644 30.98.5.3 int Fl Preferences::entries ( )

Class Documentation

Returns the number of entries (name/value pairs) in a group. Returns number of entries

30.98.5.4

const char Fl Preferences::entry ( int index )

Returns the name of an entry. There is no guaranteed order of entry names. The index must be within the range given by entries(). Parameters in

index number indexing the requested entry

Returns pointer to value cstring

30.98.5.5

char Fl Preferences::entryExists ( const char key )

Returns non-zero if an entry with this name exists. Parameters in

key name of entry that is searched for

Returns 0 if entry was not found

30.98.5.6

void Fl Preferences::ush ( )

Writes all preferences to disk. This function works only with the base preferences group. This function is rarely used as deleting the base preferences ushes automatically. 30.98.5.7 char Fl Preferences::get ( const char key, int & value, int defaultValue )

Reads an entry from the group. A default value must be supplied. The return value indicates if the value was available (non-zero) or the default was used (0).

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.98 Fl_Preferences Class Reference Parameters in out in

645

key name of entry value returned from preferences or default value if none was set defaultValue default value to be used if no preference was set

Returns 0 if the default value was used

30.98.5.8

char Fl Preferences::get ( const char key, oat & value, oat defaultValue )

Reads an entry from the group. A default value must be supplied. The return value indicates if the value was available (non-zero) or the default was used (0). Parameters in out in

key name of entry value returned from preferences or default value if none was set defaultValue default value to be used if no preference was set

Returns 0 if the default value was used

30.98.5.9

char Fl Preferences::get ( const char key, double & value, double defaultValue )

Reads an entry from the group. A default value must be supplied. The return value indicates if the value was available (non-zero) or the default was used (0). Parameters in out in

key name of entry value returned from preferences or default value if none was set defaultValue default value to be used if no preference was set

Returns 0 if the default value was used

30.98.5.10

char Fl Preferences::get ( const char key, char & text, const char defaultValue )

Reads an entry from the group. A default value must be supplied. The return value indicates if the value was available (non-zero) or the default was used (0). get() allocates memory of sufcient size to hold the value. The buffer must be freed by the developer using free(value).
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

646 Parameters in out in

Class Documentation

key name of entry text returned from preferences or default value if none was set defaultValue default value to be used if no preference was set

Returns 0 if the default value was used

30.98.5.11

char Fl Preferences::get ( const char key, char text, const char defaultValue, int maxSize )

Reads an entry from the group. A default value must be supplied. The return value indicates if the value was available (non-zero) or the default was used (0). maxSize is the maximum length of text that will be read. The text buffer must allow for one additional byte for a trailling zero. Parameters in out in in

key text defaultValue maxSize

name of entry returned from preferences or default value if none was set default value to be used if no preference was set maximum length of value plus one byte for a trailing zero

Returns 0 if the default value was used

30.98.5.12

char Fl Preferences::get ( const char key, void & data, const void defaultValue, int defaultSize )

Reads an entry from the group. A default value must be supplied. The return value indicates if the value was available (non-zero) or the default was used (0). get() allocates memory of sufcient size to hold the value. The buffer must be freed by the developer using free(value). Parameters in out in in

key data defaultValue defaultSize

name of entry returned from preferences or default value if none was set default value to be used if no preference was set size of default value array

Returns 0 if the default value was used

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.98 Fl_Preferences Class Reference 30.98.5.13 char Fl Preferences::get ( const char key, void data, const void defaultValue, int defaultSize, int maxSize )

647

Reads an entry from the group. A default value must be supplied. The return value indicates if the value was available (non-zero) or the default was used (0). maxSize is the maximum length of text that will be read. Parameters in out in in in

key data defaultValue defaultSize maxSize

name of entry value returned from preferences or default value if none was set default value to be used if no preference was set size of default value array maximum length of value

Returns 0 if the default value was used Todo maxSize should receive the number of bytes that were read.

30.98.5.14

char Fl Preferences::getUserdataPath ( char path, int pathlen )

Creates a path that is related to the preferences le and that is usable for additional application data. This function creates a directory that is named after the preferences database without the .prefs extension and located in the same directory. It then lls the given buffer with the complete path name. Exmaple:
Fl_Preferences prefs( USER, "matthiasm.com", "test" ); char path[FL_PATH_MAX]; prefs.getUserdataPath( path );

creates the preferences database in (MS Windows):


c:/Documents and Settings/matt/Application Data/matthiasm.com/test.prefs

and returns the userdata path:


c:/Documents and Settings/matt/Application Data/matthiasm.com/test/

Parameters out in

path buffer for user data path pathlen size of path buffer (should be at least FL_PATH_MAX)

Returns 0 if path was not created or pathname cant t into buffer

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

648 30.98.5.15 const char Fl Preferences::group ( int num group )

Class Documentation

Returns the name of the Nth (num_group) group. There is no guaranteed order of group names. The index must be within the range given by groups(). Parameters in

num_group number indexing the requested group

Returns C string pointer to the group name

30.98.5.16

char Fl Preferences::groupExists ( const char key )

Returns non-zero if a group with this name exists. Group names are relative to the Preferences node and can contain a path. "." describes the current node, "./" describes the topmost node. By preceding a groupname with a "./", its path becomes relative to the topmost node. Parameters in

key name of group that is searched for

Returns 0 if no group by that name was found

30.98.5.17

int Fl Preferences::groups ( )

Returns the number of groups that are contained within a group. Returns 0 for no groups at all

30.98.5.18

const char Fl Preferences::newUUID ( ) [static]

Returns a UUID as generated by the system. A UUID is a "universally unique identier" which is commonly used in conguration les to create identities. A UUID in ASCII looks like this: 937C4900-51AA-4C11-8DD3-7AB59944F03E. It has always 36 bytes plus a trailing zero. Returns a pointer to a static buffer containing the new UUID in ASCII format. The buffer is overwritten during every call to this function!

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.98 Fl_Preferences Class Reference 30.98.5.19 char Fl Preferences::set ( const char key, int value )

649

Sets an entry (name/value pair). The return value indicates if there was a problem storing the data in memory. However it does not reect if the value was actually stored in the preferences le. Parameters in in

key name of entry value set this entry to value

Returns 0 if setting the value failed

30.98.5.20

char Fl Preferences::set ( const char key, oat value )

Sets an entry (name/value pair). The return value indicates if there was a problem storing the data in memory. However it does not reect if the value was actually stored in the preferences le. Parameters in in

key name of entry value set this entry to value

Returns 0 if setting the value failed

30.98.5.21

char Fl Preferences::set ( const char key, oat value, int precision )

Sets an entry (name/value pair). The return value indicates if there was a problem storing the data in memory. However it does not reect if the value was actually stored in the preferences le. Parameters in in in Returns 0 if setting the value failed

key name of entry value set this entry to value precision number of decimal digits to represent value

30.98.5.22

char Fl Preferences::set ( const char key, double value )

Sets an entry (name/value pair).


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

650

Class Documentation

The return value indicates if there was a problem storing the data in memory. However it does not reect if the value was actually stored in the preferences le. Parameters in in

key name of entry value set this entry to value

Returns 0 if setting the value failed

30.98.5.23

char Fl Preferences::set ( const char key, double value, int precision )

Sets an entry (name/value pair). The return value indicates if there was a problem storing the data in memory. However it does not reect if the value was actually stored in the preferences le. Parameters in in in

key name of entry value set this entry to value precision number of decimal digits to represent value

Returns 0 if setting the value failed

30.98.5.24

char Fl Preferences::set ( const char key, const char text )

Sets an entry (name/value pair). The return value indicates if there was a problem storing the data in memory. However it does not reect if the value was actually stored in the preferences le. Parameters in in

key name of entry text set this entry to value

Returns 0 if setting the value failed

30.98.5.25

char Fl Preferences::set ( const char key, const void data, int dsize )

Sets an entry (name/value pair). The return value indicates if there was a problem storing the data in memory. However it does not reect if the value was actually stored in the preferences le.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.99 Fl_Printer Class Reference Parameters in in in

651

key name of entry data set this entry to value dsize size of data array

Returns 0 if setting the value failed

30.98.5.26

int Fl Preferences::size ( const char key )

Returns the size of the value part of an entry. Parameters in

key name of entry

Returns size of value The documentation for this class was generated from the following les: Fl_Preferences.H Fl_Preferences.cxx

30.99

Fl Printer Class Reference

OS-independent print support. #include <Fl_Printer.H> Inheritance diagram for Fl_Printer:


Fl_Device Fl_Surface_Device Fl_Paged_Device Fl_Printer

Public Member Functions


const char class_name ()
Returns the name of the class of this object.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

652 Fl_Graphics_Driver driver (void)


Returns the graphics driver of this drawing surface.

Class Documentation

void end_job (void)


To be called at the end of a print job.

int end_page (void)


To be called at the end of each page.

Fl_Printer (void)
The constructor.

void margins (int left, int top, int right, int bottom)
Computes the dimensions of margins that lie between the printable page area and the full page.

void origin (int x, int y)


Computes the page coordinates of the current origin of graphics functions.

void origin (int x, int y)


Sets the position in page coordinates of the origin of graphics functions.

void print_widget (Fl_Widget widget, int delta_x=0, int delta_y=0)


Draws the widget on the printed page.

void print_window_part (Fl_Window win, int x, int y, int w, int h, int delta_x=0, int delta_y=0)
Prints a rectangular part of an on-screen window.

int printable_rect (int w, int h)


Computes the width and height of the printable area of the page.

void rotate (oat angle)


Rotates the graphics operations relatively to paper.

void scale (oat scale_x, oat scale_y=0.)


Changes the scaling of page coordinates.

void set_current (void)


Use this drawing surface for future graphics requests.

int start_job (int pagecount, int frompage=NULL, int topage=NULL)


Starts a print job.

int start_page (void)


Starts a new printed page.

void translate (int x, int y)


Translates the current graphics origin accounting for the current rotation.

void untranslate (void)


Undoes the effect of a previous translate() call.

Fl_Printer (void)
The destructor.

Static Public Attributes


static const char class_id = "Fl_Printer"
A string that identies each subclass of Fl_Device.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.99 Fl_Printer Class Reference These attributes are effective under the Xlib platform only. static const char dialog_title = "Print"
[this text may be customized at run-time]

653

static const char dialog_printer = "Printer:"


[this text may be customized at run-time]

static const char dialog_range = "Print Range"


[this text may be customized at run-time]

static const char dialog_copies = "Copies"


[this text may be customized at run-time]

static const char dialog_all = "All"


[this text may be customized at run-time]

static const char dialog_pages = "Pages"


[this text may be customized at run-time]

static const char dialog_from = "From:"


[this text may be customized at run-time]

static const char dialog_to = "To:"


[this text may be customized at run-time]

static const char dialog_properties = "Properties..."


[this text may be customized at run-time]

static const char dialog_copyNo = "# Copies:"


[this text may be customized at run-time]

static const char dialog_print_button = "Print"


[this text may be customized at run-time]

static const char dialog_cancel_button = "Cancel"


[this text may be customized at run-time]

static const char dialog_print_to_le = "Print To File"


[this text may be customized at run-time]

static const char property_title = "Printer Properties"


[this text may be customized at run-time]

static const char property_pagesize = "Page Size:"


[this text may be customized at run-time]

static const char property_mode = "Output Mode:"


[this text may be customized at run-time]

static const char property_use = "Use"


[this text may be customized at run-time]

static const char property_save = "Save"


[this text may be customized at run-time]

static const char property_cancel = "Cancel"


[this text may be customized at run-time]

30.99.1

Detailed Description

OS-independent print support. Fl_Printer allows to use all FLTK drawing, color, text, and clip functions, and to have them operate on printed page(s). There are two main, non exclusive, ways to use it. Print any widget (standard, custom, Fl_Window, Fl_Gl_Window) as it appears on screen, with optional translation, scaling and rotation. This is done by calling print_widget(), print_window() or print_window_part().
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

654

Class Documentation Use a series of FLTK graphics commands (e.g., font, text, lines, colors, clip, image) to compose a page appropriately shaped for printing.

In both cases, begin by start_job(), start_page(), printable_rect() and origin() calls and nish by end_page() and end_job() calls. Platform specics Unix/Linux platforms: Class Fl_RGB_Image prints but loses its transparency if it has one. See class Fl_PostScript_Graphics_Driver for a description of how UTF-8 strings appear in print. Use the static public attributes of this class to set the print dialog to other languages than English. For example, the "Printer:" dialog item Fl_Printer::dialog_printer can be set to French with:
Fl_Printer::dialog_printer = "Imprimante:";

before creation of the Fl_Printer object. Use Fl_PostScript_File_Device::le_chooser_title to customize the title of the le chooser dialog that opens when using the "Print To File" option of the print dialog. MSWindows platform: Transparent Fl_RGB_Image s dont print with exact transparency on most printers. Fl_RGB_Image s dont rotate() well. A workaround is to use the print_window_part() call. Mac OS X platform: all graphics requests print as on display.

30.99.2
30.99.2.1

Member Function Documentation


const char Fl Printer::class name ( ) [inline, virtual]

Returns the name of the class of this object. The class of an instance of an Fl_Device subclass can be checked with code such as:
if ( instance->class_name() == Fl_Printer::class_id ) { ... }

Reimplemented from Fl_Paged_Device.

30.99.2.2 Fl_Graphics_Driver Fl Printer::driver ( void ) Returns the graphics driver of this drawing surface. Reimplemented from Fl_Surface_Device.

30.99.2.3

int Fl Printer::end page ( void ) [virtual]

To be called at the end of each page. Returns 0 if OK, non-zero if any error. Reimplemented from Fl_Paged_Device.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.99 Fl_Printer Class Reference 30.99.2.4 void Fl Printer::margins ( int left, int top, int right, int bottom ) [virtual]

655

Computes the dimensions of margins that lie between the printable page area and the full page. Values are in the same unit as that used by FLTK drawing functions. They are changed by scale() calls. Parameters out out out out

left top right bottom

If non-null, left is set to the left margin size. If non-null, top is set to the top margin size. If non-null, right is set to the right margin size. If non-null, bottom is set to the bottom margin size.

Reimplemented from Fl_Paged_Device. 30.99.2.5 void Fl Printer::origin ( int x, int y ) [virtual]

Computes the page coordinates of the current origin of graphics functions. Parameters out out

x If non-null, x is set to the horizontal page offset of graphics origin. y Same as above, vertically.

Reimplemented from Fl_Paged_Device. 30.99.2.6 void Fl Printer::origin ( int x, int y ) [virtual]

Sets the position in page coordinates of the origin of graphics functions. Arguments should be expressed relatively to the result of a previous printable_rect() call. That is, printable_rect(&w, &h); origin(w/2, 0); sets the graphics origin at the top center of the page printable area. Origin() calls are not affected by rotate() calls. Successive origin() calls dont combine their effects. Parameters in in

x Horizontal position in page coordinates of the desired origin of graphics functions. y Same as above, vertically.

Reimplemented from Fl_Paged_Device. 30.99.2.7 void Fl Printer::print widget ( Fl_Widget widget, int delta x = 0, int delta y = 0 ) [virtual]

Draws the widget on the printed page. The widgets position on the printed page is determined by the last call to origin() and by the optional delta_x and delta_y arguments. Its dimensions are in points unless there was a previous call to scale(). Parameters in

widget Any FLTK widget (e.g., standard, custom, window).

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

656

Class Documentation

in in

delta_x Optional horizontal offset for positioning the widget relatively to the current origin of graphics functions. delta_y Same as above, vertically.

Reimplemented from Fl_Paged_Device. 30.99.2.8 void Fl Printer::print window part ( Fl_Window win, int x, int y, int w, int h, int delta x = 0, int delta y = 0 ) [virtual]

Prints a rectangular part of an on-screen window. Parameters The window from where to capture. The rectangle left The rectangle top The rectangle width The rectangle height Optional horizontal offset from current graphics origin where to print the captured rectangle. delta_y As above, vertically. win x y w h delta_x Reimplemented from Fl_Paged_Device. 30.99.2.9 int Fl Printer::printable rect ( int w, int h ) [virtual]

Computes the width and height of the printable area of the page. Values are in the same unit as that used by FLTK drawing functions, are unchanged by calls to origin(), but are changed by scale() calls. Values account for the user-selected paper type and print orientation. Returns 0 if OK, non-zero if any error Reimplemented from Fl_Paged_Device. 30.99.2.10 void Fl Printer::rotate ( oat angle ) [virtual]

Rotates the graphics operations relatively to paper. The rotation is centered on the current graphics origin. Successive rotate() calls dont combine their effects. Parameters angle Rotation angle in counter-clockwise degrees.

Reimplemented from Fl_Paged_Device.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.99 Fl_Printer Class Reference 30.99.2.11 void Fl Printer::scale ( oat scale x, oat scale y = 0. ) [virtual]

657

Changes the scaling of page coordinates. This function also resets the origin of graphics functions at top left of printable page area. After a scale() call, do a printable_rect() call to get the new dimensions of the printable page area. Successive scale() calls dont combine their effects. Parameters scale_x Horizontal dimensions of plot are multiplied by this quantity. scale_y Same as above, vertically. The value 0. is equivalent to setting scale_y = scale_x. Thus, scale(factor); is equivalent to scale(factor, factor); Reimplemented from Fl_Paged_Device. 30.99.2.12 void Fl Printer::set current ( void ) [virtual]

Use this drawing surface for future graphics requests. Reimplemented from Fl_Surface_Device. 30.99.2.13 int Fl Printer::start job ( int pagecount, int frompage = NULL, int topage = NULL ) [virtual]

Starts a print job. Parameters in out out

pagecount the total number of pages of the job frompage if non-null, frompage is set to the rst page the user wants printed topage if non-null, topage is set to the last page the user wants printed

Returns 0 if OK, non-zero if any error Reimplemented from Fl_Paged_Device.

30.99.2.14

int Fl Printer::start page ( void ) [virtual]

Starts a new printed page. The page coordinates are initially in points, i.e., 1/72 inch, and with origin at the top left of the printable page area. Returns 0 if OK, non-zero if any error Reimplemented from Fl_Paged_Device.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

658 30.99.2.15 void Fl Printer::translate ( int x, int y ) [virtual]

Class Documentation

Translates the current graphics origin accounting for the current rotation. This function is only useful after a rotate() call. Each translate() call must be matched by an untranslate() call. Successive translate() calls add up their effects. Reimplemented from Fl_Paged_Device.

30.99.3
30.99.3.1

Member Data Documentation


const char Fl_Printer::class_id = Fl Printer [static]

A string that identies each subclass of Fl_Device. Function class_name() applied to a device of this class returns this string. Reimplemented from Fl_Paged_Device. The documentation for this class was generated from the following les: Fl_Printer.H Fl_Printer.cxx

30.100

Fl Progress Class Reference

Displays a progress bar for the user. #include <Fl_Progress.H> Inheritance diagram for Fl_Progress:

Fl_Widget Fl_Progress

Public Member Functions


Fl_Progress (int x, int y, int w, int h, const char l=0)
The constructor creates the progress bar using the position, size, and label.

void maximum (oat v)


Sets the maximum value in the progress widget.

oat maximum () const


Gets the maximum value in the progress widget.

void minimum (oat v)


Sets the minimum value in the progress widget.

oat minimum () const


Gets the minimum value in the progress widget.

void value (oat v)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.100 Fl_Progress Class Reference


Sets the current value in the progress widget.

659

oat value () const


Gets the current value in the progress widget.

Protected Member Functions


virtual void draw ()
Draws the progress bar.

30.100.1

Detailed Description

Displays a progress bar for the user.

30.100.2
30.100.2.1

Constructor & Destructor Documentation


Fl Progress::Fl Progress ( int X, int Y, int W, int H, const char L = 0 )

The constructor creates the progress bar using the position, size, and label. You can set the background color with color() and the progress bar color with selection_color(), or you can set both colors together with color(unsigned bg, unsigned sel). The default colors are FL_BACKGROUND2_COLOR and FL_YELLOW, resp.

30.100.3
30.100.3.1

Member Function Documentation


void Fl Progress::draw ( void ) [protected, virtual]

Draws the progress bar. Implements Fl_Widget. 30.100.3.2 void Fl Progress::maximum ( oat v ) [inline]

Sets the maximum value in the progress widget. 30.100.3.3 oat Fl Progress::maximum ( ) const [inline]

Gets the maximum value in the progress widget. 30.100.3.4 void Fl Progress::minimum ( oat v ) [inline]

Sets the minimum value in the progress widget. 30.100.3.5 oat Fl Progress::minimum ( ) const [inline]

Gets the minimum value in the progress widget.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

660 30.100.3.6 void Fl Progress::value ( oat v ) [inline]

Class Documentation

Sets the current value in the progress widget. 30.100.3.7 oat Fl Progress::value ( ) const [inline]

Gets the current value in the progress widget. The documentation for this class was generated from the following les: Fl_Progress.H Fl_Progress.cxx

30.101

Fl Quartz Graphics Driver Class Reference

The Mac OS X-specic graphics class. #include <Fl_Device.H> Inheritance diagram for Fl_Quartz_Graphics_Driver:

Fl_Device Fl_Graphics_Driver Fl_Quartz_Graphics_Driver

Public Member Functions


const char class_name ()
Returns the name of the class of this object.

void color (Fl_Color c)


see _color(Fl_Color c).

void color (uchar r, uchar g, uchar b)


see _color(uchar r, uchar g, uchar b).

int descent ()
see _descent().

void draw (const char str, int n, int x, int y)


see _draw(const char str, int n, int x, int y).

void draw (int angle, const char str, int n, int x, int y)
see _draw(int angle, const char str, int n, int x, int y).

void draw (Fl_Pixmap pxm, int XP, int YP, int WP, int HP, int cx, int cy)
Draws an Fl_Pixmap object to the device.

void draw (Fl_Bitmap pxm, int XP, int YP, int WP, int HP, int cx, int cy)
Draws an Fl_Bitmap object to the device.

void draw (Fl_RGB_Image img, int XP, int YP, int WP, int HP, int cx, int cy)
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.101 Fl_Quartz_Graphics_Driver Class Reference


Draws an Fl_RGB_Image object to the device.

661

void draw_image (const uchar buf, int X, int Y, int W, int H, int D=3, int L=0)
see _draw_image(const uchar buf, int X,int Y,int W,int H, int D, int L).

void draw_image (Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D=3)
see _draw_image(Fl_Draw_Image_Cb cb, void data, int X,int Y,int W,int H, int D).

void draw_image_mono (const uchar buf, int X, int Y, int W, int H, int D=1, int L=0)
see _draw_image_mono(const uchar buf, int X,int Y,int W,int H, int D, int L).

void draw_image_mono (Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D=1)
see _draw_image_mono(Fl_Draw_Image_Cb cb, void data, int X,int Y,int W,int H, int D).

void font (Fl_Font face, Fl_Fontsize size)


see _font(Fl_Font face, Fl_Fontsize size).

int height ()
see _height().

void rtl_draw (const char str, int n, int x, int y)


see _rtl_draw(const char str, int n, int x, int y).

void text_extents (const char , int n, int &dx, int &dy, int &w, int &h)
see _text_extents(const char, int n, int& dx, int& dy, int& w, int& h).

double width (const char str, int n)


see _width(const char str, int n).

double width (unsigned int c)


see _width(unsigned int n).

Static Public Attributes


static const char class_id = "Fl_Quartz_Graphics_Driver"
A string that identies each subclass of Fl_Device.

30.101.1

Detailed Description

The Mac OS X-specic graphics class. This class is implemented only on the Mac OS X platform.

30.101.2
30.101.2.1

Member Function Documentation


const char Fl Quartz Graphics Driver::class name ( ) [inline, virtual]

Returns the name of the class of this object. The class of an instance of an Fl_Device subclass can be checked with code such as:
if ( instance->class_name() == Fl_Printer::class_id ) { ... }

Reimplemented from Fl_Graphics_Driver. 30.101.2.2 void Fl Quartz Graphics Driver::color ( Fl_Color c ) [virtual]

see _color(Fl_Color c). Reimplemented from Fl_Graphics_Driver.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

662 30.101.2.3

Class Documentation void Fl Quartz Graphics Driver::color ( uchar r, uchar g, uchar b ) [virtual]

see _color(uchar r, uchar g, uchar b). Implements Fl_Graphics_Driver. 30.101.2.4 int Fl Quartz Graphics Driver::descent ( ) [virtual]

see _descent(). Implements Fl_Graphics_Driver. 30.101.2.5 void Fl Quartz Graphics Driver::draw ( const char str, int n, int x, int y ) [virtual]

see _draw(const char str, int n, int x, int y). Implements Fl_Graphics_Driver. 30.101.2.6 void Fl Quartz Graphics Driver::draw ( int angle, const char str, int n, int x, int y ) [virtual]

see _draw(int angle, const char str, int n, int x, int y). Implements Fl_Graphics_Driver. 30.101.2.7 void Fl Quartz Graphics Driver::draw ( Fl_Pixmap pxm, int XP, int YP, int WP, int HP, int cx, int cy ) [virtual]

Draws an Fl_Pixmap object to the device. Species a bounding box for the image, with the origin (upper left-hand corner) of the image offset by the cx and cy arguments. Implements Fl_Graphics_Driver. 30.101.2.8 void Fl Quartz Graphics Driver::draw ( Fl_Bitmap bm, int XP, int YP, int WP, int HP, int cx, int cy ) [virtual]

Draws an Fl_Bitmap object to the device. Species a bounding box for the image, with the origin (upper left-hand corner) of the image offset by the cx and cy arguments. Implements Fl_Graphics_Driver. 30.101.2.9 void Fl Quartz Graphics Driver::draw ( Fl_RGB_Image rgb, int XP, int YP, int WP, int HP, int cx, int cy ) [virtual]

Draws an Fl_RGB_Image object to the device. Species a bounding box for the image, with the origin (upper left-hand corner) of the image offset by the cx and cy arguments. Implements Fl_Graphics_Driver.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.101 Fl_Quartz_Graphics_Driver Class Reference 30.101.2.10

663

void Fl Quartz Graphics Driver::draw image ( const uchar buf, int X, int Y, int W, int H, int D = 3, int L = 0 ) [virtual]

see _draw_image(const uchar buf, int X,int Y,int W,int H, int D, int L). Implements Fl_Graphics_Driver. 30.101.2.11 void Fl Quartz Graphics Driver::draw image ( Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D = 3 ) [virtual]

see _draw_image(Fl_Draw_Image_Cb cb, void data, int X,int Y,int W,int H, int D). Implements Fl_Graphics_Driver. 30.101.2.12 void Fl Quartz Graphics Driver::draw image mono ( const uchar buf, int X, int Y, int W, int H, int D = 1, int L = 0 ) [virtual]

see _draw_image_mono(const uchar buf, int X,int Y,int W,int H, int D, int L). Implements Fl_Graphics_Driver. 30.101.2.13 void Fl Quartz Graphics Driver::draw image mono ( Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D = 1 ) [virtual]

see _draw_image_mono(Fl_Draw_Image_Cb cb, void data, int X,int Y,int W,int H, int D). Implements Fl_Graphics_Driver. 30.101.2.14 void Fl Quartz Graphics Driver::font ( Fl_Font face, Fl_Fontsize size ) [virtual]

see _font(Fl_Font face, Fl_Fontsize size). Reimplemented from Fl_Graphics_Driver. 30.101.2.15 int Fl Quartz Graphics Driver::height ( ) [virtual]

see _height(). Implements Fl_Graphics_Driver. 30.101.2.16 void Fl Quartz Graphics Driver::rtl draw ( const char str, int n, int x, int y ) [virtual]

see _rtl_draw(const char str, int n, int x, int y). Implements Fl_Graphics_Driver. 30.101.2.17 void Fl Quartz Graphics Driver::text extents ( const char t, int n, int & dx, int & dy, int & w, int & h ) [virtual]

see _text_extents(const char, int n, int& dx, int& dy, int& w, int& h). Reimplemented from Fl_Graphics_Driver.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

664 30.101.2.18

Class Documentation double Fl Quartz Graphics Driver::width ( const char str, int n ) [virtual]

see _width(const char str, int n). Implements Fl_Graphics_Driver. 30.101.2.19 double Fl Quartz Graphics Driver::width ( unsigned int c ) [virtual]

see _width(unsigned int n). Reimplemented from Fl_Graphics_Driver.

30.101.3
30.101.3.1

Member Data Documentation


const char Fl_Quartz_Graphics_Driver::class_id = Fl Quartz Graphics Driver [static]

A string that identies each subclass of Fl_Device. Function class_name() applied to a device of this class returns this string. Reimplemented from Fl_Graphics_Driver. The documentation for this class was generated from the following les: Fl_Device.H _color_mac.cxx Fl_Device.cxx _draw_image_mac.cxx

30.102

Fl Radio Button Class Reference

Inheritance diagram for Fl_Radio_Button:

Fl_Widget Fl_Button Fl_Radio_Button

Public Member Functions


Fl_Radio_Button (int x, int y, int w, int h, const char l=0) The documentation for this class was generated from the following le: Fl_Radio_Button.H
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.103 Fl_Radio_Light_Button Class Reference

665

30.103

Fl Radio Light Button Class Reference

Inheritance diagram for Fl_Radio_Light_Button:


Fl_Widget Fl_Button Fl_Light_Button Fl_Radio_Light_Button

Public Member Functions


Fl_Radio_Light_Button (int X, int Y, int W, int H, const char l=0) The documentation for this class was generated from the following le: Fl_Radio_Light_Button.H

30.104

Fl Radio Round Button Class Reference

Inheritance diagram for Fl_Radio_Round_Button:


Fl_Widget Fl_Button Fl_Light_Button Fl_Round_Button Fl_Radio_Round_Button

Public Member Functions


Fl_Radio_Round_Button (int x, int y, int w, int h, const char l=0) The documentation for this class was generated from the following le: Fl_Radio_Round_Button.H
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

666

Class Documentation

30.105

Fl Repeat Button Class Reference

The Fl_Repeat_Button is a subclass of Fl_Button that generates a callback when it is pressed and then repeatedly generates callbacks as long as it is held down. #include <Fl_Repeat_Button.H> Inheritance diagram for Fl_Repeat_Button:

Fl_Widget Fl_Button Fl_Repeat_Button

Public Member Functions


void deactivate ()
Deactivates the widget.

Fl_Repeat_Button (int X, int Y, int W, int H, const char l=0)


Creates a new Fl_Repeat_Button widget using the given position, size, and label string.

int handle (int)


Handles the specied event.

30.105.1

Detailed Description

The Fl_Repeat_Button is a subclass of Fl_Button that generates a callback when it is pressed and then repeatedly generates callbacks as long as it is held down. The speed of the repeat is xed and depends on the implementation.

30.105.2
30.105.2.1

Constructor & Destructor Documentation


Fl Repeat Button::Fl Repeat Button ( int X, int Y, int W, int H, const char l = 0 ) [inline]

Creates a new Fl_Repeat_Button widget using the given position, size, and label string. The default boxtype is FL_UP_BOX. Deletes the button.

30.105.3
30.105.3.1

Member Function Documentation


void Fl Repeat Button::deactivate ( ) [inline]

Deactivates the widget. Inactive widgets will be drawn "grayed out", e.g. with less contrast than the active widget. Inactive widgets will not receive any keyboard or mouse button events. Other events (including FL_ENTER, FL_MOVE,
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.106 Fl_Return_Button Class Reference

667

FL_LEAVE, FL_SHORTCUT, and others) will still be sent. A widget is only active if active() is true on it and all of its parents. Changing this value will send FL_DEACTIVATE to the widget if active_r() is true. Currently you cannot deactivate Fl_Window widgets. See also activate(), active(), active_r() Reimplemented from Fl_Widget. 30.105.3.2 int Fl Repeat Button::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted

See also Fl_Event Reimplemented from Fl_Button. The documentation for this class was generated from the following les: Fl_Repeat_Button.H Fl_Repeat_Button.cxx

30.106

Fl Return Button Class Reference

The Fl_Return_Button is a subclass of Fl_Button that generates a callback when it is pressed or when the user presses the Enter key. #include <Fl_Return_Button.H> Inheritance diagram for Fl_Return_Button:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

668

Class Documentation

Fl_Widget Fl_Button Fl_Return_Button

Public Member Functions


Fl_Return_Button (int X, int Y, int W, int H, const char l=0)
Creates a new Fl_Return_Button widget using the given position, size, and label string.

int handle (int)


Handles the specied event.

Protected Member Functions


void draw ()
Draws the widget.

30.106.1

Detailed Description

The Fl_Return_Button is a subclass of Fl_Button that generates a callback when it is pressed or when the user presses the Enter key. A carriage-return symbol is drawn next to the button label.

Figure 30.25: Fl_Return_Button

30.106.2
30.106.2.1

Constructor & Destructor Documentation


Fl Return Button::Fl Return Button ( int X, int Y, int W, int H, const char l = 0 ) [inline]

Creates a new Fl_Return_Button widget using the given position, size, and label string. The default boxtype is FL_UP_BOX. The inherited destructor deletes the button.

30.106.3
30.106.3.1

Member Function Documentation


void Fl Return Button::draw ( ) [protected, virtual]

Draws the widget.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.107 Fl_RGB_Image Class Reference

669

Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Reimplemented from Fl_Button. 30.106.3.2 int Fl Return Button::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted

See also Fl_Event Reimplemented from Fl_Button. The documentation for this class was generated from the following les: Fl_Return_Button.H Fl_Return_Button.cxx

30.107

Fl RGB Image Class Reference

The Fl_RGB_Image class supports caching and drawing of full-color images with 1 to 4 channels of color information. #include <Fl_Image.H> Inheritance diagram for Fl_RGB_Image:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

670

Class Documentation

Fl_Image Fl_RGB_Image Fl_BMP_Image Fl_JPEG_Image Fl_PNG_Image Fl_PNM_Image

Public Member Functions


virtual void color_average (Fl_Color c, oat i)
The color_average() method averages the colors in the image with the FLTK color value c.

virtual Fl_Image copy (int W, int H)


The copy() method creates a copy of the specied image.

Fl_Image copy ()
The copy() method creates a copy of the specied image.

virtual void desaturate ()


The desaturate() method converts an image to grayscale.

virtual void draw (int X, int Y, int W, int H, int cx=0, int cy=0)
Draws the image with a bounding box.

void draw (int X, int Y)


Draws the image.

Fl_RGB_Image (const uchar bits, int W, int H, int D=3, int LD=0)
The constructor creates a new image from the specied data.

virtual void label (Fl_Widget w)


The label() methods are an obsolete way to set the image attribute of a widget or menu item.

virtual void label (Fl_Menu_Item m)


The label() methods are an obsolete way to set the image attribute of a widget or menu item.

virtual void uncache ()


If the image has been cached for display, delete the cache data.

virtual Fl_RGB_Image ()
The destructor free all memory and server resources that are used by the image.

Public Attributes
int alloc_array const uchar array

Friends
class Fl_GDI_Graphics_Driver class Fl_Quartz_Graphics_Driver class Fl_Xlib_Graphics_Driver
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.107 Fl_RGB_Image Class Reference

671

30.107.1

Detailed Description

The Fl_RGB_Image class supports caching and drawing of full-color images with 1 to 4 channels of color information. Images with an even number of channels are assumed to contain alpha information, which is used to blend the image with the contents of the screen. Fl_RGB_Image is dened in <FL/Fl_Image.H>, however for compatibility reasons <FL/Fl_RGB_Image.H> should be included.

30.107.2
30.107.2.1

Constructor & Destructor Documentation


Fl RGB Image::Fl RGB Image ( const uchar bits, int W, int H, int D = 3, int LD = 0 ) [inline]

The constructor creates a new image from the specied data.

30.107.2.2

Fl RGB Image::Fl RGB Image ( ) [virtual]

The destructor free all memory and server resources that are used by the image.

30.107.3
30.107.3.1

Member Function Documentation


void Fl RGB Image::color average ( Fl_Color c, oat i ) [virtual]

The color_average() method averages the colors in the image with the FLTK color value c. The i argument species the amount of the original image to combine with the color, so a value of 1.0 results in no color blend, and a value of 0.0 results in a constant image of the specied color. The original image data is not altered by this method. Reimplemented from Fl_Image.

30.107.3.2 Fl_Image Fl RGB Image::copy ( int W, int H ) [virtual] The copy() method creates a copy of the specied image. If the width and height are provided, the image is resized to the specied size. The image should be deleted (or in the case of Fl_Shared_Image, released) when you are done with it. Reimplemented from Fl_Image.

30.107.3.3 Fl_Image Fl RGB Image::copy ( ) [inline] The copy() method creates a copy of the specied image. If the width and height are provided, the image is resized to the specied size. The image should be deleted (or in the case of Fl_Shared_Image, released) when you are done with it. Reimplemented from Fl_Image.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

672 30.107.3.4 void Fl RGB Image::desaturate ( ) [virtual]

Class Documentation

The desaturate() method converts an image to grayscale. If the image contains an alpha channel (depth = 4), the alpha channel is preserved. This method does not alter the original image data. Reimplemented from Fl_Image.

30.107.3.5

void Fl RGB Image::draw ( int X, int Y, int W, int H, int cx = 0, int cy = 0 ) [virtual]

Draws the image with a bounding box. This form species a bounding box for the image, with the origin (upper-lefthand corner) of the image offset by the cx and cy arguments. Reimplemented from Fl_Image.

30.107.3.6

void Fl RGB Image::draw ( int X, int Y ) [inline]

Draws the image. This form species the upper-lefthand corner of the image. Reimplemented from Fl_Image.

30.107.3.7

void Fl RGB Image::label ( Fl_Widget widget ) [virtual]

The label() methods are an obsolete way to set the image attribute of a widget or menu item. Use the image() or deimage() methods of the Fl_Widget and Fl_Menu_Item classes instead. Reimplemented from Fl_Image.

30.107.3.8

void Fl RGB Image::label ( Fl_Menu_Item m ) [virtual]

The label() methods are an obsolete way to set the image attribute of a widget or menu item. Use the image() or deimage() methods of the Fl_Widget and Fl_Menu_Item classes instead. Reimplemented from Fl_Image.

30.107.3.9

void Fl RGB Image::uncache ( ) [virtual]

If the image has been cached for display, delete the cache data. This allows you to change the data used for the image and then redraw it without recreating an image object. Reimplemented from Fl_Image. The documentation for this class was generated from the following les: Fl_Image.H Fl_Image.cxx
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.108 Fl_Roller Class Reference

673

30.108

Fl Roller Class Reference

The Fl_Roller widget is a "dolly" control commonly used to move 3D objects. #include <Fl_Roller.H> Inheritance diagram for Fl_Roller:

Fl_Widget Fl_Valuator Fl_Roller

Public Member Functions


Fl_Roller (int X, int Y, int W, int H, const char L=0)
Creates a new Fl_Roller widget using the given position, size, and label string.

int handle (int)


Handles the specied event.

Protected Member Functions


void draw ()
Draws the widget.

30.108.1

Detailed Description

The Fl_Roller widget is a "dolly" control commonly used to move 3D objects.

Figure 30.26: Fl_Roller

30.108.2
30.108.2.1

Constructor & Destructor Documentation


Fl Roller::Fl Roller ( int X, int Y, int W, int H, const char L = 0 )

Creates a new Fl_Roller widget using the given position, size, and label string.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

674 The default boxtype is FL_NO_BOX. Inherited destructor destroys the valuator.

Class Documentation

30.108.3
30.108.3.1

Member Function Documentation


void Fl Roller::draw ( ) [protected, virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Implements Fl_Widget. 30.108.3.2 int Fl Roller::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted

See also Fl_Event Reimplemented from Fl_Widget. The documentation for this class was generated from the following les: Fl_Roller.H Fl_Roller.cxx
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.109 Fl_Round_Button Class Reference

675

30.109

Fl Round Button Class Reference

Buttons generate callbacks when they are clicked by the user. #include <Fl_Round_Button.H> Inheritance diagram for Fl_Round_Button:
Fl_Widget Fl_Button Fl_Light_Button Fl_Round_Button Fl_Radio_Round_Button

Public Member Functions


Fl_Round_Button (int x, int y, int w, int h, const char l=0)
Creates a new Fl_Round_Button widget using the given position, size, and label string.

30.109.1

Detailed Description

Buttons generate callbacks when they are clicked by the user. You control exactly when and how by changing the values for type() and when().

Figure 30.27: Fl_Round_Button

The Fl_Round_Button subclass display the "on" state by turning on a light, rather than drawing pushed in. The shape of the "light" is initially set to FL_ROUND_DOWN_BOX. The color of the light when on is controlled with selection_color(), which defaults to FL_RED. The documentation for this class was generated from the following les: Fl_Round_Button.H Fl_Round_Button.cxx

30.110

Fl Round Clock Class Reference

A clock widget of type FL_ROUND_CLOCK.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

676 #include <Fl_Round_Clock.H> Inheritance diagram for Fl_Round_Clock:


Fl_Widget Fl_Clock_Output Fl_Clock Fl_Round_Clock

Class Documentation

Public Member Functions


Fl_Round_Clock (int x, int y, int w, int h, const char l=0)
Creates the clock widget, setting his type and box.

30.110.1

Detailed Description

A clock widget of type FL_ROUND_CLOCK. Has no box.

30.110.2
30.110.2.1

Constructor & Destructor Documentation


Fl Round Clock::Fl Round Clock ( int x, int y, int w, int h, const char l = 0 ) [inline]

Creates the clock widget, setting his type and box. The documentation for this class was generated from the following le: Fl_Round_Clock.H

30.111

Fl Scroll Class Reference

This container widget lets you maneuver around a set of widgets much larger than your window. #include <Fl_Scroll.H> Inheritance diagram for Fl_Scroll:

Fl_Widget Fl_Group Fl_Scroll

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.111 Fl_Scroll Class Reference

677

Classes
struct ScrollInfo

Public Types
enum { HORIZONTAL = 1, VERTICAL = 2, BOTH = 3, ALWAYS_ON = 4, HORIZONTAL_ALWAYS = 5, VERTICAL_ALWAYS = 6, BOTH_ALWAYS = 7 }

Public Member Functions


void clear ()
Clear all but the scrollbars...

Fl_Scroll (int X, int Y, int W, int H, const char l=0)


Creates a new Fl_Scroll widget using the given position, size, and label string.

int handle (int)


Handles the specied event.

void resize (int, int, int, int)


Resizes the Fl_Group widget and all of its children.

void scroll_to (int, int)


Moves the contents of the scroll group to a new position.

int scrollbar_size () const


Gets the current size of the scrollbars troughs, in pixels.

void scrollbar_size (int size)


Sets the pixel size of the scrollbars troughs to the size, in pixels.

int xposition () const


Gets the current horizontal scrolling position.

int yposition () const


Gets the current vertical scrolling position.

Public Attributes
Fl_Scrollbar hscrollbar Fl_Scrollbar scrollbar

Protected Member Functions


void bbox (int &, int &, int &, int &)
Returns the bounding box for the interior of the scrolling area, inside the scrollbars.

void draw ()
Draws the widget.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

678

Class Documentation

30.111.1

Detailed Description

This container widget lets you maneuver around a set of widgets much larger than your window. If the child widgets are larger than the size of this object then scrollbars will appear so that you can scroll over to them:

Figure 30.28: Fl_Scroll

If all of the child widgets are packed together into a solid rectangle then you want to set box() to FL_NO_BOX or one of the _FRAME types. This will result in the best output. However, if the child widgets are a sparse arrangement you must set box() to a real _BOX type. This can result in some blinking during redrawing, but that can be solved by using a Fl_Double_Window. By default you can scroll in both directions, and the scrollbars disappear if the data will t in the area of the scroll. Use Fl_Scroll::type() to change this as follows : 0 - No scrollbars Fl_Scroll::HORIZONTAL - Only a horizontal scrollbar. Fl_Scroll::VERTICAL - Only a vertical scrollbar. Fl_Scroll::BOTH - The default is both scrollbars. Fl_Scroll::HORIZONTAL_ALWAYS - Horizontal scrollbar always on, vertical always off. Fl_Scroll::VERTICAL_ALWAYS - Vertical scrollbar always on, horizontal always off. Fl_Scroll::BOTH_ALWAYS - Both always on. Use scrollbar.align(int) ( see void Fl_Widget::align(Fl_Align) ) : to change what side the scrollbars are drawn on. If the FL_ALIGN_LEFT bit is on, the vertical scrollbar is on the left. If the FL_ALIGN_TOP bit is on, the horizontal scrollbar is on the top. Note that only the alignment ags in scrollbar are considered. The ags in hscrollbar however are ignored. This widget can also be used to pan around a single child widget "canvas". This child widget should be of your own class, with a draw() method that draws the contents. The scrolling is done by changing the x() and y() of the widget, so this child must use the x() and y() to position its drawing. To speed up drawing it should test _push_clip(). Another very useful child is a single Fl_Pack, which is itself a group that packs its children together and changes size to surround them. Filling the Fl_Pack with Fl_Tabs groups (and then putting normal widgets inside those) gives you a very powerful scrolling list of individually-openable panels.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.111 Fl_Scroll Class Reference

679

Fluid lets you create these, but you can only lay out objects that t inside the Fl_Scroll without scrolling. Be sure to leave space for the scrollbars, as Fluid wont show these either. You cannot use Fl_Window as a child of this since the clipping is not conveyed to it when drawn, and it will draw over the scrollbars and neighboring objects.

30.111.2
30.111.2.1

Constructor & Destructor Documentation


Fl Scroll::Fl Scroll ( int X, int Y, int W, int H, const char L = 0 )

Creates a new Fl_Scroll widget using the given position, size, and label string. The default boxtype is FL_NO_BOX. The destructor also deletes all the children. This allows a whole tree to be deleted at once, without having to keep a pointer to all the children in the user code. A kludge has been done so the Fl_Scroll and all of its children can be automatic (local) variables, but you must declare the Fl_Scrollrst, so that it is destroyed last.

30.111.3
30.111.3.1

Member Function Documentation


void Fl Scroll::bbox ( int & X, int & Y, int & W, int & H ) [protected]

Returns the bounding box for the interior of the scrolling area, inside the scrollbars. Currently this is only reliable after draw(), and before any resizing of the Fl_Scroll or any child widgets occur. Todo The visibility of the scrollbars ought to be checked/calculated outside of the draw() method (STR #1895).

30.111.3.2

void Fl Scroll::clear ( )

Clear all but the scrollbars... Reimplemented from Fl_Group. 30.111.3.3 void Fl Scroll::draw ( ) [protected, virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Reimplemented from Fl_Group.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

680 30.111.3.4 int Fl Scroll::handle ( int event ) [virtual]

Class Documentation

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted

See also Fl_Event Reimplemented from Fl_Group. 30.111.3.5 void Fl Scroll::resize ( int X, int Y, int W, int H ) [virtual]

Resizes the Fl_Group widget and all of its children. The Fl_Group widget rst resizes itself, and then it moves and resizes all its children according to the rules documented for Fl_Group::resizable(Fl_Widget) See also Fl_Group::resizable(Fl_Widget) Fl_Group::resizable() Fl_Widget::resize(int,int,int,int) Reimplemented from Fl_Group. 30.111.3.6 void Fl Scroll::scroll to ( int X, int Y )

Moves the contents of the scroll group to a new position. 30.111.3.7 int Fl Scroll::scrollbar size ( ) const [inline]

Gets the current size of the scrollbars troughs, in pixels. If this value is zero (default), this widget will use the Fl::scrollbar_size() value as the scrollbars width.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.112 Fl_Scrollbar Class Reference Returns Scrollbar size in pixels, or 0 if the global Fl::scrollsize() is being used.

681

See also Fl::scrollbar_size(int)

30.111.3.8

void Fl Scroll::scrollbar size ( int size ) [inline]

Sets the pixel size of the scrollbars troughs to the size, in pixels. Normally you should not need this method, and should use Fl::scrollbar_size(int) instead to manage the size of ALL your widgets scrollbars. This ensures your application has a consistent UI, is the default behavior, and is normally what you want. Only use THIS method if you really need to override the global scrollbar size. The need for this should be rare. Setting size to the special value of 0 causes the widget to track the global Fl::scrollbar_size(), which is the default. Parameters in

size Sets the scrollbar size in pixels. If 0 (default), scrollbar size tracks the global Fl::scrollbar_size()

See also Fl::scrollbar_size()

30.111.3.9

int Fl Scroll::xposition ( ) const [inline]

Gets the current horizontal scrolling position. 30.111.3.10 int Fl Scroll::yposition ( ) const [inline]

Gets the current vertical scrolling position. The documentation for this class was generated from the following les: Fl_Scroll.H Fl_Scroll.cxx

30.112

Fl Scrollbar Class Reference

The Fl_Scrollbar widget displays a slider with arrow buttons at the ends of the scrollbar. #include <Fl_Scrollbar.H> Inheritance diagram for Fl_Scrollbar:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

682
Fl_Widget Fl_Valuator Fl_Slider Fl_Scrollbar

Class Documentation

Public Member Functions


Fl_Scrollbar (int X, int Y, int W, int H, const char L=0)
Creates a new Fl_Scrollbar widget with given position, size, and label.

int handle (int)


Handles the specied event.

int linesize () const


Get the size of step, in lines, that the arror keys move.

void linesize (int i)


This number controls how big the steps are that the arrow keys do.

int value () const


Gets the integer value (position) of the slider in the scrollbar.

int value (int p)


Sets the value (position) of the slider in the scrollbar.

int value (int pos, int size, int rst, int total)
Sets the position, size and range of the slider in the scrollbar.

Fl_Scrollbar ()
Destroys the Scrollbar.

Protected Member Functions


void draw ()
Draws the widget.

30.112.1

Detailed Description

The Fl_Scrollbar widget displays a slider with arrow buttons at the ends of the scrollbar. Clicking on the arrows move up/left and down/right by linesize(). Scrollbars also accept FL_SHORTCUT events: the arrows move by linesize(), and vertical scrollbars take Page Up/Down (they move by the page size minus linesize()) and Home/End (they jump to the top or bottom). Scrollbars have step(1) preset (they always return integers). If desired you can set the step() to non-integer values. You will then have to use casts to get at the oating-point versions of value() from Fl_Slider.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.112 Fl_Scrollbar Class Reference

683

Figure 30.29: Fl_Scrollbar

30.112.2
30.112.2.1

Constructor & Destructor Documentation


Fl Scrollbar::Fl Scrollbar ( int X, int Y, int W, int H, const char L = 0 )

Creates a new Fl_Scrollbar widget with given position, size, and label. You need to do type(FL_HORIZONTAL) if you want a horizontal scrollbar. 30.112.2.2 Fl Scrollbar::Fl Scrollbar ( )

Destroys the Scrollbar.

30.112.3
30.112.3.1

Member Function Documentation


void Fl Scrollbar::draw ( ) [protected, virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Reimplemented from Fl_Slider. 30.112.3.2 int Fl Scrollbar::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

684

Class Documentation

Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted

See also Fl_Event Reimplemented from Fl_Slider. 30.112.3.3 void Fl Scrollbar::linesize ( int i ) [inline]

This number controls how big the steps are that the arrow keys do. In addition page up/down move by the size last sent to value() minus one linesize(). The default is 16. 30.112.3.4 int Fl Scrollbar::value ( ) const [inline]

Gets the integer value (position) of the slider in the scrollbar. You can get the oating point value with Fl_Slider::value(). See also Fl_Scrollbar::value(int p) Fl_Scrollbar::value(int pos, int size, int rst, int total) Reimplemented from Fl_Valuator. 30.112.3.5 int Fl Scrollbar::value ( int p ) [inline]

Sets the value (position) of the slider in the scrollbar. See also Fl_Scrollbar::value() Fl_Scrollbar::value(int pos, int size, int rst, int total)

30.112.3.6

int Fl Scrollbar::value ( int pos, int size, int rst, int total ) [inline]

Sets the position, size and range of the slider in the scrollbar. Parameters
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.113 Fl_Secret_Input Class Reference

685

in in in in

pos size rst total

position, rst line displayed window size, number of lines displayed number of rst line total number of lines

You should call this every time your window changes size, your data changes size, or your scroll position changes (even if in response to a callback from this scrollbar). All necessary calls to redraw() are done. Calls Fl_Slider::scrollvalue(int pos, int size, int rst, int total). The documentation for this class was generated from the following les: Fl_Scrollbar.H Fl_Scrollbar.cxx

30.113

Fl Secret Input Class Reference

The Fl_Secret_Input class is a subclass of Fl_Input that displays its input as a string of placeholders. #include <Fl_Secret_Input.H> Inheritance diagram for Fl_Secret_Input:
Fl_Widget Fl_Input_ Fl_Input Fl_Secret_Input

Public Member Functions


Fl_Secret_Input (int X, int Y, int W, int H, const char l=0)
Creates a new Fl_Secret_Input widget using the given position, size, and label string.

30.113.1

Detailed Description

The Fl_Secret_Input class is a subclass of Fl_Input that displays its input as a string of placeholders. Depending on the platform this placeholder is either the asterisk () or the Unicode bullet character (U+2022). This subclass is usually used to receive passwords and other "secret" information.

30.113.2

Constructor & Destructor Documentation

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

686 30.113.2.1

Class Documentation Fl Secret Input::Fl Secret Input ( int X, int Y, int W, int H, const char l = 0 ) [inline]

Creates a new Fl_Secret_Input widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX. Inherited destructor destroys the widget and any value associated with it. The documentation for this class was generated from the following le: Fl_Secret_Input.H

30.114

Fl Select Browser Class Reference

The class is a subclass of Fl_Browser which lets the user select a single item, or no items by clicking on the empty space. #include <Fl_Select_Browser.H> Inheritance diagram for Fl_Select_Browser:
Fl_Widget Fl_Group Fl_Browser_ Fl_Browser Fl_Select_Browser

Public Member Functions


Fl_Select_Browser (int X, int Y, int W, int H, const char L=0)
Creates a new Fl_Select_Browser widget using the given position, size, and label string.

30.114.1

Detailed Description

The class is a subclass of Fl_Browser which lets the user select a single item, or no items by clicking on the empty space. As long as the mouse button is held down on an unselected item it is highlighted. Normally the callback is done when the user presses the mouse, but you can change this with when(). See Fl_Browser for methods to add and remove lines from the browser.

30.114.2

Constructor & Destructor Documentation


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.115 Fl_Shared_Image Class Reference 30.114.2.1 Fl Select Browser::Fl Select Browser ( int X, int Y, int W, int H, const char L = 0 ) [inline]

687

Creates a new Fl_Select_Browser widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX. The constructor specializes Fl_Browser() by setting the type to FL_SELECT_BROWSER. The destructor destroys the widget and frees all memory that has been allocated. The documentation for this class was generated from the following le: Fl_Select_Browser.H

30.115

Fl Shared Image Class Reference

This class supports caching, loading, and drawing of image les. #include <Fl_Shared_Image.H> Inheritance diagram for Fl_Shared_Image:

Fl_Image Fl_Shared_Image

Public Member Functions


virtual void color_average (Fl_Color c, oat i)
The color_average() method averages the colors in the image with the FLTK color value c.

virtual Fl_Image copy (int W, int H)


The copy() method creates a copy of the specied image.

Fl_Image copy ()
The copy() method creates a copy of the specied image.

virtual void desaturate ()


The desaturate() method converts an image to grayscale.

virtual void draw (int X, int Y, int W, int H, int cx, int cy)
Draws the image with a bounding box.

void draw (int X, int Y)


Draws the image.

const char name ()


Returns the lename of the shared image.

int refcount ()
Returns the number of references of this shared image.

void release ()
Releases and possibly destroys (if refcount <=0) a shared image.

void reload ()
Reloads the shared image from disk.

virtual void uncache ()


If the image has been cached for display, delete the cache data.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

688

Class Documentation

Static Public Member Functions


static void add_handler (Fl_Shared_Handler f)
Adds a shared image handler, which is basically a test function for adding new formats.

static Fl_Shared_Image nd (const char n, int W=0, int H=0)


Finds a shared image from its named and size specications.

static Fl_Shared_Image get (const char n, int W=0, int H=0)


Find or load an image that can be shared by multiple widgets.

static Fl_Shared_Image images ()


Returns the Fl_Shared_Image array.

static int num_images ()


Returns the total number of shared images in the array.

static void remove_handler (Fl_Shared_Handler f)


Removes a shared image handler.

Protected Member Functions


void add () Fl_Shared_Image ()
Creates an empty shared image.

Fl_Shared_Image (const char n, Fl_Image img=0)


Creates a shared image from its lename and its corresponding Fl_Image img.

void update () virtual Fl_Shared_Image ()


The destructor free all memory and server resources that are used by the image.

Static Protected Member Functions


static int compare (Fl_Shared_Image i0, Fl_Shared_Image i1)

Protected Attributes
int alloc_image_ Fl_Image image_ const char name_ int original_ int refcount_

Static Protected Attributes


static int alloc_handlers_ = 0 static int alloc_images_ = 0 static Fl_Shared_Handler handlers_ = 0 static Fl_Shared_Image images_ = 0 static int num_handlers_ = 0 static int num_images_ = 0
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.115 Fl_Shared_Image Class Reference

689

Friends
class Fl_JPEG_Image class Fl_PNG_Image

30.115.1

Detailed Description

This class supports caching, loading, and drawing of image les. Most applications will also want to link against the tk_images library and call the _register_images() function to support standard image formats such as BMP, GIF, JPEG, and PNG.

30.115.2
30.115.2.1

Constructor & Destructor Documentation


Fl Shared Image::Fl Shared Image ( ) [protected]

Creates an empty shared image. The constructors create a new shared image record in the image cache. The constructors are protected and cannot be used directly from a program. Use the get() method instead. 30.115.2.2 Fl Shared Image::Fl Shared Image ( const char n, Fl_Image img = 0 ) [protected]

Creates a shared image from its lename and its corresponding Fl_Image img. The constructors create a new shared image record in the image cache. The constructors are protected and cannot be used directly from a program. Use the get() method instead. 30.115.2.3 Fl Shared Image::Fl Shared Image ( ) [protected, virtual]

The destructor free all memory and server resources that are used by the image. The destructor is protected and cannot be used directly from a program. Use the Fl_Shared_Image::release() method instead.

30.115.3
30.115.3.1

Member Function Documentation


void Fl Shared Image::color average ( Fl_Color c, oat i ) [virtual]

The color_average() method averages the colors in the image with the FLTK color value c. The i argument species the amount of the original image to combine with the color, so a value of 1.0 results in no color blend, and a value of 0.0 results in a constant image of the specied color. The original image data is not altered by this method. Reimplemented from Fl_Image. 30.115.3.2 Fl_Image Fl Shared Image::copy ( int W, int H ) [virtual] The copy() method creates a copy of the specied image.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

690

Class Documentation

If the width and height are provided, the image is resized to the specied size. The image should be deleted (or in the case of Fl_Shared_Image, released) when you are done with it. Reimplemented from Fl_Image. 30.115.3.3 Fl_Image Fl Shared Image::copy ( ) [inline] The copy() method creates a copy of the specied image. If the width and height are provided, the image is resized to the specied size. The image should be deleted (or in the case of Fl_Shared_Image, released) when you are done with it. Reimplemented from Fl_Image. 30.115.3.4 void Fl Shared Image::desaturate ( ) [virtual]

The desaturate() method converts an image to grayscale. If the image contains an alpha channel (depth = 4), the alpha channel is preserved. This method does not alter the original image data. Reimplemented from Fl_Image. 30.115.3.5 void Fl Shared Image::draw ( int X, int Y, int W, int H, int cx, int cy ) [virtual]

Draws the image with a bounding box. This form species a bounding box for the image, with the origin (upper-lefthand corner) of the image offset by the cx and cy arguments. Reimplemented from Fl_Image. 30.115.3.6 void Fl Shared Image::draw ( int X, int Y ) [inline]

Draws the image. This form species the upper-lefthand corner of the image. Reimplemented from Fl_Image. 30.115.3.7 Fl_Shared_Image Fl Shared Image::get ( const char n, int W = 0, int H = 0 ) [static] Find or load an image that can be shared by multiple widgets. Gets a shared image, if it exists already ; it will return it. If it does not exist or if it exist but with other size, then the existing image is deleted and replaced by a new image from the n lename of the proper dimension. If n is not a valid image lename, then get() will return NULL. Shared JPEG and PNG images can also be created from memory by using their named memory access constructor. Parameters n name of the image W,H desired size

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.116 Fl_Simple_Counter Class Reference See also

691

Fl_Shared_Image::nd(const char n, int W, int H) Fl_Shared_Image::release() Fl_JPEG_Image::Fl_JPEG_Image(const char name, const unsigned char data) Fl_PNG_Image::Fl_PNG_Image (const char name_png, const unsigned char buffer, int maxsize)

30.115.3.8

int Fl Shared Image::num images ( ) [static]

Returns the total number of shared images in the array.

30.115.3.9

int Fl Shared Image::refcount ( ) [inline]

Returns the number of references of this shared image. When reference is below 1, the image is deleted.

30.115.3.10

void Fl Shared Image::release ( )

Releases and possibly destroys (if refcount <=0) a shared image. In the latter case, it will reorganize the shared image array so that no hole will occur.

30.115.3.11

void Fl Shared Image::uncache ( ) [virtual]

If the image has been cached for display, delete the cache data. This allows you to change the data used for the image and then redraw it without recreating an image object. Reimplemented from Fl_Image. The documentation for this class was generated from the following les: Fl_Shared_Image.H Fl_Shared_Image.cxx

30.116

Fl Simple Counter Class Reference

This widget creates a counter with only 2 arrow buttons. #include <Fl_Simple_Counter.H> Inheritance diagram for Fl_Simple_Counter:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

692
Fl_Widget Fl_Valuator Fl_Counter Fl_Simple_Counter

Class Documentation

Public Member Functions


Fl_Simple_Counter (int x, int y, int w, int h, const char l=0)

30.116.1

Detailed Description

This widget creates a counter with only 2 arrow buttons.

Figure 30.30: Fl_Simple_Counter

The documentation for this class was generated from the following le:

Fl_Simple_Counter.H

30.117

Fl Single Window Class Reference

This is the same as Fl_Window. #include <Fl_Single_Window.H> Inheritance diagram for Fl_Single_Window:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.117 Fl_Single_Window Class Reference


Fl_Widget Fl_Group Fl_Window Fl_Single_Window Fl_Menu_Window

693

Public Member Functions


Fl_Single_Window (int W, int H, const char l=0)
Creates a new Fl_Single_Window widget using the given size, and label (title) string.

Fl_Single_Window (int X, int Y, int W, int H, const char l=0)


Creates a new Fl_Single_Window widget using the given position, size, and label (title) string.

void ush ()
Forces the window to be drawn, this window is also made current and calls draw().

int make_current ()
Sets things up so that the drawing functions in <FL/_draw.H> will go into this window.

void show ()
Puts the window on the screen.

void show (int a, char b)


Puts the window on the screen and parses command-line arguments.

30.117.1

Detailed Description

This is the same as Fl_Window. However, it is possible that some implementations will provide double-buffered windows by default. This subcan be used to force single-buffering. This may be useful for modifying existing programs that use incremental update, or for some types of image data, such as a movie ipbook.

30.117.2
30.117.2.1

Member Function Documentation


void Fl Single Window::ush ( ) [virtual]

Forces the window to be drawn, this window is also made current and calls draw(). Reimplemented from Fl_Window. Reimplemented in Fl_Menu_Window. 30.117.2.2 int Fl Single Window::make current ( )

Sets things up so that the drawing functions in <FL/_draw.H> will go into this window.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

694

Class Documentation

This is useful for incremental update of windows, such as in an idle callback, which will make your program behave much better if it draws a slow graphic. Danger: incremental update is very hard to debug and maintain! This method only works for the Fl_Window and Fl_Gl_Window derived classes. Reimplemented from Fl_Window. 30.117.2.3 void Fl Single Window::show ( ) [virtual]

Puts the window on the screen. Usually (on X) this has the side effect of opening the display. If the window is already shown then it is restored and raised to the top. This is really convenient because your program can call show() at any time, even if the window is already up. It also means that show() serves the purpose of raise() in other toolkits. Fl_Window::show(int argc, char argv) is used for top-level windows and allows standard arguments to be parsed from the command-line. See also Fl_Window::show(int argc, char argv) Reimplemented from Fl_Window. Reimplemented in Fl_Menu_Window. 30.117.2.4 void Fl Single Window::show ( int argc, char argv ) [inline]

Puts the window on the screen and parses command-line arguments. Usually (on X) this has the side effect of opening the display. This form should be used for top-level windows, at least for the rst (main) window. It allows standard arguments to be parsed from the command-line. You can use argc and argv from main(int argc, char argv) for this call. The rst call also sets up some system-specic internal variables like the system colors. Todo explain which system parameters are set up.

Parameters argc command-line argument count, usually from main() argv command-line argument vector, usually from main() See also virtual void Fl_Window::show() Reimplemented from Fl_Window. The documentation for this class was generated from the following les: Fl_Single_Window.H
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.118 Fl_Slider Class Reference Fl_Single_Window.cxx

695

30.118

Fl Slider Class Reference

The Fl_Slider widget contains a sliding knob inside a box. #include <Fl_Slider.H> Inheritance diagram for Fl_Slider:
Fl_Widget Fl_Valuator Fl_Slider Fl_Fill_Slider Fl_Hor_Fill_Slider Fl_Hor_Nice_Slider Fl_Hor_Slider Fl_Nice_Slider Fl_Scrollbar Fl_Value_Slider Fl_Hor_Value_Slider

Public Member Functions


void bounds (double a, double b)
Sets the minimum (a) and maximum (b) values for the valuator widget.

Fl_Slider (int X, int Y, int W, int H, const char L=0)


Creates a new Fl_Slider widget using the given position, size, and label string.

Fl_Slider (uchar t, int X, int Y, int W, int H, const char L)


Creates a new Fl_Slider widget using the given box type, position, size, and label string.

int handle (int)


Handles the specied event.

int scrollvalue (int pos, int size, int rst, int total)
Sets the size and position of the sliding knob in the box.

Fl_Boxtype slider () const


Gets the slider box type.

void slider (Fl_Boxtype c)


Sets the slider box type.

oat slider_size () const


Get the dimensions of the moving piece of slider.

void slider_size (double v)


Set the dimensions of the moving piece of slider.

Protected Member Functions


void draw (int, int, int, int) void draw ()
Draws the widget.

int handle (int, int, int, int, int)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

696

Class Documentation

30.118.1

Detailed Description

The Fl_Slider widget contains a sliding knob inside a box. It if often used as a scrollbar. Moving the box all the way to the top/left sets it to the minimum(), and to the bottom/right to the maximum(). The minimum() may be greater than the maximum() to reverse the slider direction. Use void Fl_Widget::type(int) to set how the slider is drawn, which can be one of the following: FL_VERTICAL - Draws a vertical slider (this is the default). FL_HORIZONTAL - Draws a horizontal slider. FL_VERT_FILL_SLIDER - Draws a lled vertical slider, useful as a progress or value meter. FL_HOR_FILL_SLIDER - Draws a lled horizontal slider, useful as a progress or value meter. FL_VERT_NICE_SLIDER - Draws a vertical slider with a nice looking control knob. FL_HOR_NICE_SLIDER - Draws a horizontal slider with a nice looking control knob.

Figure 30.31: Fl_Slider

30.118.2
30.118.2.1

Constructor & Destructor Documentation


Fl Slider::Fl Slider ( int X, int Y, int W, int H, const char L = 0 )

Creates a new Fl_Slider widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX.

30.118.3
30.118.3.1

Member Function Documentation


void Fl Slider::bounds ( double a, double b )

Sets the minimum (a) and maximum (b) values for the valuator widget. if at least one of the values is changed, a partial redraw is asked. Reimplemented from Fl_Valuator. 30.118.3.2 void Fl Slider::draw ( ) [protected, virtual]

Draws the widget.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.118 Fl_Slider Class Reference

697

Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Implements Fl_Widget. Reimplemented in Fl_Scrollbar, and Fl_Value_Slider. 30.118.3.3 int Fl Slider::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted

See also Fl_Event Reimplemented from Fl_Widget. Reimplemented in Fl_Scrollbar, and Fl_Value_Slider. 30.118.3.4 int Fl Slider::scrollvalue ( int pos, int size, int rst, int total )

Sets the size and position of the sliding knob in the box. Parameters in in in in

pos size rst total

position of rst line displayed size of window in lines number of rst line total number of lines Returns Fl_Valuator::value(p)

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

698 30.118.3.5 Fl_Boxtype Fl Slider::slider ( ) const [inline] Gets the slider box type. 30.118.3.6 void Fl Slider::slider ( Fl_Boxtype c ) [inline]

Class Documentation

Sets the slider box type. 30.118.3.7 void Fl Slider::slider size ( double v )

Set the dimensions of the moving piece of slider. This is the fraction of the size of the entire widget. If you set this to 1 then the slider cannot move. The default value is .08. For the "ll" sliders this is the size of the area around the end that causes a drag effect rather than causing the slider to jump to the mouse. The documentation for this class was generated from the following les: Fl_Slider.H Fl_Slider.cxx

30.119

Fl Spinner Class Reference

This widget is a combination of the input widget and repeat buttons. #include <Fl_Spinner.H> Inheritance diagram for Fl_Spinner:

Fl_Widget Fl_Group Fl_Spinner

Public Member Functions


Fl_Spinner (int X, int Y, int W, int H, const char L=0)
Creates a new Fl_Spinner widget using the given position, size, and label string.

const char format ()


Sets or returns the format string for the value.

void format (const char f)


Sets or returns the format string for the value.

int handle (int event)


Handles the specied event.

double maximum () const


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.119 Fl_Spinner Class Reference


Gets the maximum value of the widget.

699

void maximum (double m)


Sets the maximum value of the widget.

double maxinum () const


Speling mistakes retained for source compatibility.

double minimum () const


Gets the minimum value of the widget.

void minimum (double m)


Sets the minimum value of the widget.

double mininum () const


Speling mistakes retained for source compatibility.

void range (double a, double b)


Sets the minimum and maximum values for the widget.

void resize (int X, int Y, int W, int H)


Resizes the Fl_Group widget and all of its children.

double step () const


Sets or returns the amount to change the value when the user clicks a button.

void step (double s)


See double Fl_Spinner::step() const.

Fl_Color textcolor () const


Gets the color of the text in the input eld.

void textcolor (Fl_Color c)


Sets the color of the text in the input eld.

Fl_Font textfont () const


Gets the font of the text in the input eld.

void textfont (Fl_Font f)


Sets the font of the text in the input eld.

Fl_Fontsize textsize () const


Gets the size of the text in the input eld.

void textsize (Fl_Fontsize s)


Sets the size of the text in the input eld.

uchar type () const


Gets the numeric representation in the input eld.

void type (uchar v)


Sets the numeric representation in the input eld.

double value () const


Gets the current value of the widget.

void value (double v)


Sets the current value of the widget.

30.119.1

Detailed Description

This widget is a combination of the input widget and repeat buttons. The user can either type into the input area or use the buttons to change the value.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

700

Class Documentation

30.119.2
30.119.2.1

Constructor & Destructor Documentation


Fl Spinner::Fl Spinner ( int X, int Y, int W, int H, const char L = 0 ) [inline]

Creates a new Fl_Spinner widget using the given position, size, and label string. Inherited destructor Destroys the widget and any value associated with it.

30.119.3
30.119.3.1

Member Function Documentation


const char Fl Spinner::format ( ) [inline]

Sets or returns the format string for the value. 30.119.3.2 void Fl Spinner::format ( const char f ) [inline]

Sets or returns the format string for the value. 30.119.3.3 int Fl Spinner::handle ( int event ) [inline, virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted

See also Fl_Event Reimplemented from Fl_Group.

30.119.3.4

double Fl Spinner::maximum ( ) const [inline]

Gets the maximum value of the widget.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.119 Fl_Spinner Class Reference 30.119.3.5 void Fl Spinner::maximum ( double m ) [inline]

701

Sets the maximum value of the widget. 30.119.3.6 double Fl Spinner::maxinum ( ) const [inline]

Speling mistakes retained for source compatibility. Deprecated

30.119.3.7

double Fl Spinner::minimum ( ) const [inline]

Gets the minimum value of the widget. 30.119.3.8 void Fl Spinner::minimum ( double m ) [inline]

Sets the minimum value of the widget. 30.119.3.9 double Fl Spinner::mininum ( ) const [inline]

Speling mistakes retained for source compatibility. Deprecated

30.119.3.10

void Fl Spinner::range ( double a, double b ) [inline]

Sets the minimum and maximum values for the widget. 30.119.3.11 void Fl Spinner::resize ( int X, int Y, int W, int H ) [inline, virtual]

Resizes the Fl_Group widget and all of its children. The Fl_Group widget rst resizes itself, and then it moves and resizes all its children according to the rules documented for Fl_Group::resizable(Fl_Widget) See also Fl_Group::resizable(Fl_Widget) Fl_Group::resizable() Fl_Widget::resize(int,int,int,int) Reimplemented from Fl_Group. 30.119.3.12 double Fl Spinner::step ( ) const [inline]

Sets or returns the amount to change the value when the user clicks a button. Before setting step to a non-integer value, the spinner type() should be changed to oating point.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

702 30.119.3.13 Fl_Color Fl Spinner::textcolor ( ) const [inline] Gets the color of the text in the input eld. 30.119.3.14 void Fl Spinner::textcolor ( Fl_Color c ) [inline]

Class Documentation

Sets the color of the text in the input eld. 30.119.3.15 Fl_Font Fl Spinner::textfont ( ) const [inline] Gets the font of the text in the input eld. 30.119.3.16 void Fl Spinner::textfont ( Fl_Font f ) [inline]

Sets the font of the text in the input eld. 30.119.3.17 Fl_Fontsize Fl Spinner::textsize ( ) const [inline] Gets the size of the text in the input eld. 30.119.3.18 void Fl Spinner::textsize ( Fl_Fontsize s ) [inline]

Sets the size of the text in the input eld. 30.119.3.19 uchar Fl Spinner::type ( ) const [inline] Gets the numeric representation in the input eld. See also Fl_Spinner::type(uchar) Reimplemented from Fl_Widget. 30.119.3.20 void Fl Spinner::type ( uchar v ) [inline]

Sets the numeric representation in the input eld. Valid values are FL_INT_INPUT and FL_FLOAT_INPUT. Also changes the format() template. Setting a new spinner type via a superclass pointer will not work. Note type is not a virtual function. Reimplemented from Fl_Widget. 30.119.3.21 double Fl Spinner::value ( ) const [inline]

Gets the current value of the widget.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.120 Fl_Surface_Device Class Reference 30.119.3.22 void Fl Spinner::value ( double v ) [inline]

703

Sets the current value of the widget. Before setting value to a non-integer value, the spinner type() should be changed to oating point. The documentation for this class was generated from the following le: Fl_Spinner.H

30.120

Fl Surface Device Class Reference

A surface thats susceptible to receive graphical output. #include <Fl_Device.H> Inheritance diagram for Fl_Surface_Device:
Fl_Device Fl_Surface_Device Fl_Display_Device Fl_PostScript_File_Device Fl_PostScript_Printer Fl_Paged_Device Fl_Printer Fl_System_Printer

Public Member Functions


const char class_name ()
Returns the name of the class of this object.

void driver (Fl_Graphics_Driver graphics_driver)


Sets the graphics driver of this drawing surface.

Fl_Graphics_Driver driver ()
Returns the graphics driver of this drawing surface.

virtual void set_current (void)


Use this drawing surface for future graphics requests.

virtual Fl_Surface_Device ()
The destructor.

Static Public Member Functions


static Fl_Surface_Device surface ()
the surface that currently receives graphics output
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

704

Class Documentation

Static Public Attributes


static const char class_id = "Fl_Surface_Device"
A string that identies each subclass of Fl_Device.

Protected Member Functions


Fl_Surface_Device (Fl_Graphics_Driver graphics_driver)
Constructor that sets the graphics driver to use for the created surface.

30.120.1

Detailed Description

A surface thats susceptible to receive graphical output.

30.120.2
30.120.2.1

Constructor & Destructor Documentation


Fl Surface Device::Fl Surface Device ( Fl_Graphics_Driver graphics driver ) [inline, protected]

Constructor that sets the graphics driver to use for the created surface. 30.120.2.2 virtual Fl Surface Device::Fl Surface Device ( ) [inline, virtual]

The destructor.

30.120.3
30.120.3.1

Member Function Documentation


const char Fl Surface Device::class name ( ) [inline, virtual]

Returns the name of the class of this object. The class of an instance of an Fl_Device subclass can be checked with code such as:
if ( instance->class_name() == Fl_Printer::class_id ) { ... }

Reimplemented from Fl_Device. Reimplemented in Fl_Display_Device, Fl_PostScript_File_Device, Fl_Printer, Fl_Paged_Device, Fl_PostScript_Printer, and Fl_System_Printer. 30.120.3.2 void Fl Surface Device::driver ( Fl_Graphics_Driver graphics driver ) [inline]

Sets the graphics driver of this drawing surface. 30.120.3.3 Fl_Graphics_Driver Fl Surface Device::driver ( void ) [inline] Returns the graphics driver of this drawing surface. Reimplemented in Fl_PostScript_File_Device, and Fl_Printer.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.121 Fl_Sys_Menu_Bar Class Reference 30.120.3.4 void Fl Surface Device::set current ( void ) [virtual]

705

Use this drawing surface for future graphics requests. Reimplemented in Fl_Printer.

30.120.4
30.120.4.1

Member Data Documentation


const char Fl_Surface_Device::class_id = Fl Surface Device [static]

A string that identies each subclass of Fl_Device. Function class_name() applied to a device of this class returns this string. Reimplemented from Fl_Device. Reimplemented in Fl_Display_Device, Fl_PostScript_File_Device, Fl_Printer, Fl_Paged_Device, Fl_PostScript_Printer, and Fl_System_Printer. The documentation for this class was generated from the following les: Fl_Device.H Fl_Device.cxx

30.121

Fl Sys Menu Bar Class Reference

A class to create, modify and delete menus that appear on Mac OS X in the menu bar at the top of the screen. #include <Fl_Sys_Menu_Bar.H> Inheritance diagram for Fl_Sys_Menu_Bar:
Fl_Widget Fl_Menu_ Fl_Menu_Bar Fl_Sys_Menu_Bar

Public Member Functions


int add (const char label, int shortcut, Fl_Callback , void user_data=0, int ags=0)
add to the system menu bar a new menu item

void clear ()
Same as menu(NULL), set the array pointer to null, indicating a zero-length menu.

int clear_submenu (int index)


Clears the specied submenu pointed to by index of all menu items.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

706 Fl_Sys_Menu_Bar (int x, int y, int w, int h, const char l=0)


The constructor.

Class Documentation

int insert (int index, const char label, int shortcut, Fl_Callback cb, void user_data=0, int ags=0)
insert in the system menu bar a new menu item

void menu (const Fl_Menu_Item m)


create a system menu bar using the given list of menu structs

void remove (int n)


remove an item from the system menu bar

void replace (int rank, const char name)


rename an item from the system menu bar

Protected Member Functions


void draw ()
Draws the widget.

30.121.1

Detailed Description

A class to create, modify and delete menus that appear on Mac OS X in the menu bar at the top of the screen. On other than Mac OS X platforms, Fl_Sys_Menu_Bar is a synonym of class Fl_Menu_Bar.

30.121.2
30.121.2.1

Constructor & Destructor Documentation


Fl Sys Menu Bar::Fl Sys Menu Bar ( int x, int y, int w, int h, const char l = 0 ) [inline]

The constructor. On Mac OS X, all arguments are unused. On other platforms they are used as by Fl_Menu_Bar::Fl_Menu_Bar().

30.121.3
30.121.3.1

Member Function Documentation


int Fl Sys Menu Bar::add ( const char label, int shortcut, Fl_Callback cb, void user data = 0, int ags = 0 )

add to the system menu bar a new menu item add to the system menu bar a new menu item, with a title string, shortcut int, callback, argument to the callback, and ags. See also Fl_Menu_::add(const char label, int shortcut, Fl_Callback cb, void user_data, int ags) Reimplemented from Fl_Menu_.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.121 Fl_Sys_Menu_Bar Class Reference 30.121.3.2 void Fl Sys Menu Bar::clear ( )

707

Same as menu(NULL), set the array pointer to null, indicating a zero-length menu. Menus must not be cleared during a callback to the same menu. Reimplemented from Fl_Menu_. 30.121.3.3 int Fl Sys Menu Bar::clear submenu ( int index )

Clears the specied submenu pointed to by index of all menu items. This method is useful for clearing a submenu so that it can be re-populated with new items. Example: a "File/Recent Files/..." submenu that shows the last few les that have been opened. The specied index must point to a submenu. The submenu is cleared with remove(). If the menu array was directly set with menu(x), then copy() is done to make a private array. Warning Since this method can change the internal menu array, any menu item pointers or indecies the application may have cached can become stale, and should be recalculated/refreshed. Example:
int index = menubar->find_index("File/Recent"); "File/Recent" submenu if ( index != -1 ) menubar->clear_submenu(index); menubar->add("File/Recent/Aaa"); menubar->add("File/Recent/Bbb"); [..] // get index of // clear the submenu

Parameters index The index of the submenu to be cleared

Returns 0 on success, -1 if the index is out of range or not a submenu

See also remove(int) Reimplemented from Fl_Menu_. 30.121.3.4 void Fl Sys Menu Bar::draw ( ) [protected, virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

708

Class Documentation

If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Reimplemented from Fl_Menu_Bar. 30.121.3.5 int Fl Sys Menu Bar::insert ( int index, const char label, int shortcut, Fl_Callback cb, void user data = 0, int ags = 0 )

insert in the system menu bar a new menu item insert in the system menu bar a new menu item, with a title string, shortcut int, callback, argument to the callback, and ags. See also Fl_Menu_::insert(int index, const char label, int shortcut, Fl_Callback cb, void user_data, int ags) Reimplemented from Fl_Menu_. 30.121.3.6 void Fl Sys Menu Bar::menu ( const Fl_Menu_Item m )

create a system menu bar using the given list of menu structs Author Matthias Melcher Parameters m list of Fl_Menu_Item Reimplemented from Fl_Menu_. 30.121.3.7 void Fl Sys Menu Bar::remove ( int rank )

remove an item from the system menu bar Parameters rank the rank of the item to remove Reimplemented from Fl_Menu_. 30.121.3.8 void Fl Sys Menu Bar::replace ( int rank, const char name )

rename an item from the system menu bar

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.122 Fl_System_Printer Class Reference Parameters rank the rank of the item to rename name the new item name as a UTF8 string Reimplemented from Fl_Menu_. The documentation for this class was generated from the following les: Fl_Sys_Menu_Bar.H Fl_Sys_Menu_Bar.cxx

709

30.122

Fl System Printer Class Reference

Print support under MSWindows and Mac OS. #include <Fl_Printer.H> Inheritance diagram for Fl_System_Printer:
Fl_Device Fl_Surface_Device Fl_Paged_Device Fl_System_Printer

Public Member Functions


const char class_name ()
Returns the name of the class of this object.

void end_job (void)


To be called at the end of a print job.

int end_page (void)


To be called at the end of each page.

void margins (int left, int top, int right, int bottom)
Computes the dimensions of margins that lie between the printable page area and the full page.

void origin (int x, int y)


Computes the page coordinates of the current origin of graphics functions.

void origin (int x, int y)


Sets the position in page coordinates of the origin of graphics functions.

int printable_rect (int w, int h)


Computes the width and height of the printable area of the page.

void rotate (oat angle)


Rotates the graphics operations relatively to paper.

void scale (oat scale_x, oat scale_y=0.)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

710
Changes the scaling of page coordinates.

Class Documentation

int start_job (int pagecount, int frompage=NULL, int topage=NULL)


Starts a print job.

int start_page (void)


Starts a new printed page.

void translate (int x, int y)


Translates the current graphics origin accounting for the current rotation.

void untranslate (void)


Undoes the effect of a previous translate() call.

Fl_System_Printer (void)
The destructor.

Static Public Attributes


static const char class_id = Fl_Printer::class_id
A string that identies each subclass of Fl_Device.

Protected Member Functions


Fl_System_Printer (void)
The constructor.

Friends
class Fl_Printer

30.122.1

Detailed Description

Print support under MSWindows and Mac OS. Class Fl_System_Printer is implemented only on the MSWindows and Mac OS platforms. It has no public constructor. Use Fl_Printer instead that is cross-platform and has the same API.

30.122.2
30.122.2.1

Member Function Documentation


const char Fl System Printer::class name ( ) [inline, virtual]

Returns the name of the class of this object. The class of an instance of an Fl_Device subclass can be checked with code such as:
if ( instance->class_name() == Fl_Printer::class_id ) { ... }

Reimplemented from Fl_Paged_Device.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.122 Fl_System_Printer Class Reference 30.122.2.2 int Fl System Printer::end page ( void ) [virtual]

711

To be called at the end of each page. Returns 0 if OK, non-zero if any error. Reimplemented from Fl_Paged_Device. 30.122.2.3 void Fl System Printer::margins ( int left, int top, int right, int bottom ) [virtual]

Computes the dimensions of margins that lie between the printable page area and the full page. Values are in the same unit as that used by FLTK drawing functions. They are changed by scale() calls. Parameters out out out out

left top right bottom

If non-null, left is set to the left margin size. If non-null, top is set to the top margin size. If non-null, right is set to the right margin size. If non-null, bottom is set to the bottom margin size.

Reimplemented from Fl_Paged_Device. 30.122.2.4 void Fl System Printer::origin ( int x, int y ) [virtual]

Computes the page coordinates of the current origin of graphics functions. Parameters out out

x If non-null, x is set to the horizontal page offset of graphics origin. y Same as above, vertically.

Reimplemented from Fl_Paged_Device. 30.122.2.5 void Fl System Printer::origin ( int x, int y ) [virtual]

Sets the position in page coordinates of the origin of graphics functions. Arguments should be expressed relatively to the result of a previous printable_rect() call. That is, printable_rect(&w, &h); origin(w/2, 0); sets the graphics origin at the top center of the page printable area. Origin() calls are not affected by rotate() calls. Successive origin() calls dont combine their effects. Parameters in in

x Horizontal position in page coordinates of the desired origin of graphics functions. y Same as above, vertically.

Reimplemented from Fl_Paged_Device.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

712 30.122.2.6 int Fl System Printer::printable rect ( int w, int h ) [virtual]

Class Documentation

Computes the width and height of the printable area of the page. Values are in the same unit as that used by FLTK drawing functions, are unchanged by calls to origin(), but are changed by scale() calls. Values account for the user-selected paper type and print orientation. Returns 0 if OK, non-zero if any error Reimplemented from Fl_Paged_Device. 30.122.2.7 void Fl System Printer::rotate ( oat angle ) [virtual]

Rotates the graphics operations relatively to paper. The rotation is centered on the current graphics origin. Successive rotate() calls dont combine their effects. Parameters angle Rotation angle in counter-clockwise degrees. Reimplemented from Fl_Paged_Device. 30.122.2.8 void Fl System Printer::scale ( oat scale x, oat scale y = 0. ) [virtual]

Changes the scaling of page coordinates. This function also resets the origin of graphics functions at top left of printable page area. After a scale() call, do a printable_rect() call to get the new dimensions of the printable page area. Successive scale() calls dont combine their effects. Parameters scale_x Horizontal dimensions of plot are multiplied by this quantity. scale_y Same as above, vertically. The value 0. is equivalent to setting scale_y = scale_x. Thus, scale(factor); is equivalent to scale(factor, factor); Reimplemented from Fl_Paged_Device. 30.122.2.9 int Fl System Printer::start job ( int pagecount, int frompage = NULL, int topage = NULL ) [virtual]

Starts a print job. Parameters in out out

pagecount the total number of pages of the job frompage if non-null, frompage is set to the rst page the user wants printed topage if non-null, topage is set to the last page the user wants printed

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.123 Fl_Table Class Reference Returns 0 if OK, non-zero if any error Reimplemented from Fl_Paged_Device.

713

30.122.2.10

int Fl System Printer::start page ( void ) [virtual]

Starts a new printed page. The page coordinates are initially in points, i.e., 1/72 inch, and with origin at the top left of the printable page area. Returns 0 if OK, non-zero if any error Reimplemented from Fl_Paged_Device.

30.122.2.11

void Fl System Printer::translate ( int x, int y ) [virtual]

Translates the current graphics origin accounting for the current rotation. This function is only useful after a rotate() call. Each translate() call must be matched by an untranslate() call. Successive translate() calls add up their effects. Reimplemented from Fl_Paged_Device.

30.122.3
30.122.3.1

Member Data Documentation


const char Fl_System_Printer::class_id = Fl_Printer::class_id [static]

A string that identies each subclass of Fl_Device. Function class_name() applied to a device of this class returns this string. Reimplemented from Fl_Paged_Device. The documentation for this class was generated from the following les: Fl_Printer.H Fl_Printer.cxx

30.123

Fl Table Class Reference

A table of widgets or other content. #include <Fl_Table.H> Inheritance diagram for Fl_Table:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

714
Fl_Widget Fl_Group Fl_Table Fl_Table_Row

Class Documentation

Classes
class IntVector

Public Types
enum TableContext { CONTEXT_NONE = 0, CONTEXT_STARTPAGE = 0x01, CONTEXT_ENDPAGE = 0x02, CONTEXT_ROW_HEADER = 0x04, CONTEXT_COL_HEADER = 0x08, CONTEXT_CELL = 0x10, CONTEXT_TABLE = 0x20, CONTEXT_RC_RESIZE = 0x40 }
The context bit ags for Fl_Table related callbacks (eg.

Public Member Functions


void add (Fl_Widget &w)
The widget is removed from its current group (if any) and then added to the end of this group.

void add (Fl_Widget w)


See void Fl_Group::add(Fl_Widget &w)

Fl_Widget const array () void begin ()


Sets the current group so you can build the widget tree by just constructing the widgets.

void callback (Fl_Widget , void )


Callbacks will be called depending on the setting of Fl_Widget::when().

int callback_col ()
Returns the current column the event occurred on.

TableContext callback_context ()
Returns the current table context.

int callback_row ()
Returns the current row the event occurred on.

Fl_Widget child (int n) const


Returns the child widget by an index.

int children () const


Returns the number of children in the table.

virtual void clear ()


Clears the table to zero rows, zero columns.

int col_header ()
Returns if column headers are enabled or not.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.123 Fl_Table Class Reference void col_header (int ag)


Enable or disable column headers.

715

void col_header_color (Fl_Color val)


Sets the color for column headers and redraws the table.

Fl_Color col_header_color ()
Gets the color for column headers.

void col_header_height (int height)


Sets the height in pixels for column headers and redraws the table.

int col_header_height ()
Gets the column header height.

void col_position (int col)


Sets the column scroll position to column col, and causes the screen to redraw.

int col_position ()
Returns the current column scroll position as a column number.

int col_resize ()
Returns the current value of this ag.

void col_resize (int ag)


Allows/disallows column resizing by the user.

int col_resize_min ()
Sets the current column minimum resize value.

void col_resize_min (int val)


Returns the current column minimum resize value.

void col_width (int col, int width)


Sets the width of the specied column in pixels, and the table is redrawn.

int col_width (int col)


Returns the current width of the specied column in pixels.

void col_width_all (int width)


Convenience method to set the width of all columns to the same value, in pixels.

virtual void cols (int val)


Set the number of columns in the table and redraw.

int cols ()
Get the number of columns in the table.

void do_callback (TableContext context, int row, int col) void draw (void)
Draws the widget.

void end ()
Exactly the same as current(this->parent()).

int nd (const Fl_Widget w) const


Searches the child array for the widget and returns the index.

int nd (const Fl_Widget &w) const


See int Fl_Group::nd(const Fl_Widget w) const.

Fl_Table (int X, int Y, int W, int H, const char l=0)


The constructor for the Fl_Table.

void get_selection (int &row_top, int &col_left, int &row_bot, int &col_right)
Gets the region of cells selected (highlighted).

void init_sizes ()
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

716
Resets the internal array of widget sizes and positions.

Class Documentation

void insert (Fl_Widget &w, int n)


The widget is removed from its current group (if any) and then inserted into this group.

void insert (Fl_Widget &w, Fl_Widget w2)


This does insert(w, nd(before)).

int is_interactive_resize ()
Returns 1 if someone is interactively resizing a row or column.

int is_selected (int r, int c)


See if the cell at row r and column c is selected.

int move_cursor (int R, int C) void remove (Fl_Widget &w)


Removes a widget from the group but does not delete it.

void resize (int X, int Y, int W, int H)


Changes the size of the Fl_Table, causing it to redraw.

int row_header ()
Returns the value of this ag.

void row_header (int ag)


Enables/disables showing the row headers.

void row_header_color (Fl_Color val)


Sets the row header color and causes the screen to redraw.

Fl_Color row_header_color ()
Returns the current row header color.

void row_header_width (int width)


Sets the row header width to n and causes the screen to redraw.

int row_header_width ()
Returns the current row header width (in pixels).

void row_height (int row, int height)


Sets the height of the specied row in pixels, and the table is redrawn.

int row_height (int row)


Returns the current height of the specied row as a value in pixels.

void row_height_all (int height)


Convenience method to set the height of all rows to the same value, in pixels.

void row_position (int row)


Sets the row scroll position to row, and causes the screen to redraw.

int row_position ()
Returns the current row scroll position as a row number.

int row_resize ()
Returns the current value of this ag.

void row_resize (int ag)


Allows/disallows row resizing by the user.

int row_resize_min ()
Returns the current row minimum resize value.

void row_resize_min (int val)


Sets the current row minimum resize value.

virtual void rows (int val)


Sets the number of rows in the table, and the table is redrawn.

int rows ()
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.123 Fl_Table Class Reference


Returns the number of rows in the table.

717

void set_selection (int row_top, int col_left, int row_bot, int col_right)
Sets the region of cells to be selected (highlighted).

void table_box (Fl_Boxtype val)


Sets the kind of box drawn around the data table, the default being FL_NO_BOX.

Fl_Boxtype table_box (void)


Returns the current box type used for the data table.

void top_row (int row)


Sets which row should be at the top of the table, scrolling as necessary, and the table is redrawn.

int top_row ()
Returns the current top row shown in the table.

void visible_cells (int &r1, int &r2, int &c1, int &c2)
Returns the range of row and column numbers for all visible and partially visible cells in the table.

void when (Fl_When ags)


The Fl_Widget::when() function is used to set a group of ags, determining when the widget callback is called:

Fl_Table ()
The destructor for the Fl_Table.

Protected Types
enum ResizeFlag { RESIZE_NONE = 0, RESIZE_COL_LEFT = 1, RESIZE_COL_RIGHT = 2, RESIZE_ROW_ABOVE = 3, RESIZE_ROW_BELOW = 4 }

Protected Member Functions


void change_cursor (Fl_Cursor newcursor) long col_scroll_position (int col) TableContext cursor2rowcol (int &R, int &C, ResizeFlag &resizeag) void damage_zone (int r1, int c1, int r2, int c2, int r3=0, int c3=0) virtual void draw_cell (TableContext context, int R=0, int C=0, int X=0, int Y=0, int W=0, int H=0)
Subclass should override this method to handle drawing the cells.

int nd_cell (TableContext context, int R, int C, int &X, int &Y, int &W, int &H) void get_bounds (TableContext context, int &X, int &Y, int &W, int &H) int handle (int e)
Handles the specied event.

int is_tk_container () void recalc_dimensions () void redraw_range (int toprow, int botrow, int leftcol, int rightcol) int row_col_clamp (TableContext context, int &R, int &C) long row_scroll_position (int row) void table_resized () void table_scrolled ()

Static Protected Member Functions


static void scroll_cb (Fl_Widget , void )
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

718

Class Documentation

Protected Attributes
int botrow int current_col int current_row Fl_Scrollbar hscrollbar int leftcol int leftcol_scrollpos int rightcol int select_col int select_row Fl_Scroll table int table_h int table_w int tih int tiw int tix int tiy int toh int toprow int toprow_scrollpos int tow int tox int toy Fl_Scrollbar vscrollbar int wih int wiw int wix int wiy

30.123.1

Detailed Description

A table of widgets or other content. This is the base class for table widgets. To be useful it must be subclassed and several virtual functions dened. Normally applications use widgets derived from this widget, and do not use this widget directly; this widget is usually too low level to be used directly by applications. This widget does not handle the data in the table. The draw_cell() method must be overridden by a subclass to manage drawing the contents of the cells. This widget can be used in several ways: As a custom widget; see examples/table-simple.cxx and test/table.cxx. Very optimal for even extremely large tables. As a table made up of a single FLTK widget instanced all over the table, simulating a numeric spreadsheet. See examples/table-spreadsheet.cxx and examples/table-spreadsheet-with-keyboard-nav.cxx. Optimal for large tables. As a regular container of FLTK widgets, one widget per cell. See examples/table-as-container.cxx. Not recommended for large tables.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.123 Fl_Table Class Reference

719

Figure 30.32: table-simple example

Figure 30.33: table-as-container example

When acting as part of a custom widget, events on the cells and/or headings generate callbacks when they are clicked by the user. You control when events are generated based on the setting for Fl_Table::when(). When acting as a container for FLTK widgets, the FLTK widgets maintain themselves. Although the draw_cell() method must be overridden, its contents can be very simple. See the draw_cell() code in examples/table-simple.cxx. The following variables are available to classes deriving from Fl_Table:

Figure 30.34: Fl_Table Dimensions

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

720 x()/y()/w()/h()

Class Documentation Fl_Table widgets outer dimension. The outer edge of the border of the Fl_Table. (Red in the diagram above) Fl_Table widgets inner dimension. The inner edge of the border of the Fl_Table. eg. if the Fl_Tables box() is FL_NO_BOX, these values are the same as x()/y()/w()/h(). (Yellow in the diagram above) The tables outer dimension. The outer edge of the border around the cells, but inside the row/col headings and scrollbars. (Green in the diagram above) The tables inner dimension. The inner edge of the border around the cells, but inside the row/col headings and scrollbars. AKA the tables clip region. eg. if the table_box() is FL_NO_BOX, these values are the same as tox/toyy/tow/toh. (Blue in the diagram above)

wix/wiy/wiw/wih

tox/toy/tow/toh

tix/tiy/tiw/tih

CORE DEVELOPERS Greg Ercolano : 12/16/2002 - initial implementation 12/16/02. Fl_Table, Fl_Table_Row, docs. Jean-Marc Lienher : 02/22/2004 - added keyboard nav + mouse selection, and ported Fl_Table into tk-utf8-1.1.4 OTHER CONTRIBUTORS Inspired by the Feb 2000 version of FLVWs Flvw_Table widget. Mucho thanks to those folks. Mister Satan : 04/07/2003 - MinGW porting mods, and singleinput.cxx; a cool Fl_Input oriented spreadsheet example Marek Paliwoda : 01/08/2003 - Porting mods for Borland Ori Berger : 03/16/2006 - Optimizations for >500k rows/cols LICENSE Greg added the following license to the original distribution of Fl_Table. He kindly gave his permission to integrate Fl_Table and Fl_Table_Row into FLTK, allowing FLTK license to apply while his widgets are part of the library. If used on its own, this is the license that applies:
Fl_Table License December 16, 2002 The Fl_Table library and included programs are provided under the terms of the GNU Library General Public License (LGPL) with the following exceptions: 1. Modifications to the Fl_Table configure script, config header file, and makefiles by themselves to support a specific platform do not constitute a modified or
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.123 Fl_Table Class Reference


derivative work. The authors do request that such modifications be contributed to the Fl_Table project - send all contributions to "erco at seriss dot com". 2. Widgets that are subclassed from Fl_Table widgets do not constitute a derivative work. 3. Static linking of applications and widgets to the Fl_Table library does not constitute a derivative work and does not require the author to provide source code for the application or widget, use the shared Fl_Table libraries, or link their applications or widgets against a user-supplied version of Fl_Table. If you link the application or widget to a modified version of Fl_Table, then the changes to Fl_Table must be provided under the terms of the LGPL in sections 1, 2, and 4. 4. You do not have to provide a copy with programs that are linked to the do you have to identify the Fl_Table program or documentation as required of the LGPL. of the Fl_Table license Fl_Table library, nor license in your by section 6

721

However, programs must still identify their use of Fl_Table. The following example statement can be included in user documentation to satisfy this requirement: [program/widget] is based in part on the work of the Fl_Table project http://seriss.com/people/erco/fltk/Fl_Table/

30.123.2
30.123.2.1

Member Enumeration Documentation


enum Fl_Table::TableContext

The context bit ags for Fl_Table related callbacks (eg. draw_cell(), callback(), etc) Enumerator: CONTEXT_NONE no known context CONTEXT_STARTPAGE before a page is redrawn CONTEXT_ENDPAGE after a page is redrawn CONTEXT_ROW_HEADER in the row header CONTEXT_COL_HEADER in the col header CONTEXT_CELL in one of the cells CONTEXT_TABLE in a dead zone of table CONTEXT_RC_RESIZE column or row being resized

30.123.3
30.123.3.1

Constructor & Destructor Documentation


Fl Table::Fl Table ( int X, int Y, int W, int H, const char l = 0 )

The constructor for the Fl_Table.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

722

Class Documentation

This creates an empty table with no rows or columns, with headers and row/column resize behavior disabled. 30.123.3.2 Fl Table::Fl Table ( )

The destructor for the Fl_Table. Destroys the table and its associated widgets.

30.123.4
30.123.4.1

Member Function Documentation


void Fl Table::begin ( ) [inline]

Sets the current group so you can build the widget tree by just constructing the widgets. begin() is automatically called by the constructor for Fl_Group (and thus for Fl_Window as well). begin() is exactly the same as current(this). Dont forget to end() the group or window! Reimplemented from Fl_Group. 30.123.4.2 void Fl Table::callback ( Fl_Widget , void )

Callbacks will be called depending on the setting of Fl_Widget::when(). Callback functions should use the following functions to determine the context/row/column: Fl_Table::callback_row() returns current row Fl_Table::callback_col() returns current column Fl_Table::callback_context() returns current table context callback_row() and callback_col() will be set to the row and column number the event occurred on. If someone clicked on a row header, col will be 0. If someone clicked on a column header, row will be 0. callback_context() will return one of the following: Fl_Table::CONTEXT_ROW_HEADER Fl_Table::CONTEXT_COL_HEADER Fl_Table::CONTEXT_CELL Someone clicked on a row header. Excludes resizing. Someone clicked on a column header. Excludes resizing. Someone clicked on a cell. To receive callbacks for FL_RELEASE events, you must set when(FL_WHEN_RELEASE). Someone is resizing rows/columns either interactively, or via the col_width() or row_height() API. Use is_interactive_resize() to determine interactive resizing. If resizing a column, R=0 and C=column being resized. If resizing a row, C=0 and R=row being resized. NOTE: To receive resize events, you must set when(FL_WHEN_CHANGED).

Fl_Table::CONTEXT_RC_RESIZE

class MyTable : public Fl_Table { [..] private: // Handle events that happen on the table
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.123 Fl_Table Class Reference


void event_callback2() { int R = callback_row(), // row where event occurred C = callback_col(); // column where event occurred TableContext context = callback_context(); // which part of table fprintf(stderr, "callback: Row=%d Col=%d Context=%d Event=%d\n", R, C, (int)context, (int)Fl::event()); } // Actual static callback static void event_callback(Fl_Widget*, void* data) { MyTable *o = (MyTable*)data; o-&gt;event_callback2(); } public: // Constructor MyTable() { [..] table.callback(&event_callback, (void*)this); table.when(FL_WHEN_CHANGED|FL_WHEN_RELEASE); } };

723

// setup callback // when to call it

30.123.4.3

int Fl Table::callback col ( ) [inline]

Returns the current column the event occurred on. This function should only be used from within the users callback function 30.123.4.4 TableContext Fl Table::callback context ( ) [inline] Returns the current table context. This function should only be used from within the users callback function 30.123.4.5 int Fl Table::callback row ( ) [inline]

Returns the current row the event occurred on. This function should only be used from within the users callback function 30.123.4.6 Fl_Widget Fl Table::child ( int n ) const [inline] Returns the child widget by an index. When using the Fl_Table as a container for FLTK widgets, this method returns the widget pointer from the internal array of widgets in the container. Typically used in loops, eg:
for ( int i=0; i<children(); i++ ) { Fl_Widget *w = child(i); [..] }

Reimplemented from Fl_Group.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

724 30.123.4.7 int Fl Table::children ( ) const [inline]

Class Documentation

Returns the number of children in the table. When using the Fl_Table as a container for FLTK widgets, this method returns how many child widgets the table has. See also child(int) Reimplemented from Fl_Group. 30.123.4.8 virtual void Fl Table::clear ( ) [inline, virtual]

Clears the table to zero rows, zero columns. Same as rows(0); cols(0); See also rows(int), cols(int) Reimplemented from Fl_Group. Reimplemented in Fl_Table_Row. 30.123.4.9 void Fl Table::col header ( int ag ) [inline]

Enable or disable column headers. If changed, the table is redrawn. 30.123.4.10 void Fl Table::col resize ( int ag ) [inline]

Allows/disallows column resizing by the user. 1=allow interactive resizing, 0=disallow interactive resizing. Since interactive resizing is done via the column headers, col_header() must also be enabled to allow resizing. 30.123.4.11 int Fl Table::col resize min ( ) [inline]

Sets the current column minimum resize value. This is used to prevent the user from interactively resizing any column to be smaller than pixels. Must be a value >=1. 30.123.4.12 void Fl Table::col width ( int col, int width )

Sets the width of the specied column in pixels, and the table is redrawn. callback() will be invoked with CONTEXT_RC_RESIZE if the columns width was actually changed, and when() is FL_WHEN_CHANGED.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.123 Fl_Table Class Reference 30.123.4.13 void Fl Table::col width all ( int width ) [inline]

725

Convenience method to set the width of all columns to the same value, in pixels. The screen is redrawn.

30.123.4.14

void Fl Table::draw ( void ) [virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:

Fl_Widget *s = &scroll; s->draw();

// scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Reimplemented from Fl_Group.

30.123.4.15

virtual void Fl Table::draw cell ( TableContext context, int R = 0, int C = 0, int X = 0, int Y = 0, int W = 0, int H = 0 ) [inline, protected, virtual]

Subclass should override this method to handle drawing the cells. This method will be called whenever the table is redrawn, once per cell. Only cells that are completely (or partially) visible will be told to draw. context will be one of the following:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

726 Fl_Table::CONTEXT_STARTPAGE

Class Documentation When table, or parts of the table, are about to be redrawn. Use to initialize static data, such as font selections. R/C will be zero, X/Y/W/H will be the dimensions of the tables entire data area. (Useful for locking a database before accessing; see also visible_cells()) When table has completed being redrawn. R/C will be zero, X/Y/W/H dimensions of tables data area. (Useful for unlocking a database after accessing) Whenever a row header cell needs to be drawn. R will be the row number of the header being redrawn, C will be zero, X/Y/W/H will be the tk drawing area of the row header in the window Whenever a column header cell needs to be drawn. R will be zero, C will be the column number of the header being redrawn, X/Y/W/H will be the tk drawing area of the column header in the window Whenever a data cell in the table needs to be drawn. R/C will be the row/column of the cell to be drawn, X/Y/W/H will be the tk drawing area of the cell in the window Whenever table or row/column is resized or scrolled, either interactively or via col_width() or row_height(). R/C/X/Y/W/H will all be zero. Useful for tk containers that need to resize or move the child tk widgets.

Fl_Table::CONTEXT_ENDPAGE

Fl_Table::CONTEXT_ROW_HEADER

Fl_Table::CONTEXT_COL_HEADER

Fl_Table::CONTEXT_CELL

Fl_Table::CONTEXT_RC_RESIZE

row and col will be set to the row and column number of the cell being drawn. In the case of row headers, col will be 0. In the case of column headers, row will be 0. x/y/w/h will be the position and dimensions of where the cell should be drawn. In the case of custom widgets, a minimal draw_cell() override might look like the following. With custom widgets it is up to the caller to handle drawing everything within the dimensions of the cell, including handling the selection color. Note all clipping must be handled as well; this allows drawing outside the dimensions of the cell if so desired for custom effects.
// This is called whenever Fl_Table wants you to draw a cell void MyTable::draw_cell(TableContext context, int R=0, int C=0, int X=0, int Y=0, int W=0, int H=0) { static char s[40]; sprintf(s, "%d/%d", R, C); // text for each cell switch ( context ) { case CONTEXT_STARTPAGE: // Fl_Table telling us its starting to draw page
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.123 Fl_Table Class Reference


fl_font(FL_HELVETICA, 16); return; case CONTEXT_ROW_HEADER: // Fl_Table telling us its draw row/col headers case CONTEXT_COL_HEADER: fl_push_clip(X, Y, W, H); { fl_draw_box(FL_THIN_UP_BOX, X, Y, W, H, color()); fl_color(FL_BLACK); fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER); } fl_pop_clip(); return; case CONTEXT_CELL: // Fl_Table telling us to draw cells fl_push_clip(X, Y, W, H); { // BG COLOR fl_color( row_selected(R) ? selection_color() : FL_WHITE); fl_rectf(X, Y, W, H); // TEXT fl_color(FL_BLACK); fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER); // BORDER fl_color(FL_LIGHT2); fl_rect(X, Y, W, H); } fl_pop_clip(); return; default: return; } //NOTREACHED }

727

30.123.4.16

void Fl Table::end ( ) [inline]

Exactly the same as current(this->parent()). Any new widgets added to the widget tree will be added to the parent of the group. Reimplemented from Fl_Group. 30.123.4.17 int Fl Table::nd ( const Fl_Widget o ) const [inline]

Searches the child array for the widget and returns the index. Returns children() if the widget is NULL or not found. Reimplemented from Fl_Group. 30.123.4.18 void Fl Table::get selection ( int & row top, int & col left, int & row bot, int & col right )

Gets the region of cells selected (highlighted).

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

728 Parameters in in in in

Class Documentation

row_top col_left row_bot col_right

Returns the top row of selection area Returns the left column of selection area Returns the bottom row of selection area Returns the right column of selection area

30.123.4.19

int Fl Table::handle ( int event ) [protected, virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted

See also Fl_Event Reimplemented from Fl_Group. Reimplemented in Fl_Table_Row. 30.123.4.20 void Fl Table::init sizes ( ) [inline]

Resets the internal array of widget sizes and positions. The Fl_Group widget keeps track of the original widget sizes and positions when resizing occurs so that if you resize a window back to its original size the widgets will be in the correct places. If you rearrange the widgets in your group, call this method to register the new arrangement with the Fl_Group that contains them. If you add or remove widgets, this will be done automatically. Note The internal array of widget sizes and positions will be allocated and lled when the next resize() occurs.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.123 Fl_Table Class Reference See also sizes() Reimplemented from Fl_Group.

729

30.123.4.21

void Fl Table::insert ( Fl_Widget & o, int index ) [inline]

The widget is removed from its current group (if any) and then inserted into this group. It is put at index n - or at the end, if n >= children(). This can also be used to rearrange the widgets inside a group. Reimplemented from Fl_Group.

30.123.4.22

void Fl Table::insert ( Fl_Widget & o, Fl_Widget before ) [inline]

This does insert(w, nd(before)). This will append the widget if before is not in the group. Reimplemented from Fl_Group.

30.123.4.23

int Fl Table::is interactive resize ( ) [inline]

Returns 1 if someone is interactively resizing a row or column. You can currently call this only from within your callback().

30.123.4.24

int Fl Table::is selected ( int r, int c )

See if the cell at row r and column c is selected. Returns 1 if the cell is selected, 0 if not.

30.123.4.25

void Fl Table::remove ( Fl_Widget & o ) [inline]

Removes a widget from the group but does not delete it. This method does nothing if the widget is not a child of the group. This method differs from the clear() method in that it only affects a single widget and does not delete it from memory. Note If you have the childs index anyway, use remove(int index) instead, because this doesnt need a child lookup in the groups table of children. This can be much faster, if there are lots of children. Reimplemented from Fl_Group.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

730 30.123.4.26 void Fl Table::row header ( int ag ) [inline]

Class Documentation

Enables/disables showing the row headers. 1=enabled, 0=disabled. If changed, the table is redrawn. 30.123.4.27 void Fl Table::row height ( int row, int height )

Sets the height of the specied row in pixels, and the table is redrawn. callback() will be invoked with CONTEXT_RC_RESIZE if the rows height was actually changed, and when() is FL_WHEN_CHANGED. 30.123.4.28 void Fl Table::row height all ( int height ) [inline]

Convenience method to set the height of all rows to the same value, in pixels. The screen is redrawn. 30.123.4.29 void Fl Table::row resize ( int ag ) [inline]

Allows/disallows row resizing by the user. 1=allow interactive resizing, 0=disallow interactive resizing. Since interactive resizing is done via the row headers, row_header() must also be enabled to allow resizing. 30.123.4.30 void Fl Table::row resize min ( int val ) [inline]

Sets the current row minimum resize value. This is used to prevent the user from interactively resizing any row to be smaller than pixels. Must be a value >=1. 30.123.4.31 void Fl Table::set selection ( int row top, int col left, int row bot, int col right )

Sets the region of cells to be selected (highlighted). So for instance, set_selection(0,0,0,0) selects the top/left cell in the table. And set_selection(0,0,1,1) selects the four cells in rows 0 and 1, column 0 and 1. Parameters in in in in

row_top col_left row_bot col_right

Top row of selection area Left column of selection area Bottom row of selection area Right column of selection area

30.123.4.32

void Fl Table::table box ( Fl_Boxtype val ) [inline]

Sets the kind of box drawn around the data table, the default being FL_NO_BOX. Changing this value will cause the table to redraw.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.123 Fl_Table Class Reference 30.123.4.33 void Fl Table::top row ( int row ) [inline]

731

Sets which row should be at the top of the table, scrolling as necessary, and the table is redrawn. If the table cannot be scrolled that far, it is scrolled as far as possible. 30.123.4.34 int Fl Table::top row ( ) [inline]

Returns the current top row shown in the table. This row may be partially obscured. 30.123.4.35 void Fl Table::visible cells ( int & r1, int & r2, int & c1, int & c2 ) [inline]

Returns the range of row and column numbers for all visible and partially visible cells in the table. These values can be used e.g. by your draw_cell() routine during CONTEXT_STARTPAGE to gure out what cells are about to be redrawn for the purposes of locking the data from a database before its drawn.
leftcol rightcol : : toprow .. .-------------------. | | | V I S I B L E | | | | T A B L E | | | botrow .. -------------------

e.g. in a table where the visible rows are 5-20, and the visible columns are 100-120, then those variables would be: toprow = 5 botrow = 20 leftcol = 100 rightcol = 120

30.123.4.36

void Fl Table::when ( Fl_When ags )

The Fl_Widget::when() function is used to set a group of ags, determining when the widget callback is called: FL_WHEN_CHANGED callback() will be called when rows or columns are resized (interactively or via col_width() or row_height()), passing CONTEXT_RC_RESIZE via callback_context(). callback() will be called during FL_RELEASE events, such as when someone releases a mouse button somewhere on the table.

FL_WHEN_RELEASE

The callback() routine is sent a TableContext that indicates the context the event occurred in, such as in a cell, in a header, or elsewhere on the table. When an event occurs in a cell or header, callback_row() and
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

732

Class Documentation

callback_col() can be used to determine the row and column. The callback can also look at the regular tk event values (ie. Fl::event() and Fl::button()) to determine what kind of event is occurring. The documentation for this class was generated from the following les: Fl_Table.H Fl_Table.cxx

30.124

Fl Table Row Class Reference

A table with row selection capabilities. #include <Fl_Table_Row.H> Inheritance diagram for Fl_Table_Row:
Fl_Widget Fl_Group Fl_Table Fl_Table_Row

Classes
class CharVector

Public Types
enum TableRowSelectMode { SELECT_NONE, SELECT_SINGLE, SELECT_MULTI }

Public Member Functions


void clear ()
Clears the table to zero rows, zero columns.

Fl_Table_Row (int X, int Y, int W, int H, const char l=0)


The constructor for the Fl_Table_Row.

int row_selected (int row)


Checks to see if row is selected.

void rows (int val)


Sets the number of rows in the table, and the table is redrawn.

int rows ()
Returns the number of rows in the table.

void select_all_rows (int ag=1)


This convenience function changes the selection state for all rows based on ag.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.124 Fl_Table_Row Class Reference int select_row (int row, int ag=1)
Changes the selection state for row, depending on the value of ag.

733

void type (TableRowSelectMode val)


Sets the table selection mode.

TableRowSelectMode type () const


Gets the widget type.

Fl_Table_Row ()
The destructor for the Fl_Table_Row.

Protected Member Functions


int nd_cell (TableContext context, int R, int C, int &X, int &Y, int &W, int &H) int handle (int event)
Handles the specied event.

30.124.1

Detailed Description

A table with row selection capabilities. This class implements a simple table with the ability to select rows. This widget is similar to an Fl_Browser with columns. Most methods of importance will be found in the Fl_Table widget, such as Fl_Table::rows() and Fl_Table::cols(). To be useful it must be subclassed and at minimum the draw_cell() method must be overridden to provide the content of the cells. This widget does not manage the cells data content; it is up to the parent classs draw_cell() method override to provide this. Events on the cells and/or headings generate callbacks when they are clicked by the user. You control when events are generated based on the values you supply for Fl_Table::when().

30.124.2
30.124.2.1

Constructor & Destructor Documentation


Fl Table Row::Fl Table Row ( int X, int Y, int W, int H, const char l = 0 ) [inline]

The constructor for the Fl_Table_Row. This creates an empty table with no rows or columns, with headers and row/column resize behavior disabled. 30.124.2.2 Fl Table Row::Fl Table Row ( ) [inline]

The destructor for the Fl_Table_Row. Destroys the table and its associated widgets.

30.124.3
30.124.3.1

Member Function Documentation


void Fl Table Row::clear ( ) [inline, virtual]

Clears the table to zero rows, zero columns. Same as rows(0); cols(0);
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

734 See also rows(int), cols(int) Reimplemented from Fl_Table. 30.124.3.2 int Fl Table Row::handle ( int event ) [protected, virtual]

Class Documentation

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted

See also Fl_Event Reimplemented from Fl_Table.

30.124.3.3

int Fl Table Row::row selected ( int row )

Checks to see if row is selected. Returns 1 if selected, 0 if not. You can change the selection of a row by clicking on it, or by using select_row(row, ag)

30.124.3.4

void Fl Table Row::select all rows ( int ag = 1 )

This convenience function changes the selection state for all rows based on ag. 0=deselect, 1=select, 2=toggle existing state.

30.124.3.5

int Fl Table Row::select row ( int row, int ag = 1 )

Changes the selection state for row, depending on the value of ag. 0=deselected, 1=select, 2=toggle existing state.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.125 Fl_Tabs Class Reference 30.124.3.6 void Fl Table Row::type ( TableRowSelectMode val )

735

Sets the table selection mode. Fl_Table_Row::SELECT_NONE - No selection allowed Fl_Table_Row::SELECT_SINGLE - Only single rows can be selected Fl_Table_Row::SELECT_MULTI - Multiple rows can be selected

30.124.3.7

TableRowSelectMode Fl Table Row::type ( ) const [inline]

Gets the widget type. Returns the widget type value, which is used for Forms compatibility and to simulate RTTI. Todo Explain "simulate RTTI" (currently only used to decide if a widget is a window, i.e. type()>=FL_WINDOW ?). Is type() really used in a way that ensures "Forms compatibility" ? Reimplemented from Fl_Widget. The documentation for this class was generated from the following les: Fl_Table_Row.H Fl_Table_Row.cxx

30.125

Fl Tabs Class Reference

The Fl_Tabs widget is the "le card tabs" interface that allows you to put lots and lots of buttons and switches in a panel, as popularized by many toolkits. #include <Fl_Tabs.H> Inheritance diagram for Fl_Tabs:

Fl_Widget Fl_Group Fl_Tabs

Public Member Functions


void client_area (int &rx, int &ry, int &rw, int &rh, int tabh=0)
Returns the position and size available to be used by its children.

Fl_Tabs (int, int, int, int, const char =0)


Creates a new Fl_Tabs widget using the given position, size, and label string.

int handle (int)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

736
Handles the specied event.

Class Documentation

Fl_Widget push () const int push (Fl_Widget ) Fl_Widget value ()


Gets the currently visible widget/tab.

int value (Fl_Widget )


Sets the widget to become the current visible widget/tab.

Fl_Widget which (int event_x, int event_y)

Protected Member Functions


void draw ()
Draws the widget.

void redraw_tabs ()

30.125.1

Detailed Description

The Fl_Tabs widget is the "le card tabs" interface that allows you to put lots and lots of buttons and switches in a panel, as popularized by many toolkits.

Figure 30.35: Fl_Tabs

Clicking the tab makes a child visible() by calling show() on it, and all other children are made invisible by calling hide() on them. Usually the children are Fl_Group widgets containing several widgets themselves. Each child makes a card, and its label() is printed on the card tab, including the label font and style. The selection color of that child is used to color the tab, while the color of the child determines the background color of the pane. The size of the tabs is controlled by the bounding box of the children (there should be some space between the children and the edge of the Fl_Tabs), and the tabs may be placed "inverted" on the bottom - this is determined by which gap is larger. It is easiest to lay this out in uid, using the uid browser to select each child group and resize them until the tabs look the way you want them to.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.125 Fl_Tabs Class Reference

737

30.125.2
30.125.2.1

Constructor & Destructor Documentation


Fl Tabs::Fl Tabs ( int X, int Y, int W, int H, const char l = 0 )

Creates a new Fl_Tabs widget using the given position, size, and label string. The default boxtype is FL_THIN_UP_BOX. Use add(Fl_Widget) to add each child, which are usually Fl_Group widgets. The children should be sized to stay away from the top or bottom edge of the Fl_Tabs widget, which is where the tabs will be drawn. All children of Fl_Tabs should have the same size and exactly t on top of each other. They should only leave space above or below where that tabs will go, but not on the sides. If the rst child of Fl_Tabs is set to "resizable()", the riders will not resize when the tabs are resized. The destructor also deletes all the children. This allows a whole tree to be deleted at once, without having to keep a pointer to all the children in the user code. A kludge has been done so the Fl_Tabs and all of its children can be automatic (local) variables, but you must declare the Fl_Tabs widget rst so that it is destroyed last.

30.125.3
30.125.3.1

Member Function Documentation


void Fl Tabs::client area ( int & rx, int & ry, int & rw, int & rh, int tabh = 0 )

Returns the position and size available to be used by its children. If there isnt any child yet the tabh parameter will be used to calculate the return values. This assumes that the childrens labelsize is the same as the Fl_Tabs labelsize and adds a small border. If there are already children, the values of child(0) are returned, and tabh is ignored. Note Children should always use the same positions and sizes. tabh can be one of 0: calculate label size, tabs on top -1: calculate label size, tabs on bottom > 0: use given tabh value, tabs on top (height = tabh) < -1: use given tabh value, tabs on bottom (height = -tabh) Parameters in out

tabh position and optional height of tabs (see above) rx,ry,rw,rh (x,y,w,h) of client area for children

Since FLTK 1.3.0

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

738 30.125.3.2 void Fl Tabs::draw ( ) [protected, virtual]

Class Documentation

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Reimplemented from Fl_Group. 30.125.3.3 int Fl Tabs::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted

See also Fl_Event Reimplemented from Fl_Group.

30.125.3.4 Fl_Widget Fl Tabs::value ( ) Gets the currently visible widget/tab. The value() is the rst visible child (or the last child if none are visible) and this also hides any other children. This allows the tabs to be deleted, moved to other groups, and show()/hide() called without it screwing up.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.126 Fl_Text_Buffer Class Reference 30.125.3.5 int Fl Tabs::value ( Fl_Widget newvalue )

739

Sets the widget to become the current visible widget/tab. Setting the value hides all other children, and makes this one visible, if it is really a child. The documentation for this class was generated from the following les: Fl_Tabs.H Fl_Tabs.cxx

30.126

Fl Text Buffer Class Reference

This class manages unicode displayed in one or more Fl_Text_Display widgets. #include <Fl_Text_Buffer.H>

Public Member Functions


void add_modify_callback (Fl_Text_Modify_Cb bufModiedCB, void cbArg)
Adds a callback function that is called whenever the text buffer is modied.

void add_predelete_callback (Fl_Text_Predelete_Cb bufPredelCB, void cbArg)


Adds a callback routine to be called before text is deleted from the buffer.

const char address (int pos) const


Convert a byte offset in buffer into a memory address.

char address (int pos)


Convert a byte offset in buffer into a memory address.

void append (const char t)


Appends the text string to the end of the buffer.

int appendle (const char le, int buen=128 1024)


Appends the named le to the end of the buffer.

char byte_at (int pos) const


Returns the raw byte at the specied position pos in the buffer.

void call_modify_callbacks ()
Calls all modify callbacks that have been registered using the add_modify_callback() method.

void call_predelete_callbacks ()
Calls the stored pre-delete callback procedure(s) for this buffer to update the changed area(s) on the screen and any other listeners.

void canUndo (char ag=1)


Lets the undo system know if we can undo changes.

unsigned int char_at (int pos) const


Returns the character at the specied position pos in the buffer.

void copy (Fl_Text_Buffer fromBuf, int fromStart, int fromEnd, int toPos)
Copies text from one buffer to this one.

int count_displayed_characters (int lineStartPos, int targetPos) const


Count the number of displayed characters between buffer position lineStartPos and targetPos.

int count_lines (int startPos, int endPos) const


Counts the number of newlines between startPos and endPos in buffer.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

740

Class Documentation int ndchar_backward (int startPos, unsigned int searchChar, int foundPos) const
Search backwards in buffer buf for character searchChar, starting with the character BEFORE startPos, returning the result in foundPos returns 1 if found, 0 if not.

int ndchar_forward (int startPos, unsigned searchChar, int foundPos) const


Finds the next occurrence of the specied character.

Fl_Text_Buffer (int requestedSize=0, int preferredGapSize=1024)


Create an empty text buffer of a pre-determined size.

void highlight (int start, int end)


Highlights the specied text within the buffer.

int highlight ()
Returns the highlighted text.

int highlight_position (int start, int end)


Highlights the specied text between start and end within the buffer.

const Fl_Text_Selection highlight_selection () const


Returns the current highlight selection.

char highlight_text ()
Returns the highlighted text.

void insert (int pos, const char text)


Inserts null-terminated string text at position pos.

int insertle (const char le, int pos, int buen=128 1024)
Inserts a le at the specied position.

int length () const


Returns the number of bytes in the buffer.

int line_end (int pos) const


Finds and returns the position of the end of the line containing position pos (which is either a pointer to the newline character ending the line, or a pointer to one character beyond the end of the buffer)

int line_start (int pos) const


Returns the position of the start of the line containing position pos.

char line_text (int pos) const


Returns the text from the entire line containing the specied character position.

int loadle (const char le, int buen=128 1024)


Loads a text le into the buffer.

int next_char (int ix) const


Returns the index of the next character.

int next_char_clipped (int ix) const int outputle (const char le, int start, int end, int buen=128 1024)
Writes the specied portions of the le to a le.

int prev_char (int ix) const


Returns the index of the previous character.

int prev_char_clipped (int ix) const const Fl_Text_Selection primary_selection () const


Returns the primary selection.

Fl_Text_Selection primary_selection ()
Returns the primary selection.

void remove (int start, int end)


Deletes a range of characters in the buffer.

void remove_modify_callback (Fl_Text_Modify_Cb bufModiedCB, void cbArg)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.126 Fl_Text_Buffer Class Reference


Removes a modify callback.

741

void remove_predelete_callback (Fl_Text_Predelete_Cb predelCB, void cbArg)


Removes a callback routine bufPreDeleteCB associated with argument cbArg to be called before text is deleted from the buffer.

void remove_secondary_selection ()
Removes the text from the buffer corresponding to the secondary text selection object.

void remove_selection ()
Removes the text in the primary selection.

void replace (int start, int end, const char text)


Deletes the characters between start and end, and inserts the null-terminated string text in their place in the buffer.

void replace_secondary_selection (const char text)


Replaces the text from the buffer corresponding to the secondary text selection object with the new string text.

void replace_selection (const char text)


Replaces the text in the primary selection.

int rewind_lines (int startPos, int nLines)


Finds and returns the position of the rst character of the line nLines backwards from startPos (not counting the character pointed to by startpos if that is a newline) in the buffer.

int savele (const char le, int buen=128 1024)


Saves a text le from the current buffer.

int search_backward (int startPos, const char searchString, int foundPos, int matchCase=0) const
Search backwards in buffer for string searchCharssearchString, starting with the character BEFORE startPos, returning the result in foundPos returns 1 if found, 0 if not.

int search_forward (int startPos, const char searchString, int foundPos, int matchCase=0) const
Search forwards in buffer for string searchString, starting with the character startPos, and returning the result in foundPos returns 1 if found, 0 if not.

void secondary_select (int start, int end)


Selects a range of characters in the secondary selection.

int secondary_selected ()
Returns a non 0 value if text has been selected in the secondary text selection, 0 otherwise.

const Fl_Text_Selection secondary_selection () const


Returns the secondary selection.

int secondary_selection_position (int start, int end)


Returns the current selection in the secondary text selection object.

char secondary_selection_text ()
Returns the text in the secondary selection.

void secondary_unselect ()
Clears any selection in the secondary text selection object.

void select (int start, int end)


Selects a range of characters in the buffer.

int selected () const


Returns a non 0 value if text has been selected, 0 otherwise.

int selection_position (int start, int end)


Gets the selection position.

char selection_text ()
Returns the currently selected text.

int skip_displayed_characters (int lineStartPos, int nChars)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

742

Class Documentation
Count forward from buffer position startPos in displayed characters (displayed characters are the characters shown on the screen to represent characters in the buffer, where tabs and control characters are expanded)

int skip_lines (int startPos, int nLines)


Finds the rst character of the line nLines forward from startPos in the buffer and returns its position.

int tab_distance () const


Gets the tab width.

void tab_distance (int tabDist)


Set the hardware tab distance (width) used by all displays for this buffer, and used in computing offsets for rectangular selection operations.

char text () const


Get a copy of the entire contents of the text buffer.

void text (const char text)


Replaces the entire contents of the text buffer.

char text_range (int start, int end) const


Get a copy of a part of the text buffer.

int undo (int cp=0)


Undo text modication according to the undo variables or insert text from the undo buffer.

void unhighlight ()
Unhighlights text in the buffer.

void unselect ()
Cancels any previous selection on the primary text selection object.

int utf8_align (int) const


Align an index into the buffer to the current or previous utf8 boundary.

int word_end (int pos) const


Returns the position corresponding to the end of the word.

int word_start (int pos) const


Returns the position corresponding to the start of the word.

Fl_Text_Buffer ()
Frees a text buffer.

Public Attributes
int input_le_was_transcoded
true iff the loaded le has been transcoded to UTF-8

void( transcoding_warning_action )(Fl_Text_Buffer )


Pointer to a function called after reading a non UTF-8 encoded le.

Static Public Attributes


static const char le_encoding_warning_message = "Some changes may have occurred."
This message may be displayed using the _alert() function when a le which was not UTF-8 encoded is input.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.126 Fl_Text_Buffer Class Reference

743

Protected Member Functions


void call_modify_callbacks (int pos, int nDeleted, int nInserted, int nRestyled, const char deletedText) const
Calls the stored modify callback procedure(s) for this buffer to update the changed area(s) on the screen and any other listeners.

void call_predelete_callbacks (int pos, int nDeleted) const


Calls the stored pre-delete callback procedure(s) for this buffer to update the changed area(s) on the screen and any other listeners.

int insert_ (int pos, const char text)


Internal (non-redisplaying) version of BufInsert.

void move_gap (int pos)


Move the gap to start at a new position.

void reallocate_with_gap (int newGapStart, int newGapLen)


Reallocates the text storage in the buffer to have a gap starting at newGapStart and a gap size of newGapLen, preserving the buffers current contents.

void redisplay_selection (Fl_Text_Selection oldSelection, Fl_Text_Selection newSelection) const


Calls the stored redisplay procedure(s) for this buffer to update the screen for a change in a selection.

void remove_ (int start, int end)


Internal (non-redisplaying) version of BufRemove.

void remove_selection_ (Fl_Text_Selection sel)


Removes the text from the buffer corresponding to sel.

void replace_selection_ (Fl_Text_Selection sel, const char text)


Replaces the text in selection sel.

char selection_text_ (Fl_Text_Selection sel) const void update_selections (int pos, int nDeleted, int nInserted)
Updates all of the selections in the buffer for changes in the buffers text.

Protected Attributes
char mBuf
allocated memory where the text is stored

char mCanUndo
if this buffer is used for attributes, it must not do any undo calls

void mCbArgs
caller arguments for modifyProcs above

int mCursorPosHint
hint for reasonable cursor position after a buffer modication operation

int mGapEnd
points to the rst char after the gap

int mGapStart
points to the rst character of the gap

Fl_Text_Selection mHighlight
highlighted areas

int mLength
length of the text in the buffer (the length of the buffer itself must be calculated: gapEnd - gapStart + length)

Fl_Text_Modify_Cb mModifyProcs
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

744
procedures to call when buffer is modied to redisplay contents

Class Documentation

int mNModifyProcs
number of modify-redisplay procs attached

int mNPredeleteProcs
number of pre-delete procs attached

void mPredeleteCbArgs
caller argument for pre-delete proc above

Fl_Text_Predelete_Cb mPredeleteProcs
procedure to call before text is deleted from the buffer; at most one is supported.

int mPreferredGapSize
the default allocation for the text gap is 1024 bytes and should only be increased if frequent and large changes in buffer size are expected

Fl_Text_Selection mPrimary
highlighted areas

Fl_Text_Selection mSecondary
highlighted areas

int mTabDist
equiv.

30.126.1

Detailed Description

This class manages unicode displayed in one or more Fl_Text_Display widgets. All text in Fl_Text_Buffermust be encoded in UTF-8. All indices used in the function calls must be aligned to the start of a UTF-8 sequence. All indices and pointers returned will be aligned. All functions that return a single character will return that in an unsiged int in UCS-4 encoding. The Fl_Text_Buffer class is used by the Fl_Text_Display and Fl_Text_Editor to manage complex text data and is based upon the excellent NEdit text editor engine - see http://www.nedit.org/.

30.126.2
30.126.2.1

Constructor & Destructor Documentation


Fl Text Buffer::Fl Text Buffer ( int requestedSize = 0, int preferredGapSize = 1024 )

Create an empty text buffer of a pre-determined size. Parameters requestedSize use this to avoid unnecessary re-allocation if you know exactly how much the buffer will need to hold preferredGap- Initial size for the buffer gap (empty space in the buffer where text might be inserted if Size the user is typing sequential chars)

30.126.3
30.126.3.1

Member Function Documentation


void Fl Text Buffer::add modify callback ( Fl Text Modify Cb bufModiedCB, void cbArg )

Adds a callback function that is called whenever the text buffer is modied. The callback function is declared as follows:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.126 Fl_Text_Buffer Class Reference


typedef void (*Fl_Text_Modify_Cb)(int pos, int nInserted, int nDeleted, int nRestyled, const char* deletedText, void* cbArg);

745

30.126.3.2

const char Fl Text Buffer::address ( int pos ) const [inline]

Convert a byte offset in buffer into a memory address. Parameters pos byte offset into buffer

Returns byte offset converted to a memory address

30.126.3.3

char Fl Text Buffer::address ( int pos ) [inline]

Convert a byte offset in buffer into a memory address. Parameters pos byte offset into buffer

Returns byte offset converted to a memory address

30.126.3.4

void Fl Text Buffer::append ( const char t ) [inline]

Appends the text string to the end of the buffer. Parameters t utf-8 encoded and nul terminated text

30.126.3.5

int Fl Text Buffer::appendle ( const char le, int buen = 1281024 ) [inline]

Appends the named le to the end of the buffer. See also insertle(). 30.126.3.6 char Fl Text Buffer::byte at ( int pos ) const

Returns the raw byte at the specied position pos in the buffer. Positions start at 0

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

746 Parameters pos byte offset into buffer

Class Documentation

Returns unencoded raw byte

30.126.3.7

unsigned int Fl Text Buffer::char at ( int pos ) const

Returns the character at the specied position pos in the buffer. Positions start at 0 Parameters pos byte offset into buffer, pos must be at acharacter boundary

Returns Unicode UCS-4 encoded character

30.126.3.8

void Fl Text Buffer::copy ( Fl_Text_Buffer fromBuf, int fromStart, int fromEnd, int toPos )

Copies text from one buffer to this one. Parameters fromBuf fromStart fromEnd toPos

source text buffer may be the same as this byte offset into buffer byte offset into buffer destination byte offset into buffer

30.126.3.9

int Fl Text Buffer::count displayed characters ( int lineStartPos, int targetPos ) const

Count the number of displayed characters between buffer position lineStartPos and targetPos. (displayed characters are the characters shown on the screen to represent characters in the buffer, where tabs and control characters are expanded)

30.126.3.10

int Fl Text Buffer::count lines ( int startPos, int endPos ) const

Counts the number of newlines between startPos and endPos in buffer. The character at position endPos is not counted.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.126 Fl_Text_Buffer Class Reference 30.126.3.11

747

int Fl Text Buffer::ndchar backward ( int startPos, unsigned int searchChar, int foundPos ) const

Search backwards in buffer buf for character searchChar, starting with the character BEFORE startPos, returning the result in foundPos returns 1 if found, 0 if not. (The difference between this and BufSearchBackward is that its optimized for single characters. The overall performance of the text widget is dependent on its ability to count lines quickly, hence searching for a single character: newline) Parameters startPos byte offset to start position searchChar UCS-4 character that we want to nd foundPos byte offset where the character was found

Returns 1 if found, 0 if not

30.126.3.12

int Fl Text Buffer::ndchar forward ( int startPos, unsigned searchChar, int foundPos ) const

Finds the next occurrence of the specied character. Search forwards in buffer for character searchChar, starting with the character startPos, and returning the result in foundPos returns 1 if found, 0 if not. (The difference between this and BufSearchForward is that its optimized for single characters. The overall performance of the text widget is dependent on its ability to count lines quickly, hence searching for a single character: newline) Parameters startPos byte offset to start position searchChar UCS-4 character that we want to nd foundPos byte offset where the character was found

Returns 1 if found, 0 if not

30.126.3.13

int Fl Text Buffer::highlight ( ) [inline]

Returns the highlighted text. When you are done with the text, free it using the free() function.

30.126.3.14

char Fl Text Buffer::highlight text ( )

Returns the highlighted text. When you are done with the text, free it using the free() function.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

748 30.126.3.15 void Fl Text Buffer::insert ( int pos, const char text )

Class Documentation

Inserts null-terminated string text at position pos. Parameters pos insertion position as byte offset (must be utf-8 character aligned) text utf-8 encoded and nul terminated text

30.126.3.16

int Fl Text Buffer::insert ( int pos, const char text ) [protected]

Internal (non-redisplaying) version of BufInsert. Returns the length of text inserted (this is just strlen(text), however this calculation can be expensive and the length will be required by any caller who will continue on to call redisplay). pos must be contiguous with the existing text in the buffer (i.e. not past the end). Returns the number of bytes inserted

30.126.3.17

int Fl Text Buffer::insertle ( const char le, int pos, int buen = 1281024 )

Inserts a le at the specied position. Returns 0 on success, non-zero on error (strerror() contains reason). 1 indicates open for read failed (no data loaded). 2 indicates error occurred while reading data (data was partially loaded). File can be UTF-8 or CP1252-encoded. If the input le is not UTF-8-encoded, the Fl_Text_Buffer widget will contain UTF-8-transcoded data. By default, the message Fl_Text_Buffer::le_encoding_warning_message will warn the user about this. See also input_le_was_transcoded and transcoding_warning_action.

30.126.3.18

int Fl Text Buffer::length ( ) const [inline]

Returns the number of bytes in the buffer. Returns size of text in bytes

30.126.3.19

int Fl Text Buffer::line end ( int pos ) const

Finds and returns the position of the end of the line containing position pos (which is either a pointer to the newline character ending the line, or a pointer to one character beyond the end of the buffer) Parameters pos byte index into buffer
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.126 Fl_Text_Buffer Class Reference Returns byte offset to line end

749

30.126.3.20

int Fl Text Buffer::line start ( int pos ) const

Returns the position of the start of the line containing position pos. Parameters pos byte index into buffer

Returns byte offset to line start

30.126.3.21

char Fl Text Buffer::line text ( int pos ) const

Returns the text from the entire line containing the specied character position. When you are done with the text, free it using the free() function. Parameters pos byte index into buffer

Returns copy of utf8 text, must be freed

30.126.3.22

int Fl Text Buffer::loadle ( const char le, int buen = 1281024 ) [inline]

Loads a text le into the buffer. See also insertle(). 30.126.3.23 int Fl Text Buffer::next char ( int ix ) const

Returns the index of the next character. Parameters ix index to the current char

30.126.3.24

int Fl Text Buffer::outputle ( const char le, int start, int end, int buen = 1281024 )

Writes the specied portions of the le to a le. Returns 0 on success, non-zero on error (strerror() contains reason). 1 indicates open for write failed (no data saved). 2 indicates error occurred while writing data (data was partially saved).
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

750 30.126.3.25 int Fl Text Buffer::prev char ( int ix ) const

Class Documentation

Returns the index of the previous character. Parameters ix index to the current char

30.126.3.26

void Fl Text Buffer::remove ( int start, int end )

Deletes a range of characters in the buffer. Parameters start byte offset to rst character to be removed end byte offset to charcatre after last character to be removed

30.126.3.27

void Fl Text Buffer::remove ( int start, int end ) [protected]

Internal (non-redisplaying) version of BufRemove. Removes the contents of the buffer between start and end (and moves the gap to the site of the delete). 30.126.3.28 void Fl Text Buffer::replace ( int start, int end, const char text )

Deletes the characters between start and end, and inserts the null-terminated string text in their place in the buffer. Parameters start byte offset to rst character to be removed and new insert position end byte offset to charcatre after last character to be removed text utf-8 encoded and nul terminated text

30.126.3.29

int Fl Text Buffer::rewind lines ( int startPos, int nLines )

Finds and returns the position of the rst character of the line nLines backwards from startPos (not counting the character pointed to by startpos if that is a newline) in the buffer. nLines == 0 means nd the beginning of the line 30.126.3.30 int Fl Text Buffer::search backward ( int startPos, const char searchString, int foundPos, int matchCase = 0 ) const

Search backwards in buffer for string searchCharssearchString, starting with the character BEFORE startPos, returning the result in foundPos returns 1 if found, 0 if not.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.126 Fl_Text_Buffer Class Reference Parameters startPos searchString foundPos matchCase

751

byte offset to start position utf8 string that we want to nd byte offset where the string was found if set, match character case

Returns 1 if found, 0 if not

30.126.3.31

int Fl Text Buffer::search forward ( int startPos, const char searchString, int foundPos, int matchCase = 0 ) const

Search forwards in buffer for string searchString, starting with the character startPos, and returning the result in foundPos returns 1 if found, 0 if not. Parameters startPos searchString foundPos matchCase

byte offset to start position utf8 string that we want to nd byte offset where the string was found if set, match character case

Returns 1 if found, 0 if not

30.126.3.32

char Fl Text Buffer::secondary selection text ( )

Returns the text in the secondary selection. When you are done with the text, free it using the free() function. 30.126.3.33 char Fl Text Buffer::selection text ( )

Returns the currently selected text. When you are done with the text, free it using the free() function. 30.126.3.34 int Fl Text Buffer::skip displayed characters ( int lineStartPos, int nChars )

Count forward from buffer position startPos in displayed characters (displayed characters are the characters shown on the screen to represent characters in the buffer, where tabs and control characters are expanded) Parameters lineStartPos byte offset into buffer nChars number of bytes that are sent to the display

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

752 Returns byte offset in input after all output bytes are sent

Class Documentation

30.126.3.35

char Fl Text Buffer::text ( ) const

Get a copy of the entire contents of the text buffer. Memory is allocated to contain the returned string, which the caller must free. Returns newly allocated text buffer - must be freed, text is utf8

30.126.3.36

void Fl Text Buffer::text ( const char text )

Replaces the entire contents of the text buffer. Parameters text Text must be valid utf8.

30.126.3.37

char Fl Text Buffer::text range ( int start, int end ) const

Get a copy of a part of the text buffer. Return a copy of the text between start and end character positions from text buffer buf. Positions start at 0, and the range does not include the character pointed to by end. When you are done with the text, free it using the free() function. Parameters start byte offset to rst character end byte offset after last character in range

Returns newly allocated text buffer - must be freed, text is utf8

30.126.3.38

int Fl Text Buffer::word end ( int pos ) const

Returns the position corresponding to the end of the word. Parameters pos byte index into buffer Returns byte offset to word end

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.127 Fl_Text_Display Class Reference 30.126.3.39 int Fl Text Buffer::word start ( int pos ) const

753

Returns the position corresponding to the start of the word. Parameters pos byte index into buffer

Returns byte offset to word start

30.126.4
30.126.4.1

Member Data Documentation


Fl Text Predelete Cb Fl_Text_Buffer::mPredeleteProcs [protected]

procedure to call before text is deleted from the buffer; at most one is supported.

30.126.4.2 equiv.

int Fl_Text_Buffer::mTabDist [protected]

number of characters in a tab

30.126.4.3

void( Fl_Text_Buffer::transcoding_warning_action)(Fl_Text_Buffer )

Pointer to a function called after reading a non UTF-8 encoded le. This function is called after reading a le if the le content was transcoded to UTF-8. Its default implementation calls _alert() with the text of le_encoding_warning_message. No warning message is displayed if this pointer is set to NULL. Use input_le_was_transcoded to be informed if le input required transcoding to UTF-8. The documentation for this class was generated from the following les: Fl_Text_Buffer.H Fl_Text_Buffer.cxx

30.127

Fl Text Display Class Reference

Rich text display widget. #include <Fl_Text_Display.H> Inheritance diagram for Fl_Text_Display:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

754
Fl_Widget Fl_Group Fl_Text_Display Fl_Text_Editor

Class Documentation

Classes
struct Style_Table_Entry
This structure associates the color, font, andsize of a string to draw with an attribute mask matching attr.

Public Types
enum { NORMAL_CURSOR, CARET_CURSOR, DIM_CURSOR, BLOCK_CURSOR, HEAVY_CURSOR }
text display cursor shapes enumeration

enum { CURSOR_POS, CHARACTER_POS }


the character position is the left edge of a character, whereas the cursor is thought to be between the centers of two consecutive characters.

enum { DRAG_NONE = -2, DRAG_START_DND = -1, DRAG_CHAR = 0, DRAG_WORD = 1, DRAG_LINE = 2 }


drag types - they match Fl::event_clicks() so that single clicking to start a collection selects by character, double clicking selects by word and triple clicking selects by line.

enum { WRAP_NONE, WRAP_AT_COLUMN, WRAP_AT_PIXEL, WRAP_AT_BOUNDS }


wrap types - used in wrap_mode()

typedef void( Unnished_Style_Cb )(int, void )

Public Member Functions


void buffer (Fl_Text_Buffer buf)
Attach a text buffer to display, replacing the current buffer (if any)

void buffer (Fl_Text_Buffer &buf)


Sets the current text buffer associated with the text widget.

Fl_Text_Buffer buffer () const


Gets the current text buffer associated with the text widget.

double col_to_x (double col) const


Convert a column number into an x pixel position.

int count_lines (int start, int end, bool start_pos_is_line_start) const


Count the number of lines between two positions.

Fl_Color cursor_color () const


Gets the text cursor color.

void cursor_color (Fl_Color n)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.127 Fl_Text_Display Class Reference


Sets the text cursor color.

755

void cursor_style (int style)


Sets the text cursor style.

Fl_Text_Display (int X, int Y, int W, int H, const char l=0)


Creates a new text display widget.

virtual int handle (int e)


Event handling.

void hide_cursor ()
Hides the text cursor.

void highlight_data (Fl_Text_Buffer styleBuffer, const Style_Table_Entry styleTable, int nStyles, char unnishedStyle, Unnished_Style_Cb unnishedHighlightCB, void cbArg)
Attach (or remove) highlight information in text display and redisplay.

int in_selection (int x, int y) const


Check if a pixel position is within the primary selection.

void insert (const char text)


Inserts "text" at the current cursor location.

void insert_position (int newPos)


Sets the position of the text insertion cursor for text display.

int insert_position () const


Gets the position of the text insertion cursor for text display.

int line_end (int startPos, bool startPosIsLineStart) const


Returns the end of a line.

int line_start (int pos) const


Return the beginning of a line.

int move_down ()
Moves the current insert position down one line.

int move_left ()
Moves the current insert position left one character.

int move_right ()
Moves the current insert position right one character.

int move_up ()
Moves the current insert position up one line.

void next_word (void)


Moves the current insert position right one word.

void overstrike (const char text)


Replaces text at the current insert position.

int position_style (int lineStartPos, int lineLen, int lineIndex) const


Find the correct style for a character.

int position_to_xy (int pos, int x, int y) const


Convert a character index into a pixel position.

void previous_word (void)


Moves the current insert position left one word.

void redisplay_range (int start, int end)


Marks text from start to end as needing a redraw.

virtual void resize (int X, int Y, int W, int H)


Change the size of the displayed text area.

int rewind_lines (int startPos, int nLines)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

756
Skip a number of lines back.

Class Documentation

void scroll (int topLineNum, int horizOffset)


Scrolls the current buffer to start at the specied line and column.

Fl_Align scrollbar_align () const


Gets the scrollbar alignment type.

void scrollbar_align (Fl_Align a)


Sets the scrollbar alignment type.

int scrollbar_width () const


Gets the width/height of the scrollbars.

void scrollbar_width (int W)


Sets the width/height of the scrollbars.

int shortcut () const void shortcut (int s) void show_cursor (int b=1)
Shows the text cursor.

void show_insert_position ()
Scrolls the text buffer to show the current insert position.

int skip_lines (int startPos, int nLines, bool startPosIsLineStart)


Skip a number of lines forward.

Fl_Color textcolor () const


Gets the default color of text in the widget.

void textcolor (Fl_Color n)


Sets the default color of text in the widget.

Fl_Font textfont () const


Gets the default font used when drawing text in the widget.

void textfont (Fl_Font s)


Sets the default font used when drawing text in the widget.

Fl_Fontsize textsize () const


Gets the default size of text in the widget.

void textsize (Fl_Fontsize s)


Sets the default size of text in the widget.

int word_end (int pos) const


Moves the insert position to the end of the current word.

int word_start (int pos) const


Moves the insert position to the beginning of the current word.

void wrap_mode (int wrap, int wrap_margin)


Set the new text wrap mode.

int wrapped_column (int row, int column) const


Nobody knows what this function does.

int wrapped_row (int row) const


Nobody knows what this function does.

double x_to_col (double x) const


Convert an x pixel position into a column number.

Fl_Text_Display ()
Free a text display and release its associated memory.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.127 Fl_Text_Display Class Reference

757

Protected Types
enum { DRAW_LINE, FIND_INDEX, FIND_INDEX_FROM_ZERO, GET_WIDTH }

Protected Member Functions


void absolute_top_line_number (int oldFirstChar)
Line numbering stuff, currently unused.

void calc_last_char ()
Update last display character index.

void calc_line_starts (int startLine, int endLine)


Update the line start arrays.

void clear_rect (int style, int x, int y, int width, int height) const
Clear a rectangle with the appropriate background color for style.

void display_insert ()
Scroll the display to bring insertion cursor into view.

virtual void draw ()


Draw the widget.

void draw_cursor (int, int)


Draw a cursor with top center at X, Y.

void draw_line_numbers (bool clearAll)


Refresh the line number area.

void draw_range (int start, int end)


Draw a range of text.

void draw_string (int style, int x, int y, int toX, const char string, int nChars) const
Draw a text segment in a single style.

void draw_text (int X, int Y, int W, int H)


Refresh a rectangle of the text display.

void draw_vline (int visLineNum, int leftClip, int rightClip, int leftCharIndex, int rightCharIndex)
Draw a single line of text.

int empty_vlines () const


Return true if there are lines visible with no corresponding buffer text.

void extend_range_for_styles (int start, int end)


I dont know what this does!

void nd_line_end (int pos, bool start_pos_is_line_start, int lineEnd, int nextLineStart) const
Finds both the end of the current line and the start of the next line.

void nd_wrap_range (const char deletedText, int pos, int nInserted, int nDeleted, int modRangeStart, int modRangeEnd, int linesInserted, int linesDeleted)
Wrapping calculations.

int nd_x (const char s, int len, int style, int x) const
Find the index of the character that lies at the given x position.

int get_absolute_top_line_number () const


Line numbering stuff, currently unused.

int handle_vline (int mode, int lineStart, int lineLen, int leftChar, int rightChar, int topClip, int bottomClip, int leftClip, int rightClip) const
Universal pixel machine.

int longest_vline () const


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

758
Find the longest line of all visible lines.

Class Documentation

void maintain_absolute_top_line_number (int state)


Line numbering stuff, currently unused.

int maintaining_absolute_top_line_number () const


Line numbering stuff, currently unused.

void measure_deleted_lines (int pos, int nDeleted)


Wrapping calculations.

double measure_proportional_character (const char s, int colNum, int pos) const


Wrapping calculations.

int measure_vline (int visLineNum) const


Returns the width in pixels of the displayed line pointed to by "visLineNum".

void offset_line_starts (int newTopLineNum)


Offset line start counters for a new vertical scroll position.

int position_to_line (int pos, int lineNum) const


Convert a position index into a line number offset.

int position_to_linecol (int pos, int lineNum, int column) const


Find the line and column number of position pos.

void reset_absolute_top_line_number ()
Line numbering stuff, probably unused.

int scroll_ (int topLineNum, int horizOffset)


Scrolls the current buffer to start at the specied line and column.

double string_width (const char string, int length, int style) const
Find the width of a string in the font of a particular style.

void update_h_scrollbar ()
Update vertical scrollbar.

void update_line_starts (int pos, int charsInserted, int charsDeleted, int linesInserted, int linesDeleted, int scrolled)
Update line start arrays and variables.

void update_v_scrollbar ()
Update vertical scrollbar.

int vline_length (int visLineNum) const


Count number of bytes in a visible line.

int wrap_uses_character (int lineEndPos) const


Check if the line break is caused by a \n or by line wrapping.

void wrapped_line_counter (Fl_Text_Buffer buf, int startPos, int maxPos, int maxLines, bool startPosIsLineStart, int styleBufOffset, int retPos, int retLines, int retLineStart, int retLineEnd, bool countLastLineMissingNewLine=true) const
Wrapping calculations.

int xy_to_position (int x, int y, int PosType=CHARACTER_POS) const


Translate a pixel position into a character index.

void xy_to_rowcol (int x, int y, int row, int column, int PosType=CHARACTER_POS) const
Translate pixel coordinates into row and column.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.127 Fl_Text_Display Class Reference

759

Static Protected Member Functions


static void buffer_modied_cb (int pos, int nInserted, int nDeleted, int nRestyled, const char deletedText, void cbArg)
This is called whenever the buffer is modied.

static void buffer_predelete_cb (int pos, int nDeleted, void cbArg)


This is called before any characters are deleted.

static void h_scrollbar_cb (Fl_Scrollbar w, Fl_Text_Display d)


Callbacks for drag or valueChanged on scrollbars.

static void scroll_timer_cb (void )


Timer callback for scroll events.

static void v_scrollbar_cb (Fl_Scrollbar w, Fl_Text_Display d)


Callbacks for drag or valueChanged on scrollbars.

Protected Attributes
int damage_range1_end int damage_range1_start int damage_range2_end int damage_range2_start int display_insert_position_hint int dragging int dragPos int dragType int mAbsTopLineNum Fl_Text_Buffer mBuffer double mColumnScale int mContinuousWrap Fl_Color mCursor_color int mCursorOldY int mCursorOn int mCursorPos int mCursorPreferredXPos int mCursorStyle int mCursorToHint int mFirstChar void mHighlightCBArg int mHorizOffset int mHorizOffsetHint Fl_Scrollbar mHScrollBar int mLastChar int mLineNumLeft int mLineNumWidth int mLineStarts int mMaxsize int mModifyingTabDistance int mNBufferLines int mNeedAbsTopLineNum int mNLinesDeleted

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

760 int mNStyles int mNVisibleLines Fl_Text_Buffer mStyleBuffer const Style_Table_Entry mStyleTable int mSuppressResync int mTopLineNum int mTopLineNumHint Unnished_Style_Cb mUnnishedHighlightCB char mUnnishedStyle Fl_Scrollbar mVScrollBar int mWrapMarginPix Fl_Align scrollbar_align_ int scrollbar_width_ int shortcut_ struct { int h int w int x int y } text_area

Class Documentation

Fl_Color textcolor_ Fl_Font textfont_ Fl_Fontsize textsize_

Friends
void _text_drag_me (int pos, Fl_Text_Display d)

30.127.1

Detailed Description

Rich text display widget. This is the FLTK text display widget. It allows the user to view multiple lines of text and supports highlighting and scrolling. The buffer that is displayed in the widget is managed by the Fl_Text_Buffer class. A single Text Buffer can be displayed by multiple Text Displays.

30.127.2
30.127.2.1

Member Enumeration Documentation


anonymous enum

text display cursor shapes enumeration Enumerator: NORMAL_CURSOR I-beam. CARET_CURSOR caret under the text DIM_CURSOR dim I-beam BLOCK_CURSOR unlle box under the current character HEAVY_CURSOR thick I-beam
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.127 Fl_Text_Display Class Reference 30.127.2.2 anonymous enum

761

wrap types - used in wrap_mode() Enumerator: WRAP_NONE dont wrap text at all WRAP_AT_COLUMN wrap text at the given text column WRAP_AT_PIXEL wrap text at a pixel position WRAP_AT_BOUNDS wrap text so that it ts into the widget width

30.127.3
30.127.3.1

Constructor & Destructor Documentation


Fl Text Display::Fl Text Display ( int X, int Y, int W, int H, const char l = 0 )

Creates a new text display widget. Parameters X,Y,W,H position and size of widget l label text, defaults to none

30.127.3.2

Fl Text Display::Fl Text Display ( )

Free a text display and release its associated memory. Note, the text BUFFER that the text display displays is a separate entity and is not freed, nor are the style buffer or style table.

30.127.4
30.127.4.1

Member Function Documentation


void Fl Text Display::absolute top line number ( int oldFirstChar ) [protected]

Line numbering stuff, currently unused. Re-calculate absolute top line number for a change in scroll position. 30.127.4.2 void Fl Text Display::buffer ( Fl_Text_Buffer buf )

Attach a text buffer to display, replacing the current buffer (if any) Parameters buf attach this text buffer

30.127.4.3

void Fl Text Display::buffer ( Fl_Text_Buffer & buf ) [inline]

Sets the current text buffer associated with the text widget. Multiple text widgets can be associated with the same text buffer.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

762 Parameters buf new text buffer

Class Documentation

30.127.4.4 Fl_Text_Buffer Fl Text Display::buffer ( ) const [inline] Gets the current text buffer associated with the text widget. Multiple text widgets can be associated with the same text buffer. Returns current text buffer

30.127.4.5

void Fl Text Display::buffer modied cb ( int pos, int nInserted, int nDeleted, int nRestyled, const char deletedText, void cbArg ) [static, protected]

This is called whenever the buffer is modied. Callback attached to the text buffer to receive modication information Parameters pos nInserted nDeleted nRestyled deletedText cbArg starting index of modication number of bytes we inserted (must be UTF-8 aligned!) number of bytes deleted (must be UTF-8 aligned!) ?? this is what was removed, must not be NULL if nDeleted is set "this" pointer for static callback function

30.127.4.6

void Fl Text Display::buffer predelete cb ( int pos, int nDeleted, void cbArg ) [static, protected]

This is called before any characters are deleted. Callback attached to the text buffer to receive delete information before the modications are actually made. Parameters pos starting index of deletion nDeleted number of bytes we will delete (must be UTF-8 aligned!) cbArg "this" pointer for static callback function

30.127.4.7

void Fl Text Display::calc last char ( ) [protected]

Update last display character index. Given a Fl_Text_Display with a complete, up-to-date lineStarts array, update the lastChar entry to point to the last buffer position displayed.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.127 Fl_Text_Display Class Reference 30.127.4.8 void Fl Text Display::calc line starts ( int startLine, int endLine ) [protected]

763

Update the line start arrays. Scan through the text in the "textD"s buffer and recalculate the line starts array values beginning at index "startLine" and continuing through (including) "endLine". It assumes that the line starts entry preceding "startLine" (or mFirstChar if startLine is 0) is good, and re-counts newlines to ll in the requested entries. Out of range values for "startLine" and "endLine" are acceptable. Parameters startLine,end- range of lines to scan as line numbers Line

30.127.4.9

void Fl Text Display::clear rect ( int style, int X, int Y, int width, int height ) const [protected]

Clear a rectangle with the appropriate background color for style. Parameters style index into style table X,- size and position of background area Y,width,height

30.127.4.10

double Fl Text Display::col to x ( double col ) const

Convert a column number into an x pixel position. Parameters col an approximate column number based on the main font

Returns number of pixels from the left margin to the left of an average sized character

30.127.4.11

int Fl Text Display::count lines ( int startPos, int endPos, bool startPosIsLineStart ) const

Count the number of lines between two positions. Same as BufCountLines, but takes into account wrapping if wrapping is turned on. If the caller knows that startPos is at a line start, it can pass startPosIsLineStart as True to make the call more efcient by avoiding the additional step of scanning back to the last newline. Parameters startPos index to rst character endPos index after last character startPosIsLine- avoid scanning back to the line start Start

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

764 Returns number of lines

Class Documentation

30.127.4.12 Fl_Color Fl Text Display::cursor color ( ) const [inline] Gets the text cursor color. Returns cursor color

30.127.4.13

void Fl Text Display::cursor color ( Fl_Color n ) [inline]

Sets the text cursor color. Parameters n new cursor color

30.127.4.14

void Fl Text Display::cursor style ( int style )

Sets the text cursor style. Sets the text cursor style to one of the following: Fl_Text_Display::NORMAL_CURSOR - Shows an I beam. Fl_Text_Display::CARET_CURSOR - Shows a caret under the text. Fl_Text_Display::DIM_CURSOR - Shows a dimmed I beam. Fl_Text_Display::BLOCK_CURSOR - Shows an unlled box around the current character. Fl_Text_Display::HEAVY_CURSOR - Shows a thick I beam. This call also switches the cursor on and may trigger a redraw. Parameters style new cursor style

30.127.4.15

void Fl Text Display::display insert ( ) [protected]

Scroll the display to bring insertion cursor into view. Note: it would be nice to be able to do this without counting lines twice (scroll_() counts them too) and/or to count from the most efcient starting point, but the efciency of this routine is not as important to the overall performance of the text display. Todo Unicode?

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.127 Fl_Text_Display Class Reference 30.127.4.16 void Fl Text Display::draw ( void ) [protected, virtual]

765

Draw the widget. This function tries to limit drawing to smaller areas if possible. Reimplemented from Fl_Group. 30.127.4.17 void Fl Text Display::draw cursor ( int X, int Y ) [protected]

Draw a cursor with top center at X, Y. Parameters X,Y cursor position in pixels

30.127.4.18

void Fl Text Display::draw line numbers ( bool clearAll ) [protected]

Refresh the line number area. If clearAll is False, writes only over the character cell areas. Setting clearAll to True will clear out any stray marks outside of the character cell area, which might have been left from before a resize or font change. This function is not used. 30.127.4.19 void Fl Text Display::draw range ( int startpos, int endpos ) [protected]

Draw a range of text. Refresh all of the text between buffer positions startpos and endpos not including the character at the position endpos. If endpos points beyond the end of the buffer, refresh the whole display after startpos, including blank lines which are not technically part of any range of characters. Parameters startpos index of rst character to draw endpos index after last character to draw

30.127.4.20

void Fl Text Display::draw string ( int style, int X, int Y, int toX, const char string, int nChars ) const [protected]

Draw a text segment in a single style. Draw a string or blank area according to parameter style, using the appropriate colors and drawing method for that style, with top left corner at X, Y. If style says to draw text, use string as source of characters, and draw nChars, if style is FILL, erase rectangle where text would have drawn from X to toX and from Y to the maximum y extent of the current font(s). Parameters style index into style lookup table X,Y drawing origin
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

766

Class Documentation

toX rightmost position if this is a ll operation string text if this is a drawing operation nChars number of characters to draw

30.127.4.21

void Fl Text Display::draw text ( int left, int top, int width, int height ) [protected]

Refresh a rectangle of the text display. Parameters left,top are in coordinates of the text drawing window. width,height size in pixels

30.127.4.22

void Fl Text Display::draw vline ( int visLineNum, int leftClip, int rightClip, int leftCharIndex, int rightCharIndex ) [protected]

Draw a single line of text. Draw the text on a single line represented by visLineNum (the number of lines down from the top of the display), limited by leftClip and rightClip window coordinates and leftCharIndex and rightCharIndex character positions (not including the character at position rightCharIndex). Parameters visLineNum index of line in the visible line number lookup leftClip,right- pixel position of clipped area Clip leftChar- index into line of segment that we want to draw Index,rightCharIndex

30.127.4.23

int Fl Text Display::empty vlines ( ) const [protected]

Return true if there are lines visible with no corresponding buffer text. Returns 1 if there are empty lines

30.127.4.24

void Fl Text Display::extend range for styles ( int startpos, int endpos ) [protected]

I dont know what this does! Extend the range of a redraw request (from start to end) with additional redraw requests resulting from changes to the attached style buffer (which contains auxiliary information for coloring or styling text).

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.127 Fl_Text_Display Class Reference Parameters startpos ?? endpos ?? Todo Unicode?

767

30.127.4.25

void Fl Text Display::nd line end ( int startPos, bool startPosIsLineStart, int lineEnd, int nextLineStart ) const [protected]

Finds both the end of the current line and the start of the next line. Why? In continuous wrap mode, if you need to know both, guring out one from the other can be expensive or error prone. The problem comes when theres a trailing space or tab just before the end of the buffer. To translate an end of line value to or from the next lines start value, you need to know whether the trailing space or tab is being used as a line break or just a normal character, and to nd that out would otherwise require counting all the way back to the beginning of the line. Parameters startPos startPosIsLineStart lineEnd nextLineStart

out out

30.127.4.26

void Fl Text Display::nd wrap range ( const char deletedText, int pos, int nInserted, int nDeleted, int modRangeStart, int modRangeEnd, int linesInserted, int linesDeleted ) [protected]

Wrapping calculations. When continuous wrap is on, and the user inserts or deletes characters, wrapping can happen before and beyond the changed position. This routine nds the extent of the changes, and counts the deleted and inserted lines over that range. It also attempts to minimize the size of the range to what has to be counted and re-displayed, so the results can be useful both for delimiting where the line starts need to be recalculated, and for deciding what part of the text to redisplay. Parameters deletedText pos nInserted nDeleted modRangeStart modRangeEnd linesInserted linesDeleted

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

768 30.127.4.27

Class Documentation int Fl Text Display::nd x ( const char s, int len, int style, int x ) const [protected]

Find the index of the character that lies at the given x position. Parameters s len style x UTF-8 text string length of string index into style lookup table position in pixels

Returns index into buffer

30.127.4.28

int Fl Text Display::get absolute top line number ( ) const [protected]

Line numbering stuff, currently unused. Returns the absolute (non-wrapped) line number of the rst line displayed. Returns 0 if the absolute top line number is not being maintained. 30.127.4.29 int Fl Text Display::handle vline ( int mode, int lineStartPos, int lineLen, int leftChar, int rightChar, int Y, int bottomClip, int leftClip, int rightClip ) const [protected]

Universal pixel machine. We use a single function that handles all line layout, measuring, and drawing draw a text range return the width of a text range in pixels return the index of a character that is at a pixel position Parameters in in in in in in

mode lineStartPos lineLen leftChar,rightChar Y bottomClip,leftClip,rightClip

DRAW_LINE, GET_WIDTH, FIND_INDEX index of rst character size of string in bytes

drawing position stop work when we reach the clipped area. rightClip is the X position that we search in FIND_INDEX.

Return values DRAW_LINE GET_WIDTH FIND_INDEX FIND_INDEX_FROM_ZERO index of last drawn character width in pixels of text segment if we would draw it index of character at given x position in window coordinates index of character at given x position without scrolling and widget offsets

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.127 Fl_Text_Display Class Reference Todo we need to handle hidden hyphens and tabs here! we handle all styles and selections we must provide code to get pixel positions of the middle of a character as well

769

30.127.4.30

void Fl Text Display::highlight data ( Fl_Text_Buffer styleBuffer, const Style_Table_Entry styleTable, int nStyles, char unnishedStyle, Unnished Style Cb unnishedHighlightCB, void cbArg )

Attach (or remove) highlight information in text display and redisplay. Highlighting information consists of a style buffer which parallels the normal text buffer, but codes font and color information for the display; a style table which translates style buffer codes (indexed by buffer character - A) into fonts and colors; and a callback mechanism for as-needed highlighting, triggered by a style buffer entry of "unnishedStyle". Style buffer can trigger additional redisplay during a normal buffer modication if the buffer contains a primary Fl_Text_Selection (see extendRangeForStyleMods for more information on this protocol). Style buffers, tables and their associated memory are managed by the caller. Styles are ranged from 65 (A) to 126. Parameters styleBuffer this buffer works in parallel to the text buffer. For every character in the text buffer, the stye buffer has a byte at the same offset that contains an index into an array of possible styles. styleTable a list of styles indexed by the style buffer nStyles number of styles in the style table unnishedStyle if this style is found, the callback below is called unnished- if a character with an unnished style is found, this callback will be called HighlightCB cbArg and optional argument for the callback above, usually a pointer to the Text Display.

30.127.4.31

int Fl Text Display::in selection ( int X, int Y ) const

Check if a pixel position is within the primary selection. Parameters X,Y pixel position to test

Returns 1 if position (X, Y) is inside of the primary Fl_Text_Selection

30.127.4.32

void Fl Text Display::insert ( const char text )

Inserts "text" at the current cursor location. This has the same effect as inserting the text into the buffer using BufInsert and then moving the insert position after the newly inserted text, except that its optimized to do less redrawing.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

770 Parameters text new text in UTF-8 encoding.

Class Documentation

30.127.4.33

void Fl Text Display::insert position ( int newPos )

Sets the position of the text insertion cursor for text display. Move the insertion cursor in front of the character at newPos. This function may trigger a redraw. Parameters newPos new caret position

30.127.4.34

int Fl Text Display::insert position ( ) const [inline]

Gets the position of the text insertion cursor for text display. Returns insert position index into text buffer

30.127.4.35

int Fl Text Display::line end ( int startPos, bool startPosIsLineStart ) const

Returns the end of a line. Same as BufEndOfLine, but takes into account line breaks when wrapping is turned on. If the caller knows that startPos is at a line start, it can pass "startPosIsLineStart" as True to make the call more efcient by avoiding the additional step of scanning back to the last newline. Note that the denition of the end of a line is less clear when continuous wrap is on. With continuous wrap off, its just a pointer to the newline that ends the line. When its on, its the character beyond the last displayable character on the line, where a whitespace character which has been "converted" to a newline for wrapping is not considered displayable. Also note that a line can be wrapped at a non-whitespace character if the line had no whitespace. In this case, this routine returns a pointer to the start of the next line. This is also consistent with the model used by visLineLength. Parameters startPos index to starting character startPosIsLine- avoid scanning back to the line start Start Returns new position as index

30.127.4.36

int Fl Text Display::line start ( int pos ) const

Return the beginning of a line. Same as BufStartOfLine, but returns the character after last wrap point rather than the last newline.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.127 Fl_Text_Display Class Reference Parameters pos index to starting character

771

Returns new position as index

30.127.4.37

int Fl Text Display::longest vline ( ) const [protected]

Find the longest line of all visible lines. Returns the width of the longest visible line in pixels

30.127.4.38

void Fl Text Display::maintain absolute top line number ( int state ) [protected]

Line numbering stuff, currently unused. In continuous wrap mode, internal line numbers are calculated after wrapping. A separate non-wrapped line count is maintained when line numbering is turned on. There is some performance cost to maintaining this line count, so normally absolute line numbers are not tracked if line numbering is off. This routine allows callers to specify that they still want this line count maintained (for use via TextDPosToLineAndCol). More specically, this allows the line number reported in the statistics line to be calibrated in absolute lines, rather than post-wrapped lines. 30.127.4.39 int Fl Text Display::maintaining absolute top line number ( ) const [protected]

Line numbering stuff, currently unused. Return true if a separate absolute top line number is being maintained (for displaying line numbers or showing in the statistics line). 30.127.4.40 void Fl Text Display::measure deleted lines ( int pos, int nDeleted ) [protected]

Wrapping calculations. This is a stripped-down version of the ndWrapRange() function above, intended to be used to calculate the number of "deleted" lines during a buffer modication. It is called _before_ the modication takes place. This function should only be called in continuous wrap mode with a non-xed font width. In that case, it is impossible to calculate the number of deleted lines, because the necessary style information is no longer available _after_ the modication. In other cases, we can still perform the calculation afterwards (possibly even more efciently). Parameters pos nDeleted

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

772 30.127.4.41

Class Documentation double Fl Text Display::measure proportional character ( const char s, int xPix, int pos ) const [protected]

Wrapping calculations. Measure the width in pixels of the rst character of string "s" at a particular column "colNum" and buffer position "pos". This is for measuring characters in proportional or mixed-width highlighting fonts. A note about proportional and mixed-width fonts: the mixed width and proportional font code in nedit does not get much use in general editing, because nedit doesnt allow per-language-mode fonts, and editing programs in a proportional font is usually a bad idea, so very few users would choose a proportional font as a default. There are still probably mixed- width syntax highlighting cases where things dont redraw properly for insertion/deletion, though static display and wrapping and resizing should now be solid because they are now used for online help display. Parameters s text string xPix x pixel position needed for calculating tab widths pos offset within string

Returns width of character in pixels

30.127.4.42

int Fl Text Display::measure vline ( int visLineNum ) const [protected]

Returns the width in pixels of the displayed line pointed to by "visLineNum". Parameters visLineNum index into visible lines array Returns width of line in pixels

30.127.4.43

int Fl Text Display::move down ( )

Moves the current insert position down one line. Returns 1 if the cursor moved, 0 if the beginning of the text was reached

30.127.4.44

int Fl Text Display::move left ( )

Moves the current insert position left one character. Returns 1 if the cursor moved, 0 if the beginning of the text was reached

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.127 Fl_Text_Display Class Reference 30.127.4.45 int Fl Text Display::move right ( )

773

Moves the current insert position right one character. Returns 1 if the cursor moved, 0 if the end of the text was reached

30.127.4.46

int Fl Text Display::move up ( )

Moves the current insert position up one line. Returns 1 if the cursor moved, 0 if the beginning of the text was reached

30.127.4.47

void Fl Text Display::offset line starts ( int newTopLineNum ) [protected]

Offset line start counters for a new vertical scroll position. Offset the line starts array, mTopLineNum, mFirstChar and lastChar, for a new vertical scroll position given by newTopLineNum. If any currently displayed lines will still be visible, salvage the line starts values, otherwise, count lines from the nearest known line start (start or end of buffer, or the closest value in the mLineStarts array) Parameters newTopLine- index into buffer Num

30.127.4.48

void Fl Text Display::overstrike ( const char text )

Replaces text at the current insert position. Parameters text new text in UTF-8 encoding Todo Unicode? Find out exactly what we do here and simplify.

30.127.4.49

int Fl Text Display::position style ( int lineStartPos, int lineLen, int lineIndex ) const

Find the correct style for a character. Determine the drawing method to use to draw a specic character from "buf". lineStartPos gives the character index where the line begins, lineIndex, the number of characters past the beginning of the line, and lineIndex the number of displayed characters past the beginning of the line. Passing lineStartPos of -1 returns the drawing style for "no text". Why not just: position_style(pos)? Because style applies to blank areas of the window beyond the text
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

774

Class Documentation

boundaries, and because this routine must also decide whether a position is inside of a rectangular Fl_Text_Selection, and do so efciently, without re-counting character positions from the start of the line. Note that style is a somewhat incorrect name, drawing method would be more appropriate. Parameters lineStartPos beginning of this line lineLen number of bytes in line lineIndex position of character within line

Returns style for the given character

30.127.4.50

int Fl Text Display::position to line ( int pos, int lineNum ) const [protected]

Convert a position index into a line number offset. Find the line number of position pos relative to the rst line of displayed text. Returns 0 if the line is not displayed. Parameters out pos ?? lineNum ??

Returns ?? Todo What does this do?

30.127.4.51

int Fl Text Display::position to linecol ( int pos, int lineNum, int column ) const [protected]

Find the line and column number of position pos. This only works for displayed lines. If the line is not displayed, the function returns 0 (without the mLineStarts array it could turn in to very long calculation involving scanning large amounts of text in the buffer). If continuous wrap mode is on, returns the absolute line number (as opposed to the wrapped line number which is used for scrolling). Parameters out out pos character index lineNum absolute (unwrapped) line number column character offset to the beginning of the line

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.127 Fl_Text_Display Class Reference Returns 0 if pos is off screen, line number otherwise

775

Todo a column number makes little sense in the UTF-8/variable font width environment. We will have to further dene what exactly we want to return. Please check the functions that call this particular function.

30.127.4.52

int Fl Text Display::position to xy ( int pos, int X, int Y ) const

Convert a character index into a pixel position. Translate a buffer text position to the XY location where the top left of the cursor would be positioned to point to that character. Returns 0 if the position is not displayed because it is vertically out of view. If the position is horizontally out of view, returns the X coordinate where the position would be if it were visible. Parameters out pos character index X,Y pixel position of character on screen

Returns 0 if character vertically out of view, X position otherwise

30.127.4.53

void Fl Text Display::redisplay range ( int startpos, int endpos )

Marks text from start to end as needing a redraw. This function will trigger a damage event and later a redraw of parts of the widget. Parameters startpos index of rst character needing redraw endpos index after last character needing redraw

30.127.4.54

void Fl Text Display::reset absolute top line number ( ) [protected]

Line numbering stuff, probably unused. Count lines from the beginning of the buffer to reestablish the absolute (non-wrapped) top line number. If mode is not continuous wrap, or the number is not being maintained, does nothing.

30.127.4.55

void Fl Text Display::resize ( int X, int Y, int W, int H ) [virtual]

Change the size of the displayed text area. Calling this function will trigger a recalculation of all lines visible and of all scrollbar sizes.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

776 Parameters X,Y,W,H new position and size of this widget Reimplemented from Fl_Group. 30.127.4.56 int Fl Text Display::rewind lines ( int startPos, int nLines )

Class Documentation

Skip a number of lines back. Same as BufCountBackwardNLines, but takes into account line breaks when wrapping is turned on. Parameters startPos index to starting character nLines number of lines to skip back

Returns new position as index

30.127.4.57

void Fl Text Display::scroll ( int topLineNum, int horizOffset )

Scrolls the current buffer to start at the specied line and column. Parameters topLineNum top line number horizOffset column number Todo Column numbers make little sense here.

30.127.4.58

int Fl Text Display::scroll ( int topLineNum, int horizOffset ) [protected]

Scrolls the current buffer to start at the specied line and column. Parameters topLineNum top line number horizOffset in pixels Returns 0 if nothing changed, 1 if we scrolled

30.127.4.59

void Fl Text Display::scroll timer cb ( void user data ) [static, protected]

Timer callback for scroll events. This timer event scrolls the text view proportionally to how far the mouse pointer has left the text area. This allows for smooth scrolling without "wiggeling" the mouse.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.127 Fl_Text_Display Class Reference 30.127.4.60 Fl_Align Fl Text Display::scrollbar align ( ) const [inline] Gets the scrollbar alignment type. Returns scrollbar alignment

777

30.127.4.61

void Fl Text Display::scrollbar align ( Fl_Align a ) [inline]

Sets the scrollbar alignment type. Parameters a new scrollbar alignment

30.127.4.62

int Fl Text Display::scrollbar width ( ) const [inline]

Gets the width/height of the scrollbars. /return width of scrollbars 30.127.4.63 void Fl Text Display::scrollbar width ( int W ) [inline]

Sets the width/height of the scrollbars. Parameters W width of scrollbars

30.127.4.64

int Fl Text Display::shortcut ( ) const [inline]

Todo FIXME : get set methods pointing on shortcut_ have no effects as shortcut_ is unused in this class and derived! Returns the current shortcut key

30.127.4.65

void Fl Text Display::shortcut ( int s ) [inline]

Todo FIXME : get set methods pointing on shortcut_ have no effects as shortcut_ is unused in this class and derived! Parameters s the new shortcut key

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

778 30.127.4.66 void Fl Text Display::show cursor ( int b = 1 )

Class Documentation

Shows the text cursor. This function may trigger a redraw. Parameters b show(1) or hide(0) the text cursor (caret).

30.127.4.67

void Fl Text Display::show insert position ( )

Scrolls the text buffer to show the current insert position. This function triggers a complete recalculation, ending in a call to Fl_Text_Display::display_insert() 30.127.4.68 int Fl Text Display::skip lines ( int startPos, int nLines, bool startPosIsLineStart )

Skip a number of lines forward. Same as BufCountForwardNLines, but takes into account line breaks when wrapping is turned on. If the caller knows that startPos is at a line start, it can pass "startPosIsLineStart" as True to make the call more efcient by avoiding the additional step of scanning back to the last newline. Parameters startPos index to starting character nLines number of lines to skip ahead startPosIsLine- avoid scanning back to the line start Start

Returns new position as index

30.127.4.69

double Fl Text Display::string width ( const char string, int length, int style ) const [protected]

Find the width of a string in the font of a particular style. Parameters string the text length number of bytes in string style index into style table

Returns width of text segment in pixels

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.127 Fl_Text_Display Class Reference 30.127.4.70 Fl_Color Fl Text Display::textcolor ( ) const [inline] Gets the default color of text in the widget. Returns text color unless overridden by a style

779

30.127.4.71

void Fl Text Display::textcolor ( Fl_Color n ) [inline]

Sets the default color of text in the widget. Parameters n new text color

30.127.4.72 Fl_Font Fl Text Display::textfont ( ) const [inline] Gets the default font used when drawing text in the widget. Returns current text font face unless overridden by a style

30.127.4.73

void Fl Text Display::textfont ( Fl_Font s ) [inline]

Sets the default font used when drawing text in the widget. Parameters s default text font face

30.127.4.74 Fl_Fontsize Fl Text Display::textsize ( ) const [inline] Gets the default size of text in the widget. Returns current text height unless overridden by a style

30.127.4.75

void Fl Text Display::textsize ( Fl_Fontsize s ) [inline]

Sets the default size of text in the widget. Parameters s new text size

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

780 30.127.4.76 void Fl Text Display::update h scrollbar ( ) [protected]

Class Documentation

Update vertical scrollbar. Update the minimum, maximum, slider size, page increment, and value for the horizontal scrollbar. 30.127.4.77 void Fl Text Display::update line starts ( int pos, int charsInserted, int charsDeleted, int linesInserted, int linesDeleted, int scrolled ) [protected]

Update line start arrays and variables. Update the line starts array, mTopLineNum, mFirstChar and lastChar for this text display after a modication to the text buffer, given by the position pos where the change began, and the numbers of characters and lines inserted and deleted. Parameters pos charsInserted charsDeleted linesInserted linesDeleted scrolled index into buffer of recent changes number of bytes(!) inserted number of bytes(!) deleted number of lines number of lines set to 1 if the text display needs to be scrolled

out

30.127.4.78

void Fl Text Display::update v scrollbar ( ) [protected]

Update vertical scrollbar. Update the minimum, maximum, slider size, page increment, and value for vertical scrollbar. 30.127.4.79 int Fl Text Display::vline length ( int visLineNum ) const [protected]

Count number of bytes in a visible line. Return the length of a line (number of bytes) by examining entries in the line starts array rather than by scanning for newlines. Parameters visLineNum index of line in visible line array

Returns number of bytes in this line

30.127.4.80

int Fl Text Display::word end ( int pos ) const [inline]

Moves the insert position to the end of the current word. Parameters pos start calculation at this index
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.127 Fl_Text_Display Class Reference Returns index of rst character after the end of the word

781

30.127.4.81

int Fl Text Display::word start ( int pos ) const [inline]

Moves the insert position to the beginning of the current word. Parameters pos start calculation at this index

Returns beginning of the words

30.127.4.82

void Fl Text Display::wrap mode ( int wrap, int wrapMargin )

Set the new text wrap mode. If wrap mode is not zero, this call enables automatic word wrapping at column wrapMargin. Wordwrapping does not change the text buffer itself, only the way the text is displayed. Different Text Displays can have different wrap modes, even if they share the same Text Buffer. Parameters wrap new wrap mode is WRAP_NONE (dont wrap text at all), WRAP_AT_COLUMN (wrap text at the given text column), WRAP_AT_PIXEL (wrap text at a pixel position), or WRAP_AT_BOUNDS (wrap text so that it ts into the widget width) wrapMargin in WRAP_AT_COLUMN mode, text will wrap at the nth character. For variable width fonts, an average character width is calculated. The column width is calculated using the current textfont or the rst style when this function is called. If the font size changes, this function must be called again. In WRAP_AT_PIXEL mode, this is the pixel position. Todo we need new wrap modes to wrap at the window edge and based on pixel width or average character width.

30.127.4.83

int Fl Text Display::wrap uses character ( int lineEndPos ) const [protected]

Check if the line break is caused by a \n or by line wrapping. Line breaks in continuous wrap mode usually happen at newlines or whitespace. This line-terminating character is not included in line width measurements and has a special status as a non-visible character. However, lines with no whitespace are wrapped without the benet of a line terminating character, and this distinction causes endless trouble with all of the text display code which was originally written without continuous wrap mode and always expects to wrap at a newline character. Given the position of the end of the line, as returned by TextDEndOfLine or BufEndOfLine, this returns true if there is a line terminating character, and false if theres not. On the last character in the buffer, this function cant tell for certain whether a trailing space was used as a wrap point, and just guesses that it wasnt. So if an exact accounting is necessary, dont use this function.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

782 Parameters lineEndPos index of character where the line wraps

Class Documentation

Returns 1 if a \n character causes the line wrap

30.127.4.84

int Fl Text Display::wrapped column ( int row, int column ) const

Nobody knows what this function does. Correct a column number based on an unconstrained position (as returned by TextDXYToUnconstrainedPosition) to be relative to the last actual newline in the buffer before the row and column position given, rather than the last line start created by line wrapping. This is an adapter for rectangular selections and code written before continuous wrap mode, which thinks that the unconstrained column is the number of characters from the last newline. Obviously this is time consuming, because it invloves character recounting. Parameters row column

Returns something unknown Todo What does this do and how is it useful? Column numbers mean little in this context. Which functions depend on this one? Todo Unicode?

30.127.4.85

void Fl Text Display::wrapped line counter ( Fl_Text_Buffer buf, int startPos, int maxPos, int maxLines, bool startPosIsLineStart, int styleBufOffset, int retPos, int retLines, int retLineStart, int retLineEnd, bool countLastLineMissingNewLine = true ) const [protected]

Wrapping calculations. Count forward from startPos to either maxPos or maxLines (whichever is reached rst), and return all relevant positions and line count. The provided textBuffer may differ from the actual text buffer of the widget. In that case it must be a (partial) copy of the actual text buffer and the styleBufOffset argument must indicate the starting position of the copy, to take into account the correct style information. Parameters buf startPos maxPos maxLines startPosIsLineStart
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.127 Fl_Text_Display Class Reference

783

out out out out out

styleBufOffset retPos Position where counting ended. When counting lines, the position returned is the start of the line "maxLines" lines beyond "startPos". retLines Number of line breaks counted retLineStart Start of the line where counting ended retLineEnd End position of the last line traversed countLastLineMissingNewLine

30.127.4.86

int Fl Text Display::wrapped row ( int row ) const

Nobody knows what this function does. Correct a row number from an unconstrained position (as returned by TextDXYToUnconstrainedPosition) to a straight number of newlines from the top line of the display. Because rectangular selections are based on newlines, rather than display wrapping, and anywhere a rectangular selection needs a row, it needs it in terms of un-wrapped lines. Parameters row

Returns something unknown Todo What does this do and how is it useful? Column numbers mean little in this context. Which functions depend on this one?

30.127.4.87

double Fl Text Display::x to col ( double x ) const

Convert an x pixel position into a column number. Parameters x number of pixels from the left margin

Returns an approximate column number based on the main font

30.127.4.88

int Fl Text Display::xy to position ( int X, int Y, int posType = CHARACTER POS ) const [protected]

Translate a pixel position into a character index. Translate window coordinates to the nearest (insert cursor or character cell) text position. The parameter posType species how to interpret the position: CURSOR_POS means translate the coordinates to the
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

784

Class Documentation

nearest cursor position, and CHARACTER_POS means return the position of the character closest to (X, Y). Parameters X,Y pixel position posType CURSOR_POS or CHARACTER_POS

Returns index into text buffer

30.127.4.89

void Fl Text Display::xy to rowcol ( int X, int Y, int row, int column, int posType = CHARACTER POS ) const [protected]

Translate pixel coordinates into row and column. Translate window coordinates to the nearest row and column number for positioning the cursor. This, of course, makes no sense when the font is proportional, since there are no absolute columns. The parameter posType species how to interpret the position: CURSOR_POS means translate the coordinates to the nearest position between characters, and CHARACTER_POS means translate the position to the nearest character cell. Parameters out X,Y pixel coordinates row,column neares row and column posType CURSOR_POS or CHARACTER_POS

The documentation for this class was generated from the following les: Fl_Text_Display.H Fl_Text_Display.cxx

30.128

Fl Text Editor Class Reference

This is the FLTK text editor widget. #include <Fl_Text_Editor.H> Inheritance diagram for Fl_Text_Editor:
Fl_Widget Fl_Group Fl_Text_Display Fl_Text_Editor

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.128 Fl_Text_Editor Class Reference

785

Classes
struct Key_Binding
Simple linked list associating a key/state to a function.

Public Types
typedef int( Key_Func )(int key, Fl_Text_Editor editor)
Key function binding callback type.

Public Member Functions


void add_default_key_bindings (Key_Binding list)
Adds all of the default editor key bindings to the specied key binding list.

void add_key_binding (int key, int state, Key_Func f, Key_Binding list)


Adds a key of state "state" with the function "function".

void add_key_binding (int key, int state, Key_Func f)


Adds a key of state "state" with the function "function".

Key_Func bound_key_function (int key, int state, Key_Binding list)


Returns the function associated with a key binding.

Key_Func bound_key_function (int key, int state)


Returns the function associated with a key binding.

void default_key_function (Key_Func f)


Sets the default key function for unassigned keys.

Fl_Text_Editor (int X, int Y, int W, int H, const char l=0)


The constructor creates a new text editor widget.

virtual int handle (int e)


Event handling.

void insert_mode (int b)


Sets the current insert mode; if non-zero, new text is inserted before the current cursor position.

int insert_mode ()
Gets the current insert mode; if non-zero, new text is inserted before the current cursor position.

void remove_all_key_bindings (Key_Binding list)


Removes all of the key bindings associated with the text editor or list.

void remove_all_key_bindings ()
Removes all of the key bindings associated with the text editor or list.

void remove_key_binding (int key, int state, Key_Binding list)


Removes the key binding associated with the key "key" of state "state".

void remove_key_binding (int key, int state)


Removes the key binding associated with the key "key" of state "state".
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

786

Class Documentation

Static Public Member Functions


static int kf_backspace (int c, Fl_Text_Editor e)
Does a backspace in the current buffer.

static int kf_c_s_move (int c, Fl_Text_Editor e)


Extends the current selection in the direction indicated by control key c.

static int kf_copy (int c, Fl_Text_Editor e)


Does a copy of selected text or the current character in the current buffer.

static int kf_ctrl_move (int c, Fl_Text_Editor e)


Moves the current text cursor in the direction indicated by control key.

static int kf_cut (int c, Fl_Text_Editor e)


Does a cut of selected text in the current buffer.

static int kf_default (int c, Fl_Text_Editor e)


Inserts the text associated with the key.

static int kf_delete (int c, Fl_Text_Editor e)


Does a delete of selected text or the current character in the current buffer.

static int kf_down (int c, Fl_Text_Editor e)


Moves the text cursor one line down.

static int kf_end (int c, Fl_Text_Editor e)


Moves the text cursor to the end of the current line.

static int kf_enter (int c, Fl_Text_Editor e)


Inserts a newline at the current cursor position.

static int kf_home (int, Fl_Text_Editor e)


Moves the text cursor to the beginning of the current line.

static int kf_ignore (int c, Fl_Text_Editor e)


Ignores the keypress.

static int kf_insert (int c, Fl_Text_Editor e)


Toggles the insert mode in the text editor.

static int kf_left (int c, Fl_Text_Editor e)


Moves the text cursor one character to the left.

static int kf_m_s_move (int c, Fl_Text_Editor e)


Extends the current selection in the direction indicated by meta key c.

static int kf_meta_move (int c, Fl_Text_Editor e)


Moves the current text cursor in the direction indicated by meta key.

static int kf_move (int c, Fl_Text_Editor e)


Moves the text cursor in the direction indicated by key c.

static int kf_page_down (int c, Fl_Text_Editor e)


Moves the text cursor down one page.

static int kf_page_up (int c, Fl_Text_Editor e)


Moves the text cursor up one page.

static int kf_paste (int c, Fl_Text_Editor e)


Does a paste of selected text in the current buffer.

static int kf_right (int c, Fl_Text_Editor e)


Moves the text cursor one character to the right.

static int kf_select_all (int c, Fl_Text_Editor e)


Selects all text in the current buffer.

static int kf_shift_move (int c, Fl_Text_Editor e)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.128 Fl_Text_Editor Class Reference


Extends the current selection in the direction of key c.

787

static int kf_undo (int c, Fl_Text_Editor e)


Undo last edit in the current buffer.

static int kf_up (int c, Fl_Text_Editor e)


Moves the text cursor one line up.

Protected Member Functions


int handle_key ()
Handles a key press in the editor.

void maybe_do_callback ()
does or does not a callback according to changed() and when() settings

30.128.1

Detailed Description

This is the FLTK text editor widget. It allows the user to edit multiple lines of text and supports highlighting and scrolling. The buffer that is displayed in the widget is managed by the Fl_Text_Buffer class.

30.128.2
30.128.2.1

Constructor & Destructor Documentation


Fl Text Editor::Fl Text Editor ( int X, int Y, int W, int H, const char l = 0 )

The constructor creates a new text editor widget.

30.128.3
30.128.3.1

Member Function Documentation


void Fl Text Editor::add default key bindings ( Key_Binding list )

Adds all of the default editor key bindings to the specied key binding list.

30.128.3.2 Fl_Text_Editor::Key_Func Fl Text Editor::bound key function ( int key, int state, Key_Binding list ) Returns the function associated with a key binding.

30.128.3.3 Key_Func Fl Text Editor::bound key function ( int key, int state ) [inline] Returns the function associated with a key binding.

30.128.3.4

void Fl Text Editor::default key function ( Key_Func f ) [inline]

Sets the default key function for unassigned keys.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

788 30.128.3.5 void Fl Text Editor::insert mode ( int b ) [inline]

Class Documentation

Sets the current insert mode; if non-zero, new text is inserted before the current cursor position. Otherwise, new text replaces text at the current cursor position. 30.128.3.6 int Fl Text Editor::insert mode ( ) [inline]

Gets the current insert mode; if non-zero, new text is inserted before the current cursor position. Otherwise, new text replaces text at the current cursor position. 30.128.3.7 int Fl Text Editor::kf backspace ( int c, Fl_Text_Editor e ) [static]

Does a backspace in the current buffer. 30.128.3.8 int Fl Text Editor::kf c s move ( int c, Fl_Text_Editor e ) [static]

Extends the current selection in the direction indicated by control key c. 30.128.3.9 int Fl Text Editor::kf copy ( int c, Fl_Text_Editor e ) [static]

Does a copy of selected text or the current character in the current buffer. 30.128.3.10 int Fl Text Editor::kf cut ( int c, Fl_Text_Editor e ) [static]

Does a cut of selected text in the current buffer. 30.128.3.11 int Fl Text Editor::kf delete ( int c, Fl_Text_Editor e ) [static]

Does a delete of selected text or the current character in the current buffer. 30.128.3.12 int Fl Text Editor::kf down ( int c, Fl_Text_Editor e ) [static]

Moves the text cursor one line down. 30.128.3.13 int Fl Text Editor::kf end ( int c, Fl_Text_Editor e ) [static]

Moves the text cursor to the end of the current line. 30.128.3.14 int Fl Text Editor::kf home ( int , Fl_Text_Editor e ) [static]

Moves the text cursor to the beginning of the current line. 30.128.3.15 int Fl Text Editor::kf insert ( int c, Fl_Text_Editor e ) [static]

Toggles the insert mode in the text editor.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.128 Fl_Text_Editor Class Reference 30.128.3.16 int Fl Text Editor::kf left ( int c, Fl_Text_Editor e ) [static]

789

Moves the text cursor one character to the left. int Fl Text Editor::kf m s move ( int c, Fl_Text_Editor e ) [static]

30.128.3.17

Extends the current selection in the direction indicated by meta key c. int Fl Text Editor::kf move ( int c, Fl_Text_Editor e ) [static]

30.128.3.18

Moves the text cursor in the direction indicated by key c. int Fl Text Editor::kf page down ( int c, Fl_Text_Editor e ) [static]

30.128.3.19

Moves the text cursor down one page. int Fl Text Editor::kf page up ( int c, Fl_Text_Editor e ) [static]

30.128.3.20

Moves the text cursor up one page. int Fl Text Editor::kf paste ( int c, Fl_Text_Editor e ) [static]

30.128.3.21

Does a paste of selected text in the current buffer. int Fl Text Editor::kf right ( int c, Fl_Text_Editor e ) [static]

30.128.3.22

Moves the text cursor one character to the right. int Fl Text Editor::kf select all ( int c, Fl_Text_Editor e ) [static]

30.128.3.23

Selects all text in the current buffer. int Fl Text Editor::kf shift move ( int c, Fl_Text_Editor e ) [static]

30.128.3.24

Extends the current selection in the direction of key c. int Fl Text Editor::kf undo ( int c, Fl_Text_Editor e ) [static]

30.128.3.25

Undo last edit in the current buffer. Also deselect previous selection. int Fl Text Editor::kf up ( int c, Fl_Text_Editor e ) [static]

30.128.3.26

Moves the text cursor one line up.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

790 30.128.3.27 void Fl Text Editor::remove all key bindings ( Key_Binding list )

Class Documentation

Removes all of the key bindings associated with the text editor or list. 30.128.3.28 void Fl Text Editor::remove all key bindings ( ) [inline]

Removes all of the key bindings associated with the text editor or list. 30.128.3.29 void Fl Text Editor::remove key binding ( int key, int state ) [inline]

Removes the key binding associated with the key "key" of state "state". The documentation for this class was generated from the following les: Fl_Text_Editor.H Fl_Text_Editor.cxx

30.129

Fl Text Selection Class Reference

This is an internal class for Fl_Text_Buffer to manage text selections. #include <Fl_Text_Buffer.H>

Public Member Functions


int end () const
Return the byte ofsset to the character after the last selected character.

int includes (int pos) const


Return true if position pos with indentation dispIndex is in the Fl_Text_Selection.

int position (int start, int end) const


Return the positions of this selection.

bool selected () const


Returns true if any text is selected.

void selected (bool b)


Modify the selected ag.

void set (int start, int end)


Set the selection range.

int start () const


Return the byte offset to the rst selected character.

void update (int pos, int nDeleted, int nInserted)


Updates a selection afer text was modied.

Protected Attributes
int mEnd
byte offset to the character after the last selected character

bool mSelected
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.129 Fl_Text_Selection Class Reference


this ag is set if any text is selected

791

int mStart
byte offset to the rst selected character

Friends
class Fl_Text_Buffer

30.129.1

Detailed Description

This is an internal class for Fl_Text_Buffer to manage text selections. This class works correctly with utf-8 strings assuming that the parameters for all calls are on character boundaries.

30.129.2
30.129.2.1

Member Function Documentation


int Fl Text Selection::end ( ) const [inline]

Return the byte ofsset to the character after the last selected character. Returns byte offset

30.129.2.2

int Fl Text Selection::position ( int start, int end ) const

Return the positions of this selection. Parameters start retrun byte offset to rst selected character end retrun byte offset pointing after last selected character Returns true if selected

30.129.2.3

bool Fl Text Selection::selected ( ) const [inline]

Returns true if any text is selected. Returns a non-zero number if any text has been selected, or 0 if no text is selected.

30.129.2.4

void Fl Text Selection::selected ( bool b ) [inline]

Modify the selected ag.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

792 Parameters b new ag

Class Documentation

30.129.2.5

void Fl Text Selection::set ( int start, int end )

Set the selection range. Parameters start byte offset to rst selected character end byte offset pointing after last selected character

30.129.2.6

int Fl Text Selection::start ( ) const [inline]

Return the byte offset to the rst selected character. Returns byte offset

30.129.2.7

void Fl Text Selection::update ( int pos, int nDeleted, int nInserted )

Updates a selection afer text was modied. Updates an individual selection for changes in the corresponding text Parameters pos byte offset into text buffer at which the change occured nDeleted number of bytes deleted from the buffer nInserted number of bytes inserted into the buffer

The documentation for this class was generated from the following les:

Fl_Text_Buffer.H Fl_Text_Buffer.cxx

30.130

Fl Tile Class Reference

The Fl_Tile class lets you resize the children by dragging the border between them: #include <Fl_Tile.H> Inheritance diagram for Fl_Tile:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.130 Fl_Tile Class Reference

793

Fl_Widget Fl_Group Fl_Tile

Public Member Functions


Fl_Tile (int X, int Y, int W, int H, const char l=0)
Creates a new Fl_Tile widget using the given position, size, and label string.

int handle (int)


Handles the specied event.

void position (int, int, int, int)


Drag the intersection at from_x,from_y to to_x,to_y.

void resize (int, int, int, int)


Resizes the Fl_Group widget and all of its children.

30.130.1

Detailed Description

The Fl_Tile class lets you resize the children by dragging the border between them:

Figure 30.36: Fl_Tile

For the tiling to work correctly, the children of an Fl_Tile must cover the entire area of the widget, but not overlap. This means that all children must touch each other at their edges, and no gaps cant be left inside the Fl_Tile. Fl_Tile does not normailly draw any graphics of its own. The "borders" which can be seen in the snapshot above are actually part of the children. Their boxtypes have been set to FL_DOWN_BOX creating the impression of "ridges" where the boxes touch. What you see are actually two adjacent FL_DOWN_BOXs drawn next to each other. All neighboring widgets share the same edge - the widgets thick borders make it appear as though the widgets arent actually touching, but they are. If the edges of adjacent widgets do not touch, then it will be impossible to drag the corresponding edges. Fl_Tile allows objects to be resized to zero dimensions. To prevent this you can use the resizable() to limit where corners can be dragged to.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

794

Class Documentation

Even though objects can be resized to zero sizes, they must initially have non-zero sizes so the Fl_Tile can gure out their layout. If desired, call position() after creating the children but before displaying the window to set the borders where you want. Note on resizable(Fl_Widget &w) : The "resizable" child widget (which should be invisible) limits where the border can be dragged to. If you dont set it, it will be possible to drag the borders right to the edge, and thus resize objects on the edge to zero width or height. The resizable() widget is not resized by dragging any borders. See also void Fl_Group::resizable(Fl_Widget &w)

30.130.2
30.130.2.1

Constructor & Destructor Documentation


Fl Tile::Fl Tile ( int X, int Y, int W, int H, const char l = 0 ) [inline]

Creates a new Fl_Tile widget using the given position, size, and label string. The default boxtype is FL_NO_BOX. The destructor also deletes all the children. This allows a whole tree to be deleted at once, without having to keep a pointer to all the children in the user code. A kludge has been done so the Fl_Tile and all of its children can be automatic (local) variables, but you must declare the Fl_Tile rst, so that it is destroyed last.

30.130.3
30.130.3.1

Member Function Documentation


int Fl Tile::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted See also Fl_Event Reimplemented from Fl_Group. 30.130.3.2 void Fl Tile::position ( int oix, int oiy, int newx, int newy )

Drag the intersection at from_x,from_y to to_x,to_y.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.131 Fl_Tiled_Image Class Reference This redraws all the necessary children. 30.130.3.3 void Fl Tile::resize ( int X, int Y, int W, int H ) [virtual]

795

Resizes the Fl_Group widget and all of its children. The Fl_Group widget rst resizes itself, and then it moves and resizes all its children according to the rules documented for Fl_Group::resizable(Fl_Widget) See also Fl_Group::resizable(Fl_Widget) Fl_Group::resizable() Fl_Widget::resize(int,int,int,int) Reimplemented from Fl_Group. The documentation for this class was generated from the following les: Fl_Tile.H Fl_Tile.cxx

30.131

Fl Tiled Image Class Reference

This class supports tiling of images over a specied area. #include <Fl_Tiled_Image.H> Inheritance diagram for Fl_Tiled_Image:

Fl_Image Fl_Tiled_Image

Public Member Functions


virtual void color_average (Fl_Color c, oat i)
The color_average() method averages the colors in the image with the FLTK color value c.

virtual Fl_Image copy (int W, int H)


The copy() method creates a copy of the specied image.

Fl_Image copy ()
The copy() method creates a copy of the specied image.

virtual void desaturate ()


The desaturate() method converts an image to grayscale.

virtual void draw (int X, int Y, int W, int H, int cx, int cy)
Draws the image with a bounding box.

void draw (int X, int Y)


Draws the image.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

796 Fl_Tiled_Image (Fl_Image i, int W=0, int H=0)


The constructors create a new tiled image containing the specied image.

Class Documentation

Fl_Image image ()
Gets The image that is shared.

virtual Fl_Tiled_Image ()
The destructor frees all memory and server resources that are used by the tiled image.

Protected Attributes
int alloc_image_ Fl_Image image_

30.131.1

Detailed Description

This class supports tiling of images over a specied area. The source (tile) image is not copied unless you call the color_average(), desaturate(), or inactive() methods.

30.131.2
30.131.2.1

Constructor & Destructor Documentation


Fl Tiled Image::Fl Tiled Image ( Fl_Image i, int W = 0, int H = 0 )

The constructors create a new tiled image containing the specied image. Use a width and height of 0 to tile the whole window/widget.

30.131.3
30.131.3.1

Member Function Documentation


void Fl Tiled Image::color average ( Fl_Color c, oat i ) [virtual]

The color_average() method averages the colors in the image with the FLTK color value c. The i argument species the amount of the original image to combine with the color, so a value of 1.0 results in no color blend, and a value of 0.0 results in a constant image of the specied color. The original image data is not altered by this method. Reimplemented from Fl_Image.

30.131.3.2 Fl_Image Fl Tiled Image::copy ( int W, int H ) [virtual] The copy() method creates a copy of the specied image. If the width and height are provided, the image is resized to the specied size. The image should be deleted (or in the case of Fl_Shared_Image, released) when you are done with it. Reimplemented from Fl_Image.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.132 Fl_Timer Class Reference 30.131.3.3 Fl_Image Fl Tiled Image::copy ( ) [inline] The copy() method creates a copy of the specied image.

797

If the width and height are provided, the image is resized to the specied size. The image should be deleted (or in the case of Fl_Shared_Image, released) when you are done with it. Reimplemented from Fl_Image.

30.131.3.4

void Fl Tiled Image::desaturate ( ) [virtual]

The desaturate() method converts an image to grayscale. If the image contains an alpha channel (depth = 4), the alpha channel is preserved. This method does not alter the original image data. Reimplemented from Fl_Image.

30.131.3.5

void Fl Tiled Image::draw ( int X, int Y, int W, int H, int cx, int cy ) [virtual]

Draws the image with a bounding box. This form species a bounding box for the image, with the origin (upper-lefthand corner) of the image offset by the cx and cy arguments. Reimplemented from Fl_Image.

30.131.3.6

void Fl Tiled Image::draw ( int X, int Y ) [inline]

Draws the image. This form species the upper-lefthand corner of the image. Reimplemented from Fl_Image. The documentation for this class was generated from the following les: Fl_Tiled_Image.H Fl_Tiled_Image.cxx

30.132

Fl Timer Class Reference

This is provided only to emulate the Forms Timer widget. #include <Fl_Timer.H> Inheritance diagram for Fl_Timer:

Fl_Widget Fl_Timer

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

798

Class Documentation

Public Member Functions


char direction () const
Gets or sets the direction of the timer.

void direction (char d)


Gets or sets the direction of the timer.

Fl_Timer (uchar t, int x, int y, int w, int h, const char l)


Creates a new Fl_Timer widget using the given type, position, size, and label string.

int handle (int)


Handles the specied event.

char suspended () const


Gets or sets whether the timer is suspended.

void suspended (char d)


Gets or sets whether the timer is suspended.

void value (double)


Sets the current timer value.

double value () const


See void Fl_Timer::value(double)

Fl_Timer ()
Destroys the timer and removes the timeout.

Protected Member Functions


void draw ()
Draws the widget.

30.132.1

Detailed Description

This is provided only to emulate the Forms Timer widget. It works by making a timeout callback every 1/5 second. This is wasteful and inaccurate if you just want something to happen a xed time in the future. You should directly call Fl::add_timeout() instead.

30.132.2
30.132.2.1

Constructor & Destructor Documentation


Fl Timer::Fl Timer ( uchar t, int X, int Y, int W, int H, const char l )

Creates a new Fl_Timer widget using the given type, position, size, and label string. The type parameter can be any of the following symbolic constants: FL_NORMAL_TIMER - The timer just does the callback and displays the string "Timer" in the widget. FL_VALUE_TIMER - The timer does the callback and displays the current timer value in the widget. FL_HIDDEN_TIMER - The timer just does the callback and does not display anything.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.132 Fl_Timer Class Reference

799

30.132.3
30.132.3.1

Member Function Documentation


char Fl Timer::direction ( ) const [inline]

Gets or sets the direction of the timer. If the direction is zero then the timer will count up, otherwise it will count down from the initial value(). 30.132.3.2 void Fl Timer::direction ( char d ) [inline]

Gets or sets the direction of the timer. If the direction is zero then the timer will count up, otherwise it will count down from the initial value(). 30.132.3.3 void Fl Timer::draw ( ) [protected, virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Implements Fl_Widget. 30.132.3.4 int Fl Timer::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

800 See also Fl_Event Reimplemented from Fl_Widget. 30.132.3.5 char Fl Timer::suspended ( ) const [inline]

Class Documentation

Gets or sets whether the timer is suspended. 30.132.3.6 void Fl Timer::suspended ( char d )

Gets or sets whether the timer is suspended. The documentation for this class was generated from the following les: Fl_Timer.H forms_timer.cxx

30.133

Fl Toggle Button Class Reference

The toggle button is a push button that needs to be clicked once to toggle on, and one more time to toggle off. #include <Fl_Toggle_Button.H> Inheritance diagram for Fl_Toggle_Button:

Fl_Widget Fl_Button Fl_Toggle_Button

Public Member Functions


Fl_Toggle_Button (int X, int Y, int W, int H, const char l=0)
Creates a new Fl_Toggle_Button widget using the given position, size, and label string.

30.133.1

Detailed Description

The toggle button is a push button that needs to be clicked once to toggle on, and one more time to toggle off. The Fl_Toggle_Button subclass displays the "on" state by drawing a pushed-in button. Buttons generate callbacks when they are clicked by the user. You control exactly when and how by changing the values for type() and when().
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.134 Fl_Tooltip Class Reference

801

30.133.2
30.133.2.1

Constructor & Destructor Documentation


Fl Toggle Button::Fl Toggle Button ( int X, int Y, int W, int H, const char l = 0 ) [inline]

Creates a new Fl_Toggle_Button widget using the given position, size, and label string. The inherited destructor deletes the toggle button. The documentation for this class was generated from the following le: Fl_Toggle_Button.H

30.134

Fl Tooltip Class Reference

The Fl_Tooltip class provides tooltip support for all FLTK widgets. #include <Fl_Tooltip.H>

Static Public Member Functions


static Fl_Color color ()
Gets the background color for tooltips.

static void color (Fl_Color c)


Sets the background color for tooltips.

static Fl_Widget current ()


Gets the current widget target.

static void current (Fl_Widget )


Sets the current widget target.

static oat delay ()


Gets the tooltip delay.

static void delay (oat f)


Sets the tooltip delay.

static void disable ()


Same as enable(0), disables tooltips on all widgets.

static void enable (int b=1)


Enables tooltips on all widgets (or disables if b is false).

static int enabled ()


Returns non-zero if tooltips are enabled.

static void enter_area (Fl_Widget w, int X, int Y, int W, int H, const char tip)
You may be able to use this to provide tooltips for internal pieces of your widget.

static Fl_Font font ()


Gets the typeface for the tooltip text.

static void font (Fl_Font i)


Sets the typeface for the tooltip text.

static oat hoverdelay ()


Gets the tooltip hover delay, the delay between tooltips.

static void hoverdelay (oat f)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

802
Sets the tooltip hover delay, the delay between tooltips.

Class Documentation

static Fl_Fontsize size ()


Gets the size of the tooltip text.

static void size (Fl_Fontsize s)


Sets the size of the tooltip text.

static Fl_Color textcolor ()


Gets the color of the text in the tooltip.

static void textcolor (Fl_Color c)


Sets the color of the text in the tooltip.

Static Public Attributes


static void( enter )(Fl_Widget w) = nothing static void( exit )(Fl_Widget w) = nothing

Friends
void Fl_Widget::copy_tooltip (const char ) void Fl_Widget::tooltip (const char )

30.134.1

Detailed Description

The Fl_Tooltip class provides tooltip support for all FLTK widgets. It contains only static methods.

30.134.2
30.134.2.1

Member Function Documentation


static Fl_Color Fl Tooltip::color ( ) [inline, static]

Gets the background color for tooltips. The default background color is a pale yellow.

30.134.2.2

static void Fl Tooltip::color ( Fl_Color c ) [inline, static]

Sets the background color for tooltips. The default background color is a pale yellow.

30.134.2.3

void Fl Tooltip::current ( Fl_Widget w ) [static]

Sets the current widget target. Acts as though enter(widget) was done but does not pop up a tooltip. This is useful to prevent a tooltip from reappearing when a modal overlapping window is deleted. FLTK does this automatically when you click the mouse button.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.134 Fl_Tooltip Class Reference 30.134.2.4 static oat Fl Tooltip::delay ( ) [inline, static]

803

Gets the tooltip delay. The default delay is 1.0 seconds.

30.134.2.5

static void Fl Tooltip::delay ( oat f ) [inline, static]

Sets the tooltip delay. The default delay is 1.0 seconds.

30.134.2.6

static void Fl Tooltip::disable ( ) [inline, static]

Same as enable(0), disables tooltips on all widgets.

30.134.2.7

static void Fl Tooltip::enable ( int b = 1 ) [inline, static]

Enables tooltips on all widgets (or disables if b is false).

30.134.2.8

static int Fl Tooltip::enabled ( ) [inline, static]

Returns non-zero if tooltips are enabled.

30.134.2.9

void Fl Tooltip::enter area ( Fl_Widget wid, int x, int y, int w, int h, const char t ) [static]

You may be able to use this to provide tooltips for internal pieces of your widget. Call this after setting Fl::belowmouse() to your widget (because that calls the above enter() method). Then gure out what thing the mouse is pointing at, and call this with the widget (this pointer is used to remove the tooltip if the widget is deleted or hidden, and to locate the tooltip), the rectangle surrounding the area, relative to the top-left corner of the widget (used to calculate where to put the tooltip), and the text of the tooltip (which must be a pointer to static data as it is not copied).

30.134.2.10

static Fl_Font Fl Tooltip::font ( ) [inline, static]

Gets the typeface for the tooltip text.

30.134.2.11

static void Fl Tooltip::font ( Fl_Font i ) [inline, static]

Sets the typeface for the tooltip text.

30.134.2.12

static oat Fl Tooltip::hoverdelay ( ) [inline, static]

Gets the tooltip hover delay, the delay between tooltips. The default delay is 0.2 seconds.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

804 30.134.2.13 static void Fl Tooltip::hoverdelay ( oat f ) [inline, static]

Class Documentation

Sets the tooltip hover delay, the delay between tooltips. The default delay is 0.2 seconds.

30.134.2.14

static Fl_Fontsize Fl Tooltip::size ( ) [inline, static]

Gets the size of the tooltip text.

30.134.2.15

static void Fl Tooltip::size ( Fl_Fontsize s ) [inline, static]

Sets the size of the tooltip text.

30.134.2.16

static Fl_Color Fl Tooltip::textcolor ( ) [inline, static]

Gets the color of the text in the tooltip. The default is black.

30.134.2.17

static void Fl Tooltip::textcolor ( Fl_Color c ) [inline, static]

Sets the color of the text in the tooltip. The default is black. The documentation for this class was generated from the following les: Fl_Tooltip.H Fl.cxx Fl_Tooltip.cxx

30.135
Tree widget.

Fl Tree Class Reference

#include <Fl_Tree.H> Inheritance diagram for Fl_Tree:

Fl_Widget Fl_Group Fl_Tree

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.135 Fl_Tree Class Reference

805

Public Member Functions


Fl_Tree_Item add (const char path)
Adds a new item, given a menu style path, eg: "/Parent/Child/item".

Fl_Tree_Item add (Fl_Tree_Item item, const char name)


Add a new child to a tree-item.

void callback_item (Fl_Tree_Item item)


Sets the item that was changed for this callback.

Fl_Tree_Item callback_item ()
Gets the item that caused the callback.

void callback_reason (Fl_Tree_Reason reason)


Sets the reason for this callback.

Fl_Tree_Reason callback_reason () const


Gets the reason for this callback.

void clear ()
Clear all children from the tree.

void clear_children (Fl_Tree_Item item)


Clear all the children of a particular node in the tree specied by item.

int close (Fl_Tree_Item item, int docallback=1)


Closes the specied item.

int close (const char path, int docallback=1)


Closes the item specied by path, eg: "Parent/child/item".

Fl_Image closeicon () const


Returns the icon to be used as the close icon.

void closeicon (Fl_Image val)


Sets the icon to be used as the close icon.

Fl_Color connectorcolor () const


Get the connector color used for tree connection lines.

void connectorcolor (Fl_Color val)


Set the connector color used for tree connection lines.

Fl_Tree_Connector connectorstyle () const


Returns the line drawing style for inter-connecting items.

void connectorstyle (Fl_Tree_Connector val)


Sets the line drawing style for inter-connecting items.

int connectorwidth () const


Gets the width of the horizontal connection lines (in pixels) that appear to the left of each tree items label.

void connectorwidth (int val)


Sets the width of the horizontal connection lines (in pixels) that appear to the left of each tree items label.

int deselect (Fl_Tree_Item item, int docallback=1)


De-select the specied item.

int deselect (const char path, int docallback=1)


Deselect an item specied by path (eg: "Parent/child/item").

int deselect_all (Fl_Tree_Item item=0, int docallback=1)


Deselect item and all its children.

void display (Fl_Tree_Item item)


Displays item, scrolling the tree as necessary.

int displayed (Fl_Tree_Item item)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

806
See if item is currently displayed on-screen (visible within the widget).

Class Documentation

void draw ()
Standard FLTK draw() method, handles draws the tree widget.

const Fl_Tree_Item nd_clicked () const


Find the item that was clicked.

Fl_Tree_Item nd_item (const char path)


Find the item, given a menu style path, eg: "/Parent/Child/item".

const Fl_Tree_Item nd_item (const char path) const


A const version of Fl_Tree::nd_item(const char path)

Fl_Tree_Item rst ()
Returns the rst item in the tree.

Fl_Tree_Item rst_selected_item ()
Returns the rst selected item in the tree.

Fl_Tree (int X, int Y, int W, int H, const char L=0)


Constructor.

int handle (int e)


Standard FLTK event handler for this widget.

Fl_Tree_Item insert (Fl_Tree_Item item, const char name, int pos)


Insert a new item into a tree-items children at a specied position.

Fl_Tree_Item insert_above (Fl_Tree_Item above, const char name)


Inserts a new item above the specied Fl_Tree_Item, with the label set to name.

int is_close (Fl_Tree_Item item) const


See if the specied item is closed.

int is_close (const char path) const


See if item specied by path (eg: "Parent/child/item") is closed.

int is_open (Fl_Tree_Item item) const


See if item is open.

int is_open (const char path) const


See if item specied by path (eg: "Parent/child/item") is open.

int is_scrollbar (Fl_Widget w)


See if widget w is one of the Fl_Tree widgets scrollbars.

int is_selected (Fl_Tree_Item item) const


See if the specied item is selected.

int is_selected (const char path)


See if item specied by path (eg: "Parent/child/item") is selected.

Fl_Tree_Item item_clicked ()
Return the item that was last clicked.

Fl_Color item_labelbgcolor (void) const


Get the default label background color used for creating new items.

void item_labelbgcolor (Fl_Color val)


Set the default label background color used for creating new items.

Fl_Color item_labelfgcolor (void) const


Get the default label foreground color used for creating new items.

void item_labelfgcolor (Fl_Color val)


Set the default label foreground color used for creating new items.

Fl_Font item_labelfont () const


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.135 Fl_Tree Class Reference


Get the default font face used for creating new items.

807

void item_labelfont (Fl_Font val)


Set the default font face used for creating new items.

Fl_Fontsize item_labelsize () const


Get the default label fontsize used for creating new items.

void item_labelsize (Fl_Fontsize val)


Set the default label font size used for creating new items.

int item_pathname (char pathname, int pathnamelen, const Fl_Tree_Item item) const
Find the pathname for the specied item.

Fl_Tree_Item last ()
Returns the last item in the tree.

void load (class Fl_Preferences &)


Load FLTK preferences.

int marginleft () const


Get the amount of white space (in pixels) that should appear between the widgets left border and the trees contents.

void marginleft (int val)


Set the amount of white space (in pixels) that should appear between the widgets left border and the left side of the trees contents.

int margintop () const


Get the amount of white space (in pixels) that should appear between the widgets top border and the top of the trees contents.

void margintop (int val)


Sets the amount of white space (in pixels) that should appear between the widgets top border and the top of the trees contents.

Fl_Tree_Item next (Fl_Tree_Item item=0)


Return the next item after item, or 0 if no more items.

Fl_Tree_Item next_selected_item (Fl_Tree_Item item=0)


Returns the next selected item after item.

int open (Fl_Tree_Item item, int docallback=1)


Open the specied item.

int open (const char path, int docallback=1)


Opens the item specied by path (eg: "Parent/child/item").

void open_toggle (Fl_Tree_Item item, int docallback=1)


Toggle the open state of item.

int openchild_marginbottom () const


Get the amount of white space (in pixels) that should appear below an open child trees contents.

void openchild_marginbottom (int val)


Set the amount of white space (in pixels) that should appear below an open child trees contents.

Fl_Image openicon () const


Returns the icon to be used as the open icon.

void openicon (Fl_Image val)


Sets the icon to be used as the open icon.

Fl_Tree_Item prev (Fl_Tree_Item item=0)


Return the previous item before item, or 0 if no more items.

int remove (Fl_Tree_Item item)


Remove the specied item from the tree.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

808 Fl_Tree_Item root ()


Returns the root item.

Class Documentation

void root_label (const char new_label)


Set the label for the root item.

int scrollbar_size () const


Gets the current size of the scrollbars troughs, in pixels.

void scrollbar_size (int size)


Sets the pixel size of the scrollbars troughs to the size, in pixels.

int select (Fl_Tree_Item item, int docallback=1)


Select the specied item.

int select (const char path, int docallback=1)


Select the item specied by path (eg: "Parent/child/item").

int select_all (Fl_Tree_Item item=0, int docallback=1)


Select item and all its children.

int select_only (Fl_Tree_Item selitem, int docallback=1)


Select only the specied item, deselecting all others that might be selected.

void select_toggle (Fl_Tree_Item item, int docallback=1)


Toggle the select state of the specied item.

Fl_Boxtype selectbox () const


Sets the style of box used to draw selected items.

void selectbox (Fl_Boxtype val)


Gets the style of box used to draw selected items.

Fl_Tree_Select selectmode () const


Gets the trees current selection mode.

void selectmode (Fl_Tree_Select val)


Sets the trees selection mode.

void set_item_focus (Fl_Tree_Item o)


Set the item that currently should have keyboard focus.

void show_item (Fl_Tree_Item item, int yoff)


Adjust the vertical scroll bar so that item is visible yoff pixels from the top of the Fl_Tree widgets display.

void show_item (Fl_Tree_Item item)


Adjust the vertical scroll bar to show item at the top of the display IF it is currently off-screen (e.g.

void show_item_bottom (Fl_Tree_Item item)


Adjust the vertical scrollbar so that item is at the bottom of the display.

void show_item_middle (Fl_Tree_Item item)


Adjust the vertical scrollbar so that item is in the middle of the display.

void show_item_top (Fl_Tree_Item item)


Adjust the vertical scrollbar so that item is at the top of the display.

void show_self ()
Print the tree as ascii art to stdout.

int showcollapse () const


Returns 1 if the collapse icon is enabled, 0 if not.

void showcollapse (int val)


Set if we should show the collapse icon or not.

int showroot () const


Returns 1 if the root item is to be shown, or 0 if not.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.135 Fl_Tree Class Reference void showroot (int val)


Set if the root item should be shown or not.

809

Fl_Tree_Sort sortorder () const


Set the default sort order used when items are added to the tree.

void sortorder (Fl_Tree_Sort val)


Gets the sort order used to add items to the tree.

Fl_Image usericon () const


Returns the Fl_Image being used as the default user icon for all newly created items.

void usericon (Fl_Image val)


Sets the Fl_Image to be used as the default user icon for all newly created items.

int vposition () const


Returns the vertical scroll position as a pixel offset.

void vposition (int ypos)


Sets the vertical scroll offset to position pos.

Fl_Tree ()
Destructor.

Protected Member Functions


void do_callback_for_item (Fl_Tree_Item item, Fl_Tree_Reason reason)
Do the callback for the item, setting the item and reason.

void item_clicked (Fl_Tree_Item val)


Set the item that was last clicked.

Fl_Tree_Item next_visible_item (Fl_Tree_Item start, int dir)


Returns next visible item above (dir==Fl_Up) or below (dir==Fl_Down) the specied item.

Protected Attributes
Fl_Scrollbar _vscroll
Vertical scrollbar.

30.135.1
Tree widget.

Detailed Description

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

810

Class Documentation

Figure 30.37: Fl_Tree example program

Fl_Tree |--- Fl_Tree_Item |--- Fl_Tree_Prefs tree |--- Fl_Tree_Connector (enum) |--- Fl_Tree_Select (enum) |--- Fl_Tree_Sort (enum)

// Top level widget // Items in the tree // Preferences for the // Connection modes // Selection modes // Sort behavior

Similar to Fl_Browser, Fl_Tree is a browser of Fl_Tree_Items, which is arranged in a parented hierarchy, or tree. Subtrees can be expanded or closed. Items can be added, deleted, inserted, sorted and re-ordered. The tree items may also contain other FLTK widgets, like buttons, input elds, or even "custom" widgets. The callback() is invoked depending on the value of when(): FL_WHEN_RELEASE -- callback invoked when left mouse button is released on an item FL_WHEN_CHANGED -- callback invoked when left mouse changes selection state The simple way to dene a tree:
#include <FL/Fl_Tree.H> [..] Fl_Tree tree(X,Y,W,H); tree.begin(); tree.add("Flintstones/Fred"); tree.add("Flintstones/Wilma"); tree.add("Flintstones/Pebbles"); tree.add("Simpsons/Homer"); tree.add("Simpsons/Marge"); tree.add("Simpsons/Bart"); tree.add("Simpsons/Lisa"); tree.end();

Items can be added with add(), removed with remove(), completely cleared with clear(), inserted with insert() and insert_above(), selected/deselected with select() and deselect(), open/closed with open() and closed(). Children of an item can be swapped around with Fl_Tree_Item::swap_children(), sorting can be controlled when items are add()ed via sortorder(). You can walk the entire tree with rst() and next(). You can walk selected items with rst_selected_item() and next_selected_item(). Items can be found by their pathname using nd_item(const char), and an items pathname can be found with item_pathname(). The selected items colors are controlled by selection_color() (inherited from Fl_Widget).
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.135 Fl_Tree Class Reference The tree can have different selection behaviors controlled by selectmode(). FLTK widgets (including custom widgets) can be assigned to tree items via Fl_Tree_Item::widget().

811

Icons for individual items can be changed with Fl_Tree_Item::openicon(), Fl_Tree_Item::closeicon(), Fl_Tree_Item::usericon(). Various default preferences can be globally manipulated via Fl_Tree_Prefs, including colors, margins, icons, connection lines. The trees callback() will be invoked when items change state or are open/closed. when() controls when mouse/keyboard events invoke the callback. callback_item() and callback_reason() can be used to determine the cause of the callback. eg:
void MyTreeCallback(Fl_Widget *w, void *data) { Fl_Tree *tree = (Fl_Tree*)w; Fl_Tree_Item *item = (Fl_Tree_Item*)tree->callback_item(); item switch ( tree->callback_reason() ) { case FL_TREE_REASON_SELECTED: [..] case FL_TREE_REASON_DESELECTED: [..] case FL_TREE_REASON_OPENED: [..] case FL_TREE_REASON_CLOSED: [..] }

// get selected

To get the items full menu pathname, you can use Fl_Tree_Item::item_pathname(), eg:
char pathname[256] = "???"; tree->item_pathname(pathname, sizeof(pathname), item); "Parent/Child/Item"

// eg.

To walk all the items of the tree from top to bottom:


// Walk all the items in the tree, and print their labels for ( Fl_Tree_Item *item = tree->first(); item; item = tree->next(item) ) { printf("Item: %s\n", item->label()); }

To recursively walk all the children of a particular item, dene a function that uses recursion:
// Find all of the items children and print an indented report of their labels void my_print_all_children(Fl_Tree_Item *item, int indent=0) { for ( int t=0; t<item->children(); t++ ) { printf("%*s Item: %s\n", indent, "", item->child(t)->label()); my_print_all_children(item->child(t), indent+4); // recurse } }

To change the default label font and color for creating new items:
tree = new Fl_Tree(..); tree->item_labelfont(FL_COURIER); // Use Courier font for all new items tree->item_labelfgcolor(FL_RED); // Use red color for labels of all new items [..] // Now create the items in the tree using the above defaults. tree->add("Aaa"); tree->add("Bbb"); [..]

To change the font and color of all items in the tree:


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

812

Class Documentation

// Change the font and color of all items currently in the tree for ( Fl_Tree_Item *item = tree->first(); item; item = tree->next(item) ) { item->labelfont(FL_COURIER); item->labelcolor(FL_RED); }

The following image shows the trees various visual elements and the methods that control them:

Figure 30.38: Fl_Tree dimensions

30.135.2

Member Function Documentation

30.135.2.1 Fl_Tree_Item Fl Tree::add ( const char path ) Adds a new item, given a menu style path, eg: "/Parent/Child/item". Any parent nodes that dont already exist are created automatically. Adds the item based on the value of sortorder(). To specify items or submenus that contain slashes (/ or \) use an escape character to protect them, e.g.
tree->add("/Holidays/Photos/12\\/25\\2010"); // Adds item "12/25/2010" tree->add("/Pathnames/c:\\\\Program Files\\\\MyApp"); // Adds item "c:\Program Files\MyApp"

Returns the child item created, or 0 on error.

30.135.2.2 Fl_Tree_Item Fl Tree::add ( Fl_Tree_Item item, const char name ) Add a new child to a tree-item. Parameters in in

item The existing item to add new child to. Must not be NULL. name The label for the new item

Returns the item that was added.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.135 Fl_Tree Class Reference 30.135.2.3 void Fl Tree::callback item ( Fl_Tree_Item item ) [inline]

813

Sets the item that was changed for this callback. Used internally to pass the item that invoked the callback. 30.135.2.4 Fl_Tree_Item Fl Tree::callback item ( ) [inline] Gets the item that caused the callback. The callback() can use this value to see which item changed. 30.135.2.5 void Fl Tree::callback reason ( Fl_Tree_Reason reason ) [inline]

Sets the reason for this callback. Used internally to pass the reason the callback was invoked. 30.135.2.6 Fl_Tree_Reason Fl Tree::callback reason ( ) const [inline] Gets the reason for this callback. The callback() can use this value to see why it was called. Example:
void MyTreeCallback(Fl_Widget *w, void *userdata) { Fl_Tree *tree = (Fl_Tree*)w; Fl_Tree_Item *item = tree->callback_item(); // the item changed (can be NULL if more than one item was changed!) switch ( tree->callback_reason() ) { // reason callback was invoked case FL_TREE_REASON_OPENED: ..item was opened.. case FL_TREE_REASON_CLOSED: ..item was closed.. case FL_TREE_REASON_SELECTED: ..item was selected.. case FL_TREE_REASON_DESELECTED: ..item was deselected.. } }

30.135.2.7

void Fl Tree::clear ( ) [inline]

Clear all children from the tree. The tree will be left completely empty. Reimplemented from Fl_Group. 30.135.2.8 void Fl Tree::clear children ( Fl_Tree_Item item ) [inline]

Clear all the children of a particular node in the tree specied by item. Item may not be NULL. 30.135.2.9 int Fl Tree::close ( Fl_Tree_Item item, int docallback = 1 ) [inline]

Closes the specied item.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

814

Class Documentation

Handles redrawing if anything was actually changed. Invokes the callback depending on the value of optional parameter docallback. The callback can use callback_item() and callback_reason() respectively to determine the item changed and the reason the callback was called. Parameters in in

item -- the item to be closed. Must not be NULL. docallback -- A ag that determines if the callback() is invoked or not: 0 - callback() is not invoked 1 - callback() is invoked if item changed, callback_reason() will be FL_TREE_REASON_CLOSED

Returns 1 -- item was closed 0 -- item was already closed, no change

See also open(), close(), is_open(), is_close(), callback_item(), callback_reason()

30.135.2.10

int Fl Tree::close ( const char path, int docallback = 1 ) [inline]

Closes the item specied by path, eg: "Parent/child/item". Handles redrawing if anything was actually changed. Invokes the callback depending on the value of optional parameter docallback. Items or submenus that themselves contain slashes (/ or \) should be escaped, e.g. close("Holidays/12\\/25\//2010"). The callback can use callback_item() and callback_reason() respectively to determine the item changed and the reason the callback was called. Parameters in in

path -- the tree items pathname (e.g. "Flintstones/Fred") docallback -- A ag that determines if the callback() is invoked or not: 0 - callback() is not invoked 1 - callback() is invoked if item changed, callback_reason() will be FL_TREE_REASON_CLOSED

Returns 1 -- OK: item closed 0 -- OK: item was already closed, no change -1 -- ERROR: item was not found

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.135 Fl_Tree Class Reference See also open(), close(), is_open(), is_close(), callback_item(), callback_reason()

815

30.135.2.11 Fl_Image Fl Tree::closeicon ( ) const [inline] Returns the icon to be used as the close icon. If none was set, the internal default is returned, a simple [-] icon. 30.135.2.12 void Fl Tree::closeicon ( Fl_Image val ) [inline]

Sets the icon to be used as the close icon. This overrides the built in default [-] icon. Parameters in

val -- The new image, or zero to use the default [-] icon.

30.135.2.13

int Fl Tree::deselect ( Fl_Tree_Item item, int docallback = 1 ) [inline]

De-select the specied item. Handles redrawing if anything was actually changed. Invokes the callback depending on the value of optional parameter docallback. The callback can use callback_item() and callback_reason() respectively to determine the item changed and the reason the callback was called. Parameters in in

item -- the item to be selected. Must not be NULL. docallback -- A ag that determines if the callback() is invoked or not: 0 - the callback() is not invoked 1 - the callback() is invoked if item changed state, callback_reason() will be FL_TREE_REASON_DESELECTED

Returns 0 - item was already deselected, no change was made 1 - items state was changed

30.135.2.14

int Fl Tree::deselect ( const char path, int docallback = 1 ) [inline]

Deselect an item specied by path (eg: "Parent/child/item"). Handles redrawing if anything was actually changed. Invokes the callback depending on the value of optional parameter docallback. Items or submenus that themselves contain slashes (/ or \) should be escaped, e.g. deselect("Holidays/12\\/25\//2010").
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

816

Class Documentation

The callback can use callback_item() and callback_reason() respectively to determine the item changed and the reason the callback was called. Parameters in in

path -- the tree items pathname (e.g. "Flintstones/Fred") docallback -- A ag that determines if the callback() is invoked or not: 0 - the callback() is not invoked 1 - the callback() is invoked if item changed state, callback_reason() will be FL_TREE_REASON_DESELECTED

Returns 1 - OK: items state was changed 0 - OK: item was already deselected, no change was made -1 - ERROR: item was not found

30.135.2.15

int Fl Tree::deselect all ( Fl_Tree_Item item = 0, int docallback = 1 )

Deselect item and all its children. If item is NULL, rst() is used. Handles calling redraw() if anything was changed. Invokes the callback depending on the value of optional parameter docallback. The callback can use callback_item() and callback_reason() respectively to determine the item changed and the reason the callback was called. Parameters in in

item The item that will be deselected (along with all its children). If NULL, rst() is used. docallback -- A ag that determines if the callback() is invoked or not: 0 - the callback() is not invoked 1 - the callback() is invoked for each item that changed state, callback_reason() will be FL_TREE_REASON_DESELECTED

Returns count of how many items were actually changed to the deselected state.

30.135.2.16

void Fl Tree::display ( Fl_Tree_Item item )

Displays item, scrolling the tree as necessary. Parameters in

item The item to be displayed. If NULL, rst() is used.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.135 Fl_Tree Class Reference 30.135.2.17 int Fl Tree::displayed ( Fl_Tree_Item item )

817

See if item is currently displayed on-screen (visible within the widget). This can be used to detect if the item is scrolled off-screen. Checks to see if the items vertical position is within the top and bottom edges of the display window. This does NOT take into account the hide()/show() or open()/close() status of the item. Parameters in

item The item to be checked. If NULL, rst() is used.

Returns 1 if displayed, 0 if scrolled off screen or no items are in tree.

30.135.2.18

const Fl_Tree_Item Fl Tree::nd clicked ( ) const

Find the item that was clicked. You should use callback_item() instead, which is fast, and is meant to be used within a callback to determine the item clicked. This method walks the entire tree looking for the rst item that is under the mouse (ie. at Fl::event_x()/Fl:event_y(). Use this method /only/ if youve subclassed Fl_Tree, and are receiving events before Fl_Tree has been able to process and update callback_item(). Returns the item clicked, or 0 if no item was under the current event.

30.135.2.19 Fl_Tree_Item Fl Tree::nd item ( const char path ) Find the item, given a menu style path, eg: "/Parent/Child/item". There is both a const and non-const version of this method. Const version allows pure const methods to use this method to do lookups without causing compiler errors. To specify items or submenus that contain slashes (/ or \) use an escape character to protect them, e.g.
tree->add("/Holidays/Photos/12\\/25\\2010"); // Adds item "12/25/2010" tree->add("/Pathnames/c:\\\\Program Files\\\\MyApp"); // Adds item "c:\Program Files\MyApp"

Parameters in Returns

path -- the tree items pathname to be found (e.g. "Flintstones/Fred")

the item, or NULL if not found.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

818 See also item_pathname()

Class Documentation

30.135.2.20 Fl_Tree_Item Fl Tree::rst ( ) Returns the rst item in the tree. Use this to walk the tree in the forward direction, eg:
for ( Fl_Tree_Item *item = tree->first(); item; item = tree->next(item) ) { printf("Item: %s\n", item->label()); }

Returns rst item in tree, or 0 if none (tree empty).

See also rst(),next(),last(),prev()

30.135.2.21 Fl_Tree_Item Fl Tree::rst selected item ( ) Returns the rst selected item in the tree. Use this to walk the tree looking for all the selected items, eg:
for ( Fl_Tree_Item *item = tree->first_selected_item(); item; item = tree-> next_selected_item(item) ) { printf("Item: %s\n", item->label()); }

Returns The next selected item, or 0 if there are no more selected items.

30.135.2.22 Fl_Tree_Item Fl Tree::insert ( Fl_Tree_Item item, const char name, int pos ) Insert a new item into a tree-items children at a specied position. Parameters in in in

item The existing item to insert new child into. Must not be NULL. name The label for the new item pos The position of the new item in the child list

Returns the item that was added.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.135 Fl_Tree Class Reference 30.135.2.23 Fl_Tree_Item Fl Tree::insert above ( Fl_Tree_Item above, const char name ) Inserts a new item above the specied Fl_Tree_Item, with the label set to name. Parameters in in

819

above -- the item above which to insert the new item. Must not be NULL. name -- the name of the new item

Returns the item that was added, or 0 if above could not be found.

30.135.2.24

int Fl Tree::is close ( Fl_Tree_Item item ) const [inline]

See if the specied item is closed. Parameters in

item -- the item to be tested. Must not be NULL.

Returns 1 : item is open 0 : item is closed

30.135.2.25

int Fl Tree::is close ( const char path ) const [inline]

See if item specied by path (eg: "Parent/child/item") is closed. Items or submenus that themselves contain slashes (/ or \) should be escaped, e.g. is_close("Holidays/12\\/25\//2010"). Parameters in

path -- the tree items pathname (e.g. "Flintstones/Fred")

Returns 1 - OK: item is closed 0 - OK: item is open -1 - ERROR: item was not found

30.135.2.26

int Fl Tree::is open ( Fl_Tree_Item item ) const [inline]

See if item is open. Items that are open are themselves not necessarily visible; one of the items parents might be closed.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

820 Parameters in

Class Documentation

item -- the item to be tested. Must not be NULL.

Returns 1 : item is open 0 : item is closed

30.135.2.27

int Fl Tree::is open ( const char path ) const [inline]

See if item specied by path (eg: "Parent/child/item") is open. Items or submenus that themselves contain slashes (/ or \) should be escaped, e.g. is_open("Holidays/12\\/25\//2010"). Items that are open are themselves not necessarily visible; one of the items parents might be closed. Parameters in

path -- the tree items pathname (e.g. "Flintstones/Fred")

Returns 1 - OK: item is open 0 - OK: item is closed -1 - ERROR: item was not found

30.135.2.28

int Fl Tree::is scrollbar ( Fl_Widget w ) [inline]

See if widget w is one of the Fl_Tree widgets scrollbars. Use this to skip over the scrollbars when walking the child() array. Example:
for ( int i=0; i<tree->children(); i++ ) { Fl_Widget *w= tree->child(i); if ( brow->is_scrollbar(w) ) continue; ..do work here.. } // walk children // skip scrollbars

Parameters in

w Widget to test

Returns 1 if w is a scrollbar, 0 if not.

30.135.2.29

int Fl Tree::is selected ( Fl_Tree_Item item ) const [inline]

See if the specied item is selected.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.135 Fl_Tree Class Reference Parameters in

821

item -- the item to be tested. Must not be NULL.

Returns 1 : item selected 0 : item deselected

30.135.2.30

int Fl Tree::is selected ( const char path ) [inline]

See if item specied by path (eg: "Parent/child/item") is selected. Items or submenus that themselves contain slashes (/ or \) should be escaped, e.g. is_selected("Holidays/12\\/25\//2010"). Parameters in

path -- the tree items pathname (e.g. "Flintstones/Fred")

Returns 1 : item selected 0 : item deselected -1 : item was not found

30.135.2.31

void Fl Tree::item clicked ( Fl_Tree_Item val ) [protected]

Set the item that was last clicked. Should only be used by subclasses needing to change this value. Normally Fl_Tree manages this value. Deprecated: use callback_item() instead. 30.135.2.32 Fl_Tree_Item Fl Tree::item clicked ( ) [inline] Return the item that was last clicked. Valid only from within the callback(). Deprecated: use callback_item() instead. Returns the item clicked, or 0 if none. 0 may also be used to indicate several items were clicked/changed.

30.135.2.33

void Fl Tree::item labelbgcolor ( Fl_Color val ) [inline]

Set the default label background color used for creating new items. To change the background color on a per-item basis, use Fl_Tree_Item::labelbgcolor(Fl_Color)
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

822 30.135.2.34 void Fl Tree::item labelfgcolor ( Fl_Color val ) [inline]

Class Documentation

Set the default label foreground color used for creating new items. To change the foreground color on a per-item basis, use Fl_Tree_Item::labelfgcolor(Fl_Color) 30.135.2.35 void Fl Tree::item labelfont ( Fl_Font val ) [inline]

Set the default font face used for creating new items. To change the font face on a per-item basis, use Fl_Tree_Item::labelfont(Fl_Font) 30.135.2.36 void Fl Tree::item labelsize ( Fl_Fontsize val ) [inline]

Set the default label font size used for creating new items. To change the font size on a per-item basis, use Fl_Tree_Item::labelsize(Fl_Fontsize) 30.135.2.37 int Fl Tree::item pathname ( char pathname, int pathnamelen, const Fl_Tree_Item item ) const

Find the pathname for the specied item. If item is NULL, root() is used. The trees root will be included in the pathname of showroot() is on. Menu items or submenus that contain slashes (/ or \) in their names will be escaped with a backslash. This is symmetrical with the add() function which uses the same escape pattern to set names. Parameters in in in

pathname The string to use to return the pathname pathnamelen The maximum length of the string (including NULL). Must not be zero. item The item whose pathname is to be returned.

Returns 0 : OK (pathname returns the items pathname) -1 : item not found (pathname="") -2 : pathname not large enough (pathname="") See also nd_item()

30.135.2.38 Fl_Tree_Item Fl Tree::last ( ) Returns the last item in the tree. This can be used to walk the tree in reverse, eg:
for ( Fl_Tree_Item *item = tree->last(); item; item = tree->prev() ) { printf("Item: %s\n", item->label()); }

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.135 Fl_Tree Class Reference Returns last item in the tree, or 0 if none (tree empty).

823

See also rst(),next(),last(),prev()

30.135.2.39

void Fl Tree::load ( class Fl_Preferences & prefs )

Load FLTK preferences. Read a preferences database into the tree widget. A preferences database is a hierarchical collection of data which can be directly loaded into the tree view for inspection. Parameters in

prefs the Fl_Preferences database

30.135.2.40 Fl_Tree_Item Fl Tree::next ( Fl_Tree_Item item = 0 ) Return the next item after item, or 0 if no more items. Use this code to walk the entire tree:
for ( Fl_Tree_Item *item = tree->first(); item; item = tree->next(item) ) { printf("Item: %s\n", item->label()); }

Parameters in Returns

item The item to use to nd the next item. If NULL, returns 0.

Next item in tree, or 0 if at last item. See also rst(),next(),last(),prev()

30.135.2.41 Fl_Tree_Item Fl Tree::next selected item ( Fl_Tree_Item item = 0 ) Returns the next selected item after item. If item is 0, search starts at the rst item (root). Use this to walk the tree looking for all the selected items, eg:
for ( Fl_Tree_Item *item = tree->first_selected_item(); item; item = tree-> next_selected_item(item) ) { printf("Item: %s\n", item->label()); }

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

824 Parameters in

Class Documentation

item The item to use to nd the next selected item. If NULL, rst() is used.

Returns The next selected item, or 0 if there are no more selected items.

30.135.2.42 Fl_Tree_Item Fl Tree::next visible item ( Fl_Tree_Item item, int dir ) [protected] Returns next visible item above (dir==Fl_Up) or below (dir==Fl_Down) the specied item. If item is 0, returns rst() if dir is Fl_Up, or last() if dir is FL_Down. Parameters in in

item The item above/below which well nd the next visible item dir The direction to search. Can be FL_Up or FL_Down.

Returns The item found, or 0 if theres no visible items above/below the specied item.

30.135.2.43

int Fl Tree::open ( Fl_Tree_Item item, int docallback = 1 ) [inline]

Open the specied item. This causes the items children (if any) to be shown. Handles redrawing if anything was actually changed. Invokes the callback depending on the value of optional parameter docallback. The callback can use callback_item() and callback_reason() respectively to determine the item changed and the reason the callback was called. Parameters in in

item -- the item to be opened. Must not be NULL. docallback -- A ag that determines if the callback() is invoked or not: 0 - callback() is not invoked 1 - callback() is invoked if item changed, callback_reason() will be FL_TREE_REASON_OPENED

Returns 1 -- item was opened 0 -- item was already open, no change

See also open(), close(), is_open(), is_close(), callback_item(), callback_reason()

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.135 Fl_Tree Class Reference 30.135.2.44 int Fl Tree::open ( const char path, int docallback = 1 ) [inline]

825

Opens the item specied by path (eg: "Parent/child/item"). This causes the items children (if any) to be shown. Handles redrawing if anything was actually changed. Invokes the callback depending on the value of optional parameter docallback. Items or submenus that themselves contain slashes (/ or \) should be escaped, e.g. open("Holidays/12\\/25\//2010"). The callback can use callback_item() and callback_reason() respectively to determine the item changed and the reason the callback was called. Parameters in in

path -- the tree items pathname (e.g. "Flintstones/Fred") docallback -- A ag that determines if the callback() is invoked or not: 0 - callback() is not invoked 1 - callback() is invoked if item changed, callback_reason() will be FL_TREE_REASON_OPENED

Returns 1 -- OK: item opened 0 -- OK: item was already open, no change -1 -- ERROR: item was not found See also open(), close(), is_open(), is_close(), callback_item(), callback_reason()

30.135.2.45

void Fl Tree::open toggle ( Fl_Tree_Item item, int docallback = 1 ) [inline]

Toggle the open state of item. Handles redrawing if anything was actually changed. Invokes the callback depending on the value of optional parameter docallback. The callback can use callback_item() and callback_reason() respectively to determine the item changed and the reason the callback was called. Parameters in in

item -- the item whose open state is to be toggled. Must not be NULL. docallback -- A ag that determines if the callback() is invoked or not: 0 - callback() is not invoked 1 - callback() is invoked, callback_reason() will be either FL_TREE_REASON_OPENED or FL_TREE_REASON_CLOSED

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

826 See also open(), close(), is_open(), is_close(), callback_item(), callback_reason()

Class Documentation

30.135.2.46 Fl_Image Fl Tree::openicon ( ) const [inline] Returns the icon to be used as the open icon. If none was set, the internal default is returned, a simple [+] icon. 30.135.2.47 void Fl Tree::openicon ( Fl_Image val ) [inline]

Sets the icon to be used as the open icon. This overrides the built in default [+] icon. Parameters in

val -- The new image, or zero to use the default [+] icon.

30.135.2.48 Fl_Tree_Item Fl Tree::prev ( Fl_Tree_Item item = 0 ) Return the previous item before item, or 0 if no more items. This can be used to walk the tree in reverse, eg:
for ( Fl_Tree_Item *item = tree->first(); item; item = tree->prev(item) ) { printf("Item: %s\n", item->label()); }

Parameters in

item The item to use to nd the previous item. If NULL, returns 0.

Returns Previous item in tree, or 0 if at rst item. See also rst(),next(),last(),prev()

30.135.2.49

int Fl Tree::remove ( Fl_Tree_Item item ) [inline]

Remove the specied item from the tree. item may not be NULL. If it has children, all those are removed too. Returns 0 if done, -1 if item not found.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.135 Fl_Tree Class Reference 30.135.2.50 void Fl Tree::root label ( const char new label ) [inline]

827

Set the label for the root item. Makes an internally managed copy of new_label. 30.135.2.51 int Fl Tree::scrollbar size ( ) const [inline]

Gets the current size of the scrollbars troughs, in pixels. If this value is zero (default), this widget will use the global Fl::scrollbar_size() value as the scrollbars width. Returns Scrollbar size in pixels, or 0 if the global Fl::scrollsize() is being used.

See also Fl::scrollbar_size(int)

30.135.2.52

void Fl Tree::scrollbar size ( int size ) [inline]

Sets the pixel size of the scrollbars troughs to the size, in pixels. Normally you should not need this method, and should use the global Fl::scrollbar_size(int) instead to manage the size of ALL your widgets scrollbars. This ensures your application has a consistent UI, is the default behavior, and is normally what you want. Only use THIS method if you really need to override the global scrollbar size. The need for this should be rare. Setting size to the special value of 0 causes the widget to track the global Fl::scrollbar_size(), which is the default. Parameters in

size Sets the scrollbar size in pixels. If 0 (default), scrollbar size tracks the global Fl::scrollbar_size()

See also Fl::scrollbar_size()

30.135.2.53

int Fl Tree::select ( Fl_Tree_Item item, int docallback = 1 ) [inline]

Select the specied item. Use deselect() to de-select it. Handles redrawing if anything was actually changed. Invokes the callback depending on the value of optional parameter docallback. The callback can use callback_item() and callback_reason() respectively to determine the item changed and the reason the callback was called.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

828 Parameters in in

Class Documentation

item -- the item to be selected. Must not be NULL. docallback -- A ag that determines if the callback() is invoked or not: 0 - the callback() is not invoked 1 - the callback() is invoked if item changed state, callback_reason() will be FL_TREE_REASON_SELECTED

Returns 1 - items state was changed 0 - item was already selected, no change was made

30.135.2.54

int Fl Tree::select ( const char path, int docallback = 1 ) [inline]

Select the item specied by path (eg: "Parent/child/item"). Handles redrawing if anything was actually changed. Invokes the callback depending on the value of optional parameter docallback. Items or submenus that themselves contain slashes (/ or \) should be escaped, e.g. select("Holidays/12\\/25\//2010"). The callback can use callback_item() and callback_reason() respectively to determine the item changed and the reason the callback was called. Parameters in in

path -- the tree items pathname (e.g. "Flintstones/Fred") docallback -- A ag that determines if the callback() is invoked or not: 0 - the callback() is not invoked 1 - the callback() is invoked if item changed state, callback_reason() will be FL_TREE_REASON_SELECTED

Returns 1 : OK: items state was changed 0 : OK: item was already selected, no change was made -1 : ERROR: item was not found

30.135.2.55

int Fl Tree::select all ( Fl_Tree_Item item = 0, int docallback = 1 )

Select item and all its children. If item is NULL, rst() is used. Handles calling redraw() if anything was changed. Invokes the callback depending on the value of optional parameter docallback. The callback can use callback_item() and callback_reason() respectively to determine the item changed and the reason the callback was called.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.135 Fl_Tree Class Reference Parameters in in

829

item The item that will be selected (along with all its children). If NULL, rst() is used. docallback -- A ag that determines if the callback() is invoked or not: 0 - the callback() is not invoked 1 - the callback() is invoked for each item that changed state, callback_reason() will be FL_TREE_REASON_SELECTED

Returns count of how many items were actually changed to the selected state.

30.135.2.56

int Fl Tree::select only ( Fl_Tree_Item selitem, int docallback = 1 )

Select only the specied item, deselecting all others that might be selected. If item is 0, rst() is used. Handles calling redraw() if anything was changed. Invokes the callback depending on the value of optional parameter docallback. The callback can use callback_item() and callback_reason() respectively to determine the item changed and the reason the callback was called. Parameters in in

selitem The item to be selected. If NULL, rst() is used. docallback -- A ag that determines if the callback() is invoked or not: 0 - the callback() is not invoked 1 - the callback() is invoked for each item that changed state, callback_reason() will be either FL_TREE_REASON_SELECTED or FL_TREE_REASON_DESELECTED

Returns the number of items whose selection states were changed, if any.

30.135.2.57

void Fl Tree::select toggle ( Fl_Tree_Item item, int docallback = 1 ) [inline]

Toggle the select state of the specied item. Handles redrawing if anything was actually changed. Invokes the callback depending on the value of optional parameter docallback. The callback can use callback_item() and callback_reason() respectively to determine the item changed and the reason the callback was called.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

830 Parameters in in

Class Documentation

item -- the item to be selected. Must not be NULL. docallback -- A ag that determines if the callback() is invoked or not: 0 - the callback() is not invoked 1 - the callback() is invoked, callback_reason() will be either FL_TREE_REASON_SELECTED or FL_TREE_REASON_DESELECTED

30.135.2.58 Fl_Boxtype Fl Tree::selectbox ( ) const [inline] Sets the style of box used to draw selected items. This is an tk Fl_Boxtype. The default is inuenced by FLTKs current Fl::scheme() 30.135.2.59 void Fl Tree::selectbox ( Fl_Boxtype val ) [inline]

Gets the style of box used to draw selected items. This is an tk Fl_Boxtype. The default is inuenced by FLTKs current Fl::scheme() 30.135.2.60 void Fl Tree::set item focus ( Fl_Tree_Item item )

Set the item that currently should have keyboard focus. Handles calling redraw() to update the focus box (if it is visible). Parameters in

item The item that should take focus. If NULL, none will have focus.

30.135.2.61

void Fl Tree::show item ( Fl_Tree_Item item, int yoff )

Adjust the vertical scroll bar so that item is visible yoff pixels from the top of the Fl_Tree widgets display. For instance, yoff=0 will position the item at the top. If yoff is larger than the vertical scrollbars limit, the value will be clipped. So if yoff=100, but scrollbars max is 50, then 50 will be used. Parameters in in

item The item to be shown. If NULL, rst() is used. yoff The pixel offset from the top for the displayed position.

See also show_item_top(), show_item_middle(), show_item_bottom()

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.135 Fl_Tree Class Reference 30.135.2.62 void Fl Tree::show item ( Fl_Tree_Item item )

831

Adjust the vertical scroll bar to show item at the top of the display IF it is currently off-screen (e.g. show_item_top()). If it is already on-screen, no change is made. Parameters in

item The item to be shown. If NULL, rst() is used.

See also show_item_top(), show_item_middle(), show_item_bottom()

30.135.2.63

void Fl Tree::show item bottom ( Fl_Tree_Item item )

Adjust the vertical scrollbar so that item is at the bottom of the display. Parameters in

item The item to be shown. If NULL, rst() is used.

30.135.2.64

void Fl Tree::show item middle ( Fl_Tree_Item item )

Adjust the vertical scrollbar so that item is in the middle of the display. Parameters in

item The item to be shown. If NULL, rst() is used.

30.135.2.65

void Fl Tree::show item top ( Fl_Tree_Item item )

Adjust the vertical scrollbar so that item is at the top of the display. Parameters in

item The item to be shown. If NULL, rst() is used.

30.135.2.66

void Fl Tree::show self ( ) [inline]

Print the tree as ascii art to stdout. Used mainly for debugging. 30.135.2.67 void Fl Tree::showcollapse ( int val ) [inline]

Set if we should show the collapse icon or not. If collapse icons are disabled, the user will not be able to interactively collapse items in the tree, unless the application provides some other means via open() and close().
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

832 Parameters in

Class Documentation

val 1: shows collapse icons (default), 0: hides collapse icons.

30.135.2.68

void Fl Tree::showroot ( int val ) [inline]

Set if the root item should be shown or not. Parameters in

val 1 -- show the root item (default) 0 -- hide the root item.

30.135.2.69 Fl_Tree_Sort Fl Tree::sortorder ( ) const [inline] Set the default sort order used when items are added to the tree. See Fl_Tree_Sort for possible values. 30.135.2.70 Fl_Image Fl Tree::usericon ( ) const [inline] Returns the Fl_Image being used as the default user icon for all newly created items. Returns zero if no icon has been set, which is the default. 30.135.2.71 void Fl Tree::usericon ( Fl_Image val ) [inline]

Sets the Fl_Image to be used as the default user icon for all newly created items. If you want to specify user icons on a per-item basis, use Fl_Tree_Item::usericon() instead. Parameters in

val -- The new image to be used, or zero to disable user icons.

30.135.2.72

int Fl Tree::vposition ( ) const

Returns the vertical scroll position as a pixel offset. The position returned is how many pixels of the tree are scrolled off the top edge of the screen. Example: A position of 3 indicates the top 3 pixels of the tree are scrolled off the top edge of the screen. See also vposition(), hposition()

30.135.2.73

void Fl Tree::vposition ( int pos )

Sets the vertical scroll offset to position pos.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.136 Fl_Tree_Item Class Reference

833

The position is how many pixels of the tree are scrolled off the top edge of the screen. Example: A position of 3 scrolls the top three pixels of the tree off the top edge of the screen. Parameters in

pos The vertical position (in pixels) to scroll the browser to.

The documentation for this class was generated from the following les: Fl_Tree.H Fl_Tree.cxx

30.136
Tree item.

Fl Tree Item Class Reference

#include <Fl_Tree_Item.H>

Public Member Functions


void activate (int val=1)
Change the items activation state to the optionally specied val.

Fl_Tree_Item add (const Fl_Tree_Prefs &prefs, const char new_label)


Add a new child to this item with the name new_label, with defaults from prefs.

Fl_Tree_Item add (const Fl_Tree_Prefs &prefs, char arr)


Descend into the path specied by arr, and add a new child there.

Fl_Tree_Item child (int index)


Return the child item for the given index.

const Fl_Tree_Item child (int t) const


Return the const child item for the given index.

int children () const


Return the number of children this item has.

void clear_children ()
Clear all the children for this item.

void close ()
Close this item and all its children.

void deactivate ()
Deactivate the item; the callback() wont be invoked when clicked.

int depth () const


Returns how many levels deep this item is in the hierarchy.

void deselect ()
Disable the items selection state.

int deselect_all ()
Deselect self and all children Returns count of how many items were in the selected state, ie.

void draw (int X, int &Y, int W, Fl_Widget tree, Fl_Tree_Item itemfocus, const Fl_Tree_Prefs &prefs, int lastchild=1)
Draw this item and its children.

int event_on_collapse_icon (const Fl_Tree_Prefs &prefs) const


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

834
Was the event on the collapse button?

Class Documentation

int event_on_label (const Fl_Tree_Prefs &prefs) const


Was event on the label()?

int nd_child (const char name)


Return the index of the immediate child of this item that has the label name.

int nd_child (Fl_Tree_Item item)


Find the index number for the specied item in the current items list of children.

const Fl_Tree_Item nd_child_item (char arr) const


Find child item by descending array of names.

Fl_Tree_Item nd_child_item (char arr)


Find child item by descending array of names.

const Fl_Tree_Item nd_clicked (const Fl_Tree_Prefs &prefs) const


Find the item that the last event was over.

Fl_Tree_Item nd_clicked (const Fl_Tree_Prefs &prefs)


Non-const version of the above.

const Fl_Tree_Item nd_item (char arr) const


Find item by descending array of names.

Fl_Tree_Item nd_item (char arr)


Find item by descending array of names.

Fl_Tree_Item (const Fl_Tree_Prefs &prefs)


Constructor.

Fl_Tree_Item (const Fl_Tree_Item o)


Copy constructor.

int h () const int has_children () const


See if this item has children.

Fl_Tree_Item insert (const Fl_Tree_Prefs &prefs, const char new_label, int pos=0)
Insert a new item into current items children at a specied position.

Fl_Tree_Item insert_above (const Fl_Tree_Prefs &prefs, const char new_label)


Insert a new item above this item.

char is_activated () const


See if the item is activated.

char is_active () const


See if the item is activated.

int is_close () const


See if the item is closed.

int is_open () const


See if the item is open.

int is_root () const


Is this item the root of the tree?

char is_selected () const


See if the item is selected.

void label (const char val)


Set the label. Makes a copy of the name.

const char label () const


Return the label.

void labelbgcolor (Fl_Color val)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.136 Fl_Tree_Item Class Reference


Set items label background color.

835

Fl_Color labelbgcolor () const


Return items background text color.

void labelcolor (Fl_Color val)


Set items label text color.

Fl_Color labelcolor () const


Return items label text color.

void labelfgcolor (Fl_Color val)


Set items label foreground text color.

Fl_Color labelfgcolor () const


Return items label foreground text color.

void labelfont (Fl_Font val)


Set items label font face.

Fl_Font labelfont () const


Get items label font face.

void labelsize (Fl_Fontsize val)


Set items label font size.

Fl_Fontsize labelsize () const


Get items label font size.

Fl_Tree_Item next ()
Return the next item in the tree.

Fl_Tree_Item next_displayed (Fl_Tree_Prefs &prefs)


Return the next visible item.

Fl_Tree_Item next_sibling ()
Return this items next sibling.

void open ()
Open this item and all its children.

void open_toggle ()
Toggle the items open/closed state.

Fl_Tree_Item parent ()
Return the parent for this item. Returns NULL if we are the root.

const Fl_Tree_Item parent () const


Return the const parent for this item. Returns NULL if we are the root.

void parent (Fl_Tree_Item val)


Set the parent for this item.

Fl_Tree_Item prev ()
Return the previous item in the tree.

Fl_Tree_Item prev_displayed (Fl_Tree_Prefs &prefs)


Return the previous visible item.

Fl_Tree_Item prev_sibling ()
Return this items previous sibling.

int remove_child (Fl_Tree_Item item)


Remove child by item.

int remove_child (const char new_label)


Remove immediate child (and its children) by its label name.

void select (int val=1)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

836
Change the items selection state to the optionally specied val.

Class Documentation

int select_all ()
Select self and all children Returns count of how many items were in the deselected state, ie.

void select_toggle ()
Toggle the items selection state.

void show_self (const char indent="") const


Print the tree as ascii art to stdout.

void swap_children (int ax, int bx)


Swap two of our children, given two child index values.

int swap_children (Fl_Tree_Item a, Fl_Tree_Item b)


Swap two of our children, given item pointers.

void user_data (void data)


Set a user-data value for the item.

void user_data () const


Retrieve the user-data value that has been assigned to the item.

void usericon (Fl_Image val)


Set the user icons image. 0 will disable.

Fl_Image usericon () const


Get the user icon. Returns 0 if disabled.

int visible () const


See if the item is visible.

int visible_r () const


Returns if item and all its parents are visible.

int w () const void widget (Fl_Widget val)


Assign an FLTK widget to this item.

Fl_Widget widget () const


Return FLTK widget assigned to this item.

int x () const int y () const

Protected Member Functions


void draw_horizontal_connector (int x1, int x2, int y, const Fl_Tree_Prefs &prefs)
Internal: Horizontal connector line based on preference settings.

void draw_vertical_connector (int x, int y1, int y2, const Fl_Tree_Prefs &prefs)
Internal: Vertical connector line based on preference settings.

void hide_widgets ()
Internal: Hide the FLTK widget() for this item and all children.

void show_widgets ()
Internal: Show the FLTK widget() for this item and all children.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.136 Fl_Tree_Item Class Reference

837

30.136.1
Tree item.

Detailed Description

This class is a single tree item, and manages all of the items attributes. Fl_Tree_Item is used by Fl_Tree, which is comprised of many instances of Fl_Tree_Item. Fl_Tree_Item is hierarchical; it dynamically manages an Fl_Tree_Item_Array of children that are themselves instances of Fl_Tree_Item. Each item can have zero or more children. When an item has children, close() and open() can be used to hide or show them. Items have their own attributes; font size, face, color. Items maintain their own hierarchy of children. When you make changes to items, youll need to tell the tree to redraw() for the changes to show up.

30.136.2
30.136.2.1

Constructor & Destructor Documentation


Fl Tree Item::Fl Tree Item ( const Fl_Tree_Prefs & prefs )

Constructor. Makes a new instance of Fl_Tree_Item using defaults from prefs.

30.136.3
30.136.3.1

Member Function Documentation


void Fl Tree Item::activate ( int val = 1 ) [inline]

Change the items activation state to the optionally specied val. When deactivated, the item will be grayed out; the callback() wont be invoked if the user clicks on the label. If the item has a widget() associated with the item, its activation state will be changed as well. If val is not specied, the item will be activated. 30.136.3.2 Fl_Tree_Item Fl Tree Item::add ( const Fl_Tree_Prefs & prefs, const char new label ) Add a new child to this item with the name new_label, with defaults from prefs. An internally managed copy is made of the label string. Adds the item based on the value of prefs.sortorder(). 30.136.3.3 Fl_Tree_Item Fl Tree Item::add ( const Fl_Tree_Prefs & prefs, char arr ) Descend into the path specied by arr, and add a new child there. Should be used only by Fl_Trees internals. Adds the item based on the value of prefs.sortorder(). Returns the item added.

30.136.3.4

const Fl_Tree_Item Fl Tree Item::child ( int t ) const

Return the const child item for the given index.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

838 Return child item for the specied index.

Class Documentation

30.136.3.5

void Fl Tree Item::deactivate ( ) [inline]

Deactivate the item; the callback() wont be invoked when clicked. Same as activate(0)

30.136.3.6

int Fl Tree Item::depth ( ) const

Returns how many levels deep this item is in the hierarchy. For instance; root has a depth of zero, and its immediate children would have a depth of 1, and so on.

30.136.3.7

int Fl Tree Item::deselect all ( ) [inline]

Deselect self and all children Returns count of how many items were in the selected state, ie. how many items were "changed".

30.136.3.8

int Fl Tree Item::nd child ( const char name )

Return the index of the immediate child of this item that has the label name. Returns index of found item, or -1 if not found.

30.136.3.9

int Fl Tree Item::nd child ( Fl_Tree_Item item )

Find the index number for the specied item in the current items list of children. Returns the index, or -1 if not found.

30.136.3.10

const Fl_Tree_Item Fl Tree Item::nd child item ( char arr ) const

Find child item by descending array of names. Does not include self in search. Only Fl_Tree should need this method. Returns item, or 0 if not found

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.136 Fl_Tree_Item Class Reference 30.136.3.11 Fl_Tree_Item Fl Tree Item::nd child item ( char arr ) Find child item by descending array of names.

839

Does not include self in search. Only Fl_Tree should need this method. Use Fl_Tree::nd_item() instead. Returns item, or 0 if not found

30.136.3.12

const Fl_Tree_Item Fl Tree Item::nd clicked ( const Fl_Tree_Prefs & prefs ) const

Find the item that the last event was over. Returns the item if it is visible, and mouse is over it. Works even if widget deactivated. Use event_on_collapse_icon() to determine if collapse button was pressed. Returns const visible item under the event if found, or 0 if none.

30.136.3.13 Fl_Tree_Item Fl Tree Item::nd clicked ( const Fl_Tree_Prefs & prefs ) Non-const version of the above. Find the item that the last event was over. Returns the item if it is visible, and mouse is over it. Works even if widget deactivated. Use event_on_collapse_icon() to determine if collapse button was pressed. Returns the visible item under the event if found, or 0 if none.

30.136.3.14

const Fl_Tree_Item Fl Tree Item::nd item ( char names ) const

Find item by descending array of names. Includes self in search. Only Fl_Tree should need this method. Use Fl_Tree::nd_item() instead. Returns item, or 0 if not found

30.136.3.15 Fl_Tree_Item Fl Tree Item::nd item ( char names ) Find item by descending array of names. Includes self in search. Only Fl_Tree should need this method. Returns item, or 0 if not found

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

840 30.136.3.16 void Fl Tree Item::hide widgets ( ) [protected]

Class Documentation

Internal: Hide the FLTK widget() for this item and all children. Used by close() to hide widgets. 30.136.3.17 Fl_Tree_Item Fl Tree Item::insert ( const Fl_Tree_Prefs & prefs, const char new label, int pos = 0 ) Insert a new item into current items children at a specied position. Returns the new item inserted.

30.136.3.18 Fl_Tree_Item Fl Tree Item::insert above ( const Fl_Tree_Prefs & prefs, const char new label ) Insert a new item above this item. Returns the new item inserted, or 0 if an error occurred.

30.136.3.19 Fl_Tree_Item Fl Tree Item::next ( ) Return the next item in the tree. This method can be used to walk the tree forward. For an example of how to use this method, see Fl_Tree::rst(). Returns the next item in the tree, or 0 if theres no more items.

30.136.3.20 Fl_Tree_Item Fl Tree Item::next displayed ( Fl_Tree_Prefs & prefs ) Return the next visible item. (If this item has children and is closed, children are skipped) This method can be used to walk the tree forward, skipping items that are not currently visible to the user. Returns the next visible item below us, or 0 if theres no more items.

30.136.3.21 Fl_Tree_Item Fl Tree Item::next sibling ( ) Return this items next sibling. Moves to the next item below us at the same level (sibling). Use this to move down the tree without moving deeper into the tree, effectively skipping over this items children/descendents.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.136 Fl_Tree_Item Class Reference Returns items next sibling, or 0 if none.

841

30.136.3.22

void Fl Tree Item::parent ( Fl_Tree_Item val ) [inline]

Set the parent for this item. Should only be used by Fl_Trees internals. 30.136.3.23 Fl_Tree_Item Fl Tree Item::prev ( ) Return the previous item in the tree. This method can be used to walk the tree backwards. For an example of how to use this method, see Fl_Tree::last(). Returns the previous item in the tree, or 0 if theres no item above this one (hit the root).

30.136.3.24 Fl_Tree_Item Fl Tree Item::prev displayed ( Fl_Tree_Prefs & prefs ) Return the previous visible item. (If this item above us has children and is closed, its children are skipped) This method can be used to walk the tree backward, skipping items that are not currently visible to the user. Returns the previous visible item above us, or 0 if theres no more items.

30.136.3.25 Fl_Tree_Item Fl Tree Item::prev sibling ( ) Return this items previous sibling. Moves to the previous item above us at the same level (sibling). Use this to move up the tree without moving deeper into the tree. Returns This items previous sibling, or 0 if none.

30.136.3.26

int Fl Tree Item::remove child ( Fl_Tree_Item item )

Remove child by item. Returns 0 if removed, -1 if item not an immediate child.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

842 30.136.3.27 int Fl Tree Item::remove child ( const char name )

Class Documentation

Remove immediate child (and its children) by its label name. Returns 0 if removed, -1 if not found.

30.136.3.28

void Fl Tree Item::select ( int val = 1 ) [inline]

Change the items selection state to the optionally specied val. If val is not specied, the item will be selected. 30.136.3.29 int Fl Tree Item::select all ( ) [inline]

Select self and all children Returns count of how many items were in the deselected state, ie. how many items were "changed". 30.136.3.30 void Fl Tree Item::show self ( const char indent = "" ) const

Print the tree as ascii art to stdout. Used mainly for debugging. 30.136.3.31 void Fl Tree Item::show widgets ( ) [protected]

Internal: Show the FLTK widget() for this item and all children. Used by open() to re-show widgets that were hidden by a previous close() 30.136.3.32 void Fl Tree Item::swap children ( int ax, int bx )

Swap two of our children, given two child index values. Use this eg. for sorting. This method is FAST, and does not involve lookups. No range checking is done on either index value. Returns 0 : OK -1 : failed: a or b is not our immediate child

30.136.3.33

int Fl Tree Item::swap children ( Fl_Tree_Item a, Fl_Tree_Item b )

Swap two of our children, given item pointers. Use this eg. for sorting. This method is SLOW because it involves linear lookups. For speed, use swap_children(int,int) instead.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.137 Fl_Tree_Item_Array Class Reference Returns 0 : OK -1 : failed: a or b is not our immediate child

843

30.136.3.34

int Fl Tree Item::visible r ( ) const

Returns if item and all its parents are visible. Also takes into consideration if any parent is close()ed. Returns 1 -- item and its parents are visible/open() 0 -- item (or parents) invisible or close()ed. The documentation for this class was generated from the following les: Fl_Tree_Item.H Fl_Tree_Item.cxx

30.137

Fl Tree Item Array Class Reference

Manages an array of Fl_Tree_Item pointers. #include <Fl_Tree_Item_Array.H>

Public Member Functions


void add (Fl_Tree_Item val)
Add an item to the end of the array.

void clear ()
Clear the entire array.

Fl_Tree_Item_Array (int new_chunksize=10)


Constructor; creates an empty array.

Fl_Tree_Item_Array (const Fl_Tree_Item_Array o)


Copy constructor. Makes new copy of array, with new instances of each item.

void insert (int pos, Fl_Tree_Item new_item)


Insert an item at index position pos.

Fl_Tree_Item operator[ ] (int i)


Return the item and index i.

const Fl_Tree_Item operator[ ] (int i) const


Const version of operator[ ](int i)

void remove (int index)


Remove the item at.

int remove (Fl_Tree_Item item)


Remove the item from the array.

void swap (int ax, int bx)


Swap the two items at index positions ax and bx.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

844 int total () const


Return the total items in the array, or 0 if empty.

Class Documentation

Fl_Tree_Item_Array ()
Destructor. Calls each items destructor, destroys internal _items array.

30.137.1

Detailed Description

Manages an array of Fl_Tree_Item pointers. Because FLTK 1.x.x. has mandated that templates and STL not be used, we use this class to dynamically manage the arrays. None of the methods do range checking on index values; the caller must be sure that index values are within the range 0<index<total() (unless otherwise noted).

30.137.2
30.137.2.1

Constructor & Destructor Documentation


Fl Tree Item Array::Fl Tree Item Array ( int new chunksize = 10 )

Constructor; creates an empty array. The optional chunksize can be specied to optimize memory allocation for potentially large arrays. Default chunksize is 10.

30.137.3
30.137.3.1

Member Function Documentation


void Fl Tree Item Array::add ( Fl_Tree_Item val )

Add an item to the end of the array. Assumes the item was created with new, and will remain allocated.. Fl_Tree_Item_Array will handle calling the items destructor when the array is cleared or the item remove()ed. 30.137.3.2 void Fl Tree Item Array::clear ( )

Clear the entire array. Each item will be deleted (destructors will be called), and the array will be cleared. total() will return 0. 30.137.3.3 void Fl Tree Item Array::insert ( int pos, Fl_Tree_Item new item )

Insert an item at index position pos. Handles enlarging array if needed, total increased by 1. If pos == total(), an empty item is appended to the array. 30.137.3.4 void Fl Tree Item Array::remove ( int index )

Remove the item at.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.138 Fl_Tree_Prefs Class Reference Parameters in

845

index from the array.

The item will be deleted (if non-NULL), so its destructor will be called. 30.137.3.5 int Fl Tree Item Array::remove ( Fl_Tree_Item item )

Remove the item from the array. Returns 0 if removed, or -1 if the item was not in the array. The documentation for this class was generated from the following les: Fl_Tree_Item_Array.H Fl_Tree_Item_Array.cxx

30.138

Fl Tree Prefs Class Reference

Tree widgets preferences. #include <Fl_Tree_Prefs.H>

Public Member Functions


Fl_Image closeicon () const
Gets the default close icon Returns the Fl_Image of the icon, or 0 if none.

void closeicon (Fl_Image val)


Sets the icon to be used as the close icon.

Fl_Color connectorcolor () const


Get the connector color used for tree connection lines.

void connectorcolor (Fl_Color val)


Set the connector color used for tree connection lines.

Fl_Tree_Connector connectorstyle () const


Get the connector style.

void connectorstyle (Fl_Tree_Connector val)


Set the connector style.

void connectorstyle (int val)


Set the connector style [integer].

int connectorwidth () const


Get the tree connection lines width.

void connectorwidth (int val)


Set the tree connection lines width.

Fl_Tree_Prefs ()
Fl_Tree_Prefs constructor.

Fl_Color labelbgcolor () const


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

846
Get the default label background color.

Class Documentation

void labelbgcolor (Fl_Color val)


Set the default label background color.

Fl_Color labelfgcolor () const


Get the default label foreground color.

void labelfgcolor (Fl_Color val)


Set the default label foreground color.

Fl_Font labelfont () const


Return the labels font.

void labelfont (Fl_Font val)


Set the labels font to val.

int labelmarginleft () const


Get the labels left margin value in pixels.

void labelmarginleft (int val)


Set the labels left margin value in pixels.

Fl_Fontsize labelsize () const


Return the labels size in pixels.

void labelsize (Fl_Fontsize val)


Set the labels size in pixels to val.

int linespacing () const


Get the line spacing value in pixels.

void linespacing (int val)


Set the line spacing value in pixels.

int marginleft () const


Get the left margins value in pixels.

void marginleft (int val)


Set the left margins value in pixels.

int margintop () const


Get the top margins value in pixels.

void margintop (int val)


Set the top margins value in pixels.

int openchild_marginbottom () const


Get the margin below an open child in pixels.

void openchild_marginbottom (int val)


Set the margin below an open child in pixels.

Fl_Image openicon () const


Get the current default open icon.

void openicon (Fl_Image val)


Sets the default icon to be used as the open icon when items are add()ed to the tree.

Fl_Boxtype selectbox () const


Get the default selection boxs box drawing style as an Fl_Boxtype.

void selectbox (Fl_Boxtype val)


Set the default selection boxs box drawing style to val.

Fl_Tree_Select selectmode () const


Get the selection mode used for the tree.

void selectmode (Fl_Tree_Select val)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.138 Fl_Tree_Prefs Class Reference


Set the selection mode used for the tree to val.

847

char showcollapse () const


Returns 1 if the collapse icon is enabled, 0 if not.

void showcollapse (int val)


Set if we should show the collapse icon or not.

int showroot () const


Returns 1 if the root item is to be shown, or 0 if not.

void showroot (int val)


Set if the root item should be shown or not.

Fl_Tree_Sort sortorder () const


Get the default sort order value.

void sortorder (Fl_Tree_Sort val)


Set the default sort order value.

Fl_Image usericon () const


Gets the default user icon (default is 0)

void usericon (Fl_Image val)


Sets the default user icon Returns the Fl_Image of the icon, or 0 if none (default).

int usericonmarginleft () const


Get the user icons left margin value in pixels.

void usericonmarginleft (int val)


Set the user icons left margin value in pixels.

30.138.1

Detailed Description

Tree widgets preferences. Fl_Trees Preferences class. This class manages the Fl_Trees defaults. You should probably be using the methods in Fl_Tree instead of trying to accessing trees preferences settings directly.

30.138.2
30.138.2.1

Member Function Documentation


void Fl Tree Prefs::closeicon ( Fl_Image val )

Sets the icon to be used as the close icon. This overrides the built in default [-] icon. Parameters in

val -- The new image, or zero to use the default [-] icon.

30.138.2.2 Fl_Font Fl Tree Prefs::labelfont ( ) const [inline] Return the labels font.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

848 30.138.2.3 Fl_Image Fl Tree Prefs::openicon ( ) const [inline] Get the current default open icon. Returns the Fl_Image of the icon, or 0 if none. 30.138.2.4 void Fl Tree Prefs::openicon ( Fl_Image val )

Class Documentation

Sets the default icon to be used as the open icon when items are add()ed to the tree. This overrides the built in default [+] icon. Parameters in

val -- The new image, or zero to use the default [+] icon.

30.138.2.5

void Fl Tree Prefs::selectmode ( Fl_Tree_Select val ) [inline]

Set the selection mode used for the tree to val. This affects how items in the tree are selected when clicked on and dragged over by the mouse. See Fl_Tree_Select for possible values. 30.138.2.6 char Fl Tree Prefs::showcollapse ( ) const [inline]

Returns 1 if the collapse icon is enabled, 0 if not. 30.138.2.7 void Fl Tree Prefs::showcollapse ( int val ) [inline]

Set if we should show the collapse icon or not. If collapse icons are disabled, the user will not be able to interactively collapse items in the tree, unless the application provides some other means via open() and close(). Parameters in

val 1: shows collapse icons (default), 0: hides collapse icons.

30.138.2.8

void Fl Tree Prefs::showroot ( int val ) [inline]

Set if the root item should be shown or not. Parameters in

val 1 -- show the root item (default) 0 -- hide the root item.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.139 Fl_Valuator Class Reference 30.138.2.9 void Fl Tree Prefs::sortorder ( Fl_Tree_Sort val ) [inline]

849

Set the default sort order value. Denes the order new items appear when add()ed to the tree. See Fl_Tree_Sort for possible values. The documentation for this class was generated from the following les: Fl_Tree_Prefs.H Fl_Tree_Prefs.cxx

30.139

Fl Valuator Class Reference

The Fl_Valuator class controls a single oating-point value and provides a consistent interface to set the value, range, and step, and insures that callbacks are done the same for every object. #include <Fl_Valuator.H> Inheritance diagram for Fl_Valuator:
Fl_Widget Fl_Valuator Fl_Adjuster Fl_Counter Fl_Simple_Counter Fl_Dial Fl_Roller Fl_Fill_Dial Fl_Line_Dial Fl_Slider Fl_Value_Input Fl_Fill_Slider Fl_Hor_Fill_Slider Fl_Hor_Nice_Slider Fl_Hor_Slider Fl_Nice_Slider Fl_Scrollbar Fl_Value_Slider Fl_Value_Output

Public Member Functions


void bounds (double a, double b)
Sets the minimum (a) and maximum (b) values for the valuator widget.

double clamp (double)


Clamps the passed value to the valuator range.

virtual int format (char )


Uses internal rules to format the elds numerical value into the character array pointed to by the passed parameter.

double increment (double, int)


Adds n times the step value to the passed value.

double maximum () const


Gets the maximum value for the valuator.

void maximum (double a)


Sets the maximum value for the valuator.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

850 double minimum () const


Gets the minimum value for the valuator.

Class Documentation

void minimum (double a)


Sets the minimum value for the valuator.

void precision (int)


Sets the step value to 1/10digits .

void range (double a, double b)


Sets the minimum and maximum values for the valuator.

double round (double)


Round the passed value to the nearest step increment.

void step (int a)


See double Fl_Valuator::step() const.

void step (double a, int b)


See double Fl_Valuator::step() const.

void step (double s)


See double Fl_Valuator::step() const.

double step () const


Gets or sets the step value.

double value () const


Gets the oating point(double) value.

int value (double)


Sets the current value.

Protected Member Functions


Fl_Valuator (int X, int Y, int W, int H, const char L)
Creates a new Fl_Valuator widget using the given position, size, and label string.

void handle_drag (double newvalue)


Called during a drag operation, after an FL_WHEN_CHANGED event is received and before the callback.

void handle_push ()
Stores the current value in the previous value.

void handle_release ()
Called after an FL_WHEN_RELEASE event is received and before the callback.

int horizontal () const


Tells if the valuator is an FL_HORIZONTAL one.

double previous_value () const


Gets the previous oating point value before an event changed it.

void set_value (double v)


Sets the current oating point value.

double softclamp (double)


Clamps the value, but accepts v if the previous value is not already out of range.

virtual void value_damage ()


Asks for partial redraw.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.139 Fl_Valuator Class Reference

851

30.139.1

Detailed Description

The Fl_Valuator class controls a single oating-point value and provides a consistent interface to set the value, range, and step, and insures that callbacks are done the same for every object. There are probably more of these classes in FLTK than any others:

Figure 30.39: Valuators derived from Fl_Valuators

In the above diagram each box surrounds an actual subclass. These are further differentiated by setting the type() of the widget t o the symbolic value labeling the widget. The ones labelled "0" are the default versions with a type(0). For consistency the symbol FL_VERTICAL is dened as zero.

30.139.2
30.139.2.1

Constructor & Destructor Documentation


Fl Valuator::Fl Valuator ( int X, int Y, int W, int H, const char L ) [protected]

Creates a new Fl_Valuator widget using the given position, size, and label string. The default boxtype is FL_NO_BOX.

30.139.3
30.139.3.1

Member Function Documentation


void Fl Valuator::bounds ( double a, double b ) [inline]

Sets the minimum (a) and maximum (b) values for the valuator widget. Reimplemented in Fl_Slider.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

852 30.139.3.2 double Fl Valuator::clamp ( double v )

Class Documentation

Clamps the passed value to the valuator range. 30.139.3.3 int Fl Valuator::format ( char buffer ) [virtual]

Uses internal rules to format the elds numerical value into the character array pointed to by the passed parameter. The actual format used depends on the current step value. If the step value has been set to zero then a g format is used. If the step value is non-zero, then a %.f format is used, where the precision is calculated to show sufcient digits for the current step value. An integer step value, such as 1 or 1.0, gives a precision of 0, so the formatted value will appear as an integer. This method is used by the Fl_Value_... group of widgets to format the current value into a text string. The return value is the length of the formatted text. The formatted value is written into in buffer. buffer should have space for at least 128 bytes. You may override this function to create your own text formatting. 30.139.3.4 void Fl Valuator::handle drag ( double v ) [protected]

Called during a drag operation, after an FL_WHEN_CHANGED event is received and before the callback. 30.139.3.5 void Fl Valuator::handle release ( ) [protected]

Called after an FL_WHEN_RELEASE event is received and before the callback. 30.139.3.6 double Fl Valuator::increment ( double v, int n )

Adds n times the step value to the passed value. If step was set to zero it uses fabs(maximum() - minimum()) / 100. 30.139.3.7 double Fl Valuator::maximum ( ) const [inline]

Gets the maximum value for the valuator. 30.139.3.8 void Fl Valuator::maximum ( double a ) [inline]

Sets the maximum value for the valuator. 30.139.3.9 double Fl Valuator::minimum ( ) const [inline]

Gets the minimum value for the valuator. 30.139.3.10 void Fl Valuator::minimum ( double a ) [inline]

Sets the minimum value for the valuator.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.139 Fl_Valuator Class Reference 30.139.3.11 void Fl Valuator::precision ( int p )

853

Sets the step value to 1/10digits .

30.139.3.12

void Fl Valuator::range ( double a, double b ) [inline]

Sets the minimum and maximum values for the valuator. When the user manipulates the widget, the value is limited to this range. This clamping is done after rounding to the step value (this makes a difference if the range is not a multiple of the step). The minimum may be greater than the maximum. This has the effect of "reversing" the object so the larger values are in the opposite direction. This also switches which end of the lled sliders is lled. Some widgets consider this a "soft" range. This means they will stop at the range, but if the user releases and grabs the control again and tries to move it further, it is allowed. The range may affect the display. You must redraw() the widget after changing the range.

30.139.3.13

double Fl Valuator::round ( double v )

Round the passed value to the nearest step increment. Does nothing if step is zero.

30.139.3.14

void Fl Valuator::set value ( double v ) [inline, protected]

Sets the current oating point value.

30.139.3.15

double Fl Valuator::step ( ) const [inline]

Gets or sets the step value. As the user moves the mouse the value is rounded to the nearest multiple of the step value. This is done before clamping it to the range. For most widgets the default step is zero. For precision the step is stored as the ratio of two integers, A/B. You can set these integers directly. Currently setting a oating point value sets the nearest A/1 or 1/B value possible. Reimplemented in Fl_Counter.

30.139.3.16

double Fl Valuator::value ( ) const [inline]

Gets the oating point(double) value. See int value(double) Reimplemented in Fl_Scrollbar.

30.139.3.17

int Fl Valuator::value ( double v )

Sets the current value.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

854

Class Documentation

The new value is not clamped or otherwise changed before storing it. Use clamp() or round() to modify the value before calling value(). The widget is redrawn if the new value is different than the current one. The initial value is zero. changed() will return true if the user has moved the slider, but it will be turned off by value(x) and just before doing a callback (the callback can turn it back on if desired). The documentation for this class was generated from the following les: Fl_Valuator.H Fl_Valuator.cxx

30.140

Fl Value Input Class Reference

The Fl_Value_Input widget displays a numeric value. #include <Fl_Value_Input.H> Inheritance diagram for Fl_Value_Input:

Fl_Widget Fl_Valuator Fl_Value_Input

Public Member Functions


Fl_Color cursor_color () const
Gets the color of the text cursor.

void cursor_color (Fl_Color n)


Sets the color of the text cursor.

Fl_Value_Input (int x, int y, int w, int h, const char l=0)


Creates a new Fl_Value_Input widget using the given position, size, and label string.

int handle (int)


Handles the specied event.

void resize (int, int, int, int)


Changes the size or position of the widget.

int shortcut () const


Returns the current shortcut key for the Input.

void shortcut (int s)


Sets the shortcut key to s.

void soft (char s)


See void Fl_Value_Input::soft(char s)

char soft () const


If "soft" is turned on, the user is allowed to drag the value outside the range.

Fl_Color textcolor () const


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.140 Fl_Value_Input Class Reference


Gets the color of the text in the value box.

855

void textcolor (Fl_Color n)


Sets the color of the text in the value box.

Fl_Font textfont () const


Gets the typeface of the text in the value box.

void textfont (Fl_Font s)


Sets the typeface of the text in the value box.

Fl_Fontsize textsize () const


Gets the size of the text in the value box.

void textsize (Fl_Fontsize s)


Sets the size of the text in the value box.

Public Attributes
Fl_Input input

Protected Member Functions


void draw ()
Draws the widget.

30.140.1

Detailed Description

The Fl_Value_Input widget displays a numeric value. The user can click in the text eld and edit it - there is in fact a hidden Fl_Input widget with type(FL_FLOAT_INPUT) or type(FL_INT_INPUT) in there - and when they hit return or tab the value updates to what they typed and the callback is done. If step() is non-zero and integral, then the range of numbers is limited to integers instead of oating point numbers. As well as displaying the value as an integer, typed input is also limited to integer values, even if the hidden Fl_Input widget is of type(FL_FLOAT_INPUT). If step() is non-zero, the user can also drag the mouse across the object and thus slide the value. The left button moves one step() per pixel, the middle by 10 step(), and the right button by 100 step(). It is therefore impossible to select text by dragging across it, although clicking can still move the insertion cursor. If step() is non-zero and integral, then the range of numbers are limited to integers instead of oating point values.

Figure 30.40: Fl_Value_Input

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

856

Class Documentation

30.140.2
30.140.2.1

Constructor & Destructor Documentation


Fl Value Input::Fl Value Input ( int X, int Y, int W, int H, const char l = 0 )

Creates a new Fl_Value_Input widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX.

30.140.3

Member Function Documentation

30.140.3.1 Fl_Color Fl Value Input::cursor color ( ) const [inline] Gets the color of the text cursor. The text cursor is black by default. 30.140.3.2 void Fl Value Input::cursor color ( Fl_Color n ) [inline]

Sets the color of the text cursor. The text cursor is black by default. 30.140.3.3 void Fl Value Input::draw ( ) [protected, virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Implements Fl_Widget. 30.140.3.4 int Fl Value Input::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.140 Fl_Value_Input Class Reference Return values 0 if the event was not used or understood 1 if the event was used and can be deleted

857

See also Fl_Event Reimplemented from Fl_Widget. 30.140.3.5 void Fl Value Input::resize ( int x, int y, int w, int h ) [virtual]

Changes the size or position of the widget. This is a virtual function so that the widget may implement its own handling of resizing. The default version does not call the redraw() method, but instead relies on the parent widget to do so because the parent may know a faster way to update the display, such as scrolling from the old position. Some window managers under X11 call resize() a lot more often than needed. Please verify that the position or size of a widget did actually change before doing any extensive calculations. position(X, Y) is a shortcut for resize(X, Y, w(), h()), and size(W, H) is a shortcut for resize(x(), y(), W, H). Parameters in in See also position(int,int), size(int,int) Reimplemented from Fl_Widget. 30.140.3.6 int Fl Value Input::shortcut ( ) const [inline]

x,y new position relative to the parent window w,h new size

Returns the current shortcut key for the Input. See also Fl_Value_Input::shortcut(int)

30.140.3.7

void Fl Value Input::shortcut ( int s ) [inline]

Sets the shortcut key to s. Setting this overrides the use of & in the label(). The value is a bitwise OR of a key and a set of shift ags, for example FL_ALT | a , FL_ALT | (FL_F + 10), or just a. A value of 0 disables the shortcut. The key can be any value returned by Fl::event_key(), but will usually be an ASCII letter. Use a lower-case letter unless you require the shift key to be held down. The shift ags can be any set of values accepted by Fl::event_state(). If the bit is on that shift key must be pushed. Meta, Alt, Ctrl, and Shift must be off if they are not in the shift ags (zero for the other bits indicates a "dont care" setting).
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

858 30.140.3.8 char Fl Value Input::soft ( ) const [inline]

Class Documentation

If "soft" is turned on, the user is allowed to drag the value outside the range. If they drag the value to one of the ends, let go, then grab again and continue to drag, they can get to any value. The default is true.

30.140.3.9 Fl_Color Fl Value Input::textcolor ( ) const [inline] Gets the color of the text in the value box.

30.140.3.10

void Fl Value Input::textcolor ( Fl_Color n ) [inline]

Sets the color of the text in the value box.

30.140.3.11 Fl_Font Fl Value Input::textfont ( ) const [inline] Gets the typeface of the text in the value box.

30.140.3.12

void Fl Value Input::textfont ( Fl_Font s ) [inline]

Sets the typeface of the text in the value box.

30.140.3.13 Fl_Fontsize Fl Value Input::textsize ( ) const [inline] Gets the size of the text in the value box.

30.140.3.14

void Fl Value Input::textsize ( Fl_Fontsize s ) [inline]

Sets the size of the text in the value box. The documentation for this class was generated from the following les: Fl_Value_Input.H Fl_Value_Input.cxx

30.141

Fl Value Output Class Reference

The Fl_Value_Output widget displays a oating point value. #include <Fl_Value_Output.H> Inheritance diagram for Fl_Value_Output:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.141 Fl_Value_Output Class Reference

859

Fl_Widget Fl_Valuator Fl_Value_Output

Public Member Functions


Fl_Value_Output (int x, int y, int w, int h, const char l=0)
Creates a new Fl_Value_Output widget using the given position, size, and label string.

int handle (int)


Handles the specied event.

void soft (uchar s)


If "soft" is turned on, the user is allowed to drag the value outside the range.

uchar soft () const


If "soft" is turned on, the user is allowed to drag the value outside the range.

Fl_Color textcolor () const


Sets the color of the text in the value box.

void textcolor (Fl_Color s)


Gets the color of the text in the value box.

Fl_Font textfont () const


Gets the typeface of the text in the value box.

void textfont (Fl_Font s)


Sets the typeface of the text in the value box.

Fl_Fontsize textsize () const


Gets the size of the text in the value box.

void textsize (Fl_Fontsize s)

Protected Member Functions


void draw ()
Draws the widget.

30.141.1

Detailed Description

The Fl_Value_Output widget displays a oating point value. If step() is not zero, the user can adjust the value by dragging the mouse left and right. The left button moves one step() per pixel, the middle by 10 step(), and the right button by 100 step(). This is much lighter-weight than Fl_Value_Input because it contains no text editing code or character buffer.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

860

Class Documentation

Figure 30.41: Fl_Value_Output

30.141.2
30.141.2.1

Constructor & Destructor Documentation


Fl Value Output::Fl Value Output ( int X, int Y, int W, int H, const char l = 0 )

Creates a new Fl_Value_Output widget using the given position, size, and label string. The default boxtype is FL_NO_BOX. Inherited destructor destroys the Valuator.

30.141.3
30.141.3.1

Member Function Documentation


void Fl Value Output::draw ( ) [protected, virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Implements Fl_Widget. 30.141.3.2 int Fl Value Output::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.141 Fl_Value_Output Class Reference Return values 0 if the event was not used or understood 1 if the event was used and can be deleted

861

See also Fl_Event Reimplemented from Fl_Widget. 30.141.3.3 void Fl Value Output::soft ( uchar s ) [inline]

If "soft" is turned on, the user is allowed to drag the value outside the range. If they drag the value to one of the ends, let go, then grab again and continue to drag, they can get to any value. Default is one. 30.141.3.4 uchar Fl Value Output::soft ( ) const [inline] If "soft" is turned on, the user is allowed to drag the value outside the range. If they drag the value to one of the ends, let go, then grab again and continue to drag, they can get to any value. Default is one. 30.141.3.5 Fl_Color Fl Value Output::textcolor ( ) const [inline] Sets the color of the text in the value box. 30.141.3.6 void Fl Value Output::textcolor ( Fl_Color s ) [inline]

Gets the color of the text in the value box. 30.141.3.7 Fl_Font Fl Value Output::textfont ( ) const [inline] Gets the typeface of the text in the value box. 30.141.3.8 void Fl Value Output::textfont ( Fl_Font s ) [inline]

Sets the typeface of the text in the value box. 30.141.3.9 Fl_Fontsize Fl Value Output::textsize ( ) const [inline] Gets the size of the text in the value box. The documentation for this class was generated from the following les: Fl_Value_Output.H Fl_Value_Output.cxx
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

862

Class Documentation

30.142

Fl Value Slider Class Reference

The Fl_Value_Slider widget is a Fl_Slider widget with a box displaying the current value. #include <Fl_Value_Slider.H> Inheritance diagram for Fl_Value_Slider:
Fl_Widget Fl_Valuator Fl_Slider Fl_Value_Slider Fl_Hor_Value_Slider

Public Member Functions


Fl_Value_Slider (int x, int y, int w, int h, const char l=0)
Creates a new Fl_Value_Slider widget using the given position, size, and label string.

int handle (int)


Handles the specied event.

Fl_Color textcolor () const


Gets the color of the text in the value box.

void textcolor (Fl_Color s)


Sets the color of the text in the value box.

Fl_Font textfont () const


Gets the typeface of the text in the value box.

void textfont (Fl_Font s)


Sets the typeface of the text in the value box.

Fl_Fontsize textsize () const


Gets the size of the text in the value box.

void textsize (Fl_Fontsize s)


Sets the size of the text in the value box.

Protected Member Functions


void draw ()
Draws the widget.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.142 Fl_Value_Slider Class Reference

863

30.142.1

Detailed Description

The Fl_Value_Slider widget is a Fl_Slider widget with a box displaying the current value.

Figure 30.42: Fl_Value_Slider

30.142.2
30.142.2.1

Constructor & Destructor Documentation


Fl Value Slider::Fl Value Slider ( int X, int Y, int W, int H, const char l = 0 )

Creates a new Fl_Value_Slider widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX.

30.142.3
30.142.3.1

Member Function Documentation


void Fl Value Slider::draw ( ) [protected, virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Reimplemented from Fl_Slider. 30.142.3.2 int Fl Value Slider::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

864 Parameters in

Class Documentation

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted

See also Fl_Event Reimplemented from Fl_Slider. 30.142.3.3 Fl_Color Fl Value Slider::textcolor ( ) const [inline] Gets the color of the text in the value box. 30.142.3.4 void Fl Value Slider::textcolor ( Fl_Color s ) [inline]

Sets the color of the text in the value box. 30.142.3.5 Fl_Font Fl Value Slider::textfont ( ) const [inline] Gets the typeface of the text in the value box. 30.142.3.6 void Fl Value Slider::textfont ( Fl_Font s ) [inline]

Sets the typeface of the text in the value box. 30.142.3.7 Fl_Fontsize Fl Value Slider::textsize ( ) const [inline] Gets the size of the text in the value box. 30.142.3.8 void Fl Value Slider::textsize ( Fl_Fontsize s ) [inline]

Sets the size of the text in the value box. The documentation for this class was generated from the following les: Fl_Value_Slider.H Fl_Value_Slider.cxx

30.143

Fl Widget Class Reference

Fl_Widget is the base class for all widgets in FLTK. #include <Fl_Widget.H>
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.143 Fl_Widget Class Reference Inheritance diagram for Fl_Widget:


Fl_Widget Fl_Box Fl_Button Fl_Chart Fl_Clock_Output Fl_FormsBitmap Fl_FormsPixmap Fl_Free Fl_Group Fl_Input_ Fl_Menu_ Fl_Positioner Fl_Progress Fl_Timer Fl_Valuator

865

Public Member Functions


void activate ()
Activates the widget.

unsigned int active () const


Returns whether the widget is active.

int active_r () const


Returns whether the widget and all of its parents are active.

Fl_Align align () const


Gets the label alignment.

void align (Fl_Align alignment)


Sets the label alignment.

long argument () const


Gets the current user data (long) argument that is passed to the callback function.

void argument (long v)


Sets the current user data (long) argument that is passed to the callback function.

virtual class Fl_Gl_Window as_gl_window ()


Returns an Fl_Gl_Window pointer if this widget is an Fl_Gl_Window.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

866 virtual Fl_Group as_group ()


Returns an Fl_Group pointer if this widget is an Fl_Group.

Class Documentation

virtual Fl_Window as_window ()


Returns an Fl_Window pointer if this widget is an Fl_Window.

Fl_Boxtype box () const


Gets the box type of the widget.

void box (Fl_Boxtype new_box)


Sets the box type for the widget.

Fl_Callback_p callback () const


Gets the current callback function for the widget.

void callback (Fl_Callback cb, void p)


Sets the current callback function for the widget.

void callback (Fl_Callback cb)


Sets the current callback function for the widget.

void callback (Fl_Callback0 cb)


Sets the current callback function for the widget.

void callback (Fl_Callback1 cb, long p=0)


Sets the current callback function for the widget.

unsigned int changed () const


Checks if the widget value changed since the last callback.

void clear_changed ()
Marks the value of the widget as unchanged.

void clear_damage (uchar c=0)


Clears or sets the damage ags.

void clear_output ()
Sets a widget to accept input.

void clear_visible ()
Hides the widget.

void clear_visible_focus ()
Disables keyboard focus navigation with this widget.

Fl_Color color () const


Gets the background color of the widget.

void color (Fl_Color bg)


Sets the background color of the widget.

void color (Fl_Color bg, Fl_Color sel)


Sets the background and selection color of the widget.

Fl_Color color2 () const


For back compatibility only.

void color2 (unsigned a)


For back compatibility only.

int contains (const Fl_Widget w) const


Checks if w is a child of this widget.

void copy_label (const char new_label)


Sets the current label.

void copy_tooltip (const char text)


Sets the current tooltip text.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.143 Fl_Widget Class Reference uchar damage () const


Returns non-zero if draw() needs to be called.

867

void damage (uchar c)


Sets the damage bits for the widget.

void damage (uchar c, int x, int y, int w, int h)


Sets the damage bits for an area inside the widget.

int damage_resize (int, int, int, int)


Internal use only.

void deactivate ()
Deactivates the widget.

Fl_Image deimage ()
Gets the image that is used as part of the widget label.

const Fl_Image deimage () const void deimage (Fl_Image img)


Sets the image to use as part of the widget label.

void deimage (Fl_Image &img)


Sets the image to use as part of the widget label.

void do_callback ()
Calls the widget callback.

void do_callback (Fl_Widget o, long arg)


Calls the widget callback.

void do_callback (Fl_Widget o, void arg=0)


Calls the widget callback.

virtual void draw ()=0


Draws the widget.

void draw_label (int, int, int, int, Fl_Align) const


Draws the label in an arbitrary bounding box with an arbitrary alignment.

int h () const
Gets the widget height.

virtual int handle (int event)


Handles the specied event.

virtual void hide ()


Makes a widget invisible.

Fl_Image image ()
Gets the image that is used as part of the widget label.

const Fl_Image image () const void image (Fl_Image img)


Sets the image to use as part of the widget label.

void image (Fl_Image &img)


Sets the image to use as part of the widget label.

int inside (const Fl_Widget w) const


Checks if this widget is a child of w.

const char label () const


Gets the current label text.

void label (const char text)


Sets the current label pointer.

void label (Fl_Labeltype a, const char b)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

868
Shortcut to set the label text and type in one call.

Class Documentation

Fl_Color labelcolor () const


Gets the label color.

void labelcolor (Fl_Color c)


Sets the label color.

Fl_Font labelfont () const


Gets the font to use.

void labelfont (Fl_Font f)


Sets the font to use.

Fl_Fontsize labelsize () const


Gets the font size in pixels.

void labelsize (Fl_Fontsize pix)


Sets the font size in pixels.

Fl_Labeltype labeltype () const


Gets the label type.

void labeltype (Fl_Labeltype a)


Sets the label type.

void measure_label (int &ww, int &hh) const


Sets width ww and height hh accordingly with the label size.

unsigned int output () const


Returns if a widget is used for output only.

Fl_Group parent () const


Returns a pointer to the parent widget.

void parent (Fl_Group p)


Internal use only - "for hacks only".

void position (int X, int Y)


Repositions the window or widget.

void redraw ()
Schedules the drawing of the widget.

void redraw_label ()
Schedules the drawing of the label.

virtual void resize (int x, int y, int w, int h)


Changes the size or position of the widget.

Fl_Color selection_color () const


Gets the selection color.

void selection_color (Fl_Color a)


Sets the selection color.

void set_changed ()
Marks the value of the widget as changed.

void set_output ()
Sets a widget to output only.

void set_visible ()
Makes the widget visible.

void set_visible_focus ()
Enables keyboard focus navigation with this widget.

virtual void show ()


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.143 Fl_Widget Class Reference


Makes a widget visible.

869

void size (int W, int H)


Changes the size of the widget.

int take_focus ()
Gives the widget the keyboard focus.

unsigned int takesevents () const


Returns if the widget is able to take events.

int test_shortcut ()
Returns true if the widgets label contains the entered &x shortcut.

const char tooltip () const


Gets the current tooltip text.

void tooltip (const char text)


Sets the current tooltip text.

uchar type () const


Gets the widget type.

void type (uchar t)


Sets the widget type.

void user_data () const


Gets the user data for this widget.

void user_data (void v)


Sets the user data for this widget.

unsigned int visible () const


Returns whether a widget is visible.

void visible_focus (int v)


Modies keyboard focus navigation.

unsigned int visible_focus ()


Checks whether this widget has a visible focus.

int visible_r () const


Returns whether a widget and all its parents are visible.

int w () const
Gets the widget width.

Fl_When when () const


Returns the conditions under which the callback is called.

void when (uchar i)


Sets the ags used to decide when a callback is called.

Fl_Window window () const


Returns a pointer to the primary Fl_Window widget.

int x () const
Gets the widget position in its window.

int y () const
Gets the widget position in its window.

virtual Fl_Widget ()
Destroys the widget.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

870

Class Documentation

Static Public Member Functions


static void default_callback (Fl_Widget cb, void d)
Sets the default callback for all widgets.

static unsigned int label_shortcut (const char t)


Returns the Unicode value of the &x shortcut in a given text.

static int test_shortcut (const char , const bool require_alt=false)


Returns true if the given text t contains the entered &x shortcut.

Protected Types
enum { INACTIVE = 1<<0, INVISIBLE = 1<<1, OUTPUT = 1<<2, NOBORDER = 1<<3, FORCE_POSITION = 1<<4, NON_MODAL = 1<<5, SHORTCUT_LABEL = 1<<6, CHANGED = 1<<7, OVERRIDE = 1<<8, VISIBLE_FOCUS = 1<<9, COPIED_LABEL = 1<<10, CLIP_CHILDREN = 1<<11, MENU_WINDOW = 1<<12, TOOLTIP_WINDOW = 1<<13, MODAL = 1<<14, NO_OVERLAY = 1<<15, GROUP_RELATIVE = 1<<16, COPIED_TOOLTIP = 1<<17, USERFLAG3 = 1<<29, USERFLAG2 = 1<<30, USERFLAG1 = 1<<31 }
ags possible values enumeration.

Protected Member Functions


void clear_ag (unsigned int c)
Clears a ag in the ags mask.

void draw_backdrop () const


If FL_ALIGN_IMAGE_BACKDROP is set, the image or deimage will be drawn.

void draw_box () const


Draws the widget box according its box style.

void draw_box (Fl_Boxtype t, Fl_Color c) const


Draws a box of type t, of color c at the widgets position and size.

void draw_box (Fl_Boxtype t, int x, int y, int w, int h, Fl_Color c) const


Draws a box of type t, of color c at the position X,Y and size W,H.

void draw_focus ()
draws a focus rectangle around the widget

void draw_focus (Fl_Boxtype t, int x, int y, int w, int h) const


Draws a focus box for the widget at the given position and size.

void draw_label () const


Draws the widgets label at the dened label position.

void draw_label (int, int, int, int) const


Draws the label in an arbitrary bounding box.

Fl_Widget (int x, int y, int w, int h, const char label=0L)


Creates a widget at the given position and size.

unsigned int ags () const


Gets the widget ags mask.

void h (int v)
Internal use only.

void set_ag (unsigned int c)


Sets a ag in the ags mask.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.143 Fl_Widget Class Reference void w (int v)


Internal use only.

871

void x (int v)
Internal use only.

void y (int v)
Internal use only.

Friends
class Fl_Group

30.143.1

Detailed Description

Fl_Widget is the base class for all widgets in FLTK. You cant create one of these because the constructor is not public. However you can subclass it. All "property" accessing methods, such as color(), parent(), or argument() are implemented as trivial inline functions and thus are as fast and small as accessing elds in a structure. Unless otherwise noted, the property setting methods such as color(n) or label(s) are also trivial inline functions, even if they change the widgets appearance. It is up to the user code to call redraw() after these.

30.143.2
30.143.2.1

Member Enumeration Documentation


anonymous enum [protected]

ags possible values enumeration. See activate(), output(), visible(), changed(), set_visible_focus() Enumerator: INACTIVE the widget cant receive focus, and is disabled but potentially visible INVISIBLE the widget is not drawn, but can receive a few special events OUTPUT for output only NOBORDER dont draw a decoration (Fl_Window) FORCE_POSITION dont let the window manager position the window (Fl_Window) NON_MODAL this is a hovering toolbar window (Fl_Window) SHORTCUT_LABEL the label contains a shortcut we need to draw CHANGED the widget value changed OVERRIDE position window on top (Fl_Window) VISIBLE_FOCUS accepts keyboard focus navigation if the widget can have the focus COPIED_LABEL the widget label is internally copied, its destruction is handled by the widget CLIP_CHILDREN all drawing within this widget will be clipped (Fl_Group) MENU_WINDOW a temporary popup window, dismissed by clicking outside (Fl_Window) TOOLTIP_WINDOW a temporary popup, transparent to events, and dismissed easily (Fl_Window) MODAL a window blocking input to all other winows (Fl_Window)
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

872

Class Documentation NO_OVERLAY window not using a hardware overlay plane (Fl_Menu_Window) GROUP_RELATIVE position this widget relative to the parent group, not to the window COPIED_TOOLTIP the widget tooltip is internally copied, its destruction is handled by the widget USERFLAG3 reserved for 3rd party extensions USERFLAG2 reserved for 3rd party extensions USERFLAG1 reserved for 3rd party extensions

30.143.3
30.143.3.1

Constructor & Destructor Documentation


Fl Widget::Fl Widget ( int x, int y, int w, int h, const char label = 0L ) [protected]

Creates a widget at the given position and size. The Fl_Widget is a protected constructor, but all derived widgets have a matching public constructor. It takes a value for x(), y(), w(), h(), and an optional value for label(). Parameters in in in

x,y the position of the widget relative to the enclosing window w,h size of the widget in pixels label optional text for the widget label

30.143.3.2

Fl Widget::Fl Widget ( ) [virtual]

Destroys the widget. Destroys the widget, taking care of throwing focus before if any. Destroying single widgets is not very common. You almost always want to destroy the parent group instead, which will destroy all of the child widgets and groups in that group. Since FLTK 1.3, the widgets destructor removes the widget from its parent group, if it is member of a group. Destruction removes the widget from any parent group! And groups when destroyed destroy all their children. This is convenient and fast.

30.143.4
30.143.4.1

Member Function Documentation


void Fl Widget::activate ( )

Activates the widget. Changing this value will send FL_ACTIVATE to the widget if active_r() is true. See also active(), active_r(), deactivate()

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.143 Fl_Widget Class Reference 30.143.4.2 unsigned int Fl Widget::active ( ) const [inline]

873

Returns whether the widget is active. Return values 0 if the widget is inactive

See also active_r(), activate(), deactivate()

30.143.4.3

int Fl Widget::active r ( ) const

Returns whether the widget and all of its parents are active. Return values 0 if this or any of the parent widgets are inactive

See also active(), activate(), deactivate()

30.143.4.4 Fl_Align Fl Widget::align ( ) const [inline] Gets the label alignment. Returns label alignment

See also label(), align(Fl_Align), Fl_Align

30.143.4.5

void Fl Widget::align ( Fl_Align alignment ) [inline]

Sets the label alignment. This controls how the label is displayed next to or inside the widget. The default value is FL_ALIGN_CENTER, which centers the label inside the widget. Parameters in

alignment new label alignment

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

874 See also align(), Fl_Align

Class Documentation

30.143.4.6

void Fl Widget::argument ( long v ) [inline]

Sets the current user data (long) argument that is passed to the callback function. Todo The user data value must be implemented using intptr_t or similar to avoid 64-bit machine incompatibilities.

30.143.4.7

virtual class Fl_Gl_Window Fl Widget::as gl window ( ) [inline, virtual]

Returns an Fl_Gl_Window pointer if this widget is an Fl_Gl_Window. Use this method if you have a widget (pointer) and need to know whether this widget is derived from Fl_Gl_Window. If it returns non-NULL, then the widget in question is derived from Fl_Gl_Window. Return values NULL if this widget is not derived from Fl_Gl_Window.

Note This method is provided to avoid dynamic_cast.

See also Fl_Widget::as_group(), Fl_Widget::as_window() Reimplemented in Fl_Gl_Window. 30.143.4.8 virtual Fl_Group Fl Widget::as group ( ) [inline, virtual]

Returns an Fl_Group pointer if this widget is an Fl_Group. Use this method if you have a widget (pointer) and need to know whether this widget is derived from Fl_Group. If it returns non-NULL, then the widget in question is derived from Fl_Group, and you can use the returned pointer to access its children or other Fl_Group-specic methods. Example:
void my_callback (Fl_Widget *w, void *) { Fl_Group *g = w->as_group(); if (g) printf ("This group has %d children\n",g->children()); else printf ("This widget is not a group!\n"); }

Return values NULL if this widget is not derived from Fl_Group.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.143 Fl_Widget Class Reference Note This method is provided to avoid dynamic_cast.

875

See also Fl_Widget::as_window(), Fl_Widget::as_gl_window() Reimplemented in Fl_Group. 30.143.4.9 virtual Fl_Window Fl Widget::as window ( ) [inline, virtual]

Returns an Fl_Window pointer if this widget is an Fl_Window. Use this method if you have a widget (pointer) and need to know whether this widget is derived from Fl_Window. If it returns non-NULL, then the widget in question is derived from Fl_Window, and you can use the returned pointer to access its children or other Fl_Window-specic methods. Return values NULL if this widget is not derived from Fl_Window. Note This method is provided to avoid dynamic_cast. See also Fl_Widget::as_group(), Fl_Widget::as_gl_window() Reimplemented in Fl_Window. 30.143.4.10 Fl_Boxtype Fl Widget::box ( ) const [inline] Gets the box type of the widget. Returns the current box type See also box(Fl_Boxtype), Fl_Boxtype

30.143.4.11

void Fl Widget::box ( Fl_Boxtype new box ) [inline]

Sets the box type for the widget. This identies a routine that draws the background of the widget. See Fl_Boxtype for the available types. The default depends on the widget, but is usually FL_NO_BOX or FL_UP_BOX. Parameters
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

876

Class Documentation

in

new_box the new box type

See also box(), Fl_Boxtype

30.143.4.12 Fl_Callback_p Fl Widget::callback ( ) const [inline] Gets the current callback function for the widget. Each widget has a single callback. Returns current callback

30.143.4.13

void Fl Widget::callback ( Fl_Callback cb, void p ) [inline]

Sets the current callback function for the widget. Each widget has a single callback. Parameters in in

cb new callback p user data

30.143.4.14

void Fl Widget::callback ( Fl_Callback cb ) [inline]

Sets the current callback function for the widget. Each widget has a single callback. Parameters in

cb new callback

30.143.4.15

void Fl Widget::callback ( Fl_Callback0 cb ) [inline]

Sets the current callback function for the widget. Each widget has a single callback. Parameters in

cb new callback

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.143 Fl_Widget Class Reference 30.143.4.16 void Fl Widget::callback ( Fl_Callback1 cb, long p = 0 ) [inline]

877

Sets the current callback function for the widget. Each widget has a single callback. Parameters in in

cb new callback p user data

30.143.4.17

unsigned int Fl Widget::changed ( ) const [inline]

Checks if the widget value changed since the last callback. "Changed" is a ag that is turned on when the user changes the value stored in the widget. This is only used by subclasses of Fl_Widget that store values, but is in the base class so it is easier to scan all the widgets in a panel and do_callback() on the changed ones in response to an "OK" button. Most widgets turn this ag off when they do the callback, and when the program sets the stored value. Return values 0 if the value did not change

See also set_changed(), clear_changed() Reimplemented in Fl_Input_Choice. 30.143.4.18 void Fl Widget::clear changed ( ) [inline]

Marks the value of the widget as unchanged. See also changed(), set_changed() Reimplemented in Fl_Input_Choice. 30.143.4.19 void Fl Widget::clear damage ( uchar c = 0 ) [inline]

Clears or sets the damage ags. Damage ags are cleared when parts of the widget drawing is repaired. The optional argument c species the bits that are set after the call (default: 0) and not the bits that are cleared! Note Therefore it is possible to set damage bits with this method, but this should be avoided. Use damage(uchar) instead.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

878 Parameters in

Class Documentation

c new bitmask of damage ags (default: 0)

See also damage(uchar), damage()

30.143.4.20

void Fl Widget::clear output ( ) [inline]

Sets a widget to accept input. See also set_output(), output()

30.143.4.21

void Fl Widget::clear visible ( ) [inline]

Hides the widget. You must still redraw the parent to see a change in the window. Normally you want to use the hide() method instead.

30.143.4.22

void Fl Widget::clear visible focus ( ) [inline]

Disables keyboard focus navigation with this widget. Normally, all widgets participate in keyboard focus navigation. See also set_visible_focus(), visible_focus(), visible_focus(int)

30.143.4.23 Fl_Color Fl Widget::color ( ) const [inline] Gets the background color of the widget. Returns current background color

See also color(Fl_Color), color(Fl_Color, Fl_Color)

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.143 Fl_Widget Class Reference 30.143.4.24 void Fl Widget::color ( Fl_Color bg ) [inline]

879

Sets the background color of the widget. The color is passed to the box routine. The color is either an index into an internal table of RGB colors or an RGB color value generated using _rgb_color(). The default for most widgets is FL_BACKGROUND_COLOR. Use Fl::set_color() to redene colors in the color map. Parameters in

bg background color

See also color(), color(Fl_Color, Fl_Color), selection_color(Fl_Color)

30.143.4.25

void Fl Widget::color ( Fl_Color bg, Fl_Color sel ) [inline]

Sets the background and selection color of the widget. The two color form sets both the background and selection colors. Parameters in in

bg background color sel selection color

See also color(unsigned), selection_color(unsigned)

30.143.4.26 Fl_Color Fl Widget::color2 ( ) const [inline] For back compatibility only. Deprecated Use selection_color() instead.

30.143.4.27

void Fl Widget::color2 ( unsigned a ) [inline]

For back compatibility only. Deprecated Use selection_color(unsigned) instead.

30.143.4.28

int Fl Widget::contains ( const Fl_Widget w ) const

Checks if w is a child of this widget.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

880 Parameters in

Class Documentation

w potential child widget

Returns Returns 1 if w is a child of this widget, or is equal to this widget. Returns 0 if w is NULL.

30.143.4.29

void Fl Widget::copy label ( const char new label )

Sets the current label. Unlike label(), this method allocates a copy of the label string instead of using the original string pointer. The internal copy will automatically be freed whenever you assign a new label or when the widget is destroyed. Parameters in

new_label the new label text

See also label() Reimplemented in Fl_Window. 30.143.4.30 void Fl Widget::copy tooltip ( const char text )

Sets the current tooltip text. Unlike tooltip(), this method allocates a copy of the tooltip string instead of using the original string pointer. The internal copy will automatically be freed whenever you assign a new tooltip or when the widget is destroyed. If no tooltip is set, the tooltip of the parent is inherited. Setting a tooltip for a group and setting no tooltip for a child will show the groups tooltip instead. To avoid this behavior, you can set the childs tooltip to an empty string (""). Parameters in

text New tooltip text (an internal copy is made and managed)

See also tooltip(const char), tooltip()

30.143.4.31 uchar Fl Widget::damage ( ) const [inline] Returns non-zero if draw() needs to be called. The damage value is actually a bit eld that the widget subclass can use to gure out what parts to draw.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.143 Fl_Widget Class Reference Returns a bitmap of ags describing the kind of damage to the widget

881

See also damage(uchar), clear_damage(uchar)

30.143.4.32

void Fl Widget::damage ( uchar c )

Sets the damage bits for the widget. Setting damage bits will schedule the widget for the next redraw. Parameters in

c bitmask of ags to set

See also damage(), clear_damage(uchar)

30.143.4.33

void Fl Widget::damage ( uchar c, int x, int y, int w, int h )

Sets the damage bits for an area inside the widget. Setting damage bits will schedule the widget for the next redraw. Parameters in in

c bitmask of ags to set x,y,w,h size of damaged area

See also damage(), clear_damage(uchar)

30.143.4.34

int Fl Widget::damage resize ( int X, int Y, int W, int H )

Internal use only. 30.143.4.35 void Fl Widget::deactivate ( )

Deactivates the widget. Inactive widgets will be drawn "grayed out", e.g. with less contrast than the active widget. Inactive widgets will not receive any keyboard or mouse button events. Other events (including FL_ENTER, FL_MOVE, FL_LEAVE, FL_SHORTCUT, and others) will still be sent. A widget is only active if active() is true on it and all of its parents. Changing this value will send FL_DEACTIVATE to the widget if active_r() is true.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

882 Currently you cannot deactivate Fl_Window widgets. See also activate(), active(), active_r() Reimplemented in Fl_Repeat_Button. 30.143.4.36

Class Documentation

void Fl Widget::default callback ( Fl_Widget cb, void d ) [static]

Sets the default callback for all widgets. Sets the default callback, which puts a pointer to the widget on the queue returned by Fl::readqueue(). You may want to call this from your own callback. Parameters in in

cb the new callback d user data associated with that callback

See also callback(), do_callback(), Fl::readqueue()

30.143.4.37 Fl_Image Fl Widget::deimage ( ) [inline] Gets the image that is used as part of the widget label. This image is used when drawing the widget in the inactive state. Returns the current image for the deactivated widget

30.143.4.38

void Fl Widget::deimage ( Fl_Image img ) [inline]

Sets the image to use as part of the widget label. This image is used when drawing the widget in the inactive state. Parameters in

img the new image for the deactivated widget

30.143.4.39

void Fl Widget::deimage ( Fl_Image & img ) [inline]

Sets the image to use as part of the widget label. This image is used when drawing the widget in the inactive state.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.143 Fl_Widget Class Reference Parameters in

883

img the new image for the deactivated widget

30.143.4.40

void Fl Widget::do callback ( ) [inline]

Calls the widget callback. Causes a widget to invoke its callback function with default arguments. See also callback()

30.143.4.41

void Fl Widget::do callback ( Fl_Widget o, long arg ) [inline]

Calls the widget callback. Causes a widget to invoke its callback function with arbitrary arguments. Parameters in in

o call the callback with o as the widget argument arg call the callback with arg as the user data argument

See also callback()

30.143.4.42

void Fl Widget::do callback ( Fl_Widget o, void arg = 0 )

Calls the widget callback. Causes a widget to invoke its callback function with arbitrary arguments. Parameters in in See also callback()

o call the callback with o as the widget argument arg use arg as the user data argument

30.143.4.43

virtual void Fl Widget::draw ( ) [pure virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

884

Class Documentation

If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Implemented in Fl_Table, Fl_Text_Display, Fl_Input, Fl_Gl_Window, Fl_Tree, Fl_Browser_, Fl_Scroll, Fl_Button, Fl_Chart, Fl_Choice, Fl_Window, Fl_Slider, Fl_Value_Input, Fl_File_Input, Fl_Tabs, Fl_Counter, Fl_Free, Fl_Clock_Output, Fl_Dial, Fl_Cairo_Window, Fl_Menu_Bar, Fl_Pack, Fl_Group, Fl_Menu_Button, Fl_Scrollbar, Fl_Positioner, Fl_Adjuster, Fl_Timer, Fl_Value_Output, Fl_Glut_Window, Fl_Progress, Fl_Light_Button, Fl_Value_Slider, Fl_Roller, Fl_Box, Fl_Return_Button, Fl_FormsPixmap, Fl_Sys_Menu_Bar, and Fl_FormsBitmap. 30.143.4.44 void Fl Widget::draw box ( Fl_Boxtype t, Fl_Color c ) const [protected]

Draws a box of type t, of color c at the widgets position and size. 30.143.4.45 void Fl Widget::draw box ( Fl_Boxtype t, int X, int Y, int W, int H, Fl_Color c ) const [protected]

Draws a box of type t, of color c at the position X,Y and size W,H. 30.143.4.46 void Fl Widget::draw label ( ) const [protected]

Draws the widgets label at the dened label position. This is the normal call for a widgets draw() method. 30.143.4.47 void Fl Widget::draw label ( int X, int Y, int W, int H ) const [protected]

Draws the label in an arbitrary bounding box. draw() can use this instead of draw_label(void) to change the bounding box 30.143.4.48 void Fl Widget::draw label ( int X, int Y, int W, int H, Fl_Align a ) const

Draws the label in an arbitrary bounding box with an arbitrary alignment. Anybody can call this to force the label to draw anywhere. 30.143.4.49 void Fl Widget::h ( int v ) [inline, protected]

Internal use only. Use position(int,int), size(int,int) or resize(int,int,int,int) instead. 30.143.4.50 int Fl Widget::h ( ) const [inline]

Gets the widget height.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.143 Fl_Widget Class Reference Returns the height of the widget in pixels.

885

30.143.4.51

int Fl Widget::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted

See also Fl_Event Reimplemented in Fl_Table, Fl_Input, Fl_Tree, Fl_Browser_, Fl_Window, Fl_Spinner, Fl_Scroll, Fl_Table_Row, Fl_Clock, Fl_Text_Display, Fl_Check_Browser, Fl_Button, Fl_Gl_Window, Fl_Choice, Fl_Slider, Fl_Tile, Fl_Menu_Button, Fl_Tabs, Fl_Value_Input, Fl_Counter, Fl_File_Input, Fl_Free, Fl_Group, Fl_Dial, Fl_Menu_Bar, Fl_Scrollbar, Fl_Text_Editor, Fl_Box, Fl_Positioner, Fl_Value_Output, Fl_Timer, Fl_Glut_Window, Fl_Adjuster, Fl_Light_Button, Fl_Value_Slider, Fl_Roller, Fl_Return_Button, and Fl_Repeat_Button. 30.143.4.52 void Fl Widget::hide ( ) [virtual]

Makes a widget invisible. See also show(), visible(), visible_r() Reimplemented in Fl_Window, Fl_Browser, Fl_Gl_Window, Fl_Double_Window, Fl_Overlay_Window, and Fl_Menu_Window. 30.143.4.53 Fl_Image Fl Widget::image ( ) [inline] Gets the image that is used as part of the widget label. This image is used when drawing the widget in the active state.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

886 Returns the current image

Class Documentation

30.143.4.54

void Fl Widget::image ( Fl_Image img ) [inline]

Sets the image to use as part of the widget label. This image is used when drawing the widget in the active state. Parameters in

img the new image for the label

30.143.4.55

void Fl Widget::image ( Fl_Image & img ) [inline]

Sets the image to use as part of the widget label. This image is used when drawing the widget in the active state. Parameters in

img the new image for the label

30.143.4.56

int Fl Widget::inside ( const Fl_Widget w ) const [inline]

Checks if this widget is a child of w. Returns 1 if this widget is a child of w, or is equal to w. Returns 0 if w is NULL. Parameters in

w the possible parent widget.

See also contains()

30.143.4.57

const char Fl Widget::label ( ) const [inline]

Gets the current label text. Returns a pointer to the current label text See also label(const char ), copy_label(const char ) Reimplemented in Fl_Window.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.143 Fl_Widget Class Reference 30.143.4.58 void Fl Widget::label ( const char text )

887

Sets the current label pointer. The label is shown somewhere on or next to the widget. The passed pointer is stored unchanged in the widget (the string is not copied), so if you need to set the label to a formatted value, make sure the buffer is static, global, or allocated. The copy_label() method can be used to make a copy of the label string automatically. Parameters in

text pointer to new label text

See also copy_label() Reimplemented in Fl_Window. 30.143.4.59 void Fl Widget::label ( Fl_Labeltype a, const char b ) [inline]

Shortcut to set the label text and type in one call. See also label(const char ), labeltype(Fl_Labeltype)

30.143.4.60

unsigned int Fl Widget::label shortcut ( const char t ) [static]

Returns the Unicode value of the &x shortcut in a given text. The given text t (usually a widgets label or a menu text) is searched for a &x shortcut label, and if found, the Unicode value (code point) of the &x shortcut is returned. Parameters t text or label to search for &x shortcut.

Returns Unicode (UCS-4) value of shortcut in t or 0.

Note Internal use only.

30.143.4.61 Fl_Color Fl Widget::labelcolor ( ) const [inline] Gets the label color. The default color is FL_FOREGROUND_COLOR.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

888 Returns the current label color

Class Documentation

30.143.4.62

void Fl Widget::labelcolor ( Fl_Color c ) [inline]

Sets the label color. The default color is FL_FOREGROUND_COLOR. Parameters in

c the new label color

30.143.4.63 Fl_Font Fl Widget::labelfont ( ) const [inline] Gets the font to use. Fonts are identied by indexes into a table. The default value uses a Helvetica typeface (Arial for MicrosoftWindows). The function Fl::set_font() can dene new typefaces. Returns current font used by the label

See also Fl_Font

30.143.4.64

void Fl Widget::labelfont ( Fl_Font f ) [inline]

Sets the font to use. Fonts are identied by indexes into a table. The default value uses a Helvetica typeface (Arial for MicrosoftWindows). The function Fl::set_font() can dene new typefaces. Parameters in

f the new font for the label

See also Fl_Font

30.143.4.65 Fl_Fontsize Fl Widget::labelsize ( ) const [inline] Gets the font size in pixels. The default size is 14 pixels.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.143 Fl_Widget Class Reference Returns the current font size

889

30.143.4.66

void Fl Widget::labelsize ( Fl_Fontsize pix ) [inline]

Sets the font size in pixels. Parameters in

pix the new font size

See also Fl_Fontsize labelsize()

30.143.4.67 Fl_Labeltype Fl Widget::labeltype ( ) const [inline] Gets the label type. Returns the current label type.

See also Fl_Labeltype

30.143.4.68

void Fl Widget::labeltype ( Fl_Labeltype a ) [inline]

Sets the label type. The label type identies the function that draws the label of the widget. This is generally used for special effects such as embossing or for using the label() pointer as another form of data such as an icon. The value FL_NORMAL_LABEL prints the label as plain text. Parameters in

a new label type

See also Fl_Labeltype

30.143.4.69

void Fl Widget::measure label ( int & ww, int & hh ) const [inline]

Sets width ww and height hh accordingly with the label size. Labels with images will return w() and h() of the image.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

890 30.143.4.70 unsigned int Fl Widget::output ( ) const [inline]

Class Documentation

Returns if a widget is used for output only. output() means the same as !active() except it does not change how the widget is drawn. The widget will not receive any events. This is useful for making scrollbars or buttons that work as displays rather than input devices. Return values 0 if the widget is used for input and output

See also set_output(), clear_output()

30.143.4.71 Fl_Group Fl Widget::parent ( ) const [inline] Returns a pointer to the parent widget. Usually this is a Fl_Group or Fl_Window. Return values NULL if the widget has no parent

See also Fl_Group::add(Fl_Widget)

30.143.4.72

void Fl Widget::parent ( Fl_Group p ) [inline]

Internal use only - "for hacks only". It is STRONGLY recommended not to use this method, because it short-circuits Fl_Groups normal widget adding and removing methods, if the widget is already a child widget of another Fl_Group. Use Fl_Group::add(Fl_Widget) and/or Fl_Group::remove(Fl_Widget) instead. 30.143.4.73 void Fl Widget::position ( int X, int Y ) [inline]

Repositions the window or widget. position(X, Y) is a shortcut for resize(X, Y, w(), h()). Parameters in

X,Y new position relative to the parent window

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.143 Fl_Widget Class Reference See also resize(int,int,int,int), size(int,int) Reimplemented in Fl_Input_. 30.143.4.74 void Fl Widget::redraw ( )

891

Schedules the drawing of the widget. Marks the widget as needing its draw() routine called. 30.143.4.75 void Fl Widget::redraw label ( )

Schedules the drawing of the label. Marks the widget or the parent as needing a redraw for the label area of a widget. 30.143.4.76 void Fl Widget::resize ( int x, int y, int w, int h ) [virtual]

Changes the size or position of the widget. This is a virtual function so that the widget may implement its own handling of resizing. The default version does not call the redraw() method, but instead relies on the parent widget to do so because the parent may know a faster way to update the display, such as scrolling from the old position. Some window managers under X11 call resize() a lot more often than needed. Please verify that the position or size of a widget did actually change before doing any extensive calculations. position(X, Y) is a shortcut for resize(X, Y, w(), h()), and size(W, H) is a shortcut for resize(x(), y(), W, H). Parameters in in See also position(int,int), size(int,int) Reimplemented in Fl_Table, Fl_Help_View, Fl_Text_Display, Fl_Input_, Fl_Browser_, Fl_Spinner, Fl_Input_Choice, Fl_Window, Fl_Scroll, Fl_Tile, Fl_Group, Fl_Gl_Window, Fl_Value_Input, Fl_Double_Window, and Fl_Overlay_Window. 30.143.4.77 Fl_Color Fl Widget::selection color ( ) const [inline] Gets the selection color. Returns the current selection color See also selection_color(Fl_Color), color(Fl_Color, Fl_Color)

x,y new position relative to the parent window w,h new size

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

892 30.143.4.78 void Fl Widget::selection color ( Fl_Color a ) [inline]

Class Documentation

Sets the selection color. The selection color is dened for Forms compatibility and is usually used to color the widget when it is selected, although some widgets use this color for other purposes. You can set both colors at once with color(Fl_Color bg, Fl_Color sel). Parameters in

a the new selection color

See also selection_color(), color(Fl_Color, Fl_Color)

30.143.4.79

void Fl Widget::set changed ( ) [inline]

Marks the value of the widget as changed. See also changed(), clear_changed() Reimplemented in Fl_Input_Choice. 30.143.4.80 void Fl Widget::set output ( ) [inline]

Sets a widget to output only. See also output(), clear_output()

30.143.4.81

void Fl Widget::set visible ( ) [inline]

Makes the widget visible. You must still redraw the parent widget to see a change in the window. Normally you want to use the show() method instead. 30.143.4.82 void Fl Widget::set visible focus ( ) [inline]

Enables keyboard focus navigation with this widget. Note, however, that this will not necessarily mean that the widget will accept focus, but for widgets that can accept focus, this method enables it if it has been disabled. See also visible_focus(), clear_visible_focus(), visible_focus(int)

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.143 Fl_Widget Class Reference 30.143.4.83 void Fl Widget::show ( ) [virtual]

893

Makes a widget visible. An invisible widget never gets redrawn and does not get keyboard or mouse events, but can receive a few other events like FL_SHOW. The visible() method returns true if the widget is set to be visible. The visible_r() method returns true if the widget and all of its parents are visible. A widget is only visible if visible() is true on it and all of its parents. Changing it will send FL_SHOW or FL_HIDE events to the widget. Do not change it if the parent is not visible, as this will send false FL_SHOW or FL_HIDE events to the widget. redraw() is called if necessary on this or the parent. See also hide(), visible(), visible_r() Reimplemented in Fl_Window, Fl_Browser, Fl_Gl_Window, Fl_Double_Window, Fl_Overlay_Window, Fl_Single_Window, and Fl_Menu_Window. 30.143.4.84 void Fl Widget::size ( int W, int H ) [inline]

Changes the size of the widget. size(W, H) is a shortcut for resize(x(), y(), W, H). Parameters in

W,H new size

See also position(int,int), resize(int,int,int,int) Reimplemented in Fl_Help_View, Fl_Input_, Fl_Browser, Fl_Chart, and Fl_Menu_. 30.143.4.85 int Fl Widget::take focus ( )

Gives the widget the keyboard focus. Tries to make this widget be the Fl::focus() widget, by rst sending it an FL_FOCUS event, and if it returns non-zero, setting Fl::focus() to this widget. You should use this method to assign the focus to a widget. Returns true if the widget accepted the focus.

30.143.4.86

unsigned int Fl Widget::takesevents ( ) const [inline]

Returns if the widget is able to take events. This is the same as (active() && !output() && visible()) but is faster.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

894 Return values 0 if the widget takes no events

Class Documentation

30.143.4.87

int Fl Widget::test shortcut ( )

Returns true if the widgets label contains the entered &x shortcut. This method must only be called in handle() methods or callbacks after a keypress event (usually FL_KEYDOWN or FL_SHORTCUT). The widgets label is searched for a &x shortcut, and if found, this is compared with the entered key value. Fl::event_text() is used to get the entered key value. Returns true, if the entered text matches the widgets&x shortcut, false (0) otherwise.

Note Internal use only. Reimplemented in Fl_Menu_. 30.143.4.88 int Fl Widget::test shortcut ( const char t, const bool require alt = false ) [static]

Returns true if the given text t contains the entered &x shortcut. This method must only be called in handle() methods or callbacks after a keypress event (usually FL_KEYDOWN or FL_SHORTCUT). The given text t (usually a widgets label or menu text) is searched for a &x shortcut, and if found, this is compared with the entered key value. Fl::event_text() is used to get the entered key value. Fl::event_state() is used to get the Alt modier, if require_alt is true. Parameters t text or label to search for &x shortcut. require_alt if true: match only if Alt key is pressed.

Returns true, if the entered text matches the &x shortcut in t false (0) otherwise.

Note Internal use only.

30.143.4.89

const char Fl Widget::tooltip ( ) const [inline]

Gets the current tooltip text.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.143 Fl_Widget Class Reference Returns a pointer to the tooltip text or NULL

895

See also tooltip(const char), copy_tooltip(const char)

30.143.4.90

void Fl Widget::tooltip ( const char text )

Sets the current tooltip text. Sets a string of text to display in a popup tooltip window when the user hovers the mouse over the widget. The string is not copied, so make sure any formatted string is stored in a static, global, or allocated buffer. If you want a copy made and managed for you, use the copy_tooltip() method, which will manage the tooltip string automatically. If no tooltip is set, the tooltip of the parent is inherited. Setting a tooltip for a group and setting no tooltip for a child will show the groups tooltip instead. To avoid this behavior, you can set the childs tooltip to an empty string (""). Parameters in See also copy_tooltip(const char), tooltip()

text New tooltip text (no copy is made)

30.143.4.91 uchar Fl Widget::type ( ) const [inline] Gets the widget type. Returns the widget type value, which is used for Forms compatibility and to simulate RTTI. Todo Explain "simulate RTTI" (currently only used to decide if a widget is a window, i.e. type()>=FL_WINDOW ?). Is type() really used in a way that ensures "Forms compatibility" ? Reimplemented in Fl_Spinner, and Fl_Table_Row. 30.143.4.92 void Fl Widget::type ( uchar t ) [inline]

Sets the widget type. This is used for Forms compatibility. Reimplemented in Fl_Spinner. 30.143.4.93 void Fl Widget::user data ( ) const [inline]

Gets the user data for this widget. Gets the current user data (void ) argument that is passed to the callback function.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

896 Returns user data as a pointer

Class Documentation

30.143.4.94

void Fl Widget::user data ( void v ) [inline]

Sets the user data for this widget. Sets the new user data (void ) argument that is passed to the callback function. Parameters in

v new user data

30.143.4.95

unsigned int Fl Widget::visible ( ) const [inline]

Returns whether a widget is visible. Return values 0 if the widget is not drawn and hence invisible.

See also show(), hide(), visible_r()

30.143.4.96

void Fl Widget::visible focus ( int v ) [inline]

Modies keyboard focus navigation. Parameters in

v set or clear visible focus

See also set_visible_focus(), clear_visible_focus(), visible_focus()

30.143.4.97

unsigned int Fl Widget::visible focus ( ) [inline]

Checks whether this widget has a visible focus. Return values 0 if this widget has no visible focus. See also visible_focus(int), set_visible_focus(), clear_visible_focus()

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.143 Fl_Widget Class Reference 30.143.4.98 int Fl Widget::visible r ( ) const

897

Returns whether a widget and all its parents are visible. Return values 0 if the widget or any of its parents are invisible.

See also show(), hide(), visible()

30.143.4.99

void Fl Widget::w ( int v ) [inline, protected]

Internal use only. Use position(int,int), size(int,int) or resize(int,int,int,int) instead. 30.143.4.100 int Fl Widget::w ( ) const [inline]

Gets the widget width. Returns the width of the widget in pixels.

30.143.4.101 Fl_When Fl Widget::when ( ) const [inline] Returns the conditions under which the callback is called. You can set the ags with when(uchar), the default value is FL_WHEN_RELEASE. Returns set of ags

See also when(uchar)

30.143.4.102

void Fl Widget::when ( uchar i ) [inline]

Sets the ags used to decide when a callback is called. This controls when callbacks are done. The following values are useful, the default value is FL_WHEN_RELEASE: 0: The callback is not done, but changed() is turned on. FL_WHEN_CHANGED: The callback is done each time the text is changed by the user.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

898

Class Documentation FL_WHEN_RELEASE: The callback will be done when this widget loses the focus, including when the window is unmapped. This is a useful value for text elds in a panel where doing the callback on every change is wasteful. However the callback will also happen if the mouse is moved out of the window, which means it should not do anything visible (like pop up an error message). You might do better setting this to zero, and scanning all the items for changed() when the OK button on a panel is pressed. FL_WHEN_ENTER_KEY: If the user types the Enter key, the entire text is selected, and the callback is done if the text has changed. Normally the Enter key will navigate to the next eld (or insert a newline for a Fl_Multiline_Input) - this changes the behavior. FL_WHEN_ENTER_KEY|FL_WHEN_NOT_CHANGED: The Enter key will do the callback even if the text has not changed. Useful for command elds. Fl_Widget::when() is a set of bitags used by subclasses of Fl_Widget to decide when to do the callback.

If the value is zero then the callback is never done. Other values are described in the individual widgets. This eld is in the base class so that you can scan a panel and do_callback() on all the ones that dont do their own callbacks in response to an "OK" button. Parameters in

i set of ags

30.143.4.103 Fl_Window Fl Widget::window ( ) const Returns a pointer to the primary Fl_Window widget. Return values NULL if no window is associated with this widget.

Note for an Fl_Window widget, this returns its parent window (if any), not this window.

30.143.4.104

void Fl Widget::x ( int v ) [inline, protected]

Internal use only. Use position(int,int), size(int,int) or resize(int,int,int,int) instead.

30.143.4.105

int Fl Widget::x ( ) const [inline]

Gets the widget position in its window. Returns the x position relative to the window

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.144 Fl_Widget_Tracker Class Reference 30.143.4.106 void Fl Widget::y ( int v ) [inline, protected]

899

Internal use only. Use position(int,int), size(int,int) or resize(int,int,int,int) instead.

30.143.4.107

int Fl Widget::y ( ) const [inline]

Gets the widget position in its window. Returns the y position relative to the window The documentation for this class was generated from the following les: Fl_Widget.H Fl.cxx _boxtype.cxx _labeltype.cxx _shortcut.cxx Fl_Tooltip.cxx Fl_Widget.cxx Fl_Window.cxx

30.144

Fl Widget Tracker Class Reference

This class should be used to control safe widget deletion. #include <Fl.H>

Public Member Functions


int deleted ()
Returns 1, if the watched widget has been deleted.

int exists ()
Returns 1, if the watched widget exists (has not been deleted).

Fl_Widget_Tracker (Fl_Widget wi)


The constructor adds a widget to the watch list.

Fl_Widget widget ()
Returns a pointer to the watched widget.

Fl_Widget_Tracker ()
The destructor removes a widget from the watch list.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

900

Class Documentation

30.144.1

Detailed Description

This class should be used to control safe widget deletion. You can use an Fl_Widget_Tracker object to watch another widget, if you need to know, if this widget has been deleted during a callback. This simplies the use of the "safe widget deletion" methods Fl::watch_widget_pointer() and Fl::release_widget_pointer() and makes their use more reliable, because the destructor autmatically releases the widget pointer from the widget watch list. It is intended to be used as an automatic (local/stack) variable, such that the automatic destructor is called when the objects scope is left. This ensures that no stale widget pointers are left in the widget watch list (see example below). You can also create Fl_Widget_Tracker objects with new, but then it is your responsibility to delete the object (and thus remove the widget pointer from the watch list) when it is not needed any more. Example:
int MyClass::handle (int event) { if (...) { Fl_Widget_Tracker wp(this); do_callback(); if (wp.deleted()) return 1;

// watch myself // call the callback // exit, if deleted

// Now we are sure that the widget has not been deleted. // It is safe to access the widget clear_changed(); } } // access the widget

30.144.2
30.144.2.1

Member Function Documentation


int Fl Widget Tracker::deleted ( ) [inline]

Returns 1, if the watched widget has been deleted. This is a convenience method. You can also use something like if (wp.widget() == 0) // ... where wp is an Fl_Widget_Tracker object. 30.144.2.2 int Fl Widget Tracker::exists ( ) [inline]

Returns 1, if the watched widget exists (has not been deleted). This is a convenience method. You can also use something like if (wp.widget() != 0) // ... where wp is an Fl_Widget_Tracker object. 30.144.2.3 Fl_Widget Fl Widget Tracker::widget ( ) [inline] Returns a pointer to the watched widget.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.145 Fl_Window Class Reference This pointer is NULL, if the widget has been deleted. The documentation for this class was generated from the following les: Fl.H Fl.cxx

901

30.145

Fl Window Class Reference

This widget produces an actual window. #include <Fl_Window.H> Inheritance diagram for Fl_Window:
Fl_Widget Fl_Group Fl_Window Fl_Double_Window Fl_Cairo_Window Fl_Overlay_Window Fl_Gl_Window Fl_Glut_Window Fl_Single_Window Fl_Menu_Window

Public Member Functions


virtual Fl_Window as_window ()
Returns an Fl_Window pointer if this widget is an Fl_Window.

void border (int b)


Sets whether or not the window manager border is around the window.

unsigned int border () const


See void Fl_Window::border(int)

void clear_border ()
Fast inline function to turn the window manager border off.

void copy_label (const char a)


Sets the current label.

void cursor (Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE)


Changes the cursor for this window.

int decorated_h ()
Returns the window height including any window title bar and any frame added by the window manager.

int decorated_w ()
Returns the window width including any frame added by the window manager.

void default_cursor (Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE)


Sets the default window cursor as well as its color.

Fl_Window (int w, int h, const char title=0)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

902
Creates a window from the given size and title.

Class Documentation

Fl_Window (int x, int y, int w, int h, const char title=0)


Creates a window from the given position, size and title.

void free_position ()
Undoes the effect of a previous resize() or show() so that the next time show() is called the window manager is free to position the window.

void fullscreen ()
Makes the window completely ll the screen, without any window manager border visible.

void fullscreen_off (int, int, int, int)


Turns off any side effects of fullscreen() and does resize(x,y,w,h).

virtual int handle (int)


Handles the specied event.

virtual void hide ()


Removes the window from the screen.

void hotspot (int x, int y, int offscreen=0)


Positions the window so that the mouse is pointing at the given position, or at the center of the given widget, which may be the window itself.

void hotspot (const Fl_Widget , int offscreen=0)


See void Fl_Window::hotspot(int x, int y, int offscreen = 0)

void hotspot (const Fl_Widget &p, int offscreen=0)


See void Fl_Window::hotspot(int x, int y, int offscreen = 0)

const void icon () const


Gets the current icon window target dependent data.

void icon (const void ic)


Sets the current icon window target dependent data.

void iconize ()
Iconies the window.

const char iconlabel () const


See void Fl_Window::iconlabel(const char)

void iconlabel (const char )


Sets the icon label.

const char label () const


See void Fl_Window::label(const char)

void label (const char )


Sets the window title bar label.

void label (const char label, const char iconlabel)


Sets the icon label.

void make_current ()
Sets things up so that the drawing functions in <FL/_draw.H> will go into this window.

unsigned int menu_window () const


Returns true if this window is a menu window.

unsigned int modal () const


Returns true if this window is modal.

unsigned int non_modal () const


Returns true if this window is modal or non-modal.

unsigned int override () const


Returns non zero if FL_OVERRIDE ag is set, 0 otherwise.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.145 Fl_Window Class Reference virtual void resize (int, int, int, int)
Changes the size and position of the window.

903

void set_menu_window ()
Marks the window as a menu window.

void set_modal ()
A "modal" window, when shown(), will prevent any events from being delivered to other windows in the same program, and will also remain on top of the other windows (if the X window manager supports the "transient for" property).

void set_non_modal ()
A "non-modal" window (terminology borrowed from Microsoft Windows) acts like a modal() one in that it remains on top, but it has no effect on event delivery.

void set_override ()
Activates the ags NOBORDER|FL_OVERRIDE.

void set_tooltip_window ()
Marks the window as a tooltip window.

virtual void show ()


Puts the window on the screen.

void show (int argc, char argv)


Puts the window on the screen and parses command-line arguments.

int shown ()
Returns non-zero if show() has been called (but not hide() ).

void size_range (int a, int b, int c=0, int d=0, int e=0, int f=0, int g=0)
Sets the allowable range the user can resize this window to.

unsigned int tooltip_window () const


Returns true if this window is a tooltip window.

int x_root () const


Gets the x position of the window on the screen.

const char xclass () const


Returns the xclass for this window, or a default.

void xclass (const char c)


Sets the xclass for this window.

int y_root () const


Gets the y position of the window on the screen.

virtual Fl_Window ()
The destructor also deletes all the children.

Static Public Member Functions


static Fl_Window current ()
Returns the last window that was made current.

static void default_callback (Fl_Window , void v)


Back compatibility: Sets the default callback v for win to call on close event.

static void default_xclass (const char )


Sets the default window xclass.

static const char default_xclass ()


Returns the default xclass.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

904

Class Documentation

Protected Member Functions


virtual void draw ()
Draws the widget.

virtual void ush ()


Forces the window to be drawn, this window is also made current and calls draw().

void force_position (int force)


Sets an internal ag that tells FLTK and the window manager to honor position requests.

int force_position () const


Returns the internal state of the windows FORCE_POSITION ag.

Static Protected Attributes


static Fl_Window current_
Stores the last window that was made current.

Friends
class Fl_X

30.145.1

Detailed Description

This widget produces an actual window. This can either be a main window, with a border and title and all the window management controls, or a "subwindow" inside a window. This is controlled by whether or not the window has a parent(). Once you create a window, you usually add children Fl_Widget s to it by using window->add(child) for each new widget. See Fl_Group for more information on how to add and remove children. There are several subclasses of Fl_Window that provide double-buffering, overlay, menu, and OpenGL support. The windows callback is done if the user tries to close a window using the window manager and Fl::modal() is zero or equal to the window. Fl_Window has a default callback that calls Fl_Window::hide().

30.145.2
30.145.2.1

Constructor & Destructor Documentation


Fl Window::Fl Window ( int w, int h, const char title = 0 )

Creates a window from the given size and title. If Fl_Group::current() is not NULL, the window is created as a subwindow of the parent window. The (w,h) form of the constructor creates a top-level window and asks the window manager to position the window. The (x,y,w,h) form of the constructor either creates a subwindow or a top-level window at the specied location (x,y) , subject to window manager conguration. If you do not specify the position of the window, the window manager will pick a place to show the window or allow the user to pick a location. Use position(x,y) or hotspot() before calling show() to request a position on the screen. See Fl_Window::resize() for some more details on positioning windows. Top-level windows initially have visible() set to 0 and parent() set to NULL. Subwindows initially have visible() set to 1 and parent() set to the parent window pointer.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.145 Fl_Window Class Reference

905

Fl_Widget::box() defaults to FL_FLAT_BOX. If you plan to completely ll the window with children widgets you should change this to FL_NO_BOX. If you turn the window border off you may want to change this to FL_UP_BOX. See also Fl_Window(int x, int y, int w, int h, const char title)

30.145.2.2

Fl Window::Fl Window ( int x, int y, int w, int h, const char title = 0 )

Creates a window from the given position, size and title. See also Fl_Window(int w, int h, const char title)

30.145.2.3

Fl Window::Fl Window ( ) [virtual]

The destructor also deletes all the children. This allows a whole tree to be deleted at once, without having to keep a pointer to all the children in the user code. A kludge has been done so the Fl_Window and all of its children can be automatic (local) variables, but you must declare the Fl_Window rst so that it is destroyed last.

30.145.3
30.145.3.1

Member Function Documentation


virtual Fl_Window Fl Window::as window ( ) [inline, virtual]

Returns an Fl_Window pointer if this widget is an Fl_Window. Use this method if you have a widget (pointer) and need to know whether this widget is derived from Fl_Window. If it returns non-NULL, then the widget in question is derived from Fl_Window, and you can use the returned pointer to access its children or other Fl_Window-specic methods. Return values NULL if this widget is not derived from Fl_Window. Note This method is provided to avoid dynamic_cast. See also Fl_Widget::as_group(), Fl_Widget::as_gl_window() Reimplemented from Fl_Widget. 30.145.3.2 void Fl Window::border ( int b )

Sets whether or not the window manager border is around the window.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

906

Class Documentation

The default value is true. void border(int) can be used to turn the border on and off. Under most X window managers this does not work after show() has been called, although SGIs 4DWM does work. 30.145.3.3 void Fl Window::clear border ( ) [inline]

Fast inline function to turn the window manager border off. It only works before show() is called. 30.145.3.4 void Fl Window::copy label ( const char new label )

Sets the current label. Unlike label(), this method allocates a copy of the label string instead of using the original string pointer. The internal copy will automatically be freed whenever you assign a new label or when the widget is destroyed. Parameters in

new_label the new label text

See also label() Reimplemented from Fl_Widget.

30.145.3.5 Fl_Window Fl Window::current ( ) [static] Returns the last window that was made current. See also Fl_Window::make_current() Reimplemented from Fl_Group.

30.145.3.6

void Fl Window::cursor ( Fl_Cursor c, Fl_Color fg = FL BLACK, Fl_Color bg = FL WHITE )

Changes the cursor for this window. This always calls the system, if you are changing the cursor a lot you may want to keep track of how you set it in a static variable and call this only if the new cursor is different. The type Fl_Cursor is an enumeration dened in <FL/Enumerations.H>. (Under X you can get any XC_cursor value by passing Fl_Cursor((XC_foo/2)+1)). The colors only work on X, they are not implemented on WIN32. For back compatibility only.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.145 Fl_Window Class Reference 30.145.3.7 int Fl Window::decorated h ( )

907

Returns the window height including any window title bar and any frame added by the window manager. Same as h() if applied to a subwindow. 30.145.3.8 int Fl Window::decorated w ( )

Returns the window width including any frame added by the window manager. Same as w() if applied to a subwindow. 30.145.3.9 void Fl Window::default cursor ( Fl_Cursor c, Fl_Color fg = FL BLACK, Fl_Color bg = FL WHITE )

Sets the default window cursor as well as its color. For back compatibility only. 30.145.3.10 void Fl Window::default xclass ( const char xc ) [static]

Sets the default window xclass. The default xclass is used for all windows that dont have their own xclass set before show() is called. You can change the default xclass whenever you want, but this only affects windows that are created (and shown) after this call. The given string xc is copied. You can use a local variable or free the string immediately after this call. If you dont call this, the default xclass for all windows will be "FLTK". You can reset the default xclass by specifying NULL for xc. If you call Fl_Window::xclass(const char ) for any window, then this also sets the default xclass, unless it has been set before. Parameters in See also Fl_Window::xclass(const char )

xc default xclass for all windows subsequently created

30.145.3.11

const char Fl Window::default xclass ( ) [static]

Returns the default xclass. See also Fl_Window::default_xclass(const char )

30.145.3.12

void Fl Window::draw ( ) [protected, virtual]

Draws the widget.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

908

Class Documentation

Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widgets draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; s->draw(); // scroll is an embedded Fl_Scrollbar // calls Fl_Scrollbar::draw()

Reimplemented from Fl_Group. Reimplemented in Fl_Gl_Window, Fl_Cairo_Window, and Fl_Glut_Window. 30.145.3.13 void Fl Window::ush ( ) [protected, virtual]

Forces the window to be drawn, this window is also made current and calls draw(). Reimplemented in Fl_Gl_Window, Fl_Double_Window, Fl_Overlay_Window, Fl_Single_Window, and Fl_Menu_Window. 30.145.3.14 void Fl Window::force position ( int force ) [inline, protected]

Sets an internal ag that tells FLTK and the window manager to honor position requests. This is used internally and should not be needed by user code. Parameters in

force 1 to set the FORCE_POSITION ag, 0 to clear it

30.145.3.15

int Fl Window::force position ( ) const [inline, protected]

Returns the internal state of the windows FORCE_POSITION ag. Return values 1 if ag is set 0 otherwise See also force_position(int)

30.145.3.16

void Fl Window::free position ( ) [inline]

Undoes the effect of a previous resize() or show() so that the next time show() is called the window manager is free to position the window. This is for Forms compatibility only. Deprecated please use force_position(0) instead

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.145 Fl_Window Class Reference 30.145.3.17 void Fl Window::fullscreen ( )

909

Makes the window completely ll the screen, without any window manager border visible. You must use fullscreen_off() to undo this. This may not work with all window managers. 30.145.3.18 int Fl Window::handle ( int event ) [virtual]

Handles the specied event. You normally dont call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you dont short-circuit events that you dont handle. In this last case you should return the callee retval. Parameters in

event the kind of event received

Return values 0 if the event was not used or understood 1 if the event was used and can be deleted See also Fl_Event Reimplemented from Fl_Group. Reimplemented in Fl_Gl_Window, and Fl_Glut_Window. 30.145.3.19 void Fl Window::hide ( ) [virtual]

Removes the window from the screen. If the window is already hidden or has not been shown then this does nothing and is harmless. Reimplemented from Fl_Widget. Reimplemented in Fl_Gl_Window, Fl_Double_Window, Fl_Overlay_Window, and Fl_Menu_Window. 30.145.3.20 void Fl Window::hotspot ( int x, int y, int offscreen = 0 )

Positions the window so that the mouse is pointing at the given position, or at the center of the given widget, which may be the window itself. If the optional offscreen parameter is non-zero, then the window is allowed to extend off the screen (this does not work with some X window managers). See also position()

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

910 30.145.3.21 const void Fl Window::icon ( ) const

Class Documentation

Gets the current icon window target dependent data. 30.145.3.22 void Fl Window::icon ( const void ic )

Sets the current icon window target dependent data. 30.145.3.23 void Fl Window::iconize ( )

Iconies the window. If you call this when shown() is false it will show() it as an icon. If the window is already iconied this does nothing. Call show() to restore the window. When a window is iconied/restored (either by these calls or by the user) the handle() method is called with FL_HIDE and FL_SHOW events and visible() is turned on and off. There is no way to control what is drawn in the icon except with the string passed to Fl_Window::xclass(). You should not rely on window managers displaying the icons. 30.145.3.24 void Fl Window::iconlabel ( const char iname )

Sets the icon label. 30.145.3.25 void Fl Window::label ( const char name )

Sets the window title bar label. Reimplemented from Fl_Widget. 30.145.3.26 void Fl Window::label ( const char label, const char iconlabel )

Sets the icon label. 30.145.3.27 void Fl Window::make current ( )

Sets things up so that the drawing functions in <FL/_draw.H> will go into this window. This is useful for incremental update of windows, such as in an idle callback, which will make your program behave much better if it draws a slow graphic. Danger: incremental update is very hard to debug and maintain! This method only works for the Fl_Window and Fl_Gl_Window derived classes. Reimplemented in Fl_Gl_Window, Fl_Glut_Window, and Fl_Single_Window. 30.145.3.28 unsigned int Fl Window::menu window ( ) const [inline]

Returns true if this window is a menu window.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.145 Fl_Window Class Reference 30.145.3.29 unsigned int Fl Window::modal ( ) const [inline]

911

Returns true if this window is modal.

30.145.3.30

unsigned int Fl Window::non modal ( ) const [inline]

Returns true if this window is modal or non-modal.

30.145.3.31

unsigned int Fl Window::override ( ) const [inline]

Returns non zero if FL_OVERRIDE ag is set, 0 otherwise.

30.145.3.32

virtual void Fl Window::resize ( int , int , int , int ) [virtual]

Changes the size and position of the window. If shown() is true, these changes are communicated to the window server (which may refuse that size and cause a further resize). If shown() is false, the size and position are used when show() is called. See Fl_Group for the effect of resizing on the child widgets. You can also call the Fl_Widget methods size(x,y) and position(w,h), which are inline wrappers for this virtual function. A top-level window can not force, but merely suggest a position and size to the operating system. The window manager may not be willing or able to display a window at the desired position or with the given dimensions. It is up to the application developer to verify window parameters after the resize request. Reimplemented from Fl_Group. Reimplemented in Fl_Gl_Window, Fl_Double_Window, and Fl_Overlay_Window.

30.145.3.33

void Fl Window::set menu window ( ) [inline]

Marks the window as a menu window. This is intended for internal use, but it can also be used if you write your own menu handling. However, this is not recommended. This ag is used for correct "parenting" of windows in communication with the windowing system. Modern X window managers can use different ags to distinguish menu and tooltip windows from normal windows. This must be called before the window is shown and cannot be changed later.

30.145.3.34

void Fl Window::set modal ( ) [inline]

A "modal" window, when shown(), will prevent any events from being delivered to other windows in the same program, and will also remain on top of the other windows (if the X window manager supports the "transient for" property). Several modal windows may be shown at once, in which case only the last one shown gets events. You can see which window (if any) is modal by calling Fl::modal().
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

912 30.145.3.35 void Fl Window::set non modal ( ) [inline]

Class Documentation

A "non-modal" window (terminology borrowed from Microsoft Windows) acts like a modal() one in that it remains on top, but it has no effect on event delivery. There are three states for a window: modal, non-modal, and normal. 30.145.3.36 void Fl Window::set tooltip window ( ) [inline]

Marks the window as a tooltip window. This is intended for internal use, but it can also be used if you write your own tooltip handling. However, this is not recommended. This ag is used for correct "parenting" of windows in communication with the windowing system. Modern X window managers can use different ags to distinguish menu and tooltip windows from normal windows. This must be called before the window is shown and cannot be changed later. Note Since Fl_Tooltip_Window is derived from Fl_Menu_Window, this also clears the menu_window() state.

30.145.3.37

virtual void Fl Window::show ( ) [virtual]

Puts the window on the screen. Usually (on X) this has the side effect of opening the display. If the window is already shown then it is restored and raised to the top. This is really convenient because your program can call show() at any time, even if the window is already up. It also means that show() serves the purpose of raise() in other toolkits. Fl_Window::show(int argc, char argv) is used for top-level windows and allows standard arguments to be parsed from the command-line. See also Fl_Window::show(int argc, char argv) Reimplemented from Fl_Widget. Reimplemented in Fl_Gl_Window, Fl_Double_Window, Fl_Overlay_Window, Fl_Single_Window, and Fl_Menu_Window. 30.145.3.38 void Fl Window::show ( int argc, char argv )

Puts the window on the screen and parses command-line arguments. Usually (on X) this has the side effect of opening the display. This form should be used for top-level windows, at least for the rst (main) window. It allows standard arguments to be parsed from the command-line. You can use argc and argv from main(int argc, char argv) for this call. The rst call also sets up some system-specic internal variables like the system colors.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.145 Fl_Window Class Reference Todo explain which system parameters are set up.

913

Parameters argc command-line argument count, usually from main() argv command-line argument vector, usually from main()

See also virtual void Fl_Window::show() Reimplemented in Fl_Gl_Window, Fl_Overlay_Window, Fl_Double_Window, and Fl_Single_Window. 30.145.3.39 int Fl Window::shown ( ) [inline]

Returns non-zero if show() has been called (but not hide() ). You can tell if a window is iconied with (w->shown() && !w->visible()). 30.145.3.40 void Fl Window::size range ( int a, int b, int c = 0, int d = 0, int e = 0, int f = 0, int g = 0 ) [inline]

Sets the allowable range the user can resize this window to. This only works for top-level windows. minw and minh are the smallest the window can be. Either value must be greater than 0. maxw and maxh are the largest the window can be. If either is equal to the minimum then you cannot resize in that direction. If either is zero then FLTK picks a maximum size in that direction such that the window will ll the screen. dw and dh are size increments. The window will be constrained to widths of minw + N dw, where N is any non-negative integer. If these are less or equal to 1 they are ignored (this is ignored on WIN32). aspect is a ag that indicates that the window should preserve its aspect ratio. This only works if both the maximum and minimum have the same aspect ratio (ignored on WIN32 and by many X window managers). If this function is not called, FLTK tries to gure out the range from the setting of resizable(): If resizable() is NULL (this is the default) then the window cannot be resized and the resize border and max-size control will not be displayed for the window. If either dimension of resizable() is less than 100, then that is considered the minimum size. Otherwise the resizable() has a minimum size of 100. If either dimension of resizable() is zero, then that is also the maximum size (so the window cannot resize in that direction). It is undened what happens if the current size does not t in the constraints passed to size_range().
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

914 30.145.3.41 unsigned int Fl Window::tooltip window ( ) const [inline]

Class Documentation

Returns true if this window is a tooltip window. 30.145.3.42 const char Fl Window::xclass ( ) const

Returns the xclass for this window, or a default. See also Fl_Window::default_xclass(const char ) Fl_Window::xclass(const char )

30.145.3.43

void Fl Window::xclass ( const char xc )

Sets the xclass for this window. A string used to tell the system what type of window this is. Mostly this identies the picture to draw in the icon. This only works if called before calling show(). Under X, this is turned into a XA_WM_CLASS pair by truncating at the rst non-alphanumeric character and capitalizing the rst character, and the second one if the rst is x. Thus "foo" turns into "foo, Foo", and "xprog.1" turns into "xprog, XProg". Under Microsoft Windows, this string is used as the name of the WNDCLASS structure, though it is not clear if this can have any visible effect. Since FLTK 1.3 the passed string is copied. You can use a local variable or free the string immediately after this call. Note that FLTK 1.1 stores the pointer without copying the string. If the default xclass has not yet been set, this also sets the default xclass for all windows created subsequently. See also Fl_Window::default_xclass(const char )

30.145.4

Member Data Documentation

30.145.4.1 Fl_Window Fl_Window::current_ [static, protected] Stores the last window that was made current. See current() const Reimplemented from Fl_Group. The documentation for this class was generated from the following les: Fl_Window.H Fl.cxx Fl_arg.cxx
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.146 Fl_Wizard Class Reference _cursor.cxx Fl_Window.cxx Fl_Window_fullscreen.cxx Fl_Window_hotspot.cxx Fl_Window_iconize.cxx

915

30.146

Fl Wizard Class Reference

This widget is based off the Fl_Tabs widget, but instead of displaying tabs it only changes "tabs" under program control. #include <Fl_Wizard.H> Inheritance diagram for Fl_Wizard:

Fl_Widget Fl_Group Fl_Wizard

Public Member Functions


Fl_Wizard (int, int, int, int, const char =0)
The constructor creates the Fl_Wizard widget at the specied position and size.

void next ()
This method shows the next child of the wizard.

void prev ()
Shows the previous child.

Fl_Widget value ()
Gets the current visible child widget.

void value (Fl_Widget )


Sets the child widget that is visible.

30.146.1

Detailed Description

This widget is based off the Fl_Tabs widget, but instead of displaying tabs it only changes "tabs" under program control. Its primary purpose is to support "wizards" that step a user through conguration or troubleshooting tasks. As with Fl_Tabs, wizard panes are composed of child (usually Fl_Group) widgets. Navigation buttons must be added separately.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

916

Class Documentation

30.146.2
30.146.2.1

Constructor & Destructor Documentation


Fl Wizard::Fl Wizard ( int xx, int yy, int ww, int hh, const char l = 0 )

The constructor creates the Fl_Wizard widget at the specied position and size. The inherited destructor destroys the widget and its children.

30.146.3
30.146.3.1

Member Function Documentation


void Fl Wizard::next ( )

This method shows the next child of the wizard. If the last child is already visible, this function does nothing.

30.146.3.2

void Fl Wizard::prev ( )

Shows the previous child.

30.146.3.3 Fl_Widget Fl Wizard::value ( ) Gets the current visible child widget.

30.146.3.4

void Fl Wizard::value ( Fl_Widget kid )

Sets the child widget that is visible. The documentation for this class was generated from the following les: Fl_Wizard.H Fl_Wizard.cxx

30.147

Fl XBM Image Class Reference

The Fl_XBM_Image class supports loading, caching, and drawing of X Bitmap (XBM) bitmap les. #include <Fl_XBM_Image.H> Inheritance diagram for Fl_XBM_Image:

Fl_Image Fl_Bitmap Fl_XBM_Image

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.148 Fl_XColor Struct Reference

917

Public Member Functions


Fl_XBM_Image (const char lename)
The constructor loads the named XBM le from the given name lename.

30.147.1

Detailed Description

The Fl_XBM_Image class supports loading, caching, and drawing of X Bitmap (XBM) bitmap les.

30.147.2
30.147.2.1

Constructor & Destructor Documentation


Fl XBM Image::Fl XBM Image ( const char name )

The constructor loads the named XBM le from the given name lename. The destructor free all memory and server resources that are used by the image. The documentation for this class was generated from the following les: Fl_XBM_Image.H Fl_XBM_Image.cxx

30.148

Fl XColor Struct Reference

Public Attributes
unsigned char b unsigned char g unsigned char mapped unsigned long pixel unsigned char r The documentation for this struct was generated from the following le: Fl_XColor.H

30.149

Fl Xlib Graphics Driver Class Reference

The Xlib-specic graphics class. #include <Fl_Device.H> Inheritance diagram for Fl_Xlib_Graphics_Driver:
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

918

Class Documentation

Fl_Device Fl_Graphics_Driver Fl_Xlib_Graphics_Driver

Public Member Functions


const char class_name ()
Returns the name of the class of this object.

void color (Fl_Color c)


see _color(Fl_Color c).

void color (uchar r, uchar g, uchar b)


see _color(uchar r, uchar g, uchar b).

int descent ()
see _descent().

void draw (const char str, int n, int x, int y)


see _draw(const char str, int n, int x, int y).

void draw (int angle, const char str, int n, int x, int y)
see _draw(int angle, const char str, int n, int x, int y).

void draw (Fl_Pixmap pxm, int XP, int YP, int WP, int HP, int cx, int cy)
Draws an Fl_Pixmap object to the device.

void draw (Fl_Bitmap pxm, int XP, int YP, int WP, int HP, int cx, int cy)
Draws an Fl_Bitmap object to the device.

void draw (Fl_RGB_Image img, int XP, int YP, int WP, int HP, int cx, int cy)
Draws an Fl_RGB_Image object to the device.

void draw_image (const uchar buf, int X, int Y, int W, int H, int D=3, int L=0)
see _draw_image(const uchar buf, int X,int Y,int W,int H, int D, int L).

void draw_image (Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D=3)
see _draw_image(Fl_Draw_Image_Cb cb, void data, int X,int Y,int W,int H, int D).

void draw_image_mono (const uchar buf, int X, int Y, int W, int H, int D=1, int L=0)
see _draw_image_mono(const uchar buf, int X,int Y,int W,int H, int D, int L).

void draw_image_mono (Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D=1)
see _draw_image_mono(Fl_Draw_Image_Cb cb, void data, int X,int Y,int W,int H, int D).

void font (Fl_Font face, Fl_Fontsize size)


see _font(Fl_Font face, Fl_Fontsize size).

int height ()
see _height().

void rtl_draw (const char str, int n, int x, int y)


see _rtl_draw(const char str, int n, int x, int y).

void text_extents (const char , int n, int &dx, int &dy, int &w, int &h)
see _text_extents(const char, int n, int& dx, int& dy, int& w, int& h).

double width (const char str, int n)


see _width(const char str, int n).

double width (unsigned int c)


see _width(unsigned int n).
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.149 Fl_Xlib_Graphics_Driver Class Reference

919

Static Public Attributes


static const char class_id = "Fl_Xlib_Graphics_Driver"
A string that identies each subclass of Fl_Device.

30.149.1

Detailed Description

The Xlib-specic graphics class. This class is implemented only on the Xlib platform.

30.149.2
30.149.2.1

Member Function Documentation


const char Fl Xlib Graphics Driver::class name ( ) [inline, virtual]

Returns the name of the class of this object. The class of an instance of an Fl_Device subclass can be checked with code such as:
if ( instance->class_name() == Fl_Printer::class_id ) { ... }

Reimplemented from Fl_Graphics_Driver. 30.149.2.2 void Fl Xlib Graphics Driver::color ( Fl_Color c ) [virtual]

see _color(Fl_Color c). Reimplemented from Fl_Graphics_Driver. 30.149.2.3 void Fl Xlib Graphics Driver::color ( uchar r, uchar g, uchar b ) [virtual]

see _color(uchar r, uchar g, uchar b). Implements Fl_Graphics_Driver. 30.149.2.4 int Fl Xlib Graphics Driver::descent ( ) [virtual]

see _descent(). Implements Fl_Graphics_Driver. 30.149.2.5 void Fl Xlib Graphics Driver::draw ( const char str, int n, int x, int y ) [virtual]

see _draw(const char str, int n, int x, int y). Implements Fl_Graphics_Driver. 30.149.2.6 void Fl Xlib Graphics Driver::draw ( int angle, const char str, int n, int x, int y ) [virtual]

see _draw(int angle, const char str, int n, int x, int y). Implements Fl_Graphics_Driver.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

920 30.149.2.7

Class Documentation void Fl Xlib Graphics Driver::draw ( Fl_Pixmap pxm, int XP, int YP, int WP, int HP, int cx, int cy ) [virtual]

Draws an Fl_Pixmap object to the device. Species a bounding box for the image, with the origin (upper left-hand corner) of the image offset by the cx and cy arguments. Implements Fl_Graphics_Driver.

30.149.2.8

void Fl Xlib Graphics Driver::draw ( Fl_Bitmap bm, int XP, int YP, int WP, int HP, int cx, int cy ) [virtual]

Draws an Fl_Bitmap object to the device. Species a bounding box for the image, with the origin (upper left-hand corner) of the image offset by the cx and cy arguments. Implements Fl_Graphics_Driver.

30.149.2.9

void Fl Xlib Graphics Driver::draw ( Fl_RGB_Image rgb, int XP, int YP, int WP, int HP, int cx, int cy ) [virtual]

Draws an Fl_RGB_Image object to the device. Species a bounding box for the image, with the origin (upper left-hand corner) of the image offset by the cx and cy arguments. Implements Fl_Graphics_Driver.

30.149.2.10

void Fl Xlib Graphics Driver::draw image ( const uchar buf, int X, int Y, int W, int H, int D = 3, int L = 0 ) [virtual]

see _draw_image(const uchar buf, int X,int Y,int W,int H, int D, int L). Implements Fl_Graphics_Driver.

30.149.2.11

void Fl Xlib Graphics Driver::draw image ( Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D = 3 ) [virtual]

see _draw_image(Fl_Draw_Image_Cb cb, void data, int X,int Y,int W,int H, int D). Implements Fl_Graphics_Driver.

30.149.2.12

void Fl Xlib Graphics Driver::draw image mono ( const uchar buf, int X, int Y, int W, int H, int D = 1, int L = 0 ) [virtual]

see _draw_image_mono(const uchar buf, int X,int Y,int W,int H, int D, int L). Implements Fl_Graphics_Driver.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.149 Fl_Xlib_Graphics_Driver Class Reference 30.149.2.13

921

void Fl Xlib Graphics Driver::draw image mono ( Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D = 1 ) [virtual]

see _draw_image_mono(Fl_Draw_Image_Cb cb, void data, int X,int Y,int W,int H, int D). Implements Fl_Graphics_Driver. 30.149.2.14 void Fl Xlib Graphics Driver::font ( Fl_Font face, Fl_Fontsize size ) [virtual]

see _font(Fl_Font face, Fl_Fontsize size). Reimplemented from Fl_Graphics_Driver. 30.149.2.15 int Fl Xlib Graphics Driver::height ( ) [virtual]

see _height(). Implements Fl_Graphics_Driver. 30.149.2.16 void Fl Xlib Graphics Driver::rtl draw ( const char str, int n, int x, int y ) [virtual]

see _rtl_draw(const char str, int n, int x, int y). Implements Fl_Graphics_Driver. 30.149.2.17 void Fl Xlib Graphics Driver::text extents ( const char t, int n, int & dx, int & dy, int & w, int & h ) [virtual]

see _text_extents(const char, int n, int& dx, int& dy, int& w, int& h). Reimplemented from Fl_Graphics_Driver. 30.149.2.18 double Fl Xlib Graphics Driver::width ( const char str, int n ) [virtual]

see _width(const char str, int n). Implements Fl_Graphics_Driver. 30.149.2.19 double Fl Xlib Graphics Driver::width ( unsigned int c ) [virtual]

see _width(unsigned int n). Reimplemented from Fl_Graphics_Driver.

30.149.3
30.149.3.1

Member Data Documentation


const char Fl_Xlib_Graphics_Driver::class_id = Fl Xlib Graphics Driver [static]

A string that identies each subclass of Fl_Device. Function class_name() applied to a device of this class returns this string. Reimplemented from Fl_Graphics_Driver.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

922 The documentation for this class was generated from the following les: Fl_Device.H Fl_Bitmap.cxx _color.cxx Fl_Device.cxx _draw_image.cxx Fl_Image.cxx Fl_Pixmap.cxx

Class Documentation

30.150

Fl XPM Image Class Reference

The Fl_XPM_Image class supports loading, caching, and drawing of X Pixmap (XPM) images, including transparency. #include <Fl_XPM_Image.H> Inheritance diagram for Fl_XPM_Image:

Fl_Image Fl_Pixmap Fl_XPM_Image

Public Member Functions


Fl_XPM_Image (const char lename)
The constructor loads the XPM image from the name lename.

30.150.1

Detailed Description

The Fl_XPM_Image class supports loading, caching, and drawing of X Pixmap (XPM) images, including transparency.

30.150.2
30.150.2.1

Constructor & Destructor Documentation


Fl XPM Image::Fl XPM Image ( const char name )

The constructor loads the XPM image from the name lename. The destructor free all memory and server resources that are used by the image. The documentation for this class was generated from the following les: Fl_XPM_Image.H Fl_XPM_Image.cxx
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.151 IActiveIMMApp Class Reference

923

30.151

IActiveIMMApp Class Reference

Public Member Functions


virtual long __stdcall Activate (BOOL fRestoreLayout)=0 virtual long __stdcall AssociateContext (HWND hWnd, HIMC hIME, HIMC phPrev)=0 virtual long __stdcall AssociateContextEx (HWND hWnd, HIMC hIMC, DWORD dwFlags)=0 virtual long __stdcall CongureIMEA (HKL hKL, HWND hWnd, DWORD dwMode, void pData)=0 virtual long __stdcall CongureIMEW (HKL hKL, HWND hWnd, DWORD dwMode, void pData)=0 virtual long __stdcall CreateContext (HIMC phIMC)=0 virtual long __stdcall Deactivate (void)=0 virtual long __stdcall DestroyContext (HIMC hIME)=0 virtual long __stdcall DisableIME (DWORD idThread)=0 virtual long __stdcall EnumInputContext (DWORD idThread, void ppEnum)=0 virtual long __stdcall EnumRegisterWordA (HKL hKL, LPSTR szReading, DWORD dwStyle, LPSTR szRegister, LPVOID pData, void pEnum)=0 virtual long __stdcall EnumRegisterWordW (HKL hKL, LPWSTR szReading, DWORD dwStyle, LPWSTR szRegister, LPVOID pData, void pEnum)=0 virtual long __stdcall EscapeA (HKL hKL, HIMC hIMC, UINT uEscape, LPVOID pData, LRESULT plResult)=0 virtual long __stdcall EscapeW (HKL hKL, HIMC hIMC, UINT uEscape, LPVOID pData, LRESULT plResult)=0 virtual long __stdcall FilterClientWindows (ATOM aaClassList, UINT uSize)=0 virtual long __stdcall GetCandidateListA (HIMC hIMC, DWORD dwIndex, UINT uBufLen, void pCandList, UINT puCopied)=0 virtual long __stdcall GetCandidateListCountA (HIMC hIMC, DWORD pdwListSize, DWORD pdwBufLen)=0 virtual long __stdcall GetCandidateListCountW (HIMC hIMC, DWORD pdwListSize, DWORD pdwBufLen)=0 virtual long __stdcall GetCandidateListW (HIMC hIMC, DWORD dwIndex, UINT uBufLen, void pCandList, UINT puCopied)=0 virtual long __stdcall GetCandidateWindow (HIMC hIMC, DWORD dwIndex, void pCandidate)=0 virtual long __stdcall GetCodePageA (HKL hKL, UINT uCodePage)=0 virtual long __stdcall GetCompositionFontA (HIMC hIMC, LOGFONTA plf)=0 virtual long __stdcall GetCompositionFontW (HIMC hIMC, LOGFONTW plf)=0 virtual long __stdcall GetCompositionStringA (HIMC hIMC, DWORD dwIndex, DWORD dwBufLen, LONG plCopied, LPVOID pBuf)=0 virtual long __stdcall GetCompositionStringW (HIMC hIMC, DWORD dwIndex, DWORD dwBufLen, LONG plCopied, LPVOID pBuf)=0 virtual long __stdcall GetCompositionWindow (HIMC hIMC, void pCompForm)=0 virtual long __stdcall GetContext (HWND hWnd, HIMC phIMC)=0 virtual long __stdcall GetConversionListA (HKL hKL, HIMC hIMC, LPSTR pSrc, UINT uBufLen, UINT uFlag, void pDst, UINT puCopied)=0 virtual long __stdcall GetConversionListW (HKL hKL, HIMC hIMC, LPWSTR pSrc, UINT uBufLen, UINT uFlag, void pDst, UINT puCopied)=0 virtual long __stdcall GetConversionStatus (HIMC hIMC, DWORD pfdwConversion, DWORD pfdwSentence)=0 virtual long __stdcall GetDefaultIMEWnd (HWND hWnd, HWND phDefWnd)=0

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

924

Class Documentation virtual long __stdcall GetDescriptionA (HKL hKL, UINT uBufLen, LPSTR szDescription, UINT puCopied)=0 virtual long __stdcall GetDescriptionW (HKL hKL, UINT uBufLen, LPWSTR szDescription, UINT puCopied)=0 virtual long __stdcall GetGuideLineA (HIMC hIMC, DWORD dwIndex, DWORD dwBufLen, LPSTR pBuf, DWORD pdwResult)=0 virtual long __stdcall GetGuideLineW (HIMC hIMC, DWORD dwIndex, DWORD dwBufLen, LPWSTR pBuf, DWORD pdwResult)=0 virtual long __stdcall GetIMEFileNameA (HKL hKL, UINT uBufLen, LPSTR szFileName, UINT puCopied)=0 virtual long __stdcall GetIMEFileNameW (HKL hKL, UINT uBufLen, LPWSTR szFileName, UINT puCopied)=0 virtual long __stdcall GetImeMenuItemsA (HIMC hIMC, DWORD dwFlags, DWORD dwType, void pImeParentMenu, void pImeMenu, DWORD dwSize, DWORD pdwResult)=0 virtual long __stdcall GetImeMenuItemsW (HIMC hIMC, DWORD dwFlags, DWORD dwType, void pImeParentMenu, void pImeMenu, DWORD dwSize, DWORD pdwResult)=0 virtual long __stdcall GetLangId (HKL hKL, WORD plid)=0 virtual long __stdcall GetOpenStatus (HIMC hIMC)=0 virtual long __stdcall GetProperty (HKL hKL, DWORD fdwIndex, DWORD pdwProperty)=0 virtual long __stdcall GetRegisterWordStyleA (HKL hKL, UINT nItem, STYLEBUFA pStyleBuf, UINT puCopied)=0 virtual long __stdcall GetRegisterWordStyleW (HKL hKL, UINT nItem, STYLEBUFW pStyleBuf, UINT puCopied)=0 virtual long __stdcall GetStatusWindowPos (HIMC hIMC, POINT pptPos)=0 virtual long __stdcall GetVirtualKey (HWND hWnd, UINT puVirtualKey)=0 virtual long __stdcall InstallIMEA (LPSTR szIMEFileName, LPSTR szLayoutText, HKL phKL)=0 virtual long __stdcall InstallIMEW (LPWSTR szIMEFileName, LPWSTR szLayoutText, HKL phKL)=0 virtual long __stdcall IsIME (HKL hKL)=0 virtual long __stdcall IsUIMessageA (HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam)=0 virtual long __stdcall IsUIMessageW (HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam)=0 virtual long __stdcall NotifyIME (HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)=0 virtual long __stdcall OnDefWindowProc (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT plResult)=0 virtual long __stdcall RegisterWordA (HKL hKL, LPSTR szReading, DWORD dwStyle, LPSTR szRegister)=0 virtual long __stdcall RegisterWordW (HKL hKL, LPWSTR szReading, DWORD dwStyle, LPWSTR szRegister)=0 virtual long __stdcall ReleaseContext (HWND hWnd, HIMC hIMC)=0 virtual long __stdcall SetCandidateWindow (HIMC hIMC, void pCandidate)=0 virtual long __stdcall SetCompositionFontA (HIMC hIMC, LOGFONTA plf)=0 virtual long __stdcall SetCompositionFontW (HIMC hIMC, LOGFONTW plf)=0 virtual long __stdcall SetCompositionStringA (HIMC hIMC, DWORD dwIndex, LPVOID pComp, DWORD dwCompLen, LPVOID pRead, DWORD dwReadLen)=0 virtual long __stdcall SetCompositionStringW (HIMC hIMC, DWORD dwIndex, LPVOID pComp, DWORD dwCompLen, LPVOID pRead, DWORD dwReadLen)=0 virtual long __stdcall SetCompositionWindow (HIMC hIMC, void pCompForm)=0
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.152 Fl_Input_Choice::InputMenuButton Class Reference

925

virtual long __stdcall SetConversionStatus (HIMC hIMC, DWORD fdwConversion, DWORD fdwSentence)=0 virtual long __stdcall SetOpenStatus (HIMC hIMC, BOOL fOpen)=0 virtual long __stdcall SetStatusWindowPos (HIMC hIMC, POINT pptPos)=0 virtual long __stdcall SimulateHotKey (HWND hWnd, DWORD dwHotKeyID)=0 virtual long __stdcall UnregisterWordA (HKL hKL, LPSTR szReading, DWORD dwStyle, LPSTR szUnregister)=0 virtual long __stdcall UnregisterWordW (HKL hKL, LPWSTR szReading, DWORD dwStyle, LPWSTR szUnregister)=0 The documentation for this class was generated from the following le: aimm.h

30.152

Fl Input Choice::InputMenuButton Class Reference

Inheritance diagram for Fl_Input_Choice::InputMenuButton:


Fl_Widget Fl_Menu_ Fl_Menu_Button Fl_Input_Choice::InputMenuButton

Public Member Functions


InputMenuButton (int x, int y, int w, int h, const char l=0) The documentation for this class was generated from the following le: Fl_Input_Choice.H

30.153

Fl Table::IntVector Class Reference

Public Member Functions


int back () IntVector (IntVector &o) IntVector & operator= (IntVector &o) int operator[ ] (int x) const int & operator[ ] (int x) int pop_back () void push_back (int val)

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

926 unsigned int size () void size (unsigned int count) The documentation for this class was generated from the following le: Fl_Table.H

Class Documentation

30.154

Fl Text Editor::Key Binding Struct Reference

Simple linked list associating a key/state to a function. #include <Fl_Text_Editor.H>

Public Attributes
Key_Func function
associated function

int key
the key pressed

Key_Binding next
next key binding in the list

int state
the state of key modiers

30.154.1

Detailed Description

Simple linked list associating a key/state to a function. The documentation for this struct was generated from the following le: Fl_Text_Editor.H

30.155

Fl Graphics Driver::matrix Struct Reference

A 2D coordinate transformation matrix. #include <Fl_Device.H>

Public Attributes
double a double b double c double d double x double y
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.156 Fl_Preferences::Name Class Reference

927

30.155.1

Detailed Description

A 2D coordinate transformation matrix. The documentation for this struct was generated from the following le: Fl_Device.H

30.156

Fl Preferences::Name Class Reference

Name provides a simple method to create numerical or more complex procedural names for entries and groups on the y. #include <Fl_Preferences.H>

Public Member Functions


Name (unsigned int n)
Creates a group name or entry name on the y.

Name (const char format,...)


Creates a group name or entry name on the y.

operator const char ()


Return the Name as a "C" string.

30.156.1

Detailed Description

Name provides a simple method to create numerical or more complex procedural names for entries and groups on the y. Example: prefs.set(Fl_Preferences::Name("File%d",i),le[i]);. See test/preferences.cxx as a sample for writing arrays into preferences. Name is actually implemented as a class inside Fl_Preferences. It casts into const char and gets automatically destroyed after the enclosing call ends.

30.156.2
30.156.2.1

Constructor & Destructor Documentation


Fl Preferences::Name::Name ( unsigned int n )

Creates a group name or entry name on the y. This version creates a simple unsigned integer as an entry name.
int n, i; Fl_Preferences prev( appPrefs, "PreviousFiles" ); prev.get( "n", 0 ); for ( i=0; i<n; i++ ) prev.get( Fl_Preferences::Name(i), prevFile[i], "" );

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

928 30.156.2.2 Fl Preferences::Name::Name ( const char format, ... )

Class Documentation

Creates a group name or entry name on the y. This version creates entry names as in printf.
int n, i; Fl_Preferences prefs( USER, "matthiasm.com", "test" ); prev.get( "nFiles", 0 ); for ( i=0; i<n; i++ ) prev.get( Fl_Preferences::Name( "File%d", i ), prevFile[i], "" );

The documentation for this class was generated from the following les: Fl_Preferences.H Fl_Preferences.cxx

30.157

Fl Preferences::Node Class Reference

Public Member Functions


void add (const char line) Node addChild (const char path) const char child (int ix) Node childNode (int ix) void deleteAllChildren () void deleteAllEntries () char deleteEntry (const char name) char dirty () Entry & entry (int i) Node nd (const char path) RootNode ndRoot () const char get (const char name) int getEntry (const char name) const char name () int nChildren () int nEntry () Node (const char path) Node parent () const char path () char remove () Node search (const char path, int offset=0) void set (const char name, const char value) void set (const char line) void setParent (Node parent) void setRoot (RootNode r) int write (FILE f)
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.158 Fl_Paged_Device::page_format Struct Reference

929

Static Public Attributes


static int lastEntrySet = -1 The documentation for this class was generated from the following les: Fl_Preferences.H Fl_Preferences.cxx

30.158

Fl Paged Device::page format Struct Reference

width, height and name of a page format #include <Fl_Paged_Device.H>

Public Attributes
int height
height in points

const char name


format name

int width
width in points

30.158.1

Detailed Description

width, height and name of a page format The documentation for this struct was generated from the following le: Fl_Paged_Device.H

30.159

Fl Preferences::RootNode Class Reference

Public Member Functions


char getPath (char path, int pathlen) int read () RootNode (Fl_Preferences , Root root, const char vendor, const char application) RootNode (Fl_Preferences , const char path, const char vendor, const char application) RootNode (Fl_Preferences ) int write ()

The documentation for this class was generated from the following les: Fl_Preferences.H Fl_Preferences.cxx
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

930

Class Documentation

30.160

Fl Scroll::ScrollInfo Struct Reference

Public Attributes
int child_b int child_l int child_r int child_t int hrst int hneeded int hpos int hscroll_h int hscroll_w int hscroll_x int hscroll_y int hsize int htotal int innerbox_h int innerbox_w int innerbox_x int innerbox_y int innerchild_h int innerchild_w int innerchild_x int innerchild_y int scrollsize int vrst int vneeded int vpos int vscroll_h int vscroll_w int vscroll_x int vscroll_y int vsize int vtotal

The documentation for this struct was generated from the following le: Fl_Scroll.H

30.161

Fl Text Display::Style Table Entry Struct Reference

This structure associates the color, font, andsize of a string to draw with an attribute mask matching attr. #include <Fl_Text_Display.H>
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

30.162 XUtf8FontStruct Struct Reference

931

Public Attributes
unsigned attr Fl_Color color Fl_Font font Fl_Fontsize size

30.161.1

Detailed Description

This structure associates the color, font, andsize of a string to draw with an attribute mask matching attr. The documentation for this struct was generated from the following le: Fl_Text_Display.H

30.162

XUtf8FontStruct Struct Reference

Public Attributes
int ascent int descent int encodings Font d char font_name_list XFontStruct fonts int nb_font int ranges

The documentation for this struct was generated from the following le: Xutf8.h

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

932 Windows/Linux

Class Documentation Mac Command-A Command-C Function Selects all text in the widget. Copy the current selection to the clipboard. Insert a tab. Insert a Line Feed. (Similar to literal Enter character) Insert a Form Feed. Insert a Carriage Return. Paste the clipboard. (Macs keyboards dont have "Insert" keys, but if they did, Shift-Insert would work) Cut. Copy the selection to the clipboard and delete it. (If theres no selection, Shift-Delete acts like Delete) Undo. This is a single-level undo mechanism, but all adjacent deletions and insertions are concatenated into a single "undo". Often this will undo a lot more than you expected. Redo. Currently same behavior as Z. Reserved for future multilevel undo/redo. Standard cursor movement. Can be combined with Shift to extend selection. Move to start of line. Can be combined with Shift to extend selection. Move to end of line. Can be combined with Shift to extend selection.

A C

I J

I J

L M

L M

V, Shift-Insert

Command-V

X, Shift-Delete

Command-X, Shift-Delete

Command-Z

Shift- Z

Shift-Command-Z

Arrow Keys

Arrow Keys

Home

Command-Up, Command-Left

End

Command-Down, Command-Right

Ctrl-Home

Command-Up, Move to top of Command-PgUp, document/eld. Ctrl-Left In single line input, 1.3.0 by to Generated on Fri Aug 26 2011 19:16:35 for FLTKmoves Doxygen start of line. In multiline input, moves to start of top line. Can be combined with Shift to extend selection. Command-End, Move to bottom of

Ctrl-End

Chapter 31

File Documentation
31.1 Enumerations.H File Reference

This le contains type denitions and general enumerations. #include "Fl_Export.H" #include "fl_types.h"

Denes
#dene FL_IMAGE_WITH_ALPHA 0x40000000 Version Numbers FLTK denes some constants to help the programmer to nd out, for which FLTK version a program is compiled. The following constants are dened: #dene FL_MAJOR_VERSION 1
The major release version of this FLTK library.

#dene FL_MINOR_VERSION 3
The minor release version for this library.

#dene FL_PATCH_VERSION 0
The patch version for this library.

#dene FL_VERSION
The FLTK version number as a double.

Mouse and Keyboard Events This and the following constants dene the non-ASCII keys on the keyboard for FL_KEYBOARD and FL_SHORTCUT events. Todo FL_Button and FL_key... constants could be structured better (use an enum or some doxygen grouping ?)

934 See also Fl::event_key() and Fl::get_key(int) (use ascii letters for all other keys): #dene FL_Button 0xfee8
A mouse button; use Fl_Button + n for mouse button n.

File Documentation

#dene FL_BackSpace 0xff08


The backspace key.

#dene FL_Tab 0xff09


The tab key.

#dene FL_Enter 0xff0d


The enter key.

#dene FL_Pause 0xff13


The pause key.

#dene FL_Scroll_Lock 0xff14


The scroll lock key.

#dene FL_Escape 0xff1b


The escape key.

#dene FL_Home 0xff50


The home key.

#dene FL_Left 0xff51


The left arrow key.

#dene FL_Up 0xff52


The up arrow key.

#dene FL_Right 0xff53


The right arrow key.

#dene FL_Down 0xff54


The down arrow key.

#dene FL_Page_Up 0xff55


The page-up key.

#dene FL_Page_Down 0xff56


The page-down key.

#dene FL_End 0xff57


The end key.

#dene FL_Print 0xff61


The print (or print-screen) key.

#dene FL_Insert 0xff63


The insert key.

#dene FL_Menu 0xff67


The menu key.

#dene FL_Help 0xff68


The help key on Mac keyboards.

#dene FL_Num_Lock 0xff7f


The num lock key.

#dene FL_KP 0xff80


One of the keypad numbers; use FL_KP + n for number n.

#dene FL_KP_Enter 0xff8d


The enter key on the keypad, same as Fl_KP+\r.

#dene FL_KP_Last 0xffbd


The last keypad key; use to range-check keypad.

#dene FL_F 0xffbd


One of the function keys; use FL_F + n for function key n.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

31.1 Enumerations.H File Reference #dene FL_F_Last 0xffe0


The last function key; use to range-check function keys.

935

#dene FL_Shift_L 0xffe1


The lefthand shift key.

#dene FL_Shift_R 0xffe2


The righthand shift key.

#dene FL_Control_L 0xffe3


The lefthand control key.

#dene FL_Control_R 0xffe4


The righthand control key.

#dene FL_Caps_Lock 0xffe5


The caps lock key.

#dene FL_Meta_L 0xffe7


The left meta/Windows key.

#dene FL_Meta_R 0xffe8


The right meta/Windows key.

#dene FL_Alt_L 0xffe9


The left alt key.

#dene FL_Alt_R 0xffea


The right alt key.

#dene FL_Delete 0xffff


The delete key.

#dene FL_Volume_Down 0xEF11 #dene FL_Volume_Mute 0xEF12 #dene FL_Volume_Up 0xEF13 #dene FL_Media_Play 0xEF14 #dene FL_Media_Stop 0xEF15 #dene FL_Media_Prev 0xEF16 #dene FL_Media_Next 0xEF17 #dene FL_Home_Page 0xEF18 #dene FL_Mail 0xEF19 #dene FL_Search 0xEF1B #dene FL_Back 0xEF26 #dene FL_Forward 0xEF27 #dene FL_Stop 0xEF28 #dene FL_Refresh 0xEF29 #dene FL_Sleep 0xEF2F #dene FL_Favorites 0xEF30

Mouse Buttons These constants dene the button numbers for FL_PUSH and FL_RELEASE events. See also Fl::event_button() #dene FL_LEFT_MOUSE 1
The left mouse button.

#dene FL_MIDDLE_MOUSE 2
The middle mouse button.

#dene FL_RIGHT_MOUSE 3
The right mouse button.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

936 Event States The following constants dene bits in the Fl::event_state() value. #dene FL_SHIFT 0x00010000
One of the shift keys is down.

File Documentation

#dene FL_CAPS_LOCK 0x00020000


The caps lock is on.

#dene FL_CTRL 0x00040000


One of the ctrl keys is down.

#dene FL_ALT 0x00080000


One of the alt keys is down.

#dene FL_NUM_LOCK 0x00100000


The num lock is on.

#dene FL_META 0x00400000


One of the meta/Windows keys is down.

#dene FL_SCROLL_LOCK 0x00800000


The scroll lock is on.

#dene FL_BUTTON1 0x01000000


Mouse button 1 is pushed.

#dene FL_BUTTON2 0x02000000


Mouse button 2 is pushed.

#dene FL_BUTTON3 0x04000000


Mouse button 3 is pushed.

#dene FL_BUTTONS 0x7f000000


Any mouse button is pushed.

#dene FL_BUTTON(n) (0x00800000<<(n))


Mouse button n (n > 0) is pushed.

#dene FL_KEY_MASK 0x0000ffff


All keys are 16 bit for now.

#dene FL_COMMAND FL_CTRL


An alias for FL_CTRL on WIN32 and X11, or FL_META on MacOS X.

#dene FL_CONTROL FL_META


An alias for FL_META on WIN32 and X11, or FL_CTRL on MacOS X.

Typedefs
typedef int Fl_Fontsize
Size of a font in pixels.

Enumerations
enum { FL_READ = 1, FL_WRITE = 4, FL_EXCEPT = 8 }
FD "when" conditions.

enum Fl_Damage { FL_DAMAGE_CHILD = 0x01, FL_DAMAGE_EXPOSE = 0x02, FL_DAMAGE_SCROLL = 0x04, FL_DAMAGE_OVERLAY = 0x08, FL_DAMAGE_USER1 = 0x10, FL_DAMAGE_USER2 = 0x20, FL_DAMAGE_ALL = 0x80 }
Damage masks.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

31.1 Enumerations.H File Reference

937

enum Fl_Event { FL_NO_EVENT = 0, FL_PUSH = 1, FL_RELEASE = 2, FL_ENTER = 3, FL_LEAVE = 4, FL_DRAG = 5, FL_FOCUS = 6, FL_UNFOCUS = 7, FL_KEYDOWN = 8, FL_KEYBOARD = 8, FL_KEYUP = 9, FL_CLOSE = 10, FL_MOVE = 11, FL_SHORTCUT = 12, FL_DEACTIVATE = 13, FL_ACTIVATE = 14, FL_HIDE = 15, FL_SHOW = 16, FL_PASTE = 17, FL_SELECTIONCLEAR = 18, FL_MOUSEWHEEL = 19, FL_DND_ENTER = 20, FL_DND_DRAG = 21, FL_DND_LEAVE = 22, FL_DND_RELEASE = 23 }
Every time a user moves the mouse pointer, clicks a button, or presses a key, an event is generated and sent to your application.

enum Fl_Labeltype { FL_NORMAL_LABEL = 0, FL_NO_LABEL, _FL_SHADOW_LABEL, _FL_ENGRAVED_LABEL, _FL_EMBOSSED_LABEL, _FL_MULTI_LABEL, _FL_ICON_LABEL, _FL_IMAGE_LABEL, FL_FREE_LABELTYPE }
The labeltype() method sets the type of the label.

enum Fl_Mode { FL_RGB = 0, FL_INDEX = 1, FL_SINGLE = 0, FL_DOUBLE = 2, FL_ACCUM = 4, FL_ALPHA = 8, FL_DEPTH = 16, FL_STENCIL = 32, FL_RGB8 = 64, FL_MULTISAMPLE = 128, FL_STEREO = 256, FL_FAKE_SINGLE = 512 }
visual types and Fl_Gl_Window::mode() (values match Glut)

When Conditions enum Fl_When { FL_WHEN_NEVER = 0, FL_WHEN_CHANGED = 1, FL_WHEN_NOT_CHANGED = 2, FL_WHEN_RELEASE = 4, FL_WHEN_RELEASE_ALWAYS = 6, FL_WHEN_ENTER_KEY = 8, FL_WHEN_ENTER_KEY_ALWAYS = 10, FL_WHEN_ENTER_KEY_CHANGED = 11 }
These constants determine when a callback is performed.

Cursors enum Fl_Cursor { FL_CURSOR_DEFAULT = 0, FL_CURSOR_ARROW = 35, FL_CURSOR_CROSS = 66, FL_CURSOR_WAIT = 76, FL_CURSOR_INSERT = 77, FL_CURSOR_HAND = 31, FL_CURSOR_HELP = 47, FL_CURSOR_MOVE = 27, FL_CURSOR_NS = 78, FL_CURSOR_WE = 79, FL_CURSOR_NWSE = 80, FL_CURSOR_NESW = 81, FL_CURSOR_NONE = 255, FL_CURSOR_N = 70, FL_CURSOR_NE = 69, FL_CURSOR_E = 49, FL_CURSOR_SE = 8, FL_CURSOR_S = 9, FL_CURSOR_SW = 7, FL_CURSOR_W = 36, FL_CURSOR_NW = 68 }
The following constants dene the mouse cursors that are available in FLTK.

Variables
FL_EXPORT Fl_Fontsize FL_NORMAL_SIZE
normal font size

Box Types
FLTK standard box types This enum denes the standard box types included with FLTK. FL_NO_BOX means nothing is drawn at all, so whatever is already on the screen remains. The FL_..._FRAME types only draw their edges, leaving the interior unchanged. The blue color in Figure 1 is the area that is not drawn by the frame types.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

938

File Documentation

Figure 31.1: FLTK standard box types

Todo Description of boxtypes is incomplete. See below for the dened enum Fl_Boxtype.

See also src/Fl_get_system_colors.cxx #dene FL_ROUND_UP_BOX _dene_FL_ROUND_UP_BOX() #dene FL_ROUND_DOWN_BOX (Fl_Boxtype)(_dene_FL_ROUND_UP_BOX()+1) #dene FL_SHADOW_BOX _dene_FL_SHADOW_BOX() #dene FL_SHADOW_FRAME (Fl_Boxtype)(_dene_FL_SHADOW_BOX()+2) #dene FL_ROUNDED_BOX _dene_FL_ROUNDED_BOX() #dene FL_ROUNDED_FRAME (Fl_Boxtype)(_dene_FL_ROUNDED_BOX()+2) #dene FL_RFLAT_BOX _dene_FL_RFLAT_BOX() #dene FL_RSHADOW_BOX _dene_FL_RSHADOW_BOX() #dene FL_DIAMOND_UP_BOX _dene_FL_DIAMOND_BOX() #dene FL_DIAMOND_DOWN_BOX (Fl_Boxtype)(_dene_FL_DIAMOND_BOX()+1) #dene FL_OVAL_BOX _dene_FL_OVAL_BOX() #dene FL_OSHADOW_BOX (Fl_Boxtype)(_dene_FL_OVAL_BOX()+1) #dene FL_OVAL_FRAME (Fl_Boxtype)(_dene_FL_OVAL_BOX()+2) #dene FL_OFLAT_BOX (Fl_Boxtype)(_dene_FL_OVAL_BOX()+3) #dene FL_PLASTIC_UP_BOX _dene_FL_PLASTIC_UP_BOX() #dene FL_PLASTIC_DOWN_BOX (Fl_Boxtype)(_dene_FL_PLASTIC_UP_BOX()+1) #dene FL_PLASTIC_UP_FRAME (Fl_Boxtype)(_dene_FL_PLASTIC_UP_BOX()+2) #dene FL_PLASTIC_DOWN_FRAME (Fl_Boxtype)(_dene_FL_PLASTIC_UP_BOX()+3) #dene FL_PLASTIC_THIN_UP_BOX (Fl_Boxtype)(_dene_FL_PLASTIC_UP_BOX()+4) #dene FL_PLASTIC_THIN_DOWN_BOX (Fl_Boxtype)(_dene_FL_PLASTIC_UP_BOX()+5)

#dene FL_PLASTIC_ROUND_UP_BOX (Fl_Boxtype)(_dene_FL_PLASTIC_UP_BOX()+6)

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

31.1 Enumerations.H File Reference

939

#dene FL_PLASTIC_ROUND_DOWN_BOX (Fl_Boxtype)(_dene_FL_PLASTIC_UP_BOX()+7) #dene FL_GTK_UP_BOX _dene_FL_GTK_UP_BOX() #dene FL_GTK_DOWN_BOX (Fl_Boxtype)(_dene_FL_GTK_UP_BOX()+1) #dene FL_GTK_UP_FRAME (Fl_Boxtype)(_dene_FL_GTK_UP_BOX()+2) #dene FL_GTK_DOWN_FRAME (Fl_Boxtype)(_dene_FL_GTK_UP_BOX()+3) #dene FL_GTK_THIN_UP_BOX (Fl_Boxtype)(_dene_FL_GTK_UP_BOX()+4) #dene FL_GTK_THIN_DOWN_BOX (Fl_Boxtype)(_dene_FL_GTK_UP_BOX()+5) #dene FL_GTK_THIN_UP_FRAME (Fl_Boxtype)(_dene_FL_GTK_UP_BOX()+6) #dene FL_GTK_THIN_DOWN_FRAME (Fl_Boxtype)(_dene_FL_GTK_UP_BOX()+7) #dene FL_GTK_ROUND_UP_BOX (Fl_Boxtype)(_dene_FL_GTK_UP_BOX()+8) #dene FL_GTK_ROUND_DOWN_BOX (Fl_Boxtype)(_dene_FL_GTK_UP_BOX()+9) #dene FL_FRAME FL_ENGRAVED_FRAME #dene FL_FRAME_BOX FL_ENGRAVED_BOX #dene FL_CIRCLE_BOX FL_ROUND_DOWN_BOX #dene FL_DIAMOND_BOX FL_DIAMOND_DOWN_BOX enum Fl_Boxtype { FL_NO_BOX = 0, FL_FLAT_BOX, FL_UP_BOX, FL_DOWN_BOX, FL_UP_FRAME, FL_DOWN_FRAME, FL_THIN_UP_BOX, FL_THIN_DOWN_BOX, FL_THIN_UP_FRAME, FL_THIN_DOWN_FRAME, FL_ENGRAVED_BOX, FL_EMBOSSED_BOX, FL_ENGRAVED_FRAME, FL_EMBOSSED_FRAME, FL_BORDER_BOX, _FL_SHADOW_BOX, FL_BORDER_FRAME, _FL_SHADOW_FRAME, _FL_ROUNDED_BOX, _FL_RSHADOW_BOX, _FL_ROUNDED_FRAME, _FL_RFLAT_BOX, _FL_ROUND_UP_BOX, _FL_ROUND_DOWN_BOX, _FL_DIAMOND_UP_BOX, _FL_DIAMOND_DOWN_BOX, _FL_OVAL_BOX, _FL_OSHADOW_BOX, _FL_OVAL_FRAME, _FL_OFLAT_BOX, _FL_PLASTIC_UP_BOX, _FL_PLASTIC_DOWN_BOX, _FL_PLASTIC_UP_FRAME, _FL_PLASTIC_DOWN_FRAME, _FL_PLASTIC_THIN_UP_BOX, _FL_PLASTIC_THIN_DOWN_BOX, _FL_PLASTIC_ROUND_UP_BOX, _FL_PLASTIC_ROUND_DOWN_BOX, _FL_GTK_UP_BOX, _FL_GTK_DOWN_BOX, _FL_GTK_UP_FRAME, _FL_GTK_DOWN_FRAME, _FL_GTK_THIN_UP_BOX, _FL_GTK_THIN_DOWN_BOX, _FL_GTK_THIN_UP_FRAME, _FL_GTK_THIN_DOWN_FRAME, _FL_GTK_ROUND_UP_BOX, _FL_GTK_ROUND_DOWN_BOX, FL_FREE_BOXTYPE } FL_EXPORT Fl_Boxtype _dene_FL_ROUND_UP_BOX () FL_EXPORT Fl_Boxtype _dene_FL_SHADOW_BOX () FL_EXPORT Fl_Boxtype _dene_FL_ROUNDED_BOX () FL_EXPORT Fl_Boxtype _dene_FL_RFLAT_BOX () FL_EXPORT Fl_Boxtype _dene_FL_RSHADOW_BOX () FL_EXPORT Fl_Boxtype _dene_FL_DIAMOND_BOX () FL_EXPORT Fl_Boxtype _dene_FL_OVAL_BOX () FL_EXPORT Fl_Boxtype _dene_FL_PLASTIC_UP_BOX () FL_EXPORT Fl_Boxtype _dene_FL_GTK_UP_BOX () Fl_Boxtype _box (Fl_Boxtype b)
Get the lled version of a frame.

Fl_Boxtype _down (Fl_Boxtype b)


Get the "pressed" or "down" version of a box.

Fl_Boxtype _frame (Fl_Boxtype b)


Get the unlled, frame only version of a box.

#dene FL_SYMBOL_LABEL FL_NORMAL_LABEL


Sets the current label type and return its corresponding Fl_Labeltype value.

#dene FL_SHADOW_LABEL _dene_FL_SHADOW_LABEL()


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

940 #dene FL_ENGRAVED_LABEL _dene_FL_ENGRAVED_LABEL() #dene FL_EMBOSSED_LABEL _dene_FL_EMBOSSED_LABEL() Fl_Labeltype FL_EXPORT _dene_FL_SHADOW_LABEL () Fl_Labeltype FL_EXPORT _dene_FL_ENGRAVED_LABEL () Fl_Labeltype FL_EXPORT _dene_FL_EMBOSSED_LABEL ()

File Documentation

Alignment Flags
Flags to control the label alignment. This controls how the label is displayed next to or inside the widget. The default value is FL_ALIGN_CENTER for most widgets, which centers the label inside the widget. Flags can be ord to achieve a combination of alignments.
Outside alignments: TOP_LEFT TOP TOP_RIGHT LEFT_TOP+---------------------------------+RIGHT_TOP | | LEFT| |RIGHT | | LEFT_BOTTOM+---------------------------------+RIGHT_BOTTOM BOTTOM_RIGHT BOTTOM BOTTOM_LEFT Inside alignments: +---------------------------------+ |TOP_LEFT TOP TOP_RIGHT| | | |LEFT RIGHT| | | |BOTTOM_RIGHT BOTTOM BOTTOM_LEFT| +---------------------------------+

See also FL_ALIGN_CENTER, etc. typedef unsigned Fl_Align


FLTK type for alignment control.

const Fl_Align FL_ALIGN_CENTER = (Fl_Align)0


Align the label horizontally in the middle.

const Fl_Align FL_ALIGN_TOP = (Fl_Align)1


Align the label at the top of the widget.

const Fl_Align FL_ALIGN_BOTTOM = (Fl_Align)2


Align the label at the bottom of the widget.

const Fl_Align FL_ALIGN_LEFT = (Fl_Align)4


Align the label at the left of the widget.

const Fl_Align FL_ALIGN_RIGHT = (Fl_Align)8


Align the label to the right of the widget.

const Fl_Align FL_ALIGN_INSIDE = (Fl_Align)16


Draw the label inside of the widget.

const Fl_Align FL_ALIGN_TEXT_OVER_IMAGE = (Fl_Align)0x0020


If the label contains an image, draw the text on top of the image.

const Fl_Align FL_ALIGN_IMAGE_OVER_TEXT = (Fl_Align)0x0000


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

31.1 Enumerations.H File Reference


If the label contains an image, draw the text below the image.

941

const Fl_Align FL_ALIGN_CLIP = (Fl_Align)64


All parts of the label that are lager than the widget will not be drawn .

const Fl_Align FL_ALIGN_WRAP = (Fl_Align)128


Wrap text that does not t the width of the widget.

const Fl_Align FL_ALIGN_IMAGE_NEXT_TO_TEXT = (Fl_Align)0x0100


If the label contains an image, draw the text to the right of the image.

const Fl_Align FL_ALIGN_TEXT_NEXT_TO_IMAGE = (Fl_Align)0x0120


If the label contains an image, draw the text to the left of the image.

const Fl_Align FL_ALIGN_IMAGE_BACKDROP = (Fl_Align)0x0200


If the label contains an image, draw the image or deimage in the background.

const Fl_Align FL_ALIGN_TOP_LEFT = FL_ALIGN_TOP | FL_ALIGN_LEFT const Fl_Align FL_ALIGN_TOP_RIGHT = FL_ALIGN_TOP | FL_ALIGN_RIGHT const Fl_Align FL_ALIGN_BOTTOM_LEFT = FL_ALIGN_BOTTOM | FL_ALIGN_LEFT const Fl_Align FL_ALIGN_BOTTOM_RIGHT = FL_ALIGN_BOTTOM | FL_ALIGN_RIGHT const Fl_Align FL_ALIGN_LEFT_TOP = 0x0007 const Fl_Align FL_ALIGN_RIGHT_TOP = 0x000b const Fl_Align FL_ALIGN_LEFT_BOTTOM = 0x000d const Fl_Align FL_ALIGN_RIGHT_BOTTOM = 0x000e const Fl_Align FL_ALIGN_NOWRAP = (Fl_Align)0 const Fl_Align FL_ALIGN_POSITION_MASK = 0x000f const Fl_Align FL_ALIGN_IMAGE_MASK = 0x0320

Font Numbers
The following constants dene the standard FLTK fonts: typedef int Fl_Font
A font number is an index into the internal font table.

const Fl_Font FL_HELVETICA = 0


Helvetica (or Arial) normal (0)

const Fl_Font FL_HELVETICA_BOLD = 1


Helvetica (or Arial) bold.

const Fl_Font FL_HELVETICA_ITALIC = 2


Helvetica (or Arial) oblique.

const Fl_Font FL_HELVETICA_BOLD_ITALIC = 3


Helvetica (or Arial) bold-oblique.

const Fl_Font FL_COURIER = 4


Courier normal.

const Fl_Font FL_COURIER_BOLD = 5


Courier bold.

const Fl_Font FL_COURIER_ITALIC = 6


Courier italic.

const Fl_Font FL_COURIER_BOLD_ITALIC = 7


Courier bold-italic.

const Fl_Font FL_TIMES = 8


Times roman.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

942 const Fl_Font FL_TIMES_BOLD = 9


Times roman bold.

File Documentation

const Fl_Font FL_TIMES_ITALIC = 10


Times roman italic.

const Fl_Font FL_TIMES_BOLD_ITALIC = 11


Times roman bold-italic.

const Fl_Font FL_SYMBOL = 12


Standard symbol font.

const Fl_Font FL_SCREEN = 13


Default monospaced screen font.

const Fl_Font FL_SCREEN_BOLD = 14


Default monospaced bold screen font.

const Fl_Font FL_ZAPF_DINGBATS = 15


Zapf-dingbats font.

const Fl_Font FL_FREE_FONT = 16


rst one to allocate

const Fl_Font FL_BOLD = 1


add this to helvetica, courier, or times

const Fl_Font FL_ITALIC = 2


add this to helvetica, courier, or times

const Fl_Font FL_BOLD_ITALIC = 3


add this to helvetica, courier, or times

Colors
The Fl_Color type holds an FLTK color value. Colors are either 8-bit indexes into a virtual colormap or 24-bit RGB color values. Color indices occupy the lower 8 bits of the value, while RGB colors occupy the upper 24 bits, for a byte organization of RGBI.
Fl_Color => 0xrrggbbii | | | | | | | +--| | +----| +------+---------

index between 0 and 255 blue color component (8 bit) green component (8 bit) red component (8 bit)

A color can have either an index or an rgb value. Colors with rgb set and an index >0 are reserved for special use. #dene FL_FREE_COLOR (Fl_Color)16 #dene FL_NUM_FREE_COLOR 16 #dene FL_GRAY_RAMP (Fl_Color)32 #dene FL_NUM_GRAY 24 #dene FL_GRAY FL_BACKGROUND_COLOR #dene FL_COLOR_CUBE (Fl_Color)56 #dene FL_NUM_RED 5
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

31.1 Enumerations.H File Reference #dene FL_NUM_GREEN 8 #dene FL_NUM_BLUE 5 typedef unsigned int Fl_Color
an FLTK color value

943

const Fl_Color FL_FOREGROUND_COLOR = 0


the default foreground color (0) used for labels and text

const Fl_Color FL_BACKGROUND2_COLOR = 7


the default background color for text, list, and valuator widgets

const Fl_Color FL_INACTIVE_COLOR = 8


the inactive foreground color

const Fl_Color FL_SELECTION_COLOR = 15


the default selection/highlight color

const Fl_Color FL_GRAY0 = 32 const Fl_Color FL_DARK3 = 39 const Fl_Color FL_DARK2 = 45 const Fl_Color FL_DARK1 = 47 const Fl_Color FL_BACKGROUND_COLOR = 49 const Fl_Color FL_LIGHT1 = 50 const Fl_Color FL_LIGHT2 = 52 const Fl_Color FL_LIGHT3 = 54 const Fl_Color FL_BLACK = 56 const Fl_Color FL_RED = 88 const Fl_Color FL_GREEN = 63 const Fl_Color FL_YELLOW = 95 const Fl_Color FL_BLUE = 216 const Fl_Color FL_MAGENTA = 248 const Fl_Color FL_CYAN = 223 const Fl_Color FL_DARK_RED = 72 const Fl_Color FL_DARK_GREEN = 60 const Fl_Color FL_DARK_YELLOW = 76 const Fl_Color FL_DARK_BLUE = 136 const Fl_Color FL_DARK_MAGENTA = 152 const Fl_Color FL_DARK_CYAN = 140 const Fl_Color FL_WHITE = 255 FL_EXPORT Fl_Color _inactive (Fl_Color c)
Returns the inactive, dimmed version of the given color.

FL_EXPORT Fl_Color _contrast (Fl_Color fg, Fl_Color bg)


Returns a color that contrasts with the background color.

FL_EXPORT Fl_Color _color_average (Fl_Color c1, Fl_Color c2, oat weight)


Returns the weighted average color between the two given colors.

Fl_Color _lighter (Fl_Color c)


Returns a lighter version of the specied color.

Fl_Color _darker (Fl_Color c)


Returns a darker version of the specied color.

Fl_Color _rgb_color (uchar r, uchar g, uchar b)


Returns the 24-bit color value closest to r, g, b.

Fl_Color _rgb_color (uchar g)


Returns the 24-bit color value closest to g (grayscale).
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

944 Fl_Color _gray_ramp (int i)

File Documentation

Returns a gray color value from black (i == 0) to white (i == FL_NUM_GRAY - 1).

Fl_Color _color_cube (int r, int g, int b)


Returns a color out of the color cube.

31.1.1

Detailed Description

This le contains type denitions and general enumerations.

31.1.2
31.1.2.1

Dene Documentation
#dene FL MAJOR VERSION 1

The major release version of this FLTK library. See also FL_VERSION

31.1.2.2

#dene FL MINOR VERSION 3

The minor release version for this library. FLTK remains mostly source-code compatible between minor version changes. 31.1.2.3 #dene FL PATCH VERSION 0

The patch version for this library. FLTK remains binary compatible between patches. 31.1.2.4 Value:
((double)FL_MAJOR_VERSION + \ (double)FL_MINOR_VERSION * 0.01 + \ (double)FL_PATCH_VERSION * 0.0001)

#dene FL VERSION

The FLTK version number as a double. FL_VERSION is a double that describes the major and minor version numbers. Version 1.1 is actually stored as 1.01 to allow for more than 9 minor releases. The FL_MAJOR_VERSION, FL_MINOR_VERSION, and FL_PATCH_VERSION constants give the integral values for the major, minor, and patch releases respectively.

31.1.3
31.1.3.1

Typedef Documentation
typedef int Fl_Font

A font number is an index into the internal font table.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

31.1 Enumerations.H File Reference 31.1.3.2 typedef int Fl_Fontsize

945

Size of a font in pixels. This is the approximate height of a font in pixels.

31.1.4
31.1.4.1

Enumeration Type Documentation


anonymous enum

FD "when" conditions. Enumerator: FL_READ Call the callback when there is data to be read. FL_WRITE Call the callback when data can be written without blocking. FL_EXCEPT Call the callback if an exception occurs on the le.

31.1.4.2

enum Fl_Boxtype

Enumerator: FL_NO_BOX nothing is drawn at all, this box is invisible FL_FLAT_BOX a at box FL_UP_BOX see gure 1 FL_DOWN_BOX see gure 1 FL_UP_FRAME see gure 1 FL_DOWN_FRAME see gure 1 FL_THIN_UP_BOX see gure 1 FL_THIN_DOWN_BOX see gure 1 FL_THIN_UP_FRAME see gure 1 FL_THIN_DOWN_FRAME see gure 1 FL_ENGRAVED_BOX see gure 1 FL_EMBOSSED_BOX see gure 1 FL_ENGRAVED_FRAME see gure 1 FL_EMBOSSED_FRAME see gure 1 FL_BORDER_BOX see gure 1 _FL_SHADOW_BOX see gure 1 FL_BORDER_FRAME see gure 1 _FL_SHADOW_FRAME see gure 1 _FL_ROUNDED_BOX see gure 1 _FL_RSHADOW_BOX see gure 1 _FL_ROUNDED_FRAME see gure 1 _FL_RFLAT_BOX see gure 1 _FL_ROUND_UP_BOX see gure 1
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

946 _FL_ROUND_DOWN_BOX see gure 1 _FL_DIAMOND_UP_BOX see gure 1 _FL_DIAMOND_DOWN_BOX see gure 1 _FL_OVAL_BOX see gure 1 _FL_OSHADOW_BOX see gure 1 _FL_OVAL_FRAME see gure 1 _FL_OFLAT_BOX see gure 1 _FL_PLASTIC_UP_BOX plastic version of FL_UP_BOX _FL_PLASTIC_DOWN_BOX plastic version of FL_DOWN_BOX _FL_PLASTIC_UP_FRAME plastic version of FL_UP_FRAME _FL_PLASTIC_DOWN_FRAME plastic version of FL_DOWN_FRAME _FL_PLASTIC_THIN_UP_BOX plastic version of FL_THIN_UP_BOX

File Documentation

_FL_PLASTIC_THIN_DOWN_BOX plastic version of FL_THIN_DOWN_BOX _FL_PLASTIC_ROUND_UP_BOX plastic version of FL_ROUND_UP_BOX _FL_PLASTIC_ROUND_DOWN_BOX plastic version of FL_ROUND_DOWN_BOX _FL_GTK_UP_BOX gtk+ version of FL_UP_BOX _FL_GTK_DOWN_BOX gtk+ version of FL_DOWN_BOX _FL_GTK_UP_FRAME gtk+ version of FL_UP_FRAME _FL_GTK_DOWN_FRAME gtk+ version of FL_DOWN_RAME _FL_GTK_THIN_UP_BOX gtk+ version of FL_THIN_UP_BOX _FL_GTK_THIN_DOWN_BOX gtk+ version of FL_THIN_DOWN_BOX _FL_GTK_THIN_UP_FRAME gtk+ version of FL_UP_FRAME _FL_GTK_THIN_DOWN_FRAME gtk+ version of FL_THIN_DOWN_FRAME _FL_GTK_ROUND_UP_BOX gtk+ version of FL_ROUND_UP_BOX _FL_GTK_ROUND_DOWN_BOX gtk+ version of FL_ROUND_DOWN_BOX FL_FREE_BOXTYPE the rst free box type for creation of new box types

31.1.4.3

enum Fl_Cursor

The following constants dene the mouse cursors that are available in FLTK. The double-headed arrows are bitmaps provided by FLTK on X, the others are provided by system-dened cursors. Todo enum Fl_Cursor needs maybe an image. Enumerator: FL_CURSOR_DEFAULT the default cursor, usually an arrow. FL_CURSOR_ARROW an arrow pointer. FL_CURSOR_CROSS crosshair. FL_CURSOR_WAIT watch or hourglass. FL_CURSOR_INSERT I-beam. FL_CURSOR_HAND hand (uparrow on MSWindows).
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

31.1 Enumerations.H File Reference FL_CURSOR_HELP question mark. FL_CURSOR_MOVE 4-pointed arrow. FL_CURSOR_NS up/down arrow. FL_CURSOR_WE left/right arrow. FL_CURSOR_NWSE diagonal arrow. FL_CURSOR_NESW diagonal arrow. FL_CURSOR_NONE invisible. FL_CURSOR_N for back compatibility. FL_CURSOR_NE for back compatibility. FL_CURSOR_E for back compatibility. FL_CURSOR_SE for back compatibility. FL_CURSOR_S for back compatibility. FL_CURSOR_SW for back compatibility. FL_CURSOR_W for back compatibility. FL_CURSOR_NW for back compatibility.

947

31.1.4.4

enum Fl_Damage

Damage masks. Enumerator: FL_DAMAGE_CHILD A child needs to be redrawn. FL_DAMAGE_EXPOSE The window was exposed. FL_DAMAGE_SCROLL The Fl_Scroll widget was scrolled. FL_DAMAGE_OVERLAY The overlay planes need to be redrawn. FL_DAMAGE_USER1 First user-dened damage bit. FL_DAMAGE_USER2 Second user-dened damage bit. FL_DAMAGE_ALL Everything needs to be redrawn.

31.1.4.5

enum Fl_Event

Every time a user moves the mouse pointer, clicks a button, or presses a key, an event is generated and sent to your application. Events can also come from other programs like the window manager. Events are identied by the integer argument passed to the Fl_Widget::handle() virtual method. Other information about the most recent event is stored in static locations and acquired by calling the Fl::event_() methods. This static information remains valid until the next event is read from the window system, so it is ok to look at it outside of the handle() method.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

948 See also Fl::event_text(), Fl::event_key(), class Fl:: Enumerator:

File Documentation

FL_NO_EVENT No event. FL_PUSH A mouse button has gone down with the mouse pointing at this widget. You can nd out what button by calling Fl::event_button(). You nd out the mouse position by calling Fl::event_x() and Fl::event_y(). A widget indicates that it "wants" the mouse click by returning non-zero from its Fl_Widget::handle() method. It will then become the Fl::pushed() widget and will get FL_DRAG and the matching FL_RELEASE events. If Fl_Widget::handle() returns zero then FLTK will try sending the FL_PUSH to another widget. FL_RELEASE A mouse button has been released. You can nd out what button by calling Fl::event_button(). In order to receive the FL_RELEASE event, the widget must return non-zero when handling FL_PUSH. FL_ENTER The mouse has been moved to point at this widget. This can be used for highlighting feedback. If a widget wants to highlight or otherwise track the mouse, it indicates this by returning non-zero from its handle() method. It then becomes the Fl::belowmouse() widget and will receive FL_MOVE and FL_LEAVE events. FL_LEAVE The mouse has moved out of the widget. In order to receive the FL_LEAVE event, the widget must return non-zero when handling FL_ENTER. FL_DRAG The mouse has moved with a button held down. The current button state is in Fl::event_state(). The mouse position is in Fl::event_x() and Fl::event_y(). In order to receive FL_DRAG events, the widget must return non-zero when handling FL_PUSH. FL_FOCUS This indicates an attempt to give a widget the keyboard focus. If a widget wants the focus, it should change itself to display the fact that it has the focus, and return non-zero from its handle() method. It then becomes the Fl::focus() widget and gets FL_KEYDOWN, FL_KEYUP, and FL_UNFOCUS events. The focus will change either because the window manager changed which window gets the focus, or because the user tried to navigate using tab, arrows, or other keys. You can check Fl::event_key() to gure out why it moved. For navigation it will be the key pressed and for interaction with the window manager it will be zero. FL_UNFOCUS This event is sent to the previous Fl::focus() widget when another widget gets the focus or the window loses focus. FL_KEYDOWN A key was pressed (FL_KEYDOWN) or released (FL_KEYUP). Fl_KEYBOARD is a synonym for FL_KEYDOWN. The key can be found in Fl::event_key(). The text that the key should insert can be found with Fl::event_text() and its length is in Fl::event_length(). If you use the key handle() should return 1. If you return zero then FLTK assumes you ignored the key and will then attempt to send it to a parent widget. If none of them want it, it will change the event into a FL_SHORTCUT event. To receive FL_KEYBOARD events you must also respond to the FL_FOCUS and FL_UNFOCUS events. If you are writing a text-editing widget you may also want to call the Fl::compose() function to translate individual keystrokes into non-ASCII characters. FL_KEYUP events are sent to the widget that currently has focus. This is not necessarily the same widget that received the corresponding FL_KEYDOWN event because focus may have changed between events. FL_KEYBOARD Equivalent to FL_KEYDOWN.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

31.1 Enumerations.H File Reference See also FL_KEYDOWN FL_KEYUP Key release event. See also FL_KEYDOWN

949

FL_CLOSE The user clicked the close button of a window. This event is used internally only to trigger the callback of Fl_Window derived classed. The default callback closes the window calling Fl_Window::hide(). FL_MOVE The mouse has moved without any mouse buttons held down. This event is sent to the Fl::belowmouse() widget. In order to receive FL_MOVE events, the widget must return non-zero when handling FL_ENTER. FL_SHORTCUT If the Fl::focus() widget is zero or ignores an FL_KEYBOARD event then FLTK tries sending this event to every widget it can, until one of them returns non-zero. FL_SHORTCUT is rst sent to the Fl::belowmouse() widget, then its parents and siblings, and eventually to every widget in the window, trying to nd an object that returns non-zero. FLTK tries really hard to not to ignore any keystrokes! You can also make "global" shortcuts by using Fl::add_handler(). A global shortcut will work no matter what windows are displayed or which one has the focus. FL_DEACTIVATE This widget is no longer active, due to Fl_Widget::deactivate() being called on it or one of its parents. Fl_Widget::active() may still be true after this, the widget is only active if Fl_Widget::active() is true on it and all its parents (use Fl_Widget::active_r() to check this). FL_ACTIVATE This widget is now active, due to Fl_Widget::activate() being called on it or one of its parents. FL_HIDE This widget is no longer visible, due to Fl_Widget::hide() being called on it or one of its parents, or due to a parent window being minimized. Fl_Widget::visible() may still be true after this, but the widget is visible only if visible() is true for it and all its parents (use Fl_Widget::visible_r() to check this). FL_SHOW This widget is visible again, due to Fl_Widget::show() being called on it or one of its parents, or due to a parent window being restored. Child Fl_Windows respond to this by actually creating the window if not done already, so if you subclass a window, be sure to pass FL_SHOW to the base class Fl_Widget::handle() method! FL_PASTE You should get this event some time after you call Fl::paste(). The contents of Fl::event_text() is the text to insert and the number of characters is in Fl::event_length(). FL_SELECTIONCLEAR The Fl::selection_owner() will get this event before the selection is moved to another widget. This indicates that some other widget or program has claimed the selection. Motif programs used this to clear the selection indication. Most modern programs ignore this. FL_MOUSEWHEEL The user has moved the mouse wheel. The Fl::event_dx() and Fl::event_dy() methods can be used to nd the amount to scroll horizontally and vertically. FL_DND_ENTER The mouse has been moved to point at this widget. A widget that is interested in receiving dragndrop data must return 1 to receive FL_DND_DRAG, FL_DND_LEAVE and FL_DND_RELEASE events. FL_DND_DRAG The mouse has been moved inside a widget while dragging data. A widget that is interested in receiving dragndrop data should indicate the possible drop position. FL_DND_LEAVE The mouse has moved out of the widget. FL_DND_RELEASE The user has released the mouse button dropping data into the widget. If the widget returns 1, it will receive the data in the immediately following FL_PASTE event.

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

950 31.1.4.6 enum Fl_Labeltype

File Documentation

The labeltype() method sets the type of the label. The following standard label types are included: Todo The doxygen comments are incomplete, and some labeltypes are starting with an underscore. Also, there are three external functions undocumented (yet): _dene_FL_SHADOW_LABEL() _dene_FL_ENGRAVED_LABEL() _dene_FL_EMBOSSED_LABEL() Enumerator: FL_NORMAL_LABEL draws the text (0) FL_NO_LABEL does nothing _FL_SHADOW_LABEL draws a drop shadow under the text _FL_ENGRAVED_LABEL draws edges as though the text is engraved _FL_EMBOSSED_LABEL draws edges as though the text is raised _FL_MULTI_LABEL ? _FL_ICON_LABEL draws the icon associated with the text _FL_IMAGE_LABEL ? FL_FREE_LABELTYPE rst free labeltype to use for creating own labeltypes

31.1.4.7

enum Fl_When

These constants determine when a callback is performed. See also Fl_Widget::when(); Todo doxygen comments for values are incomplete and maybe wrong or unclear Enumerator: FL_WHEN_NEVER Never call the callback. FL_WHEN_CHANGED Do the callback only when the widget value changes. FL_WHEN_NOT_CHANGED Do the callback whenever the user interacts with the widget. FL_WHEN_RELEASE Do the callback when the button or key is released and the value changes. FL_WHEN_RELEASE_ALWAYS Do the callback when the button or key is released, even if the value doesnt change. FL_WHEN_ENTER_KEY Do the callback when the user presses the ENTER key and the value changes. FL_WHEN_ENTER_KEY_ALWAYS Do the callback when the user presses the ENTER key, even if the value doesnt change. FL_WHEN_ENTER_KEY_CHANGED ?
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

31.1 Enumerations.H File Reference

951

31.1.5

Function Documentation

31.1.5.1 Fl_Boxtype box ( Fl_Boxtype b ) [inline] Get the lled version of a frame. If no lled version of a given frame exists, the behavior of this function is undened and some random box or frame is returned. 31.1.5.2 Fl_Color color cube ( int r, int g, int b ) [inline] Returns a color out of the color cube. r must be in the range 0 to FL_NUM_RED (5) minus 1, g must be in the range 0 to FL_NUM_GREEN (8) minus 1, b must be in the range 0 to FL_NUM_BLUE (5) minus 1. To get the closest color to a 8-bit set of R,G,B values use:
fl_color_cube(R * (FL_NUM_RED - 1) / 255, G * (FL_NUM_GREEN - 1) / 255, B * (FL_NUM_BLUE - 1) / 255);

31.1.5.3 Fl_Color darker ( Fl_Color c ) [inline] Returns a darker version of the specied color. 31.1.5.4 Fl_Boxtype down ( Fl_Boxtype b ) [inline] Get the "pressed" or "down" version of a box. If no "down" version of a given box exists, the behavior of this function is undened and some random box or frame is returned. 31.1.5.5 Fl_Boxtype frame ( Fl_Boxtype b ) [inline] Get the unlled, frame only version of a box. If no frame version of a given box exists, the behavior of this function is undened and some random box or frame is returned. 31.1.5.6 Fl_Color gray ramp ( int i ) [inline] Returns a gray color value from black (i == 0) to white (i == FL_NUM_GRAY - 1). FL_NUM_GRAY is dened to be 24 in the current FLTK release. To get the closest FLTK gray value to an 8-bit grayscale color I use:
fl_gray_ramp(I * (FL_NUM_GRAY - 1) / 255)

31.1.5.7 Fl_Color lighter ( Fl_Color c ) [inline] Returns a lighter version of the specied color.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

952 31.1.5.8 Fl_Color rgb color ( uchar r, uchar g, uchar b ) [inline] Returns the 24-bit color value closest to r, g, b.

File Documentation

31.1.5.9 Fl_Color rgb color ( uchar g ) [inline] Returns the 24-bit color value closest to g (grayscale).

31.1.6
31.1.6.1

Variable Documentation
const Fl_Align FL_ALIGN_BOTTOM = (Fl_Align)2

Align the label at the bottom of the widget.

31.1.6.2

const Fl_Align FL_ALIGN_CENTER = (Fl_Align)0

Align the label horizontally in the middle.

31.1.6.3

const Fl_Align FL_ALIGN_CLIP = (Fl_Align)64

All parts of the label that are lager than the widget will not be drawn .

31.1.6.4

const Fl_Align FL_ALIGN_IMAGE_BACKDROP = (Fl_Align)0x0200

If the label contains an image, draw the image or deimage in the background.

31.1.6.5

const Fl_Align FL_ALIGN_IMAGE_NEXT_TO_TEXT = (Fl_Align)0x0100

If the label contains an image, draw the text to the right of the image.

31.1.6.6

const Fl_Align FL_ALIGN_IMAGE_OVER_TEXT = (Fl_Align)0x0000

If the label contains an image, draw the text below the image.

31.1.6.7

const Fl_Align FL_ALIGN_INSIDE = (Fl_Align)16

Draw the label inside of the widget.

31.1.6.8

const Fl_Align FL_ALIGN_LEFT = (Fl_Align)4

Align the label at the left of the widget. Inside labels appear left-justied starting at the left side of the widget, outside labels are right-justied and drawn to the left of the widget.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

31.2 Fl.H File Reference 31.1.6.9 const Fl_Align FL_ALIGN_RIGHT = (Fl_Align)8

953

Align the label to the right of the widget. 31.1.6.10 const Fl_Align FL_ALIGN_TEXT_NEXT_TO_IMAGE = (Fl_Align)0x0120

If the label contains an image, draw the text to the left of the image. 31.1.6.11 const Fl_Align FL_ALIGN_TEXT_OVER_IMAGE = (Fl_Align)0x0020

If the label contains an image, draw the text on top of the image. 31.1.6.12 const Fl_Align FL_ALIGN_TOP = (Fl_Align)1

Align the label at the top of the widget. Inside labels appear below the top, outside labels are drawn on top of the widget. 31.1.6.13 const Fl_Align FL_ALIGN_WRAP = (Fl_Align)128

Wrap text that does not t the width of the widget.

31.2

Fl.H File Reference

Fl static class. #include <FL/Fl_Cairo.H> #include "fl_utf8.h" #include "Enumerations.H"

Classes
class Fl
The Fl is the FLTK global (static) class containing state information and global methods for the current application.

class Fl_Widget_Tracker
This class should be used to control safe widget deletion.

Denes
#dene Fl_Object Fl_Widget
for back compatibility - use Fl_Widget!

Typedefs
typedef void( Fl_Abort_Handler )(const char format,...)
Signature of set_abort functions passed as parameters.

typedef int( Fl_Args_Handler )(int argc, char argv, int &i)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

954
Signature of args functions passed as parameters.

File Documentation

typedef void( Fl_Atclose_Handler )(Fl_Window window, void data)


Signature of set_atclose functions passed as parameters.

typedef void( Fl_Awake_Handler )(void data)


Signature of some wakeup callback functions passed as parameters.

typedef void( Fl_Box_Draw_F )(int x, int y, int w, int h, Fl_Color color)


Signature of some box drawing functions passed as parameters.

typedef int( Fl_Event_Dispatch )(int event, Fl_Window w)


Signature of event_dispatch functions passed as parameters.

typedef int( Fl_Event_Handler )(int event)


Signature of add_handler functions passed as parameters.

typedef void( Fl_FD_Handler )(int fd, void data)


Signature of add_fd functions passed as parameters.

typedef void( Fl_Idle_Handler )(void data)


Signature of add_idle callback functions passed as parameters.

typedef void( Fl_Label_Draw_F )(const Fl_Label label, int x, int y, int w, int h, Fl_Align align)
Signature of some label drawing functions passed as parameters.

typedef void( Fl_Label_Measure_F )(const Fl_Label label, int &width, int &height)
Signature of some label measurement functions passed as parameters.

typedef void( Fl_Old_Idle_Handler )()


Signature of set_idle callback functions passed as parameters.

typedef void( Fl_Timeout_Handler )(void data)


Signature of some timeout callback functions passed as parameters.

31.2.1

Detailed Description

Fl static class.

31.3

arc.cxx File Reference

Utility functions for drawing arcs and circles. #include <FL/fl_draw.H> #include <FL/math.h>

31.3.1

Detailed Description

Utility functions for drawing arcs and circles.

31.4

arci.cxx File Reference

Utility functions for drawing circles using integers. #include <FL/fl_draw.H> #include <FL/x.H> #include <config.h>
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

31.5 _boxtype.cxx File Reference

955

31.4.1

Detailed Description

Utility functions for drawing circles using integers.

31.5

boxtype.cxx File Reference

drawing code for common box types. #include <FL/Fl.H> #include <FL/Fl_Widget.H> #include <FL/fl_draw.H> #include <config.h>

Denes
#dene D1 BORDER_WIDTH #dene D2 (BORDER_WIDTH+BORDER_WIDTH) #dene _border_box _rectbound
allow consistent naming

Functions
void _border_frame (int x, int y, int w, int h, Fl_Color c)
Draws a frame of type FL_BORDER_FRAME.

void _down_box (int x, int y, int w, int h, Fl_Color c)


Draws a box of type FL_DOWN_BOX.

void _down_frame (int x, int y, int w, int h, Fl_Color)


Draws a frame of type FL_DOWN_FRAME.

void _draw_box (Fl_Boxtype t, int x, int y, int w, int h, Fl_Color c)


Draws a box using given type, position, size and color.

void _embossed_box (int x, int y, int w, int h, Fl_Color c)


Draws a box of type FL_EMBOSSED_BOX.

void _embossed_frame (int x, int y, int w, int h, Fl_Color)


Draws a frame of type FL_EMBOSSED_FRAME.

void _engraved_box (int x, int y, int w, int h, Fl_Color c)


Draws a box of type FL_ENGRAVED_BOX.

void _engraved_frame (int x, int y, int w, int h, Fl_Color)


Draws a frame of type FL_ENGRAVED_FRAME.

void _frame (const char s, int x, int y, int w, int h)


Draws a series of line segments around the given box.

void _frame2 (const char s, int x, int y, int w, int h)


Draws a series of line segments around the given box.

uchar _gray_ramp () void _internal_boxtype (Fl_Boxtype t, Fl_Box_Draw_F f)


Sets the drawing function for a given box type.

void _no_box (int, int, int, int, Fl_Color)


Draws a box of type FL_NO_BOX.

void _rectbound (int x, int y, int w, int h, Fl_Color bgcolor)


Draws a bounded rectangle with a given position, size and color.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

956 void _thin_down_box (int x, int y, int w, int h, Fl_Color c)


Draws a box of type FL_THIN_DOWN_BOX.

File Documentation

void _thin_down_frame (int x, int y, int w, int h, Fl_Color)


Draws a frame of type FL_THIN_DOWN_FRAME.

void _thin_up_box (int x, int y, int w, int h, Fl_Color c)


Draws a box of type FL_THIN_UP_BOX.

void _thin_up_frame (int x, int y, int w, int h, Fl_Color)


Draws a frame of type FL_THIN_UP_FRAME.

void _up_box (int x, int y, int w, int h, Fl_Color c)


Draws a box of type FL_UP_BOX.

void _up_frame (int x, int y, int w, int h, Fl_Color)


Draws a frame of type FL_UP_FRAME.

31.5.1

Detailed Description

drawing code for common box types.

31.5.2
31.5.2.1

Function Documentation
void internal boxtype ( Fl_Boxtype t, Fl_Box_Draw_F f )

Sets the drawing function for a given box type. Parameters in in

t box type f box drawing function

31.5.2.2

void rectbound ( int x, int y, int w, int h, Fl_Color bgcolor )

Draws a bounded rectangle with a given position, size and color. Equivalent to drawing a box of type FL_BORDER_BOX.

31.6

color.cxx File Reference

Color handling. #include "Fl_XColor.H" #include <FL/Fl.H> #include <FL/x.H> #include <FL/fl_draw.H> #include "fl_cmap.h"

Denes
#dene _overlay 0
HAVE_OVERLAY determines whether _overlay is variable or dened as 0.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

31.7 Fl_Color_Chooser.H File Reference

957

Functions
Fl_Color _color_average (Fl_Color color1, Fl_Color color2, oat weight)
Returns the weighted average color between the two given colors.

Fl_Color _contrast (Fl_Color fg, Fl_Color bg)


Returns a color that contrasts with the background color.

Fl_Color _inactive (Fl_Color c)


Returns the inactive, dimmed version of the given color.

ulong _xpixel (uchar r, uchar g, uchar b)


Returns the X pixel number used to draw the given rgb color.

ulong _xpixel (Fl_Color i)


Returns the X pixel number used to draw the given FLTK color index.

Variables
uchar _bluemask
color mask used in current color map handling

int _blueshift
color shift used in current color map handling

int _extrashift
color shift used in current color map handling

uchar _greenmask
color mask used in current color map handling

int _greenshift
color shift used in current color map handling

uchar _redmask
color mask used in current color map handling

int _redshift
color shift used in current color map handling

Fl_XColor _xmap [1][256]


HAVE_OVERLAY determines whether _xmap is one or two planes.

31.6.1

Detailed Description

Color handling.

31.7

Fl Color Chooser.H File Reference

Fl_Color_Chooser widget . #include <FL/Fl_Group.H> #include <FL/Fl_Box.H> #include <FL/Fl_Return_Button.H> #include <FL/Fl_Choice.H> #include <FL/Fl_Value_Input.H>

Classes
class Fl_Color_Chooser
The Fl_Color_Chooser widget provides a standard RGB color chooser.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

958

File Documentation

31.7.1

Detailed Description

Fl_Color_Chooser widget .

31.8

curve.cxx File Reference

Utility for drawing Bezier curves, adding the points to the current _begin/_vertex/_end path. #include <FL/fl_draw.H> #include <math.h>

31.8.1

Detailed Description

Utility for drawing Bezier curves, adding the points to the current _begin/_vertex/_end path. Incremental math implementation: I very much doubt this is optimal! From Foley/vanDam page 511. If anybody has a better algorithm, please send it!

31.9

Fl Device.H File Reference

declaration of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device, Fl_Device_Plugin. #include <FL/x.H> #include <FL/Fl_Plugin.H> #include <FL/Fl_Image.H> #include <FL/Fl_Bitmap.H> #include <FL/Fl_Pixmap.H> #include <FL/Fl_RGB_Image.H>

Classes
class Fl_Device
All graphical output devices and all graphics systems.

class Fl_Device_Plugin
This plugin socket allows the integration of new device drivers for special window or screen types.

class Fl_Display_Device
A display to which the computer can draw.

class Fl_GDI_Graphics_Driver
The MSWindows-specic graphics class.

class Fl_Graphics_Driver
A virtual class subclassed for each graphics driver FLTK uses.

class Fl_Quartz_Graphics_Driver
The Mac OS X-specic graphics class.

class Fl_Surface_Device
A surface thats susceptible to receive graphical output.

class Fl_Xlib_Graphics_Driver
The Xlib-specic graphics class.

struct Fl_Graphics_Driver::matrix
A 2D coordinate transformation matrix.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

31.10 _draw.H File Reference

959

Denes
#dene FL_MATRIX_STACK_SIZE 32 #dene FL_REGION_STACK_SIZE 10 #dene XPOINT XPoint

Typedefs
typedef short COORD_T typedef void( Fl_Draw_Image_Cb )(void data, int x, int y, int w, uchar buf)
signature of image generation callback function.

Variables
FL_EXPORT Fl_Graphics_Driver _graphics_driver
Points to the driver that currently receives all graphics requests.

31.9.1

Detailed Description

declaration of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device, Fl_Device_Plugin.

31.9.2
31.9.2.1

Typedef Documentation
typedef void( Fl_Draw_Image_Cb)(void data, int x, int y, int w, uchar buf)

signature of image generation callback function. Parameters in in out

data user data passed to function x,y,w position and width of scan line in image buf buffer for generated image data. You must copy w pixels from scanline y, starting at pixel x to this buffer.

31.10

draw.H File Reference

utility header to pull drawing functions together #include <FL/x.H> #include <FL/Enumerations.H> #include <FL/Fl_Window.H> #include <FL/Fl_Device.H>

Denes
#dene _clip _push_clip
Intersects the current clip region with a rectangle and pushes this new region onto the stack (deprecated).

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

960

File Documentation

Enumerations
enum { FL_SOLID = 0, FL_DASH = 1, FL_DOT = 2, FL_DASHDOT = 3, FL_DASHDOTDOT = 4, FL_CAP_FLAT = 0x100, FL_CAP_ROUND = 0x200, FL_CAP_SQUARE = 0x300, FL_JOIN_MITER = 0x1000, FL_JOIN_ROUND = 0x2000, FL_JOIN_BEVEL = 0x3000 }

Functions
FL_EXPORT int _add_symbol (const char name, void(drawit)(Fl_Color), int scalable)
Adds a symbol to the system.

void _arc (int x, int y, int w, int h, double a1, double a2)
Draw ellipse sections using integer coordinates.

void _arc (double x, double y, double r, double start, double end)


Adds a series of points to the current path on the arc of a circle.

void _begin_complex_polygon ()
Starts drawing a complex lled polygon.

void _begin_line ()
Starts drawing a list of lines.

void _begin_loop ()
Starts drawing a closed sequence of lines.

void _begin_points ()
Starts drawing a list of points.

void _begin_polygon ()
Starts drawing a convex lled polygon.

FL_EXPORT char _can_do_alpha_blending ()


Checks whether platform supports true alpha blending for RGBA images.

FL_EXPORT void _chord (int x, int y, int w, int h, double a1, double a2)
_chord declaration is a place holder - the function does not yet exist

void _circle (double x, double y, double r)


_circle() is equivalent to _arc(x,y,r,0,360), but may be faster.

int _clip_box (int x, int y, int w, int h, int &X, int &Y, int &W, int &H)
Intersects the rectangle with the current clip region and returns the bounding box of the result.

void _clip_region (Fl_Region r)


Replaces the top of the clipping stack with a clipping region of any shape.

Fl_Region _clip_region ()
Returns the current clipping region.

void _color (Fl_Color c)


Sets the color for all subsequent drawing operations.

void _color (int c)


for back compatibility - use _color(Fl_Color c) instead

void _color (uchar r, uchar g, uchar b)


Sets the color for all subsequent drawing operations.

Fl_Color _color ()
Returns the last _color() that was set.

FL_EXPORT void _cursor (Fl_Cursor, Fl_Color fg=FL_BLACK, Fl_Color bg=FL_WHITE)


Sets the cursor for the current window to the specied shape and colors.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

31.10 _draw.H File Reference

961

void _curve (double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3)
Adds a series of points on a Bezier curve to the path.

int _descent ()
Returns the recommended distance above the bottom of a _height() tall box to draw the text at so it looks centered vertically in that box.

FL_EXPORT void _draw (const char str, int x, int y)


Draws a nul-terminated string starting at the given location.

FL_EXPORT void _draw (int angle, const char str, int x, int y)
Draws a nul-terminated string starting at the given location and rotating angle degrees counter-clockwise.

void _draw (const char str, int n, int x, int y)


Draws an array of n characters starting at the given location.

void _draw (int angle, const char str, int n, int x, int y)
Draws an array of n characters starting at the given location, rotating angle degrees counter-clockwise.

FL_EXPORT void _draw (const char str, int x, int y, int w, int h, Fl_Align align, Fl_Image img=0, int draw_symbols=1)
Fancy string drawing function which is used to draw all the labels.

FL_EXPORT void _draw (const char str, int x, int y, int w, int h, Fl_Align align, void(callthis)(const char , int, int, int), Fl_Image img=0, int draw_symbols=1)
The same as _draw(const char,int,int,int,int,Fl_Align,Fl_Image,int) with the addition of the callthis parameter, which is a pointer to a text drawing function such as _draw(const char, int, int, int) to do the real work.

FL_EXPORT void _draw_box (Fl_Boxtype, int x, int y, int w, int h, Fl_Color)


Draws a box using given type, position, size and color.

void _draw_image (const uchar buf, int X, int Y, int W, int H, int D=3, int L=0)
Draws an 8-bit per color RGB or luminance image.

void _draw_image (Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D=3)
Draws an image using a callback function to generate image data.

void _draw_image_mono (const uchar buf, int X, int Y, int W, int H, int D=1, int L=0)
Draws a gray-scale (1 channel) image.

FL_EXPORT void _draw_image_mono (Fl_Draw_Image_Cb cb, void data, int X, int Y, int W, int H, int D=1)
Draws a gray-scale image using a callback function to generate image data.

FL_EXPORT int _draw_pixmap (char const data, int x, int y, Fl_Color=FL_GRAY)


Draw XPM image data, with the top-left corner at the given position.

FL_EXPORT int _draw_pixmap (const char const cdata, int x, int y, Fl_Color=FL_GRAY)
Draw XPM image data, with the top-left corner at the given position.

FL_EXPORT int _draw_symbol (const char label, int x, int y, int w, int h, Fl_Color)
Draw the named symbol in the given rectangle using the given color.

void _end_complex_polygon ()
Ends complex lled polygon, and draws.

void _end_line ()
Ends list of lines, and draws.

void _end_loop ()
Ends closed sequence of lines, and draws.

void _end_points ()
Ends list of points, and draws.

void _end_polygon ()
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

962
Ends convex lled polygon, and draws.

File Documentation

FL_EXPORT const char _expand_text (const char from, char buf, int maxbuf, double maxw, int &n, double &width, int wrap, int draw_symbols=0)
Copy from to buf, replacing unprintable characters with X and \nnn.

void _font (Fl_Font face, Fl_Fontsize size)


Sets the current font, which is then used in various drawing routines.

Fl_Font _font ()
Returns the face set by the most recent call to _font().

FL_EXPORT void _frame (const char s, int x, int y, int w, int h)


Draws a series of line segments around the given box.

FL_EXPORT void _frame2 (const char s, int x, int y, int w, int h)


Draws a series of line segments around the given box.

void _gap ()
Call _gap() to separate loops of the path.

int _height ()
Returns the recommended minimum line spacing for the current font.

FL_EXPORT int _height (int font, int size)


This function returns the actual height of the specied font and size.

FL_EXPORT const char _latin1_to_local (const char t, int n=-1)


Converts text from Windows/X11 latin1 character set to local encoding.

void _line (int x, int y, int x1, int y1)


Draws a line from (x,y) to (x1,y1)

void _line (int x, int y, int x1, int y1, int x2, int y2)
Draws a line from (x,y) to (x1,y1) and another from (x1,y1) to (x2,y2)

void _line_style (int style, int width=0, char dashes=0)


Sets how to draw lines (the "pen").

FL_EXPORT const char _local_to_latin1 (const char t, int n=-1)


Converts text from local encoding to Windowx/X11 latin1 character set.

FL_EXPORT const char _local_to_mac_roman (const char t, int n=-1)


Converts text from local encoding to Mac Roman character set.

void _loop (int x, int y, int x1, int y1, int x2, int y2)
Outlines a 3-sided polygon with lines.

void _loop (int x, int y, int x1, int y1, int x2, int y2, int x3, int y3)
Outlines a 4-sided polygon with lines.

FL_EXPORT const char _mac_roman_to_local (const char t, int n=-1)


Converts text from Mac Roman character set to local encoding.

FL_EXPORT void _measure (const char str, int &x, int &y, int draw_symbols=1)
Measure how wide and tall the string will be when printed by the _draw() function with align parameter.

FL_EXPORT int _measure_pixmap (char const data, int &w, int &h)
Get the dimensions of a pixmap.

FL_EXPORT int _measure_pixmap (const char const cdata, int &w, int &h)
Get the dimensions of a pixmap.

void _mult_matrix (double a, double b, double c, double d, double x, double y)


Concatenates another transformation onto the current one.

int _not_clipped (int x, int y, int w, int h)


Does the rectangle intersect the current clip region?

FL_EXPORT unsigned int _old_shortcut (const char s)


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

31.10 _draw.H File Reference


Emulation of XForms named shortcuts.

963

FL_EXPORT void _overlay_clear ()


Erase a selection rectangle without drawing a new one.

FL_EXPORT void _overlay_rect (int x, int y, int w, int h)


Draws a selection rectangle, erasing a previous one by XORing it rst.

void _pie (int x, int y, int w, int h, double a1, double a2)
Draw lled ellipse sections using integer coordinates.

void _point (int x, int y)


Draws a single pixel at the given coordinates.

void _polygon (int x, int y, int x1, int y1, int x2, int y2)
Fills a 3-sided polygon.

void _polygon (int x, int y, int x1, int y1, int x2, int y2, int x3, int y3)
Fills a 4-sided polygon.

void _pop_clip ()
Restores the previous clip region.

void _pop_matrix ()
Restores the current transformation matrix from the stack.

void _push_clip (int x, int y, int w, int h)


Intersects the current clip region with a rectangle and pushes this new region onto the stack.

void _push_matrix ()
Saves the current transformation matrix on the stack.

void _push_no_clip ()
Pushes an empty clip region onto the stack so nothing will be clipped.

FL_EXPORT uchar _read_image (uchar p, int X, int Y, int W, int H, int alpha=0)
Reads an RGB(A) image from the current window or off-screen buffer.

void _rect (int x, int y, int w, int h)


Draws a 1-pixel border inside the given bounding box.

void _rect (int x, int y, int w, int h, Fl_Color c)


Draws with passed color a 1-pixel border inside the given bounding box.

void _rectf (int x, int y, int w, int h)


Colors with current color a rectangle that exactly lls the given bounding box.

void _rectf (int x, int y, int w, int h, Fl_Color c)


Colors with passed color a rectangle that exactly lls the given bounding box.

FL_EXPORT void _rectf (int x, int y, int w, int h, uchar r, uchar g, uchar b)
Colors a rectangle with "exactly" the passed r,g,b color.

FL_EXPORT void _reset_spot (void) void _restore_clip ()


Undoes any clobbering of clip done by your program.

void _rotate (double d)


Concatenates rotation transformation onto the current one.

void _rtl_draw (const char str, int n, int x, int y)


Draws an array of n characters right to left starting at given location.

void _scale (double x, double y)


Concatenates scaling transformation onto the current one.

void _scale (double x)


Concatenates scaling transformation onto the current one.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

964

File Documentation FL_EXPORT void _scroll (int X, int Y, int W, int H, int dx, int dy, void(draw_area)(void , int, int, int, int), void data)
Scroll a rectangle and draw the newly exposed portions.

FL_EXPORT void _set_spot (int font, int size, int X, int Y, int W, int H, Fl_Window win=0) FL_EXPORT void _set_status (int X, int Y, int W, int H) FL_EXPORT const char _shortcut_label (unsigned int shortcut)
Get a human-readable string from a shortcut value.

FL_EXPORT const char _shortcut_label (unsigned int shortcut, const char eom)
Get a human-readable string from a shortcut value.

Fl_Fontsize _size ()
Returns the size set by the most recent call to _font().

FL_EXPORT void _text_extents (const char , int &dx, int &dy, int &w, int &h)
Determines the minimum pixel dimensions of a nul-terminated string.

void _text_extents (const char t, int n, int &dx, int &dy, int &w, int &h)
Determines the minimum pixel dimensions of a sequence of n characters.

double _transform_dx (double x, double y)


Transforms distance using current transformation matrix.

double _transform_dy (double x, double y)


Transforms distance using current transformation matrix.

double _transform_x (double x, double y)


Transforms coordinate using the current transformation matrix.

double _transform_y (double x, double y)


Transforms coordinate using the current transformation matrix.

void _transformed_vertex (double xf, double yf)


Adds coordinate pair to the vertex list without further transformations.

void _translate (double x, double y)


Concatenates translation transformation onto the current one.

void _vertex (double x, double y)


Adds a single vertex to the current path.

FL_EXPORT double _width (const char txt)


Returns the typographical width of a nul-terminated string.

double _width (const char txt, int n)


Returns the typographical width of a sequence of n characters.

double _width (unsigned int c)


Returns the typographical width of a single character.

void _xyline (int x, int y, int x1)


Draws a horizontal line from (x,y) to (x1,y)

void _xyline (int x, int y, int x1, int y2)


Draws a horizontal line from (x,y) to (x1,y), then vertical from (x1,y) to (x1,y2)

void _xyline (int x, int y, int x1, int y2, int x3)
Draws a horizontal line from (x,y) to (x1,y), then a vertical from (x1,y) to (x1,y2) and then another horizontal from (x1,y2) to (x3,y2)

void _yxline (int x, int y, int y1)


Draws a vertical line from (x,y) to (x,y1)

void _yxline (int x, int y, int y1, int x2)


Draws a vertical line from (x,y) to (x,y1), then a horizontal from (x,y1) to (x2,y1)

void _yxline (int x, int y, int y1, int x2, int y3)
Draws a vertical line from (x,y) to (x,y1) then a horizontal from (x,y1) to (x2,y1), then another vertical from (x2,y1) to (x2,y3)
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

31.11 _line_style.cxx File Reference

965

Variables
FL_EXPORT char _draw_shortcut

31.10.1

Detailed Description

utility header to pull drawing functions together

31.11

line style.cxx File Reference

Line style drawing utility hiding different platforms. #include <FL/Fl.H> #include <FL/fl_draw.H> #include <FL/x.H> #include <FL/Fl_Printer.H> #include "flstring.h" #include <stdio.h>

Variables
int _line_width_ = 0

31.11.1

Detailed Description

Line style drawing utility hiding different platforms.

31.12

Fl Native File Chooser.H File Reference

Fl_Native_File_Chooser widget. #include <FL/Fl_File_Chooser.H> #include <unistd.h>

Classes
class Fl_Native_File_Chooser
This class lets an FLTK application easily and consistently access the operating systems native le chooser.

31.12.1

Detailed Description

Fl_Native_File_Chooser widget.

31.13

Fl Paged Device.cxx File Reference

implementation of class Fl_Paged_Device. #include <FL/Fl_Paged_Device.H> #include <FL/Fl.H> #include <FL/fl_draw.H>


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

966

File Documentation

31.13.1

Detailed Description

implementation of class Fl_Paged_Device.

31.14

Fl Paged Device.H File Reference

declaration of class Fl_Paged_Device. #include <FL/Fl_Device.H> #include <FL/Fl_Window.H>

Classes
class Fl_Paged_Device
Represents page-structured drawing surfaces.

struct Fl_Paged_Device::page_format
width, height and name of a page format

Denes
#dene NO_PAGE_FORMATS 30
Number of elements in enum Page_Format.

31.14.1

Detailed Description

declaration of class Fl_Paged_Device.

31.15

Fl PostScript.H File Reference

declaration of classes Fl_PostScript_Graphics_Driver, Fl_PostScript_File_Device. #include <FL/Fl_Paged_Device.H> #include <FL/fl_draw.H>

Classes
class Fl_PostScript_File_Device
To send graphical output to a PostScript le.

class Fl_PostScript_Graphics_Driver
PostScript graphical backend.

31.15.1

Detailed Description

declaration of classes Fl_PostScript_Graphics_Driver, Fl_PostScript_File_Device.


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

31.16 Fl_Printer.H File Reference

967

31.16

Fl Printer.H File Reference

declaration of classes Fl_Printer, Fl_System_Printer and Fl_PostScript_Printer. #include <FL/x.H> #include <FL/Fl_Paged_Device.H> #include <FL/fl_draw.H> #include <FL/Fl_Pixmap.H> #include <FL/Fl_RGB_Image.H> #include <FL/Fl_Bitmap.H> #include <stdio.h> #include <FL/Fl_PostScript.H>

Classes
class Fl_PostScript_Printer
Print support under Unix/Linux.

class Fl_Printer
OS-independent print support.

class Fl_System_Printer
Print support under MSWindows and Mac OS.

31.16.1

Detailed Description

declaration of classes Fl_Printer, Fl_System_Printer and Fl_PostScript_Printer.

31.17

rect.cxx File Reference

Drawing and clipping routines for rectangles. #include <config.h> #include <FL/Fl.H> #include <FL/Fl_Widget.H> #include <FL/Fl_Printer.H> #include <FL/fl_draw.H> #include <FL/x.H>

Functions
Fl_Region XRectangleRegion (int x, int y, int w, int h)

Variables
int _line_width_

31.17.1

Detailed Description

Drawing and clipping routines for rectangles.

31.18

Fl Shared Image.H File Reference

Fl_Shared_Image class. #include "Fl_Image.H"


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

968

File Documentation

Classes
class Fl_Shared_Image
This class supports caching, loading, and drawing of image les.

Typedefs
typedef Fl_Image ( Fl_Shared_Handler )(const char name, uchar header, int headerlen)

Functions
FL_EXPORT void _register_images ()
Register the image formats.

31.18.1

Detailed Description

Fl_Shared_Image class.

31.18.2
31.18.2.1

Function Documentation
FL EXPORT void register images ( )

Register the image formats. This function is provided in the tk_images library and registers all of the "extra" image le formats that are not part of the core FLTK library.

31.19

show colormap.H File Reference

The _show_colormap() function hides the implementation classes used to provide the popup window and color selection mechanism.

Functions
FL_EXPORT Fl_Color _show_colormap (Fl_Color oldcol)
Pops up a window to let the user pick a colormap entry.

31.19.1

Detailed Description

The _show_colormap() function hides the implementation classes used to provide the popup window and color selection mechanism.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

31.20 Fl_Tree.H File Reference

969

31.20

Fl Tree.H File Reference

This le contains the denitions of the Fl_Tree class. #include <FL/Fl.H> #include <FL/Fl_Group.H> #include <FL/Fl_Scrollbar.H> #include <FL/fl_draw.H> #include <FL/Fl_Tree_Item.H> #include <FL/Fl_Tree_Prefs.H>

Classes
class Fl_Tree
Tree widget.

Enumerations
enum Fl_Tree_Reason { FL_TREE_REASON_NONE = 0, FL_TREE_REASON_SELECTED, FL_TREE_REASON_DESELECTED, FL_TREE_REASON_OPENED, FL_TREE_REASON_CLOSED }
The reason the callback was invoked.

31.20.1

Detailed Description

This le contains the denitions of the Fl_Tree class.

31.20.2
31.20.2.1

Enumeration Type Documentation


enum Fl_Tree_Reason

The reason the callback was invoked. Enumerator: FL_TREE_REASON_NONE unknown reason FL_TREE_REASON_SELECTED an item was selected FL_TREE_REASON_DESELECTED an item was de-selected FL_TREE_REASON_OPENED an item was opened FL_TREE_REASON_CLOSED an item was closed

31.21

Fl Tree Item.H File Reference

This le contains the denitions for Fl_Tree_Item. #include <FL/Fl.H> #include <FL/Fl_Widget.H> #include <FL/Fl_Image.H> #include <FL/fl_draw.H> #include <FL/Fl_Tree_Item_Array.H> #include <FL/Fl_Tree_Prefs.H>
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

970

File Documentation

Classes
class Fl_Tree_Item
Tree item.

31.21.1

Detailed Description

This le contains the denitions for Fl_Tree_Item.

31.22

Fl Tree Item Array.H File Reference

This le denes a class that manages an array of Fl_Tree_Item pointers. #include "Fl_Export.H"

Classes
class Fl_Tree_Item_Array
Manages an array of Fl_Tree_Item pointers.

Variables
class FL_EXPORT Fl_Tree_Item

31.22.1

Detailed Description

This le denes a class that manages an array of Fl_Tree_Item pointers.

31.23

Fl Tree Prefs.H File Reference

This le contains the denitions for Fl_Trees preferences.

Classes
class Fl_Tree_Prefs
Tree widgets preferences.

Enumerations
enum Fl_Tree_Connector { FL_TREE_CONNECTOR_NONE = 0, FL_TREE_CONNECTOR_DOTTED = 1, FL_TREE_CONNECTOR_SOLID = 2 }
Denes the style of connection lines between items.

enum Fl_Tree_Select { FL_TREE_SELECT_NONE = 0, FL_TREE_SELECT_SINGLE = 1, FL_TREE_SELECT_MULTI = 2 }


Tree selection style.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

31.23 Fl_Tree_Prefs.H File Reference

971

enum Fl_Tree_Sort { FL_TREE_SORT_NONE = 0, FL_TREE_SORT_ASCENDING = 1, FL_TREE_SORT_DESCENDING = 2 }


Sort order options for items added to the tree.

31.23.1

Detailed Description

This le contains the denitions for Fl_Trees preferences.


Fl_Tree_Prefs : .....:....... : : Fl_Tree : |_____ Fl_Tree_Item

31.23.2
31.23.2.1

Enumeration Type Documentation


enum Fl_Tree_Connector

Denes the style of connection lines between items. Enumerator: FL_TREE_CONNECTOR_NONE Use no lines connecting items. FL_TREE_CONNECTOR_DOTTED Use dotted lines connecting items (default) FL_TREE_CONNECTOR_SOLID Use solid lines connecting items.

31.23.2.2

enum Fl_Tree_Select

Tree selection style. Enumerator: FL_TREE_SELECT_NONE Nothing selected when items are clicked. FL_TREE_SELECT_SINGLE Single item selected when item is clicked (default) FL_TREE_SELECT_MULTI Multiple items can be selected by clicking with. SHIFT or CTRL or mouse drags.

31.23.2.3

enum Fl_Tree_Sort

Sort order options for items added to the tree. Enumerator: FL_TREE_SORT_NONE No sorting; items are added in the order dened (default). FL_TREE_SORT_ASCENDING Add items in ascending sort order. FL_TREE_SORT_DESCENDING Add items in descending sort order.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

972

File Documentation

31.24

types.h File Reference

This le contains simple "C"-style type denitions.

Typedefs
Miscellaneous typedef unsigned char uchar
unsigned char

typedef unsigned long ulong


unsigned long

typedef char Fl_String


Flexible length utf8 Unicode text.

typedef const char Fl_CString


Flexible length utf8 Unicode read-only string.

typedef unsigned int Fl_Shortcut


24-bit Unicode character + 8-bit indicator for keyboard ags

typedef unsigned int Fl_Char


24-bit Unicode character - upper 8-bits are unused

31.24.1

Detailed Description

This le contains simple "C"-style type denitions.

31.24.2
31.24.2.1

Typedef Documentation
typedef const char Fl_CString

Flexible length utf8 Unicode read-only string. See also Fl_String

31.24.2.2

typedef char Fl_String

Flexible length utf8 Unicode text. Todo FIXME: temporary (?) typedef to mark UTF8 and Unicode conversions

31.25

utf8.h File Reference

header for Unicode and UTF8 chracter handling #include "Fl_Export.H" #include "fl_types.h" #include <stdio.h> #include <string.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include "Xutf8.h" #include <X11/Xlocale.h> #include <X11/Xlib.h> #include <locale.h>
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

31.25 _utf8.h File Reference

973

Denes
#dene xchar unsigned short

Functions
FL_EXPORT int _access (const char f, int mode) FL_EXPORT int _chmod (const char f, int mode) FL_EXPORT int _execvp (const char le, char const argv) FL_EXPORT FILE _fopen (const char f, const char mode) FL_EXPORT char _getcwd (char buf, int maxlen) FL_EXPORT char _getenv (const char name) FL_EXPORT char _make_path (const char path) FL_EXPORT void _make_path_for_le (const char path) FL_EXPORT int _mkdir (const char f, int mode) FL_EXPORT unsigned int _nonspacing (unsigned int ucs)
returns true if the character is non-spacing.

FL_EXPORT int _open (const char f, int o,...) FL_EXPORT int _rename (const char f, const char t) FL_EXPORT int _rmdir (const char f) FL_EXPORT int _stat (const char path, struct stat buffer) FL_EXPORT int _system (const char f) FL_EXPORT int _tolower (unsigned int ucs)
return the Unicode lower case value of ucs

FL_EXPORT int _toupper (unsigned int ucs)


return the Unicode upper case value of ucs

FL_EXPORT unsigned _ucs_to_Utf16 (const unsigned ucs, unsigned short dst, const unsigned dstlen) FL_EXPORT int _unlink (const char f) FL_EXPORT char _utf2mbcs (const char s)
converts UTF8 to a local multi-byte character string.

FL_EXPORT const char _utf8back (const char p, const char start, const char end) FL_EXPORT int _utf8bytes (unsigned ucs)
Return the number of bytes needed to encode the given UCS4 character in UTF8.

FL_EXPORT unsigned _utf8decode (const char p, const char end, int len) FL_EXPORT int _utf8encode (unsigned ucs, char buf) FL_EXPORT unsigned _utf8from_mb (char dst, unsigned dstlen, const char src, unsigned srclen) FL_EXPORT unsigned _utf8froma (char dst, unsigned dstlen, const char src, unsigned srclen) FL_EXPORT unsigned _utf8fromwc (char dst, unsigned dstlen, const wchar_t src, unsigned srclen) FL_EXPORT const char _utf8fwd (const char p, const char start, const char end) FL_EXPORT int _utf8len (char c)
return the byte length of the UTF-8 sequence with rst byte c, or -1 if c is not valid.

FL_EXPORT int _utf8len1 (char c)


Return the byte length of the UTF-8 sequence with rst byte c, or 1 if c is not valid.

FL_EXPORT int _utf8locale () FL_EXPORT int _utf8test (const char src, unsigned len) FL_EXPORT unsigned _utf8to_mb (const char src, unsigned srclen, char dst, unsigned dstlen)
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

974

File Documentation FL_EXPORT unsigned _utf8toa (const char src, unsigned srclen, char dst, unsigned dstlen) FL_EXPORT unsigned _utf8toUtf16 (const char src, unsigned srclen, unsigned short dst, unsigned dstlen) FL_EXPORT unsigned _utf8towc (const char src, unsigned srclen, wchar_t dst, unsigned dstlen)
Converts a UTF-8 string into a wide character string.

FL_EXPORT int _utf_nb_char (const unsigned char buf, int len)


returns the number of Unicode chars in the UTF-8 string

FL_EXPORT int _utf_strcasecmp (const char s1, const char s2)


UTF-8 aware strcasecmp - converts to Unicode and tests.

FL_EXPORT int _utf_strncasecmp (const char s1, const char s2, int n)
UTF-8 aware strncasecmp - converts to lower case Unicode and tests.

FL_EXPORT int _utf_tolower (const unsigned char str, int len, char buf)
converts the str string to the lower case equivalent into buf.

FL_EXPORT int _utf_toupper (const unsigned char str, int len, char buf)
converts the str string to the upper case equivalent into buf.

FL_EXPORT int _wcwidth (const char src)


extended wrapper around _wcwidth_(unsigned int ucs) function.

FL_EXPORT int _wcwidth_ (unsigned int ucs)


wrapper to adapt Markus Kuhns implementation of wcwidth() for FLTK

31.25.1

Detailed Description

header for Unicode and UTF8 chracter handling

31.26

vertex.cxx File Reference

Portable drawing code for drawing arbitrary shapes with simple 2D transformations. #include <config.h> #include <FL/fl_draw.H> #include <FL/x.H> #include <FL/Fl.H> #include <FL/math.h> #include <stdlib.h>

31.26.1

Detailed Description

Portable drawing code for drawing arbitrary shapes with simple 2D transformations.

31.27

Fl Widget.H File Reference

Fl_Widget, Fl_Label classes . #include "Enumerations.H"


Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

31.28 gl.h File Reference

975

Classes
struct Fl_Label
This struct stores all information for a text or mixed graphics label.

class Fl_Widget
Fl_Widget is the base class for all widgets in FLTK.

Denes
#dene FL_RESERVED_TYPE 100
Reserved type numbers (necessary for my cheapo RTTI) start here.

Typedefs
typedef void( Fl_Callback )(Fl_Widget , void )
Default callback type denition for all tk widgets (by far the most used)

typedef void( Fl_Callback0 )(Fl_Widget )


One parameter callback type denition passing only the widget.

typedef void( Fl_Callback1 )(Fl_Widget , long)


Callback type denition passing the widget and a long data value.

typedef Fl_Callback Fl_Callback_p


Default callback type pointer denition for all tk widgets.

typedef long _intptr_t typedef unsigned long _uintptr_t

31.27.1

Detailed Description

Fl_Widget, Fl_Label classes .

31.27.2
31.27.2.1

Dene Documentation
#dene FL RESERVED TYPE 100

Reserved type numbers (necessary for my cheapo RTTI) start here. Grep the header les for "RESERVED_TYPE" to nd the next available number.

31.27.3
31.27.3.1

Typedef Documentation
typedef long _intptr_t

Todo typedefs _intptr_t and _uintptr_t should be documented.

31.28

gl.h File Reference

This le denes wrapper functions for OpenGL in FLTK. #include "Enumerations.H" #include <GL/gl.h>
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

976

File Documentation

Functions
FL_EXPORT void gl_color (Fl_Color i)
Sets the curent OpenGL color to an FLTK color.

void gl_color (int c)


back compatibility

FL_EXPORT int gl_descent ()


Returns the current fonts descent.

FL_EXPORT void gl_draw (const char )


Draws a nul-terminated string in the current font at the current position.

FL_EXPORT void gl_draw (const char , int n)


Draws an array of n characters of the string in the current font at the current position.

FL_EXPORT void gl_draw (const char , int x, int y)


Draws a nul-terminated string in the current font at the given position.

FL_EXPORT void gl_draw (const char , oat x, oat y)


Draws a nul-terminated string in the current font at the given position.

FL_EXPORT void gl_draw (const char , int n, int x, int y)


Draws n characters of the string in the current font at the given position.

FL_EXPORT void gl_draw (const char , int n, oat x, oat y)


Draws n characters of the string in the current font at the given position.

FL_EXPORT void gl_draw (const char , int x, int y, int w, int h, Fl_Align)
Draws a string formatted into a box, with newlines and tabs expanded, other control characters changed to X.

FL_EXPORT void gl_draw_image (const uchar , int x, int y, int w, int h, int d=3, int ld=0) FL_EXPORT void gl_nish ()
Releases an OpenGL context.

FL_EXPORT void gl_font (int fontid, int size)


Sets the current OpenGL font to the same font as calling _font()

FL_EXPORT int gl_height ()


Returns the current fonts height.

FL_EXPORT void gl_measure (const char , int &x, int &y)


Measure how wide and tall the string will be when drawn by the gl_draw() function.

FL_EXPORT void gl_rect (int x, int y, int w, int h)


Outlines the given rectangle with the current color.

void gl_rectf (int x, int y, int w, int h)


Fills the given rectangle with the current color.

FL_EXPORT void gl_start ()


Creates an OpenGL context.

FL_EXPORT double gl_width (const char )


Returns the width of the string in the current fnt.

FL_EXPORT double gl_width (const char , int n)


Returns the width of n characters of the string in the current font.

FL_EXPORT double gl_width (uchar)


Returns the width of the character in the current font.
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

31.28 gl.h File Reference

977

31.28.1

Detailed Description

This le denes wrapper functions for OpenGL in FLTK. To use OpenGL from within an FLTK application you MUST use gl_visual() to select the default visual before doing show() on any windows. Mesa will crash if yoy try to use a visual not returned by glxChooseVidual. This does not work with Fl_Double_Windows! It will try to draw into the front buffer. Depending on the system this will either crash or do nothing (when pixmaps are being used as back buffer and GL is being done by hardware), work correctly (when GL is done with software, such as Mesa), or draw into the front buffer and be erased when the buffers are swapped (when double buffer hardware is being used)

31.28.2
31.28.2.1

Function Documentation
FL EXPORT void gl color ( Fl_Color i )

Sets the curent OpenGL color to an FLTK color. For color-index modes it will use _xpixel(c), which is only right if the window uses the default colormap!

31.28.2.2

FL EXPORT void gl draw ( const char str )

Draws a nul-terminated string in the current font at the current position. See also On the Mac OS X platform, see gl_texture_pile_height(int)

31.28.2.3

FL EXPORT void gl draw ( const char str, int n )

Draws an array of n characters of the string in the current font at the current position. See also On the Mac OS X platform, see gl_texture_pile_height(int)

31.28.2.4

FL EXPORT void gl draw ( const char str, int x, int y )

Draws a nul-terminated string in the current font at the given position. See also On the Mac OS X platform, see gl_texture_pile_height(int)

31.28.2.5

FL EXPORT void gl draw ( const char str, oat x, oat y )

Draws a nul-terminated string in the current font at the given position. See also On the Mac OS X platform, see gl_texture_pile_height(int)

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

978 31.28.2.6 FL EXPORT void gl draw ( const char str, int n, int x, int y )

File Documentation

Draws n characters of the string in the current font at the given position. See also On the Mac OS X platform, see gl_texture_pile_height(int)

31.28.2.7

FL EXPORT void gl draw ( const char str, int n, oat x, oat y )

Draws n characters of the string in the current font at the given position. See also On the Mac OS X platform, see gl_texture_pile_height(int)

31.28.2.8

FL EXPORT void gl draw ( const char str, int x, int y, int w, int h, Fl_Align align )

Draws a string formatted into a box, with newlines and tabs expanded, other control characters changed to X. and aligned with the edges or center. Exactly the same output as _draw(). 31.28.2.9 FL EXPORT void gl rect ( int x, int y, int w, int h )

Outlines the given rectangle with the current color. If Fl_Gl_Window::ortho() has been called, then the rectangle will exactly ll the given pixel rectangle. 31.28.2.10 void gl rectf ( int x, int y, int w, int h ) [inline]

Fills the given rectangle with the current color. See also gl_rect(int x, int y, int w, int h)

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

Index
Fl_Check_Browser Fl_Check_Browser, 386 Fl_Device Fl_Device, 407 Fl_Double_Window Fl_Double_Window, 414 Fl_File_Chooser Fl_File_Chooser, 423 Fl_Group Fl_Group, 489 Fl_Help_View Fl_Help_View, 506 Fl_Input_ Fl_Input_, 524 Fl_Menu_Window Fl_Menu_Window, 581 Fl_Native_File_Chooser Fl_Native_File_Chooser, 591 Fl_Plugin_Manager Fl_Plugin_Manager, 612 Fl_PostScript_Graphics_Driver Fl_PostScript_Graphics_Driver, 627 Fl_Preferences Fl_Preferences, 643 Fl_RGB_Image Fl_RGB_Image, 671 Fl_Scrollbar Fl_Scrollbar, 683 Fl_Shared_Image Fl_Shared_Image, 689 Fl_Surface_Device Fl_Surface_Device, 704 Fl_Table Fl_Table, 722 Fl_Table_Row Fl_Table_Row, 733 Fl_Text_Display Fl_Text_Display, 761 Fl_Widget Fl_Widget, 872 Fl_Window Fl_Window, 905 A0 Fl_Paged_Device, 602 A4 Fl_Paged_Device, 602 ALWAYS_ON Fl_Browser_, 360 BLOCK_CURSOR Fl_Text_Display, 760 BOTH Fl_Browser_, 360 BOTH_ALWAYS Fl_Browser_, 360 BROWSE_DIRECTORY Fl_Native_File_Chooser, 590 BROWSE_FILE Fl_Native_File_Chooser, 590 BROWSE_MULTI_DIRECTORY Fl_Native_File_Chooser, 590 BROWSE_MULTI_FILE Fl_Native_File_Chooser, 590 BROWSE_SAVE_DIRECTORY Fl_Native_File_Chooser, 590 BROWSE_SAVE_FILE Fl_Native_File_Chooser, 590 CARET_CURSOR Fl_Text_Display, 760 CHANGED Fl_Widget, 871 CLIP_CHILDREN Fl_Widget, 871 CONTEXT_CELL Fl_Table, 721 CONTEXT_COL_HEADER Fl_Table, 721 CONTEXT_ENDPAGE Fl_Table, 721 CONTEXT_NONE Fl_Table, 721 CONTEXT_RC_RESIZE Fl_Table, 721 CONTEXT_ROW_HEADER Fl_Table, 721 CONTEXT_STARTPAGE Fl_Table, 721 CONTEXT_TABLE Fl_Table, 721

980 COPIED_LABEL Fl_Widget, 871 COPIED_TOOLTIP Fl_Widget, 872 DIM_CURSOR Fl_Text_Display, 760 Drawing functions FL_CAP_FLAT, 253 FL_CAP_ROUND, 253 FL_CAP_SQUARE, 253 FL_DASH, 253 FL_DASHDOT, 253 FL_DASHDOTDOT, 253 FL_DOT, 253 FL_JOIN_BEVEL, 253 FL_JOIN_MITER, 253 FL_JOIN_ROUND, 253 FL_SOLID, 253 Enumerations.H FL_ACTIVATE, 949 FL_BORDER_BOX, 945 FL_BORDER_FRAME, 945 FL_CLOSE, 949 FL_CURSOR_ARROW, 946 FL_CURSOR_CROSS, 946 FL_CURSOR_DEFAULT, 946 FL_CURSOR_E, 947 FL_CURSOR_HAND, 946 FL_CURSOR_HELP, 946 FL_CURSOR_INSERT, 946 FL_CURSOR_MOVE, 947 FL_CURSOR_N, 947 FL_CURSOR_NE, 947 FL_CURSOR_NESW, 947 FL_CURSOR_NONE, 947 FL_CURSOR_NS, 947 FL_CURSOR_NW, 947 FL_CURSOR_NWSE, 947 FL_CURSOR_S, 947 FL_CURSOR_SE, 947 FL_CURSOR_SW, 947 FL_CURSOR_W, 947 FL_CURSOR_WAIT, 946 FL_CURSOR_WE, 947 FL_DAMAGE_ALL, 947 FL_DAMAGE_CHILD, 947 FL_DAMAGE_EXPOSE, 947 FL_DAMAGE_OVERLAY, 947 FL_DAMAGE_SCROLL, 947 FL_DAMAGE_USER1, 947 FL_DAMAGE_USER2, 947 FL_DEACTIVATE, 949 FL_DND_DRAG, 949 FL_DND_ENTER, 949

INDEX FL_DND_LEAVE, 949 FL_DND_RELEASE, 949 FL_DOWN_BOX, 945 FL_DOWN_FRAME, 945 FL_DRAG, 948 FL_EMBOSSED_BOX, 945 FL_EMBOSSED_FRAME, 945 FL_ENGRAVED_BOX, 945 FL_ENGRAVED_FRAME, 945 FL_ENTER, 948 FL_EXCEPT, 945 FL_FLAT_BOX, 945 FL_FOCUS, 948 FL_FREE_BOXTYPE, 946 FL_FREE_LABELTYPE, 950 FL_HIDE, 949 FL_KEYBOARD, 948 FL_KEYDOWN, 948 FL_KEYUP, 949 FL_LEAVE, 948 FL_MOUSEWHEEL, 949 FL_MOVE, 949 FL_NORMAL_LABEL, 950 FL_NO_BOX, 945 FL_NO_EVENT, 948 FL_NO_LABEL, 950 FL_PASTE, 949 FL_PUSH, 948 FL_READ, 945 FL_RELEASE, 948 FL_SELECTIONCLEAR, 949 FL_SHORTCUT, 949 FL_SHOW, 949 FL_THIN_DOWN_BOX, 945 FL_THIN_DOWN_FRAME, 945 FL_THIN_UP_BOX, 945 FL_THIN_UP_FRAME, 945 FL_UNFOCUS, 948 FL_UP_BOX, 945 FL_UP_FRAME, 945 FL_WHEN_CHANGED, 950 FL_WHEN_ENTER_KEY, 950 FL_WHEN_ENTER_KEY_ALWAYS, 950 FL_WHEN_ENTER_KEY_CHANGED, 950 FL_WHEN_NEVER, 950 FL_WHEN_NOT_CHANGED, 950 FL_WHEN_RELEASE, 950 FL_WHEN_RELEASE_ALWAYS, 950 FL_WRITE, 945 _FL_DIAMOND_DOWN_BOX, 946 _FL_DIAMOND_UP_BOX, 946 _FL_EMBOSSED_LABEL, 950 _FL_ENGRAVED_LABEL, 950 _FL_GTK_DOWN_BOX, 946
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

INDEX _FL_GTK_DOWN_FRAME, 946 _FL_GTK_ROUND_DOWN_BOX, 946 _FL_GTK_ROUND_UP_BOX, 946 _FL_GTK_THIN_DOWN_BOX, 946 _FL_GTK_THIN_DOWN_FRAME, 946 _FL_GTK_THIN_UP_BOX, 946 _FL_GTK_THIN_UP_FRAME, 946 _FL_GTK_UP_BOX, 946 _FL_GTK_UP_FRAME, 946 _FL_ICON_LABEL, 950 _FL_IMAGE_LABEL, 950 _FL_MULTI_LABEL, 950 _FL_OFLAT_BOX, 946 _FL_OSHADOW_BOX, 946 _FL_OVAL_BOX, 946 _FL_OVAL_FRAME, 946 _FL_PLASTIC_DOWN_BOX, 946 _FL_PLASTIC_DOWN_FRAME, 946 _FL_PLASTIC_ROUND_DOWN_BOX, 946 _FL_PLASTIC_ROUND_UP_BOX, 946 _FL_PLASTIC_THIN_DOWN_BOX, 946 _FL_PLASTIC_THIN_UP_BOX, 946 _FL_PLASTIC_UP_BOX, 946 _FL_PLASTIC_UP_FRAME, 946 _FL_RFLAT_BOX, 945 _FL_ROUNDED_BOX, 945 _FL_ROUNDED_FRAME, 945 _FL_ROUND_DOWN_BOX, 945 _FL_ROUND_UP_BOX, 945 _FL_RSHADOW_BOX, 945 _FL_SHADOW_BOX, 945 _FL_SHADOW_FRAME, 945 _FL_SHADOW_LABEL, 950 FL_ACTIVATE Enumerations.H, 949 FL_BORDER_BOX Enumerations.H, 945 FL_BORDER_FRAME Enumerations.H, 945 FL_CAP_FLAT Drawing functions, 253 FL_CAP_ROUND Drawing functions, 253 FL_CAP_SQUARE Drawing functions, 253 FL_CLOSE Enumerations.H, 949 FL_CURSOR_ARROW Enumerations.H, 946 FL_CURSOR_CROSS Enumerations.H, 946 FL_CURSOR_DEFAULT Enumerations.H, 946 FL_CURSOR_E
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

981 Enumerations.H, 947 FL_CURSOR_HAND Enumerations.H, 946 FL_CURSOR_HELP Enumerations.H, 946 FL_CURSOR_INSERT Enumerations.H, 946 FL_CURSOR_MOVE Enumerations.H, 947 FL_CURSOR_N Enumerations.H, 947 FL_CURSOR_NE Enumerations.H, 947 FL_CURSOR_NESW Enumerations.H, 947 FL_CURSOR_NONE Enumerations.H, 947 FL_CURSOR_NS Enumerations.H, 947 FL_CURSOR_NW Enumerations.H, 947 FL_CURSOR_NWSE Enumerations.H, 947 FL_CURSOR_S Enumerations.H, 947 FL_CURSOR_SE Enumerations.H, 947 FL_CURSOR_SW Enumerations.H, 947 FL_CURSOR_W Enumerations.H, 947 FL_CURSOR_WAIT Enumerations.H, 946 FL_CURSOR_WE Enumerations.H, 947 FL_DAMAGE_ALL Enumerations.H, 947 FL_DAMAGE_CHILD Enumerations.H, 947 FL_DAMAGE_EXPOSE Enumerations.H, 947 FL_DAMAGE_OVERLAY Enumerations.H, 947 FL_DAMAGE_SCROLL Enumerations.H, 947 FL_DAMAGE_USER1 Enumerations.H, 947 FL_DAMAGE_USER2 Enumerations.H, 947 FL_DASH Drawing functions, 253 FL_DASHDOT Drawing functions, 253 FL_DASHDOTDOT

982 Drawing functions, 253 FL_DEACTIVATE Enumerations.H, 949 FL_DND_DRAG Enumerations.H, 949 FL_DND_ENTER Enumerations.H, 949 FL_DND_LEAVE Enumerations.H, 949 FL_DND_RELEASE Enumerations.H, 949 FL_DOT Drawing functions, 253 FL_DOWN_BOX Enumerations.H, 945 FL_DOWN_FRAME Enumerations.H, 945 FL_DRAG Enumerations.H, 948 FL_EMBOSSED_BOX Enumerations.H, 945 FL_EMBOSSED_FRAME Enumerations.H, 945 FL_ENGRAVED_BOX Enumerations.H, 945 FL_ENGRAVED_FRAME Enumerations.H, 945 FL_ENTER Enumerations.H, 948 FL_EXCEPT Enumerations.H, 945 FL_FLAT_BOX Enumerations.H, 945 FL_FOCUS Enumerations.H, 948 FL_FREE_BOXTYPE Enumerations.H, 946 FL_FREE_LABELTYPE Enumerations.H, 950 FL_HIDE Enumerations.H, 949 FL_JOIN_BEVEL Drawing functions, 253 FL_JOIN_MITER Drawing functions, 253 FL_JOIN_ROUND Drawing functions, 253 FL_KEYBOARD Enumerations.H, 948 FL_KEYDOWN Enumerations.H, 948 FL_KEYUP Enumerations.H, 949 FL_LEAVE Enumerations.H, 948 FL_MOUSEWHEEL Enumerations.H, 949 FL_MOVE Enumerations.H, 949 FL_NORMAL_LABEL Enumerations.H, 950 FL_NO_BOX Enumerations.H, 945 FL_NO_EVENT Enumerations.H, 948 FL_NO_LABEL Enumerations.H, 950 FL_PASTE Enumerations.H, 949 FL_PUSH Enumerations.H, 948 FL_READ Enumerations.H, 945 FL_RELEASE Enumerations.H, 948 FL_SELECTIONCLEAR Enumerations.H, 949 FL_SHORTCUT Enumerations.H, 949 FL_SHOW Enumerations.H, 949 FL_SOLID Drawing functions, 253 FL_THIN_DOWN_BOX Enumerations.H, 945 FL_THIN_DOWN_FRAME Enumerations.H, 945 FL_THIN_UP_BOX Enumerations.H, 945 FL_THIN_UP_FRAME Enumerations.H, 945 FL_TREE_CONNECTOR_DOTTED Fl_Tree_Prefs.H, 971 FL_TREE_CONNECTOR_NONE Fl_Tree_Prefs.H, 971 FL_TREE_CONNECTOR_SOLID Fl_Tree_Prefs.H, 971 FL_TREE_REASON_CLOSED Fl_Tree.H, 969 FL_TREE_REASON_DESELECTED Fl_Tree.H, 969 FL_TREE_REASON_NONE Fl_Tree.H, 969 FL_TREE_REASON_OPENED Fl_Tree.H, 969 FL_TREE_REASON_SELECTED Fl_Tree.H, 969 FL_TREE_SELECT_MULTI

INDEX

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

INDEX Fl_Tree_Prefs.H, 971 FL_TREE_SELECT_NONE Fl_Tree_Prefs.H, 971 FL_TREE_SELECT_SINGLE Fl_Tree_Prefs.H, 971 FL_TREE_SORT_ASCENDING Fl_Tree_Prefs.H, 971 FL_TREE_SORT_DESCENDING Fl_Tree_Prefs.H, 971 FL_TREE_SORT_NONE Fl_Tree_Prefs.H, 971 FL_UNFOCUS Enumerations.H, 948 FL_UP_BOX Enumerations.H, 945 FL_UP_FRAME Enumerations.H, 945 FL_WHEN_CHANGED Enumerations.H, 950 FL_WHEN_ENTER_KEY Enumerations.H, 950 FL_WHEN_ENTER_KEY_ALWAYS Enumerations.H, 950 FL_WHEN_ENTER_KEY_CHANGED Enumerations.H, 950 FL_WHEN_NEVER Enumerations.H, 950 FL_WHEN_NOT_CHANGED Enumerations.H, 950 FL_WHEN_RELEASE Enumerations.H, 950 FL_WHEN_RELEASE_ALWAYS Enumerations.H, 950 FL_WRITE Enumerations.H, 945 FORCE_POSITION Fl_Widget, 871 Fl OPTION_ARROW_FOCUS, 314 OPTION_DND_TEXT, 314 OPTION_LAST, 314 OPTION_SHOW_TOOLTIPS, 314 OPTION_VISIBLE_FOCUS, 314 Fl_Browser_ ALWAYS_ON, 360 BOTH, 360 BOTH_ALWAYS, 360 HORIZONTAL, 360 HORIZONTAL_ALWAYS, 360 VERTICAL, 360 VERTICAL_ALWAYS, 360 Fl_Menu_Button POPUP1, 566 POPUP12, 566
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

983 POPUP123, 567 POPUP13, 567 POPUP2, 566 POPUP23, 567 POPUP3, 566 Fl_Native_File_Chooser BROWSE_DIRECTORY, 590 BROWSE_FILE, 590 BROWSE_MULTI_DIRECTORY, 590 BROWSE_MULTI_FILE, 590 BROWSE_SAVE_DIRECTORY, 590 BROWSE_SAVE_FILE, 590 NEW_FOLDER, 590 NO_OPTIONS, 590 PREVIEW, 590 SAVEAS_CONFIRM, 590 Fl_Paged_Device A0, 602 A4, 602 LANDSCAPE, 603 LETTER, 602 ORIENTATION, 603 PORTRAIT, 603 REVERSED, 603 Fl_Preferences SYSTEM, 641 USER, 641 Fl_Table CONTEXT_CELL, 721 CONTEXT_COL_HEADER, 721 CONTEXT_ENDPAGE, 721 CONTEXT_NONE, 721 CONTEXT_RC_RESIZE, 721 CONTEXT_ROW_HEADER, 721 CONTEXT_STARTPAGE, 721 CONTEXT_TABLE, 721 Fl_Text_Display BLOCK_CURSOR, 760 CARET_CURSOR, 760 DIM_CURSOR, 760 HEAVY_CURSOR, 760 NORMAL_CURSOR, 760 WRAP_AT_BOUNDS, 761 WRAP_AT_COLUMN, 761 WRAP_AT_PIXEL, 761 WRAP_NONE, 761 Fl_Tree.H FL_TREE_REASON_CLOSED, 969 FL_TREE_REASON_DESELECTED, 969 FL_TREE_REASON_NONE, 969 FL_TREE_REASON_OPENED, 969 FL_TREE_REASON_SELECTED, 969 Fl_Tree_Prefs.H FL_TREE_CONNECTOR_DOTTED, 971

984 FL_TREE_CONNECTOR_NONE, 971 FL_TREE_CONNECTOR_SOLID, 971 FL_TREE_SELECT_MULTI, 971 FL_TREE_SELECT_NONE, 971 FL_TREE_SELECT_SINGLE, 971 FL_TREE_SORT_ASCENDING, 971 FL_TREE_SORT_DESCENDING, 971 FL_TREE_SORT_NONE, 971 Fl_Widget CHANGED, 871 CLIP_CHILDREN, 871 COPIED_LABEL, 871 COPIED_TOOLTIP, 872 FORCE_POSITION, 871 GROUP_RELATIVE, 872 INACTIVE, 871 INVISIBLE, 871 MENU_WINDOW, 871 MODAL, 871 NOBORDER, 871 NON_MODAL, 871 NO_OVERLAY, 871 OUTPUT, 871 OVERRIDE, 871 SHORTCUT_LABEL, 871 TOOLTIP_WINDOW, 871 USERFLAG1, 872 USERFLAG2, 872 USERFLAG3, 872 VISIBLE_FOCUS, 871 GROUP_RELATIVE Fl_Widget, 872 HEAVY_CURSOR Fl_Text_Display, 760 HORIZONTAL Fl_Browser_, 360 HORIZONTAL_ALWAYS Fl_Browser_, 360 INACTIVE Fl_Widget, 871 INVISIBLE Fl_Widget, 871 LANDSCAPE Fl_Paged_Device, 603 LETTER Fl_Paged_Device, 602 MENU_WINDOW Fl_Widget, 871 MODAL Fl_Widget, 871 NEW_FOLDER Fl_Native_File_Chooser, 590 NOBORDER Fl_Widget, 871 NON_MODAL Fl_Widget, 871 NORMAL_CURSOR Fl_Text_Display, 760 NO_OPTIONS Fl_Native_File_Chooser, 590 NO_OVERLAY Fl_Widget, 871 OPTION_ARROW_FOCUS Fl, 314 OPTION_DND_TEXT Fl, 314 OPTION_LAST Fl, 314 OPTION_SHOW_TOOLTIPS Fl, 314 OPTION_VISIBLE_FOCUS Fl, 314 ORIENTATION Fl_Paged_Device, 603 OUTPUT Fl_Widget, 871 OVERRIDE Fl_Widget, 871 POPUP1 Fl_Menu_Button, 566 POPUP12 Fl_Menu_Button, 566 POPUP123 Fl_Menu_Button, 567 POPUP13 Fl_Menu_Button, 567 POPUP2 Fl_Menu_Button, 566 POPUP23 Fl_Menu_Button, 567 POPUP3 Fl_Menu_Button, 566 PORTRAIT Fl_Paged_Device, 603 PREVIEW Fl_Native_File_Chooser, 590 REVERSED Fl_Paged_Device, 603 SAVEAS_CONFIRM Fl_Native_File_Chooser, 590 SHORTCUT_LABEL Fl_Widget, 871 SYSTEM Fl_Preferences, 641 TOOLTIP_WINDOW Fl_Widget, 871 USER Fl_Preferences, 641

INDEX

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

INDEX USERFLAG1 Fl_Widget, 872 USERFLAG2 Fl_Widget, 872 USERFLAG3 Fl_Widget, 872 VERTICAL Fl_Browser_, 360 VERTICAL_ALWAYS Fl_Browser_, 360 VISIBLE_FOCUS Fl_Widget, 871 WRAP_AT_BOUNDS Fl_Text_Display, 761 WRAP_AT_COLUMN Fl_Text_Display, 761 WRAP_AT_PIXEL Fl_Text_Display, 761 WRAP_NONE Fl_Text_Display, 761 _FL_DIAMOND_DOWN_BOX Enumerations.H, 946 _FL_DIAMOND_UP_BOX Enumerations.H, 946 _FL_EMBOSSED_LABEL Enumerations.H, 950 _FL_ENGRAVED_LABEL Enumerations.H, 950 _FL_GTK_DOWN_BOX Enumerations.H, 946 _FL_GTK_DOWN_FRAME Enumerations.H, 946 _FL_GTK_ROUND_DOWN_BOX Enumerations.H, 946 _FL_GTK_ROUND_UP_BOX Enumerations.H, 946 _FL_GTK_THIN_DOWN_BOX Enumerations.H, 946 _FL_GTK_THIN_DOWN_FRAME Enumerations.H, 946 _FL_GTK_THIN_UP_BOX Enumerations.H, 946 _FL_GTK_THIN_UP_FRAME Enumerations.H, 946 _FL_GTK_UP_BOX Enumerations.H, 946 _FL_GTK_UP_FRAME Enumerations.H, 946 _FL_ICON_LABEL Enumerations.H, 950 _FL_IMAGE_LABEL Enumerations.H, 950 _FL_MULTI_LABEL Enumerations.H, 950
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

985 _FL_OFLAT_BOX Enumerations.H, 946 _FL_OSHADOW_BOX Enumerations.H, 946 _FL_OVAL_BOX Enumerations.H, 946 _FL_OVAL_FRAME Enumerations.H, 946 _FL_PLASTIC_DOWN_BOX Enumerations.H, 946 _FL_PLASTIC_DOWN_FRAME Enumerations.H, 946 _FL_PLASTIC_ROUND_DOWN_BOX Enumerations.H, 946 _FL_PLASTIC_ROUND_UP_BOX Enumerations.H, 946 _FL_PLASTIC_THIN_DOWN_BOX Enumerations.H, 946 _FL_PLASTIC_THIN_UP_BOX Enumerations.H, 946 _FL_PLASTIC_UP_BOX Enumerations.H, 946 _FL_PLASTIC_UP_FRAME Enumerations.H, 946 _FL_RFLAT_BOX Enumerations.H, 945 _FL_ROUNDED_BOX Enumerations.H, 945 _FL_ROUNDED_FRAME Enumerations.H, 945 _FL_ROUND_DOWN_BOX Enumerations.H, 945 _FL_ROUND_UP_BOX Enumerations.H, 945 _FL_RSHADOW_BOX Enumerations.H, 945 _FL_SHADOW_BOX Enumerations.H, 945 _FL_SHADOW_FRAME Enumerations.H, 945 _FL_SHADOW_LABEL Enumerations.H, 950 Cairo support functions and classes, 274 cairo_autolink_context, 274 cairo_cc, 275 Callback function typedefs, 215 Fl_Event_Dispatch, 216 Color & Font functions, 239 _color, 240, 241 _color_average, 241 _contrast, 241 _font, 241, 242 _height, 242 _latin1_to_local, 242

986 _local_to_latin1, 242 _local_to_mac_roman, 243 _mac_roman_to_local, 243 _show_colormap, 243 _size, 244 _text_extents, 244, 245 _width, 245 _xpixel, 245 free_color, 245 get_color, 246 get_font, 246 get_font_name, 246 get_font_sizes, 246 set_color, 246, 247 set_font, 247 set_fonts, 247 Common Dialogs classes and functions, 287 error, 296 fatal, 296 _alert, 288 _ask, 288 _beep, 289 _choice, 289 _color_chooser, 289, 290 _dir_chooser, 291 _le_chooser, 292 _le_chooser_callback, 292 _le_chooser_ok_label, 293 _input, 293 _message, 293 _message_hotspot, 293, 294 _message_icon, 294 _message_title, 294 _message_title_default, 295 _password, 295 warning, 296 Drawing functions, 248 _add_symbol, 253 _arc, 253, 254 _begin_complex_polygon, 254 _begin_offscreen, 254 _begin_points, 254 _can_do_alpha_blending, 254 _circle, 255 _clip, 252 _clip_box, 255 _clip_region, 255 _copy_offscreen, 255 _create_offscreen, 256 _cursor, 256 _curve, 256 _delete_offscreen, 256 _draw, 256, 257 _draw_box, 257 _draw_image, 257, 258 _draw_image_mono, 258, 259 _draw_pixmap, 259 _draw_symbol, 259 _expand_text, 260 _frame, 260 _frame2, 260 _gap, 260 _line_style, 261 _measure, 261 _measure_pixmap, 261, 262 _mult_matrix, 262 _not_clipped, 262 _old_shortcut, 262 _pie, 263 _polygon, 263 _pop_clip, 263 _push_clip, 263 _push_matrix, 263 _read_image, 263 _rect, 264 _rectf, 264 _reset_spot, 264 _rotate, 264 _scale, 264, 265 _scroll, 265 _set_spot, 265 _set_status, 265 _shortcut_label, 265, 266 _transform_dx, 266 _transform_dy, 266 _transform_x, 266 _transform_y, 267 _transformed_vertex, 267 _translate, 267 _vertex, 267 ERRORS_TO_CP1252 Unicode and UTF-8 functions, 277 ERRORS_TO_ISO8859_1 Unicode and UTF-8 functions, 277 Enumerations.H, 933 FL_ALIGN_BOTTOM, 952 FL_ALIGN_CENTER, 952 FL_ALIGN_CLIP, 952 FL_ALIGN_INSIDE, 952 FL_ALIGN_LEFT, 952 FL_ALIGN_RIGHT, 952 FL_ALIGN_TOP, 953 FL_ALIGN_WRAP, 953 FL_MAJOR_VERSION, 944 FL_MINOR_VERSION, 944 FL_PATCH_VERSION, 944 FL_VERSION, 944 Fl_Boxtype, 945

INDEX

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

INDEX Fl_Cursor, 946 Fl_Damage, 947 Fl_Event, 947 Fl_Font, 944 Fl_Fontsize, 944 Fl_Labeltype, 949 Fl_When, 950 _box, 951 _color_cube, 951 _darker, 951 _down, 951 _frame, 951 _gray_ramp, 951 _lighter, 951 _rgb_color, 951, 952 Events handling functions, 220 add_handler, 222 belowmouse, 222 compose, 223 compose_reset, 223 event, 223 event_alt, 223 event_button, 223 event_button1, 224 event_button2, 224 event_button3, 224 event_buttons, 224 event_clicks, 224 event_command, 225 event_ctrl, 225 event_dispatch, 225 event_dx, 226 event_dy, 226 event_inside, 226 event_is_click, 227 event_key, 227 event_length, 228 event_original_key, 228 event_shift, 228 event_state, 228 event_text, 229 event_x_root, 229 event_y_root, 229 _eventnames, 232 _fontnames, 233 focus, 230 get_key, 230 get_mouse, 230 handle, 230 handle_, 231 pushed, 231 remove_handler, 231 test_shortcut, 232 FL_ALIGN_BOTTOM
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

987 Enumerations.H, 952 FL_ALIGN_CENTER Enumerations.H, 952 FL_ALIGN_CLIP Enumerations.H, 952 FL_ALIGN_INSIDE Enumerations.H, 952 FL_ALIGN_LEFT Enumerations.H, 952 FL_ALIGN_RIGHT Enumerations.H, 952 FL_ALIGN_TOP Enumerations.H, 953 FL_ALIGN_WRAP Enumerations.H, 953 FL_CHART_ENTRY, 384 col, 385 str, 385 val, 385 FL_MAJOR_VERSION Enumerations.H, 944 FL_MINOR_VERSION Enumerations.H, 944 FL_PATCH_VERSION Enumerations.H, 944 FL_RESERVED_TYPE Fl_Widget.H, 975 FL_VERSION Enumerations.H, 944 File names and URI utility functions, 297 Fl_File_Sort_F, 298 _lename_absolute, 298 _lename_expand, 298 _lename_ext, 299 _lename_free_list, 299 _lename_isdir, 299 _lename_list, 300 _lename_match, 300 _lename_name, 301 _lename_relative, 301 _lename_setext, 302 _open_uri, 302 Fl, 305 Fl_Option, 313 add_awake_handler_, 314 add_check, 314 add_fd, 314 add_idle, 315 add_timeout, 315 arg, 315 args, 316, 317 background, 317 background2, 317 box_dh, 318

988 box_dw, 318 box_dx, 318 box_dy, 318 check, 318 damage, 319 display, 319 dnd_text_ops, 319 draw_box_active, 319 ush, 319 foreground, 320 get_awake_handler_, 320 get_boxtype, 320 get_system_colors, 320 gl_visual, 320 help, 326 idle, 326 option, 320, 321 own_colormap, 321 ready, 321 release, 322 reload_scheme, 322 remove_check, 322 remove_fd, 322 remove_timeout, 322 repeat_timeout, 322 run, 323 scheme, 323 scrollbar_size, 323 set_boxtype, 324 set_idle, 324 set_labeltype, 324 version, 324 visible_focus, 324 visual, 324 wait, 325 Fl.H, 953 Fl_Adjuster, 327 Fl_Adjuster, 328 draw, 328 Fl_Adjuster, 328 handle, 328 soft, 329 Fl_BMP_Image, 332 Fl_BMP_Image, 333 Fl_BMP_Image, 333 Fl_Bitmap, 329 Fl_Bitmap, 331 copy, 331 draw, 331 Fl_Bitmap, 331 label, 331, 332 uncache, 332 Fl_Box, 333 Fl_Box, 334 draw, 334 Fl_Box, 334 handle, 334 Fl_Boxtype Enumerations.H, 945 Fl_Browser, 335 Fl_Browser, 339 _remove, 339 add, 339 bottomline, 340 clear, 340 column_char, 340 column_widths, 340, 341 data, 341 display, 342 displayed, 342 nd_line, 342 Fl_Browser, 339 format_char, 343 full_height, 344 hide, 344 icon, 344, 345 incr_height, 345 insert, 345, 346 item_at, 346 item_draw, 346 item_rst, 346 item_height, 347 item_last, 347 item_next, 347 item_prev, 348 item_select, 348 item_selected, 348 item_swap, 349 item_text, 349 item_width, 349 lineno, 350 lineposition, 350 load, 350 make_visible, 351 middleline, 351 move, 351 remove, 352 remove_icon, 352 replace, 352 select, 352 selected, 353 show, 353 size, 353 swap, 354 text, 354, 355 topline, 355 value, 355 visible, 356

INDEX

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

INDEX Fl_Browser_, 356 Fl_Browser_, 360 bbox, 361 deleting, 361 deselect, 361 display, 361 displayed, 361 nd_item, 362 Fl_Browser_, 360 full_height, 362 full_width, 362 handle, 362 has_scrollbar, 363 hposition, 363 hscrollbar, 372 incr_height, 364 inserting, 364 item_at, 364 item_rst, 364 item_height, 365 item_last, 365 item_next, 365 item_prev, 365 item_quick_height, 366 item_select, 366 item_selected, 366 item_swap, 366 item_text, 367 item_width, 367 leftedge, 367 new_list, 368 position, 368 redraw_line, 368 redraw_lines, 368 replacing, 369 resize, 369 scrollbar, 372 scrollbar_left, 369 scrollbar_right, 369 scrollbar_size, 369, 370 scrollbar_width, 370 select, 370 select_only, 371 selection, 371 sort, 371 swapping, 371 textfont, 372 Fl_Button, 372 Fl_Button, 374 clear, 375 down_box, 375 draw, 375 Fl_Button, 374 handle, 375
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

989 set, 376 shortcut, 376 value, 377 Fl_CString _types.h, 972 Fl_Cairo_State, 377 Fl_Cairo_Window, 378 set_draw_cb, 379 Fl_Chart, 379 Fl_Chart, 381 add, 381 autosize, 382 bounds, 382 draw, 382 Fl_Chart, 381 insert, 383 maxsize, 383 replace, 383 size, 383 textcolor, 384 textfont, 384 textsize, 384 Fl_Check_Browser, 385 Fl_Check_Browser, 386 Fl_Check_Browser, 386 add, 387 check_all, 387 check_none, 387 checked, 387 clear, 387 Fl_Check_Browser, 386 handle, 387 nchecked, 388 nitems, 388 remove, 388 set_checked, 388 text, 388 value, 388 Fl_Check_Button, 388 Fl_Check_Button, 389 Fl_Check_Button, 389 Fl_Choice, 390 Fl_Choice, 391 draw, 391 Fl_Choice, 391 handle, 392 value, 392, 393 Fl_Clock, 393 Fl_Clock, 394, 395 Fl_Clock, 394, 395 handle, 395 Fl_Clock_Output, 395 Fl_Clock_Output, 397 draw, 397

990 Fl_Clock_Output, 397 hour, 397 minute, 398 second, 398 value, 398, 399 Fl_Color_Chooser, 399 Fl_Color_Chooser, 401 b, 401 Fl_Color_Chooser, 401 g, 401 hsv, 401 hsv2rgb, 402 hue, 402 mode, 402 r, 402 rgb, 402 rgb2hsv, 403 saturation, 403 value, 403 Fl_Color_Chooser.H, 957 Fl_Counter, 403 Fl_Counter, 405 draw, 405 Fl_Counter, 405 handle, 406 lstep, 406 step, 406 Fl_Cursor Enumerations.H, 946 Fl_Damage Enumerations.H, 947 Fl_Device, 407 Fl_Device, 407 class_id, 408 class_name, 408 Fl_Device.H, 958 Fl_Draw_Image_Cb, 959 Fl_Device_Plugin, 408 print, 409 Fl_Dial, 409 Fl_Dial, 411 angle1, 411 draw, 411 Fl_Dial, 411 handle, 411 Fl_Display_Device, 411 class_id, 413 class_name, 412 display_device, 412 Fl_Double_Window, 413 Fl_Double_Window, 414 ush, 414 hide, 414 resize, 415 show, 415 Fl_Draw_Image_Cb Fl_Device.H, 959 Fl_End, 416 Fl_Event Enumerations.H, 947 Fl_Event_Dispatch Callback function typedefs, 216 Fl_File_Browser, 417 Fl_File_Browser, 418 letype, 418 lter, 418 Fl_File_Browser, 418 iconsize, 418 load, 418 Fl_File_Chooser, 419 Fl_File_Chooser, 423 Fl_File_Chooser, 423 add_extra, 424 color, 424 count, 424 directory, 424 lter, 424 lter_value, 424, 425 Fl_File_Chooser, 423 hide, 425 iconsize, 425 label, 425 preview, 425 rescan, 425 show, 425 textcolor, 426 textfont, 426 textsize, 426 type, 426 value, 426 visible, 426 Fl_File_Icon, 427 Fl_File_Icon, 428 add, 428 add_color, 429 add_vertex, 429 clear, 429 draw, 429 nd, 429 rst, 430 Fl_File_Icon, 428 label, 430 labeltype, 430 load, 430 load_fti, 430 load_image, 431 load_system_icons, 431 next, 431

INDEX

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

INDEX pattern, 431 size, 431 type, 431 value, 432 Fl_File_Input, 432 Fl_File_Input, 433 down_box, 434 errorcolor, 434 Fl_File_Input, 433 handle, 434 value, 434 Fl_File_Sort_F File names and URI utility functions, 298 Fl_Fill_Dial, 435 Fl_Fill_Dial, 435 Fl_Fill_Dial, 435 Fl_Fill_Slider, 435 Fl_Fill_Slider, 436 Fl_Fill_Slider, 436 Fl_Float_Input, 436 Fl_Float_Input, 437 Fl_Float_Input, 437 Fl_Font Enumerations.H, 944 Fl_Font_Descriptor, 437 Fl_Fontdesc, 438 Fl_Fontsize Enumerations.H, 944 Fl_FormsBitmap, 438 bitmap, 439 draw, 439 set, 439 Fl_FormsPixmap, 439 Fl_FormsPixmap, 440 Pixmap, 440, 441 draw, 440 Fl_FormsPixmap, 440 set, 441 Fl_Free, 441 Fl_Free, 442 draw, 443 Fl_Free, 442 handle, 443 Fl_GDI_Graphics_Driver, 444 class_id, 448 class_name, 445 color, 445 descent, 445 draw, 445, 446 draw_image, 446 draw_image_mono, 447 font, 447 height, 447 rtl_draw, 447
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

991 text_extents, 447 width, 447 Fl_GIF_Image, 448 Fl_GIF_Image, 448 Fl_GIF_Image, 448 Fl_Gl_Choice, 449 Fl_Gl_Window, 449 Fl_Gl_Window, 451 as_gl_window, 452 can_do, 452 can_do_overlay, 452 context, 452 context_valid, 453 draw, 453 Fl_Gl_Window, 451 ush, 453 hide_overlay, 453 make_current, 453 make_overlay_current, 454 mode, 454 ortho, 454 redraw_overlay, 454 resize, 455 show, 455 swap_buffers, 456 valid, 456 Fl_Glut_Bitmap_Font, 456 Fl_Glut_StrokeChar, 457 Fl_Glut_StrokeFont, 457 Fl_Glut_StrokeStrip, 457 Fl_Glut_StrokeVertex, 458 Fl_Glut_Window, 458 Fl_Glut_Window, 459 draw, 459 draw_overlay, 460 Fl_Glut_Window, 459 make_current, 460 Fl_Graphics_Driver, 460 Fl_Graphics_Driver, 468 arc, 468 begin_complex_polygon, 468 begin_line, 468 begin_loop, 468 begin_points, 468 begin_polygon, 469 circle, 469 class_id, 486 class_name, 469 clip_box, 469 clip_region, 469 color, 469, 470 curve, 470 descent, 470 draw, 470, 471

992 draw_image, 471 draw_image_mono, 471 end_complex_polygon, 471 end_line, 472 end_loop, 472 end_points, 472 end_polygon, 472 _arc, 477 _begin_complex_polygon, 478 _begin_points, 478 _circle, 478 _clip_box, 478 _clip_region, 479 _color, 479 _curve, 479 _draw_image, 480 _draw_image_mono, 481 _font, 481 _gap, 481 _line_style, 482 _mult_matrix, 482 _not_clipped, 482 _pie, 483 _polygon, 483 _pop_clip, 483 _push_clip, 483 _push_matrix, 484 _rect, 484 _rotate, 484 _scale, 484 _transform_dx, 484 _transform_dy, 484 _transform_x, 485 _transform_y, 485 _transformed_vertex, 485 _translate, 485 _vertex, 485 Fl_Graphics_Driver, 468 font, 472 gap, 472 height, 472 line, 473 line_style, 473 loop, 473 mult_matrix, 473 not_clipped, 473 pie, 473 point, 474 polygon, 474 pop_clip, 474 pop_matrix, 474 push_clip, 474 push_matrix, 474 push_no_clip, 474 rect, 474 rectf, 475 restore_clip, 475 rotate, 475 rtl_draw, 475 scale, 475 size, 475 text_extents, 475 transform_dx, 475 transform_dy, 476 transform_x, 476 transform_y, 476 transformed_vertex, 476 translate, 476 vertex, 476 width, 476 xyline, 476, 477 yxline, 477 Fl_Graphics_Driver::matrix, 926 Fl_Group, 486 Fl_Group, 489 Fl_Group, 489 array, 489 as_group, 489 begin, 490 child, 490 clear, 490 clip_children, 490, 491 current, 491 draw, 491 draw_child, 491 draw_children, 492 draw_outside_label, 492 end, 492 nd, 492 Fl_Group, 489 focus, 492 handle, 492 init_sizes, 493 insert, 493 remove, 494 resizable, 494 resize, 495 sizes, 496 update_child, 496 Fl_Help_Block, 496 Fl_Help_Dialog, 497 Fl_Help_Dialog, 498 Fl_Help_Dialog, 498 h, 498 hide, 498 load, 498 position, 498 resize, 498

INDEX

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

INDEX show, 499 textsize, 499 value, 499 visible, 499 w, 499 x, 499 y, 499 Fl_Help_Font_Stack, 500 Fl_Help_Font_Stack, 500 count, 500 Fl_Help_Font_Stack, 500 top, 500 Fl_Help_Font_Style, 501 Fl_Help_Link, 501 Fl_Help_Target, 502 Fl_Help_View, 503 Fl_Help_View, 506 clear_selection, 506 directory, 506 lename, 506 nd, 506 leftline, 507 link, 507 load, 507 resize, 507 scrollbar_size, 507, 508 select_all, 508 size, 508 textcolor, 509 textfont, 509 textsize, 509 title, 509 topline, 509, 510 value, 510 Fl_Hold_Browser, 510 Fl_Hold_Browser, 511 Fl_Hold_Browser, 511 Fl_Hor_Fill_Slider, 511 Fl_Hor_Nice_Slider, 512 Fl_Hor_Slider, 512 Fl_Hor_Value_Slider, 513 Fl_Image, 514 Fl_Image, 516 color_average, 516 copy, 516 count, 516 d, 516 data, 516 desaturate, 517 draw, 517 draw_empty, 517 Fl_Image, 516 inactive, 517 label, 517
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

993 ld, 518 uncache, 518 Fl_Input, 518 Fl_Input, 519 draw, 519 Fl_Input, 519 handle, 520 Fl_Input_, 520 Fl_Input_, 524 Fl_Input_, 524 copy, 524 copy_cuts, 525 cursor_color, 525 cut, 525, 526 drawtext, 526 Fl_Input_, 524 handle_mouse, 526 handletext, 527 index, 527 input_type, 527 insert, 527 line_end, 528 line_start, 528 mark, 528 maximum_size, 529 position, 529, 530 readonly, 530 replace, 530 resize, 531 shortcut, 531 size, 532 static_value, 532, 533 tab_nav, 533 textcolor, 534 textfont, 534 textsize, 535 undo, 535 up_down_position, 535 value, 535, 536 word_end, 537 word_start, 537 wrap, 537 Fl_Input_Choice, 538 Fl_Input_Choice, 539 add, 539 changed, 539 clear, 540 clear_changed, 540 Fl_Input_Choice, 539 input, 540 menu, 540 menubutton, 540 resize, 540 set_changed, 541

994 value, 541 Fl_Input_Choice::InputMenuButton, 925 Fl_Int_Input, 541 Fl_Int_Input, 542 Fl_Int_Input, 542 Fl_JPEG_Image, 542 Fl_JPEG_Image, 543 Fl_JPEG_Image, 543 Fl_Label, 543 draw, 544 measure, 544 type, 544 Fl_Labeltype Enumerations.H, 949 Fl_Light_Button, 545 Fl_Light_Button, 546 draw, 546 Fl_Light_Button, 546 handle, 546 Fl_Line_Dial, 547 Fl_Mac_App_Menu, 547 print, 548 Fl_Menu_, 548 Fl_Menu_, 551 add, 551, 553 clear, 554 clear_submenu, 554 copy, 555 down_box, 555 nd_index, 555, 556 nd_item, 556, 557 Fl_Menu_, 551 global, 557 insert, 557 item_pathname, 558 menu, 559 mode, 559 mvalue, 559 picked, 559 remove, 560 replace, 560 shortcut, 560 size, 560 test_shortcut, 561 text, 561 textcolor, 561 textfont, 561 textsize, 561, 562 value, 562 Fl_Menu_Bar, 562 Fl_Menu_Bar, 564 draw, 564 Fl_Menu_Bar, 564 handle, 564 Fl_Menu_Button, 565 Fl_Menu_Button, 567 draw, 567 Fl_Menu_Button, 567 handle, 567 popup, 568 popup_buttons, 566 Fl_Menu_Item, 568 activate, 573 active, 573 activevisible, 573 add, 573 argument, 573 callback, 573, 574 check, 574 checkbox, 574 checked, 575 clear, 575 deactivate, 575 do_callback, 575 draw, 575 nd_shortcut, 575 rst, 576 hide, 576 insert, 576 label, 577 labelcolor, 577 labelfont, 577 labelsize, 577 labeltype, 577, 578 measure, 578 next, 578 popup, 578 pulldown, 578 radio, 579 set, 579 setonly, 579 shortcut, 579 show, 579 submenu, 579 test_shortcut, 580 uncheck, 580 value, 580 visible, 580 Fl_Menu_Window, 580 Fl_Menu_Window, 581 Fl_Menu_Window, 581, 582 clear_overlay, 582 Fl_Menu_Window, 581, 582 ush, 582 hide, 582 set_overlay, 582 show, 582 Fl_Multi_Browser, 583

INDEX

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

INDEX Fl_Multi_Browser, 583 Fl_Multi_Browser, 583 Fl_Multi_Label, 584 Fl_Multiline_Input, 584 Fl_Multiline_Input, 585 Fl_Multiline_Input, 585 Fl_Multiline_Output, 585 Fl_Multiline_Output, 586 Fl_Multiline_Output, 586 Fl_Native_File_Chooser, 586 Fl_Native_File_Chooser, 591 Fl_Native_File_Chooser, 591 Option, 590 Type, 590 count, 591 directory, 591 errmsg, 591 lename, 591 lter, 592 lter_value, 592 Fl_Native_File_Chooser, 591 options, 592 preset_le, 593 show, 593 title, 593 Fl_Native_File_Chooser.H, 965 Fl_Nice_Slider, 594 Fl_Option Fl, 313 Fl_Output, 594 Fl_Output, 595 Fl_Output, 595 Fl_Overlay_Window, 596 Fl_Overlay_Window, 597 Fl_Overlay_Window, 597 hide, 597 redraw_overlay, 597 resize, 597 show, 597, 598 Fl_PNG_Image, 613 Fl_PNG_Image, 614 Fl_PNG_Image, 614 Fl_PNM_Image, 614 Fl_PNM_Image, 615 Fl_PNM_Image, 615 Fl_Pack, 598 Fl_Pack, 599 draw, 600 Fl_Pack, 599 Fl_Paged_Device, 600 Page_Format, 602 Page_Layout, 602 class_id, 606 class_name, 603
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

995 end_page, 603 margins, 603 origin, 603, 604 print_widget, 604 print_window, 604 print_window_part, 604 printable_rect, 605 rotate, 605 scale, 605 start_job, 606 start_page, 606 translate, 606 Fl_Paged_Device.H, 966 Fl_Paged_Device.cxx, 965 Fl_Paged_Device::page_format, 929 Fl_Pixmap, 607 Fl_Pixmap, 608 color_average, 609 copy, 609 desaturate, 609 draw, 609 Fl_Pixmap, 608 label, 609, 610 uncache, 610 Fl_Plugin, 610 Fl_Plugin, 611 Fl_Plugin, 611 Fl_Plugin_Manager, 611 Fl_Plugin_Manager, 612 addPlugin, 613 load, 613 removePlugin, 613 Fl_Positioner, 615 Fl_Positioner, 617 draw, 617 Fl_Positioner, 617 handle, 617 value, 618 xbounds, 618 xstep, 618 xvalue, 618 ybounds, 618 ystep, 618 yvalue, 618 Fl_PostScript.H, 966 Fl_PostScript_File_Device, 619 class_id, 623 class_name, 620 end_page, 620 margins, 621 origin, 621 printable_rect, 621 rotate, 622 scale, 622

996 start_job, 622, 623 start_page, 623 translate, 623 Fl_PostScript_Graphics_Driver, 624 arc, 628 begin_complex_polygon, 628 begin_line, 628 begin_loop, 628 begin_points, 628 begin_polygon, 628 circle, 628 class_id, 635 class_name, 629 clip_box, 629 color, 629 curve, 629 descent, 629 draw, 629, 630 draw_image, 630 draw_image_mono, 630, 631 end_complex_polygon, 631 end_line, 631 end_loop, 631 end_points, 631 end_polygon, 631 font, 631 gap, 631 height, 632 line, 632 line_style, 632 loop, 632 not_clipped, 632 pie, 632 point, 633 polygon, 633 pop_clip, 633 push_clip, 633 push_no_clip, 633 rect, 633 rectf, 633 rtl_draw, 634 text_extents, 634 transformed_vertex, 634 vertex, 634 width, 634 xyline, 634 yxline, 635 Fl_PostScript_Printer, 635 class_id, 637 class_name, 636 start_job, 637 Fl_Preferences, 637 Fl_Preferences, 643 Fl_Preferences, 641643 ID, 641 Root, 641 deleteEntry, 643 deleteGroup, 643 entries, 643 entry, 644 entryExists, 644 Fl_Preferences, 641643 ush, 644 get, 644646 getUserdataPath, 647 group, 647 groupExists, 648 groups, 648 newUUID, 648 set, 648650 size, 651 Fl_Preferences::Entry, 305 Fl_Preferences::Name, 927 Name, 927 Fl_Preferences::Node, 928 Fl_Preferences::RootNode, 929 Fl_Printer, 651 class_id, 658 class_name, 654 driver, 654 end_page, 654 margins, 654 origin, 655 print_widget, 655 print_window_part, 656 printable_rect, 656 rotate, 656 scale, 656 set_current, 657 start_job, 657 start_page, 657 translate, 657 Fl_Printer.H, 967 Fl_Progress, 658 Fl_Progress, 659 draw, 659 Fl_Progress, 659 maximum, 659 minimum, 659 value, 659, 660 Fl_Quartz_Graphics_Driver, 660 class_id, 664 class_name, 661 color, 661 descent, 662 draw, 662 draw_image, 662, 663 draw_image_mono, 663

INDEX

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

INDEX font, 663 height, 663 rtl_draw, 663 text_extents, 663 width, 663, 664 Fl_RGB_Image, 669 Fl_RGB_Image, 671 Fl_RGB_Image, 671 color_average, 671 copy, 671 desaturate, 671 draw, 672 Fl_RGB_Image, 671 label, 672 uncache, 672 Fl_Radio_Button, 664 Fl_Radio_Light_Button, 665 Fl_Radio_Round_Button, 665 Fl_Repeat_Button, 666 Fl_Repeat_Button, 666 deactivate, 666 Fl_Repeat_Button, 666 handle, 667 Fl_Return_Button, 667 Fl_Return_Button, 668 draw, 668 Fl_Return_Button, 668 handle, 669 Fl_Roller, 673 Fl_Roller, 673 draw, 674 Fl_Roller, 673 handle, 674 Fl_Round_Button, 675 Fl_Round_Clock, 675 Fl_Round_Clock, 676 Fl_Round_Clock, 676 Fl_Scroll, 676 Fl_Scroll, 679 bbox, 679 clear, 679 draw, 679 Fl_Scroll, 679 handle, 679 resize, 680 scroll_to, 680 scrollbar_size, 680, 681 xposition, 681 yposition, 681 Fl_Scroll::ScrollInfo, 930 Fl_Scrollbar, 681 Fl_Scrollbar, 683 Fl_Scrollbar, 683 draw, 683
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

997 Fl_Scrollbar, 683 handle, 683 linesize, 684 value, 684 Fl_Secret_Input, 685 Fl_Secret_Input, 685 Fl_Secret_Input, 685 Fl_Select_Browser, 686 Fl_Select_Browser, 686 Fl_Select_Browser, 686 Fl_Shared_Image, 687 Fl_Shared_Image, 689 Fl_Shared_Image, 689 color_average, 689 copy, 689, 690 desaturate, 690 draw, 690 Fl_Shared_Image, 689 get, 690 num_images, 691 refcount, 691 release, 691 uncache, 691 Fl_Shared_Image.H, 967 _register_images, 968 Fl_Simple_Counter, 691 Fl_Single_Window, 692 ush, 693 make_current, 693 show, 694 Fl_Slider, 695 Fl_Slider, 696 bounds, 696 draw, 696 Fl_Slider, 696 handle, 697 scrollvalue, 697 slider, 697, 698 slider_size, 698 Fl_Spinner, 698 Fl_Spinner, 700 Fl_Spinner, 700 format, 700 handle, 700 maximum, 700 maxinum, 701 minimum, 701 mininum, 701 range, 701 resize, 701 step, 701 textcolor, 701, 702 textfont, 702 textsize, 702

998 type, 702 value, 702 Fl_String _types.h, 972 Fl_Surface_Device, 703 Fl_Surface_Device, 704 Fl_Surface_Device, 704 class_id, 705 class_name, 704 driver, 704 Fl_Surface_Device, 704 set_current, 704 Fl_Sys_Menu_Bar, 705 Fl_Sys_Menu_Bar, 706 add, 706 clear, 706 clear_submenu, 707 draw, 707 Fl_Sys_Menu_Bar, 706 insert, 708 menu, 708 remove, 708 replace, 708 Fl_System_Printer, 709 class_id, 713 class_name, 710 end_page, 710 margins, 711 origin, 711 printable_rect, 711 rotate, 712 scale, 712 start_job, 712 start_page, 713 translate, 713 Fl_Table, 713 Fl_Table, 722 Fl_Table, 721 TableContext, 721 begin, 722 callback, 722 callback_col, 723 callback_context, 723 callback_row, 723 child, 723 children, 723 clear, 724 col_header, 724 col_resize, 724 col_resize_min, 724 col_width, 724 col_width_all, 724 draw, 725 draw_cell, 725 end, 727 nd, 727 Fl_Table, 721 get_selection, 727 handle, 728 init_sizes, 728 insert, 729 is_interactive_resize, 729 is_selected, 729 remove, 729 row_header, 729 row_height, 730 row_height_all, 730 row_resize, 730 row_resize_min, 730 set_selection, 730 table_box, 730 top_row, 730, 731 visible_cells, 731 when, 731 Fl_Table::IntVector, 925 Fl_Table_Row, 732 Fl_Table_Row, 733 Fl_Table_Row, 733 clear, 733 Fl_Table_Row, 733 handle, 734 row_selected, 734 select_all_rows, 734 select_row, 734 type, 734, 735 Fl_Table_Row::CharVector, 305 Fl_Tabs, 735 Fl_Tabs, 737 client_area, 737 draw, 737 Fl_Tabs, 737 handle, 738 value, 738 Fl_Text_Buffer, 739 Fl_Text_Buffer, 744 add_modify_callback, 744 address, 745 append, 745 appendle, 745 byte_at, 745 char_at, 746 copy, 746 count_displayed_characters, 746 count_lines, 746 ndchar_backward, 746 ndchar_forward, 747 Fl_Text_Buffer, 744 highlight, 747

INDEX

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

INDEX highlight_text, 747 insert, 747 insert_, 748 insertle, 748 length, 748 line_end, 748 line_start, 749 line_text, 749 loadle, 749 mPredeleteProcs, 753 mTabDist, 753 next_char, 749 outputle, 749 prev_char, 749 remove, 750 remove_, 750 replace, 750 rewind_lines, 750 search_backward, 750 search_forward, 751 secondary_selection_text, 751 selection_text, 751 skip_displayed_characters, 751 text, 752 text_range, 752 transcoding_warning_action, 753 word_end, 752 word_start, 752 Fl_Text_Display, 753 Fl_Text_Display, 761 Fl_Text_Display, 761 absolute_top_line_number, 761 buffer, 761, 762 buffer_modied_cb, 762 buffer_predelete_cb, 762 calc_last_char, 762 calc_line_starts, 762 clear_rect, 763 col_to_x, 763 count_lines, 763 cursor_color, 764 cursor_style, 764 display_insert, 764 draw, 764 draw_cursor, 765 draw_line_numbers, 765 draw_range, 765 draw_string, 765 draw_text, 766 draw_vline, 766 empty_vlines, 766 extend_range_for_styles, 766 nd_line_end, 767 nd_wrap_range, 767
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

999 nd_x, 767 Fl_Text_Display, 761 get_absolute_top_line_number, 768 handle_vline, 768 highlight_data, 769 in_selection, 769 insert, 769 insert_position, 770 line_end, 770 line_start, 770 longest_vline, 771 maintain_absolute_top_line_number, 771 maintaining_absolute_top_line_number, 771 measure_deleted_lines, 771 measure_proportional_character, 771 measure_vline, 772 move_down, 772 move_left, 772 move_right, 772 move_up, 773 offset_line_starts, 773 overstrike, 773 position_style, 773 position_to_line, 774 position_to_linecol, 774 position_to_xy, 775 redisplay_range, 775 reset_absolute_top_line_number, 775 resize, 775 rewind_lines, 776 scroll, 776 scroll_, 776 scroll_timer_cb, 776 scrollbar_align, 776, 777 scrollbar_width, 777 shortcut, 777 show_cursor, 777 show_insert_position, 778 skip_lines, 778 string_width, 778 textcolor, 778, 779 textfont, 779 textsize, 779 update_h_scrollbar, 779 update_line_starts, 780 update_v_scrollbar, 780 vline_length, 780 word_end, 780 word_start, 781 wrap_mode, 781 wrap_uses_character, 781 wrapped_column, 782 wrapped_line_counter, 782 wrapped_row, 783

1000 x_to_col, 783 xy_to_position, 783 xy_to_rowcol, 784 Fl_Text_Display::Style_Table_Entry, 930 Fl_Text_Editor, 784 Fl_Text_Editor, 787 add_default_key_bindings, 787 bound_key_function, 787 default_key_function, 787 Fl_Text_Editor, 787 insert_mode, 787, 788 kf_backspace, 788 kf_c_s_move, 788 kf_copy, 788 kf_cut, 788 kf_delete, 788 kf_down, 788 kf_end, 788 kf_home, 788 kf_insert, 788 kf_left, 788 kf_m_s_move, 789 kf_move, 789 kf_page_down, 789 kf_page_up, 789 kf_paste, 789 kf_right, 789 kf_select_all, 789 kf_shift_move, 789 kf_undo, 789 kf_up, 789 remove_all_key_bindings, 789, 790 remove_key_binding, 790 Fl_Text_Editor::Key_Binding, 926 Fl_Text_Selection, 790 end, 791 position, 791 selected, 791 set, 792 start, 792 update, 792 Fl_Tile, 792 Fl_Tile, 794 Fl_Tile, 794 handle, 794 position, 794 resize, 795 Fl_Tiled_Image, 795 Fl_Tiled_Image, 796 color_average, 796 copy, 796 desaturate, 797 draw, 797 Fl_Tiled_Image, 796 Fl_Timer, 797 Fl_Timer, 798 direction, 799 draw, 799 Fl_Timer, 798 handle, 799 suspended, 800 Fl_Toggle_Button, 800 Fl_Toggle_Button, 801 Fl_Toggle_Button, 801 Fl_Tooltip, 801 color, 802 current, 802 delay, 802, 803 disable, 803 enable, 803 enabled, 803 enter_area, 803 font, 803 hoverdelay, 803 size, 804 textcolor, 804 Fl_Tree, 804 add, 812 callback_item, 812, 813 callback_reason, 813 clear, 813 clear_children, 813 close, 813, 814 closeicon, 815 deselect, 815 deselect_all, 816 display, 816 displayed, 816 nd_clicked, 817 nd_item, 817 rst, 818 rst_selected_item, 818 insert, 818 insert_above, 818 is_close, 819 is_open, 819, 820 is_scrollbar, 820 is_selected, 820, 821 item_clicked, 821 item_labelbgcolor, 821 item_labelfgcolor, 821 item_labelfont, 822 item_labelsize, 822 item_pathname, 822 last, 822 load, 823 next, 823 next_selected_item, 823

INDEX

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

INDEX next_visible_item, 824 open, 824 open_toggle, 825 openicon, 826 prev, 826 remove, 826 root_label, 826 scrollbar_size, 827 select, 827, 828 select_all, 828 select_only, 829 select_toggle, 829 selectbox, 830 set_item_focus, 830 show_item, 830 show_item_bottom, 831 show_item_middle, 831 show_item_top, 831 show_self, 831 showcollapse, 831 showroot, 832 sortorder, 832 usericon, 832 vposition, 832 Fl_Tree.H, 969 Fl_Tree_Reason, 969 Fl_Tree_Connector Fl_Tree_Prefs.H, 971 Fl_Tree_Item, 833 Fl_Tree_Item, 837 activate, 837 add, 837 child, 837 deactivate, 838 depth, 838 deselect_all, 838 nd_child, 838 nd_child_item, 838 nd_clicked, 839 nd_item, 839 Fl_Tree_Item, 837 hide_widgets, 839 insert, 840 insert_above, 840 next, 840 next_displayed, 840 next_sibling, 840 parent, 841 prev, 841 prev_displayed, 841 prev_sibling, 841 remove_child, 841 select, 842 select_all, 842
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

1001 show_self, 842 show_widgets, 842 swap_children, 842 visible_r, 843 Fl_Tree_Item.H, 969 Fl_Tree_Item_Array, 843 Fl_Tree_Item_Array, 844 add, 844 clear, 844 Fl_Tree_Item_Array, 844 insert, 844 remove, 844, 845 Fl_Tree_Item_Array.H, 970 Fl_Tree_Prefs, 845 closeicon, 847 labelfont, 847 openicon, 847, 848 selectmode, 848 showcollapse, 848 showroot, 848 sortorder, 848 Fl_Tree_Prefs.H, 970 Fl_Tree_Connector, 971 Fl_Tree_Select, 971 Fl_Tree_Sort, 971 Fl_Tree_Reason Fl_Tree.H, 969 Fl_Tree_Select Fl_Tree_Prefs.H, 971 Fl_Tree_Sort Fl_Tree_Prefs.H, 971 Fl_Valuator, 849 Fl_Valuator, 851 bounds, 851 clamp, 851 Fl_Valuator, 851 format, 852 handle_drag, 852 handle_release, 852 increment, 852 maximum, 852 minimum, 852 precision, 852 range, 853 round, 853 set_value, 853 step, 853 value, 853 Fl_Value_Input, 854 Fl_Value_Input, 856 cursor_color, 856 draw, 856 Fl_Value_Input, 856 handle, 856

1002 resize, 857 shortcut, 857 soft, 857 textcolor, 858 textfont, 858 textsize, 858 Fl_Value_Output, 858 Fl_Value_Output, 860 draw, 860 Fl_Value_Output, 860 handle, 860 soft, 861 textcolor, 861 textfont, 861 textsize, 861 Fl_Value_Slider, 862 Fl_Value_Slider, 863 draw, 863 Fl_Value_Slider, 863 handle, 863 textcolor, 864 textfont, 864 textsize, 864 Fl_When Enumerations.H, 950 Fl_Widget, 864 Fl_Widget, 872 Fl_Widget, 872 activate, 872 active, 872 active_r, 873 align, 873 argument, 874 as_gl_window, 874 as_group, 874 as_window, 875 box, 875 callback, 876 changed, 877 clear_changed, 877 clear_damage, 877 clear_output, 878 clear_visible, 878 clear_visible_focus, 878 color, 878, 879 color2, 879 contains, 879 copy_label, 880 copy_tooltip, 880 damage, 880, 881 damage_resize, 881 deactivate, 881 default_callback, 882 deimage, 882 do_callback, 883 draw, 883 draw_box, 884 draw_label, 884 Fl_Widget, 872 h, 884 handle, 885 hide, 885 image, 885, 886 inside, 886 label, 886, 887 label_shortcut, 887 labelcolor, 887, 888 labelfont, 888 labelsize, 888, 889 labeltype, 889 measure_label, 889 output, 889 parent, 890 position, 890 redraw, 891 redraw_label, 891 resize, 891 selection_color, 891 set_changed, 892 set_output, 892 set_visible, 892 set_visible_focus, 892 show, 892 size, 893 take_focus, 893 takesevents, 893 test_shortcut, 894 tooltip, 894, 895 type, 895 user_data, 895, 896 visible, 896 visible_focus, 896 visible_r, 896 w, 897 when, 897 window, 898 x, 898 y, 898, 899 Fl_Widget.H, 974 _intptr_t, 975 Fl_Widget_Tracker, 899 deleted, 900 exists, 900 widget, 900 Fl_Window, 901 Fl_Window, 905 Fl_Window, 904, 905 as_window, 905

INDEX

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

INDEX border, 905 clear_border, 906 copy_label, 906 current, 906 current_, 914 cursor, 906 decorated_h, 906 decorated_w, 907 default_cursor, 907 default_xclass, 907 draw, 907 Fl_Window, 904, 905 ush, 908 force_position, 908 free_position, 908 fullscreen, 908 handle, 909 hide, 909 hotspot, 909 icon, 909, 910 iconize, 910 iconlabel, 910 label, 910 make_current, 910 menu_window, 910 modal, 910 non_modal, 911 override, 911 resize, 911 set_menu_window, 911 set_modal, 911 set_non_modal, 911 set_tooltip_window, 912 show, 912 shown, 913 size_range, 913 tooltip_window, 913 xclass, 914 Fl_Wizard, 915 Fl_Wizard, 916 Fl_Wizard, 916 next, 916 prev, 916 value, 916 Fl_XBM_Image, 916 Fl_XBM_Image, 917 Fl_XBM_Image, 917 Fl_XColor, 917 Fl_XPM_Image, 922 Fl_XPM_Image, 922 Fl_XPM_Image, 922 Fl_Xlib_Graphics_Driver, 917 class_id, 921 class_name, 919
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

1003 color, 919 descent, 919 draw, 919, 920 draw_image, 920 draw_image_mono, 920 font, 921 height, 921 rtl_draw, 921 text_extents, 921 width, 921 IActiveIMMApp, 923 ID Fl_Preferences, 641 Mac OS X-specic symbols, 285 _mac_set_about, 285 _open_callback, 285 gl_texture_pile_height, 285, 286 Multithreading support functions, 268 awake, 268 lock, 268 thread_message, 269 unlock, 269 Name Fl_Preferences::Name, 927 Option Fl_Native_File_Chooser, 590 Page_Format Fl_Paged_Device, 602 Page_Layout Fl_Paged_Device, 602 Pixmap Fl_FormsPixmap, 440, 441 Root Fl_Preferences, 641 STRICT_RFC3629 Unicode and UTF-8 functions, 277 Safe widget deletion support functions, 270 clear_widget_pointer, 271 delete_widget, 271 do_widget_deletion, 271 release_widget_pointer, 272 watch_widget_pointer, 272 Screen functions, 236 h, 236 screen_dpi, 236 screen_xywh, 237 w, 238 x, 238 y, 238 Selection & Clipboard functions, 234 copy, 234 dnd, 234 paste, 234, 235 selection, 235

1004 selection_owner, 235 TableContext Fl_Table, 721 Type Fl_Native_File_Chooser, 590 Unicode and UTF-8 functions, 276 ERRORS_TO_CP1252, 277 ERRORS_TO_ISO8859_1, 277 STRICT_RFC3629, 277 _nonspacing, 278 _ucs_to_Utf16, 278 _utf8back, 278 _utf8bytes, 278 _utf8decode, 279 _utf8encode, 279 _utf8from_mb, 279 _utf8froma, 280 _utf8fromwc, 280 _utf8fwd, 280 _utf8len, 281 _utf8len1, 281 _utf8locale, 281 _utf8test, 281 _utf8to_mb, 281 _utf8toUtf16, 282 _utf8toa, 282 _utf8towc, 282 _utf_strcasecmp, 283 _utf_strncasecmp, 283 _utf_tolower, 283 _utf_toupper, 283 _wcwidth, 283 _wcwidth_, 284 Windows handling functions, 217 atclose, 219 default_atclose, 217 rst_window, 217 grab, 218 modal, 218 next_window, 218 set_atclose, 218 XUtf8FontStruct, 931 _remove Fl_Browser, 339 absolute_top_line_number Fl_Text_Display, 761 activate Fl_Menu_Item, 573 Fl_Tree_Item, 837 Fl_Widget, 872 active Fl_Menu_Item, 573 Fl_Widget, 872 active_r Fl_Widget, 873 activevisible Fl_Menu_Item, 573 add Fl_Browser, 339 Fl_Chart, 381 Fl_Check_Browser, 387 Fl_File_Icon, 428 Fl_Input_Choice, 539 Fl_Menu_, 551, 553 Fl_Menu_Item, 573 Fl_Sys_Menu_Bar, 706 Fl_Tree, 812 Fl_Tree_Item, 837 Fl_Tree_Item_Array, 844 add_awake_handler_ Fl, 314 add_check Fl, 314 add_color Fl_File_Icon, 429 add_default_key_bindings Fl_Text_Editor, 787 add_extra Fl_File_Chooser, 424 add_fd Fl, 314 add_handler Events handling functions, 222 add_idle Fl, 315 add_modify_callback Fl_Text_Buffer, 744 add_timeout Fl, 315 add_vertex Fl_File_Icon, 429 addPlugin Fl_Plugin_Manager, 613 address Fl_Text_Buffer, 745 align Fl_Widget, 873 angle1 Fl_Dial, 411 append Fl_Text_Buffer, 745 appendle Fl_Text_Buffer, 745 arc Fl_Graphics_Driver, 468 Fl_PostScript_Graphics_Driver, 628 arg

INDEX

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

INDEX Fl, 315 args Fl, 316, 317 argument Fl_Menu_Item, 573 Fl_Widget, 874 array Fl_Group, 489 as_gl_window Fl_Gl_Window, 452 Fl_Widget, 874 as_group Fl_Group, 489 Fl_Widget, 874 as_window Fl_Widget, 875 Fl_Window, 905 atclose Windows handling functions, 219 autosize Fl_Chart, 382 awake Multithreading support functions, 268 b Fl_Color_Chooser, 401 background Fl, 317 background2 Fl, 317 bbox Fl_Browser_, 361 Fl_Scroll, 679 begin Fl_Group, 490 Fl_Table, 722 begin_complex_polygon Fl_Graphics_Driver, 468 Fl_PostScript_Graphics_Driver, 628 begin_line Fl_Graphics_Driver, 468 Fl_PostScript_Graphics_Driver, 628 begin_loop Fl_Graphics_Driver, 468 Fl_PostScript_Graphics_Driver, 628 begin_points Fl_Graphics_Driver, 468 Fl_PostScript_Graphics_Driver, 628 begin_polygon Fl_Graphics_Driver, 469 Fl_PostScript_Graphics_Driver, 628 belowmouse Events handling functions, 222 bitmap
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

1005 Fl_FormsBitmap, 439 border Fl_Window, 905 bottomline Fl_Browser, 340 bound_key_function Fl_Text_Editor, 787 bounds Fl_Chart, 382 Fl_Slider, 696 Fl_Valuator, 851 box Fl_Widget, 875 box_dh Fl, 318 box_dw Fl, 318 box_dx Fl, 318 box_dy Fl, 318 buffer Fl_Text_Display, 761, 762 buffer_modied_cb Fl_Text_Display, 762 buffer_predelete_cb Fl_Text_Display, 762 byte_at Fl_Text_Buffer, 745 cairo_autolink_context Cairo support functions and classes, 274 cairo_cc Cairo support functions and classes, 275 calc_last_char Fl_Text_Display, 762 calc_line_starts Fl_Text_Display, 762 callback Fl_Menu_Item, 573, 574 Fl_Table, 722 Fl_Widget, 876 callback_col Fl_Table, 723 callback_context Fl_Table, 723 callback_item Fl_Tree, 812, 813 callback_reason Fl_Tree, 813 callback_row Fl_Table, 723 can_do Fl_Gl_Window, 452

1006 can_do_overlay Fl_Gl_Window, 452 changed Fl_Input_Choice, 539 Fl_Widget, 877 char_at Fl_Text_Buffer, 746 check Fl, 318 Fl_Menu_Item, 574 check_all Fl_Check_Browser, 387 check_none Fl_Check_Browser, 387 checkbox Fl_Menu_Item, 574 checked Fl_Check_Browser, 387 Fl_Menu_Item, 575 child Fl_Group, 490 Fl_Table, 723 Fl_Tree_Item, 837 children Fl_Table, 723 circle Fl_Graphics_Driver, 469 Fl_PostScript_Graphics_Driver, 628 clamp Fl_Valuator, 851 class_id Fl_Device, 408 Fl_Display_Device, 413 Fl_GDI_Graphics_Driver, 448 Fl_Graphics_Driver, 486 Fl_Paged_Device, 606 Fl_PostScript_File_Device, 623 Fl_PostScript_Graphics_Driver, 635 Fl_PostScript_Printer, 637 Fl_Printer, 658 Fl_Quartz_Graphics_Driver, 664 Fl_Surface_Device, 705 Fl_System_Printer, 713 Fl_Xlib_Graphics_Driver, 921 class_name Fl_Device, 408 Fl_Display_Device, 412 Fl_GDI_Graphics_Driver, 445 Fl_Graphics_Driver, 469 Fl_Paged_Device, 603 Fl_PostScript_File_Device, 620 Fl_PostScript_Graphics_Driver, 629 Fl_PostScript_Printer, 636 Fl_Printer, 654 Fl_Quartz_Graphics_Driver, 661 Fl_Surface_Device, 704 Fl_System_Printer, 710 Fl_Xlib_Graphics_Driver, 919 clear

INDEX

Fl_Browser, 340 Fl_Button, 375 Fl_Check_Browser, 387 Fl_File_Icon, 429 Fl_Group, 490 Fl_Input_Choice, 540 Fl_Menu_, 554 Fl_Menu_Item, 575 Fl_Scroll, 679 Fl_Sys_Menu_Bar, 706 Fl_Table, 724 Fl_Table_Row, 733 Fl_Tree, 813 Fl_Tree_Item_Array, 844 clear_border Fl_Window, 906 clear_changed Fl_Input_Choice, 540 Fl_Widget, 877 clear_children Fl_Tree, 813 clear_damage Fl_Widget, 877 clear_output Fl_Widget, 878 clear_overlay Fl_Menu_Window, 582 clear_rect Fl_Text_Display, 763 clear_selection Fl_Help_View, 506 clear_submenu Fl_Menu_, 554 Fl_Sys_Menu_Bar, 707 clear_visible Fl_Widget, 878 clear_visible_focus Fl_Widget, 878 clear_widget_pointer Safe widget deletion support functions, 271 client_area Fl_Tabs, 737 clip_box Fl_Graphics_Driver, 469 Fl_PostScript_Graphics_Driver, 629 clip_children Fl_Group, 490, 491 clip_region Fl_Graphics_Driver, 469
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

INDEX close Fl_Tree, 813, 814 closeicon Fl_Tree, 815 Fl_Tree_Prefs, 847 col FL_CHART_ENTRY, 385 col_header Fl_Table, 724 col_resize Fl_Table, 724 col_resize_min Fl_Table, 724 col_to_x Fl_Text_Display, 763 col_width Fl_Table, 724 col_width_all Fl_Table, 724 color Fl_File_Chooser, 424 Fl_GDI_Graphics_Driver, 445 Fl_Graphics_Driver, 469, 470 Fl_PostScript_Graphics_Driver, 629 Fl_Quartz_Graphics_Driver, 661 Fl_Tooltip, 802 Fl_Widget, 878, 879 Fl_Xlib_Graphics_Driver, 919 color2 Fl_Widget, 879 color_average Fl_Image, 516 Fl_Pixmap, 609 Fl_RGB_Image, 671 Fl_Shared_Image, 689 Fl_Tiled_Image, 796 column_char Fl_Browser, 340 column_widths Fl_Browser, 340, 341 compose Events handling functions, 223 compose_reset Events handling functions, 223 contains Fl_Widget, 879 context Fl_Gl_Window, 452 context_valid Fl_Gl_Window, 453 copy Fl_Bitmap, 331 Fl_Image, 516 Fl_Input_, 524
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

1007 Fl_Menu_, 555 Fl_Pixmap, 609 Fl_RGB_Image, 671 Fl_Shared_Image, 689, 690 Fl_Text_Buffer, 746 Fl_Tiled_Image, 796 Selection & Clipboard functions, 234 copy_cuts Fl_Input_, 525 copy_label Fl_Widget, 880 Fl_Window, 906 copy_tooltip Fl_Widget, 880 count Fl_File_Chooser, 424 Fl_Help_Font_Stack, 500 Fl_Image, 516 Fl_Native_File_Chooser, 591 count_displayed_characters Fl_Text_Buffer, 746 count_lines Fl_Text_Buffer, 746 Fl_Text_Display, 763 current Fl_Group, 491 Fl_Tooltip, 802 Fl_Window, 906 current_ Fl_Window, 914 cursor Fl_Window, 906 cursor_color Fl_Input_, 525 Fl_Text_Display, 764 Fl_Value_Input, 856 cursor_style Fl_Text_Display, 764 curve Fl_Graphics_Driver, 470 Fl_PostScript_Graphics_Driver, 629 cut Fl_Input_, 525, 526 d Fl_Image, 516 damage Fl, 319 Fl_Widget, 880, 881 damage_resize Fl_Widget, 881 data Fl_Browser, 341 Fl_Image, 516

1008 deactivate Fl_Menu_Item, 575 Fl_Repeat_Button, 666 Fl_Tree_Item, 838 Fl_Widget, 881 decorated_h Fl_Window, 906 decorated_w Fl_Window, 907 default_atclose Windows handling functions, 217 default_callback Fl_Widget, 882 default_cursor Fl_Window, 907 default_key_function Fl_Text_Editor, 787 default_xclass Fl_Window, 907 deimage Fl_Widget, 882 delay Fl_Tooltip, 802, 803 delete_widget Safe widget deletion support functions, 271 deleteEntry Fl_Preferences, 643 deleteGroup Fl_Preferences, 643 deleted Fl_Widget_Tracker, 900 deleting Fl_Browser_, 361 depth Fl_Tree_Item, 838 desaturate Fl_Image, 517 Fl_Pixmap, 609 Fl_RGB_Image, 671 Fl_Shared_Image, 690 Fl_Tiled_Image, 797 descent Fl_GDI_Graphics_Driver, 445 Fl_Graphics_Driver, 470 Fl_PostScript_Graphics_Driver, 629 Fl_Quartz_Graphics_Driver, 662 Fl_Xlib_Graphics_Driver, 919 deselect Fl_Browser_, 361 Fl_Tree, 815 deselect_all Fl_Tree, 816 Fl_Tree_Item, 838 direction

INDEX Fl_Timer, 799 directory Fl_File_Chooser, 424 Fl_Help_View, 506 Fl_Native_File_Chooser, 591 disable Fl_Tooltip, 803 display Fl, 319 Fl_Browser, 342 Fl_Browser_, 361 Fl_Tree, 816 display_device Fl_Display_Device, 412 display_insert Fl_Text_Display, 764 displayed Fl_Browser, 342 Fl_Browser_, 361 Fl_Tree, 816 dnd Selection & Clipboard functions, 234 dnd_text_ops Fl, 319 do_callback Fl_Menu_Item, 575 Fl_Widget, 883 do_widget_deletion Safe widget deletion support functions, 271 down_box Fl_Button, 375 Fl_File_Input, 434 Fl_Menu_, 555 draw Fl_Adjuster, 328 Fl_Bitmap, 331 Fl_Box, 334 Fl_Button, 375 Fl_Chart, 382 Fl_Choice, 391 Fl_Clock_Output, 397 Fl_Counter, 405 Fl_Dial, 411 Fl_File_Icon, 429 Fl_FormsBitmap, 439 Fl_FormsPixmap, 440 Fl_Free, 443 Fl_GDI_Graphics_Driver, 445, 446 Fl_Gl_Window, 453 Fl_Glut_Window, 459 Fl_Graphics_Driver, 470, 471 Fl_Group, 491 Fl_Image, 517 Fl_Input, 519
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

INDEX Fl_Label, 544 Fl_Light_Button, 546 Fl_Menu_Bar, 564 Fl_Menu_Button, 567 Fl_Menu_Item, 575 Fl_Pack, 600 Fl_Pixmap, 609 Fl_Positioner, 617 Fl_PostScript_Graphics_Driver, 629, 630 Fl_Progress, 659 Fl_Quartz_Graphics_Driver, 662 Fl_Return_Button, 668 Fl_RGB_Image, 672 Fl_Roller, 674 Fl_Scroll, 679 Fl_Scrollbar, 683 Fl_Shared_Image, 690 Fl_Slider, 696 Fl_Sys_Menu_Bar, 707 Fl_Table, 725 Fl_Tabs, 737 Fl_Text_Display, 764 Fl_Tiled_Image, 797 Fl_Timer, 799 Fl_Value_Input, 856 Fl_Value_Output, 860 Fl_Value_Slider, 863 Fl_Widget, 883 Fl_Window, 907 Fl_Xlib_Graphics_Driver, 919, 920 draw_box Fl_Widget, 884 draw_box_active Fl, 319 draw_cell Fl_Table, 725 draw_child Fl_Group, 491 draw_children Fl_Group, 492 draw_cursor Fl_Text_Display, 765 draw_empty Fl_Image, 517 draw_image Fl_GDI_Graphics_Driver, 446 Fl_Graphics_Driver, 471 Fl_PostScript_Graphics_Driver, 630 Fl_Quartz_Graphics_Driver, 662, 663 Fl_Xlib_Graphics_Driver, 920 draw_image_mono Fl_GDI_Graphics_Driver, 447 Fl_Graphics_Driver, 471 Fl_PostScript_Graphics_Driver, 630, 631
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

1009 Fl_Quartz_Graphics_Driver, 663 Fl_Xlib_Graphics_Driver, 920 draw_label Fl_Widget, 884 draw_line_numbers Fl_Text_Display, 765 draw_outside_label Fl_Group, 492 draw_overlay Fl_Glut_Window, 460 draw_range Fl_Text_Display, 765 draw_string Fl_Text_Display, 765 draw_text Fl_Text_Display, 766 draw_vline Fl_Text_Display, 766 drawtext Fl_Input_, 526 driver Fl_Printer, 654 Fl_Surface_Device, 704 empty_vlines Fl_Text_Display, 766 enable Fl_Tooltip, 803 enabled Fl_Tooltip, 803 end Fl_Group, 492 Fl_Table, 727 Fl_Text_Selection, 791 end_complex_polygon Fl_Graphics_Driver, 471 Fl_PostScript_Graphics_Driver, 631 end_line Fl_Graphics_Driver, 472 Fl_PostScript_Graphics_Driver, 631 end_loop Fl_Graphics_Driver, 472 Fl_PostScript_Graphics_Driver, 631 end_page Fl_Paged_Device, 603 Fl_PostScript_File_Device, 620 Fl_Printer, 654 Fl_System_Printer, 710 end_points Fl_Graphics_Driver, 472 Fl_PostScript_Graphics_Driver, 631 end_polygon Fl_Graphics_Driver, 472 Fl_PostScript_Graphics_Driver, 631

1010 enter_area Fl_Tooltip, 803 entries Fl_Preferences, 643 entry Fl_Preferences, 644 entryExists Fl_Preferences, 644 errmsg Fl_Native_File_Chooser, 591 error Common Dialogs classes and functions, 296 errorcolor Fl_File_Input, 434 event Events handling functions, 223 event_alt Events handling functions, 223 event_button Events handling functions, 223 event_button1 Events handling functions, 224 event_button2 Events handling functions, 224 event_button3 Events handling functions, 224 event_buttons Events handling functions, 224 event_clicks Events handling functions, 224 event_command Events handling functions, 225 event_ctrl Events handling functions, 225 event_dispatch Events handling functions, 225 event_dx Events handling functions, 226 event_dy Events handling functions, 226 event_inside Events handling functions, 226 event_is_click Events handling functions, 227 event_key Events handling functions, 227 event_length Events handling functions, 228 event_original_key Events handling functions, 228 event_shift Events handling functions, 228 event_state Events handling functions, 228 event_text Events handling functions, 229 event_x_root Events handling functions, 229 event_y_root Events handling functions, 229 exists Fl_Widget_Tracker, 900 extend_range_for_styles Fl_Text_Display, 766 fatal

INDEX

Common Dialogs classes and functions, 296 lename Fl_Help_View, 506 Fl_Native_File_Chooser, 591 letype Fl_File_Browser, 418 lter Fl_File_Browser, 418 Fl_File_Chooser, 424 Fl_Native_File_Chooser, 592 lter_value Fl_File_Chooser, 424, 425 Fl_Native_File_Chooser, 592 nd Fl_File_Icon, 429 Fl_Group, 492 Fl_Help_View, 506 Fl_Table, 727 nd_child Fl_Tree_Item, 838 nd_child_item Fl_Tree_Item, 838 nd_clicked Fl_Tree, 817 Fl_Tree_Item, 839 nd_index Fl_Menu_, 555, 556 nd_item Fl_Browser_, 362 Fl_Menu_, 556, 557 Fl_Tree, 817 Fl_Tree_Item, 839 nd_line Fl_Browser, 342 nd_line_end Fl_Text_Display, 767 nd_shortcut Fl_Menu_Item, 575 nd_wrap_range Fl_Text_Display, 767 nd_x Fl_Text_Display, 767
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

INDEX ndchar_backward Fl_Text_Buffer, 746 ndchar_forward Fl_Text_Buffer, 747 rst Fl_File_Icon, 430 Fl_Menu_Item, 576 Fl_Tree, 818 rst_selected_item Fl_Tree, 818 rst_window Windows handling functions, 217 _add_symbol Drawing functions, 253 _alert Common Dialogs classes and functions, 288 _arc Drawing functions, 253, 254 Fl_Graphics_Driver, 477 _arc.cxx, 954 _arci.cxx, 954 _ask Common Dialogs classes and functions, 288 _beep Common Dialogs classes and functions, 289 _begin_complex_polygon Drawing functions, 254 Fl_Graphics_Driver, 478 _begin_offscreen Drawing functions, 254 _begin_points Drawing functions, 254 Fl_Graphics_Driver, 478 _box Enumerations.H, 951 _boxtype.cxx, 955 _internal_boxtype, 956 _rectbound, 956 _can_do_alpha_blending Drawing functions, 254 _choice Common Dialogs classes and functions, 289 _circle Drawing functions, 255 Fl_Graphics_Driver, 478 _clip Drawing functions, 252 _clip_box Drawing functions, 255 Fl_Graphics_Driver, 478 _clip_region Drawing functions, 255 Fl_Graphics_Driver, 479 _color
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

1011 Color & Font functions, 240, 241 Fl_Graphics_Driver, 479 _color.cxx, 956 _color_average Color & Font functions, 241 _color_chooser Common Dialogs classes and functions, 289, 290 _color_cube Enumerations.H, 951 _contrast Color & Font functions, 241 _copy_offscreen Drawing functions, 255 _create_offscreen Drawing functions, 256 _cursor Drawing functions, 256 _curve Drawing functions, 256 Fl_Graphics_Driver, 479 _curve.cxx, 958 _darker Enumerations.H, 951 _delete_offscreen Drawing functions, 256 _dir_chooser Common Dialogs classes and functions, 291 _down Enumerations.H, 951 _draw Drawing functions, 256, 257 _draw.H, 959 _draw_box Drawing functions, 257 _draw_image Drawing functions, 257, 258 Fl_Graphics_Driver, 480 _draw_image_mono Drawing functions, 258, 259 Fl_Graphics_Driver, 481 _draw_pixmap Drawing functions, 259 _draw_symbol Drawing functions, 259 _eventnames Events handling functions, 232 _expand_text Drawing functions, 260 _le_chooser Common Dialogs classes and functions, 292 _le_chooser_callback Common Dialogs classes and functions, 292 _le_chooser_ok_label

1012 Common Dialogs classes and functions, 293 _lename_absolute File names and URI utility functions, 298 _lename_expand File names and URI utility functions, 298 _lename_ext File names and URI utility functions, 299 _lename_free_list File names and URI utility functions, 299 _lename_isdir File names and URI utility functions, 299 _lename_list File names and URI utility functions, 300 _lename_match File names and URI utility functions, 300 _lename_name File names and URI utility functions, 301 _lename_relative File names and URI utility functions, 301 _lename_setext File names and URI utility functions, 302 _font Color & Font functions, 241, 242 Fl_Graphics_Driver, 481 _fontnames Events handling functions, 233 _frame Drawing functions, 260 Enumerations.H, 951 _frame2 Drawing functions, 260 _gap Drawing functions, 260 Fl_Graphics_Driver, 481 _gray_ramp Enumerations.H, 951 _height Color & Font functions, 242 _input Common Dialogs classes and functions, 293 _internal_boxtype _boxtype.cxx, 956 _intptr_t Fl_Widget.H, 975 _latin1_to_local Color & Font functions, 242 _lighter Enumerations.H, 951 _line_style Drawing functions, 261 Fl_Graphics_Driver, 482 _line_style.cxx, 965 _local_to_latin1 Color & Font functions, 242

INDEX _local_to_mac_roman Color & Font functions, 243 _mac_roman_to_local Color & Font functions, 243 _mac_set_about Mac OS X-specic symbols, 285 _measure Drawing functions, 261 _measure_pixmap Drawing functions, 261, 262 _message Common Dialogs classes and functions, 293 _message_hotspot Common Dialogs classes and functions, 293, 294 _message_icon Common Dialogs classes and functions, 294 _message_title Common Dialogs classes and functions, 294 _message_title_default Common Dialogs classes and functions, 295 _mult_matrix Drawing functions, 262 Fl_Graphics_Driver, 482 _nonspacing Unicode and UTF-8 functions, 278 _not_clipped Drawing functions, 262 Fl_Graphics_Driver, 482 _old_shortcut Drawing functions, 262 _open_callback Mac OS X-specic symbols, 285 _open_uri File names and URI utility functions, 302 _password Common Dialogs classes and functions, 295 _pie Drawing functions, 263 Fl_Graphics_Driver, 483 _polygon Drawing functions, 263 Fl_Graphics_Driver, 483 _pop_clip Drawing functions, 263 Fl_Graphics_Driver, 483 _push_clip Drawing functions, 263 Fl_Graphics_Driver, 483 _push_matrix Drawing functions, 263 Fl_Graphics_Driver, 484 _read_image Drawing functions, 263
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

INDEX _rect Drawing functions, 264 Fl_Graphics_Driver, 484 _rect.cxx, 967 _rectbound _boxtype.cxx, 956 _rectf Drawing functions, 264 _register_images Fl_Shared_Image.H, 968 _reset_spot Drawing functions, 264 _rgb_color Enumerations.H, 951, 952 _rotate Drawing functions, 264 Fl_Graphics_Driver, 484 _scale Drawing functions, 264, 265 Fl_Graphics_Driver, 484 _scroll Drawing functions, 265 _set_spot Drawing functions, 265 _set_status Drawing functions, 265 _shortcut_label Drawing functions, 265, 266 _show_colormap Color & Font functions, 243 _show_colormap.H, 968 _size Color & Font functions, 244 _text_extents Color & Font functions, 244, 245 _transform_dx Drawing functions, 266 Fl_Graphics_Driver, 484 _transform_dy Drawing functions, 266 Fl_Graphics_Driver, 484 _transform_x Drawing functions, 266 Fl_Graphics_Driver, 485 _transform_y Drawing functions, 267 Fl_Graphics_Driver, 485 _transformed_vertex Drawing functions, 267 Fl_Graphics_Driver, 485 _translate Drawing functions, 267 Fl_Graphics_Driver, 485 _types.h, 972
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

1013 Fl_CString, 972 Fl_String, 972 _ucs_to_Utf16 Unicode and UTF-8 functions, 278 _utf8.h, 972 _utf8back Unicode and UTF-8 functions, 278 _utf8bytes Unicode and UTF-8 functions, 278 _utf8decode Unicode and UTF-8 functions, 279 _utf8encode Unicode and UTF-8 functions, 279 _utf8from_mb Unicode and UTF-8 functions, 279 _utf8froma Unicode and UTF-8 functions, 280 _utf8fromwc Unicode and UTF-8 functions, 280 _utf8fwd Unicode and UTF-8 functions, 280 _utf8len Unicode and UTF-8 functions, 281 _utf8len1 Unicode and UTF-8 functions, 281 _utf8locale Unicode and UTF-8 functions, 281 _utf8test Unicode and UTF-8 functions, 281 _utf8to_mb Unicode and UTF-8 functions, 281 _utf8toUtf16 Unicode and UTF-8 functions, 282 _utf8toa Unicode and UTF-8 functions, 282 _utf8towc Unicode and UTF-8 functions, 282 _utf_strcasecmp Unicode and UTF-8 functions, 283 _utf_strncasecmp Unicode and UTF-8 functions, 283 _utf_tolower Unicode and UTF-8 functions, 283 _utf_toupper Unicode and UTF-8 functions, 283 _vertex Drawing functions, 267 Fl_Graphics_Driver, 485 _vertex.cxx, 974 _wcwidth Unicode and UTF-8 functions, 283 _wcwidth_ Unicode and UTF-8 functions, 284 _width

1014 Color & Font functions, 245 _xpixel Color & Font functions, 245 ush Fl, 319 Fl_Double_Window, 414 Fl_Gl_Window, 453 Fl_Menu_Window, 582 Fl_Preferences, 644 Fl_Single_Window, 693 Fl_Window, 908 focus Events handling functions, 230 Fl_Group, 492 font Fl_GDI_Graphics_Driver, 447 Fl_Graphics_Driver, 472 Fl_PostScript_Graphics_Driver, 631 Fl_Quartz_Graphics_Driver, 663 Fl_Tooltip, 803 Fl_Xlib_Graphics_Driver, 921 force_position Fl_Window, 908 foreground Fl, 320 format Fl_Spinner, 700 Fl_Valuator, 852 format_char Fl_Browser, 343 free_color Color & Font functions, 245 free_position Fl_Window, 908 full_height Fl_Browser, 344 Fl_Browser_, 362 full_width Fl_Browser_, 362 fullscreen Fl_Window, 908 g Fl_Color_Chooser, 401 gap Fl_Graphics_Driver, 472 Fl_PostScript_Graphics_Driver, 631 get Fl_Preferences, 644646 Fl_Shared_Image, 690 get_absolute_top_line_number Fl_Text_Display, 768 get_awake_handler_ Fl, 320 h Fl_Help_Dialog, 498 Fl_Widget, 884 Screen functions, 236 handle Events handling functions, 230 get_boxtype Fl, 320 get_color Color & Font functions, 246 get_font Color & Font functions, 246 get_font_name Color & Font functions, 246 get_font_sizes Color & Font functions, 246 get_key Events handling functions, 230 get_mouse Events handling functions, 230 get_selection Fl_Table, 727 get_system_colors Fl, 320 getUserdataPath Fl_Preferences, 647 gl.h, 975 gl_color, 977 gl_draw, 977, 978 gl_rect, 978 gl_rectf, 978 gl_color gl.h, 977 gl_draw gl.h, 977, 978 gl_rect gl.h, 978 gl_rectf gl.h, 978 gl_texture_pile_height Mac OS X-specic symbols, 285, 286 gl_visual Fl, 320 global Fl_Menu_, 557 grab Windows handling functions, 218 group Fl_Preferences, 647 groupExists Fl_Preferences, 648 groups Fl_Preferences, 648

INDEX

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

INDEX Fl_Adjuster, 328 Fl_Box, 334 Fl_Browser_, 362 Fl_Button, 375 Fl_Check_Browser, 387 Fl_Choice, 392 Fl_Clock, 395 Fl_Counter, 406 Fl_Dial, 411 Fl_File_Input, 434 Fl_Free, 443 Fl_Group, 492 Fl_Input, 520 Fl_Light_Button, 546 Fl_Menu_Bar, 564 Fl_Menu_Button, 567 Fl_Positioner, 617 Fl_Repeat_Button, 667 Fl_Return_Button, 669 Fl_Roller, 674 Fl_Scroll, 679 Fl_Scrollbar, 683 Fl_Slider, 697 Fl_Spinner, 700 Fl_Table, 728 Fl_Table_Row, 734 Fl_Tabs, 738 Fl_Tile, 794 Fl_Timer, 799 Fl_Value_Input, 856 Fl_Value_Output, 860 Fl_Value_Slider, 863 Fl_Widget, 885 Fl_Window, 909 handle_ Events handling functions, 231 handle_drag Fl_Valuator, 852 handle_mouse Fl_Input_, 526 handle_release Fl_Valuator, 852 handle_vline Fl_Text_Display, 768 handletext Fl_Input_, 527 has_scrollbar Fl_Browser_, 363 height Fl_GDI_Graphics_Driver, 447 Fl_Graphics_Driver, 472 Fl_PostScript_Graphics_Driver, 632 Fl_Quartz_Graphics_Driver, 663 Fl_Xlib_Graphics_Driver, 921
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

1015 help Fl, 326 hide Fl_Browser, 344 Fl_Double_Window, 414 Fl_File_Chooser, 425 Fl_Help_Dialog, 498 Fl_Menu_Item, 576 Fl_Menu_Window, 582 Fl_Overlay_Window, 597 Fl_Widget, 885 Fl_Window, 909 hide_overlay Fl_Gl_Window, 453 hide_widgets Fl_Tree_Item, 839 highlight Fl_Text_Buffer, 747 highlight_data Fl_Text_Display, 769 highlight_text Fl_Text_Buffer, 747 hotspot Fl_Window, 909 hour Fl_Clock_Output, 397 hoverdelay Fl_Tooltip, 803 hposition Fl_Browser_, 363 hscrollbar Fl_Browser_, 372 hsv Fl_Color_Chooser, 401 hsv2rgb Fl_Color_Chooser, 402 hue Fl_Color_Chooser, 402 icon Fl_Browser, 344, 345 Fl_Window, 909, 910 iconize Fl_Window, 910 iconlabel Fl_Window, 910 iconsize Fl_File_Browser, 418 Fl_File_Chooser, 425 idle Fl, 326 image Fl_Widget, 885, 886 in_selection

1016 Fl_Text_Display, 769 inactive Fl_Image, 517 incr_height Fl_Browser, 345 Fl_Browser_, 364 increment Fl_Valuator, 852 index Fl_Input_, 527 init_sizes Fl_Group, 493 Fl_Table, 728 input Fl_Input_Choice, 540 input_type Fl_Input_, 527 insert Fl_Browser, 345, 346 Fl_Chart, 383 Fl_Group, 493 Fl_Input_, 527 Fl_Menu_, 557 Fl_Menu_Item, 576 Fl_Sys_Menu_Bar, 708 Fl_Table, 729 Fl_Text_Buffer, 747 Fl_Text_Display, 769 Fl_Tree, 818 Fl_Tree_Item, 840 Fl_Tree_Item_Array, 844 insert_ Fl_Text_Buffer, 748 insert_above Fl_Tree, 818 Fl_Tree_Item, 840 insert_mode Fl_Text_Editor, 787, 788 insert_position Fl_Text_Display, 770 insertle Fl_Text_Buffer, 748 inserting Fl_Browser_, 364 inside Fl_Widget, 886 is_close Fl_Tree, 819 is_interactive_resize Fl_Table, 729 is_open Fl_Tree, 819, 820 is_scrollbar Fl_Tree, 820 is_selected Fl_Table, 729 Fl_Tree, 820, 821 item_at Fl_Browser, 346 Fl_Browser_, 364 item_clicked Fl_Tree, 821 item_draw Fl_Browser, 346 item_rst Fl_Browser, 346 Fl_Browser_, 364 item_height Fl_Browser, 347 Fl_Browser_, 365 item_labelbgcolor Fl_Tree, 821 item_labelfgcolor Fl_Tree, 821 item_labelfont Fl_Tree, 822 item_labelsize Fl_Tree, 822 item_last Fl_Browser, 347 Fl_Browser_, 365 item_next Fl_Browser, 347 Fl_Browser_, 365 item_pathname Fl_Menu_, 558 Fl_Tree, 822 item_prev Fl_Browser, 348 Fl_Browser_, 365 item_quick_height Fl_Browser_, 366 item_select Fl_Browser, 348 Fl_Browser_, 366 item_selected Fl_Browser, 348 Fl_Browser_, 366 item_swap Fl_Browser, 349 Fl_Browser_, 366 item_text Fl_Browser, 349 Fl_Browser_, 367 item_width Fl_Browser, 349 Fl_Browser_, 367

INDEX

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

INDEX kf_backspace Fl_Text_Editor, 788 kf_c_s_move Fl_Text_Editor, 788 kf_copy Fl_Text_Editor, 788 kf_cut Fl_Text_Editor, 788 kf_delete Fl_Text_Editor, 788 kf_down Fl_Text_Editor, 788 kf_end Fl_Text_Editor, 788 kf_home Fl_Text_Editor, 788 kf_insert Fl_Text_Editor, 788 kf_left Fl_Text_Editor, 788 kf_m_s_move Fl_Text_Editor, 789 kf_move Fl_Text_Editor, 789 kf_page_down Fl_Text_Editor, 789 kf_page_up Fl_Text_Editor, 789 kf_paste Fl_Text_Editor, 789 kf_right Fl_Text_Editor, 789 kf_select_all Fl_Text_Editor, 789 kf_shift_move Fl_Text_Editor, 789 kf_undo Fl_Text_Editor, 789 kf_up Fl_Text_Editor, 789 label Fl_Bitmap, 331, 332 Fl_File_Chooser, 425 Fl_File_Icon, 430 Fl_Image, 517 Fl_Menu_Item, 577 Fl_Pixmap, 609, 610 Fl_RGB_Image, 672 Fl_Widget, 886, 887 Fl_Window, 910 label_shortcut Fl_Widget, 887 labelcolor
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

1017 Fl_Menu_Item, 577 Fl_Widget, 887, 888 labelfont Fl_Menu_Item, 577 Fl_Tree_Prefs, 847 Fl_Widget, 888 labelsize Fl_Menu_Item, 577 Fl_Widget, 888, 889 labeltype Fl_File_Icon, 430 Fl_Menu_Item, 577, 578 Fl_Widget, 889 last Fl_Tree, 822 ld Fl_Image, 518 leftedge Fl_Browser_, 367 leftline Fl_Help_View, 507 length Fl_Text_Buffer, 748 line Fl_Graphics_Driver, 473 Fl_PostScript_Graphics_Driver, 632 line_end Fl_Input_, 528 Fl_Text_Buffer, 748 Fl_Text_Display, 770 line_start Fl_Input_, 528 Fl_Text_Buffer, 749 Fl_Text_Display, 770 line_style Fl_Graphics_Driver, 473 Fl_PostScript_Graphics_Driver, 632 line_text Fl_Text_Buffer, 749 lineno Fl_Browser, 350 lineposition Fl_Browser, 350 linesize Fl_Scrollbar, 684 link Fl_Help_View, 507 load Fl_Browser, 350 Fl_File_Browser, 418 Fl_File_Icon, 430 Fl_Help_Dialog, 498 Fl_Help_View, 507 Fl_Plugin_Manager, 613

1018 Fl_Tree, 823 load_fti Fl_File_Icon, 430 load_image Fl_File_Icon, 431 load_system_icons Fl_File_Icon, 431 loadle Fl_Text_Buffer, 749 lock Multithreading support functions, 268 longest_vline Fl_Text_Display, 771 loop Fl_Graphics_Driver, 473 Fl_PostScript_Graphics_Driver, 632 lstep Fl_Counter, 406 mPredeleteProcs Fl_Text_Buffer, 753 mTabDist Fl_Text_Buffer, 753 maintain_absolute_top_line_number Fl_Text_Display, 771 maintaining_absolute_top_line_number Fl_Text_Display, 771 make_current Fl_Gl_Window, 453 Fl_Glut_Window, 460 Fl_Single_Window, 693 Fl_Window, 910 make_overlay_current Fl_Gl_Window, 454 make_visible Fl_Browser, 351 margins Fl_Paged_Device, 603 Fl_PostScript_File_Device, 621 Fl_Printer, 654 Fl_System_Printer, 711 mark Fl_Input_, 528 maximum Fl_Progress, 659 Fl_Spinner, 700 Fl_Valuator, 852 maximum_size Fl_Input_, 529 maxinum Fl_Spinner, 701 maxsize Fl_Chart, 383 measure Fl_Label, 544 Fl_Menu_Item, 578 measure_deleted_lines Fl_Text_Display, 771 measure_label Fl_Widget, 889 measure_proportional_character Fl_Text_Display, 771 measure_vline Fl_Text_Display, 772 menu Fl_Input_Choice, 540 Fl_Menu_, 559 Fl_Sys_Menu_Bar, 708 menu_window Fl_Window, 910 menubutton Fl_Input_Choice, 540 middleline Fl_Browser, 351 minimum Fl_Progress, 659 Fl_Spinner, 701 Fl_Valuator, 852 mininum Fl_Spinner, 701 minute Fl_Clock_Output, 398 modal Fl_Window, 910 Windows handling functions, 218 mode Fl_Color_Chooser, 402 Fl_Gl_Window, 454 Fl_Menu_, 559 move Fl_Browser, 351 move_down Fl_Text_Display, 772 move_left Fl_Text_Display, 772 move_right Fl_Text_Display, 772 move_up Fl_Text_Display, 773 mult_matrix Fl_Graphics_Driver, 473 mvalue Fl_Menu_, 559 nchecked Fl_Check_Browser, 388 new_list Fl_Browser_, 368

INDEX

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

INDEX newUUID Fl_Preferences, 648 next Fl_File_Icon, 431 Fl_Menu_Item, 578 Fl_Tree, 823 Fl_Tree_Item, 840 Fl_Wizard, 916 next_char Fl_Text_Buffer, 749 next_displayed Fl_Tree_Item, 840 next_selected_item Fl_Tree, 823 next_sibling Fl_Tree_Item, 840 next_visible_item Fl_Tree, 824 next_window Windows handling functions, 218 nitems Fl_Check_Browser, 388 non_modal Fl_Window, 911 not_clipped Fl_Graphics_Driver, 473 Fl_PostScript_Graphics_Driver, 632 num_images Fl_Shared_Image, 691 offset_line_starts Fl_Text_Display, 773 open Fl_Tree, 824 open_toggle Fl_Tree, 825 openicon Fl_Tree, 826 Fl_Tree_Prefs, 847, 848 option Fl, 320, 321 options Fl_Native_File_Chooser, 592 origin Fl_Paged_Device, 603, 604 Fl_PostScript_File_Device, 621 Fl_Printer, 655 Fl_System_Printer, 711 ortho Fl_Gl_Window, 454 output Fl_Widget, 889 outputle Fl_Text_Buffer, 749
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

1019 override Fl_Window, 911 overstrike Fl_Text_Display, 773 own_colormap Fl, 321 parent Fl_Tree_Item, 841 Fl_Widget, 890 paste Selection & Clipboard functions, 234, 235 pattern Fl_File_Icon, 431 picked Fl_Menu_, 559 pie Fl_Graphics_Driver, 473 Fl_PostScript_Graphics_Driver, 632 point Fl_Graphics_Driver, 474 Fl_PostScript_Graphics_Driver, 633 polygon Fl_Graphics_Driver, 474 Fl_PostScript_Graphics_Driver, 633 pop_clip Fl_Graphics_Driver, 474 Fl_PostScript_Graphics_Driver, 633 pop_matrix Fl_Graphics_Driver, 474 popup Fl_Menu_Button, 568 Fl_Menu_Item, 578 popup_buttons Fl_Menu_Button, 566 position Fl_Browser_, 368 Fl_Help_Dialog, 498 Fl_Input_, 529, 530 Fl_Text_Selection, 791 Fl_Tile, 794 Fl_Widget, 890 position_style Fl_Text_Display, 773 position_to_line Fl_Text_Display, 774 position_to_linecol Fl_Text_Display, 774 position_to_xy Fl_Text_Display, 775 precision Fl_Valuator, 852 preset_le Fl_Native_File_Chooser, 593

1020 prev Fl_Tree, 826 Fl_Tree_Item, 841 Fl_Wizard, 916 prev_char Fl_Text_Buffer, 749 prev_displayed Fl_Tree_Item, 841 prev_sibling Fl_Tree_Item, 841 preview Fl_File_Chooser, 425 print Fl_Device_Plugin, 409 Fl_Mac_App_Menu, 548 print_widget Fl_Paged_Device, 604 Fl_Printer, 655 print_window Fl_Paged_Device, 604 print_window_part Fl_Paged_Device, 604 Fl_Printer, 656 printable_rect Fl_Paged_Device, 605 Fl_PostScript_File_Device, 621 Fl_Printer, 656 Fl_System_Printer, 711 pulldown Fl_Menu_Item, 578 push_clip Fl_Graphics_Driver, 474 Fl_PostScript_Graphics_Driver, 633 push_matrix Fl_Graphics_Driver, 474 push_no_clip Fl_Graphics_Driver, 474 Fl_PostScript_Graphics_Driver, 633 pushed Events handling functions, 231 r Fl_Color_Chooser, 402 radio Fl_Menu_Item, 579 range Fl_Spinner, 701 Fl_Valuator, 853 readonly Fl_Input_, 530 ready Fl, 321 rect Fl_Graphics_Driver, 474 rectf Fl_PostScript_Graphics_Driver, 633

INDEX

Fl_Graphics_Driver, 475 Fl_PostScript_Graphics_Driver, 633 redisplay_range Fl_Text_Display, 775 redraw Fl_Widget, 891 redraw_label Fl_Widget, 891 redraw_line Fl_Browser_, 368 redraw_lines Fl_Browser_, 368 redraw_overlay Fl_Gl_Window, 454 Fl_Overlay_Window, 597 refcount Fl_Shared_Image, 691 release Fl, 322 Fl_Shared_Image, 691 release_widget_pointer Safe widget deletion support functions, 272 reload_scheme Fl, 322 remove Fl_Browser, 352 Fl_Check_Browser, 388 Fl_Group, 494 Fl_Menu_, 560 Fl_Sys_Menu_Bar, 708 Fl_Table, 729 Fl_Text_Buffer, 750 Fl_Tree, 826 Fl_Tree_Item_Array, 844, 845 remove_ Fl_Text_Buffer, 750 remove_all_key_bindings Fl_Text_Editor, 789, 790 remove_check Fl, 322 remove_child Fl_Tree_Item, 841 remove_fd Fl, 322 remove_handler Events handling functions, 231 remove_icon Fl_Browser, 352 remove_key_binding Fl_Text_Editor, 790 remove_timeout Fl, 322
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

INDEX removePlugin Fl_Plugin_Manager, 613 repeat_timeout Fl, 322 replace Fl_Browser, 352 Fl_Chart, 383 Fl_Input_, 530 Fl_Menu_, 560 Fl_Sys_Menu_Bar, 708 Fl_Text_Buffer, 750 replacing Fl_Browser_, 369 rescan Fl_File_Chooser, 425 reset_absolute_top_line_number Fl_Text_Display, 775 resizable Fl_Group, 494 resize Fl_Browser_, 369 Fl_Double_Window, 415 Fl_Gl_Window, 455 Fl_Group, 495 Fl_Help_Dialog, 498 Fl_Help_View, 507 Fl_Input_, 531 Fl_Input_Choice, 540 Fl_Overlay_Window, 597 Fl_Scroll, 680 Fl_Spinner, 701 Fl_Text_Display, 775 Fl_Tile, 795 Fl_Value_Input, 857 Fl_Widget, 891 Fl_Window, 911 restore_clip Fl_Graphics_Driver, 475 rewind_lines Fl_Text_Buffer, 750 Fl_Text_Display, 776 rgb Fl_Color_Chooser, 402 rgb2hsv Fl_Color_Chooser, 403 root_label Fl_Tree, 826 rotate Fl_Graphics_Driver, 475 Fl_Paged_Device, 605 Fl_PostScript_File_Device, 622 Fl_Printer, 656 Fl_System_Printer, 712 round
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

1021 Fl_Valuator, 853 row_header Fl_Table, 729 row_height Fl_Table, 730 row_height_all Fl_Table, 730 row_resize Fl_Table, 730 row_resize_min Fl_Table, 730 row_selected Fl_Table_Row, 734 rtl_draw Fl_GDI_Graphics_Driver, 447 Fl_Graphics_Driver, 475 Fl_PostScript_Graphics_Driver, 634 Fl_Quartz_Graphics_Driver, 663 Fl_Xlib_Graphics_Driver, 921 run Fl, 323 saturation Fl_Color_Chooser, 403 scale Fl_Graphics_Driver, 475 Fl_Paged_Device, 605 Fl_PostScript_File_Device, 622 Fl_Printer, 656 Fl_System_Printer, 712 scheme Fl, 323 screen_dpi Screen functions, 236 screen_xywh Screen functions, 237 scroll Fl_Text_Display, 776 scroll_ Fl_Text_Display, 776 scroll_timer_cb Fl_Text_Display, 776 scroll_to Fl_Scroll, 680 scrollbar Fl_Browser_, 372 scrollbar_align Fl_Text_Display, 776, 777 scrollbar_left Fl_Browser_, 369 scrollbar_right Fl_Browser_, 369 scrollbar_size Fl, 323

1022 Fl_Browser_, 369, 370 Fl_Help_View, 507, 508 Fl_Scroll, 680, 681 Fl_Tree, 827 scrollbar_width Fl_Browser_, 370 Fl_Text_Display, 777 scrollvalue Fl_Slider, 697 search_backward Fl_Text_Buffer, 750 search_forward Fl_Text_Buffer, 751 second Fl_Clock_Output, 398 secondary_selection_text Fl_Text_Buffer, 751 select Fl_Browser, 352 Fl_Browser_, 370 Fl_Tree, 827, 828 Fl_Tree_Item, 842 select_all Fl_Help_View, 508 Fl_Tree, 828 Fl_Tree_Item, 842 select_all_rows Fl_Table_Row, 734 select_only Fl_Browser_, 371 Fl_Tree, 829 select_row Fl_Table_Row, 734 select_toggle Fl_Tree, 829 selectbox Fl_Tree, 830 selected Fl_Browser, 353 Fl_Text_Selection, 791 selection Fl_Browser_, 371 Selection & Clipboard functions, 235 selection_color Fl_Widget, 891 selection_owner Selection & Clipboard functions, 235 selection_text Fl_Text_Buffer, 751 selectmode Fl_Tree_Prefs, 848 set Fl_Button, 376 Fl_FormsBitmap, 439 Fl_FormsPixmap, 441 Fl_Menu_Item, 579 Fl_Preferences, 648650 Fl_Text_Selection, 792 set_atclose Windows handling functions, 218 set_boxtype Fl, 324 set_changed Fl_Input_Choice, 541 Fl_Widget, 892 set_checked Fl_Check_Browser, 388 set_color Color & Font functions, 246, 247 set_current Fl_Printer, 657 Fl_Surface_Device, 704 set_draw_cb Fl_Cairo_Window, 379 set_font Color & Font functions, 247 set_fonts Color & Font functions, 247 set_idle Fl, 324 set_item_focus Fl_Tree, 830 set_labeltype Fl, 324 set_menu_window Fl_Window, 911 set_modal Fl_Window, 911 set_non_modal Fl_Window, 911 set_output Fl_Widget, 892 set_overlay Fl_Menu_Window, 582 set_selection Fl_Table, 730 set_tooltip_window Fl_Window, 912 set_value Fl_Valuator, 853 set_visible Fl_Widget, 892 set_visible_focus Fl_Widget, 892 setonly Fl_Menu_Item, 579 shortcut Fl_Button, 376

INDEX

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

INDEX Fl_Input_, 531 Fl_Menu_, 560 Fl_Menu_Item, 579 Fl_Text_Display, 777 Fl_Value_Input, 857 show Fl_Browser, 353 Fl_Double_Window, 415 Fl_File_Chooser, 425 Fl_Gl_Window, 455 Fl_Help_Dialog, 499 Fl_Menu_Item, 579 Fl_Menu_Window, 582 Fl_Native_File_Chooser, 593 Fl_Overlay_Window, 597, 598 Fl_Single_Window, 694 Fl_Widget, 892 Fl_Window, 912 show_cursor Fl_Text_Display, 777 show_insert_position Fl_Text_Display, 778 show_item Fl_Tree, 830 show_item_bottom Fl_Tree, 831 show_item_middle Fl_Tree, 831 show_item_top Fl_Tree, 831 show_self Fl_Tree, 831 Fl_Tree_Item, 842 show_widgets Fl_Tree_Item, 842 showcollapse Fl_Tree, 831 Fl_Tree_Prefs, 848 shown Fl_Window, 913 showroot Fl_Tree, 832 Fl_Tree_Prefs, 848 size Fl_Browser, 353 Fl_Chart, 383 Fl_File_Icon, 431 Fl_Graphics_Driver, 475 Fl_Help_View, 508 Fl_Input_, 532 Fl_Menu_, 560 Fl_Preferences, 651 Fl_Tooltip, 804 Fl_Widget, 893
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

1023 size_range Fl_Window, 913 sizes Fl_Group, 496 skip_displayed_characters Fl_Text_Buffer, 751 skip_lines Fl_Text_Display, 778 slider Fl_Slider, 697, 698 slider_size Fl_Slider, 698 soft Fl_Adjuster, 329 Fl_Value_Input, 857 Fl_Value_Output, 861 sort Fl_Browser_, 371 sortorder Fl_Tree, 832 Fl_Tree_Prefs, 848 start Fl_Text_Selection, 792 start_job Fl_Paged_Device, 606 Fl_PostScript_File_Device, 622, 623 Fl_PostScript_Printer, 637 Fl_Printer, 657 Fl_System_Printer, 712 start_page Fl_Paged_Device, 606 Fl_PostScript_File_Device, 623 Fl_Printer, 657 Fl_System_Printer, 713 static_value Fl_Input_, 532, 533 step Fl_Counter, 406 Fl_Spinner, 701 Fl_Valuator, 853 str FL_CHART_ENTRY, 385 string_width Fl_Text_Display, 778 submenu Fl_Menu_Item, 579 suspended Fl_Timer, 800 swap Fl_Browser, 354 swap_buffers Fl_Gl_Window, 456 swap_children Fl_Tree_Item, 842

1024 swapping Fl_Browser_, 371 tab_nav Fl_Input_, 533 table_box Fl_Table, 730 take_focus Fl_Widget, 893 takesevents Fl_Widget, 893 test_shortcut Events handling functions, 232 Fl_Menu_, 561 Fl_Menu_Item, 580 Fl_Widget, 894 text Fl_Browser, 354, 355 Fl_Check_Browser, 388 Fl_Menu_, 561 Fl_Text_Buffer, 752 text_extents Fl_GDI_Graphics_Driver, 447 Fl_Graphics_Driver, 475 Fl_PostScript_Graphics_Driver, 634 Fl_Quartz_Graphics_Driver, 663 Fl_Xlib_Graphics_Driver, 921 text_range Fl_Text_Buffer, 752 textcolor Fl_Chart, 384 Fl_File_Chooser, 426 Fl_Help_View, 509 Fl_Input_, 534 Fl_Menu_, 561 Fl_Spinner, 701, 702 Fl_Text_Display, 778, 779 Fl_Tooltip, 804 Fl_Value_Input, 858 Fl_Value_Output, 861 Fl_Value_Slider, 864 textfont Fl_Browser_, 372 Fl_Chart, 384 Fl_File_Chooser, 426 Fl_Help_View, 509 Fl_Input_, 534 Fl_Menu_, 561 Fl_Spinner, 702 Fl_Text_Display, 779 Fl_Value_Input, 858 Fl_Value_Output, 861 Fl_Value_Slider, 864 textsize Fl_Chart, 384 Fl_File_Chooser, 426 Fl_Help_Dialog, 499 Fl_Help_View, 509 Fl_Input_, 535 Fl_Menu_, 561, 562 Fl_Spinner, 702 Fl_Text_Display, 779 Fl_Value_Input, 858 Fl_Value_Output, 861 Fl_Value_Slider, 864 thread_message Multithreading support functions, 269 title Fl_Help_View, 509 Fl_Native_File_Chooser, 593 tooltip Fl_Widget, 894, 895 tooltip_window Fl_Window, 913 top Fl_Help_Font_Stack, 500 top_row Fl_Table, 730, 731 topline Fl_Browser, 355 Fl_Help_View, 509, 510 transcoding_warning_action Fl_Text_Buffer, 753 transform_dx Fl_Graphics_Driver, 475 transform_dy Fl_Graphics_Driver, 476 transform_x Fl_Graphics_Driver, 476 transform_y Fl_Graphics_Driver, 476 transformed_vertex Fl_Graphics_Driver, 476 Fl_PostScript_Graphics_Driver, 634 translate Fl_Graphics_Driver, 476 Fl_Paged_Device, 606 Fl_PostScript_File_Device, 623 Fl_Printer, 657 Fl_System_Printer, 713 type Fl_File_Chooser, 426 Fl_File_Icon, 431 Fl_Label, 544 Fl_Spinner, 702 Fl_Table_Row, 734, 735 Fl_Widget, 895

INDEX

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

INDEX uncache Fl_Bitmap, 332 Fl_Image, 518 Fl_Pixmap, 610 Fl_RGB_Image, 672 Fl_Shared_Image, 691 uncheck Fl_Menu_Item, 580 undo Fl_Input_, 535 unlock Multithreading support functions, 269 up_down_position Fl_Input_, 535 update Fl_Text_Selection, 792 update_child Fl_Group, 496 update_h_scrollbar Fl_Text_Display, 779 update_line_starts Fl_Text_Display, 780 update_v_scrollbar Fl_Text_Display, 780 user_data Fl_Widget, 895, 896 usericon Fl_Tree, 832 val FL_CHART_ENTRY, 385 valid Fl_Gl_Window, 456 value Fl_Browser, 355 Fl_Button, 377 Fl_Check_Browser, 388 Fl_Choice, 392, 393 Fl_Clock_Output, 398, 399 Fl_Color_Chooser, 403 Fl_File_Chooser, 426 Fl_File_Icon, 432 Fl_File_Input, 434 Fl_Help_Dialog, 499 Fl_Help_View, 510 Fl_Input_, 535, 536 Fl_Input_Choice, 541 Fl_Menu_, 562 Fl_Menu_Item, 580 Fl_Positioner, 618 Fl_Progress, 659, 660 Fl_Scrollbar, 684 Fl_Spinner, 702 Fl_Tabs, 738
Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

1025 Fl_Valuator, 853 Fl_Wizard, 916 version Fl, 324 vertex Fl_Graphics_Driver, 476 Fl_PostScript_Graphics_Driver, 634 visible Fl_Browser, 356 Fl_File_Chooser, 426 Fl_Help_Dialog, 499 Fl_Menu_Item, 580 Fl_Widget, 896 visible_cells Fl_Table, 731 visible_focus Fl, 324 Fl_Widget, 896 visible_r Fl_Tree_Item, 843 Fl_Widget, 896 visual Fl, 324 vline_length Fl_Text_Display, 780 vposition Fl_Tree, 832 w Fl_Help_Dialog, 499 Fl_Widget, 897 Screen functions, 238 wait Fl, 325 warning Common Dialogs classes and functions, 296 watch_widget_pointer Safe widget deletion support functions, 272 when Fl_Table, 731 Fl_Widget, 897 widget Fl_Widget_Tracker, 900 width Fl_GDI_Graphics_Driver, 447 Fl_Graphics_Driver, 476 Fl_PostScript_Graphics_Driver, 634 Fl_Quartz_Graphics_Driver, 663, 664 Fl_Xlib_Graphics_Driver, 921 window Fl_Widget, 898 word_end Fl_Input_, 537 Fl_Text_Buffer, 752

1026 Fl_Text_Display, 780 word_start Fl_Input_, 537 Fl_Text_Buffer, 752 Fl_Text_Display, 781 wrap Fl_Input_, 537 wrap_mode Fl_Text_Display, 781 wrap_uses_character Fl_Text_Display, 781 wrapped_column Fl_Text_Display, 782 wrapped_line_counter Fl_Text_Display, 782 wrapped_row Fl_Text_Display, 783 x Fl_Help_Dialog, 499 Fl_Widget, 898 Screen functions, 238 x_to_col Fl_Text_Display, 783 xbounds Fl_Positioner, 618 xclass Fl_Window, 914 xposition Fl_Scroll, 681 xstep Fl_Positioner, 618 xvalue Fl_Positioner, 618 xy_to_position Fl_Text_Display, 783 xy_to_rowcol Fl_Text_Display, 784 xyline Fl_Graphics_Driver, 476, 477 Fl_PostScript_Graphics_Driver, 634 y Fl_Help_Dialog, 499 Fl_Widget, 898, 899 Screen functions, 238 ybounds Fl_Positioner, 618 yposition Fl_Scroll, 681 ystep Fl_Positioner, 618 yvalue Fl_Positioner, 618 yxline Fl_Graphics_Driver, 477 Fl_PostScript_Graphics_Driver, 635

INDEX

Generated on Fri Aug 26 2011 19:16:35 for FLTK 1.3.0 by Doxygen

You might also like