Cross-Platform GUI Programming with wxWidgets

Julian Smart, Kevin Hock, Stefan Csomor

Publisher: Prentice Hall, 2006, 700 pages

ISBN: 0-13-147381-6

Keywords: Programming

Last modified: May 7, 2021, 1:37 p.m.

The Definitive Guide to wxWidgets Cross-Platform Development — from wxWidgets' Creator

wxWidgets is an easy-to-use, open source C++ API for writing GUI applications that runs on Windows, Linux, Mac OS X, and even Pocket-PC — supporting each platform's native look and feel with virtually no additional coding. Now, its creator and two leading developers teach you all you need to know to write robust cross-platform software with wxWidgets. This book covers everything from dialog boxes to drag-and-drop, from networking to multithreading. It includes all the tools and code you need to get great results, fast. From AMD to AOL, Lockheed Martin to Xerox, world-class developers are using wxWidgets to save money, increase efficiency, and reach new markets. With this book, you can, too.

  1. Introduction
    • What Is wxWidgets?
    • Why Use wxWidgets?
    • A Brief History of wxWidgets
    • The wxWidgets Community
    • wxWidgets and Object-Oriented Programming
    • License Considerations
    • The wxWidgets Architecture
      • wxMSW
      • wxGTK
      • wxX11
      • wxMotif
      • wxMac
      • wxCocoa
      • wxWinCE
      • wxPalmOS
      • wxOS2
      • wxMGL
      • Internal Organization
    • Summary
  2. Getting Started
    • A Small wxWidgets Sample
    • The Application Class
    • The Frame Class
    • The Event Handlers
    • The Frame Constructor
    • The Whole Program
    • Compiling and Running the Program
    • Program Flow
    • Summary
  3. Event Handling
    • Event-Driven Programming
    • Event Tables and Handlers
    • Skipping Events
    • Pluggable Event Handlers
    • Dynamic Event Handlers
    • Window Identifiers
    • Defining Custom Events
    • Summary
  4. Window Basics
    • Anatomy of a Window
      • The Concept of a Window
      • Client and Non-Client Areas
      • Scrollbars
      • Caret and Cursor
      • Top-Level Windows
      • Coordinate System
      • Painting
      • Color and Font
      • Window Variant
      • Sizing
      • Input
      • Idle Time Processing and UI Updates
      • Window Creation and Deletion
      • Window Styles
    • A Quick Guide to the Window Classes
      • Base Window Classes
      • Top-Level Windows
      • Container Windows
      • Non-Static Controls
      • Static Controls
      • Menus
      • Control Bars
    • Base Window Classes
      • wxWindow
        • wxWindow Styles
        • wxWindow Events
        • wxWindow Member Functions
      • wxControl
        • wxControlWithItems
        • wxControlWithItems Member Functions
    • Top-Level Windows
      • wxFrame
        • wxFrame Styles
        • wxFrame Events
        • wxFrame Member Functions
        • Non-Rectangular Frames
        • Mini-Frames
      • wxMDIParentFrame
        • wxMDIParentFrame Styles
        • wxMDIParentFrame Member Functions
      • wxMDIChildFrame
        • wxMDIChildFrame Styles
        • wxMDIChildFrame Member Functions
      • wxDialog
        • wxDialog Styles
        • wxDialog Events
        • wxDialog Member Functions
      • wxPopupWindow
    • Container Windows
      • wxPanel
        • wxPanel Styles
        • wxPanel Member Functions
      • wxNotebook
        • Notebook Theme Management
        • wxNotebook Styles
        • wxNotebook Events
        • wxNotebook Member Functions
        • Alternatives to wxNotebook
      • wxScrolledWindow
        • wxScrolledWindow Styles
        • wxScrolledWindow Events
        • wxScrolledWindow Member Functions
        • Scrolling Without Using wxScrolledWindow
      • wxSplitterWindow
        • wxSplitterWindow Styles
        • wxSplitterWindow Events
        • wxSplitterWindow Member Functions
        • Sizing Issues with wxSplitterWindow
        • Alternatives to wxSplitterWindow
    • Non-Static Controls
      • wxButton
        • wxButton Styles
        • wxButton Events
        • wxButton Member Functions
      • wxButton Labels
      • wxBitmapButton
        • wxBitmapButton Styles
        • wxBitmapButton Events
        • wxBitmapButton Member Functions
      • wxChoice
        • wxChoice Styles
        • wxChoice Events
        • wxChoice Member Functions
      • wxComboBox
        • wxComboBox Styles
        • wxComboBox Events
        • wxComboBox Member Functions
      • wxCheckBox
        • wxCheckBox Styles
        • wxCheckBox Events
        • wxCheckBox Member Functions
      • wxListBox and wxCheckListBox
        • wxListBox and wxCheckListBox Styles
        • wxListBox and wxCheckListBox Events
        • wxListBox Member Functions
        • wxCheckListBox Member Functions
      • wxRadioBox
        • wxRadioBox Styles
        • wxRadioBox Events
        • wxRadioBox Member Functions
      • wxRadioButton
        • wxRadioButton Styles
        • wxRadioButton Events
        • wxRadioButton Member Functions
      • wxScrollBar
        • wxScrollBar Styles
        • wxScrollBar Events
        • wxScrollBar Member Functions
      • wxSpinButton
        • wxSpinButton Styles
        • wxSpinButton Events
        • wxSpinButton Member Functions
      • wxSpinCtrl
        • wxSpinCtrl Styles
        • wxSpinCtrl Events
        • wxSpinCtrl Member Functions
      • wxSlider
        • wxSlider Styles
        • wxSlider Events
        • wxSlider Member Functions
      • wxTextCtrl
        • wxTextCtrl Styles
        • wxTextCtrl Events
        • wxTextCtrl Member Functions
      • wxToggleButton
        • wxToggleButton Styles
        • wxToggleButton Events
        • wxToggleButton Member Functions
    • Static Controls
      • wxGauge
        • wxGauge Styles
        • wxGauge Events
        • wxGauge Member Functions
      • wxStaticText
        • wxStaticText Styles
        • wxStaticText Member Functions
      • wxStaticBitmap
        • wxStaticBitmap Styles
        • wxStaticBitmap Member Functions
      • wxStaticLine
        • wxStaticLine Styles
        • wxStaticLine Member Functions
      • wxStaticBox
        • wxStaticBox Styles
        • wxStaticBox Member Functions
    • Menus
      • wxMenu
        • wxMenu Events
        • wxMenu Member Functions
    • Control Bars
      • wxMenuBar
        • wxMenuBar Styles
        • wxMenuBar Events
        • wxMenuBar Member Functions
      • wxToolBar
        • Tool Bitmap Colors Under Windows
        • wxToolBar Styles
        • wxToolBar Events
        • wxToolBar Member Functions
      • wxStatusBar
        • wxStatusBar Styles
        • wxStatusBar Events
        • wxStatusBar Member Functions
    • Summary
  5. Drawing and Printing
    • Understanding Device Contexts
      • Available Device Contexts
      • Drawing on Windows with wxClientDC
      • Erasing Window Backgrounds
      • Drawing on Windows with wxPaintDC
      • Drawing on Bitmaps with wxMemoryDC
      • Creating Metafiles with wxMetafileDC
      • Accessing the Screen with wxScreenDC
      • Printing with wxPrinterDC and wxPostScriptDC
    • Drawing Tools
      • wxColour
      • wxPen
      • wxBrush
      • wxFont
      • wxPalette
    • Device Context Drawing Functions
      • Drawing Text
      • Drawing Lines and Shapes
      • Drawing Splines
      • Drawing Bitmaps
      • Filling Arbitrary Areas
      • Logical Functions
    • Using the Printing Framework
      • More on wxPrintout
      • Scaling for Printing and Previewing
      • Printing under Unix with GTK+
    • 3D Graphics with wxGLCanvas
    • Summary
  6. Handling Input
    • Mouse Input
      • Handling Button and Motion Events
      • Handling Mouse Wheel Events
    • Handling Keyboard Events
      • An Example Character Event Handler
      • Key Code Translation
      • Modifier Key Variations
      • Accelerators
    • Handling Joystick Events
      • wxJoystick Events
      • wxJoystickEvent Member Functions
      • wxJoystick Member Functions
    • Summary
  7. Window Layout Using Sizers
    • Layout Basics
    • Sizers
      • Common Features of Sizers
    • Programming with Sizers
      • Programming with wxBoxSizer
      • Programming with wxStaticBoxSizer
      • Programming with wxGridSizer
      • Programming with wxFlexGridSizer
      • Programming with wxGridBagSizer
    • Further Layout Issues
      • Dialog Units
      • Platform-Adaptive Layouts
      • Dynamic Layouts
    • Summary
  8. Using Standard Dialogs
    • Informative Dialogs
      • wxMessageDialog
        • wxMessageDialog Example
        • wxMessageBox
      • wxProgressDialog
      • wxProgressDialog Example
      • wxBusyInfo
        • wxBusyInfo Example
      • wxShowTip
        • wxShowTip Example
    • File and Directory Dialogs
      • wxFileDialog
        • wxFileDialog Styles
        • wxFileDialog Functions
        • wxFileDialog Example
      • wxDirDialog
        • wxDirDialog Functions
        • wxDirDialog Example
    • Choice and Selection Dialogs
      • wxColourDialog
        • wxColourData Functions
        • wxColourDialog Example
      • wxFontDialog
        • wxFontData Functions
        • Font Selector Example
      • wxSingleChoiceDialog
        • wxSingleChoiceDialog Example
      • wxMultiChoiceDialog
        • wxMultiChoiceDialog Example
    • Entry Dialogs
      • wxNumberEntryDialog
        • wxNumberEntryDialog Example
      • wxTextEntryDialog and wxPasswordEntryDialog
        • wxTextEntryDialog Example
      • wxFindReplaceDialog
        • Handling Events from the Dialog
        • wxFindDialogEvent Functions
        • Passing Data to the Dialog
        • wxFindReplaceData Functions
        • Find and Replace Example
    • Printing Dialogs
      • wxPageSetupDialog
        • wxPageSetupData Functions
        • wxPageSetupDialog Example
      • wxPrintDialog
        • wxPrintDialogData Functions
        • wxPrintDialog Example
    • Summary
  9. Writing Custom Dialogs
    • Steps in Creating a Custom Dialog
    • An Example: PersonalRecordDialog
      • Deriving a New Class
      • Designing Data Storage
      • Coding the Controls and Layout
      • Data Transfer and Validation
      • Handling Events
      • Handling UI Updates
      • Adding Help
        • Tooltips
        • Context-Sensitive Help
        • Online Help
      • The Complete Class
      • Invoking the Dialog
    • Adapting Dialogs for Small Devices
    • Further Considerations in Dialog Design
      • Keyboard Navigation
      • Data and UI Separation
      • Layout
      • Aesthetics
      • Alternatives to Dialogs
    • Using wxWidgets Resource Files
      • Loading Resources
      • Using Binary and Embedded Resource Files
      • Translating Resources
      • The XRC Format
      • Writing Resource Handlers
      • Foreign Controls
    • Summary
  10. Programming with Images
    • Image Classes in wxWidgets
    • Programming with wxBitmap
      • Creating a wxBitmap
      • Setting a wxMask
      • The XPM Format
      • Drawing with Bitmaps
      • Packaging Bitmap Resources
    • Programming with wxIcon
      • Creating a wxIcon
      • Using wxIcon
      • Associating an Icon with an Application
    • Programming with wxCursor
      • Creating a wxCursor
      • Using wxCursor
      • Using wxSetCursorEvent
    • Programming with wxImage
      • Loading and Saving Images
      • Transparency
      • Transformations
      • Color Reduction
      • Manipulating wxImage Data Directly
    • Image Lists and Icon Bundles
    • Customizing Art in wxWidgets
    • Summary
  11. Clipboard and Drag and Drop
    • Data Objects
      • Data Source Duties
      • Data Target Duties
    • Using the Clipboard
    • Implementing Drag and Drop
      • Implementing a Drag Source
        1. Preparation
        2. Drag Start
        3. Dragging
        4. Processing the Result
      • Implementing a Drop Target
        1. Initialization
        2. Dragging
        3. Drop
      • Using Standard Drop Targets
      • Creating a Custom Drop Target
      • More on wxDataObject
        • Deriving from wxDataObject
        • The wxWidgets Drag and Drop Sample
      • Drag and Drop Helpers in wxWidgets
        • wxTreeCtrl
        • wxListCtrl
        • wxDragImage
    • Summary
  12. Advanced Window Classes
    • wxTreeCtrl
      • wxTreeCtrl Styles
      • wxTreeCtrl Events
      • wxTreeCtrl Member Functions
    • wxListCtrl
      • wxListCtrl Styles
      • wxListCtrl Events
      • wxListItem
      • wxListCtrl Member Functions
      • Using wxListCtrl
      • Virtual List Controls
    • wxWizard
      • wxWizard Events
      • wxWizard Member Functions
      • wxWizard Example
    • wxHtmlWindow
      • wxHtmlWindow Styles
      • wxHtmlWindow Member Functions
      • Embedding Windows in HTML Pages
      • HTML Printing
    • wxGrid
      • The wxGrid System of Classes
      • wxGrid Events
      • wxGrid Member Functions
        • Functions for Creation, Deletion, and Data Retrieval
        • Presentation Functions
        • Functions for Setting and Getting wxGrid Metrics
        • Selection and Cursor Functions
        • Miscellaneous wxGrid Functions
    • wxTaskBarIcon
      • wxTaskBarIcon Events
      • wxTaskBarIcon Member Functions
    • Writing Your Own Controls
      • The Custom Control Declaration
      • Adding DoGetBestSize
      • Defining a New Event Class
      • Displaying Information on the Control
      • Handling Input
      • Defining Default Event Handlers
      • Implementing Validators
      • Implementing Resource Handlers
      • Determining Control Appearance
      • A More Complex Example: wxThumbnailCtrl
    • Summary
  13. Data Structure Classes
    • Why Not STL?
    • Strings
      • Using wxString
      • wxString, Characters, and String Literals
      • Basic wxString to C Pointer Conversions
      • Standard C String Functions
      • Converting to and from Numbers
      • wxStringTokenizer
      • wxRegEx
    • wxArray
      • Array Types
      • wxArrayString
      • Array Construction, Destruction, and Memory Management
      • Array Sample Code
    • wxList and wxNode
    • wxHashMap
    • Storing and Processing Dates and Times
      • wxDateTime
      • wxDateTime Constructors and Modifiers
      • wxDateTime Accessors
      • Getting the Current Time
      • Parsing and Formatting Dates
      • Date Comparisons
      • Date Arithmetic
    • Helper Data Structures
      • wxObject
      • wxLongLong
      • wxPoint and wxRealPoint
      • wxRect
      • wxRegion
      • wxSize
      • wxVariant
    • Summary
  14. Files and Streams
    • File Classes and Functions
      • wxFile and wxFFile
      • wxTextFile
      • wxTempFile
      • wxDir
      • wxFileName
      • File Functions
    • Stream Classes
      • File Streams
      • Memory and String Streams
      • Reading and Writing Data Types
      • Socket Streams
      • Filter Streams
      • Zip Streams
      • Virtual File Systems
    • Summary
  15. Memory Management, Debugging, and Error Checking
    • Memory Management Basics
      • Creating and Deleting Window Objects
      • Creating and Copying Drawing Objects
      • Initializing Your Application Object
      • Cleaning Up Your Application
    • Detecting Memory Leaks and Other Errors
    • Facilities for Defensive Programming
    • Error Reporting
      • wxMessageOutput Versus wxLog
    • Providing Run-Time Type Information
    • Using wxModule
    • Loading Dynamic Libraries
    • Exception Handling
    • Debugging Tips
      • Debugging X11 Errors
      • Simplify the Problem
      • Debugging a Release Build
    • Summary
  16. Writing International Applications
    • Introduction to Internationalization
    • Providing Translations
      • poEdit
      • Step-by-Step Guide to Using Message Catalogs
      • Using wxLocale
    • Character Encodings and Unicode
      • Converting Data
      • wxEncodingConverter
      • wxCSConv (wxMBConv)
      • Converting Outside of a Temporary Buffer
      • Help Files
    • Numbers and Dates
    • Other Media
    • A Simple Sample
    • Summary
  17. Writing Multithreaded Applications
    • When to Use Threads, and When Not To
    • Using wxThread
      • Creation
        • Specifying Stack Size
        • Specifying Priority
      • Starting the Thread
      • How to Pause a Thread or Wait for an External Condition
      • Termination
    • Synchronization Objects
      • wxMutex
      • Deadlocks
      • wxCriticalSection
      • wxCondition
        • wxCondition Example
      • wxSemaphore
    • The wxWidgets Thread Sample
    • Alternatives to Multithreading
      • Using wxTimer
      • Idle Time Processing
      • Yielding
    • Summary
  18. Programming with wxSocket
    • Socket Classes and Functionality Overview
    • Introduction to Sockets and Basic Socket Processing
      • The Client
      • The Server
      • Connecting to a Server
        • Socket Addresses
        • Socket Clients
      • Socket Events
        • Socket Event Types
        • wxSocketEvent Major Member Functions
        • Using Socket Events
      • Socket Status and Error Notifications
      • Sending and Receiving Socket Data
        • Reading
        • Writing
      • Creating a Server
        • wxSocketServer Major Member Functions
        • Handling a New Connection Event
      • Socket Event Recap
    • Socket Flags
      • Blocking and Non-Blocking Sockets in wxWidgets
        • The Impossible Socket Combination
      • How Flags Affect Socket Behavior
      • Using wxSocket as a Standard Socket
    • Using Socket Streams
      • File Sending Thread
      • File Receiving Thread
    • Alternatives to wxSocket
    • Summary
  19. Working with Documents and Views
    • Document/View Basics
      • Step 1: Choose an Interface Style
      • Step 2: Create and Use Frame Classes
      • Step 3: Define Your Document and View Classes
      • Step 4: Define Your Window Classes
      • Step 5: Use wxDocManager and wxDocTemplate
    • Other Document/View Capabilities
      • Standard Identifiers
      • Printing and Previewing
      • File History
      • Explicit Document Creation
    • Strategies for Implementing Undo/Redo
    • Summary
  20. Perfecting Your Application
    • Single Instance or Multiple Instances?
    • Modifying Event Handling
    • Reducing Flicker
    • Implementing Online Help
      • Using a Help Controller
      • Extended wxWidgets HTML Help
      • Authoring Help
      • Other Ways to Provide Help
      • Context-Sensitive Help and Tooltips
      • Menu Help
    • Parsing the Command Line
    • Storing Application Resources
      • Reducing the Number of Data Files
      • Finding the Application Path
    • Invoking Other Applications
      • Running an Application
      • Launching Documents
      • Redirecting Process Input and Output
    • Managing Application Settings
      • Storing Settings
      • Editing Settings
    • Application Installation
      • Installation on Windows
      • Installation on Linux
        • Shared Library Issues on Linux
      • Installation on Mac OS X
    • Following UI Design Guidelines
      • Standard Buttons
      • Menus
      • Icons
      • Fonts and Colors
      • Application Termination Behavior
      • Further Reading
    • Summary
  1. Installing wxWidgets
  2. Building Your Own wxWidgets Applications
  3. Creating Applications with DialogBlocks
  4. Other Features in wxWidgets
  5. Third-Party Tools for wxWidgets
  6. wxWidgets Application Showcase
  7. Using the CD-ROM
  8. How wxWidgets Processes Events
  9. Event Classes and Macros
  10. Code Listings
  11. Porting from MFC

Reviews

Cross-Platform GUI Programming with wxWidgets

Reviewed by Roland Buresund

Very Good ******** (8 out of 10)

Last modified: May 7, 2021, 1:40 p.m.

A very good book on wxWidgets, with great examples and explanations.

The intended audience are hardcore programmers. and it fulfills its promise, even though it gets dated fast, as wxWidgets continues to be developed at a fast pace.

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required

captcha

required