summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-01-20 23:14:44 -0700
committerIra Rice <irarice@gmail.com>2009-01-20 23:14:44 -0700
commitf4a57afa912826499ca8ff5a7b74fa69ba04f0ac (patch)
tree1e0c4e8efefaa27d0b0550b212d936af9d5a110a /src/gui
parent518b19cbdc4037de948dd4b456885d8c6c2b9f41 (diff)
downloadmana-f4a57afa912826499ca8ff5a7b74fa69ba04f0ac.tar.gz
mana-f4a57afa912826499ca8ff5a7b74fa69ba04f0ac.tar.bz2
mana-f4a57afa912826499ca8ff5a7b74fa69ba04f0ac.tar.xz
mana-f4a57afa912826499ca8ff5a7b74fa69ba04f0ac.zip
Reflowed emote window using the layout code.
Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/emotewindow.cpp32
-rw-r--r--src/gui/emotewindow.h10
2 files changed, 7 insertions, 35 deletions
diff --git a/src/gui/emotewindow.cpp b/src/gui/emotewindow.cpp
index 9639d9b6..3653cb68 100644
--- a/src/gui/emotewindow.cpp
+++ b/src/gui/emotewindow.cpp
@@ -29,6 +29,8 @@
#include "emotecontainer.h"
#include "scrollarea.h"
+#include "widgets/layout.h"
+
#include "../localplayer.h"
#include "../utils/gettext.h"
@@ -41,6 +43,7 @@ EmoteWindow::EmoteWindow():
setResizable(true);
setCloseButton(true);
setMinWidth(80);
+ setMinHeight(130);
setDefaultSize(115, 25, 322, 200);
mUseButton = new Button(_("Use"), "use", this);
@@ -51,10 +54,11 @@ EmoteWindow::EmoteWindow():
mEmoteScroll = new ScrollArea(mEmotes);
mEmoteScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- draw();
+ place(0, 0, mEmoteScroll, 5, 4);
+ place(4, 4, mUseButton);
- add(mUseButton);
- add(mEmoteScroll);
+ Layout &layout = getLayout();
+ layout.setRowHeight(0, Layout::AUTO_SET);
mUseButton->setSize(60, mUseButton->getHeight());
@@ -71,28 +75,6 @@ void EmoteWindow::action(const gcn::ActionEvent &event)
player_node->emote(emote);
}
-
-void EmoteWindow::draw()
-{
- const gcn::Rectangle &area = getChildrenArea();
- const int width = area.width;
- const int height = area.height;
-
- mUseButton->setPosition(8, height - 8 - mUseButton->getHeight());
-
- mEmoteScroll->setSize(width - 16, mUseButton->getY() - 18);
- mEmoteScroll->setPosition(8, 10);
-
- setMinHeight(130);
-}
-
-void EmoteWindow::widgetResized(const gcn::Event &event)
-{
- Window::widgetResized(event);
- draw();
-}
-
-
int EmoteWindow::getSelectedEmote() const
{
return mEmotes->getSelectedEmote();
diff --git a/src/gui/emotewindow.h b/src/gui/emotewindow.h
index a996db99..e92808dc 100644
--- a/src/gui/emotewindow.h
+++ b/src/gui/emotewindow.h
@@ -56,16 +56,6 @@ class EmoteWindow : public Window, gcn::ActionListener,
*/
int getSelectedEmote() const;
- /**
- * Updates window drawing.
- */
- void draw();
-
- /**
- * Called whenever the widget changes size.
- */
- void widgetResized(const gcn::Event &event);
-
private:
EmoteContainer *mEmotes;