wxWidgets 2.6.2: A portable C++ and Python GUI toolkit (DocBook docs generated from XML)Table of ContentsChapter 1. Copyright noticewxWindows Library License, Version 3.1GNU Library General Public License, Version 2Chapter 2. IntroductionWhat is wxWidgets?Why another cross-platform development tool?wxWidgets requirementsAvailability and location of wxWidgetsAcknowledgementsChapter 3. Multi-platform development with wxWidgetsInclude filesLibrariesConfigurationMakefilesWindows-specific filesAllocating and deleting wxWidgets objectsArchitecture dependencyConditional compilationC++ issuesFile handlingChapter 4. Utilities and libraries supplied with wxWidgetsChapter 5. Programming strategiesStrategies for reducing programming errorsStrategies for portabilityStrategies for debuggingChapter 6. Libraries listChapter 7. FunctionsAlphabetical functions and macros listVersion macrosApplication initialization and terminationProcess control functionsThread functionsFile functionsNetwork, user and OS functionsString functionsDialog functionsMath functionsGDI functionsPrinter settingsClipboard functionsMiscellaneous functionsByte order macrosRTTI functionsLog functionsTime functionsDebugging macros and functionsEnvironment access functionsChapter 8. ConstantsPreprocesser symbols defined by wxWidgetsStandard event identifiersKeycodesLanguage identifiersStock itemsChapter 9. Classes by categoryChapter 10. Alphabetical Class ReferencewxAcceleratorEntrywxAcceleratorTablewxAccessiblewxActivateEventwxAppwxArchiveClassFactorywxArchiveEntrywxArchiveInputStreamwxArchiveIteratorwxArchiveNotifierwxArchiveOutputStreamwxArraywxArrayStringwxArtProviderwxAutomationObjectwxBitmapwxBitmapButtonwxBitmapDataObjectwxBitmapHandlerwxBoxSizerwxBrushwxBrushListwxBufferedDCwxBufferedInputStreamwxBufferedOutputStreamwxBufferedPaintDCwxBusyCursorwxBusyInfowxButtonwxCSConvwxCalculateLayoutEventwxCalendarCtrlwxCalendarDateAttrwxCalendarEventwxCaretwxCheckBoxwxCheckListBoxwxChoicewxChoicebookwxClassInfowxClientwxClientDCwxClientDatawxClientDataContainerwxClipboardwxCloseEventwxCmdLineParserwxColourwxColourDatawxColourDatabasewxColourDialogwxComboBoxwxCommandwxCommandEventwxCommandProcessorwxConditionwxConfigBasewxConnectionwxContextHelpwxContextHelpButtonwxContextMenuEventwxControlwxControlWithItemswxCountingOutputStreamwxCriticalSectionwxCriticalSectionLockerwxCursorwxCustomDataObjectwxDCwxDCClipperwxDDEClientwxDDEConnectionwxDDEServerwxDataFormatwxDataInputStreamwxDataObjectwxDataObjectCompositewxDataObjectSimplewxDataOutputStreamwxDateEventwxDatePickerCtrlwxDateSpanwxDateTimewxDateTimeHolidayAuthoritywxDateTimeWorkDayswxDbwxDbColDataPtrwxDbColDefwxDbColForwxDbColInfwxDbConnectInfwxDbGridColInfowxDbGridTableBasewxDbIdxDefwxDbInfwxDbTablewxDbTableInfwxDebugContextwxDebugReportwxDebugReportCompresswxDebugReportPreviewwxDebugReportPreviewStdwxDebugReportUploadwxDebugStreamBufwxDelegateRendererNativewxDialUpEventwxDialUpManagerwxDialogwxDirwxDirDialogwxDirTraverserwxDisplaywxDllLoaderwxDocChildFramewxDocMDIChildFramewxDocMDIParentFramewxDocManagerwxDocParentFramewxDocTemplatewxDocumentwxDragImagewxDropFilesEventwxDropSourcewxDropTargetwxDynamicLibrarywxDynamicLibraryDetailswxEncodingConverterwxEraseEventwxEventwxEvtHandlerwxFFilewxFFileInputStreamwxFFileOutputStreamwxFFileStreamwxFSFilewxFTPwxFilewxFileConfigwxFileDataObjectwxFileDialogwxFileDropTargetwxFileHistorywxFileInputStreamwxFileNamewxFileOutputStreamwxFileStreamwxFileSystemwxFileSystemHandlerwxFileTypewxFilterInputStreamwxFilterOutputStreamwxFindDialogEventwxFindReplaceDatawxFindReplaceDialogwxFlexGridSizerwxFocusEventwxFontwxFontDatawxFontDialogwxFontEnumeratorwxFontListwxFontMapperwxFramewxGBPositionwxGBSizerItemwxGBSpanwxGDIObjectwxGLCanvaswxGLContextwxGaugewxGenericDirCtrlwxGenericValidatorwxGridwxGridBagSizerwxGridCellAttrwxGridCellBoolEditorwxGridCellBoolRendererwxGridCellChoiceEditorwxGridCellEditorwxGridCellFloatEditorwxGridCellFloatRendererwxGridCellNumberEditorwxGridCellNumberRendererwxGridCellRendererwxGridCellStringRendererwxGridCellTextEditorwxGridEditorCreatedEventwxGridEventwxGridRangeSelectEventwxGridSizeEventwxGridSizerwxGridTableBasewxHTTPwxHashMapwxHashSetwxHashTablewxHelpControllerwxHelpControllerHelpProviderwxHelpEventwxHelpProviderwxHtmlCellwxHtmlColourCellwxHtmlContainerCellwxHtmlDCRendererwxHtmlEasyPrintingwxHtmlFilterwxHtmlHelpControllerwxHtmlHelpDatawxHtmlHelpFramewxHtmlLinkInfowxHtmlListBoxwxHtmlParserwxHtmlPrintoutwxHtmlTagwxHtmlTagHandlerwxHtmlTagsModulewxHtmlWidgetCellwxHtmlWinParserwxHtmlWinTagHandlerwxHtmlWindowwxIPV4addresswxIPaddresswxIconwxIconBundlewxIconLocationwxIconizeEventwxIdleEventwxImagewxImageHandlerwxImageListwxIndividualLayoutConstraintwxInitDialogEventwxInputStreamwxJoystickwxJoystickEventwxKeyEventwxLayoutAlgorithmwxLayoutConstraintswxListwxListBoxwxListCtrlwxListEventwxListItemwxListItemAttrwxListViewwxListbookwxLocalewxLogwxLogChainwxLogGuiwxLogNullwxLogPassThroughwxLogStderrwxLogStreamwxLogTextCtrlwxLogWindowwxLongLongwxMBConvwxMBConvFilewxMBConvUTF16wxMBConvUTF32wxMBConvUTF7wxMBConvUTF8wxMDIChildFramewxMDIClientWindowwxMDIParentFramewxMaskwxMaximizeEventwxMediaCtrlwxMediaEventwxMemoryBufferwxMemoryDCwxMemoryFSHandlerwxMemoryInputStreamwxMemoryOutputStreamwxMenuwxMenuBarwxMenuEventwxMenuItemwxMessageDialogwxMetafilewxMetafileDCwxMimeTypesManagerwxMiniFramewxMirrorDCwxModulewxMouseCaptureChangedEventwxMouseEventwxMoveEventwxMultiChoiceDialogwxMutexwxMutexLockerwxNodewxNotebookwxNotebookEventwxNotebookSizerwxNotifyEventwxObjectwxObjectRefDatawxOutputStreamwxPageSetupDialogwxPageSetupDialogDatawxPaintDCwxPaintEventwxPalettewxPanelwxPasswordEntryDialogwxPathListwxPenwxPenListwxPointwxPostScriptDCwxPreviewCanvaswxPreviewControlBarwxPreviewFramewxPrintDatawxPrintDialogwxPrintDialogDatawxPrintPreviewwxPrinterwxPrinterDCwxPrintoutwxProcesswxProcessEventwxProgressDialogwxPropertySheetDialogwxProtocolwxQuantizewxQueryLayoutInfoEventwxRadioBoxwxRadioButtonwxRealPointwxRectwxRecursionGuardwxRecursionGuardFlagwxRegExwxRegKeywxRegionwxRegionIteratorwxRendererNativewxRendererVersionwxSashEventwxSashLayoutWindowwxSashWindowwxScopedArraywxScopedPtrwxScopedTiedPtrwxScreenDCwxScrollBarwxScrollEventwxScrollWinEventwxScrolledWindowwxSemaphorewxServerwxSetCursorEventwxSimpleHelpProviderwxSingleChoiceDialogwxSingleInstanceCheckerwxSizewxSizeEventwxSizerwxSizerFlagswxSizerItemwxSliderwxSockAddresswxSocketBasewxSocketClientwxSocketEventwxSocketInputStreamwxSocketOutputStreamwxSocketServerwxSoundwxSpinButtonwxSpinCtrlwxSpinEventwxSplashScreenwxSplitterEventwxSplitterRenderParamswxSplitterWindowwxStackFramewxStackWalkerwxStandardPathswxStaticBitmapwxStaticBoxwxStaticBoxSizerwxStaticLinewxStaticTextwxStatusBarwxStdDialogButtonSizerwxStopWatchwxStreamBasewxStreamBufferwxStreamToTextRedirectorwxStringwxStringBufferwxStringBufferLengthwxStringClientDatawxStringInputStreamwxStringOutputStreamwxStringTokenizerwxSysColourChangedEventwxSystemOptionswxSystemSettingswxTCPClientwxTCPConnectionwxTCPServerwxTaskBarIconwxTempFilewxTempFileOutputStreamwxTextAttrwxTextCtrlwxTextDataObjectwxTextDropTargetwxTextEntryDialogwxTextFilewxTextInputStreamwxTextOutputStreamwxTextValidatorwxThreadwxThreadHelperwxTimeSpanwxTimerwxTimerEventwxTipProviderwxTipWindowwxToggleButtonwxToolBarwxToolTipwxTopLevelWindowwxTreeCtrlwxTreeEventwxTreeItemDatawxURIwxURLwxUpdateUIEventwxVListBoxwxVScrolledWindowwxValidatorwxVariantwxVariantDatawxViewwxWindowwxWindowCreateEventwxWindowDCwxWindowDestroyEventwxWindowDisablerwxWizardwxWizardEventwxWizardPagewxWizardPageSimplewxXmlResourcewxXmlResourceHandlerwxZipClassFactorywxZipEntrywxZipInputStreamwxZipNotifierwxZipOutputStreamwxZlibInputStreamwxZlibOutputStreamChapter 11. Topic overviewsChanges since 2.4.xNotes on using the referenceWriting a wxWidgets application: a rough guidewxWidgets Hello World samplewxWidgets sampleswxApp overviewRuntime class information (aka RTTI) overviewwxString overviewBuffer classes overviewChapter 12. Platform detailswxGTK portwxMSW portwxMac portwxPalmOS portwxOS2 portwxMGL portwxX11 portwxWidgets 2.6.2: A portable C++ and Python GUI toolkit (DocBook docs generated from XML)Julian SmartRobert RoeblingVadim ZeitlinRobin Dunnet alwxWidgets 2.6.2: A portable C++ and Python GUI toolkit (DocBook docs generated from XML)Julian SmartRobert RoeblingVadim ZeitlinRobin Dunnet alwxWidgets 2.6.2: A portable C++ and Python GUI toolkit (DocBook docs generated from XML)wxWidgets 2.6.2: A portable C++ and Python GUI toolkit (DocBook docs generated from XML)Table of Contents1. Copyright notice wxWindows Library License, Version 3.1 GNU Library General Public License, Version 2 2. Introduction What is wxWidgets? Why another cross-platform development tool? wxWidgets requirements Availability and location of wxWidgets Acknowledgements 3. Multi-platform development with wxWidgets Include files Libraries Configuration Makefiles Windows-specific files Allocating and deleting wxWidgets objects Architecture dependency Conditional compilation C++ issues File handling 4. Utilities and libraries supplied with wxWidgets 5. Programming strategies Strategies for reducing programming errors Strategies for portability Strategies for debugging 6. Libraries list 7. Functions Alphabetical functions and macros list Version macros Application initialization and termination Process control functions Thread functions File functions Network, user and OS functions String functions Dialog functions Math functions GDI functions Printer settings Clipboard functions Miscellaneous functions Byte order macros RTTI functions Log functions Time functions Debugging macros and functions Environment access functions 8. Constants Preprocesser symbols defined by wxWidgets Standard event identifiers Keycodes Language identifiers Stock items 9. Classes by category 10. Alphabetical Class Reference wxAcceleratorEntry wxAcceleratorTable wxAccessible wxActivateEvent wxApp wxArchiveClassFactory wxArchiveEntry wxArchiveInputStream wxArchiveIterator wxArchiveNotifier wxArchiveOutputStream wxArray wxArrayString wxArtProvider wxAutomationObject wxBitmap wxBitmapButton wxBitmapDataObject wxBitmapHandler wxBoxSizer wxBrush wxBrushList wxBufferedDC wxBufferedInputStream wxBufferedOutputStream wxBufferedPaintDC wxBusyCursor wxBusyInfo wxButton wxCSConv wxCalculateLayoutEvent wxCalendarCtrl wxCalendarDateAttr wxCalendarEvent wxCaret wxCheckBox wxCheckListBox wxChoice wxChoicebook wxClassInfo wxClient wxClientDC wxClientData wxClientDataContainer wxClipboard wxCloseEvent wxCmdLineParser wxColour wxColourData wxColourDatabase wxColourDialog wxComboBox wxCommand wxCommandEvent wxCommandProcessor wxCondition wxConfigBase wxConnection wxContextHelp wxContextHelpButton wxContextMenuEvent wxControl wxControlWithItems wxCountingOutputStream wxCriticalSection wxCriticalSectionLocker wxCursor wxCustomDataObject wxDC wxDCClipper wxDDEClient wxDDEConnection wxDDEServer wxDataFormat wxDataInputStream wxDataObject wxDataObjectComposite wxDataObjectSimple wxDataOutputStream wxDateEvent wxDatePickerCtrl wxDateSpan wxDateTime wxDateTimeHolidayAuthority wxDateTimeWorkDays wxDb wxDbColDataPtr wxDbColDef wxDbColFor wxDbColInf wxDbConnectInf wxDbGridColInfo wxDbGridTableBase wxDbIdxDef wxDbInf wxDbTable wxDbTableInf wxDebugContext wxDebugReport wxDebugReportCompress wxDebugReportPreview wxDebugReportPreviewStd wxDebugReportUpload wxDebugStreamBuf wxDelegateRendererNative wxDialUpEvent wxDialUpManager wxDialog wxDir wxDirDialog wxDirTraverser wxDisplay wxDllLoader wxDocChildFrame wxDocMDIChildFrame wxDocMDIParentFrame wxDocManager wxDocParentFrame wxDocTemplate wxDocument wxDragImage wxDropFilesEvent wxDropSource wxDropTarget wxDynamicLibrary wxDynamicLibraryDetails wxEncodingConverter wxEraseEvent wxEvent wxEvtHandler wxFFile wxFFileInputStream wxFFileOutputStream wxFFileStream wxFSFile wxFTP wxFile wxFileConfig wxFileDataObject wxFileDialog wxFileDropTarget wxFileHistory wxFileInputStream wxFileName wxFileOutputStream wxFileStream wxFileSystem wxFileSystemHandler wxFileType wxFilterInputStream wxFilterOutputStream wxFindDialogEvent wxFindReplaceData wxFindReplaceDialog wxFlexGridSizer wxFocusEvent wxFont wxFontData wxFontDialog wxFontEnumerator wxFontList wxFontMapper wxFrame wxGBPosition wxGBSizerItem wxGBSpan wxGDIObject wxGLCanvas wxGLContext wxGauge wxGenericDirCtrl wxGenericValidator wxGrid wxGridBagSizer wxGridCellAttr wxGridCellBoolEditor wxGridCellBoolRenderer wxGridCellChoiceEditor wxGridCellEditor wxGridCellFloatEditor wxGridCellFloatRenderer wxGridCellNumberEditor wxGridCellNumberRenderer wxGridCellRenderer wxGridCellStringRenderer wxGridCellTextEditor wxGridEditorCreatedEvent wxGridEvent wxGridRangeSelectEvent wxGridSizeEvent wxGridSizer wxGridTableBase wxHTTP wxHashMap wxHashSet wxHashTable wxHelpController wxHelpControllerHelpProvider wxHelpEvent wxHelpProvider wxHtmlCell wxHtmlColourCell wxHtmlContainerCell wxHtmlDCRenderer wxHtmlEasyPrinting wxHtmlFilter wxHtmlHelpController wxHtmlHelpData wxHtmlHelpFrame wxHtmlLinkInfo wxHtmlListBox wxHtmlParser wxHtmlPrintout wxHtmlTag wxHtmlTagHandler wxHtmlTagsModule wxHtmlWidgetCell wxHtmlWinParser wxHtmlWinTagHandler wxHtmlWindow wxIPV4address wxIPaddress wxIcon wxIconBundle wxIconLocation wxIconizeEvent wxIdleEvent wxImage wxImageHandler wxImageList wxIndividualLayoutConstraint wxInitDialogEvent wxInputStream wxJoystick wxJoystickEvent wxKeyEvent wxLayoutAlgorithm wxLayoutConstraints wxList wxListBox wxListCtrl wxListEvent wxListItem wxListItemAttr wxListView wxListbook wxLocale wxLog wxLogChain wxLogGui wxLogNull wxLogPassThrough wxLogStderr wxLogStream wxLogTextCtrl wxLogWindow wxLongLong wxMBConv wxMBConvFile wxMBConvUTF16 wxMBConvUTF32 wxMBConvUTF7 wxMBConvUTF8 wxMDIChildFrame wxMDIClientWindow wxMDIParentFrame wxMask wxMaximizeEvent wxMediaCtrl wxMediaEvent wxMemoryBuffer wxMemoryDC wxMemoryFSHandler wxMemoryInputStream wxMemoryOutputStream wxMenu wxMenuBar wxMenuEvent wxMenuItem wxMessageDialog wxMetafile wxMetafileDC wxMimeTypesManager wxMiniFrame wxMirrorDC wxModule wxMouseCaptureChangedEvent wxMouseEvent wxMoveEvent wxMultiChoiceDialog wxMutex wxMutexLocker wxNode wxNotebook wxNotebookEvent wxNotebookSizer wxNotifyEvent wxObject wxObjectRefData wxOutputStream wxPageSetupDialog wxPageSetupDialogData wxPaintDC wxPaintEvent wxPalette wxPanel wxPasswordEntryDialog wxPathList wxPen wxPenList wxPoint wxPostScriptDC wxPreviewCanvas wxPreviewControlBar wxPreviewFrame wxPrintData wxPrintDialog wxPrintDialogData wxPrintPreview wxPrinter wxPrinterDC wxPrintout wxProcess wxProcessEvent wxProgressDialog wxPropertySheetDialog wxProtocol wxQuantize wxQueryLayoutInfoEvent wxRadioBox wxRadioButton wxRealPoint wxRect wxRecursionGuard wxRecursionGuardFlag wxRegEx wxRegKey wxRegion wxRegionIterator wxRendererNative wxRendererVersion wxSashEvent wxSashLayoutWindow wxSashWindow wxScopedArray wxScopedPtr wxScopedTiedPtr wxScreenDC wxScrollBar wxScrollEvent wxScrollWinEvent wxScrolledWindow wxSemaphore wxServer wxSetCursorEvent wxSimpleHelpProvider wxSingleChoiceDialog wxSingleInstanceChecker wxSize wxSizeEvent wxSizer wxSizerFlags wxSizerItem wxSlider wxSockAddress wxSocketBase wxSocketClient wxSocketEvent wxSocketInputStream wxSocketOutputStream wxSocketServer wxSound wxSpinButton wxSpinCtrl wxSpinEvent wxSplashScreen wxSplitterEvent wxSplitterRenderParams wxSplitterWindow wxStackFrame wxStackWalker wxStandardPaths wxStaticBitmap wxStaticBox wxStaticBoxSizer wxStaticLine wxStaticText wxStatusBar wxStdDialogButtonSizer wxStopWatch wxStreamBase wxStreamBuffer wxStreamToTextRedirector wxString wxStringBuffer wxStringBufferLength wxStringClientData wxStringInputStream wxStringOutputStream wxStringTokenizer wxSysColourChangedEvent wxSystemOptions wxSystemSettings wxTCPClient wxTCPConnection wxTCPServer wxTaskBarIcon wxTempFile wxTempFileOutputStream wxTextAttr wxTextCtrl wxTextDataObject wxTextDropTarget wxTextEntryDialog wxTextFile wxTextInputStream wxTextOutputStream wxTextValidator wxThread wxThreadHelper wxTimeSpan wxTimer wxTimerEvent wxTipProvider wxTipWindow wxToggleButton wxToolBar wxToolTip wxTopLevelWindow wxTreeCtrl wxTreeEvent wxTreeItemData wxURI wxURL wxUpdateUIEvent wxVListBox wxVScrolledWindow wxValidator wxVariant wxVariantData wxView wxWindow wxWindowCreateEvent wxWindowDC wxWindowDestroyEvent wxWindowDisabler wxWizard wxWizardEvent wxWizardPage wxWizardPageSimple wxXmlResource wxXmlResourceHandler wxZipClassFactory wxZipEntry wxZipInputStream wxZipNotifier wxZipOutputStream wxZlibInputStream wxZlibOutputStream 11. Topic overviews Changes since 2.4.x Notes on using the reference Writing a wxWidgets application: a rough guide wxWidgets Hello World sample wxWidgets samples wxApp overview Runtime class information (aka RTTI) overview wxString overview Buffer classes overview 12. Platform details wxGTK port wxMSW port wxMac port wxPalmOS port wxOS2 port wxMGL port wxX11 port Copyright noticeCopyright noticeChapter 1. Copyright noticeCopyright (c) 1992-2002 Julian Smart, Robert Roebling,
Vadim Zeitlin and other members of the wxWidgets team
Portions (c) 1996 Artificial Intelligence Applications
InstitutePlease also see the wxWindows license files (preamble.txt,
lgpl.txt, gpl.txt, licence.txt, licendoc.txt) for conditions of
software and documentation use. Note that we use the old name
wxWindows in the license, pending recognition of the new name by
OSI.the section called “wxWindows Library License, Version 3.1”the section called “GNU Library General Public License, Version 2”wxWindows Library License, Version 3.1wxWindows Library License, Version 3.1Copyright (c) 1998-2005 Julian Smart, Robert Roebling et alEveryone is permitted to copy and distribute verbatim copies of
this licence document, but changing it is not allowed.WXWINDOWS LIBRARY LICENCE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
MODIFICATIONThis library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public Licence
as published by the Free Software Foundation; either version 2 of
the Licence, or (at your option) any later version.This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public Licence for more details.You should have received a copy of the GNU Library General
Public Licence along with this software, usually in a file named
COPYING.LIB. If not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.EXCEPTION NOTICE1. As a special exception, the copyright holders of this library
give permission for additional uses of the text contained in this
release of the library as licenced under the wxWindows Library
Licence, applying either version 3.1 of the Licence, or (at your
option) any later version of the Licence as published by the
copyright holders of version 3.1 of the Licence document.2. The exception is that you may use, copy, link, modify and
distribute under your own terms, binary object code versions of
works based on the Library.3. If you copy code from files distributed under the terms of
the GNU General Public Licence or the GNU Library General Public
Licence into a copy of this library, as this licence permits, the
exception does not apply to the code that you add in this way. To
avoid misleading anyone as to the status of such modified files,
you must delete this exception notice from such code and/or adjust
the licensing conditions notice accordingly.4. If you write modifications of your own for this library, it
is your choice whether to permit this exception to apply to your
modifications. If you do not wish that, you must delete the
exception notice from such code and/or adjust the licensing
conditions notice accordingly.GNU Library General Public License, Version 2GNU Library General Public License, Version 2Copyright (C) 1991 Free Software Foundation, Inc. 675 Mass Ave,
Cambridge, MA 02139, USAEveryone is permitted to copy and distribute verbatim copies of
this license document, but changing it is not allowed.[This is the first released version of the library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]PreambleThe licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software -- to make sure the software is free for all its
users.This license, the Library General Public License, applies to
some specially designated Free Software Foundation software, and to
any other libraries whose authors decide to use it. You can use it
for your libraries, too.When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and
charge for this service if you wish), that you receive source code
or can get it if you want it, that you can change the software or
use pieces of it in new free programs; and that you know you can do
these things.To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the
rights. These restrictions translate to certain responsibilities
for you if you distribute copies of the library, or if you modify
it.For example, if you distribute copies of the library, whether
gratis or for a fee, you must give the recipients all the rights
that we gave you. You must make sure that they, too, receive or can
get the source code. If you link a program with the library, you
must provide complete object files to the recipients so that they
can relink them with the library, after making changes to the
library and recompiling it. And you must show them these terms so
they know their rights.Our method of protecting your rights has two steps: (1)
copyright the library, and (2) offer you this license which gives
you legal permission to copy, distribute and/or modify the
library.Also, for each distributor's protection, we want to make certain
that everyone understands that there is no warranty for this free
library. If the library is modified by someone else and passed on,
we want its recipients to know that what they have is not the
original version, so that any problems introduced by others will
not reflect on the original authors' reputations.Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that companies distributing
free software will individually obtain patent licenses, thus in
effect transforming the program into proprietary software. To
prevent this, we have made it clear that any patent must be
licensed for everyone's free use or not licensed at all.Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License, which was designed for utility
programs. This license, the GNU Library General Public License,
applies to certain designated libraries. This license is quite
different from the ordinary one; be sure to read it in full, and
don't assume that anything in it is the same as in the ordinary
license.The reason we have a separate public license for some libraries
is that they blur the distinction we usually make between modifying
or adding to a program and simply using it. Linking a program with
a library, without changing the library, is in some sense simply
using the library, and is analogous to running a utility program or
application program. However, in a textual and legal sense, the
linked executable is a combined work, a derivative of the original
library, and the ordinary General Public License treats it as
such.Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries. We
concluded that weaker conditions might promote sharing better.However, unrestricted linking of non-free programs would deprive
the users of those programs of all benefit from the free status of
the libraries themselves. This Library General Public License is
intended to permit developers of non-free programs to use free
libraries, while preserving your freedom as a user of such programs
to change the free libraries that are incorporated in them. (We
have not seen how to achieve this as regards changes in header
files, but we have achieved it as regards changes in the actual
functions of the Library.) The hope is that this will lead to
faster development of free libraries.The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between
a "work based on the library" and a "work that uses the library".
The former contains code derived from the library, while the latter
only works together with the library.Note that it is possible for a library to be covered by the
ordinary General Public License rather than by this special
one.GNU LIBRARY GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
MODIFICATION0. This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other
authorized party saying it may be distributed under the terms of
this Library General Public License (also called "this License").
Each licensee is addressed as "you".A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form
executables.The "Library", below, refers to any such software library or
work which has been distributed under these terms. A "work based on
the Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or
translated straightforwardly into another language. (Hereinafter,
translation is included without limitation in the term
"modification".)"Source code" for a work means the preferred form of the work
for making modifications to it. For a library, complete source code
means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the library.Activities other than copying, distribution and modification are
not covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output
from such a program is covered only if its contents constitute a
work based on the Library (independent of the use of the Library in
a tool for writing it). Whether that is true depends on what the
Library does and what the program that uses the Library does.1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided
that you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep
intact all the notices that refer to this License and to the
absence of any warranty; and distribute a copy of this License
along with the Library.You may charge a fee for the physical act of transferring a
copy, and you may at your option offer warranty protection in
exchange for a fee.2. You may modify your copy or copies of the Library or any
portion of it, thus forming a work based on the Library, and copy
and distribute such modifications or work under the terms of
Section 1 above, provided that you also meet all of these
conditions:a) The modified work must itself be a
software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.d) If a facility in the modified Library refers to a function or
a table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility is
invoked, then you must make a good faith effort to ensure that, in
the event an application does not supply such function or table,
the facility still operates, and performs whatever part of its
purpose remains meaningful.(For example, a function in a library to compute square roots
has a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square root
function must still compute square roots.)These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the
Library, and can be reasonably considered independent and separate
works in themselves, then this License, and its terms, do not apply
to those sections when you distribute them as separate works. But
when you distribute the same sections as part of a whole which is a
work based on the Library, the distribution of the whole must be on
the terms of this License, whose permissions for other licensees
extend to the entire whole, and thus to each and every part
regardless of who wrote it.Thus, it is not the intent of this section to claim rights or
contest your rights to work written entirely by you; rather, the
intent is to exercise the right to control the distribution of
derivative or collective works based on the Library.In addition, mere aggregation of another work not based on the
Library with the Library (or with a work based on the Library) on a
volume of a storage or distribution medium does not bring the other
work under the scope of this License.3. You may opt to apply the terms of the ordinary GNU General
Public License instead of this License to a given copy of the
Library. To do this, you must alter all the notices that refer to
this License, so that they refer to the ordinary GNU General Public
License, version 2, instead of to this License. (If a newer version
than version 2 of the ordinary GNU General Public License has
appeared, then you can specify that version instead if you wish.)
Do not make any other change in these notices.Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to
all subsequent copies and derivative works made from that copy.This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable
form under the terms of Sections 1 and 2 above provided that you
accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software
interchange.If distribution of object code is made by offering access to
copy from a designated place, then offering equivalent access to
copy the source code from the same place satisfies the requirement
to distribute the source code, even though third parties are not
compelled to copy the source along with the object code.5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled
or linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because
it contains portions of the Library), rather than a "work that uses
the library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.When a "work that uses the Library" uses material from a header
file that is part of the Library, the object code for the work may
be a derivative work of the Library even though the source code is
not. Whether this is true is especially significant if the work can
be linked without the Library, or if the work is itself a library.
The threshold for this to be true is not precisely defined by
law.If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a
derivative work. (Executables containing this object code plus
portions of the Library will still fall under Section 6.)Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section
6. Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library
itself.6. As an exception to the Sections above, you may also compile
or link a "work that uses the Library" with the Library to produce
a work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.You must give prominent notice with each copy of the work that
the Library is used in it and that the Library and its use are
covered by this License. You must supply a copy of this License. If
the work during execution displays copyright notices, you must
include the copyright notice for the Library among them, as well as
a reference directing the user to the copy of this License. Also,
you must do one of these things:a) Accompany the work with the
complete corresponding machine-readable source code for the Library
including whatever changes were used in the work (which must be
distributed under Sections 1 and 2 above); and, if the work is an
executable linked with the Library, with the complete
machine-readable "work that uses the Library", as object code
and/or source code, so that the user can modify the Library and
then relink to produce a modified executable containing the
modified Library. (It is understood that the user who changes the
contents of definitions files in the Library will not necessarily
be able to recompile the application to use the modified
definitions.)
b) Accompany the work with a written offer, valid for at least
three years, to give the same user the materials specified in
Subsection 6a, above, for a charge no more than the cost of
performing this distribution.c) If distribution of the work is made by offering access to
copy from a designated place, offer equivalent access to copy the
above specified materials from the same place.d) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special
exception, the source code distributed need not include anything
that is normally distributed (in either source or binary form) with
the major components (compiler, kernel, and so on) of the operating
system on which the executable runs, unless that component itself
accompanies the executable.It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you
cannot use both them and the Library together in an executable that
you distribute.7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other
library facilities not covered by this License, and distribute such
a combined library, provided that the separate distribution of the
work based on the Library and of the other library facilities is
otherwise permitted, and provided that you do these two things:a) Accompany the combined library
with a copy of the same work based on the Library, uncombined with
any other library facilities. This must be distributed under the
terms of the Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same
work.8. You may not copy, modify, sublicense, link with, or
distribute the Library except as expressly provided under this
License. Any attempt otherwise to copy, modify, sublicense, link
with, or distribute the Library is void, and will automatically
terminate your rights under this License. However, parties who have
received copies, or rights, from you under this License will not
have their licenses terminated so long as such parties remain in
full compliance.9. You are not required to accept this License, since you have
not signed it. However, nothing else grants you permission to
modify or distribute the Library or its derivative works. These
actions are prohibited by law if you do not accept this License.
Therefore, by modifying or distributing the Library (or any work
based on the Library), you indicate your acceptance of this License
to do so, and all its terms and conditions for copying,
distributing or modifying the Library or works based on it.10. Each time you redistribute the Library (or any work based on
the Library), the recipient automatically receives a license from
the original licensor to copy, distribute, link with or modify the
Library subject to these terms and conditions. You may not impose
any further restrictions on the recipients' exercise of the rights
granted herein. You are not responsible for enforcing compliance by
third parties to this License.11. If, as a consequence of a court judgment or allegation of
patent infringement or for any other reason (not limited to patent
issues), conditions are imposed on you (whether by court order,
agreement or otherwise) that contradict the conditions of this
License, they do not excuse you from the conditions of this
License. If you cannot distribute so as to satisfy simultaneously
your obligations under this License and any other pertinent
obligations, then as a consequence you may not distribute the
Library at all. For example, if a patent license would not permit
royalty-free redistribution of the Library by all those who receive
copies directly or indirectly through you, then the only way you
could satisfy both it and this License would be to refrain entirely
from distribution of the Library.If any portion of this section is held invalid or unenforceable
under any particular circumstance, the balance of the section is
intended to apply, and the section as a whole is intended to apply
in other circumstances.It is not the purpose of this section to induce you to infringe
any patents or other property right claims or to contest validity
of any such claims; this section has the sole purpose of protecting
the integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is
willing to distribute software through any other system and a
licensee cannot impose that choice.This section is intended to make thoroughly clear what is
believed to be a consequence of the rest of this License.12. If the distribution and/or use of the Library is restricted
in certain countries either by patents or by copyrighted
interfaces, the original copyright holder who places the Library
under this License may add an explicit geographical distribution
limitation excluding those countries, so that distribution is
permitted only in or among countries not thus excluded. In such
case, this License incorporates the limitation as if written in the
body of this License.13. The Free Software Foundation may publish revised and/or new
versions of the Library General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.Each version is given a distinguishing version number. If the
Library specifies a version number of this License which applies to
it and "any later version", you have the option of following the
terms and conditions either of that version or of any later version
published by the Free Software Foundation. If the Library does not
specify a license version number, you may choose any version ever
published by the Free Software Foundation.14. If you wish to incorporate parts of the Library into other
free programs whose distribution conditions are incompatible with
these, write to the author to ask for permission. For software
which is copyrighted by the Free Software Foundation, write to the
Free Software Foundation; we sometimes make exceptions for this.
Our decision will be guided by the two goals of preserving the free
status of all derivatives of our free software and of promoting the
sharing and reuse of software generally.NO WARRANTY15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE
LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS
AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR
OR CORRECTION.16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO
IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY
MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU
OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY
OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.END OF TERMS AND CONDITIONSAppendix: How to Apply These Terms to
Your New LibrariesIf you develop a new library, and you want it to be of the
greatest possible use to the public, we recommend making it free
software that everyone can redistribute and change. You can do so
by permitting redistribution under these terms (or, alternatively,
under the terms of the ordinary General Public License).To apply these terms, attach the following notices to the
library. It is safest to attach them to the start of each source
file to most effectively convey the exclusion of warranty; and each
file should have at least the "copyright" line and a pointer to
where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and
paper mail.You should also get your employer (if you work as a programmer)
or your school, if any, to sign a "copyright disclaimer" for the
library, if necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!IntroductionIntroductionChapter 2. Introductionthe section called “What is wxWidgets?”the section called “Why another cross-platform development tool?”the section called “wxWidgets requirements”the section called “Availability and location of wxWidgets”the section called “Acknowledgements”What is wxWidgets?What is wxWidgets?wxWidgets is a C++ framework providing GUI (Graphical User
Interface) and other facilities on more than one platform. Version
2 currently supports all desktop versions of MS Windows, Unix with
GTK+, Unix with Motif, and MacOS. An OS/2 port is in progress.wxWidgets was originally developed at the Artificial
Intelligence Applications Institute, University of Edinburgh, for
internal use, and was first made publicly available in 1992.
Version 2 is a vastly improved version written and maintained by
Julian Smart, Robert Roebling, Vadim Zeitlin, Vaclav Slavik and
many others.This manual contains a class reference and topic overviews. For
a selection of wxWidgets tutorials, please see the documentation
page on the wxWidgets web
site [http://www.wxwidgets.org].Please note that in the following, "MS Windows" often refers to
all platforms related to Microsoft Windows, including 16-bit and
32-bit variants, unless otherwise stated. All trademarks are
acknowledged.Why another cross-platform development tool?Why another cross-platform development tool?wxWidgets was developed to provide a cheap and flexible way to
maximize investment in GUI application development. While a number
of commercial class libraries already existed for cross-platform
development, none met all of the following criteria:1.low price;2.source availability;3.simplicity of programming;4.support for a wide range of compilers.Since wxWidgets was started, several other free or almost-free
GUI frameworks have emerged. However, none has the range of
features, flexibility, documentation and the well-established
development team that wxWidgets has.As open source software, wxWidgets has benefited from comments,
ideas, bug fixes, enhancements and the sheer enthusiasm of users.
This gives wxWidgets a certain advantage over its commercial
competitors (and over free libraries without an independent
development team), plus a robustness against the transience of one
individual or company. This openness and availability of source
code is especially important when the future of thousands of lines
of application code may depend upon the longevity of the underlying
class library.Version 2 goes much further than previous versions in terms of
generality and features, allowing applications to be produced that
are often indistinguishable from those produced using
single-platform toolkits such as Motif, GTK+ and MFC.The importance of using a platform-independent class library
cannot be overstated, since GUI application development is very
time-consuming, and sustained popularity of particular GUIs cannot
be guaranteed. Code can very quickly become obsolete if it
addresses the wrong platform or audience. wxWidgets helps to
insulate the programmer from these winds of change. Although
wxWidgets may not be suitable for every application (such as an
OLE-intensive program), it provides access to most of the
functionality a GUI program normally requires, plus many extras
such as network programming, PostScript output, and HTML rendering;
and it can of course be extended as needs dictate. As a bonus, it
provides a far cleaner and easier programming interface than the
native APIs. Programmers may find it worthwhile to use wxWidgets
even if they are developing on only one platform.It is impossible to sum up the functionality of wxWidgets in a
few paragraphs, but here are some of the benefits:•Low cost (free, in fact!)•You get the source.•Available on a variety of popular platforms.•Works with almost all popular C++ compilers and Python.•Over 50 example programs.•Over 1000 pages of printable and on-line documentation.•Includes Tex2RTF, to allow you to produce your own
documentation in Windows Help, HTML and Word RTF formats.•Simple-to-use, object-oriented API.•Flexible event system.•Graphics calls include lines, rounded rectangles, splines,
polylines, etc.•Constraint-based and sizer-based layouts.•Print/preview and document/view architectures.•Toolbar, notebook, tree control, advanced list control
classes.•PostScript generation under Unix, normal MS Windows printing on
the PC.•MDI (Multiple Document Interface) support.•Can be used to create DLLs under Windows, dynamic libraries on
Unix.•Common dialogs for file browsing, printing, colour selection,
etc.•Under MS Windows, support for creating metafiles and copying
them to the clipboard.•An API for invoking help from applications.•Ready-to-use HTML window (supporting a subset of HTML).•Network support via a family of socket and protocol
classes.•Support for platform independent image processing.•Built-in support for many file formats (BMP, PNG, JPEG, GIF,
XPM, PNM, PCX).wxWidgets requirementswxWidgets requirementsTo make use of wxWidgets, you currently need one of the
following setups.(a) MS-Windows:1.A 32-bit or 64-bit PC running MS Windows.2.A Windows compiler: MS Visual C++ (embedded Visual C++ for
wxWinCE port), Borland C++, Watcom C++, Cygwin, MinGW, Metrowerks
CodeWarrior, Digital Mars C++. See install.txt for details
about compiler version supported.3.At least 100 MB of disk space for source tree and additional
space for libraries and application building (depends on compiler
and build settings).(b) Unix:1.Almost any C++ compiler, including GNU C++ (EGCS 1.1.1 or
above).2.Almost any Unix workstation, and one of: GTK+ 1.2, GTK+ 2.0,
Motif 1.2 or higher, Lesstif. If using the wxX11 port, no such
widget set is required.3.At least 100 MB of disk space for source tree and additional
space for libraries and application building (depends on compiler
and build settings).(c) Mac OS/Mac OS X:1.A PowerPC Mac running Mac OS 8.6/9.x (eg. Classic) or Mac OS X
10.x.2.CodeWarrior 5.3, 6 or 7 for Classic Mac OS.3.The Apple Developer Tools (eg. GNU C++), CodeWarrior 7 or above
for Mac OS X.4.At least 100 MB of disk space for source tree and additional
space for libraries and application building (depends on compiler
and build settings).Availability and location of wxWidgetsAvailability and location of wxWidgetswxWidgets is available by anonymous FTP and World Wide Web from
???
and/or http://www.wxwidgets.org.You can also buy a CD-ROM using the form on the Web site.AcknowledgementsAcknowledgementsThanks are due to AIAI for being willing to release the original
version of wxWidgets into the public domain, and to our patient
partners.We would particularly like to thank the following for their
contributions to wxWidgets, and the many others who have been
involved in the project over the years. Apologies for any
unintentional omissions from this list. Yiorgos Adamopoulos,
Jamshid Afshar, Alejandro Aguilar-Sierra, AIAI, Patrick Albert,
Karsten Ballueder, Mattia Barbon, Michael Bedward, Kai Bendorf,
Yura Bidus, Keith Gary Boyce, Chris Breeze, Pete Britton, Ian
Brown, C. Buckley, Marco Cavallini, Dmitri Chubraev, Robin Corbet,
Cecil Coupe, Stefan Csomor, Andrew Davison, Gilles Depeyrot, Neil
Dudman, Robin Dunn, Hermann Dunkel, Jos van Eijndhoven, Chris
Elliott, David Elliott, Tom Felici, Thomas Fettig, Matthew Flatt,
Pasquale Foggia, Josep Fortiana, Todd Fries, Dominic Gallagher,
Guillermo Rodriguez Garcia, Wolfram Gloger, Norbert Grotz, Stefan
Gunter, Bill Hale, Patrick Halke, Stefan Hammes, Guillaume Helle,
Harco de Hilster, Kevin Hock, Cord Hockemeyer, Markus Holzem, Olaf
Klein, Leif Jensen, Bart Jourquin, Guilhem Lavaux, Ron Lee, Jan
Lessner, Nicholas Liebmann, Torsten Liermann, Per Lindqvist, Thomas
Runge, Tatu Männistö, Scott Maxwell, Thomas Myers, Oliver
Niedung, Stefan Neis, Ryan Norton, Hernan Otero, Ian Perrigo,
Timothy Peters, Giordano Pezzoli, Harri Pasanen, Thomaso Paoletti,
Garrett Potts, Marcel Rasche, Robert Roebling, Dino Scaringella,
Jobst Schmalenbach, Arthur Seaton, Paul Shirley, Wlodzimierz 'ABX'
Skiba, Vaclav Slavik, Julian Smart, Stein Somers, Petr Smilauer,
Neil Smith, Kari Systä, George Tasker, Arthur Tetzlaff-Deas,
Jonathan Tonberg, Jyrki Tuomi, Janos Vegh, Andrea Venturoli, David
Webster, Otto Wyss, Vadim Zeitlin, Xiaokun Zhu, Edward
Zimmermann.'Graphplace', the basis for the wxGraphLayout library, is
copyright Dr. Jos T.J. van Eijndhoven of Eindhoven University of
Technology. The code has been used in wxGraphLayout with his
permission.We also acknowledge the author of XFIG, the excellent Unix
drawing tool, from the source of which we have borrowed some spline
drawing code. His copyright is included below.XFig2.1 is copyright (c) 1985 by Supoj Sutanthavibul.
Permission to use, copy, modify, distribute, and sell this software
and its documentation for any purpose is hereby granted without
fee, provided that the above copyright notice appear in all copies
and that both that copyright notice and this permission notice
appear in supporting documentation, and that the name of M.I.T. not
be used in advertising or publicity pertaining to distribution of
the software without specific, written prior permission. M.I.T.
makes no representations about the suitability of this software for
any purpose. It is provided "as is'' without express or implied
warranty.Multi-platform development with wxWidgetsMulti-platform development with wxWidgetsChapter 3. Multi-platform development with wxWidgetsThis chapter describes the practical details of using wxWidgets.
Please see the file install.txt for up-to-date installation
instructions, and changes.txt for differences between versions.the section called “Include files”the section called “Libraries”the section called “Configuration”the section called “Makefiles”the section called “Windows-specific files”the section called “Allocating and deleting wxWidgets objects”the section called “Architecture dependency”the section called “Conditional compilation”the section called “C++ issues”the section called “File handling”Include filesInclude filesThe main include file is "wx/wx.h"; this includes the
most commonly used modules of wxWidgets.To save on compilation time, include only those header files
relevant to the source file. If you are using precompiled headers,
you should include the following section before any other
includes:
// For compilers that support precompilation, includes "wx.h".
#include <wx/wxprec.h>
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
// Include your minimal set of headers here, or wx.h
#include <wx/wx.h>
#endif
... now your other include files ...
The file "wx/wxprec.h" includes "wx/wx.h".
Although this incantation may seem quirky, it is in fact the end
result of a lot of experimentation, and several Windows compilers
to use precompilation which is largely automatic for compilers with
necessary support. Currently it is used for Visual C++ (including
embedded Visual C++), Borland C++, Open Watcom C++, Digital Mars
C++ and newer versions of GCC. Some compilers might need extra work
from the application developer to set the build environment up as
necessary for the support.LibrariesLibrariesMost ports of wxWidgets can create either a static library or a
shared library. wxWidgets can also be built in multilib and
monolithic variants. See the Chapter 6, Libraries list for more
information on these.ConfigurationConfigurationWhen using project files and makefiles directly to build
wxWidgets, options are configurable in the file
"wx/XXX/setup.h" where XXX is the required platform (such
as msw, motif, gtk, mac). Some settings are a matter of taste, some
help with platform-specific problems, and others can be set to
minimize the size of the library. Please see the setup.h file and
install.txt files for details on configuration.When using the 'configure' script to configure wxWidgets (on
Unix and other platforms where configure is available), the
corresponding setup.h files are generated automatically along with
suitable makefiles. When using the RPM packages for installing
wxWidgets on Linux, a correct setup.h is shipped in the package and
this must not be changed.MakefilesMakefilesOn Microsoft Windows, wxWidgets has a different set of makefiles
for each compiler, because each compiler's 'make' tool is slightly
different. Popular Windows compilers that we cater for, and the
corresponding makefile extensions, include: Microsoft Visual C++
(.vc), Borland C++ (.bcc), OpenWatcom C++ (.wat) and MinGW/Cygwin
(.gcc). Makefiles are provided for the wxWidgets library itself,
samples, demos, and utilities.On Linux, Mac and OS/2, you use the 'configure' command to
generate the necessary makefiles. You should also use this method
when building with MinGW/Cygwin on Windows.We also provide project files for some compilers, such as
Microsoft VC++. However, we recommend using makefiles to build the
wxWidgets library itself, because makefiles can be more powerful
and less manual intervention is required.On Windows using a compiler other than MinGW/Cygwin, you would
build the wxWidgets library from the build/msw directory which
contains the relevant makefiles.On Windows using MinGW/Cygwin, and on Unix, MacOS X and OS/2,
you invoke 'configure' (found in the top-level of the wxWidgets
source hierarchy), from within a suitable empty directory for
containing makefiles, object files and libraries.For details on using makefiles, configure, and project files,
please see docs/xxx/install.txt in your distribution, where xxx is
the platform of interest, such as msw, gtk, x11, mac.Windows-specific filesWindows-specific fileswxWidgets application compilation under MS Windows requires at
least one extra file: a resource file.???The least that must be defined in the Windows resource file
(extension RC) is the following statement:
#include "wx/msw/wx.rc"
which includes essential internal wxWidgets definitions. The
resource script may also contain references to icons, cursors,
etc., for example:
wxicon icon wx.ico
The icon can then be referenced by name when creating a frame
icon. See the MS Windows SDK documentation.Note: include wx.rc after any ICON statements so programs
that search your executable for icons (such as the Program Manager)
find your application icon first.Allocating and deleting wxWidgets objectsAllocating and deleting wxWidgets objectsIn general, classes derived from wxWindow must dynamically
allocated with new and deleted with delete. If you
delete a window, all of its children and descendants will be
automatically deleted, so you don't need to delete these
descendants explicitly.When deleting a frame or dialog, use Destroy rather than
delete so that the wxWidgets delayed deletion can take
effect. This waits until idle time (when all messages have been
processed) to actually delete the window, to avoid problems
associated with the GUI sending events to deleted windows.Don't create a window on the stack, because this will interfere
with delayed deletion.If you decide to allocate a C++ array of objects (such as
wxBitmap) that may be cleaned up by wxWidgets, make sure you delete
the array explicitly before wxWidgets has a chance to do so on
exit, since calling delete on array members will cause
memory problems.wxColour can be created statically: it is not automatically
cleaned up and is unlikely to be shared between other objects; it
is lightweight enough for copies to be made.Beware of deleting objects such as a wxPen or wxBitmap if they
are still in use. Windows is particularly sensitive to this: so
make sure you make calls like wxDC::SetPen(wxNullPen) or
wxDC::SelectObject(wxNullBitmap) before deleting a drawing object
that may be in use. Code that doesn't do this will probably work
fine on some platforms, and then fail under Windows.Architecture dependencyArchitecture dependencyA problem which sometimes arises from writing multi-platform
programs is that the basic C types are not defined the same on all
platforms. This holds true for both the length in bits of the
standard types (such as int and long) as well as their byte order,
which might be little endian (typically on Intel computers) or big
endian (typically on some Unix workstations). wxWidgets defines
types and macros that make it easy to write architecture
independent code. The types are:wxInt32, wxInt16, wxInt8, wxUint32, wxUint16 = wxWord, wxUint8 =
wxBytewhere wxInt32 stands for a 32-bit signed integer type etc. You
can also check which architecture the program is compiled on using
the wxBYTE_ORDER define which is either wxBIG_ENDIAN or
wxLITTLE_ENDIAN (in the future maybe wxPDP_ENDIAN as well).The macros handling bit-swapping with respect to the
applications endianness are described in the the section called “Byte order macros”
section.Conditional compilationConditional compilationOne of the purposes of wxWidgets is to reduce the need for
conditional compilation in source code, which can be messy and
confusing to follow. However, sometimes it is necessary to
incorporate platform-specific features (such as metafile use under
MS Windows). The symbols listed in the file symbols.txt
may be used for this purpose, along with any user-supplied
ones.C++ issuesC++ issuesThe following documents some miscellaneous C++ issues.????????????wxWidgets does not use templates (except for some advanced
features that are switched off by default) since it is a
notoriously unportable feature.RTTIRTTIwxWidgets does not use C++ run-time type information since
wxWidgets provides its own run-time type information system,
implemented using macros.Type of NULLType of NULLSome compilers (e.g. the native IRIX cc) define NULL to be 0L so
that no conversion to pointers is allowed. Because of that, all
these occurrences of NULL in the GTK+ port use an explicit
conversion such as wxWindow *my_window = (wxWindow*) NULL;
It is recommended to adhere to this in all code using wxWidgets
as this make the code (a bit) more portable.Precompiled headersPrecompiled headersSome compilers, such as Borland C++ and Microsoft C++, support
precompiled headers. This can save a great deal of compiling time.
The recommended approach is to precompile "wx.h", using
this precompiled header for compiling both wxWidgets itself and any
wxWidgets applications. For Windows compilers, two dummy source
files are provided (one for normal applications and one for
creating DLLs) to allow initial creation of the precompiled
header.However, there are several downsides to using precompiled
headers. One is that to take advantage of the facility, you often
need to include more header files than would normally be the case.
This means that changing a header file will cause more
recompilations (in the case of wxWidgets, everything needs to be
recompiled since everything includes "wx.h"!)A related problem is that for compilers that don't have
precompiled headers, including a lot of header files slows down
compilation considerably. For this reason, you will find (in the
common X and Windows parts of the library) conditional compilation
that under Unix, includes a minimal set of headers; and when using
Visual C++, includes wx.h. This should help provide the
optimal compilation for each compiler, although it is biased
towards the precompiled headers facility available in Microsoft
C++.File handlingFile handlingWhen building an application which may be used under different
environments, one difficulty is coping with documents which may be
moved to different directories on other machines. Saving a file
which has pointers to full pathnames is going to be inherently
unportable. One approach is to store filenames on their own, with
no directory information. The application searches through a number
of locally defined directories to find the file. To support this,
the class wxPathList makes adding directories and searching
for files easy, and the global function wxFileNameFromPath
allows the application to strip off the filename from the path if
the filename must be stored. This has undesirable ramifications for
people who have documents of the same name in different
directories.As regards the limitations of DOS 8+3 single-case filenames
versus unrestricted Unix filenames, the best solution is to use DOS
filenames for your application, and also for document filenames
if the user is likely to be switching platforms regularly.
Obviously this latter choice is up to the application user to
decide. Some programs (such as YACC and LEX) generate filenames
incompatible with DOS; the best solution here is to have your Unix
makefile rename the generated files to something more compatible
before transferring the source to DOS. Transferring DOS files to
Unix is no problem, of course, apart from EOL conversion for which
there should be a utility available (such as dos2unix).See also the File Functions section of the reference manual for
descriptions of miscellaneous file handling functions.Utilities and libraries supplied with wxWidgetsUtilities and libraries supplied with wxWidgetsChapter 4. Utilities and libraries supplied with wxWidgetsIn addition to the core wxWidgets library, a number of further
libraries and utilities are supplied with each distribution.Some are under the 'contrib' hierarchy which mirrors the
structure of the main wxWidgets hierarchy. See also the 'utils'
hierarchy. The first place to look for documentation about these
tools and libraries is under the wxWidgets 'docs' hierarchy, for
example docs/htmlhelp/fl.chm.For other user-contributed packages, please see the
Contributions page on the wxWidgets Web site [http://www.wxwidgets.org].HelpviewHelpview is a program for displaying wxWidgets HTML Help files.
In many cases, you may wish to use the wxWidgets HTML Help classes
from within your application, but this provides a handy stand-alone
viewer. See ??? for
more details. You can find it in
samples/html/helpview.Tex2RTFSupplied with wxWidgets is a utility called Tex2RTF for
converting LaTeX manuals HTML, MS HTML Help, wxHTML Help, RTF, and
Windows Help RTF formats. Tex2RTF is used for the wxWidgets manuals
and can be used independently by authors wishing to create on-line
and printed manuals from the same LaTeX source. Please see the
separate documentation for Tex2RTF. You can find it under
utils/tex2rtf.HelpgenHelpgen takes C++ header files and generates a
Tex2RTF-compatible documentation file for each class it finds,
using comments as appropriate. This is a good way to start a
reference for a set of classes. Helpgen can be found in
utils/HelpGen.EmulatorXnest-based display emulator for X11-based PDA applications. On
some systems, the Xnest window does not synchronise with the 'skin'
window. This program can be found in utils/emulator.Configuration ToolThe wxWidgets Configuration Tool is a work in progress intended
to make it easier to configure wxWidgets features in detail. It
exports setup.h configurations and will eventually generate
makefile config files. Invoking compilers is also on the cards.
Since configurations are handled one at a time, the tool is of
limited used until further development can be done. The program can
be found in utils/configtool.XRC resource systemThis is the sizer-aware resource system, and uses XML-based
resource specifications that can be generated by tools such as
wxDesigner [http://www.roebling.de]. You can find this
in src/xrc, include/wx/xrc, samples/xrc.
For more information, see the ???.Object Graphics LibraryOGL defines an API for applications that need to display
objects connected by lines. The objects can be moved around and
interacted with. You can find this in contrib/src/ogl,
contrib/include/wx/ogl, and
contrib/samples/ogl.Frame Layout libraryFL provides sophisticated pane dragging and docking facilities.
You can find this in contrib/src/fl,
contrib/include/wx/fl, and
contrib/samples/fl.Gizmos libraryGizmos is a collection of useful widgets and other classes.
Classes include wxLEDNumberCtrl, wxEditableListBox,
wxMultiCellCanvas. You can find this in
contrib/src/gizmos, contrib/include/wx/gizmos,
and contrib/samples/gizmos.Net libraryNet is a collection of very simple mail and web related
classes. Currently there is only wxEmail, which makes it easy to
send email messages via MAPI on Windows or sendmail on Unix. You
can find this in contrib/src/net and
contrib/include/wx/net.Animate libraryAnimate allows you to load animated GIFs and play them on a
window. The library can be extended to use other animation formats.
You can find this in contrib/src/animate,
contrib/include/wx/animate, and
contrib/samples/animate.MMedia libraryMmedia supports a variety of multimedia functionality. The
status of this library is currently unclear. You can find this in
contrib/src/mmedia, contrib/include/wx/mmedia,
and contrib/samples/mmedia.Styled Text Control librarySTC is a wrapper around Scintilla, a syntax-highlighting text
editor. You can find this in contrib/src/stc,
contrib/include/wx/stc, and
contrib/samples/stc.PlotPlot is a simple curve plotting library. You can find this in
contrib/src/plot, contrib/include/wx/plot, and
contrib/samples/plot.Programming strategiesProgramming strategiesChapter 5. Programming strategiesThis chapter is intended to list strategies that may be useful
when writing and debugging wxWidgets programs. If you have any good
tips, please submit them for inclusion here.the section called “Strategies for reducing programming errors”the section called “Strategies for portability”the section called “Strategies for debugging”Strategies for reducing programming errorsStrategies for reducing programming errors??????Although I haven't done this myself within wxWidgets, it is good
practice to use ASSERT statements liberally, that check for
conditions that should or should not hold, and print out
appropriate error messages. These can be compiled out of a
non-debugging version of wxWidgets and your application. Using
ASSERT is an example of 'defensive programming': it can alert you
to problems later on.Use wxString in preference to character arraysUse wxString in preference to character arraysUsing wxString can be much safer and more convenient than using
char *. Again, I haven't practiced what I'm preaching, but I'm now
trying to use wxString wherever possible. You can reduce the
possibility of memory leaks substantially, and it is much more
convenient to use the overloaded operators than functions such as
strcmp. wxString won't add a significant overhead to your program;
the overhead is compensated for by easier manipulation (which means
less code).The same goes for other data types: use classes wherever
possible.Strategies for portabilityStrategies for portability??????Don't use absolute panel item positioning if you can avoid it.
Different GUIs have very differently sized panel items. Consider
using the constraint system, although this can be complex to
program.Alternatively, you could use alternative .wrc (wxWidgets
resource files) on different platforms, with slightly different
dimensions in each. Or space your panel items out to avoid
problems.Use wxWidgets resource filesUse wxWidgets resource filesUse .xrc (wxWidgets resource files) where possible, because they
can be easily changed independently of source code.Strategies for debuggingStrategies for debugging???????????????It is common to blow up the problem in one's imagination, so
that it seems to threaten weeks, months or even years of work. The
problem you face may seem insurmountable: but almost never is. Once
you have been programming for some time, you will be able to
remember similar incidents that threw you into the depths of
despair. But remember, you always solved the problem, somehow!Perseverance is often the key, even though a seemingly trivial
problem can take an apparently inordinate amount of time to solve.
In the end, you will probably wonder why you worried so much.
That's not to say it isn't painful at the time. Try not to worry --
there are many more important things in life.Simplify the problemSimplify the problemReduce the code exhibiting the problem to the smallest program
possible that exhibits the problem. If it is not possible to reduce
a large and complex program to a very small program, then try to
ensure your code doesn't hide the problem (you may have attempted
to minimize the problem in some way: but now you want to expose
it).With luck, you can add a small amount of code that causes the
program to go from functioning to non-functioning state. This
should give a clue to the problem. In some cases though, such as
memory leaks or wrong deallocation, this can still give totally
spurious results!Use a debuggerUse a debuggerThis sounds like facetious advice, but it is surprising how
often people don't use a debugger. Often it is an overhead to
install or learn how to use a debugger, but it really is essential
for anything but the most trivial programs.Use logging functionsUse logging functionsThere is a variety of logging functions that you can use in your
program: see the section called “Log functions”.Using tracing statements may be more convenient than using the
debugger in some circumstances (such as when your debugger doesn't
support a lot of debugging code, or you wish to print a bunch of
variables).Use the wxWidgets debugging facilitiesUse the wxWidgets debugging facilitiesYou can use wxDebugContext to check for memory leaks and corrupt
memory: in fact in debugging mode, wxWidgets will automatically
check for memory leaks at the end of the program if wxWidgets is
suitably configured. Depending on the operating system and
compiler, more or less specific information about the problem will
be logged.You should also use the section called “Debugging macros and functions” as part of a
'defensive programming' strategy, scattering wxASSERTs liberally to
test for problems in your code as early as possible. Forward
thinking will save a surprising amount of time in the long run.See the ??? for further information.Libraries listLibraries listChapter 6. Libraries listStarting from version 2.5.0 wxWidgets can be built either as a
single large library (this is called the monolithic build)
or as several smaller libraries (multilib build). Multilib
build is the default.wxWidgets library is divided into libraries briefly described
below. This diagram show dependencies between them:wxBaseEvery wxWidgets application must link against this library. It
contains mandatory classes that any wxWidgets code depends on (e.g.
???) and portability
classes that abstract differences between platforms. wxBase can be
used to develop console mode applications, it does not require any
GUI libraries or running X Window System on Unix.wxNetClasses for network access:•wxSocket classes (???,
???
and related classes)•???
and ???•sockets-based IPC classes (???, ??? and ???)•???•wxInternetFSHandler (a ???) Requires wxBase.wxXMLThis library contains simple classes for parsing XML documents.
Note that their API will change in the future and backward
compatibility will not be preserved. Use of this library in your
applications is not recommended, it is only meant for use by XML
resources system. Future versions of wxWidgets will contain new XML
handling classes with DOM-like API. Requires wxBase.wxCoreBasic GUI classes such as GDI classes or controls are in this
library. All wxWidgets GUI applications must link against this
library, only console mode applications don't.wxAdvancedAdvanced or rarely used GUI classes:•wxBufferedDC•???•???•???•???•???•???•???•???•???•???Requires wxCore and wxBase.wxMediaMiscellaneous classes related to multimedia. Currently this
library only contains ??? but more classes
will be added in the future.Requires wxCore and wxBase.wxGLThis library contains ??? class for
integrating OpenGL library with wxWidgets. Unlike all others, this
library is not part of the monolithic library, it is
always built as separate library. Requires wxCore and wxBase.wxHTMLSimple HTML renderer and other ??? are contained in
this library, as well as ???,
???
and ???. Requires
wxCore and wxBase.wxODBC???. Requires wxBase.wxQAThis is the library containing extra classes for quality
assurance. Currently it only contains ??? and related
classes, but more will be added to it in the future.Requires wxCore, wxBase and wxXML.wxDbGrid???
class which combines ??? and
???. Requires
wxODBC and wxAdvanced.wxXRCThis library contains ??? class that
provides access to XML resource files in XRC format. Requires
wxXML, wxCore, wxAdvanced and wxHTML.FunctionsFunctionsChapter 7. FunctionsThe functions and macros defined in wxWidgets are described
here: you can either look up a function using the alphabetical
listing of them or find it in the corresponding topic.the section called “Alphabetical functions and macros list”the section called “Version macros”the section called “Application initialization and termination”the section called “Process control functions”the section called “Thread functions”the section called “File functions”the section called “Network, user and OS functions”the section called “String functions”the section called “Dialog functions”the section called “Math functions”the section called “GDI functions”the section called “Printer settings”the section called “Clipboard functions”the section called “Miscellaneous functions”the section called “Byte order macros”the section called “RTTI functions”the section called “Log functions”the section called “Time functions”the section called “Debugging macros and functions”the section called “Environment access functions”Alphabetical functions and macros listAlphabetical functions and macros list?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Version macrosVersion macrosThe following constants are defined in wxWidgets:•wxMAJOR_VERSION is the major version of wxWidgets•wxMINOR_VERSION is the minor version of wxWidgets•wxRELEASE_NUMBER is the release number•wxSUBRELEASE_NUMBER is the subrelease number which is
0 for all official releasesFor example, the values or these constants for wxWidgets 2.1.15
are 2, 1 and 15.Additionally, wxVERSION_STRING is a user-readable
string containing the full wxWidgets version and
wxVERSION_NUMBER is a combination of the three version
numbers above: for 2.1.15, it is 2115 and it is 2200 for wxWidgets
2.2.The subrelease number is only used for the sources in between
official releases and so normally is not useful.Include files<wx/version.h> or <wx/defs.h>????????????boolwxCHECK_GCC_VERSION(major, minor,
release)Returns 1 if the compiler being used to compile the code is GNU
C++ compiler (g++) version major.minor.release or greater.
Otherwise, and also if the compiler is not GNU C++ at all, returns
0.wxCHECK_VERSIONwxCHECK_VERSIONboolwxCHECK_VERSION(major, minor,
release)This is a macro which evaluates to true if the current wxWidgets
version is at least major.minor.release.For example, to test if the program is compiled with wxWidgets
2.2 or higher, the following can be done:
wxString s;
#if wxCHECK_VERSION(2, 2, 0)
if ( s.StartsWith("foo") )
#else // replacement code for old version
if ( strncmp(s, "foo", 3) == 0 )
#endif
{
...
}
wxCHECK_VERSION_FULLwxCHECK_VERSION_FULLboolwxCHECK_VERSION_FULL(major, minor,
release, subrel)Same as ??? but
also checks that wxSUBRELEASE_NUMBER is at least
subrel.wxCHECK_W32API_VERSIONwxCHECK_W32API_VERSIONboolwxCHECK_GCC_VERSION(major, minor,
release)Returns 1 if the version of w32api headers used is
major.minor.release or greater. Otherwise, and also if we are not
compiling with mingw32/cygwin under Win32 at all, returns 0.Application initialization and terminationApplication initialization and terminationThe functions in this section are used on application
startup/shutdown and also to control the behaviour of the main
event loop of the GUI programs.???????????????????????????This initializes wxWidgets in a platform-dependent way. Use this
if you are not using the default wxWidgets entry code (e.g. main or
WinMain). For example, you can initialize wxWidgets from an
Microsoft Foundation Classes application using this function.voidwxEntry(HANDLEhInstance,
HANDLEhPrevInstance, const wxString&commandLine, intcmdShow, boolenterLoop = true)wxWidgets initialization under Windows (non-DLL). If
enterLoop is false, the function will return immediately
after calling wxApp::OnInit. Otherwise, the wxWidgets message loop
will be entered.voidwxEntry(HANDLEhInstance,
HANDLEhPrevInstance, WORDwDataSegment, WORDwHeapSize, const
wxString&commandLine)wxWidgets initialization under Windows (for applications
constructed as a DLL).intwxEntry(intargc, const
wxString& *argv)wxWidgets initialization under Unix.RemarksTo clean up wxWidgets, call wxApp::OnExit followed by the static
function wxApp::CleanUp. For example, if exiting from an MFC
application that also uses wxWidgets:
int CTheApp::ExitInstance()
{
// OnExit isn't called by CleanUp so must be called explicitly.
wxTheApp->OnExit();
wxApp::CleanUp();
return CWinApp::ExitInstance();
}
Include files<wx/app.h>::wxGetApp::wxGetAppwxAppDerivedClass&wxGetApp()This function doesn't exist in wxWidgets but it is created by
using the ??? macro. Thus,
before using it anywhere but in the same module where this macro is
used, you must make it available using ???.The advantage of using this function compared to directly using
the global wxTheApp pointer is that the latter is of type wxApp
* and so wouldn't allow you to access the functions specific
to your application class but not present in wxApp while wxGetApp()
returns the object of the right type.::wxHandleFatalExceptions::wxHandleFatalExceptionsboolwxHandleFatalExceptions(booldoIt =
true)If doIt is true, the fatal exceptions (also known as
general protection faults under Windows or segmentation violations
in the Unix world) will be caught and passed to ???.
By default, i.e. before this function is called, they will be
handled in the normal way which usually just means that the
application will be terminated. Calling wxHandleFatalExceptions()
with doIt equal to false will restore this default
behaviour.::wxInitAllImageHandlers::wxInitAllImageHandlersvoidwxInitAllImageHandlers()Initializes all available image handlers. For a list of
available handlers, see ???.See also???, ???Include files<wx/image.h>::wxInitialize::wxInitializeboolwxInitialize()This function is used in wxBase only and only if you don't
create ??? object at all. In
this case you must call it from your main() function
before calling any other wxWidgets functions.If the function returns false the initialization could
not be performed, in this case the library cannot be used and
???
shouldn't be called neither.This function may be called several times but ??? must be
called for each successful call to this function.Include files<wx/app.h>::wxSafeYield::wxSafeYieldboolwxSafeYield(wxWindow*win =
NULL, boolonlyIfNeeded = false)This function is similar to wxYield, except that it disables the
user input to all program windows before calling wxYield and
re-enables it again afterwards. If win is not NULL, this
window will remain enabled, allowing the implementation of some
limited user interaction.Returns the result of the call to ???.Include files<wx/utils.h>::wxUninitialize::wxUninitializevoidwxUninitialize()This function is for use in console (wxBase) programs only. It
must be called once for each previous successful call to ???.Include files<wx/app.h>::wxYield::wxYieldboolwxYield()Calls ???.This function is kept only for backwards compatibility. Please
use the ??? method
instead in any new code.Include files<wx/app.h> or <wx/utils.h>::wxWakeUpIdle::wxWakeUpIdlevoidwxWakeUpIdle()This functions wakes up the (internal and platform dependent)
idle system, i.e. it will force the system to send an idle event
even if the system currently is idle and thus would not send
any idle event until after some other event would get sent. This is
also useful for sending events between two threads and is used by
the corresponding functions ??? and ???.Include files<wx/event.h>Process control functionsProcess control functionsThe functions in this section are used to launch or terminate
the other processes.??????????????????longwxExecute(const wxString&command, intsync = wxEXEC_ASYNC, wxProcess
*callback = NULL)wxPerl note: In wxPerl this
function is called Wx::ExecuteCommandlongwxExecute(char **argv,
intflags = wxEXEC_ASYNC, wxProcess
*callback = NULL)wxPerl note: In wxPerl this
function is called Wx::ExecuteArgslongwxExecute(const wxString&command, wxArrayString&output, intflags = 0)wxPerl note: In wxPerl this
function is called Wx::ExecuteStdout and it only takes the
command argument, and returns a 2-element list (
status, output ), where output is an array
reference.longwxExecute(const wxString&command, wxArrayString&output,
wxArrayString&errors, intflags =
0)wxPerl note: In wxPerl this
function is called Wx::ExecuteStdoutStderr and it only
takes the command argument, and returns a 3-element list
( status, output, errors ), where output and
errors are array references.Executes another program in Unix or Windows.The first form takes a command string, such as "emacs
file.txt".The second form takes an array of values: a command, any number
of arguments, terminated by NULL.The semantics of the third and fourth versions is different from
the first two and is described in more details below.If flags parameter contains wxEXEC_ASYNC flag
(the default), flow of control immediately returns. If it contains
wxEXEC_SYNC, the current application waits until the other
program has terminated.In the case of synchronous execution, the return value is the
exit code of the process (which terminates by the moment the
function returns) and will be -1 if the process couldn't be started
and typically 0 if the process terminated successfully. Also, while
waiting for the process to terminate, wxExecute will call ???. Because of this, by
default this function disables all application windows to avoid
unexpected reentrancies which could result from the users
interaction with the program while the child process is running. If
you are sure that it is safe to not disable the program windows,
you may pass wxEXEC_NODISABLE flag to prevent this
automatic disabling from happening.For asynchronous execution, however, the return value is the
process id and zero value indicates that the command could not be
executed. As an added complication, the return value of -1 in this
case indicates that we didn't launch a new process, but connected
to the running one (this can only happen in case of using DDE under
Windows for command execution). In particular, in this, and only
this, case the calling code will not get the notification about
process termination.If callback isn't NULL and if execution is asynchronous,
???
will be called when the process finishes. Specifying this parameter
also allows you to redirect the standard input and/or output of the
process being launched by calling ???. If the child
process IO is redirected, under Windows the process window is not
shown by default (this avoids having to flush an unnecessary
console for the processes which don't create any windows anyhow)
but a wxEXEC_NOHIDE flag can be used to prevent this from
happening, i.e. with this flag the child process window will be
shown normally.Under Unix the flag wxEXEC_MAKE_GROUP_LEADER may be
used to ensure that the new process is a group leader (this will
create a new session if needed). Calling ??? passing
wxKILL_CHILDREN will will kill this process as well as all of its
children (except those which have started their own session).Finally, you may use the third overloaded version of this
function to execute a process (always synchronously, the contents
of flags is or'd with wxEXEC_SYNC) and capture its
output in the array output. The fourth version adds the
possibility to additionally capture the messages from standard
error output in the errors array.NB: Currently wxExecute() can only be used from the main
thread, calling this function from another thread will result in an
assert failure in debug build and won't work.See also???, ???, ???.ParameterscommandThe command to execute and any
parameters to pass to it as a single string.argvThe command to execute should be the
first element of this array, any additional ones are the command
parameters and the array must be terminated with a NULL
pointer.flagsCombination of bit masks
wxEXEC_ASYNC, wxEXEC_SYNC and
wxEXEC_NOHIDEcallbackAn optional pointer to ???Include files<wx/utils.h>::wxExit::wxExitvoidwxExit()Exits application after calling ???. Should only be used
in an emergency: normally the top-level frame should be deleted
(after deleting all other frames) to terminate the application. See
??? and
???.Include files<wx/app.h>::wxKill::wxKillintwxKill(longpid, intsig = wxSIGTERM, wxKillError*rc = NULL,
intflags = 0)Equivalent to the Unix kill function: send the given signal
sig to the process with PID pid. The valid signal
values are
enum wxSignal
{
wxSIGNONE = 0, // verify if the process exists under Unix
wxSIGHUP,
wxSIGINT,
wxSIGQUIT,
wxSIGILL,
wxSIGTRAP,
wxSIGABRT,
wxSIGEMT,
wxSIGFPE,
wxSIGKILL, // forcefully kill, dangerous!
wxSIGBUS,
wxSIGSEGV,
wxSIGSYS,
wxSIGPIPE,
wxSIGALRM,
wxSIGTERM // terminate the process gently
};
wxSIGNONE, wxSIGKILL and wxSIGTERM
have the same meaning under both Unix and Windows but all the other
signals are equivalent to wxSIGTERM under Windows.Returns 0 on success, -1 on failure. If rc parameter is
not NULL, it will be filled with an element of wxKillError
enum:
enum wxKillError
{
wxKILL_OK, // no error
wxKILL_BAD_SIGNAL, // no such signal
wxKILL_ACCESS_DENIED, // permission denied
wxKILL_NO_PROCESS, // no such process
wxKILL_ERROR // another, unspecified error
};
The flags parameter can be wxKILL_NOCHILDREN (the
default), or wxKILL_CHILDREN, in which case the child processes of
this process will be killed too. Note that under Unix, for
wxKILL_CHILDREN to work you should have created the process by
passing wxEXEC_MAKE_GROUP_LEADER to wxExecute.See also???,
???,
???Include files<wx/utils.h>::wxGetProcessId::wxGetProcessIdunsigned longwxGetProcessId()Returns the number uniquely identifying the current process in
the system.If an error occurs, 0 is returned.Include files<wx/utils.h>::wxShell::wxShellboolwxShell(const wxString&command
= NULL)Executes a command in an interactive shell window. If no command
is specified, then just the shell is spawned.See also ???, ???.Include files<wx/utils.h>::wxShutdown::wxShutdownboolwxShutdown(wxShutdownFlagsflags)This function shuts down or reboots the computer depending on
the value of the flags. Please notice that doing this
requires the corresponding access rights (superuser under Unix,
SE_SHUTDOWN privelege under Windows NT) and that this
function is only implemented under Unix and Win32.ParametersflagsEither wxSHUTDOWN_POWEROFF
or wxSHUTDOWN_REBOOTReturnstrue on success, false if an error
occurred.Include files<wx/utils.h>Thread functionsThread functionsThe functions and macros here mainly exist to make it writing
the code which may be compiled in multi thread build
(wxUSE_THREADS = 1) as well as in single thread
configuration (wxUSE_THREADS = 0).For example, a static variable must be protected against
simultaneous access by multiple threads in the former configuration
but in the latter the extra overhead of using the critical section
is not needed. To solve this problem, the ???
macro may be used to create and use the critical section only when
needed.Include files<wx/thread.h>See also???, ???, ??????????????????????????????wxCRIT_SECT_DECLARE(cs)This macro declares a (static) critical section object named
cs if wxUSE_THREADS is 1 and does nothing if it is
0.wxCRIT_SECT_DECLARE_MEMBERwxCRIT_SECT_DECLARE_MEMBERwxCRIT_SECT_DECLARE(cs)This macro declares a critical section object named cs if
wxUSE_THREADS is 1 and does nothing if it is 0. As it
doesn't include the static keyword (unlike ???),
it can be used to declare a class or struct member which explains
its name.wxCRIT_SECT_LOCKERwxCRIT_SECT_LOCKERwxCRIT_SECT_LOCKER(name, cs)This macro creates a ??? object named name and associated with the
critical section cs if wxUSE_THREADS is 1 and does
nothing if it is 0.wxCRITICAL_SECTIONwxCRITICAL_SECTIONwxCRITICAL_SECTION(name)This macro combines ???
and ???:
it creates a static critical section object and also the lock
object associated with it. Because of this, it can be only used
inside a function, not at global scope. For example:
int IncCount()
{
static int s_counter = 0;
wxCRITICAL_SECTION(counter);
return ++s_counter;
}
(note that we suppose that the function is called the first time
from the main thread so that the critical section object is
initialized correctly by the time other threads start calling it,
if this is not the case this approach can not be used and
the critical section must be made a global instead).wxENTER_CRIT_SECTwxENTER_CRIT_SECTwxENTER_CRIT_SECT(wxCriticalSection&cs)This macro is equivalent to ???
if wxUSE_THREADS is 1 and does nothing if it is 0.::wxIsMainThread::wxIsMainThreadboolwxIsMainThread()Returns true if this thread is the main one. Always
returns true if wxUSE_THREADS is 0.wxLEAVE_CRIT_SECTwxLEAVE_CRIT_SECTwxLEAVE_CRIT_SECT(wxCriticalSection&cs)This macro is equivalent to ???
if wxUSE_THREADS is 1 and does nothing if it is 0.::wxMutexGuiEnter::wxMutexGuiEntervoidwxMutexGuiEnter()This function must be called when any thread other than the main
GUI thread wants to get access to the GUI library. This function
will block the execution of the calling thread until the main
thread (or any other thread holding the main GUI lock) leaves the
GUI library and no other thread will enter the GUI library until
the calling thread calls ???.Typically, these functions are used like this:
void MyThread::Foo(void)
{
// before doing any GUI calls we must ensure that this thread is the only
// one doing it!
wxMutexGuiEnter();
// Call GUI here:
my_window->DrawSomething();
wxMutexGuiLeave();
}
Note that under GTK, no creation of top-level windows is allowed
in any thread but the main one.This function is only defined on platforms which support
preemptive threads.::wxMutexGuiLeave::wxMutexGuiLeavevoidwxMutexGuiLeave()See ???.This function is only defined on platforms which support
preemptive threads.File functionsFile functionsInclude files<wx/filefn.h>See also??????????????????????????????????????????????????????????????????????????????????????????????????????voidwxDos2UnixFilename(wxChar
*s)Converts a DOS to a Unix filename by replacing backslashes with
forward slashes.::wxFileExists::wxFileExistsboolwxFileExists(const wxString&filename)Returns true if the file exists and is a plain file.::wxFileModificationTime::wxFileModificationTimetime_twxFileModificationTime(const
wxString&filename)Returns time of last modification of given file.The return value is 0 if an error occured (e.g. file not
found).::wxFileNameFromPath::wxFileNameFromPathwxStringwxFileNameFromPath(const
wxString&path)char *wxFileNameFromPath(char
*path)NB: This function is obsolete, please use ???
instead.Returns the filename for a full path. The second form returns a
pointer to temporary storage that should not be deallocated.::wxFindFirstFile::wxFindFirstFilewxStringwxFindFirstFile(const char
*spec, intflags = 0)This function does directory searching; returns the first file
that matches the path spec, or the empty string. Use
???
to get the next matching file. Neither will report the current
directory "." or the parent directory "..".WarningAs of wx 2.5.2, these functions are not thread-safe! (they use
static variables). You probably want to use ??? or ???
instead.spec may contain wildcards.flags may be wxDIR for restricting the query to
directories, wxFILE for files or zero for either.For example:
wxString f = wxFindFirstFile("/home/project/*.*");
while ( !f.empty() )
{
...
f = wxFindNextFile();
}
::wxFindNextFile::wxFindNextFilewxStringwxFindNextFile()Returns the next file that matches the path passed to ???.See ??? for an
example.::wxGetDiskSpace::wxGetDiskSpaceboolwxGetDiskSpace(const wxString&path, wxLongLong*total = NULL,
wxLongLong*free = NULL)This function returns the total number of bytes and number of
free bytes on the disk containing the directory path (it
should exist). Both total and free parameters may be
NULL if the corresponding information is not needed.Returnstrue on success, false if an error occurred
(for example, the directory doesn't exist).PortabilityThis function is implemented for Win32, Mac OS and generic Unix
provided the system has statfs() function.This function first appeared in wxWidgets 2.3.2.::wxGetFileKind::wxGetFileKindwxFileKindwxGetFileKind(intfd)wxFileKindwxGetFileKind(FILE
*fp)Returns the type of an open file. Possible return values
are:
enum wxFileKind
{
wxFILE_KIND_UNKNOWN,
wxFILE_KIND_DISK, // a file supporting seeking to arbitrary offsets
wxFILE_KIND_TERMINAL, // a tty
wxFILE_KIND_PIPE // a pipe
};
Include files<wx/filefn.h>::wxGetOSDirectory::wxGetOSDirectorywxStringwxGetOSDirectory()Returns the Windows directory under Windows; on other platforms
returns the empty string.::wxIsAbsolutePath::wxIsAbsolutePathboolwxIsAbsolutePath(const wxString&filename)Returns true if the argument is an absolute filename, i.e. with
a slash or drive name at the beginning.::wxDirExists::wxDirExistsboolwxDirExists(const wxString&dirname)Returns true if the path exists.::wxPathOnly::wxPathOnlywxStringwxPathOnly(const wxString&path)Returns the directory part of the filename.::wxUnix2DosFilename::wxUnix2DosFilenamevoidwxUnix2DosFilename(wxChar
*s)This function is deprecated, use ??? instead.Converts a Unix to a DOS filename by replacing forward slashes
with backslashes.wxCHANGE_UMASKwxCHANGE_UMASKwxCHANGE_UMASK(intmask)Under Unix this macro changes the current process umask to the
given value, unless it is equal to -1 in which case nothing is
done, and restores it to the original value on scope exit. It works
by declaring a variable which sets umask to mask in its
constructor and restores it in its destructor.Under other platforms this macro expands to nothing.::wxConcatFiles::wxConcatFilesboolwxConcatFiles(const wxString&file1, const wxString&file2, const
wxString&file3)Concatenates file1 and file2 to file3,
returning true if successful.::wxCopyFile::wxCopyFileboolwxCopyFile(const wxString&file1, const wxString&file2, booloverwrite = true)Copies file1 to file2, returning true if
successful. If overwrite parameter is true (default), the
destination file is overwritten if it exists, but if
overwrite is false, the functions fails in this case.::wxGetCwd::wxGetCwdwxStringwxGetCwd()Returns a string containing the current (or working)
directory.::wxGetWorkingDirectory::wxGetWorkingDirectorywxStringwxGetWorkingDirectory(char
*buf=NULL, intsz=1000)NB: This function is obsolete: use ??? instead.Copies the current working directory into the buffer if
supplied, or copies the working directory into new storage (which
you must delete yourself) if the buffer is NULL.sz is the size of the buffer if supplied.::wxGetTempFileName::wxGetTempFileNamechar *wxGetTempFileName(const
wxString&prefix, char *buf=NULL)boolwxGetTempFileName(const wxString&prefix, wxString&buf)NB: These functions are obsolete, please use ???
instead.::wxIsWild::wxIsWildboolwxIsWild(const wxString&pattern)Returns true if the pattern contains wildcards. See ???.::wxMatchWild::wxMatchWildboolwxMatchWild(const wxString&pattern, const wxString&text, booldot_special)Returns true if the pattern matches the text; if
dot_special is true, filenames beginning with a dot are not
matched with wildcard characters. See ???.::wxMkdir::wxMkdirboolwxMkdir(const wxString&dir, intperm = 0777)Makes the directory dir, returning true if
successful.perm is the access mask for the directory for the systems
on which it is supported (Unix) and doesn't have effect for the
other ones.::wxParseCommonDialogsFilter::wxParseCommonDialogsFilterintwxParseCommonDialogsFilter(const
wxString&wildCard, wxArrayString&descriptions, wxArrayString&filters)Parses the wildCard, returning the number of filters.
Returns 0 if none or if there's a problem. The arrays will contain
an equal number of items found before the error. On platforms where
native dialogs handle only one filter per entry, entries in arrays
are automatically adjusted. wildCard is in the form:
"All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png"
::wxRemoveFile::wxRemoveFileboolwxRemoveFile(const wxString&file)Removes file, returning true if successful.::wxRenameFile::wxRenameFileboolwxRenameFile(const wxString&file1, const wxString&file2)Renames file1 to file2, returning true if
successful.::wxRmdir::wxRmdirboolwxRmdir(const wxString&dir, intflags=0)Removes the directory dir, returning true if successful.
Does not work under VMS.The flags parameter is reserved for future use.::wxSetWorkingDirectory::wxSetWorkingDirectoryboolwxSetWorkingDirectory(const
wxString&dir)Sets the current working directory, returning true if the
operation succeeded. Under MS Windows, the current drive is also
changed if dir contains a drive specification.::wxSplitPath::wxSplitPathvoidwxSplitPath(const char *fullname, wxString *path, wxString *name, wxString *ext)NB: This function is obsolete, please use ???
instead.This function splits a full file name into components: the path
(including possible disk/drive specification under Windows), the
base name and the extension. Any of the output parameters
(path, name or ext) may be NULL if you are not
interested in the value of a particular component.wxSplitPath() will correctly handle filenames with both DOS and
Unix path separators under Windows, however it will not consider
backslashes as path separators under Unix (where backslash is a
valid character in a filename).On entry, fullname should be non-NULL (it may be empty
though).On return, path contains the file path (without the
trailing separator), name contains the file name and
ext contains the file extension without leading dot. All
three of them may be empty if the corresponding component is. The
old contents of the strings pointed to by these parameters will be
overwritten in any case (if the pointers are not NULL).::wxTransferFileToStream::wxTransferFileToStreamboolwxTransferFileToStream(const
wxString&filename, ostream&stream)Copies the given file to stream. Useful when converting
an old application to use streams (within the document/view
framework, for example).Include files<wx/docview.h>::wxTransferStreamToFile::wxTransferStreamToFileboolwxTransferStreamToFile(istream&streamconst wxString&filename)Copies the given stream to the file filename. Useful when
converting an old application to use streams (within the
document/view framework, for example).Include files<wx/docview.h>Network, user and OS functionsNetwork, user and OS functionsThe functions in this section are used to retrieve information
about the current computer and/or user characteristics.??????????????????????????????wxStringwxGetEmailAddress()boolwxGetEmailAddress(char *buf,
intsz)Copies the user's email address into the supplied buffer, by
concatenating the values returned by ???
and ???.Returns true if successful, false otherwise.Include files<wx/utils.h>::wxGetFreeMemory::wxGetFreeMemorywxMemorySizewxGetFreeMemory()Returns the amount of free memory in bytes under environments
which support it, and -1 if not supported or failed to perform
measurement.Include files<wx/utils.h>::wxGetFullHostName::wxGetFullHostNamewxStringwxGetFullHostName()Returns the FQDN (fully qualified domain host name) or an empty
string on error.See also???Include files<wx/utils.h>::wxGetHomeDir::wxGetHomeDirwxStringwxGetHomeDir()Return the (current) user's home directory.See also???Include files<wx/utils.h>::wxGetHostName::wxGetHostNamewxStringwxGetHostName()boolwxGetHostName(char *buf,
intsz)Copies the current host machine's name into the supplied buffer.
Please note that the returned name is not fully qualified,
i.e. it does not include the domain name.Under Windows or NT, this function first looks in the
environment variable SYSTEM_NAME; if this is not found, the entry
HostName in the wxWidgets section of the WIN.INI file
is tried.The first variant of this function returns the hostname if
successful or an empty string otherwise. The second (deprecated)
function returns true if successful, false otherwise.See also???Include files<wx/utils.h>::wxGetOsDescription::wxGetOsDescriptionwxStringwxGetOsDescription()Returns the string containing the description of the current
platform in a user-readable form. For example, this function may
return strings like Windows NT Version 4.0 or Linux
2.2.2 i386.See also???Include files<wx/utils.h>::wxGetOsVersion::wxGetOsVersionintwxGetOsVersion(int *major =
NULL, int *minor = NULL)Gets operating system version information.PlatformReturn typesMac OSReturn value is wxMAC when compiled with
CodeWarrior under Mac OS 8.x/9.x and Mac OS X, wxMAC_DARWIN when
compiled with the Apple Developer Tools under Mac OS X.
Both major and minor have to be looked at as
hexadecimal numbers. So System 10.2.4 returns 0x10, resp 16 for
major and 0x24, resp 36 for minor.GTKReturn value is wxGTK, For GTK 1.0, major
is 1, minor is 0.MotifReturn value is wxMOTIF_X, major is X
version, minor is X revision.OS/2Return value is wxOS2_PM.Windows 3.1Return value is wxWINDOWS, major is 3,
minor is 1.Windows NT/2000Return value is wxWINDOWS_NT, version is returned
in major and minor.Windows 98Return value is wxWIN95, major is 4,
minor is 1 or greater.Windows 95Return value is wxWIN95, major is 4,
minor is 0.Win32s (Windows 3.1)Return value is wxWIN32S, major is 3,
minor is 1.Windows PocketPCReturn value is wxWINDOWS_POCKETPC, version is
returned in major and minor.Windows SmartphoneReturn value is wxWINDOWS_SMARTPHONE, version is
returned in major and minor.Windows CE (non-specific)Return value is wxWINDOWS_CE, version is returned
in major and minor.Watcom C++ 386 supervisor mode (Windows 3.1)Return value is wxWIN386, major is 3,
minor is 1.See also???Include files<wx/utils.h>::wxGetUserHome::wxGetUserHomeconst wxChar *wxGetUserHome(const
wxString&user = "")Returns the home directory for the given user. If the username
is empty (default value), this function behaves like ???.Include files<wx/utils.h>::wxGetUserId::wxGetUserIdwxStringwxGetUserId()boolwxGetUserId(char *buf,
intsz)This function returns the "user id" also known as "login name"
under Unix i.e. something like "jsmith". It uniquely identifies the
current user (on this system).Under Windows or NT, this function first looks in the
environment variables USER and LOGNAME; if neither of these is
found, the entry UserId in the wxWidgets section of
the WIN.INI file is tried.The first variant of this function returns the login name if
successful or an empty string otherwise. The second (deprecated)
function returns true if successful, false otherwise.See also???Include files<wx/utils.h>::wxGetUserName::wxGetUserNamewxStringwxGetUserName()boolwxGetUserName(char *buf,
intsz)This function returns the full user name (something like "Mr.
John Smith").Under Windows or NT, this function looks for the entry
UserName in the wxWidgets section of the WIN.INI
file. If PenWindows is running, the entry Current in the
section User of the PENWIN.INI file is used.The first variant of this function returns the user name if
successful or an empty string otherwise. The second (deprecated)
function returns true if successful, false
otherwise.See also???Include files<wx/utils.h>String functionsString functions?????????????????????????????????????????????char *copystring(const char *s)Makes a copy of the string s using the C++ new operator,
so it can be deleted with the delete operator.This function is deprecated, use ??? class instead.::wxGetTranslation::wxGetTranslationconst char *wxGetTranslation(const char *str)const char *wxGetTranslation(const char *str, const char *strPlural, size_tn)This function returns the translation of string str in
the current ???. If the
string is not found in any of the loaded message catalogs (see
???), the original string is returned. In debug build, an
error message is logged -- this should help to find the strings
which were not yet translated. As this function is used very often,
an alternative (and also common in Unix world) syntax is provided:
the ??? macro is
defined to do the same thing as wxGetTranslation.The second form is used when retrieving translation of string
that has different singular and plural form in English or different
plural forms in some other language. It takes two extra arguments:
as above, str parameter must contain the singular form of
the string to be converted and is used as the key for the search in
the catalog. The strPlural parameter is the plural form (in
English). The parameter n is used to determine the plural
form. If no message catalog is found str is returned if 'n
== 1', otherwise strPlural.See
GNU gettext manual [http://www.gnu.org/manual/gettext/html_chapter/gettext_10.html#SEC150] for additional information on plural forms
handling. For a shorter alternative see the ??? macro.Both versions call ???.Note that this function is not suitable for literal strings in
Unicode builds, since the literal strings must be enclosed into
??? or ??? macro which makes them
unrecognised by xgettext, and so they are not extracted to
the message catalog. Instead, use the ??? and ??? macro for all
literal strings.::wxIsEmpty::wxIsEmptyboolwxIsEmpty(const char *p)Returns true if the pointer is either NULL or
points to an empty string, false otherwise.::wxStrcmp::wxStrcmpintwxStrcmp(const char *p1,
const char *p2)Returns a negative value, 0, or positive value if p1 is
less than, equal to or greater than p2. The comparison is
case-sensitive.This function complements the standard C function
stricmp() which performs case-insensitive comparison.::wxStricmp::wxStricmpintwxStricmp(const char *p1,
const char *p2)Returns a negative value, 0, or positive value if p1 is
less than, equal to or greater than p2. The comparison is
case-insensitive.This function complements the standard C function
strcmp() which performs case-sensitive comparison.::wxStringMatch::wxStringMatchboolwxStringMatch(const wxString&s1, const wxString&s2,boolsubString = true, boolexact =
false)NB: This function is obsolete, use ??? instead.Returns true if the substring s1 is found within
s2, ignoring case if exact is false. If
subString is false, no substring matching is
done.::wxStringEq::wxStringEqboolwxStringEq(const wxString&s1, const wxString&s2)NB: This function is obsolete, use ??? instead.A macro defined as:
#define wxStringEq(s1, s2) (s1 && s2 && (strcmp(s1, s2) == 0))
::wxStrlen::wxStrlensize_twxStrlen(const char *p)This is a safe version of standard function strlen(): it
does exactly the same thing (i.e. returns the length of the string)
except that it returns 0 if p is the NULL
pointer.::wxSnprintf::wxSnprintfintwxSnprintf(wxChar *buf,
size_tlen, const wxChar *format,
...)This function replaces the dangerous standard function
sprintf() and is like snprintf() available on
some platforms. The only difference with sprintf() is that an
additional argument - buffer size - is taken and the buffer is
never overflowed.Returns the number of characters copied to the buffer or -1 if
there is not enough space.See also???,
???wxTwxTwxCharwxT(charch)const wxChar *wxT(const char
*s)wxT() is a macro which can be used with character and string
literals (in other words, 'x' or "foo") to
automatically convert them to Unicode in Unicode build
configuration. Please see the ??? for more
information.This macro is simply returns the value passed to it without
changes in ASCII build. In fact, its definition is:
#ifdef UNICODE
#define wxT(x) L ## x
#else // !Unicode
#define wxT(x) x
#endif
wxTRANSLATEwxTRANSLATEconst wxChar *wxTRANSLATE(const char
*s)This macro doesn't do anything in the program code -- it simply
expands to the value of its argument (except in Unicode build where
it is equivalent to ???
which makes it unnecessary to use both wxTRANSLATE and wxT with the
same string which would be really unreadable).However it does have a purpose and it is to mark the literal
strings for the extraction into the message catalog created by
xgettext program. Usually this is achieved using ??? but that macro not
only marks the string for extraction but also expands into a
???
function call which means that it cannot be used in some
situations, notably for static array initialization.Here is an example which should make it more clear: suppose that
you have a static array of strings containing the weekday names and
which have to be translated (note that it is a bad example, really,
as ??? already
can be used to get the localized week day names already). If you
write
static const wxChar * const weekdays[] = { _("Mon"), ..., _("Sun") };
...
// use weekdays[n] as usual
the code wouldn't compile because the function calls are
forbidden in the array initializer. So instead you should do
static const wxChar * const weekdays[] = { wxTRANSLATE("Mon"), ..., wxTRANSLATE("Sun") };
...
// use wxGetTranslation(weekdays[n])
here.Note that although the code would compile if you simply
omit wxTRANSLATE() in the above, it wouldn't work as expected
because there would be no translations for the weekday names in the
program message catalog and wxGetTranslation wouldn't find
them.::wxVsnprintf::wxVsnprintfintwxVsnprintf(wxChar *buf,
size_tlen, const wxChar *format,
va_listargPtr)The same as ??? but takes a
va_list argument instead of arbitrary number of
parameters.See also???,
???__const wxChar *_(const char *s)This macro expands into a call to ???
function, so it marks the message for the extraction by
xgettext just as ??? does, but
also returns the translation of the string for the current locale
during execution.Don't confuse this macro with ???!wxPLURALwxPLURALconst wxChar *wxPLURAL(const char
*sing, const char *plur,
size_tn)This macro is identical to ??? but for the plural
variant of ???._T_TwxChar_T(charch)const wxChar *_T(const wxCharch)This macro is exactly the same as ??? and is defined in wxWidgets
simply because it may be more intuitive for Windows programmers as
the standard Win32 headers also define it (as well as yet another
name for the same macro which is _TEXT()).Don't confuse this macro with ???!Dialog functionsDialog functionsBelow are a number of convenience functions for getting input
from the user or displaying messages. Note that in these functions
the last three parameters are optional. However, it is recommended
to pass a parent frame parameter, or (in MS Windows or Motif) the
wrong window frame may be brought to the front when the dialog box
is popped up.?????????????????????????????????????????????????????????voidwxBeginBusyCursor(wxCursor *cursor
= wxHOURGLASS_CURSOR)Changes the cursor to the given cursor for all windows in the
application. Use ??? to
revert the cursor back to its previous state. These two calls can
be nested, and a counter ensures that only the outer calls take
effect.See also ???, ???.Include files<wx/utils.h>::wxBell::wxBellvoidwxBell()Ring the system bell.Include files<wx/utils.h>::wxCreateFileTipProvider::wxCreateFileTipProviderwxTipProvider *wxCreateFileTipProvider(const
wxString&filename, size_tcurrentTip)This function creates a ??? which may
be used with ???.filenameThe name of the file containing the
tips, one per linecurrentTipThe index of the first tip to show -
normally this index is remembered between the 2 program runs.See also???Include files<wx/tipdlg.h>::wxDirSelector::wxDirSelectorwxStringwxDirSelector(const wxString&message = wxDirSelectorPromptStr,const wxString&default_path = "",longstyle = 0, const wxPoint&pos =
wxDefaultPosition,wxWindow *parent = NULL)Pops up a directory selector dialog. The arguments have the same
meaning as those of wxDirDialog::wxDirDialog(). The message is
displayed at the top, and the default_path, if specified, is set as
the initial selection.The application must check for an empty return value (if the
user pressed Cancel). For example:
const wxString& dir = wxDirSelector("Choose a folder");
if ( !dir.empty() )
{
...
}
Include files<wx/dirdlg.h>::wxFileSelector::wxFileSelectorwxStringwxFileSelector(const wxString&message, const wxString&default_path =
"",const wxString&default_filename = "", const
wxString&default_extension = "",const wxString&wildcard = "*.*", intflags = 0, wxWindow *parent = NULL,intx = -1, inty = -1)Pops up a file selector box. In Windows, this is the common file
selector dialog. In X, this is a file selector box with the same
functionality. The path and filename are distinct elements of a
full file pathname. If path is empty, the current directory will be
used. If filename is empty, no default filename will be supplied.
The wildcard determines what files are displayed in the file
selector, and file extension supplies a type extension for the
required filename. Flags may be a combination of wxOPEN, wxSAVE,
wxOVERWRITE_PROMPT, wxFILE_MUST_EXIST, wxMULTIPLE or 0.Both the Unix and Windows versions implement a wildcard filter.
Typing a filename containing wildcards (*, ?) in the filename text
item, and clicking on Ok, will result in only those files matching
the pattern being displayed.The wildcard may be a specification for multiple types of file
with a description for each, such as:
"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"
The application must check for an empty return value (the user
pressed Cancel). For example:
wxString filename = wxFileSelector("Choose a file to open");
if ( !filename.empty() )
{
// work with the file
...
}
//else: cancelled by user
Include files<wx/filedlg.h>::wxEndBusyCursor::wxEndBusyCursorvoidwxEndBusyCursor()Changes the cursor back to the original cursor, for all windows
in the application. Use with ???.See also ???, ???.Include files<wx/utils.h>::wxGetColourFromUser::wxGetColourFromUserwxColourwxGetColourFromUser(wxWindow
*parent, const wxColour&colInit)Shows the colour selection dialog and returns the colour
selected by user or invalid colour (use ??? to test whether a
colour is valid) if the dialog was cancelled.ParametersparentThe parent window for the colour
selection dialogcolInitIf given, this will be the colour
initially selected in the dialog.Include files<wx/colordlg.h>::wxGetFontFromUser::wxGetFontFromUserwxFontwxGetFontFromUser(wxWindow
*parent, const wxFont&fontInit)Shows the font selection dialog and returns the font selected by
user or invalid font (use ??? to test whether a font is
valid) if the dialog was cancelled.ParametersparentThe parent window for the font
selection dialogfontInitIf given, this will be the font
initially selected in the dialog.Include files<wx/fontdlg.h>::wxGetMultipleChoices::wxGetMultipleChoicessize_twxGetMultipleChoices(wxArrayInt&selections,const wxString&message,const wxString&caption,const wxArrayString&aChoices,wxWindow *parent = NULL,intx = -1, inty = -1,boolcentre = true,intwidth=150, intheight=200)size_twxGetMultipleChoices(wxArrayInt&selections,const wxString&message,const wxString&caption,intn, const wxString&choices[],wxWindow *parent = NULL,intx = -1, inty = -1,boolcentre = true,intwidth=150, intheight=200)Pops up a dialog box containing a message, OK/Cancel buttons and
a multiple-selection listbox. The user may choose an arbitrary
(including 0) number of items in the listbox whose indices will be
returned in selection array. The initial contents of this
array will be used to select the items when the dialog is
shown.You may pass the list of strings to choose from either using
choices which is an array of n strings for the
listbox or by using a single aChoices parameter of type
???.If centre is true, the message text (which may include
new line characters) is centred; if false, the message is
left-justified.Include files<wx/choicdlg.h>wxPerl note: In wxPerl there
is just an array reference in place of n and
choices, and no selections parameter; the
function returns an array containing the user selections.::wxGetNumberFromUser::wxGetNumberFromUserlongwxGetNumberFromUser( const
wxString&message, const wxString&prompt, const wxString&caption,
longvalue, longmin = 0, longmax = 100, wxWindow *parent = NULL, const
wxPoint&pos = wxDefaultPosition)Shows a dialog asking the user for numeric input. The dialogs
title is set to caption, it contains a (possibly) multiline
message above the single line prompt and the zone for
entering the number.The number entered must be in the range min..max
(both of which should be positive) and value is the initial
value of it. If the user enters an invalid value or cancels the
dialog, the function will return -1.Dialog is centered on its parent unless an explicit
position is given in pos.Include files<wx/numdlg.h>::wxGetPasswordFromUser::wxGetPasswordFromUserwxStringwxGetPasswordFromUser(const
wxString&message, const wxString&caption = "Input text",const wxString&default_value = "", wxWindow
*parent = NULL,intx = wxDefaultCoord, inty =
wxDefaultCoord, boolcentre = true)Similar to ???
but the text entered in the dialog is not shown on screen but
replaced with stars. This is intended to be used for entering
passwords as the function name implies.Include files<wx/textdlg.h>::wxGetTextFromUser::wxGetTextFromUserwxStringwxGetTextFromUser(const
wxString&message, const wxString&caption = "Input text",const wxString&default_value = "", wxWindow
*parent = NULL,intx = wxDefaultCoord, inty =
wxDefaultCoord, boolcentre = true)Pop up a dialog box with title set to caption,
message, and a default_value. The user may type in
text and press OK to return this text, or press Cancel to return
the empty string.If centre is true, the message text (which may include
new line characters) is centred; if false, the message is
left-justified.Include files<wx/textdlg.h>::wxGetMultipleChoice::wxGetMultipleChoiceintwxGetMultipleChoice(const wxString&message, const wxString&caption,
intn, const wxString&choices[],intnsel, int *selection, wxWindow
*parent = NULL, intx = -1, inty = -1,boolcentre = true, intwidth=150,
intheight=200)Pops up a dialog box containing a message, OK/Cancel buttons and
a multiple-selection listbox. The user may choose one or more
item(s) and press OK or Cancel.The number of initially selected choices, and array of the
selected indices, are passed in; this array will contain the user
selections on exit, with the function returning the number of
selections. selection must be as big as the number of
choices, in case all are selected.If Cancel is pressed, -1 is returned.choices is an array of n strings for the
listbox.If centre is true, the message text (which may include
new line characters) is centred; if false, the message is
left-justified.Include files<wx/choicdlg.h>::wxGetSingleChoice::wxGetSingleChoicewxStringwxGetSingleChoice(const
wxString&message,const wxString&caption,const wxArrayString&aChoices,wxWindow *parent = NULL,intx = -1, inty = -1,boolcentre = true,intwidth=150, intheight=200)wxStringwxGetSingleChoice(const
wxString&message,const wxString&caption,intn, const wxString&choices[],wxWindow *parent = NULL,intx = -1, inty = -1,boolcentre = true,intwidth=150, intheight=200)Pops up a dialog box containing a message, OK/Cancel buttons and
a single-selection listbox. The user may choose an item and press
OK to return a string or Cancel to return the empty string. Use
???
if empty string is a valid choice and if you want to be able to
detect pressing Cancel reliably.You may pass the list of strings to choose from either using
choices which is an array of n strings for the
listbox or by using a single aChoices parameter of type
???.If centre is true, the message text (which may include
new line characters) is centred; if false, the message is
left-justified.Include files<wx/choicdlg.h>wxPerl note: In wxPerl there
is just an array reference in place of n and
choices.::wxGetSingleChoiceIndex::wxGetSingleChoiceIndexintwxGetSingleChoiceIndex(const
wxString&message,const wxString&caption,const wxArrayString&aChoices,wxWindow *parent = NULL, intx = -1,
inty = -1,boolcentre = true, intwidth=150,
intheight=200)intwxGetSingleChoiceIndex(const
wxString&message,const wxString&caption,intn, const wxString&choices[],wxWindow *parent = NULL, intx = -1,
inty = -1,boolcentre = true, intwidth=150,
intheight=200)As wxGetSingleChoice but returns the index representing
the selected string. If the user pressed cancel, -1 is
returned.Include files<wx/choicdlg.h>wxPerl note: In wxPerl there
is just an array reference in place of n and
choices.::wxGetSingleChoiceData::wxGetSingleChoiceDatawxStringwxGetSingleChoiceData(const
wxString&message,const wxString&caption,const wxArrayString&aChoices,const wxString&client_data[],wxWindow *parent = NULL,intx = -1, inty = -1,boolcentre = true, intwidth=150,
intheight=200)wxStringwxGetSingleChoiceData(const
wxString&message,const wxString&caption,intn, const wxString&choices[],const wxString&client_data[],wxWindow *parent = NULL,intx = -1, inty = -1,boolcentre = true, intwidth=150,
intheight=200)As wxGetSingleChoice but takes an array of client data
pointers corresponding to the strings, and returns one of these
pointers or NULL if Cancel was pressed. The client_data
array must have the same number of elements as choices or
aChoices!Include files<wx/choicdlg.h>wxPerl note: In wxPerl there
is just an array reference in place of n and
choices, and the client data array must have the same
length as the choices array.::wxIsBusy::wxIsBusyboolwxIsBusy()Returns true if between two ???
and ???
calls.See also ???.Include files<wx/utils.h>::wxMessageBox::wxMessageBoxintwxMessageBox(const wxString&message, const wxString&caption =
"Message", intstyle = wxOK,wxWindow *parent = NULL, intx = -1,
inty = -1)General purpose message dialog. style may be a bit list
of the following identifiers:wxYES_NOPuts Yes and No buttons on the message box. May be
combined with wxCANCEL.wxCANCELPuts a Cancel button on the message box. May be
combined with wxYES_NO or wxOK.wxOKPuts an Ok button on the message box. May be
combined with wxCANCEL.wxICON_EXCLAMATIONDisplays an exclamation mark symbol.wxICON_HANDDisplays an error symbol.wxICON_ERRORDisplays an error symbol - the same as
wxICON_HAND.wxICON_QUESTIONDisplays a question mark symbol.wxICON_INFORMATIONDisplays an information symbol.The return value is one of: wxYES, wxNO, wxCANCEL, wxOK.For example:
...
int answer = wxMessageBox("Quit program?", "Confirm",
wxYES_NO | wxCANCEL, main_frame);
if (answer == wxYES)
main_frame->Close();
...
message may contain newline characters, in which case the
message will be split into separate lines, to cater for large
messages.Include files<wx/msgdlg.h>::wxShowTip::wxShowTipboolwxShowTip(wxWindow *parent,
wxTipProvider *tipProvider, boolshowAtStartup = true)This function shows a "startup tip" to the user. The return
value is the state of the 'Show tips at startup' checkbox.parentThe parent window for the modal
dialogtipProviderAn object which is used to get the
text of the tips. It may be created with the ???
function.showAtStartupShould be true if startup tips are
shown, false otherwise. This is used as the initial value for "Show
tips at startup" checkbox which is shown in the tips dialog.See also???Include files<wx/tipdlg.h>Math functionsMath functionsInclude files<wx/math.h>??????intwxFinite(doublex)Returns a non-zero value if x is neither infinite or NaN
(not a number), returns 0 otherwise.wxIsNaNwxIsNaNboolwxIsNaN(doublex)Returns a non-zero value if x is NaN (not a number),
returns 0 otherwise.GDI functionsGDI functionsThe following are relevant to the GDI (Graphics Device
Interface).Include files<wx/gdicmn.h>??????????????????????????????wxBITMAP(bitmapName)This macro loads a bitmap from either application resources (on
the platforms for which they exist, i.e. Windows and OS2) or from
an XPM file. It allows to avoid using #ifdefs when
creating bitmaps.See also???, ???Include files<wx/gdicmn.h>::wxClientDisplayRect::wxClientDisplayRectvoidwxClientDisplayRect(int *x,
int *y, int *width, int
*height)wxRectwxGetClientDisplayRect()Returns the dimensions of the work area on the display. On
Windows this means the area not covered by the taskbar, etc. Other
platforms are currently defaulting to the whole display until a way
is found to provide this info for all window managers, etc.::wxColourDisplay::wxColourDisplayboolwxColourDisplay()Returns true if the display is colour, false otherwise.::wxDisplayDepth::wxDisplayDepthintwxDisplayDepth()Returns the depth of the display (a value of 1 denotes a
monochrome display).::wxDisplaySize::wxDisplaySizevoidwxDisplaySize(int *width,
int *height)wxSizewxGetDisplaySize()Returns the display size in pixels.::wxDisplaySizeMM::wxDisplaySizeMMvoidwxDisplaySizeMM(int *width,
int *height)wxSizewxGetDisplaySizeMM()Returns the display size in millimeters.::wxDROP_ICON::wxDROP_ICONwxIconOrCursorwxDROP_ICON(const char
*name)This macro creates either a cursor (MSW) or an icon (elsewhere)
with the given name. Under MSW, the cursor is loaded from the
resource file and the icon is loaded from XPM file under other
platforms.This macro should be used with ???.Include files<wx/dnd.h>wxICONwxICONwxICON(iconName)This macro loads an icon from either application resources (on
the platforms for which they exist, i.e. Windows and OS2) or from
an XPM file. It allows to avoid using #ifdefs when
creating icons.See also???, ???Include files<wx/gdicmn.h>::wxMakeMetafilePlaceable::wxMakeMetafilePlaceableboolwxMakeMetafilePlaceable(const
wxString&filename, intminX,
intminY, intmaxX, intmaxY, floatscale=1.0)Given a filename for an existing, valid metafile (as constructed
using ???)
makes it into a placeable metafile by prepending a header
containing the given bounding box. The bounding box may be obtained
from a device context after drawing into it, using the functions
wxDC::MinX, wxDC::MinY, wxDC::MaxX and wxDC::MaxY.In addition to adding the placeable metafile header, this
function adds the equivalent of the following code to the start of
the metafile data:
SetMapMode(dc, MM_ANISOTROPIC);
SetWindowOrg(dc, minX, minY);
SetWindowExt(dc, maxX - minX, maxY - minY);
This simulates the wxMM_TEXT mapping mode, which wxWidgets
assumes.Placeable metafiles may be imported by many Windows
applications, and can be used in RTF (Rich Text Format) files.scale allows the specification of scale for the
metafile.This function is only available under Windows.::wxSetCursor::wxSetCursorvoidwxSetCursor(wxCursor
*cursor)Globally sets the cursor; only has an effect in Windows and GTK.
See also ???, ???.Printer settingsPrinter settingsNB: These routines are obsolete and should no longer be
used!The following functions are used to control PostScript printing.
Under Windows, PostScript output can only be sent to a file.Include files<wx/dcps.h>????????????????????????????????????????????????wxStringwxGetPrinterCommand()Gets the printer command used to print a file. The default is
lpr.::wxGetPrinterFile::wxGetPrinterFilewxStringwxGetPrinterFile()Gets the PostScript output filename.::wxGetPrinterMode::wxGetPrinterModeintwxGetPrinterMode()Gets the printing mode controlling where output is sent
(PS_PREVIEW, PS_FILE or PS_PRINTER). The default is PS_PREVIEW.::wxGetPrinterOptions::wxGetPrinterOptionswxStringwxGetPrinterOptions()Gets the additional options for the print command (e.g. specific
printer). The default is nothing.::wxGetPrinterOrientation::wxGetPrinterOrientationintwxGetPrinterOrientation()Gets the orientation (PS_PORTRAIT or PS_LANDSCAPE). The default
is PS_PORTRAIT.::wxGetPrinterPreviewCommand::wxGetPrinterPreviewCommandwxStringwxGetPrinterPreviewCommand()Gets the command used to view a PostScript file. The default
depends on the platform.::wxGetPrinterScaling::wxGetPrinterScalingvoidwxGetPrinterScaling(float *x,
float *y)Gets the scaling factor for PostScript output. The default is
1.0, 1.0.::wxGetPrinterTranslation::wxGetPrinterTranslationvoidwxGetPrinterTranslation(float
*x, float *y)Gets the translation (from the top left corner) for PostScript
output. The default is 0.0, 0.0.::wxSetPrinterCommand::wxSetPrinterCommandvoidwxSetPrinterCommand(const
wxString&command)Sets the printer command used to print a file. The default is
lpr.::wxSetPrinterFile::wxSetPrinterFilevoidwxSetPrinterFile(const wxString&filename)Sets the PostScript output filename.::wxSetPrinterMode::wxSetPrinterModevoidwxSetPrinterMode(intmode)Sets the printing mode controlling where output is sent
(PS_PREVIEW, PS_FILE or PS_PRINTER). The default is PS_PREVIEW.::wxSetPrinterOptions::wxSetPrinterOptionsvoidwxSetPrinterOptions(const
wxString&options)Sets the additional options for the print command (e.g. specific
printer). The default is nothing.::wxSetPrinterOrientation::wxSetPrinterOrientationvoidwxSetPrinterOrientation(intorientation)Sets the orientation (PS_PORTRAIT or PS_LANDSCAPE). The default
is PS_PORTRAIT.::wxSetPrinterPreviewCommand::wxSetPrinterPreviewCommandvoidwxSetPrinterPreviewCommand(const
wxString&command)Sets the command used to view a PostScript file. The default
depends on the platform.::wxSetPrinterScaling::wxSetPrinterScalingvoidwxSetPrinterScaling(floatx,
floaty)Sets the scaling factor for PostScript output. The default is
1.0, 1.0.::wxSetPrinterTranslation::wxSetPrinterTranslationvoidwxSetPrinterTranslation(floatx, floaty)Sets the translation (from the top left corner) for PostScript
output. The default is 0.0, 0.0.Clipboard functionsClipboard functionsThese clipboard functions are implemented for Windows only. The
use of these functions is deprecated and the code is no longer
maintained. Use the ??? class
instead.Include files<wx/clipbrd.h>??????????????????????????????boolwxClipboardOpen()Returns true if this application has already opened the
clipboard.::wxCloseClipboard::wxCloseClipboardboolwxCloseClipboard()Closes the clipboard to allow other applications to use it.::wxEmptyClipboard::wxEmptyClipboardboolwxEmptyClipboard()Empties the clipboard.::wxEnumClipboardFormats::wxEnumClipboardFormatsintwxEnumClipboardFormats(intdataFormat)Enumerates the formats found in a list of available formats that
belong to the clipboard. Each call to this function specifies a
known available format; the function returns the format that
appears next in the list.dataFormat specifies a known format. If this parameter is
zero, the function returns the first format in the list.The return value specifies the next known clipboard data format
if the function is successful. It is zero if the dataFormat
parameter specifies the last format in the list of available
formats, or if the clipboard is not open.Before it enumerates the formats function, an application must
open the clipboard by using the wxOpenClipboard function.::wxGetClipboardData::wxGetClipboardDatawxObject *wxGetClipboardData(intdataFormat)Gets data from the clipboard.dataFormat may be one of:•wxCF_TEXT or wxCF_OEMTEXT: returns a pointer to new memory
containing a null-terminated text string.•wxCF_BITMAP: returns a new wxBitmap.The clipboard must have previously been opened for this call to
succeed.::wxGetClipboardFormatName::wxGetClipboardFormatNameboolwxGetClipboardFormatName(intdataFormat,
const wxString&formatName,
intmaxCount)Gets the name of a registered clipboard format, and puts it into
the buffer formatName which is of maximum length
maxCount. dataFormat must not specify a predefined
clipboard format.::wxIsClipboardFormatAvailable::wxIsClipboardFormatAvailableboolwxIsClipboardFormatAvailable(intdataFormat)Returns true if the given data format is available on the
clipboard.::wxOpenClipboard::wxOpenClipboardboolwxOpenClipboard()Opens the clipboard for passing data to it or getting data from
it.::wxRegisterClipboardFormat::wxRegisterClipboardFormatintwxRegisterClipboardFormat(const
wxString&formatName)Registers the clipboard data format name and returns an
identifier.::wxSetClipboardData::wxSetClipboardDataboolwxSetClipboardData(intdataFormat, wxObject
*data, intwidth,
intheight)Passes data to the clipboard.dataFormat may be one of:•wxCF_TEXT or wxCF_OEMTEXT: data is a null-terminated
text string.•wxCF_BITMAP: data is a wxBitmap.•wxCF_DIB: data is a wxBitmap. The bitmap is converted to
a DIB (device independent bitmap).•wxCF_METAFILE: data is a wxMetafile. width and
height are used to give recommended dimensions.The clipboard must have previously been opened for this call to
succeed.Miscellaneous functionsMiscellaneous functions?????????????????????????????????????????????????????????????????????????????????????????????????????????wxCONCAT(x, y)This macro returns the concatenation of two tokens x and
y.wxDYNLIB_FUNCTIONwxDYNLIB_FUNCTIONwxDYNLIB_FUNCTION(type, name,
dynlib)When loading a function from a DLL you always have to cast the
returned void * pointer to the correct type and, even more
annoyingly, you have to repeat this type twice if you want to
declare and define a function pointer all in one lineThis macro makes this slightly less painful by allowing you to
specify the type only once, as the first parameter, and creating a
variable of this type named after the function but with
pfn prefix and initialized with the function name
from the ???dynlib.Parameterstypethe type of the functionnamethe name of the function to load, not
a string (without quotes, it is quoted automatically by the
macro)dynlibthe library to load the function
fromwxEXPLICITwxEXPLICITwxEXPLICIT is a macro which expands to the C++
explicit keyword if the compiler supports it or nothing
otherwise. Thus, it can be used even in the code which might have
to be compiled with an old compiler without support for this
language feature but still take advantage of it when it is
available.::wxGetKeyState::wxGetKeyStateboolwxGetKeyState(wxKeyCodekey)For normal keys, returns true if the specified key is
currently down.For togglable keys (Caps Lock, Num Lock and Scroll Lock),
returns true if the key is toggled such that its LED
indicator is lit. There is currently no way to test whether
togglable keys are up or down.Even though there are virtual key codes defined for mouse
buttons, they cannot be used with this function currently.Include files<wx/utils.h>wxLLwxLLwxLongLong_twxLL(number)This macro is defined for the platforms with a native 64 bit
integer type and allows to define 64 bit compile time
constants:
#ifdef wxLongLong_t
wxLongLong_t ll = wxLL(0x1234567890abcdef);
#endif
Include files<wx/longlong.h>See also???, ???wxLongLongFmtSpecwxLongLongFmtSpecThis macro is defined to contain the printf() format
specifier using which 64 bit integer numbers (i.e. those of type
wxLongLong_t) can be printed. Example of using it:
#ifdef wxLongLong_t
wxLongLong_t ll = wxLL(0x1234567890abcdef);
printf("Long long = %" wxLongLongFmtSpec "x\n", ll);
#endif
See also???Include files<wx/longlong.h>::wxNewId::wxNewIdlongwxNewId()Generates an integer identifier unique to this run of the
program.Include files<wx/utils.h>wxON_BLOCK_EXITwxON_BLOCK_EXITwxON_BLOCK_EXIT0(func)
wxON_BLOCK_EXIT1(func, p1)
wxON_BLOCK_EXIT2(func, p1, p2)This family of macros allows to ensure that the global function
func with 0, 1, 2 or more parameters (up to some
implementaton-defined limit) is executed on scope exit, whether due
to a normal function return or because an exception has been
thrown. A typical example of its usage:
void *buf = malloc(size);
wxON_BLOCK_EXIT1(free, buf);
Please see the original article by Andrei Alexandrescu and Petru
Marginean published in December 2000 issue of C/C++ Users
Journal for more details.Include files<wx/scopeguard.h>See also???wxON_BLOCK_EXIT_OBJwxON_BLOCK_EXIT_OBJwxON_BLOCK_EXIT_OBJ0(obj, method)
wxON_BLOCK_EXIT_OBJ1(obj, method, p1)
wxON_BLOCK_EXIT_OBJ2(obj, method, p1,
p2)This family of macros is similar to ??? but calls a
method of the given object instead of a free function.Include files<wx/scopeguard.h>::wxRegisterId::wxRegisterIdvoidwxRegisterId(longid)Ensures that ids subsequently generated by NewId do not
clash with the given id.Include files<wx/utils.h>::wxDDECleanUp::wxDDECleanUpvoidwxDDECleanUp()Called when wxWidgets exits, to clean up the DDE system. This no
longer needs to be called by the application.See also ???.Include files<wx/dde.h>::wxDDEInitialize::wxDDEInitializevoidwxDDEInitialize()Initializes the DDE system. May be called multiple times without
harm.This no longer needs to be called by the application: it will be
called by wxWidgets if necessary.See also ???, ???, ???,
???.Include files<wx/dde.h>::wxEnableTopLevelWindows::wxEnableTopLevelWindowsvoidwxEnableTopLevelWindow(boolenable
= true)This function enables or disables all top level windows. It is
used by ???.Include files<wx/utils.h>::wxFindMenuItemId::wxFindMenuItemIdintwxFindMenuItemId(wxFrame *frame,
const wxString&menuString, const
wxString&itemString)Find a menu item identifier associated with the given frame's
menu bar.Include files<wx/utils.h>::wxFindWindowByLabel::wxFindWindowByLabelwxWindow *wxFindWindowByLabel(const
wxString&label, wxWindow
*parent=NULL)NB: This function is obsolete, please use ???
instead.Find a window by its label. Depending on the type of window, the
label may be a window title or panel item label. If parent
is NULL, the search will start from all top-level frames and dialog
boxes; if non-NULL, the search will be limited to the given window
hierarchy. The search is recursive in both cases.Include files<wx/utils.h>::wxFindWindowByName::wxFindWindowByNamewxWindow *wxFindWindowByName(const
wxString&name, wxWindow
*parent=NULL)NB: This function is obsolete, please use ???
instead.Find a window by its name (as given in a window constructor or
Create function call). If parent is NULL, the search
will start from all top-level frames and dialog boxes; if non-NULL,
the search will be limited to the given window hierarchy. The
search is recursive in both cases.If no such named window is found, wxFindWindowByLabel is
called.Include files<wx/utils.h>::wxFindWindowAtPoint::wxFindWindowAtPointwxWindow *wxFindWindowAtPoint(const
wxPoint&pt)Find the deepest window at the given mouse position in screen
coordinates, returning the window if found, or NULL if not.::wxFindWindowAtPointer::wxFindWindowAtPointerwxWindow *wxFindWindowAtPointer(wxPoint&pt)Find the deepest window at the mouse pointer position, returning
the window and current pointer position in screen coordinates.::wxGetActiveWindow::wxGetActiveWindowwxWindow *wxGetActiveWindow()Gets the currently active window (Windows only).Include files<wx/windows.h>::wxGetBatteryState::wxGetBatteryStatewxBatteryStatewxGetBatteryState()Returns battery state as one of wxBATTERY_NORMAL_STATE,
wxBATTERY_LOW_STATE, wxBATTERY_CRITICAL_STATE,
wxBATTERY_SHUTDOWN_STATE or
wxBATTERY_UNKNOWN_STATE. wxBATTERY_UNKNOWN_STATE
is also the default on platforms where this feature is not
implemented.Include files<wx/utils.h>::wxGetDisplayName::wxGetDisplayNamewxStringwxGetDisplayName()Under X only, returns the current display name. See also
???.Include files<wx/utils.h>::wxGetPowerType::wxGetPowerTypewxPowerTypewxGetPowerType()Returns the type of power source as one of
wxPOWER_SOCKET, wxPOWER_BATTERY or
wxPOWER_UNKNOWN. wxPOWER_UNKNOWN is also the
default on platforms where this feature is not implemented.Include files<wx/utils.h>::wxGetMousePosition::wxGetMousePositionwxPointwxGetMousePosition()Returns the mouse position in screen coordinates.Include files<wx/utils.h>::wxGetResource::wxGetResourceboolwxGetResource(const wxString§ion, const wxString&entry, const
wxString& *value, const wxString&file
= NULL)boolwxGetResource(const wxString§ion, const wxString&entry, float
*value, const wxString&file =
NULL)boolwxGetResource(const wxString§ion, const wxString&entry, long
*value, const wxString&file =
NULL)boolwxGetResource(const wxString§ion, const wxString&entry, int
*value, const wxString&file =
NULL)Gets a resource value from the resource database (for example,
WIN.INI, or .Xdefaults). If file is NULL, WIN.INI or
.Xdefaults is used, otherwise the specified file is used.Under X, if an application class (wxApp::GetClassName) has been
defined, it is appended to the string /usr/lib/X11/app-defaults/ to
try to find an applications default file when merging all resource
databases.The reason for passing the result in an argument is that it can
be convenient to define a default value, which gets overridden if
the value exists in the resource file. It saves a separate test for
that resource's existence, and it also allows the overloading of
the function for different types.See also ???, ???.Include files<wx/utils.h>::wxGetStockLabel::wxGetStockLabelwxStringwxGetStockLabel(wxWindowIDid, boolwithCodes = true, wxStringaccelerator = wxEmptyString)Returns label that should be used for given id
element.Parametersidgiven id of the ???, ???, ??? tool, etc.withCodesif false then strip accelerator code
from the label; usefull for getting labels without accelerator char
code like for toolbar tooltip or under platforms without
traditional keyboard like smartphonesacceleratoroptional accelerator string
automatically added to label; useful for building labels for
???Include files<wx/stockitem.h>::wxGetTopLevelParent::wxGetTopLevelParentwxWindow *wxGetTopLevelParent(wxWindow*win)Returns the first top level parent of the given window, or in
other words, the frame or dialog containing it, or
NULL.Include files<wx/window.h>::wxLaunchDefaultBrowser::wxLaunchDefaultBrowserboolwxLaunchDefaultBrowser(const
wxString&sUrl)Launches the user's default browser and tells it to open the
location at sUrl.Returns true if the application was successfully launched.Include files<wx/utils.h>::wxLoadUserResource::wxLoadUserResourcewxStringwxLoadUserResource(const
wxString&resourceName, const wxString&resourceType="TEXT")Loads a user-defined Windows resource as a string. If the
resource is found, the function creates a new character array and
copies the data into it. A pointer to this data is returned. If
unsuccessful, NULL is returned.The resource must be defined in the .rc file using the
following syntax:
myResource TEXT file.ext
where file.ext is a file that the resource compiler can
find.This function is available under Windows only.Include files<wx/utils.h>::wxPostDelete::wxPostDeletevoidwxPostDelete(wxObject
*object)Tells the system to delete the specified object when all other
events have been processed. In some environments, it is necessary
to use this instead of deleting a frame directly with the delete
operator, because some GUIs will still send events to a deleted
window.Now obsolete: use ??? instead.Include files<wx/utils.h>::wxPostEvent::wxPostEventvoidwxPostEvent(wxEvtHandler *dest,
wxEvent&event)In a GUI application, this function posts event to the
specified dest object using ???.
Otherwise, it dispatches event immediately using ???.
See the respective documentation for details (and caveats).Include files<wx/app.h>::wxSetDisplayName::wxSetDisplayNamevoidwxSetDisplayName(const wxString&displayName)Under X only, sets the current display name. This is the X host
and display name such as "colonsay:0.0", and the function indicates
which display should be used for creating windows from this point
on. Setting the display within an application allows multiple
displays to be used.See also ???.Include files<wx/utils.h>::wxStripMenuCodes::wxStripMenuCodeswxStringwxStripMenuCodes(const
wxString&in)voidwxStripMenuCodes(char *in,
char *out)NB: This function is obsolete, please use ???
instead.Strips any menu codes from in and places the result in
out (or returns the new string, in the first form).Menu codes include & (mark the next character with an
underline as a keyboard shortkey in Windows and Motif) and \t (tab
in Windows).Include files<wx/utils.h>wxULLwxULLwxLongLong_twxULL(number)This macro is defined for the platforms with a native 64 bit
integer type and allows to define unsigned 64 bit compile time
constants:
#ifdef wxLongLong_t
unsigned wxLongLong_t ll = wxULL(0x1234567890abcdef);
#endif
Include files<wx/longlong.h>See also???, ???wxVaCopywxVaCopyvoidwxVaCopy(va_listargptrDst,
va_listargptrSrc)This macro is the same as the standard C99 va_copy for
the compilers which support it or its replacement for those that
don't. It must be used to preserve the value of a va_list
object if you need to use it after passing it to another function
because it can be modified by the latter.As with va_start, each call to wxVaCopy must
have a matching va_end.::wxWriteResource::wxWriteResourceboolwxWriteResource(const wxString§ion, const wxString&entry, const
wxString&value, const wxString&file
= NULL)boolwxWriteResource(const wxString§ion, const wxString&entry,
floatvalue, const wxString&file =
NULL)boolwxWriteResource(const wxString§ion, const wxString&entry,
longvalue, const wxString&file =
NULL)boolwxWriteResource(const wxString§ion, const wxString&entry, intvalue, const wxString&file = NULL)Writes a resource value into the resource database (for example,
WIN.INI, or .Xdefaults). If file is NULL, WIN.INI or
.Xdefaults is used, otherwise the specified file is used.Under X, the resource databases are cached until the internal
function wxFlushResources is called automatically on exit,
when all updated resource databases are written to their files.Note that it is considered bad manners to write to the
.Xdefaults file under Unix, although the WIN.INI file is fair game
under Windows.See also ???, ???.Include files<wx/utils.h>Byte order macrosByte order macrosThe endian-ness issues (that is the difference between
big-endian and little-endian architectures) are important for the
portable programs working with the external binary data (for
example, data files or data coming from network) which is usually
in some fixed, platform-independent format. The macros are helpful
for transforming the data to the correct format.?????????wxInt32wxINT32_SWAP_ALWAYS(wxInt32value)wxUint32wxUINT32_SWAP_ALWAYS(wxUint32value)wxInt16wxINT16_SWAP_ALWAYS(wxInt16value)wxUint16wxUINT16_SWAP_ALWAYS(wxUint16value)These macros will swap the bytes of the value variable
from little endian to big endian or vice versa unconditionally,
i.e. independently of the current platform.wxINTXX_SWAP_ON_BEwxINTXX_SWAP_ON_BEwxInt32wxINT32_SWAP_ON_BE(wxInt32value)wxUint32wxUINT32_SWAP_ON_BE(wxUint32value)wxInt16wxINT16_SWAP_ON_BE(wxInt16value)wxUint16wxUINT16_SWAP_ON_BE(wxUint16value)This macro will swap the bytes of the value variable from
little endian to big endian or vice versa if the program is
compiled on a big-endian architecture (such as Sun work stations).
If the program has been compiled on a little-endian architecture,
the value will be unchanged.Use these macros to read data from and write data to a file that
stores data in little-endian (for example Intel i386) format.wxINTXX_SWAP_ON_LEwxINTXX_SWAP_ON_LEwxInt32wxINT32_SWAP_ON_LE(wxInt32value)wxUint32wxUINT32_SWAP_ON_LE(wxUint32value)wxInt16wxINT16_SWAP_ON_LE(wxInt16value)wxUint16wxUINT16_SWAP_ON_LE(wxUint16value)This macro will swap the bytes of the value variable from
little endian to big endian or vice versa if the program is
compiled on a little-endian architecture (such as Intel PCs). If
the program has been compiled on a big-endian architecture, the
value will be unchanged.Use these macros to read data from and write data to a file that
stores data in big-endian format.RTTI functionsRTTI functionswxWidgets uses its own RTTI ("run-time type identification")
system which predates the current standard C++ RTTI and so is kept
for backwards compatibility reasons but also because it allows some
things which the standard RTTI doesn't directly support (such as
creating a class from its name).The standard C++ RTTI can be used in the user code without any
problems and in general you shouldn't need to use the functions and
the macros in this section unless you are thinking of modifying or
adding any wxWidgets classes.See alsothe section called “Runtime class information (aka RTTI) overview”???????????????????????????????????????????????????????????????wxClassInfo *CLASSINFO(className)Returns a pointer to the wxClassInfo object associated with this
class.Include files<wx/object.h>DECLARE_ABSTRACT_CLASSDECLARE_ABSTRACT_CLASSDECLARE_ABSTRACT_CLASS(className)Used inside a class declaration to declare that the class should
be made known to the class hierarchy, but objects of this class
cannot be created dynamically. The same as DECLARE_CLASS.Example:
class wxCommand: public wxObject
{
DECLARE_ABSTRACT_CLASS(wxCommand)
private:
...
public:
...
};
Include files<wx/object.h>DECLARE_APPDECLARE_APPDECLARE_APP(className)This is used in headers to create a forward declaration of the
??? function
implemented by ???. It creates the
declaration className& wxGetApp(void).Example:
DECLARE_APP(MyApp)
Include files<wx/app.h>DECLARE_CLASSDECLARE_CLASSDECLARE_CLASS(className)Used inside a class declaration to declare that the class should
be made known to the class hierarchy, but objects of this class
cannot be created dynamically. The same as
DECLARE_ABSTRACT_CLASS.Include files<wx/object.h>DECLARE_DYNAMIC_CLASSDECLARE_DYNAMIC_CLASSDECLARE_DYNAMIC_CLASS(className)Used inside a class declaration to make the class known to
wxWidgets RTTI system and also declare that the objects of this
class should be dynamically creatable from run-time type
information. Notice that this implies that the class should have a
default constructor, if this is not the case consider using
???.Example:
class wxFrame: public wxWindow
{
DECLARE_DYNAMIC_CLASS(wxFrame)
private:
const wxString& frameTitle;
public:
...
};
Include files<wx/object.h>IMPLEMENT_ABSTRACT_CLASSIMPLEMENT_ABSTRACT_CLASSIMPLEMENT_ABSTRACT_CLASS(className, baseClassName)Used in a C++ implementation file to complete the declaration of
a class that has run-time type information. The same as
IMPLEMENT_CLASS.Example:
IMPLEMENT_ABSTRACT_CLASS(wxCommand, wxObject)
wxCommand::wxCommand(void)
{
...
}
Include files<wx/object.h>IMPLEMENT_ABSTRACT_CLASS2IMPLEMENT_ABSTRACT_CLASS2IMPLEMENT_ABSTRACT_CLASS2(className, baseClassName1,
baseClassName2)Used in a C++ implementation file to complete the declaration of
a class that has run-time type information and two base classes.
The same as IMPLEMENT_CLASS2.Include files<wx/object.h>IMPLEMENT_APPIMPLEMENT_APPIMPLEMENT_APP(className)This is used in the application class implementation file to
make the application class known to wxWidgets for dynamic
construction. You use this instead ofOld form:
MyApp myApp;
New form:
IMPLEMENT_APP(MyApp)
See also ???.Include files<wx/app.h>IMPLEMENT_CLASSIMPLEMENT_CLASSIMPLEMENT_CLASS(className, baseClassName)Used in a C++ implementation file to complete the declaration of
a class that has run-time type information. The same as
IMPLEMENT_ABSTRACT_CLASS.Include files<wx/object.h>IMPLEMENT_CLASS2IMPLEMENT_CLASS2IMPLEMENT_CLASS2(className, baseClassName1,
baseClassName2)Used in a C++ implementation file to complete the declaration of
a class that has run-time type information and two base classes.
The same as IMPLEMENT_ABSTRACT_CLASS2.Include files<wx/object.h>IMPLEMENT_DYNAMIC_CLASSIMPLEMENT_DYNAMIC_CLASSIMPLEMENT_DYNAMIC_CLASS(className, baseClassName)Used in a C++ implementation file to complete the declaration of
a class that has run-time type information, and whose instances can
be created dynamically.Example:
IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
wxFrame::wxFrame(void)
{
...
}
Include files<wx/object.h>IMPLEMENT_DYNAMIC_CLASS2IMPLEMENT_DYNAMIC_CLASS2IMPLEMENT_DYNAMIC_CLASS2(className, baseClassName1,
baseClassName2)Used in a C++ implementation file to complete the declaration of
a class that has run-time type information, and whose instances can
be created dynamically. Use this for classes derived from two base
classes.Include files<wx/object.h>wxConstCastwxConstCastclassname *wxConstCast(ptr, classname)This macro expands into const_cast<classname
*>(ptr) if the compiler supports const_cast or into
an old, C-style cast, otherwise.See also?????????::wxCreateDynamicObject::wxCreateDynamicObjectwxObject *wxCreateDynamicObject(const
wxString&className)Creates and returns an object of the given class, if the class
has been registered with the dynamic class system using DECLARE...
and IMPLEMENT... macros.WXDEBUG_NEWWXDEBUG_NEWWXDEBUG_NEW(arg)This is defined in debug mode to be call the redefined new
operator with filename and line number arguments. The definition
is:
#define WXDEBUG_NEW new(__FILE__,__LINE__)
In non-debug mode, this is defined as the normal new
operator.Include files<wx/object.h>wxDynamicCastwxDynamicCastclassname *wxDynamicCast(ptr, classname)This macro returns the pointer ptr cast to the type
classname * if the pointer is of this type (the check is
done during the run-time) or NULL otherwise. Usage of this
macro is preferred over obsoleted wxObject::IsKindOf()
function.The ptr argument may be NULL, in which case
NULL will be returned.Example:
wxWindow *win = wxWindow::FindFocus();
wxTextCtrl *text = wxDynamicCast(win, wxTextCtrl);
if ( text )
{
// a text control has the focus...
}
else
{
// no window has the focus or it is not a text control
}
See alsothe section called “Runtime class information (aka RTTI) overview”?????????wxDynamicCastThiswxDynamicCastThisclassname *wxDynamicCastThis(classname)This macro is equivalent to wxDynamicCast(this,
classname) but the latter provokes spurious compilation
warnings from some compilers (because it tests whether
this pointer is non NULL which is always true),
so this macro should be used to avoid them.See also???wxStaticCastwxStaticCastclassname *wxStaticCast(ptr, classname)This macro checks that the cast is valid in debug mode (an
assert failure will result if wxDynamicCast(ptr, classname) ==
NULL) and then returns the result of executing an equivalent
of static_cast<classname *>(ptr).See also?????????wx_const_castwx_const_castTwx_const_cast(T, x)Same as const_cast<T>(x) if the compiler supports
const cast or (T)x for old compilers. Unlike ???, the cast it to
the type T and not to T * and also the order of
arguments is the same as for the standard cast.See also???,???wx_reinterpret_castwx_reinterpret_castTwx_reinterpret_cast(T, x)Same as reinterpret_cast<T>(x) if the compiler
supports reinterpret cast or (T)x for old compilers.See also???,???wx_static_castwx_static_castTwx_static_cast(T, x)Same as static_cast<T>(x) if the compiler
supports static cast or (T)x for old compilers. Unlike
???, there
are no checks being done and the meaning of the macro arguments is
exactly the same as for the standard static cast, i.e. T is
the full type name and star is not appended to it.See also???,???Log functionsLog functionsThese functions provide a variety of logging functions: see
??? for further information. The functions use
(implicitly) the currently active log target, so their descriptions
here may not apply if the log target is not the standard one
(installed by wxWidgets in the beginning of the program).Include files<wx/log.h>?????????????????????????????????????????????????????????voidwxDebugMsg(const wxString&fmt, ...)NB: This function is now obsolete, replaced by the section called “Log functions” and ??? in particular.Display a debugging message; under Windows, this will appear on
the debugger command window, and under Unix, it will be written to
standard error.The syntax is identical to printf: pass a format string
and a variable list of arguments.Tip: under Windows, if your application crashes before
the message appears in the debugging window, put a wxYield call
after each wxDebugMsg call. wxDebugMsg seems to be broken under
WIN32s (at least for Watcom C++): preformat your messages and use
OutputDebugString instead.Include files<wx/utils.h>::wxError::wxErrorvoidwxError(const wxString&msg, const wxString&title = "wxWidgets
Internal Error")NB: This function is now obsolete, please use ??? instead.Displays msg and continues. This writes to standard error
under Unix, and pops up a message box under Windows. Used for
internal wxWidgets errors. See also ???.Include files<wx/utils.h>::wxFatalError::wxFatalErrorvoidwxFatalError(const wxString&msg, const wxString&title = "wxWidgets Fatal
Error")NB: This function is now obsolete, please use ???
instead.Displays msg and exits. This writes to standard error
under Unix, and pops up a message box under Windows. Used for fatal
internal wxWidgets errors. See also ???.Include files<wx/utils.h>::wxLogError::wxLogErrorvoidwxLogError(const char
*formatString, ...)voidwxVLogError(const char
*formatString, va_listargPtr)The functions to use for error messages, i.e. the messages that
must be shown to the user. The default processing is to pop up a
message box to inform the user about it.::wxLogFatalError::wxLogFatalErrorvoidwxLogFatalError(const char
*formatString, ...)voidwxVLogFatalError(const char
*formatString, va_listargPtr)Like ???,
but also terminates the program with the exit code 3. Using
abort() standard function also terminates the program with
this exit code.::wxLogWarning::wxLogWarningvoidwxLogWarning(const char
*formatString, ...)voidwxVLogWarning(const char
*formatString, va_listargPtr)For warnings - they are also normally shown to the user, but
don't interrupt the program work.::wxLogMessage::wxLogMessagevoidwxLogMessage(const char
*formatString, ...)voidwxVLogMessage(const char
*formatString, va_listargPtr)For all normal, informational messages. They also appear in a
message box by default (but it can be changed).::wxLogVerbose::wxLogVerbosevoidwxLogVerbose(const char
*formatString, ...)voidwxVLogVerbose(const char
*formatString, va_listargPtr)For verbose output. Normally, it is suppressed, but might be
activated if the user wishes to know more details about the program
progress (another, but possibly confusing name for the same
function is wxLogInfo).::wxLogStatus::wxLogStatusvoidwxLogStatus(wxFrame *frame,
const char *formatString, ...)voidwxVLogStatus(wxFrame *frame,
const char *formatString, va_listargPtr)voidwxLogStatus(const char
*formatString, ...)voidwxVLogStatus(const char
*formatString, va_listargPtr)Messages logged by these functions will appear in the statusbar
of the frame or of the top level application window by
default (i.e. when using the second version of the functions).If the target frame doesn't have a statusbar, the message will
be lost.::wxLogSysError::wxLogSysErrorvoidwxLogSysError(const char
*formatString, ...)voidwxVLogSysError(const char
*formatString, va_listargPtr)Mostly used by wxWidgets itself, but might be handy for logging
errors after system call (API function) failure. It logs the
specified message text as well as the last system error code
(errno or ::GetLastError() depending on the platform)
and the corresponding error message. The second form of this
function takes the error code explicitly as the first argument.See also???, ???::wxLogDebug::wxLogDebugvoidwxLogDebug(const char
*formatString, ...)voidwxVLogDebug(const char
*formatString, va_listargPtr)The right functions for debug output. They only do something in
debug mode (when the preprocessor symbol __WXDEBUG__ is defined)
and expand to nothing in release mode (otherwise).::wxLogTrace::wxLogTracevoidwxLogTrace(const char
*formatString, ...)voidwxVLogTrace(const char
*formatString, va_listargPtr)voidwxLogTrace(const char *mask,
const char *formatString, ...)voidwxVLogTrace(const char *mask,
const char *formatString, va_listargPtr)voidwxLogTrace(wxTraceMaskmask,
const char *formatString, ...)voidwxVLogTrace(wxTraceMaskmask,
const char *formatString, va_listargPtr)As wxLogDebug, trace functions only do something in debug
build and expand to nothing in the release one. The reason for
making it a separate function from it is that usually there are a
lot of trace messages, so it might make sense to separate them from
other debug messages.The trace messages also usually can be separated into different
categories and the second and third versions of this function only
log the message if the mask which it has is currently
enabled in ???. This allows to
selectively trace only some operations and not others by changing
the value of the trace mask (possible during the run-time).For the second function (taking a string mask), the message is
logged only if the mask has been previously enabled by the call to
??? or by
setting ???. The predefined string trace masks used by
wxWidgets are:•wxTRACE_MemAlloc: trace memory allocation (new/delete)•wxTRACE_Messages: trace window messages/X callbacks•wxTRACE_ResAlloc: trace GDI resource allocation•wxTRACE_RefCount: trace various ref counting operations•wxTRACE_OleCalls: trace OLE method calls (Win32 only)Caveats: since both the mask and the format string are
strings, this might lead to function signature confusion in some
cases: if you intend to call the format string only version of
wxLogTrace, then add a %s format string parameter and then supply a
second string parameter for that %s, the string mask version of
wxLogTrace will erroneously get called instead, since you are
supplying two string parameters to the function. In this case
you'll unfortunately have to avoid having two leading string
parameters, e.g. by adding a bogus integer (with its %d format
string).The third version of the function only logs the message if all
the bits corresponding to the mask are set in the wxLog
trace mask which can be set by ???. This version is
less flexible than the previous one because it doesn't allow
defining the user trace masks easily - this is why it is deprecated
in favour of using string trace masks.•wxTraceMemAlloc: trace memory allocation (new/delete)•wxTraceMessages: trace window messages/X callbacks•wxTraceResAlloc: trace GDI resource allocation•wxTraceRefCount: trace various ref counting operations•wxTraceOleCalls: trace OLE method calls (Win32 only)::wxSafeShowMessage::wxSafeShowMessagevoidwxSafeShowMessage(const wxString&title, const wxString&text)This function shows a message to the user in a safe way and
should be safe to call even before the application has been
initialized or if it is currently in some other strange state (for
example, about to crash). Under Windows this function shows a
message box using a native dialog instead of ??? (which
might be unsafe to call), elsewhere it simply prints the message to
the standard output using the title as prefix.ParameterstitleThe title of the message box shown to
the user or the prefix of the message stringtextThe text to show to the userSee also???Include files<wx/log.h>::wxSysErrorCode::wxSysErrorCodeunsigned longwxSysErrorCode()Returns the error code from the last system call. This function
uses errno on Unix platforms and GetLastError
under Win32.See also???,
???::wxSysErrorMsg::wxSysErrorMsgconst wxChar *wxSysErrorMsg(unsigned longerrCode = 0)Returns the error message corresponding to the given system
error code. If errCode is 0 (default), the last error code
(as returned by ???) is
used.See also???, ???WXTRACEWXTRACEInclude files<wx/object.h>WXTRACE(formatString, ...)NB: This macro is now obsolete, replaced by the section called “Log functions”.Calls wxTrace with printf-style variable argument syntax. Output
is directed to the current output stream (see ???).Include files<wx/memory.h>WXTRACELEVELWXTRACELEVELWXTRACELEVEL(level, formatString, ...)NB: This function is now obsolete, replaced by the section called “Log functions”.Calls wxTraceLevel with printf-style variable argument syntax.
Output is directed to the current output stream (see ???).
The first argument should be the level at which this information is
appropriate. It will only be output if the level returned by
wxDebugContext::GetLevel is equal to or greater than this
value.Include files<wx/memory.h>::wxTrace::wxTracevoidwxTrace(const wxString&fmt, ...)NB: This function is now obsolete, replaced by the section called “Log functions”.Takes printf-style variable argument syntax. Output is directed
to the current output stream (see ???).Include files<wx/memory.h>::wxTraceLevel::wxTraceLevelvoidwxTraceLevel(intlevel,
const wxString&fmt, ...)NB: This function is now obsolete, replaced by the section called “Log functions”.Takes printf-style variable argument syntax. Output is directed
to the current output stream (see ???).
The first argument should be the level at which this information is
appropriate. It will only be output if the level returned by
wxDebugContext::GetLevel is equal to or greater than this
value.Include files<wx/memory.h>Time functionsTime functionsThe functions in this section deal with getting the current time
and starting/stopping the global timers. Please note that the timer
functions are deprecated because they work with one global timer
only and ??? and/or
??? classes
should be used instead. For retrieving the current time, you may
also use ??? or ???
methods.??????????????????????????????longwxGetElapsedTime(boolresetTimer =
true)Gets the time in milliseconds since the last ???.If resetTimer is true (the default), the timer is reset
to zero by this call.See also ???.Include files<wx/timer.h>::wxGetLocalTime::wxGetLocalTimelongwxGetLocalTime()Returns the number of seconds since local time 00:00:00 Jan 1st
1970.See also???Include files<wx/timer.h>::wxGetLocalTimeMillis::wxGetLocalTimeMilliswxLongLongwxGetLocalTimeMillis()Returns the number of milliseconds since local time 00:00:00 Jan
1st 1970.See also???,???Include files<wx/timer.h>::wxGetUTCTime::wxGetUTCTimelongwxGetUTCTime()Returns the number of seconds since GMT 00:00:00 Jan 1st
1970.See also???Include files<wx/timer.h>::wxMicroSleep::wxMicroSleepvoidwxMicroSleep(unsigned longmicroseconds)Sleeps for the specified number of microseconds. The microsecond
resolution may not, in fact, be available on all platforms
(currently only Unix platforms with nanosleep(2) may provide it) in
which case this is the same as ???(microseconds/1000).Include files<wx/utils.h>::wxMilliSleep::wxMilliSleepvoidwxMilliSleep(unsigned longmilliseconds)Sleeps for the specified number of milliseconds. Notice that
usage of this function is encouraged instead of calling usleep(3)
directly because the standard usleep() function is not MT safe.Include files<wx/utils.h>::wxNow::wxNowwxStringwxNow()Returns a string representing the current date and time.Include files<wx/utils.h>::wxSleep::wxSleepvoidwxSleep(intsecs)Sleeps for the specified number of seconds.Include files<wx/utils.h>::wxStartTimer::wxStartTimervoidwxStartTimer()Starts a stopwatch; use ??? to
get the elapsed time.See also ???.Include files<wx/timer.h>::wxUsleep::wxUsleepvoidwxUsleep(unsigned longmilliseconds)This function is deprecated because its name is misleading:
notice that the argument is in milliseconds, not microseconds.
Please use either ??? or ??? depending on
the resolution you need.Debugging macros and functionsDebugging macros and functionsUseful macros and functions for error checking and defensive
programming. wxWidgets defines three families of the assert-like
macros: the wxASSERT and wxFAIL macros only do anything if
__WXDEBUG__ is defined (in other words, in the debug build) but
disappear completely in the release build. On the other hand, the
wxCHECK macros stay event in release builds but a check failure
doesn't generate any user-visible effects then. Finally, the
compile time assertions don't happen during the run-time but result
in the compilation error messages if the condition they check
fail.Include files<wx/debug.h>?????????????????????????????????????????????voidwxOnAssert(const char
*fileName, intlineNumber, const char
*cond, const char *msg = NULL)This function is called whenever one of debugging macros fails
(i.e. condition is false in an assertion). It is only defined in
the debug mode, in release builds the ??? failures don't result in
anything.To override the default behaviour in the debug builds which is
to show the user a dialog asking whether he wants to abort the
program, continue or continue ignoring any subsequent assert
failures, you may override ??? which is called
by this function if the global application object exists.wxASSERTwxASSERTwxASSERT(condition)Assert macro. An error message will be generated if the
condition is false in debug mode, but nothing will be done in the
release build.Please note that the condition in wxASSERT() should have no side
effects because it will not be executed in release mode at all.See also???,???wxASSERT_MIN_BITSIZEwxASSERT_MIN_BITSIZEwxASSERT_MIN_BITSIZE(type, size)This macro results in a ??? if the size of the given type type is less than
size bits.You may use it like this, for example:
// we rely on the int being able to hold values up to 2^32
wxASSERT_MIN_BITSIZE(int, 32);
// can't work with the platforms using UTF-8 for wchar_t
wxASSERT_MIN_BITSIZE(wchar_t, 16);
wxASSERT_MSGwxASSERT_MSGwxASSERT_MSG(condition, msg)Assert macro with message. An error message will be generated if
the condition is false.See also???,???wxCOMPILE_TIME_ASSERTwxCOMPILE_TIME_ASSERTwxCOMPILE_TIME_ASSERT(condition, msg)Using wxCOMPILE_TIME_ASSERT results in a compilation
error if the specified condition is false. The compiler
error message should include the msg identifier - please
note that it must be a valid C++ identifier and not a string unlike
in the other cases.This macro is mostly useful for testing the expressions
involving the sizeof operator as they can't be tested by
the preprocessor but it is sometimes desirable to test them at the
compile time.Note that this macro internally declares a struct whose name it
tries to make unique by using the __LINE__ in it but it
may still not work if you use it on the same line in two different
source files. In this case you may either change the line in which
either of them appears on or use the ???
macro.Also note that Microsoft Visual C++ has a bug which results in
compiler errors if you use this macro with 'Program Database For
Edit And Continue' (/ZI) option, so you shouldn't use it
('Program Database' (/Zi) is ok though) for the code
making use of this macro.See also???,???wxCOMPILE_TIME_ASSERT2wxCOMPILE_TIME_ASSERT2wxCOMPILE_TIME_ASSERT(condition, msg,
name)This macro is identical to ???
except that it allows you to specify a unique name for the
struct internally defined by this macro to avoid getting the
compilation errors described ???.wxFAILwxFAILwxFAIL()Will always generate an assert error if this code is reached (in
debug mode).See also: ???wxFAIL_MSGwxFAIL_MSGwxFAIL_MSG(msg)Will always generate an assert error with specified message if
this code is reached (in debug mode).This macro is useful for marking unreachable" code areas, for
example it may be used in the "default:" branch of a switch
statement if all possible cases are processed above.See also???wxCHECKwxCHECKwxCHECK(condition, retValue)Checks that the condition is true, returns with the given return
value if not (FAILs in debug mode). This check is done even in
release mode.wxCHECK_MSGwxCHECK_MSGwxCHECK_MSG(condition, retValue,
msg)Checks that the condition is true, returns with the given return
value if not (FAILs in debug mode). This check is done even in
release mode.This macro may be only used in non void functions, see also
???.wxCHECK_RETwxCHECK_RETwxCHECK_RET(condition, msg)Checks that the condition is true, and returns if not (FAILs
with given error message in debug mode). This check is done even in
release mode.This macro should be used in void functions instead of ???.wxCHECK2wxCHECK2wxCHECK2(condition, operation)Checks that the condition is true and ??? and execute
operation if it is not. This is a generalisation of ??? and may be used when
something else than just returning from the function must be done
when the condition is false.This check is done even in release mode.wxCHECK2_MSGwxCHECK2_MSGwxCHECK2(condition, operation,
msg)This is the same as ???, but ??? with the specified
msg is called instead of wxFAIL() if the condition is
false.::wxTrap::wxTrapvoidwxTrap()In debug mode (when __WXDEBUG__ is defined) this
function generates a debugger exception meaning that the control is
passed to the debugger if one is attached to the process. Otherwise
the program just terminates abnormally.In release mode this function does nothing.Include files<wx/debug.h>::wxIsDebuggerRunning::wxIsDebuggerRunningboolwxIsDebuggerRunning()Returns true if the program is running under debugger,
false otherwise.Please note that this function is currently only implemented for
Win32 and Mac builds using CodeWarrior and always returns
false elsewhere.Environment access functionsEnvironment access functionsThe functions in this section allow to access (get) or change
value of environment variables in a portable way. They are
currently implemented under Win32 and POSIX-like systems
(Unix).Include files<wx/utils.h>????????????wxChar *wxGetEnv(const wxString&var)This is a macro defined as getenv() or its wide char
version in Unicode mode.Note that under Win32 it may not return correct value for the
variables set with ???, use ??? function
instead.wxGetEnvwxGetEnvboolwxGetEnv(const wxString&var, wxString *value)Returns the current value of the environment variable var
in value. value may be NULL if you just want
to know if the variable exists and are not interested in its
value.Returns true if the variable exists, false
otherwise.wxSetEnvwxSetEnvboolwxSetEnv(const wxString&var, const wxChar *value)Sets the value of the environment variable var (adding it
if necessary) to value.Returns true on success.wxUnsetEnvwxUnsetEnvboolwxUnsetEnv(const wxString&var)Removes the variable var from the environment. ??? will return
NULL after the call to this function.Returns true on success.ConstantsConstantsChapter 8. ConstantsThis chapter describes the constants defined by wxWidgets.the section called “Preprocesser symbols defined by wxWidgets”the section called “Standard event identifiers”the section called “Keycodes”the section called “Language identifiers”the section called “Stock items”Preprocesser symbols defined by wxWidgetsPreprocesser symbols defined by wxWidgetsThese are preprocessor symbols used in the wxWidgets source,
grouped by category (and sorted by alphabetical order inside each
category). All of these macros except for the wxUSE_XXX
variety is defined if the corresponding condition is true and
undefined if it isn't, so they should be always tested using
ifdef and not if.??????????????????__WINDOWS__any Windows, yom may also use __WXMSW____WIN16__Win16 API (not supported since wxWidgets 2.6)__WIN32__Win32 API__WIN95__Windows 95 or NT 4.0 and above system (not NT
3.5x)__WXBASE__Only wxBase, no GUI features (same as
wxUSE_GUI == 0)__WXCOCOA__OS X using Cocoa API__WXWINCE__Windows CE__WXGTK__GTK+__WXGTK12__GTK+ 1.2 or higher__WXGTK20__GTK+ 2.0 or higher__WXMOTIF__Motif__WXMOTIF20__Motif 2.0 or higher__WXMAC__Mac OS all targets__WXMAC_CLASSIC__MacOS for Classic__WXMAC_CARBON__MacOS for Carbon CFM (running under Classic or
OSX) or true OS X Mach-O Builds__WXMAC_OSX__MacOS X Carbon Mach-O Builds__WXMGL__SciTech Soft MGL (__WXUNIVERSAL__ will be also
defined)__WXMSW__Any Windows__WXOS2__Identical to __WXPM____WXOSX__Any Mac OS X port (either Carbon or Cocoa)__WXPALMOS__PalmOS__WXPM__OS/2 native Presentation Manager__WXSTUBS__Stubbed version ('template' wxWin
implementation)__WXXT__Xt; mutually exclusive with WX_MOTIF, not
implemented in wxWidgets 2.x__WXX11__wxX11 (__WXUNIVERSAL__ will be also defined)__WXWINE__WINE (i.e. WIN32 on Unix)__WXUNIVERSAL__wxUniversal port, always defined in addition to
one of the symbols above so this should be tested first.__X__any X11-based GUI toolkit except GTK+There are two wxWidgets ports to Mac OS. One of them, wxMac,
exists in two versions: Classic and Carbon. The Classic version is
the only one to work on Mac OS version 8. The Carbon version may be
built either as CFM or Mach-O (binary format, like ELF) and the
former may run under OS 9 while the latter only runs under OS X.
Finally, there is a new Cocoa port which can only be used under OS
X. To summarize:•If you want to test for all Mac platforms, classic and OS X,
you should test both __WXMAC__ and
__WXCOCOA__.•If you want to test for any GUI Mac port under OS X, use
__WXOSX__.•If you want to test for any port under Mac OS X, including, for
example, wxGTK and also wxBase, use __DARWIN__ (see
below).The convention is to use the __WX prefix for these
symbols, although this has not always been followed.Operating systemsOperating systems__APPLE__any Mac OS version__AIX__AIX__BSD__Any *BSD system__CYGWIN__Cygwin: Unix on Win32__DARWIN__Mac OS X using the BSD Unix C library (as opposed
to using the Metrowerks MSL C/C++ library)__DATA_GENERAL__DG-UX__DOS_GENERAL__DOS (used with wxMGL only)__FREEBSD__FreeBSD__HPUX__HP-UX (Unix)__GNU__GNU Hurd__LINUX__Linux__MACH__Mach-O Architecture (Mac OS X only builds)__OSF__OSF/1__PALMOS__PalmOS__SGI__IRIX__SOLARIS__Solaris__SUN__Any Sun__SUNOS__Sun OS__SVR4__SystemV R4__SYSV__SystemV generic__ULTRIX__Ultrix__UNIX__any Unix__UNIX_LIKE__Unix, BeOS or VMS__VMS__VMS__WINDOWS__any WindowsHardware architectures (CPU)Hardware architectures (CPU)Note that not all of these symbols are always defined, it
depends on the compiler used.__ALPHA__DEC Alpha architecture__INTEL__Intel i386 or compatible__IA64__Intel 64 bit architecture__POWERPC__Motorola Power PCHardware typeHardware type__SMARTPHONE__Generic mobile devices with phone buttons and a
small display__PDA__Personal digital assistant, usually with touch
screen__HANDHELD__Small but powerful computer, usually with a
keyboard__POCKETPC__Microsoft-powered PocketPC devices with
touch-screen__WINCE_STANDARDSDK__Microsoft-powered Windows CE devices, for generic
Windows CE applications__WINCE_NET__Microsoft-powered Windows CE .NET devices
(_WIN32_WCE is 400 or greater)WIN32_PLATFORM_WFSPMicrosoft-powered smartphoneCompilersCompilers__BORLANDC__Borland C++. The value of the macro corresponds to
the compiler version: 500 is 5.0.__DJGPP__DJGPP__DIGITALMARS__Digital Mars__GNUG__Gnu C++ on any platform, see also ???__GNUWIN32__Gnu-Win32 compiler, see also ???__MINGW32__MinGW__MWERKS__CodeWarrior MetroWerks compiler__SUNCC__Sun CC__SYMANTECC__Symantec C++__VISAGECPP__IBM Visual Age (OS/2)__VISUALC__Microsoft Visual C++. The value of this macro
corresponds to the compiler version: 1020 for 4.2 (the first
supported version), 1100 for 5.0, 1200 for 6.0 and so on__XLC__AIX compiler__WATCOMC__Watcom C++. The value of this macro corresponds to
the compiler version, 1100 is 11.0 and 1200 is OpenWatcom._WIN32_WCEWindows CE versionMiscellaneousMiscellaneous__WXWINDOWS__always defined in wxWidgets applications, see also
???__WXDEBUG__defined in debug mode, undefined in release
modewxUSE_XXXif defined as 1, feature XXX is active (the
symbols of this form are always defined, use #if and not #ifdef to
test for them)WX_PRECOMPis defined if precompiled headers (PCH) are in
use. In this case, wx/wxprec.h includes wx/wx.h
which, in turn, includes a number of wxWidgets headers thus making
it unnecessary to include them explicitly. However if this is not
defined, you do need to include them and so the usual idiom which
allows to support both cases is to first include
wx/wxprec.h and then, inside ifndef WX_PRECOMP,
individual headers you need._UNICODE and UNICODEboth are defined if wxUSE_UNICODE is set to 1wxUSE_GUIthis particular feature test macro is defined to 1
when compiling or using the library with the GUI features
activated, if it is defined as 0, only wxBase is available.wxUSE_BASEonly used by wxWidgets internally (defined as 1
when building wxBase code, either as a standalone library or as
part of the monolithic wxWidgets library, defined as 0 when
building GUI library only)wxNO_RTTIis defined if the compiler RTTI support has been
switched offwxNO_EXCEPTIONSis defined if the compiler support for C++
exceptions has been switched offwxNO_THREADSif this macro is defined, the compilation options
don't include compiler flags needed for multithreaded code
generation. This implies that wxUSE_THREADS is 0 and also that
other (non wx-based) threading packages cannot be used
neither.Standard event identifiersStandard event identifierswxWidgets defines a special identifier value wxID_ANY
which is used in the following two situations:•when creating a new window you may specify wxID_ANY to
let wxWidgets assign an unused identifier to it automatically•when installing an event handler using either the event table
macros or ???,
you may use it to indicate that you want to handle the events
coming from any control, regardless of its identifierAnother standard special identifier value is wxID_NONE:
this is a value which is not matched by any other id.wxWidgets also defines a few standard command identifiers which
may be used by the user code and also are sometimes used by
wxWidgets itself. These reserved identifiers are all in the range
between wxID_LOWEST and wxID_HIGHEST and,
accordingly, the user code should avoid defining its own constants
in this range.
wxID_LOWEST = 4999,
wxID_OPEN,
wxID_CLOSE,
wxID_NEW,
wxID_SAVE,
wxID_SAVEAS,
wxID_REVERT,
wxID_EXIT,
wxID_UNDO,
wxID_REDO,
wxID_HELP,
wxID_PRINT,
wxID_PRINT_SETUP,
wxID_PREVIEW,
wxID_ABOUT,
wxID_HELP_CONTENTS,
wxID_HELP_COMMANDS,
wxID_HELP_PROCEDURES,
wxID_HELP_CONTEXT,
wxID_CLOSE_ALL,
wxID_CUT = 5030,
wxID_COPY,
wxID_PASTE,
wxID_CLEAR,
wxID_FIND,
wxID_DUPLICATE,
wxID_SELECTALL,
wxID_DELETE,
wxID_REPLACE,
wxID_REPLACE_ALL,
wxID_PROPERTIES,
wxID_VIEW_DETAILS,
wxID_VIEW_LARGEICONS,
wxID_VIEW_SMALLICONS,
wxID_VIEW_LIST,
wxID_VIEW_SORTDATE,
wxID_VIEW_SORTNAME,
wxID_VIEW_SORTSIZE,
wxID_VIEW_SORTTYPE,
wxID_FILE1 = 5050,
wxID_FILE2,
wxID_FILE3,
wxID_FILE4,
wxID_FILE5,
wxID_FILE6,
wxID_FILE7,
wxID_FILE8,
wxID_FILE9,
// Standard button IDs
wxID_OK = 5100,
wxID_CANCEL,
wxID_APPLY,
wxID_YES,
wxID_NO,
wxID_STATIC,
wxID_FORWARD,
wxID_BACKWARD,
wxID_DEFAULT,
wxID_MORE,
wxID_SETUP,
wxID_RESET,
wxID_CONTEXT_HELP,
wxID_YESTOALL,
wxID_NOTOALL,
wxID_ABORT,
wxID_RETRY,
wxID_IGNORE,
wxID_UP,
wxID_DOWN,
wxID_HOME,
wxID_REFRESH,
wxID_STOP,
wxID_INDEX,
wxID_BOLD,
wxID_ITALIC,
wxID_JUSTIFY_CENTER,
wxID_JUSTIFY_FILL,
wxID_JUSTIFY_RIGHT,
wxID_JUSTIFY_LEFT,
wxID_UNDERLINE,
wxID_INDENT,
wxID_UNINDENT,
wxID_ZOOM_100,
wxID_ZOOM_FIT,
wxID_ZOOM_IN,
wxID_ZOOM_OUT,
wxID_UNDELETE,
wxID_REVERT_TO_SAVED,
// System menu IDs (used by wxUniv):
wxID_SYSTEM_MENU = 5200,
wxID_CLOSE_FRAME,
wxID_MOVE_FRAME,
wxID_RESIZE_FRAME,
wxID_MAXIMIZE_FRAME,
wxID_ICONIZE_FRAME,
wxID_RESTORE_FRAME,
// IDs used by generic file dialog (13 consecutive starting from this value)
wxID_FILEDLGG = 5900,
wxID_HIGHEST = 5999
KeycodesKeycodesKeypresses are represented by an enumerated type, wxKeyCode. The
possible values are the ASCII character codes, plus the
following: WXK_BACK = 8
WXK_TAB = 9
WXK_RETURN = 13
WXK_ESCAPE = 27
WXK_SPACE = 32
WXK_DELETE = 127
WXK_START = 300
WXK_LBUTTON
WXK_RBUTTON
WXK_CANCEL
WXK_MBUTTON
WXK_CLEAR
WXK_SHIFT
WXK_CONTROL
WXK_MENU
WXK_PAUSE
WXK_CAPITAL
WXK_PRIOR
WXK_NEXT
WXK_END
WXK_HOME
WXK_LEFT
WXK_UP
WXK_RIGHT
WXK_DOWN
WXK_SELECT
WXK_PRINT
WXK_EXECUTE
WXK_SNAPSHOT
WXK_INSERT
WXK_HELP
WXK_NUMPAD0
WXK_NUMPAD1
WXK_NUMPAD2
WXK_NUMPAD3
WXK_NUMPAD4
WXK_NUMPAD5
WXK_NUMPAD6
WXK_NUMPAD7
WXK_NUMPAD8
WXK_NUMPAD9
WXK_MULTIPLY
WXK_ADD
WXK_SEPARATOR
WXK_SUBTRACT
WXK_DECIMAL
WXK_DIVIDE
WXK_F1
WXK_F2
WXK_F3
WXK_F4
WXK_F5
WXK_F6
WXK_F7
WXK_F8
WXK_F9
WXK_F10
WXK_F11
WXK_F12
WXK_F13
WXK_F14
WXK_F15
WXK_F16
WXK_F17
WXK_F18
WXK_F19
WXK_F20
WXK_F21
WXK_F22
WXK_F23
WXK_F24
WXK_NUMLOCK
WXK_SCROLL
WXK_PAGEUP,
WXK_PAGEDOWN,
WXK_NUMPAD_SPACE,
WXK_NUMPAD_TAB,
WXK_NUMPAD_ENTER,
WXK_NUMPAD_F1,
WXK_NUMPAD_F2,
WXK_NUMPAD_F3,
WXK_NUMPAD_F4,
WXK_NUMPAD_HOME,
WXK_NUMPAD_LEFT,
WXK_NUMPAD_UP,
WXK_NUMPAD_RIGHT,
WXK_NUMPAD_DOWN,
WXK_NUMPAD_PRIOR,
WXK_NUMPAD_PAGEUP,
WXK_NUMPAD_NEXT,
WXK_NUMPAD_PAGEDOWN,
WXK_NUMPAD_END,
WXK_NUMPAD_BEGIN,
WXK_NUMPAD_INSERT,
WXK_NUMPAD_DELETE,
WXK_NUMPAD_EQUAL,
WXK_NUMPAD_MULTIPLY,
WXK_NUMPAD_ADD,
WXK_NUMPAD_SEPARATOR,
WXK_NUMPAD_SUBTRACT,
WXK_NUMPAD_DECIMAL,
WXK_NUMPAD_DIVIDE,
// the following key codes are only generated under Windows currently
WXK_WINDOWS_LEFT,
WXK_WINDOWS_RIGHT,
WXK_WINDOWS_MENU,
WXK_COMMAND,
// Hardware-specific buttons
WXK_SPECIAL1 = 193,
WXK_SPECIAL2,
WXK_SPECIAL3,
WXK_SPECIAL4,
WXK_SPECIAL5,
WXK_SPECIAL6,
WXK_SPECIAL7,
WXK_SPECIAL8,
WXK_SPECIAL9,
WXK_SPECIAL10,
WXK_SPECIAL11,
WXK_SPECIAL12,
WXK_SPECIAL13,
WXK_SPECIAL14,
WXK_SPECIAL15,
WXK_SPECIAL16,
WXK_SPECIAL17,
WXK_SPECIAL18,
WXK_SPECIAL19,
WXK_SPECIAL20
Language identifiersLanguage identifiersThe following wxLanguage constants may be used to specify the
language in ??? and are returned
by ???:wxLANGUAGE_DEFAULTuser's default language as obtained from the
operating systemwxLANGUAGE_UNKNOWNreturned by ???
if it fails to detect the default languagewxLANGUAGE_USER_DEFINEDuser defined languages' integer identifiers should
start from thiswxLANGUAGE_ABKHAZIAN wxLANGUAGE_AFAR wxLANGUAGE_AFRIKAANS wxLANGUAGE_ALBANIAN wxLANGUAGE_AMHARIC wxLANGUAGE_ARABIC wxLANGUAGE_ARABIC_ALGERIA wxLANGUAGE_ARABIC_BAHRAIN wxLANGUAGE_ARABIC_EGYPT wxLANGUAGE_ARABIC_IRAQ wxLANGUAGE_ARABIC_JORDAN wxLANGUAGE_ARABIC_KUWAIT wxLANGUAGE_ARABIC_LEBANON wxLANGUAGE_ARABIC_LIBYA wxLANGUAGE_ARABIC_MOROCCO wxLANGUAGE_ARABIC_OMAN wxLANGUAGE_ARABIC_QATAR wxLANGUAGE_ARABIC_SAUDI_ARABIA wxLANGUAGE_ARABIC_SUDAN wxLANGUAGE_ARABIC_SYRIA wxLANGUAGE_ARABIC_TUNISIA wxLANGUAGE_ARABIC_UAE wxLANGUAGE_ARABIC_YEMEN wxLANGUAGE_ARMENIAN wxLANGUAGE_ASSAMESE wxLANGUAGE_AYMARA wxLANGUAGE_AZERI wxLANGUAGE_AZERI_CYRILLIC wxLANGUAGE_AZERI_LATIN wxLANGUAGE_BASHKIR wxLANGUAGE_BASQUE wxLANGUAGE_BELARUSIAN wxLANGUAGE_BENGALI wxLANGUAGE_BHUTANI wxLANGUAGE_BIHARI wxLANGUAGE_BISLAMA wxLANGUAGE_BRETON wxLANGUAGE_BULGARIAN wxLANGUAGE_BURMESE wxLANGUAGE_CAMBODIAN wxLANGUAGE_CATALAN wxLANGUAGE_CHINESE wxLANGUAGE_CHINESE_SIMPLIFIED wxLANGUAGE_CHINESE_TRADITIONAL wxLANGUAGE_CHINESE_HONGKONG wxLANGUAGE_CHINESE_MACAU wxLANGUAGE_CHINESE_SINGAPORE wxLANGUAGE_CHINESE_TAIWAN wxLANGUAGE_CORSICAN wxLANGUAGE_CROATIAN wxLANGUAGE_CZECH wxLANGUAGE_DANISH wxLANGUAGE_DUTCH wxLANGUAGE_DUTCH_BELGIAN wxLANGUAGE_ENGLISH wxLANGUAGE_ENGLISH_UK wxLANGUAGE_ENGLISH_US wxLANGUAGE_ENGLISH_AUSTRALIA wxLANGUAGE_ENGLISH_BELIZE wxLANGUAGE_ENGLISH_BOTSWANA wxLANGUAGE_ENGLISH_CANADA wxLANGUAGE_ENGLISH_CARIBBEAN wxLANGUAGE_ENGLISH_DENMARK wxLANGUAGE_ENGLISH_EIRE wxLANGUAGE_ENGLISH_JAMAICA wxLANGUAGE_ENGLISH_NEW_ZEALAND wxLANGUAGE_ENGLISH_PHILIPPINES wxLANGUAGE_ENGLISH_SOUTH_AFRICA wxLANGUAGE_ENGLISH_TRINIDAD wxLANGUAGE_ENGLISH_ZIMBABWE wxLANGUAGE_ESPERANTO wxLANGUAGE_ESTONIAN wxLANGUAGE_FAEROESE wxLANGUAGE_FARSI wxLANGUAGE_FIJI wxLANGUAGE_FINNISH wxLANGUAGE_FRENCH wxLANGUAGE_FRENCH_BELGIAN wxLANGUAGE_FRENCH_CANADIAN wxLANGUAGE_FRENCH_LUXEMBOURG wxLANGUAGE_FRENCH_MONACO wxLANGUAGE_FRENCH_SWISS wxLANGUAGE_FRISIAN wxLANGUAGE_GALICIAN wxLANGUAGE_GEORGIAN wxLANGUAGE_GERMAN wxLANGUAGE_GERMAN_AUSTRIAN wxLANGUAGE_GERMAN_BELGIUM wxLANGUAGE_GERMAN_LIECHTENSTEIN wxLANGUAGE_GERMAN_LUXEMBOURG wxLANGUAGE_GERMAN_SWISS wxLANGUAGE_GREEK wxLANGUAGE_GREENLANDIC wxLANGUAGE_GUARANI wxLANGUAGE_GUJARATI wxLANGUAGE_HAUSA wxLANGUAGE_HEBREW wxLANGUAGE_HINDI wxLANGUAGE_HUNGARIAN wxLANGUAGE_ICELANDIC wxLANGUAGE_INDONESIAN wxLANGUAGE_INTERLINGUA wxLANGUAGE_INTERLINGUE wxLANGUAGE_INUKTITUT wxLANGUAGE_INUPIAK wxLANGUAGE_IRISH wxLANGUAGE_ITALIAN wxLANGUAGE_ITALIAN_SWISS wxLANGUAGE_JAPANESE wxLANGUAGE_JAVANESE wxLANGUAGE_KANNADA wxLANGUAGE_KASHMIRI wxLANGUAGE_KASHMIRI_INDIA wxLANGUAGE_KAZAKH wxLANGUAGE_KERNEWEK wxLANGUAGE_KINYARWANDA wxLANGUAGE_KIRGHIZ wxLANGUAGE_KIRUNDI wxLANGUAGE_KONKANI wxLANGUAGE_KOREAN wxLANGUAGE_KURDISH wxLANGUAGE_LAOTHIAN wxLANGUAGE_LATIN wxLANGUAGE_LATVIAN wxLANGUAGE_LINGALA wxLANGUAGE_LITHUANIAN wxLANGUAGE_MACEDONIAN wxLANGUAGE_MALAGASY wxLANGUAGE_MALAY wxLANGUAGE_MALAYALAM wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM wxLANGUAGE_MALAY_MALAYSIA wxLANGUAGE_MALTESE wxLANGUAGE_MANIPURI wxLANGUAGE_MAORI wxLANGUAGE_MARATHI wxLANGUAGE_MOLDAVIAN wxLANGUAGE_MONGOLIAN wxLANGUAGE_NAURU wxLANGUAGE_NEPALI wxLANGUAGE_NEPALI_INDIA wxLANGUAGE_NORWEGIAN_BOKMAL wxLANGUAGE_NORWEGIAN_NYNORSK wxLANGUAGE_OCCITAN wxLANGUAGE_ORIYA wxLANGUAGE_OROMO wxLANGUAGE_PASHTO wxLANGUAGE_POLISH wxLANGUAGE_PORTUGUESE wxLANGUAGE_PORTUGUESE_BRAZILIAN wxLANGUAGE_PUNJABI wxLANGUAGE_QUECHUA wxLANGUAGE_RHAETO_ROMANCE wxLANGUAGE_ROMANIAN wxLANGUAGE_RUSSIAN wxLANGUAGE_RUSSIAN_UKRAINE wxLANGUAGE_SAMOAN wxLANGUAGE_SANGHO wxLANGUAGE_SANSKRIT wxLANGUAGE_SCOTS_GAELIC wxLANGUAGE_SERBIAN wxLANGUAGE_SERBIAN_CYRILLIC wxLANGUAGE_SERBIAN_LATIN wxLANGUAGE_SERBO_CROATIAN wxLANGUAGE_SESOTHO wxLANGUAGE_SETSWANA wxLANGUAGE_SHONA wxLANGUAGE_SINDHI wxLANGUAGE_SINHALESE wxLANGUAGE_SISWATI wxLANGUAGE_SLOVAK wxLANGUAGE_SLOVENIAN wxLANGUAGE_SOMALI wxLANGUAGE_SPANISH wxLANGUAGE_SPANISH_ARGENTINA wxLANGUAGE_SPANISH_BOLIVIA wxLANGUAGE_SPANISH_CHILE wxLANGUAGE_SPANISH_COLOMBIA wxLANGUAGE_SPANISH_COSTA_RICA wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC wxLANGUAGE_SPANISH_ECUADOR wxLANGUAGE_SPANISH_EL_SALVADOR wxLANGUAGE_SPANISH_GUATEMALA wxLANGUAGE_SPANISH_HONDURAS wxLANGUAGE_SPANISH_MEXICAN wxLANGUAGE_SPANISH_MODERN wxLANGUAGE_SPANISH_NICARAGUA wxLANGUAGE_SPANISH_PANAMA wxLANGUAGE_SPANISH_PARAGUAY wxLANGUAGE_SPANISH_PERU wxLANGUAGE_SPANISH_PUERTO_RICO wxLANGUAGE_SPANISH_URUGUAY wxLANGUAGE_SPANISH_US wxLANGUAGE_SPANISH_VENEZUELA wxLANGUAGE_SUNDANESE wxLANGUAGE_SWAHILI wxLANGUAGE_SWEDISH wxLANGUAGE_SWEDISH_FINLAND wxLANGUAGE_TAGALOG wxLANGUAGE_TAJIK wxLANGUAGE_TAMIL wxLANGUAGE_TATAR wxLANGUAGE_TELUGU wxLANGUAGE_THAI wxLANGUAGE_TIBETAN wxLANGUAGE_TIGRINYA wxLANGUAGE_TONGA wxLANGUAGE_TSONGA wxLANGUAGE_TURKISH wxLANGUAGE_TURKMEN wxLANGUAGE_TWI wxLANGUAGE_UIGHUR wxLANGUAGE_UKRAINIAN wxLANGUAGE_URDU wxLANGUAGE_URDU_INDIA wxLANGUAGE_URDU_PAKISTAN wxLANGUAGE_UZBEK wxLANGUAGE_UZBEK_CYRILLIC wxLANGUAGE_UZBEK_LATIN wxLANGUAGE_VIETNAMESE wxLANGUAGE_VOLAPUK wxLANGUAGE_WELSH wxLANGUAGE_WOLOF wxLANGUAGE_XHOSA wxLANGUAGE_YIDDISH wxLANGUAGE_YORUBA wxLANGUAGE_ZHUANG wxLANGUAGE_ZULU Stock itemsStock itemsWindow IDs for which stock buttons are created (see ???):wxID_ADD"Add"wxID_APPLY"&Apply"wxID_BOLD"&Bold"wxID_CANCEL"&Cancel"wxID_CLEAR"&Clear"wxID_CLOSE"&Close"wxID_COPY"&Copy"wxID_CUT"Cu&t"wxID_DELETE"&Delete"wxID_FIND"&Find"wxID_REPLACE"Find and rep&lace"wxID_BACKWARD"&Back"wxID_DOWN"&Down"wxID_FORWARD"&Forward"wxID_UP"&Up"wxID_HELP"&Help"wxID_HOME"&Home"wxID_INDENT"Indent"wxID_INDEX"&Index"wxID_ITALIC"&Italic"wxID_JUSTIFY_CENTER"Centered"wxID_JUSTIFY_FILL"Justified"wxID_JUSTIFY_LEFT"Align Left"wxID_JUSTIFY_RIGHT"Align Right"wxID_NEW"&New"wxID_NO"&No"wxID_OK"&OK"wxID_OPEN"&Open"wxID_PASTE"&Paste"wxID_PREFERENCES"&Preferences"wxID_PRINT"&Print"wxID_PREVIEW"Print previe&w"wxID_PROPERTIES"&Properties"wxID_EXIT"&Quit"wxID_REDO"&Redo"wxID_REFRESH"Refresh"wxID_REMOVE"Remove"wxID_REVERT_TO_SAVED"Revert to Saved"wxID_SAVE"&Save"wxID_SAVEAS"Save &As..."wxID_STOP"&Stop"wxID_UNDELETE"Undelete"wxID_UNDERLINE"&Underline"wxID_UNDO"&Undo"wxID_UNINDENT"&Unindent"wxID_YES"&Yes"wxID_ZOOM_100"&Actual Size"wxID_ZOOM_FIT"Zoom to &Fit"wxID_ZOOM_IN"Zoom &In"wxID_ZOOM_OUT"Zoom &Out"Classes by categoryClasses by categoryChapter 9. Classes by categoryA classification of wxWidgets classes by category.Managed windowsThere are several types of window that are directly controlled
by the window manager (such as MS Windows, or the Motif Window
Manager). Frames and dialogs are similar in wxWidgets, but only
dialogs may be modal.???Any top level window, dialog or frame???Dialog box???Normal frame???MDI child frame???MDI parent frame???A frame with a small title bar???Splash screen class???Property sheet dialog???Shows text in a small window???A wizard dialogSee also Common dialogs.Miscellaneous windowsThe following are a variety of classes that are derived from
wxWindow.???A window whose colour changes according to current
user settings???Window with automatically managed scrollbars???A grid (table) window???Window which can be split vertically or
horizontally???Implements the status bar on a frame???Toolbar class???Notebook class???Similar to notebook but using list control???Similar to notebook but using choice control???Window with four optional sashes that can be
dragged???Window that can be involved in an IDE-like layout
arrangement???As wxScrolledWindow but supports lines of variable
height???A base class for the page in wizard dialog.???A page in wizard dialog.Common dialogs???Common dialogs are ready-made dialog classes which are
frequently used in an application.???Base class for common dialogs???Colour chooser dialog???Directory selector dialog???File selector dialog???Text search/replace dialog???Dialog to get one or more selections from a
list???Dialog to get a single selection from a list and
return the string???Dialog to get a single line of text from the
user???Dialog to get a password from the user???Font chooser dialog???Standard page setup dialog???Standard print dialog???Progress indication dialog???Simple message box dialog???A wizard dialog.ControlsTypically, these are small windows which provide interaction
with the user. Controls that are not static can have ??? associated with
them.???The base class for controls???Push button control, displaying text???Push button control, displaying a bitmap???A button which stays pressed when clicked by
user.???Control showing an entire calendar month???Checkbox control???A listbox with a checkbox to the left of each
item???Choice control (a combobox without the editable
area)???A choice with an editable area???Small date picker control???A control to represent a varying quantity, such as
time remaining???A control for displaying a directory tree???A listbox showing HTML content???A static, or group box for visually grouping
related controls???A list of strings for single or multiple
selection???A control for displaying lists of strings and/or
icons, plus a multicolumn report view???A simpler interface (façade for
wxListCtrl in report mode???Single or multiline text editing control???Tree (hierarchy) control???Scrollbar control???A spin or 'up-down' control???A spin control - i.e. spin button and text
control???One or more lines of non-editable text???A control to display a bitmap???A group of radio buttons???A round button to be used with others in a
mutually exclusive way???A slider that can be dragged by the user???A listbox supporting variable height rowsMenus???Displays a series of menu items for selection???Contains a series of menus for use with a
frame???Represents a single menu itemWindow layoutThere are two different systems for laying out windows (and
dialogs in particular). One is based upon so-called sizers and it
requires less typing, thinking and calculating and will in almost
all cases produce dialogs looking equally well on all platforms,
the other is based on so-called constraints and is deprecated,
though still available.???
describes sizer-based layout.These are the classes relevant to sizer-based layout.???Abstract base class???A sizer for laying out windows in a grid with all
fields having the same size???A sizer for laying out windows in a flexible
grid???Another grid sizer that lets you specify the cell
an item is in, and items can span rows and/or columns.???A sizer for laying out windows in a row or
column???Same as wxBoxSizer, but with a surrounding static
box??? describes constraints-based layout.These are the classes relevant to constraints-based window
layout.???Represents a single constraint dimension???Represents the constraints for a window classDevice contexts???Device contexts are surfaces that may be drawn on, and provide
an abstraction that allows parameterisation of your drawing code by
passing different device contexts.???A helper device context for double buffered
drawing.???A helper device context for double buffered
drawing inside OnPaint.???A device context to access the client area outside
OnPaint events???A device context to access the client area inside
OnPaint events???A device context to access the non-client
area???A device context to access the entire screen???The device context base class???A device context for drawing into bitmaps???A device context for drawing into metafiles???A proxy device context allowing for simple
mirroring.???A device context for drawing into PostScript
files???A device context for drawing to printersGraphics device interface???These classes are related to drawing on device contexts and
windows.???Represents the red, blue and green elements of a
colour???Wraps the operations of setting and destroying the
clipping region???Represents a bitmap???Used for filling areas on a device context???The list of previously-created brushes???A small, transparent bitmap representing the
cursor???Represents fonts???The list of previously-created fonts???A small, transparent bitmap for assigning to
frames and drawing on device contexts???A platform-independent image class???A list of images, used with some controls???Represents a mask to be used with a bitmap for
transparent drawing???Used for drawing lines on a device context???The list of previously-created pens???Represents a table of indices into RGB values???Represents a simple or complex region on a window
or device context???Abstracts high-level drawing primitivesEvents???An event object contains information about a specific event.
Event handlers (usually member functions) have a single, event
argument.???A window or application activation event???Used with ??????Used to calculate window layout???A close window or end session event???An event from a variety of standard controls???An event generated when the user issues a context
menu command???Used with ??????Event send by ??????A drop files event???An erase background event???The event base class???Event sent by ??????A window focus event???A keypress event???An iconize/restore event???An idle event???A dialog initialisation event???A joystick event???A list control event???A maximize event???A menu event???A mouse capture changed event???A mouse event???A move event???A notebook control event???A notification event, which can be vetoed???A paint event???A process ending event???Used to query layout information???A scroll event from sliders, stand-alone
scrollbars and spin buttons???A scroll event from scrolled windows???A size event???A socket event???An event from ??????An event from ??????A system colour change event???A timer expiration event???A tree control event???A user interface update event???A window creation event???A window destruction event???A wizard eventValidators???These are the window validators, used for filtering and
validating user input.???Base validator class???Text control validator class???Generic control validator classData structuresThese are the data structure classes supported by wxWidgets.???Command line parser class???A logical time interval.???A class for date/time manipulations???A dynamic array implementation???An efficient container for storing ??? objects???A simple hash map implementation???A simple hash set implementation???A simple hash table implementation (deprecated,
use wxHashMap)???A simple linked list implementation???A portable 64 bit integer type???Represents a node in the wxList
implementation???The root class for most wxWidgets classes???A class to help search multiple paths???Representation of a point???A class representing a rectangle???Regular expression support???A class representing a region???A string class???A class for interpreting a string as a list of
tokens or words???Representation of a point using floating point
numbers???Representation of a size???A time interval.???Represents a Uniform Resource Identifier???A class for storing arbitrary types that may
change at run-timeRun-time class information
systemthe section called “Runtime class information (aka RTTI) overview”wxWidgets supports run-time manipulation of class information,
and dynamic creation of objects given class names.???Holds run-time class information???Root class for classes with run-time
informationthe section called “RTTI functions”Macros for manipulating run-time informationLogging features???wxWidgets provides several classes and functions for message
logging. Please see the ??? for more
details.???The base log class???Log messages to a C STDIO stream???Log messages to a C++ iostream???Log messages to a ??????Log messages to a log frame???Default log target for GUI programs???Temporarily suppress message logging???Allows to chain two log targets???Allows to filter the log messages???Allows to redirect output sent to cout to
a ???the section called “Log functions”Error and warning logging functionsDebugging features???wxWidgets supports some aspects of debugging an application
through classes, functions and macros.???Provides memory-checking facilitiesthe section called “Debugging macros and functions”Debug macros for assertion and checking???Use this macro to give further debugging
information???Base class for creating debug reports in case of a
program crash.???Class for creating compressed debug reports.???Class for uploading compressed debug reports via
HTTP.???Abstract base class for previewing the contents of
a debug report.???Standard implementation of
wxDebugReportPreview.Networking classeswxWidgets provides its own classes for socket based
networking.???Provides functions to check the status of network
connection and to establish one???Represents an Internet address???Represents an Internet address???Represents a socket base object???Represents a socket client???Represents a socket server???A socket event???FTP protocol class???HTTP protocol class???Represents a Universal Resource LocatorInterprocess communication???wxWidgets provides simple interprocess communications facilities
based on Windows DDE, but available on most platforms using
TCP.???, ???Represents a client???, ???Represents the connection between a client and a
server???, ???Represents a serverDocument/view framework???wxWidgets supports a document/view framework which provides
housekeeping for a document-centric application.???Represents a document???Represents a view???Manages the relationship between a document class
and a view class???Manages the documents and views in an
application???A child frame for showing a document view???A parent frame to contain viewsPrinting framework???A printing and previewing framework is implemented to make it
relatively straightforward to provide document printing
facilities.???Frame for displaying a print preview???Canvas for displaying a print preview???Standard control bar for a print preview???Standard print dialog???Standard page setup dialog???Class representing the printer???Printer device context???Class representing a particular printout???Class representing a print preview???Represents information about the document being
printed???Represents information about the print dialog???Represents information about the page setup
dialogDrag and drop and clipboard
classes??????Data object class???Represents a data format???Text data object class???File data object class???Bitmap data object class???Custom data object class???Clipboard class???Drop target class???File drop target class???Text drop target class???Drop source classFile related classeswxWidgets has several small classes to work with disk files, see
??? for more details.???Operations with the file name and attributes???Class for enumerating files/subdirectories.???Class used together with wxDir for recursively
enumerating the files/subdirectories???Low-level file input/output class.???Another low-level file input/output class.???Class to safely replace an existing file???Class for working with text files as with arrays
of lines???Paths for standard directoriesStream classeswxWidgets has its own set of stream classes, as an alternative
to often buggy standard stream libraries, and to provide enhanced
functionality.???Stream base class???Stream buffer class???Input stream class???Output stream class???Stream class for querying what size a stream would
have.???Filtered input stream class???Filtered output stream class???Buffered input stream class???Buffered output stream class???Memory input stream class???Memory output stream class???Platform-independent binary data input stream
class???Platform-independent binary data output stream
class???Platform-independent text data input stream
class???Platform-independent text data output stream
class???File input stream class???File output stream class???Another file input stream class???Another file output stream class???Stream to safely replace an existing file???String input stream class???String output stream class???Zlib (compression) input stream class???Zlib (compression) output stream class???Input stream for reading from ZIP archives???Output stream for writing from ZIP archives???Socket input stream class???Socket output stream classThreading classes???wxWidgets provides a set of classes to make use of the native
thread capabilities of the various platforms.???Thread class???Manages background threads easily???Mutex class???Mutex locker utility class???Critical section class???Critical section locker utility class???Condition class???Semaphore classHTML classeswxWidgets provides a set of classes to display text in HTML
format. These class include a help system based on the HTML
widget.???HTML help controller class???HTML window class???Simple class for printing HTML???Generic HTML wxPrintout class???Generic HTML parser class???HTML tag handler, pluginable into
wxHtmlParser???HTML parser class for wxHtmlWindow???HTML tag handler, pluginable into
wxHtmlWinParserVirtual file system classeswxWidgets provides a set of classes that implement an extensible
virtual file system, used internally by the HTML classes.???Represents a file in the virtual file system???Main interface for the virtual file system???Class used to announce file system typeXML-based resource system
classes???Resources allow your application to create controls and other
user interface elements from specifications stored in an XML
format.???The main class for working with resources.???The base class for XML resource handlers.Online help???Family of classes for controlling help
windows???HTML help controller class???Class to put application into context-sensitive
help mode???Button class for putting application into
context-sensitive help mode???Abstract class for context-sensitive help
provision???Class for simple context-sensitive help
provision???Class for context-sensitive help provision via a
help controller???Class implementing tooltipsDatabase classes???wxWidgets provides a set of classes for accessing Microsoft's
ODBC (Open Database Connectivity) product, donated by Remstar. This
is known as wxODBC.???ODBC database connection???Provides access to a database table??? ??? ??? ??? ??? ??? ??? ??? Miscellaneous???Application class???A caret (cursor) object???Command line parser class???Classes for configuration reading/writing (using
either INI files or registry)???Class to work with shared libraries.???Canvas that you can render OpenGL calls to.???Class to ease sharing of OpenGL data
resources.???An alternative window layout facility???Process class???Timer class???Stop watch class???MIME-types manager class???System settings class for obtaining various global
parameters???System options class for run-time
configuration???Accelerator table???OLE automation class???Font mapping, finding suitable font for given
encoding???Encoding conversions???Used with ??????Class to perform quantization, or colour
reduction???Check that only single program instance is
runningAlphabetical Class ReferenceAlphabetical Class ReferenceChapter 10. Alphabetical Class Reference
This is the Alphabetical Class Reference: wxString That was a link.
•wxAcceleratorEntry•wxAcceleratorTable•wxAccessible•wxActivateEvent•wxApp•wxArchiveClassFactory•wxArchiveEntry•wxArchiveInputStream•wxArchiveIterator•wxArchiveNotifier•wxArchiveOutputStream•wxArray•wxArrayString•wxArtProvider•wxAutomationObject•wxBitmap•wxBitmapButton•wxBitmapDataObject•wxBitmapHandler•wxBoxSizer•wxBrush•wxBrushList•wxBufferedDC•wxBufferedInputStream•wxBufferedOutputStream•wxBufferedPaintDC•wxBusyCursor•wxBusyInfo•wxButton•wxCSConv•wxCalculateLayoutEvent•wxCalendarCtrl•wxCalendarDateAttr•wxCalendarEvent•wxCaret•wxCheckBox•wxCheckListBox•wxChoice•wxChoicebook•wxClassInfo•wxClient•wxClientDC•wxClientData•wxClientDataContainer•wxClipboard•wxCloseEvent•wxCmdLineParser•wxColour•wxColourData•wxColourDatabase•wxColourDialog•wxComboBox•wxCommand•wxCommandEvent•wxCommandProcessor•wxCondition•wxConfigBase•wxConnection•wxContextHelp•wxContextHelpButton•wxContextMenuEvent•wxControl•wxControlWithItems•wxCountingOutputStream•wxCriticalSection•wxCriticalSectionLocker•wxCursor•wxCustomDataObject•wxDC•wxDCClipper•wxDDEClient•wxDDEConnection•wxDDEServer•wxDataFormat•wxDataInputStream•wxDataObject•wxDataObjectComposite•wxDataObjectSimple•wxDataOutputStream•wxDateEvent•wxDatePickerCtrl•wxDateSpan•wxDateTime•wxDateTimeHolidayAuthority•wxDateTimeWorkDays•wxDb•wxDbColDataPtr•wxDbColDef•wxDbColFor•wxDbColInf•wxDbConnectInf•wxDbGridColInfo•wxDbGridTableBase•wxDbIdxDef•wxDbInf•wxDbTable•wxDbTableInf•wxDebugContext•wxDebugReport•wxDebugReportCompress•wxDebugReportPreview•wxDebugReportPreviewStd•wxDebugReportUpload•wxDebugStreamBuf•wxDelegateRendererNative•wxDialUpEvent•wxDialUpManager•wxDialog•wxDir•wxDirDialog•wxDirTraverser•wxDisplay•wxDllLoader•wxDocChildFrame•wxDocMDIChildFrame•wxDocMDIParentFrame•wxDocManager•wxDocParentFrame•wxDocTemplate•wxDocument•wxDragImage•wxDropFilesEvent•wxDropSource•wxDropTarget•wxDynamicLibrary•wxDynamicLibraryDetails•wxEncodingConverter•wxEraseEvent•wxEvent•wxEvtHandler•wxFFile•wxFFileInputStream•wxFFileOutputStream•wxFFileStream•wxFSFile•wxFTP•wxFile•wxFileConfig•wxFileDataObject•wxFileDialog•wxFileDropTarget•wxFileHistory•wxFileInputStream•wxFileName•wxFileOutputStream•wxFileStream•wxFileSystem•wxFileSystemHandler•wxFileType•wxFilterInputStream•wxFilterOutputStream•wxFindDialogEvent•wxFindReplaceData•wxFindReplaceDialog•wxFlexGridSizer•wxFocusEvent•wxFont•wxFontData•wxFontDialog•wxFontEnumerator•wxFontList•wxFontMapper•wxFrame•wxGBPosition•wxGBSizerItem•wxGBSpan•wxGDIObject•wxGLCanvas•wxGLContext•wxGauge•wxGenericDirCtrl•wxGenericValidator•wxGrid•wxGridBagSizer•wxGridCellAttr•wxGridCellBoolEditor•wxGridCellBoolRenderer•wxGridCellChoiceEditor•wxGridCellEditor•wxGridCellFloatEditor•wxGridCellFloatRenderer•wxGridCellNumberEditor•wxGridCellNumberRenderer•wxGridCellRenderer•wxGridCellStringRenderer•wxGridCellTextEditor•wxGridEditorCreatedEvent•wxGridEvent•wxGridRangeSelectEvent•wxGridSizeEvent•wxGridSizer•wxGridTableBase•wxHTTP•wxHashMap•wxHashSet•wxHashTable•wxHelpController•wxHelpControllerHelpProvider•wxHelpEvent•wxHelpProvider•wxHtmlCell•wxHtmlColourCell•wxHtmlContainerCell•wxHtmlDCRenderer•wxHtmlEasyPrinting•wxHtmlFilter•wxHtmlHelpController•wxHtmlHelpData•wxHtmlHelpFrame•wxHtmlLinkInfo•wxHtmlListBox•wxHtmlParser•wxHtmlPrintout•wxHtmlTag•wxHtmlTagHandler•wxHtmlTagsModule•wxHtmlWidgetCell•wxHtmlWinParser•wxHtmlWinTagHandler•wxHtmlWindow•wxIPV4address•wxIPaddress•wxIcon•wxIconBundle•wxIconLocation•wxIconizeEvent•wxIdleEvent•wxImage•wxImageHandler•wxImageList•wxIndividualLayoutConstraint•wxInitDialogEvent•wxInputStream•wxJoystick•wxJoystickEvent•wxKeyEvent•wxLayoutAlgorithm•wxLayoutConstraints•wxList•wxListBox•wxListCtrl•wxListEvent•wxListItem•wxListItemAttr•wxListView•wxListbook•wxLocale•wxLog•wxLogChain•wxLogGui•wxLogNull•wxLogPassThrough•wxLogStderr•wxLogStream•wxLogTextCtrl•wxLogWindow•wxLongLong•wxMBConv•wxMBConvFile•wxMBConvUTF16•wxMBConvUTF32•wxMBConvUTF7•wxMBConvUTF8•wxMDIChildFrame•wxMDIClientWindow•wxMDIParentFrame•wxMask•wxMaximizeEvent•wxMediaCtrl•wxMediaEvent•wxMemoryBuffer•wxMemoryDC•wxMemoryFSHandler•wxMemoryInputStream•wxMemoryOutputStream•wxMenu•wxMenuBar•wxMenuEvent•wxMenuItem•wxMessageDialog•wxMetafile•wxMetafileDC•wxMimeTypesManager•wxMiniFrame•wxMirrorDC•wxModule•wxMouseCaptureChangedEvent•wxMouseEvent•wxMoveEvent•wxMultiChoiceDialog•wxMutex•wxMutexLocker•wxNode•wxNotebook•wxNotebookEvent•wxNotebookSizer•wxNotifyEvent•wxObject•wxObjectRefData•wxOutputStream•wxPageSetupDialog•wxPageSetupDialogData•wxPaintDC•wxPaintEvent•wxPalette•wxPanel•wxPasswordEntryDialog•wxPathList•wxPen•wxPenList•wxPoint•wxPostScriptDC•wxPreviewCanvas•wxPreviewControlBar•wxPreviewFrame•wxPrintData•wxPrintDialog•wxPrintDialogData•wxPrintPreview•wxPrinter•wxPrinterDC•wxPrintout•wxProcess•wxProcessEvent•wxProgressDialog•wxPropertySheetDialog•wxProtocol•wxQuantize•wxQueryLayoutInfoEvent•wxRadioBox•wxRadioButton•wxRealPoint•wxRect•wxRecursionGuard•wxRecursionGuardFlag•wxRegEx•wxRegKey•wxRegion•wxRegionIterator•wxRendererNative•wxRendererVersion•wxSashEvent•wxSashLayoutWindow•wxSashWindow•wxScopedArray•wxScopedPtr•wxScopedTiedPtr•wxScreenDC•wxScrollBar•wxScrollEvent•wxScrollWinEvent•wxScrolledWindow•wxSemaphore•wxServer•wxSetCursorEvent•wxSimpleHelpProvider•wxSingleChoiceDialog•wxSingleInstanceChecker•wxSize•wxSizeEvent•wxSizer•wxSizerFlags•wxSizerItem•wxSlider•wxSockAddress•wxSocketBase•wxSocketClient•wxSocketEvent•wxSocketInputStream•wxSocketOutputStream•wxSocketServer•wxSound•wxSpinButton•wxSpinCtrl•wxSpinEvent•wxSplashScreen•wxSplitterEvent•wxSplitterRenderParams•wxSplitterWindow•wxStackFrame•wxStackWalker•wxStandardPaths•wxStaticBitmap•wxStaticBox•wxStaticBoxSizer•wxStaticLine•wxStaticText•wxStatusBar•wxStdDialogButtonSizer•wxStopWatch•wxStreamBase•wxStreamBuffer•wxStreamToTextRedirector•wxString•wxStringBuffer•wxStringBufferLength•wxStringClientData•wxStringInputStream•wxStringOutputStream•wxStringTokenizer•wxSysColourChangedEvent•wxSystemOptions•wxSystemSettings•wxTCPClient•wxTCPConnection•wxTCPServer•wxTaskBarIcon•wxTempFile•wxTempFileOutputStream•wxTextAttr•wxTextCtrl•wxTextDataObject•wxTextDropTarget•wxTextEntryDialog•wxTextFile•wxTextInputStream•wxTextOutputStream•wxTextValidator•wxThread•wxThreadHelper•wxTimeSpan•wxTimer•wxTimerEvent•wxTipProvider•wxTipWindow•wxToggleButton•wxToolBar•wxToolTip•wxTopLevelWindow•wxTreeCtrl•wxTreeEvent•wxTreeItemData•wxURI•wxURL•wxUpdateUIEvent•wxVListBox•wxVScrolledWindow•wxValidator•wxVariant•wxVariantData•wxView•wxWindow•wxWindowCreateEvent•wxWindowDC•wxWindowDestroyEvent•wxWindowDisabler•wxWizard•wxWizardEvent•wxWizardPage•wxWizardPageSimple•wxXmlResource•wxXmlResourceHandler•wxZipClassFactory•wxZipEntry•wxZipInputStream•wxZipNotifier•wxZipOutputStream•wxZlibInputStream•wxZlibOutputStreamwxAcceleratorEntrywxAcceleratorEntry
An object used by an application wishing to create an
accelerator table
.
Include Files
<wx/accel.h>
See also
wxAcceleratorTable
wxWindow::SetAcceleratorTable
MemberswxAcceleratorEntry::wxAcceleratorEntry wxAcceleratorEntry ()
Default constructor.
wxAcceleratorEntry (int flags, int keyCode, int cmd)
Constructor.
wxAcceleratorEntry::GetCommandint GetCommand ()
Returns the command identifier for the accelerator table entry.
wxAcceleratorEntry::GetFlagsint GetFlags ()
Returns the flags for the accelerator table entry.
wxAcceleratorEntry::GetKeyCodeint GetKeyCode ()
Returns the keycode for the accelerator table entry.
wxAcceleratorEntry::Setvoid Set (int flags, int keyCode, int cmd)
Sets the accelerator entry parameters.
wxAcceleratorTablewxAcceleratorTable
An accelerator table allows the application to specify a table of keyboard
shortcuts for menus or other commands. On Windows, menu or button commands are
supported; on GTK, only menu commands are supported.
The object
wxNullAcceleratorTable
is defined to be a table with no data, and is the initial accelerator table for
a window.
wxAcceleratorEntry entries[4];
entries[0].Set(wxACCEL_CTRL, (int) 'N', ID_NEW_WINDOW);
entries[1].Set(wxACCEL_CTRL, (int) 'X', wxID_EXIT);
entries[2].Set(wxACCEL_SHIFT, (int) 'A', ID_ABOUT);
entries[3].Set(wxACCEL_NORMAL, WXK_DELETE, wxID_CUT);
wxAcceleratorTable accel(4, entries);
frame->SetAcceleratorTable(accel);
Derived fromwxObjectInclude Files
<wx/accel.h>
Remark
An accelerator takes precedence over normal processing and can be a convenient
way to program some event handling. For example, you can use an accelerator
table to enable a dialog with a multi-line text control to accept CTRL-Enter as
meaning `OK' (but not in GTK+ at present).
See also
wxAcceleratorEntry
wxWindow::SetAcceleratorTable
MemberswxAcceleratorTable::wxAcceleratorTable wxAcceleratorTable ()
Default constructor.
wxAcceleratorTable (const wxAcceleratorTable& bitmap)
Copy constructor.
wxAcceleratorTable (int n, wxAcceleratorEntry entries[])
Creates from an array of
wxAcceleratorEntry
objects.
wxAcceleratorTable (const wxString& resource)
Loads the accelerator table from a Windows resource (Windows only).
wxAcceleratorTable::~wxAcceleratorTable ~wxAcceleratorTable ()
Destroys the wxAcceleratorTable object.
wxAcceleratorTable::Okbool Ok ()
Returns true if the accelerator table is valid.
wxAcceleratorTable::operator=wxAcceleratorTable& operator = (const wxAcceleratorTable& accel)
Assignment operator. This operator does not copy any data, but instead passes a
pointer to the data in
accel
and increments a reference counter. It is a fast operation.
wxAcceleratorTable::operator==bool operator == (const wxAcceleratorTable& accel)
Equality operator. This operator tests whether the internal data pointers are
equal (a fast test).
wxAcceleratorTable::operator!=bool operator != (const wxAcceleratorTable& accel)
Inequality operator. This operator tests whether the internal data pointers are
unequal (a fast test).
wxAccessiblewxAccessible
The wxAccessible class allows wxWidgets applications, and wxWidgets itself, to
return extended information about user interface elements to client applications
such as screen readers. This is the main way in which wxWidgets implements
accessibility features.
At present, only Microsoft Active Accessibility is supported by this class.
To use this class, derive from wxAccessible, implement appropriate functions,
and associate an object of the class with a window using
wxWindow::SetAccessible
.
All functions return an indication of success, failure, or not implemented using
values of the wxAccStatus enum type.
If you return wxACC_NOT_IMPLEMENTED from any function, the system will try to
implement the appropriate functionality. However this will not work with all
functions.
Most functions work with an
object id
, which can be zero to refer to 'this' UI element, or greater than zero to refer
to the nth child element. This allows you to specify elements that don't have a
corresponding wxWindow or wxAccessible; for example, the sash of a splitter
window.
For details on the semantics of functions and types, please refer to the
Microsoft Active Accessibility 1.2 documentation.
This class is compiled into wxWidgets only if the wxUSE_ACCESSIBILITY setup
symbol is set to 1.
Derived fromwxObjectInclude Files
<wx/access.h>
Structs
Functions return a wxAccStatus error code, which may be one of the following:
typedef enum
{
wxACC_FAIL, // The function failed
wxACC_FALSE, // The function returned false
wxACC_OK, // The function completed successfully
wxACC_NOT_IMPLEMENTED, // The function is not implemented
wxACC_NOT_SUPPORTED // The function is not supported
} wxAccStatus
Directions of navigation are represented by the following:
typedef enum
{
wxNAVDIR_DOWN,
wxNAVDIR_FIRSTCHILD,
wxNAVDIR_LASTCHILD,
wxNAVDIR_LEFT,
wxNAVDIR_NEXT,
wxNAVDIR_PREVIOUS,
wxNAVDIR_RIGHT,
wxNAVDIR_UP
} wxNavDir
The role of a user interface element is represented by the following type:
typedef enum {
wxROLE_NONE,
wxROLE_SYSTEM_ALERT,
wxROLE_SYSTEM_ANIMATION,
wxROLE_SYSTEM_APPLICATION,
wxROLE_SYSTEM_BORDER,
wxROLE_SYSTEM_BUTTONDROPDOWN,
wxROLE_SYSTEM_BUTTONDROPDOWNGRID,
wxROLE_SYSTEM_BUTTONMENU,
wxROLE_SYSTEM_CARET,
wxROLE_SYSTEM_CELL,
wxROLE_SYSTEM_CHARACTER,
wxROLE_SYSTEM_CHART,
wxROLE_SYSTEM_CHECKBUTTON,
wxROLE_SYSTEM_CLIENT,
wxROLE_SYSTEM_CLOCK,
wxROLE_SYSTEM_COLUMN,
wxROLE_SYSTEM_COLUMNHEADER,
wxROLE_SYSTEM_COMBOBOX,
wxROLE_SYSTEM_CURSOR,
wxROLE_SYSTEM_DIAGRAM,
wxROLE_SYSTEM_DIAL,
wxROLE_SYSTEM_DIALOG,
wxROLE_SYSTEM_DOCUMENT,
wxROLE_SYSTEM_DROPLIST,
wxROLE_SYSTEM_EQUATION,
wxROLE_SYSTEM_GRAPHIC,
wxROLE_SYSTEM_GRIP,
wxROLE_SYSTEM_GROUPING,
wxROLE_SYSTEM_HELPBALLOON,
wxROLE_SYSTEM_HOTKEYFIELD,
wxROLE_SYSTEM_INDICATOR,
wxROLE_SYSTEM_LINK,
wxROLE_SYSTEM_LIST,
wxROLE_SYSTEM_LISTITEM,
wxROLE_SYSTEM_MENUBAR,
wxROLE_SYSTEM_MENUITEM,
wxROLE_SYSTEM_MENUPOPUP,
wxROLE_SYSTEM_OUTLINE,
wxROLE_SYSTEM_OUTLINEITEM,
wxROLE_SYSTEM_PAGETAB,
wxROLE_SYSTEM_PAGETABLIST,
wxROLE_SYSTEM_PANE,
wxROLE_SYSTEM_PROGRESSBAR,
wxROLE_SYSTEM_PROPERTYPAGE,
wxROLE_SYSTEM_PUSHBUTTON,
wxROLE_SYSTEM_RADIOBUTTON,
wxROLE_SYSTEM_ROW,
wxROLE_SYSTEM_ROWHEADER,
wxROLE_SYSTEM_SCROLLBAR,
wxROLE_SYSTEM_SEPARATOR,
wxROLE_SYSTEM_SLIDER,
wxROLE_SYSTEM_SOUND,
wxROLE_SYSTEM_SPINBUTTON,
wxROLE_SYSTEM_STATICTEXT,
wxROLE_SYSTEM_STATUSBAR,
wxROLE_SYSTEM_TABLE,
wxROLE_SYSTEM_TEXT,
wxROLE_SYSTEM_TITLEBAR,
wxROLE_SYSTEM_TOOLBAR,
wxROLE_SYSTEM_TOOLTIP,
wxROLE_SYSTEM_WHITESPACE,
wxROLE_SYSTEM_WINDOW
} wxAccRole
Objects are represented by the following type:
typedef enum {
wxOBJID_WINDOW = 0x00000000,
wxOBJID_SYSMENU = 0xFFFFFFFF,
wxOBJID_TITLEBAR = 0xFFFFFFFE,
wxOBJID_MENU = 0xFFFFFFFD,
wxOBJID_CLIENT = 0xFFFFFFFC,
wxOBJID_VSCROLL = 0xFFFFFFFB,
wxOBJID_HSCROLL = 0xFFFFFFFA,
wxOBJID_SIZEGRIP = 0xFFFFFFF9,
wxOBJID_CARET = 0xFFFFFFF8,
wxOBJID_CURSOR = 0xFFFFFFF7,
wxOBJID_ALERT = 0xFFFFFFF6,
wxOBJID_SOUND = 0xFFFFFFF5
} wxAccObject
Selection actions are identified by this type:
typedef enum
{
wxACC_SEL_NONE = 0,
wxACC_SEL_TAKEFOCUS = 1,
wxACC_SEL_TAKESELECTION = 2,
wxACC_SEL_EXTENDSELECTION = 4,
wxACC_SEL_ADDSELECTION = 8,
wxACC_SEL_REMOVESELECTION = 16
} wxAccSelectionFlags
States are represented by the following:
#define wxACC_STATE_SYSTEM_ALERT_HIGH 0x00000001
#define wxACC_STATE_SYSTEM_ALERT_MEDIUM 0x00000002
#define wxACC_STATE_SYSTEM_ALERT_LOW 0x00000004
#define wxACC_STATE_SYSTEM_ANIMATED 0x00000008
#define wxACC_STATE_SYSTEM_BUSY 0x00000010
#define wxACC_STATE_SYSTEM_CHECKED 0x00000020
#define wxACC_STATE_SYSTEM_COLLAPSED 0x00000040
#define wxACC_STATE_SYSTEM_DEFAULT 0x00000080
#define wxACC_STATE_SYSTEM_EXPANDED 0x00000100
#define wxACC_STATE_SYSTEM_EXTSELECTABLE 0x00000200
#define wxACC_STATE_SYSTEM_FLOATING 0x00000400
#define wxACC_STATE_SYSTEM_FOCUSABLE 0x00000800
#define wxACC_STATE_SYSTEM_FOCUSED 0x00001000
#define wxACC_STATE_SYSTEM_HOTTRACKED 0x00002000
#define wxACC_STATE_SYSTEM_INVISIBLE 0x00004000
#define wxACC_STATE_SYSTEM_MARQUEED 0x00008000
#define wxACC_STATE_SYSTEM_MIXED 0x00010000
#define wxACC_STATE_SYSTEM_MULTISELECTABLE 0x00020000
#define wxACC_STATE_SYSTEM_OFFSCREEN 0x00040000
#define wxACC_STATE_SYSTEM_PRESSED 0x00080000
#define wxACC_STATE_SYSTEM_PROTECTED 0x00100000
#define wxACC_STATE_SYSTEM_READONLY 0x00200000
#define wxACC_STATE_SYSTEM_SELECTABLE 0x00400000
#define wxACC_STATE_SYSTEM_SELECTED 0x00800000
#define wxACC_STATE_SYSTEM_SELFVOICING 0x01000000
#define wxACC_STATE_SYSTEM_UNAVAILABLE 0x02000000
Event identifiers that can be sent via
wxAccessible::NotifyEvent
are as follows:
#define wxACC_EVENT_SYSTEM_SOUND 0x0001
#define wxACC_EVENT_SYSTEM_ALERT 0x0002
#define wxACC_EVENT_SYSTEM_FOREGROUND 0x0003
#define wxACC_EVENT_SYSTEM_MENUSTART 0x0004
#define wxACC_EVENT_SYSTEM_MENUEND 0x0005
#define wxACC_EVENT_SYSTEM_MENUPOPUPSTART 0x0006
#define wxACC_EVENT_SYSTEM_MENUPOPUPEND 0x0007
#define wxACC_EVENT_SYSTEM_CAPTURESTART 0x0008
#define wxACC_EVENT_SYSTEM_CAPTUREEND 0x0009
#define wxACC_EVENT_SYSTEM_MOVESIZESTART 0x000A
#define wxACC_EVENT_SYSTEM_MOVESIZEEND 0x000B
#define wxACC_EVENT_SYSTEM_CONTEXTHELPSTART 0x000C
#define wxACC_EVENT_SYSTEM_CONTEXTHELPEND 0x000D
#define wxACC_EVENT_SYSTEM_DRAGDROPSTART 0x000E
#define wxACC_EVENT_SYSTEM_DRAGDROPEND 0x000F
#define wxACC_EVENT_SYSTEM_DIALOGSTART 0x0010
#define wxACC_EVENT_SYSTEM_DIALOGEND 0x0011
#define wxACC_EVENT_SYSTEM_SCROLLINGSTART 0x0012
#define wxACC_EVENT_SYSTEM_SCROLLINGEND 0x0013
#define wxACC_EVENT_SYSTEM_SWITCHSTART 0x0014
#define wxACC_EVENT_SYSTEM_SWITCHEND 0x0015
#define wxACC_EVENT_SYSTEM_MINIMIZESTART 0x0016
#define wxACC_EVENT_SYSTEM_MINIMIZEEND 0x0017
#define wxACC_EVENT_OBJECT_CREATE 0x8000
#define wxACC_EVENT_OBJECT_DESTROY 0x8001
#define wxACC_EVENT_OBJECT_SHOW 0x8002
#define wxACC_EVENT_OBJECT_HIDE 0x8003
#define wxACC_EVENT_OBJECT_REORDER 0x8004
#define wxACC_EVENT_OBJECT_FOCUS 0x8005
#define wxACC_EVENT_OBJECT_SELECTION 0x8006
#define wxACC_EVENT_OBJECT_SELECTIONADD 0x8007
#define wxACC_EVENT_OBJECT_SELECTIONREMOVE 0x8008
#define wxACC_EVENT_OBJECT_SELECTIONWITHIN 0x8009
#define wxACC_EVENT_OBJECT_STATECHANGE 0x800A
#define wxACC_EVENT_OBJECT_LOCATIONCHANGE 0x800B
#define wxACC_EVENT_OBJECT_NAMECHANGE 0x800C
#define wxACC_EVENT_OBJECT_DESCRIPTIONCHANGE 0x800D
#define wxACC_EVENT_OBJECT_VALUECHANGE 0x800E
#define wxACC_EVENT_OBJECT_PARENTCHANGE 0x800F
#define wxACC_EVENT_OBJECT_HELPCHANGE 0x8010
#define wxACC_EVENT_OBJECT_DEFACTIONCHANGE 0x8011
#define wxACC_EVENT_OBJECT_ACCELERATORCHANGE 0x8012
MemberswxAccessible::wxAccessible wxAccessible (wxWindow* win = NULL)
Constructor, taking an optional window. The object can be associated with a
window later.
wxAccessible::~wxAccessible ~wxAccessible ()
Destructor.
wxAccessible::DoDefaultActionvirtual wxAccStatus DoDefaultAction (int childId)
Performs the default action for the object.
childId
is 0 (the action for this object) or greater than 0 (the action for a child).
Return wxACC_NOT_SUPPORTED if there is no default action for this window (e.g.
an edit control).
wxAccessible::GetChildvirtual wxAccStatus GetChild (int childId, wxAccessible** child)
Gets the specified child (starting from 1). If
child
is NULL and the return value is wxACC_OK, this means that the child is a simple
element and not an accessible object.
wxAccessible::GetChildCountvirtual wxAccStatus GetChildCount (int* childCount)
Returns the number of children in
childCount
.
wxAccessible::GetDefaultActionvirtual wxAccStatus GetDefaultAction (int childId, wxString* actionName)
Gets the default action for this object (0) or a child (greater than 0). Return
wxACC_OK even if there is no action.
actionName
is the action, or the empty string if there is no action. The retrieved string
describes the action that is performed on an object, not what the object does as
a result. For example, a toolbar button that prints a document has a default
action of "Press" rather than "Prints the current document."
wxAccessible::GetDescriptionvirtual wxAccStatus GetDescription (int childId, wxString* description)
Returns the description for this object or a child.
wxAccessible::GetFocusvirtual wxAccStatus GetFocus (int* childId, wxAccessible** child)
Gets the window with the keyboard focus. If childId is 0 and child is NULL, no
object in this subhierarchy has the focus. If this object has the focus, child
should be 'this'.
wxAccessible::GetHelpTextvirtual wxAccStatus GetHelpText (int childId, wxString* helpText)
Returns help text for this object or a child, similar to tooltip text.
wxAccessible::GetKeyboardShortcutvirtual wxAccStatus GetKeyboardShortcut (int childId, wxString* shortcut)
Returns the keyboard shortcut for this object or child. Return e.g. ALT+K.
wxAccessible::GetLocationvirtual wxAccStatus GetLocation (wxRect& rect, int elementId)
Returns the rectangle for this object (id is 0) or a child element (id is
greater than 0).
rect
is in screen coordinates.
wxAccessible::GetNamevirtual wxAccStatus GetName (int childId, wxString* name)
Gets the name of the specified object.
wxAccessible::GetParentvirtual wxAccStatus GetParent (wxAccessible** parent)
Returns the parent of this object, or NULL.
wxAccessible::GetRolevirtual wxAccStatus GetRole (int childId, wxAccRole* role)
Returns a role constant describing this object. See
wxAccessible
for a list of these roles.
wxAccessible::GetSelectionsvirtual wxAccStatus GetSelections (wxVariant* selections)
Gets a variant representing the selected children of this object.
Acceptable values are:
•a null variant (IsNull() returns TRUE)•a list variant (GetType() == wxT("list"))•an integer representing the selected child element, or 0 if this object is
selected (GetType() == wxT("long"))•a "void*" pointer to a wxAccessible child object
wxAccessible::GetStatevirtual wxAccStatus GetState (int childId, long* state)
Returns a state constant. See
wxAccessible
for a list of these states.
wxAccessible::GetValuevirtual wxAccStatus GetValue (int childId, wxString* strValue)
Returns a localized string representing the value for the object or child.
wxAccessible::GetWindowwxWindow* GetWindow ()
Returns the window associated with this object.
wxAccessible::HitTestvirtual wxAccStatus HitTest (const wxPoint& pt, int* childId, wxAccessible** childObject)
Returns a status value and object id to indicate whether the given point was on
this or a child object. Can return either a child object, or an integer
representing the child element, starting from 1.
pt
is in screen coordinates.
wxAccessible::Navigatevirtual wxAccStatus Navigate (wxNavDir navDir, int fromId, int* toId, wxAccessible** toObject)
Navigates from
fromId
to
toId
/
toObject
.
wxAccessible::NotifyEventvirtual static void NotifyEvent (int eventType, wxWindow* window, wxAccObject objectType, int objectType)
Allows the application to send an event when something changes in an accessible
object.
wxAccessible::Selectvirtual wxAccStatus Select (int childId, wxAccSelectionFlags selectFlags)
Selects the object or child. See
wxAccessible
for a list of the selection actions.
wxAccessible::SetWindowvoid SetWindow (wxWindow* window)
Sets the window associated with this object.
wxActivateEventwxActivateEvent
An activate event is sent when a window or application is being activated or
deactivated.
Derived fromwxEventwxObjectInclude Files
<wx/event.h>
Event handlingEVT_ACTIVATE(func)Process a wxEVT_ACTIVATE event.EVT_ACTIVATE_APP(func)Process a wxEVT_ACTIVATE_APP event.EVT_HIBERNATE(func)Process a hibernate event, supplying the member function.
This event applies to wxApp only, and only on Windows SmartPhone and PocketPC. It is generated when the
system is low on memory; the application should free up as much memory as possible, and restore
full working when it receives a wxEVT_ACTIVATE or wxEVT_ACTIVATE_APP event.Remark
A top-level window (a dialog or frame) receives an activate event when is being
activated or deactivated. This is indicated visually by the title bar changing
colour, and a subwindow gaining the keyboard focus.
An application is activated or deactivated when one of its frames becomes
activated, or a frame becomes inactivate resulting in all application frames
being inactive. (Windows only)
Please note that usually you should call
event.Skip()
in your handlers for these events as not doing so can result in strange effects.
See also
Event handling overview [eventhandlingoverview]
,
wxApp::IsActive
MemberswxActivateEvent::wxActivateEvent wxActivateEvent (WXTYPE eventType = 0, bool active = true, int id = 0)
Constructor.
wxActivateEvent::GetActivebool GetActive ()
Returns true if the application or window is being activated, false otherwise.
wxAppwxApp
The
wxApp
class represents the application itself. It is used to:
•set and get application-wide properties;•implement the windowing system message or event loop;•initiate application processing via
wxApp::OnInit
;•allow default processing of events not handled by other objects in the
application.
You should use the macro IMPLEMENT_APP(appClass) in your application
implementation file to tell wxWidgets how to create an instance of your
application class.
Use DECLARE_APP(appClass) in a header file if you want the wxGetApp function
(which returns a reference to your application object) to be visible to other
files.
Derived fromwxEvtHandlerwxObjectInclude Files
<wx/app.h>
See also
wxApp overview [wxappoverview]
MemberswxApp::wxApp wxApp ()
Constructor. Called implicitly with a definition of a wxApp object.
wxApp::~wxApp ~wxApp ()
Destructor. Will be called implicitly on program exit if the wxApp object is
created on the stack.
wxApp::argcwxApp::argvwxApp::CreateLogTargetvirtual wxLog* CreateLogTarget ()
Creates a wxLog class for the application to use for logging errors. The default
implementation returns a new wxLogGui class.
See also
wxLog
wxApp::Dispatchvirtual void Dispatch ()
Dispatches the next event in the windowing system event queue.
This can be used for programming event loops, e.g.
while (app.Pending())
Dispatch();
See also
wxApp::Pending
wxApp::ExitMainLoopvirtual void ExitMainLoop ()
Call this to explicitly exit the main message (event) loop. You should normally
exit the main loop (and the application) by deleting the top window.
wxApp::FilterEventint FilterEvent (wxEvent& event)
This function is called before processing any event and allows the application
to preempt the processing of some events. If this method returns -1 the event is
processed normally, otherwise either
true
or
false
should be returned and the event processing stops immediately considering that
the event had been already processed (for the former return value) or that it is
not going to be processed at all (for the latter one).
wxApp::GetAppNamewxString GetAppName ()
Returns the application name.
wxApp::GetClassNamewxString GetClassName ()
Gets the class name of the application. The class name may be used in a platform
specific manner to refer to the application.
See also
wxApp::SetClassName
wxApp::GetExitOnFrameDeletebool GetExitOnFrameDelete ()
Returns true if the application will exit when the top-level window is deleted,
false otherwise.
See also
wxApp::SetExitOnFrameDelete,
wxApp shutdown overview [wxappshutdownoverview]
wxApp::GetInstancestatic wxAppConsole * GetInstance ()
Returns the one and only global application object. Usually
wxTheApp
is usead instead.
See also
wxApp::SetInstance
wxApp::GetTopWindowvirtual wxWindow * GetTopWindow ()
Returns a pointer to the top window.
See also
SetTopWindow
wxApp::GetUseBestVisualbool GetUseBestVisual ()
Returns true if the application will use the best visual on systems that support
different visuals, false otherwise.
See also
SetUseBestVisual
wxApp::GetVendorNamewxString GetVendorName ()
Returns the application's vendor name.
wxApp::IsActivebool IsActive ()
Returns true if the application is active, i.e. if one of its windows is
currently in the foreground. If this function returns false and you need to
attract users attention to the application, you may use
wxTopLevelWindow::RequestUserAttention
to do it.
wxApp::IsMainLoopRunningstatic bool IsMainLoopRunning ()
Returns true if the main event loop is currently running, i.e. if the
application is inside
OnRun
.
This can be useful to test whether the events can be dispatched. For example, if
this function returns false, non-blocking sockets cannot be used because the
events from them would never be processed.
wxApp::MainLoopvirtual int MainLoop ()
Called by wxWidgets on creation of the application. Override this if you wish to
provide your own (environment-dependent) main loop.
wxApp::OnAssertvoid OnAssert (const wxChar * file, int line, const wxChar * cond, const wxChar * msg)
This function is called when an assert failure occurs, i.e. the condition
specified in
wxASSERT [wxassert]
macro evaluated to
false
. It is only called in debug mode (when
__WXDEBUG__
is defined) as asserts are not left in the release code at all.
The base class version show the default assert failure dialog box proposing to
the user to stop the program, continue or ignore all subsequent asserts.
wxApp::OnCmdLineErrorbool OnCmdLineError (wxCmdLineParser& parser)
Called when command line parsing fails (i.e. an incorrect command line option
was specified by the user). The default behaviour is to show the program usage
text and abort the program.
Return
true
to continue normal execution or
false
to return
false
from
OnInit
thus terminating the program.
See also
OnInitCmdLine
wxApp::OnCmdLineHelpbool OnCmdLineHelp (wxCmdLineParser& parser)
Called when the help option (
--help
) was specified on the command line. The default behaviour is to show the
program usage text and abort the program.
Return
true
to continue normal execution or
false
to return
false
from
OnInit
thus terminating the program.
See also
OnInitCmdLine
wxApp::OnCmdLineParsedbool OnCmdLineParsed (wxCmdLineParser& parser)
Called after the command line had been successfully parsed. You may override
this method to test for the values of the various parameters which could be set
from the command line.
Don't forget to call the base class version unless you want to suppress
processing of the standard command line options.
Return
true
to continue normal execution or
false
to return
false
from
OnInit
thus terminating the program.
See also
OnInitCmdLine
wxApp::OnExceptionInMainLoopvirtual bool OnExceptionInMainLoop ()
This function is called if an unhandled exception occurs inside the main
application event loop. It can return true to ignore the exception and to
continue running the loop or false to exit the loop and terminate the program.
In the latter case it can also use C++
throw
keyword to rethrow the current exception.
The default behaviour of this function is the latter in all ports except under
Windows where a dialog is shown to the user which allows him to choose between
the different options. You may override this function in your class to do
something more appropriate.
Finally note that if the exception is rethrown from here, it can be caught in
OnUnhandledException
.
wxApp::OnExitvirtual int OnExit ()
Override this member function for any processing which needs to be done as the
application is about to exit. OnExit is called after destroying all application
windows and controls, but before wxWidgets cleanup. Note that it is not called
at all if
OnInit
failed.
The return value of this function is currently ignored, return the same value as
returned by the base class method if you override it.
wxApp::OnFatalExceptionvoid OnFatalException ()
This function may be called if something fatal happens: an unhandled exception
under Win32 or a a fatal signal under Unix, for example. However, this will not
happen by default: you have to explicitly call
wxHandleFatalExceptions [wxhandlefatalexceptions]
to enable this.
Generally speaking, this function should only show a message to the user and
return. You may attempt to save unsaved data but this is not guaranteed to work
and, in fact, probably won't.
See also
wxHandleFatalExceptions [wxhandlefatalexceptions]
wxApp::OnInitbool OnInit ()
This must be provided by the application, and will usually create the
application's main window, optionally calling
wxApp::SetTopWindow
. You may use
OnExit
to clean up anything initialized here, provided that the function returns true.
Notice that if you want to to use the command line processing provided by
wxWidgets you have to call the base class version in the derived class OnInit().
Return true to continue processing, false to exit the application immediately.
wxApp::OnInitCmdLinevoid OnInitCmdLine (wxCmdLineParser& parser)
Called from
OnInit
and may be used to initialize the parser with the command line options for this
application. The base class versions adds support for a few standard options
only.
wxApp::OnRunvirtual int OnRun ()
This virtual function is where the execution of a program written in wxWidgets
starts. The default implementation just enters the main loop and starts handling
the events until it terminates, either because
ExitMainLoop
has been explicitly called or because the last frame has been deleted and
GetExitOnFrameDelete
flag is true (this is the default).
The return value of this function becomes the exit code of the program, so it
should return 0 in case of successful termination.
wxApp::OnUnhandledExceptionvirtual void OnUnhandledException ()
This function is called when an unhandled C++ exception occurs inside
OnRun()
(the exceptions which occur during the program startup and shutdown might not be
caught at all). Note that the exception type is lost by now, so if you want to
really handle the exception you should override
OnRun()
and put a try/catch clause around the call to the base class version there.
wxApp::ProcessMessagebool ProcessMessage (WXMSG * msg)
Windows-only function for processing a message. This function is called from the
main message loop, checking for windows that may wish to process it. The
function returns true if the message was processed, false otherwise. If you use
wxWidgets with another class library with its own message loop, you should make
sure that this function is called to allow wxWidgets to receive messages. For
example, to allow co-existence with the Microsoft Foundation Classes, override
the PreTranslateMessage function:
// Provide wxWidgets message loop compatibility
BOOL CTheApp::PreTranslateMessage(MSG *msg)
{
if (wxTheApp && wxTheApp->ProcessMessage((WXMSW *)msg))
return true;
else
return CWinApp::PreTranslateMessage(msg);
}
wxApp::Pendingvirtual bool Pending ()
Returns true if unprocessed events are in the window system event queue.
See also
wxApp::Dispatch
wxApp::SendIdleEventsbool SendIdleEvents (wxWindow* win, wxIdleEvent& event)
Sends idle events to a window and its children.
Please note that this function is internal to wxWidgets and shouldn't be used by
user code.
See also
wxIdleEvent
wxApp::SetAppNamevoid SetAppName (const wxString& name)
Sets the name of the application. The name may be used in dialogs (for example
by the document/view framework). A default name is set by wxWidgets.
See also
wxApp::GetAppName
wxApp::SetClassNamevoid SetClassName (const wxString& name)
Sets the class name of the application. This may be used in a platform specific
manner to refer to the application.
See also
wxApp::GetClassName
wxApp::SetExitOnFrameDeletevoid SetExitOnFrameDelete (bool flag)
Allows the programmer to specify whether the application will exit when the
top-level frame is deleted.
See also
wxApp::GetExitOnFrameDelete,
wxApp shutdown overview [wxappshutdownoverview]
wxApp::SetInstancestatic void SetInstance (wxAppConsole* app)
Allows external code to modify global
wxTheApp
, but you should really know what you're doing if you call it.
See also
wxApp::GetInstance
wxApp::SetTopWindowvoid SetTopWindow (wxWindow* window)See also
wxApp::GetTopWindow
wxApp::OnInit
wxApp::SetVendorNamevoid SetVendorName (const wxString& name)
Sets the name of application's vendor. The name will be used in registry access.
A default name is set by wxWidgets.
See also
wxApp::GetVendorName
wxApp::SetUseBestVisualvoid SetUseBestVisual (bool flag)
Allows the programmer to specify whether the application will use the best
visual on systems that support several visual on the same display. This is
typically the case under Solaris and IRIX, where the default visual is only
8-bit whereas certain applications are supposed to run in TrueColour mode.
Note that this function has to be called in the constructor of the
wxApp
instance and won't have any effect when called later on.
This function currently only has effect under GTK.
wxApp::HandleEventvirtual void HandleEvent (wxEvtHandler * handler, wxEventFunction func, wxEvent& event)
This function simply invokes the given method
func
of the specified event handler
handler
with the
event
as parameter. It exists solely to allow to catch the C++ exceptions which could
be thrown by all event handlers in the application in one place: if you want to
do this, override this function in your wxApp-derived class and add try/catch
clause(s) to it.
wxApp::Yieldbool Yield (bool onlyIfNeeded = false)
Yields control to pending messages in the windowing system. This can be useful,
for example, when a time-consuming process writes to a text window. Without an
occasional yield, the text window will not be updated properly, and on systems
with cooperative multitasking, such as Windows 3.1 other processes will not
respond.
Caution should be exercised, however, since yielding may allow the user to
perform actions which are not compatible with the current task. Disabling menu
items or whole menus during processing can avoid unwanted reentrance of code:
see
::wxSafeYield [wxsafeyield]
for a better function.
Note that Yield() will not flush the message logs. This is intentional as
calling Yield() is usually done to quickly update the screen and popping up a
message box dialog may be undesirable. If you do wish to flush the log messages
immediately (otherwise it will be done during the next idle loop iteration),
call
wxLog::FlushActive
.
Calling Yield() recursively is normally an error and an assert failure is raised
in debug build if such situation is detected. However if the
onlyIfNeeded
parameter is
true
, the method will just silently return
false
instead.
wxArchiveClassFactorywxArchiveClassFactory
An abstract base class which serves as a common interface to archive class
factories such as
wxZipClassFactory
.
For each supported archive type (such as zip) there is a class factory derived
from wxArchiveClassFactory, which allows archive objects to be created in a
generic way, without knowing the particular type of archive being used.
Derived fromwxObjectInclude Files
<wx/archive.h>
See also
Archive formats such as zip [wxarc]
Generic archive programming [wxarcgeneric]
wxArchiveEntry
wxArchiveInputStream
wxArchiveOutputStream
MemberswxArchiveClassFactory::Get/SetConvwxMBConv& GetConv ()void SetConv (wxMBConv& conv)
The
wxMBConv
object that the created streams will use when translating meta-data. The initial
default, set by the constructor, is wxConvLocal.
wxArchiveClassFactory::GetInternalNamewxString GetInternalName (const wxString& name, wxPathFormat format = wxPATH_NATIVE)
Calls the static GetInternalName() function for the archive entry type, for
example
wxZipEntry::GetInternalName()
.
wxArchiveClassFactory::NewEntrywxArchiveEntry* NewEntry ()
Create a new
wxArchiveEntry
object of the appropriate type.
wxArchiveClassFactory::NewStreamwxArchiveInputStream* NewStream (wxInputStream& stream)wxArchiveOutputStream* NewStream (wxOutputStream& stream)
Create a new
wxArchiveInputStream
or
wxArchiveOutputStream
of the appropriate type.
wxArchiveEntrywxArchiveEntry
An abstract base class which serves as a common interface to archive entry
classes such as
wxZipEntry
. These hold the meta-data (filename, timestamp, etc.), for entries in archive
files such as zips and tars.
Non-seekable streams
This information applies only when reading archives from non-seekable streams.
When the stream is seekable
GetNextEntry()
returns a fully populated
wxArchiveEntry
. See '
Archives on non-seekable streams [wxarcnoseek]
' for more information.
For generic programming, when the worst case must be assumed, you can rely on
all the fields of wxArchiveEntry being fully populated when GetNextEntry()
returns, with the the following exceptions:
GetSize() [wxarchiveentrysize]
Guaranteed to be
available after the entry has been read to Eof(),
or CloseEntry() has been called
IsReadOnly() [wxarchiveentryisreadonly]
Guaranteed to
be available after the end of the archive has been reached, i.e. after
GetNextEntry() returns NULL and Eof() is true
Derived fromwxObjectInclude Files
<wx/archive.h>
See also
Archive formats such as zip [wxarc]
Generic archive programming [wxarcgeneric]
wxArchiveInputStream
wxArchiveOutputStream
wxArchiveNotifier
MemberswxArchiveEntry::ClonewxArchiveEntry* Clone ()
Returns a copy of this entry object.
wxArchiveEntry::Get/SetDateTimewxDateTime GetDateTime ()void SetDateTime (const wxDateTime& dt)
The entry's timestamp.
wxArchiveEntry::GetInternalFormatwxPathFormat GetInternalFormat ()
Returns the path format used internally within the archive to store filenames.
wxArchiveEntry::GetInternalNamewxString GetInternalName ()
Returns the entry's filename in the internal format used within the archive. The
name can include directory components, i.e. it can be a full path.
The names of directory entries are returned without any trailing path separator.
This gives a canonical name that can be used in comparisons.
See also
Looking up an archive entry by name [wxarcbyname]
wxArchiveEntry::Get/SetNamewxString GetName (wxPathFormat format = wxPATH_NATIVE)void SetName (const wxString& name, wxPathFormat format = wxPATH_NATIVE)
The entry's name, by default in the native format. The name can include
directory components, i.e. it can be a full path.
If this is a directory entry, (i.e. if
IsDir() [wxarchiveentryisdir]
is true) then GetName() returns the name with a trailing path separator.
Similarly, setting a name with a trailing path separator sets IsDir().
wxArchiveEntry::GetOffsetoff_t GetOffset ()
Returns a numeric value unique to the entry within the archive.
wxArchiveEntry::Get/SetSizeoff_t GetSize ()void SetSize (off_t size)
The size of the entry's data in bytes.
wxArchiveEntry::IsDir/SetIsDirbool IsDir ()void SetIsDir (bool isDir = true)
True if this is a directory entry.
Directory entries are entries with no data, which are used to store the
meta-data of directories. They also make it possible for completely empty
directories to be stored.
The names of entries within an archive can be complete paths, and unarchivers
typically create whatever directories are necessary as they restore files, even
if the archive contains no explicit directory entries.
wxArchiveEntry::IsReadOnly/SetIsReadOnlybool IsReadOnly ()void SetIsReadOnly (bool isReadOnly = true)
True if the entry is a read-only file.
wxArchiveEntry::Set/UnsetNotifiervoid SetNotifier (wxArchiveNotifier& notifier)void UnsetNotifier ()
Sets the
notifier
for this entry. Whenever the
wxArchiveInputStream
updates this entry, it will then invoke the associated notifier's
OnEntryUpdated
method.
Setting a notifier is not usually necessary. It is used to handle certain cases
when modifying an archive in a pipeline (i.e. between non-seekable streams).
See also
Archives on non-seekable streams [wxarcnoseek]
wxArchiveNotifier
wxArchiveInputStreamwxArchiveInputStream
An abstract base class which serves as a common interface to archive input
streams such as
wxZipInputStream
.
GetNextEntry()
returns an
wxArchiveEntry
object containing the meta-data for the next entry in the archive (and gives
away ownership). Reading from the wxArchiveInputStream then returns the entry's
data. Eof() becomes true after an attempt has been made to read past the end of
the entry's data. When there are no more entries, GetNextEntry() returns NULL
and sets Eof().
Derived fromwxFilterInputStreamInclude Files
<wx/archive.h>
Structs
typedef wxArchiveEntry entry_type
See also
Archive formats such as zip [wxarc]
wxArchiveEntry
wxArchiveOutputStream
MemberswxArchiveInputStream::CloseEntrybool CloseEntry ()
Closes the current entry. On a non-seekable stream reads to the end of the
current entry first.
wxArchiveInputStream::GetNextEntrywxArchiveEntry* GetNextEntry ()
Closes the current entry if one is open, then reads the meta-data for the next
entry and returns it in a
wxArchiveEntry
object, giving away ownership. Reading this wxArchiveInputStream then returns
the entry's data.
wxArchiveInputStream::OpenEntrybool OpenEntry (wxArchiveEntry& entry)
Closes the current entry if one is open, then opens the entry specified by the
wxArchiveEntry
object.
entry
must be from the same archive file that this wxArchiveInputStream is reading,
and it must be reading it from a seekable stream.
See also
Looking up an archive entry by name [wxarcbyname]
wxArchiveIteratorwxArchiveIterator
An input iterator template class that can be used to transfer an archive's
catalogue to a container. It is only available if wxUSE_STL is set to 1 in
setup.h, and the uses for it outlined below require a compiler which supports
member templates.
template <class Arc, class T = typename Arc::entry_type*>
class wxArchiveIterator
{
// this constructor creates an 'end of sequence' object
wxArchiveIterator();
// template parameter 'Arc' should be the type of an archive input stream
wxArchiveIterator(Arc& arc) {
/* ... */
};
The first template parameter should be the type of archive input stream (e.g.
wxArchiveInputStream
) and the second can either be a pointer to an entry (e.g.
wxArchiveEntry
*), or a string/pointer pair (e.g. std::pair<wxString,
wxArchiveEntry*>).
The
<wx/archive.h>
header defines the following typedefs:
typedef wxArchiveIterator<wxArchiveInputStream> wxArchiveIter;
typedef wxArchiveIterator<wxArchiveInputStream,
std::pair<wxString, wxArchiveEntry*> > wxArchivePairIter;
The header for any implementation of this interface should define similar
typedefs for its types, for example in
<wx/zipstrm.h>
there is:
typedef wxArchiveIterator<wxZipInputStream> wxZipIter;
typedef wxArchiveIterator<wxZipInputStream,
std::pair<wxString, wxZipEntry*> > wxZipPairIter;
Transferring the catalogue of an archive
arc
to a vector
cat
, can then be done something like this:
std::vector<wxArchiveEntry*> cat((wxArchiveIter)arc, wxArchiveIter());
When the iterator is dereferenced, it gives away ownership of an entry object.
So in the above example, when you have finished with
cat
you must delete the pointers it contains.
If you have smart pointers with normal copy semantics (i.e. not auto_ptr or
wxScopedPtr
), then you can create an iterator which uses them instead. For example, with a
smart pointer class for zip entries
ZipEntryPtr
:
typedef std::vector<ZipEntryPtr> ZipCatalog;
typedef wxArchiveIterator<wxZipInputStream, ZipEntryPtr> ZipIter;
ZipCatalog cat((ZipIter)zip, ZipIter());
Iterators that return std::pair objects can be used to populate a std::multimap,
to allow entries to be looked up by name. The string is initialised using the
wxArchiveEntry object's
GetInternalName()
function.
typedef std::multimap<wxString, wxZipEntry*> ZipCatalog;
ZipCatalog cat((wxZipPairIter)zip, wxZipPairIter());
Note that this iterator also gives away ownership of an entry object each time
it is dereferenced. So in the above example, when you have finished with
cat
you must delete the pointers it contains.
Or if you have them, a pair containing a smart pointer can be used (again
ZipEntryPtr
), no worries about ownership:
typedef std::multimap<wxString, ZipEntryPtr> ZipCatalog;
typedef wxArchiveIterator<wxZipInputStream,
std::pair<wxString, ZipEntryPtr> > ZipPairIter;
ZipCatalog cat((ZipPairIter)zip, ZipPairIter());
Include Files
<wx/archive.h>
Structs
typedef std::input_iterator_tag iterator_category
typedef T value_type
typedef ptrdiff_t difference_type
typedef T* pointer
typedef T& reference
See also
wxArchiveEntry
wxArchiveInputStream
wxArchiveOutputStream
MemberswxArchiveIterator::wxArchiveIterator wxArchiveIterator ()
Construct an 'end of sequence' instance.
wxArchiveIterator (Arc& arc)
Construct iterator that returns all the entries in the archive input stream
arc
.
wxArchiveIterator::operator*const T& operator* ()
Returns an entry object from the archive input stream, giving away ownership.
wxArchiveIterator::operator++wxArchiveIterator& operator++ ()wxArchiveIterator& operator++ (int )
Position the input iterator at the next entry in the archive input stream.
wxArchiveNotifierwxArchiveNotifier
If you need to know when a
wxArchiveInputStream
updates a
wxArchiveEntry
object, you can create a notifier by deriving from this abstract base class,
overriding
OnEntryUpdated()
. An instance of your notifier class can then be assigned to the wxArchiveEntry
object using
wxArchiveEntry::SetNotifier() [wxarchiveentrynotifier]
. Your OnEntryUpdated() method will then be invoked whenever the input stream
updates the entry.
Setting a notifier is not usually necessary. It is used to handle certain cases
when modifying an archive in a pipeline (i.e. between non-seekable streams). See
Archives on non-seekable streams [wxarcnoseek]
.
Include Files
<wx/archive.h>
See also
Archives on non-seekable streams [wxarcnoseek]
wxArchiveEntry
wxArchiveInputStream
wxArchiveOutputStream
MemberswxArchiveNotifier::OnEntryUpdatedvoid OnEntryUpdated (class wxArchiveEntry& entry)
This method must be overridden in your derived class.
wxArchiveOutputStreamwxArchiveOutputStream
An abstract base class which serves as a common interface to archive output
streams such as
wxZipOutputStream
.
PutNextEntry()
is used to create a new entry in the output archive, then the entry's data is
written to the wxArchiveOutputStream. Another call to PutNextEntry() closes the
current entry and begins the next.
Derived fromwxFilterOutputStreamInclude Files
<wx/archive.h>
See also
Archive formats such as zip [wxarc]
wxArchiveEntry
wxArchiveInputStream
MemberswxArchiveOutputStream::~wxArchiveOutputStream ~wxArchiveOutputStream ()
Calls
Close()
if it has not already been called.
wxArchiveOutputStream::Closebool Close ()
Closes the archive, returning true if it was successfully written. Called by the
destructor if not called explicitly.
wxArchiveOutputStream::CloseEntrybool CloseEntry ()
Close the current entry. It is called implicitly whenever another new entry is
created with
CopyEntry()
or
PutNextEntry()
, or when the archive is closed.
wxArchiveOutputStream::CopyArchiveMetaDatabool CopyArchiveMetaData (wxArchiveInputStream& stream)
Some archive formats have additional meta-data that applies to the archive as a
whole. For example in the case of zip there is a comment, which is stored at the
end of the zip file. CopyArchiveMetaData() can be used to transfer such
information when writing a modified copy of an archive.
Since the position of the meta-data can vary between the various archive
formats, it is best to call CopyArchiveMetaData() before transferring the
entries. The
wxArchiveOutputStream
will then hold on to the meta-data and write it at the correct point in the
output file.
When the input archive is being read from a non-seekable stream, the meta-data
may not be available when CopyArchiveMetaData() is called, in which case the two
streams set up a link and transfer the data when it becomes available.
wxArchiveOutputStream::CopyEntrybool CopyEntry (wxArchiveEntry* entry, wxArchiveInputStream& stream)
Takes ownership of
entry
and uses it to create a new entry in the archive.
entry
is then opened in the input stream
stream
and its contents copied to this stream.
For archive types which compress entry data, CopyEntry() is likely to be much
more efficient than transferring the data using Read() and Write() since it will
copy them without decompressing and recompressing them.
entry
must be from the same archive file that
stream
is accessing. For non-seekable streams,
entry
must also be the last thing read from
stream
.
wxArchiveOutputStream::PutNextDirEntrybool PutNextDirEntry (const wxString& name, const wxDateTime& dt = wxDateTime::Now())
Create a new directory entry (see
wxArchiveEntry::IsDir() [wxarchiveentryisdir]
) with the given name and timestamp.
PutNextEntry()
can also be used to create directory entries, by supplying a name with a
trailing path separator.
wxArchiveOutputStream::PutNextEntrybool PutNextEntry (wxArchiveEntry* entry)
Takes ownership of
entry
and uses it to create a new entry in the archive. The entry's data can then be
written by writing to this wxArchiveOutputStream.
bool PutNextEntry (const wxString& name, const wxDateTime& dt = wxDateTime::Now(), off_t size = wxInvalidOffset)
Create a new entry with the given name, timestamp and size. The entry's data can
then be written by writing to this wxArchiveOutputStream.
wxArraywxArray
This section describes the so called
dynamic arrays
. This is a C array-like data structure i.e. the member access time is constant
(and not linear according to the number of container elements as for linked
lists). However, these arrays are dynamic in the sense that they will
automatically allocate more memory if there is not enough of it for adding a new
element. They also perform range checking on the index values but in debug mode
only, so please be sure to compile your application in debug mode to use it (see
debugging overview [debuggingoverview]
for details). So, unlike the arrays in some other languages, attempt to access
an element beyond the arrays bound doesn't automatically expand the array but
provokes an assertion failure instead in debug build and does nothing (except
possibly crashing your program) in the release build.
The array classes were designed to be reasonably efficient, both in terms of
run-time speed and memory consumption and the executable size. The speed of
array item access is, of course, constant (independent of the number of
elements) making them much more efficient than linked lists (
wxList
). Adding items to the arrays is also implemented in more or less constant time
- but the price is preallocating the memory in advance. In the
memory management [wxarraymemorymanagement]
section you may find some useful hints about optimizing wxArray memory usage. As
for executable size, all wxArray functions are inline, so they do not take
any space at all
.
wxWidgets has three different kinds of array. All of them derive from
wxBaseArray class which works with untyped data and can not be used directly.
The standard macros WX_DEFINE_ARRAY(), WX_DEFINE_SORTED_ARRAY() and
WX_DEFINE_OBJARRAY() are used to define a new class deriving from it. The
classes declared will be called in this documentation wxArray, wxSortedArray and
wxObjArray but you should keep in mind that no classes with such names actually
exist, each time you use one of WX_DEFINE_XXXARRAY macro you define a class with
a new name. In fact, these names are "template" names and each usage
of one of the macros mentioned above creates a template specialization for the
given element type.
wxArray is suitable for storing integer types and pointers which it does not
treat as objects in any way, i.e. the element pointed to by the pointer is not
deleted when the element is removed from the array. It should be noted that all
of wxArray's functions are inline, so it costs strictly nothing to define as
many array types as you want (either in terms of the executable size or the
speed) as long as at least one of them is defined and this is always the case
because wxArrays are used by wxWidgets internally. This class has one serious
limitation: it can only be used for storing integral types (bool, char, short,
int, long and their unsigned variants) or pointers (of any kind). An attempt to
use with objects of sizeof() greater than sizeof(long) will provoke a runtime
assertion failure, however declaring a wxArray of floats will not (on the
machines where sizeof(float) <= sizeof(long)), yet it will
not
work, please use wxObjArray for storing floats and doubles (NB: a more efficient
wxArrayDouble class is scheduled for the next release of wxWidgets).
wxSortedArray is a wxArray variant which should be used when searching in the
array is a frequently used operation. It requires you to define an additional
function for comparing two elements of the array element type and always stores
its items in the sorted order (according to this function). Thus, it is
Index()
function execution time is O(log(N)) instead of O(N) for the usual arrays but
the
Add()
method is slower: it is O(log(N)) instead of constant time (neglecting time
spent in memory allocation routine). However, in a usual situation elements are
added to an array much less often than searched inside it, so wxSortedArray may
lead to huge performance improvements compared to wxArray. Finally, it should be
noticed that, as wxArray, wxSortedArray can be only used for storing integral
types or pointers.
wxObjArray class treats its elements like "objects". It may delete
them when they are removed from the array (invoking the correct destructor) and
copies them using the objects copy constructor. In order to implement this
behaviour the definition of the wxObjArray arrays is split in two parts: first,
you should declare the new wxObjArray class using WX_DECLARE_OBJARRAY() macro
and then you must include the file defining the implementation of template type:
<wx/arrimpl.cpp> and define the array class with WX_DEFINE_OBJARRAY()
macro from a point where the full (as opposed to `forward') declaration of the
array elements class is in scope. As it probably sounds very complicated here is
an example:
#include <wx/dynarray.h>
// we must forward declare the array because it is used inside the class
// declaration
class MyDirectory;
class MyFile;
// this defines two new types: ArrayOfDirectories and ArrayOfFiles which can be
// now used as shown below
WX_DECLARE_OBJARRAY(MyDirectory, ArrayOfDirectories);
WX_DECLARE_OBJARRAY(MyFile, ArrayOfFiles);
class MyDirectory
{
...
ArrayOfDirectories m_subdirectories; // all subdirectories
ArrayOfFiles m_files; // all files in this directory
};
...
// now that we have MyDirectory declaration in scope we may finish the
// definition of ArrayOfDirectories -- note that this expands into some C++
// code and so should only be compiled once (i.e., don't put this in the
// header, but into a source file or you will get linking errors)
#include <wx/arrimpl.cpp> // this is a magic incantation which must be done!
WX_DEFINE_OBJARRAY(ArrayOfDirectories);
// that's all!
It is not as elegant as writing
typedef std::vector<MyDirectory> ArrayOfDirectories;
but is not that complicated and allows the code to be compiled with any, however
dumb, C++ compiler in the world.
Things are much simpler for wxArray and wxSortedArray however: it is enough just
to write
WX_DEFINE_ARRAY(int, ArrayOfDirectories);
WX_DEFINE_SORTED_ARRAY(int, ArrayOfFiles);
i.e. there is only one
DEFINE
macro and no need for separate
DECLARE
one.
Include Files
<wx/dynarray.h>
See also
Container classes overview [wxcontaineroverview]
wxList
MemberswxArray::WX_DEFINE_ARRAY WX_DEFINE_ARRAY ( T, name) WX_DEFINE_EXPORTED_ARRAY ( T, name) WX_DEFINE_USER_EXPORTED_ARRAY ( T, name, exportspec)
This macro defines a new array class named
name
and containing the elements of type
T
. The second form is used when compiling wxWidgets as a DLL under Windows and
array needs to be visible outside the DLL. The third is needed for exporting an
array from a user DLL.
Example:
WX_DEFINE_ARRAY_INT(wxArrayInt);
class MyClass;
WX_DEFINE_ARRAY(MyClass *, wxArrayOfMyClass);
Note that wxWidgets predefines the following standard array classes: wxArrayInt,
wxArrayLong and wxArrayPtrVoid.
wxArray::WX_DEFINE_SORTED_ARRAY WX_DEFINE_SORTED_ARRAY ( T, name) WX_DEFINE_SORTED_EXPORTED_ARRAY ( T, name) WX_DEFINE_SORTED_USER_EXPORTED_ARRAY ( T, name)
This macro defines a new sorted array class named
name
and containing the elements of type
T
. The second form is used when compiling wxWidgets as a DLL under Windows and
array needs to be visible outside the DLL. The third is needed for exporting an
array from a user DLL.
Example:
WX_DEFINE_SORTED_ARRAY_INT(wxSortedArrayInt);
class MyClass;
WX_DEFINE_SORTED_ARRAY(MyClass *, wxArrayOfMyClass);
You will have to initialize the objects of this class by passing a comparison
function to the array object constructor like this:
int CompareInts(int n1, int n2)
{
return n1 - n2;
}
wxSortedArrayInt sorted(CompareInts);
int CompareMyClassObjects(MyClass *item1, MyClass *item2)
{
// sort the items by their address...
return Stricmp(item1->GetAddress(), item2->GetAddress());
}
wxArrayOfMyClass another(CompareMyClassObjects);
wxArray::WX_DECLARE_OBJARRAY WX_DECLARE_OBJARRAY ( T, name) WX_DECLARE_EXPORTED_OBJARRAY ( T, name) WX_DECLARE_USER_EXPORTED_OBJARRAY ( T, name)
This macro declares a new object array class named
name
and containing the elements of type
T
. The second form is used when compiling wxWidgets as a DLL under Windows and
array needs to be visible outside the DLL. The third is needed for exporting an
array from a user DLL.
Example:
class MyClass;
WX_DECLARE_OBJARRAY(MyClass, wxArrayOfMyClass); // note: not "MyClass *"!
You must use
WX_DEFINE_OBJARRAY() [wxdefineobjarray]
macro to define the array class - otherwise you would get link errors.
wxArray::WX_DEFINE_OBJARRAY WX_DEFINE_OBJARRAY ( name) WX_DEFINE_EXPORTED_OBJARRAY ( name) WX_DEFINE_USER_EXPORTED_OBJARRAY ( name)
This macro defines the methods of the array class
name
not defined by the
WX_DECLARE_OBJARRAY() [wxdeclareobjarray]
macro. You must include the file <wx/arrimpl.cpp> before using this macro
and you must have the full declaration of the class of array elements in scope!
If you forget to do the first, the error will be caught by the compiler, but,
unfortunately, many compilers will not give any warnings if you forget to do the
second - but the objects of the class will not be copied correctly and their
real destructor will not be called. The latter two forms are merely aliases of
the first to satisfy some people's sense of symmetry when using the exported
declarations.
Example of usage:
// first declare the class!
class MyClass
{
public:
MyClass(const MyClass&);
...
virtual ~MyClass();
};
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY(wxArrayOfMyClass);
wxArray::WX_APPEND_ARRAYvoid WX_APPEND_ARRAY (wxArray& array, wxArray& other)
This macro may be used to append all elements of the
other
array to the
array
. The two arrays must be of the same type.
wxArray::WX_CLEAR_ARRAYvoid WX_CLEAR_ARRAY (wxArray& array)
This macro may be used to delete all elements of the array before emptying it.
It can not be used with wxObjArrays - but they will delete their elements anyhow
when you call Empty().
wxArray::Defaultconstructors wxArray () wxObjArray ()
Default constructor initializes an empty array object.
wxSortedArray (int (*)(T first, T second) compareFunction)
There is no default constructor for wxSortedArray classes - you must initialize
it with a function to use for item comparison. It is a function which is passed
two arguments of type
T
where
T
is the array element type and which should return a negative, zero or positive
value according to whether the first element passed to it is less than, equal to
or greater than the second one.
wxArray::wxArraycopyconstructorandassignmentoperator wxArray (const wxArray& array) wxSortedArray (const wxSortedArray& array) wxObjArray (const wxObjArray& array)wxArray& operator= (const wxArray& array)wxSortedArray& operator= (const wxSortedArray& array)wxObjArray& operator= (const wxObjArray& array)
The copy constructors and assignment operators perform a shallow array copy
(i.e. they don't copy the objects pointed to even if the source array contains
the items of pointer type) for wxArray and wxSortedArray and a deep copy (i.e.
the array element are copied too) for wxObjArray.
wxArray::~wxArray ~wxArray () ~wxSortedArray () ~wxObjArray ()
The wxObjArray destructor deletes all the items owned by the array. This is not
done by wxArray and wxSortedArray versions - you may use
WX_CLEAR_ARRAY [wxcleararray]
macro for this.
wxArray::Addvoid Add (T item, size_t copies = 1)void Add (T * item)void Add (T & item, size_t copies = 1)
Appends the given number of
copies
of the
item
to the array consisting of the elements of type
T
.
The first version is used with wxArray and wxSortedArray. The second and the
third are used with wxObjArray. There is an important difference between them:
if you give a pointer to the array, it will take ownership of it, i.e. will
delete it when the item is deleted from the array. If you give a reference to
the array, however, the array will make a copy of the item and will not take
ownership of the original item. Once again, it only makes sense for wxObjArrays
because the other array types never take ownership of their elements. Also note
that you cannot append more than one pointer as reusing it would lead to
deleting it twice (or more) and hence to a crash.
You may also use
WX_APPEND_ARRAY [wxappendarray]
macro to append all elements of one array to another one but it is more
efficient to use
copies
parameter and modify the elements in place later if you plan to append a lot of
items.
wxArray::Allocvoid Alloc (size_t count)
Preallocates memory for a given number of array elements. It is worth calling
when the number of items which are going to be added to the array is known in
advance because it will save unneeded memory reallocation. If the array already
has enough memory for the given number of items, nothing happens.
wxArray::Clearvoid Clear ()
This function does the same as
Empty()
and additionally frees the memory allocated to the array.
wxArray::Countsize_t Count ()
Same as
GetCount()
. This function is deprecated - it exists only for compatibility.
wxObjArray::DetachT * Detach (size_t index)
Removes the element from the array, but, unlike,
Remove()
doesn't delete it. The function returns the pointer to the removed element.
wxArray::Emptyvoid Empty ()
Empties the array. For wxObjArray classes, this destroys all of the array
elements. For wxArray and wxSortedArray this does nothing except marking the
array of being empty - this function does not free the allocated memory, use
Clear()
for this.
wxArray::GetCountsize_t GetCount ()
Return the number of items in the array.
wxArray::Indexint Index (T& item, bool searchFromEnd = false)int Index (T& item)
The first version of the function is for wxArray and wxObjArray, the second is
for wxSortedArray only.
Searches the element in the array, starting from either beginning or the end
depending on the value of
searchFromEnd
parameter.
wxNOT_FOUND
is returned if the element is not found, otherwise the index of the element is
returned.
Linear search is used for the wxArray and wxObjArray classes but binary search
in the sorted array is used for wxSortedArray (this is why searchFromEnd
parameter doesn't make sense for it).
NB:
even for wxObjArray classes, the operator==() of the elements in the array is
not
used by this function. It searches exactly the given element in the array and so
will only succeed if this element had been previously added to the array, but
fail even if another, identical, element is in the array.
wxArray::Insertvoid Insert (T item, size_t n, size_t copies = 1)void Insert (T * item, size_t n)void Insert (T & item, size_t n, size_t copies = 1)
Insert the given number of
copies
of the
item
into the array before the existing item
n
- thus,
Insert(something, 0u)
will insert an item in such way that it will become the first array element.
Please see
Add()
for explanation of the differences between the overloaded versions of this
function.
wxArray::IsEmptybool IsEmpty ()
Returns true if the array is empty, false otherwise.
wxArray::ItemT& Item (size_t index)
Returns the item at the given position in the array. If
index
is out of bounds, an assert failure is raised in the debug builds but nothing
special is done in the release build.
The returned value is of type "reference to the array element type"
for all of the array classes.
wxArray::LastT& Last ()
Returns the last element in the array, i.e. is the same as Item(GetCount() - 1).
An assert failure is raised in the debug mode if the array is empty.
The returned value is of type "reference to the array element type"
for all of the array classes.
wxArray::Removevoid Remove (T item)
Removes an element from the array by value: the first item of the array equal to
item
is removed, an assert failure will result from an attempt to remove an item
which doesn't exist in the array.
When an element is removed from wxObjArray it is deleted by the array - use
Detach()
if you don't want this to happen. On the other hand, when an object is removed
from a wxArray nothing happens - you should delete it manually if required:
T *item = array[n];
delete item;
array.Remove(n)
See also
WX_CLEAR_ARRAY [wxcleararray]
macro which deletes all elements of a wxArray (supposed to contain pointers).
wxArray::RemoveAtvoid RemoveAt (size_t index, size_t count = 1)
Removes
count
elements starting at
index
from the array. When an element is removed from wxObjArray it is deleted by the
array - use
Detach()
if you don't want this to happen. On the other hand, when an object is removed
from a wxArray nothing happens - you should delete it manually if required:
T *item = array[n];
delete item;
array.RemoveAt(n)
See also
WX_CLEAR_ARRAY [wxcleararray]
macro which deletes all elements of a wxArray (supposed to contain pointers).
wxArray::SetCountvoid SetCount (size_t count, T defval = T(0))
This function ensures that the number of array elements is at least
count
. If the array has already
count
or more items, nothing is done. Otherwise,
count - GetCount()
elements are added and initialized to the value
defval
.
See also
GetCount
wxArray::Shrinkvoid Shrink ()
Frees all memory unused by the array. If the program knows that no new items
will be added to the array it may call Shrink() to reduce its memory usage.
However, if a new item is added to the array, some extra memory will be
allocated again.
wxArray::Sortvoid Sort (CMPFUNC<T> compareFunction)
The notation CMPFUNC<T> should be read as if we had the following
declaration:
template int CMPFUNC(T *first, T *second);
where
T
is the type of the array elements. I.e. it is a function returning
int
which is passed two arguments of type
T *
.
Sorts the array using the specified compare function: this function should
return a negative, zero or positive value according to whether the first element
passed to it is less than, equal to or greater than the second one.
wxSortedArray doesn't have this function because it is always sorted.
wxArrayStringwxArrayString
wxArrayString is an efficient container for storing
wxString
objects. It has the same features as all
wxArray
classes, i.e. it dynamically expands when new items are added to it (so it is as
easy to use as a linked list), but the access time to the elements is constant,
instead of being linear in number of elements as in the case of linked lists. It
is also very size efficient and doesn't take more space than a C array
wxString[]
type (wxArrayString uses its knowledge of internals of wxString class to achieve
this).
This class is used in the same way as other dynamic
arrays
, except that no
WX_DEFINE_ARRAY
declaration is needed for it. When a string is added or inserted in the array, a
copy of the string is created, so the original string may be safely deleted
(e.g. if it was a
char *
pointer the memory it was using can be freed immediately after this). In
general, there is no need to worry about string memory deallocation when using
this class - it will always free the memory it uses itself.
The references returned by
Item
,
Last
or
operator[] [wxarraystringoperatorindex]
are not constant, so the array elements may be modified in place like this
array.Last().MakeUpper();
There is also a variant of wxArrayString called wxSortedArrayString which has
exactly the same methods as wxArrayString, but which always keeps the string in
it in (alphabetical) order. wxSortedArrayString uses binary search in its
Index
function (instead of linear search for wxArrayString::Index) which makes it much
more efficient if you add strings to the array rarely (because, of course, you
have to pay for Index() efficiency by having Add() be slower) but search for
them often. Several methods should not be used with sorted array (basically, all
which break the order of items) which is mentioned in their description.
Final word: none of the methods of wxArrayString is virtual including its
destructor, so this class should not be used as a base class.
Include Files
<wx/arrstr.h>
See also
wxArray
wxString
wxString overview [wxstringoverview]
MemberswxArrayString::wxArrayString wxArrayString ()
Default constructor.
wxArrayString (const wxArrayString& array)
Copy constructor. Note that when an array is assigned to a sorted array, its
contents is automatically sorted during construction.
wxArrayString (size_t sz, const wxChar** arr)
Constructor from a C string array. Pass a size
sz
and array
arr
.
wxArrayString (size_t sz, const wxString* arr)
Constructor from a wxString array. Pass a size
sz
and array
arr
.
wxArrayString::~wxArrayString ~wxArrayString ()
Destructor frees memory occupied by the array strings. For the performance
reasons it is not virtual, so this class should not be derived from.
wxArrayString::operator=wxArrayString & operator = (const wxArrayString& array)
Assignment operator.
wxArrayString::operator==bool operator == (const wxArrayString& array)
Compares 2 arrays respecting the case. Returns true only if the arrays have the
same number of elements and the same strings in the same order.
wxArrayString::operator!=bool operator != (const wxArrayString& array)
Compares 2 arrays respecting the case. Returns true if the arrays have different
number of elements or if the elements don't match pairwise.
wxArrayString::operator[]wxString& operator[] (size_t nIndex)
Return the array element at position
nIndex
. An assert failure will result from an attempt to access an element beyond the
end of array in debug mode, but no check is done in release mode.
This is the operator version of
Item
method.
wxArrayString::Addsize_t Add (const wxString& str, size_t copies = 1)
Appends the given number of
copies
of the new item
str
to the array and returns the index of the first new item in the array.
Warning:
For sorted arrays, the index of the inserted item will not be, in general, equal
to
GetCount()
- 1 because the item is inserted at the correct position to keep the array
sorted and not appended.
See also
Insert
wxArrayString::Allocvoid Alloc (size_t nCount)
Preallocates enough memory to store
nCount
items. This function may be used to improve array class performance before
adding a known number of items consecutively.
See also
Dynamic array memory management [wxarraymemorymanagement]
wxArrayString::Clearvoid Clear ()
Clears the array contents and frees memory.
See also
Empty
wxArrayString::Countsize_t Count ()
Returns the number of items in the array. This function is deprecated and is for
backwards compatibility only, please use
GetCount
instead.
wxArrayString::Emptyvoid Empty ()
Empties the array: after a call to this function
GetCount
will return 0. However, this function does not free the memory used by the array
and so should be used when the array is going to be reused for storing other
strings. Otherwise, you should use
Clear
to empty the array and free memory.
wxArrayString::GetCountsize_t GetCount ()
Returns the number of items in the array.
wxArrayString::Indexint Index (const char * sz, bool bCase = true, bool bFromEnd = false)
Search the element in the array, starting from the beginning if
bFromEnd
is false or from end otherwise. If
bCase
, comparison is case sensitive (default), otherwise the case is ignored.
This function uses linear search for wxArrayString and binary search for
wxSortedArrayString, but it ignores the
bCase
and
bFromEnd
parameters in the latter case.
Returns index of the first item matched or
wxNOT_FOUND
if there is no match.
wxArrayString::Insertvoid Insert (const wxString& str, size_t nIndex, size_t copies = 1)
Insert the given number of
copies
of the new element in the array before the position
nIndex
. Thus, for example, to insert the string in the beginning of the array you
would write
Insert("foo", 0);
If
nIndex
is equal to
GetCount()
this function behaves as
Add
.
Warning:
this function should not be used with sorted arrays because it could break the
order of items and, for example, subsequent calls to
Index()
would then not work!
wxArrayString::IsEmptybool IsEmpty ()
Returns true if the array is empty, false otherwise. This function returns the
same result as
GetCount() == 0
but is probably easier to read.
wxArrayString::ItemwxString& Item (size_t nIndex)
Return the array element at position
nIndex
. An assert failure will result from an attempt to access an element beyond the
end of array in debug mode, but no check is done in release mode.
See also
operator[] [wxarraystringoperatorindex]
for the operator version.
wxArrayString::LastwxString& Last ()
Returns the last element of the array. Attempt to access the last element of an
empty array will result in assert failure in debug build, however no checks are
done in release mode.
wxArrayString::Removevoid Remove (const char * sz)
Removes the first item matching this value. An assert failure is provoked by an
attempt to remove an element which does not exist in debug build.
See also
Index
wxArrayString::RemoveAtvoid RemoveAt (size_t nIndex, size_t count = 1)
Removes
count
items starting at position
nIndex
from the array.
wxArrayString::Shrinkvoid Shrink ()
Releases the extra memory allocated by the array. This function is useful to
minimize the array memory consumption.
See also
Alloc
,
Dynamic array memory management [wxarraymemorymanagement]
wxArrayString::Sortvoid Sort (bool reverseOrder = false)
Sorts the array in alphabetical order or in reverse alphabetical order if
reverseOrder
is true. The sort is case-sensitive.
Warning:
this function should not be used with sorted array because it could break the
order of items and, for example, subsequent calls to
Index()
would then not work!
void Sort (CompareFunction compareFunction)
Sorts the array using the specified
compareFunction
for item comparison.
CompareFunction
is defined as a function taking two
const
wxString&
parameters and returning an
int
value less than, equal to or greater than 0 if the first string is less than,
equal to or greater than the second one.
wxArtProviderwxArtProvider
wxArtProvider class is used to customize the look of wxWidgets application. When
wxWidgets needs to display an icon or a bitmap (e.g. in the standard file
dialog), it does not use a hard-coded resource but asks wxArtProvider for it
instead. This way users can plug in their own wxArtProvider class and easily
replace standard art with their own version. All that is needed is to derive a
class from wxArtProvider, override its
CreateBitmap
method and register the provider with
wxArtProvider::PushProvider
:
class MyProvider : public wxArtProvider
{
protected:
wxBitmap CreateBitmap(const wxArtID& id,
const wxArtClient& client,
const wxSize size)
{ ... }
};
...
wxArtProvider::PushProvider(new MyProvider);
There's another way of taking advantage of this class: you can use it in your
code and use platform native icons as provided by
wxArtProvider::GetBitmap
or
wxArtProvider::GetIcon
(NB: this is not yet really possible as of wxWidgets 2.3.3, the set of
wxArtProvider bitmaps is too small).
Identifying art resources
Every bitmap is known to wxArtProvider under an unique ID that is used by when
requesting a resource from it. The ID is represented by wxArtID type and can
have one of these predefined values (you can see bitmaps represented by these
constants in the
artprov [sampleartprovider]
sample):
•wxART_ADD_BOOKMARK•wxART_DEL_BOOKMARK•wxART_HELP_SIDE_PANEL•wxART_HELP_SETTINGS•wxART_HELP_BOOK•wxART_HELP_FOLDER•wxART_HELP_PAGE•wxART_GO_BACK•wxART_GO_FORWARD•wxART_GO_UP•wxART_GO_DOWN•wxART_GO_TO_PARENT•wxART_GO_HOME•wxART_FILE_OPEN•wxART_PRINT•wxART_HELP•wxART_TIP•wxART_REPORT_VIEW•wxART_LIST_VIEW•wxART_NEW_DIR•wxART_FOLDER•wxART_GO_DIR_UP•wxART_EXECUTABLE_FILE•wxART_NORMAL_FILE•wxART_TICK_MARK•wxART_CROSS_MARK•wxART_ERROR•wxART_QUESTION•wxART_WARNING•wxART_INFORMATION•wxART_MISSING_IMAGE
Additionally, any string recognized by custom art providers registered using
PushProvider
may be used.
GTK+ Note
When running under GTK+ 2, GTK+ stock item IDs (e.g.
"gtk-cdrom"
) may be used as well. Additionally, if wxGTK was compiled against GTK+ >=
2.4, then it is also possible to load icons from current icon theme by
specifying their name (without extension and directory components). Icon themes
recognized by GTK+ follow the
http://freedesktop.org/Standards/icon-theme-spec
. Note that themes are not guaranteed to contain all icons, so wxArtProvider may
return
wxNullBitmap
or
wxNullIcon
. Default theme is typically installed in
/usr/share/icons/hicolor
.
Clients
Client is the entity that calls wxArtProvider's GetBitmap or GetIcon function.
It is represented by wxClientID type and can have one of these values:
•wxART_TOOLBAR•wxART_MENU•wxART_BUTTON•wxART_FRAME_ICON•wxART_CMN_DIALOG•wxART_HELP_BROWSER•wxART_MESSAGE_BOX•wxART_OTHER (used for all requests that don't fit into any of the categories
above)
Client ID servers as a hint to wxArtProvider that is supposed to help it to
choose the best looking bitmap. For example it is often desirable to use
slightly different icons in menus and toolbars even though they represent the
same action (e.g.
wx_ART_FILE_OPEN
). Remember that this is really only a hint for wxArtProvider -- it is common
that
wxArtProvider::GetBitmap
returns identical bitmap for different
client
values!
Derived fromwxObjectInclude Files
<wx/artprov.h>
See also
See the
artprov [sampleartprovider]
sample for an example of wxArtProvider usage.
MemberswxArtProvider::CreateBitmapwxBitmap CreateBitmap (const wxArtID& id, const wxArtClient& client, const wxSize& size)
Derived art provider classes must override this method to create requested art
resource. Note that returned bitmaps are cached by wxArtProvider and it is
therefore not necessary to optimize CreateBitmap for speed (e.g. you may create
wxBitmap objects from XPMs here).
wxArtProvider::GetBitmapstatic wxBitmap GetBitmap (const wxArtID& id, const wxArtClient& client = wxART_OTHER, const wxSize& size = wxDefaultSize)
Query registered providers for bitmap with given ID.
wxArtProvider::GetIconstatic wxIcon GetIcon (const wxArtID& id, const wxArtClient& client = wxART_OTHER, const wxSize& size = wxDefaultSize)
Same as
wxArtProvider::GetBitmap
, but return a wxIcon object (or wxNullIcon on failure).
static wxSize GetSizeHint (const wxArtClient& client, bool platform_default = false)
Returns a suitable size hint for the given
wxArtClient
. If
platform_default
is true, return a size based on the current platform, otherwise return the size
from the topmost wxArtProvider.
wxDefaultSize
may be returned if the client doesn't have a specified size, like wxART_OTHER
for example.
wxArtProvider::PopProviderstatic bool PopProvider ()
Remove latest added provider and delete it.
wxArtProvider::PushProviderstatic void PushProvider (wxArtProvider* provider)
Register new art provider (add it to the top of providers stack).
wxArtProvider::RemoveProviderstatic bool RemoveProvider (wxArtProvider* provider)
Remove a provider from the stack. The provider must have been added previously
and is
not
deleted.
wxAutomationObjectwxAutomationObject
The
wxAutomationObject
class represents an OLE automation object containing a single data member, an
IDispatch pointer. It contains a number of functions that make it easy to
perform automation operations, and set and get properties. The class makes heavy
use of the
wxVariant
class.
The usage of these classes is quite close to OLE automation usage in Visual
Basic. The API is high-level, and the application can specify multiple
properties in a single string. The following example gets the current Excel
instance, and if it exists, makes the active cell bold.
wxAutomationObject excelObject;
if (excelObject.GetInstance("Excel.Application"))
excelObject.PutProperty("ActiveCell.Font.Bold", true);
Note that this class obviously works under Windows only.
Derived fromwxObjectInclude Files
<wx/msw/ole/automtn.h>
See also
wxVariant
MemberswxAutomationObject::wxAutomationObject wxAutomationObject (WXIDISPATCH* dispatchPtr = NULL)
Constructor, taking an optional IDispatch pointer which will be released when
the object is deleted.
wxAutomationObject::~wxAutomationObject ~wxAutomationObject ()
Destructor. If the internal IDispatch pointer is non-null, it will be released.
wxAutomationObject::CallMethodwxVariant CallMethod (const wxString& method, int noArgs, wxVariant args[])wxVariant CallMethod (const wxString& method, ... )
Calls an automation method for this object. The first form takes a method name,
number of arguments, and an array of variants. The second form takes a method
name and zero to six constant references to variants. Since the variant class
has constructors for the basic data types, and C++ provides temporary objects
automatically, both of the following lines are syntactically valid:
wxVariant res = obj.CallMethod("Sum", wxVariant(1.2), wxVariant(3.4));
wxVariant res = obj.CallMethod("Sum", 1.2, 3.4);
Note that
method
can contain dot-separated property names, to save the application needing to
call GetProperty several times using several temporary objects. For example:
object.CallMethod("ActiveCell.Font.ShowDialog", "My caption");
wxAutomationObject::CreateInstancebool CreateInstance (const wxString& classId)
Creates a new object based on the class id, returning true if the object was
successfully created, or false if not.
wxAutomationObject::GetDispatchPtrIDispatch* GetDispatchPtr ()
Gets the IDispatch pointer.
wxAutomationObject::GetInstancebool GetInstance (const wxString& classId)
Retrieves the current object associated with a class id, and attaches the
IDispatch pointer to this object. Returns true if a pointer was successfully
retrieved, false otherwise.
Note that this cannot cope with two instances of a given OLE object being active
simultaneously, such as two copies of Excel running. Which object is referenced
cannot currently be specified.
wxAutomationObject::GetObjectbool GetObject (wxAutomationObject& obj, const wxString& property, int noArgs = 0, wxVariant args[] = NULL)
Retrieves a property from this object, assumed to be a dispatch pointer, and
initialises
obj
with it. To avoid having to deal with IDispatch pointers directly, use this
function in preference to
wxAutomationObject::GetProperty
when retrieving objects from other objects.
Note that an IDispatch pointer is stored as a void* pointer in wxVariant
objects.
See also
wxAutomationObject::GetProperty
wxAutomationObject::GetPropertywxVariant GetProperty (const wxString& property, int noArgs, wxVariant args[])wxVariant GetProperty (const wxString& property, ... )
Gets a property value from this object. The first form takes a property name,
number of arguments, and an array of variants. The second form takes a property
name and zero to six constant references to variants. Since the variant class
has constructors for the basic data types, and C++ provides temporary objects
automatically, both of the following lines are syntactically valid:
wxVariant res = obj.GetProperty("Range", wxVariant("A1"));
wxVariant res = obj.GetProperty("Range", "A1");
Note that
property
can contain dot-separated property names, to save the application needing to
call GetProperty several times using several temporary objects.
wxAutomationObject::Invokebool Invoke (const wxString& member, int action, wxVariant& retValue, int noArgs, wxVariant args[], const wxVariant* ptrArgs[] = 0)
This function is a low-level implementation that allows access to the IDispatch
Invoke function. It is not meant to be called directly by the application, but
is used by other convenience functions.
.
wxAutomationObject::PutPropertybool PutProperty (const wxString& property, int noArgs, wxVariant args[])bool PutProperty (const wxString& property, ... )
Puts a property value into this object. The first form takes a property name,
number of arguments, and an array of variants. The second form takes a property
name and zero to six constant references to variants. Since the variant class
has constructors for the basic data types, and C++ provides temporary objects
automatically, both of the following lines are syntactically valid:
obj.PutProperty("Value", wxVariant(23));
obj.PutProperty("Value", 23);
Note that
property
can contain dot-separated property names, to save the application needing to
call GetProperty several times using several temporary objects.
wxAutomationObject::SetDispatchPtrvoid SetDispatchPtr (WXIDISPATCH* dispatchPtr)
Sets the IDispatch pointer. This function does not check if there is already an
IDispatch pointer.
You may need to cast from IDispatch* to WXIDISPATCH* when calling this
function.
wxBitmapwxBitmap
This class encapsulates the concept of a platform-dependent bitmap, either
monochrome or colour or colour with alpha channel support.
Derived fromwxGDIObjectwxObjectInclude Files
<wx/bitmap.h>
Predefs
Objects:
wxNullBitmap
See also
wxBitmap overview [wxbitmapoverview]
,
supported bitmap file formats [supportedbitmapformats]
,
wxDC::Blit
,
wxIcon
wxCursor
wxBitmap
,
wxMemoryDC
MemberswxBitmap::wxBitmap wxBitmap ()
Default constructor.
wxBitmap (const wxBitmap& bitmap)
Copy constructor. Note that this does not take a fresh copy of the data, but
instead makes the internal data point to
bitmap
's data. So changing one bitmap will change the other. To make a real copy, you
can use:
wxBitmap newBitmap = oldBitmap.GetSubBitmap(
wxRect(0, 0, oldBitmap.GetWidth(), oldBitmap.GetHeight()));
wxBitmap (void* data, int type, int width, int height, int depth = -1)
Creates a bitmap from the given data which is interpreted in platform-dependent
manner.
wxBitmap (const char bits[], int width, int height, int depth = 1)
Creates a bitmap from an array of bits.
You should only use this function for monochrome bitmaps (
depth
1) in portable programs: in this case the
bits
parameter should contain an XBM image.
For other bit depths, the behaviour is platform dependent: under Windows, the
data is passed without any changes to the underlying
CreateBitmap()
API. Under other platforms, only monochrome bitmaps may be created using this
constructor and
wxImage
should be used for creating colour bitmaps from static data.
wxBitmap (int width, int height, int depth = -1)
Creates a new bitmap. A depth of -1 indicates the depth of the current screen or
visual. Some platforms only support 1 for monochrome and -1 for the current
colour setting. Beginning with version 2.5.4 of wxWidgets a depth of 32
including an alpha channel is supported under MSW, Mac and GTK+.
wxBitmap (const char** bits)
Creates a bitmap from XPM data.
wxBitmap (const wxString& name, long type)
Loads a bitmap from a file or resource.
wxBitmap (const wxImage& img, int depth = -1)
Creates bitmap object from the image. This has to be done to actually display an
image as you cannot draw an image directly on a window. The resulting bitmap
will use the provided colour depth (or that of the current system if depth is
-1) which entails that a colour reduction has to take place.
When in 8-bit mode (PseudoColour mode), the GTK port will use a color cube
created on program start-up to look up colors. This ensures a very fast
conversion, but the image quality won't be perfect (and could be better for
photo images using more sophisticated dithering algorithms).
On Windows, if there is a palette present (set with SetPalette), it will be used
when creating the wxBitmap (most useful in 8-bit display mode). On other
platforms, the palette is currently ignored.
See also
wxBitmap::LoadFile