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