]> git.saurik.com Git - wxWidgets.git/blame - include/wx/radiobox.h
Fix missing documentation for several GDI functions.
[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
bb4acdc0
VZ
15#include "wx/defs.h"
16
1e6feb95
VZ
17#if wxUSE_RADIOBOX
18
8ba7c771 19#include "wx/ctrlsub.h"
1e6feb95 20
c670c855
VZ
21#if wxUSE_TOOLTIPS
22
23#include "wx/dynarray.h"
24
b5dbe15d 25class WXDLLIMPEXP_FWD_CORE wxToolTip;
c670c855
VZ
26
27WX_DEFINE_EXPORTED_ARRAY_PTR(wxToolTip *, wxToolTipArray);
28
29#endif // wxUSE_TOOLTIPS
30
53a2db12 31extern WXDLLIMPEXP_DATA_CORE(const char) wxRadioBoxNameStr[];
1e6feb95
VZ
32
33// ----------------------------------------------------------------------------
34// wxRadioBoxBase is not a normal base class, but rather a mix-in because the
35// real wxRadioBox derives from different classes on different platforms: for
aca49b79 36// example, it is a wxStaticBox in wxUniv and wxMSW but not in other ports
1e6feb95
VZ
37// ----------------------------------------------------------------------------
38
53a2db12 39class WXDLLIMPEXP_CORE wxRadioBoxBase : public wxItemContainerImmutable
1e6feb95
VZ
40{
41public:
c670c855
VZ
42 virtual ~wxRadioBoxBase();
43
3bfa7be9 44 // change/query the individual radio button state
aa61d352
VZ
45 virtual bool Enable(unsigned int n, bool enable = true) = 0;
46 virtual bool Show(unsigned int n, bool show = true) = 0;
7a952d4c
WS
47 virtual bool IsItemEnabled(unsigned int n) const = 0;
48 virtual bool IsItemShown(unsigned int n) const = 0;
3bfa7be9 49
21e0a4d5 50 // return number of columns/rows in this radiobox
aa61d352
VZ
51 unsigned int GetColumnCount() const { return m_numCols; }
52 unsigned int GetRowCount() const { return m_numRows; }
1e6feb95 53
05d31b3a
VZ
54 // return the next active (i.e. shown and not disabled) item above/below/to
55 // the left/right of the given one
1e6feb95
VZ
56 int GetNextItem(int item, wxDirection dir, long style) const;
57
c670c855
VZ
58#if wxUSE_TOOLTIPS
59 // set the tooltip text for a radio item, empty string unsets any tooltip
60 void SetItemToolTip(unsigned int item, const wxString& text);
61
62 // get the individual items tooltip; returns NULL if none
63 wxToolTip *GetItemToolTip(unsigned int item) const
64 { return m_itemsTooltips ? (*m_itemsTooltips)[item] : NULL; }
65#endif // wxUSE_TOOLTIPS
3bfa7be9 66
dc26eeb3
VZ
67#if wxUSE_HELP
68 // set helptext for a particular item, pass an empty string to erase it
69 void SetItemHelpText(unsigned int n, const wxString& helpText);
70
71 // retrieve helptext for a particular item, empty string means no help text
72 wxString GetItemHelpText(unsigned int n) const;
73#else // wxUSE_HELP
74 // just silently ignore the help text, it's better than requiring using
75 // conditional compilation in all code using this function
76 void SetItemHelpText(unsigned int WXUNUSED(n),
77 const wxString& WXUNUSED(helpText))
78 {
79 }
80#endif // wxUSE_HELP
81
82 // returns the radio item at the given position or wxNOT_FOUND if none
83 // (currently implemented only under MSW and GTK)
84 virtual int GetItemFromPoint(const wxPoint& WXUNUSED(pt)) const
85 {
86 return wxNOT_FOUND;
87 }
88
89
21e0a4d5
VZ
90protected:
91 wxRadioBoxBase()
92 {
155e46c2
VZ
93 m_numCols =
94 m_numRows =
21e0a4d5 95 m_majorDim = 0;
c670c855
VZ
96
97#if wxUSE_TOOLTIPS
98 m_itemsTooltips = NULL;
99#endif // wxUSE_TOOLTIPS
21e0a4d5
VZ
100 }
101
677dc0ed
JS
102 virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
103
21e0a4d5
VZ
104 // return the number of items in major direction (which depends on whether
105 // we have wxRA_SPECIFY_COLS or wxRA_SPECIFY_ROWS style)
aa61d352 106 unsigned int GetMajorDim() const { return m_majorDim; }
21e0a4d5
VZ
107
108 // sets m_majorDim and also updates m_numCols/Rows
109 //
110 // the style parameter should be the style of the radiobox itself
aa61d352 111 void SetMajorDim(unsigned int majorDim, long style);
21e0a4d5 112
c670c855
VZ
113#if wxUSE_TOOLTIPS
114 // called from SetItemToolTip() to really set the tooltip for the specified
115 // item in the box (or, if tooltip is NULL, to remove any existing one).
116 //
117 // NB: this function should really be pure virtual but to avoid breaking
118 // the build of the ports for which it's not implemented yet we provide
119 // an empty stub in the base class for now
120 virtual void DoSetItemToolTip(unsigned int item, wxToolTip *tooltip);
121
122 // returns true if we have any item tooltips
123 bool HasItemToolTips() const { return m_itemsTooltips != NULL; }
124#endif // wxUSE_TOOLTIPS
21e0a4d5 125
dc26eeb3
VZ
126#if wxUSE_HELP
127 // Retrieve help text for an item: this is a helper for the implementation
128 // of wxWindow::GetHelpTextAtPoint() in the real radiobox class
129 wxString DoGetHelpTextAtPoint(const wxWindow *derived,
130 const wxPoint& pt,
131 wxHelpEvent::Origin origin) const;
132#endif // wxUSE_HELP
133
21e0a4d5
VZ
134private:
135 // the number of elements in major dimension (i.e. number of columns if
136 // wxRA_SPECIFY_COLS or the number of rows if wxRA_SPECIFY_ROWS) and also
137 // the number of rows/columns calculated from it
aa61d352
VZ
138 unsigned int m_majorDim,
139 m_numCols,
140 m_numRows;
c670c855
VZ
141
142#if wxUSE_TOOLTIPS
143 // array of tooltips for the individual items
144 //
145 // this array is initially NULL and initialized on first use
146 wxToolTipArray *m_itemsTooltips;
147#endif
dc26eeb3
VZ
148
149#if wxUSE_HELP
150 // help text associated with a particular item or empty string if none
151 wxArrayString m_itemsHelpTexts;
152#endif // wxUSE_HELP
1e6feb95
VZ
153};
154
155#if defined(__WXUNIVERSAL__)
156 #include "wx/univ/radiobox.h"
157#elif defined(__WXMSW__)
158 #include "wx/msw/radiobox.h"
2049ba38 159#elif defined(__WXMOTIF__)
1e6feb95 160 #include "wx/motif/radiobox.h"
1be7a35c 161#elif defined(__WXGTK20__)
1e6feb95 162 #include "wx/gtk/radiobox.h"
1be7a35c
MR
163#elif defined(__WXGTK__)
164 #include "wx/gtk1/radiobox.h"
34138703 165#elif defined(__WXMAC__)
ef0e9220 166 #include "wx/osx/radiobox.h"
e64df9bc
DE
167#elif defined(__WXCOCOA__)
168 #include "wx/cocoa/radiobox.h"
1777b9bb 169#elif defined(__WXPM__)
1e6feb95 170 #include "wx/os2/radiobox.h"
c801d85f
KB
171#endif
172
1e6feb95
VZ
173#endif // wxUSE_RADIOBOX
174
dc26eeb3 175#endif // _WX_RADIOBOX_H_BASE_