Inheritance: Atk.Object, Atk.ComponentImplementor
Example #1
0
		public BaseActionImplementor (Adapter adapter, AutomationPeer peer)
			: base (adapter, peer)
		{
			// TODO: also do this in response to patterns being
			// added/removed
			RefreshActions ();
		}
		public ExpandCollapseInvokeToggle (Adapter adapter, AutomationPeer peer)
			: base (adapter, peer)
		{
			adapter.AutomationPropertyChanged
				+= new EventHandler<AutomationPropertyChangedEventArgs> (
					OnAutomationPropertyChanged);
		}
Example #3
0
		public GridTable (Adapter adapter, AutomationPeer peer) : base (adapter, peer)
		{
			this.peer = peer;

			this.tableProvider = (ITableProvider) peer.GetPattern (
				PatternInterface.Table);
		}
Example #4
0
		public Calendar (Adapter adapter, AutomationPeer peer)
			: base (adapter, peer)
		{
			FrameworkElementAutomationPeer feap = peer as FrameworkElementAutomationPeer;
			if (feap == null)
				return;

			// XXX: We can't link to System.Windows.Controls, so
			// we'll use reflection instead.

			UIElement calendar = feap.Owner;

			Type t = calendar.GetType ();
			if (t.Namespace != "System.Windows.Controls" || t.Name != "Calendar")
				return;

			// XXX SUCH A HACK! XXX
			// Workaround a bug in CalendarAutomationPeer.
			// Even though its selection and NameProperty
			// change, it does not send the proper change
			// notifications via the peer.  So we fake them.
			EventInfo ei = t.GetEvent ("SelectedDatesChanged");
			ei.AddEventHandler (calendar,
			                    new EventHandler<SelectionChangedEventArgs> (OnSelectedDatesChanged));
		}
Example #5
0
		public RadioButton (Adapter adapter, AutomationPeer peer)
			: base (adapter, peer)
		{
			adapter.AutomationPropertyChanged
				+= new EventHandler<AutomationPropertyChangedEventArgs> (
					OnAutomationPropertyChanged);
		}
Example #6
0
		public Selection (Adapter adapter, AutomationPeer peer) : base (adapter, peer)
		{
			this.selectionProvider = (ISelectionProvider) peer.GetPattern (
				PatternInterface.Selection);

			adapter.AutomationPropertyChanged += (o, args) => {
				if (args.Property == SelectionPatternIdentifiers.SelectionProperty)
					adapter.EmitSignal ("selection_changed");
			};
		}
Example #7
0
		public RangeValue (Adapter adapter, AutomationPeer peer)
			: base (adapter, peer)
		{
			this.rangeValueProvider = (IRangeValueProvider) peer.GetPattern (
				PatternInterface.RangeValue);

			adapter.AutomationPropertyChanged
				+= new EventHandler<AutomationPropertyChangedEventArgs> (
					OnAutomationPropertyChanged);
		}
Example #8
0
		public SelectionItem (Adapter adapter, AutomationPeer peer) : base (adapter, peer)
		{
			bool? isSelected = IsSelected;
			if (isSelected.HasValue)
				WasSelected = isSelected.Value;

			adapter.AutomationPropertyChanged
				+= new EventHandler<AutomationPropertyChangedEventArgs> (
				OnAutomationPropertyChanged);

			adapter.AutomationEventRaised
				+= new EventHandler<AutomationEventEventArgs> (
				OnAutomationEventRaised);
		}
Example #9
0
		public BasePatternImplementor (Adapter adapter, AutomationPeer peer)
		{
			this.adapter = adapter;
			this.peer = peer;
		}
Example #10
0
		public TabItem (Adapter adapter, AutomationPeer peer) : base (adapter, peer)
		{
			adapter.AutomationPropertyChanged += (o, args) => {
				if (args.Property == SelectionItemPatternIdentifiers.IsSelectedProperty) {
					isSelectedChanged = true;
					newValue = (bool) args.NewValue;
				}
			};

			// XXX: Warning! Hack alert!
			//
			// TabItem's children are avaliable *only* when the TabItem is selected,
			// (its IsSelectedProperty is true). We are updating children here instead for
			// two reasons:
			//
			// 1. We can't modify the sources in System.Windows.Controls.dll because this
			//    dll is bundled in the packaged XAP, VS does this automatically. If we
			//    fix the sources in SWC.dll all applications built using VS *will fail*
			//    anyway.
			// 2. We are using both the AutomationPropertyEvent (IsSelected) and the event
			//    LayoutUpdated because the TabControl has *one* SelectedContent area, and
			//    this area is updated *after* raising the event. If we only use
			//    IsSelectedPropertyEvent we will always get the previous/unselected
			//    TabItem's children instead of the current/selected's.
			//
			FrameworkElement tabItem
				= ((FrameworkElementAutomationPeer) peer).Owner as FrameworkElement;
			if (tabItem != null) {
				tabItem.LayoutUpdated += (o, e) => {
					if (isSelectedChanged) {
						Adapter parentTabControl = ParentTabControl;

						// We don't have a parent let's update our children anyway.
						if (parentTabControl == null)
							adapter.HandleStructureChanged ();
						// We have a parent, let's update our children "the right way",
						// first the unselected TabItem then the selected TabItem.
						else {
							Adapter cachedTabItem = null;
							if (CachedTabItems.TryGetValue (parentTabControl,
							    out cachedTabItem)) {
								if (newValue) {
									cachedTabItem.HandleStructureChanged ();
									cachedTabItem.NotifyStateChange (Atk.StateType.Selected);

									adapter.HandleStructureChanged ();
									adapter.NotifyStateChange (Atk.StateType.Selected);
								} else {
									adapter.HandleStructureChanged ();
									adapter.NotifyStateChange (Atk.StateType.Selected);

									cachedTabItem.HandleStructureChanged ();
									cachedTabItem.NotifyStateChange (Atk.StateType.Selected);
								}
								CachedTabItems.Remove (parentTabControl);
							} else
								CachedTabItems.Add (parentTabControl, adapter);
						}
						isSelectedChanged = false;
						newValue = false;
					}
				};
			}
		}
Example #11
0
		internal int GetIndexOfChild (Adapter child)
		{
			CacheChildren ();

			if (children == null || child == null)
				return -1;

			// Intentionally use Children list instead of
			// Peer.GetChildren () as we're concerned with what is
			// currently displayed to the user
			lock (ChildrenLock) {
				return children.IndexOf (child.Peer);
			}
		}