applied (slightly modified) wxToggleButton patch from John Norris and Axel Schlueter
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9333 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -370,6 +370,7 @@ public:
|
||||
wxEVT_COMMAND_SCROLLBAR_UPDATED
|
||||
wxEVT_COMMAND_VLBOX_SELECTED
|
||||
wxEVT_COMMAND_COMBOBOX_SELECTED
|
||||
wxEVT_COMMAND_TOGGLEBUTTON_CLICKED
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxCommandEvent : public wxEvent
|
||||
|
83
include/wx/gtk/tglbtn.h
Normal file
83
include/wx/gtk/tglbtn.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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
|
||||
// License: Rocketeer license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GTK_TOGGLEBUTTON_H_
|
||||
#define _WX_GTK_TOGGLEBUTTON_H_
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxToggleButton;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// global data
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
extern const char *wxCheckBoxNameStr;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxToggleButton
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxToggleButton: public wxControl
|
||||
{
|
||||
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);
|
||||
|
||||
protected:
|
||||
// Callback function given to gtk
|
||||
static void gtk_togglebutton_clicked_callback(GtkWidget *widget,
|
||||
wxToggleButton *win);
|
||||
|
||||
// wx stuff
|
||||
void ApplyWidgetStyle();
|
||||
bool IsOwnGtkWindow(GdkWindow *window);
|
||||
|
||||
virtual void OnInternalIdle();
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxToggleButton)
|
||||
};
|
||||
|
||||
#endif // _WX_GTK_TOGGLEBUTTON_H_
|
||||
|
83
include/wx/gtk1/tglbtn.h
Normal file
83
include/wx/gtk1/tglbtn.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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
|
||||
// License: Rocketeer license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GTK_TOGGLEBUTTON_H_
|
||||
#define _WX_GTK_TOGGLEBUTTON_H_
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxToggleButton;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// global data
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
extern const char *wxCheckBoxNameStr;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxToggleButton
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxToggleButton: public wxControl
|
||||
{
|
||||
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);
|
||||
|
||||
protected:
|
||||
// Callback function given to gtk
|
||||
static void gtk_togglebutton_clicked_callback(GtkWidget *widget,
|
||||
wxToggleButton *win);
|
||||
|
||||
// wx stuff
|
||||
void ApplyWidgetStyle();
|
||||
bool IsOwnGtkWindow(GdkWindow *window);
|
||||
|
||||
virtual void OnInternalIdle();
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxToggleButton)
|
||||
};
|
||||
|
||||
#endif // _WX_GTK_TOGGLEBUTTON_H_
|
||||
|
@@ -379,6 +379,7 @@
|
||||
#define wxUSE_SPINCTRL 1
|
||||
#define wxUSE_STATLINE 1
|
||||
#define wxUSE_STATUSBAR 1
|
||||
#define wxUSE_TOGGLEBTN 1 // requires wxButton
|
||||
#define wxUSE_TOOLTIPS 1 // wxToolTip and wxWindow::SetToolTip()
|
||||
|
||||
// Two status bar implementations are available under Win32: the generic one
|
||||
|
59
include/wx/msw/tglbtn.h
Normal file
59
include/wx/msw/tglbtn.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/msw/tglbtn.h
|
||||
// Purpose: Declaration of the wxToggleButton class, which implements a
|
||||
// toggle button under wxMSW.
|
||||
// Author: John Norris, minor changes by Axel Schlueter
|
||||
// Modified by:
|
||||
// Created: 08.02.01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Johnny C. Norris II
|
||||
// License: Rocketeer license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_TOGGLEBUTTON_H_
|
||||
#define _WX_TOGGLEBUTTON_H_
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxCheckBoxNameStr;
|
||||
|
||||
// Checkbox item (single checkbox)
|
||||
class WXDLLEXPORT wxToggleButton : public wxControl
|
||||
{
|
||||
public:
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
virtual void SetValue(bool value);
|
||||
virtual bool GetValue() const ;
|
||||
|
||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||
virtual void SetLabel(const wxString& label);
|
||||
virtual void Command(wxCommandEvent& event);
|
||||
|
||||
protected:
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxToggleButton)
|
||||
};
|
||||
|
||||
#endif // _WX_TOGGLEBUTTON_H_
|
||||
|
50
include/wx/tglbtn.h
Normal file
50
include/wx/tglbtn.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/tglbtn.h
|
||||
// Purpose: This dummy header includes the proper header file for the
|
||||
// system we're compiling under.
|
||||
// Author: John Norris, minor changes by Axel Schlueter
|
||||
// Modified by:
|
||||
// Created: 08.02.01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Johnny C. Norris II
|
||||
// License: Rocketeer license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_TOGGLEBUTTON_H_BASE_
|
||||
#define _WX_TOGGLEBUTTON_H_BASE_
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_TOGGLEBTN
|
||||
|
||||
#include "wx/event.h"
|
||||
#include "wx/control.h" // base class
|
||||
|
||||
BEGIN_DECLARE_EVENT_TYPES()
|
||||
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, 19)
|
||||
END_DECLARE_EVENT_TYPES()
|
||||
|
||||
#define EVT_TOGGLEBUTTON(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL ),
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/tglbtn.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/tglbtn.h"
|
||||
/*
|
||||
# elif defined(__WXMOTIF__)
|
||||
# include "wx/motif/tglbtn.h"
|
||||
# elif defined(__WXQT__)
|
||||
# include "wx/qt/tglbtn.h"
|
||||
# elif defined(__WXMAC__)
|
||||
# include "wx/mac/tglbtn.h"
|
||||
# elif defined(__WXPM__)
|
||||
# include "wx/os2/tglbtn.h"
|
||||
# elif defined(__WXSTUBS__)
|
||||
# include "wx/stubs/tglbtn.h"
|
||||
*/
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_TOGGLEBTN
|
||||
|
||||
#endif // _WX_TOGGLEBUTTON_H_BASE_
|
||||
|
Reference in New Issue
Block a user