2001-02-08 13:57:23 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/gtk/tglbtn.h
|
|
|
|
// 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
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) 2000 Johnny C. Norris II
|
2004-11-22 10:55:34 -05:00
|
|
|
// License: 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
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2005-08-02 18:58:06 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxToggleButton;
|
|
|
|
class WXDLLIMPEXP_CORE wxToggleBitmapButton;
|
2001-02-08 13:57:23 -05:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// global data
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2006-01-16 09:59:55 -05:00
|
|
|
extern WXDLLIMPEXP_CORE const wxChar wxCheckBoxNameStr[];
|
2001-02-08 13:57:23 -05:00
|
|
|
|
2004-03-07 11:46:36 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxToggleBitmapButton
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2005-08-02 18:58:06 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxToggleBitmapButton: public wxControl
|
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();
|
|
|
|
bool IsOwnGtkWindow(GdkWindow *window);
|
|
|
|
|
|
|
|
virtual void OnInternalIdle();
|
2006-02-08 16:47:09 -05:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void DoApplyWidgetStyle(GtkRcStyle *style);
|
2004-03-07 11:46:36 -05:00
|
|
|
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);
|
2001-11-17 18:50:58 -05:00
|
|
|
|
|
|
|
// implementation
|
|
|
|
bool m_blockEvent;
|
2001-02-08 13:57:23 -05:00
|
|
|
|
|
|
|
bool IsOwnGtkWindow(GdkWindow *window);
|
|
|
|
|
|
|
|
virtual void OnInternalIdle();
|
2006-02-08 16:47:09 -05:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void DoApplyWidgetStyle(GtkRcStyle *style);
|
2001-02-08 13:57:23 -05:00
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxToggleButton)
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _WX_GTK_TOGGLEBUTTON_H_
|
|
|
|
|