TGUI  0.8.8
Global.hpp
1 //
3 // TGUI - Texus' Graphical User Interface
4 // Copyright (C) 2012-2020 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 
94  TGUI_API void setEditCursorBlinkRate(unsigned int blinkRateMilliseconds);
95 
96 
100  TGUI_API unsigned int getEditCursorBlinkRate();
101 
102 
111  TGUI_API void setResourcePath(const std::string& path);
112 
113 
122  TGUI_API const std::string& getResourcePath();
123 
124 
127  // Checks if two floats are equal, with regard to a small epsilon margin.
129  TGUI_API bool compareFloats(float x, float y);
130 
131 #ifndef TGUI_REMOVE_DEPRECATED_CODE
132  // Converts a string to an integer. Acts like std::stoi which isn't supported in MinGW TDM.
136  TGUI_DEPRECATED("Use strToInt instead") TGUI_API int stoi(const std::string& value);
137 
138 
141  // Converts a string to a float. Acts like std::stof which isn't supported in MinGW TDM.
143  TGUI_DEPRECATED("Use strToFloat instead") TGUI_API float stof(const std::string& value);
144 
145 
148  // Extracts a bool from a string value.
150  TGUI_DEPRECATED("This function will be removed") TGUI_API bool extractBoolFromString(const std::string& property, const std::string& value);
151 #endif
152 
153 #ifndef TGUI_NEXT
154  // Moves the iterator forward until no more whitespace is found
158  TGUI_API bool removeWhitespace(const std::string& line, std::string::const_iterator& c);
159 #endif
160 
162 }
163 
165 
166 #endif // TGUI_GLOBAL_HPP
167 
Definition: Font.hpp:43
TGUI_API const std::string & getResourcePath()
Returns the resource path.
TGUI_API Font getGlobalFont()
Retrieves the default font used for all new widgets.
TGUI_API unsigned int getDoubleClickTime()
Retrieves the double-click time for the mouse.
Namespace that contains all TGUI functions and classes.
Definition: AbsoluteOrRelativeValue.hpp:37
TGUI_API void setEditCursorBlinkRate(unsigned int blinkRateMilliseconds)
Changes the blink rate of the cursor in edit fields such as EditBox and TextBox.
TGUI_API void setGlobalTextSize(unsigned int textSize)
Sets the default text size for all widgets created after calling the function.
TGUI_API void setResourcePath(const std::string &path)
Sets a new resource path.
TGUI_API unsigned int getEditCursorBlinkRate()
Returns the blink rate of the cursor in edit fields such as EditBox and TextBox.
TGUI_API float strToFloat(const std::string &str, float defaultValue=0)
Converts a string to a float.
TGUI_API unsigned int getGlobalTextSize()
Retrieves the default text size used for all new widgets.
TGUI_API void setDoubleClickTime(unsigned int milliseconds)
Sets the double-click time for the mouse.
TGUI_API void setGlobalFont(const Font &font)
Sets the default font used by widgets.