AUI Framework  master
Cross-platform module-based framework for developing C++20 desktop applications
AEmbedAuiWrap.h
1/*
2 * AUI Framework - Declarative UI toolkit for modern C++20
3 * Copyright (C) 2020-2024 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//
13// Created by alex2 on 6/6/2021.
14//
15
16
17#pragma once
18
19
20#include <AUI/View/AViewContainer.h>
21#include "AWindowBase.h"
22
28class API_AUI_VIEWS AEmbedAuiWrap: public IEventLoop {
29private:
30 IEventLoop::Handle mEventLoopHandle;
31
32protected:
33 class EmbedWindow;
34 _<EmbedWindow> mContainer;
35 glm::ivec2 mSize;
36 AOptional<float> mCustomDpiRatio;
37 void windowInit(_unique<IRenderingContext> context);
38 void windowMakeCurrent();
39 void windowRender();
40
41 virtual void onNotifyProcessMessages() = 0;
42public:
43 explicit AEmbedAuiWrap();
44
45 void clearFocus();
46
47 void setContainer(const _<AViewContainer>& container);
48 virtual void setViewportSize(int width, int height);
49
50 void setCustomDpiRatio(float r);
51
52 bool requiresRedraw();
53
54 void notifyProcessMessages() override;
55
59 bool isUIConsumesMouseAt(int x, int y);
60
67 void onPointerPressed(int x, int y, APointerIndex pointerIndex);
68
75 void onPointerReleased(int x, int y, APointerIndex pointerIndex);
76
82 void onPointerMove(int x, int y);
83
89 void onCharEntered(wchar_t c);
90
91 void onScroll(int mouseX, int mouseY, int scrollX, int scrollY);
92
93
94 void onKeyPressed(AInput::Key key);
95 void onKeyReleased(AInput::Key key);
96
97 AWindowBase* getWindow();
98
99 void loop() override;
100};
101
102
Definition: AEmbedAuiWrap.cpp:26
Definition: AEmbedAuiWrap.h:28
Utility wrapper implementing the stack-allocated (fast) optional idiom.
Definition: AOptional.h:32
Wrapper class that stores either mouse button index or finger index.
Definition: APointerIndex.h:21
Definition: AWindowBase.h:33
Definition: IEventLoop.h:33
Definition: IEventLoop.h:17
virtual void loop()=0
Do message processing loop.
virtual void notifyProcessMessages()=0
Notifies this IEventLoop that its thread got a new message to process.
An std::weak_ptr with AUI extensions.
Definition: SharedPtrTypes.h:177
Definition: Size.h:22