Finished review of Dialogs category of functions and macros as well as choicdlg.h (assigned to myself).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52618 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Bryan Petty 2008-03-18 19:30:01 +00:00
parent 0c2d0fcf98
commit ba2874ff30
11 changed files with 385 additions and 328 deletions

View File

@ -190,7 +190,7 @@ public:
info.SetName(_("My Program")); info.SetName(_("My Program"));
info.SetVersion(_("1.2.3 Beta")); info.SetVersion(_("1.2.3 Beta"));
info.SetDescription(_("This program does something great.")); info.SetDescription(_("This program does something great."));
info.SetCopyright(_T("(C) 2007 Me my@email.addre.ss")); info.SetCopyright(_T("(C) 2007 Me <my@email.addre.ss>"));
wxAboutBox(info); wxAboutBox(info);
} }
@ -199,6 +199,8 @@ public:
Please see the @ref page_utils_samples_dialogs for more examples of Please see the @ref page_utils_samples_dialogs for more examples of
using this function and wxAboutDialogInfo for the description of the using this function and wxAboutDialogInfo for the description of the
information which can be shown in the about dialog. information which can be shown in the about dialog.
@header{wx/aboutdlg.h}
*/ */
void wxAboutBox(const wxAboutDialogInfo& info); void wxAboutBox(const wxAboutDialogInfo& info);
@ -214,6 +216,8 @@ void wxAboutBox(const wxAboutDialogInfo& info);
customization. customization.
@see wxAboutDialogInfo @see wxAboutDialogInfo
@header{wx/aboutdlg.h}
*/ */
void wxGenericAboutBox(const wxAboutDialogInfo& info); void wxGenericAboutBox(const wxAboutDialogInfo& info);

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: choicdlg.h // Name: choicdlg.h
// Purpose: interface of wxMultiChoiceDialog // Purpose: interface of wx[Multi|Single]ChoiceDialog
// Author: wxWidgets team // Author: wxWidgets team
// RCS-ID: $Id$ // RCS-ID: $Id$
// Licence: wxWindows license // Licence: wxWindows license
@ -16,8 +16,7 @@
@library{wxbase} @library{wxbase}
@category{cmndlg} @category{cmndlg}
@see @ref overview_wxmultichoicedialogoverview "wxMultiChoiceDialog overview", @see @ref overview_cmndlg_multichoice, wxSingleChoiceDialog
wxSingleChoiceDialog
*/ */
class wxMultiChoiceDialog : public wxDialog class wxMultiChoiceDialog : public wxDialog
{ {
@ -38,52 +37,21 @@ public:
An array of strings, or a string list, containing the choices. An array of strings, or a string list, containing the choices.
@param style @param style
A dialog style (bitlist) containing flags chosen from standard A dialog style (bitlist) containing flags chosen from standard
dialog styles and the following: dialog style and the ones listed below. The default value is
equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK |
wxCANCEL | wxCENTRE.
wxOK
Show an OK button.
wxCANCEL
Show a Cancel button.
wxCENTRE
Centre the message. Not Windows.
The default value is equivalent to wxDEFAULT_DIALOG_STYLE |
wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE.
@param pos @param pos
Dialog position. Not Windows. Dialog position. Not Windows.
@beginStyleTable
@style{wxOK}:
Show an OK button.
@style{wxCANCEL}:
Show a Cancel button.
@style{wxCENTRE}:
Centre the message. Not Windows.
@endStyleTable
@remarks Use ShowModal() to show the dialog. @remarks Use ShowModal() to show the dialog.
*/ */
wxMultiChoiceDialog(wxWindow* parent, const wxString& message, wxMultiChoiceDialog(wxWindow* parent, const wxString& message,
@ -122,22 +90,22 @@ public:
@class wxSingleChoiceDialog @class wxSingleChoiceDialog
@wxheader{choicdlg.h} @wxheader{choicdlg.h}
This class represents a dialog that shows a list of strings, and allows the This class represents a dialog that shows a list of strings, and allows
user to select one. Double-clicking on a list item is equivalent to the user to select one. Double-clicking on a list item is equivalent to
single-clicking and then pressing OK. single-clicking and then pressing OK.
@library{wxbase} @library{wxbase}
@category{cmndlg} @category{cmndlg}
@see @ref overview_wxsinglechoicedialogoverview "wxSingleChoiceDialog @see @ref overview_cmndlg_singlechoice, wxMultiChoiceDialog
overview", wxMultiChoiceDialog
*/ */
class wxSingleChoiceDialog : public wxDialog class wxSingleChoiceDialog : public wxDialog
{ {
public: public:
//@{ //@{
/** /**
Constructor, taking an array of wxString choices and optional client data. Constructor, taking an array of wxString choices and optional client
data.
@param parent @param parent
Parent window. Parent window.
@ -154,52 +122,21 @@ public:
See GetSelectionClientData. See GetSelectionClientData.
@param style @param style
A dialog style (bitlist) containing flags chosen from standard A dialog style (bitlist) containing flags chosen from standard
dialog styles and the following: dialog styles and the ones listed below. The default value is
equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK |
wxCANCEL | wxCENTRE.
wxOK
Show an OK button.
wxCANCEL
Show a Cancel button.
wxCENTRE
Centre the message. Not Windows.
The default value is equivalent to wxDEFAULT_DIALOG_STYLE |
wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE.
@param pos @param pos
Dialog position. Not Windows. Dialog position. Not Windows.
@beginStyleTable
@style{wxOK}:
Show an OK button.
@style{wxCANCEL}:
Show a Cancel button.
@style{wxCENTRE}:
Centre the message. Not Windows.
@endStyleTable
@remarks Use ShowModal() to show the dialog. @remarks Use ShowModal() to show the dialog.
*/ */
wxSingleChoiceDialog(wxWindow* parent, const wxString& message, wxSingleChoiceDialog(wxWindow* parent, const wxString& message,
@ -250,10 +187,14 @@ public:
// Global functions/macros // Global functions/macros
// ============================================================================ // ============================================================================
/** @ingroup group_funcmacro_dialog */
//@{ //@{
/** /**
As @b wxGetSingleChoice but returns the index representing the selected Same as wxGetSingleChoice() but returns the index representing the
string. If the user pressed cancel, -1 is returned. selected string. If the user pressed cancel, -1 is returned.
@header{wx/choicdlg.h}
*/ */
int wxGetSingleChoiceIndex(const wxString& message, int wxGetSingleChoiceIndex(const wxString& message,
const wxString& caption, const wxString& caption,
@ -274,20 +215,27 @@ int wxGetSingleChoiceIndex(const wxString& message,
bool centre = true, bool centre = true,
int width = 150, int width = 150,
int height = 200); int height = 200);
//@} //@}
/** @ingroup group_funcmacro_dialog */
//@{ //@{
/** /**
Pops up a dialog box containing a message, OK/Cancel buttons and a 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 single-selection listbox. The user may choose an item and press OK to
string or Cancel to return the empty string. Use return a string or Cancel to return the empty string. Use
wxGetSingleChoiceIndex() if empty string is a wxGetSingleChoiceIndex() if empty string is a valid choice and if you want
valid choice and if you want to be able to detect pressing Cancel reliably. to be able to detect pressing Cancel reliably.
You may pass the list of strings to choose from either using @e choices
You may pass the list of strings to choose from either using @c choices
which is an array of @a n strings for the listbox or by using a single which is an array of @a n strings for the listbox or by using a single
@a aChoices parameter of type wxArrayString. @c aChoices parameter of type wxArrayString.
If @a centre is @true, the message text (which may include new line
If @c centre is @true, the message text (which may include new line
characters) is centred; if @false, the message is left-justified. characters) is centred; if @false, the message is left-justified.
@header{wx/choicdlg.h}
*/ */
wxString wxGetSingleChoice(const wxString& message, wxString wxGetSingleChoice(const wxString& message,
const wxString& caption, const wxString& caption,
@ -308,14 +256,19 @@ wxString wxGetSingleChoice(const wxString& message,
bool centre = true, bool centre = true,
int width = 150, int width = 150,
int height = 200); int height = 200);
//@} //@}
/** @ingroup group_funcmacro_dialog */
//@{ //@{
/** /**
As @b wxGetSingleChoice but takes an array of client data pointers Same as wxGetSingleChoice but takes an array of client data pointers
corresponding to the strings, and returns one of these pointers or @NULL if corresponding to the strings, and returns one of these pointers or @NULL
Cancel was pressed. The @e client_data array must have the same number of if Cancel was pressed. The @c client_data array must have the same number
elements as @e choices or @e aChoices! of elements as @c choices or @c aChoices!
@header{wx/choicdlg.h}
*/ */
wxString wxGetSingleChoiceData(const wxString& message, wxString wxGetSingleChoiceData(const wxString& message,
const wxString& caption, const wxString& caption,
@ -338,20 +291,27 @@ wxString wxGetSingleChoiceData(const wxString& message,
bool centre = true, bool centre = true,
int width = 150, int width = 150,
int height = 200); int height = 200);
//@} //@}
/** @ingroup group_funcmacro_dialog */
//@{ //@{
/** /**
Pops up a dialog box containing a message, OK/Cancel buttons and a Pops up a dialog box containing a message, OK/Cancel buttons and a
multiple-selection listbox. The user may choose an arbitrary (including 0) multiple-selection listbox. The user may choose an arbitrary (including 0)
number of items in the listbox whose indices will be returned in number of items in the listbox whose indices will be returned in
@e selection array. The initial contents of this array will be used to @c selections array. The initial contents of this array will be used to
select the items when the dialog is shown. select the items when the dialog is shown.
You may pass the list of strings to choose from either using @e choices
You may pass the list of strings to choose from either using @c choices
which is an array of @a n strings for the listbox or by using a single which is an array of @a n strings for the listbox or by using a single
@a aChoices parameter of type wxArrayString. @c aChoices parameter of type wxArrayString.
If @a centre is @true, the message text (which may include new line
If @c centre is @true, the message text (which may include new line
characters) is centred; if @false, the message is left-justified. characters) is centred; if @false, the message is left-justified.
@header{wx/choicdlg.h}
*/ */
size_t wxGetMultipleChoices(wxArrayInt& selections, size_t wxGetMultipleChoices(wxArrayInt& selections,
const wxString& message, const wxString& message,
@ -374,5 +334,6 @@ size_t wxGetMultipleChoices(wxArrayInt& selections,
bool centre = true, bool centre = true,
int width = 150, int width = 150,
int height = 200); int height = 200);
//@} //@}

View File

@ -62,25 +62,31 @@ public:
// Global functions/macros // Global functions/macros
// ============================================================================ // ============================================================================
/** @ingroup group_funcmacro_dialog */
//@{
/** /**
Shows the colour selection dialog and returns the colour selected by user or Shows the colour selection dialog and returns the colour selected by user
invalid colour (use @ref wxColour::isok wxColour:IsOk to test whether a colour or invalid colour (use wxColour::IsOk() to test whether a colour is valid)
is valid) if the dialog was cancelled. if the dialog was cancelled.
@param parent @param parent
The parent window for the colour selection dialog The parent window for the colour selection dialog.
@param colInit @param colInit
If given, this will be the colour initially selected in the dialog. If given, this will be the colour initially selected in the dialog.
@param caption @param caption
If given, this will be used for the dialog caption. If given, this will be used for the dialog caption.
@param data @param data
Optional object storing additional colour dialog settings, such Optional object storing additional colour dialog settings, such as
as custom colours. If none is provided the same settings as the last time custom colours. If none is provided the same settings as the last time
are are used.
used.
@header{wx/colordlg.h}
*/ */
wxColour wxGetColourFromUser(wxWindow* parent, wxColour wxGetColourFromUser(wxWindow* parent,
const wxColour& colInit, const wxColour& colInit,
const wxString& caption = wxEmptyString, const wxString& caption = wxEmptyString,
wxColourData* data = NULL); wxColourData* data = NULL);
//@}

View File

@ -99,10 +99,14 @@ public:
// Global functions/macros // Global functions/macros
// ============================================================================ // ============================================================================
/** @ingroup group_funcmacro_dialog */
//@{
/** /**
Pops up a directory selector dialog. The arguments have the same meaning as Pops up a directory selector dialog. The arguments have the same meaning
those of wxDirDialog::wxDirDialog(). The message is displayed at the top, as those of wxDirDialog::wxDirDialog(). The message is displayed at the
and the default_path, if specified, is set as the initial selection. 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 The application must check for an empty return value (if the user pressed
Cancel). For example: Cancel). For example:
@ -113,6 +117,8 @@ public:
... ...
} }
@endcode @endcode
@header{wx/dirdlg.h}
*/ */
wxString wxDirSelector(const wxString& message = wxDirSelectorPromptStr, wxString wxDirSelector(const wxString& message = wxDirSelectorPromptStr,
const wxString& default_path = "", const wxString& default_path = "",
@ -120,3 +126,5 @@ wxString wxDirSelector(const wxString& message = wxDirSelectorPromptStr,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
wxWindow* parent = NULL); wxWindow* parent = NULL);
//@}

View File

@ -205,24 +205,29 @@ public:
// Global functions/macros // Global functions/macros
// ============================================================================ // ============================================================================
/** @ingroup group_funcmacro_dialog */
//@{
/** /**
Pops up a file selector box. In Windows, this is the common file selector 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. dialog. In X, this is a file selector box with the same functionality. The
The path and filename are distinct elements of a full file pathname. path and filename are distinct elements of a full file pathname. If path
If path is empty, the current directory will be used. If filename is empty, is empty, the current directory will be used. If filename is empty, no
no default filename will be supplied. The wildcard determines what files default filename will be supplied. The wildcard determines what files are
are displayed in the file selector, and file extension supplies a type displayed in the file selector, and file extension supplies a type
extension for the required filename. Flags may be a combination of wxFD_OPEN, extension for the required filename. Flags may be a combination of
wxFD_SAVE, wxFD_OVERWRITE_PROMPT or wxFD_FILE_MUST_EXIST. Note that wxFD_OPEN, wxFD_SAVE, wxFD_OVERWRITE_PROMPT or wxFD_FILE_MUST_EXIST.
wxFD_MULTIPLE
can only be used with wxFileDialog and not here as this @note wxFD_MULTIPLE can only be used with wxFileDialog and not here since
function only returns a single file name. this function only returns a single file name.
Both the Unix and Windows versions implement a wildcard filter. Typing a Both the Unix and Windows versions implement a wildcard filter. Typing a
filename containing wildcards (*, ?) in the filename text item, and filename containing wildcards (*, ?) in the filename text item, and
clicking on Ok, will result in only those files matching the pattern being clicking on Ok, will result in only those files matching the pattern being
displayed. displayed.
The wildcard may be a specification for multiple types of file
with a description for each, such as: The wildcard may be a specification for multiple types of file with a
description for each, such as:
@code @code
"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif" "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"
@ -240,6 +245,8 @@ public:
} }
//else: cancelled by user //else: cancelled by user
@endcode @endcode
@header{wx/filedlg.h}
*/ */
wxString wxFileSelector(const wxString& message, wxString wxFileSelector(const wxString& message,
const wxString& default_path = "", const wxString& default_path = "",
@ -251,3 +258,5 @@ wxString wxFileSelector(const wxString& message,
int x = -1, int x = -1,
int y = -1); int y = -1);
//@}

View File

@ -68,19 +68,26 @@ public:
// Global functions/macros // Global functions/macros
// ============================================================================ // ============================================================================
/** @ingroup group_funcmacro_dialog */
//@{
/** /**
Shows the font selection dialog and returns the font selected by user or Shows the font selection dialog and returns the font selected by user or
invalid font (use @ref wxFont::isok wxFont:IsOk to test whether a font invalid font (use wxFont::IsOk() to test whether a font is valid) if the
is valid) if the dialog was cancelled. dialog was cancelled.
@param parent @param parent
The parent window for the font selection dialog The parent window for the font selection dialog.
@param fontInit @param fontInit
If given, this will be the font initially selected in the dialog. If given, this will be the font initially selected in the dialog.
@param caption @param caption
If given, this will be used for the dialog caption. If given, this will be used for the dialog caption.
@header{wx/fontdlg.h}
*/ */
wxFont wxGetFontFromUser(wxWindow* parent, wxFont wxGetFontFromUser(wxWindow* parent,
const wxFont& fontInit, const wxFont& fontInit,
const wxString& caption = wxEmptyString); const wxString& caption = wxEmptyString);
//@}

View File

@ -33,128 +33,49 @@ public:
@param style @param style
A dialog style (bitlist) containing flags chosen from the following: A dialog style (bitlist) containing flags chosen from the following:
wxOK wxOK
Show an OK button. Show an OK button.
wxCANCEL wxCANCEL
Show a Cancel button. Show a Cancel button.
wxYES_NO wxYES_NO
Show Yes and No buttons. Show Yes and No buttons.
wxYES_DEFAULT wxYES_DEFAULT
Used with wxYES_NO, makes Yes button the default - which is the default Used with wxYES_NO, makes Yes button the default - which is the default
behaviour. behaviour.
wxNO_DEFAULT wxNO_DEFAULT
Used with wxYES_NO, makes No button the default. Used with wxYES_NO, makes No button the default.
wxICON_EXCLAMATION wxICON_EXCLAMATION
Shows an exclamation mark icon. Shows an exclamation mark icon.
wxICON_HAND wxICON_HAND
Shows an error icon. Shows an error icon.
wxICON_ERROR wxICON_ERROR
Shows an error icon - the same as wxICON_HAND. Shows an error icon - the same as wxICON_HAND.
wxICON_QUESTION wxICON_QUESTION
Shows a question mark icon. Shows a question mark icon.
wxICON_INFORMATION wxICON_INFORMATION
Shows an information (i) icon. Shows an information (i) icon.
wxSTAY_ON_TOP wxSTAY_ON_TOP
The message box stays on top of all other window, even those of the other The message box stays on top of all other window, even those of the other
applications (Windows only). applications (Windows only).
@param pos @param pos
@ -229,58 +150,46 @@ public:
// Global functions/macros // Global functions/macros
// ============================================================================ // ============================================================================
/** @ingroup group_funcmacro_dialog */
//@{
/** /**
General purpose message dialog. @a style may be a bit list of the General purpose message dialog. @c style may be a bit list of the
following identifiers: following identifiers:
wxYES_NO @beginStyleTable
@style{wxYES_NO}:
Puts Yes and No buttons on the message box. May be combined with Puts Yes and No buttons on the message box. May be combined with
wxCANCEL. wxCANCEL.
@style{wxCANCEL}:
wxCANCEL
Puts a Cancel button on the message box. May only be combined with Puts a Cancel button on the message box. May only be combined with
wxYES_NO or wxOK. wxYES_NO or wxOK.
@style{wxOK}:
wxOK
Puts an Ok button on the message box. May be combined with wxCANCEL. Puts an Ok button on the message box. May be combined with wxCANCEL.
@style{wxICON_EXCLAMATION}:
wxICON_EXCLAMATION
Displays an exclamation mark symbol. Displays an exclamation mark symbol.
@style{wxICON_HAND}:
wxICON_HAND
Displays an error symbol. Displays an error symbol.
@style{wxICON_ERROR}:
wxICON_ERROR
Displays an error symbol - the same as wxICON_HAND. Displays an error symbol - the same as wxICON_HAND.
@style{wxICON_QUESTION}:
wxICON_QUESTION
Displays a question mark symbol. Displays a question mark symbol.
@style{wxICON_INFORMATION}:
wxICON_INFORMATION
Displays an information symbol. Displays an information symbol.
The return value is one of: wxYES, wxNO, wxCANCEL, wxOK. The return value is one of: wxYES, wxNO, wxCANCEL, wxOK. For example:
For example:
@code @code
...
int answer = wxMessageBox("Quit program?", "Confirm", int answer = wxMessageBox("Quit program?", "Confirm",
wxYES_NO | wxCANCEL, main_frame); wxYES_NO | wxCANCEL, main_frame);
if (answer == wxYES) if (answer == wxYES)
main_frame-Close(); main_frame->Close();
...
@endcode @endcode
@a message may contain newline characters, in which case the @a message may contain newline characters, in which case the message will
message will be split into separate lines, to cater for large messages. be split into separate lines, to cater for large messages.
@header{wx/msgdlg.h}
*/ */
int wxMessageBox(const wxString& message, int wxMessageBox(const wxString& message,
const wxString& caption = "Message", const wxString& caption = "Message",
@ -288,3 +197,5 @@ int wxMessageBox(const wxString& message,
wxWindow* parent = NULL, wxWindow* parent = NULL,
int x = -1, int y = -1); int x = -1, int y = -1);
//@}

View File

@ -6,15 +6,23 @@
// Licence: wxWindows license // Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/** @ingroup group_funcmacro_dialog */
//@{
/** /**
Shows a dialog asking the user for numeric input. The dialogs title is set to Shows a dialog asking the user for numeric input. The dialogs title is set
@e caption, it contains a (possibly) multiline @a message above the to @c caption, it contains a (possibly) multiline @c message above the
single line @a prompt and the zone for entering the number. single line @c prompt and the zone for entering the number.
The number entered must be in the range @e min..@a max (both of which
should be positive) and @a value is the initial value of it. If the user The number entered must be in the range @c min to @c max (both of which
enters an invalid value or cancels the dialog, the function will return -1. should be positive) and @c value is the initial value of it. If the user
Dialog is centered on its @a parent unless an explicit position is given in enters an invalid value or cancels the dialog, the function will return
@e pos. -1.
Dialog is centered on its @c parent unless an explicit position is given
in @c pos.
@header{wx/numdlg.h}
*/ */
long wxGetNumberFromUser(const wxString& message, long wxGetNumberFromUser(const wxString& message,
const wxString& prompt, const wxString& prompt,
@ -25,4 +33,5 @@ long wxGetNumberFromUser(const wxString& message,
wxWindow* parent = NULL, wxWindow* parent = NULL,
const wxPoint& pos = wxDefaultPosition); const wxPoint& pos = wxDefaultPosition);
//@}

View File

@ -96,12 +96,18 @@ public:
// Global functions/macros // Global functions/macros
// ============================================================================ // ============================================================================
/** @ingroup group_funcmacro_dialog */
//@{
/** /**
Pop up a dialog box with title set to @e caption, @e message, and a Pop up a dialog box with title set to @e caption, @c message, and a
@e default_value. The user may type in text and press OK to return this text, @c default_value. The user may type in text and press OK to return this
or press Cancel to return the empty string. text, or press Cancel to return the empty string.
If @a centre is @true, the message text (which may include new line characters)
is centred; if @false, the message is left-justified. If @c centre is @true, the message text (which may include new line
characters) is centred; if @false, the message is left-justified.
@header{wx/textdlg.h}
*/ */
wxString wxGetTextFromUser(const wxString& message, wxString wxGetTextFromUser(const wxString& message,
const wxString& caption = "Input text", const wxString& caption = "Input text",
@ -112,9 +118,11 @@ wxString wxGetTextFromUser(const wxString& message,
bool centre = true); bool centre = true);
/** /**
Similar to wxGetTextFromUser() but the text entered Similar to wxGetTextFromUser() but the text entered in the dialog is not
in the dialog is not shown on screen but replaced with stars. This is intended shown on screen but replaced with stars. This is intended to be used for
to be used for entering passwords as the function name implies. entering passwords as the function name implies.
@header{wx/textdlg.h}
*/ */
wxString wxGetPasswordFromUser(const wxString& message, wxString wxGetPasswordFromUser(const wxString& message,
const wxString& caption = "Input text", const wxString& caption = "Input text",
@ -124,3 +132,5 @@ wxString wxGetPasswordFromUser(const wxString& message,
int y = wxDefaultCoord, int y = wxDefaultCoord,
bool centre = true); bool centre = true);
//@}

View File

@ -69,18 +69,46 @@ public:
// Global functions/macros // Global functions/macros
// ============================================================================ // ============================================================================
/** @ingroup group_funcmacro_dialog */
//@{
/** /**
This function creates a wxTipProvider which may be This function creates a wxTipProvider which may be used with wxShowTip().
used with wxShowTip().
@param filename @param filename
The name of the file containing the tips, one per line The name of the file containing the tips, one per line.
@param currentTip @param currentTip
The index of the first tip to show - normally this index The index of the first tip to show. Normally this index is remembered
is remembered between the 2 program runs. between the 2 program runs.
@see @ref overview_tipsoverview "Tips overview" @see @ref overview_tips
@header{wx/tipdlg.h}
*/ */
wxTipProvider* wxCreateFileTipProvider(const wxString& filename, wxTipProvider* wxCreateFileTipProvider(const wxString& filename,
size_t currentTip); size_t currentTip);
/**
This function shows a "startup tip" to the user. The return value is the
state of the "Show tips at startup" checkbox.
@param parent
The parent window for the modal dialog.
@param tipProvider
An object which is used to get the text of the tips. It may be created
with the wxCreateFileTipProvider() function.
@param showAtStartup
Should 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 @ref overview_tips
@header{wx/tipdlg.h}
*/
bool wxShowTip(wxWindow *parent,
wxTipProvider *tipProvider,
bool showAtStartup = true);
//@}

View File

@ -82,11 +82,75 @@ public:
// Global functions/macros // Global functions/macros
// ============================================================================ // ============================================================================
/** @ingroup group_funcmacro_dialog */
//@{
/**
Changes the cursor to the given cursor for all windows in the application.
Use wxEndBusyCursor() 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 wxIsBusy(), wxBusyCursor
@header{wx/utils.h}
*/
void wxBeginBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR);
/**
Changes the cursor back to the original cursor, for all windows in the
application. Use with wxBeginBusyCursor().
@see wxIsBusy(), wxBusyCursor
@header{wx/utils.h}
*/
void wxEndBusyCursor();
/**
Returns @true if between two wxBeginBusyCursor() and wxEndBusyCursor()
calls.
@see wxBusyCursor.
@header{wx/utils.h}
*/
bool wxIsBusy();
/**
Ring the system bell.
@note This function is categorized as a GUI one and so is not thread-safe.
@header{wx/utils.h}
*/
void wxBell();
/**
Shows a message box with the information about the wxWidgets build used,
including its version, most important build parameters and the version of
the underlying GUI toolkit. This is mainly used for diagnostic purposes
and can be invoked by Ctrl-Alt-middle clicking on any wxWindow which
doesn't otherwise handle this event.
@wxsince{2.9.0}
@header{wx/utils.h}
*/
void wxInfoMessageBox(wxWindow parent = NULL);
//@}
/** /**
Returns the type of power source as one of @c wxPOWER_SOCKET, Returns the type of power source as one of @c wxPOWER_SOCKET,
@c wxPOWER_BATTERY or @c wxPOWER_UNKNOWN. @c wxPOWER_BATTERY or @c wxPOWER_UNKNOWN.
@c wxPOWER_UNKNOWN is also the default on platforms where this @c wxPOWER_UNKNOWN is also the default on platforms where this
feature is not implemented (currently everywhere but MS Windows). feature is not implemented (currently everywhere but MS Windows).
@header{wx/utils.h}
*/ */
wxPowerType wxGetPowerType(); wxPowerType wxGetPowerType();
@ -103,6 +167,8 @@ wxPowerType wxGetPowerType();
if successful, @false otherwise. if successful, @false otherwise.
@see wxGetUserName() @see wxGetUserName()
@header{wx/utils.h}
*/ */
wxString wxGetUserId(); wxString wxGetUserId();
bool wxGetUserId(char* buf, int sz); bool wxGetUserId(char* buf, int sz);
@ -114,6 +180,8 @@ bool wxGetUserId(char* buf, int sz);
Displays @a msg and exits. This writes to standard error under Unix, Displays @a msg and exits. This writes to standard error under Unix,
and pops up a message box under Windows. Used for fatal internal and pops up a message box under Windows. Used for fatal internal
wxWidgets errors. See also wxError(). wxWidgets errors. See also wxError().
@header{wx/utils.h}
*/ */
void wxFatalError(const wxString& msg, void wxFatalError(const wxString& msg,
const wxString& title = "wxWidgets Fatal Error"); const wxString& title = "wxWidgets Fatal Error");
@ -124,6 +192,8 @@ void wxFatalError(const wxString& msg,
@c wxBATTERY_SHUTDOWN_STATE or @c wxBATTERY_UNKNOWN_STATE. @c wxBATTERY_SHUTDOWN_STATE or @c wxBATTERY_UNKNOWN_STATE.
@c wxBATTERY_UNKNOWN_STATE is also the default on platforms where @c wxBATTERY_UNKNOWN_STATE is also the default on platforms where
this feature is not implemented (currently everywhere but MS Windows). this feature is not implemented (currently everywhere but MS Windows).
@header{wx/utils.h}
*/ */
wxBatteryState wxGetBatteryState(); wxBatteryState wxGetBatteryState();
@ -137,18 +207,12 @@ wxBatteryState wxGetBatteryState();
window hierarchy. window hierarchy.
The search is recursive in both cases. The search is recursive in both cases.
If no such named window is found, @b wxFindWindowByLabel is called. If no such named window is found, @b wxFindWindowByLabel is called.
@header{wx/utils.h}
*/ */
wxWindow* wxFindWindowByName(const wxString& name, wxWindow* wxFindWindowByName(const wxString& name,
wxWindow* parent = NULL); wxWindow* parent = NULL);
/**
Changes the cursor back to the original cursor, for all windows in the
application.
Use with wxBeginBusyCursor().
See also wxIsBusy(), wxBusyCursor.
*/
void wxEndBusyCursor();
/** /**
This function is deprecated as the ids generated by it can conflict with the This function is deprecated as the ids generated by it can conflict with the
ids defined by the user code, use @c wxID_ANY to assign ids which are ids defined by the user code, use @c wxID_ANY to assign ids which are
@ -156,12 +220,16 @@ void wxEndBusyCursor();
items you create instead of using this function. items you create instead of using this function.
Generates an integer identifier unique to this run of the program. Generates an integer identifier unique to this run of the program.
@header{wx/utils.h}
*/ */
long wxNewId(); long wxNewId();
/** /**
Ensures that ids subsequently generated by @b NewId do not clash with Ensures that ids subsequently generated by @b NewId do not clash with
the given @b id. the given @b id.
@header{wx/utils.h}
*/ */
void wxRegisterId(long id); void wxRegisterId(long id);
@ -178,6 +246,8 @@ void wxRegisterId(long id);
each wxDebugMsg call. wxDebugMsg seems to be broken under WIN32s each wxDebugMsg call. wxDebugMsg seems to be broken under WIN32s
(at least for Watcom C++): preformat your messages and use OutputDebugString (at least for Watcom C++): preformat your messages and use OutputDebugString
instead. instead.
@header{wx/utils.h}
*/ */
void wxDebugMsg(const wxString& fmt, ... ); void wxDebugMsg(const wxString& fmt, ... );
@ -188,6 +258,8 @@ void wxDebugMsg(const wxString& fmt, ... );
currently no way to test whether togglable keys are up or down. currently no way to test whether togglable keys are up or down.
Even though there are virtual key codes defined for mouse buttons, they Even though there are virtual key codes defined for mouse buttons, they
cannot be used with this function currently. cannot be used with this function currently.
@header{wx/utils.h}
*/ */
bool wxGetKeyState(wxKeyCode key); bool wxGetKeyState(wxKeyCode key);
@ -197,6 +269,8 @@ bool wxGetKeyState(wxKeyCode key);
@c Windows NT Version 4.0 or @c Linux 2.2.2 i386. @c Windows NT Version 4.0 or @c Linux 2.2.2 i386.
@see ::wxGetOsVersion @see ::wxGetOsVersion
@header{wx/utils.h}
*/ */
wxString wxGetOsDescription(); wxString wxGetOsDescription();
@ -204,6 +278,8 @@ wxString wxGetOsDescription();
Return the (current) user's home directory. Return the (current) user's home directory.
@see wxGetUserHome(), wxStandardPaths @see wxGetUserHome(), wxStandardPaths
@header{wx/utils.h}
*/ */
wxString wxGetHomeDir(); wxString wxGetHomeDir();
@ -211,6 +287,8 @@ wxString wxGetHomeDir();
Sleeps for the specified number of milliseconds. Notice that usage of this Sleeps for the specified number of milliseconds. Notice that usage of this
function is encouraged instead of calling usleep(3) directly because the function is encouraged instead of calling usleep(3) directly because the
standard usleep() function is not MT safe. standard usleep() function is not MT safe.
@header{wx/utils.h}
*/ */
void wxMilliSleep(unsigned long milliseconds); void wxMilliSleep(unsigned long milliseconds);
@ -219,22 +297,16 @@ void wxMilliSleep(unsigned long milliseconds);
not, in fact, be available on all platforms (currently only Unix platforms with 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 nanosleep(2) may provide it) in which case this is the same as
wxMilliSleep()(@e microseconds/1000). wxMilliSleep()(@e microseconds/1000).
@header{wx/utils.h}
*/ */
void wxMicroSleep(unsigned long microseconds); void wxMicroSleep(unsigned long microseconds);
/**
Shows a message box with the information about the wxWidgets build used,
including its version, most important build parameters and the version of the
underlying GUI toolkit. This is mainly used for diagnostic purposes and can be
invoked by Ctrl-Alt-middle clicking on any wxWindow which doesn't otherwise
handle this event.
@wxsince{2.9.0}
*/
void wxInfoMessageBox(wxWindow ( parent = NULL);
/** /**
Find a menu item identifier associated with the given frame's menu bar. Find a menu item identifier associated with the given frame's menu bar.
@header{wx/utils.h}
*/ */
int wxFindMenuItemId(wxFrame* frame, const wxString& menuString, int wxFindMenuItemId(wxFrame* frame, const wxString& menuString,
const wxString& itemString); const wxString& itemString);
@ -242,6 +314,8 @@ int wxFindMenuItemId(wxFrame* frame, const wxString& menuString,
/** /**
This function enables or disables all top level windows. It is used by This function enables or disables all top level windows. It is used by
::wxSafeYield. ::wxSafeYield.
@header{wx/utils.h}
*/ */
void wxEnableTopLevelWindows(bool enable = true); void wxEnableTopLevelWindows(bool enable = true);
@ -256,6 +330,8 @@ void wxEnableTopLevelWindows(bool enable = true);
Notice that in most cases Notice that in most cases
wxMenuItem::GetLabelFromText or wxMenuItem::GetLabelFromText or
wxControl::GetLabelText can be used instead. wxControl::GetLabelText can be used instead.
@header{wx/utils.h}
*/ */
wxString wxStripMenuCodes(const wxString& str, wxString wxStripMenuCodes(const wxString& str,
int flags = wxStrip_All); int flags = wxStrip_All);
@ -266,6 +342,8 @@ wxString wxStripMenuCodes(const wxString& str,
Displays @a msg and continues. This writes to standard error under Displays @a msg and continues. This writes to standard error under
Unix, and pops up a message box under Windows. Used for internal Unix, and pops up a message box under Windows. Used for internal
wxWidgets errors. See also wxFatalError(). wxWidgets errors. See also wxFatalError().
@header{wx/utils.h}
*/ */
void wxError(const wxString& msg, void wxError(const wxString& msg,
const wxString& title = "wxWidgets Internal Error"); const wxString& title = "wxWidgets Internal Error");
@ -282,6 +360,8 @@ void wxError(const wxString& msg,
is launched to open the given URL may be URL-dependent (e.g. a browser may be is launched to open the given URL may be URL-dependent (e.g. a browser may be
used for used for
local URLs while another one may be used for remote URLs). local URLs while another one may be used for remote URLs).
@header{wx/utils.h}
*/ */
bool wxLaunchDefaultBrowser(const wxString& url, int flags = 0); bool wxLaunchDefaultBrowser(const wxString& url, int flags = 0);
@ -289,6 +369,8 @@ bool wxLaunchDefaultBrowser(const wxString& url, int flags = 0);
Executes a command in an interactive shell window. If no command is Executes a command in an interactive shell window. If no command is
specified, then just the shell is spawned. specified, then just the shell is spawned.
See also wxExecute(), @ref overview_sampleexec "Exec sample". See also wxExecute(), @ref overview_sampleexec "Exec sample".
@header{wx/utils.h}
*/ */
bool wxShell(const wxString& command = NULL); bool wxShell(const wxString& command = NULL);
@ -297,6 +379,8 @@ bool wxShell(const wxString& command = NULL);
See wxPlatformInfo for more details about wxOperatingSystemId. See wxPlatformInfo for more details about wxOperatingSystemId.
@see ::wxGetOsDescription, wxPlatformInfo @see ::wxGetOsDescription, wxPlatformInfo
@header{wx/utils.h}
*/ */
wxOperatingSystemId wxGetOsVersion(int* major = NULL, wxOperatingSystemId wxGetOsVersion(int* major = NULL,
int* minor = NULL); int* minor = NULL);
@ -306,24 +390,19 @@ wxOperatingSystemId wxGetOsVersion(int* major = NULL,
error. error.
@see wxGetHostName() @see wxGetHostName()
@header{wx/utils.h}
*/ */
wxString wxGetFullHostName(); wxString wxGetFullHostName();
/**
Changes the cursor to the given cursor for all windows in the application.
Use wxEndBusyCursor() 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 wxIsBusy(), wxBusyCursor.
*/
void wxBeginBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR);
/** /**
Tells the system to delete the specified object when Tells the system to delete the specified object when
all other events have been processed. In some environments, it is all other events have been processed. In some environments, it is
necessary to use this instead of deleting a frame directly with the 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. delete operator, because some GUIs will still send events to a deleted window.
Now obsolete: use wxWindow::Close instead. Now obsolete: use wxWindow::Close instead.
@header{wx/utils.h}
*/ */
void wxPostDelete(wxObject* object); void wxPostDelete(wxObject* object);
@ -337,6 +416,8 @@ void wxPostDelete(wxObject* object);
frames and dialog boxes; if non-@NULL, the search will be limited to the given frames and dialog boxes; if non-@NULL, the search will be limited to the given
window hierarchy. window hierarchy.
The search is recursive in both cases. The search is recursive in both cases.
@header{wx/utils.h}
*/ */
wxWindow* wxFindWindowByLabel(const wxString& label, wxWindow* wxFindWindowByLabel(const wxString& label,
wxWindow* parent = NULL); wxWindow* parent = NULL);
@ -344,6 +425,8 @@ wxWindow* wxFindWindowByLabel(const wxString& label,
/** /**
Returns the mouse position in screen coordinates. Returns the mouse position in screen coordinates.
@header{wx/utils.h}
*/ */
wxPoint wxGetMousePosition(); wxPoint wxGetMousePosition();
@ -360,6 +443,8 @@ wxPoint wxGetMousePosition();
where @c file.ext is a file that the resource compiler can find. where @c file.ext is a file that the resource compiler can find.
This function is available under Windows only. This function is available under Windows only.
@header{wx/utils.h}
*/ */
wxString wxLoadUserResource(const wxString& resourceName, wxString wxLoadUserResource(const wxString& resourceName,
const wxString& resourceType = "TEXT"); const wxString& resourceType = "TEXT");
@ -376,6 +461,8 @@ wxMemorySize wxGetFreeMemory();
Note that under Win32 it may not return correct value for the variables set Note that under Win32 it may not return correct value for the variables set
with wxSetEnv(), use wxGetEnv() function with wxSetEnv(), use wxGetEnv() function
instead. instead.
@header{wx/utils.h}
*/ */
wxChar* wxGetEnv(const wxString& var); wxChar* wxGetEnv(const wxString& var);
@ -392,6 +479,8 @@ wxChar* wxGetEnv(const wxString& var);
if successful, @false otherwise. if successful, @false otherwise.
@see wxGetFullHostName() @see wxGetFullHostName()
@header{wx/utils.h}
*/ */
wxString wxGetHostName(); wxString wxGetHostName();
bool wxGetHostName(char* buf, int sz); bool wxGetHostName(char* buf, int sz);
@ -402,26 +491,26 @@ bool wxGetHostName(char* buf, int sz);
@a value may be @NULL if you just want to know if the variable exists @a value may be @NULL if you just want to know if the variable exists
and are not interested in its value. and are not interested in its value.
Returns @true if the variable exists, @false otherwise. Returns @true if the variable exists, @false otherwise.
@header{wx/utils.h}
*/ */
bool wxGetEnv(const wxString& var, wxString* value); bool wxGetEnv(const wxString& var, wxString* value);
/** /**
Under X only, returns the current display name. See also wxSetDisplayName(). Under X only, returns the current display name. See also wxSetDisplayName().
@header{wx/utils.h}
*/ */
wxString wxGetDisplayName(); wxString wxGetDisplayName();
/**
Ring the system bell.
Note that this function is categorized as a GUI one and so is not thread-safe.
*/
void wxBell();
/** /**
Returns the home directory for the given user. If the @a user is empty Returns the home directory for the given user. If the @a user is empty
(default value), this function behaves like (default value), this function behaves like
wxGetHomeDir() i.e. returns the current user home wxGetHomeDir() i.e. returns the current user home
directory. directory.
If the home directory couldn't be determined, an empty string is returned. If the home directory couldn't be determined, an empty string is returned.
@header{wx/utils.h}
*/ */
wxString wxGetUserHome(const wxString& user = ""); wxString wxGetUserHome(const wxString& user = "");
@ -500,6 +589,8 @@ wxString wxGetUserHome(const wxString& user = "");
An optional pointer to wxProcess An optional pointer to wxProcess
@see wxShell(), wxProcess, @ref overview_sampleexec "Exec sample". @see wxShell(), wxProcess, @ref overview_sampleexec "Exec sample".
@header{wx/utils.h}
*/ */
long wxExecute(const wxString& command, int sync = wxEXEC_ASYNC, long wxExecute(const wxString& command, int sync = wxEXEC_ASYNC,
wxProcess* callback = NULL); wxProcess* callback = NULL);
@ -517,6 +608,8 @@ wxPerl note: long wxExecute(const wxString& command,
/** /**
Returns a string representing the current date and time. Returns a string representing the current date and time.
@header{wx/utils.h}
*/ */
wxString wxNow(); wxString wxNow();
@ -531,12 +624,16 @@ wxString wxNow();
fact fact
that there isn't always a standard way to do a reliable check on the OS that there isn't always a standard way to do a reliable check on the OS
architecture. architecture.
@header{wx/utils.h}
*/ */
bool wxIsPlatform64Bit(); bool wxIsPlatform64Bit();
/** /**
Returns the number uniquely identifying the current process in the system. Returns the number uniquely identifying the current process in the system.
If an error occurs, 0 is returned. If an error occurs, 0 is returned.
@header{wx/utils.h}
*/ */
unsigned long wxGetProcessId(); unsigned long wxGetProcessId();
@ -590,6 +687,8 @@ unsigned long wxGetProcessId();
to wxExecute. to wxExecute.
@see wxProcess::Kill, wxProcess::Exists, @ref overview_sampleexec "Exec sample" @see wxProcess::Kill, wxProcess::Exists, @ref overview_sampleexec "Exec sample"
@header{wx/utils.h}
*/ */
int wxKill(long pid, int sig = wxSIGTERM, wxKillError rc = NULL, int wxKill(long pid, int sig = wxSIGTERM, wxKillError rc = NULL,
int flags = 0); int flags = 0);
@ -599,22 +698,19 @@ int wxKill(long pid, int sig = wxSIGTERM, wxKillError rc = NULL,
instance that contains the current position of the mouse pointer in instance that contains the current position of the mouse pointer in
screen coordinates, as well as boolean values indicating the up/down screen coordinates, as well as boolean values indicating the up/down
status of the mouse buttons and the modifier keys. status of the mouse buttons and the modifier keys.
@header{wx/utils.h}
*/ */
wxMouseState wxGetMouseState(); wxMouseState wxGetMouseState();
/**
Returns @true if between two wxBeginBusyCursor() and
wxEndBusyCursor() calls.
See also wxBusyCursor.
*/
bool wxIsBusy();
//@{ //@{
/** /**
Copies the user's email address into the supplied buffer, by Copies the user's email address into the supplied buffer, by
concatenating the values returned by wxGetFullHostName() concatenating the values returned by wxGetFullHostName()
and wxGetUserId(). and wxGetUserId().
Returns @true if successful, @false otherwise. Returns @true if successful, @false otherwise.
@header{wx/utils.h}
*/ */
wxString wxGetEmailAddress(); wxString wxGetEmailAddress();
bool wxGetEmailAddress(char* buf, int sz); bool wxGetEmailAddress(char* buf, int sz);
@ -622,6 +718,8 @@ bool wxGetEmailAddress(char* buf, int sz);
/** /**
Sleeps for the specified number of seconds. Sleeps for the specified number of seconds.
@header{wx/utils.h}
*/ */
void wxSleep(int secs); void wxSleep(int secs);
@ -631,6 +729,8 @@ void wxSleep(int secs);
Returns @true on success. Returns @true on success.
@see wxUnsetEnv() @see wxUnsetEnv()
@header{wx/utils.h}
*/ */
bool wxSetEnv(const wxString& var, const wxString& value); bool wxSetEnv(const wxString& var, const wxString& value);
@ -640,6 +740,8 @@ bool wxSetEnv(const wxString& var, const wxString& value);
The check is performed at run-time. The check is performed at run-time.
@see @ref overview_byteordermacros "Byte order macros" @see @ref overview_byteordermacros "Byte order macros"
@header{wx/utils.h}
*/ */
bool wxIsPlatformLittleEndian(); bool wxIsPlatformLittleEndian();
@ -652,6 +754,8 @@ bool wxIsPlatformLittleEndian();
multiple multiple
displays to be used. displays to be used.
See also wxGetDisplayName(). See also wxGetDisplayName().
@header{wx/utils.h}
*/ */
void wxSetDisplayName(const wxString& displayName); void wxSetDisplayName(const wxString& displayName);