mirror of
https://github.com/raysan5/raygui.git
synced 2026-02-20 20:49:17 -05:00
Compare commits
2 Commits
a307cb55d0
...
f8f7dd3296
| Author | SHA1 | Date | |
|---|---|---|---|
| f8f7dd3296 | |||
| 9f70fcbbfb |
15
src/raygui.h
15
src/raygui.h
@ -3701,7 +3701,7 @@ int GuiListViewEx(Rectangle bounds, const char **text, int count, int *scrollInd
|
||||
{
|
||||
if ((startIndex + i) == itemSelected) GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, LIST_ITEMS_BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_DISABLED)), GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_DISABLED)));
|
||||
|
||||
GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_DISABLED)));
|
||||
GuiDrawText(text[startIndex + i], GetTextBounds(LISTVIEW, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_DISABLED)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3709,18 +3709,18 @@ int GuiListViewEx(Rectangle bounds, const char **text, int count, int *scrollInd
|
||||
{
|
||||
// Draw item selected
|
||||
GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, LIST_ITEMS_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(LISTVIEW, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_PRESSED)));
|
||||
}
|
||||
else if (((startIndex + i) == itemFocused)) // && (focus != NULL)) // NOTE: Items focused, despite not returned
|
||||
{
|
||||
// Draw item focused
|
||||
GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, LIST_ITEMS_BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_FOCUSED)), GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_FOCUSED)));
|
||||
GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_FOCUSED)));
|
||||
GuiDrawText(text[startIndex + i], GetTextBounds(LISTVIEW, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_FOCUSED)));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Draw item normal (no rectangle)
|
||||
GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_NORMAL)));
|
||||
GuiDrawText(text[startIndex + i], GetTextBounds(LISTVIEW, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_NORMAL)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -5131,12 +5131,11 @@ static const char **GetTextLines(const char *text, int *count)
|
||||
lines[0] = text;
|
||||
*count = 1;
|
||||
|
||||
for (int i = 0, k = 0; (i < textLength) && (*count < RAYGUI_MAX_TEXT_LINES); i++)
|
||||
for (int i = 0; (i < textLength) && (*count < RAYGUI_MAX_TEXT_LINES); i++)
|
||||
{
|
||||
if (text[i] == '\n')
|
||||
if ((text[i] == '\n') && ((i + 1) < textLength))
|
||||
{
|
||||
k++;
|
||||
lines[k] = &text[i + 1]; // WARNING: next value is valid?
|
||||
lines[*count] = &text[i + 1];
|
||||
*count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user