1
#ifndef oxygenspinboxengine_h
2
#define oxygenspinboxengine_h
4
//////////////////////////////////////////////////////////////////////////////
5
// oxygenspinboxengine.h
6
// stores event filters and maps widgets to animations
9
// Copyright (c) 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr>
11
// Permission is hereby granted, free of charge, to any person obtaining a copy
12
// of this software and associated documentation files (the "Software"), to
13
// deal in the Software without restriction, including without limitation the
14
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
15
// sell copies of the Software, and to permit persons to whom the Software is
16
// furnished to do so, subject to the following conditions:
18
// The above copyright notice and this permission notice shall be included in
19
// all copies or substantial portions of the Software.
21
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
28
//////////////////////////////////////////////////////////////////////////////
30
#include "oxygenbaseengine.h"
31
#include "oxygendatamap.h"
32
#include "oxygenspinboxdata.h"
37
//! handle spinbox arrows hover effect
38
class SpinBoxEngine: public BaseEngine
46
SpinBoxEngine( QObject* parent ):
51
virtual ~SpinBoxEngine( void )
55
virtual bool registerWidget( QWidget* );
58
virtual bool updateState( const QObject* object, QStyle::SubControl subControl, bool value )
60
if( DataMap<SpinBoxData>::Value data = _data.find( object ) )
62
return data.data()->updateState( subControl, value );
66
//! true if widget is animated
67
virtual bool isAnimated( const QObject* object, QStyle::SubControl subControl )
69
if( DataMap<SpinBoxData>::Value data = _data.find( object ) )
71
return data.data()->isAnimated( subControl );
77
virtual qreal opacity( const QObject* object, QStyle::SubControl subControl )
79
if( DataMap<SpinBoxData>::Value data = _data.find( object ) )
81
return data.data()->opacity( subControl );
82
} else return AnimationData::OpacityInvalid;
86
virtual void setEnabled( bool value )
88
BaseEngine::setEnabled( value );
89
_data.setEnabled( value );
93
virtual void setDuration( int value )
95
BaseEngine::setDuration( value );
96
_data.setDuration( value );
102
//! remove widget from map
103
virtual bool unregisterWidget( QObject* object )
104
{ return _data.unregisterWidget( object ); }
109
DataMap<SpinBoxData> _data;