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
,
64 virtual ~wxRadioBox();
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
);
89 virtual bool Enable(bool enable
= true);
90 virtual bool Enable(unsigned int n
, bool enable
= true);
91 virtual bool IsItemEnabled(unsigned int WXUNUSED(n
)) const
98 virtual bool Show(bool show
= true);
99 virtual bool Show(unsigned int n
, bool show
= true);
100 virtual bool IsItemShown(unsigned int WXUNUSED(n
)) const
106 // implement the radiobox interface
107 virtual void SetSelection(int n
);
108 virtual int GetSelection() const;
109 virtual unsigned int GetCount() const;
110 virtual wxString
GetString(unsigned int n
) const;
111 virtual void SetString(unsigned int n
, const wxString
& label
);
113 virtual void SetLabel(const wxString
& label
);
114 virtual wxString
GetLabel();
116 virtual void DoGetPosition( int *x
, int *y
) const;
117 virtual void DoGetSize( int *width
, int *height
) const;
118 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
120 virtual wxPoint
GetClientAreaOrigin() const;
123 void SetLabelFont(const wxFont
& WXUNUSED(font
)) {};
124 void SetButtonFont(const wxFont
& font
) { SetFont(font
); }
126 virtual void Refresh( bool eraseBackground
= true,
127 const wxRect
*rect
= NULL
);
129 void Command(wxCommandEvent
& event
);
131 int GetNumberOfRowsOrCols() const { return m_noRowsOrCols
; }
132 void SetNumberOfRowsOrCols(int n
) { m_noRowsOrCols
= n
; }
134 // implementation only from now on
135 // -------------------------------
137 virtual bool SetFont(const wxFont
& font
);
139 void SendNotificationEvent();
142 // we can't compute our best size before the items are added to the control
143 virtual void SetInitialBestSize(const wxSize
& WXUNUSED(size
)) { }
145 // get the max size of radio buttons
146 wxSize
GetMaxButtonSize() const;
148 // get the total size occupied by the radio box buttons
149 wxSize
GetTotalButtonSize(const wxSize
& sizeBtn
) const;
151 int *m_radioWidth
; // for bitmaps
155 int m_selectedButton
;
157 virtual wxSize
DoGetBestSize() const;
162 wxRadioButton
*GetRadioButton(int i
) const;
166 wxHashTable m_radios
;
168 DECLARE_DYNAMIC_CLASS(wxRadioBox
)
169 DECLARE_NO_COPY_CLASS(wxRadioBox
)