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