katearbitraryhighlight.h

00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2003 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 KATEARBITRARYHIGHLIGHT_H
00020 #define KATEARBITRARYHIGHLIGHT_H
00021 
00022 #include "kateattribute.h"
00023 #include "katesupercursor.h"
00024 
00025 #include <qobject.h>
00026 #include <qptrlist.h>
00027 #include <qmap.h>
00028 
00029 class KateDocument;
00030 class KateView;
00031 
00032 class KateArbitraryHighlightRange : public KateSuperRange, public KateAttribute
00033 {
00034   Q_OBJECT
00035 
00036 public:
00037   KateArbitraryHighlightRange(KateSuperCursor* start, KateSuperCursor* end, QObject* parent = 0L, const char* name = 0L);
00038   KateArbitraryHighlightRange(KateDocument* doc, const KateRange& range, QObject* parent = 0L, const char* name = 0L);
00039   KateArbitraryHighlightRange(KateDocument* doc, const KateTextCursor& start, const KateTextCursor& end, QObject* parent = 0L, const char* name = 0L);
00040 
00041     virtual ~KateArbitraryHighlightRange();
00042 
00043   virtual void changed() { slotTagRange(); };
00044 
00045   static KateAttribute merge(QPtrList<KateSuperRange> ranges);
00046 };
00047 
00060 class KateArbitraryHighlight : public QObject
00061 {
00062   Q_OBJECT
00063 
00064 public:
00065   KateArbitraryHighlight(KateDocument* parent = 0L, const char* name = 0L);
00066 
00067   void addHighlightToDocument(KateSuperRangeList* list);
00068   void addHighlightToView(KateSuperRangeList* list, KateView* view);
00069 
00070   KateSuperRangeList& rangesIncluding(uint line, KateView* view = 0L);
00071 
00072 signals:
00073   void tagLines(KateView* view, KateSuperRange* range);
00074 
00075 private slots:
00076   void slotTagRange(KateSuperRange* range);
00077   void slotRangeListDeleted(QObject* obj);
00078 private:
00079   KateView* viewForRange(KateSuperRange* range);
00080 
00081   QMap<KateView*, QPtrList<KateSuperRangeList>* > m_viewHLs;
00082   QPtrList<KateSuperRangeList> m_docHLs;
00083 };
00084 
00085 #endif
00086 
00087 // kate: space-indent on; indent-width 2; replace-tabs on;
KDE Home | KDE Accessibility Home | Description of Access Keys