Пример #1
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;
 }
Пример #2
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)));
        }
Пример #3
0
 public MenuCommandServiceImpl(IServiceProvider serviceProvider)
     : base(serviceProvider)
 {
     m_globalVerbs.Add(StandartVerb("Cut", StandardCommands.Cut));
     m_globalVerbs.Add(StandartVerb("Copy", StandardCommands.Copy));
     m_globalVerbs.Add(StandartVerb("Paste", StandardCommands.Paste));
     m_globalVerbs.Add(StandartVerb("Delete", StandardCommands.Delete));
     m_globalVerbs.Add(StandartVerb("Select All", StandardCommands.SelectAll));
 }
Пример #4
0
        /// <summary>
        /// Gets the collection of verbs displayed in the top right menu of the designer.
        /// </summary>
        /// <param name="panel"></param>
        /// <returns></returns>
        public static DesignerVerbCollection GetDesignerVerbs(IDesignerHost host, MultiPanel panel)
        {
            var verbs = new DesignerVerbCollection();

            verbs.Add(new DesignerVerb("Add Page", (sender, args) => AddPage(host, panel)));
            verbs.Add(new DesignerVerb("Remove Page", (sender, args) => RemovePage(host, panel)));

            foreach (MultiPanelPage page in panel.Controls)
            {
                var pageCopy = page;
                verbs.Add(new DesignerVerb("Select \"" + page.Text + "\"", (sender, args) => SelectPage(host, panel, pageCopy)));
            }

            return(verbs);
        }
Пример #5
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));
         }
     }
 }
 public BaseDesigner()
 {
     m_WorkspacePen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
     m_BorderPen.DashStyle    = System.Drawing.Drawing2D.DashStyle.Solid;
     m_Format.Trimming        = StringTrimming.EllipsisCharacter;
     m_Verbs.Add(new DesignerVerb("About", new EventHandler(AboutEvent)));
 }
        public ManagedPanelDesigner()
            : base()
        {
            DesignerVerb verb1 = new DesignerVerb("Select PanelManager", OnSelectManager);

            m_verbs.Add(verb1);
        }
 /// <summary>
 /// Adds the specified designer verb to the set of global designer verbs.
 /// </summary>
 /// <param name="verb">The <see cref="T:System.ComponentModel.Design.DesignerVerb"/> to add.</param>
 public void AddVerb(DesignerVerb verb)
 {
     if (verb != null)
     {
         verbs.Add(verb);
     }
 }
 /// <summary>
 /// Adds the specified designer verb to the set of global designer verbs.
 /// </summary>
 /// <param name="verb">The <see cref="T:System.ComponentModel.Design.DesignerVerb"/> to add.</param>
 public void AddVerb(DesignerVerb verb)
 {
     if ((verbsCollection != null) && (verb != null))
     {
         verbsCollection.Add(verb);
     }
 }
Пример #10
0
 public void AddVerb(DesignerVerb verb)
 {
     if (verbs.Contains(verb))
     {
         throw new InvalidOperationException("The MenuCommandService already contains that Designer Verb");
     }
     verbs.Add(verb);
 }
Пример #11
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);
 }
Пример #12
0
        public override void Initialize(System.ComponentModel.IComponent component)
        {
            base.Initialize(component);
            toVertical   = new DesignerVerb(Controls.Properties.Resources.Vertical_s, new EventHandler(OnChangeToVertical));
            toHorizontal = new DesignerVerb(Controls.Properties.Resources.Horizontal_s, new EventHandler(OnChangeToHorizontal));
            toNWSE       = new DesignerVerb(Controls.Properties.Resources.NWSE_s, new EventHandler(OnChangeToNWSE));
            toNESW       = new DesignerVerb(Controls.Properties.Resources.NESW_s, new EventHandler(OnChangeToNESW));

            designerVerbCollection.Add(toVertical);
            designerVerbCollection.Add(toHorizontal);
            designerVerbCollection.Add(toNESW);
            designerVerbCollection.Add(toNWSE);

            SetVerbStatus();
            ((MgLine)Component).PropertyChanged      += LineDesigner_PropertyChanged;
            ((MgLine)Component).LineDirectionChanged += new MgLine.LineDirectionChangedDelegate(LineDesigner_LineDirectionChanged);
        }
        public DirectoryTreeDesigner()
        {
            // Configure the designer verb collection.
            // Add the Set Drive verb that calls up the form.
            verbSetDrive = new DesignerVerb("Set Drive",
                                            new EventHandler(OnVerb));
            verbs.Add(verbSetDrive);

            // Add a verb for quickly setting each possible drive value
            // (for demonstration purposes).
            string[] drives = System.IO.Directory.GetLogicalDrives();

            foreach (string drive in drives)
            {
                verbs.Add(new DesignerVerb("Set Drive " + drive,
                                           new EventHandler(OnVerb)));
            }
        }
Пример #14
0
        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);
        }
Пример #15
0
        public virtual void GetOleVerbs(DesignerVerbCollection rval)
        {
            NativeMethods.IEnumOLEVERB verbEnum = null;
            NativeMethods.IOleObject   obj      = axHost.GetOcx() as NativeMethods.IOleObject;
            if (obj == null || NativeMethods.Failed(obj.EnumVerbs(out verbEnum)))
            {
                return;
            }

            Debug.Assert(verbEnum != null, "must have return value");
            if (verbEnum == null)
            {
                return;
            }
            int[] fetched = new int[1];
            NativeMethods.tagOLEVERB oleVerb = new NativeMethods.tagOLEVERB();

            foundEdit       = false;
            foundAbout      = false;
            foundProperties = false;

            while (true)
            {
                fetched[0]           = 0;
                oleVerb.lpszVerbName = null;
                int hr = verbEnum.Next(1, oleVerb, fetched);
                if (hr == NativeMethods.S_FALSE)
                {
                    break;
                }
                else if (NativeMethods.Failed(hr))
                {
                    Debug.Fail("Failed to enumerate through enums: " + hr.ToString());
                    break;
                }

                // Believe it or not, some controls, notably the shdocview control, dont' return
                // S_FALSE and neither do they set fetched to 1.  So, we need to comment out what's
                // below to maintain compatibility with Visual Basic.
                //                 if (fetched[0] != 1) {
                //                     Debug.fail("gotta have our 1 verb...");
                //                     break;
                //                 }
                if ((oleVerb.grfAttribs & NativeMethods.ActiveX.OLEVERBATTRIB_ONCONTAINERMENU) != 0)
                {
                    foundEdit       = foundEdit || oleVerb.lVerb == OLEIVERB_UIACTIVATE;
                    foundAbout      = foundAbout || oleVerb.lVerb == HOSTVERB_ABOUT;
                    foundProperties = foundProperties || oleVerb.lVerb == HOSTVERB_PROPERTIES;

                    rval.Add(new HostVerb(new OleVerbData(oleVerb), handler));
                }
            }
        }
Пример #16
0
        protected void EnsureVerbs()
        {
            DesignerVerbCollection selectionVerbs = null;

            ISelectionService selectionSvc = this.GetService(typeof(ISelectionService)) as ISelectionService;
            IDesignerHost     host         = this.GetService(typeof(IDesignerHost)) as IDesignerHost;

            if (selectionSvc != null && host != null && selectionSvc.SelectionCount == 1)
            {
                IComponent primarySelection = selectionSvc.PrimarySelection as IComponent;
                if (primarySelection != null)
                {
                    IDesigner designer = host.GetDesigner(primarySelection);
                    if (designer != null)
                    {
                        selectionVerbs = designer.Verbs;
                    }
                }
            }

            // Designer provided verbs have the higher precedence than the global
            //
            Dictionary <string, DesignerVerb> allVerbs = new Dictionary <string, DesignerVerb> ();

            if (_globalVerbs != null)
            {
                foreach (DesignerVerb verb in _globalVerbs)
                {
                    allVerbs[verb.Text] = verb;
                }
            }
            if (selectionVerbs != null)
            {
                foreach (DesignerVerb verb in selectionVerbs)
                {
                    allVerbs[verb.Text] = verb;
                }
            }

            if (_verbs == null)
            {
                _verbs = new DesignerVerbCollection();
            }
            else
            {
                _verbs.Clear();
            }

            foreach (DesignerVerb verb in allVerbs.Values)
            {
                _verbs.Add(verb);
            }
        }
Пример #17
0
        public static DesignerVerbCollection GetAttributedVerbs(this ComponentDesigner designer)
        {
            var verbs = new DesignerVerbCollection();

            foreach (var m in designer.GetType().GetMethods(allInstBind))
            {
                foreach (DesignerVerbAttribute attr in m.GetCustomAttributes(typeof(DesignerVerbAttribute), true))
                {
                    verbs.Add(attr.GetDesignerVerb(designer, m));
                }
            }
            return(verbs.Count > 0 ? verbs : null);
        }
Пример #18
0
        /// called when to add a global verb
        public void AddVerb(System.ComponentModel.Design.DesignerVerb verb)
        {
            if (verb == null)
            {
                throw new ArgumentException("verb");
            }
            globalVerbs.Add(verb);
            // create a menu item for the verb and add it to the context menu
            ToolStripMenuItem menuItem = new ToolStripMenuItem(verb.Text);

            menuItem.Click += new EventHandler(MenuItemClickHandler);
            menuItemVerb.Add(menuItem, verb);
            contextMenu.Items.Add(menuItem);
        }
        public void Remove_ValidValue_Success()
        {
            var verb       = new DesignerVerb("Text", null);
            var collection = new DesignerVerbCollection {
                verb
            };

            collection.Remove(verb);
            Assert.Empty(collection);

            collection.Add(null);
            collection.Remove(null);
            Assert.Empty(collection);
        }
Пример #20
0
 public virtual void AddVerb(DesignerVerb verb)
 {
     if (verb == null)
     {
         throw new ArgumentNullException("verb");
     }
     this.EnsureVerbs();
     if (!_verbs.Contains(verb))
     {
         if (_globalVerbs == null)
         {
             _globalVerbs = new DesignerVerbCollection();
         }
         _globalVerbs.Add(verb);
     }
     this.OnCommandsChanged(new MenuCommandsChangedEventArgs(MenuCommandsChangedType.CommandAdded, verb));
 }
Пример #21
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="host"></param>
        /// <param name="selectedItems"></param>
        /// <param name="allowDesignerActions"></param>
        /// <returns></returns>
        public static DesignerVerbCollection GetVerbsForControl(IDesignerHost host, IList selectedItems, AllowDesignerActionsDelegate allowDesignerActions)
        {
            DesignerVerbCollection verbs = new DesignerVerbCollection();


            //if we have a selected item, get its verbs
            if (selectedItems.Count == 1)
            {
                IComponent selectedItem = selectedItems[0] as IComponent;
                if (selectedItem != null && allowDesignerActions(selectedItem))
                {
                    IDesigner designer = host.GetDesigner(selectedItem);

                    if (designer != null)
                    {
                        DesignerVerbCollection orgVerbs = designer.Verbs;
                        const int MaxOptionsToShow      = 25;

                        if (orgVerbs.Count > MaxOptionsToShow)
                        {
                            //The designer actions in the property grid are shown on a single WinForms.LinkLabel.
                            //And, WinForms.LinkLabel can show 31 links at max.
                            for (int i = 0; i < MaxOptionsToShow; i++)
                            {
                                verbs.Add(orgVerbs[i]);
                            }
                        }
                        else
                        {
                            verbs.AddRange(orgVerbs);
                        }
                    }
                }
            }
            return(verbs);
        }
Пример #22
0
 /// <include file='doc\DataGridDesigner.uex' path='docs/doc[@for="DataGridDesigner.DataGridDesigner"]/*' />
 /// <devdoc>
 /// <para>Initializes a new instance of the <see cref='System.Windows.Forms.Design.DataGridDesigner'/> class.</para>
 /// </devdoc>
 public DataGridDesigner()
 {
     designerVerbs = new DesignerVerbCollection();
     designerVerbs.Add(new DesignerVerb(SR.GetString(SR.DataGridAutoFormatString), new EventHandler(this.OnAutoFormat)));
 }
 public RTBDesigner()
 {
     this.verbs = new DesignerVerbCollection();
     verbs.Add(new DesignerVerb("Add Sample Scopes", new EventHandler(AddSampleScopes)));
 }
Пример #24
0
        // DesignerVerbCollection
        public void DesignerVerbCollectionExample()
        {
            //<Snippet1>
            //<Snippet2>
            // Creates an empty DesignerVerbCollection.
            DesignerVerbCollection collection = new DesignerVerbCollection();

            //</Snippet2>

            //<Snippet3>
            // Adds a DesignerVerb to the collection.
            collection.Add(new DesignerVerb("Example designer verb", new EventHandler(this.ExampleEvent)));
            //</Snippet3>

            //<Snippet4>
            // Adds an array of DesignerVerb objects to the collection.
            DesignerVerb[] verbs = { new DesignerVerb("Example designer verb", new EventHandler(this.ExampleEvent)), new DesignerVerb("Example designer verb", new EventHandler(this.ExampleEvent)) };
            collection.AddRange(verbs);

            // Adds a collection of DesignerVerb objects to the collection.
            DesignerVerbCollection verbsCollection = new DesignerVerbCollection();

            verbsCollection.Add(new DesignerVerb("Example designer verb", new EventHandler(this.ExampleEvent)));
            verbsCollection.Add(new DesignerVerb("Example designer verb", new EventHandler(this.ExampleEvent)));
            collection.AddRange(verbsCollection);
            //</Snippet4>

            //<Snippet5>
            // Tests for the presence of a DesignerVerb in the collection,
            // and retrieves its index if it is found.
            DesignerVerb testVerb  = new DesignerVerb("Example designer verb", new EventHandler(this.ExampleEvent));
            int          itemIndex = -1;

            if (collection.Contains(testVerb))
            {
                itemIndex = collection.IndexOf(testVerb);
            }
            //</Snippet5>

            //<Snippet6>
            // Copies the contents of the collection, beginning at index 0,
            // to the specified DesignerVerb array.
            // 'verbs' is a DesignerVerb array.
            collection.CopyTo(verbs, 0);
            //</Snippet6>

            //<Snippet7>
            // Retrieves the count of the items in the collection.
            int collectionCount = collection.Count;

            //</Snippet7>

            //<Snippet8>
            // Inserts a DesignerVerb at index 0 of the collection.
            collection.Insert(0, new DesignerVerb("Example designer verb", new EventHandler(this.ExampleEvent)));
            //</Snippet8>

            //<Snippet9>
            // Removes the specified DesignerVerb from the collection.
            DesignerVerb verb = new DesignerVerb("Example designer verb", new EventHandler(this.ExampleEvent));

            collection.Remove(verb);
            //</Snippet9>

            //<Snippet10>
            // Removes the DesignerVerb at index 0.
            collection.RemoveAt(0);
            //</Snippet10>
            //</Snippet1>
        }
 public TabbedMenuDesigner()
 {
     _verbs = new DesignerVerbCollection();
     _verbs.Add(new DesignerVerb("Edit Menu Tabs", new EventHandler(OnVerbEditFixedColumns)));
 }
Пример #26
0
 ///<summary>
 ///Adds the specified designer verb to the set of global designer verbs.
 ///</summary>
 ///<param name="verb">The <see cref="T:System.ComponentModel.Design.DesignerVerb"></see> to add. </param>
 public void AddVerb(DesignerVerb verb)
 {
     verbs.Add(verb);
 }
Пример #27
0
 public BocListDesigner()
 {
     _verbs = new DesignerVerbCollection();
     _verbs.Add(new DesignerVerb("Edit Fixed Columns", new EventHandler(OnVerbEditFixedColumns)));
 }
 private DataGridDesigner()
 {
     designerVerbs = new DesignerVerbCollection();
     designerVerbs.Add(new DesignerVerb(SR.GetString("DataGridAutoFormatString"), OnAutoFormat));
     base.AutoResizeHandles = true;
 }
Пример #29
0
        public ManagedPanelDesigner() : base()
        {
            DesignerVerb verb1 = new DesignerVerb("PanelManagerを선택", new EventHandler(OnSelectManager));

            m_verbs.Add(verb1);
        }
Пример #30
0
 public MarqueeLabelDesigner()
 {
     verbs.Add(new DesignerVerb("Apply Funky Theme",
                                new EventHandler(OnVerbFunky)));
 }