]>
Commit | Line | Data |
---|---|---|
ffecfa5a JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/palmos/radiobox.h | |
3 | // Purpose: wxRadioBox class | |
e1d63b79 | 4 | // Author: William Osborne - minimal working wxPalmOS port |
a152561c | 5 | // Modified by: Wlodzimierz ABX Skiba - native wxRadioBox implementation |
ffecfa5a | 6 | // Created: 10/13/04 |
e1d63b79 | 7 | // RCS-ID: $Id$ |
a152561c | 8 | // Copyright: (c) William Osborne, Wlodzimierz Skiba |
ffecfa5a JS |
9 | // Licence: wxWindows licence |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_RADIOBOX_H_ | |
13 | #define _WX_RADIOBOX_H_ | |
14 | ||
ffecfa5a | 15 | class WXDLLEXPORT wxBitmap; |
1a87edf2 | 16 | class WXDLLEXPORT wxRadioButton; |
ffecfa5a JS |
17 | |
18 | // ---------------------------------------------------------------------------- | |
19 | // wxRadioBox | |
20 | // ---------------------------------------------------------------------------- | |
21 | ||
22 | class WXDLLEXPORT wxRadioBox : public wxControl, public wxRadioBoxBase | |
23 | { | |
24 | public: | |
1a87edf2 WS |
25 | wxRadioBox():m_radios(wxKEY_INTEGER,32) |
26 | { | |
27 | Init(); | |
28 | } | |
ffecfa5a JS |
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, | |
8be10866 | 37 | long style = wxRA_SPECIFY_COLS, |
ffecfa5a JS |
38 | const wxValidator& val = wxDefaultValidator, |
39 | const wxString& name = wxRadioBoxNameStr) | |
1a87edf2 | 40 | :m_radios(wxKEY_INTEGER,n+1) |
ffecfa5a | 41 | { |
1a87edf2 | 42 | Init(); |
ffecfa5a JS |
43 | (void)Create(parent, id, title, pos, size, n, choices, majorDim, |
44 | style, val, name); | |
45 | } | |
1a87edf2 | 46 | |
ffecfa5a JS |
47 | wxRadioBox(wxWindow *parent, |
48 | wxWindowID id, | |
49 | const wxString& title, | |
50 | const wxPoint& pos, | |
51 | const wxSize& size, | |
52 | const wxArrayString& choices, | |
53 | int majorDim = 0, | |
8be10866 | 54 | long style = wxRA_SPECIFY_COLS, |
ffecfa5a JS |
55 | const wxValidator& val = wxDefaultValidator, |
56 | const wxString& name = wxRadioBoxNameStr) | |
1a87edf2 | 57 | :m_radios(wxKEY_INTEGER,choices.GetCount()+1) |
ffecfa5a | 58 | { |
1a87edf2 | 59 | Init(); |
ffecfa5a JS |
60 | (void)Create(parent, id, title, pos, size, choices, majorDim, |
61 | style, val, name); | |
62 | } | |
63 | ||
64 | ~wxRadioBox(); | |
65 | ||
66 | bool Create(wxWindow *parent, | |
67 | wxWindowID id, | |
68 | const wxString& title, | |
69 | const wxPoint& pos = wxDefaultPosition, | |
70 | const wxSize& size = wxDefaultSize, | |
71 | int n = 0, const wxString choices[] = NULL, | |
72 | int majorDim = 0, | |
8be10866 | 73 | long style = wxRA_SPECIFY_COLS, |
ffecfa5a JS |
74 | const wxValidator& val = wxDefaultValidator, |
75 | const wxString& name = wxRadioBoxNameStr); | |
9a727a3b | 76 | |
ffecfa5a JS |
77 | bool Create(wxWindow *parent, |
78 | wxWindowID id, | |
79 | const wxString& title, | |
80 | const wxPoint& pos, | |
81 | const wxSize& size, | |
82 | const wxArrayString& choices, | |
83 | int majorDim = 0, | |
8be10866 | 84 | long style = wxRA_SPECIFY_COLS, |
ffecfa5a JS |
85 | const wxValidator& val = wxDefaultValidator, |
86 | const wxString& name = wxRadioBoxNameStr); | |
87 | ||
88 | // implement the radiobox interface | |
89 | virtual void SetSelection(int n); | |
90 | virtual int GetSelection() const; | |
91 | virtual int GetCount() const; | |
92 | virtual wxString GetString(int n) const; | |
93 | virtual void SetString(int n, const wxString& label); | |
11f4a344 WS |
94 | |
95 | virtual bool Enable(bool enable = true); | |
1a87edf2 | 96 | virtual bool Enable(int n, bool enable = true); |
11f4a344 WS |
97 | |
98 | virtual bool Show(bool show = true); | |
fa50c0e3 | 99 | virtual bool Show(int n, bool show = true); |
11f4a344 WS |
100 | |
101 | virtual void SetLabel(const wxString& label); | |
102 | virtual wxString GetLabel(); | |
103 | ||
1a87edf2 WS |
104 | virtual void DoGetPosition( int *x, int *y ) const; |
105 | virtual void DoGetSize( int *width, int *height ) const; | |
106 | virtual void DoMoveWindow(int x, int y, int width, int height); | |
107 | ||
108 | virtual wxPoint GetClientAreaOrigin() const; | |
109 | ||
ffecfa5a | 110 | void SetFocus(); |
ffecfa5a JS |
111 | void SetLabelFont(const wxFont& WXUNUSED(font)) {}; |
112 | void SetButtonFont(const wxFont& font) { SetFont(font); } | |
113 | ||
11f4a344 WS |
114 | virtual void Refresh( bool eraseBackground = true, |
115 | const wxRect *rect = NULL ); | |
116 | ||
ffecfa5a JS |
117 | void Command(wxCommandEvent& event); |
118 | ||
119 | int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; } | |
120 | void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; } | |
121 | ||
122 | // implementation only from now on | |
123 | // ------------------------------- | |
124 | ||
ffecfa5a JS |
125 | virtual bool SetFont(const wxFont& font); |
126 | ||
ffecfa5a JS |
127 | void SendNotificationEvent(); |
128 | ||
ffecfa5a JS |
129 | protected: |
130 | // we can't compute our best size before the items are added to the control | |
131 | virtual void SetInitialBestSize(const wxSize& WXUNUSED(size)) { } | |
132 | ||
ffecfa5a JS |
133 | // get the max size of radio buttons |
134 | wxSize GetMaxButtonSize() const; | |
135 | ||
136 | // get the total size occupied by the radio box buttons | |
137 | wxSize GetTotalButtonSize(const wxSize& sizeBtn) const; | |
138 | ||
ffecfa5a JS |
139 | int * m_radioWidth; // for bitmaps |
140 | int * m_radioHeight; | |
141 | ||
142 | int m_noItems; | |
143 | int m_noRowsOrCols; | |
144 | int m_selectedButton; | |
145 | ||
ffecfa5a JS |
146 | virtual wxSize DoGetBestSize() const; |
147 | ||
148 | private: | |
1a87edf2 WS |
149 | |
150 | void Init(); | |
17fb3524 | 151 | wxRadioButton *GetRadioButton(int i) const; |
1a87edf2 WS |
152 | |
153 | wxPoint m_pos; | |
154 | wxSize m_size; | |
155 | wxHashTable m_radios; | |
156 | ||
ffecfa5a JS |
157 | DECLARE_DYNAMIC_CLASS(wxRadioBox) |
158 | DECLARE_NO_COPY_CLASS(wxRadioBox) | |
159 | }; | |
160 | ||
161 | #endif | |
162 | // _WX_RADIOBOX_H_ |