2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: choicdlg.h
|
2008-03-18 15:30:01 -04:00
|
|
|
// Purpose: interface of wx[Multi|Single]ChoiceDialog
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxMultiChoiceDialog
|
|
|
|
@wxheader{choicdlg.h}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This class represents a dialog that shows a list of strings, and allows
|
|
|
|
the user to select one or more.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxbase}
|
|
|
|
@category{cmndlg}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-18 15:30:01 -04:00
|
|
|
@see @ref overview_cmndlg_multichoice, wxSingleChoiceDialog
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxMultiChoiceDialog : public wxDialog
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Constructor taking an array of wxString choices.
|
2008-03-18 15:30:01 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param parent
|
2008-03-09 08:33:59 -04:00
|
|
|
Parent window.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param message
|
2008-03-09 08:33:59 -04:00
|
|
|
Message to show on the dialog.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param caption
|
2008-03-09 08:33:59 -04:00
|
|
|
The dialog caption.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param n
|
2008-03-09 08:33:59 -04:00
|
|
|
The number of choices.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param choices
|
2008-03-09 08:33:59 -04:00
|
|
|
An array of strings, or a string list, containing the choices.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-03-09 08:33:59 -04:00
|
|
|
A dialog style (bitlist) containing flags chosen from standard
|
2008-03-18 15:30:01 -04:00
|
|
|
dialog style and the ones listed below. The default value is
|
|
|
|
equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK |
|
|
|
|
wxCANCEL | wxCENTRE.
|
|
|
|
@param pos
|
|
|
|
Dialog position. Not Windows.
|
|
|
|
|
|
|
|
@beginStyleTable
|
|
|
|
@style{wxOK}:
|
2008-03-09 08:33:59 -04:00
|
|
|
Show an OK button.
|
2008-03-18 15:30:01 -04:00
|
|
|
@style{wxCANCEL}:
|
2008-03-09 08:33:59 -04:00
|
|
|
Show a Cancel button.
|
2008-03-18 15:30:01 -04:00
|
|
|
@style{wxCENTRE}:
|
2008-03-09 08:33:59 -04:00
|
|
|
Centre the message. Not Windows.
|
2008-03-18 15:30:01 -04:00
|
|
|
@endStyleTable
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@remarks Use ShowModal() to show the dialog.
|
|
|
|
*/
|
|
|
|
wxMultiChoiceDialog(wxWindow* parent, const wxString& message,
|
|
|
|
const wxString& caption,
|
|
|
|
int n,
|
|
|
|
const wxString* choices,
|
|
|
|
long style = wxCHOICEDLG_STYLE,
|
|
|
|
const wxPoint& pos = wxDefaultPosition);
|
2008-03-08 09:43:31 -05:00
|
|
|
wxMultiChoiceDialog(wxWindow* parent,
|
|
|
|
const wxString& message,
|
|
|
|
const wxString& caption,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
long style = wxCHOICEDLG_STYLE,
|
|
|
|
const wxPoint& pos = wxDefaultPosition);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns array with indexes of selected items.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxArrayInt GetSelection() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets selected items from the array of selected items' indexes.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
void SetSelections(const wxArrayInt& selections) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Shows the dialog, returning either wxID_OK or wxID_CANCEL.
|
|
|
|
*/
|
|
|
|
int ShowModal();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxSingleChoiceDialog
|
|
|
|
@wxheader{choicdlg.h}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-18 15:30:01 -04:00
|
|
|
This class represents a dialog that shows a list of strings, and allows
|
|
|
|
the user to select one. Double-clicking on a list item is equivalent to
|
2008-03-08 08:52:38 -05:00
|
|
|
single-clicking and then pressing OK.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxbase}
|
|
|
|
@category{cmndlg}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-18 15:30:01 -04:00
|
|
|
@see @ref overview_cmndlg_singlechoice, wxMultiChoiceDialog
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxSingleChoiceDialog : public wxDialog
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//@{
|
|
|
|
/**
|
2008-03-18 15:30:01 -04:00
|
|
|
Constructor, taking an array of wxString choices and optional client
|
|
|
|
data.
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param parent
|
2008-03-09 08:33:59 -04:00
|
|
|
Parent window.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param message
|
2008-03-09 08:33:59 -04:00
|
|
|
Message to show on the dialog.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param caption
|
2008-03-09 08:33:59 -04:00
|
|
|
The dialog caption.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param n
|
2008-03-09 08:33:59 -04:00
|
|
|
The number of choices.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param choices
|
2008-03-09 08:33:59 -04:00
|
|
|
An array of strings, or a string list, containing the choices.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param clientData
|
2008-03-09 08:33:59 -04:00
|
|
|
An array of client data to be associated with the items.
|
|
|
|
See GetSelectionClientData.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-03-09 08:33:59 -04:00
|
|
|
A dialog style (bitlist) containing flags chosen from standard
|
2008-03-18 15:30:01 -04:00
|
|
|
dialog styles and the ones listed below. The default value is
|
|
|
|
equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK |
|
|
|
|
wxCANCEL | wxCENTRE.
|
|
|
|
@param pos
|
|
|
|
Dialog position. Not Windows.
|
|
|
|
|
|
|
|
@beginStyleTable
|
|
|
|
@style{wxOK}:
|
2008-03-09 08:33:59 -04:00
|
|
|
Show an OK button.
|
2008-03-18 15:30:01 -04:00
|
|
|
@style{wxCANCEL}:
|
2008-03-09 08:33:59 -04:00
|
|
|
Show a Cancel button.
|
2008-03-18 15:30:01 -04:00
|
|
|
@style{wxCENTRE}:
|
2008-03-09 08:33:59 -04:00
|
|
|
Centre the message. Not Windows.
|
2008-03-18 15:30:01 -04:00
|
|
|
@endStyleTable
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@remarks Use ShowModal() to show the dialog.
|
|
|
|
*/
|
|
|
|
wxSingleChoiceDialog(wxWindow* parent, const wxString& message,
|
|
|
|
const wxString& caption,
|
|
|
|
int n,
|
|
|
|
const wxString* choices,
|
2008-03-09 08:33:59 -04:00
|
|
|
void** clientData = NULL,
|
2008-03-08 08:52:38 -05:00
|
|
|
long style = wxCHOICEDLG_STYLE,
|
|
|
|
const wxPoint& pos = wxDefaultPosition);
|
2008-03-08 09:43:31 -05:00
|
|
|
wxSingleChoiceDialog(wxWindow* parent,
|
|
|
|
const wxString& message,
|
|
|
|
const wxString& caption,
|
|
|
|
const wxArrayString& choices,
|
2008-03-09 08:33:59 -04:00
|
|
|
void** clientData = NULL,
|
2008-03-08 09:43:31 -05:00
|
|
|
long style = wxCHOICEDLG_STYLE,
|
|
|
|
const wxPoint& pos = wxDefaultPosition);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the index of selected item.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int GetSelection() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the client data associated with the selection.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
char* GetSelectionClientData() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the selected string.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxString GetStringSelection() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the index of the initially selected item.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
void SetSelection(int selection) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Shows the dialog, returning either wxID_OK or wxID_CANCEL.
|
|
|
|
*/
|
|
|
|
int ShowModal();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
// ============================================================================
|
|
|
|
// Global functions/macros
|
|
|
|
// ============================================================================
|
|
|
|
|
2008-03-18 15:30:01 -04:00
|
|
|
/** @ingroup group_funcmacro_dialog */
|
2008-03-08 08:52:38 -05:00
|
|
|
//@{
|
2008-03-18 15:30:01 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-03-18 15:30:01 -04:00
|
|
|
Same as wxGetSingleChoice() but returns the index representing the
|
|
|
|
selected string. If the user pressed cancel, -1 is returned.
|
|
|
|
|
|
|
|
@header{wx/choicdlg.h}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
int wxGetSingleChoiceIndex(const wxString& message,
|
|
|
|
const wxString& caption,
|
|
|
|
const wxArrayString& aChoices,
|
2008-03-09 08:33:59 -04:00
|
|
|
wxWindow* parent = NULL,
|
2008-03-08 08:52:38 -05:00
|
|
|
int x = -1,
|
|
|
|
int y = -1,
|
2008-03-09 08:33:59 -04:00
|
|
|
bool centre = true,
|
|
|
|
int width = 150,
|
|
|
|
int height = 200);
|
2008-03-08 09:43:31 -05:00
|
|
|
int wxGetSingleChoiceIndex(const wxString& message,
|
|
|
|
const wxString& caption,
|
|
|
|
int n,
|
|
|
|
const wxString& choices[],
|
2008-03-09 08:33:59 -04:00
|
|
|
wxWindow* parent = NULL,
|
2008-03-08 09:43:31 -05:00
|
|
|
int x = -1,
|
|
|
|
int y = -1,
|
2008-03-09 08:33:59 -04:00
|
|
|
bool centre = true,
|
|
|
|
int width = 150,
|
|
|
|
int height = 200);
|
2008-03-18 15:30:01 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
2008-03-18 15:30:01 -04:00
|
|
|
/** @ingroup group_funcmacro_dialog */
|
2008-03-08 08:52:38 -05:00
|
|
|
//@{
|
2008-03-18 15:30:01 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Pops up a dialog box containing a message, OK/Cancel buttons and a
|
2008-03-18 15:30:01 -04:00
|
|
|
single-selection listbox. The user may choose an item and press OK to
|
|
|
|
return a string or Cancel to return the empty string. Use
|
|
|
|
wxGetSingleChoiceIndex() 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 @c choices
|
2008-03-09 08:33:59 -04:00
|
|
|
which is an array of @a n strings for the listbox or by using a single
|
2008-03-18 15:30:01 -04:00
|
|
|
@c aChoices parameter of type wxArrayString.
|
|
|
|
|
|
|
|
If @c centre is @true, the message text (which may include new line
|
2008-03-08 08:52:38 -05:00
|
|
|
characters) is centred; if @false, the message is left-justified.
|
2008-03-18 15:30:01 -04:00
|
|
|
|
|
|
|
@header{wx/choicdlg.h}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxString wxGetSingleChoice(const wxString& message,
|
|
|
|
const wxString& caption,
|
|
|
|
const wxArrayString& aChoices,
|
2008-03-09 08:33:59 -04:00
|
|
|
wxWindow* parent = NULL,
|
2008-03-08 08:52:38 -05:00
|
|
|
int x = -1,
|
|
|
|
int y = -1,
|
2008-03-09 08:33:59 -04:00
|
|
|
bool centre = true,
|
|
|
|
int width = 150,
|
|
|
|
int height = 200);
|
2008-03-08 09:43:31 -05:00
|
|
|
wxString wxGetSingleChoice(const wxString& message,
|
|
|
|
const wxString& caption,
|
|
|
|
int n,
|
|
|
|
const wxString& choices[],
|
2008-03-09 08:33:59 -04:00
|
|
|
wxWindow* parent = NULL,
|
2008-03-08 09:43:31 -05:00
|
|
|
int x = -1,
|
|
|
|
int y = -1,
|
2008-03-09 08:33:59 -04:00
|
|
|
bool centre = true,
|
|
|
|
int width = 150,
|
|
|
|
int height = 200);
|
2008-03-18 15:30:01 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
2008-03-18 15:30:01 -04:00
|
|
|
/** @ingroup group_funcmacro_dialog */
|
2008-03-08 08:52:38 -05:00
|
|
|
//@{
|
2008-03-18 15:30:01 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-03-18 15:30:01 -04:00
|
|
|
Same 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 @c client_data array must have the same number
|
|
|
|
of elements as @c choices or @c aChoices!
|
|
|
|
|
|
|
|
@header{wx/choicdlg.h}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxString wxGetSingleChoiceData(const wxString& message,
|
|
|
|
const wxString& caption,
|
|
|
|
const wxArrayString& aChoices,
|
|
|
|
const wxString& client_data[],
|
2008-03-09 08:33:59 -04:00
|
|
|
wxWindow* parent = NULL,
|
2008-03-08 08:52:38 -05:00
|
|
|
int x = -1,
|
|
|
|
int y = -1,
|
2008-03-09 08:33:59 -04:00
|
|
|
bool centre = true,
|
|
|
|
int width = 150,
|
|
|
|
int height = 200);
|
2008-03-08 09:43:31 -05:00
|
|
|
wxString wxGetSingleChoiceData(const wxString& message,
|
|
|
|
const wxString& caption,
|
|
|
|
int n,
|
|
|
|
const wxString& choices[],
|
|
|
|
const wxString& client_data[],
|
2008-03-09 08:33:59 -04:00
|
|
|
wxWindow* parent = NULL,
|
2008-03-08 09:43:31 -05:00
|
|
|
int x = -1,
|
|
|
|
int y = -1,
|
2008-03-09 08:33:59 -04:00
|
|
|
bool centre = true,
|
|
|
|
int width = 150,
|
|
|
|
int height = 200);
|
2008-03-18 15:30:01 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
2008-03-18 15:30:01 -04:00
|
|
|
/** @ingroup group_funcmacro_dialog */
|
2008-03-08 08:52:38 -05:00
|
|
|
//@{
|
2008-03-18 15:30:01 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
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
|
2008-03-18 15:30:01 -04:00
|
|
|
@c selections array. The initial contents of this array will be used to
|
2008-03-08 08:52:38 -05:00
|
|
|
select the items when the dialog is shown.
|
2008-03-18 15:30:01 -04:00
|
|
|
|
|
|
|
You may pass the list of strings to choose from either using @c choices
|
2008-03-09 08:33:59 -04:00
|
|
|
which is an array of @a n strings for the listbox or by using a single
|
2008-03-18 15:30:01 -04:00
|
|
|
@c aChoices parameter of type wxArrayString.
|
|
|
|
|
|
|
|
If @c centre is @true, the message text (which may include new line
|
2008-03-08 08:52:38 -05:00
|
|
|
characters) is centred; if @false, the message is left-justified.
|
2008-03-18 15:30:01 -04:00
|
|
|
|
|
|
|
@header{wx/choicdlg.h}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
size_t wxGetMultipleChoices(wxArrayInt& selections,
|
|
|
|
const wxString& message,
|
|
|
|
const wxString& caption,
|
|
|
|
const wxArrayString& aChoices,
|
2008-03-09 08:33:59 -04:00
|
|
|
wxWindow* parent = NULL,
|
2008-03-08 08:52:38 -05:00
|
|
|
int x = -1,
|
|
|
|
int y = -1,
|
2008-03-09 08:33:59 -04:00
|
|
|
bool centre = true,
|
|
|
|
int width = 150,
|
|
|
|
int height = 200);
|
2008-03-08 09:43:31 -05:00
|
|
|
size_t wxGetMultipleChoices(wxArrayInt& selections,
|
|
|
|
const wxString& message,
|
|
|
|
const wxString& caption,
|
|
|
|
int n,
|
|
|
|
const wxString& choices[],
|
2008-03-09 08:33:59 -04:00
|
|
|
wxWindow* parent = NULL,
|
2008-03-08 09:43:31 -05:00
|
|
|
int x = -1,
|
|
|
|
int y = -1,
|
2008-03-09 08:33:59 -04:00
|
|
|
bool centre = true,
|
|
|
|
int width = 150,
|
|
|
|
int height = 200);
|
2008-03-18 15:30:01 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|