Exemplo n.º 1
0
        /**
         * Gets both iters from the provided ListStore obj based on the passed TreePath object(the selected row)
         */
        private bool getPrevIterFromSelection(out Gtk.TreeIter selectedIter, out Gtk.TreeIter prevIter,
                                              Gtk.TreePath selectedRow, Gtk.ListStore listModel)
        {
            listModel.GetIter(out selectedIter, selectedRow);
            selectedRow.Prev();
            listModel.GetIter(out prevIter, selectedRow);

            return(prevIter.Stamp != 0 && !prevIter.Equals(selectedIter));
        }
 protected virtual void OnButtonUpClicked(object sender, System.EventArgs e)
 {
     Gtk.TreePath[] paths = engineList.Selection.GetSelectedRows();
     if (paths.Length > 0)
     {
         Gtk.TreePath p = paths [0];
         Gtk.TreeIter it1, it2;
         engineStore.GetIter(out it2, p);
         if (p.Prev() && engineStore.GetIter(out it1, p))
         {
             engineStore.Swap(it1, it2);
             UpdatePriorityButtons();
         }
     }
 }
 void UpdatePriorityButtons()
 {
     Gtk.TreePath[] paths = engineList.Selection.GetSelectedRows();
     if (paths.Length > 0)
     {
         Gtk.TreePath p = paths [0];
         Gtk.TreeIter it;
         engineStore.GetIter(out it, p);
         buttonDown.Sensitive = engineStore.IterNext(ref it);
         buttonUp.Sensitive   = p.Prev();
     }
     else
     {
         buttonDown.Sensitive = buttonUp.Sensitive = false;
     }
 }