1 #ifndef oxygenflatwidgetengine_h
2 #define oxygenflatwidgetengine_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 "oxygenbaseengine.h"
24 
25 #include <gtk/gtk.h>
26 #include <cassert>
27 #include <set>
28 
29 namespace Oxygen
30 {
31     //! forward declaration
32     class Animations;
33 
34     //! associates widgets with some type of data
35     class FlatWidgetEngine: public BaseEngine
36     {
37 
38         public:
39 
40         //! constructor
FlatWidgetEngine(Animations * widget)41         FlatWidgetEngine( Animations* widget ):
42             BaseEngine( widget )
43             {}
44 
45         //! destructor
~FlatWidgetEngine(void)46         virtual ~FlatWidgetEngine( void )
47         {}
48 
49         //! register widget
registerWidget(GtkWidget * widget)50         virtual bool registerWidget( GtkWidget* widget )
51         { return registerFlatWidget( widget ); }
52 
53         //! register widget
54         virtual bool registerFlatWidget( GtkWidget* );
55 
56         //! register widget
57         virtual bool registerPaintWidget( GtkWidget* );
58 
59         //! unregister widget
unregisterWidget(GtkWidget * widget)60         virtual void unregisterWidget( GtkWidget* widget )
61         {
62             _flatData.erase( widget );
63             _paintData.erase( widget );
64         }
65 
66         //! true if one of widgets parent is included
67         virtual GtkWidget* flatParent( GtkWidget* );
68 
69         protected:
70 
containsFlat(GtkWidget * widget)71         bool containsFlat( GtkWidget* widget ) const
72         { return _flatData.find( widget ) != _flatData.end(); }
73 
containsPaint(GtkWidget * widget)74         bool containsPaint( GtkWidget* widget ) const
75         { return _paintData.find( widget ) != _paintData.end(); }
76 
77         private:
78 
79         //! store registered widgets
80         std::set<GtkWidget*> _flatData;
81         std::set<GtkWidget*> _paintData;
82 
83     };
84 
85 }
86 
87 #endif
88