/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/Tools/Libs/GuiFoundation/ContainerWindow/ContainerWindow.moc.h
104 строки
3 KB
Jan Krassnigg
Rewrote the window layout save/restore code (#1786)
22 янв 2026, 22:43
Не верифицирован
22 янв 2026, 22:43
b2c46b3
Код
Авторство
О чём код?
#pragma once #include <Foundation/Containers/DynamicArray.h> #include <Foundation/Containers/Map.h> #include <Foundation/Strings/String.h> #include <GuiFoundation/DocumentWindow/DocumentWindow.moc.h> #include <GuiFoundation/GuiFoundationDLL.h> #include <GuiFoundation/UIServices/UIServices.moc.h> #include <QMainWindow> #include <QSet> #include <ToolsFoundation/Project/ToolsProject.h> class ezDocumentManager; class ezDocument; class ezQtApplicationPanel; struct ezDocumentTypeDescriptor; class QLabel; namespace ads { class CDockManager; class CFloatingDockContainer; class CDockWidget; } // namespace ads /// \brief Container window that hosts documents and applications panels. class EZ_GUIFOUNDATION_DLL ezQtContainerWindow : public QMainWindow { Q_OBJECT public: /// \brief Constructor. ezQtContainerWindow(); ~ezQtContainerWindow(); static ezQtContainerWindow* GetContainerWindow() { return s_pContainerWindow; } void AddDocumentWindow(ezQtDocumentWindow* pDocWindow); void DocumentWindowRenamed(ezQtDocumentWindow* pDocWindow); void AddApplicationPanel(ezQtApplicationPanel* pPanel); ads::CDockManager* GetDockManager() { return m_pDockManager; } static ezResult EnsureVisibleAnyContainer(ezDocument* pDocument); void GetDocumentWindows(ezHybridArray<ezQtDocumentWindow*, 16>& ref_windows); struct DocumentWindowState { bool m_bFloating = false; }; /// Saves the current state (floating/docked) of all document windows. /// Call before restoring a layout. void SaveDocumentWindowStates(ezMap<ads::CDockWidget*, DocumentWindowState>& out_states); /// Restores document windows to their previous states after a layout change. /// Call after restoring a layout. void RestoreDocumentWindowStates(const ezMap<ads::CDockWidget*, DocumentWindowState>& states); protected: virtual bool eventFilter(QObject* obj, QEvent* e) override; private: friend class ezQtDocumentWindow; friend class ezQtApplicationPanel; ezResult EnsureVisible(ezQtDocumentWindow* pDocWindow); ezResult EnsureVisible(ezDocument* pDocument); ezResult EnsureVisible(ezQtApplicationPanel* pPanel); private Q_SLOTS: void SlotDocumentTabCloseRequested(); void SlotTabsContextMenuRequested(const QPoint& pos); void SlotUpdateWindowDecoration(void* pDocWindow); void SlotFloatingWidgetOpened(ads::CFloatingDockContainer* FloatingWidget); void SlotDockWidgetFloatingChanged(bool bFloating); private: void UpdateWindowTitle(); void RemoveDocumentWindow(ezQtDocumentWindow* pDocWindow); void RemoveApplicationPanel(ezQtApplicationPanel* pPanel); void UpdateWindowDecoration(ezQtDocumentWindow* pDocWindow); void DocumentWindowEventHandler(const ezQtDocumentWindowEvent& e); void ProjectEventHandler(const ezToolsProjectEvent& e); void UIServicesEventHandler(const ezQtUiServices::Event& e); virtual void closeEvent(QCloseEvent* e) override; private: ads::CDockManager* m_pDockManager = nullptr; QLabel* m_pStatusBarLabel; ezDynamicArray<ezQtDocumentWindow*> m_DocumentWindows; ezDynamicArray<ads::CDockWidget*> m_DocumentDocks; ezDynamicArray<ezQtApplicationPanel*> m_ApplicationPanels; QSet<QString> m_DockNames; static ezQtContainerWindow* s_pContainerWindow; static bool s_bForceClose; };