]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
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) | |
c50f1fb9 | 9 | // Licence: wxWindows licence |
c801d85f KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef __CHOICEDLGH_G__ | |
13 | #define __CHOICEDLGH_G__ | |
14 | ||
15 | #ifdef __GNUG__ | |
257bf510 | 16 | #pragma interface "choicdgg.h" |
c801d85f KB |
17 | #endif |
18 | ||
19 | #include "wx/setup.h" | |
20 | #include "wx/dialog.h" | |
3e45770c | 21 | #include "wx/listbox.h" |
c801d85f KB |
22 | |
23 | #define wxCHOICE_HEIGHT 150 | |
24 | #define wxCHOICE_WIDTH 200 | |
25 | ||
257bf510 | 26 | #define wxCHOICEDLG_STYLE (wxOK | wxCANCEL | wxCENTRE) |
c801d85f KB |
27 | |
28 | class WXDLLEXPORT wxSingleChoiceDialog: public wxDialog | |
29 | { | |
257bf510 VZ |
30 | DECLARE_DYNAMIC_CLASS(wxSingleChoiceDialog) |
31 | ||
c801d85f | 32 | public: |
257bf510 VZ |
33 | wxSingleChoiceDialog(wxWindow *parent, |
34 | const wxString& message, | |
35 | const wxString& caption, | |
36 | int n, | |
37 | const wxString *choices, | |
38 | char **clientData = (char **)NULL, | |
39 | long style = wxCHOICEDLG_STYLE, | |
40 | const wxPoint& pos = wxDefaultPosition); | |
41 | ||
42 | wxSingleChoiceDialog(wxWindow *parent, | |
43 | const wxString& message, | |
44 | const wxString& caption, | |
45 | const wxStringList& choices, | |
46 | char **clientData = (char **)NULL, | |
47 | long style = wxCHOICEDLG_STYLE, | |
48 | const wxPoint& pos = wxDefaultPosition); | |
49 | ||
50 | bool Create(wxWindow *parent, | |
51 | const wxString& message, | |
52 | const wxString& caption, | |
53 | int n, | |
54 | const wxString *choices, | |
55 | char **clientData = (char **)NULL, | |
56 | long style = wxCHOICEDLG_STYLE, | |
57 | const wxPoint& pos = wxDefaultPosition); | |
58 | ||
59 | bool Create(wxWindow *parent, | |
60 | const wxString& message, | |
61 | const wxString& caption, | |
62 | const wxStringList& choices, | |
63 | char **clientData = (char **)NULL, | |
64 | long style = wxCHOICEDLG_STYLE, | |
65 | const wxPoint& pos = wxDefaultPosition); | |
c801d85f | 66 | |
257bf510 VZ |
67 | void SetSelection(int sel) ; |
68 | int GetSelection() const { return m_selection; } | |
69 | wxString GetStringSelection() const { return m_stringSelection; } | |
c801d85f | 70 | |
257bf510 VZ |
71 | // get client data associated with selection |
72 | void *GetClientData() const { return m_clientData; } | |
c801d85f | 73 | |
257bf510 VZ |
74 | // obsolete function (NB: no need to make it return wxChar, it's untyped) |
75 | char *GetSelectionClientData() const { return (char *)m_clientData; } | |
c801d85f | 76 | |
257bf510 | 77 | // implementation from now on |
c801d85f | 78 | void OnOK(wxCommandEvent& event); |
debe6624 | 79 | void OnListBoxDClick(wxCommandEvent& event); |
c801d85f | 80 | |
c801d85f | 81 | protected: |
c801d85f | 82 | int m_selection; |
92afa2b1 | 83 | int m_dialogStyle; |
c801d85f | 84 | wxString m_stringSelection; |
257bf510 VZ |
85 | wxListBox *m_listbox; |
86 | ||
87 | private: | |
88 | DECLARE_EVENT_TABLE() | |
c801d85f KB |
89 | }; |
90 | ||
184b5d99 | 91 | WXDLLEXPORT wxString wxGetSingleChoice(const wxString& message, const wxString& caption, |
c67daf87 | 92 | int n, const wxString *choices, wxWindow *parent = (wxWindow *) NULL, |
debe6624 JS |
93 | int x = -1, int y = -1, bool centre = TRUE, |
94 | int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT); | |
c801d85f | 95 | |
184b5d99 | 96 | WXDLLEXPORT wxString wxGetSingleChoice(const wxString& message, const wxString& caption, |
9d2f3c71 | 97 | int n, wxChar *choices[], wxWindow *parent = (wxWindow *) NULL, |
debe6624 JS |
98 | int x = -1, int y = -1, bool centre = TRUE, |
99 | int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT); | |
c801d85f KB |
100 | |
101 | // Same as above but gets position in list of strings, instead of string, | |
102 | // or -1 if no selection | |
184b5d99 | 103 | WXDLLEXPORT int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption, |
c67daf87 | 104 | int n, const wxString *choices, wxWindow *parent = (wxWindow *) NULL, |
debe6624 JS |
105 | int x = -1, int y = -1, bool centre = TRUE, |
106 | int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT); | |
c801d85f | 107 | |
184b5d99 | 108 | WXDLLEXPORT int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption, |
9d2f3c71 | 109 | int n, wxChar *choices[], wxWindow *parent = (wxWindow *) NULL, |
debe6624 JS |
110 | int x = -1, int y = -1, bool centre = TRUE, |
111 | int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT); | |
c801d85f KB |
112 | |
113 | // Return client data instead | |
257bf510 | 114 | // FIXME: this is horrible, using "char *" instead of "void *" belongs to the 70s! |
9d2f3c71 | 115 | WXDLLEXPORT wxChar* wxGetSingleChoiceData(const wxString& message, const wxString& caption, |
257bf510 | 116 | int n, const wxString *choices, char **client_data, |
c67daf87 | 117 | wxWindow *parent = (wxWindow *) NULL, int x = -1, int y = -1, |
debe6624 JS |
118 | bool centre = TRUE, |
119 | int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT); | |
c801d85f | 120 | |
9d2f3c71 | 121 | WXDLLEXPORT wxChar* wxGetSingleChoiceData(const wxString& message, const wxString& caption, |
257bf510 | 122 | int n, wxChar *choices[], char **client_data, |
c67daf87 | 123 | wxWindow *parent = (wxWindow *) NULL, int x = -1, int y = -1, |
debe6624 JS |
124 | bool centre = TRUE, |
125 | int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT); | |
126 | ||
c801d85f | 127 | /* |
184b5d99 | 128 | WXDLLEXPORT int wxGetMultipleChoice(const wxString& message, const wxString& caption, |
debe6624 JS |
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); | |
c801d85f KB |
133 | */ |
134 | ||
135 | #endif |