1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxChoice class interface
4 // Author: Vadim Zeitlin
8 // Copyright: (c) wxWidgets team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_CHOICE_H_BASE_
13 #define _WX_CHOICE_H_BASE_
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
23 #include "wx/ctrlsub.h" // the base class
25 // ----------------------------------------------------------------------------
27 // ----------------------------------------------------------------------------
29 extern WXDLLIMPEXP_DATA_CORE(const char) wxChoiceNameStr
[];
31 // ----------------------------------------------------------------------------
32 // wxChoice allows to select one of a non-modifiable list of strings
33 // ----------------------------------------------------------------------------
35 class WXDLLIMPEXP_CORE wxChoiceBase
: public wxControlWithItems
39 virtual ~wxChoiceBase();
41 // all generic methods are in wxControlWithItems
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
48 virtual int GetCurrentSelection() const { return GetSelection(); }
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 ; }
55 // emulate selecting the item event.GetInt()
56 void Command(wxCommandEvent
& event
);
58 // override wxItemContainer::IsSorted
59 virtual bool IsSorted() const { return HasFlag(wxCB_SORT
); }
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;
69 wxDECLARE_NO_COPY_CLASS(wxChoiceBase
);
72 // ----------------------------------------------------------------------------
73 // include the platform-dependent class definition
74 // ----------------------------------------------------------------------------
76 #if defined(__WXUNIVERSAL__)
77 #include "wx/univ/choice.h"
78 #elif defined(__SMARTPHONE__) && defined(__WXWINCE__)
79 #include "wx/msw/wince/choicece.h"
80 #elif defined(__WXMSW__)
81 #include "wx/msw/choice.h"
82 #elif defined(__WXMOTIF__)
83 #include "wx/motif/choice.h"
84 #elif defined(__WXGTK20__)
85 #include "wx/gtk/choice.h"
86 #elif defined(__WXGTK__)
87 #include "wx/gtk1/choice.h"
88 #elif defined(__WXMAC__)
89 #include "wx/osx/choice.h"
90 #elif defined(__WXCOCOA__)
91 #include "wx/cocoa/choice.h"
92 #elif defined(__WXPM__)
93 #include "wx/os2/choice.h"
96 #endif // wxUSE_CHOICE
98 #endif // _WX_CHOICE_H_BASE_