//------------------------------------------------------------------------------ void mforms::gtk::ToolBarImpl::set_item_checked(mforms::ToolBarItem *item, bool toggled) { Gtk::ToggleButton *btn = cast<Gtk::ToggleButton *>(item->get_data_ptr()); if (btn) { btn->set_data("ignore_signal", (void *)1); btn->set_active(toggled); btn->set_data("ignore_signal", (void *)0); } }
//------------------------------------------------------------------------------ void mforms::gtk::ToolBarImpl::set_item_alt_icon(mforms::ToolBarItem *item, const std::string &image_path) { Gtk::ToggleButton *btn = cast<Gtk::ToggleButton *>(item->get_data_ptr()); if (btn) { static ImageCache *images = ImageCache::get_instance(); Gtk::Image *img = new Gtk::Image(images->image_from_path(image_path)); if (img) { btn->set_data("alt_icon", img, free_icon); btn->signal_toggled().connect(sigc::bind(sigc::ptr_fun(swap_icons), btn)); } } }