summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/buy.cpp1
-rw-r--r--src/gui/char_server.cpp1
-rw-r--r--src/gui/npc.cpp1
-rw-r--r--src/gui/scrollarea.cpp21
-rw-r--r--src/gui/scrollarea.h6
-rw-r--r--src/gui/sell.cpp1
6 files changed, 31 insertions, 0 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index 79f21227..d291650d 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -47,6 +47,7 @@ BuyDialog::BuyDialog():
itemDescLabel = new gcn::Label("Description:");
setContentSize(260, 198);
+ scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
scrollArea->setDimension(gcn::Rectangle(5, 5, 250, 110));
itemList->setDimension(gcn::Rectangle(5, 5, 238, 110));
slider->setDimension(gcn::Rectangle(5, 120, 200, 10));
diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp
index a2bd352f..8674b6d4 100644
--- a/src/gui/char_server.cpp
+++ b/src/gui/char_server.cpp
@@ -50,6 +50,7 @@ ServerSelectDialog::ServerSelectDialog():
okButton->setPosition(
cancelButton->getX() - okButton->getWidth() - 5,
100 - okButton->getHeight() - 5);
+ scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
scrollArea->setDimension(gcn::Rectangle(
5, 5, 200 - 2 * 5,
100 - 3 * 5 - cancelButton->getHeight() -
diff --git a/src/gui/npc.cpp b/src/gui/npc.cpp
index 42d1151c..084f2f6a 100644
--- a/src/gui/npc.cpp
+++ b/src/gui/npc.cpp
@@ -37,6 +37,7 @@ NpcListDialog::NpcListDialog():
cancelButton = new Button("Cancel");
setContentSize(260, 175);
+ scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
scrollArea->setDimension(gcn::Rectangle(
5, 5, 250, 160 - okButton->getHeight()));
cancelButton->setPosition(
diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp
index ad31ada8..319025a0 100644
--- a/src/gui/scrollarea.cpp
+++ b/src/gui/scrollarea.cpp
@@ -137,6 +137,27 @@ void ScrollArea::init()
instances++;
}
+void ScrollArea::logic()
+{
+ gcn::ScrollArea::logic();
+
+ // When no scrollbar in a certain direction, adapt content size to match
+ // the content dimension exactly.
+ if (mContent != NULL)
+ {
+ if (getHorizontalScrollPolicy() == gcn::ScrollArea::SHOW_NEVER)
+ {
+ mContent->setWidth(getContentDimension().width -
+ 2 * mContent->getBorderSize());
+ }
+ if (getVerticalScrollPolicy() == gcn::ScrollArea::SHOW_NEVER)
+ {
+ mContent->setHeight(getContentDimension().height -
+ 2 * mContent->getBorderSize());
+ }
+ }
+}
+
void ScrollArea::draw(gcn::Graphics *graphics)
{
checkPolicies();
diff --git a/src/gui/scrollarea.h b/src/gui/scrollarea.h
index e3e57ae2..66ec1542 100644
--- a/src/gui/scrollarea.h
+++ b/src/gui/scrollarea.h
@@ -51,6 +51,12 @@ class ScrollArea : public gcn::ScrollArea {
~ScrollArea();
/**
+ * Logic function optionally adapts width or height of contents. This
+ * depends on the scrollbar settings.
+ */
+ void logic();
+
+ /**
* Draws the scroll area.
*/
void draw(gcn::Graphics *graphics);
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index f2e1677f..95c4a2dc 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -45,6 +45,7 @@ SellDialog::SellDialog():
okButton->setEnabled(false);
setContentSize(260, 175);
+ scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
scrollArea->setDimension(gcn::Rectangle(5, 5, 250, 110));
itemList->setDimension(gcn::Rectangle(5, 5, 238, 110));
slider->setDimension(gcn::Rectangle(5, 120, 200, 10));