Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
DockedWindow.h
Go to the documentation of this file.
1/*
2Copyright (c) 2018 DIVIDE-Studio
3Copyright (c) 2009 Ionut Cava
4
5This file is part of DIVIDE Framework.
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software
9and associated documentation files (the "Software"), to deal in the Software
10without restriction,
11including without limitation the rights to use, copy, modify, merge, publish,
12distribute, sublicense,
13and/or sell copies of the Software, and to permit persons to whom the
14Software is furnished to do so,
15subject to the following conditions:
16
17The above copyright notice and this permission notice shall be included in
18all copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21IMPLIED,
22INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23PARTICULAR PURPOSE AND NONINFRINGEMENT.
24IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25DAMAGES OR OTHER LIABILITY,
26WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27IN CONNECTION WITH THE SOFTWARE
28OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30*/
31
32#pragma once
33#ifndef DVD_EDITOR_DOCKED_WINDOW_H_
34#define DVD_EDITOR_DOCKED_WINDOW_H_
35
36#ifndef IMGUI_API
37#include <imgui.h>
38#endif //IMGUI_API
39
40namespace Divide {
41
42class Editor;
43class SceneGraphNode;
44class EditorComponent;
46 public:
47 struct Descriptor {
48 ImVec2 size;
49 ImVec2 position;
50 ImVec2 minSize = ImVec2(0, 0);
51 ImVec2 maxSize = ImVec2(FLT_MAX, FLT_MAX);
52 string name = "";
53 ImGuiWindowFlags flags = 0;
54 bool showCornerButton = false;
55 };
56
57 public:
58 explicit DockedWindow(Editor& parent, Descriptor descriptor) noexcept;
59 virtual ~DockedWindow() = default;
60
61 // Called when the editor is visible
62 void draw();
63 // Always called, even if the editor is not visible
64 void backgroundUpdate();
65
66 [[nodiscard]] virtual string name() const { return _descriptor.name; }
67
68
69 [[nodiscard]] const Descriptor& descriptor() const noexcept { return _descriptor; }
70
71 virtual void onRemoveComponent([[maybe_unused]] const EditorComponent& comp) {}
72
73 PROPERTY_RW(ImGuiWindowFlags, windowFlags, 0);
74 PROPERTY_RW(bool, enabled, true);
75 PROPERTY_R_IW(bool, focused, false);
76 PROPERTY_R_IW(bool, hovered, false);
77 PROPERTY_R_IW(bool, visible, false);
78
79 protected:
80 virtual void drawInternal() = 0;
81 virtual void backgroundUpdateInternal() {}
82
83 const char* getIconForNode(const SceneGraphNode* sgn) noexcept;
84
85 protected:
88};
89} //namespace Divide
90
91#endif //DVD_EDITOR_DOCKED_WINDOW_H_
PROPERTY_RW(ImGuiWindowFlags, windowFlags, 0)
virtual void backgroundUpdateInternal()
Definition: DockedWindow.h:81
PROPERTY_R_IW(bool, hovered, false)
virtual void drawInternal()=0
virtual ~DockedWindow()=default
const Descriptor & descriptor() const noexcept
Definition: DockedWindow.h:69
PROPERTY_R_IW(bool, focused, false)
Descriptor _descriptor
Definition: DockedWindow.h:87
PROPERTY_R_IW(bool, visible, false)
const char * getIconForNode(const SceneGraphNode *sgn) noexcept
PROPERTY_RW(bool, enabled, true)
virtual string name() const
Definition: DockedWindow.h:66
virtual void onRemoveComponent(const EditorComponent &comp)
Definition: DockedWindow.h:71
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
Project & parent
Definition: DefaultScene.h:41