Inheritance: FragmentRootControlProvider, ISelectableItem
Beispiel #1
0
 public void UnselectItem(ListItemProvider item)
 {
     if (items.Contains(item))
     {
         datagrid.UnSelect(item.Index);
     }
 }
Beispiel #2
0
        public override object GetItemPropertyValue(ListItemProvider item, int propertyId)
        {
            PropertyGridListItemProvider pgListItem
                = item as PropertyGridListItemProvider;

            if (pgListItem == null)
            {
                return(null);
            }

            if (propertyId == AEIds.NameProperty.Id)
            {
                return(pgListItem.Name);
            }
            else if (propertyId == AEIds.HasKeyboardFocusProperty.Id)
            {
                return(false);
            }
            else if (propertyId == AEIds.IsKeyboardFocusableProperty.Id)
            {
                return(true);
            }
            else
            {
                return(null);
            }
        }
Beispiel #3
0
 public override void UnselectItem(ListItemProvider item)
 {
     if (ContainsItem(item) == true)
     {
         comboboxControl.SelectedIndex = -1;
     }
 }
Beispiel #4
0
 public IProviderBehavior GetListItemBehaviorRealization(AutomationPattern behavior,
                                                         ListItemProvider listItem)
 {
     if (behavior == SelectionItemPatternIdentifiers.Pattern)
     {
         return(new DataItemSelectionItemProviderBehavior(listItem));
     }
     else if (behavior == GridItemPatternIdentifiers.Pattern)
     {
         return(new DataItemGridItemProviderBehavior(listItem));
     }
     else if (behavior == ScrollItemPatternIdentifiers.Pattern)
     {
         return(new DataItemScrollItemProviderBehavior(listItem));
     }
     else if (behavior == ValuePatternIdentifiers.Pattern)
     {
         return(new DataItemValueProviderBehavior(listItem));
     }
     else if (behavior == TableItemPatternIdentifiers.Pattern)
     {
         return(new DataItemTableItemProviderBehavior(listItem));
     }
     else
     {
         return(null);
     }
 }
Beispiel #5
0
 public override void ScrollItemIntoView(ListItemProvider item)
 {
     if (ContainsItem(item) == true)
     {
         listboxControl.TopIndex = item.Index;
     }
 }
Beispiel #6
0
            public void SelectItem(ListItemProvider prov)
            {
                if (dateTimePicker.ShowCheckBox && !dateTimePicker.Checked)
                {
                    return;
                }

                DateTime cur  = dateTimePicker.Value;
                Calendar cal  = Thread.CurrentThread.CurrentCulture.Calendar;
                DateTime date = (DateTime)prov.ObjectItem;

                switch (part_data.date_time_part)
                {
                case DateTimePicker.DateTimePart.Month:
                    cur = cur.AddMonths(date.Month - cur.Month);
                    break;

                case DateTimePicker.DateTimePart.DayName:
                    cur = cur.AddDays(cal.GetDayOfWeek(date)
                                      - cal.GetDayOfWeek(dateTimePicker.Value));
                    break;

                case DateTimePicker.DateTimePart.AMPMSpecifier:
                    if (date == amDate && IsTimePM(cur))
                    {
                        cur = cur.AddHours(-12);
                    }
                    else if (date == pmDate && !IsTimePM(cur))
                    {
                        cur = cur.AddHours(12);
                    }
                    break;
                }
                dateTimePicker.Value = cur;
            }
Beispiel #7
0
		public override IProviderBehavior GetListItemBehaviorRealization (AutomationPattern behavior,
		                                                                  ListItemProvider listItem)
		{
			if (behavior == TogglePatternIdentifiers.Pattern)
				return new ListItemToggleProviderBehavior (listItem);	
			else
				return base.GetListItemBehaviorRealization (behavior, listItem);
		}
Beispiel #8
0
		public override void ToggleItem (ListItemProvider item)
		{
			if (ContainsItem (item) == true) {
				SWF.CheckedListBox checkedListBox = (SWF.CheckedListBox) Control;
				bool chcked = checkedListBox.GetItemChecked (item.Index);
				checkedListBox.SetItemChecked (item.Index, !chcked);
			}
		}
		public override void SelectItem (ListItemProvider item)
		{
			GridItem gridItem = item.ObjectItem as GridItem;
			if (gridItem == null)
				return;
			
			propertyGrid.SelectedGridItem = gridItem;
		}
Beispiel #10
0
 private void OnDropDown(object sender, EventArgs args)
 {
     foreach (object objectItem in comboboxControl.Items)
     {
         ListItemProvider item = GetItemProviderFrom(this, objectItem);
         AddChildProvider(item);
     }
     InitializeScrollBehaviorObserver();
 }
Beispiel #11
0
 public override void ToggleItem(ListItemProvider item)
 {
     if (ContainsItem(item) == true)
     {
         SWF.CheckedListBox checkedListBox = (SWF.CheckedListBox)Control;
         bool chcked = checkedListBox.GetItemChecked(item.Index);
         checkedListBox.SetItemChecked(item.Index, !chcked);
     }
 }
Beispiel #12
0
        public bool IsItemSelected(ListItemProvider item)
        {
            if (!items.Contains(item))
            {
                return(false);
            }

            return(datagrid.IsSelected(item.Index));
        }
Beispiel #13
0
 public IConnectable GetListItemEventRealization(ProviderEventType eventType,
                                                 ListItemProvider prov)
 {
     if (eventType == ProviderEventType.AutomationElementHasKeyboardFocusProperty)
     {
         return(new PartListItemAutomationHasKeyboardFocusPropertyEvent(
                    prov, this));
     }
     return(null);
 }
Beispiel #14
0
 public void ToggleItem(ListItemProvider item)
 {
     if (items.Contains(item))
     {
         try {
             bool value = (bool)datagrid [item.Index, 0];
             datagrid [item.Index, 0] = !value;
         } catch (InvalidCastException) {}
     }
 }
Beispiel #15
0
        public override void SelectItem(ListItemProvider item)
        {
            GridItem gridItem = item.ObjectItem as GridItem;

            if (gridItem == null)
            {
                return;
            }

            propertyGrid.SelectedGridItem = gridItem;
        }
		public PartListItemAutomationHasKeyboardFocusPropertyEvent (
			ListItemProvider provider,
			DateTimePickerProvider.DateTimePickerListPartProvider listProvider)
			: base (provider, 
			        AutomationElementIdentifiers.HasKeyboardFocusProperty)
		{
			this.listProvider = listProvider;
			this.listItemProvider = provider;
			
			isSelected = listProvider.IsItemSelected (listItemProvider);
		}
		public PartListItemSelectionItemPatternElementSelectedEvent (
			ListItemProvider provider,
			DateTimePickerProvider.DateTimePickerListPartProvider listProvider)
			: base (provider, 
			        SelectionItemPatternIdentifiers.ElementSelectedEvent)
		{
			this.listProvider = listProvider;
			this.listItemProvider = provider;
			
			isSelected = listProvider.IsItemSelected (listItemProvider);
		}
Beispiel #18
0
        public bool IsItemSelected(ListItemProvider prov)
        {
            int index = control.Items.IndexOf(prov.ObjectItem);

            if (index < 0)
            {
                return(false);
            }

            return(index == control.SelectedIndex);
        }
Beispiel #19
0
        public ListItemProvider RemoveItemFrom(object objectItem)
        {
            ListItemProvider item = null;

            if (items.TryGetValue(objectItem, out item) == true)
            {
                items.Remove(objectItem);
                item.Terminate();
            }

            return(item);
        }
Beispiel #20
0
            public override void InitializeChildControlStructure()
            {
                base.InitializeChildControlStructure();

                comboboxControl.Items.UIACollectionChanged += OnCollectionChanged;

                foreach (object objectItem in comboboxControl.Items)
                {
                    ListItemProvider item = GetItemProviderFrom(this, objectItem);
                    AddChildProvider(item);
                }
            }
Beispiel #21
0
 public override IProviderBehavior GetListItemBehaviorRealization(AutomationPattern behavior,
                                                                  ListItemProvider listItem)
 {
     if (behavior == SelectionItemPatternIdentifiers.Pattern)
     {
         return(new ListItemSelectionItemProviderBehavior(listItem));
     }
     else
     {
         return(base.GetListItemBehaviorRealization(behavior, listItem));
     }
 }
Beispiel #22
0
 public IProviderBehavior GetListItemBehaviorRealization(AutomationPattern pattern,
                                                         ListItemProvider prov)
 {
     if (pattern == SelectionItemPatternIdentifiers.Pattern)
     {
         return(new ListItemSelectionItemProviderBehavior(prov));
     }
     else if (pattern == ValuePatternIdentifiers.Pattern)
     {
         return(new ListItemValueProviderBehavior(prov));
     }
     return(null);
 }
Beispiel #23
0
 public override IConnectable GetListItemEventRealization(ProviderEventType eventType,
                                                          ListItemProvider prov)
 {
     if (eventType == ProviderEventType.AutomationElementIsOffscreenProperty)
     {
         return(new ListItemAutomationIsOffscreenPropertyEvent(prov));
     }
     else
     {
         return(base.GetListItemEventRealization(eventType, prov));
     }
     //FIXME: Return AutomationIsKeyboardFocusablePropertyEvent
 }
		public ListItemGridItemProviderBehavior (ListItemProvider itemProvider)
			: base (itemProvider)
		{
			this.itemProvider = itemProvider;
			viewProvider = (ListViewProvider) itemProvider.ListProvider;
			view = (SWF.ListView) viewProvider.Control;

			//We need to keep a reference to Group because when removed the 
			//group is set to null and we need to update the values.
			group = ((SWF.ListViewItem) itemProvider.ObjectItem).Group;
			if (group == null)
				group = viewProvider.GetDefaultGroup ();
		}
Beispiel #25
0
        public override object GetItemPropertyValue(ListItemProvider item,
                                                    int propertyId)
        {
            if (propertyId == AutomationElementIdentifiers.NameProperty.Id)
            {
                return(listboxControl.GetItemText(item.ObjectItem));
            }

            if (ContainsItem(item) == false)
            {
                return(null);
            }

            if (propertyId == AutomationElementIdentifiers.HasKeyboardFocusProperty.Id)
            {
                return(listboxControl.Focused && item.Index == listboxControl.FocusedItem);
            }
            else if (propertyId == AutomationElementIdentifiers.BoundingRectangleProperty.Id)
            {
                System.Drawing.Rectangle itemRec   = System.Drawing.Rectangle.Empty;
                System.Drawing.Rectangle rectangle = listboxControl.Bounds;

                itemRec    = listboxControl.GetItemRectangle(item.Index);
                itemRec.X += rectangle.X;
                itemRec.Y += rectangle.Y;

                if (listboxControl.FindForm() == listboxControl.Parent)
                {
                    itemRec = listboxControl.TopLevelControl.RectangleToScreen(itemRec);
                }
                else
                {
                    itemRec = listboxControl.Parent.RectangleToScreen(itemRec);
                }

                return(Helper.RectangleToRect(itemRec));
            }
            else if (propertyId == AutomationElementIdentifiers.IsOffscreenProperty.Id)
            {
                return(Helper.IsListItemOffScreen((Rect)item.GetPropertyValue(AutomationElementIdentifiers.BoundingRectangleProperty.Id),
                                                  listboxControl,
                                                  false,
                                                  System.Drawing.Rectangle.Empty,
                                                  ScrollBehaviorObserver));
            }
            else
            {
                return(null);
            }
        }
Beispiel #26
0
 public object GetItemPropertyValue(ListItemProvider prov, int propertyId)
 {
     if (propertyId == AEIds.NameProperty.Id)
     {
         return((string)prov.ObjectItem);
     }
     else if (propertyId == AEIds.HasKeyboardFocusProperty.Id)
     {
         return(IsItemSelected(prov) && (string)prov.ObjectItem == Control.Text);
     }
     else if (propertyId == AEIds.BoundingRectangleProperty.Id)
     {
         return(GetProviderPropertyValue(AEIds.BoundingRectangleProperty.Id));
     }
     return(null);
 }
Beispiel #27
0
        public override IRawElementProviderSimple[] GetSelectedItems()
        {
            ListItemProvider [] items;

            if (listboxControl == null || listboxControl.SelectedIndices.Count == 0)
            {
                return(new ListItemProvider [0]);
            }

            items = new ListItemProvider [listboxControl.SelectedIndices.Count];
            for (int index = 0; index < items.Length; index++)
            {
                items [index] = GetItemProviderFrom(this, listboxControl.Items [listboxControl.SelectedIndices [index]]);
            }

            return(items);
        }
Beispiel #28
0
		public override ToggleState GetItemToggleState (ListItemProvider item)
		{
			if (ContainsItem (item) == true) {
				SWF.CheckedListBox checkedListBox = (SWF.CheckedListBox) Control;	
				
				SWF.CheckState state = checkedListBox.GetItemCheckState (item.Index);
				switch (state) {
					case SWF.CheckState.Checked:
						return ToggleState.On;
					case SWF.CheckState.Unchecked:
						return ToggleState.Off;
					default:
						return ToggleState.Indeterminate;
				}
			} else
				return ToggleState.Indeterminate;
		}
Beispiel #29
0
            public IProviderBehavior GetListItemBehaviorRealization(AutomationPattern pattern,
                                                                    ListItemProvider prov)
            {
                DateTimePickerListPartItemProvider itemProvider
                    = (DateTimePickerListPartItemProvider)prov;

                if (pattern == SelectionItemPatternIdentifiers.Pattern)
                {
                    return(new PartListItemSelectionItemProviderBehavior(
                               itemProvider));
                }
                else if (pattern == ValuePatternIdentifiers.Pattern)
                {
                    return(new PartListItemValueProviderBehavior(itemProvider));
                }
                return(null);
            }
Beispiel #30
0
 protected virtual void OnCollectionChanged(object sender, CollectionChangeEventArgs args)
 {
     if (args.Action == CollectionChangeAction.Add)
     {
         ListItemProvider item = GetItemProviderFrom(this, args.Element);
         AddChildProvider(item);
     }
     else if (args.Action == CollectionChangeAction.Remove)
     {
         ListItemProvider item = RemoveItemFrom(args.Element);
         RemoveChildProvider(item);
     }
     else if (args.Action == CollectionChangeAction.Refresh)
     {
         ClearItemsList();
         OnNavigationChildrenCleared();
     }
 }
Beispiel #31
0
            public object GetItemPropertyValue(ListItemProvider prov, int propertyId)
            {
                DateTimePickerListPartItemProvider itemProv
                    = (DateTimePickerListPartItemProvider)prov;

                if (propertyId == AEIds.NameProperty.Id)
                {
                    return(itemProv.Text);
                }
                else if (propertyId == AEIds.HasKeyboardFocusProperty.Id)
                {
                    return((bool)rootProvider.GetPropertyValue(AEIds.HasKeyboardFocusProperty.Id) &&
                           IsItemSelected(prov));
                }
                else if (propertyId == AEIds.BoundingRectangleProperty.Id)
                {
                    return(GetProviderPropertyValue(AEIds.BoundingRectangleProperty.Id));
                }
                return(null);
            }
Beispiel #32
0
 public IConnectable GetListItemEventRealization(ProviderEventType eventType,
                                                 ListItemProvider provider)
 {
     if (eventType == ProviderEventType.AutomationElementHasKeyboardFocusProperty)
     {
         return(new DataItemAutomationHasKeyboardFocusPropertyEvent(provider));
     }
     else if (eventType == ProviderEventType.AutomationFocusChangedEvent)
     {
         return(new DataItemAutomationFocusChangedEvent(provider));
     }
     else if (eventType == ProviderEventType.AutomationElementIsOffscreenProperty)
     {
         return(new DataItemAutomationIsOffscreenPropertyEvent(provider));
     }
     else
     {
         return(null);
     }
 }
Beispiel #33
0
            public bool IsItemSelected(ListItemProvider prov)
            {
                Calendar cal  = Thread.CurrentThread.CurrentCulture.Calendar;
                DateTime cur  = dateTimePicker.Value;
                DateTime date = (DateTime)prov.ObjectItem;

                switch (part_data.date_time_part)
                {
                case DateTimePicker.DateTimePart.Month:
                    return(date.Month == cur.Month);

                case DateTimePicker.DateTimePart.DayName:
                    return(cal.GetDayOfWeek(date)
                           == cal.GetDayOfWeek(cur));

                case DateTimePicker.DateTimePart.AMPMSpecifier:
                    return((date == amDate && !IsTimePM(cur)) ||
                           (date == pmDate && IsTimePM(cur)));
                }
                return(false);
            }
Beispiel #34
0
 public virtual IProviderBehavior GetListItemBehaviorRealization(AutomationPattern behavior,
                                                                 ListItemProvider listItem)
 {
     //According to: http://msdn.microsoft.com/en-us/library/ms744765.aspx
     if (behavior == ScrollItemPatternIdentifiers.Pattern)
     {
         //LAMESPEC: Supported only if the list item is contained within a container that is scrollable.
         if (IsBehaviorEnabled(ScrollPatternIdentifiers.Pattern) == true)
         {
             return(new ScrollItemProviderBehavior(listItem));
         }
         else
         {
             return(null);
         }
     }
     else
     {
         return(null);
     }
 }
Beispiel #35
0
 public ToggleState GetItemToggleState(ListItemProvider item)
 {
     if (items.Contains(item))
     {
         try {
             if ((bool)datagrid [item.Index, 0])
             {
                 return(ToggleState.On);
             }
             else
             {
                 return(ToggleState.Off);
             }
         } catch (InvalidCastException) {
             return(ToggleState.Indeterminate);
         }
     }
     else
     {
         return(ToggleState.Indeterminate);
     }
 }
Beispiel #36
0
        public virtual ListItemProvider GetItemProviderFrom(FragmentRootControlProvider rootProvider,
                                                            object objectItem,
                                                            bool create)
        {
            ListItemProvider item = null;

            if (items.TryGetValue(objectItem, out item) == false)
            {
                if (!create)
                {
                    return(null);
                }
                item = GetNewItemProvider(rootProvider,
                                          this,
                                          Control,
                                          objectItem);
                items [objectItem] = item;
                item.Initialize();
            }

            return(item);
        }
Beispiel #37
0
        private void OnUIACollectionChanged(object sender, CollectionChangeEventArgs args)
        {
            if (lastCurrencyManager == null || args.Action == CollectionChangeAction.Refresh)
            {
                return;
            }

            // FIXME: Remove CurrentTableStyle property after committing SWF patch
            SWF.DataGridTableStyle tableStyle = CurrentTableStyle;
            CreateHeader(tableStyle);

            if (args.Action == CollectionChangeAction.Add)
            {
                if (tableStyle.GridColumnStyles.Count == 0)
                {
                    return;
                }

                for (int index = items.Count; index < lastCurrencyManager.Count; index++)
                {
                    CreateListItem(index, tableStyle);
                }
            }
            else if (args.Action == CollectionChangeAction.Remove)
            {
                // TODO: Is there a better way to do this?
                int toRemove = items.Count - lastCurrencyManager.Count;
                while (toRemove > 0)
                {
                    ListItemProvider item = items [items.Count - 1];
                    RemoveChildProvider(item);
                    item.Terminate();
                    items.Remove(item);
                    toRemove--;
                }
            }
        }
Beispiel #38
0
		public ToggleState GetItemToggleState (ListItemProvider prov)
		{
			throw new NotSupportedException ();
		}
Beispiel #39
0
		protected bool ContainsItem (ListItemProvider item)
		{
			return item == null ? false : items.ContainsKey (item.ObjectItem);
		}
Beispiel #40
0
		public virtual void ToggleItem (ListItemProvider item)
		{
		}
Beispiel #41
0
		public void ScrollItemIntoView (ListItemProvider item)
		{
			throw new NotSupportedException ();
		}
Beispiel #42
0
		public void UnselectItem (ListItemProvider prov)
		{
			control.SelectedItem = null;
		}
Beispiel #43
0
		public virtual IConnectable GetListItemEventRealization (ProviderEventType eventType, 
		                                                         ListItemProvider prov)
		{
			return null;
		}
		public DataItemSelectionItemPatternElementAddedEvent (ListItemProvider provider)
			: base (provider, 
			        SelectionItemPatternIdentifiers.ElementAddedToSelectionEvent)
		{
			selected = ((SWF.DataGrid) provider.Control).IsSelected (provider.Index);
		}
		public DataItemTableItemColumnHeaderItemsEvent (ListItemProvider provider)
			: base (provider,
			        TableItemPatternIdentifiers.ColumnHeaderItemsProperty)
		{
			this.provider = (DataGridViewProvider.DataGridDataItemProvider) provider;
		}
Beispiel #46
0
		public abstract object GetItemPropertyValue (ListItemProvider item,
		                                             int propertyId);
Beispiel #47
0
		public abstract void ScrollItemIntoView (ListItemProvider item);
Beispiel #48
0
		public IProviderBehavior GetListItemBehaviorRealization (AutomationPattern pattern,
		                                                         ListItemProvider prov)
		{
			if (pattern == SelectionItemPatternIdentifiers.Pattern) {
				return new ListItemSelectionItemProviderBehavior (prov);
			} else if (pattern == ValuePatternIdentifiers.Pattern) {
				return new ListItemValueProviderBehavior (prov);
			}
			return null;
		}
		public DataItemGridItemProviderBehavior (ListItemProvider itemProvider)
			: base (itemProvider)
		{
			this.itemProvider = (DataGridProvider.DataGridDataItemProvider) itemProvider;
		}
		public ListItemSelectionItemPatternElementSelectedEvent (ListItemProvider provider)
			: base (provider, 
			        SelectionItemPatternIdentifiers.ElementSelectedEvent)
		{
		}
Beispiel #51
0
		public abstract void UnselectItem (ListItemProvider item);
Beispiel #52
0
		public abstract bool IsItemSelected (ListItemProvider item);
		public DataItemValueProviderBehavior (ListItemProvider itemProvider)
			: base (itemProvider)
		{
			provider = (DataGridProvider.DataGridDataItemProvider) itemProvider;
		}
Beispiel #54
0
		public void ToggleItem (ListItemProvider item)
		{
			throw new NotSupportedException ();
		}
Beispiel #55
0
		public bool IsItemSelected (ListItemProvider prov)
		{
			int index = control.Items.IndexOf (prov.ObjectItem);
			if (index < 0) {
				return false;
			}

			return (index == control.SelectedIndex);
		}
Beispiel #56
0
		public void SelectItem (ListItemProvider prov)
		{
			control.SelectedItem = prov.ObjectItem;
		}
Beispiel #57
0
		public IConnectable GetListItemEventRealization (ProviderEventType eventType, 
		                                                 ListItemProvider prov)
		{
			if (eventType == ProviderEventType.AutomationElementHasKeyboardFocusProperty)
				return new ListItemAutomationHasKeyboardFocusPropertyEvent (prov);
			else
				return null;
		}
Beispiel #58
0
		public virtual IProviderBehavior GetListItemBehaviorRealization (AutomationPattern behavior,
		                                                                 ListItemProvider listItem)
		{
			//According to: http://msdn.microsoft.com/en-us/library/ms744765.aspx
			if (behavior == ScrollItemPatternIdentifiers.Pattern) {
				//LAMESPEC: Supported only if the list item is contained within a container that is scrollable.
				if (IsBehaviorEnabled (ScrollPatternIdentifiers.Pattern) == true)
				    return new ScrollItemProviderBehavior (listItem);
				else
					return null;
			} else
				return null;
		}
Beispiel #59
0
		public virtual ToggleState GetItemToggleState (ListItemProvider item)
		{
			return ToggleState.Indeterminate;
		}
Beispiel #60
0
		public object GetItemPropertyValue (ListItemProvider prov, int propertyId)
		{
			if (propertyId == AEIds.NameProperty.Id) {
				return (string)prov.ObjectItem;
			} else if (propertyId == AEIds.HasKeyboardFocusProperty.Id) {
				return IsItemSelected (prov) && (string)prov.ObjectItem == Control.Text;
			} else if (propertyId == AEIds.BoundingRectangleProperty.Id) {
				return GetProviderPropertyValue (AEIds.BoundingRectangleProperty.Id);
			}
			return null;
		}