1 #ifndef oxygenscrollbarengine_h
2 #define oxygenscrollbarengine_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 
24 #include "oxygengenericengine.h"
25 #include "oxygendatamap.h"
26 #include "oxygenscrollbardata.h"
27 
28 #include <gtk/gtk.h>
29 
30 namespace Oxygen
31 {
32     //! forward declaration
33     class Animations;
34 
35     //! stores data associated to editable scrollbares
36     /*!
37     ensures that the text entry and the button of editable scrollbares
38     gets hovered and focus flags at the same time
39     */
40     class ScrollBarEngine: public GenericEngine<ScrollBarData>
41     {
42 
43         public:
44 
45         //! constructor
ScrollBarEngine(Animations * widget)46         ScrollBarEngine( Animations* widget ):
47             GenericEngine<ScrollBarData>( widget )
48             {}
49 
50         //! destructor
~ScrollBarEngine(void)51         virtual ~ScrollBarEngine( void )
52         {}
53 
54         //! register scrollbar from scrolled window
55         inline void registerScrolledWindow( GtkWidget* );
56 
57     };
58 
59     //________________________________________________________________
registerScrolledWindow(GtkWidget * widget)60     void ScrollBarEngine::registerScrolledWindow( GtkWidget* widget )
61     {
62         if( !GTK_IS_SCROLLED_WINDOW( widget ) ) return;
63         GtkScrolledWindow* scrolledWindow( GTK_SCROLLED_WINDOW( widget ) );
64 
65         if( GtkWidget* hScrollBar = gtk_scrolled_window_get_hscrollbar( scrolledWindow ) )
66         { registerWidget( hScrollBar ); }
67 
68         if( GtkWidget* vScrollBar = gtk_scrolled_window_get_vscrollbar( scrolledWindow ) )
69         { registerWidget( vScrollBar ); }
70 
71         return;
72     }
73 
74 }
75 
76 #endif
77