void RegularLayout::deactivate() { // Show the camera toggle option again GlobalUIManager().getMenuManager().setVisibility("main/view/cameraview", true); GlobalUIManager().getMenuManager().setVisibility("main/view/textureBrowser", true); // Remove all previously stored pane information GlobalRegistry().deleteXPath(RKEY_REGULAR_ROOT + "//pane"); // Save pane info saveStateToPath(RKEY_REGULAR_ROOT); // Delete all active views GlobalXYWndManager().destroyViews(); // Delete the CamWnd _camWnd = CamWndPtr(); // Hide the group dialog GlobalGroupDialog().hideDialogWindow(); GlobalTextureBrowser().destroyWindow(); // Destroy the widget, so it gets removed from the main container gtk_widget_destroy(GTK_WIDGET(_regular.horizPane)); }
void RegularLayout::deactivate() { // Show the camera toggle option again GlobalUIManager().getMenuManager().setVisibility("main/view/cameraview", true); GlobalUIManager().getMenuManager().setVisibility("main/view/textureBrowser", true); // Remove all previously stored pane information GlobalRegistry().deleteXPath(RKEY_REGULAR_ROOT + "//pane"); // Save pane info saveStateToPath(RKEY_REGULAR_ROOT); // Disconnect before destroying stuff _regular.posHPane.disconnect(); _regular.posTexCamPane.disconnect(); // Delete all active views GlobalXYWndManager().destroyViews(); // Delete the CamWnd _camWnd = CamWndPtr(); // Hide the group dialog GlobalGroupDialog().hideDialogWindow(); GlobalTextureBrowser().destroyWindow(); wxFrame* topLevelParent = GlobalMainFrame().getWxTopLevelWindow(); topLevelParent->RemoveChild(_regular.horizPane); _regular.horizPane->Destroy(); _regular.horizPane = NULL; _regular.texCamPane = NULL; }
// Constructor EntityClassTreePopulator::EntityClassTreePopulator(const Glib::RefPtr<Gtk::TreeStore>& store, const EntityClassChooser::TreeColumns& columns) : gtkutil::VFSTreePopulator(store), _store(store), _columns(columns), _folderKey(GlobalRegistry().get(FOLDER_KEY_PATH)), _folderIcon(GlobalUIManager().getLocalPixbuf(FOLDER_ICON)), _entityIcon(GlobalUIManager().getLocalPixbuf(ENTITY_ICON)) {}
RenderPreview::RenderPreview(wxWindow* parent, bool enableAnimation) : _mainPanel(loadNamedPanel(parent, "RenderPreviewPanel")), _glWidget(new wxutil::GLWidget(_mainPanel, boost::bind(&RenderPreview::drawPreview, this), "RenderPreview")), _renderSystem(GlobalRenderSystemFactory().createRenderSystem()), _sceneWalker(_renderer, _volumeTest), _renderingInProgress(false), _timer(this), _previewWidth(0), _previewHeight(0), _filtersMenu(GlobalUIManager().createFilterMenu()) { Connect(wxEVT_TIMER, wxTimerEventHandler(RenderPreview::_onFrame), NULL, this); // Insert GL widget _mainPanel->GetSizer()->Prepend(_glWidget, 1, wxEXPAND); _glWidget->Connect(wxEVT_SIZE, wxSizeEventHandler(RenderPreview::onSizeAllocate), NULL, this); _glWidget->Connect(wxEVT_MOUSEWHEEL, wxMouseEventHandler(RenderPreview::onGLScroll), NULL, this); _glWidget->Connect(wxEVT_MOTION, wxMouseEventHandler(RenderPreview::onGLMotion), NULL, this); _glWidget->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(RenderPreview::onGLMouseClick), NULL, this); _glWidget->Connect(wxEVT_LEFT_DCLICK, wxMouseEventHandler(RenderPreview::onGLMouseClick), NULL, this); wxToolBar* toolbar = findNamedObject<wxToolBar>(_mainPanel, "RenderPreviewAnimToolbar"); _toolbarSizer = toolbar->GetContainingSizer(); // Set up the toolbar if (enableAnimation) { connectToolbarSignals(); } else { toolbar->Hide(); } // Connect filters menu to toolbar wxToolBar* filterToolbar = findNamedObject<wxToolBar>(_mainPanel, "RenderPreviewFilterToolbar"); wxMenu* filterSubmenu = _filtersMenu->getMenuWidget(); wxToolBarToolBase* filterTool = filterToolbar->AddTool(wxID_ANY, _("Filters"), wxArtProvider::GetBitmap(GlobalUIManager().ArtIdPrefix() + "iconFilter16.png"), _("Filters"), wxITEM_DROPDOWN); filterToolbar->SetDropdownMenu(filterTool->GetId(), filterSubmenu); filterToolbar->Realize(); // Get notified of filter changes GlobalFilterSystem().filtersChangedSignal().connect( sigc::mem_fun(this, &RenderPreview::filtersChanged) ); }
void StimResponseEditor::populateWindow() { // Create the overall vbox _dialogVBox = Gtk::manage(new Gtk::VBox(false, 12)); add(*_dialogVBox); // Create the notebook and add it to the vbox _notebook = Gtk::manage(new Gtk::Notebook); _dialogVBox->pack_start(*_notebook, true, true, 0); // The tab label items (icon + label) Gtk::HBox* stimLabelHBox = Gtk::manage(new Gtk::HBox(false, 0)); stimLabelHBox->pack_start( *Gtk::manage(new Gtk::Image( GlobalUIManager().getLocalPixbufWithMask(ICON_STIM + SUFFIX_EXTENSION))), false, false, 3 ); stimLabelHBox->pack_start(*Gtk::manage(new Gtk::Label(_("Stims"))), false, false, 3); Gtk::HBox* responseLabelHBox = Gtk::manage(new Gtk::HBox(false, 0)); responseLabelHBox->pack_start( *Gtk::manage(new Gtk::Image( GlobalUIManager().getLocalPixbufWithMask(ICON_RESPONSE + SUFFIX_EXTENSION))), false, false, 3 ); responseLabelHBox->pack_start(*Gtk::manage(new Gtk::Label(_("Responses"))), false, false, 3); Gtk::HBox* customLabelHBox = Gtk::manage(new Gtk::HBox(false, 0)); customLabelHBox->pack_start( *Gtk::manage(new Gtk::Image( GlobalUIManager().getLocalPixbufWithMask(ICON_CUSTOM_STIM))), false, false, 3 ); customLabelHBox->pack_start(*Gtk::manage(new Gtk::Label(_("Custom Stims"))), false, false, 3); // Show the widgets before using them as label, they won't appear otherwise stimLabelHBox->show_all(); responseLabelHBox->show_all(); customLabelHBox->show_all(); // Cast the helper class to a widget and add it to the notebook page _stimPageNum = _notebook->append_page(*_stimEditor, *stimLabelHBox); _responsePageNum = _notebook->append_page(*_responseEditor, *responseLabelHBox); _customStimPageNum = _notebook->append_page(*_customStimEditor, *customLabelHBox); if (_lastShownPage == -1) { _lastShownPage = _stimPageNum; } // Pack in dialog buttons _dialogVBox->pack_start(createButtons(), false, false, 0); }
void SplitPaneLayout::deconstructMenus() { // Show the camera toggle option again GlobalUIManager().getMenuManager().setVisibility("main/view/cameraview", true); // Remove the camera position menu items GlobalUIManager().getMenuManager().remove("main/view/cameraposition"); // Remove the camera position events GlobalEventManager().removeEvent("CameraPositionTopLeft"); GlobalEventManager().removeEvent("CameraPositionTopRight"); GlobalEventManager().removeEvent("CameraPositionBottomLeft"); GlobalEventManager().removeEvent("CameraPositionBottomRight"); }
MapPreview::MapPreview() : _widget(gtk_frame_new(NULL)), _glWidget(true), _filtersMenu(GlobalUIManager().createFilterMenu()) { // Main vbox - above is the GL widget, below is the toolbar GtkWidget* vbx = gtk_vbox_new(FALSE, 0); // Cast the GLWidget object to GtkWidget for further use GtkWidget* glWidget = _glWidget; gtk_box_pack_start(GTK_BOX(vbx), glWidget, TRUE, TRUE, 0); // Connect up the signals gtk_widget_set_events(glWidget, GDK_DESTROY | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK); g_signal_connect(G_OBJECT(glWidget), "expose-event", G_CALLBACK(onExpose), this); g_signal_connect(G_OBJECT(glWidget), "motion-notify-event", G_CALLBACK(onMouseMotion), this); g_signal_connect(G_OBJECT(glWidget), "scroll-event", G_CALLBACK(onMouseScroll), this); // The HBox containing the toolbar and the menubar GtkWidget* toolHBox = gtk_hbox_new(FALSE, 0); gtk_box_pack_end(GTK_BOX(vbx), toolHBox, FALSE, FALSE, 0); // Create the menu gtk_box_pack_start(GTK_BOX(toolHBox), _filtersMenu->getMenuBarWidget(), TRUE, TRUE, 0); // Pack into a frame and return gtk_container_add(GTK_CONTAINER(_widget), vbx); // Add an observer to the FilterSystem to get notified about changes _filterObserver = MapPreviewFilterObserverPtr(new MapPreviewFilterObserver(*this)); GlobalFilterSystem().addObserver(_filterObserver); }
void StimTypes::add(int id, const std::string& name, const std::string& caption, const std::string& description, const std::string& icon, bool custom) { StimType newStimType; newStimType.name = name; newStimType.caption = caption; newStimType.description = description; newStimType.icon = icon; newStimType.custom = custom; // Add the stim to the map _stimTypes[id] = newStimType; // Combine the ID and the caption std::string captionPlusId = caption; bool showStimTypeIds = registry::getValue<bool>(RKEY_SHOW_STIM_TYPE_IDS); captionPlusId += showStimTypeIds ? " (" + string::to_string(id) + ")" : ""; Gtk::TreeModel::Row row = *_listStore->append(); row[_columns.id] = id; row[_columns.caption] = _stimTypes[id].caption; row[_columns.captionPlusID] = captionPlusId; row[_columns.icon] = GlobalUIManager().getLocalPixbufWithMask(newStimType.icon); row[_columns.name] = _stimTypes[id].name; row[_columns.isCustom] = custom; }
void PrefabSelector::populatePrefabs() { _populated = true; if (_populator && _populator->getPrefabPath() == getPrefabFolder()) { // Population already running for this path return; } // Clear the existing run first (this waits for it to finish) _populator.reset(); // Clear the treestore first _treeStore->Clear(); wxutil::TreeModel::Row row = _treeStore->AddItem(); wxIcon prefabIcon; prefabIcon.CopyFromBitmap( wxArtProvider::GetBitmap(GlobalUIManager().ArtIdPrefix() + "cmenu_add_prefab.png")); row[_columns.filename] = wxVariant(wxDataViewIconText(_("Loading..."), prefabIcon)); row[_columns.isFolder] = false; row.SendItemAdded(); _populator.reset(new PrefabPopulator(_columns, this, getPrefabFolder())); // Start the thread, will send an event when finished _populator->populate(); }
void StatusBarManager::addTextElement(const std::string& name, const std::string& icon, int pos) { // Get a free position int freePos = getFreePosition(pos); Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox(false, 6)); if (!icon.empty()) { Gtk::Image* img = Gtk::manage(new Gtk::Image( GlobalUIManager().getLocalPixbuf(icon) )); hbox->pack_start(*img, false, false, 0); } Gtk::Label* label = Gtk::manage(new Gtk::Label); hbox->pack_start(*label, false, false, 0); StatusBarElementPtr element(new StatusBarElement(Gtk::manage(new gtkutil::FramedWidget(*hbox)), label)); // Store this element _elements.insert(ElementMap::value_type(name, element)); _positions.insert(PositionMap::value_type(freePos, element)); rebuildStatusBar(); }
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); }
void SplitPaneLayout::constructMenus() { // Hide the camera toggle option for non-floating views IMenuManager& menuManager = GlobalUIManager().getMenuManager(); menuManager.setVisibility("main/view/cameraview", false); // Add the commands for changing the camera position GlobalEventManager().addToggle("CameraPositionTopLeft", boost::bind(&SplitPaneLayout::setCameraTopLeft, this, _1)); GlobalEventManager().addToggle("CameraPositionTopRight", boost::bind(&SplitPaneLayout::setCameraTopRight, this, _1)); GlobalEventManager().addToggle("CameraPositionBottomLeft", boost::bind(&SplitPaneLayout::setCameraBottomLeft, this, _1)); GlobalEventManager().addToggle("CameraPositionBottomRight", boost::bind(&SplitPaneLayout::setCameraBottomRight, this, _1)); // Add the corresponding menu items menuManager.insert("main/view/camera", "cameraposition", ui::menuFolder, _("Camera Position"), "", ""); menuManager.add("main/view/cameraposition", "camtopleft", ui::menuItem, _("Top Left"), "", "CameraPositionTopLeft"); menuManager.add("main/view/cameraposition", "camtopright", ui::menuItem, _("Top Right"), "", "CameraPositionTopRight"); menuManager.add("main/view/cameraposition", "cambottomleft", ui::menuItem, _("Bottom Left"), "", "CameraPositionBottomLeft"); menuManager.add("main/view/cameraposition", "cambottomright", ui::menuItem, _("Bottom Right"), "", "CameraPositionBottomRight"); updateCameraPositionToggles(); }
virtual void initialiseModule(const ApplicationContext& ctx) { rMessage() << getName() << "::initialiseModule called." << std::endl; // Associated "def_head" with an empty property editor instance GlobalEntityInspector().registerPropertyEditor( ui::DEF_HEAD_KEY, ui::IPropertyEditorPtr(new ui::AIHeadPropertyEditor()) ); GlobalEntityInspector().registerPropertyEditor( ui::DEF_VOCAL_SET_KEY, ui::IPropertyEditorPtr(new ui::AIVocalSetPropertyEditor()) ); GlobalCommandSystem().addCommand("FixupMapDialog", ui::FixupMapDialog::RunDialog); GlobalEventManager().addCommand("FixupMapDialog", "FixupMapDialog"); GlobalUIManager().getMenuManager().add("main/map", "FixupMapDialog", ui::menuItem, _("Fixup Map..."), // caption "", // icon "FixupMapDialog" ); GlobalRadiant().signal_radiantStarted().connect( sigc::ptr_fun(ui::AIEditingPanel::onRadiantStartup) ); }
GtkTreeIter* EntityClassTreePopulator::addRecursive(const std::string& pathName) { // Lookup pathname in map, and return the GtkTreeIter* if it is // found DirIterMap::iterator iTemp = _dirIterMap.find(pathName); if (iTemp != _dirIterMap.end()) { // found in map return iTemp->second; } // Split the path into "this directory" and the parent path std::size_t slashPos = pathName.rfind("/"); const std::string parentPath = pathName.substr(0, slashPos); const std::string thisDir = pathName.substr(slashPos + 1); // Recursively add parent path GtkTreeIter* parIter = NULL; if (slashPos != std::string::npos) parIter = addRecursive(parentPath); // Now add "this directory" as a child, saving the iter in the map // and returning it. GtkTreeIter iter; gtk_tree_store_append(_store, &iter, parIter); gtk_tree_store_set(_store, &iter, NAME_COLUMN, thisDir.c_str(), ICON_COLUMN, GlobalUIManager().getLocalPixbuf(FOLDER_ICON), DIR_FLAG_COLUMN, TRUE, -1); GtkTreeIter* dynIter = gtk_tree_iter_copy(&iter); // get a heap-allocated iter // Cache the dynamic iter and return it _dirIterMap[pathName] = dynIter; return dynIter; }
void StimTypes::setStimTypeCaption(int id, const std::string& caption) { StimTypeMap::iterator found = _stimTypes.find(id); if (found != _stimTypes.end()) { _stimTypes[id].caption = caption; // Combine the ID and the caption std::string captionPlusId = caption; bool showStimTypeIds = registry::getValue<bool>(RKEY_SHOW_STIM_TYPE_IDS); captionPlusId += showStimTypeIds ? " (" + string::to_string(id) + ")" : ""; // Update the list store wxutil::TreeModel::Row row(getIterForId(id), *_listStore); wxBitmap bmp = wxArtProvider::GetBitmap(GlobalUIManager().ArtIdPrefix() + _stimTypes[id].icon); wxIcon stimIcon; stimIcon.CopyFromBitmap(bmp); row[_columns.caption] = wxVariant(wxDataViewIconText(_stimTypes[id].caption, stimIcon)); row[_columns.captionPlusID] = captionPlusId; row.SendItemChanged(); } }
wxMenuBar* TopLevelFrame::createMenuBar() { // Create the Filter menu entries before adding the menu bar FiltersMenu::addItemsToMainMenu(); // Return the "main" menubar from the UIManager return GlobalUIManager().getMenuManager().getMenuBar("main"); }
Glib::RefPtr<Gdk::Pixbuf> PropertyEditorFactory::getPixbufFor(const std::string& type) { // Sanity check if (type.empty()) return Glib::RefPtr<Gdk::Pixbuf>(); std::string iconName = "icon_" + type + ".png"; return GlobalUIManager().getLocalPixbuf(iconName); }
void FiltersMenu::removeItemsFromMainMenu() { // Get the menu manager IMenuManager& menuManager = GlobalUIManager().getMenuManager(); // Remove the filters menu if there exists one menuManager.remove(MENU_PATH); }
PatchInspector::CoordRow PatchInspector::createCoordRow( const std::string& label, wxPanel* parent, wxSizer* sizer) { CoordRow coordRow; // Create the coordinate label wxStaticText* coordLabel = new wxStaticText(parent, wxID_ANY, label); coordRow.value = new wxTextCtrl(parent, wxID_ANY); coordRow.value->SetMinClientSize(wxSize(coordRow.value->GetCharWidth() * 7, -1)); coordRow.value->Connect(wxEVT_TEXT, wxCommandEventHandler(PatchInspector::onCoordChange), NULL, this); // Coord control wxBoxSizer* controlButtonBox = new wxBoxSizer(wxHORIZONTAL); controlButtonBox->SetMinSize(30, 30); coordRow.smaller = new wxutil::ControlButton(parent, wxArtProvider::GetBitmap(GlobalUIManager().ArtIdPrefix() + "arrow_left.png")); coordRow.smaller->SetMinSize(wxSize(15, 24)); controlButtonBox->Add(coordRow.smaller, 0); coordRow.larger = new wxutil::ControlButton(parent, wxArtProvider::GetBitmap(GlobalUIManager().ArtIdPrefix() + "arrow_right.png")); coordRow.larger->SetMinSize(wxSize(15, 24)); controlButtonBox->Add(coordRow.larger, 0); // Create the step label wxStaticText* steplabel = new wxStaticText(parent, wxID_ANY, _(LABEL_STEP)); // Create the step entry field coordRow.stepEntry = new wxTextCtrl(parent, wxID_ANY); coordRow.stepEntry->SetMinClientSize(wxSize(coordRow.stepEntry->GetCharWidth() * 5, -1)); sizer->Add(coordLabel, 0, wxALIGN_CENTRE_VERTICAL); sizer->Add(coordRow.value, 0, wxALIGN_CENTRE_VERTICAL); sizer->Add(controlButtonBox, 0, wxALIGN_CENTRE_VERTICAL); sizer->Add(steplabel, 0, wxALIGN_CENTRE_VERTICAL); sizer->Add(coordRow.stepEntry, 0, wxALIGN_CENTRE_VERTICAL); // Return the filled structure return coordRow; }
void StimResponseEditor::populateWindow() { SetSizer(new wxBoxSizer(wxVERTICAL)); _imageList.reset(new wxImageList(16, 16)); _notebook->SetImageList(_imageList.get()); // Stim Editor Page int imageId = _imageList->Add( wxArtProvider::GetBitmap(GlobalUIManager().ArtIdPrefix() + ICON_STIM + SUFFIX_EXTENSION)); _notebook->AddPage(_stimEditor, _("Stims"), false, imageId); _stimPageNum = _notebook->FindPage(_stimEditor); // Response Editor Page imageId = _imageList->Add( wxArtProvider::GetBitmap(GlobalUIManager().ArtIdPrefix() + ICON_RESPONSE + SUFFIX_EXTENSION)); _notebook->AddPage(_responseEditor, _("Responses"), false, imageId); _responsePageNum = _notebook->FindPage(_responseEditor); // Custom Stim Editor imageId = _imageList->Add( wxArtProvider::GetBitmap(GlobalUIManager().ArtIdPrefix() + ICON_CUSTOM_STIM)); _notebook->AddPage(_customStimEditor, _("Custom Stims"), false, imageId); _customStimPageNum = _notebook->FindPage(_customStimEditor); _notebook->Connect(wxEVT_NOTEBOOK_PAGE_CHANGED, wxBookCtrlEventHandler(StimResponseEditor::onPageChanged), NULL, this); // Pack everything into the main window GetSizer()->Add(_notebook, 1, wxEXPAND | wxALL, 12); GetSizer()->Add(CreateStdDialogButtonSizer(wxOK | wxCANCEL), 0, wxALIGN_RIGHT | wxALL, 12); if (_lastShownPage == -1) { _lastShownPage = _stimPageNum; } Layout(); Fit(); }
/* Checks the passed xmlNode for a recognized item (ToolButton, ToggleToolButton, Separator) * Returns the widget or NULL if nothing useful is found */ GtkWidget* ToolbarManager::createToolItem(xml::Node& node) { const std::string nodeName = node.getName(); GtkWidget* toolItem; if (nodeName == "separator") { toolItem = GTK_WIDGET(gtk_separator_tool_item_new()); } else if (nodeName == "toolbutton" || nodeName == "toggletoolbutton") { // Found a button, load the values that are shared by both types const std::string name = node.getAttributeValue("name"); const std::string icon = node.getAttributeValue("icon"); const std::string tooltip = _(node.getAttributeValue("tooltip").c_str()); const std::string action = node.getAttributeValue("action"); if (nodeName == "toolbutton") { // Create a new GtkToolButton and assign the right callback toolItem = GTK_WIDGET(gtk_tool_button_new(NULL, name.c_str())); } else { // Create a new GtkToggleToolButton and assign the right callback toolItem = GTK_WIDGET(gtk_toggle_tool_button_new()); } IEventPtr event = GlobalEventManager().findEvent(action); if (!event->empty()) { event->connectWidget(GTK_WIDGET(toolItem)); // Tell the event to update the state of this button event->updateWidgets(); } else { globalErrorStream() << "ToolbarManager: Failed to lookup command " << action << std::endl; } // Set the tooltip, if not empty if (tooltip != "") { gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(toolItem), _tooltips, tooltip.c_str(), ""); } // Load and assign the icon, if specified if (icon != "") { GtkWidget* image = gtk_image_new_from_pixbuf(GlobalUIManager().getLocalPixbufWithMask(icon)); gtk_widget_show(image); gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(toolItem), image); } } else { return NULL; } gtk_widget_show(toolItem); return toolItem; }
void StimTypes::populateComboBox(wxBitmapComboBox* combo) const { combo->Clear(); std::for_each(_stimTypes.begin(), _stimTypes.end(), [&] (const StimTypeMap::value_type& pair) { wxBitmap icon = wxArtProvider::GetBitmap(GlobalUIManager().ArtIdPrefix() + pair.second.icon); // Add the name (e.g. "STIM_FIRE") as client data to this option, for later retrieval combo->Append(pair.second.caption, icon, new wxStringClientData(pair.second.name)); }); }
EClassTreeBuilder::EClassTreeBuilder(const Glib::RefPtr<Gtk::TreeStore>& targetStore, const EClassTreeColumns& columns) : _treePopulator(targetStore), _columns(columns), _entityIcon(GlobalUIManager().getLocalPixbuf(ENTITY_ICON)) { // Travese the entity classes, this will call visit() for each eclass GlobalEntityClassManager().forEachEntityClass(*this); // Visit the tree populator in order to fill in the column data _treePopulator.forEachNode(*this); }
SelectionSetToolmenu::SelectionSetToolmenu() : Gtk::ToolItem(), _listStore(Gtk::ListStore::create(_columns)), _clearSetsButton(NULL), _entry(Gtk::manage(new Gtk::ComboBoxEntry(_listStore, _columns.name))) { // Hbox containing all our items Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox(false, 3)); add(*hbox); // Pack Label hbox->pack_start( *Gtk::manage(new gtkutil::LeftAlignedLabel(_("Selection Set: "))), false, false, 0); // Pack Combo Box hbox->pack_start(*_entry, true, true, 0); // Add tooltip _entry->set_tooltip_markup(_(ENTRY_TOOLTIP)); // Add clear button { Gtk::Image* image = Gtk::manage(new Gtk::Image(GlobalUIManager().getLocalPixbufWithMask("delete.png"))); image->show(); _clearSetsButton = Gtk::manage(new Gtk::ToolButton(*image, _("Clear Selection Sets"))); // Set tooltip _clearSetsButton->set_tooltip_text(_("Clear Selection Sets")); // Connect event _clearSetsButton->signal_clicked().connect(sigc::mem_fun(*this, &SelectionSetToolmenu::onDeleteAllSetsClicked)); hbox->pack_start(*_clearSetsButton, false, false, 0); } // Connect the signals Gtk::Entry* childEntry = _entry->get_entry(); childEntry->signal_activate().connect(sigc::mem_fun(*this, &SelectionSetToolmenu::onEntryActivated)); _entry->signal_changed().connect(sigc::mem_fun(*this, &SelectionSetToolmenu::onSelectionChanged)); // Populate the list update(); // Add self as observer GlobalSelectionSetManager().addObserver(*this); show_all(); }
ParticlePreview::ParticlePreview() { // Add one additional toolbar for particle-related stuff Gtk::Toolbar* toolbar = Gtk::manage(new Gtk::Toolbar); toolbar->set_toolbar_style(Gtk::TOOLBAR_ICONS); _showAxesButton = Gtk::manage(new Gtk::ToggleToolButton); _showAxesButton->signal_toggled().connect( sigc::mem_fun(this, &ParticlePreview::queue_draw) ); _showAxesButton->set_icon_widget(*Gtk::manage(new Gtk::Image( GlobalUIManager().getLocalPixbufWithMask("axes.png")))); _showAxesButton->set_tooltip_text(_("Show coordinate axes")); Gtk::ToolButton* reloadButton = Gtk::manage(new Gtk::ToolButton); reloadButton->set_icon_widget(*Gtk::manage(new Gtk::Image(Gtk::Stock::REFRESH, Gtk::ICON_SIZE_MENU))); reloadButton->set_tooltip_text(_("Reload Particle Defs")); IEventPtr ev = GlobalEventManager().findEvent("ReloadParticles"); ev->connectWidget(reloadButton); _showWireFrameButton = Gtk::manage(new Gtk::ToggleToolButton); _showWireFrameButton->set_icon_widget(*Gtk::manage(new Gtk::Image( GlobalUIManager().getLocalPixbufWithMask("wireframe.png")))); _showWireFrameButton->set_tooltip_text(_("Show wireframe")); _showWireFrameButton->signal_toggled().connect( sigc::mem_fun(this, &ParticlePreview::queue_draw) ); _automaticLoopButton = Gtk::manage(new Gtk::ToggleToolButton(_("Auto Loop"))); _automaticLoopButton->set_tooltip_text(_("Auto Loop")); toolbar->insert(*_showAxesButton, 0); toolbar->insert(*_showWireFrameButton, 0); toolbar->insert(*_automaticLoopButton, 0); toolbar->insert(*reloadButton, 0); addToolbar(*toolbar); }
GtkWidget* MapInfoDialog::createTabLabel(const std::string& label, const std::string& iconName) { // The tab label items (icon + label) GtkWidget* hbox = gtk_hbox_new(FALSE, 3); gtk_box_pack_start( GTK_BOX(hbox), gtk_image_new_from_pixbuf(GlobalUIManager().getLocalPixbufWithMask(iconName)), FALSE, FALSE, 3 ); gtk_box_pack_start(GTK_BOX(hbox), gtk_label_new(label.c_str()), FALSE, FALSE, 3); // Show the widgets before using them as label, they won't appear otherwise gtk_widget_show_all(hbox); return hbox; }
SelectionSetToolmenu::SelectionSetToolmenu() : _toolItem(gtk_tool_item_new()), _listStore(gtk_list_store_new(1, G_TYPE_STRING)), _clearSetsButton(NULL), _entry(gtk_combo_box_entry_new_with_model(GTK_TREE_MODEL(_listStore), 0)) { // Hbox containing all our items GtkWidget* hbox = gtk_hbox_new(FALSE, 3); gtk_container_add(GTK_CONTAINER(_toolItem), hbox); // Pack Label gtk_box_pack_start(GTK_BOX(hbox), gtkutil::LeftAlignedLabel(_("Selection Set: ")), FALSE, FALSE, 0); // Pack Combo Box gtk_box_pack_start(GTK_BOX(hbox), _entry, TRUE, TRUE, 0); // Add tooltip gtk_widget_set_tooltip_markup(_entry, _(ENTRY_TOOLTIP)); // Add clear button { GtkWidget* image = gtk_image_new_from_pixbuf(GlobalUIManager().getLocalPixbufWithMask("delete.png")); gtk_widget_show(image); _clearSetsButton = gtk_tool_button_new(image, _("Clear Selection Sets")); // Set tooltip gtk_tool_item_set_tooltip_text(_clearSetsButton, _("Clear Selection Sets")); // Connect event g_signal_connect(G_OBJECT(_clearSetsButton), "clicked", G_CALLBACK(onDeleteAllSetsClicked), this); gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(_clearSetsButton), FALSE, FALSE, 0); } // Connect the signals GtkWidget* childEntry = gtk_bin_get_child(GTK_BIN(_entry)); g_signal_connect(G_OBJECT(childEntry), "activate", G_CALLBACK(onEntryActivated), this); g_signal_connect(G_OBJECT(_entry), "changed", G_CALLBACK(onSelectionChanged), this); // Populate the list update(); // Add self as observer GlobalSelectionSetManager().addObserver(*this); }
// Required visit function void EntityClassTreePopulator::visit(IEntityClassPtr e) { // Recursively create the folder to put this EntityClass in, // depending on the value of the DISPLAY_FOLDER_KEY. This may return // NULL if the key is unset, in which case we add the entity at // the top level. GtkTreeIter* parIter = addDisplayFolder(e); // Add the new class under the parent folder GtkTreeIter iter; gtk_tree_store_append(_store, &iter, parIter); gtk_tree_store_set(_store, &iter, NAME_COLUMN, e->getName().c_str(), ICON_COLUMN, GlobalUIManager().getLocalPixbuf(ENTITY_ICON), DIR_FLAG_COLUMN, FALSE, -1); }
virtual void initialiseModule(const ApplicationContext& ctx) { rMessage() << getName() << "::initialiseModule called.\n"; // Add the callback event GlobalCommandSystem().addCommand("ConversationEditor", ui::ConversationDialog::showDialog); GlobalEventManager().addCommand("ConversationEditor", "ConversationEditor"); // Add the menu item IMenuManager& mm = GlobalUIManager().getMenuManager(); mm.add("main/map", // menu location path "ConversationEditor", // name ui::menuItem, // type _("Conversations..."), // caption "stimresponse.png", // icon "ConversationEditor"); // event name }
virtual void initialiseModule(const ApplicationContext& ctx) { rMessage() << getName() << "::initialiseModule called.\n"; // Add the callback event GlobalCommandSystem().addCommand("EntityClassTree", ui::EClassTree::showWindow); GlobalEventManager().addCommand("EntityClassTree", "EntityClassTree"); // Add the menu item IMenuManager& mm = GlobalUIManager().getMenuManager(); mm.add("main/entity", // menu location path "EntityClassTree", // name ui::menuItem, // type _("Entity Class Tree..."), // caption "icon_classname.png", // icon "EntityClassTree"); // event name }