| 25 | } |
| 26 | |
| 27 | OvEditor::Panels::Toolbar::Toolbar |
| 28 | ( |
| 29 | const std::string& p_title, |
| 30 | bool p_opened, |
| 31 | const OvUI::Settings::PanelWindowSettings& p_windowSettings |
| 32 | ) : PanelWindow(p_title, p_opened, p_windowSettings) |
| 33 | { |
| 34 | using namespace OvUI::Widgets; |
| 35 | using namespace OvUI::Widgets::Buttons; |
| 36 | |
| 37 | const auto iconSize = OvMaths::FVector2{ 20, 20 }; |
| 38 | auto& textureManager = OvCore::Global::ServiceLocator::Get<OvCore::ResourceManagement::TextureManager>(); |
| 39 | auto& editorResources = EDITOR_CONTEXT(editorResources); |
| 40 | |
| 41 | auto& translate = CreateWidget<ButtonImage>(editorResources->GetTexture("Move")->GetTexture().GetID(), iconSize); |
| 42 | translate.lineBreak = false; |
| 43 | translate.tooltip = "Set gizmo operation to translate\nShortcut: [W]"; |
| 44 | translate.ClickedEvent += []() { EDITOR_EXEC(SetGizmoOperation(OvEditor::Core::EGizmoOperation::TRANSLATE)); }; |
| 45 | |
| 46 | auto& rotate = CreateWidget<ButtonImage>(editorResources->GetTexture("Rotate")->GetTexture().GetID(), iconSize); |
| 47 | rotate.lineBreak = false; |
| 48 | rotate.tooltip = "Set gizmo operation to rotate\nShortcut: [E]"; |
| 49 | rotate.ClickedEvent += []() { EDITOR_EXEC(SetGizmoOperation(OvEditor::Core::EGizmoOperation::ROTATE)); }; |
| 50 | |
| 51 | auto& scale = CreateWidget<ButtonImage>(editorResources->GetTexture("Scale")->GetTexture().GetID(), iconSize); |
| 52 | scale.lineBreak = false; |
| 53 | scale.tooltip = "Set gizmo operation to scale\nShortcut: [R]"; |
| 54 | scale.ClickedEvent += []() { EDITOR_EXEC(SetGizmoOperation(OvEditor::Core::EGizmoOperation::SCALE)); }; |
| 55 | |
| 56 | auto updateGizmoOperation = [&translate, &rotate, &scale](Core::EGizmoOperation p_operation) { |
| 57 | using enum Core::EGizmoOperation; |
| 58 | translate.tint = GetButtonTint(p_operation == TRANSLATE); |
| 59 | rotate.tint = GetButtonTint(p_operation == ROTATE); |
| 60 | scale.tint = GetButtonTint(p_operation == SCALE); |
| 61 | }; |
| 62 | |
| 63 | updateGizmoOperation(EDITOR_EXEC(GetGizmoOperation())); |
| 64 | |
| 65 | EDITOR_EVENT(EditorOperationChanged) += updateGizmoOperation; |
| 66 | |
| 67 | CreateWidget<Layout::Spacing>().lineBreak = false; |
| 68 | |
| 69 | m_playButton = &CreateWidget<ButtonImage>(editorResources->GetTexture("Play")->GetTexture().GetID(), iconSize); |
| 70 | m_pauseButton = &CreateWidget<ButtonImage>(editorResources->GetTexture("Pause")->GetTexture().GetID(), iconSize); |
| 71 | m_stopButton = &CreateWidget<ButtonImage>(editorResources->GetTexture("Stop")->GetTexture().GetID(), iconSize); |
| 72 | m_nextButton = &CreateWidget<ButtonImage>(editorResources->GetTexture("Next")->GetTexture().GetID(), iconSize); |
| 73 | |
| 74 | m_playButton->tooltip = "Play (or resume) the game"; |
| 75 | m_pauseButton->tooltip = "Pause the game"; |
| 76 | m_stopButton->tooltip = "Stop the game"; |
| 77 | m_nextButton->tooltip = "Step to the next frame"; |
| 78 | |
| 79 | CreateWidget<Layout::Spacing>(0).lineBreak = false; |
| 80 | auto& refreshButton = CreateWidget<ButtonImage>(editorResources->GetTexture("Refresh")->GetTexture().GetID(), iconSize); |
| 81 | refreshButton.tooltip = "Reload all scripts"; |
| 82 | |
| 83 | m_playButton->lineBreak = false; |
| 84 | m_pauseButton->lineBreak = false; |
nothing calls this directly
no test coverage detected