| 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 | #include "wx/defs.h" |
| 20 | |
| 21 | #if wxUSE_CHOICE |
| 22 | |
| 23 | #include "wx/ctrlsub.h" // the base class |
| 24 | |
| 25 | // ---------------------------------------------------------------------------- |
| 26 | // global data |
| 27 | // ---------------------------------------------------------------------------- |
| 28 | |
| 29 | extern WXDLLIMPEXP_DATA_CORE(const char) wxChoiceNameStr[]; |
| 30 | |
| 31 | // ---------------------------------------------------------------------------- |
| 32 | // wxChoice allows to select one of a non-modifiable list of strings |
| 33 | // ---------------------------------------------------------------------------- |
| 34 | |
| 35 | class WXDLLIMPEXP_CORE wxChoiceBase : public wxControlWithItems |
| 36 | { |
| 37 | public: |
| 38 | wxChoiceBase() { } |
| 39 | virtual ~wxChoiceBase(); |
| 40 | |
| 41 | // all generic methods are in wxControlWithItems |
| 42 | |
| 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 | |
| 50 | // set/get the number of columns in the control (as they're not supported 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 | // override wxItemContainer::IsSorted |
| 59 | virtual bool IsSorted() const { return HasFlag(wxCB_SORT); } |
| 60 | |
| 61 | private: |
| 62 | wxDECLARE_NO_COPY_CLASS(wxChoiceBase); |
| 63 | }; |
| 64 | |
| 65 | // ---------------------------------------------------------------------------- |
| 66 | // include the platform-dependent class definition |
| 67 | // ---------------------------------------------------------------------------- |
| 68 | |
| 69 | #if defined(__WXUNIVERSAL__) |
| 70 | #include "wx/univ/choice.h" |
| 71 | #elif defined(__SMARTPHONE__) && defined(__WXWINCE__) |
| 72 | #include "wx/msw/wince/choicece.h" |
| 73 | #elif defined(__WXMSW__) |
| 74 | #include "wx/msw/choice.h" |
| 75 | #elif defined(__WXMOTIF__) |
| 76 | #include "wx/motif/choice.h" |
| 77 | #elif defined(__WXGTK20__) |
| 78 | #include "wx/gtk/choice.h" |
| 79 | #elif defined(__WXGTK__) |
| 80 | #include "wx/gtk1/choice.h" |
| 81 | #elif defined(__WXMAC__) |
| 82 | #include "wx/osx/choice.h" |
| 83 | #elif defined(__WXCOCOA__) |
| 84 | #include "wx/cocoa/choice.h" |
| 85 | #elif defined(__WXPM__) |
| 86 | #include "wx/os2/choice.h" |
| 87 | #endif |
| 88 | |
| 89 | #endif // wxUSE_CHOICE |
| 90 | |
| 91 | #endif // _WX_CHOICE_H_BASE_ |