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

(-)UiaAtkBridge/UiaAtkBridge/TreeItem.cs (+41 lines)
Lines 27-32 Link Here
27
using System.Windows.Automation;
27
using System.Windows.Automation;
28
using Mono.UIAutomation.Services;
28
using Mono.UIAutomation.Services;
29
using System.Windows.Automation.Provider;
29
using System.Windows.Automation.Provider;
30
using SCG = System.Collections.Generic;
30
31
31
namespace UiaAtkBridge
32
namespace UiaAtkBridge
32
{
33
{
Lines 429-435 Link Here
429
				throw new NotSupportedException ("Unknown toggleState " + state.ToString ());
430
				throw new NotSupportedException ("Unknown toggleState " + state.ToString ());
430
			}
431
			}
431
		}
432
		}
433
		
434
		protected override Atk.RelationSet OnRefRelationSet ()
435
		{
436
			Atk.RelationSet relSet = base.OnRefRelationSet ();
437
			if (relSet == null)
438
				relSet = new Atk.RelationSet ();
439
			
440
			SCG.List<Atk.Relation> relsToRemove = new SCG.List<Atk.Relation> ();
441
			for (int i = 0; i < relSet.NRelations; i++) {
442
				Atk.Relation rel = relSet.GetRelation (i);
443
				if (relSet.GetRelation (i).RelationType == Atk.RelationType.NodeChildOf)
444
					relsToRemove.Add (rel);
445
			}
446
			foreach (Atk.Relation relation in relsToRemove)
447
				relSet.Remove (relation);
448
			
449
			if (VirtualParent != null) {
450
				Atk.Object[] parents = new Atk.Object [1];
451
				parents [0] = VirtualParent;
452
				var rel = new Atk.Relation (parents, 
453
				                            Atk.RelationType.NodeChildOf);
454
				relSet.Add (rel);
455
			}
456
			return relSet;
457
		}
432
458
459
		internal override Adapter VirtualParent {
460
			get {
461
				//FIXME: this should be the real implementation of VirtualParent in the Adapter class, and later each class should
462
				//override the special cases, not the other way around (so the AutomationBridge.GetParentAdapter method gets OOP)
463
				IRawElementProviderFragment frag = Provider as IRawElementProviderFragment;
464
				if (frag == null)
465
					return null;
466
				frag = frag.Navigate (NavigateDirection.Parent);
467
				if (frag != null)
468
					return AutomationBridge.GetAdapterForProviderSemiLazy (frag);
469
				return null;
470
			}
471
		}
472
473
433
		#region Atk.ImageImplementor implementation 
474
		#region Atk.ImageImplementor implementation 
434
		
475
		
435
		public void GetImagePosition (out int x, out int y, Atk.CoordType coordType)
476
		public void GetImagePosition (out int x, out int y, Atk.CoordType coordType)
(-)UiaAtkBridge/UiaAtkBridge/Adapter.cs (-1 / +1 lines)
Lines 329-335 Link Here
329
			}
329
			}
330
		}
330
		}
331
331
332
		internal Adapter VirtualParent {
332
		internal virtual Adapter VirtualParent {
333
			get { return (Provider == null) ? null : AutomationBridge.GetParentAdapter (Provider); }
333
			get { return (Provider == null) ? null : AutomationBridge.GetParentAdapter (Provider); }
334
		}
334
		}
335
		
335
		
336
336

Return to bug 534100