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

Scrollable menu widget that hosts SMenuItem heir items. More...

Go to the source code of this file.

Typedefs

typedef struct SMenu SMenu
 SMenu opaque structure.
 

Functions

SMenu * smenu_alloc (Widget *parent, bool is_cursor_enabled)
 Create a new SMenu instance.
 
void smenu_free (SMenu *instance)
 Delete an SMenu instance and all of its items.
 
Widget * smenu_get_base (SMenu *instance)
 Get a pointer to the base class instance.
 
void smenu_set_selected_item_index (SMenu *instance, size_t index)
 Select the item in an SMenu instance at the given position.
 
size_t smenu_get_selected_item_index (SMenu *instance)
 Get the position of the selected item in an SMenu instance.
 
SMenu * smenu_get_from_item (SMenuItem *item)
 Get the menu an item belongs to.
 
void smenu_reset (SMenu *instance)
 Remove all items from an SMenu instance.
 

Detailed Description

Scrollable menu widget that hosts SMenuItem heir items.

Function Documentation

◆ smenu_alloc()

SMenu * smenu_alloc ( Widget * parent,
bool is_cursor_enabled )

Create a new SMenu instance.

Parameters
[in,out]parentpointer to the parent Widget instance
[in]is_cursor_enabledwhether the menu shows a cursor indicator next to the item in focus
Returns
pointer to the newly created SMenu instance

◆ smenu_free()

void smenu_free ( SMenu * instance)

Delete an SMenu instance and all of its items.

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

◆ smenu_get_base()

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

◆ smenu_get_from_item()

SMenu * smenu_get_from_item ( SMenuItem * item)

Get the menu an item belongs to.

Parameters
[in]itempointer to the menu item instance to be queried
Returns
pointer to the SMenu instance the item belongs to, or NULL if the item is not attached to a menu

◆ smenu_get_selected_item_index()

size_t smenu_get_selected_item_index ( SMenu * instance)

Get the position of the selected item in an SMenu instance.

Parameters
[in]instancepointer to the SMenu instance to be queried
Returns
zero-based position of the selected item among the menu items

◆ smenu_reset()

void smenu_reset ( SMenu * instance)

Remove all items from an SMenu instance.

The menu instance itself, along with its settings, remains valid.

Parameters
[in,out]instancepointer to the SMenu instance to be modified

◆ smenu_set_selected_item_index()

void smenu_set_selected_item_index ( SMenu * instance,
size_t index )

Select the item in an SMenu instance at the given position.

Parameters
[in,out]instancepointer to the SMenu instance to be modified
[in]indexzero-based position of the item to be selected