]>
Commit | Line | Data |
---|---|---|
2bda0e17 | 1 | ///////////////////////////////////////////////////////////////////////////// |
1e6feb95 | 2 | // Name: wx/msw/radiobox.h |
2bda0e17 KB |
3 | // Purpose: wxRadioBox class |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
bbcdf8bc | 8 | // Copyright: (c) Julian Smart |
65571936 | 9 | // Licence: wxWindows licence |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_RADIOBOX_H_ |
13 | #define _WX_RADIOBOX_H_ | |
2bda0e17 | 14 | |
bd0a76e2 VZ |
15 | #include "wx/statbox.h" |
16 | ||
17 | class WXDLLEXPORT wxSubwindows; | |
2bda0e17 | 18 | |
1e6feb95 VZ |
19 | // ---------------------------------------------------------------------------- |
20 | // wxRadioBox | |
21 | // ---------------------------------------------------------------------------- | |
bfc6fde4 | 22 | |
bd0a76e2 | 23 | class WXDLLEXPORT wxRadioBox : public wxStaticBox, public wxRadioBoxBase |
1e6feb95 | 24 | { |
2bda0e17 | 25 | public: |
bd0a76e2 | 26 | wxRadioBox() { Init(); } |
2bda0e17 | 27 | |
1e6feb95 VZ |
28 | wxRadioBox(wxWindow *parent, |
29 | wxWindowID id, | |
30 | const wxString& title, | |
31 | const wxPoint& pos = wxDefaultPosition, | |
32 | const wxSize& size = wxDefaultSize, | |
33 | int n = 0, const wxString choices[] = NULL, | |
34 | int majorDim = 0, | |
35 | long style = wxRA_HORIZONTAL, | |
36 | const wxValidator& val = wxDefaultValidator, | |
6463b9f5 JS |
37 | const wxString& name = wxRadioBoxNameStr) |
38 | { | |
bd0a76e2 VZ |
39 | Init(); |
40 | ||
6463b9f5 JS |
41 | (void)Create(parent, id, title, pos, size, n, choices, majorDim, |
42 | style, val, name); | |
43 | } | |
bd0a76e2 | 44 | |
584ad2a3 MB |
45 | wxRadioBox(wxWindow *parent, |
46 | wxWindowID id, | |
47 | const wxString& title, | |
48 | const wxPoint& pos, | |
49 | const wxSize& size, | |
50 | const wxArrayString& choices, | |
51 | int majorDim = 0, | |
52 | long style = wxRA_HORIZONTAL, | |
53 | const wxValidator& val = wxDefaultValidator, | |
54 | const wxString& name = wxRadioBoxNameStr) | |
55 | { | |
bd0a76e2 VZ |
56 | Init(); |
57 | ||
584ad2a3 MB |
58 | (void)Create(parent, id, title, pos, size, choices, majorDim, |
59 | style, val, name); | |
60 | } | |
bfc6fde4 | 61 | |
b0282524 | 62 | virtual ~wxRadioBox(); |
bfc6fde4 | 63 | |
1e6feb95 VZ |
64 | bool Create(wxWindow *parent, |
65 | wxWindowID id, | |
66 | const wxString& title, | |
67 | const wxPoint& pos = wxDefaultPosition, | |
68 | const wxSize& size = wxDefaultSize, | |
69 | int n = 0, const wxString choices[] = NULL, | |
70 | int majorDim = 0, | |
71 | long style = wxRA_HORIZONTAL, | |
72 | const wxValidator& val = wxDefaultValidator, | |
73 | const wxString& name = wxRadioBoxNameStr); | |
584ad2a3 MB |
74 | bool Create(wxWindow *parent, |
75 | wxWindowID id, | |
76 | const wxString& title, | |
77 | const wxPoint& pos, | |
78 | const wxSize& size, | |
79 | const wxArrayString& choices, | |
80 | int majorDim = 0, | |
81 | long style = wxRA_HORIZONTAL, | |
82 | const wxValidator& val = wxDefaultValidator, | |
83 | const wxString& name = wxRadioBoxNameStr); | |
1e6feb95 VZ |
84 | |
85 | // implement the radiobox interface | |
86 | virtual void SetSelection(int n); | |
bd0a76e2 | 87 | virtual int GetSelection() const { return m_selectedButton; } |
aa61d352 VZ |
88 | virtual unsigned int GetCount() const; |
89 | virtual wxString GetString(unsigned int n) const; | |
90 | virtual void SetString(unsigned int n, const wxString& label); | |
91 | virtual bool Enable(unsigned int n, bool enable = true); | |
92 | virtual bool Show(unsigned int n, bool show = true); | |
93 | virtual bool IsItemEnabled(unsigned int n) const; | |
94 | virtual bool IsItemShown(unsigned int n) const; | |
bfc6fde4 | 95 | |
bd0a76e2 | 96 | // override some base class methods |
4d08943e | 97 | virtual bool Show(bool show = true); |
4d08943e | 98 | virtual bool Enable(bool enable = true); |
bd0a76e2 VZ |
99 | virtual void SetFocus(); |
100 | virtual bool SetFont(const wxFont& font); | |
101 | virtual bool ContainsHWND(WXHWND hWnd) const; | |
c670c855 VZ |
102 | #if wxUSE_TOOLTIPS |
103 | virtual bool HasToolTips() const; | |
104 | #endif // wxUSE_TOOLTIPS | |
bd0a76e2 | 105 | |
b0282524 VZ |
106 | // we inherit a version always returning false from wxStaticBox, override |
107 | // it to behave normally | |
108 | virtual bool AcceptsFocus() const { return wxControl::AcceptsFocus(); } | |
47e388ca | 109 | |
6fb99eb3 | 110 | void SetLabelFont(const wxFont& WXUNUSED(font)) {} |
bfc6fde4 VZ |
111 | void SetButtonFont(const wxFont& font) { SetFont(font); } |
112 | ||
bfc6fde4 | 113 | |
c49245f8 VZ |
114 | // implementation only from now on |
115 | // ------------------------------- | |
116 | ||
1e6feb95 | 117 | virtual bool MSWCommand(WXUINT param, WXWORD id); |
bd0a76e2 | 118 | void Command(wxCommandEvent& event); |
1e6feb95 | 119 | |
9a5ccab4 | 120 | void SendNotificationEvent(); |
bfc6fde4 | 121 | |
2bda0e17 | 122 | protected: |
bd0a76e2 VZ |
123 | // common part of all ctors |
124 | void Init(); | |
125 | ||
7a5a5718 RD |
126 | // we can't compute our best size before the items are added to the control |
127 | virtual void SetInitialBestSize(const wxSize& WXUNUSED(size)) { } | |
128 | ||
3ca6a5f0 | 129 | // subclass one radio button |
e373f51b VZ |
130 | void SubclassRadioButton(WXHWND hWndBtn); |
131 | ||
3ca6a5f0 BP |
132 | // get the max size of radio buttons |
133 | wxSize GetMaxButtonSize() const; | |
134 | ||
135 | // get the total size occupied by the radio box buttons | |
136 | wxSize GetTotalButtonSize(const wxSize& sizeBtn) const; | |
137 | ||
bfc6fde4 VZ |
138 | virtual void DoSetSize(int x, int y, |
139 | int width, int height, | |
140 | int sizeFlags = wxSIZE_AUTO); | |
3ca6a5f0 | 141 | virtual wxSize DoGetBestSize() const; |
1e6feb95 | 142 | |
c670c855 VZ |
143 | #if wxUSE_TOOLTIPS |
144 | virtual void DoSetItemToolTip(unsigned int n, wxToolTip * tooltip); | |
145 | #endif | |
146 | ||
dc26eeb3 VZ |
147 | virtual int GetItemFromPoint(const wxPoint& pt) const; |
148 | ||
149 | #if wxUSE_HELP | |
150 | // override virtual function with a platform-independent implementation | |
151 | virtual wxString GetHelpTextAtPoint(const wxPoint & pt, wxHelpEvent::Origin origin) const | |
152 | { | |
153 | return wxRadioBoxBase::DoGetHelpTextAtPoint( this, pt, origin ); | |
154 | } | |
155 | #endif // wxUSE_HELP | |
156 | ||
c3732409 | 157 | #ifndef __WXWINCE__ |
3b6e5fb3 | 158 | virtual WXHRGN MSWGetRegionWithoutChildren(); |
c3732409 | 159 | #endif // __WXWINCE__ |
3b6e5fb3 | 160 | |
bd0a76e2 VZ |
161 | |
162 | // the buttons we contain | |
163 | wxSubwindows *m_radioButtons; | |
164 | ||
165 | // array of widths and heights of the buttons, may be wxDefaultCoord if the | |
166 | // corresponding quantity should be computed | |
167 | int *m_radioWidth; | |
168 | int *m_radioHeight; | |
169 | ||
bd0a76e2 VZ |
170 | // currently selected button or wxNOT_FOUND if none |
171 | int m_selectedButton; | |
172 | ||
1e6feb95 VZ |
173 | private: |
174 | DECLARE_DYNAMIC_CLASS(wxRadioBox) | |
22f3361e | 175 | DECLARE_NO_COPY_CLASS(wxRadioBox) |
2bda0e17 KB |
176 | }; |
177 | ||
178 | #endif | |
bbcdf8bc | 179 | // _WX_RADIOBOX_H_ |