summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2025-04-02 09:28:31 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2025-04-02 09:44:09 +0200
commit71b39b1d1674406703cbdfd5f3297af72e92bfe9 (patch)
tree460730472a50e476175554af998f328559df15c2 /src
parentce60630c42e232bf81f22019e3499d6036a68f7e (diff)
downloadmana-71b39b1d1674406703cbdfd5f3297af72e92bfe9.tar.gz
mana-71b39b1d1674406703cbdfd5f3297af72e92bfe9.tar.bz2
mana-71b39b1d1674406703cbdfd5f3297af72e92bfe9.tar.xz
mana-71b39b1d1674406703cbdfd5f3297af72e92bfe9.zip
Fixed minimum width of the Social window
Needs to allow space for all three buttons, especially since they are no longer clipped to the window.
Diffstat (limited to 'src')
-rw-r--r--src/gui/socialwindow.cpp16
-rw-r--r--src/gui/widgets/window.cpp14
-rw-r--r--src/gui/widgets/window.h5
3 files changed, 25 insertions, 10 deletions
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp
index fcc19673..072d87bc 100644
--- a/src/gui/socialwindow.cpp
+++ b/src/gui/socialwindow.cpp
@@ -34,6 +34,7 @@
#include "gui/widgets/avatarlistbox.h"
#include "gui/widgets/browserbox.h"
#include "gui/widgets/button.h"
+#include "gui/widgets/layout.h"
#include "gui/widgets/linkhandler.h"
#include "gui/widgets/popup.h"
#include "gui/widgets/scrollarea.h"
@@ -360,13 +361,8 @@ SocialWindow::SocialWindow() :
setResizable(true);
setSaveVisible(true);
setCloseButton(true);
- setMinWidth(120);
- setMinHeight(55);
- setDefaultSize(590, 200, 150, 124);
setupWindow->registerWindowForReset(this);
- loadWindowState();
-
mCreateButton = new Button(_("Create"), "create", this);
mInviteButton = new Button(_("Invite"), "invite", this);
mLeaveButton = new Button(_("Leave"), "leave", this);
@@ -377,7 +373,13 @@ SocialWindow::SocialWindow() :
place(2, 0, mLeaveButton);
place(0, 1, mTabs, 4, 4);
- widgetResized(nullptr);
+ // Determine minimum size
+ int width = 0, height = 0;
+ getLayout().reflow(width, height);
+ setMinimumContentSize(width, height);
+
+ setDefaultSize(590, 200, 150, 124);
+ loadWindowState();
mCreatePopup = new CreatePopup;
@@ -387,9 +389,7 @@ SocialWindow::SocialWindow() :
mTabs->addTab(mPlayerListTab, mPlayerListTab->mScroll.get());
if (local_player->getParty())
- {
addTab(local_player->getParty());
- }
else
updateButtons();
}
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 4a0b8286..7d6f61f3 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -150,8 +150,8 @@ void Window::drawFrame(gcn::Graphics *graphics)
void Window::setContentSize(int width, int height)
{
- width = width + 2 * getPadding();
- height = height + getPadding() + getTitleBarHeight();
+ width += 2 * getPadding();
+ height += getPadding() + getTitleBarHeight();
if (getMinWidth() > width)
width = getMinWidth();
@@ -165,6 +165,16 @@ void Window::setContentSize(int width, int height)
setSize(width, height);
}
+void Window::setMinimumContentSize(int width, int height)
+{
+ const int padding = getPadding();
+ const int titleBarHeight = getTitleBarHeight();
+ auto &skin = gui->getTheme()->getSkin(SkinType::Window);
+
+ setMinWidth(std::max(skin.getMinWidth(), width + 2 * padding));
+ setMinHeight(std::max(skin.getMinHeight(), height + padding + titleBarHeight));
+}
+
void Window::setLocationRelativeTo(gcn::Widget *widget)
{
int wx;
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index c89ccfdc..bf459a32 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -83,6 +83,11 @@ class Window : public gcn::Window, gcn::WidgetListener
void setContentSize(int width, int height);
/**
+ * Sets the minimum size of the window content.
+ */
+ void setMinimumContentSize(int width, int height);
+
+ /**
* Sets the location relative to the given widget.
*/
void setLocationRelativeTo(gcn::Widget *widget);