]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/radiobox.h
Build/distrib updates
[wxWidgets.git] / include / wx / motif / radiobox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: radiobox.h
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
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_MOTIF_RADIOBOX_H_
13 #define _WX_MOTIF_RADIOBOX_H_
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "radiobox.h"
17 #endif
18
19 #ifndef wxWIDGET_ARRAY_DEFINED
20 #define wxWIDGET_ARRAY_DEFINED
21
22 #include "wx/dynarray.h"
23 WX_DEFINE_ARRAY_PTR(WXWidget, wxWidgetArray);
24 #endif // wxWIDGET_ARRAY_DEFINED
25
26 #include "wx/arrstr.h"
27
28 class WXDLLEXPORT wxRadioBox : public wxControl, public wxRadioBoxBase
29 {
30 public:
31 wxRadioBox() { Init(); }
32
33 wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title,
34 const wxPoint& pos = wxDefaultPosition,
35 const wxSize& size = wxDefaultSize,
36 int n = 0, const wxString choices[] = NULL,
37 int majorDim = 0, long style = wxRA_HORIZONTAL,
38 const wxValidator& val = wxDefaultValidator,
39 const wxString& name = wxRadioBoxNameStr)
40 {
41 Init();
42
43 Create(parent, id, title, pos, size, n, choices,
44 majorDim, style, val, name);
45 }
46
47 wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title,
48 const wxPoint& pos,
49 const wxSize& size,
50 const wxArrayString& choices,
51 int majorDim = 0, long style = wxRA_HORIZONTAL,
52 const wxValidator& val = wxDefaultValidator,
53 const wxString& name = wxRadioBoxNameStr)
54 {
55 Init();
56
57 Create(parent, id, title, pos, size, choices,
58 majorDim, style, val, name);
59 }
60
61 ~wxRadioBox();
62
63 bool Create(wxWindow *parent, wxWindowID id, const wxString& title,
64 const wxPoint& pos = wxDefaultPosition,
65 const wxSize& size = wxDefaultSize,
66 int n = 0, const wxString choices[] = NULL,
67 int majorDim = 0, long style = wxRA_HORIZONTAL,
68 const wxValidator& val = wxDefaultValidator,
69 const wxString& name = wxRadioBoxNameStr);
70
71 bool Create(wxWindow *parent, wxWindowID id, const wxString& title,
72 const wxPoint& pos,
73 const wxSize& size,
74 const wxArrayString& choices,
75 int majorDim = 0, long style = wxRA_HORIZONTAL,
76 const wxValidator& val = wxDefaultValidator,
77 const wxString& name = wxRadioBoxNameStr);
78
79 int FindString(const wxString& s) const;
80 void SetSelection(int N);
81 int GetSelection() const;
82
83 void SetString(int item, const wxString& label) ;
84 wxString GetString(int item) const;
85 virtual bool Enable(bool enable = true);
86 virtual bool Enable(int item, bool enable = true);
87 virtual bool Show(int item, bool show = true);
88 virtual bool Show(bool show = true);
89
90 virtual wxString GetStringSelection() const;
91 virtual bool SetStringSelection(const wxString& s);
92 virtual int GetCount() const { return m_noItems; } ;
93 void Command(wxCommandEvent& event);
94
95 int GetColumnCount() const;
96 int GetRowCount() const;
97
98 int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
99 void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
100
101 // Implementation
102 virtual void ChangeFont(bool keepOriginalSize = true);
103 virtual void ChangeBackgroundColour();
104 virtual void ChangeForegroundColour();
105 const wxWidgetArray& GetRadioButtons() const { return m_radioButtons; }
106 void SetSel(int i) { m_selectedButton = i; }
107 virtual WXWidget GetLabelWidget() const { return m_labelWidget; }
108
109 protected:
110 virtual void DoSetSize(int x, int y,
111 int width, int height,
112 int sizeFlags = wxSIZE_AUTO);
113
114 int m_majorDim;
115 int m_noItems;
116 int m_noRowsOrCols;
117 int m_selectedButton;
118
119 wxWidgetArray m_radioButtons;
120 WXWidget m_labelWidget;
121 wxArrayString m_radioButtonLabels;
122
123 private:
124 void Init();
125
126 DECLARE_DYNAMIC_CLASS(wxRadioBox)
127 };
128
129 #endif // _WX_MOTIF_RADIOBOX_H_
130