]>
Commit | Line | Data |
---|---|---|
2bda0e17 | 1 | ///////////////////////////////////////////////////////////////////////////// |
1e6feb95 | 2 | // Name: wx/msw/radiobox.h |
2bda0e17 KB |
3 | // Purpose: wxRadioBox class |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
bbcdf8bc | 8 | // Copyright: (c) Julian Smart |
c49245f8 | 9 | // Licence: wxWindows licence |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_RADIOBOX_H_ |
13 | #define _WX_RADIOBOX_H_ | |
2bda0e17 KB |
14 | |
15 | #ifdef __GNUG__ | |
c49245f8 | 16 | #pragma interface "radiobox.h" |
2bda0e17 KB |
17 | #endif |
18 | ||
e373f51b | 19 | class WXDLLEXPORT wxBitmap; |
2bda0e17 | 20 | |
1e6feb95 VZ |
21 | // ---------------------------------------------------------------------------- |
22 | // wxRadioBox | |
23 | // ---------------------------------------------------------------------------- | |
bfc6fde4 | 24 | |
1e6feb95 VZ |
25 | class WXDLLEXPORT wxRadioBox : public wxControl, public wxRadioBoxBase |
26 | { | |
2bda0e17 | 27 | public: |
bfc6fde4 | 28 | wxRadioBox(); |
2bda0e17 | 29 | |
1e6feb95 VZ |
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) | |
bfc6fde4 | 40 | { |
1e6feb95 VZ |
41 | (void)Create(parent, id, title, pos, size, n, choices, majorDim, |
42 | style, val, name); | |
bfc6fde4 VZ |
43 | } |
44 | ||
bfc6fde4 VZ |
45 | ~wxRadioBox(); |
46 | ||
1e6feb95 VZ |
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; | |
bfc6fde4 | 68 | |
6b0d8a01 | 69 | virtual bool Show(bool show = TRUE); |
bfc6fde4 | 70 | void SetFocus(); |
6b0d8a01 | 71 | virtual bool Enable(bool enable = TRUE); |
bfc6fde4 VZ |
72 | void SetLabelFont(const wxFont& WXUNUSED(font)) {}; |
73 | void SetButtonFont(const wxFont& font) { SetFont(font); } | |
74 | ||
bfc6fde4 VZ |
75 | void Command(wxCommandEvent& event); |
76 | ||
77 | int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; } | |
78 | void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; } | |
79 | ||
c49245f8 VZ |
80 | // implementation only from now on |
81 | // ------------------------------- | |
82 | ||
1e6feb95 VZ |
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 | ||
4afd7529 VZ |
89 | virtual bool SetFont(const wxFont& font); |
90 | ||
c92d798f | 91 | long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); |
f6bcfd97 | 92 | virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, |
1e6feb95 VZ |
93 | WXUINT message, |
94 | WXWPARAM wParam, WXLPARAM lParam); | |
bfc6fde4 | 95 | WXHWND *GetRadioButtons() const { return m_radioButtons; } |
e373f51b | 96 | bool ContainsHWND(WXHWND hWnd) const; |
9a5ccab4 | 97 | void SendNotificationEvent(); |
bfc6fde4 | 98 | |
e373f51b | 99 | // get the number of buttons per column/row |
c49245f8 VZ |
100 | int GetNumVer() const; |
101 | int GetNumHor() const; | |
102 | ||
8614c467 | 103 | // compatibility ctor |
c49245f8 VZ |
104 | #if WXWIN_COMPATIBILITY |
105 | wxRadioBox(wxWindow *parent, wxFunction func, const char *title, | |
106 | int x = -1, int y = -1, int width = -1, int height = -1, | |
107 | int n = 0, char **choices = NULL, | |
108 | int majorDim = 0, long style = wxRA_HORIZONTAL, const char *name = wxRadioBoxNameStr); | |
109 | #endif // WXWIN_COMPATIBILITY | |
e373f51b | 110 | |
2bda0e17 | 111 | protected: |
3ca6a5f0 | 112 | // subclass one radio button |
e373f51b VZ |
113 | void SubclassRadioButton(WXHWND hWndBtn); |
114 | ||
3ca6a5f0 BP |
115 | // get the max size of radio buttons |
116 | wxSize GetMaxButtonSize() const; | |
117 | ||
118 | // get the total size occupied by the radio box buttons | |
119 | wxSize GetTotalButtonSize(const wxSize& sizeBtn) const; | |
120 | ||
bfc6fde4 | 121 | WXHWND * m_radioButtons; |
e373f51b VZ |
122 | int m_majorDim; |
123 | int * m_radioWidth; // for bitmaps | |
124 | int * m_radioHeight; | |
bfc6fde4 VZ |
125 | |
126 | int m_noItems; | |
127 | int m_noRowsOrCols; | |
128 | int m_selectedButton; | |
129 | ||
130 | virtual void DoSetSize(int x, int y, | |
131 | int width, int height, | |
132 | int sizeFlags = wxSIZE_AUTO); | |
3ca6a5f0 | 133 | virtual wxSize DoGetBestSize() const; |
1e6feb95 VZ |
134 | |
135 | private: | |
136 | DECLARE_DYNAMIC_CLASS(wxRadioBox) | |
2bda0e17 KB |
137 | }; |
138 | ||
139 | #endif | |
bbcdf8bc | 140 | // _WX_RADIOBOX_H_ |