Window Identifiers

team bbl


Window identifiers are integers, and are used to uniquely determine window identity in the event system. In fact, identifiers do not need to be unique across your entire application, just unique within a particular context, such as a frame and its children. You may use the wxID_OK identifier, for example, on any number of dialogs as long as you don't have several within the same dialog.

If you pass wxID_ANY to a window constructor, an identifier will be generated for you automatically by wxWidgets. This is useful when you don't care about the exact identifier, either because you're not going to process the events from the control being created at all, or because you process the events from all controls in one place. In this case, you should specify wxID_ANY in the event table or wxEvtHandler::Connect call as well. The generated identifiers are always negative, so they will never conflict with the user-specified identifiers, which must always be positive.

wxWidgets supplies the standard identifiers listed in Table 3-1. Use the standard identifiers wherever possible: some systems can use the information to provide standard graphics (such as the OK and Cancel buttons on GTK+) or default behavior (such as responding to the Escape key by emulating a wxID_CANCEL event). On Mac OS X, wxID_ABOUT, wxID_PREFERENCES and wxID_EXIT menu items are interpreted specially and transferred to the application menu. Some wxWidgets components, such as wxTextCtrl, know how to handle menu items or buttons with identifiers such as wxID_COPY, wxID_PASTE, wxID_UNDO.

Table 3-1. Standard Window Identifiers

Identifier Name

Description

wxID_ANY

This may be passed to a window constructor as an identifier, and wxWidgets will generate an appropriate identifier

wxID_LOWEST

The lowest standard identifier value (4999)

wxID_HIGHEST

The highest standard identifier value (5999)

wxID_OPEN

File open

wxID_CLOSE

Window close

wxID_NEW

New window, file or document

wxID_SAVE

File save

wxID_SAVEAS

File save as (prompts for a save dialog)

wxID_REVERT

Revert (revert to file on disk)

wxID_EXIT

Exit application

wxID_UNDO

Undo the last operation

wxID_REDO

Redo the last undo

wxID_HELP

General help (for example, for dialog Help buttons)

wxID_PRINT

Print

wxID_PRINT_SETUP

Print setup dialog

wxID_PREVIEW

Print preview

wxID_ABOUT

Show a dialog describing the application

wxID_HELP_CONTENTS

Show the help contents

wxID_HELP_COMMANDS

Show the application commands

wxID_HELP_PROCEDURES

Show the application procedures

wxID_HELP_CONTEXT

Unused

wxID_CUT

Cut

wxID_COPY

Copy

wxID_PASTE

Paste

wxID_CLEAR

Clear

wxID_FIND

Find

wxID_DUPLICATE

Duplicate

wxID_SELECTALL

Select all

wxID_DELETE

Delete (cut without copying)

wxID_REPLACE

Replace

wxID_REPLACE_ALL

Replace all

wxID_PROPERTIES

Show properties for the selection

wxID_VIEW_DETAILS

View details in a list control

wxID_VIEW_LARGEICONS

View as large icons in a list control

wxID_VIEW_SMALLICONS

View as small icons in a list control

wxID_VIEW_LIST

View as a list in a list control

wxID_VIEW_SORTDATE

Sort by date

wxID_VIEW_SORTNAME

Sort by name

wxID_VIEW_SORTSIZE

Sort by size

wxID_VIEW_SORTTYPE

Sort by type

wxID_FILE1 to wxID_FILE9

View recent file

wxID_OK

Confirms dialog selections

wxID_CANCEL

Vetoes dialog selections

wxID_APPLY

Applies selections to data

wxID_YES

Identifier for a Yes button

wxID_NO

Identifier for a No button

wxID_STATIC

Identifier for static text or bitmap control

wxID_FORWARD

Navigate forward

wxID_BACKWARD

Navigate backward

wxID_DEFAULT

Restore default settings

wxID_MORE

View more settings

wxID_SETUP

View a setup dialog

wxID_RESET

Reset settings

wxID_CONTEXT_HELP

Show context-sensitive help

wxID_YESTOALL

Reply yes to all prompts

wxID_NOTOALL

Reply no to all prompts

wxID_ABORT

Abort the current operation

wxID_RETRY

Retry the operation

wxID_IGNORE

Ignore an error condition

wxID_UP

Navigate up

wxID_DOWN

Navigate down

wxID_HOME

Navigate home

wxID_REFRESH

Refresh

wxID_STOP

Stop the current operation

wxID_INDEX

Show an index

wxID_BOLD

Highlight in bold

wxID_ITALIC

Highlight in italic

wxID_JUSTIFY_CENTER

Center

wxID_JUSTIFY_FILL

Format

wxID_JUSTIFY_RIGHT

Right align

wxID_JUSTIFY_LEFT

Left align

wxID_UNDERLINE

Underline

wxID_INDENT

Indent

wxID_UNINDENT

Unindent

wxID_ZOOM_100

Zoom to 100%

wxID_ZOOM_FIT

Fit to page

wxID_ZOOM_IN

Zoom in

wxID_ZOOM_OUT

Zoom out

wxID_UNDELETE

Undelete

wxID_REVERT_TO_SAVED

Revert to saved state


You can use wxID_HIGHEST to determine the number above which it is safe to define your own identifiers, or you can use identifiers below wxID_LOWEST.

    team bbl



    Cross-Platform GUI Programming with wxWidgets
    Cross-Platform GUI Programming with wxWidgets
    ISBN: 0131473816
    EAN: 2147483647
    Year: 2005
    Pages: 262

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net