]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/radiobox.h
moved wxNotebook::HitTest() to the base book control class; implemented it for wxList...
[wxWidgets.git] / include / wx / radiobox.h
... / ...
CommitLineData
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$
8// Copyright: (c) Vadim Zeitlin
9// Licence: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_RADIOBOX_H_BASE_
13#define _WX_RADIOBOX_H_BASE_
14
15#if wxUSE_RADIOBOX
16
17#include "wx/ctrlsub.h"
18
19#if wxUSE_TOOLTIPS
20
21#include "wx/dynarray.h"
22
23class WXDLLEXPORT wxToolTip;
24
25WX_DEFINE_EXPORTED_ARRAY_PTR(wxToolTip *, wxToolTipArray);
26
27#endif // wxUSE_TOOLTIPS
28
29extern WXDLLEXPORT_DATA(const wxChar) wxRadioBoxNameStr[];
30
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// ----------------------------------------------------------------------------
36
37class WXDLLEXPORT wxRadioBoxBase : public wxItemContainerImmutable
38{
39public:
40 virtual ~wxRadioBoxBase();
41
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;
47
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; }
51
52 // return the item above/below/to the left/right of the given one
53 int GetNextItem(int item, wxDirection dir, long style) const;
54
55#if wxUSE_TOOLTIPS
56 // set the tooltip text for a radio item, empty string unsets any tooltip
57 void SetItemToolTip(unsigned int item, const wxString& text);
58
59 // get the individual items tooltip; returns NULL if none
60 wxToolTip *GetItemToolTip(unsigned int item) const
61 { return m_itemsTooltips ? (*m_itemsTooltips)[item] : NULL; }
62#endif // wxUSE_TOOLTIPS
63
64 // deprecated functions
65 // --------------------
66
67#if WXWIN_COMPATIBILITY_2_4
68 wxDEPRECATED( int GetNumberOfRowsOrCols() const );
69 wxDEPRECATED( void SetNumberOfRowsOrCols(int n) );
70#endif // WXWIN_COMPATIBILITY_2_4
71
72protected:
73 wxRadioBoxBase()
74 {
75 m_majorDim = 0;
76
77#if wxUSE_TOOLTIPS
78 m_itemsTooltips = NULL;
79#endif // wxUSE_TOOLTIPS
80 }
81
82 // return the number of items in major direction (which depends on whether
83 // we have wxRA_SPECIFY_COLS or wxRA_SPECIFY_ROWS style)
84 unsigned int GetMajorDim() const { return m_majorDim; }
85
86 // sets m_majorDim and also updates m_numCols/Rows
87 //
88 // the style parameter should be the style of the radiobox itself
89 void SetMajorDim(unsigned int majorDim, long style);
90
91#if wxUSE_TOOLTIPS
92 // called from SetItemToolTip() to really set the tooltip for the specified
93 // item in the box (or, if tooltip is NULL, to remove any existing one).
94 //
95 // NB: this function should really be pure virtual but to avoid breaking
96 // the build of the ports for which it's not implemented yet we provide
97 // an empty stub in the base class for now
98 virtual void DoSetItemToolTip(unsigned int item, wxToolTip *tooltip);
99
100 // returns true if we have any item tooltips
101 bool HasItemToolTips() const { return m_itemsTooltips != NULL; }
102#endif // wxUSE_TOOLTIPS
103
104private:
105 // the number of elements in major dimension (i.e. number of columns if
106 // wxRA_SPECIFY_COLS or the number of rows if wxRA_SPECIFY_ROWS) and also
107 // the number of rows/columns calculated from it
108 unsigned int m_majorDim,
109 m_numCols,
110 m_numRows;
111
112#if wxUSE_TOOLTIPS
113 // array of tooltips for the individual items
114 //
115 // this array is initially NULL and initialized on first use
116 wxToolTipArray *m_itemsTooltips;
117#endif
118};
119
120#if defined(__WXUNIVERSAL__)
121 #include "wx/univ/radiobox.h"
122#elif defined(__WXMSW__)
123 #include "wx/msw/radiobox.h"
124#elif defined(__WXMOTIF__)
125 #include "wx/motif/radiobox.h"
126#elif defined(__WXGTK20__)
127 #include "wx/gtk/radiobox.h"
128#elif defined(__WXGTK__)
129 #include "wx/gtk1/radiobox.h"
130#elif defined(__WXMAC__)
131 #include "wx/mac/radiobox.h"
132#elif defined(__WXCOCOA__)
133 #include "wx/cocoa/radiobox.h"
134#elif defined(__WXPM__)
135 #include "wx/os2/radiobox.h"
136#elif defined(__WXPALMOS__)
137 #include "wx/palmos/radiobox.h"
138#endif
139
140#endif // wxUSE_RADIOBOX
141
142#endif
143 // _WX_RADIOBOX_H_BASE_