Skip to content

Commit e4a59f0

Browse files
committed
ADDED: GuiListView*() property LIST_ITEMS_BORDER_NORMAL
Allows creating list view with items outlined on normal state (not only when focused/selected)
1 parent f24b309 commit e4a59f0

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

examples/controls_test_suite/controls_test_suite.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,10 @@ int main()
246246
if (GuiDropdownBox((Rectangle){ 25, 25, 125, 30 }, "ONE;TWO;THREE", &dropdownBox000Active, dropDown000EditMode)) dropDown000EditMode = !dropDown000EditMode;
247247

248248
// Second GUI column
249+
//GuiSetStyle(LISTVIEW, LIST_ITEMS_BORDER_NORMAL, 1);
249250
GuiListView((Rectangle){ 165, 25, 140, 124 }, "Charmander;Bulbasaur;#18#Squirtel;Pikachu;Eevee;Pidgey", &listViewScrollIndex, &listViewActive);
250251
GuiListViewEx((Rectangle){ 165, 162, 140, 184 }, listViewExList, 8, &listViewExScrollIndex, &listViewExActive, &listViewExFocus);
252+
GuiSetStyle(LISTVIEW, LIST_ITEMS_BORDER_NORMAL, 0);
251253

252254
//GuiToggle((Rectangle){ 165, 400, 140, 25 }, "#1#ONE", &toggleGroupActive);
253255
GuiToggleGroup((Rectangle){ 165, 360, 140, 24 }, "#1#ONE\n#3#TWO\n#8#THREE\n#23#", &toggleGroupActive);

src/raygui.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,7 @@ typedef enum {
660660
LIST_ITEMS_SPACING, // ListView items separation
661661
SCROLLBAR_WIDTH, // ListView scrollbar size (usually width)
662662
SCROLLBAR_SIDE, // ListView scrollbar side (0-SCROLLBAR_LEFT_SIDE, 1-SCROLLBAR_RIGHT_SIDE)
663+
LIST_ITEMS_BORDER_NORMAL, // ListView items border enabled in normal state
663664
LIST_ITEMS_BORDER_WIDTH // ListView items border width
664665
} GuiListViewProperty;
665666

@@ -3488,7 +3489,7 @@ int GuiListViewEx(Rectangle bounds, const char **text, int count, int *scrollInd
34883489
// Draw visible items
34893490
for (int i = 0; ((i < visibleItems) && (text != NULL)); i++)
34903491
{
3491-
GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, LIST_ITEMS_BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_NORMAL)), BLANK);
3492+
if (GuiGetStyle(LISTVIEW, LIST_ITEMS_BORDER_NORMAL)) GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, LIST_ITEMS_BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_NORMAL)), BLANK);
34923493

34933494
if (state == STATE_DISABLED)
34943495
{
@@ -3512,7 +3513,7 @@ int GuiListViewEx(Rectangle bounds, const char **text, int count, int *scrollInd
35123513
}
35133514
else
35143515
{
3515-
// Draw item normal
3516+
// Draw item normal (no rectangle)
35163517
GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_NORMAL)));
35173518
}
35183519
}
@@ -4331,6 +4332,7 @@ void GuiLoadStyleDefault(void)
43314332
GuiSetStyle(SCROLLBAR, SCROLL_SPEED, 12);
43324333
GuiSetStyle(LISTVIEW, LIST_ITEMS_HEIGHT, 28);
43334334
GuiSetStyle(LISTVIEW, LIST_ITEMS_SPACING, 2);
4335+
GuiSetStyle(LISTVIEW, LIST_ITEMS_BORDER_WIDTH, 1);
43344336
GuiSetStyle(LISTVIEW, SCROLLBAR_WIDTH, 12);
43354337
GuiSetStyle(LISTVIEW, SCROLLBAR_SIDE, SCROLLBAR_RIGHT_SIDE);
43364338
GuiSetStyle(COLORPICKER, COLOR_SELECTOR_SIZE, 8);

0 commit comments

Comments
 (0)