Make it possible to set filter text manually.

This commit is contained in:
Jari Vetoniemi 2014-04-10 23:05:37 +03:00
parent 71beb7583f
commit 8e0dd1ab39
2 changed files with 46 additions and 0 deletions

View File

@ -400,6 +400,22 @@ void bmItemSetUserdata(bmItem *item, void *userdata);
*/ */
void* bmItemGetUserdata(bmItem *item); void* bmItemGetUserdata(bmItem *item);
/**
* Set filter text to bmMenu instance.
*
* @param menu bmMenu instance where to set filter.
* @param filter Null terminated C "string" to act as filter.
*/
void bmMenuSetFilter(bmMenu *menu, const char *filter);
/**
* Get filter text from bmMenu instance.
*
* @param menu bmMenu instance where to get filter.
* @return Const pointer to current filter text, may be **NULL** if empty.
*/
const char* bmMenuGetFilter(bmMenu *menu);
/** /**
* Set text to bmItem instance. * Set text to bmItem instance.
* *

View File

@ -116,6 +116,36 @@ void* bmMenuGetUserdata(bmMenu *menu)
return menu->userdata; return menu->userdata;
} }
/**
* Set filter text to bmMenu instance.
*
* @param menu bmMenu instance where to set filter.
* @param filter Null terminated C "string" to act as filter.
*/
void bmMenuSetFilter(bmMenu *menu, const char *filter)
{
assert(menu);
if (!filter) {
memset(menu->filter, 0, sizeof(menu->filter));
return;
}
strncpy(menu->filter, filter, sizeof(menu->filter));
}
/**
* Get filter text from bmMenu instance.
*
* @param menu bmMenu instance where to get filter.
* @return Const pointer to current filter text, may be **NULL** if empty.
*/
const char* bmMenuGetFilter(bmMenu *menu)
{
assert(menu);
return menu->filter;
}
/** /**
* Set active filter mode to bmMenu instance. * Set active filter mode to bmMenu instance.
* *