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); }
MainWnd::MainWnd() { set_border_width(0); irActionGroup = Gtk::ActionGroup::create("ActionGroup"); irActionGroup->add(Gtk::Action::create("MenuFile", "_File")); irActionGroup->add(Gtk::Action::create("Open", Gtk::Stock::OPEN), sigc::mem_fun(*this, &MainWnd::on_action_open)); irActionGroup->add(Gtk::Action::create("Save_as", Gtk::Stock::SAVE_AS), sigc::mem_fun(*this, &MainWnd::on_action_saveas)); irUiMgr = Gtk::UIManager::create(); irUiMgr->insert_action_group(irActionGroup); irUiMgr->add_ui_from_string(sUiInfo); Gtk::Widget* pMenuBar = irUiMgr->get_widget("/MenuBar"); Gtk::Widget* pToolBar = irUiMgr->get_widget("/ToolBar"); add(iVboxMain); iVboxMain.show(); // Base vertical layout: menu iVboxMain.pack_start(*pMenuBar, Gtk::PACK_SHRINK); // Base vertical layout: toolbar iVboxMain.pack_start(*pToolBar, Gtk::PACK_SHRINK); // Create main view client window irMainClientWnd = new Gtk::ScrolledWindow(); // Log view iLogWnd = new Gtk::ScrolledWindow(); iLogView = new LogView(); iLogWnd->add(*iLogView); iLogWnd->show(); // Visualization iVis.show(); // Services window iServ.show(); iServ.append_page(*iLogWnd, "Log"); iServ.append_page(iVis, "Visualization"); iVPanG.show(); // Base vertical layout: main horisontal layout iHPanG.show(); iVboxMain.pack_start(iVPanG, Gtk::PACK_EXPAND_WIDGET); // iVboxMain.pack_start(*irMainClientWnd, Gtk::PACK_EXPAND_WIDGET); // Detail view pane iHPanG.pack2(*irMainClientWnd, Gtk::EXPAND); iVPanG.pack1(iHPanG, Gtk::EXPAND); iVPanG.pack2(iServ, Gtk::EXPAND); pMenuBar->show(); pToolBar->show(); irMainClientWnd->show(); iLogView->show(); }
//------------------------------------------------------------------------------ void mforms::gtk::TableImpl::add(Table *self, View *child, int left, int right, int top, int bottom, int flags) { TableImpl *table = self->get_data<TableImpl>(); if (table) { if ((int)table->_colCount < right || (int)table->_rowCount < bottom) throw std::logic_error(base::strfmt("Tried to use col %d, row %d, but the table has got only %d cols, %d rows.", right, bottom, (int)table->_colCount, (int)table->_rowCount)); Gtk::Widget *widget = child->get_data<ViewImpl>()->get_outer(); if (widget) { int height = bottom - top; int width = right - left; table->_grid->attach(*widget, left, top, width, height); if (flags & mforms::VExpandFlag) widget->set_vexpand(); if (flags & mforms::VFillFlag) widget->set_valign(Gtk::ALIGN_FILL); if (flags & mforms::HExpandFlag) widget->set_hexpand(); if (flags & mforms::HFillFlag) widget->set_halign(Gtk::ALIGN_FILL); widget->show(); } } }
void Dockable::add(Gtk::Widget& x) { if(prev_widget_) { remove(*prev_widget_); clear_previous(); } if(scrolled_) { delete scrolled_; scrolled_=0; } if(use_scrolled_) { scrolled_=new Gtk::ScrolledWindow; scrolled_->add(x); attach(*scrolled_, 0, 1, 1,2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); x.show(); scrolled_->show(); scrolled_->set_shadow_type(Gtk::SHADOW_NONE); scrolled_->set_policy(Gtk::POLICY_AUTOMATIC,Gtk::POLICY_AUTOMATIC); prev_widget_=scrolled_; } else { attach(x, 0, 1, 1,2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); x.show(); prev_widget_=&x; } prev_widget_delete_connection=prev_widget_->signal_delete_event().connect( sigc::hide( sigc::mem_fun( *this, &Dockable::clear_previous ) ) ); }
void GridWindow::on_action_view_toolbar() { Gtk::Widget *pToolBar = mUIManager->get_widget("/ToolBar"); if (pToolBar->is_visible()) pToolBar->hide(); else pToolBar->show(); }
SearchNotesWidget::SearchNotesWidget(NoteManager & m) : m_accel_group(Gtk::AccelGroup::create()) , m_no_matches_box(NULL) , m_manager(m) , m_clickX(0), m_clickY(0) , m_matches_column(NULL) , m_note_list_context_menu(NULL) , m_notebook_list_context_menu(NULL) , m_initial_position_restored(false) , m_sort_column_id(2) , m_sort_column_order(Gtk::SORT_DESCENDING) { set_hexpand(true); set_vexpand(true); make_actions(); // Notebooks Pane Gtk::Widget *notebooksPane = Gtk::manage(make_notebooks_pane()); notebooksPane->show(); set_position(150); add1(*notebooksPane); add2(m_matches_window); make_recent_tree(); m_tree = manage(m_tree); m_tree->set_enable_search(false); m_tree->show(); update_results(); m_matches_window.property_hscrollbar_policy() = Gtk::POLICY_AUTOMATIC; m_matches_window.property_vscrollbar_policy() = Gtk::POLICY_AUTOMATIC; m_matches_window.add(*m_tree); m_matches_window.show(); // Update on changes to notes m.signal_note_deleted.connect(sigc::mem_fun(*this, &SearchNotesWidget::on_note_deleted)); m.signal_note_added.connect(sigc::mem_fun(*this, &SearchNotesWidget::on_note_added)); m.signal_note_renamed.connect(sigc::mem_fun(*this, &SearchNotesWidget::on_note_renamed)); m.signal_note_saved.connect(sigc::mem_fun(*this, &SearchNotesWidget::on_note_saved)); // Watch when notes are added to notebooks so the search // results will be updated immediately instead of waiting // until the note's queue_save () kicks in. notebooks::NotebookManager::obj().signal_note_added_to_notebook() .connect(sigc::mem_fun(*this, &SearchNotesWidget::on_note_added_to_notebook)); notebooks::NotebookManager::obj().signal_note_removed_from_notebook() .connect(sigc::mem_fun(*this, &SearchNotesWidget::on_note_removed_from_notebook)); notebooks::NotebookManager::obj().signal_note_pin_status_changed .connect(sigc::mem_fun(*this, &SearchNotesWidget::on_note_pin_status_changed)); Glib::RefPtr<Gio::Settings> settings = Preferences::obj().get_schema_settings(Preferences::SCHEMA_GNOTE); settings->signal_changed().connect(sigc::mem_fun(*this, &SearchNotesWidget::on_settings_changed)); parse_sorting_setting(settings->get_string(Preferences::SEARCH_SORTING)); settings = Preferences::obj().get_schema_settings(Preferences::SCHEMA_DESKTOP_GNOME_INTERFACE); settings->signal_changed().connect(sigc::mem_fun(*this, &SearchNotesWidget::on_settings_changed)); }
Gtk::VBox * Extension::get_params_widget(void) { Gtk::VBox * retval = Gtk::manage(new Gtk::VBox()); Gtk::Widget * content = Gtk::manage(new Gtk::Label("Params")); retval->pack_start(*content, true, true, 5); content->show(); retval->show(); return retval; }
void Dialog_ToolOptions::set_widget(Gtk::Widget&x) { std::vector<Gtk::Widget*> children = sub_vbox_.get_children(); for(std::vector<Gtk::Widget*>::iterator i = children.begin(); i != children.end(); ++i) sub_vbox_.remove(**i); sub_vbox_.show(); sub_vbox_.pack_start(x,false,false); x.show(); }
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); }
void MainWindow::toggle_show_menubar() { Gtk::Widget* menubar = App::ui_manager()->get_widget("/menubar-main"); if(toggling_show_menubar) { menubar->hide(); toggling_show_menubar = false; } else { menubar->show(); toggling_show_menubar = true; } App::enable_mainwin_menubar = toggling_show_menubar; }
//------------------------------------------------------------------------------ void DbMySQLTableEditor::toggle_header_part() { Gtk::Button *hide_button = 0; xml()->get_widget("hide_button", hide_button); Gtk::Image *image = 0; xml()->get_widget("table_editor_image", image); const bool make_image_small = image->get_data("is_large"); image->set(ImageCache::get_instance()->image_from_filename(make_image_small ? "db.Table.editor.24x24.png" : "db.Table.editor.48x48.png", false)); image->set_data("is_large", (void*)(!make_image_small)); Gtk::VBox* image_box = dynamic_cast<Gtk::VBox*>(hide_button->get_image()); if (image_box) { const std::vector<Gtk::Widget*> images = image_box->get_children(); for (int i = ((int)images.size()) - 1; i >= 0; --i) { if (images[i]->is_visible()) images[i]->hide(); else images[i]->show(); } const char* const names[] = {"collation_label", "collation_combo", "engine_label", "engine_combo", "comment_box"}; const int names_size = sizeof(names) / sizeof(const char**); for (int i = 0; i < names_size; ++i) { Gtk::Widget* w = 0; xml()->get_widget(names[i], w); if (w) { if (w->is_visible()) w->hide(); else w->show(); } } } }
//------------------------------------------------------------------------------ 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; }