Exemple #1
0
 public virtual void OnPageContextMenu(TGContextMenuEventArgs e)
 {
     // Has anyone registered for the event?
     if (PageContextMenu != null)
         PageContextMenu(this, e);
 }
Exemple #2
0
        protected void OnPopupMenuDisplay(object sender, CancelEventArgs e)
        {
            // Remove all existing menu items
            _tabControl.ContextPopupMenu.MenuCommands.Clear();

            // Add our standard set of menus
            _tabControl.ContextPopupMenu.MenuCommands.AddRange(new MenuCommand[] { _mcClose, _mcSep1,
                                                                                   _mcProm, _mcReba,
                                                                                   _mcSep2, _mcHorz,
                                                                                   _mcVert, _mcNext,
                                                                                   _mcPrev });
            if (!_tabbedGroups.LayoutLock)
            {
                // Are any pages selected
                bool valid = (_tabControl.SelectedIndex != -1);

                // Define the latest text string
                _mcClose.Text = _tabbedGroups.CloseMenuText;
                _mcProm.Text  = _tabbedGroups.ProminentMenuText;
                _mcReba.Text  = _tabbedGroups.RebalanceMenuText;
                _mcPrev.Text  = _tabbedGroups.MovePreviousMenuText;
                _mcNext.Text  = _tabbedGroups.MoveNextMenuText;
                _mcVert.Text  = _tabbedGroups.NewVerticalMenuText;
                _mcHorz.Text  = _tabbedGroups.NewHorizontalMenuText;

                // Only need to close option if the tab has close defined
                _mcClose.Visible = _tabControl.ShowClose && valid;
                _mcSep1.Visible  = _tabControl.ShowClose && valid;

                // Update the radio button for prominent
                _mcProm.Checked = (_tabbedGroups.ProminentLeaf == this);

                // Can only create new group if at least two pages exist
                bool split = valid && (_tabControl.TabPages.Count > 1);

                bool vertSplit = split;
                bool horzSplit = split;

                TabGroupSequence tgs = _parent as TabGroupSequence;

                // If we are not the only leaf, then can only split in
                // the same direction as the group we are in
                if (tgs.Count > 1)
                {
                    if (tgs.Direction == Direction.Vertical)
                    {
                        vertSplit = false;
                    }
                    else
                    {
                        horzSplit = false;
                    }
                }

                _mcVert.Visible = vertSplit;
                _mcHorz.Visible = horzSplit;

                // Can only how movement if group exists in that direction
                _mcNext.Visible = valid && (_tabbedGroups.NextLeaf(this) != null);
                _mcPrev.Visible = valid && (_tabbedGroups.PreviousLeaf(this) != null);
                _mcSep2.Visible = _mcNext.Visible | _mcPrev.Visible | vertSplit | horzSplit;
            }
            else
            {
                // Make sure that none of the menu commands are visible
                _mcClose.Visible = false;
                _mcProm.Visible  = false;
                _mcReba.Visible  = false;
                _mcPrev.Visible  = false;
                _mcNext.Visible  = false;
                _mcVert.Visible  = false;
                _mcHorz.Visible  = false;
                _mcSep1.Visible  = false;
                _mcSep2.Visible  = false;
            }

            TGContextMenuEventArgs tge = new TGContextMenuEventArgs(this,
                                                                    _tabControl,
                                                                    _tabControl.SelectedTab,
                                                                    _tabControl.ContextPopupMenu);

            // Generate event so handlers can add/remove/cancel menu
            _tabbedGroups.OnPageContextMenu(tge);

            int visibleCommands = 0;

            // Count how many visible commands left
            foreach (MenuCommand mc in _tabControl.ContextPopupMenu.MenuCommands)
            {
                if (mc.Visible)
                {
                    visibleCommands++;
                }
            }

            // Pass back cancel value or always cancel if no commands are visible
            e.Cancel = (tge.Cancel || (visibleCommands == 0));
        }
Exemple #3
0
		public virtual void OnPageContextMenu(TGContextMenuEventArgs e) {
			// Has anyone registered for the event?
			if (PageContextMenu != null)
				PageContextMenu(this, e);
		}
        protected void OnPopupMenuDisplay(object sender, CancelEventArgs e)
        {
            // Remove all existing menu items
            _tabControl.ContextPopupMenu.MenuCommands.Clear();

            // Add our standard set of menus
            _tabControl.ContextPopupMenu.MenuCommands.AddRange(new MenuCommand[]{_mcClose, _mcSep1,
                                                                                 _mcProm, _mcReba,
                                                                                 _mcSep2, _mcHorz,
                                                                                 _mcVert, _mcNext,
                                                                                 _mcPrev});

            // Are any pages selected
            bool valid = (_tabControl.SelectedIndex != -1);

            // Define the latest text string
            _mcClose.Text = _tabbedGroups.CloseMenuText;
            _mcProm.Text = _tabbedGroups.ProminentMenuText;
            _mcReba.Text = _tabbedGroups.RebalanceMenuText;
            _mcPrev.Text = _tabbedGroups.MovePreviousMenuText;
            _mcNext.Text = _tabbedGroups.MoveNextMenuText;
            _mcVert.Text = _tabbedGroups.NewVerticalMenuText;
            _mcHorz.Text = _tabbedGroups.NewHorizontalMenuText;

            // Only need to close option if the tab has close defined
            _mcClose.Visible = _tabControl.ShowClose && valid;
            _mcSep1.Visible = _tabControl.ShowClose && valid;

            // Update the radio button for prominent
            _mcProm.Checked = (_tabbedGroups.ProminentLeaf == this);

            // Can only create new group if at least two pages exist
            bool split = valid && (_tabControl.TabPages.Count > 1);

            bool vertSplit = split;
            bool horzSplit = split;

            TabGroupSequence tgs = _parent as TabGroupSequence;

            // If we are not the only leaf, then can only split in
            // the same direction as the group we are in
            if (tgs.Count > 1)
            {
                if (tgs.Direction == Direction.Vertical)
                   vertSplit = false;
                else
                   horzSplit = false;
            }

            _mcVert.Visible = vertSplit;
            _mcHorz.Visible = horzSplit;

            // Can only how movement if group exists in that direction
            _mcNext.Visible = valid && (_tabbedGroups.NextLeaf(this) != null);
            _mcPrev.Visible = valid && (_tabbedGroups.PreviousLeaf(this) != null);

            TGContextMenuEventArgs tge = new TGContextMenuEventArgs(this,
                                                                    _tabControl,
                                                                    _tabControl.SelectedTab,
                                                                    _tabControl.ContextPopupMenu);

            // Generate event so handlers can add/remove/cancel menu
            _tabbedGroups.OnPageContextMenu(tge);

            // Pass back cancel value
            e.Cancel = tge.Cancel;
        }
Exemple #5
0
        private void m_tabs_PageContextMenu(Crownwood.Magic.Controls.TabbedGroups tg, Crownwood.Magic.Controls.TGContextMenuEventArgs e)
        {
            e.ContextMenu.MenuCommands.Add(new Crownwood.Magic.Menus.MenuCommand(I.T("New tab|101"), new EventHandler(m_menuNouvelOnglet_Click)));
            m_pageContextMenu = e.TabPage;

            MenuCommand command = new Crownwood.Magic.Menus.MenuCommand(I.T("Direct new pages to this tab|102"),
                                                                        new EventHandler(OnOrienterNouveauxIci));

            command.Checked = m_pageRecepteurUniverselle == m_pageContextMenu;
            e.ContextMenu.MenuCommands.Add(command);
        }