summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/setup_colors.h4
-rw-r--r--src/gui/setup_input.h5
-rw-r--r--src/gui/setup_video.h4
-rw-r--r--src/gui/widgets/listbox.cpp12
-rw-r--r--src/gui/widgets/listbox.h4
-rw-r--r--src/gui/worldselectdialog.h8
6 files changed, 24 insertions, 13 deletions
diff --git a/src/gui/setup_colors.h b/src/gui/setup_colors.h
index 407175698..89909ecce 100644
--- a/src/gui/setup_colors.h
+++ b/src/gui/setup_colors.h
@@ -31,12 +31,12 @@
class BrowserBox;
class Label;
+class ListBox;
class TextField;
class TextPreview;
namespace gcn
{
- class ListBox;
class ScrollArea;
class Slider;
}
@@ -62,7 +62,7 @@ class Setup_Colors final : public SetupTab,
private:
static const std::string rawmsg;
- gcn::ListBox *mColorBox;
+ ListBox *mColorBox;
gcn::ScrollArea *mScroll;
BrowserBox *mPreview;
TextPreview *mTextPreview;
diff --git a/src/gui/setup_input.h b/src/gui/setup_input.h
index 8fefe9923..ba7ddcf29 100644
--- a/src/gui/setup_input.h
+++ b/src/gui/setup_input.h
@@ -28,11 +28,10 @@
#include <guichan/actionlistener.hpp>
-#include <guichan/widgets/listbox.hpp>
-
#include <string>
class Button;
+class ListBox;
class TabStrip;
struct SetupActionData;
@@ -90,7 +89,7 @@ class Setup_Input final : public SetupTab
const std::string &text) const;
class KeyListModel *mKeyListModel;
- gcn::ListBox *mKeyList;
+ ListBox *mKeyList;
Button *mAssignKeyButton;
Button *mUnassignKeyButton;
diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h
index e00495655..6ae5af1d6 100644
--- a/src/gui/setup_video.h
+++ b/src/gui/setup_video.h
@@ -32,6 +32,7 @@
class Button;
class Label;
+class ListBox;
class ModeListModel;
class OpenGLListModel;
class TextDialog;
@@ -40,7 +41,6 @@ namespace gcn
{
class CheckBox;
class DropDown;
- class ListBox;
class Slider;
}
@@ -77,7 +77,7 @@ class Setup_Video final : public SetupTab, public gcn::KeyListener
Label *scrollRadiusLabel;
Label *scrollLazinessLabel;
- gcn::ListBox *mModeList;
+ ListBox *mModeList;
gcn::CheckBox *mFsCheckBox;
gcn::DropDown *mOpenGLDropDown;
gcn::CheckBox *mCustomCursorCheckBox;
diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp
index 259e49972..3592b12da 100644
--- a/src/gui/widgets/listbox.cpp
+++ b/src/gui/widgets/listbox.cpp
@@ -48,6 +48,7 @@ ListBox::ListBox(gcn::ListModel *const listModel):
mOldSelected(-1)
{
mForegroundColor = Theme::getThemeColor(Theme::LISTBOX);
+ adjustSize();
}
ListBox::~ListBox()
@@ -193,3 +194,14 @@ void ListBox::refocus()
if (isFocusable())
mFocusHandler->requestFocus(this);
}
+
+void ListBox::adjustSize()
+{
+ if (mListModel)
+ setHeight(getRowHeight() * mListModel->getNumberOfElements());
+}
+
+void ListBox::logic()
+{
+ adjustSize();
+}
diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h
index e3976454d..c9a70557f 100644
--- a/src/gui/widgets/listbox.h
+++ b/src/gui/widgets/listbox.h
@@ -77,6 +77,10 @@ class ListBox : public gcn::ListBox
void setDistributeMousePressed(bool b)
{ mDistributeMousePressed = b; }
+ void adjustSize();
+
+ void logic() override;
+
protected:
gcn::Color mHighlightColor;
bool mDistributeMousePressed;
diff --git a/src/gui/worldselectdialog.h b/src/gui/worldselectdialog.h
index ce238cb0e..33e588311 100644
--- a/src/gui/worldselectdialog.h
+++ b/src/gui/worldselectdialog.h
@@ -34,14 +34,10 @@
#include <vector>
class Button;
+class ListBox;
class LoginData;
class WorldListModel;
-namespace gcn
-{
- class ListBox;
-}
-
/**
* The server select dialog.
*
@@ -74,7 +70,7 @@ class WorldSelectDialog final : public Window, public gcn::ActionListener,
private:
WorldListModel *mWorldListModel;
- gcn::ListBox *mWorldList;
+ ListBox *mWorldList;
Button *mChangeLoginButton;
Button *mChooseWorld;
};