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 class WXDLLEXPORT wxBitmap
;
16 class WXDLLEXPORT wxRadioButton
;
18 // ----------------------------------------------------------------------------
20 // ----------------------------------------------------------------------------
22 class WXDLLEXPORT wxRadioBox
: public wxControl
, public wxRadioBoxBase
25 wxRadioBox():m_radios(wxKEY_INTEGER
,32)
30 wxRadioBox(wxWindow
*parent
,
32 const wxString
& title
,
33 const wxPoint
& pos
= wxDefaultPosition
,
34 const wxSize
& size
= wxDefaultSize
,
35 int n
= 0, const wxString choices
[] = NULL
,
37 long style
= wxRA_SPECIFY_COLS
,
38 const wxValidator
& val
= wxDefaultValidator
,
39 const wxString
& name
= wxRadioBoxNameStr
)
40 :m_radios(wxKEY_INTEGER
,n
+1)
43 (void)Create(parent
, id
, title
, pos
, size
, n
, choices
, majorDim
,
47 wxRadioBox(wxWindow
*parent
,
49 const wxString
& title
,
52 const wxArrayString
& choices
,
54 long style
= wxRA_SPECIFY_COLS
,
55 const wxValidator
& val
= wxDefaultValidator
,
56 const wxString
& name
= wxRadioBoxNameStr
)
57 :m_radios(wxKEY_INTEGER
,choices
.GetCount()+1)
60 (void)Create(parent
, id
, title
, pos
, size
, choices
, majorDim
,
66 bool Create(wxWindow
*parent
,
68 const wxString
& title
,
69 const wxPoint
& pos
= wxDefaultPosition
,
70 const wxSize
& size
= wxDefaultSize
,
71 int n
= 0, const wxString choices
[] = NULL
,
73 long style
= wxRA_SPECIFY_COLS
,
74 const wxValidator
& val
= wxDefaultValidator
,
75 const wxString
& name
= wxRadioBoxNameStr
);
77 bool Create(wxWindow
*parent
,
79 const wxString
& title
,
82 const wxArrayString
& choices
,
84 long style
= wxRA_SPECIFY_COLS
,
85 const wxValidator
& val
= wxDefaultValidator
,
86 const wxString
& name
= wxRadioBoxNameStr
);
88 // implement the radiobox interface
89 virtual void SetSelection(int n
);
90 virtual int GetSelection() const;
91 virtual int GetCount() const;
92 virtual wxString
GetString(int n
) const;
93 virtual void SetString(int n
, const wxString
& label
);
95 virtual bool Enable(bool enable
= true);
96 virtual bool Enable(int n
, bool enable
= true);
98 virtual bool Show(bool show
= true);
99 virtual bool Show(int n
, bool show
= true);
101 virtual void SetLabel(const wxString
& label
);
102 virtual wxString
GetLabel();
104 virtual int GetColumnCount() const;
105 virtual int GetRowCount() const;
107 virtual void DoGetPosition( int *x
, int *y
) const;
108 virtual void DoGetSize( int *width
, int *height
) const;
109 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
111 virtual wxPoint
GetClientAreaOrigin() const;
114 void SetLabelFont(const wxFont
& WXUNUSED(font
)) {};
115 void SetButtonFont(const wxFont
& font
) { SetFont(font
); }
117 virtual void Refresh( bool eraseBackground
= true,
118 const wxRect
*rect
= NULL
);
120 void Command(wxCommandEvent
& event
);
122 int GetNumberOfRowsOrCols() const { return m_noRowsOrCols
; }
123 void SetNumberOfRowsOrCols(int n
) { m_noRowsOrCols
= n
; }
125 // implementation only from now on
126 // -------------------------------
128 virtual bool SetFont(const wxFont
& font
);
130 void SendNotificationEvent();
132 // get the number of buttons per column/row
133 int GetNumVer() const;
134 int GetNumHor() const;
137 // we can't compute our best size before the items are added to the control
138 virtual void SetInitialBestSize(const wxSize
& WXUNUSED(size
)) { }
140 // get the max size of radio buttons
141 wxSize
GetMaxButtonSize() const;
143 // get the total size occupied by the radio box buttons
144 wxSize
GetTotalButtonSize(const wxSize
& sizeBtn
) const;
147 int * m_radioWidth
; // for bitmaps
152 int m_selectedButton
;
154 virtual wxSize
DoGetBestSize() const;
159 wxRadioButton
*GetRadioButton(int i
) const;
163 wxHashTable m_radios
;
165 DECLARE_DYNAMIC_CLASS(wxRadioBox
)
166 DECLARE_NO_COPY_CLASS(wxRadioBox
)