Plasma Engine  2.0
Loading...
Searching...
No Matches
DocumentWindow.moc.h
1#pragma once
2
3#include <Foundation/Communication/Event.h>
4#include <Foundation/Strings/String.h>
5#include <Foundation/Types/Status.h>
6#include <GuiFoundation/GuiFoundationDLL.h>
7#include <GuiFoundation/UIServices/UIServices.moc.h>
8#include <ToolsFoundation/Document/DocumentManager.h>
9
10#include <QMainWindow>
11
13class plDocument;
15class QLabel;
16class QToolButton;
17
31
33class PL_GUIFOUNDATION_DLL plQtDocumentWindow : public QMainWindow
34{
35 Q_OBJECT
36
37public:
39
40public:
42 plQtDocumentWindow(const char* szUniqueName);
43 virtual ~plQtDocumentWindow();
44
45 void EnsureVisible();
46
47 virtual plString GetWindowIcon() const;
48 virtual plString GetDisplayName() const { return GetUniqueName(); }
49 virtual plString GetDisplayNameShort() const;
50
51 const char* GetUniqueName() const { return m_sUniqueName; }
52
54 virtual const char* GetWindowLayoutGroupName() const = 0;
55
56 plDocument* GetDocument() const { return m_pDocument; }
57
58 plStatus SaveDocument();
59
60 bool CanCloseWindow();
61 void CloseDocumentWindow();
62
63 void ScheduleRestoreWindowLayout();
64
65 bool IsVisibleInContainer() const { return m_bIsVisibleInContainer; }
66 void SetTargetFramerate(plInt16 iTargetFPS);
67
68 void TriggerRedraw();
69
70 virtual void RequestWindowTabContextMenu(const QPoint& globalPos);
71
72 static const plDynamicArray<plQtDocumentWindow*>& GetAllDocumentWindows() { return s_AllDocumentWindows; }
73
74 static plQtDocumentWindow* FindWindowByDocument(const plDocument* pDocument);
75 plQtContainerWindow* GetContainerWindow() const;
76
78 void ShowTemporaryStatusBarMsg(const plFormatString& text, plTime duration = plTime::MakeFromSeconds(5));
79
81 void SetPermanentStatusBarMsg(const plFormatString& text);
82
84 virtual void CreateImageCapture(const char* szOutputPath);
85
88
89protected:
90 virtual void showEvent(QShowEvent* event) override;
91 virtual void hideEvent(QHideEvent* event) override;
92 virtual bool event(QEvent* event) override;
93 virtual bool eventFilter(QObject* obj, QEvent* e) override;
94
95 void FinishWindowCreation();
96
97private Q_SLOTS:
98 void SlotRestoreLayout();
99 void SlotRedraw();
100 void SlotQueuedDelete();
101 void OnPermanentGlobalStatusClicked(bool);
102 void OnStatusBarMessageChanged(const QString& sNewText);
103
104private:
105 void SaveWindowLayout();
106 void RestoreWindowLayout();
107 void DisableWindowLayoutSaving();
108
109 void ShutdownDocumentWindow();
110
111private:
112 friend class plQtContainerWindow;
113
114 void SetVisibleInContainer(bool bVisible);
115
116 bool m_bIsVisibleInContainer = false;
117 bool m_bRedrawIsTriggered = false;
118 bool m_bIsDrawingATM = false;
119 bool m_bTriggerRedrawQueued = false;
120 bool m_bAllowSaveWindowLayout = true;
121 plInt16 m_iTargetFramerate = 0;
122 plDocument* m_pDocument = nullptr;
123 plQtContainerWindow* m_pContainerWindow = nullptr;
124 QLabel* m_pPermanentDocumentStatusText = nullptr;
125 QToolButton* m_pPermanentGlobalStatusButton = nullptr;
126
127private:
128 void Constructor();
129 void DocumentManagerEventHandler(const plDocumentManager::Event& e);
130 void DocumentEventHandler(const plDocumentEvent& e);
131 void UIServicesEventHandler(const plQtUiServices::Event& e);
132 void UIServicesTickEventHandler(const plQtUiServices::TickEvent& e);
133
134 virtual void InternalDeleteThis() { delete this; }
135 virtual bool InternalCanCloseWindow();
136 virtual void InternalCloseDocumentWindow();
137 virtual void InternalVisibleInContainerChanged(bool bVisible) {}
138 virtual void InternalRedraw() {}
139
140 plString m_sUniqueName;
141
142 static plDynamicArray<plQtDocumentWindow*> s_AllDocumentWindows;
143};
144
Definition Document.h:57
Definition DynamicArray.h:81
Definition Event.h:177
Implements formating of strings with placeholders and formatting options.
Definition FormatString.h:59
Container window that hosts documents and applications panels.
Definition ContainerWindow.moc.h:28
Base class for all document windows. Handles the most basic document window management.
Definition DocumentWindow.moc.h:34
virtual const char * GetWindowLayoutGroupName() const =0
The 'GroupName' is used for serializing window layouts. It should be unique among different window ty...
static bool s_bAllowRestoreWindowLayout
In 'safe' mode we want to prevent the documents from using the stored window layout state.
Definition DocumentWindow.moc.h:87
Definition Declarations.h:54
Definition DocumentManager.h:65
Definition DocumentWindow.moc.h:19
Type
Definition DocumentWindow.moc.h:21
@ WindowClosed
Sent AFTER the window has been deleted. The pointer is given, but not valid anymore!
Definition DocumentWindow.moc.h:23
@ BeforeRedraw
Sent shortly before the content of the window is being redrawn.
Definition DocumentWindow.moc.h:25
@ WindowClosing
Sent shortly before the window is being deleted.
Definition DocumentWindow.moc.h:22
@ WindowDecorationChanged
Window title or icon has changed.
Definition DocumentWindow.moc.h:24
Definition UIServices.moc.h:23
Definition UIServices.moc.h:49
An plResult with an additional message for the reason of failure.
Definition Status.h:12
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12
PL_ALWAYS_INLINE static constexpr plTime MakeFromSeconds(double fSeconds)
Creates an instance of plTime that was initialized from seconds.
Definition Time.h:30