CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
UIDebugUtility.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include "UIUtility.hpp"
11#include "UIEvent.hpp"
12
14
15namespace CeresEngine {
16 class UIWindow;
17 class UIView;
18
23 static void simulateTypeText(UIWindow& window, StringView str);
24
27 static void simulateClick(UIWindow& window, UIPoint point);
28
31 static void simulateRightClick(UIWindow& window, UIPoint point);
32
35 static bool clickOnView(UIWindow& window, const UIView* view, UIPoint offset = {});
36 };
37
39 private:
41
42 public:
43 explicit UIEventSimulator(UIWindow& window);
44
45 public: // Mouse events
46 void mouseMove(const UIPoint& from, const UIPoint& to);
47 void mouseMove(const UIView& fromView, const UIView& toView);
48
49 void click(const UIPoint& location);
50 void click(const UIView& view);
51 void click(const UIView& view, const UIPoint& offset);
52
53 void rightClick(const UIPoint& location);
54 void rightClick(const UIView& view);
55 void rightClick(const UIView& view, const UIPoint& offset);
56
57 void middleClick(const UIPoint& location);
58 void middleClick(const UIView& view);
59 void middleClick(const UIView& view, const UIPoint& offset);
60
61 void drag(const UIPoint& from, const UIPoint& to);
64
65 private:
66 void sendMouseEvent(UIEventType type, const UIPoint& location, UInt32 buttonNumber);
67 };
68
69} // namespace CeresEngine
Definition UIDebugUtility.hpp:38
void drag(UIView &fromView, UIView &toView)
void middleClick(const UIView &view)
void drag(const UIPoint &from, const UIPoint &to)
void click(const UIView &view)
void rightClick(const UIView &view)
UIEventSimulator(UIWindow &window)
UIWindow & mWindow
Definition UIDebugUtility.hpp:40
void middleClick(const UIPoint &location)
void mouseMove(const UIPoint &from, const UIPoint &to)
void middleClick(const UIView &view, const UIPoint &offset)
void rightClick(const UIView &view, const UIPoint &offset)
void click(const UIView &view, const UIPoint &offset)
void drag(UIView &fromView, UIView &toView, const UIPoint &fromOffset, const UIPoint &toOffset)
void mouseMove(const UIView &fromView, const UIView &toView)
void sendMouseEvent(UIEventType type, const UIPoint &location, UInt32 buttonNumber)
void click(const UIPoint &location)
void rightClick(const UIPoint &location)
The infrastructure for drawing and handling events in a UI.
Definition UIView.hpp:153
A window that an app displays on the screen.
Definition UIWindow.hpp:42
Definition Application.hpp:19
UIEventType
The types of events handled by responder objects.
Definition UIEvent.hpp:24
Point2 UIPoint
A type that contains a point in a two-dimensional coordinate system.
Definition UIUtility.hpp:27
std::uint32_t UInt32
Definition DataTypes.hpp:23
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Definition UIDebugUtility.hpp:19
static void simulateTypeText(UIWindow &window, StringView str)
Sends a sequence of key events that simulates a user typing a text.
static void simulateClick(UIWindow &window, UIPoint point)
Sends a leftMouseDown event that simulates a click at the given position.
static bool clickOnView(UIWindow &window, const UIView *view, UIPoint offset={})
Sends a leftMouseDown event that will select the given view.
static void simulateRightClick(UIWindow &window, UIPoint point)
Sends a rightMouseDown event that simulates a click at the given position.