コード例 #1
0
    public MpeResourceDesigner(MediaPortalEditor mpe)
    {
      // Set Painting Styles
      SetStyle(ControlStyles.DoubleBuffer, true);
      SetStyle(ControlStyles.AllPaintingInWmPaint, true);
      SetStyle(ControlStyles.UserPaint, true);

      // This call is required by the Windows.Forms Form Designer.
      InitializeComponent();

      // Initialize variables
      this.mpe = mpe;
      mask = new MpeControlMask(this);
      //this.mask2 = new MpeResourceMask();
      //this.Controls.Add(mask2);
      resourceList = new MpeResourceCollection();

      // Create Popup Context Menu
      contextMenu = new PopupMenu();
      contextMenu.MenuCommands.Add(new MenuCommand("Parent", menuImageList, 4));
      contextMenu.MenuCommands.Add(new MenuCommand("-"));
      contextMenu.MenuCommands.Add(new MenuCommand("Send To Back", menuImageList, 0));
      contextMenu.MenuCommands.Add(new MenuCommand("Bring To Front", menuImageList, 1));
      contextMenu.MenuCommands.Add(new MenuCommand("-"));
      contextMenu.MenuCommands.Add(new MenuCommand("Copy"));
      contextMenu.MenuCommands.Add(new MenuCommand("Paste"));
      contextMenu.MenuCommands.Add(new MenuCommand("Cut"));
      contextMenu.MenuCommands.Add(new MenuCommand("Delete", menuImageList, 2));
      contextMenu.MenuCommands.Add(new MenuCommand("-"));
      contextMenu.MenuCommands.Add(new MenuCommand("Properties", menuImageList, 3));
      contextMenu.MenuCommands.Add(new MenuCommand("Test"));
    }
コード例 #2
0
 public TGContextMenuEventArgs(TabGroupLeaf tgl, Controls.TabControl tc, 
                               Controls.TabPage tp, PopupMenu contextMenu)
     : base(tgl, tc, tp)
 {
     // Definie initial state
     _contextMenu = contextMenu;
 }
コード例 #3
0
 public MpePropertyManager(MediaPortalEditor mpe)
 {
   SetStyle(ControlStyles.EnableNotifyMessage, true);
   // This call is required by the Windows.Forms Form Designer.
   InitializeComponent();
   this.mpe = mpe;
   contextMenu = new PopupMenu();
   MenuCommand category =
     new MenuCommand("Sort By Category", menuImageList, 0, new EventHandler(OnMenuCategoryClicked));
   MenuCommand name = new MenuCommand("Sort By Name", menuImageList, 1, new EventHandler(OnMenuNameClicked));
   contextMenu.MenuCommands.AddRange(new MenuCommand[] {category, name});
   propertyGrid.CommandsVisibleIfAvailable = true;
 }
コード例 #4
0
ファイル: MpeStatusBar.cs プロジェクト: arangas/MediaPortal-1
    public MpeStatusBar(ImageList icons) : base()
    {
      iconImageList = icons;
      currentLevel = MpeLogLevel.Debug;

      InitializeComponent();
      progressBar = new ProgressBar();

      panelFontBrush = new SolidBrush(Color.Black);
      progressBrush = new SolidBrush(Color.FromKnownColor(KnownColor.Highlight));
      panelBorderPen = new Pen(Color.FromKnownColor(KnownColor.ControlDark), -1.0f);

      menu = new PopupMenu();
      menu.MenuCommands.Add(new MenuCommand("Debug", iconImageList, 0));
      menu.MenuCommands.Add(new MenuCommand("Info", iconImageList, 1));
      menu.MenuCommands.Add(new MenuCommand("Warn", iconImageList, 2));
      menu.MenuCommands.Add(new MenuCommand("Error", iconImageList, 3));
    }
コード例 #5
0
        public PhoenixTabControl()
        {
            tabList = new List<TabPageInfo>();
            hiddenTabList = new List<string>();

            Config.Profile.InternalSettings.Loaded += new EventHandler(Settings_Loaded);
            Config.Profile.InternalSettings.Saving += new EventHandler(Settings_Saving);

            tabControl = new Crownwood.Magic.Controls.TabControl();
            tabControl.Style = Crownwood.Magic.Common.VisualStyle.IDE;
            tabControl.Appearance = Crownwood.Magic.Controls.TabControl.VisualAppearance.MultiDocument;
            tabControl.IDEPixelArea = false;
            tabControl.IDEPixelBorder = false;
            tabControl.Dock = DockStyle.Fill;
            tabControl.ClosePressed += new EventHandler(tabControl_ClosePressed);

            popupMenu = new PopupMenu();
            popupMenu.Animate = Animate.System;
            popupMenu.AnimateStyle = Animation.Blend;
            popupMenu.Style = Crownwood.Magic.Common.VisualStyle.IDE;

            shrinkMenuCommand = new MenuCommand("Shrink Labels");
            shrinkMenuCommand.Click += new EventHandler(shrinkMenuCommand_Click);

            multilineMenuCommand = new MenuCommand("Multiline");
            multilineMenuCommand.Click += new EventHandler(multilineMenuCommand_Click);

            hideTextMenuCommand = new MenuCommand("Hide Text");
            hideTextMenuCommand.Click += new EventHandler(hideTextMenuCommand_Click);

            tabControl.ContextPopupMenu = popupMenu;

            Controls.Add(tabControl);

            UpdateTabs();
        }
コード例 #6
0
ファイル: MenuControl.cs プロジェクト: uvbs/Holodeck
        protected void OnProcessMouseDown(int xPos, int yPos)
        {
            Point pos = new Point(xPos, yPos);

            for(int i=0; i<_drawCommands.Count; i++)
            {
                DrawCommand dc = _drawCommands[i] as DrawCommand;

                // Find the DrawCommand this is over
                if (dc.SelectRect.Contains(pos) && dc.Enabled)
                {
                    // Is an item already selected?
                    if (_selected)
                    {
                        // Is it this item that is already selected?
                        if (_trackItem == i)
                        {
                            // Is a popupMenu showing
                            if (_popupMenu != null)
                            {
                                // Dismiss the submenu
                                _popupMenu.Dismiss();

                                // No reference needed
                                _popupMenu = null;
                            }
                        }
                    }
                    else
                    {
                        // Select the tracked item
                        _selected = true;
                        _drawUpwards = false;

                        // Is there a change in tracking?
                        if (_trackItem != i)
                        {
                            // Modify the display of the two items
                            _trackItem = SwitchTrackingItem(_trackItem, i);
                        }
                        else
                        {
                            // Update display to show as selected
                            DrawCommand(_trackItem, true);
                        }

                        // Is there a submenu to show?
                        if (dc.Chevron || (dc.MenuCommand.MenuCommands.Count > 0))
                            User32.PostMessage(this.Handle, WM_OPERATEMENU, 1, 0);
                    }

                    break;
                }
            }
        }
コード例 #7
0
ファイル: MenuControl.cs プロジェクト: uvbs/Holodeck
        protected override void OnEnabledChanged(EventArgs e)
        {
            base.OnEnabledChanged(e);

            // Have we become disabled?
            if (!this.Enabled)
            {
                // Is an item selected?
                if (_selected)
                {
                    // Is a popupMenu showing?
                    if (_popupMenu != null)
                    {
                        // Dismiss the submenu
                        _popupMenu.Dismiss();

                        // No reference needed
                        _popupMenu = null;
                    }

                    // Reset state
                    Deselect();
                    _drawUpwards = false;

                    SimulateReturnFocus();
                }
            }

            // Do not draw any item as being tracked
            RemoveItemTracking();

            // Change in state changes the way items are drawn
            Invalidate();
        }
コード例 #8
0
ファイル: MenuControl.cs プロジェクト: uvbs/Holodeck
        public MenuControl()
        {
            // Set default values
            lastX = -1;
            lastY = -1;
            _trackItem = -1;
            _oldFocus = IntPtr.Zero;
            _minButton = null;
            _popupMenu = null;
            _activeChild = null;
            _closeButton = null;
            _controlLPen = null;
            _mdiContainer = null;
            _restoreButton = null;
            _controlLBrush = null;
            _chevronStartCommand = null;
            _animateFirst = true;
            _exitLoop = false;
            _selected = false;
            _multiLine = false;
            _mouseOver = false;
            _defaultFont = true;
            _manualFocus = false;
            _drawUpwards = false;
            _plainAsBlock = false;
            _clientSubclass = null;
            _ignoreMouseMove = false;
            _deselectReset = true;
            _expandAllTogether = true;
            _rememberExpansion = true;
            _highlightInfrequent = true;
            _dismissTransfer = false;
            _style = VisualStyle.IDE;
            _direction = Direction.Horizontal;
            _menuCommands = new MenuCommandCollection();
            _glyphFading = GlyphFading.Default;
            this.Dock = DockStyle.Top;
            this.Cursor = System.Windows.Forms.Cursors.Arrow;

            // Animation details
            _animateTime = 100;
            _animate = Animate.System;
            _animateStyle = Animation.System;

            // Prevent flicker with double buffering and all painting inside WM_PAINT
            SetStyle(ControlStyles.DoubleBuffer |
                     ControlStyles.AllPaintingInWmPaint |
                     ControlStyles.UserPaint, true);

            // Should not be allowed to select this control
            SetStyle(ControlStyles.Selectable, false);

            // Hookup to collection events
            _menuCommands.Cleared += new CollectionClear(OnCollectionCleared);
            _menuCommands.Inserted += new CollectionChange(OnCollectionInserted);
            _menuCommands.Removed += new CollectionChange(OnCollectionRemoved);

            // Need notification when the MenuFont is changed
            Microsoft.Win32.SystemEvents.UserPreferenceChanged +=
                new UserPreferenceChangedEventHandler(OnPreferenceChanged);

            DefineColors();

            // Set the starting Font
            DefineFont(SystemInformation.MenuFont);

            // Do not allow tab key to select this control
            this.TabStop = false;

            // Default to one line of items
            this.Height = _rowHeight;

            // Add ourself to the application filtering list
            Application.AddMessageFilter(this);
        }
コード例 #9
0
ファイル: MenuControl.cs プロジェクト: uvbs/Holodeck
        internal void OperateSubMenu(DrawCommand dc, bool selectFirst, bool trackRemove)
        {
            if (this.IsDisposed)
                return;

            if (dc == null)
                return;

            Rectangle drawRect = dc.DrawRect;

            // Find screen positions for popup menu
            Point screenPos;

            if (_style == VisualStyle.IDE)
            {
                if (_direction == Direction.Horizontal)
                    screenPos = PointToScreen(new Point(dc.DrawRect.Left + 1, drawRect.Bottom - _lengthGap - 2));
                else
                    screenPos = PointToScreen(new Point(dc.DrawRect.Right - _breadthGap, drawRect.Top + _boxExpandSides - 1));
            }
            else
            {
                if (_direction == Direction.Horizontal)
                    screenPos = PointToScreen(new Point(dc.DrawRect.Left + 1, drawRect.Bottom));
                else
                    screenPos = PointToScreen(new Point(dc.DrawRect.Right, drawRect.Top));
            }

            Point aboveScreenPos;

            if (_style == VisualStyle.IDE)
            {
                if (_direction == Direction.Horizontal)
                    aboveScreenPos = PointToScreen(new Point(dc.DrawRect.Left + 1, drawRect.Top + _breadthGap + _lengthGap - 1));
                else
                    aboveScreenPos = PointToScreen(new Point(dc.DrawRect.Right - _breadthGap, drawRect.Bottom + _lengthGap + 1));
            }
            else
            {
                if (_direction == Direction.Horizontal)
                    aboveScreenPos = PointToScreen(new Point(dc.DrawRect.Left + 1, drawRect.Top));
                else
                    aboveScreenPos = PointToScreen(new Point(dc.DrawRect.Right, drawRect.Bottom));
            }

            int borderGap;

            // Calculate the missing gap in the PopupMenu border
            if (_direction == Direction.Horizontal)
                borderGap = dc.DrawRect.Width - _subMenuBorderAdjust;
            else
                borderGap = dc.DrawRect.Height - _subMenuBorderAdjust;

            _popupMenu = new PopupMenu();
            if (_popupMenu == null)
                return;

            // Define the correct visual style based on ours
            _popupMenu.Style = this.Style;

            // Key direction when keys cause dismissal
            int returnDir = 0;

            // Command selected by the PopupMenu
            MenuCommand returnCommand = null;

            // Should the PopupMenu tell the collection to remember expansion state
            _popupMenu.RememberExpansion = _rememberExpansion;

            // Propogate our highlight setting
            _popupMenu.HighlightInfrequent = _highlightInfrequent;

            // Might need to define custom colors
            if (!_defaultSelectedBackColor)
                _popupMenu.BackColor = _selectedBackColor;

            if (!_defaultSelectedTextColor)
                _popupMenu.TextColor = _selectedTextColor;

            if (!_defaultHighlightTextColor)
                _popupMenu.HighlightTextColor = _highlightTextColor;

            if (!_defaultHighlightBackColor)
                _popupMenu.HighlightColor = _highlightBackColor;

            if (!_defaultFont)
                _popupMenu.Font = base.Font;

            // Pass on the animation values
            _popupMenu.Animate = _animate;
            _popupMenu.AnimateStyle = _animateStyle;
            _popupMenu.AnimateTime = _animateTime;

            if (dc.Chevron)
            {
                MenuCommandCollection mcc = new MenuCommandCollection();

                bool addCommands = false;

                if (_menuCommands != null)
                {
                    // Generate a collection of menu commands for those not visible
                    foreach(MenuCommand command in _menuCommands)
                    {
                        if (!addCommands && (command == _chevronStartCommand))
                            addCommands = true;

                        if (addCommands)
                            mcc.Add(command);
                    }
                }

                // Track the popup using provided menu item collection
                returnCommand = _popupMenu.TrackPopup(screenPos,
                                                      aboveScreenPos,
                                                      _direction,
                                                      mcc,
                                                      borderGap,
                                                      selectFirst,
                                                      this,
                                                      _animateFirst,
                                                      ref returnDir);
            }
            else
            {
                // Generate event so that caller has chance to modify MenuCommand contents
                dc.MenuCommand.OnPopupStart();

                // Honour the collections request for showing infrequent items
                _popupMenu.ShowInfrequent = dc.MenuCommand.MenuCommands.ShowInfrequent;

                // Track the popup using provided menu item collection
                returnCommand = _popupMenu.TrackPopup(screenPos,
                                                      aboveScreenPos,
                                                      _direction,
                                                      dc.MenuCommand.MenuCommands,
                                                      borderGap,
                                                      selectFirst,
                                                      this,
                                                      _animateFirst,
                                                      ref returnDir);
            }

            // No more animation till simulation ends
            _animateFirst = false;

            // If we are supposed to expand all items at the same time
            if (_expandAllTogether)
            {
                // Is anything we have shown now in the expanded state
                if (AnythingExpanded(_menuCommands))
                {
                    // Set everything to expanded
                    SetAllCommandsExpansion(_menuCommands, true);
                }
            }

            // Was arrow key not used to dismiss the submenu?
            if (returnDir == 0)
            {
                // The submenu may have eaten the mouse leave event
                _mouseOver = false;

                // Only if the submenu was dismissed at the request of the submenu
                // should the selection mode be cancelled, otherwise keep selection mode
                if (!_dismissTransfer)
                {
                    // This item is no longer selected
                    Deselect();
                    _drawUpwards = false;

                    if (!this.IsDisposed)
                    {
                        // Should we stop tracking this item
                        if (trackRemove)
                        {
                            // Unselect the current item
                            _trackItem = SwitchTrackingItem(_trackItem, -1);
                        }
                        else
                        {
                            if (_trackItem != -1)
                            {
                                // Repaint the item
                                DrawCommand(_trackItem, true);
                            }
                        }
                    }
                }
                else
                {
                    // Do not change _selected status
                    _dismissTransfer = false;
                }
            }

            if (!dc.Chevron)
            {
                // Generate event so that caller has chance to modify MenuCommand contents
                dc.MenuCommand.OnPopupEnd();
            }

            // Spin the message loop so the messages dealing with destroying
            // the PopupMenu window are processed and cause it to disappear from
            // view before events are generated
            Application.DoEvents();

            // Remove unwanted object
            _popupMenu = null;

            // Was arrow key used to dismiss the submenu?
            if (returnDir != 0)
            {
                if (returnDir < 0)
                {
                    // Shift selection left one
                    ProcessMoveLeft(true);
                }
                else
                {
                    // Shift selection right one
                    ProcessMoveRight(true);
                }

                // A WM_MOUSEMOVE is generated when we open up the new submenu for
                // display, ignore this as it causes the selection to move
                _ignoreMouseMove = true;
            }
            else
            {
                // Was a MenuCommand returned?
                if (returnCommand != null)
                {
                    // Remove

                    // Are we simulating having the focus?
                    if (_manualFocus)
                    {
                        // Always return focus to original when a selection is made
                        SimulateReturnFocus();
                    }

                    // Pulse the selected event for the command
                     returnCommand.OnClick(EventArgs.Empty);
                }
            }
        }
コード例 #10
0
ファイル: LogPage.cs プロジェクト: greeduomacro/phoenix
        private void InitializeMenu()
        {
            popupMenu = new PopupMenu();

            copyAllMenuCommand = new MenuCommand("Copy All", new EventHandler(copyAllMenuCommand_Click));
            clearMenuCommand = new MenuCommand("Clear", new EventHandler(clearMenuCommand_Click));
            forecolorMenuCommand = new MenuCommand("ForeColor", new EventHandler(forecolorMenuCommand_Click));
            backroundMenuCommand = new MenuCommand("BackColor", new EventHandler(backroundMenuCommand_Click));
            wordWrapMenuCommand = new MenuCommand("WordWrap", new EventHandler(wordWrapMenuCommand_Click));
            filterMenuCommand = new MenuCommand("Filter", new EventHandler(filterMenuCommand_Click));
            autoScrollCommand = new MenuCommand("AutoScroll", new EventHandler(autoScrollCommand_Click));

            popupMenu.MenuCommands.Add(copyAllMenuCommand);
            popupMenu.MenuCommands.Add(clearMenuCommand);
            popupMenu.MenuCommands.Add(new MenuCommand("-"));
            popupMenu.MenuCommands.Add(forecolorMenuCommand);
            popupMenu.MenuCommands.Add(backroundMenuCommand);
            popupMenu.MenuCommands.Add(wordWrapMenuCommand);
            popupMenu.MenuCommands.Add(new MenuCommand("-"));
            popupMenu.MenuCommands.Add(filterMenuCommand);
            popupMenu.MenuCommands.Add(autoScrollCommand);
        }
コード例 #11
0
ファイル: ProfilerControl.cs プロジェクト: ilya11211/nprof
        private void _lv_HeaderMenuEvent(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            ContainerListView listView = sender as ContainerListView;

            PopupMenu pop = new PopupMenu();
            pop.Selected += new CommandHandler(pop_Selected);
            pop.Deselected += new CommandHandler(pop_Deselected);

            MenuCommand sortBy = pop.MenuCommands.Add(new MenuCommand("Sort &By"));
            pop.MenuCommands.Add(new MenuCommand("-"));
            bool isAscending = true;
            for(int idx = 0; idx < listView.Columns.Count; ++idx)
            {
                ContainerListViewColumnHeader hdr = listView.Columns[idx];
                MenuCommand sortByItem = new MenuCommand(hdr.Text);

                sortByItem.Description = string.Format("Sort By the '{1}' column from this grid", (hdr.Visible ? "Shows" : "Hides"), hdr.Text);
                sortByItem.RadioCheck = true;
                sortByItem.Checked = hdr.SortOrder != SortOrder.None;
                sortByItem.Tag = new object[] { listView, idx };
                //				sortByItem.Click += new EventHandler(sortByItem_Click);

                if(sortByItem.Checked)
                    isAscending = hdr.SortOrder == SortOrder.Ascending;

                sortBy.MenuCommands.Add(sortByItem);
            }

            sortBy.MenuCommands.Add(new MenuCommand("-"));
            MenuCommand ascending = sortBy.MenuCommands.Add(new MenuCommand("&Ascending"));
            ascending.RadioCheck = true;
            ascending.Checked = isAscending;
            ascending.Tag = new object[] { listView, SortOrder.Ascending };
            //			ascending.Click += new EventHandler(sortOrder_Click);

            MenuCommand descending = sortBy.MenuCommands.Add(new MenuCommand("&Descending"));
            descending.RadioCheck = true;
            descending.Checked = !isAscending;
            descending.Tag = new object[] { listView, SortOrder.Descending };
            //			descending.Click += new EventHandler(sortOrder_Click);

            bool allShown = true;
            for(int idx = 0; idx < listView.Columns.Count; ++idx)
            {
                ContainerListViewColumnHeader hdr = listView.Columns[idx];
                MenuCommand checkable = new MenuCommand(hdr.Text);

                checkable.Description = string.Format("{0} the '{1}' column from this grid", (hdr.Visible ? "Shows" : "Hides"), hdr.Text);
                checkable.Checked = hdr.Visible;
                checkable.Tag = hdr;

                pop.MenuCommands.Add(checkable);
                allShown &= hdr.Visible;
            }

            pop.MenuCommands.Add(new MenuCommand("-"));
            pop.MenuCommands.Add(new MenuCommand("Show &All")).Enabled = !allShown;

            MenuCommand result = pop.TrackPopup(listView.PointToScreen(new Point(e.X, e.Y)));
            if(result != null && result.Tag is ContainerListViewColumnHeader)
                (result.Tag as ContainerListViewColumnHeader).Visible = !result.Checked;
        }
コード例 #12
0
        protected void OnWM_OPERATE_SUBMENU(ref Message m)
        {
            int popupItem = (int)m.WParam;
            bool selectFirst = (m.LParam != IntPtr.Zero);

            _popupItem = popupItem;
            _childMenu = new PopupMenu();

            DrawCommand dc = _drawCommands[popupItem] as DrawCommand;

            // Find screen coordinate of Top right of item cell
            Win32.POINT screenPosTR;
            screenPosTR.x = dc.DrawRect.Right;
            screenPosTR.y = dc.DrawRect.Top;
            User32.ClientToScreen(this.Handle, ref screenPosTR);

            // Find screen coordinate of top left of item cell
            Win32.POINT screenPosTL;
            screenPosTL.x = dc.DrawRect.Left;
            screenPosTL.y = dc.DrawRect.Top;
            User32.ClientToScreen(this.Handle, ref screenPosTL);

            // Ensure the child has the same properties as ourself
            _childMenu.Style = this.Style;
            _childMenu.Font = this.Font;
            _childMenu.BackColor = this.BackColor;
            _childMenu.TextColor = this.TextColor;
            _childMenu.HighlightTextColor = this.HighlightTextColor;
            _childMenu.HighlightColor = this.HighlightColor;
            _childMenu.Animate = this.Animate;
            _childMenu.AnimateStyle = this.AnimateStyle;
            _childMenu.AnimateTime = this.AnimateTime;

            // Record keyboard direction
            int returnDir = 0;

            // Propogate the remembering of expansion state
            _childMenu.RememberExpansion = _rememberExpansion;

            // Honour the collections request for showing infrequent items
            _childMenu._showInfrequent = dc.MenuCommand.MenuCommands.ShowInfrequent;

            // Propogate the highlight property
            _childMenu.HighlightInfrequent = _highlightInfrequent;

            // Generate event so that caller has chance to modify MenuCommand contents
            dc.MenuCommand.OnPopupStart();

            _returnCommand = _childMenu.InternalTrackPopup(new Point(screenPosTR.x, screenPosTR.y),
                                                           new Point(screenPosTL.x, screenPosTL.y),
                                                           dc.MenuCommand.MenuCommands,
                                                           this,
                                                           selectFirst,
                                                           _parentControl,
                                                           _popupRight,
                                                           _popupDown,
                                                           _animateFirst,
                                                           ref returnDir);

            // Generate event so that caller has chance to modify MenuCommand contents
            dc.MenuCommand.OnPopupEnd();

            _popupItem = -1;;
            _childMenu = null;

            // Subsequent times a submenu is shown we do not want it to animate
            _animateFirst = false;

            if ((_returnCommand != null) || (returnDir != 0))
            {
                // Finish processing messages
                _timer.Stop();
                _exitLoop = true;
                _returnDir = returnDir;
            }
        }
コード例 #13
0
ファイル: FileList.cs プロジェクト: greeduomacro/phoenix
        private void InitializeMenu()
        {
            menuIcons.Images.Add(Resources.FolderOpened);
            menuIcons.Images.Add(Resources.FolderClosed);

            fileMenu = new PopupMenu();
            MenuCommand edit = new MenuCommand("Edit");

            edit.ImageList = menuIcons;

            edit.Click += new EventHandler(edit_Click);

            fileMenu.MenuCommands.Add(edit);
            fileMenu.MenuCommands.Add(new MenuCommand("-"));
            AddDefaultCommands(fileMenu);
            fileMenu.MenuCommands["Paste"].Visible = false;

            dirMenu = new PopupMenu();
            MenuCommand add = new MenuCommand("Add");
            MenuCommand open = new MenuCommand("Open");
            MenuCommand expandAll = new MenuCommand("Expand All");
            MenuCommand collapseAll = new MenuCommand("Collapse All");

            add.ImageList = menuIcons;
            open.ImageList = menuIcons;
            expandAll.ImageList = menuIcons;
            collapseAll.ImageList = menuIcons;

            open.ImageIndex = 0;

            open.Click += new EventHandler(open_Click);
            expandAll.Click += new EventHandler(expandAll_Click);
            collapseAll.Click += new EventHandler(collapseAll_Click);

            MenuCommand addFile = new MenuCommand("New File");
            MenuCommand addExisting = new MenuCommand("Existing File");
            MenuCommand addFolder = new MenuCommand("New Folder");

            addFile.ImageList = menuIcons;
            addExisting.ImageList = menuIcons;
            addFolder.ImageList = menuIcons;

            addFolder.ImageIndex = 1;

            addFile.Click += new EventHandler(addFile_Click);
            addExisting.Click += new EventHandler(addExisting_Click);
            addFolder.Click += new EventHandler(addFolder_Click);

            add.MenuCommands.Add(addFile);
            add.MenuCommands.Add(addExisting);
            add.MenuCommands.Add(addFolder);

            dirMenu.MenuCommands.Add(add);
            dirMenu.MenuCommands.Add(open);
            dirMenu.MenuCommands.Add(new MenuCommand("-"));
            dirMenu.MenuCommands.Add(expandAll);
            dirMenu.MenuCommands.Add(collapseAll);
            dirMenu.MenuCommands.Add(new MenuCommand("-"));
            AddDefaultCommands(dirMenu);
        }
コード例 #14
0
        public PopupMenu()
        {
            // Create collection objects
            _drawCommands = new ArrayList();
            _menuCommands = new MenuCommandCollection();

            // Default the properties
            _returnDir = 0;
            _extraSize = 0;
            _popupItem = -1;
            _trackItem = -1;
            _childMenu = null;
            _exitLoop = false;
            _popupDown = true;
            _mouseOver = false;
            _excludeTop = true;
            _popupRight = true;
            _parentMenu = null;
            _excludeOffset = 0;
            _parentControl = null;
            _returnCommand = null;
            _controlLBrush = null;
            _controlEBrush = null;
            _controlLLBrush = null;
            _highlightInfrequent = false;
            _showInfrequent = false;
            _style = VisualStyle.IDE;
            _rememberExpansion = true;
            _lastMousePos = new Point(-1,-1);
            _direction = Direction.Horizontal;
            _textFont = SystemInformation.MenuFont;

            // Animation details
            _animateTime = 100;
            _animate = Animate.System;
            _animateStyle = Animation.System;
            _animateFirst = true;
            _animateIn = true;

            // Create and initialise the timer object (but do not start it running!)
            _timer = new Timer();
            _timer.Interval = _selectionDelay;
            _timer.Tick += new EventHandler(OnTimerExpire);

            // Define default colors
            _textColor = SystemColors.MenuText;
            _highlightTextColor = SystemColors.HighlightText;
            DefineHighlightColors(SystemColors.Highlight);
            DefineColors(SystemColors.Control);
        }
コード例 #15
0
ファイル: FileList.cs プロジェクト: greeduomacro/phoenix
        private void AddDefaultCommands(PopupMenu menu)
        {
            MenuCommand cut = new MenuCommand("Cut");
            MenuCommand copy = new MenuCommand("Copy");
            MenuCommand paste = new MenuCommand("Paste");
            MenuCommand delete = new MenuCommand("Delete");
            MenuCommand rename = new MenuCommand("Rename");
            MenuCommand reload = new MenuCommand("Reload");
            MenuCommand showAllFiles = new MenuCommand("Show All Files");

            cut.ImageList = menuIcons;
            copy.ImageList = menuIcons;
            paste.ImageList = menuIcons;
            delete.ImageList = menuIcons;
            rename.ImageList = menuIcons;
            reload.ImageList = menuIcons;
            showAllFiles.ImageList = menuIcons;

            cut.Click += new EventHandler(cut_Click);
            copy.Click += new EventHandler(copy_Click);
            paste.Click += new EventHandler(paste_Click);
            delete.Click += new EventHandler(delete_Click);
            rename.Click += new EventHandler(rename_Click);
            reload.Click += new EventHandler(reload_Click);
            showAllFiles.Click += new EventHandler(showAllFiles_Click);

            menu.MenuCommands.Add(cut);
            menu.MenuCommands.Add(copy);
            menu.MenuCommands.Add(paste);
            menu.MenuCommands.Add(delete);
            menu.MenuCommands.Add(rename);
            menu.MenuCommands.Add(new MenuCommand("-"));
            menu.MenuCommands.Add(reload);
            menu.MenuCommands.Add(showAllFiles);
        }
コード例 #16
0
        protected void DefinePopupMenuForControl(Controls.TabControl tabControl)
        {
            PopupMenu pm = new PopupMenu();

            // Add all the standard menus we manage
            _mcClose = new MenuCommand("", new EventHandler(OnClose));
            _mcSep1 = new MenuCommand("-");
            _mcProm = new MenuCommand("", new EventHandler(OnToggleProminent));
            _mcReba = new MenuCommand("", new EventHandler(OnRebalance));
            _mcSep2 = new MenuCommand("-");
            _mcHorz = new MenuCommand("", _internalImages, _imageHorzSplit, new EventHandler(OnNewVertical));
            _mcVert = new MenuCommand("", _internalImages, _imageVertSplit, new EventHandler(OnNewHorizontal));
            _mcNext = new MenuCommand("", new EventHandler(OnMoveNext));
            _mcPrev = new MenuCommand("", new EventHandler(OnMovePrevious));

            // Prominent is a radio checked item
            _mcProm.RadioCheck = true;

            // Use the provided context menu
            tabControl.ContextPopupMenu = pm;

            // Update command states when shown
            tabControl.PopupMenuDisplay += new CancelEventHandler(OnPopupMenuDisplay);
        }
コード例 #17
0
 void mnuExit_Click(Object sender, System.EventArgs e)
 {
     this.Hide();
     niTrayIcon.Dispose();
     pmnuTrayMenu = null;
     this.Dispose();
     this.Close();
     Application.Exit();
 }
コード例 #18
0
ファイル: DockingManager.cs プロジェクト: uvbs/Holodeck
        public virtual void OnShowContextMenu(Point screenPos)
        {
            PopupMenu context = new PopupMenu();

            // The order of Content displayed in the context menu is not the same as
            // the order of Content in the _contents collection. The latter has its
            // ordering changed to enable Restore functionality to work.
            ContentCollection temp = new ContentCollection();

            foreach(Content c in _contents)
            {
                int count = temp.Count;
                int index = 0;

                // Find best place to add into the temp collection
                for(; index<count; index++)
                {
                    if (c.Order < temp[index].Order)
                        break;
                }

                temp.Insert(index, c);
            }

            // Create a context menu entry per Content
            foreach(Content t in temp)
            {
                MenuCommand mc = new MenuCommand(t.Title, new EventHandler(OnToggleContentVisibility));
                mc.Checked = t.Visible;
                mc.Tag = t;

                context.MenuCommands.Add(mc);
            }

            // Add a separator
            context.MenuCommands.Add(new MenuCommand("-"));

            // Add fixed entries to end to effect all content objects
            context.MenuCommands.Add(new MenuCommand("Show All", new EventHandler(OnShowAll)));
            context.MenuCommands.Add(new MenuCommand("Hide All", new EventHandler(OnHideAll)));

            // Ensure menu has same style as the docking windows
            context.Style = _visualStyle;

            if (OnContextMenu(context))
            {
                // Show it!
                context.TrackPopup(screenPos, true);
            }
        }
コード例 #19
0
ファイル: TabControl.cs プロジェクト: nithinphilips/SMOz
 public void ResetContextPopupMenu()
 {
     ContextPopupMenu = null;
 }
コード例 #20
0
ファイル: DockingManager.cs プロジェクト: uvbs/Holodeck
        protected bool OnContextMenu(PopupMenu context)
        {
            CancelEventArgs cea = new CancelEventArgs();

            if (ContextMenu != null)
                ContextMenu(context, cea);

            return !cea.Cancel;
        }
コード例 #21
0
        protected MenuCommand InternalTrackPopup(Point screenPosTR, 
            Point screenPosTL,
            MenuCommandCollection menuCollection,
            PopupMenu parentMenu,
            bool selectFirst,
            MenuControl parentControl,
            bool popupRight,
            bool popupDown,
            bool animateIn,
            ref int returnDir)
        {
            // Default the drawing direction
            _direction = Direction.Horizontal;

            // Remember the MenuControl that initiated us
            _parentControl = parentControl;

            // We have a parent popup menu that should be consulted about operation
            _parentMenu = parentMenu;

            // Is this the first time a menu at this level has been animated
            _animateIn = animateIn;

            // Remember any currect menu item collection
            MenuCommandCollection oldCollection = _menuCommands;

            // Use the passed in collection of menu commands
            _menuCommands = menuCollection;

            // Remember screen positions
            _screenPos = screenPosTR;
            _aboveScreenPos = screenPosTR;
            _leftScreenPos = screenPosTL;

            // Remember display directions
            _popupRight = popupRight;
            _popupDown = popupDown;

            MenuCommand ret = InternalTrackPopup(selectFirst);

            // Restore to original collection
            _menuCommands = oldCollection;

            // Remove references no longer required
            _parentControl = null;
            _parentMenu = null;

            // Return the direction key that caused dismissal
            returnDir = _returnDir;

            return ret;
        }