From 1db4b1bdb5abb245e1eaeea37e3e2953d0f67341 Mon Sep 17 00:00:00 2001 From: Dimitris Panokostas Date: Sat, 9 Nov 2024 18:34:02 +0100 Subject: [PATCH 1/3] Fix checkbox font clipping (#126) * Use const in more places * Revert "Use const in more places" This reverts commit 125b4aa25be08ece3d7d30649cb17e188ce26160. * Fixed checkbox widgets would clip the font height At least in some cases (with a font size of 15 that I tested), the font height was clipped due to the height of the checkbox being smaller. Adding 2 pixels of padding in the height seems to fix that. --- src/widgets/checkbox.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/widgets/checkbox.cpp b/src/widgets/checkbox.cpp index b27238c..d502246 100644 --- a/src/widgets/checkbox.cpp +++ b/src/widgets/checkbox.cpp @@ -192,7 +192,8 @@ namespace gcn { const int height = getFont()->getHeight(); - setHeight(height); + // Add two pixels to avoid font clipping + setHeight(height + 2); setWidth(getFont()->getWidth(mCaption) + height + height / 2); } From cc17cf88832b0361e5f2489b5345c90227e4afee Mon Sep 17 00:00:00 2001 From: Dimitris Panokostas Date: Sat, 9 Nov 2024 18:41:05 +0100 Subject: [PATCH 2/3] Avoid hardcoding color in listbox (#129) * Use const in more places * Revert "Use const in more places" This reverts commit 125b4aa25be08ece3d7d30649cb17e188ce26160. * Don't hardcode listbox inactive color Instead of hardcoding a specific color for the Inactive one, calculate it based on the Selection color. This helps when the colors are customized from the defaults. --- src/widgets/listbox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/listbox.cpp b/src/widgets/listbox.cpp index c256642..258e532 100644 --- a/src/widgets/listbox.cpp +++ b/src/widgets/listbox.cpp @@ -126,7 +126,7 @@ namespace gcn startRow = 0; } - const auto inactive_color = Color(170, 170, 170); + const auto inactive_color = getSelectionColor() - 0x303030; // The y coordinate where we start to draw the text is // simply the y coordinate multiplied with the font height. From ae0a35c0a1275ecaeff05df94ab7c962c04148fa Mon Sep 17 00:00:00 2001 From: Dimitris Panokostas Date: Sat, 9 Nov 2024 18:47:20 +0100 Subject: [PATCH 3/3] Fix dropdown scrollbars (#130) * Use const in more places * Revert "Use const in more places" This reverts commit 125b4aa25be08ece3d7d30649cb17e188ce26160. * Fixed dropdown scrollbars obstructing content In some cases, the dropdown would show the scollbars on top of the content, obstructing it. This was very apparent in cases where the content has only one entry, and the horizontal scrollbar is drawn on top of it, making it impossible to see or select that entry. --- src/widgets/dropdown.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index 8c3f0a5..ef690bf 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -414,11 +414,11 @@ namespace gcn else { setHeight(listBoxHeight + h2 + 2); - mScrollArea->setHeight(listBoxHeight); + mScrollArea->setHeight(listBoxHeight + mScrollArea->getScrollbarWidth()); } } - mScrollArea->setWidth(getWidth()); + mScrollArea->setWidth(getWidth() + mScrollArea->getScrollbarWidth()); // Resize the ListBox to exactly fit the ScrollArea. mListBox->setWidth(mScrollArea->getChildrenArea().width); mScrollArea->setPosition(0, 0);