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(CCIFocusable f)
 {
     LinkedListNode<CCIFocusable> 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(CCIFocusable f)
        {
            LinkedListNode <CCIFocusable> i = _FocusList.AddLast(f);

            if (f.HasFocus)
            {
                if (_Current == null)
                {
                    _Current = i;
                }
                else
                {
                    f.HasFocus = false;
                }
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Scroll to the next item in the focus list.
 /// </summary>
 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)
     {
         CCIFocusable lostItem = _Current.Value;
         // Search for the next node.
         LinkedListNode <CCIFocusable> nextItem = null;
         for (LinkedListNode <CCIFocusable> 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
 /// <summary>
 /// Scroll to the previous item in the focus list.
 /// </summary>
 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)
     {
         CCIFocusable lostItem = _Current.Value;
         LinkedListNode <CCIFocusable> nextItem = null;
         for (LinkedListNode <CCIFocusable> 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
 /// <summary>
 /// Removes the given focusable node
 /// </summary>
 /// <param name="f"></param>
 public void Remove(CCIFocusable f)
 {
     _FocusList.Remove(f);
 }
Esempio n. 6
0
 /// <summary>
 /// Removes the given focusable node
 /// </summary>
 /// <param name="f"></param>
 public void Remove(CCIFocusable f)
 {
     _FocusList.Remove(f);
 }