1 #ifndef oxygenbaseengine_h
2 #define oxygenbaseengine_h
3 /*
4 * this file is part of the oxygen gtk engine
5 * Copyright (c) 2010 Hugo Pereira Da Costa <hugo.pereira@free.fr>
6 *
7 * This  library is free  software; you can  redistribute it and/or
8 * modify it  under  the terms  of the  GNU Lesser  General  Public
9 * License  as published  by the Free  Software  Foundation; either
10 * version 2 of the License, or(at your option ) any later version.
11 *
12 * This library is distributed  in the hope that it will be useful,
13 * but  WITHOUT ANY WARRANTY; without even  the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License  along  with  this library;  if not,  write to  the Free
19 * Software Foundation, Inc., 51  Franklin St, Fifth Floor, Boston,
20 * MA 02110-1301, USA.
21 */
22 
23 #include <gtk/gtk.h>
24 #include <vector>
25 
26 namespace Oxygen
27 {
28 
29     //! forward declaration
30     class Animations;
31 
32     //! base class for all engines
33     /*! engines map pointers to GtkWidget to some data, needed for animations */
34     class BaseEngine
35     {
36         public:
37 
38         //! constructor
BaseEngine(Animations * parent)39         BaseEngine( Animations* parent ):
40             _parent( parent ),
41             _enabled( true )
42         {}
43 
~BaseEngine()44         virtual ~BaseEngine()
45         {}
46 
47         //! register widget
48         virtual bool registerWidget( GtkWidget* widget );
49 
50         //! unregister widget
51         virtual void unregisterWidget( GtkWidget* ) = 0;
52 
53         //! engine list
54         typedef std::vector< BaseEngine* > List;
55 
56         //! enable state
57         /*! returns true if changed */
setEnabled(bool value)58         virtual bool setEnabled( bool value )
59         {
60             if( _enabled == value ) return false;
61             _enabled = value;
62             return true;
63         }
64 
65         //! enable state
enabled(void)66         bool enabled( void ) const
67         { return _enabled; }
68 
69         protected:
70 
71         //! returns parent
parent(void)72         virtual Animations& parent( void ) const
73         { return *_parent; }
74 
75         private:
76 
77         //! parent
78         Animations* _parent;
79 
80         //! enable flag
81         bool _enabled;
82 
83     };
84 
85 }
86 
87 #endif
88