#ifdefed out a typedef not appropriate to MSW; added SetSelection to choice dialog
[wxWidgets.git] / include / wx / generic / choicdgg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: choicdgg.h
3 // Purpose: Generic choice dialogs
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c)
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __CHOICEDLGH_G__
13 #define __CHOICEDLGH_G__
14
15 #ifdef __GNUG__
16 #pragma interface "choicdgg.h"
17 #endif
18
19 #include "wx/setup.h"
20 #include "wx/dialog.h"
21
22 #define wxCHOICE_HEIGHT 150
23 #define wxCHOICE_WIDTH 200
24
25 #define wxID_LISTBOX 3000
26
27 class WXDLLEXPORT wxSingleChoiceDialog: public wxDialog
28 {
29 DECLARE_DYNAMIC_CLASS(wxSingleChoiceDialog)
30 public:
31 wxSingleChoiceDialog(wxWindow *parent, const wxString& message, const wxString& caption,
32 const int n, const wxString *choices, char **clientData = NULL, long style = wxOK|wxCANCEL|wxCENTRE, const wxPoint& pos = wxDefaultPosition);
33
34 wxSingleChoiceDialog(wxWindow *parent, const wxString& message, const wxString& caption,
35 const wxStringList& choices, char **clientData = NULL, long style = wxOK|wxCANCEL|wxCENTRE, const wxPoint& pos = wxDefaultPosition);
36
37 bool Create(wxWindow *parent, const wxString& message, const wxString& caption,
38 const int n, const wxString *choices, char **clientData = 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, char **clientData = NULL, long style = wxOK|wxCANCEL|wxCENTRE, const wxPoint& pos = wxDefaultPosition);
41
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 char *GetSelectionClientData(void) const { return m_clientData; }
46
47 void OnOK(wxCommandEvent& event);
48
49 DECLARE_EVENT_TABLE()
50
51 protected:
52 long m_dialogStyle;
53 int m_selection;
54 wxString m_stringSelection;
55 char* m_clientData;
56 };
57
58 wxString WXDLLEXPORT wxGetSingleChoice(const wxString& message, const wxString& caption,
59 const int n, const wxString *choices, wxWindow *parent = NULL,
60 const int x = -1, const int y = -1, const bool centre = TRUE,
61 const int width = wxCHOICE_WIDTH, const int height = wxCHOICE_HEIGHT);
62
63 wxString WXDLLEXPORT wxGetSingleChoice(const wxString& message, const wxString& caption,
64 const int n, char *choices[], wxWindow *parent = NULL,
65 const int x = -1, const int y = -1, const bool centre = TRUE,
66 const int width = wxCHOICE_WIDTH, const int height = wxCHOICE_HEIGHT);
67
68 // Same as above but gets position in list of strings, instead of string,
69 // or -1 if no selection
70 int WXDLLEXPORT wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
71 const int n, const wxString *choices, wxWindow *parent = NULL,
72 const int x = -1, const int y = -1, const bool centre = TRUE,
73 const int width = wxCHOICE_WIDTH, const int height = wxCHOICE_HEIGHT);
74
75 int WXDLLEXPORT wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
76 const int n, char *choices[], wxWindow *parent = NULL,
77 const int x = -1, const int y = -1, const bool centre = TRUE,
78 const int width = wxCHOICE_WIDTH, const int height = wxCHOICE_HEIGHT);
79
80 // Return client data instead
81 char* WXDLLEXPORT wxGetSingleChoiceData(const wxString& message, const wxString& caption,
82 const int n, const wxString *choices, char **client_data,
83 wxWindow *parent = NULL, const int x = -1, const int y = -1,
84 const bool centre = TRUE,
85 const int width = wxCHOICE_WIDTH, const int height = wxCHOICE_HEIGHT);
86
87 char* WXDLLEXPORT wxGetSingleChoiceData(const wxString& message, const wxString& caption,
88 const int n, char *choices[], char **client_data,
89 wxWindow *parent = NULL, const int x = -1, const int y = -1,
90 const bool centre = TRUE,
91 const int width = wxCHOICE_WIDTH, const int height = wxCHOICE_HEIGHT);
92
93 /*
94 int WXDLLEXPORT wxGetMultipleChoice(const wxString& message, const wxString& caption,
95 const int n, const wxString *choices,
96 const int nsel, int * selection,
97 wxWindow *parent = NULL, const int x = -1 , const int y = -1, const bool centre = TRUE,
98 const int width = wxCHOICE_WIDTH, const int height = wxCHOICE_HEIGHT);
99 */
100
101 #endif