Exemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Handle choices from the sidebar's context menu.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// ------------------------------------------------------------------------------------
        private void HandleSideBarContextMenuClick(object sender, EventArgs e)
        {
            ButtonItem item = sender as ButtonItem;

            if (item == null)
            {
                return;
            }

            SideBarTab tab = m_navPane.CheckedButton as SideBarTab;

            if (tab == null)
            {
                return;
            }

            if (item.Name == kLargeIconModeItem)
            {
                tab.SmallIconMode = false;
            }
            else if (item.Name == kSmallIconModeItem)
            {
                tab.SmallIconMode = true;
            }
            else if (item.Name == kHideSideBar)
            {
                m_mediator.SendMessage("SideBar", null);
            }
        }
Exemplo n.º 2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Called from the TMAdapter when one of the view menu items needs to be updated.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected bool OnUpdateSideBarViewTabItemMenuHandler(object args)
        {
            TMItemProperties itemProps = args as TMItemProperties;

            if (itemProps == null)
            {
                return(false);
            }

            SBTabItemProperties tabProps = itemProps.Tag as SBTabItemProperties;

            if (tabProps == null)
            {
                return(false);
            }

            SideBarTab tab = m_navPane.Items[tabProps.OwningTabName] as SideBarTab;

            if (tab == null)
            {
                return(false);
            }

            itemProps.Checked = (tab == CurrentTab && tab.CurrentItemProps.Name == itemProps.Name);
            itemProps.Update  = true;
            return(true);
        }
Exemplo n.º 3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Adds an item to the specified tab.
        /// </summary>
        /// <param name="tabName"></param>
        /// <param name="itemProps"></param>
        /// ------------------------------------------------------------------------------------
        public void AddTabItem(string tabName, SBTabItemProperties itemProps)
        {
            SideBarTab tab = m_navPane.Items[tabName] as SideBarTab;

            if (tab != null)
            {
                tab.AddTabItem(itemProps);
            }
        }
Exemplo n.º 4
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Returns the properties for the specified item on the specified tab.
        /// </summary>
        /// <param name="tabName">Tab containing the item.</param>
        /// <param name="itemName">Item whose properties are being requested.</param>
        /// <returns></returns>
        /// ------------------------------------------------------------------------------------
        public SBTabItemProperties GetTabItemProperties(string tabName, string itemName)
        {
            SideBarTab tab = m_navPane.Items[tabName] as SideBarTab;

            if (tab == null)
            {
                return(null);
            }

            return(tab.GetItemProps(itemName));
        }
Exemplo n.º 5
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Sets the current sidebar tab item.
 /// </summary>
 /// <param name="tabName">Name of tab containing the tab item to make current.</param>
 /// <param name="itemName">Name of tab item to make current.</param>
 /// <param name="generateEvents"><c>true</c> to cause events to be fired when setting
 /// the current sidebar tab item (like when the user clicks on an item). Otherwise,
 /// <c>false</c>.</param>
 /// ------------------------------------------------------------------------------------
 public void SetCurrentTabItem(string tabName, string itemName, bool generateEvents)
 {
     if (m_navPane.Items.Contains(tabName))
     {
         SideBarTab tab = m_navPane.Items[tabName] as SideBarTab;
         if (tab != null)
         {
             tab.SetCurrentTabItem(itemName, generateEvents);
         }
     }
 }
Exemplo n.º 6
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Handle the current tab changing.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// ------------------------------------------------------------------------------------
        private void m_navPane_PanelChanging(object sender, PanelChangingEventArgs e)
        {
            if (m_supressAutoEvent)
            {
                return;
            }

            SideBarTab tab = e.NewPanel.ParentItem as SideBarTab;

            // Post a message to click a button in the new tab. The post will allow the panel
            // to redraw before dispatching the click.
            if (m_mediator != null && tab != null && tab.Message != null)
            {
                m_mediator.PostMessage(tab.Message, tab.Properties);
            }
        }
Exemplo n.º 7
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Make sure the tooltip for the info. bar buttons are up-to-date.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// ------------------------------------------------------------------------------------
        private void InfoBarButton_MouseEnter(object sender, EventArgs e)
        {
            PanelEx infoBarButton = sender as PanelEx;

            if (infoBarButton == null)
            {
                return;
            }

            SideBarTab tab = infoBarButton.Tag as SideBarTab;

            if (tab == null)
            {
                return;
            }

            m_tooltip.SetToolTip(infoBarButton, tab.InfoBarButtonToolTipText);
        }
Exemplo n.º 8
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);
                }
            }
        }
Exemplo n.º 9
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void PositionInfoBarButtons()
        {
            m_infoBar.SuspendLayout();

            int left = m_infoBar.ClientRectangle.Width - 5;

            for (int i = m_navPane.Items.Count - 1; i >= 0; i--)
            {
                SideBarTab tab = m_navPane.Items[i] as SideBarTab;
                if (tab == null)
                {
                    continue;
                }

                left -= (tab.InfoBarButton.Width);
                tab.InfoBarButton.Location =
                    new Point(left, (m_infoBar.Height - tab.InfoBarButton.Height) / 2);
            }

            m_infoBar.ResumeLayout();
        }
Exemplo n.º 10
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// <param name="tabProps"></param>
        /// <param name="infoBarButton"></param>
        /// ------------------------------------------------------------------------------------
        public void AddTab(SBTabProperties tabProps)
        {
            if (tabProps == null)
            {
                return;
            }

            SideBarTab tab = new SideBarTab(this, m_mediator, tabProps);

            tab.ItemImageListSmall        = ItemImageListSmall;
            tab.ItemImageListLarge        = ItemImageListLarge;
            tab.InfoBarButton.MouseEnter += new EventHandler(InfoBarButton_MouseEnter);
            m_dnbMngr.ContextMenus.Add(tab.Menu);
            m_infoBar.Controls.Add(tab.InfoBarButton);
            PositionInfoBarButtons();

            // Add the new tab's configure menu item to the side bar's context menu.
            ButtonItem tabCfgMenuItem = (ButtonItem)tab.ConfigureMenuItem.Copy();

            tabCfgMenuItem.Visible = true;
            m_contextMenu.SubItems.Add(tabCfgMenuItem);
        }
Exemplo n.º 11
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// <param name="tabProps"></param>
		/// <param name="infoBarButton"></param>
		/// ------------------------------------------------------------------------------------
		public void AddTab(SBTabProperties tabProps)
		{
			if (tabProps == null)
				return;

			SideBarTab tab = new SideBarTab(this, m_mediator, tabProps);
			tab.ItemImageListSmall = ItemImageListSmall;
			tab.ItemImageListLarge = ItemImageListLarge;
			tab.InfoBarButton.MouseEnter += new EventHandler(InfoBarButton_MouseEnter);
			m_dnbMngr.ContextMenus.Add(tab.Menu);
			m_infoBar.Controls.Add(tab.InfoBarButton);
			PositionInfoBarButtons();

			// Add the new tab's configure menu item to the side bar's context menu.
			ButtonItem tabCfgMenuItem = (ButtonItem)tab.ConfigureMenuItem.Copy();
			tabCfgMenuItem.Visible = true;
			m_contextMenu.SubItems.Add(tabCfgMenuItem);
		}