コード例 #1
0
ファイル: ObjectClipboard.cs プロジェクト: janproch/datadmin
        public static void EnableAndFillPasteButton(DragDropBuilder bld, ToolStripDropDownButton btnPaste)
        {
            int opcnt = 0;

            if (bld != null)
            {
                opcnt = bld.OperationCount();
            }
            if (opcnt > 0 && ObjectClipboard.Memory.Length > 0)
            {
                string newtext = String.Format("({0})", opcnt);
                if (btnPaste.Text != newtext)
                {
                    btnPaste.Text = newtext;
                }
                btnPaste.Enabled = true;
                btnPaste.DropDownItems.Clear();

                var lab = new ToolStripLabel();
                btnPaste.DropDownItems.Add(lab);
                lab.Image = GetClipboardImage();
                lab.Text  = "(" + GetClipboardText() + ")";
                btnPaste.DropDownItems.Add(new ToolStripSeparator());

                bld.GetMenuItems(btnPaste.DropDownItems);
            }
            else
            {
                btnPaste.Text    = "";
                btnPaste.Enabled = false;
            }
        }
コード例 #2
0
        public DragDropBuilder GetDragDropBuilder(AppObject[] draggingObjects)
        {
            var bld = new DragDropBuilder();

            foreach (object obj in GetDragDropOperationObjects())
            {
                bld.AddObject(obj, draggingObjects);
            }
            return(bld);
        }
コード例 #3
0
ファイル: DATreeView.cs プロジェクト: janproch/datadmin
        private void UpdateToolbarEnabling()
        {
            btnRefresh.Enabled = Selected != null;
            btnDelete.Enabled  = Selected != null && Selected.AllowDelete();
            btnRename.Enabled  = Selected != null && Selected.AllowRename();
            btnCopy.Enabled    = Selected != null && Selected.GetValidAppObjects().Any();
            btnNew.Enabled     = Root != null && Root.AllowNewChild();
            DragDropBuilder bld = null;

            if (Selected != null && ObjectClipboard.Memory != null)
            {
                bld = Selected.GetDragDropBuilder(ObjectClipboard.Memory);
            }
            ObjectClipboard.EnableAndFillPasteButton(bld, btnPaste);
        }
コード例 #4
0
        private void UpdateEnabling()
        {
            var caps = Widget.Caps;

            btnNew.Visible              = caps.CreateNew;
            btnDelete.Visible           = caps.Delete;
            btnRename.Visible           = caps.Rename;
            btnGenerateSql.Visible      = caps.GenerateSql;
            btnDesign.Visible           = caps.Design;
            btnMoveUp.Visible           = btnMoveDown.Visible = caps.Move;
            tbxSearch.Visible           = caps.Search;
            btnCopy.Visible             = caps.Copy;
            btnPaste.Visible            = caps.Paste;
            toolStripSeparator1.Visible = caps.Copy || caps.Paste;

            var appobj = SelectedAppObject;

            btnDelete.Enabled      = appobj != null && Widget.CanDeleteObject(appobj, SelectedItem.Index);
            btnRename.Enabled      = appobj != null && appobj.AllowRename() && listView1.SelectedItems.Count == 1;
            btnGenerateSql.Enabled = appobj != null && appobj.GetSqlGenerators().Count > 0;
            btnDesign.Enabled      = appobj != null && appobj.AllowDesign();

            btnCopy.Enabled = appobj != null;
            if (btnPaste.Visible && listView1.SelectedItems.Count == 1)
            {
                DragDropBuilder bld = null;
                if (appobj != null && ObjectClipboard.Memory != null)
                {
                    bld = appobj.GetDragDropBuilder(ObjectClipboard.Memory);
                }
                ObjectClipboard.EnableAndFillPasteButton(bld, btnPaste);
            }
            else
            {
                btnPaste.Enabled = false;
                btnPaste.Text    = "";
            }
        }