1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2001-06-26 16:59:19 -04:00
|
|
|
// Name: wx/msw/radiobox.h
|
1998-05-20 10:12:05 -04:00
|
|
|
// Purpose: wxRadioBox class
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
1998-08-07 19:52:45 -04:00
|
|
|
// Copyright: (c) Julian Smart
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 19:52:45 -04:00
|
|
|
#ifndef _WX_RADIOBOX_H_
|
|
|
|
#define _WX_RADIOBOX_H_
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2004-12-12 20:00:35 -05:00
|
|
|
#include "wx/statbox.h"
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxSubwindows;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxRadioBox
|
|
|
|
// ----------------------------------------------------------------------------
|
1999-02-22 06:01:13 -05:00
|
|
|
|
2004-12-12 20:00:35 -05:00
|
|
|
class WXDLLEXPORT wxRadioBox : public wxStaticBox, public wxRadioBoxBase
|
2001-06-26 16:59:19 -04:00
|
|
|
{
|
1998-05-20 10:12:05 -04:00
|
|
|
public:
|
2004-12-12 20:00:35 -05:00
|
|
|
wxRadioBox() { Init(); }
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2001-06-26 16:59:19 -04: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,
|
|
|
|
long style = wxRA_HORIZONTAL,
|
|
|
|
const wxValidator& val = wxDefaultValidator,
|
2004-01-15 08:49:22 -05:00
|
|
|
const wxString& name = wxRadioBoxNameStr)
|
|
|
|
{
|
2004-12-12 20:00:35 -05:00
|
|
|
Init();
|
|
|
|
|
2004-01-15 08:49:22 -05:00
|
|
|
(void)Create(parent, id, title, pos, size, n, choices, majorDim,
|
|
|
|
style, val, name);
|
|
|
|
}
|
2004-12-12 20:00:35 -05:00
|
|
|
|
2004-01-31 13:21:45 -05:00
|
|
|
wxRadioBox(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
int majorDim = 0,
|
|
|
|
long style = wxRA_HORIZONTAL,
|
|
|
|
const wxValidator& val = wxDefaultValidator,
|
|
|
|
const wxString& name = wxRadioBoxNameStr)
|
|
|
|
{
|
2004-12-12 20:00:35 -05:00
|
|
|
Init();
|
|
|
|
|
2004-01-31 13:21:45 -05:00
|
|
|
(void)Create(parent, id, title, pos, size, choices, majorDim,
|
|
|
|
style, val, name);
|
|
|
|
}
|
1999-02-22 06:01:13 -05:00
|
|
|
|
2006-03-22 19:43:11 -05:00
|
|
|
virtual ~wxRadioBox();
|
1999-02-22 06:01:13 -05:00
|
|
|
|
2001-06-26 16:59:19 -04: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,
|
|
|
|
long style = wxRA_HORIZONTAL,
|
|
|
|
const wxValidator& val = wxDefaultValidator,
|
|
|
|
const wxString& name = wxRadioBoxNameStr);
|
2004-01-31 13:21:45 -05:00
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
int majorDim = 0,
|
|
|
|
long style = wxRA_HORIZONTAL,
|
|
|
|
const wxValidator& val = wxDefaultValidator,
|
|
|
|
const wxString& name = wxRadioBoxNameStr);
|
2001-06-26 16:59:19 -04:00
|
|
|
|
|
|
|
// implement the radiobox interface
|
|
|
|
virtual void SetSelection(int n);
|
2004-12-12 20:00:35 -05:00
|
|
|
virtual int GetSelection() const { return m_selectedButton; }
|
2006-03-23 17:05:23 -05: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 14:48:21 -05:00
|
|
|
virtual int GetItemFromPoint(const wxPoint& pt) const;
|
1999-02-22 06:01:13 -05:00
|
|
|
|
2004-12-12 20:00:35 -05:00
|
|
|
// override some base class methods
|
2004-09-03 14:32:56 -04:00
|
|
|
virtual bool Show(bool show = true);
|
|
|
|
virtual bool Enable(bool enable = true);
|
2004-12-12 20:00:35 -05:00
|
|
|
virtual void SetFocus();
|
|
|
|
virtual bool SetFont(const wxFont& font);
|
|
|
|
virtual bool ContainsHWND(WXHWND hWnd) const;
|
2006-05-04 12:08:56 -04:00
|
|
|
#if wxUSE_TOOLTIPS
|
|
|
|
virtual bool HasToolTips() const;
|
|
|
|
#endif // wxUSE_TOOLTIPS
|
2006-12-09 14:48:21 -05: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-12 20:00:35 -05:00
|
|
|
|
2006-03-22 19:43:11 -05:00
|
|
|
// we inherit a version always returning false from wxStaticBox, override
|
|
|
|
// it to behave normally
|
|
|
|
virtual bool AcceptsFocus() const { return wxControl::AcceptsFocus(); }
|
2004-12-16 20:41:47 -05:00
|
|
|
|
2004-10-13 10:04:19 -04:00
|
|
|
void SetLabelFont(const wxFont& WXUNUSED(font)) {}
|
1999-02-22 06:01:13 -05:00
|
|
|
void SetButtonFont(const wxFont& font) { SetFont(font); }
|
|
|
|
|
1999-07-22 19:39:47 -04:00
|
|
|
// implementation only from now on
|
|
|
|
// -------------------------------
|
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
2004-12-12 20:00:35 -05:00
|
|
|
void Command(wxCommandEvent& event);
|
2001-06-26 16:59:19 -04:00
|
|
|
|
1999-04-17 16:29:40 -04:00
|
|
|
void SendNotificationEvent();
|
1999-02-22 06:01:13 -05:00
|
|
|
|
1998-05-20 10:12:05 -04:00
|
|
|
protected:
|
2004-12-12 20:00:35 -05:00
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
2000-08-08 02:11:51 -04:00
|
|
|
// subclass one radio button
|
1999-02-27 18:52:48 -05:00
|
|
|
void SubclassRadioButton(WXHWND hWndBtn);
|
|
|
|
|
2000-08-08 02:11:51 -04: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;
|
|
|
|
|
1999-02-22 06:01:13 -05:00
|
|
|
virtual void DoSetSize(int x, int y,
|
|
|
|
int width, int height,
|
|
|
|
int sizeFlags = wxSIZE_AUTO);
|
2000-08-08 02:11:51 -04:00
|
|
|
virtual wxSize DoGetBestSize() const;
|
2001-06-26 16:59:19 -04:00
|
|
|
|
2006-05-04 12:08:56 -04:00
|
|
|
#if wxUSE_TOOLTIPS
|
|
|
|
virtual void DoSetItemToolTip(unsigned int n, wxToolTip * tooltip);
|
|
|
|
#endif
|
|
|
|
|
2005-04-10 11:23:08 -04:00
|
|
|
#ifndef __WXWINCE__
|
2005-04-01 20:17:51 -05:00
|
|
|
virtual WXHRGN MSWGetRegionWithoutChildren();
|
2005-04-10 11:23:08 -04:00
|
|
|
#endif // __WXWINCE__
|
2005-04-01 20:17:51 -05:00
|
|
|
|
2004-12-12 20:00:35 -05:00
|
|
|
|
|
|
|
// the buttons we contain
|
|
|
|
wxSubwindows *m_radioButtons;
|
|
|
|
|
|
|
|
// 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 16:59:19 -04:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxRadioBox)
|
2003-01-02 18:38:11 -05:00
|
|
|
DECLARE_NO_COPY_CLASS(wxRadioBox)
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1998-08-07 19:52:45 -04:00
|
|
|
// _WX_RADIOBOX_H_
|