diff options
author | Jari Vetoniemi <mailroxas@gmail.com> | 2014-04-10 01:09:35 +0300 |
---|---|---|
committer | Jari Vetoniemi <mailroxas@gmail.com> | 2014-04-10 01:10:05 +0300 |
commit | 67be25fbe43274340de89049fec7098cdf998b47 (patch) | |
tree | f8d6be283944fc90e1c224c461f6e92b3ae78d6f /lib/internal.h | |
parent | a3498b25f414a888aa01ffd1cf9b2e44f6c54764 (diff) | |
download | bemenu-67be25fbe43274340de89049fec7098cdf998b47.tar.gz bemenu-67be25fbe43274340de89049fec7098cdf998b47.tar.bz2 bemenu-67be25fbe43274340de89049fec7098cdf998b47.zip |
Basic working bemenu with curses backend
Diffstat (limited to 'lib/internal.h')
-rw-r--r-- | lib/internal.h | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/lib/internal.h b/lib/internal.h index c79ffd1..786e082 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -4,6 +4,10 @@ #include "bemenu.h" +#ifndef size_t +# include <stddef.h> /* for size_t */ +#endif + /** * Internal bmItem struct that is not exposed to public. * Represents a single item in menu. @@ -17,7 +21,8 @@ struct _bmItem { * Renderers should be able to fill this one as they see fit. */ struct _bmRenderApi { - void (*render)(struct _bmItem **items, unsigned int nmemb); + bmKey (*getKey)(unsigned int *unicode); + void (*render)(const bmMenu *menu); void (*free)(void); }; @@ -25,10 +30,36 @@ struct _bmRenderApi { * Internal bmMenu struct that is not exposed to public. */ struct _bmMenu { - bmDrawMode drawMode; struct _bmRenderApi renderApi; - struct _bmItem **items; - unsigned int itemsCount; + struct _bmItem **items, **filteredItems; + char *title, filter[1024]; + unsigned int cursor, cursesCursor; + unsigned int itemsCount, allocatedCount; + unsigned int filteredCount; + unsigned int index; + bmFilterMode filterMode; + bmDrawMode drawMode; }; +/* draw/curses.c */ +int _bmDrawCursesInit(struct _bmRenderApi *api); + +/* menu.c */ +int _bmMenuShouldRenderItem(const bmMenu *menu, const bmItem *item); + +/* filter.c */ +bmItem** _bmFilterDmenu(bmMenu *menu, unsigned int *count, unsigned int *selected); +bmItem** _bmFilterDmenuCaseInsensitive(bmMenu *menu, unsigned int *count, unsigned int *selected); + +/* util.c */ +char* _bmStrdup(const char *s); +bmItem** _bmShrinkItemList(bmItem ***list, size_t osize, size_t nsize); +int _bmUtf8StringScreenWidth(const char *string); +size_t _bmUtf8RuneNext(const char *string, size_t start); +size_t _bmUtf8RunePrev(const char *string, size_t start); +size_t _bmUtf8RuneWidth(const char *rune, unsigned int u8len); +size_t _bmUtf8RuneRemove(char *string, size_t start, size_t *runeWidth); +size_t _bmUtf8RuneInsert(char *string, size_t bufSize, size_t start, const char *rune, unsigned int u8len, size_t *runeWidth); +size_t _bmUnicodeInsert(char *string, size_t bufSize, size_t start, unsigned int unicode, size_t *runeWidth); + /* vim: set ts=8 sw=4 tw=0 :*/ |