15#include "AUI/Common/AString.h"
17#include "AUI/Common/AObject.h"
18#include "AUI/Common/ASignal.h"
20#include "AUI/Platform/AWindowBase.h"
21#include "AUI/Thread/IEventLoop.h"
22#include "AUI/Util/AMetric.h"
23#include "AWindowNativePtr.h"
24#include <AUI/Enum/WindowStyle.h>
25#include <AUI/Enum/AScreenOrientation.h>
30#elif AUI_PLATFORM_ANDROID
32#elif AUI_PLATFORM_APPLE
44class API_AUI_VIEWS AWindow:
public AWindowBase
46 friend class OpenGLRenderingContext;
47 friend class IPlatformAbstraction;
48 friend class CommonRenderingContext;
49 friend class SoftwareRenderingContext;
50 friend class AWindowManager;
51 friend struct painter;
53 AWindow(
const AString& name =
"My window",
int width = 854_dp,
int height = 500_dp, AWindow* parent =
nullptr, WindowStyle ws = WindowStyle::DEFAULT) {
54 windowNativePreInit(name, width, height, parent, ws);
63 void redraw()
override;
76 void setIcon(
const AImage& image);
83 void setWindowStyle(WindowStyle ws);
84 WindowStyle windowStyle()
const {
return mWindowStyle; }
111 void flagRedraw()
override;
125 bool isClosed() const noexcept;
128 HWND getNativeHandle() {
return mHandle; }
129#elif AUI_PLATFORM_ANDROID
130 jobject getNativeHandle() {
return mHandle; }
131#elif AUI_PLATFORM_APPLE
133 AWindowNativePtr getNativeHandle() {
return mHandle; }
136 auto nativeHandle()
const {
140 const AString& getWindowTitle()
const
145 glm::ivec2 getWindowPosition()
const;
147 void setPosition(glm::ivec2 position)
override;
148 void setSize(glm::ivec2 size)
override;
149 void setGeometry(
int x,
int y,
int width,
int height)
override;
151#if AUI_PLATFORM_LINUX
152 void applyGeometryToChildren()
override;
155 void onFocusAcquired()
override;
156 void onFocusLost()
override;
158 void onKeyDown(AInput::Key key)
override;
159 void onKeyRepeat(AInput::Key key)
override;
161 void setFocusNextViewOnTab(
bool value) {
162 mFocusNextViewOnTab = value;
207 virtual void onCloseButtonClicked();
211 void showTouchscreenKeyboardImpl()
override;
212 void hideTouchscreenKeyboardImpl()
override;
259 HICON mIcon =
nullptr;
260 virtual LRESULT winProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
261#elif AUI_PLATFORM_ANDROID
262#elif AUI_PLATFORM_APPLE
264 AWindowNativePtr mHandle = 0;
265 WindowStyle mWindowStyle = WindowStyle::DEFAULT;
267 virtual void doDrawWindow();
268 virtual void onClosed();
270 void windowNativePreInit(
const AString& name,
int width,
int height, AWindow* parent, WindowStyle ws);
283 void createDevtoolsWindow()
override;
285 float fetchDpiFromSystem()
const override;
295#elif AUI_PLATFORM_ANDROID
296#elif AUI_PLATFORM_LINUX
297 bool mWasMaximized =
false;
299#ifdef AUI_PLATFORM_MACOS
300 bool mRedrawFlag =
false;
302 bool mRedrawFlag =
true;
305 AWindow* mParentWindow;
307 unsigned mFrameMillis = 1;
317 friend LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
319#if AUI_PLATFORM_LINUX
320 unsigned long xGetWindowProperty(
unsigned long property,
unsigned long type,
unsigned char** value)
const;
321 void xSendEventToWM(
unsigned long atom,
long a,
long b,
long c,
long d,
long e)
const;
Owning image representation.
Definition AImage.h:25
Definition AOverlappingSurface.h:19
Represents a Unicode character string.
Definition AString.h:38
auto size() const
Size, including content area, border and padding.
Definition AView.h:114
auto position() const
Top left corner's position relative to top left corner's position of the parent AView.
Definition AView.h:102
Definition AWindowManager.h:21
void onPointerMove(glm::vec2 pos, const APointerMoveEvent &event) override
Handles pointer hover events.
glm::ivec2 mapPositionTo(const glm::ivec2 &position, _< AWindow > other)
Translates coordinates from the coordinate space of this window to the coordinate space of another wi...
void moveToCenter()
Moves the window to the center of monitor.
void allowDragNDrop()
Enables drag-n-drop for this window.
void minimize()
Minimizes window (hide window to the taskbar, iconifies)
void forceUpdateCursor() override
Updates cursor by triggering onPointerMove on the same position (mMousePos).
bool consumesClick(const glm::ivec2 &pos) override
Determines whether this AView processes this click or passes it thru.
void restore()
Restores window (shows window from taskbar)
static AWindowBase * current()
bool mFocusNextViewOnTab
defines if the next view must be focused on tab button pressed
Definition AWindow.h:290
void blockUserInput(bool blockUserInput=true) override
Enables or disables user input for this window.
emits< glm::vec2 > moving
Window is moving.
Definition AWindow.h:236
emits restored
Window is restored (shown from the taskbar, deiconified).
Definition AWindow.h:251
glm::ivec2 mapPosition(const glm::ivec2 &position)
Translates coordinates from the monitor's coordinate space to the coordinate space of this window.
AWindow(std::nullptr_t)
Constructor for custom initialization logic.
Definition AWindow.h:281
emits maximized
Window is maximized.
Definition AWindow.h:241
void setMobileScreenOrientation(AScreenOrientation screenOrientation)
Controls mobile device's screen orientation when this window is on the foreground.
static bool isRedrawWillBeEfficient()
Checks whether last monitor frame is displayed and redraw will be efficient. If some object often upd...
_< AOverlappingSurface > createOverlappingSurfaceImpl(const glm::ivec2 &position, const glm::ivec2 &size) override
unsigned frameMillis() const noexcept override
Returns previous frame's rendering duration in millis.
Definition AWindow.h:59
static _< AWindow > wrapViewToWindow(const _< AView > &view, const AString &title, int width=854_dp, int height=500_dp, AWindow *parent=nullptr, WindowStyle ws=WindowStyle::DEFAULT)
Wraps your AView to window.
glm::ivec2 unmapPosition(const glm::ivec2 &position)
Translates coordinates from the coordinate space of this window to the coordinate space of the monito...
void maximize()
Maximizes window (makes window fullscreen)
emits minimized
Window is minimized (hidden to the taskbar, iconified).
Definition AWindow.h:246
void quit()
Removes window from AWindowManager.
An std::weak_ptr with AUI extensions.
Definition SharedPtrTypes.h:179
AScreenOrientation
Controls screen orientation.
Definition AScreenOrientation.h:20
ASignal< Args... > emits
A signal declaration.
Definition ASignal.h:577
Pointing method move event.
Definition APointerMoveEvent.h:21