summaryrefslogtreecommitdiffstats
path: root/interfaces/tdetexteditor/markinterface.h
blob: 64e9485727b8f00172706d239ed24b2b5dc1ed10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/* This file is part of the KDE project
   Copyright (C) 2001 Christoph Cullmann ([email protected])

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#ifndef __tdetexteditor_markinterface_h__
#define __tdetexteditor_markinterface_h__

#include <tqptrlist.h>

#include <tdelibs_export.h>

class TQCString;

namespace KTextEditor
{

class Mark
{
  public:
    uint line;
    uint type;
};

/**
*  This is an interface to enable marks to be made in the iconborder of the Document class.
*/
class KTEXTEDITOR_EXPORT MarkInterface
{
  friend class PrivateMarkInterface;
  
  public:
    MarkInterface ();
    virtual ~MarkInterface ();

    unsigned int markInterfaceNumber () const;
    
  protected:  
    void setMarkInterfaceDCOPSuffix (const TQCString &suffix);  

  //
  // slots !!!
  //
  public:
    /** 
    * @return a uint representing the marks set in @p line OR'ed togeather. 
    */
    virtual uint mark (uint line) = 0;
    
    /** 
    * Adds a mark of type @p markType to @p line.
    * Has no effect if the line allready contains a mark of that type. 
    */
    virtual void setMark (uint line, uint markType) = 0;
    /**
    * Clears all marks set in @p line.
    */
    virtual void clearMark (uint line) = 0;

    virtual void addMark (uint line, uint markType) = 0;
    /**
    *  Removes any mark of type @p markType from @p line.
    */
    virtual void removeMark (uint line, uint markType) = 0;

    /**
    * @return a list of all marks in the document
    */
    virtual TQPtrList<KTextEditor::Mark> marks () = 0;
    /**
    * Clears all marks in the document.
    */ 
    virtual void clearMarks () = 0;

    /**
     * get the number of predefined marker types we have so far.
     * @note If you change this you have to make sure katepart supports the new size!
     * @return number of reserved marker types
     * @since 3.3
     */
    static int reservedMarkersCount();

    /**
     * Pre-defined mark types.
     *
     * To create a non-standard mark type, use MarkInterfaceExtension.
     * To add a new standard mark type, edit this interface to document the type.
     */
    enum MarkTypes
    {
      /** Bookmark */
      markType01= 0x1,
      /** Breakpoint active */
      markType02= 0x2,
      /** Breakpoint reached */
      markType03= 0x4,
      /** Breakpoint disabled */
      markType04= 0x8,
      /** Execution mark */
      markType05= 0x10,
      /** Warning */
      markType06= 0x20,
      /** Error */
      markType07= 0x40,

      markType08= 0x80,
      markType09= 0x100,
      markType10= 0x200,
      markType11= 0x400,
      markType12= 0x800,
      markType13= 0x1000,
      markType14= 0x2000,
      markType15= 0x4000,
      markType16= 0x8000,
      markType17= 0x10000,
      markType18= 0x20000,
      markType19= 0x40000,
      markType20= 0x80000,
      markType21= 0x100000,
      markType22= 0x200000,
      markType23= 0x400000,
      markType24= 0x800000,
      markType25= 0x1000000,
      markType26= 0x2000000,
      markType27= 0x4000000,
      markType28= 0x8000000,
      markType29= 0x10000000,
      markType30= 0x20000000,
      markType31= 0x40000000,
      markType32= 0x80000000,
      /* reserved marks */
      Bookmark = markType01,
      BreakpointActive = markType02,
      BreakpointReached = markType03,
      BreakpointDisabled = markType04,
      Execution = markType05,
      Warning = markType06,
      Error = markType07
    };

  //
  // signals !!!
  //
  public:
    virtual void marksChanged () = 0;
  
  private:
    class PrivateMarkInterface *d;
    static unsigned int globalMarkInterfaceNumber;
    unsigned int myMarkInterfaceNumber;
};

KTEXTEDITOR_EXPORT MarkInterface *markInterface (class Document *doc);

}

#endif