DebuggingPage::DebuggingPage(CommandProxy& proxy) : m_proxy(proxy), m_stacklist(1, false), m_dbglist(4, false) { m_stacklist.get_column(0)->set_title("Undoable commands"); m_dbglist.get_column(0)->set_title("Level"); m_dbglist.get_column(1)->set_title("Source file"); m_dbglist.get_column(2)->set_title("Code line"); m_dbglist.get_column(3)->set_title("Message"); Gtk::VBox* vbox = manage(new Gtk::VBox); add(*vbox); Gtk::ScrolledWindow* stackscrw = manage(new Gtk::ScrolledWindow); stackscrw->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); vbox->pack_start(*stackscrw); stackscrw->add(m_stacklist); Gtk::ScrolledWindow* dbgscrw = manage(new Gtk::ScrolledWindow); dbgscrw->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); vbox->pack_start(*dbgscrw); dbgscrw->add(m_dbglist); signal_debug.connect(sigc::mem_fun(*this, &DebuggingPage::add_debug_msg)); reset_gui(); }
// Construct the dialog ShaderChooser::ShaderChooser(const Glib::RefPtr<Gtk::Window>& parent, Gtk::Entry* targetEntry) : gtkutil::BlockingTransientWindow(_(LABEL_TITLE), parent), _targetEntry(targetEntry), _selector(Gtk::manage(new ShaderSelector(this, SHADER_PREFIXES))) { set_border_width(12); if (_targetEntry != NULL) { _initialShader = targetEntry->get_text(); // Set the cursor of the tree view to the currently selected shader _selector->setSelection(_initialShader); } // Set the default size and position of the window set_default_size(DEFAULT_SIZE_X, DEFAULT_SIZE_Y); // Connect the key handler to catch the ESC event signal_key_press_event().connect(sigc::mem_fun(*this, &ShaderChooser::onKeyPress), false); // Construct main VBox, and pack in the ShaderSelector and buttons panel Gtk::VBox* vbx = Gtk::manage(new Gtk::VBox(false, 3)); vbx->pack_start(*_selector, true, true, 0); vbx->pack_start(createButtons(), false, false, 0); add(*vbx); // Connect the window position tracker _windowPosition.loadFromPath(RKEY_WINDOW_STATE); _windowPosition.connect(this); _windowPosition.applyPosition(); }
ScriptWindow::ScriptWindow() : Gtk::VBox(false, 6), _outView(Gtk::manage(new gtkutil::ConsoleView)), _view(Gtk::manage(new gtkutil::SourceView(SCRIPT_LANGUAGE_ID, false))) // allow editing { _view->unset_focus_chain(); Gtk::Button* runButton = Gtk::manage(new Gtk::Button(_("Run Script"))); runButton->signal_clicked().connect(sigc::mem_fun(*this, &ScriptWindow::onRunScript)); Gtk::HBox* buttonBar = Gtk::manage(new Gtk::HBox(false, 6)); buttonBar->pack_start(*runButton, false, false, 0); Gtk::VBox* inputVBox = Gtk::manage(new Gtk::VBox(false, 3)); inputVBox->pack_start(*Gtk::manage(new gtkutil::LeftAlignedLabel(_("Python Script Input"))), false, false, 0); inputVBox->pack_start(*_view, true, true, 0); inputVBox->pack_start(*buttonBar, false, false, 0); // Pack the scrolled textview and the entry box to the vbox Gtk::VPaned* paned = Gtk::manage(new Gtk::VPaned); paned->add1(*inputVBox); paned->add2(*_outView); pack_start(*paned, true, true, 0); show_all(); }
// Create the conversation entity panel Gtk::Widget& ConversationDialog::createEntitiesPanel() { // Hbox containing the entity list and the buttons vbox Gtk::HBox* hbx = Gtk::manage(new Gtk::HBox(false, 6)); // Tree view listing the conversation_info entities _entityView = Gtk::manage(new Gtk::TreeView(_convEntityList)); _entityView->set_headers_visible(false); Glib::RefPtr<Gtk::TreeSelection> sel = _entityView->get_selection(); sel->signal_changed().connect(sigc::mem_fun(*this, &ConversationDialog::onEntitySelectionChanged)); // Entity Name column _entityView->append_column(*Gtk::manage(new gtkutil::TextColumn("", _convEntityColumns.displayName))); hbx->pack_start(*Gtk::manage(new gtkutil::ScrolledFrame(*_entityView)), true, true, 0); // Vbox for the buttons Gtk::VBox* buttonBox = Gtk::manage(new Gtk::VBox(false, 6)); Gtk::Button* addButton = Gtk::manage(new Gtk::Button(Gtk::Stock::ADD)); addButton->signal_clicked().connect(sigc::mem_fun(*this, &ConversationDialog::onAddEntity)); buttonBox->pack_start(*addButton, true, true, 0); _deleteEntityButton = Gtk::manage(new Gtk::Button(Gtk::Stock::DELETE)); _deleteEntityButton->set_sensitive(false); // disabled at start _deleteEntityButton->signal_clicked().connect(sigc::mem_fun(*this, &ConversationDialog::onDeleteEntity)); buttonBox->pack_start(*_deleteEntityButton, true, true, 0); hbx->pack_start(*buttonBox, false, false, 0); return *hbx; }
// Main constructor SkinPropertyEditor::SkinPropertyEditor(Entity* entity, const std::string& name, const std::string& options) : PropertyEditor(entity), _key(name) { // Construct the main widget (will be managed by the base class) Gtk::VBox* mainVBox = new Gtk::VBox(false, 6); // Register the main widget in the base class setMainWidget(mainVBox); // Horizontal box contains browse button Gtk::HBox* hbx = Gtk::manage(new Gtk::HBox(false, 3)); hbx->set_border_width(3); // Create the browse button Gtk::Button* browseButton = Gtk::manage(new Gtk::Button(_("Choose skin..."))); browseButton->set_image(*Gtk::manage(new Gtk::Image( PropertyEditorFactory::getPixbufFor("skin")))); browseButton->signal_clicked().connect( sigc::mem_fun(*this, &SkinPropertyEditor::_onBrowseButton)); hbx->pack_start(*browseButton, true, false, 0); // Pack hbox into vbox (to limit vertical size), then edit frame Gtk::VBox* vbx = Gtk::manage(new Gtk::VBox(false, 0)); vbx->pack_start(*hbx, true, false, 0); mainVBox->pack_start(*vbx, true, true, 0); }
// Construct the dialog LightTextureChooser::LightTextureChooser() : gtkutil::BlockingTransientWindow(_("Choose texture"), GlobalMainFrame().getTopLevelWindow()), _selector(Gtk::manage(new ShaderSelector(this, getPrefixList(), true))) // true >> render a light texture { // Set the default size of the window Gdk::Rectangle rect; if (GlobalGroupDialog().getDialogWindow()->is_visible()) { rect = gtkutil::MultiMonitor::getMonitorForWindow(GlobalGroupDialog().getDialogWindow()); } else { rect = gtkutil::MultiMonitor::getMonitorForWindow(GlobalMainFrame().getTopLevelWindow()); } set_default_size(static_cast<int>(rect.get_width()*0.6f), static_cast<int>(rect.get_height()*0.6f)); // Construct main VBox, and pack in ShaderSelector and buttons panel Gtk::VBox* vbx = Gtk::manage(new Gtk::VBox(false, 6)); vbx->pack_start(*_selector, true, true, 0); vbx->pack_start(createButtons(), false, false, 0); add(*vbx); }
void ExpireDialog::init() { _spinner.set_numeric (true); _spinner.set_digits (1); _spinner.set_range (0, 30); _spinner.set_snap_to_ticks(); _spinner.set_adjustment (_adj); _spinner.set_value (AppContext::get().get_expire()); Gtk::VBox *vbox = get_vbox(); vbox->pack_start (_label1, Gtk::PACK_SHRINK, 10); _box.add (*new Gtk::HBox); _box.pack_start (_spinner, Gtk::PACK_SHRINK, 10); _box.pack_start (_label2, Gtk::PACK_SHRINK, 0); _box.add (*new Gtk::HBox); vbox->pack_start (_box, Gtk::PACK_EXPAND_PADDING, 10); add_button (_("Do expire"), 1); add_button (Gtk::Stock::CANCEL, 0); /// Move focus to Do button cwidget_list_t list = get_action_area()->get_children(); for (cwidget_list_t::iterator it = list.begin(); it != list.end(); ++it) if (get_response_for_widget (**it) == 1) { const_cast<Widget&>(**it).grab_focus(); break; } _changed_connection = _adj.signal_value_changed().connect ( sigc::mem_fun (*this, &ExpireDialog::on_value_changed)); show_all(); }
DialogOperationChooserGTKMM::DialogOperationChooserGTKMM( Gtk::Window* parent ) : Dialog( "Select an operation node", parent ), radioTextFileStorage("Text file storage"), radioExecuteSystemCommand("System command") { // Request a minimum with this->set_size_request( 250 ); // Put the radio buttons in the same group. Gtk::RadioButtonGroup group = radioTextFileStorage.get_group(); radioExecuteSystemCommand.set_group( group ); // Place the radio buttons in the dialog. Gtk::VBox* vBox = this->get_vbox(); vBox->pack_start( radioTextFileStorage ); vBox->pack_start( radioExecuteSystemCommand ); // Add buttons this->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); this->add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK); show_all(); };
// Main constructor ModalProgressDialog::ModalProgressDialog(const Glib::RefPtr<Gtk::Window>& parent, const std::string& title) : gtkutil::TransientWindow(title, GlobalMainFrame().getTopLevelWindow()), _label(Gtk::manage(new Gtk::Label)), _progressBar(Gtk::manage(new Gtk::ProgressBar)), _aborted(false) { // Window properties set_modal(true); set_position(Gtk::WIN_POS_CENTER_ON_PARENT); set_default_size(360, 80); set_border_width(12); // Create a vbox Gtk::VBox* vbx = Gtk::manage(new Gtk::VBox(false, 12)); // Pack a progress bar into the window vbx->pack_start(*_progressBar, false, false, 0); // Pack the label into the window vbx->pack_start(*_label, true, false, 0); add(*vbx); // Pack a right-aligned cancel button at the bottom Gtk::Button* cancelButton = Gtk::manage(new Gtk::Button(Gtk::Stock::CANCEL)); cancelButton->signal_clicked().connect(sigc::mem_fun(*this, &ModalProgressDialog::_onCancel)); vbx->pack_end(*Gtk::manage(new gtkutil::RightAlignment(*cancelButton)), false, false, 0); // Connect the realize signal to remove the window decorations signal_realize().connect(sigc::mem_fun(*this, &ModalProgressDialog::_onRealize)); // Show the window show_all(); handleEvents(); }
void Simple::build(bool modeling) { Gtk::VBox* vbox; vle::utils::Package pack(getPackage()); std::string glade = pack.getPluginGvleModelingFile( "DifferenceEquation.glade", vle::utils::PKG_BINARY); mXml = Gtk::Builder::create(); mXml->add_from_file(glade.c_str()); mXml->get_widget("DialogPluginSimpleBox", m_dialog); m_dialog->set_title("DifferenceEquation - Simple"); mXml->get_widget("SimplePluginVBox", vbox); vbox->pack_start(mNameValue.build(mXml)); vbox->pack_start(mTimeStep.build(mXml)); if (modeling) { vbox->pack_start(mParameters.build(mXml)); { m_buttonSource = Gtk::manage( new Gtk::Button("Compute / InitValue / User section")); m_buttonSource->show(); vbox->pack_start(*m_buttonSource); mList.push_back(m_buttonSource->signal_clicked().connect( sigc::mem_fun(*this, &Plugin::onSource))); } } vbox->pack_start(mMapping.build(mXml)); }
// Main constructor TexturePropertyEditor::TexturePropertyEditor(Entity* entity, const std::string& name, const std::string& options) : PropertyEditor(entity), _prefixes(options), _key(name) { // Construct the main widget (will be managed by the base class) Gtk::VBox* mainVBox = new Gtk::VBox(false, 6); // Register the main widget in the base class setMainWidget(mainVBox); Gtk::VBox* outer = Gtk::manage(new Gtk::VBox(false, 0)); Gtk::HBox* editBox = Gtk::manage(new Gtk::HBox(false, 3)); // Create the browse button Gtk::Button* browseButton = Gtk::manage(new Gtk::Button(_("Choose texture..."))); browseButton->set_image(*Gtk::manage(new Gtk::Image( PropertyEditorFactory::getPixbufFor("texture")))); browseButton->signal_clicked().connect( sigc::mem_fun(*this, &TexturePropertyEditor::_onBrowse)); editBox->pack_start(*browseButton, true, false, 0); outer->pack_start(*editBox, true, false, 0); mainVBox->pack_start(*outer, true, true, 0); }
ScriptAddDlgGtk::ScriptAddDlgGtk() : lvScriptPreview(1) , lblScriptSelection(gettext("Script to insert:") , Gtk::ALIGN_LEFT) , lblScriptPreview(gettext("Preview:"), Gtk::ALIGN_LEFT) { this->set_title(gettext("Add script")); this->set_icon_name("gpc"); this->set_default_size(400, 300); Gtk::VBox* vbScriptAddDlg = this->get_vbox(); vbScriptAddDlg->set_spacing(10); vbScriptAddDlg->pack_start(hbScriptSelection, Gtk::PACK_SHRINK); hbScriptSelection.set_border_width(10); hbScriptSelection.pack_start(lblScriptSelection); hbScriptSelection.pack_start(cbScriptSelection); vbScriptAddDlg->pack_start(vbScriptPreview); vbScriptPreview.pack_start(lblScriptPreview, Gtk::PACK_SHRINK); vbScriptPreview.pack_start(scrScriptPreview); scrScriptPreview.add(lvScriptPreview); vbScriptPreview.set_border_width(10); scrScriptPreview.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); scrScriptPreview.set_shadow_type(Gtk::SHADOW_IN); lvScriptPreview.set_column_title(0, gettext("Entry")); lvScriptPreview.set_headers_visible(false); this->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); this->add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK); this->signal_response().connect(sigc::mem_fun(this, &ScriptAddDlgGtk::signal_scriptAddDlg_response)); cbScriptSelection.signal_changed().connect(sigc::mem_fun(this, &ScriptAddDlgGtk::signal_script_selection_changed)); }
/** Creates a connection dialog. This will change pointers to strings and int representing the connection. Mainly user, host and port. The final values of the pointers will be assigned when the dialog will be closed. \param[in,out] u Pointer on the username \param[in,out] pw Pointer on the password \param[in,out] h Pointer on the host \param[in,out] p Pointer on the port */ DialogConnect::DialogConnect(std::string *u, std::string *pw, std::string *h, int *p) { user = u; host = h; port = p; pass = pw; Gtk::VBox *layout = Gtk::manage(new Gtk::VBox); Glib::RefPtr<Gtk::Adjustment> adj = Gtk::Adjustment::create(*p, 0, 65535, 1); portSpinButton = Gtk::manage(new Gtk::SpinButton(adj)); okButton = Gtk::manage(new Gtk::Button(Gtk::Stock::OK)); userEntry = Gtk::manage(new Gtk::Entry()); userEntry->set_text(*u); passEntry = Gtk::manage(new Gtk::Entry()); passEntry->set_visibility(false); passEntry->set_text(*pw); hostEntry = Gtk::manage(new Gtk::Entry()); hostEntry->set_text(*h); Gtk::Label* ul = Gtk::manage(new Gtk::Label("Username : "******"Password : "******"Hostname : ")); Gtk::Label* pl = Gtk::manage(new Gtk::Label("Port : ")); Gtk::HBox *h1 = Gtk::manage(new Gtk::HBox()); Gtk::HBox *h2 = Gtk::manage(new Gtk::HBox()); Gtk::HBox *h3 = Gtk::manage(new Gtk::HBox()); Gtk::HBox *h4 = Gtk::manage(new Gtk::HBox()); h1->add(*ul); h1->add(*userEntry); h4->add(*pwl); h4->add(*passEntry); h2->add(*hl); h2->add(*hostEntry); h3->add(*pl); h3->add(*portSpinButton); layout->pack_start(*h1, Gtk::PACK_SHRINK); layout->pack_start(*h4, Gtk::PACK_SHRINK); layout->pack_start(*h2, Gtk::PACK_SHRINK); layout->pack_start(*h3, Gtk::PACK_SHRINK); layout->pack_end(*okButton, Gtk::PACK_SHRINK); remove(); add(*layout); okButton->signal_clicked().connect(sigc::mem_fun(*this, &DialogConnect::onOk)); passEntry->signal_activate().connect(sigc::mem_fun(*this, &DialogConnect::onOk)); hostEntry->signal_activate().connect(sigc::mem_fun(*this, &DialogConnect::onOk)); show_all(); }
WindowLevelToolButton::WindowLevelToolButton() { Gtk::HBox* hbox = manage(new Gtk::HBox); Gtk::Image* image = manage(new Gtk::Image); Glib::RefPtr<Gdk::Pixbuf> p = Aeskulap::IconFactory::load_from_file("cursor_windowlevel.png"); if(p) { image->set(p); } image->show(); //image->set_padding(6, 0); m_invert = manage(new Gtk::ToggleToolButton(*image)); m_invert->set_size_request(32, 32); m_invert->set_tooltip(m_tooltips, gettext("Invert windowlevel")); m_invert->show(); m_invert->signal_toggled().connect(sigc::mem_fun(*this, &WindowLevelToolButton::on_invert)); Gtk::VBox* vbox = manage(new Gtk::VBox); vbox->pack_start(*m_invert, true, false); vbox->show(); hbox->pack_start(*vbox, Gtk::PACK_SHRINK); vbox = manage(new Gtk::VBox); vbox->show(); m_combo = manage(new Gtk::ComboBoxText); m_combo->set_size_request(-1, 32); m_combo->show(); m_combo->signal_changed().connect(sigc::mem_fun(*this, &WindowLevelToolButton::on_changed)); vbox->pack_start(*m_combo, true, false); hbox->pack_start(*vbox, Gtk::PACK_SHRINK); vbox = manage(new Gtk::VBox); vbox->show(); image = manage(new Gtk::Image(Gtk::Stock::ADD, Gtk::ICON_SIZE_SMALL_TOOLBAR)); image->show(); Gtk::ToolButton* btn = manage(new Gtk::ToolButton(*image)); btn->set_size_request(32, 32); btn->set_tooltip(m_tooltips, gettext("Add new windowlevel preset")); btn->show(); btn->signal_clicked().connect(sigc::mem_fun(*this, &WindowLevelToolButton::on_add)); vbox->pack_start(*btn, true, false); hbox->pack_start(*vbox, true,false); hbox->show(); add(*hbox); update(); m_widgetlist.insert(this); }
DC1394SliderWB::DC1394SliderWB(Gtk::VBox &vbox,yarp::dev::RemoteFrameGrabberControlsDC1394 *fg) : m_Red(0.0,1.005,0.005),m_Blue(0.0,1.005,0.005),m_OnePush("One Push") { if (!(pFG=fg)->hasFeatureDC1394(YARP_FEATURE_WHITE_BALANCE)) { m_bInactive=true; return; } m_nInternalChange=0; m_bInactive=false; m_Height+=100; vbox.pack_start(*(new Gtk::HSeparator()),Gtk::PACK_SHRINK,2); Gtk::HBox* pHBox=new Gtk::HBox(); pHBox->pack_start(*(new Gtk::Label("White Balance",0)),Gtk::PACK_EXPAND_PADDING); pHBox->pack_start(*(pPwr=new Gtk::CheckButton("pwr")),Gtk::PACK_SHRINK,0); pHBox->pack_start(*(pRBa=new Gtk::RadioButton("auto")),Gtk::PACK_SHRINK,0); const Glib::ustring s_man("man"); Gtk::RadioButtonGroup rbg=pRBa->get_group(); pHBox->pack_start(*(pRBm=new Gtk::RadioButton(rbg,s_man,false)),Gtk::PACK_SHRINK,0); pHBox->pack_start(m_OnePush,Gtk::PACK_SHRINK,8); vbox.pack_start(*(pHBox),Gtk::PACK_SHRINK); m_Blue.set_size_request(256,40); m_Red.set_size_request(256,40); Gtk::HBox *pRbox=new Gtk::HBox(); pRbox->pack_start(*(new Gtk::Label("RED ",0)),Gtk::PACK_SHRINK,4); pRbox->pack_start(m_Red,Gtk::PACK_EXPAND_WIDGET,10); vbox.pack_start(*(pRbox),Gtk::PACK_SHRINK,0); Gtk::HBox *pBbox=new Gtk::HBox(); pBbox->pack_start(*(new Gtk::Label("BLUE",0)),Gtk::PACK_SHRINK,4); pBbox->pack_start(m_Blue,Gtk::PACK_EXPAND_WIDGET,10); vbox.pack_start(*(pBbox),Gtk::PACK_SHRINK,0); //pFG->getWhiteBalanceDC1394(m_old_blu,m_old_red); //m_new_red=m_old_red; //m_new_blu=m_old_blu; m_old_red=m_old_blu=-1.0; m_Blue.signal_value_changed().connect(sigc::mem_fun(*this,&DC1394SliderWB::slider_handler)); m_Blue.set_update_policy(Gtk::UPDATE_DISCONTINUOUS); m_Red.signal_value_changed().connect(sigc::mem_fun(*this,&DC1394SliderWB::slider_handler)); m_Red.set_update_policy(Gtk::UPDATE_DISCONTINUOUS); pPwr->signal_clicked().connect(sigc::mem_fun(*this,&DC1394SliderWB::pwr_handler)); pRBa->signal_clicked().connect(sigc::mem_fun(*this,&DC1394SliderWB::automan_handler)); m_OnePush.signal_clicked().connect(sigc::mem_fun(*this,&DC1394SliderWB::onepush_handler)); Refresh(); }
Gtk::Widget& DifficultyEditor::createTreeView() { // First, create the treeview _settingsView = Gtk::manage(new Gtk::TreeView(_settings->getTreeStore())); _settingsView->set_size_request(TREE_VIEW_MIN_WIDTH, -1); // Connect the tree view selection Glib::RefPtr<Gtk::TreeSelection> selection = _settingsView->get_selection(); selection->signal_changed().connect(sigc::mem_fun(*this, &DifficultyEditor::onSettingSelectionChange)); // Add columns to this view Gtk::CellRendererText* textRenderer = Gtk::manage(new Gtk::CellRendererText); Gtk::TreeViewColumn* settingCol = Gtk::manage(new Gtk::TreeViewColumn); settingCol->pack_start(*textRenderer, false); settingCol->set_title(_("Setting")); settingCol->set_sizing(Gtk::TREE_VIEW_COLUMN_AUTOSIZE); settingCol->set_spacing(3); _settingsView->append_column(*settingCol); settingCol->add_attribute(textRenderer->property_text(), _settings->getColumns().description); settingCol->add_attribute(textRenderer->property_foreground(), _settings->getColumns().colour); settingCol->add_attribute(textRenderer->property_strikethrough(), _settings->getColumns().isOverridden); Gtk::ScrolledWindow* frame = Gtk::manage(new gtkutil::ScrolledFrame(*_settingsView)); // Create the action buttons Gtk::HBox* buttonHBox = Gtk::manage(new Gtk::HBox(false, 6)); // Create button _createSettingButton = Gtk::manage(new Gtk::Button(Gtk::Stock::ADD)); _createSettingButton->signal_clicked().connect(sigc::mem_fun(*this, &DifficultyEditor::onSettingCreate)); // Delete button _deleteSettingButton = Gtk::manage(new Gtk::Button(Gtk::Stock::DELETE)); _deleteSettingButton->signal_clicked().connect(sigc::mem_fun(*this, &DifficultyEditor::onSettingDelete)); _refreshButton = Gtk::manage(new Gtk::Button(Gtk::Stock::REFRESH)); _refreshButton->signal_clicked().connect(sigc::mem_fun(*this, &DifficultyEditor::onRefresh)); buttonHBox->pack_start(*_createSettingButton, true, true, 0); buttonHBox->pack_start(*_deleteSettingButton, true, true, 0); buttonHBox->pack_start(*_refreshButton, true, true, 0); Gtk::VBox* vbox = Gtk::manage(new Gtk::VBox(false, 6)); vbox->pack_start(*frame, true, true, 0); vbox->pack_start(*buttonHBox, false, false, 0); vbox->set_border_width(12); return *vbox; }
window_main::window_main(p2p & P2P_in): Gtk::Window(Gtk::WINDOW_TOPLEVEL), P2P(P2P_in) { //splits main window Gtk::VBox * VBox = Gtk::manage(new Gtk::VBox(false, 0)); //notebook and tab labels Gtk::Notebook * notebook = Gtk::manage(new Gtk::Notebook); Gtk::Image * download_label = Gtk::manage(new Gtk::Image(Gtk::Stock::GO_DOWN, Gtk::ICON_SIZE_LARGE_TOOLBAR)); Gtk::Image * upload_label = Gtk::manage(new Gtk::Image(Gtk::Stock::GO_UP, Gtk::ICON_SIZE_LARGE_TOOLBAR)); Gtk::Image * prefs_label = Gtk::manage(new Gtk::Image(Gtk::Stock::PREFERENCES, Gtk::ICON_SIZE_LARGE_TOOLBAR)); //windows inside tabs window_transfer * download_window = Gtk::manage(new window_transfer( window_transfer::download, P2P, notebook)); window_transfer * upload_window = Gtk::manage(new window_transfer( window_transfer::upload, P2P, notebook)); window_prefs * prefs_window = Gtk::manage(new window_prefs(P2P)); //bar on bottom of window (that lists upload/download speeds) Gtk::Fixed * statusbar = Gtk::manage(new fixed_statusbar(P2P)); //icon for top left of window this->set_icon(Gtk::Widget::render_icon(Gtk::Stock::NETWORK, Gtk::ICON_SIZE_LARGE_TOOLBAR)); //add/compose elements notebook->append_page(*download_window, *download_label); notebook->append_page(*upload_window, *upload_label); notebook->append_page(*prefs_window, *prefs_label); VBox->pack_start(*notebook); VBox->pack_start(*statusbar, Gtk::PACK_SHRINK, 0); this->add(*VBox); //options notebook->set_scrollable(true); //scroll when many tabs open this->set_title(settings::name); this->resize(640, 480); this->set_resizable(true); this->property_destroy_with_parent().set_value(false); //get URIs of files dropped on it std::list<Gtk::TargetEntry> list_targets; list_targets.push_back(Gtk::TargetEntry("STRING")); list_targets.push_back(Gtk::TargetEntry("text/plain")); this->drag_dest_set(list_targets); //signaled functions this->signal_drag_data_received().connect(sigc::mem_fun(*this, &window_main::file_drag_data_received)); this->show_all_children(); }
Gtk::Widget * LPESimplify::newWidget() { // use manage here, because after deletion of Effect object, others might still be pointing to this widget. Gtk::VBox * vbox = Gtk::manage( new Gtk::VBox(Effect::newWidget()) ); vbox->set_border_width(5); vbox->set_homogeneous(false); vbox->set_spacing(2); std::vector<Parameter *>::iterator it = param_vector.begin(); Gtk::HBox * buttons = Gtk::manage(new Gtk::HBox(true,0)); while (it != param_vector.end()) { if ((*it)->widget_is_visible) { Parameter * param = *it; Gtk::Widget * widg = dynamic_cast<Gtk::Widget *>(param->param_newWidget()); if (param->param_key == "simplify_individual_paths" || param->param_key == "simplify_just_coalesce") { Glib::ustring * tip = param->param_getTooltip(); if (widg) { buttons->pack_start(*widg, true, true, 2); if (tip) { widg->set_tooltip_text(*tip); } else { widg->set_tooltip_text(""); widg->set_has_tooltip(false); } } } else { Glib::ustring * tip = param->param_getTooltip(); if (widg) { Gtk::HBox * horizontal_box = dynamic_cast<Gtk::HBox *>(widg); std::vector< Gtk::Widget* > child_list = horizontal_box->get_children(); Gtk::Entry* entry_widg = dynamic_cast<Gtk::Entry *>(child_list[1]); entry_widg->set_width_chars(8); vbox->pack_start(*widg, true, true, 2); if (tip) { widg->set_tooltip_text(*tip); } else { widg->set_tooltip_text(""); widg->set_has_tooltip(false); } } } } ++it; } vbox->pack_start(*buttons,true, true, 2); return dynamic_cast<Gtk::Widget *>(vbox); }
OgreWindow::OgreWindow() : mOgreWidget(), mExited(false) //mRobot() { set_border_width(1); Gtk::VBox *vb = new Gtk::VBox(false,0); // Gtk::Button *mb = new Gtk::Button("Avanzar"); // mb->signal_clicked().connect(sigc::mem_fun(*this,&OgreWindow::avanzar)); // Gtk::Button *mb2 = new Gtk::Button("Retroceder"); // mb2->signal_clicked().connect(sigc::mem_fun(*this,&OgreWindow::retroceder)); // Gtk::Button *mb3 = new Gtk::Button("Giro derecha"); // mb3->signal_clicked().connect(sigc::mem_fun(*this,&OgreWindow::derecha)); // Gtk::Button *mb4 = new Gtk::Button("Giro izquierda"); // mb4->signal_clicked().connect(sigc::mem_fun(*this,&OgreWindow::izquierda)); // vb->pack_start(*mb,true,true,0); // vb->pack_start(*mb2,true,true,0); // vb->pack_start(*mb3,true,true,0); // vb->pack_start(*mb4,true,true,0); vb->pack_start(mOgreWidget,true,true,10); add(*vb); show_all(); }
//------------------------------------------------------------------------------ void DbMySQLTableEditor::decorate_object_editor() { if (is_editing_live_object()) { PluginEditorBase::decorate_object_editor(); Gtk::HBox* header_part = 0; xml()->get_widget("header_part", header_part); if (header_part->get_parent() == NULL) { decorator_control()->pack_start(*header_part, false, true); decorator_control()->reorder_child(*header_part, 0); Gtk::Button *hide_button = 0; xml()->get_widget("hide_button", hide_button); Gtk::Image* hide_image = Gtk::manage(new Gtk::Image(ImageCache::get_instance()->image_from_filename("EditorExpanded.png", false))); Gtk::Image* show_image = Gtk::manage(new Gtk::Image(ImageCache::get_instance()->image_from_filename("EditorCollapsed.png", false))); hide_image->show(); Gtk::VBox* box = Gtk::manage(new Gtk::VBox()); box->pack_start(*hide_image, false, false); box->pack_start(*show_image, false, false); box->show(); show_image->hide(); hide_button->set_image(*box); hide_button->signal_clicked().connect(sigc::mem_fun(this, &DbMySQLTableEditor::toggle_header_part)); toggle_header_part(); } } }
void JointVelocityControlWidget::init(ref<BasicEnvironment> env, ref<Robot> robot, Int index, ref<ControlInterface> interface) { velInterface = interface; // Joint velocity controls Gtk::VBox* jointControlBox = new Gtk::VBox(false,5); Int dof = velInterface->inputSize(); velAdjustments.clear(); for(Int j=0; j<dof; j++) { Gtk::HBox* hbox = new Gtk::HBox(); Gtk::Label* label = new Gtk::Label(base::intToString(j)+":"); hbox->pack_start(*manage(label), Gtk::PACK_SHRINK,5); Gtk::Adjustment* adj = new Gtk::Adjustment(0,-3,3,0.01,0.1); velAdjustments.push_back(adj); Gtk::HScale* scale = new Gtk::HScale(*manage(adj)); scale->set_draw_value(true); scale->set_digits(2); scale->set_value_pos(Gtk::POS_LEFT); scale->set_update_policy(Gtk::UPDATE_CONTINUOUS); scale->set_size_request(100,-1); hbox->pack_end(*manage(scale)); jointControlBox->pack_start(*manage(hbox),false,false); adj->signal_value_changed().connect( SigC::bind<Int>( SigC::slot(*this, &JointVelocityControlWidget::jointVelScaleChanged ), j) ); } pack_start(*manage(jointControlBox)); }
/** * This *creates* a new widget, management of deletion should be done by the caller */ Gtk::Widget * Effect::newWidget(Gtk::Tooltips * tooltips) { // use manage here, because after deletion of Effect object, others might still be pointing to this widget. Gtk::VBox * vbox = Gtk::manage( new Gtk::VBox() ); vbox->set_border_width(5); std::vector<Parameter *>::iterator it = param_vector.begin(); while (it != param_vector.end()) { if ((*it)->widget_is_visible) { Parameter * param = *it; Gtk::Widget * widg = param->param_newWidget(tooltips); Glib::ustring * tip = param->param_getTooltip(); if (widg) { vbox->pack_start(*widg, true, true, 2); if (tip != NULL) { tooltips->set_tip(*widg, *tip); } } } it++; } return dynamic_cast<Gtk::Widget *>(vbox); }
AIHeadPropertyEditor::AIHeadPropertyEditor(Entity* entity, const std::string& key, const std::string& options) : _entity(entity) { _widget = Gtk::manage(new Gtk::HBox(false, 0)); _widget->set_border_width(6); // Horizontal box contains the browse button Gtk::HBox* hbx = Gtk::manage(new Gtk::HBox(false, 3)); hbx->set_border_width(3); // Browse button for models Gtk::Button* browseButton = Gtk::manage(new Gtk::Button(_("Choose AI head..."))); browseButton->set_image( *Gtk::manage(new Gtk::Image(GlobalUIManager().getLocalPixbuf("icon_model.png"))) ); browseButton->signal_clicked().connect(sigc::mem_fun(*this, &AIHeadPropertyEditor::onChooseButton)); hbx->pack_start(*browseButton, true, false, 0); // Pack hbox into vbox (to limit vertical size), then edit frame Gtk::VBox* vbx = Gtk::manage(new Gtk::VBox(false, 0)); vbx->pack_start(*hbx, true, false, 0); _widget->pack_start(*vbx, true, true, 0); }
EntityChooser::EntityChooser() : gtkutil::DialogElement(), // create an Element without label _entityStore(Gtk::ListStore::create(_listColumns)) { Gtk::VBox* vbox = Gtk::manage(new Gtk::VBox(false, 6)); _widgets[WIDGET_TOPLEVEL] = vbox; // Initialise the base class DialogElement::setValueWidget(_widgets[WIDGET_TOPLEVEL]); Gtk::TreeView* treeView = Gtk::manage(new Gtk::TreeView(_entityStore)); _widgets[WIDGET_TREEVIEW] = treeView; treeView->set_headers_visible(false); // Use the TreeModel's full string search function treeView->set_search_equal_func(sigc::ptr_fun(>kutil::TreeModel::equalFuncStringContains)); // Head Name column treeView->append_column("", _listColumns.name); // Set the tree store to sort on this column _entityStore->set_sort_column_id(_listColumns.name, Gtk::SORT_ASCENDING); _selection = treeView->get_selection(); _selection->signal_changed().connect(sigc::mem_fun(*this, &EntityChooser::onSelectionChanged)); // Scrolled Frame vbox->pack_start(*Gtk::manage(new gtkutil::ScrolledFrame(*treeView)), true, true, 0); populateEntityList(); }
Gtk::VBox * Extension::get_info_widget(void) { Gtk::VBox * retval = Gtk::manage(new Gtk::VBox()); Gtk::Frame * info = Gtk::manage(new Gtk::Frame("General Extension Information")); retval->pack_start(*info, true, true, 5); #if WITH_GTKMM_3_0 Gtk::Grid * table = Gtk::manage(new Gtk::Grid()); #else Gtk::Table * table = Gtk::manage(new Gtk::Table()); #endif info->add(*table); int row = 0; add_val(_("Name:"), _(name), table, &row); add_val(_("ID:"), id, table, &row); add_val(_("State:"), _state == STATE_LOADED ? _("Loaded") : _state == STATE_UNLOADED ? _("Unloaded") : _("Deactivated"), table, &row); retval->show_all(); return retval; }
Viewer(): actions(Gtk::ActionGroup::create("nimrod")) { Glib::ustring title("Nimrod Alto viewer"); title += " © CoReNum"; set_title(title); actions->add(Gtk::Action::create("nimrod-new", Gtk::Stock::NEW), sigc::mem_fun(this, &Viewer::new_project)); actions->add(Gtk::Action::create("nimrod-open", Gtk::Stock::OPEN), sigc::mem_fun(this, &Viewer::open_project)); ui_manager->insert_action_group(actions); ui_manager->insert_action_group(alto.get_image_actions()); Glib::ustring ui_info = "<ui>" " <menubar name='MenuBar'>" " <menu action='app-file-menu'>" " <menuitem action='nimrod-new'/>" " <menuitem action='nimrod-open'/>" " <menuitem action='app-quit'/>" " </menu>" " <menu action='app-help-menu'>" " <menuitem action='app-about'/>" " </menu>" " </menubar>" " <toolbar name='ToolBar'>" " <toolitem action='nimrod-open'/>" " <separator/>" " <toolitem action='image-zoom-in'/>" " <toolitem action='image-zoom-out'/>" " <toolitem action='image-zoom-100'/>" " <toolitem action='image-zoom-fit'/>" " </toolbar>" "</ui>"; ui_manager->add_ui_from_string(ui_info); Gtk::VBox *vbox = Gtk::manage(new Gtk::VBox()); vbox->show(); add(*vbox); vbox->pack_start(*ui_manager->get_widget("/MenuBar"), false, true, 0); vbox->pack_start(*ui_manager->get_widget("/ToolBar"), false, true, 0); alto.show(); vbox->pack_start(alto, true, true, 0); }
MD5AnimationViewer::MD5AnimationViewer() : gtkutil::BlockingTransientWindow(_("MD5 Animation Viewer"), GlobalMainFrame().getTopLevelWindow()), _modelList(Gtk::TreeStore::create(_modelColumns)), _modelPopulator(_modelList), _animList(Gtk::ListStore::create(_animColumns)), _preview(new AnimationPreview) { // Set the default border width in accordance to the HIG set_border_width(12); set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG); // Set the default size of the window const Glib::RefPtr<Gtk::Window>& mainWindow = GlobalMainFrame().getTopLevelWindow(); Gdk::Rectangle rect = gtkutil::MultiMonitor::getMonitorForWindow(mainWindow); int height = static_cast<int>(rect.get_height() * 0.6f); set_default_size( static_cast<int>(rect.get_width() * 0.8f), height ); // Set the default size of the window _preview->setSize(rect.get_width() * 0.2f, height); // Main dialog vbox Gtk::VBox* vbox = Gtk::manage(new Gtk::VBox(false, 12)); // Create a horizontal box to pack the treeview on the left and the preview on the right Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox(false, 6)); hbox->pack_start(createListPane(), true, true, 0); Gtk::VBox* previewBox = Gtk::manage(new Gtk::VBox(false, 0)); previewBox->pack_start(*_preview, true, true, 0); hbox->pack_start(*previewBox, true, true, 0); vbox->pack_start(*hbox, true, true, 0); vbox->pack_end(createButtons(), false, false, 0); // Add main vbox to dialog add(*vbox); // Populate with model names populateModelList(); }
Example_Scaler::Example_Scaler() { Gtk::HBox* hbox; Gtk::VBox* vbox; set_title("Scaler Example"); m_Scaler = Papyrus::Scaler::create( ); m_Viewport.add_controller( m_Scaler ); m_Viewport.set_size_request( 300, 200 ); // Create some shapes to add to the group Papyrus::Arc::pointer arc = Papyrus::example_arc( ); // Add the shapes to the group m_Viewport.canvas()->add( arc ); m_Scaler->add( arc ); vbox = Gtk::manage( new Gtk::VBox() ); vbox->pack_start( m_Viewport ); vbox->pack_start( *Gtk::manage( new Gtk::HSeparator() ) ); Gtk::Table* table; table = Gtk::manage( new Gtk::Table() ); m_side_buttons[0].set_label("Top"); m_side_buttons[1].set_label("Right"); m_side_buttons[2].set_label("Bottom"); m_side_buttons[3].set_label("Left"); table->attach( m_side_buttons[0], 1, 2, 0, 1 ); table->attach( m_side_buttons[1], 2, 3, 1, 2 ); table->attach( m_side_buttons[2], 1, 2, 2, 3 ); table->attach( m_side_buttons[3], 0, 1, 1, 2 ); for ( int i=0; i < 4; i++ ) { m_side_buttons[i].set_active(true); m_side_buttons[i].signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Example_Scaler::on_button_toggled), i ) ); } vbox->pack_start( *table ); this->add( *vbox ); show_all(); }
ResolutionDialog::ResolutionDialog( Gtk::Widget * widget ) : Dialog ( _("Resolution") ), m_resetButton ( Gtk::Stock::UNDO ), m_applyButton ( Gtk::Stock::APPLY ), m_widget ( widget ), m_oldResolution ( widget->get_width(), widget->get_height() ), m_newResolution ( 0, 0 ) { // Creates the main layout. Gtk::Label * label = Gtk::manage( new Gtk::Label(_("Select, in the list bellow, a resolution to apply, \nor specify your own."), 0, 0) ); Gtk::VBox * box = Gtk::manage( new Gtk::VBox(false, 8) ); box->set_border_width( 12 ); box->pack_start( *label, Gtk::PACK_SHRINK ); box->pack_start( m_resolutions, Gtk::PACK_SHRINK ); get_vbox()->add( *box ); // Adds buttons. get_action_area()->add( m_resetButton ); get_action_area()->add( m_applyButton ); add_button( Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE ); m_applyButton.set_sensitive( false ); // Connects to some signals. m_applyButton.signal_clicked().connect( sigc::mem_fun(this, &ResolutionDialog::applyClicked) ); m_resetButton.signal_clicked().connect( sigc::mem_fun(this, &ResolutionDialog::resetClicked) ); m_resolutions.get_entry()->signal_changed().connect( sigc::mem_fun(this, &ResolutionDialog::resolutionChanged) ); // Fills the resolution box with predefined resolutions. m_resolutions.append_text(_("1024x768")); m_resolutions.append_text(_("800x600")); m_resolutions.append_text(_("720x576")); m_resolutions.append_text(_("640x480")); // Shows the whole things show_all(); // Assigns the initial resolution. m_resolutions.get_entry()->set_text( resolutionToString(m_oldResolution.first, m_oldResolution.second) ); }
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"); }