1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/palmos/radiobox.h
3 // Purpose: wxRadioBox class
4 // Author: William Osborne - minimal working wxPalmOS port
5 // Modified by: Wlodzimierz ABX Skiba - native wxRadioBox implementation
8 // Copyright: (c) William Osborne, Wlodzimierz Skiba
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_RADIOBOX_H_
13 #define _WX_RADIOBOX_H_
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "radiobox.h"
19 class WXDLLEXPORT wxBitmap
;
20 class WXDLLEXPORT wxRadioButton
;
22 // ----------------------------------------------------------------------------
24 // ----------------------------------------------------------------------------
26 class WXDLLEXPORT wxRadioBox
: public wxControl
, public wxRadioBoxBase
29 wxRadioBox():m_radios(wxKEY_INTEGER
,32)
34 wxRadioBox(wxWindow
*parent
,
36 const wxString
& title
,
37 const wxPoint
& pos
= wxDefaultPosition
,
38 const wxSize
& size
= wxDefaultSize
,
39 int n
= 0, const wxString choices
[] = NULL
,
41 long style
= wxRA_SPECIFY_COLS
,
42 const wxValidator
& val
= wxDefaultValidator
,
43 const wxString
& name
= wxRadioBoxNameStr
)
44 :m_radios(wxKEY_INTEGER
,n
+1)
47 (void)Create(parent
, id
, title
, pos
, size
, n
, choices
, majorDim
,
51 wxRadioBox(wxWindow
*parent
,
53 const wxString
& title
,
56 const wxArrayString
& choices
,
58 long style
= wxRA_SPECIFY_COLS
,
59 const wxValidator
& val
= wxDefaultValidator
,
60 const wxString
& name
= wxRadioBoxNameStr
)
61 :m_radios(wxKEY_INTEGER
,choices
.GetCount()+1)
64 (void)Create(parent
, id
, title
, pos
, size
, choices
, majorDim
,
70 bool Create(wxWindow
*parent
,
72 const wxString
& title
,
73 const wxPoint
& pos
= wxDefaultPosition
,
74 const wxSize
& size
= wxDefaultSize
,
75 int n
= 0, const wxString choices
[] = NULL
,
77 long style
= wxRA_SPECIFY_COLS
,
78 const wxValidator
& val
= wxDefaultValidator
,
79 const wxString
& name
= wxRadioBoxNameStr
);
81 bool Create(wxWindow
*parent
,
83 const wxString
& title
,
86 const wxArrayString
& choices
,
88 long style
= wxRA_SPECIFY_COLS
,
89 const wxValidator
& val
= wxDefaultValidator
,
90 const wxString
& name
= wxRadioBoxNameStr
);
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
);
99 virtual bool Enable(bool enable
= true);
100 virtual bool Enable(int n
, bool enable
= true);
102 virtual bool Show(bool show
= true);
103 virtual bool Show(int n
, bool show
= true);
105 virtual void SetLabel(const wxString
& label
);
106 virtual wxString
GetLabel();
108 virtual int GetColumnCount() const;
109 virtual int GetRowCount() const;
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
);
115 virtual wxPoint
GetClientAreaOrigin() const;
118 void SetLabelFont(const wxFont
& WXUNUSED(font
)) {};
119 void SetButtonFont(const wxFont
& font
) { SetFont(font
); }
121 virtual void Refresh( bool eraseBackground
= true,
122 const wxRect
*rect
= NULL
);
124 void Command(wxCommandEvent
& event
);
126 int GetNumberOfRowsOrCols() const { return m_noRowsOrCols
; }
127 void SetNumberOfRowsOrCols(int n
) { m_noRowsOrCols
= n
; }
129 // implementation only from now on
130 // -------------------------------
132 virtual bool SetFont(const wxFont
& font
);
134 void SendNotificationEvent();
136 // get the number of buttons per column/row
137 int GetNumVer() const;
138 int GetNumHor() const;
140 virtual void ApplyParentThemeBackground(const wxColour
& bg
)
141 { SetBackgroundColour(bg
); }
144 // we can't compute our best size before the items are added to the control
145 virtual void SetInitialBestSize(const wxSize
& WXUNUSED(size
)) { }
147 // get the max size of radio buttons
148 wxSize
GetMaxButtonSize() const;
150 // get the total size occupied by the radio box buttons
151 wxSize
GetTotalButtonSize(const wxSize
& sizeBtn
) const;
154 int * m_radioWidth
; // for bitmaps
159 int m_selectedButton
;
161 virtual wxSize
DoGetBestSize() const;
166 wxRadioButton
*GetRadioButton(int i
) const;
170 wxHashTable m_radios
;
172 DECLARE_DYNAMIC_CLASS(wxRadioBox
)
173 DECLARE_NO_COPY_CLASS(wxRadioBox
)