2001-06-26 20:59:19 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/radiobox.h
|
|
|
|
// Purpose: wxRadioBox declaration
|
|
|
|
// Author: Vadim Zeitlin
|
|
|
|
// Modified by:
|
|
|
|
// Created: 10.09.00
|
2005-05-04 18:57:50 +00:00
|
|
|
// Copyright: (c) Vadim Zeitlin
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
2001-06-26 20:59:19 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-15 00:23:28 +00:00
|
|
|
#ifndef _WX_RADIOBOX_H_BASE_
|
|
|
|
#define _WX_RADIOBOX_H_BASE_
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2010-09-29 13:45:51 +00:00
|
|
|
#include "wx/defs.h"
|
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
#if wxUSE_RADIOBOX
|
|
|
|
|
2005-02-13 19:01:17 +00:00
|
|
|
#include "wx/ctrlsub.h"
|
2001-06-26 20:59:19 +00:00
|
|
|
|
2006-05-04 16:08:56 +00:00
|
|
|
#if wxUSE_TOOLTIPS
|
|
|
|
|
|
|
|
#include "wx/dynarray.h"
|
|
|
|
|
2007-07-09 10:09:52 +00:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxToolTip;
|
2006-05-04 16:08:56 +00:00
|
|
|
|
|
|
|
WX_DEFINE_EXPORTED_ARRAY_PTR(wxToolTip *, wxToolTipArray);
|
|
|
|
|
|
|
|
#endif // wxUSE_TOOLTIPS
|
|
|
|
|
2008-03-26 15:06:00 +00:00
|
|
|
extern WXDLLIMPEXP_DATA_CORE(const char) wxRadioBoxNameStr[];
|
2001-06-26 20:59:19 +00:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxRadioBoxBase is not a normal base class, but rather a mix-in because the
|
|
|
|
// real wxRadioBox derives from different classes on different platforms: for
|
2004-12-17 01:35:10 +00:00
|
|
|
// example, it is a wxStaticBox in wxUniv and wxMSW but not in other ports
|
2001-06-26 20:59:19 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2008-03-26 15:06:00 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxRadioBoxBase : public wxItemContainerImmutable
|
2001-06-26 20:59:19 +00:00
|
|
|
{
|
|
|
|
public:
|
2006-05-04 16:08:56 +00:00
|
|
|
virtual ~wxRadioBoxBase();
|
|
|
|
|
2005-11-29 19:26:38 +00:00
|
|
|
// change/query the individual radio button state
|
2006-03-23 22:05:23 +00:00
|
|
|
virtual bool Enable(unsigned int n, bool enable = true) = 0;
|
|
|
|
virtual bool Show(unsigned int n, bool show = true) = 0;
|
2006-03-24 22:50:51 +00:00
|
|
|
virtual bool IsItemEnabled(unsigned int n) const = 0;
|
|
|
|
virtual bool IsItemShown(unsigned int n) const = 0;
|
2005-11-29 19:26:38 +00:00
|
|
|
|
2005-11-30 16:28:15 +00:00
|
|
|
// return number of columns/rows in this radiobox
|
2006-03-23 22:05:23 +00:00
|
|
|
unsigned int GetColumnCount() const { return m_numCols; }
|
|
|
|
unsigned int GetRowCount() const { return m_numRows; }
|
2001-06-26 20:59:19 +00:00
|
|
|
|
2008-08-02 19:45:23 +00:00
|
|
|
// return the next active (i.e. shown and not disabled) item above/below/to
|
|
|
|
// the left/right of the given one
|
2001-06-26 20:59:19 +00:00
|
|
|
int GetNextItem(int item, wxDirection dir, long style) const;
|
|
|
|
|
2006-05-04 16:08:56 +00:00
|
|
|
#if wxUSE_TOOLTIPS
|
|
|
|
// set the tooltip text for a radio item, empty string unsets any tooltip
|
|
|
|
void SetItemToolTip(unsigned int item, const wxString& text);
|
|
|
|
|
|
|
|
// get the individual items tooltip; returns NULL if none
|
|
|
|
wxToolTip *GetItemToolTip(unsigned int item) const
|
|
|
|
{ return m_itemsTooltips ? (*m_itemsTooltips)[item] : NULL; }
|
|
|
|
#endif // wxUSE_TOOLTIPS
|
2005-11-29 19:26:38 +00:00
|
|
|
|
2006-06-11 21:13:13 +00:00
|
|
|
#if wxUSE_HELP
|
|
|
|
// set helptext for a particular item, pass an empty string to erase it
|
|
|
|
void SetItemHelpText(unsigned int n, const wxString& helpText);
|
|
|
|
|
|
|
|
// retrieve helptext for a particular item, empty string means no help text
|
|
|
|
wxString GetItemHelpText(unsigned int n) const;
|
|
|
|
#else // wxUSE_HELP
|
|
|
|
// just silently ignore the help text, it's better than requiring using
|
|
|
|
// conditional compilation in all code using this function
|
|
|
|
void SetItemHelpText(unsigned int WXUNUSED(n),
|
|
|
|
const wxString& WXUNUSED(helpText))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif // wxUSE_HELP
|
|
|
|
|
|
|
|
// returns the radio item at the given position or wxNOT_FOUND if none
|
|
|
|
// (currently implemented only under MSW and GTK)
|
|
|
|
virtual int GetItemFromPoint(const wxPoint& WXUNUSED(pt)) const
|
|
|
|
{
|
|
|
|
return wxNOT_FOUND;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-30 16:28:15 +00:00
|
|
|
protected:
|
|
|
|
wxRadioBoxBase()
|
|
|
|
{
|
2006-10-31 16:39:07 +00:00
|
|
|
m_numCols =
|
|
|
|
m_numRows =
|
2005-11-30 16:28:15 +00:00
|
|
|
m_majorDim = 0;
|
2006-05-04 16:08:56 +00:00
|
|
|
|
|
|
|
#if wxUSE_TOOLTIPS
|
|
|
|
m_itemsTooltips = NULL;
|
|
|
|
#endif // wxUSE_TOOLTIPS
|
2005-11-30 16:28:15 +00:00
|
|
|
}
|
|
|
|
|
2007-11-14 14:44:13 +00:00
|
|
|
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
|
|
|
|
2005-11-30 16:28:15 +00:00
|
|
|
// return the number of items in major direction (which depends on whether
|
|
|
|
// we have wxRA_SPECIFY_COLS or wxRA_SPECIFY_ROWS style)
|
2006-03-23 22:05:23 +00:00
|
|
|
unsigned int GetMajorDim() const { return m_majorDim; }
|
2005-11-30 16:28:15 +00:00
|
|
|
|
|
|
|
// sets m_majorDim and also updates m_numCols/Rows
|
|
|
|
//
|
|
|
|
// the style parameter should be the style of the radiobox itself
|
2006-03-23 22:05:23 +00:00
|
|
|
void SetMajorDim(unsigned int majorDim, long style);
|
2005-11-30 16:28:15 +00:00
|
|
|
|
2006-05-04 16:08:56 +00:00
|
|
|
#if wxUSE_TOOLTIPS
|
|
|
|
// called from SetItemToolTip() to really set the tooltip for the specified
|
|
|
|
// item in the box (or, if tooltip is NULL, to remove any existing one).
|
|
|
|
//
|
|
|
|
// NB: this function should really be pure virtual but to avoid breaking
|
|
|
|
// the build of the ports for which it's not implemented yet we provide
|
|
|
|
// an empty stub in the base class for now
|
|
|
|
virtual void DoSetItemToolTip(unsigned int item, wxToolTip *tooltip);
|
|
|
|
|
|
|
|
// returns true if we have any item tooltips
|
|
|
|
bool HasItemToolTips() const { return m_itemsTooltips != NULL; }
|
|
|
|
#endif // wxUSE_TOOLTIPS
|
2005-11-30 16:28:15 +00:00
|
|
|
|
2006-06-11 21:13:13 +00:00
|
|
|
#if wxUSE_HELP
|
|
|
|
// Retrieve help text for an item: this is a helper for the implementation
|
|
|
|
// of wxWindow::GetHelpTextAtPoint() in the real radiobox class
|
|
|
|
wxString DoGetHelpTextAtPoint(const wxWindow *derived,
|
|
|
|
const wxPoint& pt,
|
|
|
|
wxHelpEvent::Origin origin) const;
|
|
|
|
#endif // wxUSE_HELP
|
|
|
|
|
2005-11-30 16:28:15 +00:00
|
|
|
private:
|
|
|
|
// the number of elements in major dimension (i.e. number of columns if
|
|
|
|
// wxRA_SPECIFY_COLS or the number of rows if wxRA_SPECIFY_ROWS) and also
|
|
|
|
// the number of rows/columns calculated from it
|
2006-03-23 22:05:23 +00:00
|
|
|
unsigned int m_majorDim,
|
|
|
|
m_numCols,
|
|
|
|
m_numRows;
|
2006-05-04 16:08:56 +00:00
|
|
|
|
|
|
|
#if wxUSE_TOOLTIPS
|
|
|
|
// array of tooltips for the individual items
|
|
|
|
//
|
|
|
|
// this array is initially NULL and initialized on first use
|
|
|
|
wxToolTipArray *m_itemsTooltips;
|
|
|
|
#endif
|
2006-06-11 21:13:13 +00:00
|
|
|
|
|
|
|
#if wxUSE_HELP
|
|
|
|
// help text associated with a particular item or empty string if none
|
|
|
|
wxArrayString m_itemsHelpTexts;
|
|
|
|
#endif // wxUSE_HELP
|
2001-06-26 20:59:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#if defined(__WXUNIVERSAL__)
|
|
|
|
#include "wx/univ/radiobox.h"
|
|
|
|
#elif defined(__WXMSW__)
|
|
|
|
#include "wx/msw/radiobox.h"
|
1998-07-10 14:15:17 +00:00
|
|
|
#elif defined(__WXMOTIF__)
|
2001-06-26 20:59:19 +00:00
|
|
|
#include "wx/motif/radiobox.h"
|
2006-01-23 03:27:34 +00:00
|
|
|
#elif defined(__WXGTK20__)
|
2001-06-26 20:59:19 +00:00
|
|
|
#include "wx/gtk/radiobox.h"
|
2006-01-23 03:27:34 +00:00
|
|
|
#elif defined(__WXGTK__)
|
|
|
|
#include "wx/gtk1/radiobox.h"
|
1998-08-15 00:23:28 +00:00
|
|
|
#elif defined(__WXMAC__)
|
2008-06-11 19:17:41 +00:00
|
|
|
#include "wx/osx/radiobox.h"
|
2014-08-24 01:50:11 +00:00
|
|
|
#elif defined(__WXQT__)
|
|
|
|
#include "wx/qt/radiobox.h"
|
1998-05-20 14:01:55 +00:00
|
|
|
#endif
|
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
#endif // wxUSE_RADIOBOX
|
|
|
|
|
2006-06-11 21:13:13 +00:00
|
|
|
#endif // _WX_RADIOBOX_H_BASE_
|