AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
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
87 void onCharEntered(wchar_t c);
88
92 void onScroll(int mouseX, int mouseY, int scrollX, int scrollY);
93
94
95 void onKeyPressed(AInput::Key key);
96 void onKeyReleased(AInput::Key key);
97
98 AWindowBase* getWindow();
99
100 void loop() override;
101};
102
103
Definition AEmbedAuiWrap.cpp:26
void onCharEntered(wchar_t c)
Handle char entered in UI.
Definition AEmbedAuiWrap.cpp:178
void onPointerMove(int x, int y)
Handle mouse move in UI.
Definition AEmbedAuiWrap.cpp:172
void onPointerReleased(int x, int y, APointerIndex pointerIndex)
Handle mouse released in UI.
Definition AEmbedAuiWrap.cpp:160
void onScroll(int mouseX, int mouseY, int scrollX, int scrollY)
Handle onScroll in UI.
Definition AEmbedAuiWrap.cpp:102
bool isUIConsumesMouseAt(int x, int y)
Definition AEmbedAuiWrap.cpp:168
void onPointerPressed(int x, int y, APointerIndex pointerIndex)
Handle mouse pressed in UI.
Definition AEmbedAuiWrap.cpp:151
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
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:178