]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/radiobox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/radiobox.h
3 // Purpose: wxRadioBox class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_RADIOBOX_H_
13 #define _WX_RADIOBOX_H_
15 #include "wx/statbox.h"
17 class WXDLLEXPORT wxSubwindows
;
19 // ----------------------------------------------------------------------------
21 // ----------------------------------------------------------------------------
23 class WXDLLEXPORT wxRadioBox
: public wxStaticBox
, public wxRadioBoxBase
26 wxRadioBox() { Init(); }
28 wxRadioBox(wxWindow
*parent
,
30 const wxString
& title
,
31 const wxPoint
& pos
= wxDefaultPosition
,
32 const wxSize
& size
= wxDefaultSize
,
33 int n
= 0, const wxString choices
[] = NULL
,
35 long style
= wxRA_HORIZONTAL
,
36 const wxValidator
& val
= wxDefaultValidator
,
37 const wxString
& name
= wxRadioBoxNameStr
)
41 (void)Create(parent
, id
, title
, pos
, size
, n
, choices
, majorDim
,
45 wxRadioBox(wxWindow
*parent
,
47 const wxString
& title
,
50 const wxArrayString
& choices
,
52 long style
= wxRA_HORIZONTAL
,
53 const wxValidator
& val
= wxDefaultValidator
,
54 const wxString
& name
= wxRadioBoxNameStr
)
58 (void)Create(parent
, id
, title
, pos
, size
, choices
, majorDim
,
64 bool Create(wxWindow
*parent
,
66 const wxString
& title
,
67 const wxPoint
& pos
= wxDefaultPosition
,
68 const wxSize
& size
= wxDefaultSize
,
69 int n
= 0, const wxString choices
[] = NULL
,
71 long style
= wxRA_HORIZONTAL
,
72 const wxValidator
& val
= wxDefaultValidator
,
73 const wxString
& name
= wxRadioBoxNameStr
);
74 bool Create(wxWindow
*parent
,
76 const wxString
& title
,
79 const wxArrayString
& choices
,
81 long style
= wxRA_HORIZONTAL
,
82 const wxValidator
& val
= wxDefaultValidator
,
83 const wxString
& name
= wxRadioBoxNameStr
);
85 // implement the radiobox interface
86 virtual void SetSelection(int n
);
87 virtual int GetSelection() const { return m_selectedButton
; }
88 virtual int GetCount() const;
89 virtual wxString
GetString(int n
) const;
90 virtual void SetString(int n
, const wxString
& label
);
91 virtual bool Enable(int n
, bool enable
= true);
92 virtual bool Show(int n
, bool show
= true);
93 virtual int GetColumnCount() const { return GetNumHor(); }
94 virtual int GetRowCount() const { return GetNumVer(); }
96 // override some base class methods
97 virtual bool Show(bool show
= true);
98 virtual bool Enable(bool enable
= true);
99 virtual void SetFocus();
100 virtual bool SetFont(const wxFont
& font
);
101 virtual bool ContainsHWND(WXHWND hWnd
) const;
103 // we inherit a version returning false from wxStaticBox, override it again
104 virtual bool AcceptsFocus() const { return true; }
106 void SetLabelFont(const wxFont
& WXUNUSED(font
)) {}
107 void SetButtonFont(const wxFont
& font
) { SetFont(font
); }
110 // implementation only from now on
111 // -------------------------------
113 virtual bool MSWCommand(WXUINT param
, WXWORD id
);
114 void Command(wxCommandEvent
& event
);
116 void SendNotificationEvent();
118 // get the number of buttons per column/row
119 int GetNumVer() const;
120 int GetNumHor() const;
123 // common part of all ctors
126 // we can't compute our best size before the items are added to the control
127 virtual void SetInitialBestSize(const wxSize
& WXUNUSED(size
)) { }
129 // subclass one radio button
130 void SubclassRadioButton(WXHWND hWndBtn
);
132 // get the max size of radio buttons
133 wxSize
GetMaxButtonSize() const;
135 // get the total size occupied by the radio box buttons
136 wxSize
GetTotalButtonSize(const wxSize
& sizeBtn
) const;
138 virtual void DoSetSize(int x
, int y
,
139 int width
, int height
,
140 int sizeFlags
= wxSIZE_AUTO
);
141 virtual wxSize
DoGetBestSize() const;
144 virtual WXHRGN
MSWGetRegionWithoutChildren();
145 virtual WXLRESULT
MSWWindowProc(WXUINT nMsg
,
148 #endif // __WXWINCE__
151 // the buttons we contain
152 wxSubwindows
*m_radioButtons
;
154 // array of widths and heights of the buttons, may be wxDefaultCoord if the
155 // corresponding quantity should be computed
159 // the number of elements in major dimension (i.e. number of columns if
160 // wxRA_SPECIFY_COLS or the number of rows if wxRA_SPECIFY_ROWS)
163 // currently selected button or wxNOT_FOUND if none
164 int m_selectedButton
;
167 DECLARE_DYNAMIC_CLASS(wxRadioBox
)
168 DECLARE_NO_COPY_CLASS(wxRadioBox
)