File indexing completed on 2024-05-19 05:35:19
0001 #ifndef oxygenbaseengine_h 0002 #define oxygenbaseengine_h 0003 0004 ////////////////////////////////////////////////////////////////////////////// 0005 // oxygenbaseengine.h 0006 // base engine 0007 // ------------------- 0008 // 0009 // SPDX-FileCopyrightText: 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr> 0010 // 0011 // SPDX-License-Identifier: MIT 0012 ////////////////////////////////////////////////////////////////////////////// 0013 0014 #include "oxygen.h" 0015 0016 #include <QObject> 0017 #include <QSet> 0018 0019 namespace Oxygen 0020 { 0021 //* base class for all animation engines 0022 /** it is used to store configuration values used by all animations stored in the engine */ 0023 class BaseEngine : public QObject 0024 { 0025 Q_OBJECT 0026 0027 public: 0028 using Pointer = WeakPointer<BaseEngine>; 0029 0030 //* constructor 0031 explicit BaseEngine(QObject *parent) 0032 : QObject(parent) 0033 { 0034 } 0035 0036 //*@name accessors 0037 //@{ 0038 0039 //* enability 0040 virtual bool enabled(void) const 0041 { 0042 return _enabled; 0043 } 0044 0045 //* duration 0046 virtual int duration(void) const 0047 { 0048 return _duration; 0049 } 0050 0051 //* list of widgets 0052 using WidgetList = QSet<QWidget *>; 0053 0054 //* returns registered widgets 0055 virtual WidgetList registeredWidgets(void) const 0056 { 0057 return WidgetList(); 0058 } 0059 0060 //@} 0061 0062 //*@name modifiers 0063 //@{ 0064 0065 //* enability 0066 virtual void setEnabled(bool value) 0067 { 0068 _enabled = value; 0069 } 0070 0071 //* duration 0072 virtual void setDuration(int value) 0073 { 0074 _duration = value; 0075 } 0076 0077 //* unregister widget 0078 virtual bool unregisterWidget(QObject *object) = 0; 0079 0080 //@} 0081 0082 private: 0083 //* engine enability 0084 bool _enabled = true; 0085 0086 //* animation duration 0087 int _duration = 200; 0088 }; 0089 } 0090 0091 #endif