1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxChoice class interface
4 // Author: Vadim Zeitlin
7 // Copyright: (c) wxWidgets team
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_CHOICE_H_BASE_
12 #define _WX_CHOICE_H_BASE_
14 // ----------------------------------------------------------------------------
16 // ----------------------------------------------------------------------------
22 #include "wx/ctrlsub.h" // the base class
24 // ----------------------------------------------------------------------------
26 // ----------------------------------------------------------------------------
28 extern WXDLLIMPEXP_DATA_CORE(const char) wxChoiceNameStr
[];
30 // ----------------------------------------------------------------------------
31 // wxChoice allows to select one of a non-modifiable list of strings
32 // ----------------------------------------------------------------------------
34 class WXDLLIMPEXP_CORE wxChoiceBase
: public wxControlWithItems
38 virtual ~wxChoiceBase();
40 // all generic methods are in wxControlWithItems
42 // get the current selection: this can only be different from the normal
43 // selection if the popup items list is currently opened and the user
44 // selected some item in it but didn't close the list yet; otherwise (and
45 // currently always on platforms other than MSW) this is the same as
47 virtual int GetCurrentSelection() const { return GetSelection(); }
49 // set/get the number of columns in the control (as they're not supported on
50 // most platforms, they do nothing by default)
51 virtual void SetColumns(int WXUNUSED(n
) = 1 ) { }
52 virtual int GetColumns() const { return 1 ; }
54 // emulate selecting the item event.GetInt()
55 void Command(wxCommandEvent
& event
);
57 // override wxItemContainer::IsSorted
58 virtual bool IsSorted() const { return HasFlag(wxCB_SORT
); }
61 // The generic implementation doesn't determine the height correctly and
62 // doesn't account for the width of the arrow but does take into account
63 // the string widths, so the derived classes should override it and set the
64 // height and add the arrow width to the size returned by this version.
65 virtual wxSize
DoGetBestSize() const;
68 wxDECLARE_NO_COPY_CLASS(wxChoiceBase
);
71 // ----------------------------------------------------------------------------
72 // include the platform-dependent class definition
73 // ----------------------------------------------------------------------------
75 #if defined(__WXUNIVERSAL__)
76 #include "wx/univ/choice.h"
77 #elif defined(__SMARTPHONE__) && defined(__WXWINCE__)
78 #include "wx/msw/wince/choicece.h"
79 #elif defined(__WXMSW__)
80 #include "wx/msw/choice.h"
81 #elif defined(__WXMOTIF__)
82 #include "wx/motif/choice.h"
83 #elif defined(__WXGTK20__)
84 #include "wx/gtk/choice.h"
85 #elif defined(__WXGTK__)
86 #include "wx/gtk1/choice.h"
87 #elif defined(__WXMAC__)
88 #include "wx/osx/choice.h"
89 #elif defined(__WXCOCOA__)
90 #include "wx/cocoa/choice.h"
91 #elif defined(__WXPM__)
92 #include "wx/os2/choice.h"
95 #endif // wxUSE_CHOICE
97 #endif // _WX_CHOICE_H_BASE_