Пример #1
0
        /// <summary>
        /// Initialize a new instance of the ViewLayoutRibbonGroupCluster class.
        /// </summary>
        /// <param name="ribbon">Owning ribbon control instance.</param>
        /// <param name="ribbonCluster">Reference to cluster definition.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewLayoutRibbonGroupCluster(KryptonRibbon ribbon,
                                            KryptonRibbonGroupCluster ribbonCluster,
                                            NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonCluster != null);
            Debug.Assert(needPaint != null);

            // Cache references
            _ribbon        = ribbon;
            _ribbonCluster = ribbonCluster;
            _needPaint     = needPaint;
            _currentSize   = GroupItemSize.Medium;

            // Associate the component with this view element for design time selection
            Component = _ribbonCluster;

            // Create the start and end separators
            _startSep        = new ViewDrawRibbonGroupClusterSeparator(_ribbon, true);
            _endSep          = new ViewDrawRibbonGroupClusterSeparator(_ribbon, false);
            _startSepVisible = false;
            _endSepVisible   = false;

            // Create palette used to supply a width to a border edge view
            PaletteBorderEdgeRedirect borderEdgeRedirect = new PaletteBorderEdgeRedirect(_ribbon.StateCommon.RibbonGroupClusterButton.Border, needPaint);

            _paletteBorderEdge = new PaletteBorderEdge(borderEdgeRedirect, needPaint);
            _lastShape         = PaletteRibbonShape.Office2007;

            // Use hashtable to store relationships
            _itemToView       = new ItemToView();
            _viewToEdge       = new ViewToEdge();
            _viewToSizeMedium = new ViewToSize();
            _viewToSizeSmall  = new ViewToSize();

            // Hook into changes in the ribbon cluster definition
            _ribbonCluster.PropertyChanged += new PropertyChangedEventHandler(OnClusterPropertyChanged);
            _ribbonCluster.ClusterView      = this;

            // At design time we want to track the mouse and show feedback
            if (_ribbon.InDesignMode)
            {
                ViewHightlightController controller = new ViewHightlightController(this, needPaint);
                controller.ContextClick += new MouseEventHandler(OnContextClick);
                MouseController          = controller;
            }
        }
Пример #2
0
        /// <summary>
        /// Initialize a new instance of the ViewLayoutRibbonGroupLines class.
        /// </summary>
        /// <param name="ribbon">Owning ribbon control instance.</param>
        /// <param name="ribbonLines">Reference to lines definition.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewLayoutRibbonGroupLines(KryptonRibbon ribbon,
                                          KryptonRibbonGroupLines ribbonLines,
                                          NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonLines != null);
            Debug.Assert(needPaint != null);

            // Cache references
            _ribbon      = ribbon;
            _ribbonLines = ribbonLines;
            _needPaint   = needPaint;

            // Associate the component with this view element for design time selection
            Component = _ribbonLines;

            // Use hashtable to store relationships
            _itemToView      = new ItemToView();
            _viewToItem      = new ViewToItem();
            _sizeLargeList   = new SizeList();
            _sizeMediumList  = new SizeList();
            _sizeSmallList   = new SizeList();
            _viewLargeList   = new ViewList();
            _viewMediumList  = new ViewList();
            _viewSmallList   = new ViewList();
            _viewToLargeGap  = new ViewToGap();
            _viewToMediumGap = new ViewToGap();
            _viewToSmallGap  = new ViewToGap();

            // Get the initial size used for sizing and positioning
            ApplySize(ribbonLines.ItemSizeCurrent);

            // Hook into changes in the ribbon triple definition
            _ribbonLines.PropertyChanged += new PropertyChangedEventHandler(OnLinesPropertyChanged);
            _ribbonLines.LinesView        = this;

            // At design time we want to track the mouse and show feedback
            if (_ribbon.InDesignMode)
            {
                ViewHightlightController controller = new ViewHightlightController(this, needPaint);
                controller.ContextClick += new MouseEventHandler(OnContextClick);
                MouseController          = controller;
            }
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonDesignBase class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonDesignBase(KryptonRibbon ribbon,
                                        NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(needPaint != null);

            // Cache incoming values
            _ribbon    = ribbon;
            _needPaint = needPaint;

            // Create and add the draw content for display inside the tab
            _contentProvider = new DesignTextToContent(ribbon);
            Add(new ViewDrawContent(_contentProvider, this, VisualOrientation.Top));

            // Use a controller to change state because of mouse movement
            ViewHightlightController controller = new ViewHightlightController(this, needPaint);

            controller.Click += new EventHandler(OnClick);
            MouseController   = controller;
        }
        /// <summary>
        /// Initialize a new instance of the ViewLayoutRibbonGroupTriple class.
        /// </summary>
        /// <param name="ribbon">Owning ribbon control instance.</param>
        /// <param name="ribbonTriple">Reference to triple definition.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewLayoutRibbonGroupTriple(KryptonRibbon ribbon,
                                           KryptonRibbonGroupTriple ribbonTriple,
                                           NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonTriple != null);
            Debug.Assert(needPaint != null);

            // Cache references
            _ribbon       = ribbon;
            _ribbonTriple = ribbonTriple;
            _needPaint    = needPaint;

            // Associate the component with this view element for design time selection
            Component = _ribbonTriple;

            // Use hashtables to store relationships
            _itemToView  = new ItemToView();
            _smallCache  = new ViewToSize();
            _mediumCache = new ViewToSize();
            _largeCache  = new ViewToSize();

            // Get the initial size used for sizing and positioning
            SetCurrentSize(ribbonTriple.ItemSizeCurrent);

            // Hook into changes in the ribbon triple definition
            _ribbonTriple.PropertyChanged += new PropertyChangedEventHandler(OnTriplePropertyChanged);
            _ribbonTriple.TripleView       = this;

            // At design time we want to track the mouse and show feedback
            if (_ribbon.InDesignMode)
            {
                ViewHightlightController controller = new ViewHightlightController(this, needPaint);
                controller.ContextClick += new MouseEventHandler(OnContextClick);
                MouseController          = controller;
            }
        }