1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: radiobox.h
|
|
|
|
// Purpose:
|
|
|
|
// Author: Robert Roebling
|
1998-10-29 18:03:18 +00:00
|
|
|
// Id: $Id$
|
|
|
|
// Copyright: (c) 1998 Robert Roebling
|
1999-05-09 22:17:03 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __GTKRADIOBOXH__
|
|
|
|
#define __GTKRADIOBOXH__
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/bitmap.h"
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxRadioBox
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxRadioBox: public wxControl
|
|
|
|
{
|
1999-05-12 20:26:54 +00:00
|
|
|
public:
|
2000-07-15 19:51:35 +00:00
|
|
|
wxRadioBox() { Init(); }
|
|
|
|
wxRadioBox(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
int n = 0,
|
|
|
|
const wxString choices[] = (const wxString *) NULL,
|
|
|
|
int majorDim = 1,
|
|
|
|
long style = wxRA_HORIZONTAL,
|
2002-02-17 22:45:08 +00:00
|
|
|
const wxValidator& val = wxDefaultValidator,
|
2000-07-15 19:51:35 +00:00
|
|
|
const wxString& name = wxRadioBoxNameStr)
|
1998-08-14 10:07:38 +00:00
|
|
|
{
|
2000-07-15 19:51:35 +00:00
|
|
|
Init();
|
|
|
|
|
|
|
|
Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name );
|
1998-08-14 10:07:38 +00:00
|
|
|
}
|
2000-07-15 19:51:35 +00:00
|
|
|
|
|
|
|
~wxRadioBox();
|
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
int n = 0,
|
|
|
|
const wxString choices[] = (const wxString *) NULL,
|
|
|
|
int majorDim = 0,
|
|
|
|
long style = wxRA_HORIZONTAL,
|
2002-02-17 22:45:08 +00:00
|
|
|
const wxValidator& val = wxDefaultValidator,
|
2000-07-15 19:51:35 +00:00
|
|
|
const wxString& name = wxRadioBoxNameStr);
|
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
int FindString( const wxString& s) const;
|
1998-07-04 15:17:59 +00:00
|
|
|
void SetSelection( int n );
|
1999-05-12 20:26:54 +00:00
|
|
|
int GetSelection() const;
|
2002-02-17 22:45:08 +00:00
|
|
|
|
1998-07-04 15:17:59 +00:00
|
|
|
wxString GetString( int n ) const;
|
2002-02-17 22:53:41 +00:00
|
|
|
void SetString( int n, const wxString& label );
|
2002-02-17 22:45:08 +00:00
|
|
|
|
1999-05-12 20:26:54 +00:00
|
|
|
void Show( int item, bool show );
|
1998-07-04 15:17:59 +00:00
|
|
|
void Enable( int item, bool enable );
|
2002-02-17 22:45:08 +00:00
|
|
|
|
1999-05-12 20:26:54 +00:00
|
|
|
virtual wxString GetStringSelection() const;
|
1998-05-20 14:01:55 +00:00
|
|
|
virtual bool SetStringSelection( const wxString& s );
|
2002-02-17 22:45:08 +00:00
|
|
|
|
|
|
|
int GetCount() const;
|
1999-05-12 20:26:54 +00:00
|
|
|
int GetNumberOfRowsOrCols() const;
|
1998-07-04 15:17:59 +00:00
|
|
|
void SetNumberOfRowsOrCols( int n );
|
2002-02-17 22:45:08 +00:00
|
|
|
|
|
|
|
// for compatibility only, don't use these methods in new code!
|
|
|
|
#if WXWIN_COMPATIBILITY_2_2
|
|
|
|
int Number() const { return GetCount(); }
|
|
|
|
wxString GetLabel(int n) const { return GetString(n); }
|
2002-02-17 22:53:41 +00:00
|
|
|
void SetLabel( int item, const wxString& label )
|
|
|
|
{ SetString(item, label); }
|
2002-02-17 22:45:08 +00:00
|
|
|
#endif // WXWIN_COMPATIBILITY_2_2
|
|
|
|
|
|
|
|
// we have to override those to avoid virtual function name hiding
|
|
|
|
wxString GetLabel() const { return wxControl::GetLabel(); }
|
2002-02-17 22:53:41 +00:00
|
|
|
void SetLabel( const wxString& label );
|
2002-02-17 22:45:08 +00:00
|
|
|
bool Show( bool show );
|
|
|
|
bool Enable( bool enable );
|
|
|
|
|
1999-11-26 17:41:20 +00:00
|
|
|
// implementation
|
|
|
|
// --------------
|
2002-02-17 22:45:08 +00:00
|
|
|
|
1999-11-26 17:41:20 +00:00
|
|
|
void SetFocus();
|
|
|
|
void GtkDisableEvents();
|
|
|
|
void GtkEnableEvents();
|
1998-09-07 12:29:07 +00:00
|
|
|
bool IsOwnGtkWindow( GdkWindow *window );
|
1998-10-29 18:03:18 +00:00
|
|
|
void ApplyWidgetStyle();
|
1999-11-26 17:41:20 +00:00
|
|
|
#if wxUSE_TOOLTIPS
|
|
|
|
void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
|
|
|
|
#endif // wxUSE_TOOLTIPS
|
1998-12-19 12:38:52 +00:00
|
|
|
wxSize LayoutItems();
|
2000-07-15 19:51:35 +00:00
|
|
|
|
|
|
|
virtual void DoSetSize( int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO );
|
|
|
|
virtual void OnInternalIdle();
|
2002-02-17 22:45:08 +00:00
|
|
|
|
2000-07-15 19:51:35 +00:00
|
|
|
bool m_hasFocus,
|
|
|
|
m_lostFocus;
|
1998-12-19 12:38:52 +00:00
|
|
|
int m_majorDim;
|
1998-09-08 00:27:29 +00:00
|
|
|
wxList m_boxes;
|
2000-07-15 19:51:35 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
1999-10-14 13:09:01 +00:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxRadioBox)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __GTKRADIOBOXH__
|