2004-10-19 09:40:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/palmos/radiobox.h
|
|
|
|
// Purpose: wxRadioBox class
|
2005-01-18 16:14:27 -05:00
|
|
|
// Author: William Osborne - minimal working wxPalmOS port
|
2005-01-31 03:04:44 -05:00
|
|
|
// Modified by: Wlodzimierz ABX Skiba - native wxRadioBox implementation
|
2004-10-19 09:40:30 -04:00
|
|
|
// Created: 10/13/04
|
2005-01-18 16:14:27 -05:00
|
|
|
// RCS-ID: $Id$
|
2005-01-31 03:04:44 -05:00
|
|
|
// Copyright: (c) William Osborne, Wlodzimierz Skiba
|
2004-10-19 09:40:30 -04:00
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_RADIOBOX_H_
|
|
|
|
#define _WX_RADIOBOX_H_
|
|
|
|
|
2007-07-09 06:09:52 -04:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxBitmap;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxRadioButton;
|
2004-10-19 09:40:30 -04:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxRadioBox
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxRadioBox : public wxControl, public wxRadioBoxBase
|
2004-10-19 09:40:30 -04:00
|
|
|
{
|
|
|
|
public:
|
2005-02-21 16:02:41 -05:00
|
|
|
wxRadioBox():m_radios(wxKEY_INTEGER,32)
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
}
|
2004-10-19 09:40:30 -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,
|
2005-02-08 04:38:08 -05:00
|
|
|
long style = wxRA_SPECIFY_COLS,
|
2004-10-19 09:40:30 -04:00
|
|
|
const wxValidator& val = wxDefaultValidator,
|
|
|
|
const wxString& name = wxRadioBoxNameStr)
|
2005-02-21 16:02:41 -05:00
|
|
|
:m_radios(wxKEY_INTEGER,n+1)
|
2004-10-19 09:40:30 -04:00
|
|
|
{
|
2005-02-21 16:02:41 -05:00
|
|
|
Init();
|
2004-10-19 09:40:30 -04:00
|
|
|
(void)Create(parent, id, title, pos, size, n, choices, majorDim,
|
|
|
|
style, val, name);
|
|
|
|
}
|
2005-02-21 16:02:41 -05:00
|
|
|
|
2004-10-19 09:40:30 -04:00
|
|
|
wxRadioBox(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
int majorDim = 0,
|
2005-02-08 04:38:08 -05:00
|
|
|
long style = wxRA_SPECIFY_COLS,
|
2004-10-19 09:40:30 -04:00
|
|
|
const wxValidator& val = wxDefaultValidator,
|
|
|
|
const wxString& name = wxRadioBoxNameStr)
|
2005-02-21 16:02:41 -05:00
|
|
|
:m_radios(wxKEY_INTEGER,choices.GetCount()+1)
|
2004-10-19 09:40:30 -04:00
|
|
|
{
|
2005-02-21 16:02:41 -05:00
|
|
|
Init();
|
2004-10-19 09:40:30 -04:00
|
|
|
(void)Create(parent, id, title, pos, size, choices, majorDim,
|
|
|
|
style, val, name);
|
|
|
|
}
|
|
|
|
|
2006-09-05 16:47:48 -04:00
|
|
|
virtual ~wxRadioBox();
|
2004-10-19 09:40:30 -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,
|
2005-02-08 04:38:08 -05:00
|
|
|
long style = wxRA_SPECIFY_COLS,
|
2004-10-19 09:40:30 -04:00
|
|
|
const wxValidator& val = wxDefaultValidator,
|
|
|
|
const wxString& name = wxRadioBoxNameStr);
|
2005-02-01 04:58:58 -05:00
|
|
|
|
2004-10-19 09:40:30 -04:00
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
int majorDim = 0,
|
2005-02-08 04:38:08 -05:00
|
|
|
long style = wxRA_SPECIFY_COLS,
|
2004-10-19 09:40:30 -04:00
|
|
|
const wxValidator& val = wxDefaultValidator,
|
|
|
|
const wxString& name = wxRadioBoxNameStr);
|
|
|
|
|
2006-03-24 17:50:51 -05:00
|
|
|
// Enabling
|
|
|
|
virtual bool Enable(bool enable = true);
|
|
|
|
virtual bool Enable(unsigned int n, bool enable = true);
|
|
|
|
virtual bool IsItemEnabled(unsigned int WXUNUSED(n)) const
|
|
|
|
{
|
|
|
|
/* TODO */
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Showing
|
|
|
|
virtual bool Show(bool show = true);
|
|
|
|
virtual bool Show(unsigned int n, bool show = true);
|
|
|
|
virtual bool IsItemShown(unsigned int WXUNUSED(n)) const
|
|
|
|
{
|
|
|
|
/* TODO */
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2004-10-19 09:40:30 -04:00
|
|
|
// implement the radiobox interface
|
|
|
|
virtual void SetSelection(int n);
|
|
|
|
virtual int GetSelection() const;
|
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);
|
2005-02-22 02:22:11 -05:00
|
|
|
|
|
|
|
virtual void SetLabel(const wxString& label);
|
|
|
|
virtual wxString GetLabel();
|
|
|
|
|
2005-02-21 16:02:41 -05:00
|
|
|
virtual void DoGetPosition( int *x, int *y ) const;
|
|
|
|
virtual void DoGetSize( int *width, int *height ) const;
|
|
|
|
virtual void DoMoveWindow(int x, int y, int width, int height);
|
|
|
|
|
|
|
|
virtual wxPoint GetClientAreaOrigin() const;
|
|
|
|
|
2004-10-19 09:40:30 -04:00
|
|
|
void SetFocus();
|
|
|
|
void SetLabelFont(const wxFont& WXUNUSED(font)) {};
|
|
|
|
void SetButtonFont(const wxFont& font) { SetFont(font); }
|
|
|
|
|
2005-02-22 02:22:11 -05:00
|
|
|
virtual void Refresh( bool eraseBackground = true,
|
|
|
|
const wxRect *rect = NULL );
|
|
|
|
|
2004-10-19 09:40:30 -04:00
|
|
|
void Command(wxCommandEvent& event);
|
|
|
|
|
|
|
|
int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
|
|
|
|
void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
|
|
|
|
|
|
|
|
// implementation only from now on
|
|
|
|
// -------------------------------
|
|
|
|
|
|
|
|
virtual bool SetFont(const wxFont& font);
|
|
|
|
|
|
|
|
void SendNotificationEvent();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// 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;
|
|
|
|
|
2006-03-14 14:44:45 -05:00
|
|
|
int *m_radioWidth; // for bitmaps
|
|
|
|
int *m_radioHeight;
|
2004-10-19 09:40:30 -04:00
|
|
|
|
2006-03-14 14:44:45 -05:00
|
|
|
int m_noRowsOrCols;
|
|
|
|
int m_selectedButton;
|
2004-10-19 09:40:30 -04:00
|
|
|
|
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
|
|
|
|
private:
|
2005-02-21 16:02:41 -05:00
|
|
|
|
|
|
|
void Init();
|
2005-02-23 15:46:32 -05:00
|
|
|
wxRadioButton *GetRadioButton(int i) const;
|
2005-02-21 16:02:41 -05:00
|
|
|
|
|
|
|
wxPoint m_pos;
|
|
|
|
wxSize m_size;
|
|
|
|
wxHashTable m_radios;
|
|
|
|
|
2004-10-19 09:40:30 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxRadioBox)
|
2009-02-08 06:45:59 -05:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxRadioBox);
|
2004-10-19 09:40:30 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// _WX_RADIOBOX_H_
|