summaryrefslogtreecommitdiff
path: root/src/gui/window.h
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-10-20 11:29:18 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-10-20 11:29:18 +0000
commit59472ef68fdef3f7e8858a81a46e28c127119c58 (patch)
tree75b5f5e658fa1b05487463f0449440524ed76256 /src/gui/window.h
parent41cf359468d6379bc0e033bee9ac148d1b9255dd (diff)
downloadmana-59472ef68fdef3f7e8858a81a46e28c127119c58.tar.gz
mana-59472ef68fdef3f7e8858a81a46e28c127119c58.tar.bz2
mana-59472ef68fdef3f7e8858a81a46e28c127119c58.tar.xz
mana-59472ef68fdef3f7e8858a81a46e28c127119c58.zip
Added a layout handler for automatically positioning widgets in a window. Fixed layout of login dialog box when native language is not English.
Diffstat (limited to 'src/gui/window.h')
-rw-r--r--src/gui/window.h39
1 files changed, 25 insertions, 14 deletions
diff --git a/src/gui/window.h b/src/gui/window.h
index ab266422..034c99da 100644
--- a/src/gui/window.h
+++ b/src/gui/window.h
@@ -30,12 +30,13 @@
#include "windowlistener.h"
+class Cell;
class ConfigListener;
-class GCContainer;
+class Image;
class ImageRect;
+class Layout;
class ResizeGrip;
class WindowContainer;
-class Image;
/**
* A window. This window can be dragged around and has a title bar. Windows are
@@ -62,7 +63,7 @@ class Window : public gcn::Window
Window *parent = NULL);
/**
- * Destructor.
+ * Destructor. Deletes all the added widgets.
*/
~Window();
@@ -77,16 +78,6 @@ class Window : public gcn::Window
void draw(gcn::Graphics *graphics);
/**
- * Adds a widget to the window.
- */
- void add(gcn::Widget *wi, bool delChild = true);
-
- /**
- * Adds a widget to the window and also specifices its position.
- */
- void add(gcn::Widget *w, int x, int y, bool delChild = true);
-
- /**
* Sets the width of the window contents.
*/
void setContentWidth(int width);
@@ -291,6 +282,26 @@ class Window : public gcn::Window
/** The window container windows add themselves to. */
static WindowContainer *windowContainer;
+ /**
+ * Gets the layout handler for this window.
+ */
+ Layout &getLayout();
+
+ /**
+ * Deletes the layout handler.
+ */
+ void forgetLayout();
+
+ /**
+ * Resizes the window after computing the position of the widgets.
+ */
+ void reflowLayout();
+
+ /**
+ * Adds a widget to the window and sets it at given cell.
+ */
+ Cell &place(int x, int y, gcn::Widget *, int w = 1, int h = 1);
+
private:
/**
* Determines if the mouse is in a resize area and returns appropriate
@@ -301,9 +312,9 @@ class Window : public gcn::Window
*/
int getResizeHandles(gcn::MouseEvent &event);
- GCContainer *mChrome; /**< Contained container */
ResizeGrip *mGrip; /**< Resize grip */
Window *mParent; /**< The parent window */
+ Layout *mLayout; /**< Layout handler */
std::string mConfigName; /**< Name used for saving window-related data */
bool mShowTitle; /**< Window has a title bar */
bool mModal; /**< Window is modal */