예제 #1
0
        /// <summary>
        /// Initialize a new instance of the KryptonBreadCrumb class.
        /// </summary>
        public KryptonBreadCrumb()
        {
            // The bread crumb cannot take the focus
            SetStyle(ControlStyles.Selectable, false);

            // Set default values
            _selectedItem              = null;
            _dropDownNavigaton         = true;
            _buttonStyle               = ButtonStyle.BreadCrumb;
            _rootItem                  = new KryptonBreadCrumbItem("Root");
            _rootItem.PropertyChanged += new PropertyChangedEventHandler(OnCrumbItemChanged);
            _allowButtonSpecToolTips   = false;

            // Create storage objects
            _buttonSpecs = new BreadCrumbButtonSpecCollection(this);

            // Create the palette storage
            _stateCommon   = new PaletteBreadCrumbRedirect(Redirector, NeedPaintDelegate);
            _stateDisabled = new PaletteBreadCrumbDoubleState(_stateCommon, NeedPaintDelegate);
            _stateNormal   = new PaletteBreadCrumbDoubleState(_stateCommon, NeedPaintDelegate);
            _stateTracking = new PaletteBreadCrumbState(_stateCommon, NeedPaintDelegate);
            _statePressed  = new PaletteBreadCrumbState(_stateCommon, NeedPaintDelegate);

            // Our view contains background and border with crumbs inside
            _layoutCrumbs = new ViewLayoutCrumbs(this, NeedPaintDelegate);
            _drawDocker   = new ViewDrawDocker(_stateNormal.Back, _stateNormal.Border, null);
            _drawDocker.Add(_layoutCrumbs, ViewDockStyle.Fill);

            // Create the view manager instance
            ViewManager = new ViewManager(this, _drawDocker);

            // Create button specification collection manager
            _buttonManager = new ButtonSpecManagerDraw(this, Redirector, _buttonSpecs, null,
                                                       new ViewDrawDocker[] { _drawDocker },
                                                       new IPaletteMetric[] { _stateCommon },
                                                       new PaletteMetricInt[] { PaletteMetricInt.HeaderButtonEdgeInsetPrimary },
                                                       new PaletteMetricPadding[] { PaletteMetricPadding.None },
                                                       new GetToolStripRenderer(CreateToolStripRenderer),
                                                       NeedPaintDelegate);

            // Create the manager for handling tooltips
            _toolTipManager                = new ToolTipManager();
            _toolTipManager.ShowToolTip   += new EventHandler <ToolTipEventArgs>(OnShowToolTip);
            _toolTipManager.CancelToolTip += new EventHandler(OnCancelToolTip);
            _buttonManager.ToolTipManager  = _toolTipManager;
        }
 /// <summary>
 /// Initialize a new instance of the PaletteBreadCrumbDoubleState class.
 /// </summary>
 /// <param name="redirect">Inheritence redirection instance.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public PaletteBreadCrumbDoubleState(PaletteBreadCrumbRedirect redirect,
                                     NeedPaintHandler needPaint)
     : base(redirect, needPaint)
 {
     _paletteCrumb = new PaletteTriple(redirect.BreadCrumb, needPaint);
 }