Code Coverage Statistics for Source File

c:\Tools\SD3\src\Libraries\ICSharpCode.TextEditor\Project\Src\Gui\CompletionWindow\DeclarationViewWindow.cs

Sequence Point Coverage
N/A
0 of 0
Branch Coverage
N/A
0 of 0
Lines
101
Highlight: Uncovered Code Covered Code
L V Source
1
// <file>
2
//     <copyright see="prj:///doc/copyright.txt"/>
3
//     <license see="prj:///doc/license.txt"/>
4
//     <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
5
//     <version>$Revision: 1965 $</version>
6
// </file>
7
8
using System;
9
using System.Drawing;
10
using System.Windows.Forms;
11
12
using ICSharpCode.TextEditor.Util;
13
14
namespace ICSharpCode.TextEditor.Gui.CompletionWindow
15
{
16
	public interface IDeclarationViewWindow
17
	{
18
		string Description {
19
			get;
20
			set;
21
		}
22
		void ShowDeclarationViewWindow();
23
		void CloseDeclarationViewWindow();
24
	}
25
	
26
	public class DeclarationViewWindow : Form, IDeclarationViewWindow
27
	{
28
		string description = String.Empty;
29
		
30
		public string Description {
31
			get {
32
				return description;
33
			}
34
			set {
35
				description = value;
36
				if (value == null && Visible) {
37
					Visible = false;
38
				} else if (value != null) {
39
					if (!Visible) ShowDeclarationViewWindow();
40
					Refresh();
41
				}
42
			}
43
		}
44
		
45
		public bool HideOnClick;
46
		
47
		public DeclarationViewWindow(Form parent)
48
		{
49
			SetStyle(ControlStyles.Selectable, false);
50
			StartPosition   = FormStartPosition.Manual;
51
			FormBorderStyle = FormBorderStyle.None;
52
			Owner           = parent;
53
			ShowInTaskbar   = false;
54
			Size            = new Size(0, 0);
55
			base.CreateHandle();
56
		}
57
		
58
		protected override CreateParams CreateParams {
59
			get {
60
				CreateParams p = base.CreateParams;
61
				AbstractCompletionWindow.AddShadowToWindow(p);
62
				return p;
63
			}
64
		}
65
		
66
		protected override bool ShowWithoutActivation {
67
			get {
68
				return true;
69
			}
70
		}
71
		
72
		protected override void OnClick(EventArgs e)
73
		{
74
			base.OnClick(e);
75
			if (HideOnClick) Hide();
76
		}
77
		
78
		public void ShowDeclarationViewWindow()
79
		{
80
			Show();
81
		}
82
		
83
		public void CloseDeclarationViewWindow()
84
		{
85
			Close();
86
			Dispose();
87
		}
88
		
89
		protected override void OnPaint(PaintEventArgs pe)
90
		{
91
			if (description != null && description.Length > 0) {
92
				TipPainterTools.DrawHelpTipFromCombinedDescription(this, pe.Graphics, Font, null, description);
93
			}
94
		}
95
		
96
		protected override void OnPaintBackground(PaintEventArgs pe)
97
		{
98
			pe.Graphics.FillRectangle(SystemBrushes.Info, pe.ClipRectangle);
99
		}
100
	}
101
}