Elaztek Developer Hub
Blamite Game Engine - Keystone  00411.04.21.24.0017.blamite
A library that enables the use of Qt in Blamite's editing tools.
BlamEditorDocument.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <qwidget.h>
4 #include <qmdisubwindow.h>
5 #include <string>
6 #include <Strings/components/settings/config/config.h>
7 
9 
10 #ifndef KEYSTONE
11 #define KEYSTONE
12 #endif
13 
14 class BlamEditorWindow;
16 
24 {
25  Tag,
26  File,
27  GameWindow,
28  TagDesigner,
30 };
31 
39 {
40 private:
45 
46 public:
47 
49 
50  std::string document_title = "document";
52  bool loaded = true;
53  bool modified = false;
54 
55  bool override_icon = false;
56  std::string custom_icon_group = "";
57  std::string custom_icon_id = "";
58 
59  std::string file_path = "";
60  std::string document_context = "";
61 
62  int mdi_default_width = 700;
63  int mdi_default_height = 700;
64 
72 
79 
85  virtual void OnThemeChange(BlamEditorTheme* new_theme) {};
86 
90  void Show();
91 
95  void UpdateDefaultIcon();
96 
107  virtual bool ConfirmClose(std::string confirmation_message = "");
108 
115  virtual void FlagAsModified(bool new_modified_state = true);
116 
122  virtual bool Close();
123 
131  virtual bool Close(bool force_close);
132 
136  virtual void Save() {};
137 
141  virtual void SaveAs() {};
142 
146  virtual void OnFocused() {};
147 
151  virtual void OnUnfocused() {};
152 };
153 
154 class BlamEditorDocumentSubWindow : public QMdiSubWindow
155 {
156 public:
158 
159  BlamEditorDocumentSubWindow(QWidget* parent = nullptr) : QMdiSubWindow(parent) {}
160 
161  void closeEvent(QCloseEvent* closeEvent);
162 };
163 
169 class BlamEditorDocumentWidget : public QWidget
170 {
171 public:
173 
174  BlamEditorDocumentWidget(QWidget* parent = nullptr) : QWidget(parent) {}
175 };
176 
178 {
183 
188 
196  KEYSTONE BlamConfigurationFile* GetDocumentTypeConfiguration(BlamEditorDocumentType type);
197 
203  KEYSTONE std::map<BlamEditorDocumentType, BlamConfigurationFile*> GetDocumentTypeConfigurations();
204 }
BlamEditorDocument::custom_icon_id
std::string custom_icon_id
The resource ID of the custom icon. Only used when override_icon is true.
Definition: BlamEditorDocument.h:57
BlamEditorDocument::mdi_default_height
int mdi_default_height
The default starting height of the document's MDI window.
Definition: BlamEditorDocument.h:63
BlamEditorDocument::mdi_default_width
int mdi_default_width
The default starting width of the document's MDI window.
Definition: BlamEditorDocument.h:62
BlamEditorDocument::GetDocumentType
BlamEditorDocumentType GetDocumentType()
Retrieves the type of this document.
Definition: BlamEditorDocument.cpp:18
editor_data.h
BlamEditorDocument::parent_window
BlamEditorWindow * parent_window
The parent window that owns this document.
Definition: BlamEditorDocument.h:48
BlamEditorDocument::file_path
std::string file_path
The path to the file associated with this document.
Definition: BlamEditorDocument.h:59
BlamEditorDocumentType::GameWindow
@ GameWindow
Special document type used for the Game Viewport window.
BlamEditorWindowType::Tool
@ Tool
The editor window is the GUI for Tool (see tool_gui_window).
BlamWorkspaceLayoutType::Tabs
@ Tabs
Sub-windows will be organized using tabs, similar to more modern editing tools.
KeystoneDialogResult
KeystoneDialogResult
Enumerator containing all possible generic dialog results.
Definition: keystone_api.h:30
BlamEditorWindow::workspace_type
BlamWorkspaceLayoutType workspace_type
The layout type the window is currently using.
Definition: BlamEditorWindow.h:61
BlamEditorWindow::GetEditorWindowType
BlamEditorWindowType GetEditorWindowType()
Retrieves the type of the editor window.
Definition: BlamEditorWindow.cpp:121
BlamEditorWindowType::Sapien
@ Sapien
The editor window is the main window for Sapien (see #sapien_main_window).
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:445
BlamEditorWindow::open_documents
std::vector< BlamEditorDocument * > open_documents
The list of open documents.
Definition: BlamEditorWindow.h:67
BlamEditorDocumentType
BlamEditorDocumentType
Enumerator containing all possible editor document types.
Definition: BlamEditorDocument.h:23
BlamEditorDocument::document_title
std::string document_title
The title of this document.
Definition: BlamEditorDocument.h:50
themes.h
BlamKeystone::EditorData::UnloadDocumentConfigurations
KEYSTONE void UnloadDocumentConfigurations()
Unloads all document type configurations.
Definition: document_config.cpp:91
BlamEditorTheme
Class representing a Blamite Editor Theme.
Definition: themes.h:45
BlamEditorDocument.h
BlamEditorDocument::FlagAsModified
virtual void FlagAsModified(bool new_modified_state=true)
Flags the document as being modified.
Definition: BlamEditorDocument.cpp:79
BlamEditorDocument::BlamEditorDocument
BlamEditorDocument(BlamEditorWindow *_window, BlamEditorDocumentType doctype)
Constructs a new BlamEditorDocument.
Definition: BlamEditorDocument.cpp:12
BlamKeystone::Utils::ShowMessageBox
KEYSTONE KeystoneDialogResult ShowMessageBox(std::string message)
Definition: utils.cpp:294
BlamEditorDocument::UpdateDefaultIcon
void UpdateDefaultIcon()
Updates the document's icon.
Definition: BlamEditorDocument.cpp:215
BlamEditorWindowType::Guerilla
@ Guerilla
The editor window is the main window for Guerilla (see guerilla_window).
BlamEditorDocumentWidget::BlamEditorDocumentWidget
BlamEditorDocumentWidget(QWidget *parent=nullptr)
Definition: BlamEditorDocument.h:174
BlamEditorDocument::modified
bool modified
Whether or not the document has been modified.
Definition: BlamEditorDocument.h:53
BlamWorkspaceLayoutType
BlamWorkspaceLayoutType
Enumerator used to specify the workspace layout method that an application should use.
Definition: BlamEditorWindow.h:21
utils.h
BlamEditorDocumentType::TagDesigner
@ TagDesigner
Special document type used for the Tag Designer window.
BlamEditorWindow.h
BlamEditorDocumentType::Tag
@ Tag
Indicates the document represents a tag file.
KeystoneMessageBoxButtons::YesNoCancel
@ YesNoCancel
Dialog is shown with a [Yes], [No], and [Cancel] button.
BlamEditorDocumentSubWindow::document
BlamEditorDocument * document
The document associated with this widget.
Definition: BlamEditorDocument.h:157
BlamKeystone::Themes::GetActiveTheme
KEYSTONE BlamEditorTheme * GetActiveTheme()
Retrieves the currently selected theme.
Definition: themes.cpp:335
BlamKeystone::EditorData::LoadDocumentConfigurations
KEYSTONE void LoadDocumentConfigurations()
Loads all document type configurations.
Definition: document_config.cpp:83
BlamEditorDocument::SaveAs
virtual void SaveAs()
Attempts to save the document, prompting the user to save as a new file.
Definition: BlamEditorDocument.h:141
KeystoneDialogResult::Yes
@ Yes
The user pressed the 'Yes' button.
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
BlamEditorDocument::OnUnfocused
virtual void OnUnfocused()
Called when the document is unfocused.
Definition: BlamEditorDocument.h:151
BlamKeystone::EditorData::GetMainEditorWindow
KEYSTONE BlamEditorWindow * GetMainEditorWindow()
Retrieves the main editor window.
Definition: editor_data.cpp:32
BlamEditorDocumentSubWindow::BlamEditorDocumentSubWindow
BlamEditorDocumentSubWindow(QWidget *parent=nullptr)
Definition: BlamEditorDocument.h:159
BlamEditorDocument::document_context
std::string document_context
The context of this document. Will generally be a project or tag folder.
Definition: BlamEditorDocument.h:60
BlamEditorDocument::Save
virtual void Save()
Attempts to save the document, replacing the original file.
Definition: BlamEditorDocument.h:136
KeystoneMessageBoxType::Question
@ Question
Dialog icon will be a speech bubble with a question mark.
BlamEditorDocument
Interface class that any types of editor documents inherit from.
Definition: BlamEditorDocument.h:38
BlamEditorDocument::custom_icon_group
std::string custom_icon_group
The resource group containing the custom icon name. Only used when override_icon is true.
Definition: BlamEditorDocument.h:56
BlamEditorWindow::tab_area
QTabWidget * tab_area
The tab widget used for documents. Only set when using Tab layout.
Definition: BlamEditorWindow.h:64
BlamEditorWindow::mdi_area
SkinnableMdiArea * mdi_area
The MDI area used for documents. Only set when using MDI layout.
Definition: BlamEditorWindow.h:63
BlamKeystone::EditorData::GetDocumentTypeConfigurations
KEYSTONE std::map< BlamEditorDocumentType, BlamConfigurationFile * > GetDocumentTypeConfigurations()
Retrieves the list of loaded document type configuration files.
Definition: document_config.cpp:117
BlamEditorDocument::OnThemeChange
virtual void OnThemeChange(BlamEditorTheme *new_theme)
Called when the active theme is changed.
Definition: BlamEditorDocument.h:85
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:48
BlamEditorDocumentType::Unspecified
@ Unspecified
Indicates the document type is unspecified or invalid.
BlamEditorDocumentSubWindow::closeEvent
void closeEvent(QCloseEvent *closeEvent)
Definition: BlamEditorDocumentSubWindow.cpp:5
KEYSTONE
#define KEYSTONE
Definition: BlamEditorDocument.h:11
KeystoneDialogResult::No
@ No
The user pressed the 'No' button.
BlamEditorDocumentSubWindow
Definition: BlamEditorDocument.h:154
BlamEditorDocument::Close
virtual bool Close()
Closes the document and releases any resources being used by it.
Definition: BlamEditorDocument.cpp:178
BlamKeystone::EditorData
Namespace contianing functions for accessing common editor data.
Definition: BlamEditorDocument.h:177
BlamEditorWindowType::Foundry
@ Foundry
The editor window is the main window for Foundry (see foundry_main_window).
BlamEditorDocument::ConfirmClose
virtual bool ConfirmClose(std::string confirmation_message="")
Called immediately before closing a document.
Definition: BlamEditorDocument.cpp:289
BlamEditorDocumentType::File
@ File
Indicates the document represents a generic file.
BlamEditorDocument::override_icon
bool override_icon
Whether or not this document uses a custom icon other than the application default.
Definition: BlamEditorDocument.h:55
BlamEditorDocument::OnFocused
virtual void OnFocused()
Called when the document is focused.
Definition: BlamEditorDocument.h:146
BlamEditorDocument::ui
BlamEditorDocumentWidget * ui
The GUI widget associated with this document.
Definition: BlamEditorDocument.h:51
BlamKeystone::EditorData::GetDocumentTypeConfiguration
KEYSTONE BlamConfigurationFile * GetDocumentTypeConfiguration(BlamEditorDocumentType type)
Attempts to locate the configuration file for the specified document type.
Definition: document_config.cpp:107