Update raygui.h

This commit is contained in:
Ray 2023-08-14 10:18:13 +02:00
parent 9bf3ef57a5
commit e830109d52

View File

@ -1588,7 +1588,7 @@ int GuiPanel(Rectangle bounds, const char *text)
{ {
// Move panel bounds after the header bar // Move panel bounds after the header bar
bounds.y += (float)RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT - 1; bounds.y += (float)RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT - 1;
bounds.height -= (float)RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT + 1; bounds.height -= (float)RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT - 1;
} }
// Draw control // Draw control
@ -3039,7 +3039,7 @@ int GuiListViewEx(Rectangle bounds, const char **text, int count, int *scrollInd
GuiState state = guiState; GuiState state = guiState;
int itemFocused = (focus == NULL)? -1 : *focus; int itemFocused = (focus == NULL)? -1 : *focus;
int itemSelected = *active; int itemSelected = (active == NULL)? -1 : *active;
// Check if we need a scroll bar // Check if we need a scroll bar
bool useScrollBar = false; bool useScrollBar = false;
@ -3124,13 +3124,13 @@ int GuiListViewEx(Rectangle bounds, const char **text, int count, int *scrollInd
} }
else else
{ {
if ((startIndex + i) == itemSelected) if (((startIndex + i) == itemSelected) && (active != NULL))
{ {
// Draw item selected // Draw item selected
GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_PRESSED)), GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_PRESSED))); GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_PRESSED)), GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_PRESSED)));
GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_PRESSED))); GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_PRESSED)));
} }
else if ((startIndex + i) == itemFocused) else if (((startIndex + i) == itemFocused) && (focus != NULL))
{ {
// Draw item focused // Draw item focused
GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_FOCUSED)), GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_FOCUSED))); GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_FOCUSED)), GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_FOCUSED)));
@ -3171,10 +3171,10 @@ int GuiListViewEx(Rectangle bounds, const char **text, int count, int *scrollInd
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
if (active != NULL) *active = itemSelected;
if (focus != NULL) *focus = itemFocused; if (focus != NULL) *focus = itemFocused;
if (scrollIndex != NULL) *scrollIndex = startIndex; if (scrollIndex != NULL) *scrollIndex = startIndex;
*active = itemSelected;
return result; return result;
} }