]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/radiobox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/radiobox.h
3 // Purpose: wxRadioBox class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
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
;
21 // ----------------------------------------------------------------------------
23 // ----------------------------------------------------------------------------
25 class WXDLLEXPORT wxRadioBox
: public wxControl
, public wxRadioBoxBase
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_HORIZONTAL
,
38 const wxValidator
& val
= wxDefaultValidator
,
39 const wxString
& name
= wxRadioBoxNameStr
)
41 (void)Create(parent
, id
, title
, pos
, size
, n
, choices
, majorDim
,
44 wxRadioBox(wxWindow
*parent
,
46 const wxString
& title
,
49 const wxArrayString
& choices
,
51 long style
= wxRA_HORIZONTAL
,
52 const wxValidator
& val
= wxDefaultValidator
,
53 const wxString
& name
= wxRadioBoxNameStr
)
55 (void)Create(parent
, id
, title
, pos
, size
, choices
, majorDim
,
61 bool Create(wxWindow
*parent
,
63 const wxString
& title
,
64 const wxPoint
& pos
= wxDefaultPosition
,
65 const wxSize
& size
= wxDefaultSize
,
66 int n
= 0, const wxString choices
[] = NULL
,
68 long style
= wxRA_HORIZONTAL
,
69 const wxValidator
& val
= wxDefaultValidator
,
70 const wxString
& name
= wxRadioBoxNameStr
);
71 bool Create(wxWindow
*parent
,
73 const wxString
& title
,
76 const wxArrayString
& choices
,
78 long style
= wxRA_HORIZONTAL
,
79 const wxValidator
& val
= wxDefaultValidator
,
80 const wxString
& name
= wxRadioBoxNameStr
);
82 // implement the radiobox interface
83 virtual void SetSelection(int n
);
84 virtual int GetSelection() const;
85 virtual int GetCount() const;
86 virtual wxString
GetString(int n
) const;
87 virtual void SetString(int n
, const wxString
& label
);
88 virtual void Enable(int n
, bool enable
= TRUE
);
89 virtual void Show(int n
, bool show
= TRUE
);
90 virtual int GetColumnCount() const;
91 virtual int GetRowCount() const;
93 virtual bool Show(bool show
= TRUE
);
95 virtual bool Enable(bool enable
= TRUE
);
96 void SetLabelFont(const wxFont
& WXUNUSED(font
)) {};
97 void SetButtonFont(const wxFont
& font
) { SetFont(font
); }
99 void Command(wxCommandEvent
& event
);
101 int GetNumberOfRowsOrCols() const { return m_noRowsOrCols
; }
102 void SetNumberOfRowsOrCols(int n
) { m_noRowsOrCols
= n
; }
104 // implementation only from now on
105 // -------------------------------
107 virtual bool MSWCommand(WXUINT param
, WXWORD id
);
109 // FIXME: are they used? missing "Do" prefix?
110 void GetSize(int *x
, int *y
) const;
111 void GetPosition(int *x
, int *y
) const;
113 virtual bool SetFont(const wxFont
& font
);
115 WXLRESULT
MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
116 virtual WXHBRUSH
OnCtlColor(WXHDC pDC
, WXHWND pWnd
, WXUINT nCtlColor
,
118 WXWPARAM wParam
, WXLPARAM lParam
);
119 WXHWND
*GetRadioButtons() const { return m_radioButtons
; }
120 bool ContainsHWND(WXHWND hWnd
) const;
121 void SendNotificationEvent();
123 // get the number of buttons per column/row
124 int GetNumVer() const;
125 int GetNumHor() const;
127 virtual void ApplyParentThemeBackground(const wxColour
& bg
)
128 { SetBackgroundColour(bg
); }
131 // subclass one radio button
132 void SubclassRadioButton(WXHWND hWndBtn
);
134 // get the max size of radio buttons
135 wxSize
GetMaxButtonSize() const;
137 // get the total size occupied by the radio box buttons
138 wxSize
GetTotalButtonSize(const wxSize
& sizeBtn
) const;
140 WXHWND
* m_radioButtons
;
142 int * m_radioWidth
; // for bitmaps
147 int m_selectedButton
;
149 virtual void DoSetSize(int x
, int y
,
150 int width
, int height
,
151 int sizeFlags
= wxSIZE_AUTO
);
152 virtual wxSize
DoGetBestSize() const;
155 DECLARE_DYNAMIC_CLASS(wxRadioBox
)
156 DECLARE_NO_COPY_CLASS(wxRadioBox
)