1.8
Classes | Typedefs | Enumerations | Functions
egt::v1::detail Namespace Reference

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. More...
 

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. More...
 
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. More...
 
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() More...
 
EGT_API uint32_t align_to_behave (const AlignFlags &align)
 Compute lib lay behave from @align flags. More...
 
EGT_API bool alpha_collision (const Rect &lhs, cairo_surface_t *limage, const Point &rhs)
 Detect alpha collision with a specific point. More...
 
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. More...
 
template<class T >
constexpr T angle_diff (T angle_start, T angle_stop, bool clockwise=true)
 Compute the angle different between two angles. More...
 
template<class T >
constexpr T bit (T n)
 Utility to create a bit mask for the specified bit. More...
 
cairo_format_t cairo_format (PixelFormat format)
 Convert a PixelFormat to a cairo format. More...
 
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. More...
 
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. More...
 
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. More...
 
EGT_API std::string demangle (const char *name)
 Demangle a C++ symbol into something human readable. More...
 
EGT_API void draw_text (Painter &painter, const Rect &b, const std::string &text, const Font &font, const TextBox::TextFlags &flags, const AlignFlags &text_align, Justification justify, const Pattern &text_color, const AlignFlags &image_align, const Image &image, const std::function< void(const Point &offset, size_t height)> &draw_cursor=nullptr, size_t cursor_pos=0, const Pattern &highlight_color={}, size_t select_start=0, size_t select_len=0)
 Internal draw text function with associated image. More...
 
EGT_API void draw_text (Painter &painter, const Rect &b, const std::string &text, const Font &font, const TextBox::TextFlags &flags, const AlignFlags &text_align, Justification justify, const Pattern &text_color, const std::function< void(const Point &offset, size_t height)> &draw_cursor=nullptr, size_t cursor_pos=0, const Pattern &highlight_color={}, size_t select_start=0, size_t select_len=0)
 Internal draw text function. More...
 
uint32_t drm_format (PixelFormat format)
 Convert a pixel format to a DRM format. More...
 
PixelFormat egt_format (cairo_format_t format)
 Convert a cairo format to a pixel format. More...
 
PixelFormat egt_format (uint32_t format)
 Convert a DRM format to a pixel format. More...
 
template<class T >
constexpr T enum_from_string (const char *value)
 Convert a string to an enum value. More...
 
template<class T >
constexpr T enum_from_string (const std::string &value)
 Convert a string to an enum value. More...
 
template<class T >
constexpr const char * enum_to_string (T const &e)
 Convert an enum to a string. More...
 
EGT_API std::string exe_pwd ()
 Get the directory to the current executable. More...
 
EGT_API bool exists (const std::string &path)
 Determine if a file exists. More...
 
EGT_API std::string extract_dirname (const std::string &path)
 Extract the directory name from a path. More...
 
EGT_API std::string extract_filename (const std::string &path)
 Extract the filename portion of a path or URL. More...
 
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 More...
 
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. More...
 
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. More...
 
constexpr bool float_equal (const double f1, const double f2)
 Safe equal comparison of double values. More...
 
constexpr bool float_equal (const float f1, const float f2)
 Safe equal comparison of float values. More...
 
template<class T >
std::string format (T value, int precision=2)
 Format a float/double to a fixed precision and return as a string. More...
 
EGT_API bool from_string (const std::string &x)
 Convert a lexical std::string to a bool. More...
 
EGT_API std::string get_mime_type (const std::string &path)
 Return the mime type string for a file. More...
 
EGT_API std::string get_mime_type (const void *buffer, size_t length)
 Return the mime type string for a buffer. More...
 
EGT_API std::vector< std::string > glob (const std::string &pattern)
 Given a glob pattern, return a vector of matching path names. More...
 
std::string gstreamer_format (PixelFormat format)
 Convert a pixel format to a gstreamer format. More...
 
constexpr unsigned int hash (const char *str, int h=0)
 Perform a hash of a string. More...
 
unsigned int hash (const std::string &str)
 Perform a hash of a string. More...
 
constexpr unsigned int hextoul (const char *str, unsigned int base=16)
 Like, but not the same as strtoul(). More...
 
template<typename T >
void ignoreparam (T &&)
 Utility function to safely ignore a parameter to a function. More...
 
EGT_API ImageCacheimage_cache ()
 Global image cache instance. More...
 
template<class Functor , class T >
interpolate (Functor &&easing, T percent, T start, T end, bool reverse=false)
 Interpolate function used internally. More...
 
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. More...
 
EGT_API uint32_t justify_to_contains (Justification justify, Orientation orient)
 Compute lib lay contains from @justify and @orient parameters. More...
 
EGT_API Widgetkeyboard_focus ()
 Get the current widget which has the keyboard focus, or nullptr. More...
 
EGT_API void keyboard_focus (Widget *widget)
 Set the keyboard focus of a widget. More...
 
EGT_API KeyboardCode linux_to_ekey (int code)
 Map a Linux key code to an EKEY. More...
 
EGT_API shared_cairo_surface_t load_image_from_filesystem (const std::string &path)
 Load an image from the filesystem. More...
 
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. More...
 
EGT_API shared_cairo_surface_t load_image_from_network (const std::string &url)
 Load an image from the network. More...
 
EGT_API shared_cairo_surface_t load_image_from_resource (const std::string &name)
 Load an image from ResourceManager. More...
 
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. More...
 
template<class T >
constexpr T mmod (T a, T n)
 Floating point safe modulus function. More...
 
EGT_API Widgetmouse_grab ()
 Get the current widget which has the mouse grabbed, or nullptr. More...
 
EGT_API void mouse_grab (Widget *widget)
 Set the current widget to grab the mouse. More...
 
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. More...
 
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. More...
 
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. More...
 
EGT_API char path_separator ()
 Get the separator character in a list of paths. More...
 
template<typename T >
constexpr T pi ()
 Returns the value of PI, accurate to the type used. More...
 
template<typename T >
constexpr T pi_2 ()
 Returns the value of PI/2, accurate to the type used. More...
 
EGT_API std::vector< unsigned char > read_file (const std::string &path)
 Read the contents of a file into a vector. More...
 
cairo_status_t EGT_API read_resource_stream (void *closure, unsigned char *data, unsigned int length)
 Helper function specifically for cairo's cairo_image_surface_create_from_png_stream(). More...
 
EGT_API std::string readlink (const std::string &path)
 Read the path of a symlink. More...
 
EGT_API std::string replace_all (std::string str, const std::string &from, const std::string &to)
 Replace all in string. More...
 
EGT_API SchemeType resolve_path (const std::string &path, std::string &result)
 Resolves a path to a type and path. More...
 
template<typename T >
ReverseRange< T > reverse_iterate (T &x)
 Reverse iterator to work with C++11 range based for loops in a reverse order. More...
 
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. More...
 
template<class T >
constexpr bool rule_of_5 ()
 Rule of 5 static assert all in one. More...
 
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()). More...
 
EGT_API void strip (std::string &str, const std::string &t=" \t\n\r")
 Strip the specified characters from the string. More...
 
template<class T >
constexpr T to_degrees (T radians)
 Convert from radians to degrees. More...
 
template<class T >
constexpr T to_radians (T zero, T degrees)
 Convert from degrees to radians. More...
 
template<>
std::string to_string (const bool &x)
 Convert a bool to a lexical std::string. More...
 
template<class T >
std::string to_string (const T &x)
 Convert a type to a std::string using std::ostringstream. More...
 
EGT_API void tokenize (const std::string &str, char delimiter, std::vector< std::string > &tokens)
 Tokenize a std::string. More...
 
EGT_API void tolower (std::string &s)
 Convert a string to lowercase. More...
 
EGT_API void toupper (std::string &s)
 Convert a string to lowercase. More...
 
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. More...
 
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. More...
 

Detailed Description

Internal detail namespace.

The detail namespace is considered unstable and private to EGT. Use at your own risk.

Typedef Documentation

◆ unique_plane_t

using unique_plane_t = std::unique_ptr<plane_data, detail::plane_t_deleter>

Unique pointer for a cairo context.

Enumeration Type Documentation

◆ Compatible

enum Compatible
strong

Geometry types compatibility type.

This is used to create strong incompatible types as a template argument.

Enumerator
normal 
display 
grid 

◆ SchemeType

enum SchemeType
strong

URI scheme types.

Enumerator
unknown 
resource 
filesystem 
network 

Function Documentation

◆ abspath()

EGT_API std::string egt::v1::detail::abspath ( const std::string &  path)

Convert a relative path to an absolute path.

This is similar to POSIX.1-2001 realpath().

◆ align_algorithm()

EGT_API Rect egt::v1::detail::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.

Parameters
[in]origThe default rect to use.
[in]boundingThe bounding box to position inside of.
[in]alignThe alignment setting to use for positioning.
[in]paddingPadding to use when positioning.
[in]horizontal_ratioHorizontal ratio value relative to bounding.
[in]vertical_ratioVertical ratio value relative to bounding.
[in]xratioX ratio value relative to bounding.
[in]yratioY ratio value relative to bounding.

◆ align_algorithm_force()

EGT_API Rect egt::v1::detail::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_to_behave()

EGT_API uint32_t egt::v1::detail::align_to_behave ( const AlignFlags align)

Compute lib lay behave from @align flags.

◆ alpha_collision() [1/2]

EGT_API bool egt::v1::detail::alpha_collision ( const Rect lhs,
cairo_surface_t *  limage,
const Point rhs 
)

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.

Parameters
[in]lhsThe origin and size of the limage surface.
[in]limageThe image surface.
[in]rhsThe point to test.

◆ alpha_collision() [2/2]

EGT_API bool egt::v1::detail::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.

Parameters
[in]lhsThe origin and size of the limage surface.
[in]limageThe first image surface.
[in]rhsThe origin and size of the rimage surface.
[in]rimageThe second image surface.

◆ angle_diff()

constexpr T egt::v1::detail::angle_diff ( angle_start,
angle_stop,
bool  clockwise = true 
)
constexpr

Compute the angle different between two angles.

◆ bit()

constexpr T egt::v1::detail::bit ( n)
constexpr

Utility to create a bit mask for the specified bit.

Parameters
[in]nThe bit number.

◆ cairo_format()

cairo_format_t egt::v1::detail::cairo_format ( PixelFormat  format)

Convert a PixelFormat to a cairo format.

◆ change_if_diff() [1/3]

constexpr bool egt::v1::detail::change_if_diff ( double &  old,
const double &  to 
)
constexpr
Parameters
oldReference to the old value.
toPotential new value.

◆ change_if_diff() [2/3]

constexpr bool egt::v1::detail::change_if_diff ( float &  old,
const float &  to 
)
constexpr
Parameters
oldReference to the old value.
toPotential new value.

◆ change_if_diff() [3/3]

constexpr bool egt::v1::detail::change_if_diff ( T &  old,
const T &  to 
)
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.

Parameters
oldReference to the old value.
toPotential new value.
Returns
true if the value was changed.

◆ clamp()

constexpr const T& egt::v1::detail::clamp ( const T &  v,
const T &  lo,
const T &  hi 
)
constexpr

Clamp a value between a hi and low value.

◆ cmp()

constexpr bool egt::v1::detail::cmp ( InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2,
InputIterator2  last2,
BinaryPredicate  pred 
)
constexpr

◆ cwd()

EGT_API std::string egt::v1::detail::cwd ( )

Get the current working directory.

◆ demangle()

EGT_API std::string egt::v1::detail::demangle ( const char *  name)

Demangle a C++ symbol into something human readable.

detail::demangle(typeid(*this).name());
EGT_API std::string demangle(const char *name)
Demangle a C++ symbol into something human readable.
Note
This is g++ specific.

◆ draw_text() [1/2]

EGT_API void egt::v1::detail::draw_text ( Painter painter,
const Rect b,
const std::string &  text,
const Font font,
const TextBox::TextFlags flags,
const AlignFlags text_align,
Justification  justify,
const Pattern text_color,
const AlignFlags image_align,
const Image image,
const std::function< void(const Point &offset, size_t height)> &  draw_cursor = nullptr,
size_t  cursor_pos = 0,
const Pattern highlight_color = {},
size_t  select_start = 0,
size_t  select_len = 0 
)

Internal draw text function with associated image.

◆ draw_text() [2/2]

EGT_API void egt::v1::detail::draw_text ( Painter painter,
const Rect b,
const std::string &  text,
const Font font,
const TextBox::TextFlags flags,
const AlignFlags text_align,
Justification  justify,
const Pattern text_color,
const std::function< void(const Point &offset, size_t height)> &  draw_cursor = nullptr,
size_t  cursor_pos = 0,
const Pattern highlight_color = {},
size_t  select_start = 0,
size_t  select_len = 0 
)

Internal draw text function.

◆ drm_format()

uint32_t egt::v1::detail::drm_format ( PixelFormat  format)

Convert a pixel format to a DRM format.

◆ egt_format() [1/2]

PixelFormat egt::v1::detail::egt_format ( cairo_format_t  format)

Convert a cairo format to a pixel format.

◆ egt_format() [2/2]

PixelFormat egt::v1::detail::egt_format ( uint32_t  format)

Convert a DRM format to a pixel format.

◆ enum_from_string() [1/2]

constexpr T egt::v1::detail::enum_from_string ( const char *  value)
constexpr

Convert a string to an enum value.

◆ enum_from_string() [2/2]

constexpr T egt::v1::detail::enum_from_string ( const std::string &  value)
constexpr

Convert a string to an enum value.

◆ enum_to_string()

constexpr const char* egt::v1::detail::enum_to_string ( T const &  e)
constexpr

Convert an enum to a string.

◆ exe_pwd()

EGT_API std::string egt::v1::detail::exe_pwd ( )

Get the directory to the current executable.

◆ exists()

EGT_API bool egt::v1::detail::exists ( const std::string &  path)

Determine if a file exists.

Parameters
[in]pathFile path.

◆ extract_dirname()

EGT_API std::string egt::v1::detail::extract_dirname ( const std::string &  path)

Extract the directory name from a path.

Parameters
[in]pathFile or directory path.

◆ extract_filename()

EGT_API std::string egt::v1::detail::extract_filename ( const std::string &  path)

Extract the filename portion of a path or URL.

Parameters
[in]pathFile path or URL.

◆ fabs()

constexpr T egt::v1::detail::fabs ( x,
typename std::enable_if< std::is_floating_point< T >::value >::type *  = nullptr 
)
constexpr

constexpr version of fabs/fabsf

◆ flex_layout() [1/2]

EGT_API void egt::v1::detail::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.

◆ flex_layout() [2/2]

EGT_API void egt::v1::detail::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.

◆ float_equal() [1/2]

constexpr bool egt::v1::detail::float_equal ( const double  f1,
const double  f2 
)
constexpr

Safe equal comparison of double values.

◆ float_equal() [2/2]

constexpr bool egt::v1::detail::float_equal ( const float  f1,
const float  f2 
)
constexpr

Safe equal comparison of float values.

◆ format()

std::string egt::v1::detail::format ( value,
int  precision = 2 
)

Format a float/double to a fixed precision and return as a string.

◆ from_string()

EGT_API bool egt::v1::detail::from_string ( const std::string &  x)

Convert a lexical std::string to a bool.

◆ get_mime_type() [1/2]

EGT_API std::string egt::v1::detail::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.

◆ get_mime_type() [2/2]

EGT_API std::string egt::v1::detail::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.

◆ glob()

EGT_API std::vector<std::string> egt::v1::detail::glob ( const std::string &  pattern)

Given a glob pattern, return a vector of matching path names.

◆ gstreamer_format()

std::string egt::v1::detail::gstreamer_format ( PixelFormat  format)

Convert a pixel format to a gstreamer format.

◆ hash() [1/2]

constexpr unsigned int egt::v1::detail::hash ( const char *  str,
int  h = 0 
)
constexpr

Perform a hash of a string.

◆ hash() [2/2]

unsigned int egt::v1::detail::hash ( const std::string &  str)
inline

Perform a hash of a string.

◆ hextoul()

constexpr unsigned int egt::v1::detail::hextoul ( const char *  str,
unsigned int  base = 16 
)
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.

◆ ignoreparam()

void egt::v1::detail::ignoreparam ( T &&  )

Utility function to safely ignore a parameter to a function.

◆ image_cache()

EGT_API ImageCache& egt::v1::detail::image_cache ( )

Global image cache instance.

◆ interpolate()

T egt::v1::detail::interpolate ( Functor &&  easing,
percent,
start,
end,
bool  reverse = false 
)

Interpolate function used internally.

Parameters
[in]easingThe easing function to use.
[in]percentThe current percent of the range.
[in]startStarting value.
[in]endEnding value.
[in]reverseShould we reverse start and end.

◆ join()

void egt::v1::detail::join ( std::ostream &  os,
const T &  container,
const std::string &  delimiter = "," 
)

Join each item of a container with the specified delimiter between each item.

◆ justify_to_contains()

EGT_API uint32_t egt::v1::detail::justify_to_contains ( Justification  justify,
Orientation  orient 
)

Compute lib lay contains from @justify and @orient parameters.

◆ keyboard_focus() [1/2]

EGT_API Widget* egt::v1::detail::keyboard_focus ( )

Get the current widget which has the keyboard focus, or nullptr.

◆ keyboard_focus() [2/2]

EGT_API void egt::v1::detail::keyboard_focus ( Widget widget)

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.

◆ linux_to_ekey()

EGT_API KeyboardCode egt::v1::detail::linux_to_ekey ( int  code)

Map a Linux key code to an EKEY.

◆ load_image_from_filesystem()

EGT_API shared_cairo_surface_t egt::v1::detail::load_image_from_filesystem ( const std::string &  path)

Load an image from the filesystem.

◆ load_image_from_memory()

EGT_API shared_cairo_surface_t egt::v1::detail::load_image_from_memory ( const unsigned char *  data,
size_t  len,
const std::string &  name = {} 
)

Load an image from memory.

◆ load_image_from_network()

EGT_API shared_cairo_surface_t egt::v1::detail::load_image_from_network ( const std::string &  url)

Load an image from the network.

◆ load_image_from_resource()

EGT_API shared_cairo_surface_t egt::v1::detail::load_image_from_resource ( const std::string &  name)

Load an image from ResourceManager.

See also
ResourceManager

◆ ltrim()

EGT_API std::string egt::v1::detail::ltrim ( const std::string &  source,
const std::string &  t = " \t\n\r" 
)

Trim delimiters off the left side of a std::string.

◆ mmod()

constexpr T egt::v1::detail::mmod ( a,
n 
)
constexpr

Floating point safe modulus function.

◆ mouse_grab() [1/2]

EGT_API Widget* egt::v1::detail::mouse_grab ( )

Get the current widget which has the mouse grabbed, or nullptr.

◆ mouse_grab() [2/2]

EGT_API void egt::v1::detail::mouse_grab ( Widget widget)

Set the current widget to grab the mouse.

Parameters
[in]widgetThe widget to grab all mouse events, or nullptr.

◆ move()

constexpr OutputIt egt::v1::detail::move ( InputIt  b,
InputIt  e,
OutputIt  to 
)
constexpr

◆ normalize()

constexpr T egt::v1::detail::normalize ( value,
min,
max,
target_min,
target_max 
)
constexpr

Normalize a value, given its min and max, to a different target min and max.

Parameters
valueThe value between min and max.
minThe minimum value.
maxThe maximum value.
target_minThe minimum of the range of your desired target scaling.
target_maxThe maximum of the range of your desired target scaling.

◆ normalize_to_angle()

constexpr T egt::v1::detail::normalize_to_angle ( value,
min,
max,
angle_start,
angle_stop,
bool  clockwise = true 
)
constexpr

Normalize a value, given its min and max, to a different target angle min and max.

Parameters
valueThe value between min and max.
minThe minimum value.
maxThe maximum value.
angle_startThe minimum of the range of your desired target angle.
angle_stopThe maximum of the range of your desired target angle.
clockwiseDirection is clockwise.

◆ on_scope_exit()

ScopeExit<T> egt::v1::detail::on_scope_exit ( T &&  f)

Helper to construct a ScopeExit with proper type deduction of the template parameter, which may be a lambda.

◆ path_separator()

EGT_API char egt::v1::detail::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.

◆ pi()

constexpr T egt::v1::detail::pi ( )
constexpr

Returns the value of PI, accurate to the type used.

◆ pi_2()

constexpr T egt::v1::detail::pi_2 ( )
constexpr

Returns the value of PI/2, accurate to the type used.

◆ read_file()

EGT_API std::vector<unsigned char> egt::v1::detail::read_file ( const std::string &  path)

Read the contents of a file into a vector.

Parameters
[in]pathFile path.

◆ read_resource_stream()

cairo_status_t EGT_API egt::v1::detail::read_resource_stream ( void *  closure,
unsigned char *  data,
unsigned int  length 
)

Helper function specifically for cairo's cairo_image_surface_create_from_png_stream().

◆ readlink()

EGT_API std::string egt::v1::detail::readlink ( const std::string &  path)

Read the path of a symlink.

Parameters
[in]pathSymlink path.

◆ replace_all()

EGT_API std::string egt::v1::detail::replace_all ( std::string  str,
const std::string &  from,
const std::string &  to 
)

Replace all in string.

◆ resolve_path()

EGT_API SchemeType egt::v1::detail::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.

◆ reverse_iterate()

ReverseRange<T> egt::v1::detail::reverse_iterate ( T &  x)

Reverse iterator to work with C++11 range based for loops in a reverse order.

for (auto& child : detail::reverse_iterate(children))
{
...
}
ReverseRange< T > reverse_iterate(T &x)
Reverse iterator to work with C++11 range based for loops in a reverse order.
Definition: meta.h:139

◆ rtrim()

EGT_API std::string egt::v1::detail::rtrim ( const std::string &  source,
const std::string &  t = " \t\n\r" 
)

Trim delimiters off the right side of a std::string.

◆ rule_of_5()

constexpr bool egt::v1::detail::rule_of_5 ( )
constexpr

Rule of 5 static assert all in one.

Example usage is intended for static_assert:

static_assert(detail::rule_of_5<Color>(), "must fulfill rule of 5");

◆ size()

constexpr std::size_t egt::v1::detail::size ( const   T(&)[N])
constexprnoexcept

Return the size of an array (c++17's std::size()).

◆ strip()

EGT_API void egt::v1::detail::strip ( std::string &  str,
const std::string &  t = " \t\n\r" 
)

Strip the specified characters from the string.

◆ to_degrees()

constexpr T egt::v1::detail::to_degrees ( radians)
constexpr

Convert from radians to degrees.

◆ to_radians()

constexpr T egt::v1::detail::to_radians ( zero,
degrees 
)
constexpr

Convert from degrees to radians.

◆ to_string() [1/2]

std::string egt::v1::detail::to_string ( const bool &  x)
inline

Convert a bool to a lexical std::string.

◆ to_string() [2/2]

std::string egt::v1::detail::to_string ( const T &  x)

Convert a type to a std::string using std::ostringstream.

◆ tokenize()

EGT_API void egt::v1::detail::tokenize ( const std::string &  str,
char  delimiter,
std::vector< std::string > &  tokens 
)

Tokenize a std::string.

◆ tolower()

EGT_API void egt::v1::detail::tolower ( std::string &  s)

Convert a string to lowercase.

Note
Not UTF-8 aware.

◆ toupper()

EGT_API void egt::v1::detail::toupper ( std::string &  s)

Convert a string to lowercase.

Note
Not UTF-8 aware.

◆ trim()

EGT_API std::string egt::v1::detail::trim ( const std::string &  source,
const std::string &  t = " \t\n\r" 
)

Trim delimiters off both sides of a std::string.

◆ truncate()

EGT_API std::string egt::v1::detail::truncate ( const std::string &  str,
size_t  width,
bool  ellipsis = true 
)

Truncate a string if applicable and optionally add ellipse to end.