コード例 #1
0
 public override void AllocResources()
 {
     _totalWidth      = Width;
     SelectedGridItem = null;
     _scrollPositionX = 0;
     _scrollPositionY = 0;
     LayoutRows();
     SetInitialSelectedItem();
 }
コード例 #2
0
 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);
 }
コード例 #3
0
 private void OnDown()
 {
     if (SelectedGridItem == null)
     {
         return;
     }
     SelectedGridItem.Focus = false;
     SelectedGridItem       = SelectedGridItem.OnDown(_cursorPositionX);
     if (SelectedGridItem != null)
     {
         SelectedGridItem.Focus = true;
     }
 }
コード例 #4
0
 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);
 }
コード例 #5
0
 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);
         }
     }
 }
コード例 #6
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);
        }
コード例 #7
0
 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);
 }
コード例 #8
0
 private void OnDown()
 {
   if (SelectedGridItem == null)
   {
     return;
   }
   SelectedGridItem.Focus = false;
   SelectedGridItem = SelectedGridItem.OnDown(_cursorPositionX);
   if (SelectedGridItem != null)
   {
     SelectedGridItem.Focus = true;
   }
 }
コード例 #9
0
 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);
     }
   }
 }
コード例 #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;
    }
コード例 #11
0
 public override void AllocResources()
 {
   _totalWidth = Width;
   SelectedGridItem = null;
   _scrollPositionX = 0;
   _scrollPositionY = 0;
   LayoutRows();
   SetInitialSelectedItem();
 }