1 /*
2 * this file is part of the oxygen gtk engine
3 * Copyright (c) 2010 Hugo Pereira Da Costa <hugo.pereira@free.fr>
4 *
5 * This  library is free  software; you can  redistribute it and/or
6 * modify it  under  the terms  of the  GNU Lesser  General  Public
7 * License  as published  by the Free  Software  Foundation; either
8 * version 2 of the License, or(at your option ) any later version.
9 *
10 * This library is distributed  in the hope that it will be useful,
11 * but  WITHOUT ANY WARRANTY; without even  the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License  along  with  this library;  if not,  write to  the Free
17 * Software Foundation, Inc., 51  Franklin St, Fifth Floor, Boston,
18 * MA 02110-1301, USA.
19 */
20 
21 #include "oxygenflatwidgetengine.h"
22 #include "../oxygengtktypenames.h"
23 #include "../oxygengtkutils.h"
24 #include "../config.h"
25 
26 #include <string>
27 
28 namespace Oxygen
29 {
30     //_________________________________________________________
registerFlatWidget(GtkWidget * widget)31     bool FlatWidgetEngine::registerFlatWidget( GtkWidget* widget )
32     {
33         if( containsFlat( widget ) ) return false;
34         _flatData.insert( widget );
35         BaseEngine::registerWidget( widget );
36         return true;
37     }
38 
39     //_________________________________________________________
registerPaintWidget(GtkWidget * widget)40     bool FlatWidgetEngine::registerPaintWidget( GtkWidget* widget )
41     {
42         if( containsPaint( widget ) ) return false;
43         _paintData.insert( widget );
44         BaseEngine::registerWidget( widget );
45         return true;
46     }
47 
48     //_________________________________________________________
flatParent(GtkWidget * widget)49     GtkWidget* FlatWidgetEngine::flatParent( GtkWidget* widget )
50     {
51 
52         for( GtkWidget* parent = widget; parent; parent = gtk_widget_get_parent( parent ) )
53         {
54             if( containsPaint( parent ) ) return 0x0;
55             else if( containsFlat( parent ) ) return parent;
56         }
57 
58         return 0L;
59     }
60 
61 }
62