DOC PREVIEW
GT AE 6382 - LECTURE NOTES

This preview shows page 1-2-3-4-5-34-35-36-37-68-69-70-71-72 out of 72 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1DRAFT (7/10/93): Distribution RestrictedChapter 36 Introduction 32336.1 What’s in a widget? 32436.2 Widgets are event-driven 32536.3 Tk vs. Xlib 32536.4 Square: an example widget 32636.5 Design for re-usability 328Chapter 37 Creating Windows 32937.1 Tk_Window structures 32937.2 Creating Tk_Windows 32937.3 Setting a window’s class 33137.4 Deleting windows 33237.5 Basic operations on Tk_Windows 33237.6 Create procedures 33337.7 Delayed window creation 336Chapter 38 Configuring Widgets 33738.1 Tk_ConfigureWidget 33738.1.1 Tk_ConfigSpec tables 33938.1.2 Invoking Tk_ConfigureWidget 34138.1.3 Errors 34238.1.4 Reconfiguring 34238.1.5 Tk_ConfigureInfo 34238.1.6 Tk_FreeOptions 34338.1.7 Other uses for configuration tables 34338.2 Resource caches 34338.2.1 Graphics contexts 34438.2.2 Other resources 34538.3 Tk_Uids 34638.4 Other translators 34638.5 Changing window attributes 34738.6 The square configure procedure 34838.7 The square widget command procedure 3492DRAFT (7/10/93): Distribution RestrictedChapter 39 Events 35339.1 X events 35339.2 File events 35739.3 Timer events 35939.4 Idle callbacks 36039.5 Generic event handlers 36139.6 Invoking the event dispatcher 362Chapter 40 Displaying Widgets 36540.1 Delayed redisplay 36540.2 Double-buffering with pixmaps 36740.3 Drawing procedures 367Chapter 41 Destroying Widgets 37141.1 Basics 37141.2 Delayed cleanup 372Chapter 42 Managing the Selection 37742.1 Selection handlers 37742.2 Claiming the selection 38042.3 Retrieving the selection 381Chapter 43 Geometry Management 38343.1 Requesting a size for a widget 38343.2 Internal borders 38543.3 Grids 38643.4 Geometry managers 38743.5 Claiming ownership 38843.6 Retrieving geometry information 38843.7 Mapping and setting geometry 389Part IV:Tk’s C Interfaces322DRAFT (7/10/93): Distribution Restricted323Copyright © 1993 Addison-Wesley Publishing Company, Inc.All rights reserved. Duplication of this draft is permitted by individuals for personal use only. Anyother form of duplication or reproduction requires prior written permission of the author or pub-lisher. This statement must be easily visible on the first page of any reproduced copies. The publisherdoes not offer warranties in regard to this draft.Chapter 36IntroductionLike Tcl, Tk is a C library package that is linked with applications, and it provides a col-lection of library procedures that you can invoke from C code in the enclosing application.Although you can do many interesting things with Tk without writing any C code, just bywriting Tcl scripts for wish, you’ll probably find that most large GUI applications requiresome C code too. The most common reason for using Tk’s C interfaces is to build newkinds of widgets. For example, if you write a Tk-based spreadsheet you’ll probably needto implement a new widget to display the contents of the spreadsheet; if you write a chart-ing package you’ll probably build one or two new widgets to display charts and graphs invarious forms; and so on. Some of these widgets could probably be implemented withexisting Tk widgets such as canvases or texts, but for big jobs a new widget tailored to theneeds of your application can probably do the job more simply and efficiently than any ofTk’s general-purpose widgets. Typically you’ll build one or two new widget classes to dis-play your application’s new objects, then combine your custom widgets with Tk’s built-inwidgets to create the full user interface of the application.The main focus of this part of the book is on building new widgets. Most of Tk’slibrary procedures exist for this purpose, and most of the text in this part of the book is ori-ented towards widget builders. However, you can also use Tk’s library procedures to buildnew geometry managers; this is described in Chapter 43. Or, you may simply need to pro-vide access to some window system feature that isn’t supported by the existing Tcl com-mands, such as the ability to set the border width of a top-level window. In any event, thenew features you implement should appear as Tcl commands so that you can use them inscripts. Both the philosophical issues and the library procedures discussed in Part III applyto this part of the book also.FIGURE 36TABLE 36324 IntroductionDRAFT (7/10/93): Distribution Restricted36.1 What’s in a widget?All widget classes have the same basic structure, consisting of a widget record and six Cprocedures that implement the widget’s look and feel. More complex widgets may haveadditional data structures and procedures besides theses, but all widgets have at least thesebasic components. A widget record is the C data structure that represents the state of a widget. Itincludes all of the widget’s configuration options plus anything else the widget needs forits own internal use. For example, the widget record for a label widget contains the label’stext or bitmap, its background and foreground colors, its relief, and so on. Each instance ofa widget has its own widget record, but all widgets of the same class have widget recordswith the same structure. One of the first things you will do when designing a new widgetclass is to design the widget record for that class.Of the widget’s six core procedures, two are Tcl command procedures. The first ofthese is called the create procedure; it implements the Tcl command that creates widgetsof this class. The command’s name is the same as the class name, and the commandshould have the standard syntax described in Section XXX for creating widgets. The com-mand procedure initializes a new widget record, creates the window for the widget, andcreates the widget command for the widget. It is described in more detail in Chapters 37and 38.The second command procedure is the widget command procedure; it implements thewidget commands for all widgets of this class. When the widget command is invoked itsclientData argument points to the widget record for a particular widget; this allowsthe same C procedure to implement the widget commands for many different widgets (thecounter objects described in Section XXX used a similar approach).The third core procedure for a widget class is its configure procedure. Given one ormore options in string form, such as “-background red”, it parses the options andfills in the widget record with corresponding internal representations such as an XColorstructure. The configure procedure is invoked by the create procedure and the widget com-mand procedure to handle configuration


View Full Document

GT AE 6382 - LECTURE NOTES

Download LECTURE NOTES
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view LECTURE NOTES and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view LECTURE NOTES 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?