24 #include <gtkmm/main.h>
33 StateButton::StateButton ()
35 , _self_managed (false)
36 , _is_realized (false)
37 , style_changing (false)
38 , state_before_prelight (
Gtk::STATE_NORMAL)
57 name = name.substr (0, name.find_last_of (
'-'));
72 name +=
"-alternate2";
91 if (gtk_widget_get_state (widget) == GTK_STATE_PRELIGHT) {
98 GtkRcStyle* rcstyle = gtk_widget_get_modifier_style (widget);
99 GtkStyle* style = gtk_widget_get_style (widget);
103 rcstyle->color_flags[GTK_STATE_PRELIGHT] = (GtkRcFlags) (GTK_RC_FG|GTK_RC_BG);
106 g_object_ref (rcstyle);
107 gtk_widget_modify_style (widget, rcstyle);
111 gtk_widget_modify_style (GTK_WIDGET(child->gobj()), rcstyle);
115 g_object_unref (rcstyle);
123 GtkStateType state = gtk_widget_get_state (widget);
125 if (state == GTK_STATE_PRELIGHT) {
135 GtkRcStyle* rcstyle = gtk_widget_get_modifier_style (widget);
136 GtkStyle* style = gtk_widget_get_style (widget);
138 rcstyle->fg[GTK_STATE_PRELIGHT] = style->fg[old_state];
139 rcstyle->bg[GTK_STATE_PRELIGHT] = style->bg[old_state];
140 rcstyle->color_flags[GTK_STATE_PRELIGHT] = (GtkRcFlags) (GTK_RC_FG|GTK_RC_BG);
142 g_object_ref (rcstyle);
143 gtk_widget_modify_style (widget, rcstyle);
148 gtk_widget_modify_style (GTK_WIDGET(child->gobj()), rcstyle);
151 g_object_unref (rcstyle);
164 : ToggleButton (label)
172 ToggleButton::on_realize ();
182 Button::on_realize ();
194 set_state (Gtk::STATE_ACTIVE);
196 set_state (Gtk::STATE_NORMAL);
206 Button::on_style_changed (style);
213 Button::on_state_changed (old_state);
226 Widget* w = get_child();
248 Button::on_style_changed (style);
255 Button::on_state_changed (old_state);
268 Widget* w = get_child();