2001-06-26 16:59:19 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/radiobox.h
|
|
|
|
// Purpose: wxRadioBox declaration
|
|
|
|
// Author: Vadim Zeitlin
|
|
|
|
// Modified by:
|
|
|
|
// Created: 10.09.00
|
|
|
|
// RCS-ID: $Id$
|
2005-05-04 14:57:50 -04:00
|
|
|
// Copyright: (c) Vadim Zeitlin
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
2001-06-26 16:59:19 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-14 20:23:28 -04:00
|
|
|
#ifndef _WX_RADIOBOX_H_BASE_
|
|
|
|
#define _WX_RADIOBOX_H_BASE_
|
1998-05-20 10:01:55 -04:00
|
|
|
|
2010-09-29 09:45:51 -04:00
|
|
|
#include "wx/defs.h"
|
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
#if wxUSE_RADIOBOX
|
|
|
|
|
2005-02-13 14:01:17 -05:00
|
|
|
#include "wx/ctrlsub.h"
|
2001-06-26 16:59:19 -04:00
|
|
|
|
2006-05-04 12:08:56 -04:00
|
|
|
#if wxUSE_TOOLTIPS
|
|
|
|
|
|
|
|
#include "wx/dynarray.h"
|
|
|
|
|
2007-07-09 06:09:52 -04:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxToolTip;
|
2006-05-04 12:08:56 -04:00
|
|
|
|
|
|
|
WX_DEFINE_EXPORTED_ARRAY_PTR(wxToolTip *, wxToolTipArray);
|
|
|
|
|
|
|
|
#endif // wxUSE_TOOLTIPS
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
extern WXDLLIMPEXP_DATA_CORE(const char) wxRadioBoxNameStr[];
|
2001-06-26 16:59:19 -04: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-16 20:35:10 -05:00
|
|
|
// example, it is a wxStaticBox in wxUniv and wxMSW but not in other ports
|
2001-06-26 16:59:19 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxRadioBoxBase : public wxItemContainerImmutable
|
2001-06-26 16:59:19 -04:00
|
|
|
{
|
|
|
|
public:
|
2006-05-04 12:08:56 -04:00
|
|
|
virtual ~wxRadioBoxBase();
|
|
|
|
|
2005-11-29 14:26:38 -05:00
|
|
|
// change/query the individual radio button state
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual bool Enable(unsigned int n, bool enable = true) = 0;
|
|
|
|
virtual bool Show(unsigned int n, bool show = true) = 0;
|
2006-03-24 17:50:51 -05:00
|
|
|
virtual bool IsItemEnabled(unsigned int n) const = 0;
|
|
|
|
virtual bool IsItemShown(unsigned int n) const = 0;
|
2005-11-29 14:26:38 -05:00
|
|
|
|
2005-11-30 11:28:15 -05:00
|
|
|
// return number of columns/rows in this radiobox
|
2006-03-23 17:05:23 -05:00
|
|
|
unsigned int GetColumnCount() const { return m_numCols; }
|
|
|
|
unsigned int GetRowCount() const { return m_numRows; }
|
2001-06-26 16:59:19 -04:00
|
|
|
|
2008-08-02 15:45:23 -04: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 16:59:19 -04:00
|
|
|
int GetNextItem(int item, wxDirection dir, long style) const;
|
|
|
|
|
2006-05-04 12:08:56 -04: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 14:26:38 -05:00
|
|
|
|
2006-06-11 17:13:13 -04: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 11:28:15 -05:00
|
|
|
protected:
|
|
|
|
wxRadioBoxBase()
|
|
|
|
{
|
2006-10-31 11:39:07 -05:00
|
|
|
m_numCols =
|
|
|
|
m_numRows =
|
2005-11-30 11:28:15 -05:00
|
|
|
m_majorDim = 0;
|
2006-05-04 12:08:56 -04:00
|
|
|
|
|
|
|
#if wxUSE_TOOLTIPS
|
|
|
|
m_itemsTooltips = NULL;
|
|
|
|
#endif // wxUSE_TOOLTIPS
|
2005-11-30 11:28:15 -05:00
|
|
|
}
|
|
|
|
|
2007-11-14 09:44:13 -05:00
|
|
|
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
|
|
|
|
2005-11-30 11:28:15 -05: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 17:05:23 -05:00
|
|
|
unsigned int GetMajorDim() const { return m_majorDim; }
|
2005-11-30 11:28:15 -05:00
|
|
|
|
|
|
|
// sets m_majorDim and also updates m_numCols/Rows
|
|
|
|
//
|
|
|
|
// the style parameter should be the style of the radiobox itself
|
2006-03-23 17:05:23 -05:00
|
|
|
void SetMajorDim(unsigned int majorDim, long style);
|
2005-11-30 11:28:15 -05:00
|
|
|
|
2006-05-04 12:08:56 -04: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 11:28:15 -05:00
|
|
|
|
2006-06-11 17:13:13 -04: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 11:28:15 -05: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 17:05:23 -05:00
|
|
|
unsigned int m_majorDim,
|
|
|
|
m_numCols,
|
|
|
|
m_numRows;
|
2006-05-04 12:08:56 -04: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 17:13:13 -04: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 16:59:19 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#if defined(__WXUNIVERSAL__)
|
|
|
|
#include "wx/univ/radiobox.h"
|
|
|
|
#elif defined(__WXMSW__)
|
|
|
|
#include "wx/msw/radiobox.h"
|
1998-07-10 10:15:17 -04:00
|
|
|
#elif defined(__WXMOTIF__)
|
2001-06-26 16:59:19 -04:00
|
|
|
#include "wx/motif/radiobox.h"
|
2006-01-22 22:27:34 -05:00
|
|
|
#elif defined(__WXGTK20__)
|
2001-06-26 16:59:19 -04:00
|
|
|
#include "wx/gtk/radiobox.h"
|
2006-01-22 22:27:34 -05:00
|
|
|
#elif defined(__WXGTK__)
|
|
|
|
#include "wx/gtk1/radiobox.h"
|
1998-08-14 20:23:28 -04:00
|
|
|
#elif defined(__WXMAC__)
|
2008-06-11 15:17:41 -04:00
|
|
|
#include "wx/osx/radiobox.h"
|
2003-03-22 01:18:36 -05:00
|
|
|
#elif defined(__WXCOCOA__)
|
|
|
|
#include "wx/cocoa/radiobox.h"
|
1999-07-27 23:38:12 -04:00
|
|
|
#elif defined(__WXPM__)
|
2001-06-26 16:59:19 -04:00
|
|
|
#include "wx/os2/radiobox.h"
|
1998-05-20 10:01:55 -04:00
|
|
|
#endif
|
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
#endif // wxUSE_RADIOBOX
|
|
|
|
|
2006-06-11 17:13:13 -04:00
|
|
|
#endif // _WX_RADIOBOX_H_BASE_
|