]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/choice.h | |
3 | // Purpose: wxChoice class interface | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 26.07.99 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) wxWindows team | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_CHOICE_H_BASE_ | |
13 | #define _WX_CHOICE_H_BASE_ | |
14 | ||
15 | // ---------------------------------------------------------------------------- | |
16 | // headers | |
17 | // ---------------------------------------------------------------------------- | |
18 | ||
19 | #ifdef __GNUG__ | |
20 | #pragma interface "choicebase.h" | |
21 | #endif | |
22 | ||
23 | #if wxUSE_CHOICE | |
24 | ||
25 | #include "wx/ctrlsub.h" // the base class | |
26 | ||
27 | // ---------------------------------------------------------------------------- | |
28 | // global data | |
29 | // ---------------------------------------------------------------------------- | |
30 | ||
31 | WXDLLEXPORT_DATA(extern const wxChar*) wxChoiceNameStr; | |
32 | ||
33 | // ---------------------------------------------------------------------------- | |
34 | // wxChoice allows to select one of a non-modifiable list of strings | |
35 | // ---------------------------------------------------------------------------- | |
36 | ||
37 | class WXDLLEXPORT wxChoiceBase : public wxControlWithItems | |
38 | { | |
39 | public: | |
40 | // all generic methods are in wxControlWithItems | |
41 | #ifdef __DARWIN__ | |
42 | virtual ~wxChoiceBase() {} | |
43 | #endif | |
44 | ||
45 | // single selection logic | |
46 | virtual void SetSelection(int n) = 0; | |
47 | virtual bool SetStringSelection(const wxString& s); | |
48 | ||
49 | // don't override this | |
50 | virtual void Select(int n) { SetSelection(n); } | |
51 | ||
52 | // set/get the number of columns in the control (as they're not supporte on | |
53 | // most platforms, they do nothing by default) | |
54 | virtual void SetColumns(int WXUNUSED(n) = 1 ) { } | |
55 | virtual int GetColumns() const { return 1 ; } | |
56 | ||
57 | // emulate selecting the item event.GetInt() | |
58 | void Command(wxCommandEvent& event); | |
59 | ||
60 | }; | |
61 | ||
62 | // ---------------------------------------------------------------------------- | |
63 | // include the platform-dependent class definition | |
64 | // ---------------------------------------------------------------------------- | |
65 | ||
66 | #if defined(__WXMSW__) | |
67 | #include "wx/msw/choice.h" | |
68 | #elif defined(__WXMOTIF__) | |
69 | #include "wx/motif/choice.h" | |
70 | #elif defined(__WXGTK__) | |
71 | #include "wx/gtk/choice.h" | |
72 | #elif defined(__WXMAC__) | |
73 | #include "wx/mac/choice.h" | |
74 | #elif defined(__WXPM__) | |
75 | #include "wx/os2/choice.h" | |
76 | #elif defined(__WXSTUBS__) | |
77 | #include "wx/stubs/choice.h" | |
78 | #endif | |
79 | ||
80 | #endif // wxUSE_CHOICE | |
81 | ||
82 | #endif | |
83 | // _WX_CHOICE_H_BASE_ |