예제 #1
0
 /// <summary>
 /// Initialize a new instance of the KryptonPaletteHeader class.
 /// </summary>
 /// <param name="redirect">Redirector to inherit values from.</param>
 /// <param name="backStyle">Background style.</param>
 /// <param name="borderStyle">Border style.</param>
 /// <param name="contentStyle">Content style.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public KryptonPaletteHeader(PaletteRedirect redirect,
                             PaletteBackStyle backStyle,
                             PaletteBorderStyle borderStyle,
                             PaletteContentStyle contentStyle,
                             NeedPaintHandler needPaint)
 {
     // Create the storage objects
     _stateCommon   = new PaletteHeaderRedirect(redirect, backStyle, borderStyle, contentStyle, needPaint);
     _stateDisabled = new PaletteTripleMetric(_stateCommon, needPaint);
     _stateNormal   = new PaletteTripleMetric(_stateCommon, needPaint);
 }
예제 #2
0
        /// <summary>
        /// Initialize a new instance of the KryptonHeader class.
        /// </summary>
        public KryptonHeader()
        {
            // The header cannot take the focus
            SetStyle(ControlStyles.Selectable, false);

            // Set default values
            _style                   = HeaderStyle.Primary;
            _orientation             = VisualOrientation.Top;
            _allowButtonSpecToolTips = false;

            // Create storage objects
            _headerValues              = new HeaderValues(NeedPaintDelegate);
            _headerValues.TextChanged += new EventHandler(OnHeaderTextChanged);
            _buttonSpecs = new HeaderButtonSpecCollection(this);

            // Create the palette storage
            _stateCommon   = new PaletteHeaderRedirect(Redirector, PaletteBackStyle.HeaderPrimary, PaletteBorderStyle.HeaderPrimary, PaletteContentStyle.HeaderPrimary, NeedPaintDelegate);
            _stateDisabled = new PaletteTripleMetric(_stateCommon, NeedPaintDelegate);
            _stateNormal   = new PaletteTripleMetric(_stateCommon, NeedPaintDelegate);

            // Our view contains background and border with content inside
            _drawDocker  = new ViewDrawDocker(_stateNormal.Back, _stateNormal.Border, null);
            _drawContent = new ViewDrawContent(_stateNormal.Content, _headerValues, Orientation);
            _drawDocker.Add(_drawContent, 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.HeaderButtonPaddingPrimary },
                                                       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;

            // We want to be auto sized by default, but not the property default!
            AutoSize     = true;
            AutoSizeMode = AutoSizeMode.GrowAndShrink;
        }