TGUI  0.8-beta
Global.hpp
1 //
3 // TGUI - Texus' Graphical User Interface
4 // Copyright (C) 2012-2018 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_GLOBAL_HPP
26 #define TGUI_GLOBAL_HPP
27 
29 
30 #include <TGUI/Config.hpp>
31 #include <TGUI/Exception.hpp>
32 #include <TGUI/Font.hpp>
33 #include <cstdint>
34 #include <string>
35 #include <memory>
36 
37 #ifdef TGUI_DEBUG
38  #include <iostream>
39 #endif
40 
42 
44 namespace tgui
45 {
49  TGUI_API void setGlobalTextSize(unsigned int textSize);
50 
51 
55  TGUI_API unsigned int getGlobalTextSize();
56 
57 
61  TGUI_API void setGlobalFont(const Font& font);
62 
63 
69  TGUI_API Font getGlobalFont();
70 
71 
76  TGUI_API const std::shared_ptr<sf::Font>& getInternalGlobalFont();
77 
78 
82  TGUI_API void setDoubleClickTime(unsigned int milliseconds);
83 
84 
88  TGUI_API unsigned int getDoubleClickTime();
89 
90 
99  TGUI_API void setResourcePath(const std::string& path);
100 
101 
110  TGUI_API const std::string& getResourcePath();
111 
112 
115  // Checks if two floats are equal, with regard to a small epsilon margin.
117  TGUI_API bool compareFloats(float x, float y);
118 
119 
122  // Checks if a character is a whitespace character.
124  TGUI_API bool isWhitespace(std::uint32_t character);
125 
126 
129  // Converts a string to an integer. Acts like std::stoi which isn't supported in MinGW TDM.
131  TGUI_API int stoi(const std::string& value);
132 
133 
136  // Converts a string to a float. Acts like std::stof which isn't supported in MinGW TDM.
138  TGUI_API float stof(const std::string& value);
139 
140 
143  // Extracts a bool from a string value.
145  TGUI_API bool extractBoolFromString(const std::string& property, const std::string& value);
146 
147 
150  // Moves the iterator forward until no more whitespace is found
152  TGUI_API bool removeWhitespace(const std::string& line, std::string::const_iterator& c);
153 
154 
157  // Converts a string to lowercase.
159  TGUI_API std::string toLower(std::string str);
160 
161 
164  // Trims the whitespace from a string.
166  TGUI_API std::string trim(std::string str);
167 
168 
170 }
171 
173 
174 #endif // TGUI_GLOBAL_HPP
175 
Namespace that contains all TGUI functions and classes.
Definition: AbsoluteOrRelativeValue.hpp:36
TGUI_API unsigned int getGlobalTextSize()
Retrieves the default text size used for all new widgets.
TGUI_API unsigned int getDoubleClickTime()
Retrieves the double-click time for the mouse.
TGUI_API void setGlobalTextSize(unsigned int textSize)
Sets the default text size for all widgets created after calling the function.
TGUI_API void setDoubleClickTime(unsigned int milliseconds)
Sets the double-click time for the mouse.
TGUI_API const std::string & getResourcePath()
Returns the resource path.
TGUI_API void setResourcePath(const std::string &path)
Sets a new resource path.
TGUI_API Font getGlobalFont()
Retrieves the default font used for all new widgets.
TGUI_API void setGlobalFont(const Font &font)
Sets the default font used by widgets.