]> git.saurik.com Git - wxWidgets.git/blame - include/wx/univ/radiobox.h
Added wxFopen to the MSLU code.
[wxWidgets.git] / include / wx / univ / radiobox.h
CommitLineData
1e6feb95
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/univ/radiobox.h
3// Purpose: wxRadioBox declaration
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 11.09.00
7// RCS-ID: $Id$
442b35b5 8// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
65571936 9// Licence: wxWindows licence
1e6feb95
VZ
10///////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_UNIV_RADIOBOX_H_
13#define _WX_UNIV_RADIOBOX_H_
14
12028905 15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
a3870b2f 16 #pragma interface "univradiobox.h"
1e6feb95
VZ
17#endif
18
19class WXDLLEXPORT wxRadioButton;
20
21#include "wx/statbox.h"
22#include "wx/dynarray.h"
23
d5d29b8a 24WX_DEFINE_EXPORTED_ARRAY_PTR(wxRadioButton *, wxArrayRadioButtons);
1e6feb95
VZ
25
26// ----------------------------------------------------------------------------
27// wxRadioBox: a box full of radio buttons
28// ----------------------------------------------------------------------------
29
30class WXDLLEXPORT wxRadioBox : public wxStaticBox,
31 public wxRadioBoxBase
32{
33public:
34 // wxRadioBox construction
6463b9f5 35 wxRadioBox() { Init(); }
1e6feb95
VZ
36
37 wxRadioBox(wxWindow *parent,
38 wxWindowID id,
39 const wxString& title,
40 const wxPoint& pos = wxDefaultPosition,
41 const wxSize& size = wxDefaultSize,
42 int n = 0, const wxString *choices = NULL,
43 int majorDim = 0,
44 long style = wxRA_SPECIFY_COLS,
45 const wxValidator& val = wxDefaultValidator,
6463b9f5
JS
46 const wxString& name = wxRadioBoxNameStr)
47 {
48 Init();
49
50 (void)Create(parent, id, title, pos, size, n, choices,
51 majorDim, style, val, name);
52 }
584ad2a3
MB
53 wxRadioBox(wxWindow *parent,
54 wxWindowID id,
55 const wxString& title,
56 const wxPoint& pos,
57 const wxSize& size,
58 const wxArrayString& choices,
59 int majorDim = 0,
60 long style = wxRA_SPECIFY_COLS,
61 const wxValidator& val = wxDefaultValidator,
62 const wxString& name = wxRadioBoxNameStr);
1e6feb95
VZ
63
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,
71 long style = wxRA_SPECIFY_COLS,
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,
81 long style = wxRA_SPECIFY_COLS,
82 const wxValidator& val = wxDefaultValidator,
83 const wxString& name = wxRadioBoxNameStr);
1e6feb95
VZ
84
85 virtual ~wxRadioBox();
86
87 // implement wxRadioBox interface
88 virtual void SetSelection(int n);
89 virtual int GetSelection() const;
90
91 virtual int GetCount() const { return m_buttons.GetCount(); }
92 virtual int GetColumnCount() const { return m_numCols; }
93 virtual int GetRowCount() const { return m_numRows; }
94
95 virtual wxString GetString(int n) const;
96 virtual void SetString(int n, const wxString& label);
97
a290fa5a
WS
98 virtual void Enable(int n, bool enable = true);
99 virtual void Show(int n, bool show = true);
1e6feb95
VZ
100
101 // we also override the wxControl methods to avoid virtual function hiding
a290fa5a
WS
102 virtual bool Enable(bool enable = true);
103 virtual bool Show(bool show = true);
1e6feb95
VZ
104 virtual wxString GetLabel() const;
105 virtual void SetLabel(const wxString& label);
106
44029ca4
VZ
107 // we inherit a version returning false from wxStaticBox, override it again
108 virtual bool AcceptsFocus() const { return true; }
109
d4e5272b
JS
110#if wxUSE_TOOLTIPS
111 virtual void DoSetToolTip( wxToolTip *tip );
112#endif // wxUSE_TOOLTIPS
113
1e6feb95
VZ
114 // wxUniversal-only methods
115
116 // another Append() version
117 void Append(int n, const wxString *choices);
118
119 // implementation only: called by wxRadioHookHandler
120 void OnRadioButton(wxEvent& event);
121 bool OnKeyDown(wxKeyEvent& event);
122
123protected:
124 // override the base class methods dealing with window positioning/sizing
125 // as we must move/size the buttons as well
126 virtual void DoMoveWindow(int x, int y, int width, int height);
127 virtual wxSize DoGetBestClientSize() const;
128
129 // generate a radiobutton click event for the current item
130 void SendRadioEvent();
131
132 // common part of all ctors
133 void Init();
134
135 // check that the index is valid
136 bool IsValid(int n) const { return n >= 0 && n < GetCount(); }
137
138 // sets m_majorDim and calculate m_numCols and m_numRows
139 void SetMajorDim(int majorDim);
140
141 // calculate the max size of all buttons
142 wxSize GetMaxButtonSize() const;
143
144 // the currently selected radio button or -1
145 int m_selection;
146
147 // the parameters defining the button layout: majorDim meaning depends on
148 // the style and is the (max) number of columns if it includes
149 // wxRA_SPECIFY_COLS and is the (max) number of rows if it includes
150 // wxRA_SPECIFY_ROWS - the number of rows and columns is calculated from
151 // it
152 int m_majorDim,
153 m_numCols,
154 m_numRows;
155
156 // all radio buttons
157 wxArrayRadioButtons m_buttons;
158
159 // the event handler which is used to translate radiobutton events into
160 // radiobox one
161 wxEvtHandler *m_evtRadioHook;
162
163private:
164 DECLARE_DYNAMIC_CLASS(wxRadioBox)
165};
166
167#endif // _WX_UNIV_RADIOBOX_H_