Re: How to change the color on Insensitive state for a Gtk::CheckButton?



Hi,

I found that one may use a Gtk::Style <http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1Style.html> to set the colors of a Gtk::Widget.
For example:

/// lets
Gtk::CheckButton *m_chkbt;

// set checkbutton state
m_chkbt->set_active();
m_chkbt->set_state(Gtk::STATE_INSENSITIVE);

//obtain a style
   Glib::RefPtr<Gtk::Style> m_style = Gtk::Style::create();
m_style->set_base (Gtk::STATE_INSENSITIVE, Gdk::Color::Color("red"));
   m_style->set_fg (Gtk::STATE_INSENSITIVE, Gdk::Color::Color("blue"));
   m_style->set_bg (Gtk::STATE_INSENSITIVE, Gdk::Color::Color("green"));
// apply m_style to the Gtk::CheckButton
m_chkbt->set_style (m_style);
/
Hope this helps you.

Cheers,
Mihai Niculescu


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]