summaryrefslogtreecommitdiff
path: root/src/window/window.h
blob: 716b25d5016c3e1b1075ac754303bf20b31ce9be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#pragma once

#include <forstio/async/async.h>
#include <forstio/core/common.h>
#include <forstio/codec/schema.h>

#include <string_view>
#include <variant>

#include "video_mode.h"

namespace saw {
namespace schema {
using WindowResize = Struct<
	Member<UInt32, "width">,
	Member<UInt32, "height">
>;
using WindowEvents = Union<
	Member<WindowResize, "resize">
>;
}
}

#ifdef SAW_UNIX_XCB
#include "xcb.h"
#endif

/**
namespace saw {
class window {
public:
	class event {
	public:
		struct resize {
			size_t width;
			size_t height;
		};

		struct keyboard {
			uint32_t key;
			uint32_t scan;
			bool pressed;
			bool repeat;
		};

		struct mouse {
			uint16_t button_mask;
			bool pressed;
			uint32_t x;
			uint32_t y;
		};

		struct mouse_move {
			uint32_t x;
			uint32_t y;
		};
	};

	using variant_event = std::variant<event::resize, event::keyboard,
									   event::mouse, event::mouse_move>;

	virtual ~window() = default;

	virtual void show() = 0;
	virtual void hide() = 0;

	virtual const video_mode &get_video_mode() const = 0;
	virtual const std::string_view title() const = 0;

	virtual void resize(size_t width, size_t height) = 0;

	virtual conveyor<variant_event> on_event() = 0;
};
} // namespace saw
*/