summaryrefslogtreecommitdiff
path: root/core/src/UI
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/UI')
-rw-r--r--core/src/UI/UI.hpp2
-rw-r--r--core/src/UI/UI_Templates.cpp31
-rw-r--r--core/src/UI/UI_Utils.cpp14
3 files changed, 47 insertions, 0 deletions
diff --git a/core/src/UI/UI.hpp b/core/src/UI/UI.hpp
index dfce713..0a80b4c 100644
--- a/core/src/UI/UI.hpp
+++ b/core/src/UI/UI.hpp
@@ -31,6 +31,8 @@ enum class IconType
void DrawIcon(ImDrawList* drawList, const ImVec2& a, const ImVec2& b, IconType type, bool filled, ImU32 color, ImU32 innerColor);
void Icon(const ImVec2& size, IconType type, bool filled, const ImVec4& color = ImVec4(1, 1, 1, 1), const ImVec4& innerColor = ImVec4(0, 0, 0, 0));
+bool Splitter(bool splitVertically, float thickness, float* size1, float* size2, float minSize1, float minSize2, float splitterLongAxisSize = -1.0f);
+
} // namespace ImGui
namespace UI {
diff --git a/core/src/UI/UI_Templates.cpp b/core/src/UI/UI_Templates.cpp
index 082b72a..cf53461 100644
--- a/core/src/UI/UI_Templates.cpp
+++ b/core/src/UI/UI_Templates.cpp
@@ -29,6 +29,8 @@ class TableTemplateUI : public TemplateUI
private:
std::unique_ptr<TableTemplate> mTable;
+ TableCell* mSelectedCell = nullptr;
+
public:
TableTemplateUI(std::unique_ptr<TableTemplate> table)
: mTable{ std::move(table) }
@@ -51,6 +53,31 @@ public:
private:
void DrawInspector()
{
+ if (ImGui::BeginTabBar("Inspector")) {
+ if (ImGui::BeginTabItem("Table")) {
+ DrawTableInspector();
+ ImGui::EndTabItem();
+ }
+ if (ImGui::BeginTabItem("Cell")) {
+ DrawCellInspector();
+ ImGui::EndTabItem();
+ }
+ ImGui::EndTabBar();
+ }
+ }
+
+ void DrawTableInspector()
+ {
+ // TODO
+ }
+
+ void DrawCellInspector()
+ {
+ if (mSelectedCell) {
+
+ } else {
+ ImGui::Text("Select a cell to edit");
+ }
}
void DrawTable()
@@ -300,4 +327,8 @@ void UI::TemplatesTab()
ImGui::EndPopup();
}
+
+ if (openTemplate) {
+ openTemplate->Draw();
+ }
}
diff --git a/core/src/UI/UI_Utils.cpp b/core/src/UI/UI_Utils.cpp
index d662d2c..e3ac097 100644
--- a/core/src/UI/UI_Utils.cpp
+++ b/core/src/UI/UI_Utils.cpp
@@ -296,3 +296,17 @@ void ImGui::Icon(const ImVec2& size, IconType type, bool filled, const ImVec4& c
ImGui::Dummy(size);
}
+
+bool ImGui::Splitter(bool splitVertically, float thickness, float* size1, float* size2, float minSize1, float minSize2, float splitterLongAxisSize)
+{
+ // Taken from https://github.com/thedmd/imgui-node-editor/blob/master/examples/blueprints-example/blueprints-example.cpp
+ // ::Splitter
+
+ ImGuiContext& g = *GImGui;
+ ImGuiWindow* window = g.CurrentWindow;
+ ImGuiID id = window->GetID("##Splitter");
+ ImRect bb;
+ bb.Min = window->DC.CursorPos + (splitVertically ? ImVec2(*size1, 0.0f) : ImVec2(0.0f, *size1));
+ bb.Max = bb.Min + CalcItemSize(splitVertically ? ImVec2(thickness, splitterLongAxisSize) : ImVec2(splitterLongAxisSize, thickness), 0.0f, 0.0f);
+ return SplitterBehavior(bb, id, splitVertically ? ImGuiAxis_X : ImGuiAxis_Y, size1, size2, minSize1, minSize2, 0.0f);
+}