TGUI
=
=
Download
Tutorials
1.x
0.9
0.8
Documentation
1.x
0.9
0.8
Examples
1.x
0.9
0.8
Community
TGUI
1.x-dev
Toggle main menu visibility
Loading...
Searching...
No Matches
include
TGUI
Backend
Window
GLFW
BackendGLFW.hpp
1
2
//
3
// TGUI - Texus' Graphical User Interface
4
// Copyright (C) 2012-2026 Bruno Van de Velde (vdv_b@tgui.eu)
5
//
6
// This software is provided 'as-is', without any express or implied warranty.
7
// In no event will the authors be held liable for any damages arising from the use of this software.
8
//
9
// Permission is granted to anyone to use this software for any purpose,
10
// including commercial applications, and to alter it and redistribute it freely,
11
// subject to the following restrictions:
12
//
13
// 1. The origin of this software must not be misrepresented;
14
// you must not claim that you wrote the original software.
15
// If you use this software in a product, an acknowledgment
16
// in the product documentation would be appreciated but is not required.
17
//
18
// 2. Altered source versions must be plainly marked as such,
19
// and must not be misrepresented as being the original software.
20
//
21
// 3. This notice may not be removed or altered from any source distribution.
22
//
24
25
#ifndef TGUI_BACKEND_GLFW_HPP
26
#define TGUI_BACKEND_GLFW_HPP
27
28
#include <TGUI/Backend/Window/Backend.hpp>
29
#include <TGUI/Backend/Window/GLFW/BackendGuiGLFW.hpp>
30
31
#include <map>
32
#include <unordered_map>
33
35
36
using
GLFWwindow =
struct
GLFWwindow;
37
using
GLFWcursor =
struct
GLFWcursor;
38
40
41
namespace
tgui
42
{
43
class
TGUI_API
BackendGLFW
:
public
Backend
44
{
45
public
:
49
~BackendGLFW
()
override
;
50
59
void
setGuiWindow
(
BackendGui
* gui, GLFWwindow* window);
60
65
void
detatchGui
(
BackendGui
* gui)
override
;
66
75
void
setMouseCursorStyle
(
Cursor::Type
type,
const
std::uint8_t* pixels, Vector2u size, Vector2u hotspot)
override
;
76
82
void
resetMouseCursorStyle
(
Cursor::Type
type)
override
;
83
90
void
setMouseCursor
(
BackendGui
* gui,
Cursor::Type
type)
override
;
91
99
TGUI_DEPRECATED(
"Use gui.isKeyboardModifierPressed(modifierKey) instead"
)
100
[[nodiscard]]
bool
isKeyboardModifierPressed
(
Event::KeyModifier
modifierKey)
override
;
101
107
void
setClipboard
(
const
String
& contents)
override
;
108
114
[[nodiscard]]
String
getClipboard
()
const override
;
115
117
118
private
:
120
// Helper function to create a system cursor
122
[[nodiscard]] GLFWcursor* createSystemCursor(
Cursor::Type
type);
123
125
// Helper function to update the mouse cursors on all attached guis
127
void
updateMouseCursorStyle(
Cursor::Type
type, GLFWcursor* cursor);
128
130
// Helper function to update the mouse cursor on a window
132
void
updateShownMouseCursor(GLFWwindow* window,
Cursor::Type
type);
133
135
// Returns a window attached to any gui, for when a function needs access to some window
137
[[nodiscard]] GLFWwindow* getAnyWindow()
const
;
138
140
141
private
:
142
struct
GuiResources
143
{
144
GLFWwindow* window =
nullptr
;
145
Cursor::Type
mouseCursor =
Cursor::Type::Arrow
;
146
};
147
148
std::unordered_map<const BackendGui*, GuiResources> m_guiResources;
149
std::unordered_map<Cursor::Type, GLFWcursor*> m_mouseCursors;
150
};
151
153
}
// namespace tgui
154
156
157
#endif
// TGUI_BACKEND_GLFW_HPP
tgui::BackendGLFW
Definition
BackendGLFW.hpp:44
tgui::BackendGLFW::isKeyboardModifierPressed
bool isKeyboardModifierPressed(Event::KeyModifier modifierKey) override
Checks the state for one of the modifier keys.
tgui::BackendGLFW::getClipboard
String getClipboard() const override
Returns the contents of the clipboard.
tgui::BackendGLFW::setMouseCursor
void setMouseCursor(BackendGui *gui, Cursor::Type type) override
Changes the mouse cursor when the mouse is on top of the window to which the gui is attached.
tgui::BackendGLFW::setMouseCursorStyle
void setMouseCursorStyle(Cursor::Type type, const std::uint8_t *pixels, Vector2u size, Vector2u hotspot) override
Changes the look of a certain mouse cursor by using a bitmap.
tgui::BackendGLFW::setClipboard
void setClipboard(const String &contents) override
Changes the contents of the clipboard.
tgui::BackendGLFW::detatchGui
void detatchGui(BackendGui *gui) override
Informs the backend that a gui object is being destroyed.
tgui::BackendGLFW::~BackendGLFW
~BackendGLFW() override
Destructor.
tgui::BackendGLFW::resetMouseCursorStyle
void resetMouseCursorStyle(Cursor::Type type) override
Changes the look of a certain mouse cursor back to the system theme.
tgui::BackendGLFW::setGuiWindow
void setGuiWindow(BackendGui *gui, GLFWwindow *window)
Informs the backend which window belongs to the gui.
tgui::BackendGui
Base class for the Gui.
Definition
BackendGui.hpp:45
tgui::Backend::Backend
Backend()=default
Default constructor.
tgui::Cursor::Type
Type
List of available cursors.
Definition
Cursor.hpp:48
tgui::Cursor::Type::Arrow
@ Arrow
Arrow cursor (default).
Definition
Cursor.hpp:49
tgui::String
Wrapper class to store strings.
Definition
String.hpp:94
tgui
Namespace that contains all TGUI functions and classes.
Definition
AbsoluteOrRelativeValue.hpp:37
tgui::Event::KeyModifier
KeyModifier
Modifiers keys.
Definition
Event.hpp:155
Generated on
for TGUI by
1.18.0