Code Coverage Statistics for Source File
c:\Tools\SD3\src\Libraries\ICSharpCode.TextEditor\Project\Src\Util\TipSection.cs
|
Sequence Point Coverage
N/A
0 of 0
|
Branch Coverage
N/A
0 of 0
|
Lines
84
|
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="none" email=""/> |
|
5 |
// <version>$Revision: 915 $</version> |
|
6 |
// </file> |
|
7 |
||
8 |
using System; |
|
9 |
using System.Diagnostics; |
|
10 |
using System.Drawing; |
|
11 |
||
12 |
namespace ICSharpCode.TextEditor.Util |
|
13 |
{ |
|
14 |
abstract class TipSection |
|
15 |
{ |
|
16 |
SizeF tipAllocatedSize; |
|
17 |
Graphics tipGraphics; |
|
18 |
SizeF tipMaxSize; |
|
19 |
SizeF tipRequiredSize; |
|
20 |
||
21 |
protected TipSection(Graphics graphics) |
|
22 |
{ |
|
23 |
tipGraphics = graphics; |
|
24 |
} |
|
25 |
||
26 |
public abstract void Draw(PointF location); |
|
27 |
||
28 |
public SizeF GetRequiredSize() |
|
29 |
{ |
|
30 |
return tipRequiredSize; |
|
31 |
} |
|
32 |
||
33 |
public void SetAllocatedSize(SizeF allocatedSize) |
|
34 |
{ |
|
35 |
Debug.Assert(allocatedSize.Width >= tipRequiredSize.Width && |
|
36 |
allocatedSize.Height >= tipRequiredSize.Height); |
|
37 |
||
38 |
tipAllocatedSize = allocatedSize; OnAllocatedSizeChanged(); |
|
39 |
} |
|
40 |
||
41 |
public void SetMaximumSize(SizeF maximumSize) |
|
42 |
{ |
|
43 |
tipMaxSize = maximumSize; OnMaximumSizeChanged(); |
|
44 |
} |
|
45 |
||
46 |
protected virtual void OnAllocatedSizeChanged() |
|
47 |
{ |
|
48 |
||
49 |
} |
|
50 |
||
51 |
protected virtual void OnMaximumSizeChanged() |
|
52 |
{ |
|
53 |
||
54 |
} |
|
55 |
||
56 |
protected void SetRequiredSize(SizeF requiredSize) |
|
57 |
{ |
|
58 |
requiredSize.Width = Math.Max(0, requiredSize.Width); |
|
59 |
requiredSize.Height = Math.Max(0, requiredSize.Height); |
|
60 |
requiredSize.Width = Math.Min(tipMaxSize.Width, requiredSize.Width); |
|
61 |
requiredSize.Height = Math.Min(tipMaxSize.Height, requiredSize.Height); |
|
62 |
||
63 |
tipRequiredSize = requiredSize; |
|
64 |
} |
|
65 |
||
66 |
protected Graphics Graphics { |
|
67 |
get { |
|
68 |
return tipGraphics; |
|
69 |
} |
|
70 |
} |
|
71 |
||
72 |
protected SizeF AllocatedSize { |
|
73 |
get { |
|
74 |
return tipAllocatedSize; |
|
75 |
} |
|
76 |
} |
|
77 |
||
78 |
protected SizeF MaximumSize { |
|
79 |
get { |
|
80 |
return tipMaxSize; |
|
81 |
} |
|
82 |
} |
|
83 |
} |
|
84 |
} |