4#ifndef QOHOSWINDOWPROXY_H
5#define QOHOSWINDOWPROXY_H
7#include <QtCore/private/qnapi_p.h>
8#include <QtCore/private/qohoscommon_p.h>
9#include <QtCore/qflags.h>
10#include <QtCore/qglobal.h>
11#include <QtCore/qobject.h>
12#include <QtCore/qpoint.h>
13#include <QtCore/qpointer.h>
14#include <QtCore/qrect.h>
15#include <QtCore/qsize.h>
16#include <QtGui/qcolor.h>
17#include <QtGui/qeventpoint.h>
18#include <QtGui/qwindow.h>
22#include <qarkui/input.h>
23#include <qarkui/window.h>
24#include <qohosdisplayinfo.h>
25#include <qohosenums.h>
26#include <qohosplugincore.h>
27#include <qohosutils.h>
28#include <render/qohoswindowproxydatafactory.h>
29#include <render/qxcomponent.h>
34class QOhosWindowProxy
final
136 static std::shared_ptr<QOhosWindowProxy>
142 QOhosWindowProxy &
operator=(
const QOhosWindowProxy &) =
delete;
143 QOhosWindowProxy &
operator=(QOhosWindowProxy &&) =
delete;
148 const QPoint &position, QOhosOptional<QOhosDisplayInfo::JsDisplayId> optDisplayId);
150 void setSize(
const QSize &size);
153 void setCustomCursor(
const QImage &customCursorImage,
const QPoint &hotSpot);
160 const WindowMask &windowMask,
const QOhosOptional<QSize> &ohosMaskSizeOverride = {});
163 void setTitle(
const QString &title);
201 QObject *contextObject, QOhosConsumer<std::vector<NonClientAreaMouseEvent>> mouseEventBatchConsumer);
203 QObject *contextObject, QOhosConsumer<std::vector<NonClientAreaTouchEvent>> touchEventBatchConsumer);
216 std::uint32_t queryLimit = 0);
226 enum class EventHandlerFlagBits
228 allowCallWhenAbilityIsTerminating = 1 << 0,
229 allowEventHandlerRegistrationFailure = 1 << 1,
232 struct JsScopeData :
public std::enable_shared_from_this<JsScopeData>
235 WindowProxyType windowProxyType, QNapi::Reference<QNapi::Object> jsWindow,
236 std::shared_ptr<
void> optKeepAliveData,
240 std::shared_ptr<
void> registerEventListener(
241 const std::string &eventName,
243 QFlags<EventHandlerFlagBits> eventHandlerFlags);
244 std::shared_ptr<
void> registerSubWindowCloseHandler(
246 std::function<
bool()> handler);
254 void handleWindowRectChangeInGlobalDisplayCallback(
const QtOhos::
CallbackInfo &cbInfo);
257 bool isWindowClosing()
const;
263 bool windowDestroyedFromSystem;
264 std::shared_ptr<
void> optKeepAliveData;
266 std::shared_ptr<
void> m_windowFrameMouseFilterHandle;
267 std::shared_ptr<
void> m_windowFrameTouchFilterHandle;
268 std::shared_ptr<
void> m_eventListenersHandle;
269 QOhosConsumer<NonClientAreaMouseEvent> nonClientAreaMouseEventConsumer;
270 QOhosConsumer<NonClientAreaTouchEvent> nonClientAreaTouchEventConsumer;
274 struct EventHandlerDescriptor
276 const char *eventName;
278 QFlags<EventHandlerFlagBits> eventHandlerFlags;
283 std::shared_ptr<
void> registerSubWindowCloseHandler(
284 std::function<
void()> handler,
285 bool handlerReturnValue);
287 static const EventHandlerDescriptor eventHandlerDescriptors[];
289 std::shared_ptr<JsScopeData> m_jsScopeData;
292 std::string m_qAbilityInstanceId;
293 std::shared_ptr<
void> m_subWindowCloseRegistrationHandle;
294 std::shared_ptr<
void> m_qtWindowCallbacksReceiverHandle;
295 std::shared_ptr<
void> m_qtNonClientAreaMouseWindowCallbackReceiverHandle;
296 std::shared_ptr<
void> m_qtNonClientAreaTouchWindowCallbackReceiverHandle;
void setSizeParentFillPercentNormalized(const QSizeF &size)
void setSaturation(int saturation)
void setTransparentForInput(bool transparentForInput)
void setNodeAreaChangeHandler(QOhosConsumer< QArkUi::QQtEmbeddedWindowNode::NodeAreaInfo > areaChangeEventConsumer)
void setPosition(QPoint position)
void setContrast(int contrast)
QRect nodeParentRelativeGeometryPixels() const
void startDrag(const std::vector< QImage > &images, const QPointF &hotspot, const QMimeData &mimeData, QOhosConsumer< Qt::DropAction > dropActionConsumer)
void setNodeVisibilityChangeHandler(QOhosConsumer< bool > visibilityChangedConsumer)
void detachFromParentIfPresent()
QOhosSurface * surfaceOrNull() const
void setFocused(bool focused)
void setBackgroundColor(const QColor &color)
QRect nodeScreenGeometryPixels() const
void setVisibility(bool visible)
void externalContentClickDetected()
QArkUi::QQtEmbeddedWindowNode::NodeAreaInfo nodeAreaInfo() const
void setNodeFocusChangeHandler(QOhosConsumer< bool > focusedChangedConsumer)
QNativeNode(const CreateInfo &nativeNodeCreateInfo)
void addForeignWindowChild(QOhosForeignWindow *foreignWindow)
void setSize(const QSizeF &size)
void setFocusable(bool focusable)
void setBrightness(int brightness)
void setParent(std::shared_ptr< QXComponentNode > xComponent)
void setParent(QNativeNode &other)
void setMimeDataSync(std::shared_ptr< QMimeData > mimeData, const QOhosOptional< bool > &shareInAppOnly)
QOhosClipboardObject(std::function< void(QOhosOptional< PasteboardDataSource >)> &&pasteboardUpdatesNotifier)
static std::unique_ptr< QOhosClipboardObject > makeInstance(std::function< void(QOhosOptional< PasteboardDataSource >)> &&pasteboardUpdatesNotifier)
PasteboardData getPasteboardDataWithLazyFetch()
QOhosPropertiesProvider(QOhosPropertiesStore &store)
QOhosOptional< T > tryGetProperty() const
std::shared_ptr< void > addPropertyWriteCallback(QOhosConsumer< T > propertyWriteCallback)
QOhosPropertiesStore(QObject *qObject)
std::shared_ptr< void > addPropertyWriteCallback(QOhosConsumer< T > propertyWriteCallback)
void notifyPropertyWrite(const QByteArray &propertyName)
QOhosOptional< T > tryGetProperty() const
QOhosPlatformScreen * platformScreenForDisplayIdOrNull(QOhosDisplayInfo::JsDisplayId displayId) const
QOhosPlatformScreen * platformScreenForDisplayIdOrFail(QOhosDisplayInfo::JsDisplayId displayId) const
bool isWindowPcModeEnabled() const
double fontSizeScale() const
void setExtraUsageBitsForNativeWindowBuffer(std::uint64_t usageSetBits)
void setNativeWindowSurface(::OHNativeWindow *nativeWindow, const QOhosOptional< QSize > &optSurfaceSize)
QOhosOptional< QSize > surfaceResolution() const
::OHNativeWindow * nativeWindow() const
static constexpr ::OH_NativeBuffer_Format bufferFormat
void paintOnNativeWindowSurface(std::function< std::vector<::Region::Rect >(QImage &, ::BufferHandle *)> paintFunc, std::function< void(::BufferHandle *)> onFlushSuccessFunc)
static QImage::Format mapNativeBufferFormatToQImageFormatOrFail(std::int32_t format)
static QOhosOptional< QSize > tryGetBufferGeometryForWindow(::OHNativeWindow *nativeWindow)
QOhosSurface(::OHNativeWindow *nativeWindow)
EGLSurface tryGetOrCreateEGLWindowSurface(EGLDisplay display, EGLConfig config, bool swappingBuffers)
void clearNativeWindowSurface()
void windowStatusChange(QOhosWindowProxy::WindowStatus windowStatus)
void setParentOrReparent(QOhosView &parentView)
void setCursor(const QCursor &cursor)
void handleWindowFlagsChange(Qt::WindowFlags previousWindowFlags, Qt::WindowFlags currentWindowFlags)
void addForeignWindowChild(QOhosForeignWindow *foreignWindow)
void handleWindowStateChange(Qt::WindowStates previousWindowState, Qt::WindowStates currentWindowState)
void setFocusable(bool focusable)
QArkUi::QQtEmbeddedWindowNode::NodeAreaInfo nodeAreaInfo() const
QOhosSurface * surfaceOrNull() const
void windowVisibilityChange(bool visibility)
void setPositionOnScreenImmediate(const QPoint &position, QOhosDisplayInfo::JsDisplayId jsDisplayId)
void setTransparentBackground(bool transparent)
void setModality(Qt::WindowModality modality)
bool isFullscreenImmersiveModeEnabled()
void setFramelessWindow(bool frameless)
QPixmap makeSnapshot() const
void setWindowShadowDisabled()
void setWindowTransparentForInput(bool transparentForInput)
void tryDetachFromEmbeddedParent()
ViewType viewType() const
QMargins avoidAreaMargins(QOhosWindowProxy::AvoidAreaType type) const
QWindow * ownerWindow() const
void handleSurfaceContentsUpdated()
void windowRectChanged(QOhosWindowProxy::RectChangeOptions rectChangeOptions)
QOhosOptional< QSize > surfaceResolution() const
void windowRectChangedInGlobalDisplay(QOhosWindowProxy::RectChangeOptions rectChangeOptions)
void forceGeometryUpdate()
void externalContentInteractionDetected()
void setWindowMinMaxCloseButtonState(const WindowMinMaxCloseButtonsState &state)
void setWindowMask(const QOhosWindowProxy::WindowMask &windowMask)
void setSizeLimits(const QSize &minSize, const QSize &maxSize)
void windowTouchOutside()
void nodeAreaChanged(QArkUi::QQtEmbeddedWindowNode::NodeAreaInfo areaChangeEvt)
void handlePaletteChange()
void surfaceStatusChanged(const QOhosOptional< QSize > &optSurfaceSize)
void windowDisplayIdChanged(QOhosDisplayInfo::JsDisplayId)
static std::unique_ptr< QOhosView > createForWindow(QOhosPlatformWindow *window, QOhosPropertiesProvider windowPropertiesProvider)
void setOpacity(qreal opacity)
void setNativeNodeVisibility(bool visible)
void setWindowStaysOnTop(bool staysOnTop)
ViewGeometry viewGeometry() const
void avoidAreaChanged(QOhosWindowProxy::AvoidAreaType avoidAreaType, const QOhosWindowProxy::AvoidArea &avoidArea)
void setSize(const QSize &size)
void setPosition(const QPoint &position)
QOhosView(QWindow *ownerWindow, QSharedPointer< QNativeNode > nativeNode, QOhosPropertiesProvider propertiesProvider)
bool isSubWindowCoveringFullScreen() const
QRect nodeParentRelativeGeometryPixels() const
void setTitle(const QString &title)
void startDrag(const std::vector< QImage > &images, const QPointF &hotspot, const QMimeData &mimeData, QOhosConsumer< Qt::DropAction > dropActionConsumer)
const QOhosView * viewParentOrNull() const
QRect nodeScreenGeometryPixels() const
void setWindowRectAutoSave(bool enabed)
void setWindowMask(const WindowMask &windowMask, const QOhosOptional< QSize > &ohosMaskSizeOverride={})
void setSubWindowModalEnabled(ModalityType ModalityType)
void setWindowKeepScreenOn(bool keepScreenOn)
void moveWindowToGlobal(const QPoint &position, const MoveConfiguration &moveConfiguration)
static std::shared_ptr< QOhosWindowProxy > createFloatWindow(const FloatWindowCreateInfo &createInfo)
QArkUi::WindowProperties getWindowProperties() const
void setSubWindowModalDisabled()
void setWindowPrivacyMode(bool privacyMode)
QOhosWindowProxy(const QOhosWindowProxy &)=delete
void resetSubWindowCloseHandler()
QOhosWindowProxy(QOhosWindowProxy &&)=delete
AvoidArea getWindowAvoidArea(AvoidAreaType type) const
QtOhos::enums::ohos::window::ModalityType ModalityType
void setWindowLayoutFullScreen(bool isLayoutFullScreen)
QtOhos::enums::ohos::window::AvoidAreaType AvoidAreaType
void enableDrag(bool enable)
void setWindowCornerRadius(double radius)
QOhosWindowProxyExistingMainWindowCreateInfo ExistingMainWindowCreateInfo
void setSupportedWindowModes(const std::set< SupportWindowMode > &supportedWindowModes)
void removeStartingWindow()
void setWindowSystemBarEnable(const QStringList &names)
std::shared_ptr< QOhosWindowProxy > createSubWindow(const SubWindowCreateInfo &createInfo)
static std::shared_ptr< QOhosWindowProxy > createForExistingMainWindow(const ExistingMainWindowCreateInfo &createInfo)
QtOhos::enums::ohos::window::MaximizePresentation MaximizePresentation
void setWindowTouchable(bool touchable)
WindowProxyType windowProxyType() const
void setTitle(const QString &title)
void setFollowParentMultiScreenPolicy(bool enabled)
void setWindowTopmost(bool topmost)
std::shared_ptr< QXComponentNode > nodeXComponent() const
QtOhos::enums::ohos::window::RectChangeReason RectChangeReason
void setWindowCallbackReceiver(std::unique_ptr< WindowCallbacks > receiver)
static std::vector< QArkUi::JsWindowId > queryWindowIdsByCoordinate(QOhosDisplayInfo::JsDisplayId displayId, const QPoint &queryLocation, std::uint32_t queryLimit=0)
void setSubWindowCloseHandler(std::function< void()> handler, bool handlerReturnValue)
QOhosOptional< bool > isFocused() const
void setWindowLimits(const QSize &minSize, const QSize &maxSize)
bool isWindowRectAutoSave() const
void setWindowDecorVisible(bool visible)
void showWindow(const ShowWindowOptions &options=ShowWindowOptions())
void shiftAppWindowFocus(QOhosWindowProxy &targetProxy)
QOhosWindowProxySubWindowCreateInfo SubWindowCreateInfo
void setNonClientAreaMouseWindowCallbackReceiver(QObject *contextObject, QOhosConsumer< std::vector< NonClientAreaMouseEvent > > mouseEventBatchConsumer)
void setCustomCursor(const QImage &customCursorImage, const QPoint &hotSpot)
QtOhos::enums::ohos::window::WindowEventType WindowEventType
void setWindowTitleMoveEnabled(bool enabled)
void setWindowFocusable(bool focusable)
void setWindowBackgroundColor(const QColor &color)
void setSize(const QSize &size)
QOhosWindowProxyMainWindowCreateInfo MainWindowCreateInfo
void setWindowShadowRadius(double radius)
bool qtIsMainWindow() const
QOhosWindowProxyFloatWindowCreateInfo FloatWindowCreateInfo
void setWindowTitleButtonVisible(bool maximizeVisible, bool minimizeVisible, bool closeVisible)
bool getImmersiveModeEnabledState()
void setPointerStyleSync(const QCursor &cursor)
QtOhos::enums::ohos::bundle::bundleManager::SupportWindowMode SupportWindowMode
QOhosWindowProxy & operator=(const QOhosWindowProxy &)=delete
void moveWindowToGlobalOrGlobalDisplay(const QPoint &position, QOhosOptional< QOhosDisplayInfo::JsDisplayId > optDisplayId)
QOhosWindowProxy & operator=(QOhosWindowProxy &&)=delete
WindowLimits getWindowLimits() const
static std::vector< QArkUi::JsWindowId > queryQtManagedWindowIdsByPredicate(const std::function< bool(QtOhos::JsState &jsState, const QArkUi::JsWindowRef &)> &predicate)
std::string qAbilityInstanceId() const
void maximize(MaximizePresentation maximizePresentation)
void setNonClientAreaTouchWindowCallbackReceiver(QObject *contextObject, QOhosConsumer< std::vector< NonClientAreaTouchEvent > > touchEventBatchConsumer)
QtOhos::enums::ohos::window::WindowStatusType WindowStatusType
QOhosOptional< QOhosDisplayInfo::JsDisplayId > tryGetMainWindowJsDisplayId() const
static std::shared_ptr< QOhosWindowProxy > createMainWindow(const MainWindowCreateInfo &createInfo)
bool sendEvent(WindowSystemEvent *event) override
Combined button and popup list for selecting options.
@ ForwardToGuiApplication
QOhosView * mapQWindowToViewOrNull(QWindow *window)
std::string makeQObjectOhosPropertyName()
QOhosOptional< T > tryMapFromQVariant(QVariant variant)
const char * qObjectOhosPropertyName()
std::shared_ptr< QWindowSystemEventHandler > makeApplicationStateTracker()
QT_END_NAMESPACE Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhos::enums::kit::ShareKit::systemShare::SelectionMode))
std::nullopt_t makeEmptyQOhosOptional()
bool isHandheldDeviceType()
QOhosRuntimeDeviceTypeAndMode
@ HandheldDeviceFullScreen
@ HandheldDeviceWindowPcMode
constexpr QOhosRuntimeDeviceTypeAndMode operator|(QOhosRuntimeDeviceTypeAndMode lhs, QOhosRuntimeDeviceTypeAndMode rhs)
QOhosRuntimeDeviceTypeAndMode queryQOhosRuntimeDeviceAndMode()
void setQOhosPropertyOnQObject(QObject *qObject, T propertyValue)
QOhosOptional< T > tryGetQOhosPropertyFromQObject(QObject *qObject)
Q_DECLARE_METATYPE(QOhosWindowProxy::RectChangeOptions)
QT_END_NAMESPACE Q_DECLARE_METATYPE(QOhosWindowProxy::WindowEvent)
Q_DECLARE_METATYPE(QOhosWindowProxy::AvoidArea)
Q_DECLARE_METATYPE(QOhosWindowProxy::WindowStatus)
QXComponent< QXComponentType::Node > QXComponentNode
std::unique_ptr< QMimeData > lazyFetchingData
QOhosOptional< PasteboardDataSource > dataSource
bool disableWindowFocusableBeforeLoadContent
QOhosOptional< QOhosDisplayInfo::JsDisplayId > displayId
QOhosOptional< QOhosDisplayInfo::JsDisplayId > displayId
std::chrono::milliseconds timestamp
std::chrono::milliseconds timestamp
QOhosOptional< bool > focusOnShow
QOhosConsumer< QOhosWindowProxy::AvoidAreaType, QOhosWindowProxy::AvoidArea > onAvoidAreaChange
QOhosConsumer< QOhosDisplayInfo::JsDisplayId > onWindowDisplayIdChange
QOhosConsumer< QOhosWindowProxy::RectChangeOptions > onWindowRectChange
QOhosConsumer< QOhosWindowProxy::RectChangeOptions > onWindowRectChangeInGlobalDisplay
std::function< void()> onTouchOutside
QOhosConsumer< QOhosWindowProxy::WindowStatus > onWindowStatusChange
QOhosConsumer< QOhosWindowProxy::WindowEvent > onWindowEvent
QOhosConsumer< bool > onWindowVisibilityChange
QOhosOptional< double > minWidth
QOhosOptional< double > minHeight
QOhosOptional< double > maxHeight
QOhosOptional< double > maxWidth