1. wxSingleChoiceDialog looks Ok under Windows
[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 wxCHOICEDLG_STYLE (wxOK | wxCANCEL | wxCENTRE)
26
27 class WXDLLEXPORT wxSingleChoiceDialog: public wxDialog
28 {
29 DECLARE_DYNAMIC_CLASS(wxSingleChoiceDialog)
30
31 public:
32 wxSingleChoiceDialog(wxWindow *parent,
33 const wxString& message,
34 const wxString& caption,
35 int n,
36 const wxString *choices,
37 char **clientData = (char **)NULL,
38 long style = wxCHOICEDLG_STYLE,
39 const wxPoint& pos = wxDefaultPosition);
40
41 wxSingleChoiceDialog(wxWindow *parent,
42 const wxString& message,
43 const wxString& caption,
44 const wxStringList& choices,
45 char **clientData = (char **)NULL,
46 long style = wxCHOICEDLG_STYLE,
47 const wxPoint& pos = wxDefaultPosition);
48
49 bool Create(wxWindow *parent,
50 const wxString& message,
51 const wxString& caption,
52 int n,
53 const wxString *choices,
54 char **clientData = (char **)NULL,
55 long style = wxCHOICEDLG_STYLE,
56 const wxPoint& pos = wxDefaultPosition);
57
58 bool Create(wxWindow *parent,
59 const wxString& message,
60 const wxString& caption,
61 const wxStringList& choices,
62 char **clientData = (char **)NULL,
63 long style = wxCHOICEDLG_STYLE,
64 const wxPoint& pos = wxDefaultPosition);
65
66 void SetSelection(int sel) ;
67 int GetSelection() const { return m_selection; }
68 wxString GetStringSelection() const { return m_stringSelection; }
69
70 // get client data associated with selection
71 void *GetClientData() const { return m_clientData; }
72
73 // obsolete function (NB: no need to make it return wxChar, it's untyped)
74 char *GetSelectionClientData() const { return (char *)m_clientData; }
75
76 // implementation from now on
77 void OnOK(wxCommandEvent& event);
78 void OnListBoxDClick(wxCommandEvent& event);
79
80 protected:
81 long m_dialogStyle;
82 int m_selection;
83 wxString m_stringSelection;
84 void *m_clientData;
85 wxListBox *m_listbox;
86
87 private:
88 DECLARE_EVENT_TABLE()
89 };
90
91 WXDLLEXPORT wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
92 int n, const wxString *choices, wxWindow *parent = (wxWindow *) NULL,
93 int x = -1, int y = -1, bool centre = TRUE,
94 int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT);
95
96 WXDLLEXPORT wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
97 int n, wxChar *choices[], wxWindow *parent = (wxWindow *) NULL,
98 int x = -1, int y = -1, bool centre = TRUE,
99 int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT);
100
101 // Same as above but gets position in list of strings, instead of string,
102 // or -1 if no selection
103 WXDLLEXPORT int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
104 int n, const wxString *choices, wxWindow *parent = (wxWindow *) NULL,
105 int x = -1, int y = -1, bool centre = TRUE,
106 int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT);
107
108 WXDLLEXPORT int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
109 int n, wxChar *choices[], wxWindow *parent = (wxWindow *) NULL,
110 int x = -1, int y = -1, bool centre = TRUE,
111 int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT);
112
113 // Return client data instead
114 // FIXME: this is horrible, using "char *" instead of "void *" belongs to the 70s!
115 WXDLLEXPORT wxChar* wxGetSingleChoiceData(const wxString& message, const wxString& caption,
116 int n, const wxString *choices, char **client_data,
117 wxWindow *parent = (wxWindow *) NULL, int x = -1, int y = -1,
118 bool centre = TRUE,
119 int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT);
120
121 WXDLLEXPORT wxChar* wxGetSingleChoiceData(const wxString& message, const wxString& caption,
122 int n, wxChar *choices[], char **client_data,
123 wxWindow *parent = (wxWindow *) NULL, int x = -1, int y = -1,
124 bool centre = TRUE,
125 int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT);
126
127 /*
128 WXDLLEXPORT int wxGetMultipleChoice(const wxString& message, const wxString& caption,
129 int n, const wxString *choices,
130 int nsel, int * selection,
131 wxWindow *parent = NULL, int x = -1 , int y = -1, bool centre = TRUE,
132 int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT);
133 */
134
135 #endif