Ejemplo n.º 1
0
        // In Eto not exists

        /*protected override void OnColumnWidthChanged(ColumnWidthChangedEventArgs e)
         * {
         *  if (fListMan != null && fUpdateCount == 0) {
         *      fListMan.ChangeColumnWidth(e.ColumnIndex, Columns[e.ColumnIndex].Width);
         *  }
         *
         *  base.OnColumnWidthChanged(e);
         * }*/

        private void SortContents(bool restoreSelected)
        {
            if (fSorting)
            {
                if (fListMan != null)
                {
                    fListMan.SortContents(fSortColumn, fSortOrder == BSDSortOrder.Ascending);
                }
                else
                {
                    SortHelper.MergeSort(fItems, CompareItems);
                }
            }
        }
Ejemplo n.º 2
0
        /*protected override void OnDrawColumnHeader(DrawListViewColumnHeaderEventArgs e)
         * {
         #if DEFAULT_HEADER
         *
         *  e.DrawDefault = true;
         *
         #else
         *
         *  using (var sf = new StringFormat())
         *  {
         *      Graphics gfx = e.Graphics;
         *      Rectangle rt = e.Bounds;
         *
         #if !__MonoCS__
         *      VisualStyleElement element = VisualStyleElement.Header.Item.Normal;
         *      if ((e.State & ListViewItemStates.Hot) == ListViewItemStates.Hot)
         *          element = VisualStyleElement.Header.Item.Hot;
         *      if ((e.State & ListViewItemStates.Selected) == ListViewItemStates.Selected)
         *          element = VisualStyleElement.Header.Item.Pressed;
         *
         *      var visualStyleRenderer = new VisualStyleRenderer(element);
         *      visualStyleRenderer.DrawBackground(gfx, rt);
         #else
         *      e.DrawBackground();
         #endif
         *
         *      switch (e.Header.TextAlign)
         *      {
         *          case HorizontalAlignment.Left:
         *              sf.Alignment = StringAlignment.Near;
         *              break;
         *
         *          case HorizontalAlignment.Right:
         *              sf.Alignment = StringAlignment.Far;
         *              break;
         *
         *          case HorizontalAlignment.Center:
         *              sf.Alignment = StringAlignment.Center;
         *              break;
         *      }
         *
         *      sf.LineAlignment = StringAlignment.Center;
         *      sf.Trimming = StringTrimming.EllipsisCharacter;
         *      sf.FormatFlags = StringFormatFlags.NoWrap;
         *
         *      int w = TextRenderer.MeasureText(" ", Font).Width;
         *      rt.Inflate(-(w / 5), 0);
         *
         *      gfx.DrawString(e.Header.Text, Font, Brushes.Black, rt, sf);
         *
         *      string arrow = "";
         *      switch (GetColumnSortOrder(e.ColumnIndex)) {
         *          case SortOrder.Ascending:
         *              arrow = "▲";
         *              break;
         *          case SortOrder.Descending:
         *              arrow = "▼";
         *              break;
         *      }
         *
         *      if (arrow != "") {
         *          using (var fnt = new Font(Font.FontFamily, Font.SizeInPoints * 0.6f, FontStyle.Regular)) {
         *              float aw = gfx.MeasureString(arrow, fnt).Width;
         *              float x = rt.Left + (rt.Width - aw) / 2.0f;
         *              gfx.TextRenderingHint = TextRenderingHint.AntiAlias;
         *              gfx.DrawString(arrow, fnt, Brushes.Black, x, rt.Top);
         *          }
         *      }
         *  }
         *
         #endif
         *
         *  base.OnDrawColumnHeader(e);
         * }*/

        /*protected override void OnCellFormatting(GridCellFormatEventArgs e)
         * {
         *  if (e.Row == fItems.IndexOf((GKListItem)SelectedItem)) {
         *      e.BackgroundColor = SystemColors.Highlight;
         *      e.ForegroundColor = Colors.White;
         *  } else {
         *      var item = e.Item as GKListItem;
         *      if (item != null) {
         *          if (item.BackColor != Colors.Transparent) {
         *              e.BackgroundColor = item.BackColor;
         *              e.ForegroundColor = Colors.Black;
         *          } else {
         *              e.BackgroundColor = Colors.White;
         *              e.ForegroundColor = Colors.Black;
         *          }
         *      }
         *  }
         *
         *  base.OnCellFormatting(e);
         * }*/

        private void SortContents()
        {
            if (fSorting)
            {
                if (fListMan != null)
                {
                    fListMan.SortContents(fSortColumn, fSortOrder == BSDTypes.SortOrder.Ascending);
                }
                else
                {
                    SortHelper.MergeSort(fItems, CompareItems);
                }
            }
        }
Ejemplo n.º 3
0
        /*protected override void OnDrawColumnHeader(DrawListViewColumnHeaderEventArgs e)
         * {
         #if DEFAULT_HEADER
         *
         *  e.DrawDefault = true;
         *
         #else
         *
         *  using (var sf = new StringFormat())
         *  {
         *      Graphics gfx = e.Graphics;
         *      Rectangle rt = e.Bounds;
         *
         #if !__MonoCS__
         *      VisualStyleElement element = VisualStyleElement.Header.Item.Normal;
         *      if ((e.State & ListViewItemStates.Hot) == ListViewItemStates.Hot)
         *          element = VisualStyleElement.Header.Item.Hot;
         *      if ((e.State & ListViewItemStates.Selected) == ListViewItemStates.Selected)
         *          element = VisualStyleElement.Header.Item.Pressed;
         *
         *      var visualStyleRenderer = new VisualStyleRenderer(element);
         *      visualStyleRenderer.DrawBackground(gfx, rt);
         #else
         *      e.DrawBackground();
         #endif
         *
         *      switch (e.Header.TextAlign)
         *      {
         *          case HorizontalAlignment.Left:
         *              sf.Alignment = StringAlignment.Near;
         *              break;
         *
         *          case HorizontalAlignment.Right:
         *              sf.Alignment = StringAlignment.Far;
         *              break;
         *
         *          case HorizontalAlignment.Center:
         *              sf.Alignment = StringAlignment.Center;
         *              break;
         *      }
         *
         *      sf.LineAlignment = StringAlignment.Center;
         *      sf.Trimming = StringTrimming.EllipsisCharacter;
         *      sf.FormatFlags = StringFormatFlags.NoWrap;
         *
         *      int w = TextRenderer.MeasureText(" ", Font).Width;
         *      rt.Inflate(-(w / 5), 0);
         *
         *      gfx.DrawString(e.Header.Text, Font, Brushes.Black, rt, sf);
         *
         *      string arrow = "";
         *      switch (GetColumnSortOrder(e.ColumnIndex)) {
         *          case SortOrder.Ascending:
         *              arrow = "▲";
         *              break;
         *          case SortOrder.Descending:
         *              arrow = "▼";
         *              break;
         *      }
         *
         *      if (arrow != "") {
         *          using (var fnt = new Font(Font.FontFamily, Font.SizeInPoints * 0.6f, FontStyle.Regular)) {
         *              float aw = gfx.MeasureString(arrow, fnt).Width;
         *              float x = rt.Left + (rt.Width - aw) / 2.0f;
         *              gfx.TextRenderingHint = TextRenderingHint.AntiAlias;
         *              gfx.DrawString(arrow, fnt, Brushes.Black, x, rt.Top);
         *          }
         *      }
         *  }
         *
         #endif
         *
         *  base.OnDrawColumnHeader(e);
         * }*/

        /*protected override void OnCellFormatting(GridCellFormatEventArgs e)
         * {
         *  if (e.Row == fItems.IndexOf((GKListItem)SelectedItem)) {
         *      e.BackgroundColor = SystemColors.Highlight;
         *      e.ForegroundColor = Colors.White;
         *  } else {
         *      var item = e.Item as GKListItem;
         *      if (item != null) {
         *          if (item.BackColor != Colors.Transparent) {
         *              e.BackgroundColor = item.BackColor;
         *              e.ForegroundColor = Colors.Black;
         *          } else {
         *              e.BackgroundColor = Colors.White;
         *              e.ForegroundColor = Colors.Black;
         *          }
         *      }
         *  }
         *
         *  base.OnCellFormatting(e);
         * }*/

        private void SortContents()
        {
            if (fSorting)
            {
                if (fListMan != null)
                {
                    fListMan.SortContents(fSortColumn, fSortOrder == SortOrder.Ascending);
                }
                else
                {
                    SysUtils.MergeSort(fItems, CompareItems);
                }
            }
        }
Ejemplo n.º 4
0
        private void SortContents(bool restoreSelected)
        {
            if (fListMan != null)
            {
                object rec = (restoreSelected) ? GetSelectedData() : null;

                fListMan.SortContents(fSortColumn, fSortOrder == MVPSortOrder.Ascending);
                ResetCache();

                if (restoreSelected)
                {
                    SelectItem(rec);
                }
            }
            else
            {
                Sort();
            }
        }