OneMoment::OneMoment(): Gtk::Window(Gtk::WINDOW_TOPLEVEL) { // Create the Label Gtk::Label *label = manage(new class Gtk::Label(_("One Moment, Please..."))); set_title(_("Working...")); set_modal(true); set_decorated(0); property_window_position().set_value(Gtk::WIN_POS_CENTER); set_resizable(false); add(*label); Pango::AttrList attr_list; Pango::AttrInt pango_size(Pango::Attribute::create_attr_size(Pango::SCALE*16)); pango_size.set_start_index(0); pango_size.set_end_index(64); attr_list.change(pango_size); label->set_attributes(attr_list); label->set_size_request(400,60); set_transient_for((Gtk::Window&)(*App::main_window)); // show everything off show_all(); present(); while(studio::App::events_pending())studio::App::iteration(false); }
void VRGuiVectorEntry::init(string placeholder, string label, sigc::slot<void, OSG::Vec3f&> sig) { Gtk::Fixed* ph; VRGuiBuilder()->get_widget(placeholder.c_str(), ph); Gtk::Container* frame = ph->get_parent(); frame->remove(*ph); Gtk::HBox* hb = new Gtk::HBox(); frame->add(*hb); Gtk::Label* lbl = new Gtk::Label(); lbl->set_text(label.c_str()); lbl->set_size_request(50, -1); ex = new Gtk::Entry(); ey = new Gtk::Entry(); ez = new Gtk::Entry(); ex->set_has_frame(false); ey->set_has_frame(false); ez->set_has_frame(false); ex->set_size_request(50, -1); ey->set_size_request(50, -1); ez->set_size_request(50, -1); Gtk::VSeparator *s1, *s2, *s3; s1 = new Gtk::VSeparator(); s2 = new Gtk::VSeparator(); s3 = new Gtk::VSeparator(); hb->pack_start(*lbl, false, false, 2); hb->pack_start(*s1, false, false, 0); hb->pack_start(*ex, false, false, 0); hb->pack_start(*s2, false, false, 0); hb->pack_start(*ey, false, false, 0); hb->pack_start(*s3, false, false, 0); hb->pack_start(*ez, false, false, 0); frame->show_all(); sigc::slot<bool,GdkEventFocus*> sif = sigc::bind(&VRGuiVectorEntry::proxy, sig, ex, ey, ez); ex->signal_focus_out_event().connect( sif ); ey->signal_focus_out_event().connect( sif ); ez->signal_focus_out_event().connect( sif ); sigc::slot<bool> sia_b = sigc::bind<GdkEventFocus*>(&VRGuiVectorEntry::proxy, 0, sig, ex, ey, ez); sigc::slot<void> sia = sigc::hide_return( sia_b ); ex->signal_activate().connect(sia); ey->signal_activate().connect(sia); ez->signal_activate().connect(sia); }
MESignPostInfoDialog::MESignPostInfoDialog( OldConnection* conn, uint32 toNodeID, MEMapArea* mapArea) { m_connection = conn; m_toNodeID = toNodeID; m_mapArea = mapArea; m_editSpDialog = NULL; char tmpStr[256]; sprintf( tmpStr, "%s, 0x%x", "Sign post info", m_mapArea->getMap()->getMapID() ); set_title(tmpStr); // list with all sign posts for this connection Gtk::Frame* frame = manage(new Gtk::Frame("Signposts:")); // Create ListStore and add to TreeView m_listStore = Gtk::ListStore::create(m_columns); m_treeView.set_model(m_listStore); // Add visible columns to TreeView m_treeView.append_column("REMOVE ME", m_columns.m_info); m_treeView.set_headers_visible(false); // Create selection object to handle selections m_selection = m_treeView.get_selection(); if(!m_selection) { // If this doesn't work we're in trouble. mc2log << error << "No selection object created for corresponding " << "TreeView" << endl; MC2_ASSERT(false); } Gtk::ScrolledWindow* scrolledWin = manage(new Gtk::ScrolledWindow()); scrolledWin->set_size_request(200, 150); scrolledWin->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); scrolledWin->add(m_treeView); frame->add(*scrolledWin); get_vbox()->pack_start(*frame, true, true, 5); // buttons for Edit and Close in the action area Gtk::HBox* actionBox = manage(new Gtk::HBox()); if (m_mapArea != NULL) { Gtk::Button* editButton = manage(new Gtk::Button("Edit")); editButton->set_size_request(75, 25); editButton->signal_clicked().connect( sigc::mem_fun(*this, &MESignPostInfoDialog::editSpPressed)); actionBox->pack_start(*editButton); } else { // empty label.. Gtk::Label* editLabel = manage(new Gtk::Label("")); editLabel->set_size_request(75, 25); actionBox->pack_start(*editLabel); } Gtk::Button* closeButton = manage(new Gtk::Button("Close")); closeButton->signal_clicked().connect( sigc::mem_fun(*this, &MESignPostInfoDialog::closePressed)); closeButton->set_size_request(75, 25); actionBox->pack_start(*closeButton); get_action_area()->pack_start(*actionBox); // Don't show the dialog now, wait for show()-command. }
void FindAndReplaceShader::populateWindow() { Gtk::VBox* dialogVBox = Gtk::manage(new Gtk::VBox(false, 6)); add(*dialogVBox); Gtk::HBox* findHBox = Gtk::manage(new Gtk::HBox(false, 0)); Gtk::HBox* replaceHBox = Gtk::manage(new Gtk::HBox(false, 0)); // Pack these hboxes into an alignment so that they are indented Gtk::Alignment* alignment = Gtk::manage(new gtkutil::LeftAlignment(*findHBox, 18, 1.0f)); Gtk::Alignment* alignment2 = Gtk::manage(new gtkutil::LeftAlignment(*replaceHBox, 18, 1.0f)); dialogVBox->pack_start(*alignment, true, true, 0); dialogVBox->pack_start(*alignment2, true, true, 0); // Create the labels and pack them in the hbox Gtk::Label* findLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(_(LABEL_FIND))); Gtk::Label* replaceLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(_(LABEL_REPLACE))); findLabel->set_size_request(60, -1); replaceLabel->set_size_request(60, -1); findHBox->pack_start(*findLabel, false, false, 0); replaceHBox->pack_start(*replaceLabel, false, false, 0); _findEntry = Gtk::manage(new Gtk::Entry); _replaceEntry = Gtk::manage(new Gtk::Entry); _findEntry->signal_changed().connect(sigc::mem_fun(*this, &FindAndReplaceShader::onFindChanged)); _replaceEntry->signal_changed().connect(sigc::mem_fun(*this, &FindAndReplaceShader::onReplaceChanged)); findHBox->pack_start(*_findEntry, true, true, 6); replaceHBox->pack_start(*_replaceEntry, true, true, 6); // Create the icon buttons to open the ShaderChooser and override the size request _findSelectButton = Gtk::manage( new gtkutil::IconTextButton("", GlobalUIManager().getLocalPixbuf(FOLDER_ICON)) ); _findSelectButton->set_size_request(-1, -1); _findSelectButton->signal_clicked().connect(sigc::mem_fun(*this, &FindAndReplaceShader::onChooseFind)); _replaceSelectButton = Gtk::manage( new gtkutil::IconTextButton("", GlobalUIManager().getLocalPixbuf(FOLDER_ICON)) ); _replaceSelectButton->set_size_request(-1, -1); _replaceSelectButton->signal_clicked().connect(sigc::mem_fun(*this, &FindAndReplaceShader::onChooseReplace)); findHBox->pack_start(*_findSelectButton, false, false, 0); replaceHBox->pack_start(*_replaceSelectButton, false, false, 0); Gtk::Alignment* spacer = Gtk::manage(new Gtk::Alignment(0,0,0,0)); spacer->set_size_request(10, 2); dialogVBox->pack_start(*spacer, false, false, 0); // The checkbox for "search selected only" _selectedOnly = Gtk::manage(new Gtk::CheckButton(_(LABEL_SELECTED_ONLY), true)); Gtk::Alignment* alignment3 = Gtk::manage(new gtkutil::LeftAlignment(*_selectedOnly, 18, 1.0f)); dialogVBox->pack_start(*alignment3, false, false, 0); // Finally, add the buttons dialogVBox->pack_start(createButtons(), false, false, 0); }