1 | // |
---|
2 | // Deus Hax (working title) |
---|
3 | // Copyright (c) 2010 Sam Hocevar <sam@hocevar.net> |
---|
4 | // |
---|
5 | |
---|
6 | #if !defined __DH_GLMAPVIEW_H__ |
---|
7 | #define __DH_GLMAPVIEW_H__ |
---|
8 | |
---|
9 | #include "mapviewer.h" |
---|
10 | |
---|
11 | #include <gtk/gtk.h> |
---|
12 | |
---|
13 | class GlMapView |
---|
14 | { |
---|
15 | public: |
---|
16 | GlMapView(GtkBuilder *builder); |
---|
17 | void LoadMap(char const *path); |
---|
18 | void CloseMap(); |
---|
19 | |
---|
20 | private: |
---|
21 | /* Private methods */ |
---|
22 | gboolean IdleTick(); |
---|
23 | gboolean Setup(); |
---|
24 | gboolean Shutdown(); |
---|
25 | gboolean Draw(GdkEventExpose *e); |
---|
26 | void Scroll(double dx, double dy); |
---|
27 | void UpdateAdjustments(); |
---|
28 | gboolean MouseButton(GdkEventButton *e); |
---|
29 | gboolean MouseMotion(GdkEventMotion *e); |
---|
30 | gboolean KeyPress(GdkEventKey *e); |
---|
31 | |
---|
32 | /* Private signal slots */ |
---|
33 | static gboolean IdleTickSignal(GlMapView *that); |
---|
34 | static gboolean SetupSignal(GtkWidget *w, GlMapView *that); |
---|
35 | static gboolean ShutdownSignal(GlMapView *that); |
---|
36 | static gboolean DrawSignal(GtkWidget *w, GdkEventExpose *e, |
---|
37 | GlMapView *that); |
---|
38 | static gboolean ReshapeSignal(GtkWidget *w, GdkEventConfigure *e, |
---|
39 | GlMapView *that); |
---|
40 | static gboolean MouseButtonSignal(GtkWidget *w, GdkEventButton *e, |
---|
41 | GlMapView *that); |
---|
42 | static gboolean MouseMotionSignal(GtkWidget *w, GdkEventMotion *e, |
---|
43 | GlMapView *that); |
---|
44 | static gboolean KeyPressSignal(GtkWidget *w, GdkEventKey *e, |
---|
45 | GlMapView *that); |
---|
46 | |
---|
47 | private: |
---|
48 | GtkAdjustment *hadj, *vadj; |
---|
49 | GtkWidget *glarea; |
---|
50 | gboolean ticking, panning; |
---|
51 | |
---|
52 | MapViewer *mapviewer; |
---|
53 | double xpan, ypan; |
---|
54 | }; |
---|
55 | |
---|
56 | #endif // __DH_GLMAPVIEW_H__ |
---|
57 | |
---|