summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-15 17:39:57 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-15 17:39:57 +0300
commit5658a770c18b99807e4a598e7dc70ea3f765ba81 (patch)
treef61a418fa237f82004a99a03b85a2e80ab01bd8f /src/gui/widgets
parentb2b348d4baf2891fd82635e068a4f64d2694ba6d (diff)
downloadmanaplus-5658a770c18b99807e4a598e7dc70ea3f765ba81.tar.gz
manaplus-5658a770c18b99807e4a598e7dc70ea3f765ba81.tar.bz2
manaplus-5658a770c18b99807e4a598e7dc70ea3f765ba81.tar.xz
manaplus-5658a770c18b99807e4a598e7dc70ea3f765ba81.zip
Override some methods in guichan listbox.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/listbox.cpp12
-rw-r--r--src/gui/widgets/listbox.h4
2 files changed, 16 insertions, 0 deletions
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;