User interface elements

EsElementDraw

void EsElementDraw(EsElement *element, EsPainter *painter);

Actually draw an element onto a painter.

EsElementFocus

void EsElementFocus(EsElement *element, EsElementFocusFlags flags = ES_FLAGS_DEFAULT);

Gives keyboard focus to the element. It sends the focus messages to the old and new focused elements. This must be done with the message mutex acquired.

EsElementIsFocused

bool EsElementIsFocused(EsElement *element);

Returns true if the element currently has focus.

EsElementSetDisabled

void EsElementSetDisabled(EsElement *element, bool disabled = true);

Enables or disables the element and all of its children. It removes focus from a disabled element. This must be done with the message mutex acquired.

EsElementSetHidden

void EsElementSetHidden(EsElement *element, bool hidden = true);

Shows or hides the element. It updates the parent's content size. This must be done with the message mutex acquired.

EsElementIsHidden

bool EsElementIsHidden(EsElement *element);

Returns true if the element is hidden. This must be done with the message mutex acquired.

EsElementSetCallback

void EsElementSetCallback(EsElement *element, EsElementCallback callback);

Sets the element's user message handler. This must be done with the message mutex acquired.

EsElementGetSize

void EsElementGetSize(EsElement *element, int *width, int *height);

Writes the element's width and height to the output parameters. This must be done with the message mutex acquired.

EsElementRepaint

void EsElementRepaint(EsElement *element, const EsRectangle *region = ES_NULL);

Mark an element to be repainted. If region is null, then the whole element is repainted.

EsElementRepaintForScroll

void EsElementRepaintForScroll(EsElement *element, EsMessage *message, EsRectangle border);

Minimal repaint for ES_MSG_SCROLL_X/Y.

EsElementRelayout

void EsElementRelayout(EsElement *element);

Marks the element and its ancestors as needing relayout. The layout runs during the next window update.

EsElementSetCellRange

void EsElementSetCellRange(EsElement *element, int xFrom, int yFrom, int xTo = -1, int yTo = -1);

Use only if the parent is a ES_PANEL_TABLE.

EsElementGetInsets

EsRectangle EsElementGetInsets(EsElement *element);

Returns the element's style insets. This must be done with the message mutex acquired.

EsElementGetInsetSize

EsRectangle EsElementGetInsetSize(EsElement *element);

Get the size of the element, minus the insets.

EsElementGetInsetBounds

EsRectangle EsElementGetInsetBounds(EsElement *element);

Returns the element's bounds, shrunk by the insets. This must be done with the message mutex acquired.

EsElementGetMetrics

EsThemeMetrics EsElementGetMetrics(EsElement *element);

Returns the *scaled* metrics; the metrics given in the EsStyle passed to element creation functions should *not* be scaled.

EsElementGetScaleFactor

float EsElementGetScaleFactor(EsElement *element);

Returns the current UI scale factor.

EsElementGetPreferredSize

EsRectangle EsElementGetPreferredSize(EsElement *element);

Returns the element's preferred size from its style. This must be done with the message mutex acquired.

EsElementMove

void EsElementMove(EsElement *element, int x, int y, int width, int height, bool applyCellLayout = true);

x, y are given relative to the top-left of the parent.

EsElementGetLayoutParent

EsElement *EsElementGetLayoutParent(EsElement *element);

Returns the element's parent. This must be done with the message mutex acquired.

EsElementDestroy

void EsElementDestroy(EsElement *element);

Destroys the element and removes it from its parent. This must be done with the message mutex acquired.

EsElementDestroyContents

void EsElementDestroyContents(EsElement *element);

Destroys all of the element's children, then sends ES_MSG_DESTROY_CONTENTS. This must be done with the message mutex acquired.

EsElementStartAnimating

bool EsElementStartAnimating(EsElement *element);

Returns false if the element was already animating.

EsElementStartTransition

void EsElementStartTransition(EsElement *element, EsTransitionType transitionType, EsElementTransitionFlags flags = ES_FLAGS_DEFAULT, float timeMultiplier = 1);

Starts a visual transition on the element, such as a fade in or out. timeMultiplier scales the transition duration.

EsElementInsertAfter

void EsElementInsertAfter(EsElement *element);

The next element created will be inserted after this element. They must have the same parent. Or, if this is the parent of the next element created, then it will be inserted at the start of the parent.

EsElementUpdateContentSize

void EsElementUpdateContentSize(EsElement *element, EsElementUpdateContentFlags flags = ES_FLAGS_DEFAULT);

Invalidates the element's measurement cache and marks it for relayout. Call this after the element's content changes.

EsElementGetTextStyle

void EsElementGetTextStyle(EsElement *element, EsTextStyle *style);

Writes the element's current text style to the output parameter.

EsElementGetWindowBounds

EsRectangle EsElementGetWindowBounds(EsElement *element, bool client = true);

Returns the element's bounds relative to the window. If client is true, the result excludes the element's internal offsets.

EsElementGetScreenBounds

EsRectangle EsElementGetScreenBounds(EsElement *element, bool client = true);

Returns the element's bounds in screen coordinates.

EsCustomElementCreate

EsElement *EsCustomElementCreate(EsElement *parent, EsElementFlags flags = ES_FLAGS_DEFAULT, EsStyleID style = 0);

Creates a plain element with no class message handler. Use it for simple containers and custom drawing.

EsCustomScrollViewCreate

EsScrollView *EsCustomScrollViewCreate(EsElement *parent, EsElementFlags flags = ES_FLAGS_DEFAULT, EsStyleID style = 0);

Creates a scroll view element. Configure it with EsScrollViewSetup.

EsScrollViewReceivedMessage

int EsScrollViewReceivedMessage(EsScrollView *view, EsMessage *message);

You *must* call this *before* handling any messages. If this returns non-zero, immediately return that value from your message handler.

EsScrollViewSetup

void EsScrollViewSetup(EsScrollView *view, EsScrollViewMode xMode, EsScrollViewMode yMode, uint16_t flags);

Sets the scroll modes and flags for the view. It creates or destroys the scroll bars as needed.

EsScrollViewSetPosition

void EsScrollViewSetPosition(EsScrollView *view, int axis, double newPosition, bool sendMovedMessage = true);

Sets the scroll position along the axis. It clamps the value to the scroll limit. If sendMovedMessage is true, it sends the scroll message.

EsScrollViewRefresh

void EsScrollViewRefresh(EsScrollView *view);

Recomputes the scroll limits and updates the scroll bars. Call this after the content size changes.

EsScrollViewGetPosition

int64_t EsScrollViewGetPosition(EsScrollView *view, int axis);

Returns the current scroll position along the axis.

EsScrollViewGetLimit

int64_t EsScrollViewGetLimit(EsScrollView *view, int axis);

Returns the maximum scroll position along the axis.

EsScrollViewSetFixedViewport

void EsScrollViewSetFixedViewport(EsScrollView *view, int axis, int32_t value);

Sets the fixed viewport size along the axis. The scroll bar measurements use this value instead of the content size.

EsScrollViewIsBarEnabled

bool EsScrollViewIsBarEnabled(EsScrollView *view, int axis);

Returns true if the scroll bar along the axis is enabled.

EsScrollViewIsInDragScroll

bool EsScrollViewIsInDragScroll(EsScrollView *view);

Returns true if the user is currently dragging to scroll.