summaryrefslogtreecommitdiff
path: root/lib/bemenu.h
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2014-04-10 20:04:06 +0300
committerJari Vetoniemi <mailroxas@gmail.com>2014-04-10 20:04:06 +0300
commita6d0413b972580f3bbfde8750090270b0d8d463e (patch)
tree7ed26f9c4978dfc213c89a6ec2008cccc9670dbb /lib/bemenu.h
parent16e023aa3eb495a4b48af1784e5e78dcf4e9ba0b (diff)
downloadbemenu-a6d0413b972580f3bbfde8750090270b0d8d463e.tar.gz
bemenu-a6d0413b972580f3bbfde8750090270b0d8d463e.tar.bz2
bemenu-a6d0413b972580f3bbfde8750090270b0d8d463e.zip
Implement list structure, and feature for multiple selections.
Diffstat (limited to 'lib/bemenu.h')
-rw-r--r--lib/bemenu.h56
1 files changed, 48 insertions, 8 deletions
diff --git a/lib/bemenu.h b/lib/bemenu.h
index f2f0372..250ad53 100644
--- a/lib/bemenu.h
+++ b/lib/bemenu.h
@@ -85,6 +85,7 @@ typedef enum bmKey {
BM_KEY_TAB,
BM_KEY_ESCAPE,
BM_KEY_RETURN,
+ BM_KEY_SHIFT_RETURN,
BM_KEY_UNICODE,
BM_KEY_LAST
} bmKey;
@@ -200,24 +201,52 @@ int bmMenuRemoveItemAt(bmMenu *menu, unsigned int index);
*/
int bmMenuRemoveItem(bmMenu *menu, bmItem *item);
+
/**
- * Get selected item from bmMenu instance.
+ * Get highlighted item from bmMenu instance.
*
- * @param menu bmMenu instance from where to get selected item.
- * @return Selected bmItem instance, **NULL** if none selected.
+ * @param menu bmMenu instance from where to get highlighted item.
+ * @return Selected bmItem instance, **NULL** if none highlighted.
*/
-bmItem* bmMenuGetSelectedItem(const bmMenu *menu);
+bmItem* bmMenuGetHighlightedItem(const bmMenu *menu);
/**
- * Get items from bmMenu instance.
+ * Highlight item in menu by index.
*
- * @warning The pointer returned by this function may be invalid after removing or adding new items.
+ * @param menu bmMenu instance from where to highlight item.
+ * @return 1 on successful highlight, 0 on failure.
+ */
+int bmMenuSetHighlightedIndex(bmMenu *menu, unsigned int index);
+
+/**
+ * Highlight item in menu.
*
- * @param menu bmMenu instance from where to get items.
+ * @param menu bmMenu instance from where to highlight item.
+ * @param item bmItem instance to highlight.
+ * @return 1 on successful highlight, 0 on failure.
+ */
+int bmMenuSetHighlighted(bmMenu *menu, bmItem *item);
+
+/**
+ * Get selected items from bmMenu instance.
+ *
+ * @param menu bmMenu instance from where to get selected items.
* @param outNmemb Reference to unsigned int where total count of returned items will be stored.
* @return Pointer to array of bmItem pointers.
*/
-bmItem** bmMenuGetItems(const bmMenu *menu, unsigned int *outNmemb);
+bmItem** bmMenuGetSelectedItems(const bmMenu *menu, unsigned int *outNmemb);
+
+/**
+ * Set selected items to bmMenu instance.
+ *
+ * @warning The list won't be copied.
+ *
+ * @param menu bmMenu instance where items will be set.
+ * @param items Array of bmItem pointers to set.
+ * @param nmemb Total count of items in array.
+ * @return 1 on successful set, 0 on failure.
+ */
+int bmMenuSetSelectedItems(bmMenu *menu, bmItem **items, unsigned int nmemb);
/**
* Get filtered (displayed) items from bmMenu instance.
@@ -232,6 +261,17 @@ bmItem** bmMenuGetItems(const bmMenu *menu, unsigned int *outNmemb);
bmItem** bmMenuGetFilteredItems(const bmMenu *menu, unsigned int *outNmemb);
/**
+ * Get items from bmMenu instance.
+ *
+ * @warning The pointer returned by this function may be invalid after removing or adding new items.
+ *
+ * @param menu bmMenu instance from where to get items.
+ * @param outNmemb Reference to unsigned int where total count of returned items will be stored.
+ * @return Pointer to array of bmItem pointers.
+ */
+bmItem** bmMenuGetItems(const bmMenu *menu, unsigned int *outNmemb);
+
+/**
* Set items to bmMenu instance.
* Will replace all the old items on bmMenu instance.
*