diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-15 17:39:57 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-15 17:39:57 +0300 |
commit | 5658a770c18b99807e4a598e7dc70ea3f765ba81 (patch) | |
tree | f61a418fa237f82004a99a03b85a2e80ab01bd8f | |
parent | b2b348d4baf2891fd82635e068a4f64d2694ba6d (diff) | |
download | manaplus-5658a770c18b99807e4a598e7dc70ea3f765ba81.tar.gz manaplus-5658a770c18b99807e4a598e7dc70ea3f765ba81.tar.bz2 manaplus-5658a770c18b99807e4a598e7dc70ea3f765ba81.tar.xz manaplus-5658a770c18b99807e4a598e7dc70ea3f765ba81.zip |
Override some methods in guichan listbox.
-rw-r--r-- | src/gui/setup_colors.h | 4 | ||||
-rw-r--r-- | src/gui/setup_input.h | 5 | ||||
-rw-r--r-- | src/gui/setup_video.h | 4 | ||||
-rw-r--r-- | src/gui/widgets/listbox.cpp | 12 | ||||
-rw-r--r-- | src/gui/widgets/listbox.h | 4 | ||||
-rw-r--r-- | src/gui/worldselectdialog.h | 8 | ||||
-rw-r--r-- | src/guichan/widgets/button.cpp | 2 | ||||
-rw-r--r-- | src/guichan/widgets/listbox.cpp | 3 |
8 files changed, 24 insertions, 18 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; }; diff --git a/src/guichan/widgets/button.cpp b/src/guichan/widgets/button.cpp index 69affd4b7..585b30f13 100644 --- a/src/guichan/widgets/button.cpp +++ b/src/guichan/widgets/button.cpp @@ -132,8 +132,6 @@ namespace gcn void Button::adjustSize() { - setWidth(getFont()->getWidth(mCaption) + 2*mSpacing); - setHeight(getFont()->getHeight() + 2*mSpacing); } bool Button::isPressed() const diff --git a/src/guichan/widgets/listbox.cpp b/src/guichan/widgets/listbox.cpp index 66ddf8315..35978f648 100644 --- a/src/guichan/widgets/listbox.cpp +++ b/src/guichan/widgets/listbox.cpp @@ -96,7 +96,6 @@ namespace gcn void ListBox::logic() { - adjustSize(); } int ListBox::getSelected() const @@ -186,8 +185,6 @@ namespace gcn void ListBox::adjustSize() { - if (mListModel) - setHeight(getRowHeight() * mListModel->getNumberOfElements()); } bool ListBox::isWrappingEnabled() const |