// Purpose: Definition of the wxToggleButton class, which implements a
// toggle button under wxGTK.
// Author: John Norris, minor changes by Axel Schlueter
// Purpose: Definition of the wxToggleButton class, which implements a
// toggle button under wxGTK.
// Author: John Norris, minor changes by Axel Schlueter
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
extern bool g_blockEventsOnDrag;
extern wxCursor g_globalCursor;
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
extern bool g_blockEventsOnDrag;
extern wxCursor g_globalCursor;
- if (g_isIdle)
- wxapp_install_idle_handler();
-
- if (!cb->m_hasVMT || g_blockEventsOnDrag)
- return;
-
- if (cb->m_blockEvent) return;
-
- // Generate a wx event.
- wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, cb->GetId());
- event.SetInt(cb->GetValue());
- event.SetEventObject(cb);
- cb->GetEventHandler()->ProcessEvent(event);
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ if (!cb->m_hasVMT || g_blockEventsOnDrag)
+ return;
+
+ if (cb->m_blockEvent) return;
+
+ // Generate a wx event.
+ wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, cb->GetId());
+ event.SetInt(cb->GetValue());
+ event.SetEventObject(cb);
+ cb->GetEventHandler()->ProcessEvent(event);
+}
if (!PreCreation(parent, pos, size) ||
!CreateBase(parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG(wxT("wxToggleBitmapButton creation failed"));
if (!PreCreation(parent, pos, size) ||
!CreateBase(parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG(wxT("wxToggleBitmapButton creation failed"));
}
// void SetValue(bool state)
// Set the value of the toggle button.
void wxToggleBitmapButton::SetValue(bool state)
{
}
// void SetValue(bool state)
// Set the value of the toggle button.
void wxToggleBitmapButton::SetValue(bool state)
{
if (m_bitmap.Ok())
{
int border = HasFlag(wxNO_BORDER) ? 4 : 10;
best.x = m_bitmap.GetWidth()+border;
best.y = m_bitmap.GetHeight()+border;
}
if (m_bitmap.Ok())
{
int border = HasFlag(wxNO_BORDER) ? 4 : 10;
best.x = m_bitmap.GetWidth()+border;
best.y = m_bitmap.GetHeight()+border;
}
- if (!PreCreation(parent, pos, size) ||
- !CreateBase(parent, id, pos, size, style, validator, name )) {
- wxFAIL_MSG(wxT("wxToggleButton creation failed"));
- return FALSE;
- }
+ if (!PreCreation(parent, pos, size) ||
+ !CreateBase(parent, id, pos, size, style, validator, name )) {
+ wxFAIL_MSG(wxT("wxToggleButton creation failed"));
+ return false;
+ }
- gtk_signal_connect(GTK_OBJECT(m_widget), "clicked",
- GTK_SIGNAL_FUNC(gtk_togglebutton_clicked_callback),
- (gpointer *)this);
+ gtk_signal_connect(GTK_OBJECT(m_widget), "clicked",
+ GTK_SIGNAL_FUNC(gtk_togglebutton_clicked_callback),
+ (gpointer *)this);
}
// void SetValue(bool state)
// Set the value of the toggle button.
void wxToggleButton::SetValue(bool state)
{
}
// void SetValue(bool state)
// Set the value of the toggle button.
void wxToggleButton::SetValue(bool state)
{
wxControl::SetLabel(label);
gtk_label_set(GTK_LABEL(BUTTON_CHILD(m_widget)), wxGTK_CONV( GetLabel() ) );
wxControl::SetLabel(label);
gtk_label_set(GTK_LABEL(BUTTON_CHILD(m_widget)), wxGTK_CONV( GetLabel() ) );
// Get the "best" size for this control.
wxSize wxToggleButton::DoGetBestSize() const
{
wxSize ret(wxControl::DoGetBestSize());
// Get the "best" size for this control.
wxSize wxToggleButton::DoGetBestSize() const
{
wxSize ret(wxControl::DoGetBestSize());