]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/os2/choice.h | |
3 | // Purpose: wxChoice class | |
4 | // Author: David Webster | |
5 | // Modified by: | |
6 | // Created: 10/13/99 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) David Webster | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_CHOICE_H_ | |
13 | #define _WX_CHOICE_H_ | |
14 | ||
15 | // ---------------------------------------------------------------------------- | |
16 | // Choice item | |
17 | // ---------------------------------------------------------------------------- | |
18 | ||
19 | class WXDLLEXPORT wxChoice: public wxChoiceBase | |
20 | { | |
21 | DECLARE_DYNAMIC_CLASS(wxChoice) | |
22 | ||
23 | public: | |
24 | // ctors | |
25 | inline wxChoice() { Init(); } | |
26 | virtual ~wxChoice(); | |
27 | ||
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 | |
35 | ,const wxValidator& rValidator = wxDefaultValidator | |
36 | ,const wxString& rsName = wxChoiceNameStr | |
37 | ) | |
38 | { | |
39 | Init(); | |
40 | Create( pParent | |
41 | ,vId | |
42 | ,rPos | |
43 | ,rSize | |
44 | ,n | |
45 | ,asChoices | |
46 | ,lStyle | |
47 | ,rValidator | |
48 | ,rsName | |
49 | ); | |
50 | } | |
51 | ||
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 | { | |
62 | Init(); | |
63 | Create( pParent | |
64 | ,vId | |
65 | ,rPos | |
66 | ,rSize | |
67 | ,asChoices | |
68 | ,lStyle | |
69 | ,rValidator | |
70 | ,rsName | |
71 | ); | |
72 | } | |
73 | ||
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 | |
81 | ,const wxValidator& rValidator = wxDefaultValidator | |
82 | ,const wxString& rsName = wxChoiceNameStr | |
83 | ); | |
84 | ||
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 | ||
95 | // | |
96 | // Implement base class virtuals | |
97 | // | |
98 | virtual void Delete(unsigned int n); | |
99 | virtual void Clear(void); | |
100 | ||
101 | virtual unsigned int GetCount() const; | |
102 | virtual int GetSelection(void) const; | |
103 | virtual int GetCurrentSelection(void) const; | |
104 | virtual void SetSelection(int n); | |
105 | ||
106 | virtual wxString GetString(unsigned int n) const; | |
107 | virtual void SetString(unsigned int n, const wxString& rsStr); | |
108 | ||
109 | // | |
110 | // OS2 only | |
111 | // | |
112 | virtual bool OS2Command( WXUINT uParam | |
113 | ,WXWORD wId | |
114 | ); | |
115 | MRESULT OS2WindowProc( WXUINT uMsg | |
116 | ,WXWPARAM wParam | |
117 | ,WXLPARAM lParam | |
118 | ); | |
119 | ||
120 | protected: | |
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); | |
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; | |
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); | |
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; | |
143 | }; // end of CLASS wxChoice | |
144 | ||
145 | #endif // _WX_CHOICE_H_ |