1 | #region License Information
|
---|
2 | // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
---|
3 | //
|
---|
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
---|
5 | // software and associated documentation files (the "Software"), to deal in the Software
|
---|
6 | // without restriction, including without limitation the rights to use, copy, modify, merge,
|
---|
7 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
---|
8 | // to whom the Software is furnished to do so, subject to the following conditions:
|
---|
9 | //
|
---|
10 | // The above copyright notice and this permission notice shall be included in all copies or
|
---|
11 | // substantial portions of the Software.
|
---|
12 | //
|
---|
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
---|
14 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
---|
15 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
---|
16 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
---|
17 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
---|
18 | // DEALINGS IN THE SOFTWARE.
|
---|
19 |
|
---|
20 | /* HeuristicLab
|
---|
21 | * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
22 | *
|
---|
23 | * This file is part of HeuristicLab.
|
---|
24 | *
|
---|
25 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
26 | * it under the terms of the GNU General Public License as published by
|
---|
27 | * the Free Software Foundation, either version 3 of the License, or
|
---|
28 | * (at your option) any later version.
|
---|
29 | *
|
---|
30 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
31 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
32 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
33 | * GNU General Public License for more details.
|
---|
34 | *
|
---|
35 | * You should have received a copy of the GNU General Public License
|
---|
36 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
37 | */
|
---|
38 | #endregion
|
---|
39 |
|
---|
40 | using System;
|
---|
41 | using System.Collections.Generic;
|
---|
42 | using System.Windows;
|
---|
43 | using System.Windows.Media;
|
---|
44 |
|
---|
45 | namespace ICSharpCode.SharpDevelop.Editor {
|
---|
46 | /// <summary>
|
---|
47 | /// Represents a text marker.
|
---|
48 | /// </summary>
|
---|
49 | public interface ITextMarker {
|
---|
50 | /// <summary>
|
---|
51 | /// Gets the start offset of the marked text region.
|
---|
52 | /// </summary>
|
---|
53 | int StartOffset { get; }
|
---|
54 |
|
---|
55 | /// <summary>
|
---|
56 | /// Gets the end offset of the marked text region.
|
---|
57 | /// </summary>
|
---|
58 | int EndOffset { get; }
|
---|
59 |
|
---|
60 | /// <summary>
|
---|
61 | /// Gets the length of the marked region.
|
---|
62 | /// </summary>
|
---|
63 | int Length { get; }
|
---|
64 |
|
---|
65 | /// <summary>
|
---|
66 | /// Deletes the text marker.
|
---|
67 | /// </summary>
|
---|
68 | void Delete();
|
---|
69 |
|
---|
70 | /// <summary>
|
---|
71 | /// Gets whether the text marker was deleted.
|
---|
72 | /// </summary>
|
---|
73 | bool IsDeleted { get; }
|
---|
74 |
|
---|
75 | /// <summary>
|
---|
76 | /// Event that occurs when the text marker is deleted.
|
---|
77 | /// </summary>
|
---|
78 | event EventHandler Deleted;
|
---|
79 |
|
---|
80 | /// <summary>
|
---|
81 | /// Gets/Sets the background color.
|
---|
82 | /// </summary>
|
---|
83 | Color? BackgroundColor { get; set; }
|
---|
84 |
|
---|
85 | /// <summary>
|
---|
86 | /// Gets/Sets the foreground color.
|
---|
87 | /// </summary>
|
---|
88 | Color? ForegroundColor { get; set; }
|
---|
89 |
|
---|
90 | /// <summary>
|
---|
91 | /// Gets/Sets the font weight.
|
---|
92 | /// </summary>
|
---|
93 | FontWeight? FontWeight { get; set; }
|
---|
94 |
|
---|
95 | /// <summary>
|
---|
96 | /// Gets/Sets the font style.
|
---|
97 | /// </summary>
|
---|
98 | FontStyle? FontStyle { get; set; }
|
---|
99 |
|
---|
100 | /// <summary>
|
---|
101 | /// Gets/Sets the type of the marker. Use TextMarkerType.None for normal markers.
|
---|
102 | /// </summary>
|
---|
103 | TextMarkerTypes MarkerTypes { get; set; }
|
---|
104 |
|
---|
105 | /// <summary>
|
---|
106 | /// Gets/Sets the color of the marker.
|
---|
107 | /// </summary>
|
---|
108 | Color MarkerColor { get; set; }
|
---|
109 |
|
---|
110 | /// <summary>
|
---|
111 | /// Gets/Sets an object with additional data for this text marker.
|
---|
112 | /// </summary>
|
---|
113 | object Tag { get; set; }
|
---|
114 |
|
---|
115 | /// <summary>
|
---|
116 | /// Gets/Sets an object that will be displayed as tooltip in the text editor.
|
---|
117 | /// </summary>
|
---|
118 | object ToolTip { get; set; }
|
---|
119 | }
|
---|
120 |
|
---|
121 | [Flags]
|
---|
122 | public enum TextMarkerTypes {
|
---|
123 | /// <summary>
|
---|
124 | /// Use no marker
|
---|
125 | /// </summary>
|
---|
126 | None = 0x0000,
|
---|
127 | /// <summary>
|
---|
128 | /// Use squiggly underline marker
|
---|
129 | /// </summary>
|
---|
130 | SquigglyUnderline = 0x001,
|
---|
131 | /// <summary>
|
---|
132 | /// Normal underline.
|
---|
133 | /// </summary>
|
---|
134 | NormalUnderline = 0x002,
|
---|
135 | /// <summary>
|
---|
136 | /// Dotted underline.
|
---|
137 | /// </summary>
|
---|
138 | DottedUnderline = 0x004,
|
---|
139 |
|
---|
140 | /// <summary>
|
---|
141 | /// Horizontal line in the scroll bar.
|
---|
142 | /// </summary>
|
---|
143 | LineInScrollBar = 0x0100,
|
---|
144 | /// <summary>
|
---|
145 | /// Small triangle in the scroll bar, pointing to the right.
|
---|
146 | /// </summary>
|
---|
147 | ScrollBarRightTriangle = 0x0400,
|
---|
148 | /// <summary>
|
---|
149 | /// Small triangle in the scroll bar, pointing to the left.
|
---|
150 | /// </summary>
|
---|
151 | ScrollBarLeftTriangle = 0x0800,
|
---|
152 | /// <summary>
|
---|
153 | /// Small circle in the scroll bar.
|
---|
154 | /// </summary>
|
---|
155 | CircleInScrollBar = 0x1000
|
---|
156 | }
|
---|
157 |
|
---|
158 | public interface ITextMarkerService {
|
---|
159 | /// <summary>
|
---|
160 | /// Creates a new text marker. The text marker will be invisible at first,
|
---|
161 | /// you need to set one of the Color properties to make it visible.
|
---|
162 | /// </summary>
|
---|
163 | ITextMarker Create(int startOffset, int length);
|
---|
164 |
|
---|
165 | /// <summary>
|
---|
166 | /// Gets the list of text markers.
|
---|
167 | /// </summary>
|
---|
168 | IEnumerable<ITextMarker> TextMarkers { get; }
|
---|
169 |
|
---|
170 | /// <summary>
|
---|
171 | /// Removes the specified text marker.
|
---|
172 | /// </summary>
|
---|
173 | void Remove(ITextMarker marker);
|
---|
174 |
|
---|
175 | /// <summary>
|
---|
176 | /// Removes all text markers that match the condition.
|
---|
177 | /// </summary>
|
---|
178 | void RemoveAll(Predicate<ITextMarker> predicate);
|
---|
179 |
|
---|
180 | /// <summary>
|
---|
181 | /// Finds all text markers at the specified offset.
|
---|
182 | /// </summary>
|
---|
183 | IEnumerable<ITextMarker> GetMarkersAtOffset(int offset);
|
---|
184 | }
|
---|
185 | }
|
---|