Elaztek Developer Hub
Blamite Game Engine - Keystone  00433.02.16.25.2127.blamite
A library that enables the use of Qt in Blamite's editing tools.
BlamEditorWindow.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <vector>
5 #include <HEKGuerilla/components/tags/tags.h>
6 #include <Strings/components/settings/config/config.h>
7 #include <qmainwindow.h>
8 
9 #include "api/keystone_api.h"
14 
15 #ifndef KEYSTONE
16 #define KEYSTONE
17 #endif
18 
23 {
24  MDI,
25  Tabs
26 };
27 
34 class BlamEditorWindow : public QMainWindow
35 {
36 private:
37 
42 
43  void OnTabCloseRequested(int index);
44 
45 public:
46 
48 
50  QTabWidget* tab_area = nullptr;
51 
52  std::vector<BlamEditorToolWindow*> open_tool_windows = std::vector<BlamEditorToolWindow*>();
53  std::vector<BlamEditorDocument*> open_documents = std::vector<BlamEditorDocument*>();
54 
55  BlamConfigurationFile* config = nullptr;
56 
63 
67  void SetupWindow();
68 
75 
81  virtual void OnThemeChange(BlamEditorTheme* new_theme);
82 
89  bool OpenDocument(std::string file_path, BlamTagTreeNode* tree_node, BlamEditorDocumentType doctype);
90 
96  void OpenDocument(BlamEditorDocument* document);
97 
103  void CloseDocument(int index);
104 
110  void CloseDocument(BlamEditorDocument* document);
111 
115  void CloseAllDocuments();
116 
120  void SaveAllDocuments();
121 
131  bool OpenToolWindow(BlamEditorToolWindowType tool_type, Qt::DockWidgetArea position);
132 
142 
149 
153  void CloseAllToolWindows();
154 
162 
171 
181 
186 
193  void UpdateDefaultIcon();
194 
202  std::string GetApplicationTitle();
203 
204  virtual void OnScenarioLoadStarted(std::string tag_path) {}
205  virtual void OnScenarioLoadStageChanged(std::string tag_path, int stage) {}
206  virtual void OnScenarioLoadFinished(std::string tag_path, bool success) {}
207 };
BlamEditorToolWindow
Base class for all editor tool windows.
Definition: BlamEditorToolWindow.h:38
BlamEditorDocument_Tag
Class representing a Tag document.
Definition: tag.h:15
BlamEditorDocument_GameWindow
Class representing a Game Window "document".
Definition: game_window.h:18
editor_data.h
BlamEditorDocument::parent_window
BlamEditorWindow * parent_window
The parent window that owns this document.
Definition: BlamEditorDocument.h:48
BlamEditorWindow::GetActiveDocument
BlamEditorDocument * GetActiveDocument()
Get the current active document.
Definition: BlamEditorWindow.cpp:385
BlamEditorDocument_TagDesigner
Class representing a Tag Designer "document".
Definition: tag_designer.h:18
BlamEditorDocumentType::GameWindow
@ GameWindow
Special document type used for the Game Viewport window.
SkinnableMdiArea.h
BlamWorkspaceLayoutType::Tabs
@ Tabs
Sub-windows will be organized using tabs, similar to more modern editing tools.
BlamKeystone::EditorData::LoadToolWindows
KEYSTONE void LoadToolWindows()
Loads all tool windows into the registered tool window list.
Definition: editor_data.cpp:54
BlamEditorToolWindow.h
BlamEditorWindow::workspace_type
BlamWorkspaceLayoutType workspace_type
The layout type the window is currently using.
Definition: BlamEditorWindow.h:47
BlamEditorToolWindow::OnToolOpen
virtual void OnToolOpen()
Called when the tool window is being opened.
Definition: BlamEditorToolWindow.h:90
QSourceHighlite::QSourceHighliterTheme::theme
QHash< QSourceHighliter::Token, QTextCharFormat > theme(QSourceHighliter::Themes)
Definition: qsourcehighliterthemes.cpp:63
BlamEditorWindow::GetEditorWindowType
BlamEditorWindowType GetEditorWindowType()
Retrieves the type of the editor window.
Definition: BlamEditorWindow.cpp:124
BlamEditorDocumentWidget::document
BlamEditorDocument * document
The document associated with this widget.
Definition: BlamEditorDocument.h:172
BlamEditorWindow::GetApplicationTitle
std::string GetApplicationTitle()
Retrieves the application title of this Editor Window.
Definition: BlamEditorWindow.cpp:426
BlamEditorWindow::open_documents
std::vector< BlamEditorDocument * > open_documents
The list of open documents.
Definition: BlamEditorWindow.h:53
BlamEditorDocumentType
BlamEditorDocumentType
Enumerator containing all possible editor document types.
Definition: BlamEditorDocument.h:23
themes.h
BlamEditorWindowType::Unspecified
@ Unspecified
Indicates that the editor window type is unknown. This should never happen.
BlamEditorWindowType::Sapien
@ Sapien
The editor window is the main window for Sapien (see #sapien_main_window).
BlamEditorWindow::SetupWindow
void SetupWindow()
Prepares the main window layout.
Definition: BlamEditorWindow.cpp:23
BlamEditorWindow::BlamEditorWindow
BlamEditorWindow(BlamEditorWindowType window_type)
Constructs a new editor window.
Definition: BlamEditorWindow.cpp:18
BlamEditorTheme
Class representing a Blamite Editor Theme.
Definition: themes.h:45
BlamEditorDocument.h
SkinnableMdiArea
Wrapper class around a QMdiArea, made to simplify skinning.
Definition: SkinnableMdiArea.h:20
explorer_bar.h
BlamWorkspaceLayoutType
BlamWorkspaceLayoutType
Enumerator used to specify the workspace layout method that an application should use.
Definition: BlamEditorWindow.h:22
BlamEditorDocumentType::TagDesigner
@ TagDesigner
Special document type used for the Tag Designer window.
BlamEditorWindow.h
BlamEditorDocumentType::Tag
@ Tag
Indicates the document represents a tag file.
BlamEditorToolWindowType
BlamEditorToolWindowType
Enumerator containing all possible editor tool window types.
Definition: BlamEditorToolWindow.h:21
BlamKeystone::EditorData::GetToolWindow
KEYSTONE BlamEditorToolWindow * GetToolWindow(BlamEditorToolWindowType type)
Retrieves a desired tool window.
Definition: editor_data.cpp:39
keystone_api.h
BlamEditorWindow::CloseToolWindow
void CloseToolWindow(BlamEditorToolWindowType tool_type)
Closes the specified tool window.
Definition: BlamEditorWindow.cpp:317
BlamEditorWindowType
BlamEditorWindowType
Enumerator used to identify the type of the main editor window.
Definition: keystone_api.h:53
BlamEditorWindow::UpdateDefaultIcon
void UpdateDefaultIcon()
Updates the default icon for the window (and all child MDI subwindows).
Definition: BlamEditorWindow.cpp:414
BlamKeystone::EditorData::LoadDocumentConfigurations
KEYSTONE void LoadDocumentConfigurations()
Loads all document type configurations.
Definition: document_config.cpp:83
BlamEditorWindow::config
BlamConfigurationFile * config
The configuration file for this editor window.
Definition: BlamEditorWindow.h:55
BlamWorkspaceLayoutType::MDI
@ MDI
Sub-windows will be organized using MDI (Multiple Document Interface).
BlamEditorDocumentWidget
Class acting as a simple interface to allow for easy retrieval of the active document.
Definition: BlamEditorDocument.h:169
BlamEditorWindow::IsToolWindowOpen
bool IsToolWindowOpen(BlamEditorToolWindowType tool_type)
Checks if a given tool window type is open.
Definition: BlamEditorWindow.cpp:359
BlamEditorWindow::OpenToolWindow
bool OpenToolWindow(BlamEditorToolWindowType tool_type, Qt::DockWidgetArea position)
Opens the specified tool window within the main window.
Definition: BlamEditorWindow.cpp:277
BlamEditorToolWindow::GetDockWidgetArea
Qt::DockWidgetArea GetDockWidgetArea()
Retrieves the current dock widget area of the window.
Definition: BlamEditorToolWindow.cpp:114
tag_designer.h
BlamEditorWindow::open_tool_windows
std::vector< BlamEditorToolWindow * > open_tool_windows
The list of open tool windows.
Definition: BlamEditorWindow.h:52
BlamKeystone::Themes::GetTheme
KEYSTONE BlamEditorTheme * GetTheme(std::string name)
Retrieves a theme.
Definition: themes.cpp:320
BlamEditorWindow::OnThemeChange
virtual void OnThemeChange(BlamEditorTheme *new_theme)
Called when the active theme is changed.
Definition: BlamEditorWindow.cpp:129
BlamEditorWindowType::Foundry
@ Foundry
The editor window is the main window for Foundry (see foundry_main_window).
BlamEditorDocument
Interface class that any types of editor documents inherit from.
Definition: BlamEditorDocument.h:38
BlamEditorWindow::CloseAllDocuments
void CloseAllDocuments()
Closes all open documents.
Definition: BlamEditorWindow.cpp:258
BlamEditorWindow::tab_area
QTabWidget * tab_area
The tab widget used for documents. Only set when using Tab layout.
Definition: BlamEditorWindow.h:50
BlamEditorWindow::OnScenarioLoadStarted
virtual void OnScenarioLoadStarted(std::string tag_path)
Definition: BlamEditorWindow.h:204
BlamEditorWindow::mdi_area
SkinnableMdiArea * mdi_area
The MDI area used for documents. Only set when using MDI layout.
Definition: BlamEditorWindow.h:49
BlamEditorDocument::Show
void Show()
Shows the document within the parent window.
Definition: BlamEditorDocument.cpp:23
BlamEditorDocument::loaded
bool loaded
Whether or not the document was able to be successfully loaded.
Definition: BlamEditorDocument.h:52
BlamEditorWindow
Interface class that all main editing tool windows inherit from.
Definition: BlamEditorWindow.h:34
BlamEditorWindow::OnScenarioLoadFinished
virtual void OnScenarioLoadFinished(std::string tag_path, bool success)
Definition: BlamEditorWindow.h:206
BlamEditorWindow::CloseAllToolWindows
void CloseAllToolWindows()
Closes all tool windows.
Definition: BlamEditorWindow.cpp:336
tag.h
BlamEditorWindow::ToggleToolWindow
void ToggleToolWindow(BlamEditorToolWindowType tool_type)
Toggles the specified tool window.
Definition: BlamEditorWindow.cpp:347
file.h
BlamEditorWindow::SaveAllDocuments
void SaveAllDocuments()
Attempts to save all open documents.
Definition: BlamEditorWindow.cpp:269
BlamEditorDocument::Close
virtual bool Close()
Closes the document and releases any resources being used by it.
Definition: BlamEditorDocument.cpp:178
BlamEditorWindow::OpenDocument
bool OpenDocument(std::string file_path, BlamTagTreeNode *tree_node, BlamEditorDocumentType doctype)
Attempts to open the specified document in the main window.
Definition: BlamEditorWindow.cpp:134
BlamEditorDocument_File
Class representing a File document.
Definition: file.h:14
BlamEditorWindow::OnScenarioLoadStageChanged
virtual void OnScenarioLoadStageChanged(std::string tag_path, int stage)
Definition: BlamEditorWindow.h:205
BlamEditorWindow::CloseDocument
void CloseDocument(int index)
Attempts to close the specified document.
Definition: BlamEditorWindow.cpp:245
BlamKeystone::EditorData::GetDefaultApplicationIcon
KEYSTONE QIcon GetDefaultApplicationIcon()
Retrieves the default application icon.
Definition: editor_data.cpp:91
BlamEditorWindowType::Tool
@ Tool
The editor window is the GUI for Tool (see tool_gui_window).
BlamEditorWindow::GetToolWindow
BlamEditorToolWindow * GetToolWindow(BlamEditorToolWindowType tool_type)
Retrieves a specific tool window.
Definition: BlamEditorWindow.cpp:372
BlamEditorToolWindow::OnToolClose
virtual void OnToolClose()
Called when the tool window is being closed.
Definition: BlamEditorToolWindow.h:95
BlamEditorDocumentType::File
@ File
Indicates the document represents a generic file.
output.h
tag_designer
Class representing the Tag Designer.
Definition: tag_designer.h:24
game_window.h
BlamEditorWindowType::Guerilla
@ Guerilla
The editor window is the main window for Guerilla (see guerilla_window).
BlamKeystone::EditorData::GetDocumentTypeConfiguration
KEYSTONE BlamConfigurationFile * GetDocumentTypeConfiguration(BlamEditorDocumentType type)
Attempts to locate the configuration file for the specified document type.
Definition: document_config.cpp:107