Example #1
0
        protected override Atk.RelationSet OnRefRelationSet()
        {
            Atk.RelationSet relSet = base.OnRefRelationSet();
            if (relSet == null)
            {
                relSet = new Atk.RelationSet();
            }

            List <Atk.Relation> relsToRemove = new List <Atk.Relation> ();

            for (int i = 0; i < relSet.NRelations; i++)
            {
                Atk.Relation rel = relSet.GetRelation(i);
                if (relSet.GetRelation(i).RelationType == Atk.RelationType.MemberOf)
                {
                    relsToRemove.Add(rel);
                }
            }
            foreach (Atk.Relation relation in relsToRemove)
            {
                relSet.Remove(relation);
            }

            if (Parent != null)
            {
                var rel = new Atk.Relation(((ComponentParentAdapter)Parent).RadioButtons.ToArray(),
                                           Atk.RelationType.MemberOf);
                relSet.Add(rel);
            }
            return(relSet);
        }
Example #2
0
        public Atk.Relation GetRelationByType(Atk.RelationType relationship)
        {
            IntPtr raw_ret = atk_relation_set_get_relation_by_type(Handle, (int)relationship);

            Atk.Relation ret = GLib.Object.GetObject(raw_ret) as Atk.Relation;
            return(ret);
        }
Example #3
0
        public Atk.Relation GetRelation(int i)
        {
            IntPtr raw_ret = atk_relation_set_get_relation(Handle, i);

            Atk.Relation ret = GLib.Object.GetObject(raw_ret) as Atk.Relation;
            return(ret);
        }
Example #4
0
		protected override Atk.RelationSet OnRefRelationSet ()
		{
			Atk.RelationSet relSet = base.OnRefRelationSet ();
			if (relSet == null)
				relSet = new Atk.RelationSet ();
			
			List<Atk.Relation> relsToRemove = new List<Atk.Relation> ();
			for (int i = 0; i < relSet.NRelations; i++) {
				Atk.Relation rel = relSet.GetRelation (i);
				if (relSet.GetRelation (i).RelationType == Atk.RelationType.MemberOf)
					relsToRemove.Add (rel);
			}
			foreach (Atk.Relation relation in relsToRemove)
				relSet.Remove (relation);
			
			if (Parent != null) {
				var rel = new Atk.Relation (((ComponentParentAdapter)Parent).RadioButtons.ToArray (), 
				                            Atk.RelationType.MemberOf);
				relSet.Add (rel);
			}
			return relSet;
		}
Example #5
0
        protected override Atk.RelationSet OnRefRelationSet()
        {
            Atk.RelationSet relationSet = base.OnRefRelationSet();

            if (defunct)
            {
                return(relationSet);
            }

            if (Role == Atk.Role.ScrollBar ||
                Role == Atk.Role.RadioButton)
            {
                return(relationSet);
            }

            Adapter parentAdapter = VirtualParent;

            if (parentAdapter != null)
            {
                // To support NodeChildOf parent must be either
                // - DataGrid, Table or Group, or
                // - ListItem or DataItem, in this case the parent of parent is used,
                //   because we are ignoring this parent (either ListItem or DataItem).
                int controlType
                    = (int)parentAdapter.Provider.GetPropertyValue(AutomationElementIdentifiers.ControlTypeProperty.Id);
                if (controlType == ControlType.ListItem.Id ||
                    controlType == ControlType.DataItem.Id)
                {
                    parentAdapter = parentAdapter.VirtualParent;
                }
                else if (controlType != ControlType.DataGrid.Id &&
                         controlType != ControlType.Table.Id &&
                         controlType != ControlType.Group.Id &&
                         controlType != ControlType.Tree.Id &&
                         controlType != ControlType.TreeItem.Id)
                {
                    return(relationSet);
                }

                if (parentAdapter != null)
                {
                    bool already_found = false;

                    if (relationSet == null)
                    {
                        relationSet = new Atk.RelationSet();
                    }

                    for (int i = 0; i < relationSet.NRelations; i++)
                    {
                        Atk.Relation rel = relationSet.GetRelation(i);
                        if (rel.RelationType == Atk.RelationType.NodeChildOf &&
                            rel.Target.Length == 1 &&
                            rel.Target [0] == parentAdapter)
                        {
                            already_found = true;
                        }
                    }

                    if (!already_found)
                    {
                        relationSet.AddRelationByType(Atk.RelationType.NodeChildOf, parentAdapter);
                    }
                }
            }

            return(relationSet);
        }
Example #6
0
 public void Add(Atk.Relation relation)
 {
     atk_relation_set_add(Handle, relation == null ? IntPtr.Zero : relation.Handle);
 }
Example #7
0
 public void Remove(Atk.Relation relation)
 {
     atk_relation_set_remove(Handle, relation == null ? IntPtr.Zero : relation.Handle);
 }