]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/radiobox.h
More broken compilers with enum/wxString& ambiguity.
[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
12028905 15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
c49245f8 16 #pragma interface "radiobox.h"
2bda0e17
KB
17#endif
18
e373f51b 19class WXDLLEXPORT wxBitmap;
2bda0e17 20
1e6feb95
VZ
21// ----------------------------------------------------------------------------
22// wxRadioBox
23// ----------------------------------------------------------------------------
bfc6fde4 24
1e6feb95
VZ
25class WXDLLEXPORT wxRadioBox : public wxControl, public wxRadioBoxBase
26{
2bda0e17 27public:
bfc6fde4 28 wxRadioBox();
2bda0e17 29
1e6feb95
VZ
30 wxRadioBox(wxWindow *parent,
31 wxWindowID id,
32 const wxString& title,
33 const wxPoint& pos = wxDefaultPosition,
34 const wxSize& size = wxDefaultSize,
35 int n = 0, const wxString choices[] = NULL,
36 int majorDim = 0,
37 long style = wxRA_HORIZONTAL,
38 const wxValidator& val = wxDefaultValidator,
6463b9f5
JS
39 const wxString& name = wxRadioBoxNameStr)
40 {
41 (void)Create(parent, id, title, pos, size, n, choices, majorDim,
42 style, val, name);
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,
51 long style = wxRA_HORIZONTAL,
52 const wxValidator& val = wxDefaultValidator,
53 const wxString& name = wxRadioBoxNameStr)
54 {
55 (void)Create(parent, id, title, pos, size, choices, majorDim,
56 style, val, name);
57 }
bfc6fde4 58
bfc6fde4
VZ
59 ~wxRadioBox();
60
1e6feb95
VZ
61 bool Create(wxWindow *parent,
62 wxWindowID id,
63 const wxString& title,
64 const wxPoint& pos = wxDefaultPosition,
65 const wxSize& size = wxDefaultSize,
66 int n = 0, const wxString choices[] = NULL,
67 int majorDim = 0,
68 long style = wxRA_HORIZONTAL,
69 const wxValidator& val = wxDefaultValidator,
70 const wxString& name = wxRadioBoxNameStr);
584ad2a3
MB
71 bool Create(wxWindow *parent,
72 wxWindowID id,
73 const wxString& title,
74 const wxPoint& pos,
75 const wxSize& size,
76 const wxArrayString& choices,
77 int majorDim = 0,
78 long style = wxRA_HORIZONTAL,
79 const wxValidator& val = wxDefaultValidator,
80 const wxString& name = wxRadioBoxNameStr);
1e6feb95
VZ
81
82 // implement the radiobox interface
83 virtual void SetSelection(int n);
84 virtual int GetSelection() const;
85 virtual int GetCount() const;
86 virtual wxString GetString(int n) const;
87 virtual void SetString(int n, const wxString& label);
88 virtual void Enable(int n, bool enable = TRUE);
89 virtual void Show(int n, bool show = TRUE);
90 virtual int GetColumnCount() const;
91 virtual int GetRowCount() const;
bfc6fde4 92
6b0d8a01 93 virtual bool Show(bool show = TRUE);
bfc6fde4 94 void SetFocus();
6b0d8a01 95 virtual bool Enable(bool enable = TRUE);
bfc6fde4
VZ
96 void SetLabelFont(const wxFont& WXUNUSED(font)) {};
97 void SetButtonFont(const wxFont& font) { SetFont(font); }
98
bfc6fde4
VZ
99 void Command(wxCommandEvent& event);
100
101 int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
102 void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
103
c49245f8
VZ
104 // implementation only from now on
105 // -------------------------------
106
1e6feb95
VZ
107 virtual bool MSWCommand(WXUINT param, WXWORD id);
108
109 // FIXME: are they used? missing "Do" prefix?
110 void GetSize(int *x, int *y) const;
111 void GetPosition(int *x, int *y) const;
112
4afd7529
VZ
113 virtual bool SetFont(const wxFont& font);
114
c140b7e7 115 WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
f6bcfd97 116 virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
1e6feb95
VZ
117 WXUINT message,
118 WXWPARAM wParam, WXLPARAM lParam);
bfc6fde4 119 WXHWND *GetRadioButtons() const { return m_radioButtons; }
e373f51b 120 bool ContainsHWND(WXHWND hWnd) const;
9a5ccab4 121 void SendNotificationEvent();
bfc6fde4 122
e373f51b 123 // get the number of buttons per column/row
c49245f8
VZ
124 int GetNumVer() const;
125 int GetNumHor() const;
126
cc0bffac
RD
127 virtual void ApplyParentThemeBackground(const wxColour& bg)
128 { SetBackgroundColour(bg); }
129
2bda0e17 130protected:
7a5a5718
RD
131 // we can't compute our best size before the items are added to the control
132 virtual void SetInitialBestSize(const wxSize& WXUNUSED(size)) { }
133
3ca6a5f0 134 // subclass one radio button
e373f51b
VZ
135 void SubclassRadioButton(WXHWND hWndBtn);
136
3ca6a5f0
BP
137 // get the max size of radio buttons
138 wxSize GetMaxButtonSize() const;
139
140 // get the total size occupied by the radio box buttons
141 wxSize GetTotalButtonSize(const wxSize& sizeBtn) const;
142
bfc6fde4 143 WXHWND * m_radioButtons;
e373f51b
VZ
144 int m_majorDim;
145 int * m_radioWidth; // for bitmaps
146 int * m_radioHeight;
bfc6fde4
VZ
147
148 int m_noItems;
149 int m_noRowsOrCols;
150 int m_selectedButton;
151
152 virtual void DoSetSize(int x, int y,
153 int width, int height,
154 int sizeFlags = wxSIZE_AUTO);
3ca6a5f0 155 virtual wxSize DoGetBestSize() const;
1e6feb95
VZ
156
157private:
158 DECLARE_DYNAMIC_CLASS(wxRadioBox)
22f3361e 159 DECLARE_NO_COPY_CLASS(wxRadioBox)
2bda0e17
KB
160};
161
162#endif
bbcdf8bc 163 // _WX_RADIOBOX_H_