]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/radiobox.h
wxMessageBox off the main thread lost result code.
[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
bbcdf8bc 7// Copyright: (c) Julian Smart
65571936 8// Licence: wxWindows licence
2bda0e17
KB
9/////////////////////////////////////////////////////////////////////////////
10
bbcdf8bc
JS
11#ifndef _WX_RADIOBOX_H_
12#define _WX_RADIOBOX_H_
2bda0e17 13
bd0a76e2
VZ
14#include "wx/statbox.h"
15
b5dbe15d 16class WXDLLIMPEXP_FWD_CORE wxSubwindows;
2bda0e17 17
1e6feb95
VZ
18// ----------------------------------------------------------------------------
19// wxRadioBox
20// ----------------------------------------------------------------------------
bfc6fde4 21
53a2db12 22class WXDLLIMPEXP_CORE wxRadioBox : public wxStaticBox, public wxRadioBoxBase
1e6feb95 23{
2bda0e17 24public:
bd0a76e2 25 wxRadioBox() { Init(); }
2bda0e17 26
1e6feb95
VZ
27 wxRadioBox(wxWindow *parent,
28 wxWindowID id,
29 const wxString& title,
30 const wxPoint& pos = wxDefaultPosition,
31 const wxSize& size = wxDefaultSize,
32 int n = 0, const wxString choices[] = NULL,
33 int majorDim = 0,
3998c74b 34 long style = wxRA_SPECIFY_COLS,
1e6feb95 35 const wxValidator& val = wxDefaultValidator,
6463b9f5
JS
36 const wxString& name = wxRadioBoxNameStr)
37 {
bd0a76e2
VZ
38 Init();
39
6463b9f5
JS
40 (void)Create(parent, id, title, pos, size, n, choices, majorDim,
41 style, val, name);
42 }
bd0a76e2 43
584ad2a3
MB
44 wxRadioBox(wxWindow *parent,
45 wxWindowID id,
46 const wxString& title,
47 const wxPoint& pos,
48 const wxSize& size,
49 const wxArrayString& choices,
50 int majorDim = 0,
3998c74b 51 long style = wxRA_SPECIFY_COLS,
584ad2a3
MB
52 const wxValidator& val = wxDefaultValidator,
53 const wxString& name = wxRadioBoxNameStr)
54 {
bd0a76e2
VZ
55 Init();
56
584ad2a3
MB
57 (void)Create(parent, id, title, pos, size, choices, majorDim,
58 style, val, name);
59 }
bfc6fde4 60
b0282524 61 virtual ~wxRadioBox();
bfc6fde4 62
1e6feb95
VZ
63 bool Create(wxWindow *parent,
64 wxWindowID id,
65 const wxString& title,
66 const wxPoint& pos = wxDefaultPosition,
67 const wxSize& size = wxDefaultSize,
68 int n = 0, const wxString choices[] = NULL,
69 int majorDim = 0,
3998c74b 70 long style = wxRA_SPECIFY_COLS,
1e6feb95
VZ
71 const wxValidator& val = wxDefaultValidator,
72 const wxString& name = wxRadioBoxNameStr);
584ad2a3
MB
73 bool Create(wxWindow *parent,
74 wxWindowID id,
75 const wxString& title,
76 const wxPoint& pos,
77 const wxSize& size,
78 const wxArrayString& choices,
79 int majorDim = 0,
3998c74b 80 long style = wxRA_SPECIFY_COLS,
584ad2a3
MB
81 const wxValidator& val = wxDefaultValidator,
82 const wxString& name = wxRadioBoxNameStr);
1e6feb95
VZ
83
84 // implement the radiobox interface
85 virtual void SetSelection(int n);
bd0a76e2 86 virtual int GetSelection() const { return m_selectedButton; }
aa61d352
VZ
87 virtual unsigned int GetCount() const;
88 virtual wxString GetString(unsigned int n) const;
89 virtual void SetString(unsigned int n, const wxString& label);
90 virtual bool Enable(unsigned int n, bool enable = true);
91 virtual bool Show(unsigned int n, bool show = true);
92 virtual bool IsItemEnabled(unsigned int n) const;
93 virtual bool IsItemShown(unsigned int n) const;
1c3693e8 94 virtual int GetItemFromPoint(const wxPoint& pt) 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);
bd6ca54f 99 virtual bool CanBeFocused() const;
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
a047aff2
JS
116 // returns true if the platform should explicitly apply a theme border
117 virtual bool CanApplyThemeBorder() const { return false; }
118
6fb99eb3 119 void SetLabelFont(const wxFont& WXUNUSED(font)) {}
bfc6fde4
VZ
120 void SetButtonFont(const wxFont& font) { SetFont(font); }
121
7ee21e3a 122
c49245f8
VZ
123 // implementation only from now on
124 // -------------------------------
125
7ee21e3a
VZ
126 // This function can be used to check if the given radio button HWND
127 // belongs to one of our radio boxes. If it doesn't, NULL is returned.
128 static wxRadioBox *GetFromRadioButtonHWND(WXHWND hwnd);
129
1e6feb95 130 virtual bool MSWCommand(WXUINT param, WXWORD id);
bd0a76e2 131 void Command(wxCommandEvent& event);
1e6feb95 132
9a5ccab4 133 void SendNotificationEvent();
bfc6fde4 134
2bda0e17 135protected:
bd0a76e2
VZ
136 // common part of all ctors
137 void Init();
138
3ca6a5f0 139 // subclass one radio button
e373f51b
VZ
140 void SubclassRadioButton(WXHWND hWndBtn);
141
3ca6a5f0
BP
142 // get the max size of radio buttons
143 wxSize GetMaxButtonSize() const;
144
145 // get the total size occupied by the radio box buttons
146 wxSize GetTotalButtonSize(const wxSize& sizeBtn) const;
147
d9c4ffa8
VZ
148 // Adjust all the buttons to the new window size.
149 void PositionAllButtons(int x, int y, int width, int height);
150
bfc6fde4
VZ
151 virtual void DoSetSize(int x, int y,
152 int width, int height,
153 int sizeFlags = wxSIZE_AUTO);
fa3987ef 154 virtual void DoMoveWindow(int x, int y, int width, int height);
3ca6a5f0 155 virtual wxSize DoGetBestSize() const;
1e6feb95 156
c670c855
VZ
157#if wxUSE_TOOLTIPS
158 virtual void DoSetItemToolTip(unsigned int n, wxToolTip * tooltip);
159#endif
160
c3732409 161#ifndef __WXWINCE__
3b6e5fb3 162 virtual WXHRGN MSWGetRegionWithoutChildren();
c3732409 163#endif // __WXWINCE__
3b6e5fb3 164
c78f0857
RD
165 // resolve ambiguity in base classes
166 virtual wxBorder GetDefaultBorder() const { return wxRadioBoxBase::GetDefaultBorder(); }
bd0a76e2
VZ
167
168 // the buttons we contain
169 wxSubwindows *m_radioButtons;
52ca4ec4
VZ
170
171 // and the special dummy button used only as a tab group boundary
117f566f
VZ
172 WXHWND m_dummyHwnd;
173 wxWindowIDRef m_dummyId;
bd0a76e2
VZ
174
175 // array of widths and heights of the buttons, may be wxDefaultCoord if the
176 // corresponding quantity should be computed
177 int *m_radioWidth;
178 int *m_radioHeight;
179
bd0a76e2
VZ
180 // currently selected button or wxNOT_FOUND if none
181 int m_selectedButton;
182
1e6feb95
VZ
183private:
184 DECLARE_DYNAMIC_CLASS(wxRadioBox)
c0c133e1 185 wxDECLARE_NO_COPY_CLASS(wxRadioBox);
2bda0e17
KB
186};
187
188#endif
bbcdf8bc 189 // _WX_RADIOBOX_H_