1.10 |
Internal detail namespace. More...
Classes | |
class | AnimationBase |
Base class for an animation. More... | |
class | ComposerScreen |
Screen in an in-memory buffer for the Microchip Graphic Composer. More... | |
class | CopyOnWriteAllocate |
Copy-On-Write wrapper for an object or container. More... | |
struct | EnumStrings |
When using enum_to_string() and enum_from_string(), this type needs to be defined and specialized to include the data for enum string conversions. More... | |
class | ImageCache |
Internal image cache. More... | |
class | InputEvDev |
Handles reading input events from evdev devices. More... | |
class | InputLibInput |
Handles populating and reading input events from libinput. More... | |
class | InputTslib |
Handles reading input from a tslib supported device. More... | |
class | KMSOverlay |
Screen in a KMS dumb buffer inside of an overlay plane. More... | |
class | KMSScreen |
Screen in an KMS dumb buffer. More... | |
struct | LayoutRect |
Wrapper around properties for managing a rect by flex_layout(). More... | |
class | MemoryScreen |
Screen in an in-memory buffer. More... | |
class | MouseGesture |
Basic class for interpreting mouse events. More... | |
class | NonCopyable |
Utility base class to make a derived class non-copy-able. More... | |
class | Range |
Utility class to allow range loops from a subset of a container. More... | |
class | ReverseRange |
Range class to work with C++11 range based for loops in a reverse order. More... | |
struct | ScopeExit |
Utility to run a callback when this object goes out of scope. More... | |
class | SDLScreen |
Screen in an SDL window. More... | |
class | X11Screen |
Screen in an X11 window. More... | |
Typedefs | |
using | unique_plane_t = std::unique_ptr< plane_data, detail::plane_t_deleter > |
Unique pointer for a cairo context. | |
Enumerations | |
enum class | Compatible { normal , display , grid } |
Geometry types compatibility type. More... | |
enum class | SchemeType { unknown , resource , filesystem , network } |
URI scheme types. More... | |
Functions | |
EGT_API std::string | abspath (const std::string &path) |
Convert a relative path to an absolute path. | |
EGT_API Rect | align_algorithm (const Rect &orig, const Rect &bounding, const AlignFlags &align, DefaultDim padding=0, DefaultDim horizontal_ratio=0, DefaultDim vertical_ratio=0, DefaultDim xratio=0, DefaultDim yratio=0) |
Given an item size, and a bounding box, and an alignment parameter, return the rectangle the item box should be move/resized to. | |
EGT_API Rect | align_algorithm_force (const Rect &orig, const Rect &bounding, const AlignFlags &align, DefaultDim padding=0, DefaultDim horizontal_ratio=0, DefaultDim vertical_ratio=0, DefaultDim xratio=0, DefaultDim yratio=0) |
align_algorithm() | |
EGT_API uint32_t | align_to_behave (const AlignFlags &align) |
Compute lib lay behave from @align flags. | |
EGT_API bool | alpha_collision (const Rect &lhs, cairo_surface_t *limage, const Point &rhs) |
Detect alpha collision with a specific point. | |
EGT_API bool | alpha_collision (const Rect &lhs, cairo_surface_t *limage, const Rect &rhs, cairo_surface_t *rimage) |
Detect alpha collision between two images. | |
template<class T > | |
constexpr T | angle_diff (T angle_start, T angle_stop, bool clockwise=true) |
Compute the angle different between two angles. | |
template<class T > | |
constexpr T | bit (T n) |
Utility to create a bit mask for the specified bit. | |
cairo_format_t | cairo_format (PixelFormat format) |
Convert a PixelFormat to a cairo format. | |
template<> | |
constexpr bool | change_if_diff (double &old, const double &to) |
template<> | |
constexpr bool | change_if_diff (float &old, const float &to) |
template<class T > | |
constexpr bool | change_if_diff (T &old, const T &to) |
Utility to test and change a value if it is different. | |
template<class T > | |
constexpr const T & | clamp (const T &v, const T &lo, const T &hi) |
Clamp a value between a hi and low value. | |
template<class BinaryPredicate , class InputIterator1 , class InputIterator2 > | |
constexpr bool | cmp (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, BinaryPredicate pred) |
EGT_API std::string | cwd () |
Get the current working directory. | |
EGT_API std::string | demangle (const char *name) |
Demangle a C++ symbol into something human readable. | |
EGT_API Widget * | dragged () |
Get the current widget which is being dragged, or nullptr. | |
EGT_API void | dragged (Widget *widget) |
Set the current widget which is being dragged. | |
uint32_t | drm_format (PixelFormat format) |
Convert a pixel format to a DRM format. | |
PixelFormat | egt_format (cairo_format_t format) |
Convert a cairo format to a pixel format. | |
PixelFormat | egt_format (uint32_t format) |
Convert a DRM format to a pixel format. | |
template<class T > | |
constexpr T | enum_from_string (const char *value) |
Convert a string to an enum value. | |
template<class T > | |
constexpr T | enum_from_string (const std::string &value) |
Convert a string to an enum value. | |
template<class T > | |
constexpr const char * | enum_to_string (T const &e) |
Convert an enum to a string. | |
EGT_API std::string | exe_pwd () |
Get the directory to the current executable. | |
EGT_API bool | exists (const std::string &path) |
Determine if a file exists. | |
EGT_API std::string | extract_dirname (const std::string &path) |
Extract the directory name from a path. | |
EGT_API std::string | extract_filename (const std::string &path) |
Extract the filename portion of a path or URL. | |
template<class T > | |
constexpr T | fabs (T x, typename std::enable_if< std::is_floating_point< T >::value >::type *=nullptr) |
constexpr version of fabs/fabsf | |
EGT_API void | flex_layout (const Rect &parent, std::vector< LayoutRect > &children, Justification justify, Orientation orient) |
Perform a manual flex layout given a parent rect and children rects. | |
EGT_API void | flex_layout (const Rect &parent, std::vector< LayoutRect > &children, Justification justify, Orientation orient, const AlignFlags &align) |
Perform a manual flex layout with a parent and child rect, but allow a global child alignment with the align parameter. | |
constexpr bool | float_equal (const double f1, const double f2) |
Safe equal comparison of double values. | |
constexpr bool | float_equal (const float f1, const float f2) |
Safe equal comparison of float values. | |
template<class T > | |
std::string | format (T value, int precision=2) |
Format a float/double to a fixed precision and return as a string. | |
EGT_API bool | from_string (const std::string &x) |
Convert a lexical std::string to a bool. | |
EGT_API std::string | get_mime_type (const std::string &path) |
Return the mime type string for a file. | |
EGT_API std::string | get_mime_type (const void *buffer, size_t length) |
Return the mime type string for a buffer. | |
EGT_API std::vector< std::string > | glob (const std::string &pattern) |
Given a glob pattern, return a vector of matching path names. | |
std::string | gstreamer_format (PixelFormat format) |
Convert a pixel format to a gstreamer format. | |
constexpr unsigned int | hash (const char *str, int h=0) |
Perform a hash of a string. | |
unsigned int | hash (const std::string &str) |
Perform a hash of a string. | |
constexpr unsigned int | hextoul (const char *str, unsigned int base=16) |
Like, but not the same as strtoul(). | |
template<typename T > | |
void | ignoreparam (T &&) |
Utility function to safely ignore a parameter to a function. | |
EGT_API ImageCache & | image_cache () |
Global image cache instance. | |
template<class Functor , class T > | |
T | interpolate (Functor &&easing, T percent, T start, T end, bool reverse=false) |
Interpolate function used internally. | |
template<class T > | |
void | join (std::ostream &os, const T &container, const std::string &delimiter=",") |
Join each item of a container with the specified delimiter between each item. | |
EGT_API uint32_t | justify_to_contains (Justification justify, Orientation orient) |
Compute lib lay contains from @justify and @orient parameters. | |
EGT_API Widget * | keyboard_focus () |
Get the current widget which has the keyboard focus, or nullptr. | |
EGT_API void | keyboard_focus (Widget *widget) |
Set the keyboard focus of a widget. | |
EGT_API KeyboardCode | linux_to_ekey (int code) |
Map a Linux key code to an EKEY. | |
EGT_API shared_cairo_surface_t | load_image_from_filesystem (const std::string &path) |
Load an image from the filesystem. | |
EGT_API shared_cairo_surface_t | load_image_from_memory (const unsigned char *data, size_t len, const std::string &name={}) |
Load an image from memory. | |
EGT_API shared_cairo_surface_t | load_image_from_network (const std::string &url) |
Load an image from the network. | |
EGT_API shared_cairo_surface_t | load_image_from_resource (const std::string &name) |
Load an image from ResourceManager. | |
EGT_API std::string | ltrim (const std::string &source, const std::string &t=" \t\n\r") |
Trim delimiters off the left side of a std::string. | |
template<class T > | |
constexpr T | mmod (T a, T n) |
Floating point safe modulus function. | |
EGT_API Widget * | mouse_grab () |
Get the current widget which has the mouse grabbed, or nullptr. | |
EGT_API void | mouse_grab (Widget *widget) |
Set the current widget to grab the mouse. | |
template<typename InputIt , typename OutputIt > | |
constexpr OutputIt | move (InputIt b, InputIt e, OutputIt to) |
template<class T > | |
constexpr T | normalize (T value, T min, T max, T target_min, T target_max) |
Normalize a value, given its min and max, to a different target min and max. | |
template<class T > | |
constexpr T | normalize_to_angle (T value, T min, T max, T angle_start, T angle_stop, bool clockwise=true) |
Normalize a value, given its min and max, to a different target angle min and max. | |
template<class T > | |
ScopeExit< T > | on_scope_exit (T &&f) |
Helper to construct a ScopeExit with proper type deduction of the template parameter, which may be a lambda. | |
EGT_API char | path_separator () |
Get the separator character in a list of paths. | |
template<typename T > | |
constexpr T | pi () |
Returns the value of PI, accurate to the type used. | |
template<typename T > | |
constexpr T | pi_2 () |
Returns the value of PI/2, accurate to the type used. | |
EGT_API std::vector< unsigned char > | read_file (const std::string &path) |
Read the contents of a file into a vector. | |
EGT_API std::string | readlink (const std::string &path) |
Read the path of a symlink. | |
EGT_API std::string | replace_all (std::string str, const std::string &from, const std::string &to) |
Replace all in string. | |
EGT_API SchemeType | resolve_path (const std::string &path, std::string &result) |
Resolves a path to a type and path. | |
template<typename T > | |
ReverseRange< T > | reverse_iterate (T &x) |
Reverse iterator to work with C++11 range based for loops in a reverse order. | |
EGT_API std::string | rtrim (const std::string &source, const std::string &t=" \t\n\r") |
Trim delimiters off the right side of a std::string. | |
template<class T > | |
constexpr bool | rule_of_5 () |
Rule of 5 static assert all in one. | |
template<class T , std::size_t N> | |
constexpr std::size_t | size (const T(&)[N]) noexcept |
Return the size of an array (c++17's std::size()). | |
EGT_API void | strip (std::string &str, const std::string &t=" \t\n\r") |
Strip the specified characters from the string. | |
template<class T > | |
constexpr T | to_degrees (T radians) |
Convert from radians to degrees. | |
template<class T > | |
constexpr T | to_radians (T zero, T degrees) |
Convert from degrees to radians. | |
template<> | |
std::string | to_string (const bool &x) |
Convert a bool to a lexical std::string. | |
template<class T > | |
std::string | to_string (const T &x) |
Convert a type to a std::string using std::ostringstream. | |
EGT_API void | tokenize (const std::string &str, char delimiter, std::vector< std::string > &tokens) |
Tokenize a std::string. | |
EGT_API void | tolower (std::string &s) |
Convert a string to lowercase. | |
EGT_API void | toupper (std::string &s) |
Convert a string to lowercase. | |
EGT_API std::string | trim (const std::string &source, const std::string &t=" \t\n\r") |
Trim delimiters off both sides of a std::string. | |
EGT_API std::string | truncate (const std::string &str, size_t width, bool ellipsis=true) |
Truncate a string if applicable and optionally add ellipse to end. | |
Internal detail namespace.
The detail namespace is considered unstable and private to EGT. Use at your own risk.
using unique_plane_t = std::unique_ptr<plane_data, detail::plane_t_deleter> |
Unique pointer for a cairo context.
|
strong |
|
strong |
EGT_API std::string abspath | ( | const std::string & | path | ) |
Convert a relative path to an absolute path.
This is similar to POSIX.1-2001 realpath().
EGT_API Rect align_algorithm | ( | const Rect & | orig, |
const Rect & | bounding, | ||
const AlignFlags & | align, | ||
DefaultDim | padding = 0 , |
||
DefaultDim | horizontal_ratio = 0 , |
||
DefaultDim | vertical_ratio = 0 , |
||
DefaultDim | xratio = 0 , |
||
DefaultDim | yratio = 0 |
||
) |
Given an item size, and a bounding box, and an alignment parameter, return the rectangle the item box should be move/resized to.
[in] | orig | The default rect to use. |
[in] | bounding | The bounding box to position inside of. |
[in] | align | The alignment setting to use for positioning. |
[in] | padding | Padding to use when positioning. |
[in] | horizontal_ratio | Horizontal ratio value relative to bounding. |
[in] | vertical_ratio | Vertical ratio value relative to bounding. |
[in] | xratio | X ratio value relative to bounding. |
[in] | yratio | Y ratio value relative to bounding. |
EGT_API Rect align_algorithm_force | ( | const Rect & | orig, |
const Rect & | bounding, | ||
const AlignFlags & | align, | ||
DefaultDim | padding = 0 , |
||
DefaultDim | horizontal_ratio = 0 , |
||
DefaultDim | vertical_ratio = 0 , |
||
DefaultDim | xratio = 0 , |
||
DefaultDim | yratio = 0 |
||
) |
EGT_API uint32_t align_to_behave | ( | const AlignFlags & | align | ) |
Compute lib lay behave from @align flags.
Detect alpha collision with a specific point.
This basically tests if the pixel at rhs is opaque.
lhs specified the origin with its point(). rhs is relative to this origin. lhs.size() should be the same size as the limage.
[in] | lhs | The origin and size of the limage surface. |
[in] | limage | The image surface. |
[in] | rhs | The point to test. |
EGT_API bool alpha_collision | ( | const Rect & | lhs, |
cairo_surface_t * | limage, | ||
const Rect & | rhs, | ||
cairo_surface_t * | rimage | ||
) |
Detect alpha collision between two images.
This tests if any pixel from limage inside of lhs is opaque at the same time it overlaps with an opaque pixel from rimage in rhs.
[in] | lhs | The origin and size of the limage surface. |
[in] | limage | The first image surface. |
[in] | rhs | The origin and size of the rimage surface. |
[in] | rimage | The second image surface. |
|
constexpr |
Compute the angle different between two angles.
|
constexpr |
Utility to create a bit mask for the specified bit.
[in] | n | The bit number. |
cairo_format_t cairo_format | ( | PixelFormat | format | ) |
Convert a PixelFormat to a cairo format.
|
constexpr |
old | Reference to the old value. |
to | Potential new value. |
|
constexpr |
old | Reference to the old value. |
to | Potential new value. |
|
constexpr |
Utility to test and change a value if it is different.
This is a very common pattern used by Widget functions to determine whether damage() should be called when a property is changed.
old | Reference to the old value. |
to | Potential new value. |
|
constexpr |
Clamp a value between a hi and low value.
|
constexpr |
EGT_API std::string cwd | ( | ) |
Get the current working directory.
EGT_API std::string demangle | ( | const char * | name | ) |
Demangle a C++ symbol into something human readable.
|
protected |
Get the current widget which is being dragged, or nullptr.
|
protected |
Set the current widget which is being dragged.
uint32_t drm_format | ( | PixelFormat | format | ) |
Convert a pixel format to a DRM format.
PixelFormat egt_format | ( | cairo_format_t | format | ) |
Convert a cairo format to a pixel format.
PixelFormat egt_format | ( | uint32_t | format | ) |
Convert a DRM format to a pixel format.
|
constexpr |
Convert a string to an enum value.
|
constexpr |
Convert a string to an enum value.
|
constexpr |
Convert an enum to a string.
EGT_API std::string exe_pwd | ( | ) |
Get the directory to the current executable.
EGT_API bool exists | ( | const std::string & | path | ) |
Determine if a file exists.
[in] | path | File path. |
EGT_API std::string extract_dirname | ( | const std::string & | path | ) |
Extract the directory name from a path.
[in] | path | File or directory path. |
EGT_API std::string extract_filename | ( | const std::string & | path | ) |
Extract the filename portion of a path or URL.
[in] | path | File path or URL. |
|
constexpr |
constexpr version of fabs/fabsf
EGT_API void flex_layout | ( | const Rect & | parent, |
std::vector< LayoutRect > & | children, | ||
Justification | justify, | ||
Orientation | orient | ||
) |
Perform a manual flex layout given a parent rect and children rects.
EGT_API void flex_layout | ( | const Rect & | parent, |
std::vector< LayoutRect > & | children, | ||
Justification | justify, | ||
Orientation | orient, | ||
const AlignFlags & | align | ||
) |
Perform a manual flex layout with a parent and child rect, but allow a global child alignment with the align parameter.
|
constexpr |
Safe equal comparison of double values.
|
constexpr |
Safe equal comparison of float values.
std::string format | ( | T | value, |
int | precision = 2 |
||
) |
Format a float/double to a fixed precision and return as a string.
EGT_API bool from_string | ( | const std::string & | x | ) |
Convert a lexical std::string to a bool.
EGT_API std::string get_mime_type | ( | const std::string & | path | ) |
Return the mime type string for a file.
This uses libmagic to identify the file if available. The default database file will be used. To override this, you can specify the path to the database file in the MAGIC environment variable.
EGT_API std::string get_mime_type | ( | const void * | buffer, |
size_t | length | ||
) |
Return the mime type string for a buffer.
This uses libmagic to identify the buffer if available. The default database file will be used. To override this, you can specify the path to the database file in the MAGIC environment variable.
EGT_API std::vector< std::string > glob | ( | const std::string & | pattern | ) |
Given a glob pattern, return a vector of matching path names.
std::string gstreamer_format | ( | PixelFormat | format | ) |
Convert a pixel format to a gstreamer format.
|
constexpr |
Perform a hash of a string.
|
inline |
Perform a hash of a string.
|
constexpr |
Like, but not the same as strtoul().
The idea here is a constexpr function to convert a character string to an integer without a whole lot of error checking.
void ignoreparam | ( | T && | ) |
Utility function to safely ignore a parameter to a function.
EGT_API ImageCache & image_cache | ( | ) |
Global image cache instance.
T interpolate | ( | Functor && | easing, |
T | percent, | ||
T | start, | ||
T | end, | ||
bool | reverse = false |
||
) |
Interpolate function used internally.
[in] | easing | The easing function to use. |
[in] | percent | The current percent of the range. |
[in] | start | Starting value. |
[in] | end | Ending value. |
[in] | reverse | Should we reverse start and end. |
void join | ( | std::ostream & | os, |
const T & | container, | ||
const std::string & | delimiter = "," |
||
) |
Join each item of a container with the specified delimiter between each item.
EGT_API uint32_t justify_to_contains | ( | Justification | justify, |
Orientation | orient | ||
) |
Compute lib lay contains from @justify and @orient parameters.
|
protected |
Get the current widget which has the keyboard focus, or nullptr.
|
protected |
Set the keyboard focus of a widget.
This will result in calling EventId::on_gain_focus for the new widget and EventId::on_lost_focus for any previous widget.
EGT_API KeyboardCode linux_to_ekey | ( | int | code | ) |
Map a Linux key code to an EKEY.
EGT_API shared_cairo_surface_t load_image_from_filesystem | ( | const std::string & | path | ) |
Load an image from the filesystem.
EGT_API shared_cairo_surface_t load_image_from_memory | ( | const unsigned char * | data, |
size_t | len, | ||
const std::string & | name = {} |
||
) |
Load an image from memory.
EGT_API shared_cairo_surface_t load_image_from_network | ( | const std::string & | url | ) |
Load an image from the network.
EGT_API shared_cairo_surface_t load_image_from_resource | ( | const std::string & | name | ) |
Load an image from ResourceManager.
EGT_API std::string ltrim | ( | const std::string & | source, |
const std::string & | t = " \t\n\r" |
||
) |
Trim delimiters off the left side of a std::string.
|
constexpr |
Floating point safe modulus function.
|
protected |
Get the current widget which has the mouse grabbed, or nullptr.
|
protected |
Set the current widget to grab the mouse.
[in] | widget | The widget to grab all mouse events, or nullptr. |
|
constexpr |
|
constexpr |
Normalize a value, given its min and max, to a different target min and max.
value | The value between min and max. |
min | The minimum value. |
max | The maximum value. |
target_min | The minimum of the range of your desired target scaling. |
target_max | The maximum of the range of your desired target scaling. |
|
constexpr |
Normalize a value, given its min and max, to a different target angle min and max.
value | The value between min and max. |
min | The minimum value. |
max | The maximum value. |
angle_start | The minimum of the range of your desired target angle. |
angle_stop | The maximum of the range of your desired target angle. |
clockwise | Direction is clockwise. |
ScopeExit< T > on_scope_exit | ( | T && | f | ) |
Helper to construct a ScopeExit with proper type deduction of the template parameter, which may be a lambda.
EGT_API char path_separator | ( | ) |
Get the separator character in a list of paths.
Used, for instance, in EGT_SEARCH_PATH. It should be ':' on Linux and ';' on Windows.
|
constexpr |
Returns the value of PI, accurate to the type used.
|
constexpr |
Returns the value of PI/2, accurate to the type used.
EGT_API std::vector< unsigned char > read_file | ( | const std::string & | path | ) |
Read the contents of a file into a vector.
[in] | path | File path. |
EGT_API std::string readlink | ( | const std::string & | path | ) |
Read the path of a symlink.
[in] | path | Symlink path. |
EGT_API std::string replace_all | ( | std::string | str, |
const std::string & | from, | ||
const std::string & | to | ||
) |
Replace all in string.
EGT_API SchemeType resolve_path | ( | const std::string & | path, |
std::string & | result | ||
) |
Resolves a path to a type and path.
This will use resolve_file_path() as appropriate.
ReverseRange< T > reverse_iterate | ( | T & | x | ) |
Reverse iterator to work with C++11 range based for loops in a reverse order.
EGT_API std::string rtrim | ( | const std::string & | source, |
const std::string & | t = " \t\n\r" |
||
) |
Trim delimiters off the right side of a std::string.
|
constexpr |
Rule of 5 static assert all in one.
Example usage is intended for static_assert:
|
constexprprotectednoexcept |
Return the size of an array (c++17's std::size()).
EGT_API void strip | ( | std::string & | str, |
const std::string & | t = " \t\n\r" |
||
) |
Strip the specified characters from the string.
|
constexpr |
Convert from radians to degrees.
|
constexpr |
Convert from degrees to radians.
|
inline |
Convert a bool to a lexical std::string.
std::string to_string | ( | const T & | x | ) |
Convert a type to a std::string using std::ostringstream.
EGT_API void tokenize | ( | const std::string & | str, |
char | delimiter, | ||
std::vector< std::string > & | tokens | ||
) |
Tokenize a std::string.
EGT_API void tolower | ( | std::string & | s | ) |
Convert a string to lowercase.
EGT_API void toupper | ( | std::string & | s | ) |
Convert a string to lowercase.
EGT_API std::string trim | ( | const std::string & | source, |
const std::string & | t = " \t\n\r" |
||
) |
Trim delimiters off both sides of a std::string.
EGT_API std::string truncate | ( | const std::string & | str, |
size_t | width, | ||
bool | ellipsis = true |
||
) |
Truncate a string if applicable and optionally add ellipse to end.