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(); }
/** * 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); }
DualSpinScale::DualSpinScale(const char* label1, const char* label2, double value, double lower, double upper, double step_inc, double climb_rate, int digits, const SPAttributeEnum a, char* tip_text1, char* tip_text2) : AttrWidget(a), _s1(label1, value, lower, upper, step_inc, climb_rate, digits, SP_ATTR_INVALID, tip_text1), _s2(label2, value, lower, upper, step_inc, climb_rate, digits, SP_ATTR_INVALID, tip_text2), //TRANSLATORS: "Link" means to _link_ two sliders together _link(C_("Sliders", "Link")) { signal_value_changed().connect(signal_attr_changed().make_slot()); _s1.get_adjustment()->signal_value_changed().connect(_signal_value_changed.make_slot()); _s2.get_adjustment()->signal_value_changed().connect(_signal_value_changed.make_slot()); _s1.get_adjustment()->signal_value_changed().connect(sigc::mem_fun(*this, &DualSpinScale::update_linked)); _link.signal_toggled().connect(sigc::mem_fun(*this, &DualSpinScale::link_toggled)); Gtk::VBox* vb = Gtk::manage(new Gtk::VBox); vb->add(_s1); vb->add(_s2); pack_start(*vb); pack_start(_link, false, false); _link.set_active(true); 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)); }
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(); }
void MakeBoxHIGed(Gtk::VBox& vbox) { // vbox.set_border_width(12); // vbox.set_spacing(24); vbox.set_border_width(0); vbox.set_spacing(WDG_BORDER_WDH); }
// Specifies the parent window of the dialog box and the title of the dialog box. StartDialogBox::StartDialogBox( MainWindow & parentWindow, string title) : Dialog( title, parentWindow, true, true ) { this->set_default_size(300,300); window_ = &parentWindow; Gtk::VBox* contentArea = this->get_vbox(); // Set up checkbuttons, one for each player to indicate human for ( int i = 0; i < 4; i++ ) { std::ostringstream oss; oss << "Player " << (i+1); button[i].set_label(oss.str()); contentArea->add(button[i]); } // Add a standard "ok" buttons with the appropriate responses when clicked. add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK); show_all_children(); int result = run(); switch (result) { case Gtk::RESPONSE_OK: //If ok is clicked for (int i = 0; i < 4; i++) { window_->humanPlayer[i] = button[i].get_active(); //keep track of which buttons were seleced } break; } }
// 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; }
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)); }
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(); }
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); }
// 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); }
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(); }
// 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(); }
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(); };
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; }
/** 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(); }
// 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); }
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(); }
// 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(); }
// 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); }
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"); }
Gtk::Box* PreferencesPanel::createPanelBox() { Gtk::VBox* PanelBox = Gtk::manage(new Gtk::VBox(false, 5)); PanelBox->set_border_width(10); PanelBox->set_visible(true); return PanelBox; }
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; }
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(); }
DamageWindow::DamageWindow( Glib::ustring title, Gtk::Window& parent ) : Gtk::Dialog( title, parent, true, true ), f_value(0) { Gtk::Label* label = new Gtk::Label(" ", Gtk::ALIGN_LEFT); label->set_justify( Gtk::JUSTIFY_LEFT ); f_table.AddItem( Name, gettext("Character Name"), false, label, NULL ); // label = new Gtk::Label(" ", Gtk::ALIGN_LEFT); label->set_justify( Gtk::JUSTIFY_LEFT ); label->set_use_markup( true ); f_table.AddItem( HitPoints, gettext("Current Hit Points"), false, label, NULL ); // label = new Gtk::Label(" ", Gtk::ALIGN_LEFT); label->set_justify( Gtk::JUSTIFY_LEFT ); label->set_use_markup( true ); f_table.AddItem( TempHP, gettext("Temporary Hit Points"), false, label, NULL ); // Gtk::Adjustment* adj = Gtk::manage( new Gtk::Adjustment(0.0, 0.0, 10000.0) ); f_spinButton = new Gtk::SpinButton; f_spinButton->configure( *adj, 0.0, 0 ); f_spinButton->set_numeric( true ); f_table.AddItem( DamageHealth, gettext("Enter new damage/health"), false, f_spinButton, NULL ); // Pack children into a vbox and add buttons // Gtk::VBox* vbox = get_vbox(); vbox->pack_start( f_table ); // // Respect system-dependent alternative button order (defined // in gtk+ theme). // const bool alternative_order = alternative_button_order( Glib::RefPtr<const Gdk::Screen>(0) ); // if( !alternative_order ) { add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL ); } // add_button( gettext("Bring to _Full"), RESPONSE_FULLHEATH ); add_button( gettext("Add _Health"), RESPONSE_HEALTH ); add_button( gettext("Add _Damage"), Gtk::RESPONSE_OK ); // if( alternative_order ) { add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL ); } // Dialog stuff // set_default_response( Gtk::RESPONSE_OK ); activate_default(); show_all_children(); }
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; }
SingleProgressWindow::SingleProgressWindow(MainWindow& p, Single& j) : parent(p), job(j), _chunks_this_pass(0) { set_transient_for(parent); set_title("Save as PNG"); Gtk::VBox* box = Gtk::manage(new Gtk::VBox()); progbar = Gtk::manage(new Gtk::ProgressBar()); box->pack_start(*progbar); progbar->set_text("Rendering pass 1..."); add(*box); show_all(); }
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(); }