AddPropertyDialog::AddPropertyDialog(Entity* entity) : wxutil::DialogBase(_(ADDPROPERTY_TITLE)), _entity(entity) { Connect(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(AddPropertyDialog::_onDeleteEvent), NULL, this); wxPanel* mainPanel = loadNamedPanel(this, "AddPropertyDialogPanel"); _treeView = wxutil::TreeView::Create(mainPanel, wxBORDER_STATIC | wxDV_MULTIPLE | wxDV_NO_HEADER); mainPanel->GetSizer()->Prepend(_treeView, 1, wxEXPAND | wxALL, 6); wxButton* okButton = findNamedObject<wxButton>(mainPanel, "OkButton"); okButton->Connect(wxEVT_BUTTON, wxCommandEventHandler(AddPropertyDialog::_onOK), NULL, this); wxButton* cancelButton = findNamedObject<wxButton>(mainPanel, "CancelButton"); cancelButton->Connect(wxEVT_BUTTON, wxCommandEventHandler(AddPropertyDialog::_onCancel), NULL, this); FitToScreen(0.5f, 0.6f); // Populate the tree view with properties setupTreeView(); populateTreeView(); updateUsagePanel(); }
PatchCreateDialog::PatchCreateDialog() : Dialog(_(WINDOW_TITLE)) { _dialog->GetSizer()->Add(loadNamedPanel(_dialog, "PatchCreatePanel"), 1, wxEXPAND | wxALL, 12); // Create the title label (bold font) makeLabelBold(_dialog, "PatchCreateTopLabel"); wxChoice* comboWidth = findNamedObject<wxChoice>(_dialog, "PatchCreateWidthChoice"); wxChoice* comboHeight = findNamedObject<wxChoice>(_dialog, "PatchCreateHeightChoice"); // Fill the values into the combo boxes for (int i = MIN_PATCH_DIM; i <= MAX_PATCH_DIM; i += INCR_PATCH_DIM) { comboWidth->Append(string::to_string(i)); comboHeight->Append(string::to_string(i)); } // Activate the first item in the combo boxes comboWidth->Select(0); comboHeight->Select(0); // Create the "remove brushes" label wxCheckBox* removeCheckBox = findNamedObject<wxCheckBox>(_dialog, "PatchCreateRemoveSelectedBrush"); removeCheckBox->SetValue(DEFAULT_REMOVE_BRUSHES); }
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 PatchInspector::populateWindow() { SetSizer(new wxBoxSizer(wxVERTICAL)); GetSizer()->Add(loadNamedPanel(this, "PatchInspectorMainPanel"), 1, wxEXPAND); makeLabelBold(this, "PatchInspectorVertexLabel"); makeLabelBold(this, "PatchInspectorCoordLabel"); makeLabelBold(this, "PatchInspectorTessLabel"); _rowCombo = findNamedObject<wxChoice>(this, "PatchInspectorControlRow"); _colCombo = findNamedObject<wxChoice>(this, "PatchInspectorControlColumn"); // Create the controls table wxPanel* coordPanel = findNamedObject<wxPanel>(this, "PatchInspectorCoordPanel"); wxFlexGridSizer* table = new wxFlexGridSizer(5, 5, 6, 16); table->AddGrowableCol(1); coordPanel->GetSizer()->Add(table, 1, wxEXPAND); _coords["x"] = createCoordRow("X:", coordPanel, table); _coords["y"] = createCoordRow("Y:", coordPanel, table); _coords["z"] = createCoordRow("Z:", coordPanel, table); _coords["s"] = createCoordRow("S:", coordPanel, table); _coords["t"] = createCoordRow("T:", coordPanel, table); // Connect the step values to the according registry values registry::bindWidget(_coords["x"].stepEntry, RKEY_X_STEP); registry::bindWidget(_coords["y"].stepEntry, RKEY_Y_STEP); registry::bindWidget(_coords["z"].stepEntry, RKEY_Z_STEP); registry::bindWidget(_coords["s"].stepEntry, RKEY_S_STEP); registry::bindWidget(_coords["t"].stepEntry, RKEY_T_STEP); // Connect all the arrow buttons for (CoordMap::iterator i = _coords.begin(); i != _coords.end(); ++i) { CoordRow& row = i->second; // Pass a CoordRow ref to the callback, that's all it will need to update row.smaller->Bind(wxEVT_BUTTON, boost::bind(&PatchInspector::onClickSmaller, this, row)); row.larger->Bind(wxEVT_BUTTON, boost::bind(&PatchInspector::onClickLarger, this, row)); } // Tesselation checkbox findNamedObject<wxCheckBox>(this, "PatchInspectorFixedSubdivisions")->Connect( wxEVT_CHECKBOX, wxCommandEventHandler(PatchInspector::onFixedTessChange), NULL, this); // Tesselation values findNamedObject<wxSpinCtrl>(this, "PatchInspectorSubdivisionsX")->Connect( wxEVT_SPINCTRL, wxSpinEventHandler(PatchInspector::onTessChange), NULL, this); findNamedObject<wxSpinCtrl>(this, "PatchInspectorSubdivisionsY")->Connect( wxEVT_SPINCTRL, wxSpinEventHandler(PatchInspector::onTessChange), NULL, this); }
ModelSelector::ModelSelector() : DialogBase(_(MODELSELECTOR_TITLE)), _dialogPanel(loadNamedPanel(this, "ModelSelectorPanel")), _treeStore(new wxutil::TreeModel(_columns)), _treeStoreWithSkins(new wxutil::TreeModel(_columns)), _infoTable(NULL), _materialsList(NULL), _lastModel(""), _lastSkin(""), _populated(false), _showOptions(true) { // Set the default size of the window _position.connect(this); _position.readPosition(); wxPanel* rightPanel = findNamedObject<wxPanel>(this, "ModelSelectorRightPanel"); _modelPreview.reset(new wxutil::ModelPreview(rightPanel)); rightPanel->GetSizer()->Add(_modelPreview->getWidget(), 1, wxEXPAND); // The model preview is half the width and 20% of the parent's height (to // allow vertical shrinking) _modelPreview->setSize(static_cast<int>(_position.getSize()[0]*0.4f), static_cast<int>(_position.getSize()[1]*0.2f)); wxPanel* leftPanel = findNamedObject<wxPanel>(this, "ModelSelectorLeftPanel"); // Set up view widgets setupAdvancedPanel(leftPanel); // Connect buttons findNamedObject<wxButton>(this, "ModelSelectorOkButton")->Connect( wxEVT_BUTTON, wxCommandEventHandler(ModelSelector::onOK), NULL, this); findNamedObject<wxButton>(this, "ModelSelectorCancelButton")->Connect( wxEVT_BUTTON, wxCommandEventHandler(ModelSelector::onCancel), NULL, this); Connect(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(ModelSelector::_onDeleteEvent), NULL, this); FitToScreen(0.8f, 0.8f); wxSplitterWindow* splitter = findNamedObject<wxSplitterWindow>(this, "ModelSelectorSplitter"); splitter->SetSashPosition(static_cast<int>(GetSize().GetWidth() * 0.2f)); splitter->SetMinimumPaneSize(10); // disallow unsplitting _panedPosition.connect(splitter); _panedPosition.loadFromPath(RKEY_SPLIT_POS); }
void CommandEditor::populateWindow() { loadNamedPanel(this, "ConvCmdEditorMainPanel"); makeLabelBold(this, "ConvCmdEditorActorLabel"); makeLabelBold(this, "ConvCmdEditorCommandLabel"); makeLabelBold(this, "ConvCmdEditorCmdArgLabel"); makeLabelBold(this, "ConvCmdEditorPropertiesLabel"); wxChoice* cmdDropDown = findNamedObject<wxChoice>(this, "ConvCmdEditorCommandChoice"); cmdDropDown->Connect(wxEVT_CHOICE, wxCommandEventHandler(CommandEditor::onCommandTypeChange), NULL, this); // Wire up button events findNamedObject<wxButton>(this, "ConvCmdEditorCancelButton")->Connect( wxEVT_BUTTON, wxCommandEventHandler(CommandEditor::onCancel), NULL, this); findNamedObject<wxButton>(this, "ConvCmdEditorOkButton")->Connect( wxEVT_BUTTON, wxCommandEventHandler(CommandEditor::onSave), NULL, this); }
// Private constructor sets up dialog LightInspector::LightInspector() : wxutil::TransientWindow(_(LIGHTINSPECTOR_TITLE), GlobalMainFrame().getWxTopLevelWindow(), true), _isProjected(false), _texSelector(NULL), _updateActive(false) { loadNamedPanel(this, "LightInspectorMainPanel"); setupLightShapeOptions(); setupOptionsPanel(); setupTextureWidgets(); makeLabelBold(this, "LightInspectorVolumeLabel"); makeLabelBold(this, "LightInspectorColourLabel"); makeLabelBold(this, "LightInspectorOptionsLabel"); makeLabelBold(this, "LightInspectorTextureLabel"); InitialiseWindowPosition(600, 360, RKEY_WINDOW_STATE); }
void MissionInfoEditDialog::populateWindow() { SetSizer(new wxBoxSizer(wxVERTICAL)); wxPanel* panel = loadNamedPanel(this, "MissionInfoEditDialogMainPanel"); GetSizer()->Add(panel, 1, wxEXPAND); // Replace the list control with our own TreeView wxWindow* existing = findNamedObject<wxWindow>(this, "MissionInfoEditDialogMissionTitleList"); wxutil::TreeView* treeview = wxutil::TreeView::CreateWithModel(existing->GetParent(), _missionTitleStore, wxDV_SINGLE); treeview->SetName("MissionInfoEditDialogMissionTitleList"); treeview->SetMinSize(wxSize(-1, 150)); // Display name column with icon treeview->AppendTextColumn(_("#"), _missionTitleColumns.number.getColumnIndex(), wxDATAVIEW_CELL_INERT, wxCOL_WIDTH_AUTOSIZE, wxALIGN_NOT); treeview->AppendTextColumn(_("Title"), _missionTitleColumns.title.getColumnIndex(), wxDATAVIEW_CELL_EDITABLE, wxCOL_WIDTH_AUTOSIZE, wxALIGN_NOT); treeview->Connect(wxEVT_DATAVIEW_ITEM_EDITING_DONE, wxDataViewEventHandler(MissionInfoEditDialog::onTitleEdited), nullptr, this); treeview->Connect(wxEVT_DATAVIEW_ITEM_CONTEXT_MENU, wxDataViewEventHandler(MissionInfoEditDialog::onTitleContextMenu), nullptr, this); existing->GetContainingSizer()->Replace(existing, treeview); existing->Destroy(); // Add the preview widget wxPanel* previewPanel = findNamedObject<wxPanel>(this, "MissionInfoEditDialogPreviewPanel"); _guiView = new DarkmodTxtGuiView(previewPanel); previewPanel->GetSizer()->Add(_guiView, 1, wxEXPAND); makeLabelBold(this, "MissionInfoLabel"); wxButton* saveButton = findNamedObject<wxButton>(this, "MissionInfoEditDialogSaveButton"); wxButton* cancelButton = findNamedObject<wxButton>(this, "MissionInfoEditDialogCancelButton"); saveButton->Bind(wxEVT_BUTTON, sigc::mem_fun(this, &MissionInfoEditDialog::onSave)); cancelButton->Bind(wxEVT_BUTTON, sigc::mem_fun(this, &MissionInfoEditDialog::onCancel)); // Popup Menu _missionTitlesContextMenu.reset(new wxutil::PopupMenu); _missionTitlesContextMenu->addItem( new wxutil::StockIconTextMenuItem(_("Add Title"), wxART_PLUS), std::bind(&MissionInfoEditDialog::onAddTitle, this) ); _missionTitlesContextMenu->addItem( new wxutil::StockIconTextMenuItem(_("Delete Title"), wxART_MINUS), std::bind(&MissionInfoEditDialog::onDeleteTitle, this), std::bind(&MissionInfoEditDialog::testDeleteTitle, this) ); // Wire up the text entry boxes to update the preview setupNamedEntryBox("MissionInfoEditDialogTitleEntry"); setupNamedEntryBox("MissionInfoEditDialogAuthorEntry"); setupNamedEntryBox("MissionInfoEditDialogDescriptionEntry"); setupNamedEntryBox("MissionInfoEditDialogVersionEntry"); // Setup the event for the readme.txt button wxButton* editReadmeButton = findNamedObject<wxButton>(this, "MissionInfoEditDialogEditReadmeButton"); editReadmeButton->Bind(wxEVT_BUTTON, sigc::mem_fun(this, &MissionInfoEditDialog::onEditReadme)); Layout(); Fit(); CenterOnScreen(); }