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