void GridWindow::on_action_view_toolbar() { Gtk::Widget *pToolBar = mUIManager->get_widget("/ToolBar"); if (pToolBar->is_visible()) pToolBar->hide(); else pToolBar->show(); }
MainWindow::MainWindow() { set_default_size(600, 400); toggling_show_menubar = App::enable_mainwin_menubar; main_dock_book_ = manage(new DockBook()); main_dock_book_->allow_empty = true; main_dock_book_->show(); class Bin : public Gtk::Bin { public: Bin() { } protected: void on_size_allocate(Gtk::Allocation &allocation) { Gtk::Bin::on_size_allocate(allocation); if (get_child() != NULL) get_child()->size_allocate(allocation); } }; bin_ = manage((Gtk::Bin*)new Bin()); bin_->add(*main_dock_book_); bin_->show(); Gtk::VBox *vbox = manage(new Gtk::VBox()); Gtk::Widget* menubar = App::ui_manager()->get_widget("/menubar-main"); if (menubar != NULL) { vbox->pack_start(*menubar, false, false, 0); } vbox->pack_end(*bin_, true, true, 0); vbox->show(); if(!App::enable_mainwin_menubar) menubar->hide(); add(*vbox); add_accel_group(App::ui_manager()->get_accel_group()); init_menus(); window_action_group = Gtk::ActionGroup::create("mainwindow-recentfiles"); App::ui_manager()->insert_action_group(window_action_group); App::signal_recent_files_changed().connect( sigc::mem_fun(*this, &MainWindow::on_recent_files_changed) ); signal_delete_event().connect( sigc::ptr_fun(App::shutdown_request) ); App::dock_manager->signal_dockable_registered().connect( sigc::mem_fun(*this,&MainWindow::on_dockable_registered) ); App::dock_manager->signal_dockable_unregistered().connect( sigc::mem_fun(*this,&MainWindow::on_dockable_unregistered) ); GRAB_HINT_DATA("mainwindow"); }
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(); } } } }
void CamWnd::constructToolbar() { // If lighting is not available, grey out the lighting button Gtk::ToggleToolButton* lightingBtn = gladeWidget<Gtk::ToggleToolButton>( "lightingBtn" ); if (!GlobalRenderSystem().shaderProgramsAvailable()) { lightingBtn->set_sensitive(false); } // Listen for render-mode changes, and set the correct active button to // start with. getCameraSettings()->signalRenderModeChanged().connect( sigc::mem_fun(this, &CamWnd::updateActiveRenderModeButton) ); updateActiveRenderModeButton(); // Connect button signals gladeWidget<Gtk::ToggleToolButton>("texturedBtn")->signal_toggled().connect( sigc::mem_fun(*this, &CamWnd::onRenderModeButtonsChanged) ); lightingBtn->signal_toggled().connect( sigc::mem_fun(*this, &CamWnd::onRenderModeButtonsChanged) ); gladeWidget<Gtk::ToggleToolButton>("flatShadeBtn")->signal_toggled().connect( sigc::mem_fun(*this, &CamWnd::onRenderModeButtonsChanged) ); gladeWidget<Gtk::ToggleToolButton>("wireframeBtn")->signal_toggled().connect( sigc::mem_fun(*this, &CamWnd::onRenderModeButtonsChanged) ); // Far clip buttons. gladeWidget<Gtk::ToolButton>("clipPlaneInButton")->signal_clicked().connect( sigc::mem_fun(*this, &CamWnd::farClipPlaneIn) ); gladeWidget<Gtk::ToolButton>("clipPlaneOutButton")->signal_clicked().connect( sigc::mem_fun(*this, &CamWnd::farClipPlaneOut) ); setFarClipButtonSensitivity(); GlobalRegistry().signalForKey(RKEY_ENABLE_FARCLIP).connect( sigc::mem_fun(*this, &CamWnd::setFarClipButtonSensitivity) ); gladeWidget<Gtk::ToolButton>("startTimeButton")->signal_clicked().connect( sigc::mem_fun(*this, &CamWnd::startRenderTime) ); gladeWidget<Gtk::ToolButton>("stopTimeButton")->signal_clicked().connect( sigc::mem_fun(*this, &CamWnd::stopRenderTime) ); // Stop time, initially stopRenderTime(); Gtk::Widget* toolbar = gladeWidget<Gtk::Widget>("camToolbar"); // Hide the toolbar if requested if (!getCameraSettings()->showCameraToolbar()) { toolbar->hide(); toolbar->set_no_show_all(true); } // Connect to show/hide registry key registry::observeBooleanKey( RKEY_SHOW_CAMERA_TOOLBAR, sigc::mem_fun(toolbar, &Gtk::Widget::show), sigc::mem_fun(toolbar, &Gtk::Widget::hide) ); }