From 5d94840c848fb0c41fb2c1d92488510936acdcd2 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Fri, 7 Jan 2005 12:45:31 +0000 Subject: Solved the window dragging problem. --- file.list | 1 + src/Makefile.am | 1 + src/gui/gui.cpp | 7 ++----- src/gui/window.cpp | 12 ++++++++++++ src/gui/window.h | 2 ++ 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 -- cgit v1.2.3-70-g09d2