Ejemplo n.º 1
0
        public void InvokeColumnHeaderMenu(int column)
        {
            var rectangle = GetColumnHeaderCellExtents(column, true, Atk.CoordType.Window);
            var col       = ColumnController.Where(c => c.Visible).ElementAtOrDefault(column);

            OnColumnRightClicked(col, rectangle.X + rectangle.Width / 2, rectangle.Y + rectangle.Height / 2);
        }
Ejemplo n.º 2
0
 protected override void OnModelReloaded()
 {
     ColumnController.Clear();
     foreach (ColumnDescription column_description in Model.ColumnDescriptions)
     {
         ColumnController.Add(new Column(column_description));
     }
 }
Ejemplo n.º 3
0
 public View()
 {
     ColumnController = new ColumnController();
     ColumnController.AddRange(
         new Column(String.Empty, new ColumnCellCheckBox("F", true), 1),
         new Column("Apples", new ColumnCellText("B", true), 1),
         new Column("Pears", new ColumnCellText("C", true), 1),
         new Column("How Hot", new ColumnCellRating("G", true), 1),
         new Column("Peaches", new ColumnCellText("D", true), 1),
         new Column("Doodle", new ColumnCellDoodle("E", true), 1),
         new Column("GUIDs!OMG", new ColumnCellText("A", true), 1)
         );
 }
Ejemplo n.º 4
0
        bool OnMotionNotifyEvent(int x)
        {
            if (!pressed_column_is_dragging)
            {
                return(false);
            }

            OnDragScroll(OnDragHScrollTimeout, header_interaction_alloc.Width * 0.1, header_interaction_alloc.Width, x);

            GdkWindow.Cursor = drag_cursor;

            var swap_column = GetColumnAt(x);

            if (swap_column != null)
            {
                var  swap_column_c = GetCachedColumnForColumn(swap_column);
                bool reorder       = false;

                if (swap_column_c.Index < pressed_column_index)
                {
                    // Moving from right to left
                    reorder = pressed_column_x_drag <= swap_column_c.X1 + swap_column_c.Width / 2;
                }
                else if (swap_column_c.Index > pressed_column_index)
                {
                    if (column_cache.Length > pressed_column_index && pressed_column_index >= 0)
                    {
                        // Moving from left to right
                        reorder = pressed_column_x_drag + column_cache[pressed_column_index].Width >=
                                  swap_column_c.X1 + swap_column_c.Width / 2;
                    }
                }

                if (reorder)
                {
                    int actual_pressed_index = ColumnController.IndexOf(column_cache[pressed_column_index].Column);
                    int actual_swap_index    = ColumnController.IndexOf(swap_column_c.Column);
                    ColumnController.Reorder(actual_pressed_index, actual_swap_index);
                    pressed_column_index = swap_column_c.Index;
                    RegenerateColumnCache();
                }
            }

            pressed_column_x_drag = x - pressed_column_x_offset - (pressed_column_x_start_hadjustment - HadjustmentValue);

            QueueDraw();
            return(true);
        }
Ejemplo n.º 5
0
        protected virtual void OnColumnRightClicked(Column clickedColumn, int x, int y)
        {
            Column [] columns = ColumnController.ToArray();
            Array.Sort(columns, delegate(Column a, Column b) {
                // Fully qualified type name to avoid Mono 1.2.4 bug
                return(System.String.Compare(a.Title, b.Title));
            });

            uint items = 0;

            for (int i = 0; i < columns.Length; i++)
            {
                if (columns[i].Id != null)
                {
                    items++;
                }
            }

            uint max_items_per_column = 15;

            if (items >= max_items_per_column * 2)
            {
                max_items_per_column = (uint)Math.Ceiling(items / 3.0);
            }
            else if (items >= max_items_per_column)
            {
                max_items_per_column = (uint)Math.Ceiling(items / 2.0);
            }

            uint column_count = (uint)Math.Ceiling(items / (double)max_items_per_column);

            Menu menu       = new Menu();
            uint row_offset = 2;

            if (clickedColumn.Id != null)   // FIXME: Also restrict if the column vis can't be changed
            {
                menu.Attach(new ColumnHideMenuItem(clickedColumn), 0, column_count, 0, 1);
                menu.Attach(new SeparatorMenuItem(), 0, column_count, 1, 2);
            }

            items = 0;

            for (uint i = 0, n = (uint)columns.Length, column = 0, row = 0; i < n; i++)
            {
                if (columns[i].Id == null)
                {
                    continue;
                }

                row = items++ % max_items_per_column;

                menu.Attach(new ColumnToggleMenuItem(columns[i]),
                            column, column + 1, row + row_offset, row + 1 + row_offset);

                if (row == max_items_per_column - 1)
                {
                    column++;
                }
            }

            menu.ShowAll();
            menu.Popup(null, null, delegate(Menu popup, out int pos_x, out int pos_y, out bool push_in) {
                int win_x, win_y;
                GdkWindow.GetOrigin(out win_x, out win_y);

                pos_x   = win_x + x;
                pos_y   = win_y + y;
                push_in = true;
            }, 3, Gtk.Global.CurrentEventTime);
        }
Ejemplo n.º 6
0
 public ObjectListView() : base()
 {
     ColumnController = new ColumnController();
 }
Ejemplo n.º 7
0
        public void ClickColumnHeader(int column)
        {
            var col = ColumnController.Where(c => c.Visible).ElementAtOrDefault(column);

            OnColumnLeftClicked(col);
        }