]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/radiobox.h
Replace wxST_MARKUP style with wxControl::SetLabelMarkup().
[wxWidgets.git] / include / wx / msw / radiobox.h
CommitLineData
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
b5dbe15d 17class WXDLLIMPEXP_FWD_CORE wxSubwindows;
2bda0e17 18
1e6feb95
VZ
19// ----------------------------------------------------------------------------
20// wxRadioBox
21// ----------------------------------------------------------------------------
bfc6fde4 22
53a2db12 23class WXDLLIMPEXP_CORE wxRadioBox : public wxStaticBox, public wxRadioBoxBase
1e6feb95 24{
2bda0e17 25public:
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,
3998c74b 35 long style = wxRA_SPECIFY_COLS,
1e6feb95 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,
3998c74b 52 long style = wxRA_SPECIFY_COLS,
584ad2a3
MB
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,
3998c74b 71 long style = wxRA_SPECIFY_COLS,
1e6feb95
VZ
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,
3998c74b 81 long style = wxRA_SPECIFY_COLS,
584ad2a3
MB
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;
1c3693e8 95 virtual int GetItemFromPoint(const wxPoint& pt) const;
bfc6fde4 96
bd0a76e2 97 // override some base class methods
4d08943e 98 virtual bool Show(bool show = true);
4d08943e 99 virtual bool Enable(bool enable = true);
bd0a76e2
VZ
100 virtual void SetFocus();
101 virtual bool SetFont(const wxFont& font);
102 virtual bool ContainsHWND(WXHWND hWnd) const;
c670c855
VZ
103#if wxUSE_TOOLTIPS
104 virtual bool HasToolTips() const;
105#endif // wxUSE_TOOLTIPS
1c3693e8
PC
106#if wxUSE_HELP
107 // override virtual function with a platform-independent implementation
108 virtual wxString GetHelpTextAtPoint(const wxPoint & pt, wxHelpEvent::Origin origin) const
109 {
110 return wxRadioBoxBase::DoGetHelpTextAtPoint( this, pt, origin );
111 }
112#endif // wxUSE_HELP
bd0a76e2 113
34526434
VZ
114 virtual bool Reparent(wxWindowBase *newParent);
115
b0282524
VZ
116 // we inherit a version always returning false from wxStaticBox, override
117 // it to behave normally
118 virtual bool AcceptsFocus() const { return wxControl::AcceptsFocus(); }
47e388ca 119
a047aff2
JS
120 // returns true if the platform should explicitly apply a theme border
121 virtual bool CanApplyThemeBorder() const { return false; }
122
6fb99eb3 123 void SetLabelFont(const wxFont& WXUNUSED(font)) {}
bfc6fde4
VZ
124 void SetButtonFont(const wxFont& font) { SetFont(font); }
125
7ee21e3a 126
c49245f8
VZ
127 // implementation only from now on
128 // -------------------------------
129
7ee21e3a
VZ
130 // This function can be used to check if the given radio button HWND
131 // belongs to one of our radio boxes. If it doesn't, NULL is returned.
132 static wxRadioBox *GetFromRadioButtonHWND(WXHWND hwnd);
133
1e6feb95 134 virtual bool MSWCommand(WXUINT param, WXWORD id);
bd0a76e2 135 void Command(wxCommandEvent& event);
1e6feb95 136
9a5ccab4 137 void SendNotificationEvent();
bfc6fde4 138
2bda0e17 139protected:
bd0a76e2
VZ
140 // common part of all ctors
141 void Init();
142
3ca6a5f0 143 // subclass one radio button
e373f51b
VZ
144 void SubclassRadioButton(WXHWND hWndBtn);
145
3ca6a5f0
BP
146 // get the max size of radio buttons
147 wxSize GetMaxButtonSize() const;
148
149 // get the total size occupied by the radio box buttons
150 wxSize GetTotalButtonSize(const wxSize& sizeBtn) const;
151
bfc6fde4
VZ
152 virtual void DoSetSize(int x, int y,
153 int width, int height,
154 int sizeFlags = wxSIZE_AUTO);
fa3987ef 155 virtual void DoMoveWindow(int x, int y, int width, int height);
3ca6a5f0 156 virtual wxSize DoGetBestSize() const;
1e6feb95 157
c670c855
VZ
158#if wxUSE_TOOLTIPS
159 virtual void DoSetItemToolTip(unsigned int n, wxToolTip * tooltip);
160#endif
161
c3732409 162#ifndef __WXWINCE__
3b6e5fb3 163 virtual WXHRGN MSWGetRegionWithoutChildren();
c3732409 164#endif // __WXWINCE__
3b6e5fb3 165
bd0a76e2
VZ
166
167 // the buttons we contain
168 wxSubwindows *m_radioButtons;
52ca4ec4
VZ
169
170 // and the special dummy button used only as a tab group boundary
117f566f
VZ
171 WXHWND m_dummyHwnd;
172 wxWindowIDRef m_dummyId;
bd0a76e2
VZ
173
174 // array of widths and heights of the buttons, may be wxDefaultCoord if the
175 // corresponding quantity should be computed
176 int *m_radioWidth;
177 int *m_radioHeight;
178
bd0a76e2
VZ
179 // currently selected button or wxNOT_FOUND if none
180 int m_selectedButton;
181
1e6feb95
VZ
182private:
183 DECLARE_DYNAMIC_CLASS(wxRadioBox)
c0c133e1 184 wxDECLARE_NO_COPY_CLASS(wxRadioBox);
2bda0e17
KB
185};
186
187#endif
bbcdf8bc 188 // _WX_RADIOBOX_H_