private void CreateMediumSmallLabelView() { // Create the layout docker for the contents of the label _viewMediumSmall = new ViewLayoutDocker(); if (_ribbon.InDesignMode) { // At design time we need to know when the user right clicks the label ContextClickController controller = new ContextClickController(); controller.ContextClick += new MouseEventHandler(OnContextClick); _viewMediumSmall.MouseController = controller; } // Create the image and drop down content _viewMediumSmallLabelImage = new ViewDrawRibbonGroupLabelImage(_ribbon, _ribbonLabel, false); _viewMediumSmallText1 = new ViewDrawRibbonGroupLabelText(_ribbon, _ribbonLabel, true); _viewMediumSmallText2 = new ViewDrawRibbonGroupLabelText(_ribbon, _ribbonLabel, false); _viewMediumSmallImage = new ViewLayoutRibbonCenterPadding(_smallImagePadding); _viewMediumSmallImage.Add(_viewMediumSmallLabelImage); // Layout the content in the center of a row _viewMediumSmallCenter = new ViewLayoutRibbonRowCenter(); _viewMediumSmallCenter.Add(_viewMediumSmallImage); _viewMediumSmallCenter.Add(_viewMediumSmallText1); _viewMediumSmallCenter.Add(_viewMediumSmallText2); // Use content as only fill item _viewMediumSmall.Add(_viewMediumSmallCenter, ViewDockStyle.Fill); // Create controller for intercepting events to determine tool tip handling _viewMediumSmall.MouseController = new ToolTipController(_ribbon.TabsArea.ButtonSpecManager.ToolTipManager, _viewMediumSmall, _viewMediumSmall.MouseController); }
private void CreateMediumSmallRadioButtonView() { // Create the layout docker for the contents of the button _viewMediumSmall = new ViewLayoutRibbonRadioButton(); // Create the image and drop down content _viewMediumSmallImage = new ViewDrawRibbonGroupRadioButtonImage(_ribbon, _ribbonRadioButton, false); _viewMediumSmallText1 = new ViewDrawRibbonGroupRadioButtonText(_ribbon, _ribbonRadioButton, true); _viewMediumSmallText2 = new ViewDrawRibbonGroupRadioButtonText(_ribbon, _ribbonRadioButton, false); ViewLayoutRibbonCenterPadding imagePadding = new ViewLayoutRibbonCenterPadding(_smallImagePadding); imagePadding.Add(_viewMediumSmallImage); // Layout the content in the center of a row _viewMediumSmallCenter = new ViewLayoutRibbonRowCenter(); _viewMediumSmallCenter.Add(imagePadding); _viewMediumSmallCenter.Add(_viewMediumSmallText1); _viewMediumSmallCenter.Add(_viewMediumSmallText2); // Use content as only fill item _viewMediumSmall.Add(_viewMediumSmallCenter, ViewDockStyle.Fill); // Create controller for handling mouse, keyboard and focus _viewMediumSmallController = new GroupRadioButtonController(_ribbon, _viewMediumSmall, _viewMediumSmallImage, _needPaint); _viewMediumSmallController.Click += new EventHandler(OnMediumSmallRadioButtonClick); _viewMediumSmallController.ContextClick += new MouseEventHandler(OnContextClick); _viewMediumSmall.MouseController = _viewMediumSmallController; _viewMediumSmall.SourceController = _viewMediumSmallController; _viewMediumSmall.KeyController = _viewMediumSmallController; // Create controller for intercepting events to determine tool tip handling _viewMediumSmall.MouseController = new ToolTipController(_ribbon.TabsArea.ButtonSpecManager.ToolTipManager, _viewMediumSmall, _viewMediumSmall.MouseController); }
private void CreateView() { // Override the palette provided values _backForced = new PaletteBackInheritForced(_ribbon.StateCommon.RibbonGroupClusterButton.PaletteBack); _borderForced = new PaletteBorderInheritForced(_ribbon.StateCommon.RibbonGroupClusterButton.PaletteBorder); // Create the background and border view _viewMediumSmall = new ViewDrawRibbonGroupButtonBackBorder(_ribbon, _ribbonColorButton, _backForced, _borderForced, true, _needPaint); _viewMediumSmall.SplitVertical = false; _viewMediumSmall.Click += new EventHandler(OnSmallButtonClick); _viewMediumSmall.DropDown += new EventHandler(OnSmallButtonDropDown); if (_ribbon.InDesignMode) { _viewMediumSmall.ContextClick += new MouseEventHandler(OnContextClick); } // Create the layout docker for the contents of the button ViewLayoutDocker contentLayout = new ViewLayoutDocker(); // Create the image and drop down content _viewMediumSmallImage = new ViewDrawRibbonGroupClusterColorButtonImage(_ribbon, _ribbonColorButton); _viewMediumSmallText1 = new ViewDrawRibbonGroupClusterColorButtonText(_ribbon, _ribbonColorButton); _viewMediumSmallText1.Visible = (_currentSize != GroupItemSize.Small); _viewMediumSmallDropArrow = new ViewDrawRibbonDropArrow(_ribbon); _viewMediumSmallText2Sep1 = new ViewLayoutRibbonSeparator(3, false); _viewMediumSmallText2Sep2 = new ViewLayoutRibbonSeparator(3, false); ViewLayoutRibbonCenterPadding imagePadding = new ViewLayoutRibbonCenterPadding(_smallImagePadding); imagePadding.Add(_viewMediumSmallImage); // Layout the content in the center of a row _viewMediumSmallCenter = new ViewLayoutRibbonRowCenter(); _viewMediumSmallCenter.Add(imagePadding); _viewMediumSmallCenter.Add(_viewMediumSmallText1); _viewMediumSmallCenter.Add(_viewMediumSmallText2Sep1); _viewMediumSmallCenter.Add(_viewMediumSmallDropArrow); _viewMediumSmallCenter.Add(_viewMediumSmallText2Sep2); // Use content as only fill item contentLayout.Add(_viewMediumSmallCenter, ViewDockStyle.Fill); // Add the content into the background and border _viewMediumSmall.Add(contentLayout); // Create controller for intercepting events to determine tool tip handling _viewMediumSmall.MouseController = new ToolTipController(_ribbon.TabsArea.ButtonSpecManager.ToolTipManager, _viewMediumSmall, _viewMediumSmall.MouseController); // Provide back reference to the button definition _ribbonColorButton.ClusterColorButtonView = _viewMediumSmall; // Define the actual view Add(_viewMediumSmall); }
private void CreateLargeButtonView() { // Create the background and border view _viewLarge = new ViewDrawRibbonGroupButtonBackBorder(_ribbon, _ribbonGallery, _ribbon.StateCommon.RibbonGroupButton.PaletteBack, _ribbon.StateCommon.RibbonGroupButton.PaletteBorder, false, _needPaint); _viewLarge.ButtonType = GroupButtonType.DropDown; _viewLarge.DropDown += new EventHandler(OnLargeButtonDropDown); if (_ribbon.InDesignMode) { _viewLarge.ContextClick += new MouseEventHandler(OnContextClick); } // Create the layout docker for the contents of the button ViewLayoutDocker contentLayout = new ViewLayoutDocker(); // Add the large button at the top _viewLargeImage = new ViewDrawRibbonGroupGalleryImage(_ribbon, _ribbonGallery); ViewLayoutRibbonCenterPadding largeImagePadding = new ViewLayoutRibbonCenterPadding(_largeImagePadding); largeImagePadding.Add(_viewLargeImage); contentLayout.Add(largeImagePadding, ViewDockStyle.Top); // Add the first line of text _viewLargeText1 = new ViewDrawRibbonGroupGalleryText(_ribbon, _ribbonGallery, true); contentLayout.Add(_viewLargeText1, ViewDockStyle.Bottom); // Add the second line of text _viewLargeCenter = new ViewLayoutRibbonRowCenter(); _viewLargeText2 = new ViewDrawRibbonGroupGalleryText(_ribbon, _ribbonGallery, false); _viewLargeDropArrow = new ViewDrawRibbonDropArrow(_ribbon); _viewLargeText2Sep1 = new ViewLayoutRibbonSeparator(4, false); _viewLargeText2Sep2 = new ViewLayoutRibbonSeparator(4, false); _viewLargeCenter.Add(_viewLargeText2); _viewLargeCenter.Add(_viewLargeText2Sep1); _viewLargeCenter.Add(_viewLargeDropArrow); _viewLargeCenter.Add(_viewLargeText2Sep2); contentLayout.Add(_viewLargeCenter, ViewDockStyle.Bottom); // Add a 1 pixel separator at bottom of button before the text contentLayout.Add(new ViewLayoutRibbonSeparator(1, false), ViewDockStyle.Bottom); // Add the content into the background and border _viewLarge.Add(contentLayout); // Create controller for intercepting events to determine tool tip handling _viewLarge.MouseController = new ToolTipController(_ribbon.TabsArea.ButtonSpecManager.ToolTipManager, _viewLarge, _viewLarge.MouseController); // Add as a child view but as hidden, will become visible only in small mode _viewLarge.Visible = false; Add(_viewLarge); }
private void CreateCollapsedView() { // Create a layout for the main area _layoutCollapsedMain = new ViewLayoutDocker(); // Add a mouse controller so we know when it has been pressed _collapsedController = new CollapsedGroupController(_ribbon, _layoutCollapsedMain, _needPaint); _collapsedController.Click += new MouseEventHandler(OnCollapsedClick); _layoutCollapsedMain.MouseController = _collapsedController; _layoutCollapsedMain.SourceController = _collapsedController; _layoutCollapsedMain.KeyController = _collapsedController; // Reduce layout area to remove the group border ViewLayoutRibbonPadding layoutCollapsedInsidePadding = new ViewLayoutRibbonPadding(COLLAPSED_PADDING); _layoutCollapsedMain.Add(layoutCollapsedInsidePadding, ViewDockStyle.Fill); // Position at top an area that is padded for containing the image ViewLayoutDocker layoutCollapsedInside = new ViewLayoutDocker(); layoutCollapsedInsidePadding.Add(layoutCollapsedInside); // Create the layout for the second line of text ViewLayoutRibbonRowCenter layoutCollapsedText2 = new ViewLayoutRibbonRowCenter(); _viewCollapsedText2 = new ViewDrawRibbonGroupText(_ribbon, _ribbonGroup, false); layoutCollapsedText2.Add(_viewCollapsedText2); layoutCollapsedText2.Add(new ViewLayoutRibbonSeparator(2, 10, true)); layoutCollapsedText2.Add(new ViewDrawRibbonDropArrow(_ribbon)); layoutCollapsedText2.Add(new ViewLayoutRibbonSeparator(2, 10, true)); layoutCollapsedInside.Add(layoutCollapsedText2, ViewDockStyle.Top); // Add the first line of text _viewCollapsedText1 = new ViewDrawRibbonGroupText(_ribbon, _ribbonGroup, true); layoutCollapsedInside.Add(_viewCollapsedText1, ViewDockStyle.Top); // Add group image frame _layoutCollapsedImagePadding = new ViewLayoutRibbonCenterPadding(COLLAPSED_IMAGE_PADDING_2007); layoutCollapsedInside.Add(_layoutCollapsedImagePadding, ViewDockStyle.Top); // Finally we add the actual drawing element for the collapsed group image ViewDrawRibbonGroupImage drawCollapsedImage = new ViewDrawRibbonGroupImage(_ribbon, _ribbonGroup, this); _layoutCollapsedImagePadding.Add(drawCollapsedImage); }
private void CreateMediumSmallButtonView() { // Create the background and border view _viewMediumSmall = new ViewDrawRibbonGroupButtonBackBorder(_ribbon, _ribbonColorButton, _ribbon.StateCommon.RibbonGroupButton.PaletteBack, _ribbon.StateCommon.RibbonGroupButton.PaletteBorder, false, _needPaint); _viewMediumSmall.SplitVertical = false; _viewMediumSmall.Click += new EventHandler(OnMediumSmallButtonClick); _viewMediumSmall.DropDown += new EventHandler(OnMediumSmallButtonDropDown); if (_ribbon.InDesignMode) { _viewMediumSmall.ContextClick += new MouseEventHandler(OnContextClick); } // Create the layout docker for the contents of the button ViewLayoutDocker contentLayout = new ViewLayoutDocker(); // Create the image and drop down content _viewMediumSmallImage = new ViewDrawRibbonGroupColorButtonImage(_ribbon, _ribbonColorButton, false); _viewMediumSmallText1 = new ViewDrawRibbonGroupColorButtonText(_ribbon, _ribbonColorButton, true); _viewMediumSmallText2 = new ViewDrawRibbonGroupColorButtonText(_ribbon, _ribbonColorButton, false); _viewMediumSmallDropArrow = new ViewDrawRibbonDropArrow(_ribbon); _viewMediumSmallText2Sep2 = new ViewLayoutRibbonSeparator(3, false); _viewMediumSmallText2Sep3 = new ViewLayoutRibbonSeparator(3, false); ViewLayoutRibbonCenterPadding imagePadding = new ViewLayoutRibbonCenterPadding(_smallImagePadding); imagePadding.Add(_viewMediumSmallImage); // Layout the content in the center of a row _viewMediumSmallCenter = new ViewLayoutRibbonRowCenter(); _viewMediumSmallCenter.Add(imagePadding); _viewMediumSmallCenter.Add(_viewMediumSmallText1); _viewMediumSmallCenter.Add(_viewMediumSmallText2); _viewMediumSmallCenter.Add(_viewMediumSmallText2Sep2); _viewMediumSmallCenter.Add(_viewMediumSmallDropArrow); _viewMediumSmallCenter.Add(_viewMediumSmallText2Sep3); // Use content as only fill item contentLayout.Add(_viewMediumSmallCenter, ViewDockStyle.Fill); // Add the content into the background and border _viewMediumSmall.Add(contentLayout); // Create controller for intercepting events to determine tool tip handling _viewMediumSmall.MouseController = new ToolTipController(_ribbon.TabsArea.ButtonSpecManager.ToolTipManager, _viewMediumSmall, _viewMediumSmall.MouseController); }