Example #1
0
        public static RibbonTabItemGroup CreateRibbonTabItemGroup(RibbonStrip strip, IServiceProvider provider)
		{
			IDesignerHost dh=provider.GetService(typeof(IDesignerHost)) as IDesignerHost;
			IComponentChangeService cc=provider.GetService(typeof(IComponentChangeService)) as IComponentChangeService;
			if(dh==null || cc==null) return null;
            
			DesignerTransaction trans=dh.CreateTransaction("New RibbonTabItemGroup");
			RibbonTabItemGroup group=null;
			try
			{
				group=dh.CreateComponent(typeof(RibbonTabItemGroup)) as RibbonTabItemGroup;
				cc.OnComponentChanging(strip,TypeDescriptor.GetProperties(strip)["TabGroups"]);
				strip.TabGroups.Add(group);				
				cc.OnComponentChanged(strip,TypeDescriptor.GetProperties(strip)["TabGroups"],null,null);
				SetDefaults(group);
			}
			catch
			{
				trans.Cancel();
				throw;
			}
			finally
			{
				if(!trans.Canceled)
					trans.Commit();
			}
			return group;
		}
Example #2
0
        /// <summary>
        /// Creates new instance of the class and initializes it with the parent RibbonStrip control.
        /// </summary>
        /// <param name="parent">Reference to parent RibbonStrip control</param>
        public RibbonStripContainerItem(RibbonStrip parent)
        {
            m_RibbonStrip = parent;

            // We contain other controls
            m_IsContainer = true;
            this.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;

            m_ItemContainer = new RibbonTabItemContainer();
            m_ItemContainer.ContainerControl = parent;
            m_ItemContainer.GlobalItem = false;
            m_ItemContainer.WrapItems = false;
            m_ItemContainer.EventHeight = false;
            m_ItemContainer.UseMoreItemsButton = false;
            m_ItemContainer.Stretch = true;
            m_ItemContainer.Displayed = true;
            m_ItemContainer.SystemContainer = true;
            m_ItemContainer.PaddingTop = 0;
            m_ItemContainer.PaddingBottom = 0;
            m_ItemContainer.ItemSpacing = 1;

            m_CaptionContainer = new CaptionItemContainer();
            m_CaptionContainer.ContainerControl = parent;
            m_CaptionContainer.GlobalItem = false;
            m_CaptionContainer.WrapItems = false;
            m_CaptionContainer.EventHeight = false;
            m_CaptionContainer.EqualButtonSize = false;
            m_CaptionContainer.ToolbarItemsAlign = eContainerVerticalAlignment.Top;
            m_CaptionContainer.UseMoreItemsButton = false;
            m_CaptionContainer.Stretch = true;
            m_CaptionContainer.Displayed = true;
            m_CaptionContainer.SystemContainer = true;
            m_CaptionContainer.PaddingBottom = 0;
            m_CaptionContainer.PaddingTop = 0;
            m_CaptionContainer.ItemSpacing = 1;
            m_CaptionContainer.TrackSubItemsImageSize = false;
            m_CaptionContainer.ItemAdded += new EventHandler(this.CaptionContainerNewItemAdded);
            this.SubItems.Add(m_CaptionContainer);
            this.SubItems.Add(m_ItemContainer);

            SystemCaptionItem sc = new SystemCaptionItem();
            sc.RestoreEnabled = false;
            sc.IsSystemIcon = false;
            sc.ItemAlignment = eItemAlignment.Far;
            m_CaptionContainer.SubItems.Add(sc);
            m_SystemCaptionItem = sc;

        }
Example #3
0
 /// <summary>
 /// Called when right-mouse button is pressed over RibbonStrip
 /// </summary>
 /// <param name="ribbonStrip">Reference to RibbonStrip object.</param>
 internal void OnRibbonStripRightClick(RibbonStrip ribbonStrip, int x, int y)
 {
     if (!DisplayCustomizeContextMenu)
         return;
     BaseItem item = ribbonStrip.HitTest(x, y);
     if (item != null && item.CanCustomize && !item.SystemItem)
     {
         ShowCustomizeContextMenu(item, true);
     }
 }
Example #4
0
        public RibbonControl()
        {
            // This forces the initialization out of paint loop which speeds up how fast components show up
            BaseRenderer renderer = Rendering.GlobalManager.Renderer;

            m_QatFrequentCommands.IgnoreEvents = true;
            m_QatFrequentCommands.AllowParentRemove = false;

            this.SetStyle(ControlStyles.AllPaintingInWmPaint
                  | ControlStyles.ResizeRedraw
                  | DisplayHelp.DoubleBufferFlag
                  | ControlStyles.UserPaint
                  | ControlStyles.Opaque
                  , true);
            m_RibbonStrip = new RibbonStrip();
            m_RibbonStrip.Dock = DockStyle.Top;
            m_RibbonStrip.Height = 32;
            m_RibbonStrip.ItemAdded += new System.EventHandler(RibbonStripItemAdded);
            m_RibbonStrip.SizeChanged += new System.EventHandler(RibbonStripSizeChanged);
            m_RibbonStrip.ItemRemoved += new ItemControl.ItemRemovedEventHandler(RibbonStripItemRemoved);
            m_RibbonStrip.LocalizeString += new DotNetBarManager.LocalizeStringEventHandler(RibbonStripLocalizeString);
            m_RibbonStrip.ItemClick += new System.EventHandler(RibbonStripItemClick);
            m_RibbonStrip.ButtonCheckedChanged += new EventHandler(RibbonStripButtonCheckedChanged);
            m_RibbonStrip.TitleTextMarkupLinkClick += new MarkupLinkClickEventHandler(RibbonStripTitleTextMarkupLinkClick);
            this.Controls.Add(m_RibbonStrip);
            this.TabStop = false;
            this.DockPadding.Bottom = DefaultBottomDockPadding;

            StyleManager.Register(this);
        }