2001-02-08 13:57:23 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2006-01-22 21:28:01 -05:00
|
|
|
// Name: wx/gtk1/tglbtn.h
|
2001-02-08 13:57:23 -05:00
|
|
|
// Purpose: Declaration of the wxToggleButton class, which implements a
|
|
|
|
// toggle button under wxGTK.
|
|
|
|
// Author: John Norris, minor changes by Axel Schlueter
|
|
|
|
// Modified by:
|
|
|
|
// Created: 08.02.01
|
|
|
|
// Copyright: (c) 2000 Johnny C. Norris II
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2001-02-08 13:57:23 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_GTK_TOGGLEBUTTON_H_
|
|
|
|
#define _WX_GTK_TOGGLEBUTTON_H_
|
|
|
|
|
2004-03-07 11:46:36 -05:00
|
|
|
#include "wx/bitmap.h"
|
|
|
|
|
2001-02-08 13:57:23 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2007-07-09 06:09:52 -04:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxToggleButton;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxToggleBitmapButton;
|
2001-02-08 13:57:23 -05:00
|
|
|
|
2004-03-07 11:46:36 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxToggleBitmapButton
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2007-12-08 05:43:10 -05:00
|
|
|
class WXDLLIMPEXP_CORE wxToggleBitmapButton: public wxToggleButtonBase
|
2004-03-07 11:46:36 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// construction/destruction
|
|
|
|
wxToggleBitmapButton() {}
|
|
|
|
wxToggleBitmapButton(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxBitmap& label,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxCheckBoxNameStr)
|
|
|
|
{
|
|
|
|
Create(parent, id, label, pos, size, style, validator, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create the control
|
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxBitmap& label,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize, long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxCheckBoxNameStr);
|
|
|
|
|
|
|
|
// Get/set the value
|
|
|
|
void SetValue(bool state);
|
|
|
|
bool GetValue() const;
|
|
|
|
|
|
|
|
// Set the label
|
2005-09-25 15:59:19 -04:00
|
|
|
virtual void SetLabel(const wxString& label) { wxControl::SetLabel(label); }
|
|
|
|
virtual void SetLabel(const wxBitmap& label);
|
2004-03-07 11:46:36 -05:00
|
|
|
bool Enable(bool enable = TRUE);
|
|
|
|
|
2004-05-06 13:26:25 -04:00
|
|
|
static wxVisualAttributes
|
|
|
|
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
|
|
|
|
2004-03-07 11:46:36 -05:00
|
|
|
// implementation
|
|
|
|
bool m_blockEvent;
|
|
|
|
wxBitmap m_bitmap;
|
|
|
|
|
|
|
|
void OnSetBitmap();
|
2004-06-14 13:34:00 -04:00
|
|
|
void DoApplyWidgetStyle(GtkRcStyle *style);
|
2004-03-07 11:46:36 -05:00
|
|
|
bool IsOwnGtkWindow(GdkWindow *window);
|
|
|
|
|
|
|
|
virtual void OnInternalIdle();
|
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxToggleBitmapButton)
|
|
|
|
};
|
2004-05-06 13:26:25 -04:00
|
|
|
|
2001-02-08 13:57:23 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxToggleButton
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2005-08-02 18:58:06 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxToggleButton: public wxControl
|
2001-02-08 13:57:23 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// construction/destruction
|
|
|
|
wxToggleButton() {}
|
|
|
|
wxToggleButton(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& label,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxCheckBoxNameStr)
|
|
|
|
{
|
|
|
|
Create(parent, id, label, pos, size, style, validator, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create the control
|
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& label,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize, long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxCheckBoxNameStr);
|
|
|
|
|
|
|
|
// Get/set the value
|
|
|
|
void SetValue(bool state);
|
|
|
|
bool GetValue() const;
|
|
|
|
|
|
|
|
// Set the label
|
|
|
|
void SetLabel(const wxString& label);
|
|
|
|
bool Enable(bool enable = TRUE);
|
|
|
|
|
2004-05-06 13:26:25 -04:00
|
|
|
static wxVisualAttributes
|
|
|
|
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
2006-01-22 21:28:01 -05:00
|
|
|
|
2001-11-17 18:50:58 -05:00
|
|
|
// implementation
|
|
|
|
bool m_blockEvent;
|
2001-02-08 13:57:23 -05:00
|
|
|
|
2004-06-14 13:34:00 -04:00
|
|
|
void DoApplyWidgetStyle(GtkRcStyle *style);
|
2001-02-08 13:57:23 -05:00
|
|
|
bool IsOwnGtkWindow(GdkWindow *window);
|
|
|
|
|
|
|
|
virtual void OnInternalIdle();
|
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxToggleButton)
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _WX_GTK_TOGGLEBUTTON_H_
|
|
|
|
|