]>
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 |
8d99be5f | 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 |
6463b9f5 | 27 | wxChoice() { } |
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 | } | |
584ad2a3 MB |
41 | wxChoice(wxWindow *parent, |
42 | wxWindowID id, | |
43 | const wxPoint& pos, | |
44 | const wxSize& size, | |
45 | const wxArrayString& choices, | |
46 | long style = 0, | |
47 | const wxValidator& validator = wxDefaultValidator, | |
48 | const wxString& name = wxChoiceNameStr) | |
49 | { | |
50 | Create(parent, id, pos, size, choices, style, validator, name); | |
51 | } | |
bfc6fde4 | 52 | |
8d99be5f VZ |
53 | bool Create(wxWindow *parent, |
54 | wxWindowID id, | |
55 | const wxPoint& pos = wxDefaultPosition, | |
56 | const wxSize& size = wxDefaultSize, | |
57 | int n = 0, const wxString choices[] = NULL, | |
58 | long style = 0, | |
59 | const wxValidator& validator = wxDefaultValidator, | |
60 | const wxString& name = wxChoiceNameStr); | |
584ad2a3 MB |
61 | bool Create(wxWindow *parent, |
62 | wxWindowID id, | |
63 | const wxPoint& pos, | |
64 | const wxSize& size, | |
65 | const wxArrayString& choices, | |
66 | long style = 0, | |
67 | const wxValidator& validator = wxDefaultValidator, | |
68 | const wxString& name = wxChoiceNameStr); | |
8d99be5f VZ |
69 | |
70 | // implement base class pure virtuals | |
4cd056a7 | 71 | virtual int DoAppend(const wxString& item); |
243dbf1a | 72 | virtual int DoInsert(const wxString& item, int pos); |
bfc6fde4 VZ |
73 | virtual void Delete(int n); |
74 | virtual void Clear(); | |
8d99be5f VZ |
75 | |
76 | virtual int GetCount() const; | |
77 | virtual int GetSelection() const; | |
bfc6fde4 | 78 | virtual void SetSelection(int n); |
bfc6fde4 | 79 | |
8d99be5f VZ |
80 | virtual int FindString(const wxString& s) const; |
81 | virtual wxString GetString(int n) const; | |
6c8a980f | 82 | virtual void SetString(int n, const wxString& s); |
bfc6fde4 | 83 | |
8d99be5f | 84 | // MSW only |
bfc6fde4 | 85 | virtual bool MSWCommand(WXUINT param, WXWORD id); |
bfc6fde4 | 86 | long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); |
f6bcfd97 BP |
87 | virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, |
88 | WXUINT message, WXWPARAM wParam, WXLPARAM lParam); | |
bbcdf8bc JS |
89 | |
90 | protected: | |
18c50997 | 91 | virtual void DoMoveWindow(int x, int y, int width, int height); |
6c8a980f VZ |
92 | virtual void DoSetItemClientData( int n, void* clientData ); |
93 | virtual void* DoGetItemClientData( int n ) const; | |
94 | virtual void DoSetItemClientObject( int n, wxClientData* clientData ); | |
95 | virtual wxClientData* DoGetItemClientObject( int n ) const; | |
bbcdf8bc | 96 | |
8d99be5f | 97 | // MSW implementation |
882a8f40 | 98 | virtual wxSize DoGetBestSize() const; |
d99957b6 | 99 | virtual void DoGetSize(int *w, int *h) const; |
bfc6fde4 | 100 | virtual void DoSetSize(int x, int y, |
4438caf4 VZ |
101 | int width, int height, |
102 | int sizeFlags = wxSIZE_AUTO); | |
8ee9d618 | 103 | |
71e57cd6 VZ |
104 | virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; |
105 | ||
d99957b6 VZ |
106 | // get the real height of the control |
107 | int GetVisibleHeight() const; | |
108 | ||
71e57cd6 VZ |
109 | // update the height of the drop down list to fit the number of items we |
110 | // have (without changing the visible height) | |
111 | void UpdateVisibleHeight(); | |
112 | ||
113 | // create and initialize the control | |
114 | bool CreateAndInit(wxWindow *parent, wxWindowID id, | |
115 | const wxPoint& pos, | |
116 | const wxSize& size, | |
117 | int n, const wxString choices[], | |
118 | long style, | |
119 | const wxValidator& validator, | |
120 | const wxString& name); | |
121 | ||
8ee9d618 VZ |
122 | // free all memory we have (used by Clear() and dtor) |
123 | void Free(); | |
fc7a2a60 VZ |
124 | |
125 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice) | |
2bda0e17 KB |
126 | }; |
127 | ||
8d99be5f | 128 | #endif // _WX_CHOICE_H_ |