Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT in GuiWindowBox. #453

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/raygui.h
Original file line number Diff line number Diff line change
Expand Up @@ -1569,6 +1569,10 @@ int GuiWindowBox(Rectangle bounds, const char *title)
#define RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT 24
#endif

#if !defined(RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT)
#define RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT 18
#endif

int result = 0;
//GuiState state = guiState;

Expand All @@ -1577,9 +1581,12 @@ int GuiWindowBox(Rectangle bounds, const char *title)
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) - 20,
statusBar.y + statusBarHeight/2.0f - 18.0f/2.0f, 18, 18 };
Rectangle closeButtonRec = { statusBar.x + statusBar.width - GuiGetStyle(STATUSBAR, BORDER_WIDTH) - RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT - vPadding,
statusBar.y + vPadding,
RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT,
RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT };

// Update control
//--------------------------------------------------------------------
Expand Down