Gtk::Widget * PathParam::param_newWidget() { Gtk::HBox * _widget = Gtk::manage(new Gtk::HBox()); Gtk::Label* pLabel = Gtk::manage(new Gtk::Label(param_label)); static_cast<Gtk::HBox*>(_widget)->pack_start(*pLabel, true, true); pLabel->set_tooltip_text(param_tooltip); Gtk::Widget* pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("tool-node-editor"), Inkscape::ICON_SIZE_BUTTON) ); Gtk::Button * pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); pButton->add(*pIcon); pButton->show(); pButton->signal_clicked().connect(sigc::mem_fun(*this, &PathParam::on_edit_button_click)); static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true); pButton->set_tooltip_text(_("Edit on-canvas")); pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("edit-copy"), Inkscape::ICON_SIZE_BUTTON) ); pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); pButton->add(*pIcon); pButton->show(); pButton->signal_clicked().connect(sigc::mem_fun(*this, &PathParam::on_copy_button_click)); static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true); pButton->set_tooltip_text(_("Copy path")); pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("edit-paste"), Inkscape::ICON_SIZE_BUTTON) ); pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); pButton->add(*pIcon); pButton->show(); pButton->signal_clicked().connect(sigc::mem_fun(*this, &PathParam::on_paste_button_click)); static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true); pButton->set_tooltip_text(_("Paste path")); pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("edit-clone"), Inkscape::ICON_SIZE_BUTTON) ); pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); pButton->add(*pIcon); pButton->show(); pButton->signal_clicked().connect(sigc::mem_fun(*this, &PathParam::on_link_button_click)); static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true); pButton->set_tooltip_text(_("Link to path on clipboard")); static_cast<Gtk::HBox*>(_widget)->show_all_children(); return dynamic_cast<Gtk::Widget *> (_widget); }
static void gradsel_style_button(GtkWidget *gtkbtn, char const *iconName) { Gtk::Button *btn = Glib::wrap(GTK_BUTTON(gtkbtn)); GtkWidget *child = sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName); gtk_widget_show(child); btn->add(*manage(Glib::wrap(child))); btn->set_relief(Gtk::RELIEF_NONE); }
Gtk::Widget * OriginalPathParam::param_newWidget() { Gtk::HBox *_widget = Gtk::manage(new Gtk::HBox()); { // Label Gtk::Label *pLabel = Gtk::manage(new Gtk::Label(param_label)); static_cast<Gtk::HBox*>(_widget)->pack_start(*pLabel, true, true); pLabel->set_tooltip_text(param_tooltip); } { // Paste path to link button Gtk::Widget *pIcon = Gtk::manage( sp_icon_get_icon( GTK_STOCK_PASTE, Inkscape::ICON_SIZE_BUTTON) ); Gtk::Button *pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); pButton->add(*pIcon); pButton->show(); pButton->signal_clicked().connect(sigc::mem_fun(*this, &OriginalPathParam::on_link_button_click)); static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true); pButton->set_tooltip_text(_("Link to path")); } { // Select original button Gtk::Widget *pIcon = Gtk::manage( sp_icon_get_icon("edit-select-original", Inkscape::ICON_SIZE_BUTTON) ); Gtk::Button *pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); pButton->add(*pIcon); pButton->show(); pButton->signal_clicked().connect(sigc::mem_fun(*this, &OriginalPathParam::on_select_original_button_click)); static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true); pButton->set_tooltip_text(_("Select original")); } static_cast<Gtk::HBox*>(_widget)->show_all_children(); return dynamic_cast<Gtk::Widget *> (_widget); }
Gtk::Button * FrameDial::create_icon(Gtk::IconSize iconsize, const char * stockid, const char * tooltip) { iconsize = Gtk::IconSize::from_name("synfig-small_icon_16x16"); Gtk::Image *icon = Gtk::manage(new Gtk::Image(Gtk::StockID(stockid), iconsize)); Gtk::Button *button = Gtk::manage(new class Gtk::Button()); button->add(*icon); button->set_tooltip_text(tooltip); icon->set_padding(0, 0); icon->show(); button->set_relief(Gtk::RELIEF_NONE); button->show(); return button; }
Gtk::Button * ZoomDial::create_icon(Gtk::IconSize size, const Gtk::BuiltinStockID & stockid, const char * tooltip) { Gtk::Button *button = manage(new class Gtk::Button()); Gtk::Image *icon = manage(new Gtk::Image(stockid, size)); button->add(*icon); button->set_tooltip_text(tooltip); icon->set_padding(0, 0); icon->show(); button->set_relief(Gtk::RELIEF_NONE); button->show(); return button; }
int NetLogGuiGtkWindow::on_service_added(fawkes::NetworkService *service) { if ( ntb_logviewers.get_n_pages() == 0 ) { lab_no_connection->hide(); //Gtk::Container *thiscon = this; //thiscon->remove(lab_no_connection); //add(ntb_logviewers); ntb_logviewers.show(); } Gtk::HBox *hbox = Gtk::manage(new Gtk::HBox(false, 4)); Gtk::Button *button = Gtk::manage(new Gtk::Button()); Gtk::Image *image = Gtk::manage(new Gtk::Image(Gtk::Stock::CONNECT, Gtk::ICON_SIZE_BUTTON)); button->add(*image); button->set_relief(Gtk::RELIEF_NONE); Gtk::Label *label = Gtk::manage(new Gtk::Label()); label->set_markup(Glib::ustring("<b>") + service->host() + "</b>\n" + service->addr_string()); label->set_line_wrap(); Gtk::Label *invisible = Gtk::manage(new Gtk::Label(Glib::ustring(service->name()) + "::" + service->type() + "::" + service->domain())); Gtk::ScrolledWindow *scrolled = Gtk::manage(new Gtk::ScrolledWindow()); scrolled->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); LogView *logview = Gtk::manage(new LogView(service->addr_string().c_str(), service->port())); //scrolled->add(*logview); hbox->pack_start(*button); hbox->pack_start(*label); hbox->pack_start(*invisible); button->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this, &NetLogGuiGtkWindow::on_connbut_clicked), image, logview)); logview->get_connection_dispatcher()->signal_connected().connect(sigc::bind(sigc::mem_fun(*this, &NetLogGuiGtkWindow::on_connected), image)); logview->get_connection_dispatcher()->signal_disconnected().connect(sigc::bind(sigc::mem_fun(*this, &NetLogGuiGtkWindow::on_disconnected), image)); scrolled->show(); label->show(); image->show(); button->show(); logview->show(); hbox->show(); int rv = ntb_logviewers.append_page(*logview, *hbox); return rv; }
//------------------------------------------------------------------------------ bool mforms::gtk::ToolBarImpl::create_tool_item(mforms::ToolBarItem *item, ToolBarItemType type) { Gtk::Widget *w = 0; switch (type) { case mforms::TextActionItem: case mforms::ActionItem: case mforms::SwitcherItem: { Gtk::Button *btn = Gtk::manage(new Gtk::Button()); btn->set_focus_on_click(false); btn->set_border_width(0); btn->set_relief(Gtk::RELIEF_NONE); btn->signal_clicked().connect(sigc::bind(sigc::ptr_fun(process_ctrl_action), btn, item)); if (type == mforms::SwitcherItem) btn->set_always_show_image(true); w = btn; break; } case mforms::SegmentedToggleItem: case mforms::ToggleItem: { Gtk::ToggleButton *btn = Gtk::manage(new Gtk::ToggleButton()); btn->set_focus_on_click(false); btn->set_relief(Gtk::RELIEF_NONE); btn->signal_toggled().connect(sigc::bind(sigc::ptr_fun(process_ctrl_action), btn, item)); btn->set_inconsistent(false); w = btn; break; } case mforms::SeparatorItem: { Gtk::Separator *sep = new Gtk::Separator(Gtk::ORIENTATION_VERTICAL); w = sep; break; } case mforms::SearchFieldItem: { #if GTK_VERSION_GE(2, 16) Gtk::Entry *entry = Gtk::manage(new Gtk::Entry()); w = entry; entry->set_icon_from_stock(Gtk::Stock::FIND); #else Gtk::Box *hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0)); w = hbox; Gtk::Image *image = Gtk::manage(new Gtk::Image(Gtk::Stock::FIND, Gtk::ICON_SIZE_MENU)); Gtk::Entry *entry = Gtk::manage(new Gtk::Entry()); hbox->pack_start(*image, false, true); hbox->pack_start(*entry, true, true); hbox->set_data("entry", entry); hbox->show_all(); #endif entry->signal_activate().connect(sigc::bind(sigc::ptr_fun(process_ctrl_action), entry, item)); break; } case mforms::TextEntryItem: { Gtk::Box *hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0)); w = hbox; Gtk::Entry *entry = Gtk::manage(new Gtk::Entry()); hbox->pack_start(*entry, true, true); hbox->set_data("entry", entry); hbox->show_all(); entry->signal_activate().connect(sigc::bind(sigc::ptr_fun(process_ctrl_action), entry, item)); break; } case mforms::FlatSelectorItem: case mforms::SelectorItem: { Gtk::ComboBoxText *ct = Gtk::manage(new Gtk::ComboBoxText()); ct->signal_changed().connect(sigc::bind(sigc::ptr_fun(process_ctrl_action), ct, item)); w = ct; break; } case mforms::ColorSelectorItem: { if (!color_combo_columns) { color_combo_columns = new ColorComboColumns(); } Gtk::ComboBox *ct = Gtk::manage(new Gtk::ComboBox()); ct->pack_start(color_combo_columns->image); ct->signal_changed().connect(sigc::bind(sigc::ptr_fun(process_ctrl_action), ct, item)); w = ct; break; } case mforms::ExpanderItem: case mforms::LabelItem: { Gtk::Label *label = Gtk::manage(new Gtk::Label("", 0.0, 0.5)); w = label; break; } case mforms::ImageBoxItem: { Gtk::Image *image = Gtk::manage(new Gtk::Image()); w = image; break; } case mforms::TitleItem: { Gtk::Label *label = Gtk::manage(new Gtk::Label("", 0.0, 0.5)); w = label; auto provider = Gtk::CssProvider::create(); provider->load_from_data("* { color: #333; font-weight: bold; }"); w->get_style_context()->add_provider(provider, GTK_STYLE_PROVIDER_PRIORITY_USER); break; } } if (w) { w->show(); } else logError("create_tool_item, widget is 0 for passed type %i\n", type); item->set_data(w); return w != 0; }
sessionSelectionDialog::sessionSelectionDialog(std::string const& _title, t_longList const& _sessionIDs, t_strList const& _sessionsNames, bool const _disableSelection) : disableSelection_(_disableSelection), selected(false), session(Command::INVALID_SESSION), cbt(0) { Gtk::Button* cancelbutton = Gtk::manage(new class Gtk::Button(Gtk::StockID("gtk-cancel"))); Gtk::Button* okbutton = Gtk::manage(new class Gtk::Button(Gtk::StockID("gtk-ok"))); Gtk::Label* label = Gtk::manage(new class Gtk::Label(_title)); cbt = Gtk::manage(new class Gtk::ComboBoxText()); Gtk::VBox* vbox = Gtk::manage(new class Gtk::VBox(false, 0)); cancelbutton->set_flags(Gtk::CAN_FOCUS); cancelbutton->set_relief(Gtk::RELIEF_NORMAL); okbutton->set_flags(Gtk::CAN_FOCUS); okbutton->set_relief(Gtk::RELIEF_NORMAL); get_action_area()->property_layout_style().set_value(Gtk::BUTTONBOX_END); label->set_alignment(0.5,0.5); label->set_padding(0,0); label->set_justify(Gtk::JUSTIFY_LEFT); label->set_line_wrap(false); label->set_use_markup(false); label->set_selectable(false); vbox->pack_start(*label, Gtk::PACK_SHRINK, 0); vbox->pack_start(*cbt); get_vbox()->set_homogeneous(false); get_vbox()->set_spacing(0); get_vbox()->pack_start(*vbox); set_title(_title); set_modal(true); property_window_position().set_value(Gtk::WIN_POS_NONE); set_resizable(true); property_destroy_with_parent().set_value(false); set_has_separator(true); add_action_widget(*cancelbutton, -6); add_action_widget(*okbutton, -5); /// Fill the combobox with session ids. t_strListCI sessionNameIter = _sessionsNames.begin(); for (t_longListCI sessionIter = _sessionIDs.begin(); sessionIter != _sessionIDs.end(); sessionIter++) { std::string session_descr = convertToString<t_long>(*sessionIter); session_descr += " ("; session_descr += *sessionNameIter; session_descr += ")"; cbt->append_text(session_descr); sessionNameIter++; } // Select the first session id. cbt->set_active(0); if (!disableSelection_) { cancelbutton->show(); } okbutton->show(); label->show(); cbt->show(); vbox->show(); show(); // Connect buttons to handlers. okbutton->signal_clicked().connect(sigc::mem_fun(*this, &sessionSelectionDialog::on_ok_clicked)); if (!disableSelection_) { cancelbutton->signal_clicked().connect(sigc::mem_fun(*this, &sessionSelectionDialog::on_cancel_clicked)); } }
aboutDialog::aboutDialog() { Gtk::Dialog *ad = this; Gtk::Button *okbutton = Gtk::manage(new class Gtk::Button("ok")); Gtk::Label *aboutLabel = Gtk::manage(new class Gtk::Label( "About " + GPD->sGUI_CLIENT() + " " + GPD->sVERSION() + ", build " + GPD->sBUILD() )); Gtk::TextView *textview = Gtk::manage(new class Gtk::TextView()); Gtk::ScrolledWindow *scrolledwindow = Gtk::manage(new class Gtk::ScrolledWindow()); Gtk::VBox *vbox = Gtk::manage(new class Gtk::VBox(false, 0)); okbutton->set_flags(Gtk::CAN_FOCUS); okbutton->set_relief(Gtk::RELIEF_NORMAL); ad->get_action_area()->property_layout_style().set_value(Gtk::BUTTONBOX_END); ad->set_default_size(300, 200); aboutLabel->set_alignment(0.5,0.5); aboutLabel->set_padding(0,0); aboutLabel->set_justify(Gtk::JUSTIFY_LEFT); aboutLabel->set_line_wrap(false); aboutLabel->set_use_markup(false); aboutLabel->set_selectable(false); textview->set_flags(Gtk::CAN_FOCUS); textview->set_editable(true); textview->set_cursor_visible(true); textview->set_pixels_above_lines(0); textview->set_pixels_below_lines(0); textview->set_pixels_inside_wrap(0); textview->set_left_margin(0); textview->set_right_margin(0); textview->set_indent(0); textview->set_wrap_mode(Gtk::WRAP_NONE); textview->set_justification(Gtk::JUSTIFY_LEFT); using namespace std; string text; text += "btg Copyright (C) 2005 Michael Wojciechowski."; text += GPD->sNEWLINE(); text += "This program is free software; you can redistribute it and/or modify"; text += GPD->sNEWLINE(); text += "it under the terms of the GNU General Public License as published by "; text += GPD->sNEWLINE(); text += "the Free Software Foundation; either version 2 of the License, or "; text += GPD->sNEWLINE(); text += "(at your option) any later version."; text += GPD->sNEWLINE(); text += "This program is distributed in the hope that it will be useful, "; text += GPD->sNEWLINE(); text += "but WITHOUT ANY WARRANTY; without even the implied warranty of "; text += GPD->sNEWLINE(); text += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "; text += GPD->sNEWLINE(); text += "GNU General Public License for more details."; text += GPD->sNEWLINE(); text += "You should have received a copy of the GNU General Public License "; text += GPD->sNEWLINE(); text += "along with this program; if not, write to the Free Software "; text += GPD->sNEWLINE(); text += "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA"; text += GPD->sNEWLINE(); textview->get_buffer()->set_text(text); scrolledwindow->set_flags(Gtk::CAN_FOCUS); scrolledwindow->set_shadow_type(Gtk::SHADOW_IN); scrolledwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); scrolledwindow->property_window_placement().set_value(Gtk::CORNER_TOP_LEFT); scrolledwindow->add(*textview); vbox->pack_start(*aboutLabel, Gtk::PACK_SHRINK, 0); vbox->pack_start(*scrolledwindow); ad->get_vbox()->set_homogeneous(false); ad->get_vbox()->set_spacing(0); ad->get_vbox()->pack_start(*vbox); //ad->set_title( "About " + GPD->sGUI_CLIENT() + " " + GPD->sVERSION() ); ad->set_title( GPD->sGUI_CLIENT() + " " + GPD->sVERSION() + " / About" ); ad->set_modal(true); ad->property_window_position().set_value(Gtk::WIN_POS_CENTER); ad->set_resizable(true); ad->property_destroy_with_parent().set_value(false); ad->set_has_separator(true); ad->add_action_widget(*okbutton, -5); okbutton->show(); aboutLabel->show(); textview->show(); scrolledwindow->show(); vbox->show(); okbutton->signal_clicked().connect(sigc::mem_fun(*this, &aboutDialog::on_ok_clicked)); // ad->show(); }