(GLUI) Hide tabs if we're not on the root level of the navigation

This commit is contained in:
Jean-André Santoni 2015-10-29 18:36:57 +07:00
parent 0fa2e553b2
commit cdfb274ac2
1 changed files with 67 additions and 58 deletions

View File

@ -599,6 +599,22 @@ static void glui_draw_cursor(gl_t *gl, glui_handle_t *glui,
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
}
static size_t glui_list_get_size(void *data, menu_list_type_t type)
{
size_t list_size = 0;
menu_handle_t *menu = (menu_handle_t*)data;
glui_handle_t *glui = menu ? (glui_handle_t*)menu->userdata : NULL;
/*switch (type)
{
case MENU_LIST_PLAIN:*/
list_size = menu_entries_get_stack_size(0);
/*break;
}*/
return list_size;
}
static void glui_frame(void)
{
unsigned header_height;
@ -724,6 +740,9 @@ static void glui_frame(void)
width, height,
&blue_bg[0]);
/* display tabs if depth equal one, if not hide them */
if (glui_list_get_size(menu, MENU_LIST_PLAIN) == 1)
{
/* tabs background */
glui_render_quad(gl, 0, height - glui->tabs_height, width,
glui->tabs_height,
@ -764,6 +783,7 @@ static void glui_frame(void)
width, height, 0, 1, &pure_white[0]);
}
/* active tab marker */
tab_width = width / (GLUI_SYSTEM_TAB_END+1);
glui_render_quad(gl, glui->categories.selection_ptr * tab_width,
height - (header_height/16),
@ -771,6 +791,11 @@ static void glui_frame(void)
header_height/16,
width, height,
&blue_bg[0]);
}
else
{
glui->tabs_height = 0;
}
glui_render_quad(gl, 0, header_height, width,
header_height/12,
@ -1210,22 +1235,6 @@ static void glui_list_cache(menu_list_type_t type, unsigned action)
}
}
static size_t glui_list_get_size(void *data, menu_list_type_t type)
{
size_t list_size = 0;
menu_handle_t *menu = (menu_handle_t*)data;
glui_handle_t *glui = menu ? (glui_handle_t*)menu->userdata : NULL;
/*switch (type)
{
case MENU_LIST_PLAIN:*/
list_size = menu_entries_get_stack_size(0);
/*break;
}*/
return list_size;
}
menu_ctx_driver_t menu_ctx_glui = {
NULL,
glui_get_message,