mirror of
https://github.com/raysan5/raygui.git
synced 2026-10-15 22:21:56 -04:00
Compare commits
4 Commits
04bf996730
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| ca17a68d1a | |||
| 9cb5cfa732 | |||
| 45a40cd0a6 | |||
| c2d948f565 |
22
src/raygui.h
22
src/raygui.h
@ -723,11 +723,13 @@ typedef enum {
|
|||||||
} GuiComboBoxProperty;
|
} GuiComboBoxProperty;
|
||||||
|
|
||||||
// DropdownBox
|
// DropdownBox
|
||||||
|
// TODO: Support dropdown with scrollbar
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ARROW_PADDING = 16, // DropdownBox arrow separation from border and items
|
ARROW_PADDING = 16, // DropdownBox arrow separation from border and items
|
||||||
DROPDOWN_ITEMS_SPACING, // DropdownBox items separation
|
DROPDOWN_ITEMS_SPACING, // DropdownBox items separation
|
||||||
DROPDOWN_ARROW_HIDDEN, // DropdownBox arrow hidden
|
DROPDOWN_ARROW_HIDDEN, // DropdownBox arrow hidden
|
||||||
DROPDOWN_ROLL_UP // DropdownBox roll up flag: 0-Roll down, 1-Roll up
|
DROPDOWN_ROLL_UP, // DropdownBox roll up flag: 0-Roll down, 1-Roll up
|
||||||
|
DROPDOWN_MAX_HEIGHT // DropdownBox max height, using scrollbar if required, 0-No limit
|
||||||
} GuiDropdownBoxProperty;
|
} GuiDropdownBoxProperty;
|
||||||
|
|
||||||
// TextBox/TextBoxMulti/ValueBox/Spinner
|
// TextBox/TextBoxMulti/ValueBox/Spinner
|
||||||
@ -1877,7 +1879,7 @@ int GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, Vector
|
|||||||
{
|
{
|
||||||
// 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasHorizontalScrollBar = (content.width > bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH))? true : false;
|
bool hasHorizontalScrollBar = (content.width > bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH))? true : false;
|
||||||
@ -1967,9 +1969,9 @@ int GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, Vector
|
|||||||
|
|
||||||
// Draw control
|
// Draw control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if (text != NULL) result = GuiStatusBar(statusBar, text); // Draw panel header as status bar
|
if (text != NULL) result = GuiStatusBar(statusBar, text); // Draw panel header as status bar
|
||||||
|
|
||||||
GuiDrawRectangle(bounds, 0, BLANK, GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR))); // Draw background
|
GuiDrawRectangle(bounds, 0, BLANK, GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR))); // Draw background
|
||||||
|
|
||||||
// Save size of the scrollbar slider
|
// Save size of the scrollbar slider
|
||||||
const int slider = GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE);
|
const int slider = GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE);
|
||||||
@ -3893,12 +3895,16 @@ int GuiTabBarEx(Rectangle bounds, char **text, int count, int *hscroll, int *act
|
|||||||
int tabItemsWidth = GuiGetStyle(TABBAR, TAB_ITEMS_WIDTH);
|
int tabItemsWidth = GuiGetStyle(TABBAR, TAB_ITEMS_WIDTH);
|
||||||
Rectangle tabBounds = { bounds.x, bounds.y, (float)tabItemsWidth, bounds.height };
|
Rectangle tabBounds = { bounds.x, bounds.y, (float)tabItemsWidth, bounds.height };
|
||||||
|
|
||||||
if (*active < 0) *active = 0;
|
int prevActive = 0;
|
||||||
else if (*active > count - 1) *active = count - 1;
|
if (active != NULL)
|
||||||
|
{
|
||||||
|
if (*active < 0) *active = 0;
|
||||||
|
else if (*active > count - 1) *active = count - 1;
|
||||||
|
|
||||||
int prevActive = (active == NULL)? 0 : *active;
|
prevActive = *active;
|
||||||
|
}
|
||||||
|
|
||||||
int offsetX = 0; // Required in case tabs go out of screen
|
int offsetX = 0; // Required in case tabs go out of screen
|
||||||
offsetX = (*active*tabItemsWidth) - GetScreenWidth();
|
offsetX = (*active*tabItemsWidth) - GetScreenWidth();
|
||||||
if (offsetX < 0) offsetX = 0;
|
if (offsetX < 0) offsetX = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user