Inheritance: System.ComponentModel.Component
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroup class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonGroup">Reference to ribbon group this represents.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroup(KryptonRibbon ribbon,
                                   KryptonRibbonGroup ribbonGroup,
                                   NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonGroup != null);
            Debug.Assert(needPaint != null);

            // Cache source of state specific settings
            _ribbon      = ribbon;
            _ribbonGroup = ribbonGroup;
            _needPaint   = needPaint;

            // Associate this view with the source component (required for design time selection)
            Component = _ribbonGroup;

            CreateNormalView();
            CreateCollapsedView();

            // We are always created in the normal state
            Add(_layoutNormalMain);

            // Set back reference to the actual group definition
            _ribbonGroup.GroupView = this;

            // Hook into changes in the ribbon button definition
            _ribbonGroup.PropertyChanged += OnGroupPropertyChanged;
        }
        private void OnAddGroup(object sender, EventArgs e)
        {
            if ((_ribbonTab?.Ribbon != null) && _ribbonTab.Ribbon.RibbonTabs.Contains(_ribbonTab))
            {
                // Use a transaction to support undo/redo actions
                DesignerTransaction transaction = _designerHost.CreateTransaction("KryptonRibbonTab AddGroup");

                try
                {
                    // Get access to the Groups property
                    MemberDescriptor propertyGroups = TypeDescriptor.GetProperties(_ribbonTab)["Groups"];

                    RaiseComponentChanging(propertyGroups);

                    // Get designer to create the new group component
                    KryptonRibbonGroup group = (KryptonRibbonGroup)_designerHost.CreateComponent(typeof(KryptonRibbonGroup));
                    _ribbonTab.Groups.Add(group);

                    RaiseComponentChanged(propertyGroups, null, null);
                }
                finally
                {
                    // If we managed to create the transaction, then do it
                    transaction?.Commit();
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Initialize a new instance of the VisualPopupGroup class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonGroup">Reference to ribbon group for display.</param>
        /// <param name="renderer">Drawing renderer.</param>
        public VisualPopupGroup(KryptonRibbon ribbon,
                                KryptonRibbonGroup ribbonGroup,
                                IRenderer renderer)
            : base(renderer, true)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonGroup != null);

            // Remember references needed later
            _ribbon      = ribbon;
            _ribbonGroup = ribbonGroup;

            // Create a view element for drawing the group
            ViewGroup = new ViewDrawRibbonGroup(ribbon, ribbonGroup, NeedPaintDelegate)
            {
                Collapsed = false
            };

            // Create the background that will contain the actual group instance
            _viewBackground = new ViewDrawRibbonGroupsBorder(ribbon, true, NeedPaintDelegate)
            {
                ViewGroup
            };

            // Attach the root to the view manager instance
            ViewManager = new ViewRibbonPopupGroupManager(this, ribbon, _viewBackground, ViewGroup, NeedPaintDelegate);

            // Create and add a hidden button to act as the focus target
            _hiddenFocusTarget = new Button
            {
                TabStop = false
            };
            _hiddenFocusTarget.Location = new Point(-_hiddenFocusTarget.Width, -_hiddenFocusTarget.Height);
            CommonHelper.AddControlToParent(this, _hiddenFocusTarget);
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes the designer with the specified component.
        /// </summary>
        /// <param name="component">The IComponent to associate the designer with.</param>
        public override void Initialize(IComponent component)
        {
            Debug.Assert(component != null);

            // Validate the parameter reference
            if (component == null)
            {
                throw new ArgumentNullException(nameof(component));
            }

            // Let base class do standard stuff
            base.Initialize(component);

            // Cast to correct type
            _ribbonGroup = (KryptonRibbonGroup)component;
            _ribbonGroup.DesignTimeAddTriple    += OnAddTriple;
            _ribbonGroup.DesignTimeAddLines     += OnAddLines;
            _ribbonGroup.DesignTimeAddSeparator += OnAddSep;
            _ribbonGroup.DesignTimeAddGallery   += OnAddGallery;
            _ribbonGroup.DesignTimeContextMenu  += OnContextMenu;

            // Get access to the services
            _designerHost  = (IDesignerHost)GetService(typeof(IDesignerHost));
            _changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService));

            // We need to know when we are being removed/changed
            _changeService.ComponentRemoving += OnComponentRemoving;
            _changeService.ComponentChanged  += OnComponentChanged;
        }
        private void OnClearGroups(object sender, EventArgs e)
        {
            if ((_ribbonTab?.Ribbon != null) && _ribbonTab.Ribbon.RibbonTabs.Contains(_ribbonTab))
            {
                // Use a transaction to support undo/redo actions
                DesignerTransaction transaction = _designerHost.CreateTransaction("KryptonRibbonTab ClearGroups");

                try
                {
                    // Get access to the Groups property
                    MemberDescriptor propertyGroups = TypeDescriptor.GetProperties(_ribbonTab)["Groups"];

                    RaiseComponentChanging(propertyGroups);

                    // Need access to host in order to delete a component
                    IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));

                    // We need to remove all the groups from the tab
                    for (int i = _ribbonTab.Groups.Count - 1; i >= 0; i--)
                    {
                        KryptonRibbonGroup group = _ribbonTab.Groups[i];
                        _ribbonTab.Groups.Remove(group);
                        host.DestroyComponent(group);
                    }

                    RaiseComponentChanged(propertyGroups, null, null);
                }
                finally
                {
                    // If we managed to create the transaction, then do it
                    transaction?.Commit();
                }
            }
        }
        /// <summary>
        /// Initialize a new instance of the VisualPopupGroup class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonGroup">Reference to ribbon group for display.</param>
        /// <param name="renderer">Drawing renderer.</param>
        public VisualPopupGroup(KryptonRibbon ribbon,
                                KryptonRibbonGroup ribbonGroup,
                                IRenderer renderer)
            : base(renderer, true)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonGroup != null);

            // Remember references needed later
            _ribbon = ribbon;
            _ribbonGroup = ribbonGroup;

            // Create a view element for drawing the group
            _viewGroup = new ViewDrawRibbonGroup(ribbon, ribbonGroup, NeedPaintDelegate);
            _viewGroup.Collapsed = false;

            // Create the background that will contain the actual group instance
            _viewBackground = new ViewDrawRibbonGroupsBorder(ribbon, true, NeedPaintDelegate);
            _viewBackground.Add(_viewGroup);

            // Attach the root to the view manager instance
            ViewManager = new ViewRibbonPopupGroupManager(this, ribbon, _viewBackground, _viewGroup, NeedPaintDelegate);

            // Create and add a hidden button to act as the focus target
            _hiddenFocusTarget = new Button();
            _hiddenFocusTarget.TabStop = false;
            _hiddenFocusTarget.Location = new Point(-_hiddenFocusTarget.Width, -_hiddenFocusTarget.Height);
            CommonHelper.AddControlToParent(this, _hiddenFocusTarget);
        }
Esempio n. 7
0
        private void OnMoveLast(object sender, EventArgs e)
        {
            if ((_ribbonSeparator?.Ribbon != null) && _ribbonSeparator.RibbonGroup.Items.Contains(_ribbonSeparator))
            {
                // Use a transaction to support undo/redo actions
                DesignerTransaction transaction = _designerHost.CreateTransaction("KryptonRibbonGroupSeparator MoveLast");

                try
                {
                    // Get access to the Items property
                    MemberDescriptor propertyItems = TypeDescriptor.GetProperties(_ribbonSeparator.RibbonGroup)["Items"];

                    RaiseComponentChanging(propertyItems);

                    // Move position of the triple
                    KryptonRibbonGroup ribbonGroup = _ribbonSeparator.RibbonGroup;
                    ribbonGroup.Items.Remove(_ribbonSeparator);
                    ribbonGroup.Items.Insert(ribbonGroup.Items.Count, _ribbonSeparator);
                    UpdateVerbStatus();

                    RaiseComponentChanged(propertyItems, null, null);
                }
                finally
                {
                    // If we managed to create the transaction, then do it
                    transaction?.Commit();
                }
            }
        }
 /// <summary>
 /// Initialize a new instance of the ViewDrawRibbonDesignGroup class.
 /// </summary>
 /// <param name="ribbon">Reference to owning ribbon control.</param>
 /// <param name="ribbonGroup">Associated ribbon group.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public ViewDrawRibbonDesignGroupContainer(KryptonRibbon ribbon,
                                           KryptonRibbonGroup ribbonGroup,
                                           NeedPaintHandler needPaint)
     : base(ribbon, needPaint)
 {
     Debug.Assert(ribbonGroup != null);
     _ribbonGroup = ribbonGroup;
 }
 /// <summary>
 /// Initialize a new instance of the ViewDrawRibbonDesignGroup class.
 /// </summary>
 /// <param name="ribbon">Reference to owning ribbon control.</param>
 /// <param name="ribbonGroup">Associated ribbon group.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public ViewDrawRibbonDesignGroupContainer(KryptonRibbon ribbon,
                                           KryptonRibbonGroup ribbonGroup,
                                           NeedPaintHandler needPaint)
     : base(ribbon, needPaint)
 {
     Debug.Assert(ribbonGroup != null);
     _ribbonGroup = ribbonGroup;
 }
        /// <summary>
        /// Initialize a new instance of the ViewLayoutRibbonGroupButton class.
        /// </summary>
        /// <param name="ribbon">Owning control instance.</param>
        /// <param name="ribbonGroup">Reference to ribbon group this represents.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewLayoutRibbonGroupButton(KryptonRibbon ribbon,
                                           KryptonRibbonGroup ribbonGroup,
                                           NeedPaintHandler needPaint)
        {
            _groupButton = new ViewDrawRibbonGroupDialogButton(ribbon, ribbonGroup, needPaint);
            _centerButton = new ViewLayoutRibbonCenter();

            // Fill remainder with the actual button, but centered within space
            _centerButton.Add(_groupButton);
            Add(_centerButton, ViewDockStyle.Fill);
        }
Esempio n. 11
0
        /// <summary>
        /// Initialize a new instance of the ViewLayoutRibbonGroupButton class.
        /// </summary>
        /// <param name="ribbon">Owning control instance.</param>
        /// <param name="ribbonGroup">Reference to ribbon group this represents.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewLayoutRibbonGroupButton(KryptonRibbon ribbon,
                                           KryptonRibbonGroup ribbonGroup,
                                           NeedPaintHandler needPaint)
        {
            _groupButton  = new ViewDrawRibbonGroupDialogButton(ribbon, ribbonGroup, needPaint);
            _centerButton = new ViewLayoutRibbonCenter();

            // Fill remainder with the actual button, but centered within space
            _centerButton.Add(_groupButton);
            Add(_centerButton, ViewDockStyle.Fill);
        }
Esempio n. 12
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupImage class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonGroup">Reference to ribbon group definition.</param>
        /// <param name="viewGroup">Reference to top level group element.</param>
        public ViewDrawRibbonGroupImage(KryptonRibbon ribbon,
                                        KryptonRibbonGroup ribbonGroup,
                                        ViewDrawRibbonGroup viewGroup)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonGroup != null);
            Debug.Assert(viewGroup != null);

            _ribbon      = ribbon;
            _ribbonGroup = ribbonGroup;
            _viewGroup   = viewGroup;
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupImage class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonGroup">Reference to ribbon group definition.</param>
        /// <param name="viewGroup">Reference to top level group element.</param>
        public ViewDrawRibbonGroupImage(KryptonRibbon ribbon,
                                        KryptonRibbonGroup ribbonGroup,
                                        ViewDrawRibbonGroup viewGroup)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonGroup != null);
            Debug.Assert(viewGroup != null);

            _ribbon = ribbon;
            _ribbonGroup = ribbonGroup;
            _viewGroup = viewGroup;
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupTitle class.
        /// </summary>
        /// <param name="ribbon">Source ribbon control.</param>
        /// <param name="ribbonGroup">Ribbon group to display title for.</param>
        public ViewDrawRibbonGroupTitle(KryptonRibbon ribbon,
                                        KryptonRibbonGroup ribbonGroup)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonGroup != null);

            _ribbon = ribbon;
            _ribbonGroup = ribbonGroup;

            // Use a class to convert from ribbon group to content interface
            _contentProvider = new RibbonGroupTextToContent(ribbon.StateCommon.RibbonGeneral,
                                                            ribbon.StateNormal.RibbonGroupNormalTitle);
        }
Esempio n. 15
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupTitle class.
        /// </summary>
        /// <param name="ribbon">Source ribbon control.</param>
        /// <param name="ribbonGroup">Ribbon group to display title for.</param>
        public ViewDrawRibbonGroupTitle(KryptonRibbon ribbon,
                                        KryptonRibbonGroup ribbonGroup)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonGroup != null);

            _ribbon      = ribbon;
            _ribbonGroup = ribbonGroup;

            // Use a class to convert from ribbon group to content interface
            _contentProvider = new RibbonGroupTextToContent(ribbon.StateCommon.RibbonGeneral,
                                                            ribbon.StateNormal.RibbonGroupNormalTitle);
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupText class.
        /// </summary>
        /// <param name="ribbon">Source ribbon control.</param>
        /// <param name="ribbonGroup">Ribbon group to display title for.</param>
        /// <param name="firstText">Should show the first group text.</param>
        public ViewDrawRibbonGroupText(KryptonRibbon ribbon,
                                       KryptonRibbonGroup ribbonGroup,
                                       bool firstText)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonGroup != null);

            _ribbon      = ribbon;
            _ribbonGroup = ribbonGroup;
            _firstText   = firstText;

            // Use a class to convert from ribbon group to content interface
            _contentProvider = new RibbonGroupTextToContent(ribbon.StateCommon.RibbonGeneral,
                                                            ribbon.StateNormal.RibbonGroupCollapsedText);
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupText class.
        /// </summary>
        /// <param name="ribbon">Source ribbon control.</param>
        /// <param name="ribbonGroup">Ribbon group to display title for.</param>
        /// <param name="firstText">Should show the first group text.</param>
        public ViewDrawRibbonGroupText(KryptonRibbon ribbon,
                                       KryptonRibbonGroup ribbonGroup,
                                       bool firstText)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonGroup != null);

            _ribbon = ribbon;
            _ribbonGroup = ribbonGroup;
            _firstText = firstText;

            // Use a class to convert from ribbon group to content interface
            _contentProvider = new RibbonGroupTextToContent(ribbon.StateCommon.RibbonGeneral,
                                                            ribbon.StateNormal.RibbonGroupCollapsedText);
        }
Esempio n. 18
0
        /// <summary>
        /// Initialize a new instance of the ViewLayoutRibbonGroupContent class.
        /// </summary>
        /// <param name="ribbon">Owning ribbon control instance.</param>
        /// <param name="ribbonGroup">The ribbon group this layout is used to display.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewLayoutRibbonGroupContent(KryptonRibbon ribbon,
                                            KryptonRibbonGroup ribbonGroup,
                                            NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonGroup != null);
            Debug.Assert(needPaint != null);

            // Cache references
            _ribbon      = ribbon;
            _ribbonGroup = ribbonGroup;
            _needPaint   = needPaint;

            // Use hashtable to store relationships
            _containerToView = new ContainerToView();
        }
Esempio n. 19
0
        private void OnMoveToGroup(object sender, EventArgs e)
        {
            if ((_ribbonSeparator != null) &&
                (_ribbonSeparator.Ribbon != null) &&
                _ribbonSeparator.RibbonGroup.Items.Contains(_ribbonSeparator))
            {
                // Cast to correct type
                ToolStripMenuItem groupMenuItem = (ToolStripMenuItem)sender;

                // Get access to the destination tab
                KryptonRibbonGroup destination = (KryptonRibbonGroup)groupMenuItem.Tag;

                // Use a transaction to support undo/redo actions
                DesignerTransaction transaction = _designerHost.CreateTransaction("KryptonRibbonGroupSeparator MoveSeparatorToGroup");

                try
                {
                    // Get access to the Groups property
                    MemberDescriptor oldItems = TypeDescriptor.GetProperties(_ribbonSeparator.RibbonGroup)["Items"];
                    MemberDescriptor newItems = TypeDescriptor.GetProperties(destination)["Items"];

                    // Remove the ribbon tab from the ribbon
                    RaiseComponentChanging(null);
                    RaiseComponentChanging(oldItems);
                    RaiseComponentChanging(newItems);

                    // Remove group from current group
                    _ribbonSeparator.RibbonGroup.Items.Remove(_ribbonSeparator);

                    // Append to the new destination group
                    destination.Items.Add(_ribbonSeparator);

                    RaiseComponentChanged(newItems, null, null);
                    RaiseComponentChanged(oldItems, null, null);
                    RaiseComponentChanged(null, null, null);
                }
                finally
                {
                    // If we managed to create the transaction, then do it
                    if (transaction != null)
                    {
                        transaction.Commit();
                    }
                }
            }
        }
Esempio n. 20
0
        private void OnComponentRemoving(object sender, ComponentEventArgs e)
        {
            // If our tab is being removed
            if (e.Component == _ribbonTab)
            {
                // Need access to host in order to delete a component
                IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));

                // We need to remove all the groups from the tab
                for (int i = _ribbonTab.Groups.Count - 1; i >= 0; i--)
                {
                    KryptonRibbonGroup group = _ribbonTab.Groups[i];
                    _ribbonTab.Groups.Remove(group);
                    host.DestroyComponent(group);
                }
            }
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupDialogButton class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonGroup">Reference to ribbon group this represents.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupDialogButton(KryptonRibbon ribbon,
                                               KryptonRibbonGroup ribbonGroup,
                                               NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonGroup != null);

            // Remember incoming references
            _ribbon = ribbon;
            _ribbonGroup = ribbonGroup;

            // Attach a controller to this element for the pressing of the button
            DialogLauncherButtonController controller = new DialogLauncherButtonController(ribbon, this, needPaint);
            controller.Click += new MouseEventHandler(OnClick);
            MouseController = controller;
            SourceController = controller;
            KeyController = controller;
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupDialogButton class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonGroup">Reference to ribbon group this represents.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupDialogButton(KryptonRibbon ribbon,
                                               KryptonRibbonGroup ribbonGroup,
                                               NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonGroup != null);

            // Remember incoming references
            _ribbon      = ribbon;
            _ribbonGroup = ribbonGroup;

            // Attach a controller to this element for the pressing of the button
            DialogLauncherButtonController controller = new DialogLauncherButtonController(ribbon, this, needPaint);

            controller.Click += new MouseEventHandler(OnClick);
            MouseController   = controller;
            SourceController  = controller;
            KeyController     = controller;
        }
Esempio n. 23
0
        private void OnMoveNext(object sender, EventArgs e)
        {
            if ((_ribbonGallery != null) &&
                (_ribbonGallery.Ribbon != null) &&
                _ribbonGallery.RibbonGroup.Items.Contains(_ribbonGallery))
            {
                // Use a transaction to support undo/redo actions
                DesignerTransaction transaction = _designerHost.CreateTransaction("KryptonRibbonGroupGallery MoveNext");

                try
                {
                    // Get access to the Items property
                    MemberDescriptor propertyItems = TypeDescriptor.GetProperties(_ribbonGallery.RibbonGroup)["Items"];

                    RaiseComponentChanging(propertyItems);

                    // Move position of the gallery
                    KryptonRibbonGroup ribbonGroup = _ribbonGallery.RibbonGroup;
                    int index = ribbonGroup.Items.IndexOf(_ribbonGallery) + 1;
                    index = Math.Min(index, ribbonGroup.Items.Count - 1);
                    ribbonGroup.Items.Remove(_ribbonGallery);
                    ribbonGroup.Items.Insert(index, _ribbonGallery);
                    UpdateVerbStatus();

                    RaiseComponentChanged(propertyItems, null, null);
                }
                finally
                {
                    // If we managed to create the transaction, then do it
                    if (transaction != null)
                    {
                        transaction.Commit();
                    }
                }
            }
        }
 private void InitializeComponent()
 {
     this.components                = new System.ComponentModel.Container();
     this.kryptonRibbon1            = new ComponentFactory.Krypton.Ribbon.KryptonRibbon();
     this.kryptonRibbonTab1         = new ComponentFactory.Krypton.Ribbon.KryptonRibbonTab();
     this.kryptonRibbonGroup1       = new ComponentFactory.Krypton.Ribbon.KryptonRibbonGroup();
     this.kryptonRibbonGroupTriple1 = new ComponentFactory.Krypton.Ribbon.KryptonRibbonGroupTriple();
     this.kgbtnDropShadowOn         = new ComponentFactory.Krypton.Ribbon.KryptonRibbonGroupButton();
     this.kgbtnDropShadowOff        = new ComponentFactory.Krypton.Ribbon.KryptonRibbonGroupButton();
     this.kryptonRibbonGroup2       = new ComponentFactory.Krypton.Ribbon.KryptonRibbonGroup();
     this.kryptonRibbonGroupTriple2 = new ComponentFactory.Krypton.Ribbon.KryptonRibbonGroupTriple();
     this.krgcmbThemeChooser        = new ComponentFactory.Krypton.Ribbon.KryptonRibbonGroupComboBox();
     this.krgdThemeSelector         = new ComponentFactory.Krypton.Ribbon.KryptonRibbonGroupDomainUpDown();
     this.krgbApplyTheme            = new ComponentFactory.Krypton.Ribbon.KryptonRibbonGroupButton();
     this.kryptonPanel1             = new ComponentFactory.Krypton.Toolkit.KryptonPanel();
     this.kryptonPanel2             = new ComponentFactory.Krypton.Toolkit.KryptonPanel();
     this.statusStrip1              = new System.Windows.Forms.StatusStrip();
     this.toolStripStatusLabel1     = new System.Windows.Forms.ToolStripStatusLabel();
     this.kryptonManager1           = new ComponentFactory.Krypton.Toolkit.KryptonManager(this.components);
     ((System.ComponentModel.ISupportInitialize)(this.kryptonRibbon1)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.kryptonPanel1)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.kryptonPanel2)).BeginInit();
     this.kryptonPanel2.SuspendLayout();
     this.statusStrip1.SuspendLayout();
     this.SuspendLayout();
     //
     // kryptonRibbon1
     //
     this.kryptonRibbon1.AllowFormIntegrate = true;
     this.kryptonRibbon1.InDesignHelperMode = true;
     this.kryptonRibbon1.Name = "kryptonRibbon1";
     this.kryptonRibbon1.RibbonTabs.AddRange(new ComponentFactory.Krypton.Ribbon.KryptonRibbonTab[] {
         this.kryptonRibbonTab1
     });
     this.kryptonRibbon1.SelectedTab = this.kryptonRibbonTab1;
     this.kryptonRibbon1.Size        = new System.Drawing.Size(1347, 115);
     this.kryptonRibbon1.TabIndex    = 0;
     //
     // kryptonRibbonTab1
     //
     this.kryptonRibbonTab1.Groups.AddRange(new ComponentFactory.Krypton.Ribbon.KryptonRibbonGroup[] {
         this.kryptonRibbonGroup1,
         this.kryptonRibbonGroup2
     });
     //
     // kryptonRibbonGroup1
     //
     this.kryptonRibbonGroup1.Items.AddRange(new ComponentFactory.Krypton.Ribbon.KryptonRibbonGroupContainer[] {
         this.kryptonRibbonGroupTriple1
     });
     //
     // kryptonRibbonGroupTriple1
     //
     this.kryptonRibbonGroupTriple1.Items.AddRange(new ComponentFactory.Krypton.Ribbon.KryptonRibbonGroupItem[] {
         this.kgbtnDropShadowOn,
         this.kgbtnDropShadowOff
     });
     //
     // kgbtnDropShadowOn
     //
     this.kgbtnDropShadowOn.ButtonType = ComponentFactory.Krypton.Ribbon.GroupButtonType.Check;
     this.kgbtnDropShadowOn.TextLine1  = "Turn Drop Shadow";
     this.kgbtnDropShadowOn.TextLine2  = "On";
     this.kgbtnDropShadowOn.Click     += new System.EventHandler(this.kgbtnDropShadowOn_Click);
     //
     // kgbtnDropShadowOff
     //
     this.kgbtnDropShadowOff.ButtonType = ComponentFactory.Krypton.Ribbon.GroupButtonType.Check;
     this.kgbtnDropShadowOff.TextLine1  = "Turn Drop Shadow";
     this.kgbtnDropShadowOff.TextLine2  = "Off";
     this.kgbtnDropShadowOff.Click     += new System.EventHandler(this.kgbtnDropShadowOff_Click);
     //
     // kryptonRibbonGroup2
     //
     this.kryptonRibbonGroup2.Items.AddRange(new ComponentFactory.Krypton.Ribbon.KryptonRibbonGroupContainer[] {
         this.kryptonRibbonGroupTriple2
     });
     //
     // kryptonRibbonGroupTriple2
     //
     this.kryptonRibbonGroupTriple2.Items.AddRange(new ComponentFactory.Krypton.Ribbon.KryptonRibbonGroupItem[] {
         this.krgcmbThemeChooser,
         this.krgdThemeSelector,
         this.krgbApplyTheme
     });
     //
     // krgcmbThemeChooser
     //
     this.krgcmbThemeChooser.DropDownWidth     = 121;
     this.krgcmbThemeChooser.FormattingEnabled = false;
     this.krgcmbThemeChooser.ItemHeight        = 15;
     this.krgcmbThemeChooser.Text = "";
     //
     // krgdThemeSelector
     //
     this.krgdThemeSelector.Text = "";
     //
     // krgbApplyTheme
     //
     this.krgbApplyTheme.TextLine1 = "Apply";
     this.krgbApplyTheme.TextLine2 = "Theme";
     this.krgbApplyTheme.Click    += new System.EventHandler(this.krgbApplyTheme_Click);
     //
     // kryptonPanel1
     //
     this.kryptonPanel1.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.kryptonPanel1.Location = new System.Drawing.Point(0, 115);
     this.kryptonPanel1.Name     = "kryptonPanel1";
     this.kryptonPanel1.Size     = new System.Drawing.Size(1347, 555);
     this.kryptonPanel1.TabIndex = 1;
     //
     // kryptonPanel2
     //
     this.kryptonPanel2.Controls.Add(this.statusStrip1);
     this.kryptonPanel2.Dock     = System.Windows.Forms.DockStyle.Bottom;
     this.kryptonPanel2.Location = new System.Drawing.Point(0, 648);
     this.kryptonPanel2.Name     = "kryptonPanel2";
     this.kryptonPanel2.Size     = new System.Drawing.Size(1347, 22);
     this.kryptonPanel2.TabIndex = 0;
     //
     // statusStrip1
     //
     this.statusStrip1.Font = new System.Drawing.Font("Segoe UI", 9F);
     this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
         this.toolStripStatusLabel1
     });
     this.statusStrip1.Location   = new System.Drawing.Point(0, 0);
     this.statusStrip1.Name       = "statusStrip1";
     this.statusStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.ManagerRenderMode;
     this.statusStrip1.Size       = new System.Drawing.Size(1347, 22);
     this.statusStrip1.TabIndex   = 0;
     this.statusStrip1.Text       = "statusStrip1";
     //
     // toolStripStatusLabel1
     //
     this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
     this.toolStripStatusLabel1.Size = new System.Drawing.Size(118, 17);
     this.toolStripStatusLabel1.Text = "toolStripStatusLabel1";
     //
     // RibbonApp
     //
     this.ClientSize = new System.Drawing.Size(1347, 670);
     this.Controls.Add(this.kryptonPanel2);
     this.Controls.Add(this.kryptonPanel1);
     this.Controls.Add(this.kryptonRibbon1);
     this.Name          = "RibbonApp";
     this.TextExtra     = "Test";
     this.UseDropShadow = false;
     this.Load         += new System.EventHandler(this.RibbonApp_Load);
     ((System.ComponentModel.ISupportInitialize)(this.kryptonRibbon1)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.kryptonPanel1)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.kryptonPanel2)).EndInit();
     this.kryptonPanel2.ResumeLayout(false);
     this.kryptonPanel2.PerformLayout();
     this.statusStrip1.ResumeLayout(false);
     this.statusStrip1.PerformLayout();
     this.ResumeLayout(false);
     this.PerformLayout();
 }
Esempio n. 25
0
        private void SyncChildrenToRibbonGroups()
        {
            // Remove all child elements
            Clear();

            // Create a new lookup that reflects any changes in groups
            GroupToView regenerate = new GroupToView();

            // Make sure we have a view element to match each group
            foreach (KryptonRibbonGroup group in _ribbonTab.Groups)
            {
                ViewDrawRibbonGroup view = null;

                // Get the currently cached view for the group
                if (_groupToView.ContainsKey(group))
                {
                    view = _groupToView[group];
                }

                // If a new group, create a view for it now
                if (view == null)
                {
                    view = new ViewDrawRibbonGroup(_ribbon, group, _needPaint);
                }

                // Add to the lookup for future reference
                regenerate.Add(group, view);
            }

            if (_groupSepCache.Count < _ribbonTab.Groups.Count)
            {
                for (int i = _groupSepCache.Count; i < _ribbonTab.Groups.Count; i++)
                {
                    _groupSepCache.Add(new ViewLayoutRibbonSeparator(0, true));
                }
            }

            // Update size of all separators to match ribbon shape
            Size sepSize = SeparatorSize;

            foreach (ViewLayoutRibbonSeparator sep in _groupSepCache)
            {
                sep.SeparatorSize = sepSize;
            }

            // We ignore the first separator
            bool ignoreSep = true;

            // Add child elements appropriate for each ribbon group
            for (int i = 0; i < _ribbonTab.Groups.Count; i++)
            {
                KryptonRibbonGroup ribbonGroup = _ribbonTab.Groups[i];

                // Only make the separator visible if the group is and not the first sep
                bool groupVisible = (_ribbon.InDesignHelperMode || ribbonGroup.Visible);
                _groupSepCache[i].Visible       = groupVisible && !ignoreSep;
                regenerate[ribbonGroup].Visible = groupVisible;

                // Only add a separator for the second group onwards
                if (groupVisible && ignoreSep)
                {
                    ignoreSep = false;
                }

                Add(_groupSepCache[i]);
                Add(regenerate[ribbonGroup]);

                // Remove entries we still are using
                if (_groupToView.ContainsKey(ribbonGroup))
                {
                    _groupToView.Remove(ribbonGroup);
                }
            }

            // When in design time help mode
            if (_ribbon.InDesignHelperMode)
            {
                // Create the design time 'Add Group' first time it is needed
                if (_viewAddGroup == null)
                {
                    _viewAddGroup = new ViewDrawRibbonDesignGroup(_ribbon, _needPaint);
                }

                // Always add at end of the list of groups
                Add(_viewAddGroup);
            }

            // Dispose of views no longer required
            foreach (ViewDrawRibbonGroup group in _groupToView.Values)
            {
                group.Dispose();
            }

            // No longer need the old lookup
            _groupToView = regenerate;
        }
        /// <summary>
        /// Initializes the designer with the specified component.
        /// </summary>
        /// <param name="component">The IComponent to associate the designer with.</param>
        public override void Initialize(IComponent component)
        {
            Debug.Assert(component != null);

            // Validate the parameter reference
            if (component == null) throw new ArgumentNullException("component");

            // Let base class do standard stuff
            base.Initialize(component);

            // Cast to correct type
            _ribbonGroup = (KryptonRibbonGroup)component;
            _ribbonGroup.DesignTimeAddTriple += new EventHandler(OnAddTriple);
            _ribbonGroup.DesignTimeAddLines += new EventHandler(OnAddLines);
            _ribbonGroup.DesignTimeAddSeparator += new EventHandler(OnAddSep);
            _ribbonGroup.DesignTimeAddGallery += new EventHandler(OnAddGallery);
            _ribbonGroup.DesignTimeContextMenu += new MouseEventHandler(OnContextMenu);

            // Get access to the services
            _designerHost = (IDesignerHost)GetService(typeof(IDesignerHost));
            _changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService));

            // We need to know when we are being removed/changed
            _changeService.ComponentRemoving += new ComponentEventHandler(OnComponentRemoving);
            _changeService.ComponentChanged += new ComponentChangedEventHandler(OnComponentChanged);
        }
Esempio n. 27
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroup class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonGroup">Reference to ribbon group this represents.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroup(KryptonRibbon ribbon,
                                   KryptonRibbonGroup ribbonGroup,
                                   NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonGroup != null);
            Debug.Assert(needPaint != null);

            // Cache source of state specific settings
            _ribbon = ribbon;
            _ribbonGroup = ribbonGroup;
            _needPaint = needPaint;

            // Associate this view with the source component (required for design time selection)
            Component = _ribbonGroup;

            CreateNormalView();
            CreateCollapsedView();

            // We are always created in the normal state
            Add(_layoutNormalMain);

            // Set back reference to the actual group definition
            _ribbonGroup.GroupView = this;

            // Hook into changes in the ribbon button definition
            _ribbonGroup.PropertyChanged += new PropertyChangedEventHandler(OnGroupPropertyChanged);
        }