]>
Commit | Line | Data |
---|---|---|
2bda0e17 KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: radiobox.h | |
3 | // Purpose: wxRadioBox class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
bbcdf8bc JS |
8 | // Copyright: (c) Julian Smart |
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__ | |
16 | #pragma interface "radiobox.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/control.h" | |
20 | ||
21 | WXDLLEXPORT_DATA(extern const char*) wxRadioBoxNameStr; | |
22 | ||
23 | // List box item | |
24 | class WXDLLEXPORT wxBitmap ; | |
25 | ||
26 | class WXDLLEXPORT wxRadioBox: public wxControl | |
27 | { | |
28 | DECLARE_DYNAMIC_CLASS(wxRadioBox) | |
29 | public: | |
30 | wxRadioBox(void); | |
31 | ||
32 | #if WXWIN_COMPATIBILITY | |
33 | wxRadioBox(wxWindow *parent, wxFunction func, const char *title, | |
34 | int x = -1, int y = -1, int width = -1, int height = -1, | |
35 | int n = 0, char **choices = NULL, | |
36 | int majorDim = 0, long style = wxRA_HORIZONTAL, const char *name = wxRadioBoxNameStr); | |
37 | ||
38 | /* | |
39 | inline wxRadioBox(wxWindow *parent, wxFunction func, const char *title, | |
40 | int x, int y, int width, int height, | |
41 | int n, wxBitmap **choices, | |
42 | int majorDim = 0, long style = wxRA_HORIZONTAL, const char *name = wxRadioBoxNameStr) | |
43 | { | |
44 | Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), n, (const wxBitmap **)choices, majorDim, style, | |
45 | wxDefaultValidator, name); | |
46 | Callback(func); | |
47 | } | |
48 | */ | |
49 | ||
50 | #endif | |
51 | ||
debe6624 | 52 | inline wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, |
2bda0e17 | 53 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, |
debe6624 JS |
54 | int n = 0, const wxString choices[] = NULL, |
55 | int majorDim = 0, long style = wxRA_HORIZONTAL, | |
2bda0e17 KB |
56 | const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr) |
57 | { | |
58 | Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name); | |
59 | } | |
60 | ||
61 | /* | |
debe6624 | 62 | wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, |
2bda0e17 | 63 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, |
debe6624 JS |
64 | int n = 0, const wxBitmap *choices[] = NULL, |
65 | int majorDim = 0, long style = wxRA_HORIZONTAL, | |
2bda0e17 KB |
66 | const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr) |
67 | { | |
68 | Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name); | |
69 | } | |
70 | */ | |
71 | ||
72 | ~wxRadioBox(void); | |
73 | ||
debe6624 | 74 | bool Create(wxWindow *parent, wxWindowID id, const wxString& title, |
2bda0e17 | 75 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, |
debe6624 JS |
76 | int n = 0, const wxString choices[] = NULL, |
77 | int majorDim = 0, long style = wxRA_HORIZONTAL, | |
2bda0e17 KB |
78 | const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr); |
79 | ||
80 | /* | |
debe6624 | 81 | bool Create(wxWindow *parent, wxWindowID id, const wxString& title, |
2bda0e17 | 82 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, |
debe6624 JS |
83 | int n = 0, const wxBitmap *choices[] = NULL, |
84 | int majorDim = 0, long style = wxRA_HORIZONTAL, | |
2bda0e17 KB |
85 | const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr); |
86 | */ | |
87 | ||
debe6624 JS |
88 | virtual bool MSWCommand(WXUINT param, WXWORD id); |
89 | virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, | |
2bda0e17 KB |
90 | WXUINT message, WXWPARAM wParam, WXLPARAM lParam); |
91 | ||
92 | int FindString(const wxString& s) const; | |
debe6624 | 93 | void SetSelection(int N); |
2bda0e17 | 94 | int GetSelection(void) const; |
debe6624 | 95 | wxString GetString(int N) const; |
4fabb575 | 96 | |
debe6624 | 97 | void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); |
4fabb575 JS |
98 | void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) |
99 | { wxWindow::SetSize(rect, sizeFlags); } | |
100 | void SetSize(const wxSize& size) { wxWindow::SetSize(size); } | |
101 | ||
2bda0e17 | 102 | void GetSize(int *x, int *y) const; |
4fabb575 JS |
103 | wxSize GetSize() const { return wxWindow::GetSize(); } |
104 | ||
2bda0e17 | 105 | void GetPosition(int *x, int *y) const; |
4fabb575 JS |
106 | wxPoint GetPosition() const { return wxWindow::GetPosition(); } |
107 | ||
2bda0e17 KB |
108 | wxString GetLabel(void) const; |
109 | void SetLabel(const wxString& label); | |
debe6624 JS |
110 | void SetLabel(int item, const wxString& label) ; |
111 | void SetLabel(int item, wxBitmap *bitmap) ; | |
112 | wxString GetLabel(int item) const; | |
113 | bool Show(bool show); | |
2bda0e17 | 114 | void SetFocus(void); |
debe6624 JS |
115 | void Enable(bool enable); |
116 | void Enable(int item, bool enable); | |
117 | void Show(int item, bool show) ; | |
2bda0e17 KB |
118 | inline void SetLabelFont(const wxFont& WXUNUSED(font)) {}; |
119 | inline void SetButtonFont(const wxFont& font) { SetFont(font); } | |
120 | ||
121 | virtual wxString GetStringSelection(void) const; | |
122 | virtual bool SetStringSelection(const wxString& s); | |
123 | inline virtual int Number(void) const { return m_noItems; } ; | |
124 | void Command(wxCommandEvent& event); | |
125 | ||
126 | inline int GetNumberOfRowsOrCols(void) const { return m_noRowsOrCols; } | |
debe6624 | 127 | inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; } |
2bda0e17 KB |
128 | |
129 | // Implementation | |
130 | inline WXHWND *GetRadioButtons(void) const { return m_radioButtons; } | |
131 | bool ContainsHWND(WXHWND hWnd) const ; | |
132 | ||
9c331ded JS |
133 | long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); |
134 | ||
2bda0e17 KB |
135 | protected: |
136 | WXHWND * m_radioButtons; | |
137 | int m_majorDim ; | |
138 | int * m_radioWidth ; // for bitmaps | |
139 | int * m_radioHeight ; | |
140 | ||
141 | int m_noItems; | |
142 | int m_noRowsOrCols; | |
143 | int m_selectedButton; | |
144 | ||
145 | }; | |
146 | ||
147 | #endif | |
bbcdf8bc | 148 | // _WX_RADIOBOX_H_ |