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