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 (+50 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 72-77 Link Here
72
			childDataGrid = new MonthCalendarDataGridProvider (this);
73
			childDataGrid = new MonthCalendarDataGridProvider (this);
73
			childDataGrid.Initialize ();
74
			childDataGrid.Initialize ();
74
			AddChildProvider (childDataGrid);
75
			AddChildProvider (childDataGrid);
76
			if (monthCalendar.ShowToday)
77
			{
78
				todayLink = new MonthCalendarTodayLinkProvider (this);
79
				todayLink.Initialize();
80
				AddChildProvider (todayLink);
81
			}
75
			
82
			
76
			// Don't ask me why, but Calendar needs to implement
83
			// Don't ask me why, but Calendar needs to implement
77
			// Grid as well as the DataGrid child...
84
			// Grid as well as the DataGrid child...
Lines 104-112 Link Here
104
		}
111
		}
105
112
106
		private MonthCalendarDataGridProvider childDataGrid;
113
		private MonthCalendarDataGridProvider childDataGrid;
114
		private MonthCalendarTodayLinkProvider todayLink;
107
		private MonthCalendar monthCalendar;
115
		private MonthCalendar monthCalendar;
108
116
109
		private static int numDaysInWeek = 0;
117
		private static int numDaysInWeek = 0;
110
		private static DateTime fixedDate = new DateTime (2001, 01, 01);
118
		private static DateTime fixedDate = new DateTime (2001, 01, 01);
111
	}
119
	}
120
	
121
	internal class MonthCalendarTodayLinkProvider : FragmentControlProvider
122
	{
123
		public MonthCalendarTodayLinkProvider (FragmentRootControlProvider rootProvider) : base (rootProvider.Control)
124
		{
125
			mc = rootProvider.Control as MonthCalendar;
126
		}
127
128
		public override void Initialize ()
129
		{
130
			base.Initialize ();
131
			SetBehavior (InvokePatternIdentifiers.Pattern, 
132
			             new TodayLinkInvokeProviderBehavior (this));
133
		}
134
135
		protected override object GetProviderPropertyValue (int propertyId)
136
		{
137
			if (propertyId == AutomationElementIdentifiers.ControlTypeProperty.Id)
138
				return ControlType.Button.Id;
139
			else if (propertyId == AutomationElementIdentifiers.LocalizedControlTypeProperty.Id)
140
				return Catalog.GetString ("button");
141
			else if (propertyId == AutomationElementIdentifiers.LabeledByProperty.Id)
142
				return null;
143
			else if (propertyId == AutomationElementIdentifiers.BoundingRectangleProperty.Id)
144
			{
145
#pragma warning disable 1690
146
				Rectangle today_rect = new Rectangle (mc.ClientRectangle.X,
147
					mc.ClientRectangle.Bottom - mc.date_cell_size.Height,
148
					7 * mc.date_cell_size.Width, mc.date_cell_size.Height);
149
#pragma warning restore 1690
150
				return Helper.GetControlScreenBounds (today_rect, mc true);
151
			}
152
			else if (propertyId == AutomationElementIdentifiers.NameProperty.Id)
153
				//Copied from ThemeWin32Classic.DrawMonthCalendar in SWF
154
				return "Today: " + DateTime.Now.ToShortDateString();
155
			else
156
				return base.GetProviderPropertyValue (propertyId);
157
		}
158
159
		private MonthCalendar mc;
160
161
	}
112
}
162
}
(-)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