]>
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 | ||
15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
16 | #pragma interface "radiobox.h" | |
17 | #endif | |
18 | ||
19 | class WXDLLEXPORT wxBitmap; | |
20 | ||
21 | // ---------------------------------------------------------------------------- | |
22 | // wxRadioBox | |
23 | // ---------------------------------------------------------------------------- | |
24 | ||
25 | class WXDLLEXPORT wxRadioBox : public wxControl, public wxRadioBoxBase | |
26 | { | |
27 | public: | |
28 | wxRadioBox(); | |
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) | |
40 | { | |
41 | (void)Create(parent, id, title, pos, size, n, choices, majorDim, | |
42 | style, val, name); | |
43 | } | |
44 | wxRadioBox(wxWindow *parent, | |
45 | wxWindowID id, | |
46 | const wxString& title, | |
47 | const wxPoint& pos, | |
48 | const wxSize& size, | |
49 | const wxArrayString& choices, | |
50 | int majorDim = 0, | |
8be10866 | 51 | long style = wxRA_SPECIFY_COLS, |
ffecfa5a JS |
52 | const wxValidator& val = wxDefaultValidator, |
53 | const wxString& name = wxRadioBoxNameStr) | |
54 | { | |
55 | (void)Create(parent, id, title, pos, size, choices, majorDim, | |
56 | style, val, name); | |
57 | } | |
58 | ||
59 | ~wxRadioBox(); | |
60 | ||
61 | bool Create(wxWindow *parent, | |
62 | wxWindowID id, | |
63 | 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, | |
8be10866 | 68 | long style = wxRA_SPECIFY_COLS, |
ffecfa5a JS |
69 | const wxValidator& val = wxDefaultValidator, |
70 | const wxString& name = wxRadioBoxNameStr); | |
9a727a3b | 71 | |
ffecfa5a JS |
72 | bool Create(wxWindow *parent, |
73 | wxWindowID id, | |
74 | const wxString& title, | |
75 | const wxPoint& pos, | |
76 | const wxSize& size, | |
77 | const wxArrayString& choices, | |
78 | int majorDim = 0, | |
8be10866 | 79 | long style = wxRA_SPECIFY_COLS, |
ffecfa5a JS |
80 | const wxValidator& val = wxDefaultValidator, |
81 | const wxString& name = wxRadioBoxNameStr); | |
82 | ||
83 | // implement the radiobox interface | |
84 | virtual void SetSelection(int n); | |
85 | virtual int GetSelection() const; | |
86 | virtual int GetCount() const; | |
87 | virtual wxString GetString(int n) const; | |
88 | virtual void SetString(int n, const wxString& label); | |
a152561c WS |
89 | virtual void Enable(int n, bool enable = true); |
90 | virtual void Show(int n, bool show = true); | |
ffecfa5a JS |
91 | virtual int GetColumnCount() const; |
92 | virtual int GetRowCount() const; | |
93 | ||
a152561c | 94 | virtual bool Show(bool show = true); |
ffecfa5a | 95 | void SetFocus(); |
a152561c | 96 | virtual bool Enable(bool enable = true); |
ffecfa5a JS |
97 | void SetLabelFont(const wxFont& WXUNUSED(font)) {}; |
98 | void SetButtonFont(const wxFont& font) { SetFont(font); } | |
99 | ||
100 | void Command(wxCommandEvent& event); | |
101 | ||
102 | int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; } | |
103 | void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; } | |
104 | ||
105 | // implementation only from now on | |
106 | // ------------------------------- | |
107 | ||
ffecfa5a JS |
108 | virtual bool SetFont(const wxFont& font); |
109 | ||
ffecfa5a JS |
110 | void SendNotificationEvent(); |
111 | ||
112 | // get the number of buttons per column/row | |
113 | int GetNumVer() const; | |
114 | int GetNumHor() const; | |
115 | ||
116 | virtual void ApplyParentThemeBackground(const wxColour& bg) | |
117 | { SetBackgroundColour(bg); } | |
118 | ||
119 | protected: | |
120 | // we can't compute our best size before the items are added to the control | |
121 | virtual void SetInitialBestSize(const wxSize& WXUNUSED(size)) { } | |
122 | ||
ffecfa5a JS |
123 | // get the max size of radio buttons |
124 | wxSize GetMaxButtonSize() const; | |
125 | ||
126 | // get the total size occupied by the radio box buttons | |
127 | wxSize GetTotalButtonSize(const wxSize& sizeBtn) const; | |
128 | ||
ffecfa5a JS |
129 | int m_majorDim; |
130 | int * m_radioWidth; // for bitmaps | |
131 | int * m_radioHeight; | |
132 | ||
133 | int m_noItems; | |
134 | int m_noRowsOrCols; | |
135 | int m_selectedButton; | |
136 | ||
137 | virtual void DoSetSize(int x, int y, | |
138 | int width, int height, | |
139 | int sizeFlags = wxSIZE_AUTO); | |
140 | virtual wxSize DoGetBestSize() const; | |
141 | ||
142 | private: | |
143 | DECLARE_DYNAMIC_CLASS(wxRadioBox) | |
144 | DECLARE_NO_COPY_CLASS(wxRadioBox) | |
145 | }; | |
146 | ||
147 | #endif | |
148 | // _WX_RADIOBOX_H_ |