mirror of
https://github.com/raysan5/raygui.git
synced 2026-02-20 20:49:17 -05:00
Compare commits
3 Commits
52c9d5fb52
...
a307cb55d0
| Author | SHA1 | Date | |
|---|---|---|---|
| a307cb55d0 | |||
| 628a4b2bfd | |||
| 4a7c6e17d5 |
17
src/raygui.h
17
src/raygui.h
@ -1654,13 +1654,14 @@ int GuiWindowBox(Rectangle bounds, const char *title)
|
||||
//GuiState state = guiState;
|
||||
|
||||
int statusBarHeight = RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT;
|
||||
int statusBorderWidth = GuiGetStyle(STATUSBAR, BORDER_WIDTH);
|
||||
|
||||
Rectangle statusBar = { bounds.x, bounds.y, bounds.width, (float)statusBarHeight };
|
||||
if (bounds.height < statusBarHeight*2.0f) bounds.height = statusBarHeight*2.0f;
|
||||
|
||||
const float vPadding = statusBarHeight/2.0f - RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT/2.0f;
|
||||
Rectangle windowPanel = { bounds.x, bounds.y + (float)statusBarHeight - 1, bounds.width, bounds.height - (float)statusBarHeight + 1 };
|
||||
Rectangle closeButtonRec = { statusBar.x + statusBar.width - GuiGetStyle(STATUSBAR, BORDER_WIDTH) - RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT - vPadding,
|
||||
Rectangle windowPanel = { bounds.x, bounds.y + (float)statusBarHeight - (float)statusBorderWidth, bounds.width, bounds.height - (float)statusBarHeight + (float)statusBorderWidth };
|
||||
Rectangle closeButtonRec = { statusBar.x + statusBar.width - (float)statusBorderWidth - RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT - vPadding,
|
||||
statusBar.y + vPadding, RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT, RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT };
|
||||
|
||||
// Update control
|
||||
@ -1670,8 +1671,8 @@ int GuiWindowBox(Rectangle bounds, const char *title)
|
||||
|
||||
// Draw control
|
||||
//--------------------------------------------------------------------
|
||||
GuiStatusBar(statusBar, title); // Draw window header as status bar
|
||||
GuiPanel(windowPanel, NULL); // Draw window base
|
||||
GuiStatusBar(statusBar, title); // Draw window header as status bar
|
||||
|
||||
// Draw window close button
|
||||
int tempBorderWidth = GuiGetStyle(BUTTON, BORDER_WIDTH);
|
||||
@ -5423,13 +5424,19 @@ static void GuiTooltip(Rectangle controlRec)
|
||||
|
||||
if ((controlRec.x + textSize.x + 16) > GetScreenWidth()) controlRec.x -= (textSize.x + 16 - controlRec.width);
|
||||
|
||||
GuiPanel(RAYGUI_CLITERAL(Rectangle){ controlRec.x, controlRec.y + controlRec.height + 4, textSize.x + 16, GuiGetStyle(DEFAULT, TEXT_SIZE) + 8.0f }, NULL);
|
||||
int lineCount = 0;
|
||||
GetTextLines(guiTooltipPtr, &lineCount); // Only using the line count
|
||||
if ((controlRec.y + controlRec.height + textSize.y + 4 + 8*lineCount) > GetScreenHeight())
|
||||
controlRec.y -= (controlRec.height + textSize.y + 4 + 8*lineCount);
|
||||
|
||||
// TODO: Probably TEXT_LINE_SPACING should be considered on panel size instead of hardcoding 8.0f
|
||||
GuiPanel(RAYGUI_CLITERAL(Rectangle){ controlRec.x, controlRec.y + controlRec.height + 4, textSize.x + 16, textSize.y + 8.0f*lineCount }, NULL);
|
||||
|
||||
int textPadding = GuiGetStyle(LABEL, TEXT_PADDING);
|
||||
int textAlignment = GuiGetStyle(LABEL, TEXT_ALIGNMENT);
|
||||
GuiSetStyle(LABEL, TEXT_PADDING, 0);
|
||||
GuiSetStyle(LABEL, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER);
|
||||
GuiLabel(RAYGUI_CLITERAL(Rectangle){ controlRec.x, controlRec.y + controlRec.height + 4, textSize.x + 16, GuiGetStyle(DEFAULT, TEXT_SIZE) + 8.0f }, guiTooltipPtr);
|
||||
GuiLabel(RAYGUI_CLITERAL(Rectangle){ controlRec.x, controlRec.y + controlRec.height + 4, textSize.x + 16, textSize.y + 8.0f*lineCount }, guiTooltipPtr);
|
||||
GuiSetStyle(LABEL, TEXT_ALIGNMENT, textAlignment);
|
||||
GuiSetStyle(LABEL, TEXT_PADDING, textPadding);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user