Esempio n. 1
0
 /// <summary>
 /// Adds the given node to the list of focus nodes. If the node has the focus, then it is
 /// given the current focused item status. If there is already a focused item and the
 /// given node has focus, the focus is disabled.
 /// </summary>
 /// <param name="f"></param>
 public void Add(ICCFocusable f)
 {
     LinkedListNode<ICCFocusable> i = _FocusList.AddLast(f);
     if (f.HasFocus)
     {
         if (_Current == null)
         {
             _Current = i;
         }
         else
         {
             f.HasFocus = false;
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Adds the given node to the list of focus nodes. If the node has the focus, then it is
        /// given the current focused item status. If there is already a focused item and the
        /// given node has focus, the focus is disabled.
        /// </summary>
        /// <param name="f"></param>
        public void Add(ICCFocusable f)
        {
            LinkedListNode <ICCFocusable> i = _FocusList.AddLast(f);

            if (f.HasFocus)
            {
                if (_Current == null)
                {
                    _Current = i;
                }
                else
                {
                    f.HasFocus = false;
                }
            }
        }
Esempio n. 3
0
 // Scroll to the next item in the focus list.
 public void FocusNextItem()
 {
     if (current == null && focusList.Count > 0)
     {
         current = focusList.First;
         current.Value.HasFocus = true;
         if (OnFocusChanged != null)
         {
             OnFocusChanged(null, current.Value);
         }
     }
     else if (current != null)
     {
         ICCFocusable lostItem = current.Value;
         // Search for the next node.
         LinkedListNode <ICCFocusable> nextItem = null;
         for (LinkedListNode <ICCFocusable> p = current.Next; p != null; p = p.Next)
         {
             if (p.Value.CanReceiveFocus)
             {
                 nextItem = p;
             }
         }
         if (nextItem != null)
         {
             current = nextItem;
         }
         else
         {
             current = focusList.First;
         }
         lostItem.HasFocus      = false;
         current.Value.HasFocus = true;
         if (OnFocusChanged != null)
         {
             OnFocusChanged(lostItem, current.Value);
         }
     }
     else
     {
         current = null;
     }
 }
Esempio n. 4
0
        // Scroll to the previous item in the focus list.
        public void FocusPreviousItem()
        {
            if (ItemWithFocus == null && focusList.Count > 0)
            {
                current = focusList.Last;
                current.Value.HasFocus = true;
                if (OnFocusChanged != null)
                {
                    OnFocusChanged(null, current.Value);
                }
            }
            else if (current != null)
            {
                ICCFocusable lostItem = current.Value;
                // TODO: take a look at the commented out code it does not seem to do anything.
//                LinkedListNode<ICCFocusable> nextItem = null;
//                for (LinkedListNode<ICCFocusable> p = current.Previous; p != null; p = p.Previous)
//                {
//                    if (p.Value.CanReceiveFocus)
//                    {
//                        nextItem = p;
//                    }
//                }
                if (current.Previous != null)
                {
                    current = current.Previous;
                }
                else
                {
                    current = focusList.Last;
                }
                lostItem.HasFocus      = false;
                current.Value.HasFocus = true;
                if (OnFocusChanged != null)
                {
                    OnFocusChanged(lostItem, current.Value);
                }
            }
            else
            {
                current = null;
            }
        }
Esempio n. 5
0
 // Scroll to the previous item in the focus list.
 public void FocusPreviousItem()
 {
     if (ItemWithFocus == null && focusList.Count > 0)
     {
         current = focusList.Last;
         current.Value.HasFocus = true;
         if (OnFocusChanged != null)
         {
             OnFocusChanged(null, current.Value);
         }
     }
     else if (current != null)
     {
         ICCFocusable lostItem = current.Value;
         LinkedListNode <ICCFocusable> nextItem = null;
         for (LinkedListNode <ICCFocusable> p = current.Previous; p != null; p = p.Previous)
         {
             if (p.Value.CanReceiveFocus)
             {
                 nextItem = p;
             }
         }
         if (current.Previous != null)
         {
             current = current.Previous;
         }
         else
         {
             current = focusList.Last;
         }
         lostItem.HasFocus      = false;
         current.Value.HasFocus = true;
         if (OnFocusChanged != null)
         {
             OnFocusChanged(lostItem, current.Value);
         }
     }
     else
     {
         current = null;
     }
 }
Esempio n. 6
0
 /// <summary>
 /// Removes the given focusable node
 /// </summary>
 /// <param name="f"></param>
 public void Remove(ICCFocusable f)
 {
     _FocusList.Remove(f);
 }
Esempio n. 7
0
 /// <summary>
 /// Removes the given focusable node
 /// </summary>
 /// <param name="f"></param>
 public void Remove(ICCFocusable f)
 {
     _FocusList.Remove(f);
 }