Exemple #1
0
        private void dotNetBarManager1_PopupOpen(object sender, DevComponents.DotNetBar.PopupOpenEventArgs e)
        {
            BaseItem item = sender as BaseItem;

            if (item == null)
            {
                return;
            }
            if (item.Name == "bTabContext")
            {
                // Enable/Disable the document related menu items based on where user right-clicked...
                TabItem tab = TabItemFromPoint(tabStrip1.PointToClient(Control.MousePosition));
                // If no tab is under the mouse disable document related items...
                if (tab == null)
                {
                    item.SubItems["bClose"].Enabled = false;
                    item.SubItems["bSave"].Enabled  = false;
                }
                else
                {
                    item.SubItems["bClose"].Enabled = true;
                    item.SubItems["bSave"].Enabled  = true;
                    // Make sure that tab under the mouse is active tab
                    tabStrip1.SelectedTab = tab;
                }
            }
            else if (item.Name == "bDockContext")
            {
                Bar bar = dotNetBarManager1.Bars["barTaskList"];
                // Display our context menu only if user clicks on the bar caption or tab strip control
                if (!bar.GrabHandleRect.Contains(bar.PointToClient(Control.MousePosition)) && bar.DockTabControl != null && !bar.DockTabControl.Bounds.Contains(bar.PointToClient(Control.MousePosition)))
                {
                    e.Cancel = true;
                    return;
                }
                item.SubItems.Clear();
                ButtonItem contextItem = null;
                foreach (BaseItem dockItem in bar.Items)
                {
                    contextItem            = new ButtonItem(dockItem.Name, dockItem.Text);
                    contextItem.GlobalItem = false;
                    contextItem.Click     += new EventHandler(this.DockContextClick);
                    item.SubItems.Add(contextItem);
                    contextItem.Checked = dockItem.Visible;
                }
                contextItem            = new ButtonItem("bc_tabnavigation", "Tab Navigation");
                contextItem.Checked    = bar.TabNavigation;
                contextItem.BeginGroup = true;
                contextItem.Click     += new EventHandler(this.DockContextClick);
                item.SubItems.Add(contextItem);
                PopupItem popup = item as PopupItem;
            }
        }
Exemple #2
0
        public void menu_PopupOpen(Object sender, DevComponents.DotNetBar.PopupOpenEventArgs args)
        {
            ButtonItem  b     = (ButtonItem)sender;
            ChoiceGroup group = (ChoiceGroup)b.Tag;

            group.OnDisplay(sender, null);
            // If none of the menu items are visible, cancel the popup altogether.  See LT-4342.
            int cVisible = 0;

            for (int i = 0; i < b.SubItems.Count; ++i)
            {
                if (b.SubItems[i].Visible)
                {
                    ++cVisible;
                }
            }
            if (cVisible == 0)
            {
                args.Cancel = true;
            }
        }
Exemple #3
0
 private void contextMenuBar1_PopupOpen(object sender, DevComponents.DotNetBar.PopupOpenEventArgs e)
 {
     if (sideBar1.ExpandedPanel != null)
     {
         if (sideBar1.ExpandedPanel.ItemImageSize == eBarImageSize.Default)
         {
             bSmallIcons.Checked = true;
             bLargeIcons.Checked = false;
         }
         else
         {
             bSmallIcons.Checked = false;
             bLargeIcons.Checked = true;
         }
     }
     if (m_HotItem == null)
     {
         bRemoveItem.Enabled = false;
     }
     else
     {
         bRemoveItem.Enabled = true;
     }
 }
 protected override void OnPopupOpen(PopupOpenEventArgs e)
 {
     if (!m_ColorsInitialized)
         InitializeColorDropDown();
     base.OnPopupOpen(e);
 }
Exemple #5
0
 private void OverflowButton_PopupOpen(object sender, PopupOpenEventArgs e)
 {
     if (m_OverflowRibbonBar != null)
     {
         m_OverflowRibbonBar.BackgroundStyle.ApplyStyle(this.BackgroundStyle);
         m_OverflowRibbonBar.BackgroundMouseOverStyle.ApplyStyle(this.BackgroundMouseOverStyle);
         m_OverflowRibbonBar.TitleStyle.ApplyStyle(this.TitleStyle);
         m_OverflowRibbonBar.TitleStyleMouseOver.ApplyStyle(this.TitleStyleMouseOver);
         if (this.ShowKeyTips)
             m_OverflowRibbonBar.ShowKeyTips = true;
     }
 }
Exemple #6
0
 private void bar1_PopupOpen(object sender, DevComponents.DotNetBar.PopupOpenEventArgs e)
 {
     bar1.Text = "联系电话:13849176996";
 }
Exemple #7
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// This will make sure the appropriate item on the menu is checked.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		/// ------------------------------------------------------------------------------------
		private void Menu_PopupOpen(object sender, PopupOpenEventArgs e)
		{
			// Don't check any menu items if this tab item isn't the currently
			// visible tab.
			try
			{
				foreach (ButtonItem item in m_itemPanel.Items)
					((ButtonItem)m_menu.SubItems[item.Name]).Checked = (Checked && item.Checked);

				HandleConfigureMenuPopup(m_cfgMenuItem);
			}
			catch
			{
			}
		}
Exemple #8
0
 /// <summary>
 /// 處理學生狀態變更權限。
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void StatusContainer_PopupOpen(object sender, DevComponents.DotNetBar.PopupOpenEventArgs e)
 {
 }
Exemple #9
0
 /// <summary>
 /// Invokes GalleryPopupOpen event.
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnGalleryPopupOpen(object sender, PopupOpenEventArgs e)
 {
     if (GalleryPopupOpen != null)
         GalleryPopupOpen(sender, e);
 }
Exemple #10
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// When a menu item is popped-up, then cycle through the subitems and call update
		/// handlers.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void HandleMenuPopups(object sender, PopupOpenEventArgs e)
		{
			if (CancelMenuPopup())
			{
				e.Cancel = true;
				return;
			}

			ButtonItem item = sender as ButtonItem;

			// Item must be on a menu bar or menu or it must be a context menu.
			if (item == null || item.SystemItem || m_msgMediator == null ||
				(!item.IsOnMenu && !item.IsOnMenuBar && !m_dnbMngr.ContextMenus.Contains(item)))
			{
				return;
			}

			// If we're popping-up the toolbar list, then build it.
			if (item == m_toolbarListItem)
				BuildToolbarList();

			bool buildWindowList = false;
			foreach (ButtonItem subitem in item.SubItems)
			{
				if (subitem == m_windowListItem)
					buildWindowList = true;
				else
					CallItemUpdateHandler((BaseItem)subitem);
			}

			// Now that we've iterated through the subitems, if we found the window list
			// item or toolbar list item, build those lists.
			if (buildWindowList)
				BuildWindowList();

			// Turn off tooltips for context menus. Gets turned back on when popup is closed.
			if (m_dnbMngr.ContextMenus.Contains(item))
				m_dnbMngr.ShowToolTips = false;
		}
Exemple #11
0
		void IOwnerMenuSupport.InvokePopupOpen(PopupItem item,PopupOpenEventArgs e)
		{
			if(PopupOpen!=null)
				PopupOpen(item,e);
			#if TRIAL
			iCount++;
			#endif
		}
Exemple #12
0
		/// <summary>
		/// Displays the sub-items on popup menu.
		/// </summary>
		/// <param name="x">Horizontal coordinate in pixels of the upper left corner of a popup.</param>
		/// <param name="y">Vertical coordinate in pixels of the upper left corner of a popup.</param>
        /// <param name="verifyScreenPosition">Indicates whether screen position of the menu is verified so the menu always appears on the screen.</param>
		public virtual void PopupMenu(int x, int y, bool verifyScreenPosition)
		{
            PopupPositionAdjusted = false;
			IOwnerMenuSupport ownerMenu=this.GetIOwnerMenuSupport();

			//if(ownerMenu==null)
			//	throw(new InvalidOperationException("Current owner is not assigned or it does not have popup menu support."));

			System.Windows.Forms.Control objCtrl=this.ContainerControl as System.Windows.Forms.Control;

			if(ownerMenu!=null)
			{
                PopupOpenEventArgs args=new PopupOpenEventArgs();
                OnPopupOpen(args);
				if(args.Cancel)
				{
					this.Expanded=false;
					return;
				}
			}

			if(this.SubItemsImageSize.Width==ImageItem._InitalImageSize.Width && this.SubItemsImageSize.Height==ImageItem._InitalImageSize.Height)
			{
				m_OldSubItemsImageSize=this.SubItemsImageSize;
				this.SubItemsImageSize=new Size(16,16);
			}

			foreach(BaseItem objItem in this.SubItems)
				objItem.Orientation=eOrientation.Horizontal;

			if(m_PopupMenu==null)
			{
				m_PopupMenu=new MenuPanel();
				m_PopupMenu.Owner=this.GetOwner();
                m_PopupMenu.UseWholeScreenForSizeChecking = !verifyScreenPosition;

				if(m_PopupFont!=null)
					m_PopupMenu.Font=m_PopupFont;
                else if (objCtrl != null && objCtrl.Font != null)
                {
                    if (objCtrl.GetType().Name.Contains("MetroTabStrip") && objCtrl.Parent != null && objCtrl.Parent.Font != null)
                        m_PopupMenu.Font = objCtrl.Parent.Font;
                    else
                        m_PopupMenu.Font = objCtrl.Font; // (System.Drawing.Font)objCtrl.Font.Clone();
                }
				
				if(ownerMenu!=null && ownerMenu.AlwaysShowFullMenus)
					m_PopupMenu.PersonalizedMenus=ePersonalizedMenus.Disabled;
				else
                    m_PopupMenu.PersonalizedMenus=m_PersonalizedMenus;
				if(ownerMenu!=null && !ownerMenu.ShowFullMenusOnHover && (m_PopupMenu.PersonalizedMenus==ePersonalizedMenus.DisplayOnHover || m_PopupMenu.PersonalizedMenus==ePersonalizedMenus.Both))
					m_PopupMenu.PersonalizedMenus=ePersonalizedMenus.DisplayOnClick;

				m_PopupMenu.PopupAnimation=m_PopupAnimation;

				if(ownerMenu!=null && (this.IsOnMenuBar || this.IsOnMenu))
				{
					m_PopupMenu.PersonalizedAllVisible=ownerMenu.PersonalizedAllVisible;
				}

				if(this.Parent is CustomizeItem || this is CustomizeItem && !(this is QatCustomizeItem))
					m_PopupMenu.IsCustomizeMenu=true;

				if(objCtrl is Bar)
				{
                    Bar bar=(Bar)objCtrl;
                    m_PopupMenu.ColorScheme = bar.GetColorScheme();
                    m_PopupMenu.ShowToolTips = bar.ShowToolTips;
                    m_PopupMenu.AntiAlias = bar.AntiAlias;
                    if (objCtrl is ContextMenuBar)
                        m_PopupMenu.UseWholeScreenForSizeChecking = true;
				}
				else if(objCtrl is MenuPanel)
				{
                    MenuPanel menuPanel = (MenuPanel)objCtrl;
                    m_PopupMenu.ColorScheme = menuPanel.ColorScheme;
                    m_PopupMenu.ShowToolTips = menuPanel.ShowToolTips;
                    m_PopupMenu.AntiAlias = menuPanel.AntiAlias;
				}
				else if(objCtrl is SideBar)
					m_PopupMenu.ColorScheme=((SideBar)objCtrl).ColorScheme;
                else if (objCtrl is ExplorerBar)
                {
                    ExplorerBar eb = objCtrl as ExplorerBar;
                    m_PopupMenu.ColorScheme = eb.ColorScheme;
                    m_PopupMenu.AntiAlias = eb.AntiAlias;
                }
                else if (objCtrl is BarBaseControl)
                    m_PopupMenu.ColorScheme = ((BarBaseControl)objCtrl).ColorScheme;
                else if (objCtrl is ItemControl)
                {
                    ItemControl ic = (ItemControl)objCtrl;
                    m_PopupMenu.ColorScheme = ic.GetColorSchemeInternal();
                    m_PopupMenu.AntiAlias = ic.AntiAlias;
                }
                else if (objCtrl is PopupItemControl)
                {
                    PopupItemControl bx = (PopupItemControl)objCtrl;
                    m_PopupMenu.ColorScheme = bx.GetColorScheme();
                    m_PopupMenu.AntiAlias = bx.AntiAlias;
                }
                else
                {
                    if (this.Style == eDotNetBarStyle.StyleManagerControlled && GlobalManager.Renderer is Office2007Renderer)
                    {
                        m_PopupMenu.ColorScheme = ((Office2007Renderer)GlobalManager.Renderer).ColorTable.LegacyColors;
                    }
                    else
                    {
                        m_PopupMenu.ColorScheme = new ColorScheme(this.EffectiveStyle);
                    }
                    object own = this.GetOwner();
                    if (own is ItemControl)
                    {
                        m_PopupMenu.AntiAlias = ((ItemControl)own).AntiAlias;
                    }
                    else if (own is Bar)
                    {
                        m_PopupMenu.AntiAlias = ((Bar)own).AntiAlias;
                    }
                }

                if (objCtrl != null)
                    m_PopupMenu.RightToLeft = objCtrl.RightToLeft;

				m_PopupMenu.SideBar=m_SideBar;
				m_PopupMenu.ParentItem=this;
				m_PopupMenu.CreateControl();
				m_PopupMenu.RecalcSize();
			}

			// Make sure that menu is on-screen
			ScreenInformation objScreen=BarFunctions.ScreenFromPoint(new Point(x,y));
            if(objScreen == null && IsHandleValid(objCtrl))
				objScreen=BarFunctions.ScreenFromControl(objCtrl);

			Rectangle workingArea=objScreen.WorkingArea;
            if (this.Parent == null)
            {
                workingArea = objScreen.Bounds;
                m_PopupMenu.UseWholeScreenForSizeChecking = true;
            }

			if(this.IsRightHanded)
			{
				// When working with right-handed menus for TabletPC the coordinates passed here are
				// the upper right x,y coordinates since menus are right aligned...
				x-=m_PopupMenu.Width;
                if (objScreen != null && x < workingArea.Left && verifyScreenPosition)
				{
                    PopupPositionAdjusted = true;
					// Push it to the right side
					if(this.Displayed && objCtrl!=null && (m_PopupMenu.IsCustomizeMenu || this.IsOnMenu))
					{
						Point p,ps;
						
						if(m_PopupMenu.IsCustomizeMenu)
						{
							p=new Point(m_Rect.Right,m_Rect.Bottom);
						}
						else
						{
							p=new Point(m_Rect.Right,m_Rect.Top);
						}

						ps=objCtrl.PointToScreen(p);
						x=ps.X;
                        if (x + m_PopupMenu.Width > workingArea.Right)
                        {
                            x = workingArea.Right - m_PopupMenu.Width;
                        }
					}
					else
						x=workingArea.Left;
				}
			}
			else
			{
                if (objScreen != null && (x + m_PopupMenu.Width > workingArea.Right || x < workingArea.Left) && verifyScreenPosition)
                {
                    PopupPositionAdjusted = true;
                    if (x + m_PopupMenu.Width > workingArea.Right)
                    {
                        // Push it to the right side
                        if (this.Displayed && objCtrl != null && !(objCtrl is ContextMenuBar))
                        {
                            Point p, ps;

                            if (m_PopupMenu.IsCustomizeMenu)
                            {
                                p = new Point(m_Rect.Left, m_Rect.Bottom);
                            }
                            else
                            {
                                if (this.IsOnMenu)
                                    p = new Point(m_Rect.Left, m_Rect.Top);
                                else
                                    p = new Point(m_Rect.Right, m_Rect.Top);
                            }

                            ps = objCtrl.PointToScreen(p);
                            x = ps.X - m_PopupMenu.Width;
                            if (x + m_PopupMenu.Width > workingArea.Right)
                                x = workingArea.Right - m_PopupMenu.Width;
                        }
                        else
                            x = workingArea.Right - m_PopupMenu.Width;
                    }
                    else if (x < workingArea.Left)
                        x = workingArea.Left;
                }
			}

			// Try to fit whole popup menu "nicely"
            if (objScreen != null && verifyScreenPosition)
			{
                if (y + m_PopupMenu.Height > workingArea.Bottom)
                {
                    // If this container is displayed then try to put it above the menu item
                    if (this.Displayed && objCtrl != null && objCtrl.Visible)
                    {
                        Point p = new Point(m_Rect.Left, m_Rect.Bottom - 1), ps;
                        ps = objCtrl.PointToScreen(p);
                        ps.Y += 2;
                        if (ps.Y - m_PopupMenu.Height >= workingArea.Top)
                            y = Math.Min(workingArea.Bottom, ps.Y) - m_PopupMenu.Height;
                        else if (this is ApplicationButton)
                            y = workingArea.Bottom - m_PopupMenu.Height - 4;
                        else if (this is DevComponents.DotNetBar.Metro.MetroAppButton)
                            y = workingArea.Bottom - m_PopupMenu.Height - 4;
                    }
                    else
                        y = workingArea.Bottom - m_PopupMenu.Height;
                    if (y < workingArea.Top)
                        y = workingArea.Top;
                    PopupPositionAdjusted = true;
                }
			}
            x += _PopupOffset.X;
            y += _PopupOffset.Y;
			// If it still does not fit at this point, container will scale itself properly
			// And allow item scrolling
			m_PopupMenu.Location=new Point(x,y);

            OnPopupShowing(EventArgs.Empty);

			m_PopupMenu.Show();

            if (this.ContainerControl is IKeyTipsControl)
            {
                IKeyTipsControl kc = this.ContainerControl as IKeyTipsControl;
                m_PopupMenu.ShowKeyTips = kc.ShowKeyTips;
                kc.ShowKeyTips = false;
            }

			this.Expanded=true;
			
			if(ownerMenu!=null)
			{
				if(!(objCtrl is Bar) && !(objCtrl is MenuPanel))
				{
					ownerMenu.RegisterPopup(this);
					m_FilterInstalled=true;
				}
				else if(objCtrl is Bar)
				{
					Bar bar=objCtrl as Bar;
					if(bar.BarState!=eBarState.Popup)
					{
						ownerMenu.RegisterPopup(this);
						m_FilterInstalled=true;
					}		
					bar=null;
				}
			}
		}
Exemple #13
0
 /// <summary>
 /// Invokes PopupOpen event.
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnPopupOpen(PopupOpenEventArgs e)
 {
     if (PopupOpen != null)
         PopupOpen(this, e);
     if (!e.Cancel)
     {
         IOwnerMenuSupport ownerMenu = this.GetIOwnerMenuSupport();
         if(ownerMenu!=null)
             ownerMenu.InvokePopupOpen(this, e);
     }
 }
Exemple #14
0
		/// <summary>
		/// Displays the sub-items on popup toolbar.
		/// </summary>
		/// <param name="x">Horizontal coordinate in pixels of the upper left corner of a popup.</param>
		/// <param name="y">Vertical coordinate in pixels of the upper left corner of a popup.</param>
		public virtual void PopupBar(int x, int y)
		{
			//DotNetBarManager owner=this.GetOwner();
			IOwnerMenuSupport ownerMenu=this.GetIOwnerMenuSupport();
			//if(ownerMenu==null)
			//	throw(new InvalidOperationException("Current owner is not assigned or it does not have popup bar support."));

			System.Windows.Forms.Control objCtrl=this.ContainerControl as System.Windows.Forms.Control;

			if(ownerMenu!=null)
			{
				PopupOpenEventArgs args=new PopupOpenEventArgs();
				if(PopupOpen!=null)
					PopupOpen(this,args);
				if(!args.Cancel)
					ownerMenu.InvokePopupOpen(this,args);
				if(args.Cancel)
				{
					this.Expanded=false;
					return;
				}
			}

			foreach(BaseItem objItem in this.SubItems)
				objItem.Orientation=eOrientation.Horizontal;

			if(m_PopupBar==null)
			{
				m_PopupBar=new Bar();

				if(m_PopupFont!=null)
					m_PopupBar.Font=m_PopupFont;
				else if(objCtrl!=null && objCtrl.Font!=null)
					m_PopupBar.Font=(System.Drawing.Font)objCtrl.Font.Clone();
				if(objCtrl is Bar && ((Bar)objCtrl).ColorScheme!=null)
					m_PopupBar.ColorScheme=((Bar)objCtrl).ColorScheme;
				else if(objCtrl is MenuPanel && ((MenuPanel)objCtrl).ColorScheme!=null)
					m_PopupBar.ColorScheme=((MenuPanel)objCtrl).ColorScheme;
                else if (objCtrl is ItemControl && ((ItemControl)objCtrl).ColorScheme != null)
                    m_PopupBar.ColorScheme = ((ItemControl)objCtrl).ColorScheme;
                else if (objCtrl is ButtonX && ((ButtonX)objCtrl).ColorScheme != null)
                    m_PopupBar.ColorScheme = ((ButtonX)objCtrl).ColorScheme;
				else
                    m_PopupBar.ColorScheme = new ColorScheme(this.EffectiveStyle);
				m_PopupBar.SetBarState(eBarState.Popup);
				m_PopupBar.PopupAnimation=m_PopupAnimation;
				m_PopupBar.Owner=this.GetOwner();
				m_PopupBar.ParentItem=this;
                if(objCtrl!=null)
                    m_PopupBar.RightToLeft = objCtrl.RightToLeft;
				m_PopupBar.CreateControl();
				m_PopupBar.SetDesignMode(this.DesignMode);
				m_PopupBar.ThemeAware=this.ThemeAware;
				
				if(objCtrl is IBarImageSize)
					m_PopupBar.ImageSize=((IBarImageSize)objCtrl).ImageSize;					

				m_PopupBar.PopupWidth=m_PopupWidth;

				m_PopupBar.RecalcSize();
			}

			// Make sure that menu is on-screen
			ScreenInformation objScreen=null;
			if(IsHandleValid(objCtrl))
			{
				objScreen=BarFunctions.ScreenFromControl(objCtrl);
			}
			else
			{
				objScreen=BarFunctions.ScreenFromPoint(new Point(x,y));
			}

			if(this.IsRightHanded)
				x-=m_PopupBar.Width;

			if(objScreen!=null && x+m_PopupBar.Width>objScreen.WorkingArea.Right)
			{
				// Push it to the right side
				x=objScreen.WorkingArea.Right-m_PopupBar.Width;
			}
			else if(objScreen!=null && x<objScreen.WorkingArea.Left)
				x=objScreen.WorkingArea.Left;

			// Try to fit whole popup menu "nicely"
			if(objScreen!=null && y+m_PopupBar.Height>objScreen.WorkingArea.Bottom)
			{
				// If this container is displayed then try to put it above the menu item
				if(this.Displayed && objCtrl!=null)
				{
					Point p=new Point(m_Rect.Left,m_Rect.Bottom), ps;
					ps=objCtrl.PointToScreen(p);
					ps.Y+=2;
					if(ps.Y-m_PopupBar.Height>=objScreen.WorkingArea.Top)
						y=ps.Y-m_PopupBar.Height;
				}
			}

            x += _PopupOffset.X;
            y += _PopupOffset.Y;

			// If it still does not fit at this point, container will scale itself properly
			// And allow item scrolling
			m_PopupBar.Location=new Point(x,y);
			if(ownerMenu!=null)
				ownerMenu.InvokePopupShowing(this,new EventArgs());
			m_PopupBar.ShowBar();
			this.Expanded=true;
			
			if(ownerMenu!=null)
			{
				if(!(objCtrl is Bar) && !(objCtrl is MenuPanel))
				{
					ownerMenu.RegisterPopup(this);
					m_FilterInstalled=true;
				}
				else if(objCtrl is Bar)
				{
					Bar bar=objCtrl as Bar;
					if(bar.BarState!=eBarState.Popup)
					{
						ownerMenu.RegisterPopup(this);
						m_FilterInstalled=true;
					}		
					bar=null;
				}
			}
		}
Exemple #15
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// When the side bar's context menu pops-up, we need to make sure the correct icon
		/// mode menu item is checked.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		/// ------------------------------------------------------------------------------------
		private void HandleSideBarContextMenuPopup(object sender, PopupOpenEventArgs e)
		{
			ButtonItem contextMenu = sender as ButtonItem;
			if (contextMenu == null || contextMenu.SubItems.Count == 0)
				return;

			SideBarTab tab = m_navPane.CheckedButton as SideBarTab;
			if (tab == null)
				return;

			// Setting the first item in the context menu will automatically adjust the
			// other item appropriately since they're both in the same option group.
			if (m_contextMenu.SubItems[0].Name == kLargeIconModeItem)
				((ButtonItem)m_contextMenu.SubItems[0]).Checked = !tab.SmallIconMode;
			else if (m_contextMenu.SubItems[0].Name == kSmallIconModeItem)
				((ButtonItem)m_contextMenu.SubItems[0]).Checked = tab.SmallIconMode;

			// Make only one configure menu visible. (i.e. the one corresponding to the
			// current tab. When the proper configure menu is found, then call its
			// update handler.
			for (int i = 3; i < m_contextMenu.SubItems.Count; i++)
			{
				m_contextMenu.SubItems[i].Visible =
					(m_contextMenu.SubItems[i].Name == CurrentTab.ConfigureMenuItem.Name);

				if (m_contextMenu.SubItems[i].Visible)
					CurrentTab.HandleConfigureMenuPopup(m_contextMenu.SubItems[i] as ButtonItem);
			}
		}
Exemple #16
0
 private void PopupGallery_PopupOpen(object sender, PopupOpenEventArgs e)
 {
     OnGalleryPopupOpen(sender, e);
 }
Exemple #17
0
        private void cmScriptOp_PopupOpen(object sender, PopupOpenEventArgs e)
        {
            DBCustomClass cls = GetCanDeleteRecord();
            bDeleteRecord.Enabled = cls != null;
            // 检查是否可以新建记录
            PageDesc page = (PageDesc)m_Pages[this.tabControl1.SelectedTabIndex - 1];
            if (page.pg == null)
                return;
            GridItem item = page.pg.SelectedGridItem;
            if (item == null)
            {
                bAddRecord.Enabled = false;
            }
            else
            {
                DBCustomClass dbClass = item.Value as DBCustomClass;
                if (dbClass == null || dbClass.ParentFieldType == 0)
                {
                    bAddRecord.Enabled = false;
                }
                else
                {

                    bAddRecord.Enabled = true;
                }
            }

            // 权限相关
            if (Program.m_bUseNewAcl)
            {
                if (!this.CanSaveDB)
                {
                    bEditFile.Enabled = false;
                    bDeleteRecord.Enabled = false;
                    bAddRecord.Enabled = false;
                    bClear.Enabled = false;
                    bClearContent.Enabled = false;
                }
                if (!this.CanCfg)
                {
                    bShowLuaCode.Enabled = false;
                    bShowMetainfo.Enabled = false;
                }
            }
        }
Exemple #18
0
 void IOwnerMenuSupport.InvokePopupOpen(PopupItem item, PopupOpenEventArgs e)
 {
     if (PopupOpen != null)
         PopupOpen(item, e);
 }
Exemple #19
0
        protected internal override void OnExpandChange()
        {
            m_ThumbTucked = false;
            if (!this.DesignMode && this.Expanded && this.PopupLocation.IsEmpty && this.PopupSide == ePopupSide.Default &&
                (this.Parent is CaptionItemContainer ||
                this.Parent is RibbonTabItemContainer))
            {
                if (this.SubItems.Count > 0 && this.SubItems[0] is ItemContainer &&
                    ((ItemContainer)this.SubItems[0]).BackgroundStyle.Class == ElementStyleClassKeys.RibbonFileMenuContainerKey)
                {
                    RibbonStrip rs = this.ContainerControl as RibbonStrip;
                    if (rs != null)
                    {
                        if (this.Parent is RibbonTabItemContainer)
                        {
                            if (this.EffectiveStyle == eDotNetBarStyle.Windows7)
                                this.PopupLocation = new Point(this.IsRightToLeft ? this.Bounds.Right : this.LeftInternal, this.TopInternal - 1);
                            else if(this.EffectiveStyle == eDotNetBarStyle.Metro)
                                this.PopupLocation = new Point(this.IsRightToLeft ? this.Bounds.Right : this.LeftInternal - 4, this.TopInternal - 1);
                            else
                                this.PopupLocation = new Point(this.IsRightToLeft ? this.Bounds.Right : this.LeftInternal, this.TopInternal);
                        }
                        else
                            this.PopupLocation = new Point(this.IsRightToLeft ? this.Bounds.Right : this.LeftInternal, rs.GetItemContainerBounds().Y - 1);
                        m_ThumbTucked = true;
                    }
                }
            }

            _WasMaximized = false;
            if (_BackstageTab != null && _BackstageTabEnabled)
            {
                if (this.Expanded)
                {
                    PopupOpenEventArgs args = new PopupOpenEventArgs();
                    OnPopupOpen(args);
                    if (args.Cancel)
                    {
                        this.Expanded = false;
                        return;
                    }

                    if (EffectiveStyle == eDotNetBarStyle.Metro)
                    {
                        CreateBackstageBackButton();
                        if (_BackstageTab.Parent is Form && ((Form)_BackstageTab.Parent).WindowState == FormWindowState.Maximized)
                            _WasMaximized = true;
                    }
                    else
                        RemoveBackstageBackButton();
                    
                    UpdateBackstageTabSize();

                    if (this.ContainerControl is IKeyTipsControl)
                    {
                        IKeyTipsControl kc = this.ContainerControl as IKeyTipsControl;
                        _BackstageTab.TabStrip.ShowKeyTips = kc.ShowKeyTips;
                        kc.ShowKeyTips = false;
                    }
                    OnPopupShowing(EventArgs.Empty);
                    _BackstageTab.Visible = true;
                    _BackstageTab.BringToFront();
                    _BackstageTab.Focus();

                    if (_BackstageTab.SelectedPanel != null)
                        _BackstageTab.SelectedPanel.BringToFront();
                    
                    RibbonStrip strip = this.RibbonStrip;
                    if (EffectiveStyle == eDotNetBarStyle.Metro && strip != null)
                    {
                        ((RibbonStripContainerItem)strip.GetBaseItemContainer()).MetroBackstageOpen = true;
                        strip.TabGroupPaintSuspended = true;
                    }
                    if (strip != null && strip.SelectedRibbonTabItem != null)
                    {
                        _LastSelectedRibbonTabItem = strip.SelectedRibbonTabItem;
                        if (this.DesignMode)
                            _LastSelectedRibbonTabItem.RenderTabState = false;
                        else
                            _LastSelectedRibbonTabItem.Checked = false;
                    }


                }
                else
                {
                    OnPopupClose(EventArgs.Empty);
                    if (_LastSelectedRibbonTabItem != null)
                    {
                        if (this.DesignMode)
                            _LastSelectedRibbonTabItem.RenderTabState = true;
                        else
                            _LastSelectedRibbonTabItem.Checked = true;
                        _LastSelectedRibbonTabItem = null;
                    }
                    if (this.ContainerControl is IKeyTipsControl)
                    {
                        IKeyTipsControl kc = this.ContainerControl as IKeyTipsControl;
                        kc.ShowKeyTips = _BackstageTab.TabStrip.ShowKeyTips;
                        _BackstageTab.TabStrip.ShowKeyTips = false;
                    }
                    _BackstageTab.Visible = false;
                    RibbonStrip strip = this.ContainerControl as RibbonStrip;

                    if (EffectiveStyle == eDotNetBarStyle.Metro)
                    {
                        _BackstageTab.Resize -= BackstageTabResized;
                        if (strip != null)
                        {
                            ((RibbonStripContainerItem)strip.GetBaseItemContainer()).MetroBackstageOpen = false;
                            strip.TabGroupPaintSuspended = false;
                        }
                    }

                    if (strip != null)
                    {
                        strip.BackstageTabClosed(_BackstageTab);
                        strip.Invalidate();
                    }
                    OnPopupFinalized(EventArgs.Empty);
                }
                RaiseExpandChange(EventArgs.Empty);
                return;
            }

            base.OnExpandChange();
        }