1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2001-06-26 20:59:19 +00:00
|
|
|
// Name: wx/msw/radiobox.h
|
1998-05-20 14:12:05 +00:00
|
|
|
// Purpose: wxRadioBox class
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
1998-08-07 23:52:45 +00:00
|
|
|
// Copyright: (c) Julian Smart
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 23:52:45 +00:00
|
|
|
#ifndef _WX_RADIOBOX_H_
|
|
|
|
#define _WX_RADIOBOX_H_
|
1998-05-20 14:12:05 +00:00
|
|
|
|
2004-12-13 01:00:35 +00:00
|
|
|
#include "wx/statbox.h"
|
|
|
|
|
2007-07-09 10:09:52 +00:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxSubwindows;
|
1998-05-20 14:12:05 +00:00
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxRadioBox
|
|
|
|
// ----------------------------------------------------------------------------
|
1999-02-22 11:01:13 +00:00
|
|
|
|
2008-03-26 15:06:00 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxRadioBox : public wxStaticBox, public wxRadioBoxBase
|
2001-06-26 20:59:19 +00:00
|
|
|
{
|
1998-05-20 14:12:05 +00:00
|
|
|
public:
|
2004-12-13 01:00:35 +00:00
|
|
|
wxRadioBox() { Init(); }
|
1998-05-20 14:12:05 +00:00
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
wxRadioBox(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
int n = 0, const wxString choices[] = NULL,
|
|
|
|
int majorDim = 0,
|
2009-06-03 22:33:32 +00:00
|
|
|
long style = wxRA_SPECIFY_COLS,
|
2001-06-26 20:59:19 +00:00
|
|
|
const wxValidator& val = wxDefaultValidator,
|
2004-01-15 13:49:22 +00:00
|
|
|
const wxString& name = wxRadioBoxNameStr)
|
|
|
|
{
|
2004-12-13 01:00:35 +00:00
|
|
|
Init();
|
|
|
|
|
2004-01-15 13:49:22 +00:00
|
|
|
(void)Create(parent, id, title, pos, size, n, choices, majorDim,
|
|
|
|
style, val, name);
|
|
|
|
}
|
2004-12-13 01:00:35 +00:00
|
|
|
|
2004-01-31 18:21:45 +00:00
|
|
|
wxRadioBox(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
int majorDim = 0,
|
2009-06-03 22:33:32 +00:00
|
|
|
long style = wxRA_SPECIFY_COLS,
|
2004-01-31 18:21:45 +00:00
|
|
|
const wxValidator& val = wxDefaultValidator,
|
|
|
|
const wxString& name = wxRadioBoxNameStr)
|
|
|
|
{
|
2004-12-13 01:00:35 +00:00
|
|
|
Init();
|
|
|
|
|
2004-01-31 18:21:45 +00:00
|
|
|
(void)Create(parent, id, title, pos, size, choices, majorDim,
|
|
|
|
style, val, name);
|
|
|
|
}
|
1999-02-22 11:01:13 +00:00
|
|
|
|
2006-03-23 00:43:11 +00:00
|
|
|
virtual ~wxRadioBox();
|
1999-02-22 11:01:13 +00:00
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
int n = 0, const wxString choices[] = NULL,
|
|
|
|
int majorDim = 0,
|
2009-06-03 22:33:32 +00:00
|
|
|
long style = wxRA_SPECIFY_COLS,
|
2001-06-26 20:59:19 +00:00
|
|
|
const wxValidator& val = wxDefaultValidator,
|
|
|
|
const wxString& name = wxRadioBoxNameStr);
|
2004-01-31 18:21:45 +00:00
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
int majorDim = 0,
|
2009-06-03 22:33:32 +00:00
|
|
|
long style = wxRA_SPECIFY_COLS,
|
2004-01-31 18:21:45 +00:00
|
|
|
const wxValidator& val = wxDefaultValidator,
|
|
|
|
const wxString& name = wxRadioBoxNameStr);
|
2001-06-26 20:59:19 +00:00
|
|
|
|
|
|
|
// implement the radiobox interface
|
|
|
|
virtual void SetSelection(int n);
|
2004-12-13 01:00:35 +00:00
|
|
|
virtual int GetSelection() const { return m_selectedButton; }
|
2006-03-23 22:05:23 +00:00
|
|
|
virtual unsigned int GetCount() const;
|
|
|
|
virtual wxString GetString(unsigned int n) const;
|
|
|
|
virtual void SetString(unsigned int n, const wxString& label);
|
|
|
|
virtual bool Enable(unsigned int n, bool enable = true);
|
|
|
|
virtual bool Show(unsigned int n, bool show = true);
|
|
|
|
virtual bool IsItemEnabled(unsigned int n) const;
|
|
|
|
virtual bool IsItemShown(unsigned int n) const;
|
2006-12-09 19:48:21 +00:00
|
|
|
virtual int GetItemFromPoint(const wxPoint& pt) const;
|
1999-02-22 11:01:13 +00:00
|
|
|
|
2004-12-13 01:00:35 +00:00
|
|
|
// override some base class methods
|
2004-09-03 18:32:56 +00:00
|
|
|
virtual bool Show(bool show = true);
|
|
|
|
virtual bool Enable(bool enable = true);
|
2013-07-23 12:44:33 +00:00
|
|
|
virtual bool CanBeFocused() const;
|
2004-12-13 01:00:35 +00:00
|
|
|
virtual void SetFocus();
|
|
|
|
virtual bool SetFont(const wxFont& font);
|
|
|
|
virtual bool ContainsHWND(WXHWND hWnd) const;
|
2015-09-11 16:47:49 +00:00
|
|
|
virtual bool SetForegroundColour(const wxColour& colour);
|
|
|
|
virtual bool SetBackgroundColour(const wxColour& colour);
|
2006-05-04 16:08:56 +00:00
|
|
|
#if wxUSE_TOOLTIPS
|
|
|
|
virtual bool HasToolTips() const;
|
|
|
|
#endif // wxUSE_TOOLTIPS
|
2006-12-09 19:48:21 +00:00
|
|
|
#if wxUSE_HELP
|
|
|
|
// override virtual function with a platform-independent implementation
|
|
|
|
virtual wxString GetHelpTextAtPoint(const wxPoint & pt, wxHelpEvent::Origin origin) const
|
|
|
|
{
|
|
|
|
return wxRadioBoxBase::DoGetHelpTextAtPoint( this, pt, origin );
|
|
|
|
}
|
|
|
|
#endif // wxUSE_HELP
|
2004-12-13 01:00:35 +00:00
|
|
|
|
2008-02-19 02:43:29 +00:00
|
|
|
virtual bool Reparent(wxWindowBase *newParent);
|
|
|
|
|
2007-08-07 19:22:43 +00:00
|
|
|
// returns true if the platform should explicitly apply a theme border
|
|
|
|
virtual bool CanApplyThemeBorder() const { return false; }
|
|
|
|
|
2004-10-13 14:04:19 +00:00
|
|
|
void SetLabelFont(const wxFont& WXUNUSED(font)) {}
|
1999-02-22 11:01:13 +00:00
|
|
|
void SetButtonFont(const wxFont& font) { SetFont(font); }
|
|
|
|
|
2010-10-30 23:50:39 +00:00
|
|
|
|
1999-07-22 23:39:47 +00:00
|
|
|
// implementation only from now on
|
|
|
|
// -------------------------------
|
|
|
|
|
2010-10-30 23:50:39 +00:00
|
|
|
// This function can be used to check if the given radio button HWND
|
|
|
|
// belongs to one of our radio boxes. If it doesn't, NULL is returned.
|
|
|
|
static wxRadioBox *GetFromRadioButtonHWND(WXHWND hwnd);
|
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
2004-12-13 01:00:35 +00:00
|
|
|
void Command(wxCommandEvent& event);
|
2001-06-26 20:59:19 +00:00
|
|
|
|
1999-04-17 20:29:40 +00:00
|
|
|
void SendNotificationEvent();
|
1999-02-22 11:01:13 +00:00
|
|
|
|
1998-05-20 14:12:05 +00:00
|
|
|
protected:
|
2004-12-13 01:00:35 +00:00
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
2000-08-08 06:11:51 +00:00
|
|
|
// subclass one radio button
|
1999-02-27 23:52:48 +00:00
|
|
|
void SubclassRadioButton(WXHWND hWndBtn);
|
|
|
|
|
2000-08-08 06:11:51 +00:00
|
|
|
// get the max size of radio buttons
|
|
|
|
wxSize GetMaxButtonSize() const;
|
|
|
|
|
|
|
|
// get the total size occupied by the radio box buttons
|
|
|
|
wxSize GetTotalButtonSize(const wxSize& sizeBtn) const;
|
|
|
|
|
2012-02-02 14:26:06 +00:00
|
|
|
// Adjust all the buttons to the new window size.
|
|
|
|
void PositionAllButtons(int x, int y, int width, int height);
|
|
|
|
|
1999-02-22 11:01:13 +00:00
|
|
|
virtual void DoSetSize(int x, int y,
|
|
|
|
int width, int height,
|
|
|
|
int sizeFlags = wxSIZE_AUTO);
|
2009-05-11 21:54:34 +00:00
|
|
|
virtual void DoMoveWindow(int x, int y, int width, int height);
|
2000-08-08 06:11:51 +00:00
|
|
|
virtual wxSize DoGetBestSize() const;
|
2001-06-26 20:59:19 +00:00
|
|
|
|
2006-05-04 16:08:56 +00:00
|
|
|
#if wxUSE_TOOLTIPS
|
|
|
|
virtual void DoSetItemToolTip(unsigned int n, wxToolTip * tooltip);
|
|
|
|
#endif
|
|
|
|
|
2005-04-02 01:17:51 +00:00
|
|
|
virtual WXHRGN MSWGetRegionWithoutChildren();
|
|
|
|
|
2011-10-29 04:50:04 +00:00
|
|
|
// resolve ambiguity in base classes
|
|
|
|
virtual wxBorder GetDefaultBorder() const { return wxRadioBoxBase::GetDefaultBorder(); }
|
2004-12-13 01:00:35 +00:00
|
|
|
|
|
|
|
// the buttons we contain
|
|
|
|
wxSubwindows *m_radioButtons;
|
2008-01-07 01:54:33 +00:00
|
|
|
|
|
|
|
// and the special dummy button used only as a tab group boundary
|
2008-01-07 18:46:14 +00:00
|
|
|
WXHWND m_dummyHwnd;
|
|
|
|
wxWindowIDRef m_dummyId;
|
2004-12-13 01:00:35 +00:00
|
|
|
|
|
|
|
// array of widths and heights of the buttons, may be wxDefaultCoord if the
|
|
|
|
// corresponding quantity should be computed
|
|
|
|
int *m_radioWidth;
|
|
|
|
int *m_radioHeight;
|
|
|
|
|
|
|
|
// currently selected button or wxNOT_FOUND if none
|
|
|
|
int m_selectedButton;
|
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
private:
|
2015-04-23 11:49:01 +00:00
|
|
|
wxDECLARE_DYNAMIC_CLASS(wxRadioBox);
|
2009-02-08 11:45:59 +00:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxRadioBox);
|
1998-05-20 14:12:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1998-08-07 23:52:45 +00:00
|
|
|
// _WX_RADIOBOX_H_
|