1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxRadioBox declaration
4 // Author: Vadim Zeitlin
8 // Copyright: (c) Vadim Zeitlin
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_RADIOBOX_H_BASE_
13 #define _WX_RADIOBOX_H_BASE_
17 #include "wx/ctrlsub.h"
21 #include "wx/dynarray.h"
23 class WXDLLIMPEXP_FWD_CORE wxToolTip
;
25 WX_DEFINE_EXPORTED_ARRAY_PTR(wxToolTip
*, wxToolTipArray
);
27 #endif // wxUSE_TOOLTIPS
29 extern WXDLLIMPEXP_DATA_CORE(const char) wxRadioBoxNameStr
[];
31 // ----------------------------------------------------------------------------
32 // wxRadioBoxBase is not a normal base class, but rather a mix-in because the
33 // real wxRadioBox derives from different classes on different platforms: for
34 // example, it is a wxStaticBox in wxUniv and wxMSW but not in other ports
35 // ----------------------------------------------------------------------------
37 class WXDLLIMPEXP_CORE wxRadioBoxBase
: public wxItemContainerImmutable
40 virtual ~wxRadioBoxBase();
42 // change/query the individual radio button state
43 virtual bool Enable(unsigned int n
, bool enable
= true) = 0;
44 virtual bool Show(unsigned int n
, bool show
= true) = 0;
45 virtual bool IsItemEnabled(unsigned int n
) const = 0;
46 virtual bool IsItemShown(unsigned int n
) const = 0;
48 // return number of columns/rows in this radiobox
49 unsigned int GetColumnCount() const { return m_numCols
; }
50 unsigned int GetRowCount() const { return m_numRows
; }
52 // return the next active (i.e. shown and not disabled) item above/below/to
53 // the left/right of the given one
54 int GetNextItem(int item
, wxDirection dir
, long style
) const;
57 // set the tooltip text for a radio item, empty string unsets any tooltip
58 void SetItemToolTip(unsigned int item
, const wxString
& text
);
60 // get the individual items tooltip; returns NULL if none
61 wxToolTip
*GetItemToolTip(unsigned int item
) const
62 { return m_itemsTooltips
? (*m_itemsTooltips
)[item
] : NULL
; }
63 #endif // wxUSE_TOOLTIPS
66 // set helptext for a particular item, pass an empty string to erase it
67 void SetItemHelpText(unsigned int n
, const wxString
& helpText
);
69 // retrieve helptext for a particular item, empty string means no help text
70 wxString
GetItemHelpText(unsigned int n
) const;
72 // just silently ignore the help text, it's better than requiring using
73 // conditional compilation in all code using this function
74 void SetItemHelpText(unsigned int WXUNUSED(n
),
75 const wxString
& WXUNUSED(helpText
))
80 // returns the radio item at the given position or wxNOT_FOUND if none
81 // (currently implemented only under MSW and GTK)
82 virtual int GetItemFromPoint(const wxPoint
& WXUNUSED(pt
)) const
96 m_itemsTooltips
= NULL
;
97 #endif // wxUSE_TOOLTIPS
100 virtual wxBorder
GetDefaultBorder() const { return wxBORDER_NONE
; }
102 // return the number of items in major direction (which depends on whether
103 // we have wxRA_SPECIFY_COLS or wxRA_SPECIFY_ROWS style)
104 unsigned int GetMajorDim() const { return m_majorDim
; }
106 // sets m_majorDim and also updates m_numCols/Rows
108 // the style parameter should be the style of the radiobox itself
109 void SetMajorDim(unsigned int majorDim
, long style
);
112 // called from SetItemToolTip() to really set the tooltip for the specified
113 // item in the box (or, if tooltip is NULL, to remove any existing one).
115 // NB: this function should really be pure virtual but to avoid breaking
116 // the build of the ports for which it's not implemented yet we provide
117 // an empty stub in the base class for now
118 virtual void DoSetItemToolTip(unsigned int item
, wxToolTip
*tooltip
);
120 // returns true if we have any item tooltips
121 bool HasItemToolTips() const { return m_itemsTooltips
!= NULL
; }
122 #endif // wxUSE_TOOLTIPS
125 // Retrieve help text for an item: this is a helper for the implementation
126 // of wxWindow::GetHelpTextAtPoint() in the real radiobox class
127 wxString
DoGetHelpTextAtPoint(const wxWindow
*derived
,
129 wxHelpEvent::Origin origin
) const;
133 // the number of elements in major dimension (i.e. number of columns if
134 // wxRA_SPECIFY_COLS or the number of rows if wxRA_SPECIFY_ROWS) and also
135 // the number of rows/columns calculated from it
136 unsigned int m_majorDim
,
141 // array of tooltips for the individual items
143 // this array is initially NULL and initialized on first use
144 wxToolTipArray
*m_itemsTooltips
;
148 // help text associated with a particular item or empty string if none
149 wxArrayString m_itemsHelpTexts
;
153 #if defined(__WXUNIVERSAL__)
154 #include "wx/univ/radiobox.h"
155 #elif defined(__WXMSW__)
156 #include "wx/msw/radiobox.h"
157 #elif defined(__WXMOTIF__)
158 #include "wx/motif/radiobox.h"
159 #elif defined(__WXGTK20__)
160 #include "wx/gtk/radiobox.h"
161 #elif defined(__WXGTK__)
162 #include "wx/gtk1/radiobox.h"
163 #elif defined(__WXMAC__)
164 #include "wx/osx/radiobox.h"
165 #elif defined(__WXCOCOA__)
166 #include "wx/cocoa/radiobox.h"
167 #elif defined(__WXPM__)
168 #include "wx/os2/radiobox.h"
169 #elif defined(__WXPALMOS__)
170 #include "wx/palmos/radiobox.h"
173 #endif // wxUSE_RADIOBOX
175 #endif // _WX_RADIOBOX_H_BASE_