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 CommonRenderingContext;
48 friend class SoftwareRenderingContext;
49 friend class AWindowManager;
50 friend struct painter;
52 AWindow(
const AString& name =
"My window",
int width = 854_dp,
int height = 500_dp, AWindow* parent =
nullptr, WindowStyle ws = WindowStyle::DEFAULT) {
53 windowNativePreInit(name, width, height, parent, ws);
75 void setIcon(
const AImage& image);
82 void setWindowStyle(WindowStyle ws);
109 void flagRedraw()
override;
123 bool isClosed() const noexcept;
126 HWND getNativeHandle() {
return mHandle; }
127#elif AUI_PLATFORM_ANDROID
128 jobject getNativeHandle() {
return mHandle; }
129#elif AUI_PLATFORM_APPLE
131 AWindowNativePtr getNativeHandle() {
return mHandle; }
134 auto nativeHandle()
const {
138 const AString& getWindowTitle()
const
143 glm::ivec2 getWindowPosition()
const;
145 void setPosition(glm::ivec2 position)
override;
146 void setSize(glm::ivec2 size)
override;
147 void setGeometry(
int x,
int y,
int width,
int height)
override;
149#if AUI_PLATFORM_LINUX
150 void applyGeometryToChildren()
override;
153 void onFocusAcquired()
override;
154 void onFocusLost()
override;
156 void onKeyDown(AInput::Key key)
override;
157 void onKeyRepeat(AInput::Key key)
override;
159 void setFocusNextViewOnTab(
bool value) {
160 mFocusNextViewOnTab = value;
205 virtual void onCloseButtonClicked();
209 void showTouchscreenKeyboardImpl()
override;
210 void hideTouchscreenKeyboardImpl()
override;
257 HICON mIcon =
nullptr;
258 virtual LRESULT winProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
259#elif AUI_PLATFORM_ANDROID
260#elif AUI_PLATFORM_APPLE
262 AWindowNativePtr mHandle = 0;
263 WindowStyle mWindowStyle = WindowStyle::DEFAULT;
265 virtual void doDrawWindow();
266 virtual void onClosed();
268 void windowNativePreInit(
const AString& name,
int width,
int height, AWindow* parent, WindowStyle ws);
281 void createDevtoolsWindow()
override;
283 float fetchDpiFromSystem()
const override;
293#elif AUI_PLATFORM_ANDROID
294#elif AUI_PLATFORM_LINUX
301 unsigned long counter;
302 } mXsyncRequestCounter;
303 bool mWasMaximized =
false;
307#ifdef AUI_PLATFORM_MACOS
308 bool mRedrawFlag =
false;
310 bool mRedrawFlag =
true;
315 unsigned mFrameMillis = 1;
325 friend LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
327#if AUI_PLATFORM_LINUX
328 unsigned long xGetWindowProperty(
unsigned long property,
unsigned long type,
unsigned char** value)
const;
329 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
void redraw()
Request window manager to redraw this AView.
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:23
Represents a window in the underlying windowing system.
Definition AWindow.h:45
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:288
void blockUserInput(bool blockUserInput=true) override
Enables or disables user input for this window.
emits< glm::vec2 > moving
Window is moving.
Definition AWindow.h:234
emits restored
Window is restored (shown from the taskbar, deiconified).
Definition AWindow.h:249
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:279
emits maximized
Window is maximized.
Definition AWindow.h:239
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:58
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:244
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:572
Pointing method move event.
Definition APointerMoveEvent.h:21