]> git.mxchange.org Git - flightgear.git/blob - src/GUI/CanvasWidget.hxx
Launcher: Maintain aircraft selection better
[flightgear.git] / src / GUI / CanvasWidget.hxx
1 // CanvasWidget -- Using Canvas inside PUI dialogs
2 //
3 // Copyright (C) 2012  Thomas Geymayer <tomgey@gmail.com>
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License as
7 // published by the Free Software Foundation; either version 2 of the
8 // License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful, but
11 // WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18
19 #ifndef CANVASWIDGET_HXX_
20 #define CANVASWIDGET_HXX_
21
22 #include <Main/fg_props.hxx>
23 #include <plib/pu.h>
24
25 #include <simgear/canvas/canvas_fwd.hxx>
26
27 class CanvasMgr;
28
29 class CanvasWidget:
30   public puObject
31 {
32   public:
33     CanvasWidget( int x, int y,
34                   int width, int height,
35                   SGPropertyNode* props,
36                   const std::string& module );
37     virtual ~CanvasWidget();
38
39     virtual void doHit (int button, int updown, int x, int y);
40     virtual int checkKey(int key, int updown);
41
42     virtual void setSize ( int w, int h );
43     virtual void draw(int dx, int dy);
44
45   private:
46
47     CanvasMgr  *_canvas_mgr; // TODO maybe we should store this in some central
48                              // location or make it static...
49
50     simgear::canvas::CanvasPtr _canvas;
51
52     float _last_x,
53           _last_y;
54     bool  _auto_viewport; //!< Set true to get the canvas view dimensions
55                           //   automatically resized if the size of the widget
56                           //   changes.
57
58     SGPropertyNode_ptr _time,
59                               _view_height;
60 };
61
62 #endif /* CANVASWIDGET_HXX_ */