File indexing completed on 2024-05-19 05:35:20
0001 #ifndef oxygenheaderviewengine_h 0002 #define oxygenheaderviewengine_h 0003 0004 ////////////////////////////////////////////////////////////////////////////// 0005 // oxygenheaderviewengine.h 0006 // stores event filters and maps widgets to timelines for animations 0007 // ------------------- 0008 // 0009 // SPDX-FileCopyrightText: 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr> 0010 // 0011 // SPDX-License-Identifier: MIT 0012 ////////////////////////////////////////////////////////////////////////////// 0013 0014 #include "oxygenbaseengine.h" 0015 #include "oxygendatamap.h" 0016 #include "oxygenheaderviewdata.h" 0017 0018 namespace Oxygen 0019 { 0020 //* stores headerview hovered action and timeLine 0021 class HeaderViewEngine : public BaseEngine 0022 { 0023 Q_OBJECT 0024 0025 public: 0026 //* constructor 0027 explicit HeaderViewEngine(QObject *parent) 0028 : BaseEngine(parent) 0029 { 0030 } 0031 0032 //* register headerview 0033 bool registerWidget(QWidget *); 0034 0035 //* true if widget hover state is changed 0036 bool updateState(const QObject *, const QPoint &, bool); 0037 0038 //* true if widget is animated 0039 bool isAnimated(const QObject *object, const QPoint &point) 0040 { 0041 if (DataMap<HeaderViewData>::Value data = _data.find(object)) { 0042 if (Animation::Pointer animation = data.data()->animation(point)) 0043 return animation.data()->isRunning(); 0044 } 0045 return false; 0046 } 0047 0048 //* animation opacity 0049 qreal opacity(const QObject *object, const QPoint &point) 0050 { 0051 return isAnimated(object, point) ? _data.find(object).data()->opacity(point) : AnimationData::OpacityInvalid; 0052 } 0053 0054 //* enability 0055 void setEnabled(bool value) override 0056 { 0057 BaseEngine::setEnabled(value); 0058 _data.setEnabled(value); 0059 } 0060 0061 //* duration 0062 void setDuration(int value) override 0063 { 0064 BaseEngine::setDuration(value); 0065 _data.setDuration(value); 0066 } 0067 0068 public Q_SLOTS: 0069 0070 //* remove widget from map 0071 bool unregisterWidget(QObject *object) override 0072 { 0073 return _data.unregisterWidget(object); 0074 } 0075 0076 private: 0077 //* data map 0078 DataMap<HeaderViewData> _data; 0079 }; 0080 } 0081 0082 #endif