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
|
|
|
|
// RCS-ID: $Id$
|
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"
|
|
|
|
|
|
|
|
class WXDLLEXPORT 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
|
|
|
|
2004-12-13 01:00:35 +00:00
|
|
|
class WXDLLEXPORT 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,
|
|
|
|
long style = wxRA_HORIZONTAL,
|
|
|
|
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,
|
|
|
|
long style = wxRA_HORIZONTAL,
|
|
|
|
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
|
|
|
|
|
|
|
~wxRadioBox();
|
|
|
|
|
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,
|
|
|
|
long style = wxRA_HORIZONTAL,
|
|
|
|
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,
|
|
|
|
long style = wxRA_HORIZONTAL,
|
|
|
|
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-14 19:44:45 +00:00
|
|
|
virtual size_t GetCount() const;
|
2001-06-26 20:59:19 +00:00
|
|
|
virtual wxString GetString(int n) const;
|
|
|
|
virtual void SetString(int n, const wxString& label);
|
2005-02-21 21:02:41 +00:00
|
|
|
virtual bool Enable(int n, bool enable = true);
|
2005-02-23 16:39:25 +00:00
|
|
|
virtual bool Show(int n, bool show = true);
|
2005-11-29 19:26:38 +00:00
|
|
|
virtual bool IsItemEnabled(int n) const;
|
|
|
|
virtual bool IsItemShown(int n) 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);
|
2004-12-13 01:00:35 +00:00
|
|
|
virtual void SetFocus();
|
|
|
|
virtual bool SetFont(const wxFont& font);
|
|
|
|
virtual bool ContainsHWND(WXHWND hWnd) const;
|
|
|
|
|
2004-12-17 01:41:47 +00:00
|
|
|
// we inherit a version returning false from wxStaticBox, override it again
|
|
|
|
virtual bool AcceptsFocus() const { return true; }
|
|
|
|
|
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); }
|
|
|
|
|
|
|
|
|
1999-07-22 23:39:47 +00:00
|
|
|
// implementation only from now on
|
|
|
|
// -------------------------------
|
|
|
|
|
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();
|
|
|
|
|
2004-05-03 23:08:55 +00:00
|
|
|
// we can't compute our best size before the items are added to the control
|
|
|
|
virtual void SetInitialBestSize(const wxSize& WXUNUSED(size)) { }
|
|
|
|
|
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;
|
|
|
|
|
1999-02-22 11:01:13 +00:00
|
|
|
virtual void DoSetSize(int x, int y,
|
|
|
|
int width, int height,
|
|
|
|
int sizeFlags = wxSIZE_AUTO);
|
2000-08-08 06:11:51 +00:00
|
|
|
virtual wxSize DoGetBestSize() const;
|
2001-06-26 20:59:19 +00:00
|
|
|
|
2005-04-10 15:23:08 +00:00
|
|
|
#ifndef __WXWINCE__
|
2005-04-02 01:17:51 +00:00
|
|
|
virtual WXHRGN MSWGetRegionWithoutChildren();
|
2005-04-10 15:23:08 +00:00
|
|
|
#endif // __WXWINCE__
|
2005-04-02 01:17:51 +00:00
|
|
|
|
2004-12-13 01:00:35 +00: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 20:59:19 +00:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxRadioBox)
|
2003-01-02 23:38:11 +00:00
|
|
|
DECLARE_NO_COPY_CLASS(wxRadioBox)
|
1998-05-20 14:12:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1998-08-07 23:52:45 +00:00
|
|
|
// _WX_RADIOBOX_H_
|