summaryrefslogtreecommitdiffstats
path: root/src/Gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/Gui')
-rw-r--r--src/Gui/RenderArea.cpp8
-rw-r--r--src/Gui/RenderArea.h1
-rw-r--r--src/Gui/Window.cpp12
-rw-r--r--src/Gui/Window.h5
4 files changed, 25 insertions, 1 deletions
diff --git a/src/Gui/RenderArea.cpp b/src/Gui/RenderArea.cpp
index 0cec471..2611102 100644
--- a/src/Gui/RenderArea.cpp
+++ b/src/Gui/RenderArea.cpp
@@ -44,6 +44,7 @@ RenderArea::RenderArea(BaseObjectType *cobject, const Glib::RefPtr<Gnome::Glade:
signal_configure_event().connect(sigc::mem_fun(this, &RenderArea::onConfigureEvent));
signal_expose_event().connect(sigc::mem_fun(this, &RenderArea::onExposeEvent));
signal_scroll_event().connect(sigc::mem_fun(this, &RenderArea::onScrollEvent));
+ signal_button_press_event().connect(sigc::mem_fun(this, &RenderArea::onButtonPressEvent));
signal_enter_notify_event().connect(sigc::mem_fun(this, &RenderArea::onEnterNotifyEvent));
signal_leave_notify_event().connect(sigc::mem_fun(this, &RenderArea::onLeaveNotifyEvent));
signal_motion_notify_event().connect(sigc::mem_fun(this, &RenderArea::onMotionNotifyEvent));
@@ -118,6 +119,13 @@ bool RenderArea::onScrollEvent(GdkEventScroll *event) {
return false;
}
+bool RenderArea::onButtonPressEvent(GdkEventButton *event) {
+ if(view && event->button == 1)
+ view->click(this, event->x, event->y);
+
+ return true;
+}
+
bool RenderArea::onEnterNotifyEvent(GdkEventCrossing *event) {
inWindow = true;
xHover = event->x;
diff --git a/src/Gui/RenderArea.h b/src/Gui/RenderArea.h
index 08cb841..6aa66df 100644
--- a/src/Gui/RenderArea.h
+++ b/src/Gui/RenderArea.h
@@ -55,6 +55,7 @@ class RenderArea : public Gtk::DrawingArea {
bool onConfigureEvent(GdkEventConfigure*);
bool onExposeEvent(GdkEventExpose*);
bool onScrollEvent(GdkEventScroll *event);
+ bool onButtonPressEvent(GdkEventButton *event);
bool onEnterNotifyEvent(GdkEventCrossing *event);
bool onLeaveNotifyEvent(GdkEventCrossing*);
bool onMotionNotifyEvent(GdkEventMotion *event);
diff --git a/src/Gui/Window.cpp b/src/Gui/Window.cpp
index f1af3cd..df20876 100644
--- a/src/Gui/Window.cpp
+++ b/src/Gui/Window.cpp
@@ -28,11 +28,23 @@ Window::Window(BaseObjectType *cobject, const Glib::RefPtr<Gnome::Glade::Xml> &x
xml->connect_clicked("MenuItemQuit", sigc::mem_fun(this, &Window::hide));
xml->get_widget_derived("RenderArea", renderArea);
+ xml->get_widget_derived("MapArea", mapArea);
+
+ if(renderArea)
+ renderArea->signal_expose_event().connect_notify(sigc::mem_fun(this, &Window::updateMap));
}
Window::~Window() {
if(renderArea)
delete renderArea;
+
+ if(mapArea)
+ delete mapArea;
+}
+
+void Window::updateMap(GdkEventExpose*) {
+ if(mapArea)
+ mapArea->queue_draw();
}
}
diff --git a/src/Gui/Window.h b/src/Gui/Window.h
index ae22d42..9b4f4ef 100644
--- a/src/Gui/Window.h
+++ b/src/Gui/Window.h
@@ -30,13 +30,16 @@ class RenderArea;
class Window : public Gtk::Window {
private:
- RenderArea *renderArea;
+ RenderArea *renderArea, *mapArea;
+
+ void updateMap(GdkEventExpose*);
public:
Window(BaseObjectType *cobject, const Glib::RefPtr<Gnome::Glade::Xml> &xml);
virtual ~Window();
RenderArea* getRenderArea() const {return renderArea;}
+ RenderArea* getMapArea() const {return mapArea;}
};
}