source: trunk/deushax/gtk/glmapview.h @ 825

Last change on this file since 825 was 825, checked in by sam, 11 years ago

gtk: refactor the GTK mess once again.

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