]> git.mxchange.org Git - flightgear.git/blob - src/Main/viewmgr.hxx
Added CHT (cylinder head temp) to BFI and property manager.
[flightgear.git] / src / Main / viewmgr.hxx
1 // viewmgr.hxx -- class for managing all the views in the flightgear world.
2 //
3 // Written by Curtis Olson, started October 2000.
4 //
5 // Copyright (C) 2000  Curtis L. Olson  - curt@flightgear.org
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 //
21 // $Id$
22
23
24 #ifndef _VIEWMGR_HXX
25 #define _VIEWMGR_HXX
26
27
28 #ifndef __cplusplus                                                          
29 # error This library requires C++
30 #endif                                   
31
32
33 #include <simgear/compiler.h>
34
35 #ifdef HAVE_CONFIG_H
36 #  include <config.h>
37 #endif
38
39 #include <vector>
40
41 #include "viewer_lookat.hxx"
42 #include "viewer_rph.hxx"
43
44 FG_USING_STD(vector);
45
46
47 // Define a structure containing view information
48 class FGViewMgr {
49
50 private:
51
52     typedef vector < FGViewer * > viewer_list;
53     viewer_list views;
54
55     int current;
56
57 public:
58
59     // Constructor
60     FGViewMgr( void );
61
62     // Destructor
63     ~FGViewMgr( void );
64
65     // getters
66     inline int size() const { return views.size(); }
67     inline FGViewer *get_view() {
68         return views[current];
69     }
70     inline FGViewer *get_view( int i ) {
71         if ( i < 0 ) { i = 0; }
72         if ( i >= (int)views.size() ) { i = views.size() - 1; }
73         return views[i];
74     }
75     inline FGViewer *next_view() {
76         ++current;
77         if ( current >= (int)views.size() ) {
78             current = 0;
79         }
80         return views[current];
81     }
82     inline FGViewer *prev_view() {
83         --current;
84         if ( current < 0 ) {
85             current = views.size() - 1;
86         }
87         return views[current];
88     }
89
90     // setters
91     inline void clear() { views.clear(); }
92     inline void add_view( FGViewer * v ) {
93         views.push_back(v);
94         current = views.size() - 1;
95     }
96 };
97
98
99 #endif // _VIEWMGR_HXX