mirror of
https://github.com/raysan5/raygui.git
synced 2026-10-11 20:21:55 -04:00
Compare commits
6 Commits
47066b1b9f
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 9cb5cfa732 | |||
| 45a40cd0a6 | |||
| c2d948f565 | |||
| 04bf996730 | |||
| 386297a48d | |||
| 6fcd57bfe5 |
27
src/raygui.h
27
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);
|
||||||
@ -2697,7 +2699,7 @@ int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
|
|||||||
if (pasteLength > 0)
|
if (pasteLength > 0)
|
||||||
{
|
{
|
||||||
// Move forward data from cursor position
|
// Move forward data from cursor position
|
||||||
for (int i = textLength + pasteLength; i > textBoxCursorIndex; i--) text[i] = text[i - pasteLength];
|
for (int i = textLength + pasteLength; (i > textBoxCursorIndex) && (i < pasteLength); i--) text[i] = text[i - pasteLength];
|
||||||
|
|
||||||
// Paste data in at cursor
|
// Paste data in at cursor
|
||||||
for (int i = 0; i < pasteLength; i++) text[textBoxCursorIndex + i] = pasteText[i];
|
for (int i = 0; i < pasteLength; i++) text[textBoxCursorIndex + i] = pasteText[i];
|
||||||
@ -3958,8 +3960,9 @@ int GuiTabBarEx(Rectangle bounds, char **text, int count, int *hscroll, int *act
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw tab-bar bottom line
|
// Draw tab-bar border line
|
||||||
GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + bounds.height - 1, bounds.width, 1 }, 0, BLANK, GetColor(GuiGetStyle(TABBAR, BORDER_COLOR_NORMAL)));
|
float tabBorderOffset = (GuiGetStyle(TABBAR, TAB_LINE_SIDE) == 1)? 0 : (bounds.height - 1);
|
||||||
|
GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + tabBorderOffset, bounds.width, 1 }, 0, BLANK, GetColor(GuiGetStyle(TABBAR, BORDER_COLOR_NORMAL)));
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
// NOTE: In case of tab close result, consider focused tab
|
// NOTE: In case of tab close result, consider focused tab
|
||||||
@ -5401,7 +5404,7 @@ static int GetLineWidth(const char *text)
|
|||||||
|
|
||||||
text += textIconOffset;
|
text += textIconOffset;
|
||||||
|
|
||||||
// WARNING: Make sure guiFont is set,
|
// WARNING: Make sure guiFont is set,
|
||||||
// GuiGetStyle() does a lazy initialization
|
// GuiGetStyle() does a lazy initialization
|
||||||
GuiGetStyle(DEFAULT, TEXT_SIZE);
|
GuiGetStyle(DEFAULT, TEXT_SIZE);
|
||||||
|
|
||||||
@ -5783,8 +5786,8 @@ static void GuiDrawRectangle(Rectangle rec, int borderWidth, Color borderColor,
|
|||||||
// TODO: Consider multiline text
|
// TODO: Consider multiline text
|
||||||
static Vector2 GuiMeasureText(const char *text)
|
static Vector2 GuiMeasureText(const char *text)
|
||||||
{
|
{
|
||||||
Vector2 size = { 0 };
|
Vector2 textSize = { 0 };
|
||||||
|
|
||||||
if ((guiFont.texture.id > 0) && (text != NULL))
|
if ((guiFont.texture.id > 0) && (text != NULL))
|
||||||
{
|
{
|
||||||
// Get size in bytes of the line, considering end of line and line break
|
// Get size in bytes of the line, considering end of line and line break
|
||||||
@ -5810,8 +5813,8 @@ static Vector2 GuiMeasureText(const char *text)
|
|||||||
textSize.x += (glyphWidth + (float)GuiGetStyle(DEFAULT, TEXT_SPACING));
|
textSize.x += (glyphWidth + (float)GuiGetStyle(DEFAULT, TEXT_SPACING));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return size;
|
return textSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw tooltip using control bounds
|
// Draw tooltip using control bounds
|
||||||
|
|||||||
Reference in New Issue
Block a user