# OpenShaderDesigner: Include/Editor/EditorWindow.h Source File

Loading...
Searching...
No Matches
EditorWindow.h
// =====================================================================================================================
// Copyright 2024 Medusa Slockbower
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// =====================================================================================================================
#ifndef EDITORWINDOW_H
#define EDITORWINDOW_H
#include <string>
#include <imgui-docking/imgui.h>
namespace OpenShaderDesigner
{
class EditorWindow
{
public:
void Open();
void Draw();
void Close();
[[nodiscard]] bool IsOpen() const { return bOpen; }
const std::string Title;
void SetFlags(ImGuiWindowFlags flags) { Flags |= flags; }
void ClearFlags(ImGuiWindowFlags flags) { Flags &= ~flags; }
void ToggleFlags(ImGuiWindowFlags flags) { Flags ^= flags; }
[[nodiscard]] bool CheckFlag(ImGuiWindowFlags flag) const { return Flags & flag; }
[[nodiscard]] bool HasMenuBar() const { return CheckFlag(ImGuiWindowFlags_MenuBar); }
protected:
~EditorWindow() = default;
EditorWindow(const std::string& title
, ImGuiWindowFlags flags);
virtual void OnOpen()
{
};
virtual void DrawWindow()
{
};
virtual void DrawMenu()
{
};
virtual void OnClose()
{
};
private:
EditorWindow(const EditorWindow&) = delete;
EditorWindow(EditorWindow&&) = delete;
int Flags;
bool bOpen;
friend class EditorSystem;
};
}
#endif //EDITORWINDOW_H
OpenShaderDesigner::EditorSystem
Definition EditorSystem.h:30
OpenShaderDesigner::EditorWindow
EditorWindow class for wrapping ImGui window functionality.
Definition EditorWindow.h:28
OpenShaderDesigner::EditorWindow::DrawWindow
virtual void DrawWindow()
DrawWindow function for when the EditorWindow is being drawn.
Definition EditorWindow.h:75
OpenShaderDesigner::EditorWindow::Title
const std::string Title
Title for the EditorWindow.
Definition EditorWindow.h:51
OpenShaderDesigner::EditorWindow::OnOpen
virtual void OnOpen()
OnOpen callback for when the EditorWindow is opened.
Definition EditorWindow.h:68
OpenShaderDesigner::EditorWindow::Draw
void Draw()
Draw the EditorWindow.
Definition EditorWindow.cpp:27
OpenShaderDesigner::EditorWindow::Close
void Close()
Close the EditorWindow.
Definition EditorWindow.cpp:52
OpenShaderDesigner::EditorWindow::DrawMenu
virtual void DrawMenu()
DrawMenu function for when the EditorWindow Menu is being drawn.
Definition EditorWindow.h:82
OpenShaderDesigner::EditorWindow::OnClose
virtual void OnClose()
OnClose callback for when the EditorWindow is closed.
Definition EditorWindow.h:89
OpenShaderDesigner::EditorWindow::Open
void Open()
Open the EditorWindow.
Definition EditorWindow.cpp:20
OpenShaderDesigner::EditorWindow::IsOpen
bool IsOpen() const
Check if the EditorWindow is open.
Definition EditorWindow.h:49