bemenu 1.0.0
Dynamic menu library and client program inspired by dmenu
Item

Item container. More...

Item Memory

struct bm_item * bm_item_new (const char *text)
 
void bm_item_free (struct bm_item *item)
 

Item Properties

void bm_item_set_userdata (struct bm_item *item, void *userdata)
 
void * bm_item_get_userdata (struct bm_item *item)
 
bool bm_item_set_text (struct bm_item *item, const char *text)
 
const char * bm_item_get_text (const struct bm_item *item)
 

Detailed Description

Item container.

Contains properties for visual representation of item.

Function Documentation

struct bm_item* bm_item_new ( const char *  text)

Allocate a new item.

Parameters
textPointer to null terminated C "string", can be NULL for empty text.
Returns
bm_item for new item instance, NULL if creation failed.
void bm_item_free ( struct bm_item *  item)

Release bm_item instance.

Parameters
itembm_item instance to be freed from memory.
void bm_item_set_userdata ( struct bm_item *  item,
void *  userdata 
)

Set userdata pointer to bm_item instance. Userdata will be carried unmodified by the instance.

Parameters
itembm_item instance where to set userdata pointer.
userdataPointer to userdata.
void* bm_item_get_userdata ( struct bm_item *  item)

Get userdata pointer from bm_item instance.

Parameters
itembm_item instance which userdata pointer to get.
Returns
Pointer for unmodified userdata.
bool bm_item_set_text ( struct bm_item *  item,
const char *  text 
)

Set text to bm_item instance.

Parameters
itembm_item instance where to set text.
textC "string" to set as text, can be NULL for empty text.
Returns
true if set was succesful, false if out of memory.
const char* bm_item_get_text ( const struct bm_item *  item)

Get text from bm_item instance.

Parameters
itembm_item instance where to get text from.
Returns
Pointer to null terminated C "string", can be NULL for empty text.