]> git.mxchange.org Git - flightgear.git/blob - src/GUI/CanvasWidget.hxx
Canvas add event time and expose current click count
[flightgear.git] / src / GUI / CanvasWidget.hxx
1 /*
2  * CanvasWidget.hxx
3  *
4  *  Created on: 03.07.2012
5  *      Author: tom
6  */
7
8 #ifndef CANVASWIDGET_HXX_
9 #define CANVASWIDGET_HXX_
10
11 #include <Main/fg_props.hxx>
12 #include <plib/pu.h>
13
14 #include <simgear/canvas/canvas_fwd.hxx>
15
16 class CanvasMgr;
17
18 class CanvasWidget:
19   public puObject
20 {
21   public:
22     CanvasWidget( int x, int y,
23                   int width, int height,
24                   SGPropertyNode* props,
25                   const std::string& module );
26     virtual ~CanvasWidget();
27
28     virtual void doHit (int button, int updown, int x, int y);
29     virtual int checkKey(int key, int updown);
30
31     virtual void setSize ( int w, int h );
32     virtual void draw(int dx, int dy);
33
34   private:
35
36     CanvasMgr  *_canvas_mgr; // TODO maybe we should store this in some central
37                              // location or make it static...
38
39     GLuint              _tex_id;    //<! OpenGL texture id if canvas
40     size_t              _no_tex_cnt;//<! Count since how many frames we were not
41                                     //   able to get the texture (for debugging)
42     simgear::canvas::CanvasPtr _canvas;
43     SGPropertyNode     *_mouse_x,
44                        *_mouse_y,
45                        *_mouse_down,
46                        *_mouse_drag;
47
48     float _last_x,
49           _last_y;
50
51     static SGPropertyNode_ptr _time;
52 };
53
54 #endif /* CANVASWIDGET_HXX_ */