26#ifndef TGUI_BACKEND_HPP
27#define TGUI_BACKEND_HPP
29#include <TGUI/Font.hpp>
30#include <TGUI/Event.hpp>
31#include <TGUI/Cursor.hpp>
32#include <TGUI/Backend/Font/BackendFont.hpp>
33#include <TGUI/Backend/Font/BackendFontFactory.hpp>
34#include <TGUI/Backend/Renderer/BackendText.hpp>
35#include <TGUI/Backend/Renderer/BackendTexture.hpp>
36#include <TGUI/Backend/Renderer/BackendRenderer.hpp>
46 class BackendRenderer;
47 class BackendFontFactory;
67 TGUI_API
void setBackend(std::shared_ptr<Backend> backend);
270 virtual void setRenderer(std::shared_ptr<BackendRenderer> renderer);
302 bool m_destroyOnLastGuiDetatch =
false;
303 String m_clipboardContents;
305 std::shared_ptr<BackendRenderer> m_renderer;
306 std::shared_ptr<BackendFontFactory> m_fontBackend;
Base class for the Gui.
Definition: BackendGui.hpp:45
Base class for the backend.
Definition: Backend.hpp:86
virtual void setClipboard(const String &contents)
Changes the contents of the clipboard.
std::shared_ptr< BackendFontFactory > getFontBackend() const
Returns the font factory.
std::shared_ptr< BackendFont > createFont()
Creates a new font object.
virtual void detatchGui(BackendGui *gui)=0
Informs the backend that a gui object is being destroyed.
virtual void setRenderer(std::shared_ptr< BackendRenderer > renderer)
Sets the renderer that the backend should use.
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 std::unique_ptr< std::uint8_t[]> readFileFromAndroidAssets(const String &filename, std::size_t &fileSize) const
Uses the AssetManager on Android to read a file and return its contents.
virtual void resetMouseCursorStyle(Cursor::Type type)=0
Changes the look of a certain mouse cursor back to the system theme.
virtual String getClipboard() const
Returns the contents of the clipboard.
virtual void closeVirtualKeyboard()
Closes the virtual keyboard on Android and iOS.
virtual bool isKeyboardModifierPressed(Event::KeyModifier modifierKey)=0
Checks the state for one of the modifier keys.
virtual ~Backend()=default
Virtual destructor.
virtual void openVirtualKeyboard(const FloatRect &inputRect)
Opens the virtual keyboard on Android and iOS.
std::shared_ptr< BackendTexture > createTexture()
Creates a new texture object.
std::shared_ptr< BackendRenderer > getRenderer() const
Returns the renderer.
std::shared_ptr< BackendText > createText()
Creates a new text object.
virtual void setFontBackend(std::shared_ptr< BackendFontFactory > fontBackend)
Sets the font factory that the backend should use.
bool hasFontBackend() const
Checks whether a font factory has been attached to the backend.
void setDestroyOnLastGuiDetatch(bool destroyOnDetatch)
Informs the backend whether it should destroy itself when the last Gui is detached from it.
virtual void attachGui(BackendGui *gui)=0
Informs the backend that a new gui object has been created.
virtual Font createDefaultFont()
Creates and returns the default font for all widgets.
bool hasRenderer() const
Checks whether a renderer has been attached to the backend.
Backend()=default
Default constructor.
Type
List of available cursors.
Definition: Cursor.hpp:48
Wrapper class to store strings.
Definition: String.hpp:79
Namespace that contains all TGUI functions and classes.
Definition: AbsoluteOrRelativeValue.hpp:36
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.
KeyModifier
Modifiers keys.
Definition: Event.hpp:156