]> git.saurik.com Git - wxWidgets.git/blame - include/wx/radiobox.h
define WXMAKINGDLL_QA when WXMAKINGDLL is defined (patch 1502015)
[wxWidgets.git] / include / wx / radiobox.h
CommitLineData
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$
99d80019 8// Copyright: (c) Vadim Zeitlin
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
1e6feb95
VZ
15#if wxUSE_RADIOBOX
16
8ba7c771 17#include "wx/ctrlsub.h"
1e6feb95 18
c670c855
VZ
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
63ec432b 29extern WXDLLEXPORT_DATA(const wxChar) wxRadioBoxNameStr[];
1e6feb95
VZ
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
aca49b79 34// example, it is a wxStaticBox in wxUniv and wxMSW but not in other ports
1e6feb95
VZ
35// ----------------------------------------------------------------------------
36
8ba7c771 37class WXDLLEXPORT wxRadioBoxBase : public wxItemContainerImmutable
1e6feb95
VZ
38{
39public:
c670c855
VZ
40 virtual ~wxRadioBoxBase();
41
3bfa7be9 42 // change/query the individual radio button state
aa61d352
VZ
43 virtual bool Enable(unsigned int n, bool enable = true) = 0;
44 virtual bool Show(unsigned int n, bool show = true) = 0;
7a952d4c
WS
45 virtual bool IsItemEnabled(unsigned int n) const = 0;
46 virtual bool IsItemShown(unsigned int n) const = 0;
3bfa7be9 47
21e0a4d5 48 // return number of columns/rows in this radiobox
aa61d352
VZ
49 unsigned int GetColumnCount() const { return m_numCols; }
50 unsigned int GetRowCount() const { return m_numRows; }
1e6feb95
VZ
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
c670c855
VZ
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
3bfa7be9 63
dc26eeb3
VZ
64#if wxUSE_HELP
65 // set helptext for a particular item, pass an empty string to erase it
66 void SetItemHelpText(unsigned int n, const wxString& helpText);
67
68 // retrieve helptext for a particular item, empty string means no help text
69 wxString GetItemHelpText(unsigned int n) const;
70#else // wxUSE_HELP
71 // just silently ignore the help text, it's better than requiring using
72 // conditional compilation in all code using this function
73 void SetItemHelpText(unsigned int WXUNUSED(n),
74 const wxString& WXUNUSED(helpText))
75 {
76 }
77#endif // wxUSE_HELP
78
79 // returns the radio item at the given position or wxNOT_FOUND if none
80 // (currently implemented only under MSW and GTK)
81 virtual int GetItemFromPoint(const wxPoint& WXUNUSED(pt)) const
82 {
83 return wxNOT_FOUND;
84 }
85
86
bd0a76e2
VZ
87 // deprecated functions
88 // --------------------
89
90#if WXWIN_COMPATIBILITY_2_4
91 wxDEPRECATED( int GetNumberOfRowsOrCols() const );
92 wxDEPRECATED( void SetNumberOfRowsOrCols(int n) );
93#endif // WXWIN_COMPATIBILITY_2_4
21e0a4d5
VZ
94
95protected:
96 wxRadioBoxBase()
97 {
98 m_majorDim = 0;
c670c855
VZ
99
100#if wxUSE_TOOLTIPS
101 m_itemsTooltips = NULL;
102#endif // wxUSE_TOOLTIPS
21e0a4d5
VZ
103 }
104
105 // return the number of items in major direction (which depends on whether
106 // we have wxRA_SPECIFY_COLS or wxRA_SPECIFY_ROWS style)
aa61d352 107 unsigned int GetMajorDim() const { return m_majorDim; }
21e0a4d5
VZ
108
109 // sets m_majorDim and also updates m_numCols/Rows
110 //
111 // the style parameter should be the style of the radiobox itself
aa61d352 112 void SetMajorDim(unsigned int majorDim, long style);
21e0a4d5 113
c670c855
VZ
114#if wxUSE_TOOLTIPS
115 // called from SetItemToolTip() to really set the tooltip for the specified
116 // item in the box (or, if tooltip is NULL, to remove any existing one).
117 //
118 // NB: this function should really be pure virtual but to avoid breaking
119 // the build of the ports for which it's not implemented yet we provide
120 // an empty stub in the base class for now
121 virtual void DoSetItemToolTip(unsigned int item, wxToolTip *tooltip);
122
123 // returns true if we have any item tooltips
124 bool HasItemToolTips() const { return m_itemsTooltips != NULL; }
125#endif // wxUSE_TOOLTIPS
21e0a4d5 126
dc26eeb3
VZ
127#if wxUSE_HELP
128 // Retrieve help text for an item: this is a helper for the implementation
129 // of wxWindow::GetHelpTextAtPoint() in the real radiobox class
130 wxString DoGetHelpTextAtPoint(const wxWindow *derived,
131 const wxPoint& pt,
132 wxHelpEvent::Origin origin) const;
133#endif // wxUSE_HELP
134
21e0a4d5
VZ
135private:
136 // the number of elements in major dimension (i.e. number of columns if
137 // wxRA_SPECIFY_COLS or the number of rows if wxRA_SPECIFY_ROWS) and also
138 // the number of rows/columns calculated from it
aa61d352
VZ
139 unsigned int m_majorDim,
140 m_numCols,
141 m_numRows;
c670c855
VZ
142
143#if wxUSE_TOOLTIPS
144 // array of tooltips for the individual items
145 //
146 // this array is initially NULL and initialized on first use
147 wxToolTipArray *m_itemsTooltips;
148#endif
dc26eeb3
VZ
149
150#if wxUSE_HELP
151 // help text associated with a particular item or empty string if none
152 wxArrayString m_itemsHelpTexts;
153#endif // wxUSE_HELP
1e6feb95
VZ
154};
155
156#if defined(__WXUNIVERSAL__)
157 #include "wx/univ/radiobox.h"
158#elif defined(__WXMSW__)
159 #include "wx/msw/radiobox.h"
2049ba38 160#elif defined(__WXMOTIF__)
1e6feb95 161 #include "wx/motif/radiobox.h"
1be7a35c 162#elif defined(__WXGTK20__)
1e6feb95 163 #include "wx/gtk/radiobox.h"
1be7a35c
MR
164#elif defined(__WXGTK__)
165 #include "wx/gtk1/radiobox.h"
34138703 166#elif defined(__WXMAC__)
1e6feb95 167 #include "wx/mac/radiobox.h"
e64df9bc
DE
168#elif defined(__WXCOCOA__)
169 #include "wx/cocoa/radiobox.h"
1777b9bb 170#elif defined(__WXPM__)
1e6feb95 171 #include "wx/os2/radiobox.h"
a152561c
WS
172#elif defined(__WXPALMOS__)
173 #include "wx/palmos/radiobox.h"
c801d85f
KB
174#endif
175
1e6feb95
VZ
176#endif // wxUSE_RADIOBOX
177
dc26eeb3 178#endif // _WX_RADIOBOX_H_BASE_