summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-01-07 12:45:31 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-01-07 12:45:31 +0000
commit5d94840c848fb0c41fb2c1d92488510936acdcd2 (patch)
tree5f2885924d1779fe8e385a1b4adff3d7a24bacd0
parent7692d16b78efd8a4f683150094065079df84461d (diff)
downloadmana-5d94840c848fb0c41fb2c1d92488510936acdcd2.tar.gz
mana-5d94840c848fb0c41fb2c1d92488510936acdcd2.tar.bz2
mana-5d94840c848fb0c41fb2c1d92488510936acdcd2.tar.xz
mana-5d94840c848fb0c41fb2c1d92488510936acdcd2.zip
Solved the window dragging problem.
-rw-r--r--file.list1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/gui/gui.cpp7
-rw-r--r--src/gui/window.cpp12
-rw-r--r--src/gui/window.h2
5 files changed, 18 insertions, 5 deletions
diff --git a/file.list b/file.list
index e71473da..86be4d08 100644
--- a/file.list
+++ b/file.list
@@ -30,6 +30,7 @@ MODULES = src/sound/sound.cpp \
src/gui/textbox.cpp \
src/gui/textfield.cpp \
src/gui/window.cpp \
+ src/gui/windowcontainer.cpp \
src/net/network.cpp \
src/net/protocol.cpp \
src/configuration.cpp \
diff --git a/src/Makefile.am b/src/Makefile.am
index 7c8923b7..d64b7b7b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -31,6 +31,7 @@ tmw_SOURCES = sound/sound.cpp \
gui/textbox.cpp \
gui/textfield.cpp \
gui/window.cpp \
+ gui/windowcontainer.cpp \
net/network.cpp \
net/protocol.cpp \
astar.cpp \
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index c227f05f..5cd475af 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -28,10 +28,7 @@
#include "../log.h"
#include "../sound/sound.h"
#include "allegroinput.h"
-
-#ifndef WIN32
-#define __cdecl __attribute__((cdecl))
-#endif
+#include "windowcontainer.h"
#define GUI_BMP_COUNT 11
#define GUI_BMP_OFS_BUTTON 0
@@ -71,7 +68,7 @@ Gui::Gui(BITMAP *screen)
gcn::Image::setImageLoader(imageLoader);
// Initialize top GUI widget
- guiTop = new gcn::Container();
+ guiTop = new WindowContainer();
guiTop->setDimension(gcn::Rectangle(0, 0, SCREEN_W, SCREEN_H));
guiTop->setOpaque(false);
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index 632ad303..52665213 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -215,3 +215,15 @@ void Window::mouseOut()
{
mouseDown = false;
}
+
+void Window::_mouseInputMessage(const gcn::MouseInput &mouseInput)
+{
+ if (mouseInput.getType() == gcn::MouseInput::MOTION && mouseDown) {
+ // It's a window drag event
+ gcn::Widget::_mouseInputMessage(mouseInput);
+ }
+ else {
+ // It's something else
+ gcn::Container::_mouseInputMessage(mouseInput);
+ }
+}
diff --git a/src/gui/window.h b/src/gui/window.h
index 58f0e9b7..0a0170d8 100644
--- a/src/gui/window.h
+++ b/src/gui/window.h
@@ -117,6 +117,8 @@ class Window : public gcn::Container, public gcn::MouseListener
void mouseRelease(int mx, int my, int button);
void mouseMotion(int mx, int my);
void mouseOut();
+
+ void _mouseInputMessage(const gcn::MouseInput &mouseInput);
};
#endif