コード例 #1
0
void myg_image_button_set(Gtk::Button &button,
                          const Gtk::StockID& lhs,
                          const Glib::ustring &label)
{
  Gtk::Box *box= static_cast<Gtk::Box*>(*static_cast<Gtk::Container*>(button.get_child())->get_children().begin());
  Gtk::Label *label_w;
  Gtk::Image *image_w;

  image_w= static_cast<Gtk::Image*>(*box->get_children().begin());
  label_w= static_cast<Gtk::Label*>(*++box->get_children().begin());
  
  image_w->set(lhs, Gtk::ICON_SIZE_BUTTON);
  label_w->set_text(label);
}
コード例 #2
0
void myg_image_button_set(Gtk::Button &button,
                          const Glib::RefPtr<Gdk::Pixbuf> &image,
                          const Glib::ustring &label)
{
  Gtk::Box *box= static_cast<Gtk::Box*>(*static_cast<Gtk::Container*>(button.get_child())->get_children().begin());
  Gtk::Label *label_w;
  Gtk::Image *image_w;

  image_w= static_cast<Gtk::Image*>(*box->get_children().begin());
  label_w= static_cast<Gtk::Label*>(*++box->get_children().begin());
  
  image_w->set(image);
  label_w->set_text(label);
}