summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/confirm_dialog.cpp14
-rw-r--r--src/gui/confirm_dialog.h4
-rw-r--r--src/gui/itempopup.cpp63
-rw-r--r--src/gui/itempopup.h4
-rw-r--r--src/gui/ok_dialog.cpp14
-rw-r--r--src/gui/ok_dialog.h4
-rw-r--r--src/gui/popupmenu.cpp4
-rw-r--r--src/gui/speechbubble.cpp11
-rw-r--r--src/gui/speechbubble.h2
9 files changed, 28 insertions, 92 deletions
diff --git a/src/gui/confirm_dialog.cpp b/src/gui/confirm_dialog.cpp
index 969000f3..7caa4580 100644
--- a/src/gui/confirm_dialog.cpp
+++ b/src/gui/confirm_dialog.cpp
@@ -22,7 +22,6 @@
#include "gui/confirm_dialog.h"
#include "gui/widgets/button.h"
-#include "gui/widgets/scrollarea.h"
#include "gui/widgets/textbox.h"
#include "gui/gui.h"
@@ -38,17 +37,11 @@ ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg,
mTextBox = new TextBox;
mTextBox->setEditable(false);
mTextBox->setOpaque(false);
+ mTextBox->setTextWrapped(msg, 260);
- mTextArea = new ScrollArea(mTextBox);
gcn::Button *yesButton = new Button(_("Yes"), "yes", this);
gcn::Button *noButton = new Button(_("No"), "no", this);
- mTextArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mTextArea->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mTextArea->setOpaque(false);
-
- mTextBox->setTextWrapped(msg, 260);
-
const int numRows = mTextBox->getNumberOfRows();
const int inWidth = yesButton->getWidth() + noButton->getWidth() +
(2 * getPadding());
@@ -63,8 +56,7 @@ ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg,
setContentSize(mTextBox->getMinWidth() + fontHeight, height + fontHeight +
noButton->getHeight());
- mTextArea->setDimension(gcn::Rectangle(4, 5, width + 2 * getPadding(),
- height + getPadding()));
+ mTextBox->setPosition(getPadding(), getPadding());
// 8 is the padding that GUIChan adds to button widgets
// (top and bottom combined)
@@ -72,7 +64,7 @@ ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg,
noButton->setPosition(yesButton->getX() + inWidth - noButton->getWidth(),
height + 8);
- add(mTextArea);
+ add(mTextBox);
add(yesButton);
add(noButton);
diff --git a/src/gui/confirm_dialog.h b/src/gui/confirm_dialog.h
index dad79933..38ea2abd 100644
--- a/src/gui/confirm_dialog.h
+++ b/src/gui/confirm_dialog.h
@@ -26,7 +26,6 @@
#include <guichan/actionlistener.hpp>
-class ScrollArea;
class TextBox;
/**
@@ -43,7 +42,7 @@ class ConfirmDialog : public Window, public gcn::ActionListener
* @see Window::Window
*/
ConfirmDialog(const std::string &title, const std::string &msg,
- Window *parent = NULL);
+ Window *parent = NULL);
/**
* Called when receiving actions from the widgets.
@@ -52,7 +51,6 @@ class ConfirmDialog : public Window, public gcn::ActionListener
private:
TextBox *mTextBox;
- ScrollArea *mTextArea;
};
#endif
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index a4229324..1aa61f5b 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -25,7 +25,6 @@
#include "gui/gui.h"
#include "gui/palette.h"
-#include "gui/widgets/scrollarea.h"
#include "gui/widgets/textbox.h"
#include "graphics.h"
@@ -43,48 +42,29 @@ ItemPopup::ItemPopup():
// Item Name
mItemName = new gcn::Label;
mItemName->setFont(boldFont);
- mItemName->setPosition(2, 2);
+ mItemName->setPosition(getPadding(), getPadding());
+
+ const int fontHeight = getFont()->getHeight();
// Item Description
mItemDesc = new TextBox;
mItemDesc->setEditable(false);
- mItemDescScroll = new ScrollArea(mItemDesc);
-
- const int fontHeight = getFont()->getHeight();
-
- mItemDescScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mItemDescScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mItemDescScroll->setDimension(gcn::Rectangle(0, 0, 196, fontHeight));
- mItemDescScroll->setOpaque(false);
- mItemDescScroll->setPosition(2, fontHeight);
+ mItemDesc->setPosition(getPadding(), fontHeight);
// Item Effect
mItemEffect = new TextBox;
mItemEffect->setEditable(false);
- mItemEffectScroll = new ScrollArea(mItemEffect);
-
- mItemEffectScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mItemEffectScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mItemEffectScroll->setDimension(gcn::Rectangle(0, 0, 196, fontHeight));
- mItemEffectScroll->setOpaque(false);
- mItemEffectScroll->setPosition(2, (2 * fontHeight) +
- (2 * getPadding()));
+ mItemEffect->setPosition(getPadding(), 2 * fontHeight + 2 * getPadding());
// Item Weight
mItemWeight = new TextBox;
mItemWeight->setEditable(false);
- mItemWeightScroll = new ScrollArea(mItemWeight);
-
- mItemWeightScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mItemWeightScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mItemWeightScroll->setDimension(gcn::Rectangle(0, 0, 196, fontHeight));
- mItemWeightScroll->setOpaque(false);
- mItemWeightScroll->setPosition(2, 3 * fontHeight + 4 * getPadding());
+ mItemWeight->setPosition(getPadding(), 3 * fontHeight + 4 * getPadding());
add(mItemName);
- add(mItemDescScroll);
- add(mItemEffectScroll);
- add(mItemWeightScroll);
+ add(mItemDesc);
+ add(mItemEffect);
+ add(mItemWeight);
loadPopupConfiguration();
}
@@ -123,34 +103,27 @@ void ItemPopup::setItem(const ItemInfo &item)
const int numRowsDesc = mItemDesc->getNumberOfRows();
const int numRowsEffect = mItemEffect->getNumberOfRows();
- const int numRowsWeight = mItemWeight->getNumberOfRows();
+ //const int numRowsWeight = mItemWeight->getNumberOfRows();
const int height = getFont()->getHeight();
- mItemDescScroll->setDimension(gcn::Rectangle(2, 0, minWidth,
- numRowsDesc * height));
-
- mItemEffectScroll->setDimension(gcn::Rectangle(2, 0, minWidth,
- numRowsEffect * height));
-
- mItemWeightScroll->setDimension(gcn::Rectangle(2, 0, minWidth,
- numRowsWeight * height));
-
if (item.getEffect().empty())
{
setContentSize(minWidth, (numRowsDesc + 3) * height);
- mItemWeightScroll->setPosition(2, (numRowsDesc + 2) * height);
+ mItemWeight->setPosition(getPadding(), (numRowsDesc + getPadding()) *
+ height);
}
else
{
- setContentSize(minWidth, (numRowsDesc + numRowsEffect + 3) * height);
+ setContentSize(minWidth, (numRowsDesc + numRowsEffect + getPadding()) *
+ height);
- mItemWeightScroll->setPosition(2, (numRowsDesc + numRowsEffect + 2) *
- height);
+ mItemWeight->setPosition(getPadding(), (numRowsDesc + numRowsEffect +
+ getPadding()) * height);
}
- mItemDescScroll->setPosition(2, 20);
- mItemEffectScroll->setPosition(2, (numRowsDesc + 2) * height);
+ mItemDesc->setPosition(getPadding(), 2 * height);
+ mItemEffect->setPosition(getPadding(), (numRowsDesc + getPadding()) * height);
}
gcn::Color ItemPopup::getColor(ItemType type)
diff --git a/src/gui/itempopup.h b/src/gui/itempopup.h
index 687e664b..6140e4dd 100644
--- a/src/gui/itempopup.h
+++ b/src/gui/itempopup.h
@@ -27,7 +27,6 @@
#include "resources/iteminfo.h"
-class ScrollArea;
class TextBox;
/**
@@ -62,9 +61,6 @@ class ItemPopup : public Popup
TextBox *mItemEffect;
TextBox *mItemWeight;
ItemType mItemType;
- ScrollArea *mItemDescScroll;
- ScrollArea *mItemEffectScroll;
- ScrollArea *mItemWeightScroll;
static gcn::Color getColor(ItemType type);
};
diff --git a/src/gui/ok_dialog.cpp b/src/gui/ok_dialog.cpp
index 7ccb781e..fc8c81db 100644
--- a/src/gui/ok_dialog.cpp
+++ b/src/gui/ok_dialog.cpp
@@ -24,7 +24,6 @@
#include "gui/gui.h"
#include "gui/widgets/button.h"
-#include "gui/widgets/scrollarea.h"
#include "gui/widgets/textbox.h"
#include "utils/gettext.h"
@@ -38,16 +37,10 @@ OkDialog::OkDialog(const std::string &title, const std::string &msg,
mTextBox = new TextBox;
mTextBox->setEditable(false);
mTextBox->setOpaque(false);
+ mTextBox->setTextWrapped(msg, 260);
- mTextArea = new ScrollArea(mTextBox);
gcn::Button *okButton = new Button(_("Ok"), "ok", this);
- mTextArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mTextArea->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mTextArea->setOpaque(false);
-
- mTextBox->setTextWrapped(msg, 260);
-
const int numRows = mTextBox->getNumberOfRows();
const int fontHeight = getFont()->getHeight();
const int height = numRows * fontHeight;
@@ -60,14 +53,13 @@ OkDialog::OkDialog(const std::string &title, const std::string &msg,
setContentSize(mTextBox->getMinWidth() + fontHeight, height +
fontHeight + okButton->getHeight());
- mTextArea->setDimension(gcn::Rectangle(4, 5, width + 2 * getPadding(),
- height + getPadding()));
+ mTextBox->setPosition(getPadding(), getPadding());
// 8 is the padding that GUIChan adds to button widgets
// (top and bottom combined)
okButton->setPosition((width - okButton->getWidth()) / 2, height + 8);
- add(mTextArea);
+ add(mTextBox);
add(okButton);
center();
diff --git a/src/gui/ok_dialog.h b/src/gui/ok_dialog.h
index 26e788f5..5df2fb4f 100644
--- a/src/gui/ok_dialog.h
+++ b/src/gui/ok_dialog.h
@@ -26,7 +26,6 @@
#include <guichan/actionlistener.hpp>
-class ScrollArea;
class TextBox;
/**
@@ -43,7 +42,7 @@ class OkDialog : public Window, public gcn::ActionListener
* @see Window::Window
*/
OkDialog(const std::string &title, const std::string &msg,
- Window *parent = NULL);
+ Window *parent = NULL);
/**
* Called when receiving actions from the widgets.
@@ -52,7 +51,6 @@ class OkDialog : public Window, public gcn::ActionListener
private:
TextBox *mTextBox;
- ScrollArea *mTextArea;
};
#endif
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index d3298961..94d39e78 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -262,13 +262,9 @@ void PopupMenu::handleLink(const std::string &link)
player_node->equipItem(mItem);
#else
if (mItem->isEquipped())
- {
player_node->unequipItem(mItem);
- }
else
- {
player_node->equipItem(mItem);
- }
#endif
}
else
diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp
index da472449..e95e83ca 100644
--- a/src/gui/speechbubble.cpp
+++ b/src/gui/speechbubble.cpp
@@ -24,7 +24,6 @@
#include "gui/gui.h"
-#include "gui/widgets/scrollarea.h"
#include "gui/widgets/textbox.h"
#include "graphics.h"
@@ -49,14 +48,8 @@ SpeechBubble::SpeechBubble():
mSpeechBox->setOpaque(false);
mSpeechBox->setTextColor(&guiPalette->getColor(Palette::CHAT));
- mSpeechArea = new ScrollArea(mSpeechBox);
-
- mSpeechArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mSpeechArea->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mSpeechArea->setOpaque(false);
-
add(mCaption);
- add(mSpeechArea);
+ add(mSpeechBox);
loadPopupConfiguration();
}
@@ -96,5 +89,5 @@ void SpeechBubble::setText(const std::string &text, bool showName)
const int yPos = ((getHeight() - height) / 2) + nameHeight;
mCaption->setPosition(xPos, getPadding());
- mSpeechArea->setDimension(gcn::Rectangle(xPos, yPos, width, height));
+ mSpeechBox->setPosition(xPos, yPos);
}
diff --git a/src/gui/speechbubble.h b/src/gui/speechbubble.h
index 8455a1b1..dbd5ebee 100644
--- a/src/gui/speechbubble.h
+++ b/src/gui/speechbubble.h
@@ -27,7 +27,6 @@
#include "gui/widgets/popup.h"
-class ScrollArea;
class TextBox;
class SpeechBubble : public Popup
@@ -59,7 +58,6 @@ class SpeechBubble : public Popup
std::string mText;
gcn::Label *mCaption;
TextBox *mSpeechBox;
- ScrollArea *mSpeechArea;
};
#endif