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

A widget that provides a graphical theme picker. More...

#include <gui/widget.h>
#include "../helpers/theme_picker_model.h"

Go to the source code of this file.

Typedefs

typedef struct ThemePicker ThemePicker
 ThemePicker opaque structure.
 
typedef void(* ThemePickerCallback) (uint32_t index, void *context)
 ThemePickerCallback function type.
 

Functions

ThemePicker * theme_picker_alloc (Widget *parent)
 Create a new ThemePicker instance.
 
void theme_picker_free (ThemePicker *instance)
 Delete a ThemePicker instance.
 
Widget * theme_picker_get_base (ThemePicker *instance)
 Get a pointer to the base class instance.
 
void theme_picker_set_callback (ThemePicker *instance, ThemePickerCallback callback, void *context)
 Set the function to be called upon theme selection.
 
void theme_picker_set_model (ThemePicker *instance, const ThemePickerModel *model)
 Set the model to show in this ThemePicker instance.
 
void theme_picker_set_current_item (ThemePicker *instance, uint32_t index)
 Set the currently selected item index.
 

Detailed Description

A widget that provides a graphical theme picker.

Typedef Documentation

◆ ThemePickerCallback

typedef void(* ThemePickerCallback) (uint32_t index, void *context)

ThemePickerCallback function type.

Parameters
[in]indexnumeric index of the currently selected theme
[in,out]contextpointer to the user-specific object

Function Documentation

◆ theme_picker_alloc()

ThemePicker * theme_picker_alloc ( Widget * parent)

Create a new ThemePicker instance.

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

◆ theme_picker_free()

void theme_picker_free ( ThemePicker * instance)

Delete a ThemePicker instance.

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

◆ theme_picker_get_base()

Widget * theme_picker_get_base ( ThemePicker * 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 ThemePicker instance to be queried
Returns
pointer to the base class instance

◆ theme_picker_set_callback()

void theme_picker_set_callback ( ThemePicker * instance,
ThemePickerCallback callback,
void * context )

Set the function to be called upon theme selection.

Parameters
[in,out]instancepointer to the ThemePicker instance to be modified
[in]callbackpointer to the function to be called upon theme selection
[in,out]contextpointer to a user-specified object (will be passed to the callback)

◆ theme_picker_set_current_item()

void theme_picker_set_current_item ( ThemePicker * instance,
uint32_t index )

Set the currently selected item index.

Precondition
theme_picker_set_model() MUST be called before calling this function.
Parameters
[in,out]instancepointer to the ThemePicker instance to be modified
[in]indexnumeric index of the desired item

◆ theme_picker_set_model()

void theme_picker_set_model ( ThemePicker * instance,
const ThemePickerModel * model )

Set the model to show in this ThemePicker instance.

Parameters
[in,out]instancepointer to the ThemePicker instance to be modified
[in]modelpointer to a ThemePickerModel instance to be shown