summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-05-01 14:35:41 -0600
committerJared Adams <jaxad0127@gmail.com>2009-05-01 14:35:41 -0600
commit6a7d3f9343f29bd9b46f3bbac917aa190b42b14d (patch)
tree6de65bfdc540ea9ea1a065b013179f02a968d35d /src/gui/widgets
parentb6fb2326ffa687f6028d991e2d6203b3f2a92c5a (diff)
downloadmana-client-6a7d3f9343f29bd9b46f3bbac917aa190b42b14d.tar.gz
mana-client-6a7d3f9343f29bd9b46f3bbac917aa190b42b14d.tar.bz2
mana-client-6a7d3f9343f29bd9b46f3bbac917aa190b42b14d.tar.xz
mana-client-6a7d3f9343f29bd9b46f3bbac917aa190b42b14d.zip
Merge the NPC dialogs into one
Also add support for the new TMWServ NPC packets
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/window.cpp24
-rw-r--r--src/gui/widgets/window.h7
2 files changed, 31 insertions, 0 deletions
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 7de09994..87051686 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -687,6 +687,19 @@ Layout &Window::getLayout()
return *mLayout;
}
+void Window::clearLayout()
+{
+ clear(); // This removes widgets from the container
+
+ while (!mWidgets.empty())
+ delete mWidgets.front();
+
+ if (!mLayout)
+ delete mLayout;
+ mLayout = new Layout;
+
+}
+
LayoutCell &Window::place(int x, int y, gcn::Widget *wg, int w, int h)
{
add(wg);
@@ -707,6 +720,17 @@ void Window::reflowLayout(int w, int h)
setContentSize(w, h);
}
+void Window::redraw()
+{
+ if (mLayout)
+ {
+ const gcn::Rectangle area = getChildrenArea();
+ int w = area.width;
+ int h = area.height;
+ mLayout->reflow(w, h);
+ }
+}
+
void Window::center()
{
setLocationRelativeTo(getParent());
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index aa9872d3..11193654 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -95,6 +95,8 @@ class Window : public gcn::Window, gcn::WidgetListener
*/
void setResizable(bool resize);
+ void redraw();
+
/**
* Called whenever the widget changes size.
*/
@@ -293,6 +295,11 @@ class Window : public gcn::Window, gcn::WidgetListener
Layout &getLayout();
/**
+ * Clears the Window's layout (useful for redesigning the window)
+ */
+ void clearLayout();
+
+ /**
* Computes the position of the widgets according to the current
* layout. Resizes the window so that the layout fits. Deletes the
* layout.