Cross-Platform GUI Programming with wxWidgets (Paperback)

Julian Smart, Kevin Hock with, Stefan Csomor

  • 出版商: Prentice Hall
  • 出版日期: 2005-07-01
  • 售價: $2,190
  • 貴賓價: 9.5$2,081
  • 語言: 英文
  • 頁數: 744
  • 裝訂: Paperback
  • ISBN: 0131473816
  • ISBN-13: 9780131473812
  • 相關分類: 使用者介面 UI
  • 海外代購書籍(需單獨結帳)

買這商品的人也買了...

相關主題

商品描述

Description

Unlike other cross-platform GUI toolkits (Tcl/Tk, Qt, AWT) wxWidgets

supports the native look-and-feel of the local OS. And unlike Qt, wxWidgets is

truly Open Source. It also works with virtually every standard C++ compiler.

It is a perfect solution for organizations interested in porting Windows

applications to Linux and other platforms. And with Mac OS X and Linux

gaining marketshare daily, many organizations -- including Xerox, Advanced

Micro Devices, AOL, Lockheed Martin, NASA--have adopted wxWidgets in

order to support Windows, Linux, OS X, and Unix for their applications. See

http://www.wxwidgets.org/

And wxWidgets is HOT. Mitch Kapor's OSAF is using wxWidgets for its

Chandler PIM. Bram Cohen uses wxWidgets for BitTorrent. Borland has

added enormous credibility to wxWidgets by incorporating it into its newest

C++ IDE: C++ BuilderX. wxWidgets is Borland's cross-platform

development solution.

 

Table of Contents

Foreword by Mitch Kapor.

Preface.

Acknowledgments.

About the Authors.

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

      wxControl

    Top-Level Windows

      wxFrame

      wxMDIParentFrame

      wxMDIChildFrame

      wxDialog

      wxPopupWindow

    Container Windows

      wxPanel

      wxNotebook

      wxScrolledWindow

      wxSplitterWindow

    Non-Static Controls

      wxButton

      wxButton Labels

      wxBitmapButton

      wxChoice

      wxComboBox

      wxCheckBox

      wxListBox and wxCheckListBox

      wxRadioBox

      wxRadioButton

      wxScrollBar

      wxSpinButton

      wxSpinCtrl

      wxSlider

      wxTextCtrl

      wxToggleButton

    Static Controls

      wxGauge

      wxStaticText

      wxStaticBitmap

      wxStaticLine

      wxStaticBox

    Menus

      wxMenu

    Control Bars

      wxMenuBar

      wxToolBar

      wxStatusBar

    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

      wxProgressDialog

      wxProgressDialog Example

      wxBusyInfo

      wxShowTip

    File and Directory Dialogs

      wxFileDialog

      wxDirDialog

    Choice and Selection Dialogs

      wxColourDialog

      wxFontDialog

      wxSingleChoiceDialog

      wxMultiChoiceDialog

    Entry Dialogs

      wxNumberEntryDialog

      wxTextEntryDialog and wxPasswordEntryDialog

      wxFindReplaceDialog

    Printing Dialogs

      wxPageSetupDialog

      wxPrintDialog

    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

      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

      Implementing a Drop Target

      Using Standard Drop Targets

      Creating a Custom Drop Target

      More on wxDataObject

      Drag and Drop Helpers in wxWidgets

    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

    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

      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 Events

      Socket Status and Error Notifications

      Sending and Receiving Socket Data

      Creating a Server

      Socket Event Recap

    Socket Flags

      Blocking and Non-Blocking Sockets in wxWidgets

      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

      Installation on Mac OS X

    Following UI Design Guidelines

      Standard Buttons

      Menus

      Icons

      Fonts and Colors

      Application Termination Behavior

      Further Reading

    Summary

Appendix A. Installing wxWidgets.

Appendix B. Building Your Own wxWidgets Applications.

Appendix C. Creating Applications with DialogBlocks.

Appendix D. Other Features in wxWidgets.

Appendix E. Third-Party Tools for wxWidgets.

Appendix F. wxWidgets Application Showcase.

Appendix G. Using the CD-ROM.

Appendix H. How wxWidgets Processes Events.

Appendix I. Event Classes and Macros.

Appendix J. Code Listings.

Appendix K. Porting from MFC.

Glossary.

Index

商品描述(中文翻譯)

描述

與其他跨平台GUI工具包(如Tcl/Tk、Qt、AWT)不同,wxWidgets支持本地操作系統的外觀和感覺。而且,與Qt不同,wxWidgets是真正的開源。它還與幾乎所有標準C++編譯器兼容。對於有興趣將Windows應用程序移植到Linux和其他平台的組織來說,它是一個完美的解決方案。隨著Mac OS X和Linux每天都在增加市場份額,許多組織(包括Xerox、Advanced Micro Devices、AOL、Lockheed Martin、NASA等)已經採用了wxWidgets來支持Windows、Linux、OS X和Unix的應用程序。請參閱http://www.wxwidgets.org/。而且,wxWidgets非常熱門。Mitch Kapor的OSAF正在使用wxWidgets開發其Chandler PIM。Bram Cohen使用wxWidgets開發BitTorrent。Borland將wxWidgets納入其最新的C++ IDE:C++ BuilderX,這為wxWidgets增添了巨大的可信度。wxWidgets是Borland的跨平台開發解決方案。

目錄

前言:Mitch Kapor
前言
致謝
關於作者
1. 簡介
- 什麼是wxWidgets?
- 為什麼使用wxWidgets?
- wxWidgets的簡要歷史
- wxWidgets社區
- wxWidgets和面向對象編程
- 許可證考慮因素
- wxWidgets架構
- wxMSW
- wxGTK
- wxX11
- wxMotif
- wxMac