]>
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$ | |
77ffb593 | 8 | // Copyright: (c) wxWidgets team |
65571936 | 9 | // Licence: wxWindows licence |
8d99be5f VZ |
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 | ||
2ecf902b WS |
19 | #include "wx/defs.h" |
20 | ||
1e6feb95 VZ |
21 | #if wxUSE_CHOICE |
22 | ||
6c8a980f | 23 | #include "wx/ctrlsub.h" // the base class |
8d99be5f VZ |
24 | |
25 | // ---------------------------------------------------------------------------- | |
26 | // global data | |
27 | // ---------------------------------------------------------------------------- | |
28 | ||
53a2db12 | 29 | extern WXDLLIMPEXP_DATA_CORE(const char) wxChoiceNameStr[]; |
8d99be5f VZ |
30 | |
31 | // ---------------------------------------------------------------------------- | |
32 | // wxChoice allows to select one of a non-modifiable list of strings | |
33 | // ---------------------------------------------------------------------------- | |
34 | ||
53a2db12 | 35 | class WXDLLIMPEXP_CORE wxChoiceBase : public wxControlWithItems |
8d99be5f VZ |
36 | { |
37 | public: | |
6463b9f5 | 38 | wxChoiceBase() { } |
05689a13 | 39 | virtual ~wxChoiceBase(); |
8d99be5f | 40 | |
fc7a2a60 VZ |
41 | // all generic methods are in wxControlWithItems |
42 | ||
c63312c4 VZ |
43 | // get the current selection: this can only be different from the normal |
44 | // selection if the popup items list is currently opened and the user | |
45 | // selected some item in it but didn't close the list yet; otherwise (and | |
46 | // currently always on platforms other than MSW) this is the same as | |
47 | // GetSelection() | |
48 | virtual int GetCurrentSelection() const { return GetSelection(); } | |
49 | ||
3fc2f8c6 | 50 | // set/get the number of columns in the control (as they're not supported on |
8d99be5f VZ |
51 | // most platforms, they do nothing by default) |
52 | virtual void SetColumns(int WXUNUSED(n) = 1 ) { } | |
53 | virtual int GetColumns() const { return 1 ; } | |
54 | ||
6c8a980f VZ |
55 | // emulate selecting the item event.GetInt() |
56 | void Command(wxCommandEvent& event); | |
fc7a2a60 | 57 | |
a236aa20 VZ |
58 | // override wxItemContainer::IsSorted |
59 | virtual bool IsSorted() const { return HasFlag(wxCB_SORT); } | |
60 | ||
7eb0acef VZ |
61 | protected: |
62 | // The generic implementation doesn't determine the height correctly and | |
63 | // doesn't account for the width of the arrow but does take into account | |
64 | // the string widths, so the derived classes should override it and set the | |
65 | // height and add the arrow width to the size returned by this version. | |
66 | virtual wxSize DoGetBestSize() const; | |
67 | ||
fc7a2a60 | 68 | private: |
c0c133e1 | 69 | wxDECLARE_NO_COPY_CLASS(wxChoiceBase); |
8d99be5f VZ |
70 | }; |
71 | ||
72 | // ---------------------------------------------------------------------------- | |
73 | // include the platform-dependent class definition | |
74 | // ---------------------------------------------------------------------------- | |
75 | ||
926592a8 VS |
76 | #if defined(__WXUNIVERSAL__) |
77 | #include "wx/univ/choice.h" | |
9b141468 | 78 | #elif defined(__SMARTPHONE__) && defined(__WXWINCE__) |
1550d5f8 | 79 | #include "wx/msw/wince/choicece.h" |
926592a8 | 80 | #elif defined(__WXMSW__) |
8d99be5f | 81 | #include "wx/msw/choice.h" |
2049ba38 | 82 | #elif defined(__WXMOTIF__) |
8d99be5f | 83 | #include "wx/motif/choice.h" |
1be7a35c | 84 | #elif defined(__WXGTK20__) |
8d99be5f | 85 | #include "wx/gtk/choice.h" |
1be7a35c MR |
86 | #elif defined(__WXGTK__) |
87 | #include "wx/gtk1/choice.h" | |
34138703 | 88 | #elif defined(__WXMAC__) |
ef0e9220 | 89 | #include "wx/osx/choice.h" |
e64df9bc DE |
90 | #elif defined(__WXCOCOA__) |
91 | #include "wx/cocoa/choice.h" | |
1777b9bb DW |
92 | #elif defined(__WXPM__) |
93 | #include "wx/os2/choice.h" | |
c801d85f KB |
94 | #endif |
95 | ||
1e6feb95 VZ |
96 | #endif // wxUSE_CHOICE |
97 | ||
c63312c4 | 98 | #endif // _WX_CHOICE_H_BASE_ |