TachyonUI
0.1.0
High-performance UI for building tools.
Toggle main menu visibility
Loading...
Searching...
No Matches
gui_platform_input_handler.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <stdint.h>
4
#include <string_view>
5
#include <
gui_core/gui_base_types.h
>
6
#include <
gui_core/gui_id.h
>
// OnFileDrop's default body takes it by value
7
8
namespace
tachyon
9
{
12
13
enum class
KeyCode
: uint32_t;
14
enum class
KeyModifier
: uint8_t;
15
enum class
KeyAction
: uint8_t;
16
17
enum class
MouseButtons
: uint8_t;
18
enum class
MouseAction
: uint8_t;
19
enum class
FileDropAction
: uint8_t;
20
23
class
IPlatformInputHandler
24
{
25
public
:
26
virtual
~IPlatformInputHandler
() =
default
;
29
virtual
void
OnKeyboard
(
tachyon::ID
id
,
KeyCode
key,
int
repeat,
KeyModifier
modifiers,
KeyAction
action) = 0;
31
virtual
void
OnMouseMove
(
tachyon::ID
id
,
tachyon::int2
screenPos,
tachyon::MouseButtons
buttons,
KeyModifier
modifiers) = 0;
33
virtual
void
OnMouseButton
(
tachyon::ID
id
,
tachyon::int2
screenPos,
tachyon::MouseButtons
buttons,
KeyModifier
modifiers,
tachyon::MouseAction
action) = 0;
35
virtual
void
OnMouseScroll
(
tachyon::ID
id
,
tachyon::int2
screenPos,
tachyon::float2
scrollOffset,
KeyModifier
modifiers) = 0;
39
virtual
void
OnTextComposition
(
tachyon::ID
id
, std::string_view text, int32_t cursor) = 0;
42
virtual
void
OnFileDrop
(
tachyon::ID
/*id*/
,
tachyon::int2
/*screenPos*/
,
FileDropAction
/*action*/
, std::string_view
/*data*/
) {}
43
};
44
45
};
tachyon::IPlatformInputHandler
Platform-level input interface: receives raw OS events (keyboard, mouse) and forwards them into the G...
Definition
gui_platform_input_handler.h:24
tachyon::IPlatformInputHandler::OnMouseButton
virtual void OnMouseButton(tachyon::ID id, tachyon::int2 screenPos, tachyon::MouseButtons buttons, KeyModifier modifiers, tachyon::MouseAction action)=0
A mouse button went down or up; buttons are those held down after the change.
tachyon::IPlatformInputHandler::OnMouseScroll
virtual void OnMouseScroll(tachyon::ID id, tachyon::int2 screenPos, tachyon::float2 scrollOffset, KeyModifier modifiers)=0
The wheel turned, by scrollOffset notches; positive y is away from the user (scrolls up).
tachyon::IPlatformInputHandler::OnKeyboard
virtual void OnKeyboard(tachyon::ID id, KeyCode key, int repeat, KeyModifier modifiers, KeyAction action)=0
A key went down or up (key is its KeyCode, repeat nonzero for an auto-repeat), or a character was typ...
tachyon::IPlatformInputHandler::OnTextComposition
virtual void OnTextComposition(tachyon::ID id, std::string_view text, int32_t cursor)=0
IME composition (pre-edit) text, UTF-8, shown but not yet committed; empty when composing ends.
tachyon::IPlatformInputHandler::OnMouseMove
virtual void OnMouseMove(tachyon::ID id, tachyon::int2 screenPos, tachyon::MouseButtons buttons, KeyModifier modifiers)=0
The mouse moved over window id; screenPos in screen pixels, buttons those held down.
tachyon::IPlatformInputHandler::~IPlatformInputHandler
virtual ~IPlatformInputHandler()=default
tachyon::IPlatformInputHandler::OnFileDrop
virtual void OnFileDrop(tachyon::ID, tachyon::int2, FileDropAction, std::string_view)
A drag from another application over window id: it came, moved to screenPos (screen pixels),...
Definition
gui_platform_input_handler.h:42
tachyon::KeyCode
KeyCode
Keys by what the keyboard layout makes them, not by position.
Definition
gui_input_enums.h:106
tachyon::KeyAction
KeyAction
A keyboard event: a key down or up, or a typed character (KeyChar).
Definition
gui_input_enums.h:50
tachyon::KeyModifier
KeyModifier
Modifier keys held, combined with |.
Definition
gui_input_enums.h:26
tachyon::FileDropAction
FileDropAction
A step of a drag from another application (files, text) over one of the app's windows.
Definition
gui_input_enums.h:65
tachyon::MouseButtons
MouseButtons
Mouse buttons, combined with |.
Definition
gui_input_enums.h:38
tachyon::MouseAction
MouseAction
Whether a mouse button went down or up.
Definition
gui_input_enums.h:58
gui_base_types.h
gui_id.h
tachyon
Definition
gui_logging.h:24
tachyon::ID
A 64-bit element ID whose bit layout depends on its IDMode.
Definition
gui_id.h:23
tachyon::float2
Definition
gui_base_types.h:121
tachyon::int2
Integer 2D vector.
Definition
gui_base_types.h:19
gui_core
input
gui_platform_input_handler.h
Generated by
1.18.0