Beispiel #1
0
 static void AccelEdited_cb(IntPtr inst, IntPtr path_string, uint accel_key, int accel_mods, uint hardware_keycode)
 {
     try {
         CellRendererAccel __obj = GLib.Object.GetObject(inst, false) as CellRendererAccel;
         __obj.OnAccelEdited(GLib.Marshaller.Utf8PtrToString(path_string), accel_key, (Gdk.ModifierType)accel_mods, hardware_keycode);
     } catch (Exception e) {
         GLib.ExceptionManager.RaiseUnhandledException(e, false);
     }
 }
Beispiel #2
0
 static void AccelCleared_cb(IntPtr inst, IntPtr path_string)
 {
     try {
         CellRendererAccel __obj = GLib.Object.GetObject(inst, false) as CellRendererAccel;
         __obj.OnAccelCleared(GLib.Marshaller.Utf8PtrToString(path_string));
     } catch (Exception e) {
         GLib.ExceptionManager.RaiseUnhandledException(e, false);
     }
 }
    private void AddColumns(TreeView treeView)
    {
        {
            var column = new TreeViewColumn();
            var cell = new CellRendererText();
            cell.Editable = true;
            cell.Edited += this.TextStringEdited;
            column.Title = Column.TextString.GetDescription();
            column.PackStart(cell, true);
            column.AddAttribute(cell, "text", (int)Column.TextString);
            this.treeview1.AppendColumn(column);
        }

        {
            var column = new TreeViewColumn();
            var cell = new CellRendererText();
            cell.Editable = true;
            cell.Edited += this.TextDoubleEdited;
            column.Title = Column.TextDouble.GetDescription();
            column.PackStart(cell, true);
            column.AddAttribute(cell, "text", (int)Column.TextDouble);
            this.treeview1.AppendColumn(column);
        }

        {
            var column = new TreeViewColumn();
            var cell = new CellRendererText();
            column.Title = Column.TextBool.GetDescription();
            column.PackStart(cell, true);
            column.AddAttribute(cell, "text", (int)Column.TextBool);
            this.treeview1.AppendColumn(column);
        }

        {
            var column = new TreeViewColumn();
            var cell = new CellRendererToggle();
            cell.Toggled += this.ToggleCheckBoxToggled;
            cell.Active = true;
            cell.Activatable = true;
            column.Title = Column.ToggleCheckBox.GetDescription();
            column.PackStart(cell, true);
            column.AddAttribute(cell, "active", (int)Column.ToggleCheckBox);
            this.treeview1.AppendColumn(column);
        }

        {
            var column = new TreeViewColumn();
            var cell = new CellRendererToggle();
            cell.Toggled += this.ToggleRadioButtonToggled;
            cell.Active = true;
            cell.Activatable = true;
            cell.Radio = true;
            column.Title = Column.ToggleRadioButton.GetDescription();
            column.PackStart(cell, true);
            column.AddAttribute(cell, "active", (int)Column.ToggleRadioButton);
            this.treeview1.AppendColumn(column);
        }

        {
            // Note: the text in this renderer has to be parseable as a floating point number
            var column = new TreeViewColumn();
            var cell = new CellRendererSpin();
            cell.Editable = true;
            cell.Edited += this.SpinTest1Edited;

            // Adjustment - Contains the range information for the cell.
            // Value: Must be non-null for the cell to be editable.
            cell.Adjustment = new Adjustment(0, 0, float.MaxValue, 1, 2, 0);

            // ClimbRate - Provides the acceleration rate for when the button is held down.
            // Value: Defaults to 0, must be greater than or equal to 0.
            cell.ClimbRate = 0;

            // Digits - Number of decimal places to display (seems to only work while editing the cell?!?).
            // Value: An integer between 0 and 20, default value is 0.
            cell.Digits = 3;

            column.Title = Column.Spin.GetDescription();
            column.PackStart(cell, true);
            column.AddAttribute(cell, "text", (int)Column.Spin);
            this.treeview1.AppendColumn(column);
        }

        {
            ListStore model = new ListStore(typeof(string));

            model.AppendValues("Value1");
            model.AppendValues("Value2");
            model.AppendValues("Value3");

            var column = new TreeViewColumn();
            var cell = new CellRendererCombo();
            cell.Width = 75;
            cell.Editable = true;
            cell.Edited += this.ComboEdited;

            // bool. Whether to use an entry.
            // If true, the cell renderer will include an entry and allow to
            // enter values other than the ones in the popup list.
            cell.HasEntry = true;

            // TreeModel. Holds a tree model containing the possible values for the combo box.
            // Use the CellRendererCombo.TextColumn property to specify the column holding the values.
            cell.Model = model;

            // int. Specifies the model column which holds the possible values for the combo box.
            // Note: this refers to the model specified in the model property, not the model
            // backing the tree view to which this cell renderer is attached.
            cell.TextColumn = 0;

            column.Title = Column.Combo.GetDescription();
            column.PackStart(cell, true);
            column.AddAttribute(cell, "text", (int)Column.Combo);
            this.treeview1.AppendColumn(column);
        }

        {
            var column = new TreeViewColumn();
            var cell = new CellRendererAccel();
            cell.AccelMode = CellRendererAccelMode.Other;
            cell.Editable = true;
            cell.AccelEdited += new AccelEditedHandler(this.OnAccelEdited);
            cell.AccelCleared += new AccelClearedHandler(this.OnAccelCleared);
            column.Title = Column.Accel.ToString();
            column.PackStart(cell, true);
            column.AddAttribute(cell, "text", (int)Column.Accel);
            this.treeview1.AppendColumn(column);
        }

        {
            var column = new TreeViewColumn();
            var cell = new CellRendererProgress();
            column.Title = Column.Progress.GetDescription();
            column.PackStart(cell, true);
            column.AddAttribute(cell, "text", (int)Column.ProgressText);
            column.AddAttribute(cell, "value", (int)Column.Progress);
            this.treeview1.AppendColumn(column);
        }

        {
            var column = new TreeViewColumn();
            var cell = new CellRendererText();
            column.Title = Column.PixbufStockLabel.GetDescription();
            column.PackStart(cell, true);
            column.AddAttribute(cell, "text", (int)Column.PixbufStockLabel);
            treeview1.AppendColumn(column);
        }

        {
            var column = new TreeViewColumn();
            var cell = new CellRendererPixbuf();
            column.Title = Column.PixbufStockIcon.GetDescription();
            column.PackStart(cell, true);
            column.AddAttribute(cell, "stock-id", (int)Column.PixbufStockIcon);
            treeview1.AppendColumn(column);
        }

        {
            var column = new TreeViewColumn();
            var cell = new CellRendererPixbuf();
            column.Title = Column.PixbufCustom.GetDescription();
            column.PackStart(cell, true);
            column.AddAttribute(cell, "pixbuf", (int)Column.PixbufCustom);
            treeview1.AppendColumn(column);
        }
    }
        private void SetupTreeView()
        {
            {
                var column = new TreeViewColumn();
                var cell = new CellRendererText();
                column.Title = Column.Action.ToString();
                column.PackStart(cell, true);
                column.AddAttribute(cell, "text", (int)Column.Action);
                this.treeview1.AppendColumn(column);
            }

            {
                var column = new TreeViewColumn();
                var cell = new CellRendererAccel();
                cell.AccelMode = CellRendererAccelMode.Other;
                cell.Editable = true;
                cell.AccelEdited += new AccelEditedHandler(this.OnAccelEdited);
                cell.AccelCleared += new AccelClearedHandler(this.OnAccelCleared);
                column.Title = Column.Shortcut.ToString();
                column.PackStart(cell, true);
                column.AddAttribute(cell, "text", (int)Column.Shortcut);
                this.treeview1.AppendColumn(column);
            }

            this.treeview1.RowActivated += new RowActivatedHandler(this.OnRowActivated);
            this.treeview1.ButtonPressEvent += new ButtonPressEventHandler(this.OnButtonPress);

            this.treeStore1 = (TreeStore)this.SetupTreeViewModel();
            this.treeview1.Model = this.treeStore1;
            this.treeview1.ExpandAll();
            this.treeview1.Selection.SelectPath(TreePath.NewFirst());
        }