]>
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 | { | |
39 | Create(parent, id, pos, size, n, choices, style, validator, name); | |
40 | } | |
6ba93d23 | 41 | |
584ad2a3 MB |
42 | wxChoice(wxWindow *parent, |
43 | wxWindowID id, | |
44 | const wxPoint& pos, | |
45 | const wxSize& size, | |
46 | const wxArrayString& choices, | |
47 | long style = 0, | |
48 | const wxValidator& validator = wxDefaultValidator, | |
49 | const wxString& name = wxChoiceNameStr) | |
50 | { | |
51 | Create(parent, id, pos, size, choices, style, validator, name); | |
52 | } | |
bfc6fde4 | 53 | |
8d99be5f VZ |
54 | bool Create(wxWindow *parent, |
55 | wxWindowID id, | |
56 | const wxPoint& pos = wxDefaultPosition, | |
57 | const wxSize& size = wxDefaultSize, | |
58 | int n = 0, const wxString choices[] = NULL, | |
59 | long style = 0, | |
60 | const wxValidator& validator = wxDefaultValidator, | |
61 | const wxString& name = wxChoiceNameStr); | |
584ad2a3 MB |
62 | bool Create(wxWindow *parent, |
63 | wxWindowID id, | |
64 | const wxPoint& pos, | |
65 | const wxSize& size, | |
66 | const wxArrayString& choices, | |
67 | long style = 0, | |
68 | const wxValidator& validator = wxDefaultValidator, | |
69 | const wxString& name = wxChoiceNameStr); | |
8d99be5f VZ |
70 | |
71 | // implement base class pure virtuals | |
4cd056a7 | 72 | virtual int DoAppend(const wxString& item); |
243dbf1a | 73 | virtual int DoInsert(const wxString& item, int pos); |
bfc6fde4 VZ |
74 | virtual void Delete(int n); |
75 | virtual void Clear(); | |
8d99be5f VZ |
76 | |
77 | virtual int GetCount() const; | |
78 | virtual int GetSelection() const; | |
6ba93d23 VZ |
79 | #if wxABI_VERSION >= 20602 |
80 | virtual int GetCurrentSelection() const; | |
81 | #endif | |
bfc6fde4 | 82 | virtual void SetSelection(int n); |
bfc6fde4 | 83 | |
8d99be5f VZ |
84 | virtual int FindString(const wxString& s) const; |
85 | virtual wxString GetString(int n) const; | |
6c8a980f | 86 | virtual void SetString(int n, const wxString& s); |
bfc6fde4 | 87 | |
8d99be5f | 88 | // MSW only |
bfc6fde4 | 89 | virtual bool MSWCommand(WXUINT param, WXWORD id); |
c140b7e7 | 90 | WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); |
2bae4332 | 91 | virtual WXHBRUSH MSWControlColor(WXHDC hDC, WXHWND hWnd); |
bbcdf8bc JS |
92 | |
93 | protected: | |
6ba93d23 VZ |
94 | // common part of all ctors |
95 | void Init() { m_lastAcceptedSelection = wxID_NONE; } | |
96 | ||
18c50997 | 97 | virtual void DoMoveWindow(int x, int y, int width, int height); |
6c8a980f VZ |
98 | virtual void DoSetItemClientData( int n, void* clientData ); |
99 | virtual void* DoGetItemClientData( int n ) const; | |
100 | virtual void DoSetItemClientObject( int n, wxClientData* clientData ); | |
101 | virtual wxClientData* DoGetItemClientObject( int n ) const; | |
bbcdf8bc | 102 | |
8d99be5f | 103 | // MSW implementation |
882a8f40 | 104 | virtual wxSize DoGetBestSize() const; |
d99957b6 | 105 | virtual void DoGetSize(int *w, int *h) const; |
bfc6fde4 | 106 | virtual void DoSetSize(int x, int y, |
4438caf4 VZ |
107 | int width, int height, |
108 | int sizeFlags = wxSIZE_AUTO); | |
8ee9d618 | 109 | |
4b17d2e3 DS |
110 | virtual bool MSWShouldPreProcessMessage(WXMSG *pMsg); |
111 | ||
71e57cd6 VZ |
112 | virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; |
113 | ||
71e57cd6 VZ |
114 | // update the height of the drop down list to fit the number of items we |
115 | // have (without changing the visible height) | |
116 | void UpdateVisibleHeight(); | |
117 | ||
118 | // create and initialize the control | |
119 | bool CreateAndInit(wxWindow *parent, wxWindowID id, | |
120 | const wxPoint& pos, | |
121 | const wxSize& size, | |
122 | int n, const wxString choices[], | |
123 | long style, | |
124 | const wxValidator& validator, | |
125 | const wxString& name); | |
126 | ||
8ee9d618 VZ |
127 | // free all memory we have (used by Clear() and dtor) |
128 | void Free(); | |
fc7a2a60 | 129 | |
6ba93d23 VZ |
130 | |
131 | // last "completed" selection, i.e. not the transient one while the user is | |
132 | // browsing the popup list: this is only used when != wxID_NONE which is | |
133 | // the case while the drop down is opened | |
134 | int m_lastAcceptedSelection; | |
135 | ||
136 | ||
fc7a2a60 | 137 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice) |
2bda0e17 KB |
138 | }; |
139 | ||
8d99be5f | 140 | #endif // _WX_CHOICE_H_ |