Reverted patch [ 832096 ] Final separation for GUI and console for Open Watcom
[wxWidgets.git] / include / wx / msw / radiobox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/radiobox.h
3 // Purpose: wxRadioBox class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
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
19 class WXDLLEXPORT wxBitmap;
20
21 // ----------------------------------------------------------------------------
22 // wxRadioBox
23 // ----------------------------------------------------------------------------
24
25 class WXDLLEXPORT wxRadioBox : public wxControl, public wxRadioBoxBase
26 {
27 public:
28 wxRadioBox();
29
30 wxRadioBox(wxWindow *parent,
31 wxWindowID id,
32 const wxString& title,
33 const wxPoint& pos = wxDefaultPosition,
34 const wxSize& size = wxDefaultSize,
35 int n = 0, const wxString choices[] = NULL,
36 int majorDim = 0,
37 long style = wxRA_HORIZONTAL,
38 const wxValidator& val = wxDefaultValidator,
39 const wxString& name = wxRadioBoxNameStr)
40 {
41 (void)Create(parent, id, title, pos, size, n, choices, majorDim,
42 style, val, name);
43 }
44
45 ~wxRadioBox();
46
47 bool Create(wxWindow *parent,
48 wxWindowID id,
49 const wxString& title,
50 const wxPoint& pos = wxDefaultPosition,
51 const wxSize& size = wxDefaultSize,
52 int n = 0, const wxString choices[] = NULL,
53 int majorDim = 0,
54 long style = wxRA_HORIZONTAL,
55 const wxValidator& val = wxDefaultValidator,
56 const wxString& name = wxRadioBoxNameStr);
57
58 // implement the radiobox interface
59 virtual void SetSelection(int n);
60 virtual int GetSelection() const;
61 virtual int GetCount() const;
62 virtual wxString GetString(int n) const;
63 virtual void SetString(int n, const wxString& label);
64 virtual void Enable(int n, bool enable = TRUE);
65 virtual void Show(int n, bool show = TRUE);
66 virtual int GetColumnCount() const;
67 virtual int GetRowCount() const;
68
69 virtual bool Show(bool show = TRUE);
70 void SetFocus();
71 virtual bool Enable(bool enable = TRUE);
72 void SetLabelFont(const wxFont& WXUNUSED(font)) {};
73 void SetButtonFont(const wxFont& font) { SetFont(font); }
74
75 void Command(wxCommandEvent& event);
76
77 int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
78 void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
79
80 // implementation only from now on
81 // -------------------------------
82
83 virtual bool MSWCommand(WXUINT param, WXWORD id);
84
85 // FIXME: are they used? missing "Do" prefix?
86 void GetSize(int *x, int *y) const;
87 void GetPosition(int *x, int *y) const;
88
89 virtual bool SetFont(const wxFont& font);
90
91 long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
92 virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
93 WXUINT message,
94 WXWPARAM wParam, WXLPARAM lParam);
95 WXHWND *GetRadioButtons() const { return m_radioButtons; }
96 bool ContainsHWND(WXHWND hWnd) const;
97 void SendNotificationEvent();
98
99 // get the number of buttons per column/row
100 int GetNumVer() const;
101 int GetNumHor() const;
102
103 protected:
104 // subclass one radio button
105 void SubclassRadioButton(WXHWND hWndBtn);
106
107 // get the max size of radio buttons
108 wxSize GetMaxButtonSize() const;
109
110 // get the total size occupied by the radio box buttons
111 wxSize GetTotalButtonSize(const wxSize& sizeBtn) const;
112
113 WXHWND * m_radioButtons;
114 int m_majorDim;
115 int * m_radioWidth; // for bitmaps
116 int * m_radioHeight;
117
118 int m_noItems;
119 int m_noRowsOrCols;
120 int m_selectedButton;
121
122 virtual void DoSetSize(int x, int y,
123 int width, int height,
124 int sizeFlags = wxSIZE_AUTO);
125 virtual wxSize DoGetBestSize() const;
126
127 private:
128 DECLARE_DYNAMIC_CLASS(wxRadioBox)
129 DECLARE_NO_COPY_CLASS(wxRadioBox)
130 };
131
132 #endif
133 // _WX_RADIOBOX_H_