summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-12-29 00:16:54 +0300
committerAndrei Karas <akaras@inbox.ru>2012-12-29 00:16:54 +0300
commit0cd049b5b56b34b0b7ab3e3eac93dcb255c4e118 (patch)
tree5dedc441dcf535f8ac4b43f8b8ea0bb27c8ba6ac /src/gui/widgets
parent7c51eee345d27e680a26a915ffccb2d0abf063ea (diff)
downloadmanaverse-0cd049b5b56b34b0b7ab3e3eac93dcb255c4e118.tar.gz
manaverse-0cd049b5b56b34b0b7ab3e3eac93dcb255c4e118.tar.bz2
manaverse-0cd049b5b56b34b0b7ab3e3eac93dcb255c4e118.tar.xz
manaverse-0cd049b5b56b34b0b7ab3e3eac93dcb255c4e118.zip
Show flags icons in language selection list
Also add support for extended listboxes in popuplist control.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/dropdown.cpp3
-rw-r--r--src/gui/widgets/dropdown.h1
-rw-r--r--src/gui/widgets/extendedlistbox.cpp13
-rw-r--r--src/gui/widgets/extendedlistbox.h3
-rw-r--r--src/gui/widgets/popuplist.cpp8
-rw-r--r--src/gui/widgets/popuplist.h2
6 files changed, 22 insertions, 8 deletions
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 384371107..dad85a0af 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -58,6 +58,7 @@ static std::string const dropdownFiles[2] =
DropDown::DropDown(const Widget2 *const widget,
gcn::ListModel *const listModel,
+ bool extended,
gcn::ActionListener *const listener,
const std::string &eventId):
gcn::ActionListener(),
@@ -67,7 +68,7 @@ DropDown::DropDown(const Widget2 *const widget,
gcn::FocusListener(),
gcn::SelectionListener(),
Widget2(widget),
- mPopup(new PopupList(this, listModel)),
+ mPopup(new PopupList(this, listModel, extended)),
mShadowColor(getThemeColor(Theme::DROPDOWN_SHADOW)),
mHighlightColor(getThemeColor(Theme::HIGHLIGHT)),
mPadding(1),
diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h
index 6b3b6503a..1707857cb 100644
--- a/src/gui/widgets/dropdown.h
+++ b/src/gui/widgets/dropdown.h
@@ -72,6 +72,7 @@ class DropDown final : public gcn::ActionListener,
*/
DropDown(const Widget2 *const widget,
gcn::ListModel *const listModel = nullptr,
+ bool extended = false,
gcn::ActionListener *const listener = nullptr,
const std::string &eventId = "");
diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp
index b932f91b0..8c850775a 100644
--- a/src/gui/widgets/extendedlistbox.cpp
+++ b/src/gui/widgets/extendedlistbox.cpp
@@ -37,12 +37,21 @@
#include "debug.h"
ExtendedListBox::ExtendedListBox(const Widget2 *const widget,
- gcn::ListModel *const listModel) :
+ gcn::ListModel *const listModel,
+ int rowHeight) :
ListBox(widget, listModel),
- mRowHeight(13),
+ mRowHeight(rowHeight),
mImagePadding(mSkin ? mSkin->getOption("imagePadding") : 0),
mSpacing(mSkin ? mSkin->getOption("spacing") : 0)
{
+ if (!mRowHeight)
+ {
+ const gcn::Font *font = getFont();
+ if (font)
+ mRowHeight = font->getHeight() + 2 * mPadding;
+ else
+ mRowHeight = 13;
+ }
}
ExtendedListBox::~ExtendedListBox()
diff --git a/src/gui/widgets/extendedlistbox.h b/src/gui/widgets/extendedlistbox.h
index 32fd274aa..79ae868cf 100644
--- a/src/gui/widgets/extendedlistbox.h
+++ b/src/gui/widgets/extendedlistbox.h
@@ -30,7 +30,8 @@ class ExtendedListBox final : public ListBox
* Constructor.
*/
ExtendedListBox(const Widget2 *const widget,
- gcn::ListModel *const listModel);
+ gcn::ListModel *const listModel,
+ int rowHeight = 13);
A_DELETE_COPY(ExtendedListBox)
diff --git a/src/gui/widgets/popuplist.cpp b/src/gui/widgets/popuplist.cpp
index 260dcb6a9..80fd12e85 100644
--- a/src/gui/widgets/popuplist.cpp
+++ b/src/gui/widgets/popuplist.cpp
@@ -23,7 +23,7 @@
#include "gui/gui.h"
#include "gui/widgets/dropdown.h"
-#include "gui/widgets/listbox.h"
+#include "gui/widgets/extendedlistbox.h"
#include "gui/widgets/scrollarea.h"
#include "utils/gettext.h"
@@ -31,11 +31,13 @@
#include "debug.h"
PopupList::PopupList(DropDown *const widget,
- gcn::ListModel *const listModel):
+ gcn::ListModel *const listModel,
+ bool extended):
Popup("PopupList", "popuplist.xml"),
gcn::FocusListener(),
mListModel(listModel),
- mListBox(new ListBox(widget, listModel)),
+ mListBox(extended ? new ExtendedListBox(widget, listModel, 0) :
+ new ListBox(widget, listModel)),
mScrollArea(new ScrollArea(mListBox, false)),
mDropDown(widget)
{
diff --git a/src/gui/widgets/popuplist.h b/src/gui/widgets/popuplist.h
index e609b52f6..3ba3773fe 100644
--- a/src/gui/widgets/popuplist.h
+++ b/src/gui/widgets/popuplist.h
@@ -39,7 +39,7 @@ class PopupList final : public Popup,
{
public:
PopupList(DropDown *const widget,
- gcn::ListModel *const listModel);
+ gcn::ListModel *const listModel, bool extended);
~PopupList();