removed multiple duplicate copies (with subtly different behaviour) of SetStringSelec...
[wxWidgets.git] / include / wx / choice.h
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) wxWidgets 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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
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 extern WXDLLEXPORT_DATA(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 wxChoiceBase() { }
41 virtual ~wxChoiceBase();
42
43 // all generic methods are in wxControlWithItems
44
45 // single selection logic
46 virtual void SetSelection(int n) = 0;
47
48 // don't override this
49 virtual void Select(int n) { SetSelection(n); }
50
51 // set/get the number of columns in the control (as they're not supported on
52 // most platforms, they do nothing by default)
53 virtual void SetColumns(int WXUNUSED(n) = 1 ) { }
54 virtual int GetColumns() const { return 1 ; }
55
56 // emulate selecting the item event.GetInt()
57 void Command(wxCommandEvent& event);
58
59 private:
60 DECLARE_NO_COPY_CLASS(wxChoiceBase)
61 };
62
63 // ----------------------------------------------------------------------------
64 // include the platform-dependent class definition
65 // ----------------------------------------------------------------------------
66
67 #if defined(__WXUNIVERSAL__)
68 #include "wx/univ/choice.h"
69 #elif defined(__SMARTPHONE__) && defined(__WXWINCE__)
70 #include "wx/msw/wince/choicece.h"
71 #elif defined(__WXMSW__)
72 #include "wx/msw/choice.h"
73 #elif defined(__WXMOTIF__)
74 #include "wx/motif/choice.h"
75 #elif defined(__WXGTK__)
76 #include "wx/gtk/choice.h"
77 #elif defined(__WXMAC__)
78 #include "wx/mac/choice.h"
79 #elif defined(__WXCOCOA__)
80 #include "wx/cocoa/choice.h"
81 #elif defined(__WXPM__)
82 #include "wx/os2/choice.h"
83 #endif
84
85 #endif // wxUSE_CHOICE
86
87 #endif
88 // _WX_CHOICE_H_BASE_