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