1
#ifndef oxygentabbar_datah
2
#define oxygentabbar_datah
4
//////////////////////////////////////////////////////////////////////////////
6
// data container for QTabBar animations
9
// Copyright (c) 2009 Hugo Pereira Da Costa <hugo@oxygen-icons.org>
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 "oxygenanimationdata.h"
32
#include <QtGui/QTabBar>
38
class TabBarData: public AnimationData
43
//! declare opacity property
44
Q_PROPERTY( qreal currentOpacity READ currentOpacity WRITE setCurrentOpacity )
45
Q_PROPERTY( qreal previousOpacity READ previousOpacity WRITE setPreviousOpacity )
50
TabBarData( QObject* parent, QWidget* target, int duration );
53
virtual ~TabBarData( void )
57
void setDuration( int duration )
59
currentIndexAnimation().data()->setDuration( duration );
60
previousIndexAnimation().data()->setDuration( duration );
64
bool updateState( const QPoint&, bool );
66
//!@name current index handling
70
virtual qreal currentOpacity( void ) const
71
{ return _current._opacity; }
74
virtual void setCurrentOpacity( qreal value )
76
if( _current._opacity == value ) return;
77
_current._opacity = value;
82
virtual int currentIndex( void ) const
83
{ return _current._index; }
86
virtual void setCurrentIndex( int index )
87
{ _current._index = index; }
89
//! current index animation
90
virtual const Animation::Pointer& currentIndexAnimation( void ) const
91
{ return _current._animation; }
95
//!@name previous index handling
99
virtual qreal previousOpacity( void ) const
100
{ return _previous._opacity; }
103
virtual void setPreviousOpacity( qreal value )
105
if( _previous._opacity == value ) return;
106
_previous._opacity = value;
111
virtual int previousIndex( void ) const
112
{ return _previous._index; }
115
virtual void setPreviousIndex( int index )
116
{ _previous._index = index; }
118
//! previous index Animation
119
virtual const Animation::Pointer& previousIndexAnimation( void ) const
120
{ return _previous._animation; }
124
//! return Animation associated to action at given position, if any
125
virtual Animation::Pointer animation( const QPoint& position ) const;
127
//! return opacity associated to action at given position, if any
128
virtual qreal opacity( const QPoint& position ) const;
132
//! container for needed animation data
137
//! default constructor
143
Animation::Pointer _animation;
148
//! current tab animation data (for hover enter animations)
151
//! previous tab animations data (for hover leave animations)