]>
Commit | Line | Data |
---|---|---|
1e6feb95 VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/radiobox.h | |
3 | // Purpose: wxRadioBox declaration | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 10.09.00 | |
7 | // RCS-ID: $Id$ | |
77ffb593 | 8 | // Copyright: (c) wxWidgets team |
65571936 | 9 | // Licence: wxWindows licence |
1e6feb95 VZ |
10 | /////////////////////////////////////////////////////////////////////////////// |
11 | ||
34138703 JS |
12 | #ifndef _WX_RADIOBOX_H_BASE_ |
13 | #define _WX_RADIOBOX_H_BASE_ | |
c801d85f | 14 | |
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
1e6feb95 VZ |
16 | #pragma interface "radioboxbase.h" |
17 | #endif | |
18 | ||
19 | #if wxUSE_RADIOBOX | |
20 | ||
21 | #include "wx/control.h" | |
22 | ||
23 | WXDLLEXPORT_DATA(extern const wxChar*) wxRadioBoxNameStr; | |
24 | ||
25 | // ---------------------------------------------------------------------------- | |
26 | // wxRadioBoxBase is not a normal base class, but rather a mix-in because the | |
27 | // real wxRadioBox derives from different classes on different platforms: for | |
aca49b79 | 28 | // example, it is a wxStaticBox in wxUniv and wxMSW but not in other ports |
1e6feb95 VZ |
29 | // ---------------------------------------------------------------------------- |
30 | ||
31 | class WXDLLEXPORT wxRadioBoxBase | |
32 | { | |
33 | public: | |
34 | // selection | |
35 | virtual void SetSelection(int n) = 0; | |
36 | virtual int GetSelection() const = 0; | |
37 | ||
38 | virtual wxString GetStringSelection() const | |
39 | { | |
40 | wxString s; | |
41 | int sel = GetSelection(); | |
42 | if ( sel != wxNOT_FOUND ) | |
43 | s = GetString(sel); | |
44 | ||
45 | return s; | |
46 | } | |
47 | ||
48 | virtual bool SetStringSelection(const wxString& s) | |
49 | { | |
50 | int sel = FindString(s); | |
51 | if ( sel != wxNOT_FOUND ) | |
52 | { | |
53 | SetSelection(sel); | |
54 | ||
701a0b47 | 55 | return true; |
1e6feb95 VZ |
56 | } |
57 | ||
701a0b47 | 58 | return false; |
1e6feb95 VZ |
59 | } |
60 | ||
61 | // string access | |
62 | virtual int GetCount() const = 0; | |
63 | virtual int FindString(const wxString& s) const | |
64 | { | |
65 | int count = GetCount(); | |
66 | for ( int n = 0; n < count; n++ ) | |
67 | { | |
68 | if ( GetString(n) == s ) | |
69 | return n; | |
70 | } | |
71 | ||
72 | return wxNOT_FOUND; | |
73 | } | |
74 | ||
75 | virtual wxString GetString(int n) const = 0; | |
76 | virtual void SetString(int n, const wxString& label) = 0; | |
77 | ||
78 | // change the individual radio button state | |
701a0b47 WS |
79 | virtual void Enable(int n, bool enable = true) = 0; |
80 | virtual void Show(int n, bool show = true) = 0; | |
1e6feb95 VZ |
81 | |
82 | // layout parameters | |
83 | virtual int GetColumnCount() const = 0; | |
84 | virtual int GetRowCount() const = 0; | |
85 | ||
86 | // return the item above/below/to the left/right of the given one | |
87 | int GetNextItem(int item, wxDirection dir, long style) const; | |
88 | ||
bd0a76e2 VZ |
89 | |
90 | // deprecated functions | |
91 | // -------------------- | |
92 | ||
93 | #if WXWIN_COMPATIBILITY_2_4 | |
94 | wxDEPRECATED( int GetNumberOfRowsOrCols() const ); | |
95 | wxDEPRECATED( void SetNumberOfRowsOrCols(int n) ); | |
96 | #endif // WXWIN_COMPATIBILITY_2_4 | |
97 | ||
1e6feb95 | 98 | // for compatibility only, don't use these methods in new code! |
1d79bd3e | 99 | #if WXWIN_COMPATIBILITY_2_2 |
1e6feb95 VZ |
100 | int Number() const { return GetCount(); } |
101 | wxString GetLabel(int n) const { return GetString(n); } | |
102 | void SetLabel(int n, const wxString& label) { SetString(n, label); } | |
62e26542 | 103 | #endif // WXWIN_COMPATIBILITY_2_2 |
1e6feb95 VZ |
104 | }; |
105 | ||
106 | #if defined(__WXUNIVERSAL__) | |
107 | #include "wx/univ/radiobox.h" | |
108 | #elif defined(__WXMSW__) | |
109 | #include "wx/msw/radiobox.h" | |
2049ba38 | 110 | #elif defined(__WXMOTIF__) |
1e6feb95 | 111 | #include "wx/motif/radiobox.h" |
2049ba38 | 112 | #elif defined(__WXGTK__) |
1e6feb95 | 113 | #include "wx/gtk/radiobox.h" |
34138703 | 114 | #elif defined(__WXMAC__) |
1e6feb95 | 115 | #include "wx/mac/radiobox.h" |
e64df9bc DE |
116 | #elif defined(__WXCOCOA__) |
117 | #include "wx/cocoa/radiobox.h" | |
1777b9bb | 118 | #elif defined(__WXPM__) |
1e6feb95 | 119 | #include "wx/os2/radiobox.h" |
c801d85f KB |
120 | #endif |
121 | ||
1e6feb95 VZ |
122 | #endif // wxUSE_RADIOBOX |
123 | ||
c801d85f | 124 | #endif |
34138703 | 125 | // _WX_RADIOBOX_H_BASE_ |