]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/radiobox.h
corrected logic in wxQTMediaEvtHandler::OnEraseBackground(): only erase it if there...
[wxWidgets.git] / include / wx / msw / radiobox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/radiobox.h
3 // Purpose: wxRadioBox class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_RADIOBOX_H_
13 #define _WX_RADIOBOX_H_
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "radiobox.h"
17 #endif
18
19 #include "wx/statbox.h"
20
21 class WXDLLEXPORT wxSubwindows;
22
23 // ----------------------------------------------------------------------------
24 // wxRadioBox
25 // ----------------------------------------------------------------------------
26
27 class WXDLLEXPORT wxRadioBox : public wxStaticBox, public wxRadioBoxBase
28 {
29 public:
30 wxRadioBox() { Init(); }
31
32 wxRadioBox(wxWindow *parent,
33 wxWindowID id,
34 const wxString& title,
35 const wxPoint& pos = wxDefaultPosition,
36 const wxSize& size = wxDefaultSize,
37 int n = 0, const wxString choices[] = NULL,
38 int majorDim = 0,
39 long style = wxRA_HORIZONTAL,
40 const wxValidator& val = wxDefaultValidator,
41 const wxString& name = wxRadioBoxNameStr)
42 {
43 Init();
44
45 (void)Create(parent, id, title, pos, size, n, choices, majorDim,
46 style, val, name);
47 }
48
49 wxRadioBox(wxWindow *parent,
50 wxWindowID id,
51 const wxString& title,
52 const wxPoint& pos,
53 const wxSize& size,
54 const wxArrayString& choices,
55 int majorDim = 0,
56 long style = wxRA_HORIZONTAL,
57 const wxValidator& val = wxDefaultValidator,
58 const wxString& name = wxRadioBoxNameStr)
59 {
60 Init();
61
62 (void)Create(parent, id, title, pos, size, choices, majorDim,
63 style, val, name);
64 }
65
66 ~wxRadioBox();
67
68 bool Create(wxWindow *parent,
69 wxWindowID id,
70 const wxString& title,
71 const wxPoint& pos = wxDefaultPosition,
72 const wxSize& size = wxDefaultSize,
73 int n = 0, const wxString choices[] = NULL,
74 int majorDim = 0,
75 long style = wxRA_HORIZONTAL,
76 const wxValidator& val = wxDefaultValidator,
77 const wxString& name = wxRadioBoxNameStr);
78 bool Create(wxWindow *parent,
79 wxWindowID id,
80 const wxString& title,
81 const wxPoint& pos,
82 const wxSize& size,
83 const wxArrayString& choices,
84 int majorDim = 0,
85 long style = wxRA_HORIZONTAL,
86 const wxValidator& val = wxDefaultValidator,
87 const wxString& name = wxRadioBoxNameStr);
88
89 // implement the radiobox interface
90 virtual void SetSelection(int n);
91 virtual int GetSelection() const { return m_selectedButton; }
92 virtual int GetCount() const;
93 virtual wxString GetString(int n) const;
94 virtual void SetString(int n, const wxString& label);
95 virtual bool Enable(int n, bool enable = true);
96 virtual bool Show(int n, bool show = true);
97 virtual int GetColumnCount() const { return GetNumHor(); }
98 virtual int GetRowCount() const { return GetNumVer(); }
99
100 // override some base class methods
101 virtual bool Show(bool show = true);
102 virtual bool Enable(bool enable = true);
103 virtual void SetFocus();
104 virtual bool SetFont(const wxFont& font);
105 virtual bool ContainsHWND(WXHWND hWnd) const;
106
107 // we inherit a version returning false from wxStaticBox, override it again
108 virtual bool AcceptsFocus() const { return true; }
109
110 void SetLabelFont(const wxFont& WXUNUSED(font)) {}
111 void SetButtonFont(const wxFont& font) { SetFont(font); }
112
113
114 // implementation only from now on
115 // -------------------------------
116
117 virtual bool MSWCommand(WXUINT param, WXWORD id);
118 void Command(wxCommandEvent& event);
119
120 void SendNotificationEvent();
121
122 // get the number of buttons per column/row
123 int GetNumVer() const;
124 int GetNumHor() const;
125
126 protected:
127 // common part of all ctors
128 void Init();
129
130 // we can't compute our best size before the items are added to the control
131 virtual void SetInitialBestSize(const wxSize& WXUNUSED(size)) { }
132
133 // subclass one radio button
134 void SubclassRadioButton(WXHWND hWndBtn);
135
136 // get the max size of radio buttons
137 wxSize GetMaxButtonSize() const;
138
139 // get the total size occupied by the radio box buttons
140 wxSize GetTotalButtonSize(const wxSize& sizeBtn) const;
141
142 virtual void DoSetSize(int x, int y,
143 int width, int height,
144 int sizeFlags = wxSIZE_AUTO);
145 virtual wxSize DoGetBestSize() const;
146
147 #ifndef __WXWINCE__
148 virtual WXHRGN MSWGetRegionWithoutChildren();
149 virtual WXLRESULT MSWWindowProc(WXUINT nMsg,
150 WXWPARAM wParam,
151 WXLPARAM lParam);
152 #endif // __WXWINCE__
153
154
155 // the buttons we contain
156 wxSubwindows *m_radioButtons;
157
158 // array of widths and heights of the buttons, may be wxDefaultCoord if the
159 // corresponding quantity should be computed
160 int *m_radioWidth;
161 int *m_radioHeight;
162
163 // the number of elements in major dimension (i.e. number of columns if
164 // wxRA_SPECIFY_COLS or the number of rows if wxRA_SPECIFY_ROWS)
165 int m_majorDim;
166
167 // currently selected button or wxNOT_FOUND if none
168 int m_selectedButton;
169
170 private:
171 DECLARE_DYNAMIC_CLASS(wxRadioBox)
172 DECLARE_NO_COPY_CLASS(wxRadioBox)
173 };
174
175 #endif
176 // _WX_RADIOBOX_H_