Exemplo n.º 1
0
        protected virtual void OnTreeviewrefCursorChanged(object sender, System.EventArgs e)
        {
            bool isSelect = treeviewref.Selection.CountSelectedRows() == 1;

            editAction1.Sensitive   = isSelect && CanEdit;
            removeAction1.Sensitive = isSelect && CanDel;
            bool     SelectFirst = false, SelectLast = false;
            bool     Filtered = entryFilter.Text != "";
            TreeIter iter, SelectIter;

            if (treeviewref.Selection.GetSelected(out SelectIter))
            {
                TreePath SelectPath = RefListStore.GetPath(filter.ConvertIterToChildIter(SelectIter));
                RefListStore.GetIterFirst(out iter);
                SelectFirst = RefListStore.GetPath(iter).Compare(SelectPath) == 0;
                RefListStore.IterNthChild(out iter, RefListStore.IterNChildren() - 1);
                SelectLast = RefListStore.GetPath(iter).Compare(SelectPath) == 0;
            }
            buttonOrdinalUp.Sensitive   = isSelect && !Filtered && !SelectFirst;
            buttonOrdinalDown.Sensitive = isSelect && !Filtered && !SelectLast;
            buttonOk.Sensitive          = isSelect;
        }