diff options
author | rtk0c <[email protected]> | 2021-03-29 00:06:34 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2021-03-29 00:06:34 -0700 |
commit | 2d7e772909571676dd4266337d43086bd2927e93 (patch) | |
tree | 80ec2c39336b5b7fd1cd50d5a715343531f6a743 /core/src/UI | |
parent | 53bff541e292c5d6cae73881a37bf8f7e4a5fd0a (diff) |
UI big structure
Diffstat (limited to 'core/src/UI')
-rw-r--r-- | core/src/UI/Export.cpp | 1 | ||||
-rw-r--r-- | core/src/UI/Export.hpp | 1 | ||||
-rw-r--r-- | core/src/UI/Localization.cpp | 3 | ||||
-rw-r--r-- | core/src/UI/Localization.hpp | 24 | ||||
-rw-r--r-- | core/src/UI/UI.hpp | 12 | ||||
-rw-r--r-- | core/src/UI/UI_DatabaseView.cpp | 9 | ||||
-rw-r--r-- | core/src/UI/UI_Export.cpp | 9 | ||||
-rw-r--r-- | core/src/UI/UI_Items.cpp | 9 | ||||
-rw-r--r-- | core/src/UI/UI_MainWindow.cpp | 61 | ||||
-rw-r--r-- | core/src/UI/UI_Settings.cpp | 9 | ||||
-rw-r--r-- | core/src/UI/fwd.hpp | 4 |
11 files changed, 140 insertions, 2 deletions
diff --git a/core/src/UI/Export.cpp b/core/src/UI/Export.cpp deleted file mode 100644 index d6b26dc..0000000 --- a/core/src/UI/Export.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "Export.hpp" diff --git a/core/src/UI/Export.hpp b/core/src/UI/Export.hpp deleted file mode 100644 index 6f70f09..0000000 --- a/core/src/UI/Export.hpp +++ /dev/null @@ -1 +0,0 @@ -#pragma once diff --git a/core/src/UI/Localization.cpp b/core/src/UI/Localization.cpp new file mode 100644 index 0000000..220df6f --- /dev/null +++ b/core/src/UI/Localization.cpp @@ -0,0 +1,3 @@ +#include "Localization.hpp" + +std::unique_ptr<LocaleStrings> LocaleStrings::Instance{}; diff --git a/core/src/UI/Localization.hpp b/core/src/UI/Localization.hpp new file mode 100644 index 0000000..a2ac09b --- /dev/null +++ b/core/src/UI/Localization.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include "Utils/I18n.hpp" + +#include <memory> +#include <string_view> + +using namespace std::literals::string_view_literals; + +class LocaleStrings { +public: + static std::unique_ptr<LocaleStrings> Instance; + +public: + BasicTranslation MenuBarFile{ "MenuBar.File"sv }; + BasicTranslation MenuBarNewWindow{ "MenuBar.File.NewWindow"sv }; + BasicTranslation MenuBarNewProject{ "MenuBar.File.NewProject"sv }; + BasicTranslation MenuBarOpenProject{ "MenuBar.File.OpenProject"sv }; + + BasicTranslation TabSettings{ "MainWindow.Tab.Settings"sv }; + BasicTranslation TabDatabaseView{ "MainWindow.Tab.DatabaseView"sv }; + BasicTranslation TabItems{ "MainWindow.Tab.Items"sv }; + BasicTranslation TabExport{ "MainWindow.Tab.Exports"sv }; +}; diff --git a/core/src/UI/UI.hpp b/core/src/UI/UI.hpp new file mode 100644 index 0000000..08f5771 --- /dev/null +++ b/core/src/UI/UI.hpp @@ -0,0 +1,12 @@ +#pragma once + +namespace UI { + +void MainWindow(); + +void SettingsTab(); +void DatabaseViewTab(); +void ItemsTab(); +void ExportTab(); + +} // namespace UI diff --git a/core/src/UI/UI_DatabaseView.cpp b/core/src/UI/UI_DatabaseView.cpp new file mode 100644 index 0000000..234aeaa --- /dev/null +++ b/core/src/UI/UI_DatabaseView.cpp @@ -0,0 +1,9 @@ +#include "UI.hpp" + +#include "UI/Localization.hpp" + +#include <imgui.h> + +void UI::DatabaseViewTab() { + // TODO +} diff --git a/core/src/UI/UI_Export.cpp b/core/src/UI/UI_Export.cpp new file mode 100644 index 0000000..06b49f5 --- /dev/null +++ b/core/src/UI/UI_Export.cpp @@ -0,0 +1,9 @@ +#include "UI.hpp" + +#include "UI/Localization.hpp" + +#include <imgui.h> + +void UI::ExportTab() { + // TODO +} diff --git a/core/src/UI/UI_Items.cpp b/core/src/UI/UI_Items.cpp new file mode 100644 index 0000000..371e682 --- /dev/null +++ b/core/src/UI/UI_Items.cpp @@ -0,0 +1,9 @@ +#include "UI.hpp" + +#include "UI/Localization.hpp" + +#include <imgui.h> + +void UI::ItemsTab() { + // TODO +} diff --git a/core/src/UI/UI_MainWindow.cpp b/core/src/UI/UI_MainWindow.cpp new file mode 100644 index 0000000..8b1e71d --- /dev/null +++ b/core/src/UI/UI_MainWindow.cpp @@ -0,0 +1,61 @@ +#include "UI.hpp" + +#include "UI/Localization.hpp" + +#include <imgui.h> + +void UI::MainWindow() { + auto ls = LocaleStrings::Instance.get(); + + float menuBarHeight; + ImGui::BeginMainMenuBar(); + { + menuBarHeight = ImGui::GetWindowHeight(); + + if (ImGui::BeginMenu(ls->MenuBarFile.Get())) { + if (ImGui::MenuItem(ls->MenuBarNewWindow.Get())) { + // TODO + } + if (ImGui::MenuItem(ls->MenuBarNewProject.Get())) { + // TODO + } + + ImGui::Separator(); + if (ImGui::MenuItem(ls->MenuBarOpenProject.Get())) { + // TODO + } + + ImGui::EndMenu(); + } + } + ImGui::EndMainMenuBar(); + + auto windowSize = ImGui::GetMainViewport()->Size; + ImGui::SetNextWindowSize({ windowSize.x, windowSize.y - menuBarHeight }); + ImGui::SetNextWindowPos({ 0, menuBarHeight }); + ImGui::Begin("##MainWindow", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize); + if (ImGui::BeginTabBar("##MainWindowTabs")) { + if (ImGui::BeginTabItem(ls->TabSettings.Get())) { + UI::SettingsTab(); + ImGui::EndTabItem(); + } + + if (ImGui::BeginTabItem(ls->TabDatabaseView.Get())) { + UI::DatabaseViewTab(); + ImGui::EndTabItem(); + } + + if (ImGui::BeginTabItem(ls->TabItems.Get())) { + UI::ItemsTab(); + ImGui::EndTabItem(); + } + + if (ImGui::BeginTabItem(ls->TabExport.Get())) { + UI::ExportTab(); + ImGui::EndTabItem(); + } + + ImGui::EndTabBar(); + } + ImGui::End(); +} diff --git a/core/src/UI/UI_Settings.cpp b/core/src/UI/UI_Settings.cpp new file mode 100644 index 0000000..3dbb0d2 --- /dev/null +++ b/core/src/UI/UI_Settings.cpp @@ -0,0 +1,9 @@ +#include "UI/UI.hpp" + +#include "UI/Localization.hpp" + +#include <imgui.h> + +void UI::SettingsTab() { + // TODO +} diff --git a/core/src/UI/fwd.hpp b/core/src/UI/fwd.hpp new file mode 100644 index 0000000..714a443 --- /dev/null +++ b/core/src/UI/fwd.hpp @@ -0,0 +1,4 @@ +#pragma once + +// Localization.hpp +class LocaleStrings; |