summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2025-04-09 12:09:37 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2025-04-25 14:05:30 +0000
commitf48725cbf4e5ed620a57b1c945a109f0c225b1cd (patch)
treea9599aed7cf2ff3e24546ed5b87a7f54807e9776
parentcf6e213f060866ac5da46d4c516365b3cbedc7b3 (diff)
downloadmana-f48725cbf4e5ed620a57b1c945a109f0c225b1cd.tar.gz
mana-f48725cbf4e5ed620a57b1c945a109f0c225b1cd.tar.bz2
mana-f48725cbf4e5ed620a57b1c945a109f0c225b1cd.tar.xz
mana-f48725cbf4e5ed620a57b1c945a109f0c225b1cd.zip
Jewelry: Fixed sticky button position
Used "spacing" to store the additional space between the sticky button and the edge of the window (or the close button). Adjusted Popup and ToolWindow skins by one pixel to make the sticky button align the same way as for the Window skin.
-rw-r--r--data/graphics/gui/jewelry/theme.xml6
-rw-r--r--src/gui/widgets/window.cpp36
2 files changed, 21 insertions, 21 deletions
diff --git a/data/graphics/gui/jewelry/theme.xml b/data/graphics/gui/jewelry/theme.xml
index fd20f133..ba85278d 100644
--- a/data/graphics/gui/jewelry/theme.xml
+++ b/data/graphics/gui/jewelry/theme.xml
@@ -125,7 +125,7 @@
<skin type="ToolWindow" padding="9" titleBarHeight="18">
<state>
- <img src="window.png" x="220" y="148" width="107" height="42" left="9" right="9" top="9" bottom="9" />
+ <img src="window.png" x="220" y="149" width="107" height="41" left="9" right="9" top="9" bottom="9" />
</state>
</skin>
@@ -138,7 +138,7 @@
<skin type="Popup" padding="9" titleBarHeight="26" titleOffsetX="8" titleOffsetY="8">
<state>
<text color="#f1d9a9" outlineColor="#000000"/>
- <img src="window.png" x="220" y="106" width="107" height="42" left="9" right="9" top="9" bottom="9" />
+ <img src="window.png" x="220" y="107" width="107" height="41" left="9" right="9" top="9" bottom="9" />
</state>
</skin>
@@ -354,7 +354,7 @@
</state>
</skin>
- <skin type="ButtonSticky" padding="2">
+ <skin type="ButtonSticky" padding="2" spacing="4">
<state selected="true">
<img src="window.png" x="121" y="50" width="19" height="22" />
</state>
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index ea8bc064..b899e001 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -712,15 +712,15 @@ gcn::Rectangle Window::getCloseButtonRect() const
auto theme = gui->getTheme();
- auto &closeButtonSkin = theme->getSkin(SkinType::ButtonClose);
- const int closeButtonWidth = closeButtonSkin.getMinWidth();
- const int closeButtonHeight = closeButtonSkin.getMinHeight();
+ auto &closeSkin = theme->getSkin(SkinType::ButtonClose);
+ const int closeWidth = closeSkin.getMinWidth();
+ const int closeHeight = closeSkin.getMinHeight();
return {
- getWidth() - closeButtonWidth - closeButtonSkin.padding,
- closeButtonSkin.padding,
- closeButtonWidth,
- closeButtonHeight
+ getWidth() - closeWidth - closeSkin.padding,
+ closeSkin.padding,
+ closeWidth,
+ closeHeight
};
}
@@ -731,22 +731,22 @@ gcn::Rectangle Window::getStickyButtonRect() const
auto theme = gui->getTheme();
- auto &closeButtonSkin = theme->getSkin(SkinType::ButtonClose);
- const int closeButtonWidth = closeButtonSkin.getMinWidth();
+ auto &closeSkin = theme->getSkin(SkinType::ButtonClose);
+ const int closeWidth = closeSkin.getMinWidth();
- auto &stickyButtonSkin = theme->getSkin(SkinType::ButtonSticky);
- const int stickyButtonWidth = stickyButtonSkin.getMinWidth();
- const int stickyButtonHeight = stickyButtonSkin.getMinHeight();
+ auto &stickySkin = theme->getSkin(SkinType::ButtonSticky);
+ const int stickyWidth = stickySkin.getMinWidth();
+ const int stickyHeight = stickySkin.getMinHeight();
- int stickyButtonX = getWidth() - stickyButtonWidth - stickyButtonSkin.padding;
+ int stickyX = getWidth() - stickyWidth - stickySkin.padding - stickySkin.spacing;
if (mCloseButton)
- stickyButtonX -= closeButtonWidth + closeButtonSkin.padding;
+ stickyX -= closeWidth + closeSkin.padding;
return {
- stickyButtonX,
- stickyButtonSkin.padding,
- stickyButtonWidth,
- stickyButtonHeight
+ stickyX,
+ stickySkin.padding,
+ stickyWidth,
+ stickyHeight
};
}