lxgui
Loading...
Searching...
No Matches
input_window.cpp
1#include "lxgui/input_window.hpp"
2
3#include "lxgui/input_source.hpp"
4
5namespace lxgui::input {
6
7window::window(source& src) : source_(src) {
8 connection_ = src.on_window_resized.connect([&](const gui::vector2ui& dimensions) {
9 // Forward
10 on_window_resized(dimensions);
11 });
12}
13
15 return source_.get_clipboard_content();
16}
17
18void window::set_clipboard_content(const utils::ustring& content) {
19 return source_.set_clipboard_content(content);
20}
21
22void window::set_mouse_cursor(const std::string& file_name, const gui::vector2i& hot_spot) {
23 return source_.set_mouse_cursor(file_name, hot_spot);
24}
25
27 return source_.reset_mouse_cursor();
28}
29
31 return source_.get_window_dimensions();
32}
33
37
38const source& window::get_source() const {
39 return source_;
40}
41
43 return source_;
44}
45
46} // namespace lxgui::input
The base class for input source implementation.
virtual void reset_mouse_cursor()=0
Sets the mouse cursor back to the default (arrow).
virtual void set_clipboard_content(const utils::ustring &content)=0
Replace the content of the clipboard.
virtual utils::ustring get_clipboard_content()=0
Retrieve a copy of the clipboard content.
const gui::vector2ui & get_window_dimensions() const
Get the window size (in pixels)
virtual float get_interface_scaling_factor_hint() const
Return the interface scaling factor suggested by the operating system.
utils::signal< void(const gui::vector2ui &)> on_window_resized
Signal triggered whenever the window is resized or changes resolution.
virtual void set_mouse_cursor(const std::string &file_name, const gui::vector2i &hot_spot)=0
Sets the mouse cursor to a given image on disk.
utils::ustring get_clipboard_content()
Retrieve a copy of the clipboard content.
float get_interface_scaling_factor_hint() const
Return the interface scaling factor suggested by the operating system.
utils::signal< void(const gui::vector2ui &)> on_window_resized
Signal triggered whenever the window is resized or changes resolution.
const source & get_source() const
Returns the input source.
const gui::vector2ui & get_dimensions() const
Get the window size (in pixels)
window(source &src)
Initializes this window with a chosen input source.
void reset_mouse_cursor()
Sets the mouse cursor back to the default (arrow).
void set_clipboard_content(const utils::ustring &content)
Replace the content of the clipboard.
void set_mouse_cursor(const std::string &file_name, const gui::vector2i &hot_spot)
Sets the mouse cursor to a given image on disk.