public int QueryStatus()

in Editor_With_Toolbox/CS/EditorPane.cs [201:285]


        public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
        {
            // validate parameters
            if (prgCmds == null || cCmds != 1)
            {
                return VSConstants.E_INVALIDARG;
            }

            OLECMDF cmdf = OLECMDF.OLECMDF_SUPPORTED;

            if (pguidCmdGroup == VSConstants.GUID_VSStandardCommandSet97)
            {
                // Process standard Commands
                switch (prgCmds[0].cmdID)
                {
                    case (uint)VSConstants.VSStd97CmdID.SelectAll:
                        {
                            // Always enabled
                            cmdf = OLECMDF.OLECMDF_SUPPORTED | OLECMDF.OLECMDF_ENABLED;
                            break;
                        }
                    case (uint)VSConstants.VSStd97CmdID.Copy:
                    case (uint)VSConstants.VSStd97CmdID.Cut:
                        {
                            // Enable if something is selected
                            if (editorControl.SelectionLength > 0)
                            {
                                cmdf |= OLECMDF.OLECMDF_ENABLED;
                            }
                            break;
                        }
                    case (uint)VSConstants.VSStd97CmdID.Paste:
                        {
                            // Enable if clipboard has content we can paste

                            if (editorControl.CanPaste(DataFormats.GetFormat(DataFormats.Text)))
                            {
                                cmdf |= OLECMDF.OLECMDF_ENABLED;
                            }
                            break;
                        }
                    case (uint)VSConstants.VSStd97CmdID.Redo:
                        {
                            // Enable if actions that have occurred within the RichTextBox 
                            // can be reapplied
                            if (editorControl.CanRedo)
                            {
                                cmdf |= OLECMDF.OLECMDF_ENABLED;
                            }
                            break;
                        }
                    case (uint)VSConstants.VSStd97CmdID.Undo:
                        {
                            if (editorControl.CanUndo)
                            {
                                cmdf |= OLECMDF.OLECMDF_ENABLED;
                            }
                            break;
                        }
                    default:
                        {
                            return (int)(Constants.OLECMDERR_E_NOTSUPPORTED);
                        }
                }
            }
            else if (pguidCmdGroup == GuidList.guidEditorCmdSet)
            {
                // Process our Commands
                switch (prgCmds[0].cmdID)
                {
                    // if we had commands specific to our editor, they would be processed here
                    default:
                        {
                            return (int)(Constants.OLECMDERR_E_NOTSUPPORTED);
                        }
                }
            }
            else
            {
                return (int)(Constants.OLECMDERR_E_NOTSUPPORTED); ;
            }

            prgCmds[0].cmdf = (uint)cmdf;
            return VSConstants.S_OK;
        }