]>
Commit | Line | Data |
---|---|---|
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/dialog.h" | |
20 | ||
21 | class WXDLLEXPORT wxListBox; | |
22 | ||
23 | #define wxCHOICE_HEIGHT 150 | |
24 | #define wxCHOICE_WIDTH 200 | |
25 | ||
26 | #define wxCHOICEDLG_STYLE (wxDEFAULT_DIALOG_STYLE|wxOK | wxCANCEL | wxCENTRE) | |
27 | ||
28 | class WXDLLEXPORT wxSingleChoiceDialog: public wxDialog | |
29 | { | |
30 | DECLARE_DYNAMIC_CLASS(wxSingleChoiceDialog) | |
31 | ||
32 | public: | |
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); | |
66 | ||
67 | void SetSelection(int sel); | |
68 | int GetSelection() const { return m_selection; } | |
69 | wxString GetStringSelection() const { return m_stringSelection; } | |
70 | ||
71 | // obsolete function (NB: no need to make it return wxChar, it's untyped) | |
72 | char *GetSelectionClientData() const { return (char *)m_clientData; } | |
73 | ||
74 | // implementation from now on | |
75 | void OnOK(wxCommandEvent& event); | |
76 | void OnListBoxDClick(wxCommandEvent& event); | |
77 | ||
78 | protected: | |
79 | int m_selection; | |
80 | int m_dialogStyle; | |
81 | wxString m_stringSelection; | |
82 | wxListBox *m_listbox; | |
83 | ||
84 | private: | |
85 | DECLARE_EVENT_TABLE() | |
86 | }; | |
87 | ||
88 | WXDLLEXPORT wxString wxGetSingleChoice(const wxString& message, const wxString& caption, | |
89 | int n, const wxString *choices, wxWindow *parent = (wxWindow *) NULL, | |
90 | int x = -1, int y = -1, bool centre = TRUE, | |
91 | int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT); | |
92 | ||
93 | WXDLLEXPORT wxString wxGetSingleChoice(const wxString& message, const wxString& caption, | |
94 | int n, wxChar *choices[], wxWindow *parent = (wxWindow *) NULL, | |
95 | int x = -1, int y = -1, bool centre = TRUE, | |
96 | int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT); | |
97 | ||
98 | // Same as above but gets position in list of strings, instead of string, | |
99 | // or -1 if no selection | |
100 | WXDLLEXPORT int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption, | |
101 | int n, const wxString *choices, wxWindow *parent = (wxWindow *) NULL, | |
102 | int x = -1, int y = -1, bool centre = TRUE, | |
103 | int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT); | |
104 | ||
105 | WXDLLEXPORT int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption, | |
106 | int n, wxChar *choices[], wxWindow *parent = (wxWindow *) NULL, | |
107 | int x = -1, int y = -1, bool centre = TRUE, | |
108 | int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT); | |
109 | ||
110 | // Return client data instead | |
111 | WXDLLEXPORT void* wxGetSingleChoiceData(const wxString& message, const wxString& caption, | |
112 | int n, const wxString *choices, void **client_data, | |
113 | wxWindow *parent = (wxWindow *) NULL, int x = -1, int y = -1, | |
114 | bool centre = TRUE, | |
115 | int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT); | |
116 | ||
117 | WXDLLEXPORT void* wxGetSingleChoiceData(const wxString& message, const wxString& caption, | |
118 | int n, wxChar *choices[], void **client_data, | |
119 | wxWindow *parent = (wxWindow *) NULL, int x = -1, int y = -1, | |
120 | bool centre = TRUE, | |
121 | int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT); | |
122 | ||
123 | /* | |
124 | WXDLLEXPORT int wxGetMultipleChoice(const wxString& message, const wxString& caption, | |
125 | int n, const wxString *choices, | |
126 | int nsel, int * selection, | |
127 | wxWindow *parent = NULL, int x = -1 , int y = -1, bool centre = TRUE, | |
128 | int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT); | |
129 | */ | |
130 | ||
131 | #endif |