~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextViewWeakEventManager.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using ICSharpCode.AvalonEdit.Utils;
 
6
 
 
7
namespace ICSharpCode.AvalonEdit.Rendering
 
8
{
 
9
        /// <summary>
 
10
        /// Contains weak event managers for the TextView events.
 
11
        /// </summary>
 
12
        public static class TextViewWeakEventManager
 
13
        {
 
14
                /// <summary>
 
15
                /// Weak event manager for the <see cref="TextView.DocumentChanged"/> event.
 
16
                /// </summary>
 
17
                [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
 
18
                public sealed class DocumentChanged : WeakEventManagerBase<DocumentChanged, TextView>
 
19
                {
 
20
                        /// <inheritdoc/>
 
21
                        protected override void StartListening(TextView source)
 
22
                        {
 
23
                                source.DocumentChanged += DeliverEvent;
 
24
                        }
 
25
                        
 
26
                        /// <inheritdoc/>
 
27
                        protected override void StopListening(TextView source)
 
28
                        {
 
29
                                source.DocumentChanged -= DeliverEvent;
 
30
                        }
 
31
                }
 
32
                
 
33
                /// <summary>
 
34
                /// Weak event manager for the <see cref="TextView.VisualLinesChanged"/> event.
 
35
                /// </summary>
 
36
                [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
 
37
                public sealed class VisualLinesChanged : WeakEventManagerBase<VisualLinesChanged, TextView>
 
38
                {
 
39
                        /// <inheritdoc/>
 
40
                        protected override void StartListening(TextView source)
 
41
                        {
 
42
                                source.VisualLinesChanged += DeliverEvent;
 
43
                        }
 
44
                        
 
45
                        /// <inheritdoc/>
 
46
                        protected override void StopListening(TextView source)
 
47
                        {
 
48
                                source.VisualLinesChanged -= DeliverEvent;
 
49
                        }
 
50
                }
 
51
                
 
52
                /// <summary>
 
53
                /// Weak event manager for the <see cref="TextView.ScrollOffsetChanged"/> event.
 
54
                /// </summary>
 
55
                [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
 
56
                public sealed class ScrollOffsetChanged : WeakEventManagerBase<ScrollOffsetChanged, TextView>
 
57
                {
 
58
                        /// <inheritdoc/>
 
59
                        protected override void StartListening(TextView source)
 
60
                        {
 
61
                                source.ScrollOffsetChanged += DeliverEvent;
 
62
                        }
 
63
                        
 
64
                        /// <inheritdoc/>
 
65
                        protected override void StopListening(TextView source)
 
66
                        {
 
67
                                source.ScrollOffsetChanged -= DeliverEvent;
 
68
                        }
 
69
                }
 
70
        }
 
71
}