]> git.saurik.com Git - wxWidgets.git/blame - include/wx/palmos/radiobox.h
Added #if wxUSE_STACKWALKER. Fixes compilation of OS X shared libraries.
[wxWidgets.git] / include / wx / palmos / radiobox.h
CommitLineData
ffecfa5a
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/palmos/radiobox.h
3// Purpose: wxRadioBox class
e1d63b79 4// Author: William Osborne - minimal working wxPalmOS port
a152561c 5// Modified by: Wlodzimierz ABX Skiba - native wxRadioBox implementation
ffecfa5a 6// Created: 10/13/04
e1d63b79 7// RCS-ID: $Id$
a152561c 8// Copyright: (c) William Osborne, Wlodzimierz Skiba
ffecfa5a
JS
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_RADIOBOX_H_
13#define _WX_RADIOBOX_H_
14
15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "radiobox.h"
17#endif
18
19class WXDLLEXPORT wxBitmap;
1a87edf2 20class WXDLLEXPORT wxRadioButton;
ffecfa5a
JS
21
22// ----------------------------------------------------------------------------
23// wxRadioBox
24// ----------------------------------------------------------------------------
25
26class WXDLLEXPORT wxRadioBox : public wxControl, public wxRadioBoxBase
27{
28public:
1a87edf2
WS
29 wxRadioBox():m_radios(wxKEY_INTEGER,32)
30 {
31 Init();
32 }
ffecfa5a
JS
33
34 wxRadioBox(wxWindow *parent,
35 wxWindowID id,
36 const wxString& title,
37 const wxPoint& pos = wxDefaultPosition,
38 const wxSize& size = wxDefaultSize,
39 int n = 0, const wxString choices[] = NULL,
40 int majorDim = 0,
8be10866 41 long style = wxRA_SPECIFY_COLS,
ffecfa5a
JS
42 const wxValidator& val = wxDefaultValidator,
43 const wxString& name = wxRadioBoxNameStr)
1a87edf2 44 :m_radios(wxKEY_INTEGER,n+1)
ffecfa5a 45 {
1a87edf2 46 Init();
ffecfa5a
JS
47 (void)Create(parent, id, title, pos, size, n, choices, majorDim,
48 style, val, name);
49 }
1a87edf2 50
ffecfa5a
JS
51 wxRadioBox(wxWindow *parent,
52 wxWindowID id,
53 const wxString& title,
54 const wxPoint& pos,
55 const wxSize& size,
56 const wxArrayString& choices,
57 int majorDim = 0,
8be10866 58 long style = wxRA_SPECIFY_COLS,
ffecfa5a
JS
59 const wxValidator& val = wxDefaultValidator,
60 const wxString& name = wxRadioBoxNameStr)
1a87edf2 61 :m_radios(wxKEY_INTEGER,choices.GetCount()+1)
ffecfa5a 62 {
1a87edf2 63 Init();
ffecfa5a
JS
64 (void)Create(parent, id, title, pos, size, choices, majorDim,
65 style, val, name);
66 }
67
68 ~wxRadioBox();
69
70 bool Create(wxWindow *parent,
71 wxWindowID id,
72 const wxString& title,
73 const wxPoint& pos = wxDefaultPosition,
74 const wxSize& size = wxDefaultSize,
75 int n = 0, const wxString choices[] = NULL,
76 int majorDim = 0,
8be10866 77 long style = wxRA_SPECIFY_COLS,
ffecfa5a
JS
78 const wxValidator& val = wxDefaultValidator,
79 const wxString& name = wxRadioBoxNameStr);
9a727a3b 80
ffecfa5a
JS
81 bool Create(wxWindow *parent,
82 wxWindowID id,
83 const wxString& title,
84 const wxPoint& pos,
85 const wxSize& size,
86 const wxArrayString& choices,
87 int majorDim = 0,
8be10866 88 long style = wxRA_SPECIFY_COLS,
ffecfa5a
JS
89 const wxValidator& val = wxDefaultValidator,
90 const wxString& name = wxRadioBoxNameStr);
91
92 // implement the radiobox interface
93 virtual void SetSelection(int n);
94 virtual int GetSelection() const;
95 virtual int GetCount() const;
96 virtual wxString GetString(int n) const;
97 virtual void SetString(int n, const wxString& label);
11f4a344
WS
98
99 virtual bool Enable(bool enable = true);
1a87edf2 100 virtual bool Enable(int n, bool enable = true);
11f4a344
WS
101
102 virtual bool Show(bool show = true);
fa50c0e3 103 virtual bool Show(int n, bool show = true);
11f4a344
WS
104
105 virtual void SetLabel(const wxString& label);
106 virtual wxString GetLabel();
107
ffecfa5a
JS
108 virtual int GetColumnCount() const;
109 virtual int GetRowCount() const;
110
1a87edf2
WS
111 virtual void DoGetPosition( int *x, int *y ) const;
112 virtual void DoGetSize( int *width, int *height ) const;
113 virtual void DoMoveWindow(int x, int y, int width, int height);
114
115 virtual wxPoint GetClientAreaOrigin() const;
116
ffecfa5a 117 void SetFocus();
ffecfa5a
JS
118 void SetLabelFont(const wxFont& WXUNUSED(font)) {};
119 void SetButtonFont(const wxFont& font) { SetFont(font); }
120
11f4a344
WS
121 virtual void Refresh( bool eraseBackground = true,
122 const wxRect *rect = NULL );
123
ffecfa5a
JS
124 void Command(wxCommandEvent& event);
125
126 int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
127 void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
128
129 // implementation only from now on
130 // -------------------------------
131
ffecfa5a
JS
132 virtual bool SetFont(const wxFont& font);
133
ffecfa5a
JS
134 void SendNotificationEvent();
135
136 // get the number of buttons per column/row
137 int GetNumVer() const;
138 int GetNumHor() const;
139
140 virtual void ApplyParentThemeBackground(const wxColour& bg)
141 { SetBackgroundColour(bg); }
142
143protected:
144 // we can't compute our best size before the items are added to the control
145 virtual void SetInitialBestSize(const wxSize& WXUNUSED(size)) { }
146
ffecfa5a
JS
147 // get the max size of radio buttons
148 wxSize GetMaxButtonSize() const;
149
150 // get the total size occupied by the radio box buttons
151 wxSize GetTotalButtonSize(const wxSize& sizeBtn) const;
152
ffecfa5a
JS
153 int m_majorDim;
154 int * m_radioWidth; // for bitmaps
155 int * m_radioHeight;
156
157 int m_noItems;
158 int m_noRowsOrCols;
159 int m_selectedButton;
160
ffecfa5a
JS
161 virtual wxSize DoGetBestSize() const;
162
163private:
1a87edf2
WS
164
165 void Init();
17fb3524 166 wxRadioButton *GetRadioButton(int i) const;
1a87edf2
WS
167
168 wxPoint m_pos;
169 wxSize m_size;
170 wxHashTable m_radios;
171
ffecfa5a
JS
172 DECLARE_DYNAMIC_CLASS(wxRadioBox)
173 DECLARE_NO_COPY_CLASS(wxRadioBox)
174};
175
176#endif
177 // _WX_RADIOBOX_H_