AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
ACustomWindow.h
    1/*
    2 * AUI Framework - Declarative UI toolkit for modern C++20
    3 * Copyright (C) 2020-2025 Alex2772 and Contributors
    4 *
    5 * SPDX-License-Identifier: MPL-2.0
    6 *
    7 * This Source Code Form is subject to the terms of the Mozilla Public
    8 * License, v. 2.0. If a copy of the MPL was not distributed with this
    9 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
   10 */
   11
   12#pragma once
   13#include <AUI/Platform/AWindow.h>
   14
   21class API_AUI_VIEWS ACustomWindow: public AWindow
   22{
   23    friend class AWindowManager;
   24public:
   25    ACustomWindow(const AString& name, int width, int height);
   26    ACustomWindow() = default;
   27    ~ACustomWindow() override = default;
   28
   29    void setTitleHeight(uint32_t height) {
   30        mTitleHeight = height;
   31    }
   32
   33    void onPointerPressed(const APointerPressedEvent& event) override;
   34    void onPointerReleased(const APointerReleasedEvent& event) override;
   35
   36    virtual bool isCaptionAt(const glm::ivec2& pos);
   37
   38    void setSize(glm::ivec2 size) override;
   39
   40signals:
   41    emits<glm::ivec2> dragBegin;
   42    emits<> dragEnd;
   43
   44private:
   45    bool mDragging = false;
   46    glm::ivec2 mDragPos{};
   47    uint32_t mTitleHeight = 30;
   48
   49    void handleXConfigureNotify();
   50
   51#if AUI_PLATFORM_WIN
   52protected:
   53    LRESULT winProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) noexcept override;
   54    void doDrawWindow() override;
   55
   56#endif
   57};
void onPointerReleased(const APointerReleasedEvent &event) override
Called on pointer (mouse) released event.
void onPointerPressed(const APointerPressedEvent &event) override
Called on pointer (mouse) released event.
Represents a Unicode character string.
Definition AString.h:38
auto size() const
Size, including content area, border and padding.
Definition AView.h:114
ASignal< Args... > emits
A signal declaration.
Definition ASignal.h:572
Pointing method press event.
Definition APointerPressedEvent.h:21
Pointing method press event.
Definition APointerReleasedEvent.h:19