Exemplo n.º 1
0
        /// <summary>
        /// Initialize a new instance of the GroupRadioButtonController class.
        /// </summary>
        /// <param name="ribbon">Source control instance.</param>
        /// <param name="targetMain">Target for main element changes.</param>
        /// <param name="targetImage">Target for image state changes.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public GroupRadioButtonController(KryptonRibbon ribbon,
                                          ViewBase targetMain,
                                          ViewDrawRibbonGroupRadioButtonImage targetImage,
                                          NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(targetMain != null);
            Debug.Assert(targetImage != null);
            Debug.Assert(needPaint != null);

            _ribbon      = ribbon;
            TargetMain   = targetMain;
            _targetImage = targetImage;
            NeedPaint    = needPaint;
        }
Exemplo n.º 2
0
        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, GroupRadioButton, false);
            _viewMediumSmallText1 = new ViewDrawRibbonGroupRadioButtonText(_ribbon, GroupRadioButton, true);
            _viewMediumSmallText2 = new ViewDrawRibbonGroupRadioButtonText(_ribbon, GroupRadioButton, false);
            ViewLayoutRibbonCenterPadding imagePadding = new ViewLayoutRibbonCenterPadding(_smallImagePadding)
            {
                _viewMediumSmallImage
            };

            // Layout the content in the center of a row
            _viewMediumSmallCenter = new ViewLayoutRibbonRowCenter
            {
                imagePadding,
                _viewMediumSmallText1,
                _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        += OnMediumSmallRadioButtonClick;
            _viewMediumSmallController.ContextClick += 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);
        }
Exemplo n.º 3
0
        private void CreateLargeRadioButtonView()
        {
            // Create the layout docker for the contents of the button
            _viewLarge = new ViewLayoutRibbonRadioButton();

            // Add the large button at the top
            _viewLargeImage = new ViewDrawRibbonGroupRadioButtonImage(_ribbon, GroupRadioButton, true);
            ViewLayoutRibbonCenterPadding largeImagePadding = new ViewLayoutRibbonCenterPadding(_largeImagePadding)
            {
                _viewLargeImage
            };

            _viewLarge.Add(largeImagePadding, ViewDockStyle.Top);

            // Add the first line of text
            _viewLargeText1 = new ViewDrawRibbonGroupRadioButtonText(_ribbon, GroupRadioButton, true);
            _viewLarge.Add(_viewLargeText1, ViewDockStyle.Bottom);

            // Add the second line of text
            _viewLargeText2 = new ViewDrawRibbonGroupRadioButtonText(_ribbon, GroupRadioButton, false);
            _viewLarge.Add(_viewLargeText2, ViewDockStyle.Bottom);

            // Add a 1 pixel separator at bottom of button before the text
            _viewLarge.Add(new ViewLayoutRibbonSeparator(1, false), ViewDockStyle.Bottom);

            // Create controller for handling mouse, keyboard and focus
            _viewLargeController               = new GroupRadioButtonController(_ribbon, _viewLarge, _viewLargeImage, _needPaint);
            _viewLargeController.Click        += OnLargeRadioButtonClick;
            _viewLargeController.ContextClick += OnContextClick;
            _viewLarge.MouseController         = _viewLargeController;
            _viewLarge.SourceController        = _viewLargeController;
            _viewLarge.KeyController           = _viewLargeController;

            // Create controller for intercepting events to determine tool tip handling
            _viewLarge.MouseController = new ToolTipController(_ribbon.TabsArea.ButtonSpecManager.ToolTipManager,
                                                               _viewLarge, _viewLarge.MouseController);
        }