12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #ifndef MC__WIDGET_LISTBOX_H
- #define MC__WIDGET_LISTBOX_H
- #include "lib/keybind.h"
- typedef enum
- {
- LISTBOX_CONT,
- LISTBOX_DONE
- } lcback_ret_t;
- typedef enum
- {
- LISTBOX_APPEND_AT_END = 0,
- LISTBOX_APPEND_BEFORE,
- LISTBOX_APPEND_AFTER,
- LISTBOX_APPEND_SORTED
- } listbox_append_t;
- struct WListbox;
- typedef lcback_ret_t (*lcback_fn) (struct WListbox * l);
- typedef struct WLEntry
- {
- char *text;
- int hotkey;
- void *data;
- } WLEntry;
- typedef struct WListbox
- {
- Widget widget;
- GList *list;
- int pos;
- int top;
- int count;
- gboolean allow_duplicates;
- gboolean scrollbar;
- gboolean deletable;
- lcback_fn callback;
- int cursor_x, cursor_y;
- } WListbox;
- extern const global_keymap_t *listbox_map;
- WListbox *listbox_new (int y, int x, int height, int width, gboolean deletable, lcback_fn callback);
- int listbox_search_text (WListbox * l, const char *text);
- void listbox_select_first (WListbox * l);
- void listbox_select_last (WListbox * l);
- void listbox_select_entry (WListbox * l, int dest);
- void listbox_get_current (WListbox * l, char **string, void **extra);
- void listbox_remove_current (WListbox * l);
- void listbox_set_list (WListbox * l, GList * list);
- void listbox_remove_list (WListbox * l);
- char *listbox_add_item (WListbox * l, listbox_append_t pos,
- int hotkey, const char *text, void *data);
- #endif
|