File indexing completed on 2024-05-19 05:35:22

0001 //////////////////////////////////////////////////////////////////////////////
0002 // oxygenwidgetstatedata.cpp
0003 // generic data container for widget widgetstate (mouse-over) animations
0004 // -------------------
0005 //
0006 // SPDX-FileCopyrightText: 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr>
0007 //
0008 // SPDX-License-Identifier: MIT
0009 //////////////////////////////////////////////////////////////////////////////
0010 
0011 #include "oxygenwidgetstatedata.h"
0012 
0013 namespace Oxygen
0014 {
0015 //______________________________________________
0016 bool WidgetStateData::updateState(bool value)
0017 {
0018     if (_state == value)
0019         return false;
0020     else {
0021         _state = value;
0022         animation().data()->setDirection(_state ? Animation::Forward : Animation::Backward);
0023         if (!animation().data()->isRunning())
0024             animation().data()->start();
0025         return true;
0026     }
0027 }
0028 }