// This file is part of Desktop App Toolkit, // a set of libraries for developing nice desktop applications. // // For license and copyright information please follow this link: // https://github.com/desktop-app/legal/blob/master/LEGAL // #pragma once #include "ui/platform/ui_platform_window.h" #include "ui/platform/win/ui_window_shadow_win.h" #include namespace Ui { namespace Platform { class TitleWidget; class WindowHelper final : public BasicWindowHelper { public: explicit WindowHelper(not_null window); ~WindowHelper(); not_null body() override; void setTitle(const QString &title) override; void setTitleStyle(const style::WindowTitle &st) override; void setNativeFrame(bool enabled) override; void setMinimumSize(QSize size) override; void setFixedSize(QSize size) override; void setGeometry(QRect rect) override; void showFullScreen() override; void showNormal() override; private: class NativeFilter; friend class NativeFilter; void init(); void updateMargins(); void updateSystemMenu(); void updateSystemMenu(Qt::WindowState state); void fixMaximizedWindow(); [[nodiscard]] bool handleNativeEvent( UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *result); [[nodiscard]] bool fixedSize() const; [[nodiscard]] int titleHeight() const; static not_null GetNativeFilter(); const HWND _handle = nullptr; const not_null _title; const not_null _body; std::optional _shadow; bool _updatingMargins = false; QMargins _marginsDelta; HMENU _menu = nullptr; bool _isFullScreen = false; bool _nativeFrame = false; }; [[nodiscard]] HWND GetWindowHandle(not_null widget); [[nodiscard]] HWND GetWindowHandle(not_null window); void SendWMPaintForce(not_null widget); void SendWMPaintForce(not_null window); } // namespace Platform } // namespace Ui