]> git.saurik.com Git - wxWidgets.git/blame - include/wx/choice.h
Make storing non-trivial data in wxThreadSpecificInfo possible.
[wxWidgets.git] / include / wx / choice.h
CommitLineData
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
77ffb593 7// Copyright: (c) wxWidgets team
65571936 8// Licence: wxWindows licence
8d99be5f
VZ
9/////////////////////////////////////////////////////////////////////////////
10
34138703
JS
11#ifndef _WX_CHOICE_H_BASE_
12#define _WX_CHOICE_H_BASE_
c801d85f 13
8d99be5f
VZ
14// ----------------------------------------------------------------------------
15// headers
16// ----------------------------------------------------------------------------
17
2ecf902b
WS
18#include "wx/defs.h"
19
1e6feb95
VZ
20#if wxUSE_CHOICE
21
6c8a980f 22#include "wx/ctrlsub.h" // the base class
8d99be5f
VZ
23
24// ----------------------------------------------------------------------------
25// global data
26// ----------------------------------------------------------------------------
27
53a2db12 28extern WXDLLIMPEXP_DATA_CORE(const char) wxChoiceNameStr[];
8d99be5f
VZ
29
30// ----------------------------------------------------------------------------
31// wxChoice allows to select one of a non-modifiable list of strings
32// ----------------------------------------------------------------------------
33
53a2db12 34class WXDLLIMPEXP_CORE wxChoiceBase : public wxControlWithItems
8d99be5f
VZ
35{
36public:
6463b9f5 37 wxChoiceBase() { }
05689a13 38 virtual ~wxChoiceBase();
8d99be5f 39
fc7a2a60
VZ
40 // all generic methods are in wxControlWithItems
41
c63312c4
VZ
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
46 // GetSelection()
47 virtual int GetCurrentSelection() const { return GetSelection(); }
48
3fc2f8c6 49 // set/get the number of columns in the control (as they're not supported on
8d99be5f
VZ
50 // most platforms, they do nothing by default)
51 virtual void SetColumns(int WXUNUSED(n) = 1 ) { }
52 virtual int GetColumns() const { return 1 ; }
53
6c8a980f
VZ
54 // emulate selecting the item event.GetInt()
55 void Command(wxCommandEvent& event);
fc7a2a60 56
a236aa20
VZ
57 // override wxItemContainer::IsSorted
58 virtual bool IsSorted() const { return HasFlag(wxCB_SORT); }
59
7eb0acef
VZ
60protected:
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;
66
fc7a2a60 67private:
c0c133e1 68 wxDECLARE_NO_COPY_CLASS(wxChoiceBase);
8d99be5f
VZ
69};
70
71// ----------------------------------------------------------------------------
72// include the platform-dependent class definition
73// ----------------------------------------------------------------------------
74
926592a8
VS
75#if defined(__WXUNIVERSAL__)
76 #include "wx/univ/choice.h"
9b141468 77#elif defined(__SMARTPHONE__) && defined(__WXWINCE__)
1550d5f8 78 #include "wx/msw/wince/choicece.h"
926592a8 79#elif defined(__WXMSW__)
8d99be5f 80 #include "wx/msw/choice.h"
2049ba38 81#elif defined(__WXMOTIF__)
8d99be5f 82 #include "wx/motif/choice.h"
1be7a35c 83#elif defined(__WXGTK20__)
8d99be5f 84 #include "wx/gtk/choice.h"
1be7a35c
MR
85#elif defined(__WXGTK__)
86 #include "wx/gtk1/choice.h"
34138703 87#elif defined(__WXMAC__)
ef0e9220 88 #include "wx/osx/choice.h"
e64df9bc
DE
89#elif defined(__WXCOCOA__)
90 #include "wx/cocoa/choice.h"
1777b9bb
DW
91#elif defined(__WXPM__)
92 #include "wx/os2/choice.h"
c801d85f
KB
93#endif
94
1e6feb95
VZ
95#endif // wxUSE_CHOICE
96
c63312c4 97#endif // _WX_CHOICE_H_BASE_