// Created: 08.02.01
// RCS-ID: $Id$
// Copyright: (c) 2000 Johnny C. Norris II
-// License: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
void wxBitmapToggleButton::OnSetBitmap()
{
- if (!m_bitmap.Ok()) return;
+ if (!m_bitmap.IsOk()) return;
- GtkWidget* image = ((GtkBin*)m_widget)->child;
+ GtkWidget* image = gtk_bin_get_child(GTK_BIN(m_widget));
if (image == NULL)
{
image = gtk_image_new();
if (!wxControl::Enable(enable))
return false;
- gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable);
+ gtk_widget_set_sensitive(gtk_bin_get_child(GTK_BIN(m_widget)), enable);
if (!isEnabled && enable)
{
void wxBitmapToggleButton::DoApplyWidgetStyle(GtkRcStyle *style)
{
gtk_widget_modify_style(m_widget, style);
- gtk_widget_modify_style(GTK_BIN(m_widget)->child, style);
+ gtk_widget_modify_style(gtk_bin_get_child(GTK_BIN(m_widget)), style);
}
GdkWindow *
{
wxSize best;
- if (m_bitmap.Ok())
+ if (m_bitmap.IsOk())
{
int border = HasFlag(wxNO_BORDER) ? 4 : 10;
best.x = m_bitmap.GetWidth()+border;
{
wxCHECK_MSG(m_widget != NULL, false, wxT("invalid toggle button"));
- return GTK_TOGGLE_BUTTON(m_widget)->active;
+ return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_widget)) != 0;
}
void wxToggleButton::SetLabel(const wxString& label)
bool wxToggleButton::Enable(bool enable /*=true*/)
{
- bool isEnabled = IsEnabled();
-
- if (!wxControl::Enable(enable))
+ if (!base_type::Enable(enable))
return false;
- gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable);
+ gtk_widget_set_sensitive(gtk_bin_get_child(GTK_BIN(m_widget)), enable);
- if (!isEnabled && enable)
- {
+ if (enable)
GTKFixSensitivity();
- }
return true;
}
void wxToggleButton::DoApplyWidgetStyle(GtkRcStyle *style)
{
gtk_widget_modify_style(m_widget, style);
- gtk_widget_modify_style(GTK_BIN(m_widget)->child, style);
+ gtk_widget_modify_style(gtk_bin_get_child(GTK_BIN(m_widget)), style);
}
GdkWindow *