]>
Commit | Line | Data |
---|---|---|
9b6dbb09 | 1 | ///////////////////////////////////////////////////////////////////////////// |
853dcc57 | 2 | // Name: wx/motif/radiobox.h |
9b6dbb09 JS |
3 | // Purpose: wxRadioBox class |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
65571936 | 9 | // Licence: wxWindows licence |
9b6dbb09 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
4b4f6e0f VZ |
12 | #ifndef _WX_MOTIF_RADIOBOX_H_ |
13 | #define _WX_MOTIF_RADIOBOX_H_ | |
9b6dbb09 | 14 | |
3bdb8629 MB |
15 | #ifndef wxWIDGET_ARRAY_DEFINED |
16 | #define wxWIDGET_ARRAY_DEFINED | |
9b6dbb09 | 17 | |
3bdb8629 | 18 | #include "wx/dynarray.h" |
4b4f6e0f VZ |
19 | WX_DEFINE_ARRAY_PTR(WXWidget, wxWidgetArray); |
20 | #endif // wxWIDGET_ARRAY_DEFINED | |
3bdb8629 MB |
21 | |
22 | #include "wx/arrstr.h" | |
9b6dbb09 | 23 | |
53a2db12 | 24 | class WXDLLIMPEXP_CORE wxRadioBox : public wxControl, public wxRadioBoxBase |
9b6dbb09 | 25 | { |
9b6dbb09 | 26 | public: |
3bdb8629 | 27 | wxRadioBox() { Init(); } |
6b0d8a01 | 28 | |
bfc6fde4 | 29 | wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, |
3bdb8629 MB |
30 | const wxPoint& pos = wxDefaultPosition, |
31 | const wxSize& size = wxDefaultSize, | |
32 | int n = 0, const wxString choices[] = NULL, | |
33 | int majorDim = 0, long style = wxRA_HORIZONTAL, | |
34 | const wxValidator& val = wxDefaultValidator, | |
35 | const wxString& name = wxRadioBoxNameStr) | |
bfc6fde4 | 36 | { |
3bdb8629 MB |
37 | Init(); |
38 | ||
39 | Create(parent, id, title, pos, size, n, choices, | |
40 | majorDim, style, val, name); | |
bfc6fde4 | 41 | } |
6b0d8a01 | 42 | |
584ad2a3 MB |
43 | wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, |
44 | const wxPoint& pos, | |
45 | const wxSize& size, | |
46 | const wxArrayString& choices, | |
47 | int majorDim = 0, long style = wxRA_HORIZONTAL, | |
48 | const wxValidator& val = wxDefaultValidator, | |
49 | const wxString& name = wxRadioBoxNameStr) | |
50 | { | |
51 | Init(); | |
52 | ||
53 | Create(parent, id, title, pos, size, choices, | |
54 | majorDim, style, val, name); | |
55 | } | |
56 | ||
d3c7fc99 | 57 | virtual ~wxRadioBox(); |
6b0d8a01 | 58 | |
bfc6fde4 | 59 | bool Create(wxWindow *parent, wxWindowID id, const wxString& title, |
3bdb8629 MB |
60 | const wxPoint& pos = wxDefaultPosition, |
61 | const wxSize& size = wxDefaultSize, | |
62 | int n = 0, const wxString choices[] = NULL, | |
63 | int majorDim = 0, long style = wxRA_HORIZONTAL, | |
64 | const wxValidator& val = wxDefaultValidator, | |
65 | const wxString& name = wxRadioBoxNameStr); | |
6b0d8a01 | 66 | |
584ad2a3 MB |
67 | bool Create(wxWindow *parent, wxWindowID id, const wxString& title, |
68 | const wxPoint& pos, | |
69 | const wxSize& size, | |
70 | const wxArrayString& choices, | |
71 | int majorDim = 0, long style = wxRA_HORIZONTAL, | |
72 | const wxValidator& val = wxDefaultValidator, | |
73 | const wxString& name = wxRadioBoxNameStr); | |
74 | ||
7a952d4c WS |
75 | // Enabling |
76 | virtual bool Enable(bool enable = true); | |
77 | virtual bool Enable(unsigned int item, bool enable = true); | |
78 | virtual bool IsItemEnabled(unsigned int WXUNUSED(n)) const | |
79 | { | |
80 | /* TODO */ | |
81 | return true; | |
82 | } | |
83 | ||
84 | // Showing | |
85 | virtual bool Show(bool show = true); | |
86 | virtual bool Show(unsigned int item, bool show = true); | |
87 | virtual bool IsItemShown(unsigned int WXUNUSED(n)) const | |
88 | { | |
89 | /* TODO */ | |
90 | return true; | |
91 | } | |
92 | ||
aa61d352 | 93 | virtual void SetSelection(int n); |
bfc6fde4 | 94 | int GetSelection() const; |
6b0d8a01 | 95 | |
aa61d352 VZ |
96 | virtual void SetString(unsigned int item, const wxString& label); |
97 | virtual wxString GetString(unsigned int item) const; | |
6b0d8a01 | 98 | |
bfc6fde4 VZ |
99 | virtual wxString GetStringSelection() const; |
100 | virtual bool SetStringSelection(const wxString& s); | |
aa61d352 | 101 | virtual unsigned int GetCount() const { return m_noItems; } ; |
bfc6fde4 | 102 | void Command(wxCommandEvent& event); |
6b0d8a01 | 103 | |
bfc6fde4 VZ |
104 | int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; } |
105 | void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; } | |
6b0d8a01 | 106 | |
bfc6fde4 | 107 | // Implementation |
96be256b | 108 | virtual void ChangeFont(bool keepOriginalSize = true); |
bfc6fde4 VZ |
109 | virtual void ChangeBackgroundColour(); |
110 | virtual void ChangeForegroundColour(); | |
3bdb8629 | 111 | const wxWidgetArray& GetRadioButtons() const { return m_radioButtons; } |
3dd709d8 MB |
112 | void SetSel(int i) { m_selectedButton = i; } |
113 | virtual WXWidget GetLabelWidget() const { return m_labelWidget; } | |
6b0d8a01 | 114 | |
9b6dbb09 | 115 | protected: |
677dc0ed | 116 | virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } |
4b4f6e0f VZ |
117 | virtual void DoSetSize(int x, int y, |
118 | int width, int height, | |
119 | int sizeFlags = wxSIZE_AUTO); | |
120 | ||
aa61d352 | 121 | unsigned int m_noItems; |
bfc6fde4 VZ |
122 | int m_noRowsOrCols; |
123 | int m_selectedButton; | |
6b0d8a01 | 124 | |
3bdb8629 | 125 | wxWidgetArray m_radioButtons; |
3dd709d8 | 126 | WXWidget m_labelWidget; |
3bdb8629 | 127 | wxArrayString m_radioButtonLabels; |
6b0d8a01 | 128 | |
4b4f6e0f VZ |
129 | private: |
130 | void Init(); | |
131 | ||
4b4f6e0f | 132 | DECLARE_DYNAMIC_CLASS(wxRadioBox) |
9b6dbb09 JS |
133 | }; |
134 | ||
4b4f6e0f | 135 | #endif // _WX_MOTIF_RADIOBOX_H_ |