114 template<
typename View,
typename Signature>
class UIDelegate;
120 template<
typename View,
typename R,
typename... Args>
class UIDelegate<View,
R(Args...)> {
140 : mDelegate([value =
std::
forward<
R>(value)](View&, Args...) {
return value; }) {}
149 return mDelegate(*view, std::forward<Args>(args)...);
156 template<
typename View,
typename... Args>
class UIDelegate<View,
void(Args...)> {
173 : mDelegate(delegate) {}
182 mDelegate(*view, std::forward<Args>(args)...);
229 for(
auto& value :
list) {
230 if constexpr(std::is_pointer_v<T>) {
231 (value->*
member)(args...);
248 for(
auto& value :
list) {
249 auto invoke = [&]() {
250 if constexpr(std::is_pointer_v<T>) {
251 return (value->*
member)(args...);
253 return (value.*
member)(args...);
257 if(
auto ret = invoke()) {
#define CE_ASSERT(...)
Definition Macros.hpp:323
#define CE_EXPLICIT(EXPR)
Definition Macros.hpp:413
UniqueFunction< R(View &, Args...) const > DelegateType
Definition UIUtility.hpp:124
R operator()(View *const view, Args... args) const
Definition UIUtility.hpp:146
friend View
Definition UIUtility.hpp:121
void operator()(View *const view, Args... args) const
Definition UIUtility.hpp:179
UniqueFunction< void(View &, Args...) const > DelegateType
Definition UIUtility.hpp:160
friend View
Definition UIUtility.hpp:157
Definition UIUtility.hpp:114
The infrastructure for drawing and handling events in a UI.
Definition UIView.hpp:153
A window that an app displays on the screen.
Definition UIWindow.hpp:42
Definition Application.hpp:19
Color UIColor
Definition UIUtility.hpp:187
Size2 UISize
A type that contains width and height values.
Definition UIUtility.hpp:30
Rect2Edge UIEdgeInsets
The inset distances for views.
Definition UIUtility.hpp:42
void broadcast(MemberPtr &&member, const Vector< T > &list, Args &&... args)
Helper function that calls MemberPtr on all elements in list.
Definition UIUtility.hpp:228
const UIRect UIRectZero
A zero UI rectangle.
std::vector< T, ScopedAllocatorAdaptor< StdAllocator< T, RawAllocator > > > Vector
Vector is a sequence container that encapsulates dynamic size arrays.
Definition Vector.hpp:17
auto broadcastIf(MemberPtr &&member, const Vector< T > &list, Args &&... args)
Helper function that calls MemberPtr on all elements in list.
Definition UIUtility.hpp:247
UITextAlignment
These constants specify text alignment.
Definition UIUtility.hpp:100
@ Justified
Text is justified.
@ Center
Text is visually center aligned.
Rect2 UIRect
A structure that contains the location and dimensions of a rectangle.
Definition UIUtility.hpp:33
@ Color
Attachment is used for color output.
UITextureScaling
Constants that specify a view's texture scaling behavior.
Definition UIUtility.hpp:82
@ ProportionallyUpOrDown
Scale the texture to its maximum possible dimensions while both staying within the destination area a...
@ AxesIndependently
Scale each dimension to exactly fit destination.
@ ProportionallyDown
If it is too large for the destination, scale the texture down while preserving the aspect ratio.
Point2 UIPoint
A type that contains a point in a two-dimensional coordinate system.
Definition UIUtility.hpp:27
FunctionBase< true, false, fu2::capacity_default, true, false, Signatures... > UniqueFunction
An owning non copyable function wrapper for arbitrary callable types.
Definition Function.hpp:59
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
UITexturePosition
Constants for specifying the position of a view texture relative to its title.
Definition UIUtility.hpp:58
@ NoTexture
The view doesn't display an texture.
@ TextureAbove
The texture is above the title.
@ TextureOverlaps
The texture overlaps the title.
@ TextureRight
The texture is to the right of the title.
@ TextureOnly
The cell displays an texture, but not a title.
@ TextureBelow
The texture is below the title.
@ TextureLeft
The texture is to the left of the title.
Definition UIUtility.hpp:44
double topLeft
Definition UIUtility.hpp:45
double topRight
Definition UIUtility.hpp:46
friend bool operator==(const UICornerRadius &lhs, const UICornerRadius &rhs)
Definition UIUtility.hpp:50
double bottomLeft
Definition UIUtility.hpp:47
double bottomRight
Definition UIUtility.hpp:48
friend bool operator!=(const UICornerRadius &lhs, const UICornerRadius &rhs)
Definition UIUtility.hpp:53
Definition UIUtility.hpp:213
static void layoutX(const UIView *views)
static void layoutY(const UIView *views)
static void sameHeight(std::initializer_list< UIView * > views)
static void sameWidth(std::initializer_list< UIView * > views)
Definition UIEvent.hpp:173
A set of common and useful functions for implementing UIs.
Definition UIUtility.hpp:190
static bool forwardInputEvent(UIWindow *window, const AnyInputEvent &event)
A utility method that forwards a generic AnyEvent to the given window.
static bool isOver(const UIView *view, const UIMouseEvent &event)
A utility method that checks if the event occurred over the view.
static bool makeFirstResponder(UIView *view)
Makes the view the first responder in it's window.