4#ifndef QOHOSNATIVEXCOMPONENTINPUTHANDLER_H
5#define QOHOSNATIVEXCOMPONENTINPUTHANDLER_H
7#include <QtCore/QPointer>
8#include <QtCore/QtGlobal>
9#include <QtGui/QWindow>
10#include <QtGui/qinputdevice.h>
11#include <ace/xcomponent/native_interface_xcomponent.h>
12#include <arkui/ui_input_event.h>
13#include <qohosinputmethodeventhandler.h>
14#include <qohosplugincore.h>
15#include <render/qohosnativegestureshandler.h>
16#include <render/qxcomponent.h>
20class QOhosNativeXComponentInputHandler
final
21 :
public QEnableSharedFromThis<QOhosNativeXComponentInputHandler>
26 QtOhos::QThreadSafeRef<QWindow> qWindowRef,
27 QtOhos::QThreadSafeRef<QOhosInputMethodEventHandler> imEventHandlerRef);
37 std::chrono::steady_clock::time_point timestamp;
38 ::OH_NativeXComponent_MouseEvent event;
43 std::chrono::steady_clock::time_point timestamp;
44 std::chrono::nanoseconds touchTimeStamp;
45 std::vector<QOhosTouchEventTouchPointData> touchPoints;
46 QInputDevice::DeviceType deviceType;
49 static bool mayDropMouseEvent(
50 std::chrono::steady_clock::time_point now,
51 const MouseEvent &event,
const MouseEvent &nextEvent);
53 void processMouseEventsInQtThread(std::vector<MouseEvent> &&batch);
54 void processTouchEventsInQtThread(std::vector<TouchEvent> &&batch);
55 void invokeMethodLaterIfSelfExists(
56 QtOhos::QObjectThreadSafeRef ctxRef,
57 std::function<
void(QOhosNativeXComponentInputHandler &component)>);
60 QtOhos::QThreadSafeRef<QWindow> m_qWindowRef;
61 QtOhos::QThreadSafeRef<QOhosInputMethodEventHandler> m_imEventHandlerRef;
63 std::function<
void(
std::function<
void(std::vector<MouseEvent> &)>)> m_optMouseEventsHandler;
64 QOhosConsumer<TouchEvent> m_optTouchEventsHandler;
void setParentOrReparent(ParentDescriptor parent)
static const std::int32_t minimumNodeZIndexValue
void setSizeParentFillPercentNormalized(const QSizeF &size)
void setSaturation(int saturation)
void setTransparentForInput(bool transparentForInput)
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)
void fillToParent(const QSize &surfaceResolution)
QRect nodeScreenGeometryPixels() const
void setNodeAreaChangeHandler(QOhosConsumer< QArkUi::QQtEmbeddedWindowNode::AreaChangeEvent > areaChangeEventConsumer)
void setVisibility(bool visible)
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)
virtual void handleQOhosHoverEvent(bool hovered)=0
virtual ~QOhosHoverEventsGenerator()
virtual void handleQOhosMouseEvent(const QOhosMouseEvent &mouseEvent)=0
QOhosHoverEventsGenerator()
std::enable_if_t< qohosplugincore_h_detail::isQOhosOptional< QOhosInvokeResult< Func, T > >, QOhosInvokeResult< Func, T > > andThen(Func &&func) const
void onHoverEvent(bool isHover) override
void onInputEvent(InputEventType inputEventType, ::OHNativeWindow *window) override
CallbackReceiver(QXComponentRender xComponent, QtOhos::QThreadSafeRef< QWindow > windowRef, QtOhos::QThreadSafeRef< QOhosInputMethodEventHandler > imEventHandlerRef, std::function< void(SurfaceEventType, ::OHNativeWindow *, QOhosOptional< QSize >)> surfaceEventHandler)
void onSurfaceEvent(SurfaceEventType surfaceEventType, ::OHNativeWindow *nativeWindow) override
~CallbackReceiver() override=default
Combined button and popup list for selecting options.
QArkUi::QXComponentCallbackReceiver::InputEventType InputEventType
QOhosOptional<::ArkUI_RenderFit > tryMapRenderFitPolicyToArkUi(QOhosPlatformWindow::NativeNodeRenderFitPolicy renderFitPolicy)
bool getHoveredStateFromHoverEvent(::ArkUI_UIInputEvent *uiInputEvent)
QArkUi::QXComponentCallbackReceiver::SurfaceEventType SurfaceEventType
bool isNativeNodeApiMouseEventsEnabled()
void runInJsThreadAndWait(const std::function< void(JsState &)> &task)
QOhosOptional<::ArkUI_DropOperation > tryMapQOhosArkUiDropOperationFromQt(Qt::DropAction dropAction)
::ArkUI_DropOperation getQOhosDragEventDropOperation(::ArkUI_DragEvent *dragEvent)
std::shared_ptr< QOhosHoverEventsGenerator > makeQOhosHoverEventsGenerator(QtOhos::QThreadSafeRef< QWindow > qWindowRef, QtOhos::QThreadSafeRef< QOhosInputMethodEventHandler > imEventHandlerRef)
QOhosOptional< void > makeEmptyQOhosOptional()
QXComponent< QXComponentType::Render > QXComponentRender
QXComponent< QXComponentType::Node > QXComponentNode