]>
Commit | Line | Data |
---|---|---|
0e320a79 | 1 | ///////////////////////////////////////////////////////////////////////////// |
853dcc57 | 2 | // Name: wx/os2/choice.h |
0e320a79 | 3 | // Purpose: wxChoice class |
37f214d5 | 4 | // Author: David Webster |
0e320a79 | 5 | // Modified by: |
37f214d5 | 6 | // Created: 10/13/99 |
0e320a79 | 7 | // RCS-ID: $Id$ |
37f214d5 | 8 | // Copyright: (c) David Webster |
65571936 | 9 | // Licence: wxWindows licence |
0e320a79 DW |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_CHOICE_H_ | |
13 | #define _WX_CHOICE_H_ | |
14 | ||
0934d91c | 15 | // ---------------------------------------------------------------------------- |
0e320a79 | 16 | // Choice item |
0934d91c SN |
17 | // ---------------------------------------------------------------------------- |
18 | ||
409c9842 | 19 | class WXDLLEXPORT wxChoice: public wxChoiceBase |
0e320a79 DW |
20 | { |
21 | DECLARE_DYNAMIC_CLASS(wxChoice) | |
22 | ||
dcd307ee DW |
23 | public: |
24 | // ctors | |
0934d91c SN |
25 | inline wxChoice() { Init(); } |
26 | virtual ~wxChoice(); | |
0e320a79 | 27 | |
fb49f3b3 DW |
28 | inline wxChoice( wxWindow* pParent |
29 | ,wxWindowID vId | |
30 | ,const wxPoint& rPos = wxDefaultPosition | |
31 | ,const wxSize& rSize = wxDefaultSize | |
32 | ,int n = 0 | |
33 | ,const wxString asChoices[] = NULL | |
34 | ,long lStyle = 0 | |
fb49f3b3 | 35 | ,const wxValidator& rValidator = wxDefaultValidator |
fb49f3b3 DW |
36 | ,const wxString& rsName = wxChoiceNameStr |
37 | ) | |
dcd307ee | 38 | { |
0934d91c | 39 | Init(); |
fb49f3b3 DW |
40 | Create( pParent |
41 | ,vId | |
42 | ,rPos | |
43 | ,rSize | |
44 | ,n | |
45 | ,asChoices | |
46 | ,lStyle | |
fb49f3b3 | 47 | ,rValidator |
fb49f3b3 DW |
48 | ,rsName |
49 | ); | |
dcd307ee | 50 | } |
0e320a79 | 51 | |
584ad2a3 MB |
52 | inline wxChoice( wxWindow* pParent |
53 | ,wxWindowID vId | |
54 | ,const wxPoint& rPos | |
55 | ,const wxSize& rSize | |
56 | ,const wxArrayString& asChoices | |
57 | ,long lStyle = 0 | |
58 | ,const wxValidator& rValidator = wxDefaultValidator | |
59 | ,const wxString& rsName = wxChoiceNameStr | |
60 | ) | |
61 | { | |
0934d91c | 62 | Init(); |
584ad2a3 MB |
63 | Create( pParent |
64 | ,vId | |
65 | ,rPos | |
66 | ,rSize | |
67 | ,asChoices | |
68 | ,lStyle | |
69 | ,rValidator | |
70 | ,rsName | |
71 | ); | |
72 | } | |
73 | ||
fb49f3b3 DW |
74 | bool Create( wxWindow* pParent |
75 | ,wxWindowID vId | |
76 | ,const wxPoint& rPos = wxDefaultPosition | |
77 | ,const wxSize& rSize = wxDefaultSize | |
78 | ,int n = 0 | |
79 | ,const wxString asChoices[] = NULL | |
80 | ,long lStyle = 0 | |
fb49f3b3 | 81 | ,const wxValidator& rValidator = wxDefaultValidator |
fb49f3b3 DW |
82 | ,const wxString& rsName = wxChoiceNameStr |
83 | ); | |
0e320a79 | 84 | |
584ad2a3 MB |
85 | bool Create( wxWindow* pParent |
86 | ,wxWindowID vId | |
87 | ,const wxPoint& rPos | |
88 | ,const wxSize& rSize | |
89 | ,const wxArrayString& asChoices | |
90 | ,long lStyle = 0 | |
91 | ,const wxValidator& rValidator = wxDefaultValidator | |
92 | ,const wxString& rsName = wxChoiceNameStr | |
93 | ); | |
94 | ||
fb49f3b3 | 95 | // |
dcd307ee | 96 | // Implement base class virtuals |
fb49f3b3 | 97 | // |
aa61d352 | 98 | virtual void Delete(unsigned int n); |
fb49f3b3 | 99 | virtual void Clear(void); |
37f214d5 | 100 | |
aa61d352 VZ |
101 | virtual unsigned int GetCount() const; |
102 | virtual int GetSelection(void) const; | |
0934d91c | 103 | virtual int GetCurrentSelection(void) const; |
fb49f3b3 | 104 | virtual void SetSelection(int n); |
37f214d5 | 105 | |
aa61d352 VZ |
106 | virtual wxString GetString(unsigned int n) const; |
107 | virtual void SetString(unsigned int n, const wxString& rsStr); | |
0e320a79 | 108 | |
fb49f3b3 | 109 | // |
dcd307ee | 110 | // OS2 only |
fb49f3b3 DW |
111 | // |
112 | virtual bool OS2Command( WXUINT uParam | |
113 | ,WXWORD wId | |
114 | ); | |
115 | MRESULT OS2WindowProc( WXUINT uMsg | |
116 | ,WXWPARAM wParam | |
117 | ,WXLPARAM lParam | |
118 | ); | |
0e320a79 DW |
119 | |
120 | protected: | |
0934d91c SN |
121 | // common part of all ctors |
122 | void Init() { m_lastAcceptedSelection = wxID_NONE; } | |
123 | ||
124 | virtual int DoAppend(const wxString& rsItem); | |
125 | virtual int DoInsert(const wxString& rsItem, unsigned int pos); | |
126 | virtual void DoSetItemClientData(unsigned int n, void* pClientData); | |
aa61d352 VZ |
127 | virtual void* DoGetItemClientData(unsigned int n) const; |
128 | virtual void DoSetItemClientObject(unsigned int n, wxClientData* pClientData); | |
129 | virtual wxClientData* DoGetItemClientObject(unsigned int n) const; | |
fb49f3b3 DW |
130 | virtual wxSize DoGetBestSize(void) const; |
131 | virtual void DoSetSize( int nX | |
132 | ,int nY | |
133 | ,int nWidth | |
134 | ,int nHeight | |
135 | ,int nsizeFlags = wxSIZE_AUTO | |
136 | ); | |
137 | void Free(void); | |
0934d91c SN |
138 | |
139 | // last "completed" selection, i.e. not the transient one while the user is | |
140 | // browsing the popup list: this is only used when != wxID_NONE which is | |
141 | // the case while the drop down is opened | |
142 | int m_lastAcceptedSelection; | |
fb49f3b3 | 143 | }; // end of CLASS wxChoice |
0e320a79 | 144 | |
37f214d5 | 145 | #endif // _WX_CHOICE_H_ |