BSB Developer Docs
Loading...
Searching...
No Matches
dialog.h File Reference

Simple two options selection widget. More...

#include <gui/widget.h>
#include <toolbox/color.h>

Go to the source code of this file.

Typedefs

typedef struct Dialog Dialog
 Dialog opaque structure.
 
typedef void(* DialogCallback) (uint8_t result, void *context)
 Dialog callback function type.
 

Functions

Dialog * dialog_alloc (Widget *parent)
 Create a new Dialog instance.
 
void dialog_free (Dialog *instance)
 Delete a Dialog instance.
 
Widget * dialog_get_base (Dialog *instance)
 Get a pointer to the base class instance.
 
void dialog_set_callback (Dialog *instance, DialogCallback callback, void *context)
 Set a dialog selection callback.
 
void dialog_set_icon (Dialog *instance, const char *icon_source)
 Set the icon displayed by the Dialog.
 
void dialog_set_text (Dialog *instance, const char *text)
 Set a main text label value.
 
void dialog_set_text_sub (Dialog *instance, const char *text)
 Set an extra text label value.
 
void dialog_set_options (Dialog *instance, const char *text_0, const char *text_1)
 Set options text.
 
void dialog_set_option_colors (Dialog *instance, Color color_0, Color color_1)
 Set options color.
 
void dialog_select_option (Dialog *instance, uint8_t index)
 Set dialog option selection.
 

Detailed Description

Simple two options selection widget.

Typedef Documentation

◆ DialogCallback

typedef void(* DialogCallback) (uint8_t result, void *context)

Dialog callback function type.

Parameters
[in]resultselected option (0/1)
[in,out]contextpointer to a user-specific object

Function Documentation

◆ dialog_alloc()

Dialog * dialog_alloc ( Widget * parent)

Create a new Dialog instance.

Parameters
[in,out]parentpointer to the parent Widget instance
Returns
pointer to the newly created Dialog instance

◆ dialog_free()

void dialog_free ( Dialog * instance)

Delete a Dialog instance.

Parameters
[in,out]instancepointer to the Dialog instance to be deleted

◆ dialog_get_base()

Widget * dialog_get_base ( Dialog * instance)

Get a pointer to the base class instance.

The return value can be used in all Widget methods.

Parameters
[in,out]instancepointer to the Dialog instance to be queried
Returns
pointer to the base class instance

◆ dialog_select_option()

void dialog_select_option ( Dialog * instance,
uint8_t index )

Set dialog option selection.

Parameters
[in,out]instancepointer to the Dialog instance to be modified
[in]indexselected option (0/1)

◆ dialog_set_callback()

void dialog_set_callback ( Dialog * instance,
DialogCallback callback,
void * context )

Set a dialog selection callback.

Parameters
[in,out]instancepointer to the Dialog instance to be modified
[in]callbackcallback function pointer
[in]contextcallback context

◆ dialog_set_icon()

void dialog_set_icon ( Dialog * instance,
const char * icon_source )

Set the icon displayed by the Dialog.

Parameters
[in,out]instancepointer to the Dialog instance to be modified
[in]icon_sourcezero-terminated string containing the icon file path (NULL to hide)

◆ dialog_set_option_colors()

void dialog_set_option_colors ( Dialog * instance,
Color color_0,
Color color_1 )

Set options color.

Parameters
[in,out]instancepointer to the Dialog instance to be modified
[in]color_0color of the first option
[in]color_1color of the second option

◆ dialog_set_options()

void dialog_set_options ( Dialog * instance,
const char * text_0,
const char * text_1 )

Set options text.

Parameters
[in,out]instancepointer to the Dialog instance to be modified
[in]text_0text of the first option
[in]text_1text of the second option

◆ dialog_set_text()

void dialog_set_text ( Dialog * instance,
const char * text )

Set a main text label value.

Parameters
[in,out]instancepointer to the Dialog instance to be modified
[in]textzero-terminated string containing the text

◆ dialog_set_text_sub()

void dialog_set_text_sub ( Dialog * instance,
const char * text )

Set an extra text label value.

Parameters
[in,out]instancepointer to the Dialog instance to be modified
[in]textzero-terminated string containing the text (NULL to disable this label)