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

(-)UIAutomationWinforms/Mono.UIAutomation.Winforms.mdp (-4 / +12 lines)
Lines 1-4 Link Here
1
<Project name="Mono.UIAutomation.Winforms" fileversion="2.0" language="C#" UseParentDirectoryAsNamespace="True" DefaultNamespace="Mono.UIAutomation.Winforms" clr-version="Net_2_0" targetFramework="3.5" ctype="DotNetProject">
1
<Project name="Mono.UIAutomation.Winforms" fileversion="2.0" language="C#" DefaultNamespace="Mono.UIAutomation.Winforms" UseParentDirectoryAsNamespace="True" clr-version="Net_2_0" targetFramework="3.5" ctype="DotNetProject">
2
  <Configurations active="Debug">
2
  <Configurations active="Debug">
3
    <Configuration name="Debug" ctype="DotNetProjectConfiguration">
3
    <Configuration name="Debug" ctype="DotNetProjectConfiguration">
4
      <Output directory="bin/Debug" signAssembly="True" assemblyKeyFile="../mono-uia.snk" assembly="UIAutomationWinforms" />
4
      <Output directory="bin/Debug" signAssembly="True" assemblyKeyFile="../mono-uia.snk" assembly="UIAutomationWinforms" />
Lines 567-587 Link Here
567
    <File name="Mono.UIAutomation.Winforms.Events/DataGridView/DataItemChildHasKeyboardFocusPropertyEvent.cs" subtype="Code" buildaction="Compile" />
567
    <File name="Mono.UIAutomation.Winforms.Events/DataGridView/DataItemChildHasKeyboardFocusPropertyEvent.cs" subtype="Code" buildaction="Compile" />
568
    <File name="Mono.UIAutomation.Winforms.Behaviors/DataGrid/DataItemEditSelectionItemProviderBehavior.cs" subtype="Code" buildaction="Compile" />
568
    <File name="Mono.UIAutomation.Winforms.Behaviors/DataGrid/DataItemEditSelectionItemProviderBehavior.cs" subtype="Code" buildaction="Compile" />
569
    <File name="Mono.UIAutomation.Winforms.Events/DataGrid/DataItemEditSelectionItemPatternIsSelectedEvent.cs" subtype="Code" buildaction="Compile" />
569
    <File name="Mono.UIAutomation.Winforms.Events/DataGrid/DataItemEditSelectionItemPatternIsSelectedEvent.cs" subtype="Code" buildaction="Compile" />
570
    <File name="Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemInvokeProviderBehavior.cs" subtype="Code" buildaction="Compile" />
571
    <File name="Mono.UIAutomation.Winforms.Behaviors/ToolStripButton/ToggleProviderBehavior.cs" subtype="Code" buildaction="Compile" />
572
    <File name="Mono.UIAutomation.Winforms.Events/DateTimePicker/CheckboxAutomationHasKeyboardFocusPropertyEvent.cs" subtype="Code" buildaction="Compile" />
573
    <File name="Mono.UIAutomation.Winforms.Events/DateTimePicker/PartAutomationHasKeyboardFocusPropertyEvent.cs" subtype="Code" buildaction="Compile" />
574
    <File name="Mono.UIAutomation.Winforms.Events/MonthCalendar/AutomationNamePropertyEvent.cs" subtype="Code" buildaction="Compile" />
575
    <File name="Mono.UIAutomation.Winforms.Events/PopupButton/AutomationHasKeyboardFocusPropertyEvent.cs" subtype="Code" buildaction="Compile" />
576
    <File name="Mono.UIAutomation.Winforms.Events/ToolStripButton/TogglePatternToggleStateEvent.cs" subtype="Code" buildaction="Compile" />
577
    <File name="Mono.UIAutomation.Winforms.Behaviors/MonthCalendar/TodayLinkInvokeProviderBehavior.cs" subtype="Code" buildaction="Compile" />
570
  </Contents>
578
  </Contents>
571
  <References>
579
  <References>
572
    <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
580
    <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
573
    <ProjectReference type="Gac" localcopy="True" refto="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
581
    <ProjectReference type="Gac" localcopy="True" refto="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
574
    <ProjectReference type="Gac" localcopy="True" refto="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
582
    <ProjectReference type="Gac" localcopy="True" refto="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
583
    <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
584
    <ProjectReference type="Gac" localcopy="True" refto="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
585
    <ProjectReference type="Gac" localcopy="True" refto="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
575
    <ProjectReference type="Gac" localcopy="True" refto="WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
586
    <ProjectReference type="Gac" localcopy="True" refto="WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
576
    <ProjectReference type="Gac" localcopy="True" refto="UIAutomationBridge, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
587
    <ProjectReference type="Gac" localcopy="True" refto="UIAutomationBridge, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
577
    <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
578
    <ProjectReference type="Gac" localcopy="True" refto="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
579
    <ProjectReference type="Gac" localcopy="True" refto="UIAutomationTypes, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
588
    <ProjectReference type="Gac" localcopy="True" refto="UIAutomationTypes, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
580
    <ProjectReference type="Gac" localcopy="True" refto="UIAutomationProvider, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
589
    <ProjectReference type="Gac" localcopy="True" refto="UIAutomationProvider, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
581
    <ProjectReference type="Gac" localcopy="True" refto="glib-sharp, Version=2.14.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
590
    <ProjectReference type="Gac" localcopy="True" refto="glib-sharp, Version=2.14.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
582
    <ProjectReference type="Gac" localcopy="True" refto="atk-sharp, Version=2.14.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
591
    <ProjectReference type="Gac" localcopy="True" refto="atk-sharp, Version=2.14.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
583
    <ProjectReference type="Gac" localcopy="True" refto="Mono.WebBrowser, Version=0.5.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
592
    <ProjectReference type="Gac" localcopy="True" refto="Mono.WebBrowser, Version=0.5.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
584
    <ProjectReference type="Gac" localcopy="True" refto="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
585
  </References>
593
  </References>
586
  <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="Makefile.am" IsAutotoolsProject="True" RelativeConfigureInPath="..">
594
  <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="Makefile.am" IsAutotoolsProject="True" RelativeConfigureInPath="..">
587
    <BuildFilesVar Sync="True" Name="FILES" />
595
    <BuildFilesVar Sync="True" Name="FILES" />
(-)UIAutomationWinforms/Mono.UIAutomation.Winforms/MonthCalendarProvider.cs (-1 / +70 lines)
Lines 24-29 Link Here
24
//
24
//
25
25
26
using System;
26
using System;
27
using System.Drawing;
27
using Mono.Unix;
28
using Mono.Unix;
28
using System.Threading;
29
using System.Threading;
29
using System.Globalization;
30
using System.Globalization;
Lines 43-49 Link Here
43
		public MonthCalendarProvider (MonthCalendar monthCalendar)
44
		public MonthCalendarProvider (MonthCalendar monthCalendar)
44
			: base (monthCalendar)
45
			: base (monthCalendar)
45
		{
46
		{
46
			this.monthCalendar = monthCalendar; 
47
			this.monthCalendar = monthCalendar;
48
			monthCalendar.UIAShowTodayChanged += OnUIAShowTodayChanged;
47
		}
49
		}
48
50
49
		static MonthCalendarProvider ()
51
		static MonthCalendarProvider ()
Lines 65-70 Link Here
65
					this));
67
					this));
66
		}
68
		}
67
69
70
		public override void Terminate ()
71
		{
72
			base.Terminate ();
73
			monthCalendar.UIAShowTodayChanged -= OnUIAShowTodayChanged;
74
		}
75
68
		public override void InitializeChildControlStructure ()
76
		public override void InitializeChildControlStructure ()
69
		{
77
		{
70
			base.InitializeChildControlStructure ();
78
			base.InitializeChildControlStructure ();
Lines 73-78 Link Here
73
			childDataGrid.Initialize ();
81
			childDataGrid.Initialize ();
74
			AddChildProvider (childDataGrid);
82
			AddChildProvider (childDataGrid);
75
			
83
			
84
			OnUIAShowTodayChanged (this, EventArgs.Empty);
85
			
76
			// Don't ask me why, but Calendar needs to implement
86
			// Don't ask me why, but Calendar needs to implement
77
			// Grid as well as the DataGrid child...
87
			// Grid as well as the DataGrid child...
78
			SetBehavior (GridPatternIdentifiers.Pattern,
88
			SetBehavior (GridPatternIdentifiers.Pattern,
Lines 103-112 Link Here
103
			get { return numDaysInWeek; }
113
			get { return numDaysInWeek; }
104
		}
114
		}
105
115
116
		private void OnUIAShowTodayChanged (object sender, EventArgs args)
117
		{
118
			if (monthCalendar.ShowToday && todayLink == null)
119
			{
120
				todayLink = new MonthCalendarTodayLinkProvider (this);
121
				todayLink.Initialize ();
122
				AddChildProvider (todayLink);
123
			}
124
			else if (!monthCalendar.ShowToday && todayLink != null)
125
			{
126
				RemoveChildProvider (true, todayLink);
127
				todayLink.Terminate ();
128
				todayLink = null;
129
			}
130
		}
131
106
		private MonthCalendarDataGridProvider childDataGrid;
132
		private MonthCalendarDataGridProvider childDataGrid;
133
		private MonthCalendarTodayLinkProvider todayLink;
107
		private MonthCalendar monthCalendar;
134
		private MonthCalendar monthCalendar;
108
135
109
		private static int numDaysInWeek = 0;
136
		private static int numDaysInWeek = 0;
110
		private static DateTime fixedDate = new DateTime (2001, 01, 01);
137
		private static DateTime fixedDate = new DateTime (2001, 01, 01);
111
	}
138
	}
139
	
140
	internal class MonthCalendarTodayLinkProvider : FragmentControlProvider
141
	{
142
		public MonthCalendarTodayLinkProvider (FragmentRootControlProvider rootProvider) : base (rootProvider.Control)
143
		{
144
			mc = rootProvider.Control as MonthCalendar;
145
		}
146
147
		public override void Initialize ()
148
		{
149
			base.Initialize ();
150
			SetBehavior (InvokePatternIdentifiers.Pattern, 
151
			             new TodayLinkInvokeProviderBehavior (this));
152
		}
153
154
		protected override object GetProviderPropertyValue (int propertyId)
155
		{
156
			if (propertyId == AutomationElementIdentifiers.ControlTypeProperty.Id)
157
				return ControlType.Button.Id;
158
			else if (propertyId == AutomationElementIdentifiers.LocalizedControlTypeProperty.Id)
159
				return Catalog.GetString ("button");
160
			else if (propertyId == AutomationElementIdentifiers.LabeledByProperty.Id)
161
				return null;
162
			else if (propertyId == AutomationElementIdentifiers.BoundingRectangleProperty.Id)
163
			{
164
#pragma warning disable 1690
165
				Rectangle today_rect = new Rectangle (mc.ClientRectangle.X,
166
					mc.ClientRectangle.Bottom - mc.date_cell_size.Height,
167
					7 * mc.date_cell_size.Width, mc.date_cell_size.Height);
168
#pragma warning restore 1690
169
				return Helper.GetControlScreenBounds (today_rect, mc, true);
170
			}
171
			else if (propertyId == AutomationElementIdentifiers.NameProperty.Id)
172
				//Copied from ThemeWin32Classic.DrawMonthCalendar in SWF
173
				return "Today: " + DateTime.Now.ToShortDateString();
174
			else
175
				return base.GetProviderPropertyValue (propertyId);
176
		}
177
178
		private MonthCalendar mc;
179
180
	}
112
}
181
}
(-)UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/MonthCalendar/TodayLinkInvokeProviderBehavior.cs (+81 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) 2009 Novell, Inc. (http://www.novell.com) 
21
// 
22
// Authors: 
23
//	Matt Guo <matt@mattguo.com>
24
// 
25
26
using System;
27
using System.Windows.Automation;
28
using SWF = System.Windows.Forms;
29
using Mono.UIAutomation.Winforms;
30
using Mono.UIAutomation.Winforms.Events;
31
using System.Windows.Automation.Provider;
32
33
namespace Mono.UIAutomation.Winforms.Behaviors.MonthCalendar
34
{
35
	internal class TodayLinkInvokeProviderBehavior
36
		: ProviderBehavior, IInvokeProvider
37
	{
38
#region Constructor
39
		
40
		public TodayLinkInvokeProviderBehavior (MonthCalendarTodayLinkProvider provider)
41
			: base (provider)
42
		{
43
		}
44
	
45
#endregion
46
		
47
#region IProviderBehavior Interface
48
49
		public override void Connect ()
50
		{
51
			// FIXME: Add events in SWF/MonthCalendar when the TodayLink is clicked, and then set the InvokePatternInvokedEvent
52
		}
53
		
54
		public override void Disconnect ()
55
		{
56
			Provider.SetEvent (ProviderEventType.InvokePatternInvokedEvent, 
57
			                   null);
58
		}
59
		
60
		public override AutomationPattern ProviderPattern { 
61
			get { return InvokePatternIdentifiers.Pattern; }
62
		}
63
64
#endregion
65
		
66
#region IInvokeProvider Members
67
		
68
		public void Invoke ()
69
		{
70
			if (!Provider.Control.Enabled)
71
				throw new ElementNotEnabledException ();
72
73
			SWF.MonthCalendar calendar
74
				= (SWF.MonthCalendar) Provider.Control;
75
76
			calendar.SetDate (DateTime.Today);
77
		}
78
		
79
#endregion
80
	}
81
}
(-)UIAutomationWinforms/Makefile.am (+1 lines)
Lines 146-151 Link Here
146
	Mono.UIAutomation.Winforms.Behaviors/MonthCalendar/ListItemValueProviderBehavior.cs \
146
	Mono.UIAutomation.Winforms.Behaviors/MonthCalendar/ListItemValueProviderBehavior.cs \
147
	Mono.UIAutomation.Winforms.Behaviors/MonthCalendar/SelectionProviderBehavior.cs \
147
	Mono.UIAutomation.Winforms.Behaviors/MonthCalendar/SelectionProviderBehavior.cs \
148
	Mono.UIAutomation.Winforms.Behaviors/MonthCalendar/TableProviderBehavior.cs \
148
	Mono.UIAutomation.Winforms.Behaviors/MonthCalendar/TableProviderBehavior.cs \
149
	Mono.UIAutomation.Winforms.Behaviors/MonthCalendar/TodayLinkInvokeProviderBehavior.cs \
149
	Mono.UIAutomation.Winforms.Behaviors/NumericUpDown/EditableRangeProviderBehavior.cs \
150
	Mono.UIAutomation.Winforms.Behaviors/NumericUpDown/EditableRangeProviderBehavior.cs \
150
	Mono.UIAutomation.Winforms.Behaviors/NumericUpDown/RangeValueProviderBehavior.cs \
151
	Mono.UIAutomation.Winforms.Behaviors/NumericUpDown/RangeValueProviderBehavior.cs \
151
	Mono.UIAutomation.Winforms.Behaviors/PictureBox/EmbeddedImageProviderBehavior.cs \
152
	Mono.UIAutomation.Winforms.Behaviors/PictureBox/EmbeddedImageProviderBehavior.cs \

Return to bug 516719