/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
- 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;
- }
- wxControl::SetLabel(label);
+ 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);
+ // Create the gtk widget.
+ m_widget = gtk_toggle_button_new_with_label( wxGTK_CONV( m_label ) );
+
+ 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)
{
// 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());