]>
Commit | Line | Data |
---|---|---|
8d99be5f VZ |
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 | ||
34138703 JS |
12 | #ifndef _WX_CHOICE_H_BASE_ |
13 | #define _WX_CHOICE_H_BASE_ | |
c801d85f | 14 | |
8d99be5f VZ |
15 | // ---------------------------------------------------------------------------- |
16 | // headers | |
17 | // ---------------------------------------------------------------------------- | |
18 | ||
af49c4b8 | 19 | #if defined(__GNUG__) && !defined(__APPLE__) |
1b68e0b5 | 20 | #pragma interface "choicebase.h" |
8d99be5f VZ |
21 | #endif |
22 | ||
1e6feb95 VZ |
23 | #if wxUSE_CHOICE |
24 | ||
6c8a980f | 25 | #include "wx/ctrlsub.h" // the base class |
8d99be5f VZ |
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 | ||
6c8a980f | 37 | class WXDLLEXPORT wxChoiceBase : public wxControlWithItems |
8d99be5f VZ |
38 | { |
39 | public: | |
fc7a2a60 | 40 | wxChoiceBase() { } |
799ea011 | 41 | virtual ~wxChoiceBase(); |
8d99be5f | 42 | |
fc7a2a60 VZ |
43 | // all generic methods are in wxControlWithItems |
44 | ||
6c8a980f VZ |
45 | // single selection logic |
46 | virtual void SetSelection(int n) = 0; | |
47 | virtual bool SetStringSelection(const wxString& s); | |
8d99be5f | 48 | |
6c8a980f VZ |
49 | // don't override this |
50 | virtual void Select(int n) { SetSelection(n); } | |
8d99be5f | 51 | |
3fc2f8c6 | 52 | // set/get the number of columns in the control (as they're not supported on |
8d99be5f VZ |
53 | // most platforms, they do nothing by default) |
54 | virtual void SetColumns(int WXUNUSED(n) = 1 ) { } | |
55 | virtual int GetColumns() const { return 1 ; } | |
56 | ||
6c8a980f VZ |
57 | // emulate selecting the item event.GetInt() |
58 | void Command(wxCommandEvent& event); | |
fc7a2a60 VZ |
59 | |
60 | private: | |
61 | DECLARE_NO_COPY_CLASS(wxChoiceBase) | |
8d99be5f VZ |
62 | }; |
63 | ||
64 | // ---------------------------------------------------------------------------- | |
65 | // include the platform-dependent class definition | |
66 | // ---------------------------------------------------------------------------- | |
67 | ||
926592a8 VS |
68 | #if defined(__WXUNIVERSAL__) |
69 | #include "wx/univ/choice.h" | |
70 | #elif defined(__WXMSW__) | |
8d99be5f | 71 | #include "wx/msw/choice.h" |
2049ba38 | 72 | #elif defined(__WXMOTIF__) |
8d99be5f | 73 | #include "wx/motif/choice.h" |
2049ba38 | 74 | #elif defined(__WXGTK__) |
8d99be5f | 75 | #include "wx/gtk/choice.h" |
34138703 | 76 | #elif defined(__WXMAC__) |
8d99be5f | 77 | #include "wx/mac/choice.h" |
e64df9bc DE |
78 | #elif defined(__WXCOCOA__) |
79 | #include "wx/cocoa/choice.h" | |
1777b9bb DW |
80 | #elif defined(__WXPM__) |
81 | #include "wx/os2/choice.h" | |
c801d85f KB |
82 | #endif |
83 | ||
1e6feb95 VZ |
84 | #endif // wxUSE_CHOICE |
85 | ||
c801d85f | 86 | #endif |
34138703 | 87 | // _WX_CHOICE_H_BASE_ |