Redirect storage for GroupBox states.
Inheritance: PaletteDoubleRedirect
Exemplo n.º 1
0
        /// <summary>
        /// Initialize a new instance of the KryptonGroupBox class.
        /// </summary>
        public KryptonGroupBox()
        {
            // Set default values
            _captionStyle       = LabelStyle.GroupBoxCaption;
            _captionEdge        = VisualOrientation.Top;
            _captionOrientation = ButtonOrientation.Auto;
            _captionVisible     = true;

            // Create storage objects
            Values              = new CaptionValues(NeedPaintDelegate);
            Values.TextChanged += OnValuesTextChanged;

            // Create the palette storage
            StateCommon   = new PaletteGroupBoxRedirect(Redirector, NeedPaintDelegate);
            StateDisabled = new PaletteGroupBox(StateCommon, NeedPaintDelegate);
            StateNormal   = new PaletteGroupBox(StateCommon, NeedPaintDelegate);

            // Create the internal panel used for containing content
            Panel = new KryptonGroupPanel(this, StateCommon, StateDisabled, StateNormal, OnGroupPanelPaint)
            {
                // Make sure the panel back style always mimics our back style
                PanelBackStyle = PaletteBackStyle.ControlGroupBox
            };

            _drawContent = new ViewDrawContent(StateNormal.Content, Values, VisualOrientation.Top);

            // Create view for the control border and background
            _drawDocker = new ViewDrawGroupBoxDocker(StateNormal.Back, StateNormal.Border);

            // Create the element that fills the remainder space and remembers fill rectange
            _layoutFill = new ViewLayoutFill(Panel);

            // Add caption into the docker with initial dock edges defined
            _drawDocker.Add(_drawContent, ViewDockStyle.Top);
            _drawDocker.Add(_layoutFill, ViewDockStyle.Fill);

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

            // We want to default to shrinking and growing (base class defaults to GrowOnly)
            AutoSizeMode = AutoSizeMode.GrowAndShrink;

            // Create the delegate used when we need to ensure obscurer is removed
            _removeObscurer = OnRemoveObscurer;

            // Need to prevent the AddInternal from causing a layout, otherwise the
            // layout will probably try to measure text which causes the handle for the
            // control to be created which means the handle is created at the wrong time
            // and so child controls are not added properly in the future! (for the TabControl
            // at the very least).
            _ignoreLayout = true;

            // Add panel to the controls collection
            ((KryptonReadOnlyControls)Controls).AddInternal(Panel);

            _ignoreLayout = false;
        }
 /// <summary>
 /// Initialize a new instance of the PaletteGroupBox class.
 /// </summary>
 /// <param name="inherit">Source for inheriting palette defaulted values.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public PaletteGroupBox(PaletteGroupBoxRedirect inherit,
                        NeedPaintHandler needPaint)
     : base(inherit, needPaint)
 {
     Content = new PaletteContent(inherit.PaletteContent, needPaint);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initialize a new instance of the PaletteGroupBox class.
 /// </summary>
 /// <param name="inherit">Source for inheriting palette defaulted values.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public PaletteGroupBox(PaletteGroupBoxRedirect inherit,
     NeedPaintHandler needPaint)
     : base(inherit, needPaint)
 {
     _content = new PaletteContent(inherit.PaletteContent, needPaint);
 }