Muteki
EABI code execution on Besta® RTOS devices.
Loading...
Searching...
No Matches
static.h File Reference

Static text field (single-line label) widget constructor and methods. More...

#include "../types/static.h"

Go to the source code of this file.

Functions

ui_static_t * CreateStatic (unsigned short tag, short x0, short y0, short x1, short y1, const UTF16 *text, unsigned short font_type, unsigned int text_color, unsigned int text_options, unsigned int style_options)
 Create a static text field widget.
static unsigned int ui_static_text_options (unsigned short text_flags, short left_inset)
 Format the text_options parameter of the CreateStatic() syscall.

Detailed Description

Static text field (single-line label) widget constructor and methods.

Static text fields act as single-line labels on a deskbox. The user can customize the look of the label by modifying its parameters. The string rendering is internally delegated to WriteAlignString().

A typical declaration is as follows:

0x00, // Or anything you want.
x, y, x + max_label_width - 1, 0,
_BUL("Hello world!"),
SERIF_CJK,
LCD_RGB_FROM_U8(0x00, 0x00, 0x00),
ui_static_text_options(LCD_PRINT_NONE, 0),
);
#define _BUL(x)
Besta UTF-16 string literal.
Definition common.h:61
#define LCD_RGB_FROM_U8(r, g, b)
Convert separate RGB values to integer RGB representation.
Definition primitives.h:46
@ UI_TEXT_LAYOUT_LEFT_CENTER
Render the text at the left of the widget.
Definition text_layout.h:38
@ LCD_PRINT_NONE
No extra process.
Definition lcd.h:31
@ UI_STATIC_FRAME_KIND_OUTLINE
Draw the outline with the default outline color.
Definition static.h:33
static unsigned int ui_static_style_options(enum ui_text_layout_e layout, enum ui_static_frame_kind_e frame_type)
Format the ui_static_t::style_options value.
Definition static.h:101
struct ui_static_s ui_static_t
Static text field widget struct.
ui_static_t * CreateStatic(unsigned short tag, short x0, short y0, short x1, short y1, const UTF16 *text, unsigned short font_type, unsigned int text_color, unsigned int text_options, unsigned int style_options)
Create a static text field widget.
Warning
This widget assumes its parent is a deskbox type. Therefore it cannot be used with arbitrary generic group components.

Function Documentation

◆ CreateStatic()

ui_static_t * CreateStatic ( unsigned short tag,
short x0,
short y0,
short x1,
short y1,
const UTF16 * text,
unsigned short font_type,
unsigned int text_color,
unsigned int text_options,
unsigned int style_options )
extern

Create a static text field widget.

If y1 is less than y0 , it defaults to y0 + GetFontHeight( font_type ) + 6, with the exception of when font_type is 0xffff, then it will simply be y0 + 6. Note the absence of the font width here.

Syscall Number
0x1014d
Parameters
tagComponent tag. Can be used to distinguish components under some circumstances (like when sharing a callback with another component, or looking up an item with GetDeskItem()). Does not need to be unique. Usually will be set by AllocBlock() after the memory was allocated.
x0X coordinate of the top-left corner, in pixels (inclusive).
y0Y coordinate of the top-left corner, in pixels (inclusive).
x1X coordinate of the bottom-right corner, in pixels (inclusive).
y1Y coordinate of the bottom-right corner, in pixels (inclusive).
textLabel text.
font_typeFont type, or 0xffff to use the default font.
text_colorText color.
text_optionsText options.
style_optionsWidget style options.
Returns
The created static text field widget.
See also
font_type_e Builtin font types.
LCD_RGB_FROM_U8 Format RGB color values.
ui_static_text_options Helper function to format text_options .
ui_static_style_options Helper function to format style_options .

◆ ui_static_text_options()

unsigned int ui_static_text_options ( unsigned short text_flags,
short left_inset )
inlinestatic

Format the text_options parameter of the CreateStatic() syscall.

Parameters
text_flagsFlags accepted by WriteAlignString().
left_insetExtra left inset in number of pixels.
Returns
The formatted value.