View | Details | Raw Unified | Return to bug 428698
Collapse All | Expand All

(-)Mono.UIAutomation.Winforms.mdp (+2 lines)
Lines 152-157 Link Here
152
    <File name="Mono.UIAutomation.Winforms.Behaviors/ListView/MultipleViewProviderBehavior.cs" subtype="Code" buildaction="Compile" />
152
    <File name="Mono.UIAutomation.Winforms.Behaviors/ListView/MultipleViewProviderBehavior.cs" subtype="Code" buildaction="Compile" />
153
    <File name="Mono.UIAutomation.Winforms/IScrollBehaviorSubject.cs" subtype="Code" buildaction="Compile" />
153
    <File name="Mono.UIAutomation.Winforms/IScrollBehaviorSubject.cs" subtype="Code" buildaction="Compile" />
154
    <File name="Mono.UIAutomation.Winforms/ScrollBehaviorObserver.cs" subtype="Code" buildaction="Compile" />
154
    <File name="Mono.UIAutomation.Winforms/ScrollBehaviorObserver.cs" subtype="Code" buildaction="Compile" />
155
    <File name="Mono.UIAutomation.Winforms.Behaviors/StatusBar/StatusBarPanelGridItemProviderBehavior.cs" subtype="Code" buildaction="Compile" />
156
    <File name="Mono.UIAutomation.Winforms.Events/StatusBar/StatusBarPanelGridItemPatternColumnEvent.cs" subtype="Code" buildaction="Compile" />
155
  </Contents>
157
  </Contents>
156
  <References>
158
  <References>
157
    <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
159
    <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
(-)Mono.UIAutomation.Winforms/StatusBarProvider.cs (+2 lines)
Lines 185-190 Link Here
185
				
185
				
186
				SetBehavior (ValuePatternIdentifiers.Pattern,
186
				SetBehavior (ValuePatternIdentifiers.Pattern,
187
				             new StatusBarPanelValueProviderBehavior (this));
187
				             new StatusBarPanelValueProviderBehavior (this));
188
				SetBehavior (GridItemPatternIdentifiers.Pattern,
189
				             new StatusBarPanelGridItemProviderBehavior (this, statusBarPanel));
188
			}
190
			}
189
		
191
		
190
			#endregion
192
			#endregion
(-)Mono.UIAutomation.Winforms.Behaviors/StatusBar/StatusBarPanelGridItemProviderBehavior.cs (+127 lines)
Line 0 Link Here
1
// Permission is hereby granted, free of charge, to any person obtaining 
2
// a copy of this software and associated documentation files (the 
3
// "Software"), to deal in the Software without restriction, including 
4
// without limitation the rights to use, copy, modify, merge, publish, 
5
// distribute, sublicense, and/or sell copies of the Software, and to 
6
// permit persons to whom the Software is furnished to do so, subject to 
7
// the following conditions: 
8
//  
9
// The above copyright notice and this permission notice shall be 
10
// included in all copies or substantial portions of the Software. 
11
//  
12
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
13
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
14
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
15
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 
16
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 
17
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 
18
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
19
// 
20
// Copyright (c) 2008 Novell, Inc. (http://www.novell.com) 
21
// 
22
// Authors: 
23
//	Neville Gao <nevillegao@gmail.com>
24
// 
25
26
using System;
27
using System.Windows.Automation;
28
using System.Windows.Automation.Provider;
29
using SWF = System.Windows.Forms;
30
using Mono.UIAutomation.Winforms;
31
using Mono.UIAutomation.Winforms.Events;
32
using Mono.UIAutomation.Winforms.Events.StatusBar;
33
34
namespace Mono.UIAutomation.Winforms.Behaviors.StatusBar
35
{
36
	internal class StatusBarPanelGridItemProviderBehavior : ProviderBehavior, IGridItemProvider
37
	{
38
		#region Constructor
39
		
40
		public StatusBarPanelGridItemProviderBehavior (StatusBarProvider.StatusBarPanelProvider provider,
41
		                                               SWF.StatusBarPanel statusBarPanel)
42
			: base (provider)
43
		{
44
			this.statusBarPanel = statusBarPanel;
45
		}
46
		
47
		#endregion
48
		
49
		#region IProviderBehavior Interface
50
		
51
		public override AutomationPattern ProviderPattern {
52
			get { return GridItemPatternIdentifiers.Pattern; }
53
		}
54
		
55
		public override void Connect (SWF.Control control)
56
		{
57
			// NOTE: Row Property NEVER changes.
58
			// NOTE: RowSpan Property NEVER changes.
59
			// NOTE: ColumnSpan Property NEVER changes.
60
			// NOTE: ContainingGrid Property NEVER changes.
61
			Provider.SetEvent (ProviderEventType.GridItemPatternColumnProperty,
62
			                   new StatusBarPanelGridItemPatternColumnEvent (Provider));
63
		}
64
		
65
		public override void Disconnect (SWF.Control control)
66
		{
67
			Provider.SetEvent (ProviderEventType.GridItemPatternRowProperty,
68
			                   null);
69
			Provider.SetEvent (ProviderEventType.GridItemPatternColumnProperty,
70
			                   null);
71
			Provider.SetEvent (ProviderEventType.GridItemPatternRowSpanProperty,
72
			                   null);
73
			Provider.SetEvent (ProviderEventType.GridItemPatternColumnProperty,
74
			                   null);
75
			Provider.SetEvent (ProviderEventType.GridItemPatternContainingGridProperty,
76
			                   null);
77
		}
78
79
		public override object GetPropertyValue (int propertyId)
80
		{
81
			if (propertyId == GridItemPatternIdentifiers.RowProperty.Id)
82
				return Row;
83
			else if (propertyId == GridItemPatternIdentifiers.ColumnProperty.Id)
84
				return Column;
85
			else if (propertyId == GridItemPatternIdentifiers.RowSpanProperty.Id)
86
				return RowSpan;
87
			else if (propertyId == GridItemPatternIdentifiers.ColumnSpanProperty.Id)
88
				return ColumnSpan;
89
			else if (propertyId == GridItemPatternIdentifiers.ContainingGridProperty.Id)
90
				return ContainingGrid;
91
			else
92
				return base.GetPropertyValue (propertyId);
93
		}
94
		
95
		#endregion
96
		
97
		#region IGridItemProvider Members
98
		
99
		public int Row {
100
			get { return 0; }
101
		}
102
		
103
		public int Column {
104
			get { return statusBarPanel.Parent.Panels.IndexOf (statusBarPanel); }
105
		}
106
		
107
		public int RowSpan {
108
			get { return 1; }
109
		}
110
		
111
		public int ColumnSpan {
112
			get { return 1; }
113
		}
114
		
115
		public IRawElementProviderSimple ContainingGrid {
116
			get { return ProviderFactory.GetProvider (statusBarPanel.Parent); }
117
		}
118
		
119
		#endregion
120
		
121
		#region Private Fields
122
		
123
		private SWF.StatusBarPanel statusBarPanel;
124
		
125
		#endregion
126
	}
127
}
(-)Mono.UIAutomation.Winforms.Events/StatusBar/StatusBarPanelGridItemPatternColumnEvent.cs (+80 lines)
Line 0 Link Here
1
// Permission is hereby granted, free of charge, to any person obtaining 
2
// a copy of this software and associated documentation files (the 
3
// "Software"), to deal in the Software without restriction, including 
4
// without limitation the rights to use, copy, modify, merge, publish, 
5
// distribute, sublicense, and/or sell copies of the Software, and to 
6
// permit persons to whom the Software is furnished to do so, subject to 
7
// the following conditions: 
8
//  
9
// The above copyright notice and this permission notice shall be 
10
// included in all copies or substantial portions of the Software. 
11
//  
12
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
13
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
14
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
15
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 
16
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 
17
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 
18
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
19
// 
20
// Copyright (c) 2008 Novell, Inc. (http://www.novell.com) 
21
// 
22
// Authors: 
23
//	Neville Gao <nevillegao@gmail.com>
24
// 
25
26
using System;
27
using System.Windows.Automation;
28
using System.Windows.Automation.Provider;
29
using SWF = System.Windows.Forms;
30
using System.ComponentModel;
31
32
namespace Mono.UIAutomation.Winforms.Events.StatusBar
33
{
34
	internal class StatusBarPanelGridItemPatternColumnEvent : BaseAutomationPropertyEvent
35
	{
36
		#region Constructor
37
38
		public StatusBarPanelGridItemPatternColumnEvent (IRawElementProviderSimple provider)
39
			: base (provider, GridItemPatternIdentifiers.ColumnProperty)
40
		{
41
		}
42
		
43
		#endregion
44
		
45
		#region IConnectable Overrides
46
47
		public override void Connect (SWF.Control control)
48
		{
49
			try {
50
				Helper.AddPrivateEvent (typeof (SWF.StatusBar.StatusBarPanelCollection),
51
				                        ((SWF.StatusBar) control).Panels,
52
				                        "UIACollectionChanged",
53
				                        this,
54
				                        "OnColumnChanged");
55
			} catch (NotSupportedException) { }
56
		}
57
58
		public override void Disconnect (SWF.Control control)
59
		{
60
			try {
61
				Helper.RemovePrivateEvent (typeof (SWF.StatusBar.StatusBarPanelCollection),
62
				                           ((SWF.StatusBar) control).Panels,
63
				                           "UIACollectionChanged",
64
				                           this,
65
				                           "OnColumnChanged");
66
			} catch (NotSupportedException) { }
67
		}
68
		
69
		#endregion 
70
		
71
		#region Private Methods
72
		
73
		protected void OnColumnChanged (object sender, CollectionChangeEventArgs e)
74
		{
75
			RaiseAutomationPropertyChangedEvent ();
76
		}
77
78
		#endregion
79
	}
80
}

Return to bug 428698