Free cookie consent management tool by TermsFeed Policy Generator

source: stable/HeuristicLab.ExtLibs/HeuristicLab.AvalonEdit/5.0.1/AvalonEdit-5.0.1/Folding/NewFolding.cs @ 17328

Last change on this file since 17328 was 11700, checked in by jkarder, 10 years ago

#2077: created branch and added first version

File size: 2.6 KB
Line 
1// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
2//
3// Permission is hereby granted, free of charge, to any person obtaining a copy of this
4// software and associated documentation files (the "Software"), to deal in the Software
5// without restriction, including without limitation the rights to use, copy, modify, merge,
6// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
7// to whom the Software is furnished to do so, subject to the following conditions:
8//
9// The above copyright notice and this permission notice shall be included in all copies or
10// substantial portions of the Software.
11//
12// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
13// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
15// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
17// DEALINGS IN THE SOFTWARE.
18
19using System;
20#if NREFACTORY
21using ICSharpCode.NRefactory.Editor;
22#else
23using ICSharpCode.AvalonEdit.Document;
24#endif
25
26namespace ICSharpCode.AvalonEdit.Folding
27{
28  /// <summary>
29  /// Helper class used for <see cref="FoldingManager.UpdateFoldings"/>.
30  /// </summary>
31  public class NewFolding : ISegment
32  {
33    /// <summary>
34    /// Gets/Sets the start offset.
35    /// </summary>
36    public int StartOffset { get; set; }
37   
38    /// <summary>
39    /// Gets/Sets the end offset.
40    /// </summary>
41    public int EndOffset { get; set; }
42   
43    /// <summary>
44    /// Gets/Sets the name displayed for the folding.
45    /// </summary>
46    public string Name { get; set; }
47   
48    /// <summary>
49    /// Gets/Sets whether the folding is closed by default.
50    /// </summary>
51    public bool DefaultClosed { get; set; }
52   
53    /// <summary>
54    /// Gets/Sets whether the folding is considered to be a definition.
55    /// This has an effect on the 'Show Definitions only' command.
56    /// </summary>
57    public bool IsDefinition { get; set; }
58   
59    /// <summary>
60    /// Creates a new NewFolding instance.
61    /// </summary>
62    public NewFolding()
63    {
64    }
65   
66    /// <summary>
67    /// Creates a new NewFolding instance.
68    /// </summary>
69    public NewFolding(int start, int end)
70    {
71      if (!(start <= end))
72        throw new ArgumentException("'start' must be less than 'end'");
73      this.StartOffset = start;
74      this.EndOffset = end;
75      this.Name = null;
76      this.DefaultClosed = false;
77    }
78   
79    int ISegment.Offset {
80      get { return this.StartOffset; }
81    }
82   
83    int ISegment.Length {
84      get { return this.EndOffset - this.StartOffset; }
85    }
86  }
87}
Note: See TracBrowser for help on using the repository browser.