(360) Add HAVE_RMENU_XUI hooks to file_list.c

This commit is contained in:
twinaphex 2014-02-28 19:07:30 +01:00
parent dd7a4b4128
commit 4c22d1063d
2 changed files with 24 additions and 1 deletions

View File

@ -19,6 +19,9 @@
#include "file_list.h"
#include "compat/strcasestr.h"
#include "msvc/msvc_compat.h"
#ifdef HAVE_RMENU_XUI
#include <xui.h>
#endif
struct item_file
{
@ -28,6 +31,10 @@ struct item_file
size_t directory_ptr;
};
#ifdef HAVE_RMENU_XUI
extern HXUIOBJ m_menulist;
#endif
void file_list_push(file_list_t *list,
const char *path, unsigned type, size_t directory_ptr)
{
@ -41,17 +48,30 @@ void file_list_push(file_list_t *list,
list->list = (struct item_file*)realloc(list->list, list->capacity * sizeof(struct item_file));
}
#ifdef HAVE_RMENU_XUI
wchar_t buf[PATH_MAX];
XuiListInsertItems(m_menulist, list->size, 1);
mbstowcs(buf, path, sizeof(buf) / sizeof(wchar_t));
XuiListSetText(m_menulist, list->size, buf);
#endif
list->list[list->size].path = strdup(path);
list->list[list->size].alt = NULL;
list->list[list->size].type = type;
list->list[list->size].directory_ptr = directory_ptr;
list->size++;
}
void file_list_pop(file_list_t *list, size_t *directory_ptr)
{
if (!(list->size == 0))
{
#ifdef HAVE_RMENU_XUI
XuiListDeleteItems(m_menulist, 0, list->size);
#endif
free(list->list[--list->size].path);
}
if (directory_ptr)
*directory_ptr = list->list[list->size].directory_ptr;
@ -74,6 +94,9 @@ void file_list_clear(file_list_t *list)
free(list->list[i].path);
free(list->list[i].alt);
}
#ifdef HAVE_RMENU_XUI
XuiListDeleteItems(m_menulist, 0, XuiListGetItemCount(m_menulist));
#endif
list->size = 0;
}

View File

@ -1501,7 +1501,7 @@ static void rmenu_xui_render(void *data)
&& !rgui->msg_force)
return;
size_t begin = rgui->selection_ptr >= 0;
size_t begin = rgui->selection_ptr;
size_t end = rgui->selection_buf->size;
rmenu_xui_render_background(rgui);