1
#ifndef oxygenarrowstateengine_h
2
#define oxygenarrowstateengine_h
4
* this file is part of the oxygen gtk engine
5
* Copyright (c) 2010 Hugo Pereira Da Costa <hugo.pereira@free.fr>
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.
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.
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,
23
#include "../oxygenanimationdata.h"
24
#include "../oxygenstyleoptions.h"
25
#include "oxygenanimationengine.h"
26
#include "oxygengenericengine.h"
27
#include "oxygendatamap.h"
28
#include "oxygenarrowstatedata.h"
34
//! forward declaration
37
//! stores data associated to editable arrowstatees
39
ensures that the text entry and the button of editable arrowstatees
40
gets hovered and focus flags at the same time
42
class ArrowStateEngine: public GenericEngine<ArrowStateData>, public AnimationEngine
48
ArrowStateEngine( Animations* widget ):
49
GenericEngine<ArrowStateData>( widget )
53
virtual ~ArrowStateEngine( void )
57
virtual bool setEnabled( bool value )
59
if( !BaseEngine::setEnabled( value ) ) return false;
60
for( DataMap<ArrowStateData>::Map::iterator iter = data().map().begin(); iter != data().map().end(); iter++ )
62
iter->second.setEnabled( value );
63
if( enabled() && !widgetIsBlackListed( iter->first ) ) iter->second.connect( iter->first );
64
else iter->second.disconnect( iter->first );
70
//! transition duration
71
virtual bool setDuration( int value )
73
if( !AnimationEngine::setDuration( value ) ) return false;
74
for( DataMap<ArrowStateData>::Map::iterator iter = data().map().begin(); iter != data().map().end(); iter++ )
75
{ iter->second.setDuration( value ); }
79
//! retrieve animation data matching a given widget for provided options
80
/*! note: for convenience, this method also calls ::registerWidget and ::updateState */
81
virtual AnimationData get( GtkWidget* widget, GtkArrowType type, const StyleOptions& options )
85
if( !( enabled() && widget ) ) return AnimationData();
88
registerWidget( widget );
90
ArrowStateData& data( this->data().value( widget ) );
91
data.updateState( type, (options&Hover) && !(options&Disabled) );
93
return data.isAnimated( type ) ? AnimationData( data.opacity( type ), AnimationHover ):AnimationData();
101
//!@name protected modifiers
104
//! register widget [overloaded]
105
virtual bool registerWidget( GtkWidget* widget )
107
const bool registered( GenericEngine<ArrowStateData>::registerWidget( widget ) );
109
data().value( widget ).setEnabled( enabled() );
110
data().value( widget ).setDuration( duration() );