Exemple #1
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_globalVerbs != null)
         {
             _globalVerbs.Clear();
             _globalVerbs = null;
         }
         if (_verbs != null)
         {
             _verbs.Clear();
             _verbs = null;
         }
         if (_commands != null)
         {
             _commands.Clear();
             _commands = null;
         }
         if (_serviceProvider != null)
         {
             ISelectionService selectionSvc = _serviceProvider.GetService(typeof(ISelectionService)) as ISelectionService;
             if (selectionSvc != null)
             {
                 selectionSvc.SelectionChanged -= OnSelectionChanged;
             }
             _serviceProvider = null;
         }
     }
 }
Exemple #2
0
 public void CreateVerbs()
 {
     _verbs = new DesignerVerbCollection(new[]
     {
         new DesignerVerb("About", OnSelectThisItem)
     });
 }
Exemple #3
0
 public void CreateVerbs()
 {
     verbs = new DesignerVerbCollection(new DesignerVerb[]
     {
         new DesignerVerb("About", new EventHandler(OnSelectThisItem)),
     });
 }
Exemple #4
0
 public virtual void GetOleVerbs(DesignerVerbCollection rval)
 {
     System.Design.NativeMethods.IEnumOLEVERB e   = null;
     System.Design.NativeMethods.IOleObject   ocx = this.axHost.GetOcx() as System.Design.NativeMethods.IOleObject;
     if ((ocx == null) || System.Design.NativeMethods.Failed(ocx.EnumVerbs(out e)))
     {
         return;
     }
     if (e == null)
     {
         return;
     }
     int[] pceltFetched = new int[1];
     System.Design.NativeMethods.tagOLEVERB rgelt = new System.Design.NativeMethods.tagOLEVERB();
     this.foundEdit       = false;
     this.foundAbout      = false;
     this.foundProperties = false;
     while (true)
     {
         pceltFetched[0]    = 0;
         rgelt.lpszVerbName = null;
         int hr = e.Next(1, rgelt, pceltFetched);
         if ((hr == 1) || System.Design.NativeMethods.Failed(hr))
         {
             return;
         }
         if ((rgelt.grfAttribs & 2) != 0)
         {
             this.foundEdit       = this.foundEdit || (rgelt.lVerb == -4);
             this.foundAbout      = this.foundAbout || (rgelt.lVerb == 2);
             this.foundProperties = this.foundProperties || (rgelt.lVerb == 1);
             rval.Add(new HostVerb(new OleVerbData(rgelt), this.handler));
         }
     }
 }
Exemple #5
0
        private void UpdateVerbStatus()
        {
            // Create verbs first time around
            if (_verbs == null)
            {
                _verbs                 = new DesignerVerbCollection();
                _toggleHelpersVerb     = new DesignerVerb(@"Toggle Helpers", OnToggleHelpers);
                _moveFirstVerb         = new DesignerVerb(@"Move RadioButton First", OnMoveFirst);
                _movePrevVerb          = new DesignerVerb(@"Move RadioButton Previous", OnMovePrevious);
                _moveNextVerb          = new DesignerVerb(@"Move RadioButton Next", OnMoveNext);
                _moveLastVerb          = new DesignerVerb(@"Move RadioButton Last", OnMoveLast);
                _deleteRadioButtonVerb = new DesignerVerb(@"Delete RadioButton", OnDeleteRadioButton);
                _verbs.AddRange(new[] { _toggleHelpersVerb, _moveFirstVerb, _movePrevVerb,
                                        _moveNextVerb, _moveLastVerb, _deleteRadioButtonVerb });
            }

            var moveFirst = false;
            var movePrev  = false;
            var moveNext  = false;
            var moveLast  = false;

            if (_ribbonRadioButton?.Ribbon != null)
            {
                var items = ParentItems;
                moveFirst = items.IndexOf(_ribbonRadioButton) > 0;
                movePrev  = items.IndexOf(_ribbonRadioButton) > 0;
                moveNext  = items.IndexOf(_ribbonRadioButton) < (items.Count - 1);
                moveLast  = items.IndexOf(_ribbonRadioButton) < (items.Count - 1);
            }

            _moveFirstVerb.Enabled = moveFirst;
            _movePrevVerb.Enabled  = movePrev;
            _moveNextVerb.Enabled  = moveNext;
            _moveLastVerb.Enabled  = moveLast;
        }
        public override void Initialize(IComponent component)
        {
            _mpanel = component as MultiPanel;
            if (_mpanel == null)
            {
                this.DisplayError(new ArgumentException("Tried to use the MultiPanelControlDesign with a class that does not inherit from MultiPanel.", "component"));
                return;
            }
            base.Initialize(component);
            IComponentChangeService iccs = (IComponentChangeService)this.GetService(typeof(IComponentChangeService));

            if (iccs != null)
            {
                iccs.ComponentRemoved += new ComponentEventHandler(ComponentRemoved);
            }
            ISelectionService s = (ISelectionService)GetService(typeof(ISelectionService));

            if (s != null)
            {
                s.SelectionChanged += new EventHandler(S_SelectionChanged);
            }
            _verbs = new DesignerVerbCollection
            {
                new DesignerVerb("Add Page", new EventHandler(AddPage)),
                new DesignerVerb("Remove Page", new EventHandler(RemovePage))
            };
        }
Exemple #7
0
        public override void Initialize(IComponent theComponent)
        {
            base.Initialize(theComponent); // IMPORTANT! This must be the very first line

            // ISelectionService events
            var aSrv_Sel = (ISelectionService)GetService(typeof(ISelectionService));

            if (aSrv_Sel != null)
            {
                aSrv_Sel.SelectionChanged += Handler_SelectionChanged;
            }

            // IComponentChangeService events
            var aSrv_CH = (IComponentChangeService)GetService(typeof(IComponentChangeService));

            if (aSrv_CH != null)
            {
                aSrv_CH.ComponentRemoving += Handler_ComponentRemoving;
                aSrv_CH.ComponentChanged  += Handler_ComponentChanged;
            }

            // MultiPaneControl events
            DesignedControl.SelectedPageChanged += Handler_SelectedPageChanged;

            // Prepare the verbs
            myAddVerb    = new DesignerVerb("Add page", Handler_AddPage);
            myRemoveVerb = new DesignerVerb("Remove page", Handler_RemovePage);
            mySwitchVerb = new DesignerVerb("Switch pages...", Handler_SwitchPage);

            myVerbs = new DesignerVerbCollection();
            myVerbs.AddRange(new[] { myAddVerb, myRemoveVerb, mySwitchVerb });
        }
Exemple #8
0
        public override void Initialize(System.ComponentModel.IComponent component)
        {
            base.Initialize(component);

            // #297589. Do not show the grids on table control.
            BindingFlags bindingAttrs = BindingFlags.Instance | BindingFlags.NonPublic;
            Type         classType    = typeof(ParentControlDesigner);

            MemberInfo[] memberinfos = classType.GetMember("DrawGrid", bindingAttrs);
            PropertyInfo propInfo    = memberinfos[0] as PropertyInfo;

            propInfo.SetValue(this, false, null);

            designerVerbCollection = new DesignerVerbCollection();
            // Verb to add buttons
            DesignerVerb addVerb = new DesignerVerb(Controls.Properties.Resources.AddColumn_s, new EventHandler(OnAddColumn));

            removeVerb = new DesignerVerb(Controls.Properties.Resources.RemoveColumn_s, new EventHandler(OnRemoveColumn));
            designerVerbCollection.Add(addVerb);
            designerVerbCollection.Add(removeVerb);
            selectAttachedControlsVerb = new DesignerVerb(Controls.Properties.Resources.SelectAttachedControls_s, new EventHandler(OnSelectAttachedControls));
            designerVerbCollection.Add(selectAttachedControlsVerb);
            SetVerbStatus();

            ((Control)Component).ControlAdded  += new ControlEventHandler(TableControlDesigner_ControlAdded);
            ((Control)Component).ParentChanged += new EventHandler(TablePanelDesigner_ParentChanged);

            dragDropHandler = new TablePanelDragDropHandler((Control)component, this.BehaviorService, (IDesignerHost)this.GetService(typeof(IDesignerHost)));
        }
        public void AddRange_NullValue_ThrowsArgumentNullException()
        {
            var collection = new DesignerVerbCollection();

            AssertExtensions.Throws <ArgumentNullException>("value", () => collection.AddRange((DesignerVerb[])null));
            AssertExtensions.Throws <ArgumentNullException>("value", () => collection.AddRange((DesignerVerbCollection)null));
        }
Exemple #10
0
 public RebarDesigner()
 {
     _verbs = new DesignerVerbCollection();
     _verbs.Add(new DesignerVerb("Add Band", new EventHandler(mnuAddBand)));
     _verbs.Add(new DesignerVerb("Remove Band", new EventHandler(mnuRemoveBand)));
     _verbs[1].Enabled = false;
 }
        protected override void GetComponentDesignerActions(IComponent component, DesignerActionListCollection actionLists)
        {
            if (component == null)
            {
                throw new ArgumentNullException("component");
            }
            if (actionLists == null)
            {
                throw new ArgumentNullException("actionLists");
            }
            IServiceContainer site = component.Site as IServiceContainer;

            if (site != null)
            {
                DesignerCommandSet service = (DesignerCommandSet)site.GetService(typeof(DesignerCommandSet));
                if (service != null)
                {
                    DesignerActionListCollection lists = service.ActionLists;
                    if (lists != null)
                    {
                        actionLists.AddRange(lists);
                    }
                }
                if ((actionLists.Count == 0) || ((actionLists.Count == 1) && (actionLists[0] is ControlDesigner.ControlDesignerActionList)))
                {
                    DesignerVerbCollection verbs = service.Verbs;
                    if ((verbs != null) && (verbs.Count != 0))
                    {
                        DesignerVerb[] array = new DesignerVerb[verbs.Count];
                        verbs.CopyTo(array, 0);
                        actionLists.Add(new DesignerActionVerbList(array));
                    }
                }
            }
        }
        public void Ctor_Default()
        {
            var collection = new DesignerVerbCollection();

            Assert.Equal(0, collection.Count);
            Assert.Empty(collection);
        }
        private void UpdateVerbStatus()
        {
            // Create verbs first time around
            if (_verbs == null)
            {
                _verbs                   = new DesignerVerbCollection();
                _toggleHelpersVerb       = new DesignerVerb("Toggle Helpers", new EventHandler(OnToggleHelpers));
                _moveFirstVerb           = new DesignerVerb("Move Custom Control First", new EventHandler(OnMoveFirst));
                _movePrevVerb            = new DesignerVerb("Move Custom Control Previous", new EventHandler(OnMovePrevious));
                _moveNextVerb            = new DesignerVerb("Move Custom Control Next", new EventHandler(OnMoveNext));
                _moveLastVerb            = new DesignerVerb("Move Custom Control Last", new EventHandler(OnMoveLast));
                _deleteCustomControlVerb = new DesignerVerb("Delete Custom Control", new EventHandler(OnDeleteCustomControl));
                _verbs.AddRange(new DesignerVerb[] { _toggleHelpersVerb, _moveFirstVerb, _movePrevVerb,
                                                     _moveNextVerb, _moveLastVerb, _deleteCustomControlVerb });
            }

            bool moveFirst = false;
            bool movePrev  = false;
            bool moveNext  = false;
            bool moveLast  = false;

            if ((_ribbonCustomControl != null) && (_ribbonCustomControl.Ribbon != null))
            {
                TypedRestrictCollection <KryptonRibbonGroupItem> items = ParentItems;
                moveFirst = (items.IndexOf(_ribbonCustomControl) > 0);
                movePrev  = (items.IndexOf(_ribbonCustomControl) > 0);
                moveNext  = (items.IndexOf(_ribbonCustomControl) < (items.Count - 1));
                moveLast  = (items.IndexOf(_ribbonCustomControl) < (items.Count - 1));
            }

            _moveFirstVerb.Enabled = moveFirst;
            _movePrevVerb.Enabled  = movePrev;
            _moveNextVerb.Enabled  = moveNext;
            _moveLastVerb.Enabled  = moveLast;
        }
Exemple #14
0
 public DesignerMonitorDesigner()
 {
     // Initializes the designer's shortcut menu with a "Start monitoring" command.
     dvc = new DesignerVerbCollection(new DesignerVerb[] {
         new DesignerVerb("Start monitoring", new EventHandler(this.StartMonitoring))
     });
 }
Exemple #15
0
        private void UpdateVerbStatus()
        {
            // Create verbs first time around
            if (_verbs == null)
            {
                _verbs             = new DesignerVerbCollection();
                _toggleHelpersVerb = new DesignerVerb("Toggle Helpers", OnToggleHelpers);
                _moveFirstVerb     = new DesignerVerb("Move Color Button First", OnMoveFirst);
                _movePrevVerb      = new DesignerVerb("Move Color Button Previous", OnMovePrevious);
                _moveNextVerb      = new DesignerVerb("Move Color Button Next", OnMoveNext);
                _moveLastVerb      = new DesignerVerb("Move Color Button Last", OnMoveLast);
                _deleteButtonVerb  = new DesignerVerb("Delete Color Button", OnDeleteButton);
                _verbs.AddRange(new DesignerVerb[] { _toggleHelpersVerb, _moveFirstVerb, _movePrevVerb,
                                                     _moveNextVerb, _moveLastVerb, _deleteButtonVerb });
            }

            bool moveFirst = false;
            bool movePrev  = false;
            bool moveNext  = false;
            bool moveLast  = false;

            if (_ribbonColorButton?.Ribbon != null)
            {
                TypedRestrictCollection <KryptonRibbonGroupItem> items = ParentItems;
                moveFirst = (items.IndexOf(_ribbonColorButton) > 0);
                movePrev  = (items.IndexOf(_ribbonColorButton) > 0);
                moveNext  = (items.IndexOf(_ribbonColorButton) < (items.Count - 1));
                moveLast  = (items.IndexOf(_ribbonColorButton) < (items.Count - 1));
            }

            _moveFirstVerb.Enabled = moveFirst;
            _movePrevVerb.Enabled  = movePrev;
            _moveNextVerb.Enabled  = moveNext;
            _moveLastVerb.Enabled  = moveLast;
        }
        public void Ctor_Value()
        {
            var value      = new DesignerVerb[] { new DesignerVerb("Text", null), new DesignerVerb("Text", null) };
            var collection = new DesignerVerbCollection(value);

            Assert.Equal(2, collection.Count);
            Assert.Equal(value, collection.Cast <DesignerVerb>());
        }
Exemple #17
0
 /// <include file='doc\MenuCommandService.uex' path='docs/doc[@for="MenuCommandService.OnSelectionChanging"]/*' />
 /// <devdoc>
 ///      This is called by the selection service when the selection has changed.  Here
 ///      we invalidate our verb list.
 /// </devdoc>
 private void OnSelectionChanging(object sender, EventArgs e)
 {
     if (verbs != null)
     {
         verbs = null;
         OnCommandChanged(this, EventArgs.Empty);
     }
 }
Exemple #18
0
 /// <summary>
 /// Adds the specified designer verb to the set of global designer verbs.
 /// </summary>
 /// <param name="verb">The System.ComponentModel.Design.DesignerVerb to add.</param>
 public void AddVerb(System.ComponentModel.Design.DesignerVerb verb)
 {
     if (verbs == null)
     {
         verbs = new DesignerVerbCollection();
     }
     verbs.Add(verb);
 }
Exemple #19
0
 public MenuCommandServiceImpl(IDesignerHost host)
 {
     this.host             = host;
     commands              = new Hashtable();
     globalVerbs           = new DesignerVerbCollection();
     menuItemVerb          = new Hashtable();
     contextMenu           = new ContextMenu();
     lastSelectedComponent = null;
 }
Exemple #20
0
 public override void Initialize(IComponent component)
 {
     base.Initialize(component);
     this._Control = component as Webb.Reports.ExControls.ExControl;
     this._Verbs   = new DesignerVerbCollection();
     this.InitializeVerbs();
     this._ActionLists = new CurrentDesign.DesignerActionListCollection();
     this.InitializeActionList();
 }
        public VisualTabControlDesigner()
        {
            DesignerVerb verb1 = new DesignerVerb("Add Tab", OnAddPage);
            DesignerVerb verb2 = new DesignerVerb("Insert Tab", OnInsertPage);
            DesignerVerb verb3 = new DesignerVerb("Remove Tab", OnRemovePage);

            _designerVerbCollection = new DesignerVerbCollection();
            _designerVerbCollection.AddRange(new[] { verb1, verb2, verb3 });
        }
        public void AddRange_DesignerVerbCollection_Success()
        {
            var value      = new DesignerVerb[] { new DesignerVerb("Text", null), new DesignerVerb("Text", null) };
            var collection = new DesignerVerbCollection();

            collection.AddRange(new DesignerVerbCollection(value));

            Assert.Equal(2, collection.Count);
            Assert.Equal(value, collection.Cast <DesignerVerb>());
        }
        public void AddRange_ThisDesignerVerbCollection_Success()
        {
            var value      = new DesignerVerb[] { new DesignerVerb("Text", null), new DesignerVerb("Text", null) };
            var collection = new DesignerVerbCollection(value);

            collection.AddRange(collection);

            Assert.Equal(4, collection.Count);
            Assert.Equal(value.Concat(value), collection.Cast <DesignerVerb>());
        }
        public FABaseDesigner()
        {
            changeService     = null;
            verbs             = new DesignerVerbCollection();
            ShowAbout         = new DesignerVerb("About Farsi Libraries", new EventHandler(OnShowAbout));
            ShowAbout.Checked = false;
            verbs.Add(ShowAbout);

            Designers.Add(this);
        }
        public void DesignerCommandSet_Verbs_OverridenGetCommands_ReturnsExpected()
        {
            var collection = new DesignerVerbCollection();
            var mockSet    = new Mock <DesignerCommandSet>(MockBehavior.Strict);

            mockSet
            .Setup(s => s.GetCommands("Verbs"))
            .Returns(collection);
            Assert.Same(collection, mockSet.Object.Verbs);
        }
        private static ToolStripMenuItem[] GetMenuItems(DesignerVerbCollection verbs)
        {
            var menuItems = new ToolStripMenuItem[verbs.Count];

            for (int i = 0; i < menuItems.Length; i++)
            {
                menuItems[i] = new DesignerToolStripMenuItem(verbs[i].Text, verbs[i]);
            }
            return(menuItems);
        }
        public void Contains_Value_ReturnsExpected()
        {
            var verb       = new DesignerVerb("Text", null);
            var collection = new DesignerVerbCollection {
                verb
            };

            Assert.True(collection.Contains(verb));
            Assert.False(collection.Contains(new DesignerVerb("Text", null)));
            Assert.False(collection.Contains(null));
        }
        public void IndexOf_Value_ReturnsExpected()
        {
            var verb       = new DesignerVerb("Text", null);
            var collection = new DesignerVerbCollection {
                verb
            };

            Assert.Equal(0, collection.IndexOf(verb));
            Assert.Equal(-1, collection.IndexOf(new DesignerVerb("Text", null)));
            Assert.Equal(-1, collection.IndexOf(null));
        }
        public void Add_ValidValue_Success()
        {
            var verb       = new DesignerVerb("Text", null);
            var collection = new DesignerVerbCollection {
                verb, null
            };

            Assert.Equal(2, collection.Count);
            Assert.Same(verb, collection[0]);
            Assert.Null(collection[1]);
        }
Exemple #30
0
        public void Initialize(IComponent component)
        {
            if (component == null)
            {
                throw new ArgumentNullException("component");
            }
            Component = (EditorSettingsApplier)component;

            Verbs = new DesignerVerbCollection {
                new DesignerVerb("Apply to all editors", delegate { DoDefaultAction(); })
            };
        }
	public void AddRange(DesignerVerbCollection value) {}