25#ifndef TGUI_BACKEND_HPP
26#define TGUI_BACKEND_HPP
28#include <TGUI/Font.hpp>
29#include <TGUI/Event.hpp>
30#include <TGUI/Cursor.hpp>
31#include <TGUI/Backend/Font/BackendFont.hpp>
32#include <TGUI/Backend/Font/BackendFontFactory.hpp>
33#include <TGUI/Backend/Renderer/BackendText.hpp>
34#include <TGUI/Backend/Renderer/BackendTexture.hpp>
35#include <TGUI/Backend/Renderer/BackendRenderer.hpp>
37#if !TGUI_EXPERIMENTAL_USE_STD_MODULE
45TGUI_MODULE_EXPORT
namespace tgui
50 class BackendRenderer;
51 class BackendFontFactory;
70 TGUI_API
void setBackend(std::shared_ptr<Backend> backend);
201#ifndef TGUI_REMOVE_DEPRECATED_CODE
210 TGUI_DEPRECATED(
"Use BackendGui::startTextInput instead") virtual
void openVirtualKeyboard(const
FloatRect& inputRect);
219 TGUI_DEPRECATED("Use
BackendGui::stopTextInput instead") virtual
void closeVirtualKeyboard();
229 TGUI_DEPRECATED(
"Use gui.isKeyboardModifierPressed(modifierKey) instead") TGUI_NODISCARD virtual
bool isKeyboardModifierPressed(
Event::KeyModifier modifierKey) = 0;
236 virtual
void setClipboard(const
String& contents);
243 TGUI_NODISCARD virtual
String getClipboard() const;
253 TGUI_NODISCARD virtual std::unique_ptr<std::uint8_t[]> readFileFromAndroidAssets(const
String& filename, std::
size_t& fileSize) const;
259 TGUI_NODISCARD
bool hasRenderer() const;
282 TGUI_NODISCARD
bool hasFontBackend() const;
326 void registerSvgSprite(
Sprite* sprite);
335 void unregisterSvgSprite(
Sprite* sprite);
340 bool m_destroyOnLastGuiDetatch = false;
341 String m_clipboardContents;
342 float m_fontScale = 1;
349 std::set<
Sprite*> m_registeredSvgSprites;
Base class for the font factory that is responsible for creating a font object specific to the font b...
Definition BackendFontFactory.hpp:42
Base class for font implementations that depend on the backend.
Definition BackendFont.hpp:45
Base class for the Gui.
Definition BackendGui.hpp:47
Base class for the backend renderer, which is responsible for creating text and texture objects.
Definition BackendRenderer.hpp:44
Base class for the backend.
Definition Backend.hpp:87
std::shared_ptr< BackendFont > createFont()
Creates a new font object.
float getFontScale() const
Returns the scale factor to render text at a higher quality, e.g. to scale for DPI awareness.
virtual void setMouseCursorStyle(Cursor::Type type, const std::uint8_t *pixels, Vector2u size, Vector2u hotspot)=0
Changes the look of a certain mouse cursor by using a bitmap.
virtual void setMouseCursor(BackendGui *gui, Cursor::Type type)=0
Changes the mouse cursor when the mouse is on top of the window to which the gui is attached.
virtual void resetMouseCursorStyle(Cursor::Type type)=0
Changes the look of a certain mouse cursor back to the system theme.
virtual void attachGui(BackendGui *gui)
Informs the backend that a new gui object has been created.
virtual ~Backend()=default
Virtual destructor.
virtual void detatchGui(BackendGui *gui)
Informs the backend that a gui object is being destroyed.
std::shared_ptr< BackendTexture > createTexture()
Creates a new texture object.
std::shared_ptr< BackendText > createText()
Creates a new text object.
void setDestroyOnLastGuiDetatch(bool destroyOnDetatch)
Informs the backend whether it should destroy itself when the last Gui is detached from it.
void setFontScale(float scale)
Sets the scale factor to render text at a higher quality, e.g. to scale for DPI awareness.
virtual Font createDefaultFont()
Creates and returns the default font for all widgets.
Backend()=default
Default constructor.
Type
List of available cursors.
Definition Cursor.hpp:50
Wrapper around the backend-specific font. All copies of the font will share the same internal font re...
Definition Font.hpp:58
Wrapper class to store strings.
Definition String.hpp:96
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:38
TGUI_API void setBackend(std::shared_ptr< Backend > backend)
Changes the global backend.
TGUI_API std::shared_ptr< Backend > getBackend()
Returns the global backend.
TGUI_API bool isBackendSet()
Checks whether the backend differs from a nullptr.