]>
Commit | Line | Data |
---|---|---|
2bda0e17 KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: choice.h | |
3 | // Purpose: wxChoice class | |
4 | // Author: Julian Smart | |
8d99be5f | 5 | // Modified by: Vadim Zeitlin to derive from wxChoiceBase |
2bda0e17 KB |
6 | // Created: 01/02/97 |
7 | // RCS-ID: $Id$ | |
bbcdf8bc | 8 | // Copyright: (c) Julian Smart |
65571936 | 9 | // Licence: wxWindows licence |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_CHOICE_H_ |
13 | #define _WX_CHOICE_H_ | |
2bda0e17 | 14 | |
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
8d99be5f | 16 | #pragma interface "choice.h" |
2bda0e17 KB |
17 | #endif |
18 | ||
8d99be5f | 19 | // ---------------------------------------------------------------------------- |
2bda0e17 | 20 | // Choice item |
8d99be5f VZ |
21 | // ---------------------------------------------------------------------------- |
22 | ||
23 | class WXDLLEXPORT wxChoice : public wxChoiceBase | |
2bda0e17 | 24 | { |
bfc6fde4 | 25 | public: |
8d99be5f | 26 | // ctors |
6ba93d23 | 27 | wxChoice() { Init(); } |
8ee9d618 | 28 | virtual ~wxChoice(); |
8d99be5f VZ |
29 | |
30 | wxChoice(wxWindow *parent, | |
31 | wxWindowID id, | |
32 | const wxPoint& pos = wxDefaultPosition, | |
33 | const wxSize& size = wxDefaultSize, | |
34 | int n = 0, const wxString choices[] = NULL, | |
35 | long style = 0, | |
36 | const wxValidator& validator = wxDefaultValidator, | |
6463b9f5 JS |
37 | const wxString& name = wxChoiceNameStr) |
38 | { | |
94500b32 | 39 | Init(); |
6463b9f5 JS |
40 | Create(parent, id, pos, size, n, choices, style, validator, name); |
41 | } | |
6ba93d23 | 42 | |
584ad2a3 MB |
43 | wxChoice(wxWindow *parent, |
44 | wxWindowID id, | |
45 | const wxPoint& pos, | |
46 | const wxSize& size, | |
47 | const wxArrayString& choices, | |
48 | long style = 0, | |
49 | const wxValidator& validator = wxDefaultValidator, | |
50 | const wxString& name = wxChoiceNameStr) | |
51 | { | |
94500b32 | 52 | Init(); |
584ad2a3 MB |
53 | Create(parent, id, pos, size, choices, style, validator, name); |
54 | } | |
bfc6fde4 | 55 | |
8d99be5f VZ |
56 | bool Create(wxWindow *parent, |
57 | wxWindowID id, | |
58 | const wxPoint& pos = wxDefaultPosition, | |
59 | const wxSize& size = wxDefaultSize, | |
60 | int n = 0, const wxString choices[] = NULL, | |
61 | long style = 0, | |
62 | const wxValidator& validator = wxDefaultValidator, | |
63 | const wxString& name = wxChoiceNameStr); | |
584ad2a3 MB |
64 | bool Create(wxWindow *parent, |
65 | wxWindowID id, | |
66 | const wxPoint& pos, | |
67 | const wxSize& size, | |
68 | const wxArrayString& choices, | |
69 | long style = 0, | |
70 | const wxValidator& validator = wxDefaultValidator, | |
71 | const wxString& name = wxChoiceNameStr); | |
8d99be5f VZ |
72 | |
73 | // implement base class pure virtuals | |
4cd056a7 | 74 | virtual int DoAppend(const wxString& item); |
243dbf1a | 75 | virtual int DoInsert(const wxString& item, int pos); |
bfc6fde4 VZ |
76 | virtual void Delete(int n); |
77 | virtual void Clear(); | |
8d99be5f VZ |
78 | |
79 | virtual int GetCount() const; | |
80 | virtual int GetSelection() const; | |
6ba93d23 VZ |
81 | #if wxABI_VERSION >= 20602 |
82 | virtual int GetCurrentSelection() const; | |
83 | #endif | |
bfc6fde4 | 84 | virtual void SetSelection(int n); |
bfc6fde4 | 85 | |
8d99be5f VZ |
86 | virtual int FindString(const wxString& s) const; |
87 | virtual wxString GetString(int n) const; | |
6c8a980f | 88 | virtual void SetString(int n, const wxString& s); |
bfc6fde4 | 89 | |
8d99be5f | 90 | // MSW only |
bfc6fde4 | 91 | virtual bool MSWCommand(WXUINT param, WXWORD id); |
c140b7e7 | 92 | WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); |
2bae4332 | 93 | virtual WXHBRUSH MSWControlColor(WXHDC hDC, WXHWND hWnd); |
bbcdf8bc JS |
94 | |
95 | protected: | |
6ba93d23 VZ |
96 | // common part of all ctors |
97 | void Init() { m_lastAcceptedSelection = wxID_NONE; } | |
98 | ||
18c50997 | 99 | virtual void DoMoveWindow(int x, int y, int width, int height); |
6c8a980f VZ |
100 | virtual void DoSetItemClientData( int n, void* clientData ); |
101 | virtual void* DoGetItemClientData( int n ) const; | |
102 | virtual void DoSetItemClientObject( int n, wxClientData* clientData ); | |
103 | virtual wxClientData* DoGetItemClientObject( int n ) const; | |
bbcdf8bc | 104 | |
8d99be5f | 105 | // MSW implementation |
882a8f40 | 106 | virtual wxSize DoGetBestSize() const; |
d99957b6 | 107 | virtual void DoGetSize(int *w, int *h) const; |
bfc6fde4 | 108 | virtual void DoSetSize(int x, int y, |
4438caf4 VZ |
109 | int width, int height, |
110 | int sizeFlags = wxSIZE_AUTO); | |
8ee9d618 | 111 | |
4b17d2e3 DS |
112 | virtual bool MSWShouldPreProcessMessage(WXMSG *pMsg); |
113 | ||
71e57cd6 VZ |
114 | virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; |
115 | ||
71e57cd6 VZ |
116 | // update the height of the drop down list to fit the number of items we |
117 | // have (without changing the visible height) | |
118 | void UpdateVisibleHeight(); | |
119 | ||
120 | // create and initialize the control | |
121 | bool CreateAndInit(wxWindow *parent, wxWindowID id, | |
122 | const wxPoint& pos, | |
123 | const wxSize& size, | |
124 | int n, const wxString choices[], | |
125 | long style, | |
126 | const wxValidator& validator, | |
127 | const wxString& name); | |
128 | ||
8ee9d618 VZ |
129 | // free all memory we have (used by Clear() and dtor) |
130 | void Free(); | |
fc7a2a60 | 131 | |
6ba93d23 VZ |
132 | |
133 | // last "completed" selection, i.e. not the transient one while the user is | |
134 | // browsing the popup list: this is only used when != wxID_NONE which is | |
135 | // the case while the drop down is opened | |
136 | int m_lastAcceptedSelection; | |
137 | ||
138 | ||
fc7a2a60 | 139 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice) |
2bda0e17 KB |
140 | }; |
141 | ||
8d99be5f | 142 | #endif // _WX_CHOICE_H_ |