Kate
katedynamicanimation.h
Go to the documentation of this file.00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2005 Hamish Rodda <rodda@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #ifndef KATEDYNAMICANIMATION_H 00020 #define KATEDYNAMICANIMATION_H 00021 00022 #include <QtCore/QObject> 00023 00024 #include <ktexteditor/attribute.h> 00025 00026 #include "katesmartrange.h" 00027 00028 class QTimer; 00029 00030 class KateSmartRange; 00031 class KateView; 00032 class KateDocument; 00033 00039 class KateDynamicAnimation : public QObject 00040 { 00041 Q_OBJECT 00042 00043 public: 00044 KateDynamicAnimation(KateDocument* doc, KateSmartRange* range, KTextEditor::Attribute::ActivationType type); 00045 KateDynamicAnimation(KateView* view, KateSmartRange* range, KTextEditor::Attribute::ActivationType type); 00046 virtual ~KateDynamicAnimation(); 00047 00048 void init(); 00049 00050 KateDocument* document() const; 00051 KateView* view() const; 00052 KateSmartRange* range() const; 00053 KTextEditor::Attribute::Ptr dynamicAttribute() const; 00054 00055 // The magic... add the dynamic highlight to the static highlight at this position 00056 void mergeToAttribute(KTextEditor::Attribute::Ptr attrib) const; 00057 00058 void finish(); 00059 00060 public Q_SLOTS: 00061 void timeout(); 00062 00063 Q_SIGNALS: 00064 void redraw(KateSmartRange* range); 00065 00066 private: 00067 QVariant mergeWith(const QVariant& base, const QVariant& dynamic, int percent) const; 00068 00069 KateSmartRangePtr m_range; 00070 KTextEditor::Attribute::ActivationType m_type; 00071 QTimer* m_timer; 00072 00073 // Meaning of sequence (for now): 00074 // 0 - start of animation 00075 // 1 - 99 - intro 00076 // 100 - plateau 00077 // 101 - 200 - cycle 00078 // 201 - 300 - outro 00079 int m_sequence; 00080 }; 00081 00082 #endif