public override void AllocResources()
 {
     _totalWidth      = Width;
     SelectedGridItem = null;
     _scrollPositionX = 0;
     _scrollPositionY = 0;
     LayoutRows();
     SetInitialSelectedItem();
 }
 public GUIGridCell GetColumnAt(GUIGridRow row, int x)
 {
     for (int column = 0; column < row.Count; column++)
     {
         GUIGridCell cell = row.Columns[column];
         if (x >= cell._positionX && x < cell._positionX + cell.RenderWidth)
         {
             return(cell);
         }
     }
     return(null);
 }
 private void OnDown()
 {
     if (SelectedGridItem == null)
     {
         return;
     }
     SelectedGridItem.Focus = false;
     SelectedGridItem       = SelectedGridItem.OnDown(_cursorPositionX);
     if (SelectedGridItem != null)
     {
         SelectedGridItem.Focus = true;
     }
 }
 private void OnRight()
 {
     if (SelectedGridItem == null)
     {
         return;
     }
     SelectedGridItem.Focus = false;
     SelectedGridItem       = SelectedGridItem.OnRight();
     if (SelectedGridItem != null)
     {
         SelectedGridItem.Focus = true;
     }
     _cursorPositionX = SelectedGridItem.Control.XPosition + (SelectedGridItem.RenderWidth / 2);
 }
 private void SetInitialSelectedItem()
 {
     if (SelectedGridItem != null)
     {
         return;
     }
     if (Count > 0)
     {
         GUIGridRow row = _rows[0];
         if (row.Count > 0)
         {
             SelectedGridItem = row.Columns[0];
             _cursorPositionX = SelectedGridItem.Control.XPosition + (SelectedGridItem.RenderWidth / 2);
         }
     }
 }
        public override bool HitTest(int x, int y, out int controlID, out bool focused)
        {
            bool focus = base.HitTest(x, y, out controlID, out focused);

            if (!focus)
            {
                return(focus);
            }
            if (Count == 0)
            {
                return(focus);
            }
            if (SelectedGridItem != null)
            {
                SelectedGridItem.Focus = false;
            }

            SelectedGridItem = GetItemAt(x, y);
            if (SelectedGridItem != null)
            {
                SelectedGridItem.Focus = true;
            }
            return(focus);
        }
 private void OnRight()
 {
   if (SelectedGridItem == null)
   {
     return;
   }
   SelectedGridItem.Focus = false;
   SelectedGridItem = SelectedGridItem.OnRight();
   if (SelectedGridItem != null)
   {
     SelectedGridItem.Focus = true;
   }
   _cursorPositionX = SelectedGridItem.Control.XPosition + (SelectedGridItem.RenderWidth / 2);
 }
 private void OnDown()
 {
   if (SelectedGridItem == null)
   {
     return;
   }
   SelectedGridItem.Focus = false;
   SelectedGridItem = SelectedGridItem.OnDown(_cursorPositionX);
   if (SelectedGridItem != null)
   {
     SelectedGridItem.Focus = true;
   }
 }
 private void SetInitialSelectedItem()
 {
   if (SelectedGridItem != null)
   {
     return;
   }
   if (Count > 0)
   {
     GUIGridRow row = _rows[0];
     if (row.Count > 0)
     {
       SelectedGridItem = row.Columns[0];
       _cursorPositionX = SelectedGridItem.Control.XPosition + (SelectedGridItem.RenderWidth / 2);
     }
   }
 }
Beispiel #10
0
    public override bool HitTest(int x, int y, out int controlID, out bool focused)
    {
      bool focus = base.HitTest(x, y, out controlID, out focused);
      if (!focus)
      {
        return focus;
      }
      if (Count == 0)
      {
        return focus;
      }
      if (SelectedGridItem != null)
      {
        SelectedGridItem.Focus = false;
      }

      SelectedGridItem = GetItemAt(x, y);
      if (SelectedGridItem != null)
      {
        SelectedGridItem.Focus = true;
      }
      return focus;
    }
Beispiel #11
0
 public override void AllocResources()
 {
   _totalWidth = Width;
   SelectedGridItem = null;
   _scrollPositionX = 0;
   _scrollPositionY = 0;
   LayoutRows();
   SetInitialSelectedItem();
 }