]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: radiobox.h | |
3 | // Purpose: wxRadioBox class | |
4 | // Author: David Webster | |
5 | // Modified by: | |
6 | // Created: 10/12/99 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) David Webster | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_RADIOBOX_H_ | |
13 | #define _WX_RADIOBOX_H_ | |
14 | ||
15 | // List box item | |
16 | class WXDLLEXPORT wxBitmap ; | |
17 | ||
18 | class WXDLLEXPORT wxRadioBox: public wxControl, public wxRadioBoxBase | |
19 | { | |
20 | public: | |
21 | wxRadioBox(); | |
22 | ||
23 | inline wxRadioBox( wxWindow* pParent | |
24 | ,wxWindowID vId | |
25 | ,const wxString& rsTitle | |
26 | ,const wxPoint& rPos = wxDefaultPosition | |
27 | ,const wxSize& rSize = wxDefaultSize | |
28 | ,int nNum = 0 | |
29 | ,const wxString asChoices[] = NULL | |
30 | ,int nMajorDim = 0 | |
31 | ,long lStyle = wxRA_HORIZONTAL | |
32 | ,const wxValidator& rVal = wxDefaultValidator | |
33 | ,const wxString& rsName = wxRadioBoxNameStr | |
34 | ) | |
35 | { | |
36 | Create( pParent | |
37 | ,vId | |
38 | ,rsTitle | |
39 | ,rPos | |
40 | ,rSize | |
41 | ,nNum | |
42 | ,asChoices | |
43 | ,nMajorDim | |
44 | ,lStyle | |
45 | ,rVal | |
46 | ,rsName | |
47 | ); | |
48 | } | |
49 | ||
50 | inline wxRadioBox( wxWindow* pParent | |
51 | ,wxWindowID vId | |
52 | ,const wxString& rsTitle | |
53 | ,const wxPoint& rPos | |
54 | ,const wxSize& rSize | |
55 | ,const wxArrayString& asChoices | |
56 | ,int nMajorDim = 0 | |
57 | ,long lStyle = wxRA_HORIZONTAL | |
58 | ,const wxValidator& rVal = wxDefaultValidator | |
59 | ,const wxString& rsName = wxRadioBoxNameStr | |
60 | ) | |
61 | { | |
62 | Create( pParent | |
63 | ,vId | |
64 | ,rsTitle | |
65 | ,rPos | |
66 | ,rSize | |
67 | ,asChoices | |
68 | ,nMajorDim | |
69 | ,lStyle | |
70 | ,rVal | |
71 | ,rsName | |
72 | ); | |
73 | } | |
74 | ||
75 | ~wxRadioBox(); | |
76 | ||
77 | bool Create( wxWindow* pParent | |
78 | ,wxWindowID vId | |
79 | ,const wxString& rsTitle | |
80 | ,const wxPoint& rPos = wxDefaultPosition | |
81 | ,const wxSize& rSize = wxDefaultSize | |
82 | ,int nNum = 0 | |
83 | ,const wxString asChoices[] = NULL | |
84 | ,int nMajorDim = 0 | |
85 | ,long lStyle = wxRA_HORIZONTAL | |
86 | ,const wxValidator& rVal = wxDefaultValidator | |
87 | ,const wxString& rsName = wxRadioBoxNameStr | |
88 | ); | |
89 | ||
90 | bool Create( wxWindow* pParent | |
91 | ,wxWindowID vId | |
92 | ,const wxString& rsTitle | |
93 | ,const wxPoint& rPos | |
94 | ,const wxSize& rSize | |
95 | ,const wxArrayString& asChoices | |
96 | ,int nMajorDim = 0 | |
97 | ,long lStyle = wxRA_HORIZONTAL | |
98 | ,const wxValidator& rVal = wxDefaultValidator | |
99 | ,const wxString& rsName = wxRadioBoxNameStr | |
100 | ); | |
101 | ||
102 | void Command(wxCommandEvent& rEvent); | |
103 | bool ContainsHWND(WXHWND hWnd) const; | |
104 | virtual bool Enable(bool bEnable = TRUE); | |
105 | void Enable( int nItem | |
106 | ,bool bEnable | |
107 | ); | |
108 | int FindString(const wxString& sStr) const; | |
109 | ||
110 | virtual WXHBRUSH OnCtlColor( WXHDC hDC | |
111 | ,WXHWND hWnd | |
112 | ,WXUINT uCtlColor | |
113 | ,WXUINT uMessage | |
114 | ,WXWPARAM wParam | |
115 | ,WXLPARAM lParam | |
116 | ); | |
117 | virtual bool OS2Command( WXUINT uParam | |
118 | ,WXWORD wId | |
119 | ); | |
120 | void SendNotificationEvent(void); | |
121 | virtual void Show( int nItem | |
122 | ,bool bShow = TRUE | |
123 | ) ; | |
124 | bool Show(bool bShow); | |
125 | MRESULT WindowProc( WXUINT uMsg | |
126 | ,WXWPARAM wParam | |
127 | ,WXLPARAM lParam | |
128 | ); | |
129 | ||
130 | ||
131 | ||
132 | ||
133 | virtual int GetColumnCount(void) const; | |
134 | virtual int GetCount(void) const; | |
135 | inline int GetNumberOfRowsOrCols(void) const { return m_nNoRowsOrCols; } | |
136 | int GetNumHor(void) const; | |
137 | int GetNumVer(void) const; | |
138 | void GetPosition( int* pnX | |
139 | ,int* pnY | |
140 | ) const; | |
141 | inline WXHWND* GetRadioButtons(void) const { return m_ahRadioButtons; } | |
142 | virtual int GetRowCount(void) const; | |
143 | int GetSelection(void) const; | |
144 | void GetSize( int* pnX | |
145 | ,int* pnY | |
146 | ) const; | |
147 | inline int GetSizeFlags(void) const { return m_nSizeFlags; } | |
148 | void AdjustButtons( int nX | |
149 | ,int nY | |
150 | ,int nWidth | |
151 | ,int nHeight | |
152 | ,int nSizeFlags | |
153 | ); | |
154 | wxString GetString(int nIndex) const; | |
155 | virtual wxString GetStringSelection(void) const; | |
156 | ||
157 | inline void SetButtonFont(const wxFont& rFont) { SetFont(rFont); } | |
158 | void SetFocus(void); | |
159 | virtual bool SetFont(const wxFont& rFont); | |
160 | inline void SetLabelFont(const wxFont& WXUNUSED(font)) {}; | |
161 | inline void SetNumberOfRowsOrCols(int nNum) { m_nNoRowsOrCols = nNum; } | |
162 | void SetSelection(int nIndex); | |
163 | virtual void SetString( int nNum | |
164 | ,const wxString& rsLabel | |
165 | ); | |
166 | virtual bool SetStringSelection(const wxString& rsStr); | |
167 | ||
168 | void SetLabel( int nItem | |
169 | ,const wxString& rsLabel | |
170 | ); | |
171 | void SetLabel( int item | |
172 | ,wxBitmap* pBitmap | |
173 | ); | |
174 | wxString GetLabel(int nItem) const; | |
175 | ||
176 | ||
177 | protected: | |
178 | virtual wxSize DoGetBestSize(void) const; | |
179 | virtual void DoSetSize( int nX | |
180 | ,int nY | |
181 | ,int nWidth | |
182 | ,int nHeight | |
183 | ,int nSizeFlags = wxSIZE_AUTO | |
184 | ); | |
185 | wxSize GetMaxButtonSize(void) const; | |
186 | wxSize GetTotalButtonSize(const wxSize& rSizeBtn) const; | |
187 | void SubclassRadioButton(WXHWND hWndBtn); | |
188 | ||
189 | ||
190 | WXHWND* m_ahRadioButtons; | |
191 | int m_nMajorDim ; | |
192 | int* m_pnRadioWidth; // for bitmaps | |
193 | int* m_pnRadioHeight; | |
194 | int m_nNoItems; | |
195 | int m_nNoRowsOrCols; | |
196 | int m_nSelectedButton; | |
197 | int m_nSizeFlags; | |
198 | ||
199 | private: | |
200 | inline wxString GetLabel() const | |
201 | { return wxWindowBase::GetLabel(); } | |
202 | inline void SetLabel(const wxString& rsLabel) | |
203 | { wxWindowBase::SetLabel(rsLabel); } | |
204 | ||
205 | DECLARE_DYNAMIC_CLASS(wxRadioBox) | |
206 | }; // end of wxRadioBox | |
207 | ||
208 | #endif | |
209 | // _WX_RADIOBOX_H_ |