1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Generic choice dialogs
4 // Author: Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __CHOICEDLGH_G__
13 #define __CHOICEDLGH_G__
16 #pragma interface "choicdgg.h"
20 #include "wx/dialog.h"
22 #define wxCHOICE_HEIGHT 150
23 #define wxCHOICE_WIDTH 200
25 #define wxID_LISTBOX 3000
27 class WXDLLEXPORT wxSingleChoiceDialog
: public wxDialog
29 DECLARE_DYNAMIC_CLASS(wxSingleChoiceDialog
)
31 wxSingleChoiceDialog(wxWindow
*parent
, const wxString
& message
, const wxString
& caption
,
32 int n
, const wxString
*choices
, wxChar
**clientData
= (wxChar
**) NULL
, long style
= wxOK
|wxCANCEL
|wxCENTRE
, const wxPoint
& pos
= wxDefaultPosition
);
34 wxSingleChoiceDialog(wxWindow
*parent
, const wxString
& message
, const wxString
& caption
,
35 const wxStringList
& choices
, wxChar
**clientData
= (wxChar
**) NULL
, long style
= wxOK
|wxCANCEL
|wxCENTRE
, const wxPoint
& pos
= wxDefaultPosition
);
37 bool Create(wxWindow
*parent
, const wxString
& message
, const wxString
& caption
,
38 int n
, const wxString
*choices
, wxChar
**clientData
= (wxChar
**) NULL
, long style
= wxOK
|wxCANCEL
|wxCENTRE
, const wxPoint
& pos
= wxDefaultPosition
);
39 bool Create(wxWindow
*parent
, const wxString
& message
, const wxString
& caption
,
40 const wxStringList
& choices
, wxChar
**clientData
= (wxChar
**) NULL
, long style
= wxOK
|wxCANCEL
|wxCENTRE
, const wxPoint
& pos
= wxDefaultPosition
);
42 void SetSelection(int sel
) ;
43 inline int GetSelection(void) const { return m_selection
; }
44 inline wxString
GetStringSelection(void) const { return m_stringSelection
; }
45 inline wxChar
*GetSelectionClientData(void) const { return m_clientData
; }
47 void OnOK(wxCommandEvent
& event
);
48 void OnListBoxDClick(wxCommandEvent
& event
);
55 wxString m_stringSelection
;
59 WXDLLEXPORT wxString
wxGetSingleChoice(const wxString
& message
, const wxString
& caption
,
60 int n
, const wxString
*choices
, wxWindow
*parent
= (wxWindow
*) NULL
,
61 int x
= -1, int y
= -1, bool centre
= TRUE
,
62 int width
= wxCHOICE_WIDTH
, int height
= wxCHOICE_HEIGHT
);
64 WXDLLEXPORT wxString
wxGetSingleChoice(const wxString
& message
, const wxString
& caption
,
65 int n
, wxChar
*choices
[], wxWindow
*parent
= (wxWindow
*) NULL
,
66 int x
= -1, int y
= -1, bool centre
= TRUE
,
67 int width
= wxCHOICE_WIDTH
, int height
= wxCHOICE_HEIGHT
);
69 // Same as above but gets position in list of strings, instead of string,
70 // or -1 if no selection
71 WXDLLEXPORT
int wxGetSingleChoiceIndex(const wxString
& message
, const wxString
& caption
,
72 int n
, const wxString
*choices
, wxWindow
*parent
= (wxWindow
*) NULL
,
73 int x
= -1, int y
= -1, bool centre
= TRUE
,
74 int width
= wxCHOICE_WIDTH
, int height
= wxCHOICE_HEIGHT
);
76 WXDLLEXPORT
int wxGetSingleChoiceIndex(const wxString
& message
, const wxString
& caption
,
77 int n
, wxChar
*choices
[], wxWindow
*parent
= (wxWindow
*) NULL
,
78 int x
= -1, int y
= -1, bool centre
= TRUE
,
79 int width
= wxCHOICE_WIDTH
, int height
= wxCHOICE_HEIGHT
);
81 // Return client data instead
82 WXDLLEXPORT wxChar
* wxGetSingleChoiceData(const wxString
& message
, const wxString
& caption
,
83 int n
, const wxString
*choices
, wxChar
**client_data
,
84 wxWindow
*parent
= (wxWindow
*) NULL
, int x
= -1, int y
= -1,
86 int width
= wxCHOICE_WIDTH
, int height
= wxCHOICE_HEIGHT
);
88 WXDLLEXPORT wxChar
* wxGetSingleChoiceData(const wxString
& message
, const wxString
& caption
,
89 int n
, wxChar
*choices
[], wxChar
**client_data
,
90 wxWindow
*parent
= (wxWindow
*) NULL
, int x
= -1, int y
= -1,
92 int width
= wxCHOICE_WIDTH
, int height
= wxCHOICE_HEIGHT
);
95 WXDLLEXPORT int wxGetMultipleChoice(const wxString& message, const wxString& caption,
96 int n, const wxString *choices,
97 int nsel, int * selection,
98 wxWindow *parent = NULL, int x = -1 , int y = -1, bool centre = TRUE,
99 int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT);