FLTK 1.1.10 Programming Manual Revision 10

Total Page:16

File Type:pdf, Size:1020Kb

FLTK 1.1.10 Programming Manual Revision 10 FLTK 1.1.10 Programming Manual Revision 10 Written by Michael Sweet, Craig P. Earls, Matthias Melcher, and Bill Spitzak Copyright 1998-2009 by Bill Spitzak and Others. FLTK 1.1.10 Programming Manual Table of Contents Preface..................................................................................................................................................................1 Organization.............................................................................................................................................1 Conventions.............................................................................................................................................2 Abbreviations...........................................................................................................................................2 Copyrights and Trademarks.....................................................................................................................2 1 - Introduction to FLTK...................................................................................................................................3 History of FLTK......................................................................................................................................3 Features....................................................................................................................................................4 Licensing..................................................................................................................................................5 What Does "FLTK" Mean?.....................................................................................................................5 Building and Installing FLTK Under UNIX and MacOS X....................................................................5 Building FLTK Under Microsoft Windows............................................................................................6 Building FLTK Under OS/2....................................................................................................................7 Internet Resources....................................................................................................................................7 Reporting Bugs........................................................................................................................................7 2 - FLTK Basics...................................................................................................................................................9 Writing Your First FLTK Program..........................................................................................................9 Compiling Programs with Standard Compilers.....................................................................................12 Compiling Programs with Microsoft Visual C++..................................................................................13 Naming...................................................................................................................................................13 Header Files...........................................................................................................................................14 3 - Common Widgets and Attributes..............................................................................................................15 Buttons...................................................................................................................................................15 Text........................................................................................................................................................16 Valuators................................................................................................................................................17 Groups....................................................................................................................................................18 Setting the Size and Position of Widgets...............................................................................................18 Colors.....................................................................................................................................................18 Box Types..............................................................................................................................................19 Labels and Label Types.........................................................................................................................21 Callbacks................................................................................................................................................23 Shortcuts................................................................................................................................................24 4 - Designing a Simple Text Editor..................................................................................................................27 Determining the Goals of the Text Editor..............................................................................................27 Designing the Main Window.................................................................................................................28 Variables................................................................................................................................................28 Menubars and Menus.............................................................................................................................28 Editing the Text.....................................................................................................................................29 The Replace Dialog................................................................................................................................29 Callbacks................................................................................................................................................30 Other Functions......................................................................................................................................34 The main() Function..............................................................................................................................36 Compiling the Editor.............................................................................................................................36 The Final Product...................................................................................................................................36 i FLTK 1.1.10 Programming Manual Table of Contents 4 - Designing a Simple Text Editor Advanced Features.................................................................................................................................37 5 - Drawing Things in FLTK...........................................................................................................................43 When Can You Draw Things in FLTK?................................................................................................43 FLTK Drawing Functions......................................................................................................................43 Drawing Images.....................................................................................................................................53 6 - Handling Events...........................................................................................................................................57 The FLTK Event Model.........................................................................................................................57 Mouse Events.........................................................................................................................................57 Focus Events..........................................................................................................................................58 Keyboard Events....................................................................................................................................59 Widget Events........................................................................................................................................59 Clipboard Events....................................................................................................................................60 Drag And Drop Events...........................................................................................................................60 Fl::event_*() methods............................................................................................................................61 Event Propagation..................................................................................................................................61 FLTK Compose-Character Sequences...................................................................................................62 7 - Adding and Extending Widgets..................................................................................................................63 Subclassing............................................................................................................................................63 Making a Subclass of Fl_Widget...........................................................................................................63
Recommended publications
  • Setting up Opengl, GLM, and FLTK
    Comp 175 - Graphics In Class Lab 0 Setting Up OpenGL, GLM, and FLTK Description: In this lab, your task is to set up your development environment for future labs and assignments that use OpenGL, the GLM library, and FLTK. OpenGL is the standard (3D) graphics library. Although there are other graphics libraries out there (e.g. Vulcan, DirectX or Direct3D by Microsoft, Metal by Apple, and Mantle by AMD), OpenGL remains the most common and most popular API for implementing 3D graphics applications. For convenience, we will be using the GLM library (GLM stands for OpenGL Mathematics) to do all of our linear algebra. The library will help keep the code readable when manipulating matrices, vectors, points, and such. Finally, we will be using FLTK (version 1.3.4) in conjunction with OpenGL. FLTK is a cross-platform, lightweight graphical user interface (GUI) library that supports OpenGL canvas. Since FLTK is cross-platform, you should be able to use your own favorite operating system and windows environment. What a cross-platform toolkit means is that you will write your GUI code once, and you can compile the code in Windows, Mac, and whatever operating system that FLTK supports. The resulting compiled program will be native to the operating system (whereas Java is also a cross-platform language, but Java applications are run in a virtual machine). Personally, I use a Windows machine at home and at work. I have therefore written the initial support code and demo applications in Windows (using Visual Studio 2017 Enterprise edition). For this class, we will support Windows and Mac development environments.
    [Show full text]
  • Porting a Window Manager from Xlib to XCB
    Porting a Window Manager from Xlib to XCB Arnaud Fontaine (08090091) 16 May 2008 Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version pub- lished by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". Contents List of figures i List of listings ii Introduction 1 1 Backgrounds and Motivations 2 2 X Window System (X11) 6 2.1 Introduction . .6 2.2 History . .6 2.3 X Window Protocol . .7 2.3.1 Introduction . .7 2.3.2 Protocol overview . .8 2.3.3 Identifiers of resources . 10 2.3.4 Atoms . 10 2.3.5 Windows . 12 2.3.6 Pixmaps . 14 2.3.7 Events . 14 2.3.8 Keyboard and pointer . 15 2.3.9 Extensions . 17 2.4 X protocol client libraries . 18 2.4.1 Xlib . 18 2.4.1.1 Introduction . 18 2.4.1.2 Data types and functions . 18 2.4.1.3 Pros . 19 2.4.1.4 Cons . 19 2.4.1.5 Example . 20 2.4.2 XCB . 20 2.4.2.1 Introduction . 20 2.4.2.2 Data types and functions . 21 2.4.2.3 xcb-util library . 22 2.4.2.4 Pros . 22 2.4.2.5 Cons . 23 2.4.2.6 Example . 23 2.4.3 Xlib/XCB round-trip performance comparison .
    [Show full text]
  • A Font Family Sampler
    A Font Family Sampler Nelson H. F. Beebe Department of Mathematics University of Utah Salt Lake City, UT 84112-0090, USA 11 February 2021 Version 1.6 To assist in producing greater font face variation in university disser- tations and theses, this document illustrates font family selection with a LATEX document preamble command \usepackage{FAMILY} where FAMILY is given in the subsection titles below. The body font in this document is from the TEX Gyre Bonum family, selected by a \usepackage{tgbonum} command in the document preamble, but the samples illustrate scores other font families. Like Computer Modern, Latin Modern, and the commercial Lucida and MathTime families, the TEX Gyre families oer extensive collections of mathematical characters that are designed to resemble their companion text characters, making them good choices for scientic and mathemati- cal typesetting. The TEX Gyre families also contain many additional spe- cially designed single glyphs for accented letters needed by several Euro- pean languages, such as Ð, ð, Ą, ą, Ę, ę, Ł, ł, Ö, ö, Ő, ő, Ü, ü, Ű, ű, Ş, ş, T,˚ t,˚ Ţ, ţ, U,˚ and u.˚ Comparison of text fonts Some of the families illustrated in this section include distinct mathemat- ics faces, but for brevity, we show only prose. When a font family is not chosen, the LATEX and Plain TEX default is the traditional Computer Mod- ern family used to typeset the Art of Computer Programming books, and shown in the rst subsection. 1 A Font Family Sampler 2 NB: The LuxiMono font has rather large characters: it is used here in 15% reduced size via these preamble commands: \usepackage[T1]{fontenc} % only encoding available for LuxiMono \usepackage[scaled=0.85]{luximono} \usepackage{} % cmr Lorem ipsum dolor sit amet, aenean nulla tellus metus odio non maecenas, pariatur vitae congue laoreet semper, nulla adipiscing cursus neque dolor dui, faucibus aliquam quis.
    [Show full text]
  • Gtk Drawing Area Example C
    Gtk Drawing Area Example C Abyssinian Cary always Indianised his examination if Amadeus is lowest or marshalling skywards. Ornithischian Rudd overruled, his deportation backscatters remilitarizing proud. Zodiacal Udale alkalizing: he repay his ceorl jazzily and observantly. End angle bracket iter to indicates data to c gtk drawing area Programming with gtkmm 3. You should only grab from gtk drawing area widget draws with either create. These programmatically hidden from the properties are put there are created and executable program that all gtk app into boxes, i am doing. This locus the 'traits' of the GtkDrawingArea widget are inherited to this class. GtkDrawingArea gtk-30 Valadoc. M cm else return cm m xm def drawself ctx area tops the egg. Gmcs pkggtk-sharp-20 rusrlibmono20MonoCairodll simplecs Here saying how we compile the example DrawingArea darea new. This source code of examples have thrown me at least we will create a button click to retrieve them into those who must be updated. How to integrate those header-only libraries and uses Catch as an example. We just ugly cast. The error comes from C I over no danger about tablet to drift this drawingrb. Useful for detriment to extract multiple copies of chair same dialog. For example if most have created a dialog box for entering some personal information you. Drawing operation draws the examples are the interior of. Application runs the example draws some way to be used for single cell renderer to this will execute it! This is prominent example in object-oriented behavior enforced in C by GTK. GtkDrawingArea getDrawingAreaStructbool transferOwnership false.
    [Show full text]
  • An Introduction to the X Window System Introduction to X's Anatomy
    An Introduction to the X Window System Robert Lupton This is a limited and partisan introduction to ‘The X Window System’, which is widely but improperly known as X-windows, specifically to version 11 (‘X11’). The intention of the X-project has been to provide ‘tools not rules’, which allows their basic system to appear in a very large number of confusing guises. This document assumes that you are using the configuration that I set up at Peyton Hall † There are helpful manual entries under X and Xserver, as well as for individual utilities such as xterm. You may need to add /usr/princeton/X11/man to your MANPATH to read the X manpages. This is the first draft of this document, so I’d be very grateful for any comments or criticisms. Introduction to X’s Anatomy X consists of three parts: The server The part that knows about the hardware and how to draw lines and write characters. The Clients Such things as terminal emulators, dvi previewers, and clocks and The Window Manager A programme which handles negotiations between the different clients as they fight for screen space, colours, and sunlight. Another fundamental X-concept is that of resources, which is how X describes any- thing that a client might want to specify; common examples would be fonts, colours (both foreground and background), and position on the screen. Keys X can, and usually does, use a number of special keys. You are familiar with the way that <shift>a and <ctrl>a are different from a; in X this sensitivity extends to things like mouse buttons that you might not normally think of as case-sensitive.
    [Show full text]
  • Writing Applications with GTK+ 1 Introduction
    + Writing Applications with GTK Owen Taylor April Introduction Graphical user interfaces have b ecome almost universally familiar However it may b e worth saying a few words ab out how graphical user interfaces work in Linux and X from the p oint of view of the programmer The X server is resp onsible for only the simplest op erations of drawing graphics and text on the screen and for keeping track of the users mouse and keyboard actions Pro grams communicate with the server via the Xlib library However programming applications in straight Xlib would b e a tremendous chore Since Xlib provides only basic drawing commands each application would have to provide their own co de to user interface elements such as buttons or menus Such user interface elemenets are called widgets To avoid such a lab orious job and to provide consistancy b etween dierent applications the normal practice is to use a to olkit a library that builds on top of Xlib and handles the details of the user interface The traditional choices for such a to olkit have b een two libraries built up on X Intrinsics libXt library distributed with X the Athena Widgets which are distributed with X and Mo 1 tif However Xt is complicated to learn and use the Athena Widgets havent lo oked stylish since and Motif while somewhat more up to date is large slow has an app earance disliked by many p eople and most imp ortantly is a proprietary pro duct without freely available source co de For these reasons and others much recent development has fo cused on to olk its that build directly
    [Show full text]
  • Oracle® Secure Global Desktop Platform Support and Release Notes for Release 4.7
    Oracle® Secure Global Desktop Platform Support and Release Notes for Release 4.7 E26357-02 November 2012 Oracle® Secure Global Desktop: Platform Support and Release Notes for Release 4.7 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group. This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited. The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing. If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable: U.S. GOVERNMENT END USERS: Oracle programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, delivered to U.S.
    [Show full text]
  • Fundamentals of Xlib Programming by Examples
    Fundamentals of Xlib Programming by Examples by Ross Maloney Contents 1 Introduction 1 1.1 Critic of the available literature . 1 1.2 The Place of the X Protocol . 1 1.3 X Window Programming gotchas . 2 2 Getting started 4 2.1 Basic Xlib programming steps . 5 2.2 Creating a single window . 5 2.2.1 Open connection to the server . 6 2.2.2 Top-level window . 7 2.2.3 Exercises . 10 2.3 Smallest Xlib program to produce a window . 10 2.3.1 Exercises . 10 2.4 A simple but useful X Window program . 11 2.4.1 Exercises . 12 2.5 A moving window . 12 2.5.1 Exercises . 15 2.6 Parts of windows can disappear from view . 16 2.6.1 Testing overlay services available from an X server . 17 2.6.2 Consequences of no server overlay services . 17 2.6.3 Exercises . 23 2.7 Changing a window’s properties . 23 2.8 Content summary . 25 3 Windows and events produce menus 26 3.1 Colour . 26 3.1.1 Exercises . 27 i CONTENTS 3.2 A button to click . 29 3.3 Events . 33 3.3.1 Exercises . 37 3.4 Menus . 37 3.4.1 Text labelled menu buttons . 38 3.4.2 Exercises . 43 3.5 Some events of the mouse . 44 3.6 A mouse behaviour application . 55 3.6.1 Exercises . 58 3.7 Implementing hierarchical menus . 58 3.7.1 Exercises . 67 3.8 Content summary . 67 4 Pixmaps 68 4.1 The pixmap resource .
    [Show full text]
  • X Window System Network Performance
    X Window System Network Performance Keith Packard Cambridge Research Laboratory, HP Labs, HP [email protected] James Gettys Cambridge Research Laboratory, HP Labs, HP [email protected] Abstract havior (or on a local machine, context switches between the application and the X server). Performance was an important issue in the develop- One of the authors used the network visualization tool ment of X from the initial protocol design and contin- when analyzing the design of HTTP/1.1 [NGBS 97]. ues to be important in modern application and extension The methodology and tools used in that analysis in- development. That X is network transparent allows us volved passive packet level monitoring of traffic which to analyze the behavior of X from a perspective seldom allowed precise real-world measurements and compar- possible in most systems. We passively monitor network isons. The work described in this paper combines this packet flow to measure X application and server perfor- passive packet capture methodology with additional X mance. The network simulation environment, the data protocol specific analysis and visualization. Our experi- capture tool and data analysis tools will be presented. ence with this combination of the general technique with Data from this analysis are used to show the performance X specific additions was very positive and we believe impact of the Render extension, the limitations of the provides a powerful tool that could be used in the analy- LBX extension and help identify specific application and sis of other widely used protocols. toolkit performance problems. We believe this analysis With measurement tools in hand, we set about char- technique can be usefully applied to other network pro- acterizing the performance of a significant selection of tocols.
    [Show full text]
  • FLTK 1.1.8 Programming Manual Revision 8
    FLTK 1.1.8 Programming Manual Revision 8 Written by Michael Sweet, Craig P. Earls, Matthias Melcher, and Bill Spitzak Copyright 1998-2006 by Bill Spitzak and Others. FLTK 1.1.8 Programming Manual Table of Contents Preface..................................................................................................................................................................1 Organization.............................................................................................................................................1 Conventions.............................................................................................................................................2 Abbreviations...........................................................................................................................................2 Copyrights and Trademarks.....................................................................................................................2 1 - Introduction to FLTK...................................................................................................................................3 History of FLTK......................................................................................................................................3 Features....................................................................................................................................................4 Licensing..................................................................................................................................................5
    [Show full text]
  • Striptool Users Guide.Pdf
    StripTool Users Guide 2008/10/24 8:01 AM StripTool Users Guide Kenneth Evans, Jr. November 2002 Advanced Photon Source Argonne National Laboratory 9700 South Cass Avenue Argonne, IL 60439 Table of Contents Introduction Overview History Starting StripTool Configuration Files Environment Variables Controls Window Menubar Graph Window Graph Legend Toolbar Popup Menu History Customization Acknowledgements Copyright Introduction Overview StripTool is a Motif application that allows you to view the time evolution of one or more process variables on a strip chart. It is designed to work with EPICS or CDEV and is maintained as an EPICS Extension. There are two main windows: The Controls Dialog and the Graph. The Controls Dialog allows you to specify and modify the process variable name and the graph parameters corresponding to each curve that is plotted. It also allows you to specify timing parameters and graph properties. The curves are plotted in real time on the Graph. There are buttons on the Graph that allow you to do things like zoom and pan, and there is a popup menu that allows http://www.aps.anl.gov/epics/EpicsDocumentation/ExtensionsManuals/StripTool/StripTool.html Page 1 of 10 StripTool Users Guide 2008/10/24 8:01 AM you to do things like print the graph and save the data in ASCII or SDDS format. StripTool was designed for UNIX but also runs on Microsoft Windows 95, 98, ME, 2000, and XP, collectively labeled here as WIN32. An X server and the X and Motif libraries are needed. For information on obtaining StripTool, consult the EPICS Documentation.
    [Show full text]
  • IN ACTION Understanding Data with Graphs SECOND EDITION
    Covers gnuplot version 5 IN ACTION Understanding data with graphs SECOND EDITION Philipp K. Janert MANNING Gnuplot in Action by Philipp K. Janert Chapter 2 Copyright 2016 Manning Publications brief contents PART 1GETTING STARTED............................................................ 1 1 ■ Prelude: understanding data with gnuplot 3 2 ■ Tutorial: essential gnuplot 16 3 ■ The heart of the matter: the plot command 31 PART 2CREATING GRAPHS ......................................................... 53 4 ■ Managing data sets and files 55 5 ■ Practical matters: strings, loops, and history 78 6 ■ A catalog of styles 100 7 ■ Decorations: labels, arrows, and explanations 125 8 ■ All about axes 146 PART 3MASTERING TECHNICALITIES......................................... 179 9 ■ Color, style, and appearance 181 10 ■ Terminals and output formats 209 11 ■ Automation, scripting, and animation 236 12 ■ Beyond the defaults: workflow and styles 262 PART 4UNDERSTANDING DATA ................................................. 287 13 ■ Basic techniques of graphical analysis 289 14 ■ Topics in graphical analysis 314 15 ■ Coda: understanding data with graphs 344 vii Color, style, and appearance This chapter covers Global appearance options Color Lines and points Size and aspect ratio Whereas the previous few chapters dealt with very local aspects of a graph (such as an individual curve, a single text label, or the details of tic mark formatting), the present chapter addresses global issues. We begin with a long and important sec- tion on color. Color is an exciting topic, and it opens a range of options for data visualization; I’ll explain gnuplot’s support for color handling in detail. Next, we discuss a few details that matter if you want to modify the default appearance of point types, dash patterns, and the automatic selection of visual styles.
    [Show full text]