~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/Designer/GroupeHeaderDesigner.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 System.ComponentModel;
 
6
using System.ComponentModel.Design;
 
7
 
 
8
namespace ICSharpCode.Reports.Addin.Designer
 
9
{
 
10
        /// <summary>
 
11
        /// Description of GroupeHeaderDesigner.
 
12
        /// </summary>
 
13
        public class GroupHeaderDesigner:DataItemDesigner
 
14
        {
 
15
                
 
16
                private ISelectionService selectionService;
 
17
                private IComponentChangeService componentChangeService;
 
18
                
 
19
                public GroupHeaderDesigner()
 
20
                {
 
21
                }
 
22
                
 
23
                public override void Initialize(IComponent component)
 
24
                {
 
25
                        base.Initialize(component);
 
26
                }
 
27
                
 
28
                
 
29
                
 
30
                private void OnSelectionChanged(object sender, EventArgs e)
 
31
                {
 
32
                        Control.Invalidate( );
 
33
                }
 
34
                
 
35
                
 
36
                private void OnComponentRename(object sender,ComponentRenameEventArgs e) {
 
37
                        if (e.Component == this.Component) {
 
38
                                Control.Name = e.NewName;
 
39
                                Control.Invalidate();
 
40
                        }
 
41
                }
 
42
                
 
43
                
 
44
                private void GetService ()
 
45
                {
 
46
                        selectionService = GetService(typeof(ISelectionService)) as ISelectionService;
 
47
                        if (selectionService != null)
 
48
                        {
 
49
                                selectionService.SelectionChanged += OnSelectionChanged;
 
50
                        }
 
51
                        
 
52
                        componentChangeService = (IComponentChangeService)GetService(typeof(IComponentChangeService));
 
53
                        if (componentChangeService != null) {
 
54
                                componentChangeService.ComponentRename += new ComponentRenameEventHandler(OnComponentRename);
 
55
                        }
 
56
                }
 
57
                
 
58
                        
 
59
                protected override void Dispose(bool disposing)
 
60
                {
 
61
                        if (this.selectionService != null) {
 
62
                                selectionService.SelectionChanged -= OnSelectionChanged;
 
63
                        }
 
64
                        
 
65
                        if (componentChangeService != null) {
 
66
                                componentChangeService.ComponentRename -= OnComponentRename;
 
67
                        }
 
68
                        base.Dispose(disposing);
 
69
                }
 
70
        
 
71
        }
 
72
}