Xview Code Generator Programmer's Guide
Total Page:16
File Type:pdf, Size:1020Kb
OpenWindows Developer’s Guide: XView Code Generator Programmer’s Guide 2550 Garcia Avenue Mountain View, CA 94043 U.S.A. A Sun Microsystems, Inc. Business 1994 Sun Microsystems, Inc. 2550 Garcia Avenue, Mountain View, California 94043-1100 U.S.A. All rights reserved. This product and related documentation are protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation. No part of this product or related documentation may be reproduced in any form by any means without prior written authorization of Sun and its licensors, if any. Portions of this product may be derived from the UNIX® and Berkeley 4.3 BSD systems, licensed from UNIX System Laboratories, Inc., a wholly owned subsidiary of Novell, Inc., and the University of California, respectively. Third-party font software in this product is protected by copyright and licensed from Sun’s font suppliers. RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by the United States Government is subject to the restrictions set forth in DFARS 252.227-7013 (c)(1)(ii) and FAR 52.227-19. The product described in this manual may be protected by one or more U.S. patents, foreign patents, or pending applications. TRADEMARKS Sun, the Sun logo, Sun Microsystems, Sun Microsystems Computer Corporation, SunSoft, the SunSoft logo, Solaris, SunOS, OpenWindows, DeskSet, ONC, ONC+, and NFS are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and certain other countries. UNIX is a registered trademark of Novell, Inc., in the United States and other countries; X/Open Company, Ltd., is the exclusive licensor of such trademark. OPEN LOOK® is a registered trademark of Novell, Inc. PostScript and Display PostScript are trademarks of Adobe Systems, Inc. All other product names mentioned herein are the trademarks of their respective owners. All SPARC trademarks, including the SCD Compliant Logo, are trademarks or registered trademarks of SPARC International, Inc. SPARCstation, SPARCserver, SPARCengine, SPARCstorage, SPARCware, SPARCcenter, SPARCclassic, SPARCcluster, SPARCdesign, SPARC811, SPARCprinter, UltraSPARC, microSPARC, SPARCworks, and SPARCompiler are licensed exclusively to Sun Microsystems, Inc. Products bearing SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc. The OPEN LOOK and Sun™ Graphical User Interfaces were developed by Sun Microsystems, Inc. for its users and licensees. Sun acknowledges the pioneering efforts of Xerox in researching and developing the concept of visual or graphical user interfaces for the computer industry. Sun holds a non-exclusive license from Xerox to the Xerox Graphical User Interface, which license also covers Sun’s licensees who implement OPEN LOOK GUIs and otherwise comply with Sun’s written license agreements. X Window System is a product of the Massachusetts Institute of Technology. THIS PUBLICATION IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THIS PUBLICATION COULD INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS. CHANGES ARE PERIODICALLY ADDED TO THE INFORMATION HEREIN; THESE CHANGES WILL BE INCORPORATED IN NEW EDITIONS OF THE PUBLICATION. SUN MICROSYSTEMS, INC. MAY MAKE IMPROVEMENTS AND/OR CHANGES IN THE PRODUCT(S) AND/OR THE PROGRAM(S) DESCRIBED IN THIS PUBLICATION AT ANY TIME. Please Recycle Contents Preface. xiii 1. Introduction . 1 Devguide and GXV . 1 Names and Terminology. 2 What You Need to Run GXV and Devguide . 2 Installing GXV and Devguide . 2 How You Interact with Devguide and GXV. 2 2. Getting Started with GXV. 5 Creating an Application with GXV . 5 Designing an Interface in Devguide . 6 Handling Events with Connections. 7 Using the Code Generator Tool . 8 Using the File... Button . 10 Using the Properties Window . 10 GXV Options . 12 iii Internationalization Options . 13 Applying Changes. 14 Generating XView Code from Devguide GIL Files . 14 GXV-Generated Files. 14 Compiling and Testing Interface Code . 15 Integrating Application Code with GXV Interface Code . 16 Referencing Interface Objects in GXV. 16 Regenerating Code for a Modified Interface . 17 A Simple Example . 17 3. GXV Tutorial . 23 Building the Interface . 24 Creating a Directory for GIL and Project Files. 25 Creating the Base Window Interface . 26 Creating a Menu . 33 Creating the Pop-up Window Interface . 34 Creating and Saving a Project . 37 Setting Up Connections . 38 Experimenting with Test Mode . 41 Generating Interface Source Code . 42 Creating Custom Code Using GXV Files . 43 Customizing the tutorial.c File. 43 Customizing the tutorial.h File. 44 Customizing the tutorial_popup_stubs.c File. 45 Customizing the tutorial_main_stubs.c File . 45 iv Devguide: XView Programmer’s Guide—August 1994 Compiling Code. 48 4. GXV Functionality in Detail. 49 Using Connections to Handle Events . 49 When Menu Items . 49 Action Menu Items . 50 Hints on Using Connections. 51 Using the gxv Command . 52 Using Flags with GXV. 52 Generated Files. 54 _ui.c File . 55 _ui.h File . 56 _stubs.c File . 56 .info File . 56 Makefile File . 57 .c File . 58 .h File . 58 _stubs.c.BAK File . 59 _stubs.c.delta File . 59 .po File . 59 .db File . 59 Compiling Your Application . 59 Using GXV++ . 61 Using Included Libraries . 61 File Chooser (gfm) . 62 Contents v Color Chooser (gcc) . 65 Colormap Handler (gcm) . 67 Drag and Drop Interface (gdd) . 68 Group Package. 77 Additional Programmer’s Tips . 88 Using Stubs Merge. 88 Enabling and Disabling Menu Items. 89 Tying a Pop-Up Window to a Button . 90 A. Files Provided with GXV. 91 bin Subdirectory . 91 demo Subdirectory. 91 include Subdirectory . 92 lib Subdirectory . 92 lib/templates Subdirectory . 93 man Subdirectory . 93 src Subdirectory . 93 doc Subdirectory . 93 B. Internationalization . 95 Levels of Internationalization. 96 Level 1—Text and Codesets . 96 Level 2—Formats and Collation . 96 Level 3—Messages and Text Presentation . 96 Level 4—Asian Language Support . 97 Basic Internationalization Tools. 97 vi Devguide: XView Programmer’s Guide—August 1994 Text Databases (Text Domains) . 97 gettext() and dgettext() Routines . 98 Portable Object and Message Object Files . 98 xgettext and msgfmt Utilities . 99 Internationalization Using Devguide . 99 Text Translation . 100 Size and Position of Elements . 100 Options to GXV . ..