added destructor (correction for Mac OS X)
[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) 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 #include "wx/ctrlsub.h" // the base class
24
25 // ----------------------------------------------------------------------------
26 // global data
27 // ----------------------------------------------------------------------------
28
29 WXDLLEXPORT_DATA(extern const wxChar*) wxChoiceNameStr;
30
31 // ----------------------------------------------------------------------------
32 // wxChoice allows to select one of a non-modifiable list of strings
33 // ----------------------------------------------------------------------------
34
35 class WXDLLEXPORT wxChoiceBase : public wxControlWithItems
36 {
37 public:
38 // all generic methods are in wxControlWithItems
39 #ifdef __WXMAC_X__
40 virtual ~wxChoiceBase() {}
41 #endif
42
43 // single selection logic
44 virtual void SetSelection(int n) = 0;
45 virtual bool SetStringSelection(const wxString& s);
46
47 // don't override this
48 virtual void Select(int n) { SetSelection(n); }
49
50 // set/get the number of columns in the control (as they're not supporte on
51 // most platforms, they do nothing by default)
52 virtual void SetColumns(int WXUNUSED(n) = 1 ) { }
53 virtual int GetColumns() const { return 1 ; }
54
55 // emulate selecting the item event.GetInt()
56 void Command(wxCommandEvent& event);
57
58 };
59
60 // ----------------------------------------------------------------------------
61 // include the platform-dependent class definition
62 // ----------------------------------------------------------------------------
63
64 #if defined(__WXMSW__)
65 #include "wx/msw/choice.h"
66 #elif defined(__WXMOTIF__)
67 #include "wx/motif/choice.h"
68 #elif defined(__WXGTK__)
69 #include "wx/gtk/choice.h"
70 #elif defined(__WXQT__)
71 #include "wx/qt/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
81 // _WX_CHOICE_H_BASE_