source: trunk/src/gtk/glmapview.h @ 168

Last change on this file since 168 was 168, checked in by sam, 10 years ago

Remove duplicate code in the GL map viewer.

  • Property svn:keywords set to Id
File size: 1.6 KB
Line 
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 <gtk/gtk.h>
10
11class GlMapView
12{
13public:
14    GlMapView(GtkBuilder *builder);
15    void LoadMap(char const *path);
16    void SetFocus();
17
18private:
19    /* Private methods */
20    gboolean IdleTick();
21    gboolean Setup();
22    gboolean Destroy();
23    gboolean Draw(GdkEventExpose *e);
24    gboolean Scroll(double dx, double dy);
25    gboolean UpdateAdjustments();
26    gboolean MouseButton(GdkEventButton *e);
27    gboolean MouseMotion(GdkEventMotion *e);
28    gboolean KeyPress(GdkEventKey *e);
29
30    /* Private signal slots */
31    static gboolean IdleTickSignal(GlMapView *that);
32    static gboolean SetupSignal(GtkWidget *w, GlMapView *that);
33    static gboolean DestroySignal(GtkWidget *w, GlMapView *that);
34    static gboolean DrawSignal(GtkWidget *w, GdkEventExpose *e,
35                               GlMapView *that);
36    static gboolean ReshapeSignal(GtkWidget *w, GdkEventConfigure *e,
37                                  GlMapView *that);
38    static gboolean MouseButtonSignal(GtkWidget *w, GdkEventButton *e,
39                                      GlMapView *that);
40    static gboolean MouseMotionSignal(GtkWidget *w, GdkEventMotion *e,
41                                      GlMapView *that);
42    static gboolean KeyPressSignal(GtkWidget *w, GdkEventKey *e,
43                                   GlMapView *that);
44
45private:
46    GtkAdjustment *hadj, *vadj;
47    GtkWidget *glarea;
48    gboolean ticking, panning;
49
50    MapViewer *mapviewer;
51    double xpan, ypan;
52};
53
54#endif // __DH_GLMAPVIEW_H__
55
Note: See TracBrowser for help on using the repository browser.