1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: radiobox.h
|
|
|
|
// 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
|
1999-07-22 23:39:47 +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
|
|
|
|
|
|
|
#ifdef __GNUG__
|
1999-07-22 23:39:47 +00:00
|
|
|
#pragma interface "radiobox.h"
|
1998-05-20 14:12:05 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/control.h"
|
|
|
|
|
1999-06-10 18:12:13 +00:00
|
|
|
WXDLLEXPORT_DATA(extern const wxChar*) wxRadioBoxNameStr;
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-02-27 23:52:48 +00:00
|
|
|
class WXDLLEXPORT wxBitmap;
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-02-22 11:01:13 +00:00
|
|
|
class WXDLLEXPORT wxRadioBox : public wxControl
|
1998-05-20 14:12:05 +00:00
|
|
|
{
|
1999-02-22 11:01:13 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxRadioBox)
|
|
|
|
|
1998-05-20 14:12:05 +00:00
|
|
|
public:
|
1999-02-22 11:01:13 +00:00
|
|
|
wxRadioBox();
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-02-22 11:01:13 +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, const wxString& name = wxRadioBoxNameStr)
|
|
|
|
{
|
|
|
|
Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
~wxRadioBox();
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
|
|
|
|
|
|
|
int FindString(const wxString& s) const;
|
|
|
|
void SetSelection(int N);
|
|
|
|
int GetSelection() const;
|
|
|
|
wxString GetString(int N) const;
|
|
|
|
|
|
|
|
void GetSize(int *x, int *y) const;
|
|
|
|
void GetPosition(int *x, int *y) const;
|
|
|
|
|
1999-02-27 23:52:48 +00:00
|
|
|
void SetLabel(int item, const wxString& label);
|
|
|
|
void SetLabel(int item, wxBitmap *bitmap);
|
1999-02-22 11:01:13 +00:00
|
|
|
wxString GetLabel(int item) const;
|
|
|
|
bool Show(bool show);
|
|
|
|
void SetFocus();
|
1999-05-10 00:42:57 +00:00
|
|
|
bool Enable(bool enable);
|
1999-02-22 11:01:13 +00:00
|
|
|
void Enable(int item, bool enable);
|
1999-02-27 23:52:48 +00:00
|
|
|
void Show(int item, bool show);
|
1999-02-22 11:01:13 +00:00
|
|
|
void SetLabelFont(const wxFont& WXUNUSED(font)) {};
|
|
|
|
void SetButtonFont(const wxFont& font) { SetFont(font); }
|
|
|
|
|
|
|
|
virtual wxString GetStringSelection() const;
|
|
|
|
virtual bool SetStringSelection(const wxString& s);
|
1999-02-27 23:52:48 +00:00
|
|
|
virtual int Number() const { return m_noItems; };
|
1999-02-22 11:01:13 +00:00
|
|
|
void Command(wxCommandEvent& event);
|
|
|
|
|
|
|
|
int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
|
|
|
|
void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
|
|
|
|
|
1999-07-22 23:39:47 +00:00
|
|
|
// implementation only from now on
|
|
|
|
// -------------------------------
|
|
|
|
|
1999-12-11 00:43:59 +00:00
|
|
|
virtual bool SetFont(const wxFont& font);
|
|
|
|
|
1999-12-06 12:12:36 +00:00
|
|
|
long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
2000-07-15 19:51:35 +00:00
|
|
|
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
|
|
|
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
1999-02-22 11:01:13 +00:00
|
|
|
WXHWND *GetRadioButtons() const { return m_radioButtons; }
|
1999-02-27 23:52:48 +00:00
|
|
|
bool ContainsHWND(WXHWND hWnd) const;
|
1999-04-17 20:29:40 +00:00
|
|
|
void SendNotificationEvent();
|
1999-02-22 11:01:13 +00:00
|
|
|
|
1999-02-27 23:52:48 +00:00
|
|
|
// get the number of buttons per column/row
|
1999-07-22 23:39:47 +00:00
|
|
|
int GetNumVer() const;
|
|
|
|
int GetNumHor() const;
|
|
|
|
|
2000-01-23 23:23:46 +00:00
|
|
|
// compatibility ctor
|
1999-07-22 23:39:47 +00:00
|
|
|
#if WXWIN_COMPATIBILITY
|
|
|
|
wxRadioBox(wxWindow *parent, wxFunction func, const char *title,
|
|
|
|
int x = -1, int y = -1, int width = -1, int height = -1,
|
|
|
|
int n = 0, char **choices = NULL,
|
|
|
|
int majorDim = 0, long style = wxRA_HORIZONTAL, const char *name = wxRadioBoxNameStr);
|
|
|
|
#endif // WXWIN_COMPATIBILITY
|
1999-02-27 23:52:48 +00:00
|
|
|
|
1998-05-20 14:12:05 +00:00
|
|
|
protected:
|
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
|
|
|
WXHWND * m_radioButtons;
|
1999-02-27 23:52:48 +00:00
|
|
|
int m_majorDim;
|
|
|
|
int * m_radioWidth; // for bitmaps
|
|
|
|
int * m_radioHeight;
|
1999-02-22 11:01:13 +00:00
|
|
|
|
|
|
|
int m_noItems;
|
|
|
|
int m_noRowsOrCols;
|
|
|
|
int m_selectedButton;
|
|
|
|
|
|
|
|
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;
|
1998-05-20 14:12:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1998-08-07 23:52:45 +00:00
|
|
|
// _WX_RADIOBOX_H_
|