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

(-)Mono.UIAutomation.Winforms.mdp (-2 / +6 lines)
Lines 375-381 Link Here
375
    <File name="Mono.UIAutomation.Winforms.Behaviors/DataGrid/DataItemValueProviderBehavior.cs" subtype="Code" buildaction="Compile" />
375
    <File name="Mono.UIAutomation.Winforms.Behaviors/DataGrid/DataItemValueProviderBehavior.cs" subtype="Code" buildaction="Compile" />
376
    <File name="Mono.UIAutomation.Winforms/PopupButtonPanelProvider.cs" subtype="Code" buildaction="Compile" />
376
    <File name="Mono.UIAutomation.Winforms/PopupButtonPanelProvider.cs" subtype="Code" buildaction="Compile" />
377
    <File name="Mono.UIAutomation.Winforms/PopupButtonProvider.cs" subtype="Code" buildaction="Compile" />
377
    <File name="Mono.UIAutomation.Winforms/PopupButtonProvider.cs" subtype="Code" buildaction="Compile" />
378
    <File name="Mono.UIAutomation.Winforms.Behaviors/PopupButtonPanel" subtype="Directory" buildaction="Compile" />
379
    <File name="Mono.UIAutomation.Winforms.Behaviors/PopupButtonPanel/InvokeProviderBehavior.cs" subtype="Code" buildaction="Compile" />
378
    <File name="Mono.UIAutomation.Winforms.Behaviors/PopupButtonPanel/InvokeProviderBehavior.cs" subtype="Code" buildaction="Compile" />
380
    <File name="Mono.UIAutomation.Winforms.Behaviors/ToolStripButton/InvokeProviderBehavior.cs" subtype="Code" buildaction="Compile" />
379
    <File name="Mono.UIAutomation.Winforms.Behaviors/ToolStripButton/InvokeProviderBehavior.cs" subtype="Code" buildaction="Compile" />
381
    <File name="Mono.UIAutomation.Winforms.Events/ToolStripButton/InvokePatternInvokedEvent.cs" subtype="Code" buildaction="Compile" />
380
    <File name="Mono.UIAutomation.Winforms.Events/ToolStripButton/InvokePatternInvokedEvent.cs" subtype="Code" buildaction="Compile" />
Lines 383-388 Link Here
383
    <File name="Mono.UIAutomation.Winforms/MessageBoxFormProvider.cs" subtype="Code" buildaction="Compile" />
382
    <File name="Mono.UIAutomation.Winforms/MessageBoxFormProvider.cs" subtype="Code" buildaction="Compile" />
384
    <File name="Mono.UIAutomation.Winforms.Behaviors/DateTimePicker/ToggleProviderBehavior.cs" subtype="Code" buildaction="Compile" />
383
    <File name="Mono.UIAutomation.Winforms.Behaviors/DateTimePicker/ToggleProviderBehavior.cs" subtype="Code" buildaction="Compile" />
385
    <File name="Mono.UIAutomation.Winforms.Events/DateTimePicker/TogglePatternToggleStateEvent.cs" subtype="Code" buildaction="Compile" />
384
    <File name="Mono.UIAutomation.Winforms.Events/DateTimePicker/TogglePatternToggleStateEvent.cs" subtype="Code" buildaction="Compile" />
385
    <File name="Globals.cs" subtype="Code" buildaction="Compile" />
386
    <File name="Mono.UIAutomation.Winforms.Events/Form/WindowDeactivatedEvent.cs" subtype="Code" buildaction="Compile" />
387
    <File name="Mono.UIAutomation.Winforms.Behaviors/BaseColorControl/SmallColorControlInvokeProviderBehavior.cs" subtype="Code" buildaction="Compile" />
388
    <File name="Mono.UIAutomation.Winforms/BaseColorControlProvider.cs" subtype="Code" buildaction="Compile" />
389
    <File name="Mono.UIAutomation.Winforms.Events/BaseColorControl/SmallColorControlInvokePatternInvokedEvent.cs" subtype="Code" buildaction="Compile" />
386
  </Contents>
390
  </Contents>
387
  <References>
391
  <References>
388
    <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
392
    <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
Lines 409-412 Link Here
409
    <AsmRefVar Name="REFERENCES" />
413
    <AsmRefVar Name="REFERENCES" />
410
    <ProjectRefVar Name="REFERENCES" />
414
    <ProjectRefVar Name="REFERENCES" />
411
  </MonoDevelop.Autotools.MakefileInfo>
415
  </MonoDevelop.Autotools.MakefileInfo>
412
</Project>
416
</Project>
(-)Mono.UIAutomation.Winforms/BaseColorControlProvider.cs (+103 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.Forms;
28
using System.Windows.Automation;
29
using System.Windows.Automation.Provider;
30
using Mono.Unix;
31
using Mono.UIAutomation.Winforms.Behaviors;
32
using Mono.UIAutomation.Winforms.Behaviors.BaseColorControl;
33
34
namespace Mono.UIAutomation.Winforms
35
{
36
	internal class BaseColorControlProvider : FragmentRootControlProvider
37
	{
38
		#region Constructor
39
40
		public BaseColorControlProvider (ColorDialog.BaseColorControl baseColorControl)
41
			: base (baseColorControl)
42
		{
43
		}
44
		
45
		#endregion
46
		
47
		#region SimpleControlProvider: Specializations
48
		
49
		protected override object GetProviderPropertyValue (int propertyId)
50
		{
51
			if (propertyId == AutomationElementIdentifiers.ControlTypeProperty.Id)
52
				return ControlType.Pane.Id;
53
			else if (propertyId == AutomationElementIdentifiers.LocalizedControlTypeProperty.Id)
54
				return Catalog.GetString ("pane");
55
			else
56
				return base.GetProviderPropertyValue (propertyId);
57
		}
58
		
59
		#endregion
60
61
		#region Internal Class: SmallColorControl Provider
62
63
		internal class SmallColorControlProvider : FragmentControlProvider
64
		{
65
			#region Constructor
66
	
67
			public SmallColorControlProvider (ColorDialog.BaseColorControl.SmallColorControl smallColorControl)
68
				: base (smallColorControl)
69
			{
70
			}
71
			
72
			#endregion
73
74
			#region SimpleControlProvider: Specializations
75
76
			public override void Initialize()
77
			{
78
				base.Initialize ();
79
				
80
				SetBehavior (InvokePatternIdentifiers.Pattern,
81
				             new SmallColorControlInvokeProviderBehavior (this));
82
			}
83
			
84
			#endregion
85
			
86
			#region SimpleControlProvider: Specializations
87
			
88
			protected override object GetProviderPropertyValue (int propertyId)
89
			{
90
				if (propertyId == AutomationElementIdentifiers.ControlTypeProperty.Id)
91
					return ControlType.Button.Id;
92
				else if (propertyId == AutomationElementIdentifiers.LocalizedControlTypeProperty.Id)
93
					return Catalog.GetString ("button");
94
				else
95
					return base.GetProviderPropertyValue (propertyId);
96
			}
97
			
98
			#endregion
99
		}
100
101
		#endregion
102
	}
103
}
(-)Mono.UIAutomation.Winforms/ProviderFactory.cs (+6 lines)
Lines 119-124 Link Here
119
			SWF.DataGrid dgrid;
119
			SWF.DataGrid dgrid;
120
			SWF.DateTimePicker dtp;
120
			SWF.DateTimePicker dtp;
121
			SWF.PrintPreviewControl ppc;
121
			SWF.PrintPreviewControl ppc;
122
			SWF.ColorDialog.BaseColorControl bcc;
123
			SWF.ColorDialog.BaseColorControl.SmallColorControl scc;
122
			
124
			
123
			SWF.StatusStrip ss;
125
			SWF.StatusStrip ss;
124
			SWF.MenuStrip ms;
126
			SWF.MenuStrip ms;
Lines 260-265 Link Here
260
				provider = new PopupButtonPanelProvider (pbp);
262
				provider = new PopupButtonPanelProvider (pbp);
261
			else if ((pbtn = component as SWF.PopupButtonPanel.PopupButton) != null)
263
			else if ((pbtn = component as SWF.PopupButtonPanel.PopupButton) != null)
262
				provider = new PopupButtonProvider (pbtn);
264
				provider = new PopupButtonProvider (pbtn);
265
			else if ((bcc = component as SWF.ColorDialog.BaseColorControl) != null)
266
				provider = new BaseColorControlProvider (bcc);
267
			else if ((scc = component as SWF.ColorDialog.BaseColorControl.SmallColorControl) != null)
268
				provider = new BaseColorControlProvider.SmallColorControlProvider (scc);
263
			else {
269
			else {
264
				//TODO: We have to solve the problem when there's a Custom control
270
				//TODO: We have to solve the problem when there's a Custom control
265
				//	Ideally the first thing we do is send a wndproc message to
271
				//	Ideally the first thing we do is send a wndproc message to
(-)Mono.UIAutomation.Winforms.Behaviors/BaseColorControl/SmallColorControlInvokeProviderBehavior.cs (+95 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.Forms;
28
using System.Windows.Automation;
29
using System.Windows.Automation.Provider;
30
using Mono.UIAutomation.Winforms;
31
using Mono.UIAutomation.Winforms.Events;
32
using Mono.UIAutomation.Winforms.Events.BaseColorControl;
33
34
namespace Mono.UIAutomation.Winforms.Behaviors.BaseColorControl
35
{
36
	internal class SmallColorControlInvokeProviderBehavior
37
		: ProviderBehavior, IInvokeProvider
38
	{
39
		#region Constructor
40
		
41
		public SmallColorControlInvokeProviderBehavior (BaseColorControlProvider.SmallColorControlProvider provider)
42
			: base (provider)
43
		{
44
		}
45
		
46
		#endregion
47
		
48
		#region IProviderBehavior Interface
49
50
		public override AutomationPattern ProviderPattern {
51
			get { return InvokePatternIdentifiers.Pattern; }
52
		}
53
54
		public override void Connect ()
55
		{
56
			Provider.SetEvent (ProviderEventType.InvokePatternInvokedEvent, 
57
			                   new SmallColorControlInvokePatternInvokedEvent (Provider));
58
		}
59
		
60
		public override void Disconnect ()
61
		{
62
			Provider.SetEvent (ProviderEventType.InvokePatternInvokedEvent, 
63
			                   null);
64
		}
65
		
66
		#endregion
67
		
68
		#region IInvokeProvider Members
69
		
70
		public virtual void Invoke ()
71
		{
72
			if (!Provider.Control.Enabled)
73
				throw new ElementNotEnabledException ();
74
75
			PerformClick ();
76
		}
77
		
78
		#endregion	
79
		
80
		#region Private Methods
81
		
82
		private void PerformClick ()
83
		{
84
			if (Provider.Control.InvokeRequired == true) {
85
				Provider.Control.BeginInvoke (new MethodInvoker (PerformClick));
86
				return;
87
			}
88
89
			// TODO:
90
//			((ColorDialog.BaseColorControl.SmallColorControl) Provider.Cotrol).InternalColor
91
		}
92
		
93
		#endregion
94
	}
95
}
(-)Makefile.am (+3 lines)
Lines 44-49 Link Here
44
44
45
FILES =  \
45
FILES =  \
46
	Globals.cs \
46
	Globals.cs \
47
	Mono.UIAutomation.Winforms.Behaviors/BaseColorControl/SmallColorControlInvokeProviderBehavior.cs \
47
	Mono.UIAutomation.Winforms.Behaviors/Button/InvokeProviderBehavior.cs \
48
	Mono.UIAutomation.Winforms.Behaviors/Button/InvokeProviderBehavior.cs \
48
	Mono.UIAutomation.Winforms.Behaviors/CheckBox/ToggleProviderBehavior.cs \
49
	Mono.UIAutomation.Winforms.Behaviors/CheckBox/ToggleProviderBehavior.cs \
49
	Mono.UIAutomation.Winforms.Behaviors/CheckedListBox/ListItemToggleProviderBehavior.cs \
50
	Mono.UIAutomation.Winforms.Behaviors/CheckedListBox/ListItemToggleProviderBehavior.cs \
Lines 155-160 Link Here
155
	Mono.UIAutomation.Winforms.Events/AutomationNamePropertyEvent.cs \
156
	Mono.UIAutomation.Winforms.Events/AutomationNamePropertyEvent.cs \
156
	Mono.UIAutomation.Winforms.Events/BaseAutomationEvent.cs \
157
	Mono.UIAutomation.Winforms.Events/BaseAutomationEvent.cs \
157
	Mono.UIAutomation.Winforms.Events/BaseAutomationPropertyEvent.cs \
158
	Mono.UIAutomation.Winforms.Events/BaseAutomationPropertyEvent.cs \
159
	Mono.UIAutomation.Winforms.Events/BaseColorControl/SmallColorControlInvokePatternInvokedEvent.cs \
158
	Mono.UIAutomation.Winforms.Events/Button/InvokePatternInvokedEvent.cs \
160
	Mono.UIAutomation.Winforms.Events/Button/InvokePatternInvokedEvent.cs \
159
	Mono.UIAutomation.Winforms.Events/CheckBox/TogglePatternToggleStateEvent.cs \
161
	Mono.UIAutomation.Winforms.Events/CheckBox/TogglePatternToggleStateEvent.cs \
160
	Mono.UIAutomation.Winforms.Events/CheckedListBox/ListItemTogglePatternToggleStateEvent.cs \
162
	Mono.UIAutomation.Winforms.Events/CheckedListBox/ListItemTogglePatternToggleStateEvent.cs \
Lines 336-341 Link Here
336
	Mono.UIAutomation.Winforms.Navigation/ParentNavigation.cs \
338
	Mono.UIAutomation.Winforms.Navigation/ParentNavigation.cs \
337
	Mono.UIAutomation.Winforms.Navigation/SimpleNavigation.cs \
339
	Mono.UIAutomation.Winforms.Navigation/SimpleNavigation.cs \
338
	Mono.UIAutomation.Winforms/AssemblyInfo.cs \
340
	Mono.UIAutomation.Winforms/AssemblyInfo.cs \
341
	Mono.UIAutomation.Winforms/BaseColorControlProvider.cs \
339
	Mono.UIAutomation.Winforms/ButtonProvider.cs \
342
	Mono.UIAutomation.Winforms/ButtonProvider.cs \
340
	Mono.UIAutomation.Winforms/CheckBoxProvider.cs \
343
	Mono.UIAutomation.Winforms/CheckBoxProvider.cs \
341
	Mono.UIAutomation.Winforms/CheckedListBoxProvider.cs \
344
	Mono.UIAutomation.Winforms/CheckedListBoxProvider.cs \
(-)Mono.UIAutomation.Winforms.Events/BaseColorControl/SmallColorControlInvokePatternInvokedEvent.cs (+70 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 System.Windows.Forms;
30
using Mono.UIAutomation.Winforms.Events;
31
32
namespace Mono.UIAutomation.Winforms.Events.BaseColorControl
33
{
34
35
	internal class SmallColorControlInvokePatternInvokedEvent : BaseAutomationEvent
36
	{
37
38
		#region Constructors
39
40
		public SmallColorControlInvokePatternInvokedEvent (SimpleControlProvider provider) 
41
			: base (provider, InvokePatternIdentifiers.InvokedEvent)
42
		{
43
		}
44
		
45
		#endregion
46
		
47
		#region IConnectable Overrides
48
		
49
		public override void Connect ()
50
		{
51
			Provider.Control.Click += new EventHandler (OnClick);
52
		}
53
54
		public override void Disconnect ()
55
		{
56
			Provider.Control.Click -= new EventHandler (OnClick);
57
		}
58
		
59
		#endregion
60
61
		#region Private Methods
62
63
		private void OnClick (object sender, EventArgs e)
64
		{
65
			RaiseAutomationEvent ();
66
		}
67
68
		#endregion
69
	}
70
}

Return to bug 428845