Example #1
0
 /// <summary>
 /// Initialize a new instance of the ViewDrawMenuSeparator class.
 /// </summary>
 /// <param name="state">State specific source of palette values.</param>
 public ViewDrawMenuSeparator(PaletteDouble state)
     : base(state.Back, state.Border)
 {
     // We need to be big enough to contain 1 pixel square spacer
     Orientation = VisualOrientation.Left;
     Add(new ViewLayoutSeparator(1));
 }
        /// <summary>
        /// Initialize a new instance of the KryptonGroup class.
        /// </summary>
        public KryptonGroup()
        {
            SetStyle(ControlStyles.SupportsTransparentBackColor | ControlStyles.OptimizedDoubleBuffer, true);

            // Create the palette storage
            StateCommon   = new PaletteDoubleRedirect(Redirector, PaletteBackStyle.ControlClient, PaletteBorderStyle.ControlClient, NeedPaintDelegate);
            StateDisabled = new PaletteDouble(StateCommon, NeedPaintDelegate);
            StateNormal   = new PaletteDouble(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.ControlClient
            };

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

            // Create view for the control border and background
            _drawDocker = new ViewDrawDocker(StateNormal.Back, StateNormal.Border)
            {
                { _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;

            // Add panel to the controls collection
            ((KryptonReadOnlyControls)Controls).AddInternal(Panel);
        }
 /// <summary>
 /// Initialize a new instance of the KryptonGroupPanel class.
 /// </summary>
 /// <param name="alignControl">Container control for alignment.</param>
 /// <param name="stateCommon">Common appearance state to inherit from.</param>
 /// <param name="stateDisabled">Disabled appearance state.</param>
 /// <param name="stateNormal">Normal appearance state.</param>
 /// <param name="layoutHandler">Callback delegate for layout processing.</param>
 public KryptonGroupBoxPanel(Control alignControl,
                             PaletteDoubleRedirect stateCommon,
                             PaletteDouble stateDisabled,
                             PaletteDouble stateNormal,
                             NeedPaintHandler layoutHandler)
     : base(alignControl, stateCommon, stateDisabled, stateNormal, layoutHandler)
 {
 }
Example #4
0
        /// <summary>
        /// Initialize a new instance of the PaletteDataGridViewAll class.
        /// </summary>
        /// <param name="inherit">Source for inheriting values.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public PaletteDataGridViewAll(PaletteDataGridViewRedirect inherit,
                                      NeedPaintHandler needPaint)
            : base(inherit, needPaint)
        {
            Debug.Assert(inherit != null);

            // Create storage that maps onto the inherit instances
            _background = new PaletteDouble(inherit.BackgroundDouble, needPaint);
        }
 /// <summary>
 /// Initialize a new instance of KryptonPaletteDouble3 KryptonPaletteControl 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="needPaint">Delegate for notifying paint requests.</param>
 protected KryptonPaletteDouble3(PaletteRedirect redirect,
                                 PaletteBackStyle backStyle,
                                 PaletteBorderStyle borderStyle,
                                 NeedPaintHandler needPaint)
 {
     // Create the storage objects
     _stateCommon   = new PaletteDoubleRedirect(redirect, backStyle, borderStyle, needPaint);
     _stateDisabled = new PaletteDouble(_stateCommon, needPaint);
     _stateNormal   = new PaletteDouble(_stateCommon, needPaint);
 }
Example #6
0
        /// <summary>
        /// Initialize a new instance of the KryptonPanel class.
        /// </summary>
        public KryptonPanel()
        {
            SetStyle(ControlStyles.SupportsTransparentBackColor | ControlStyles.OptimizedDoubleBuffer, true);

            // Create the palette storage
            _stateCommon   = new PaletteDoubleRedirect(Redirector, PaletteBackStyle.PanelClient, PaletteBorderStyle.ControlClient, NeedPaintDelegate);
            _stateDisabled = new PaletteDouble(_stateCommon, NeedPaintDelegate);
            _stateNormal   = new PaletteDouble(_stateCommon, NeedPaintDelegate);

            Construct();
        }
 /// <summary>
 /// Initialize a new instance of the PaletteContextMenuItemState class.
 /// </summary>
 /// <param name="redirectItemHighlight">Redirector for ItemHighlight.</param>
 /// <param name="redirectItemImage">Redirector for ItemImage.</param>
 /// <param name="redirectItemShortcutText">Redirector for ItemShortcutText.</param>
 /// <param name="redirectItemSplit">Redirector for ItemSplit.</param>
 /// <param name="redirectItemTextAlternate">Redirector for ItemTextStandard.</param>
 /// <param name="redirectItemTextStandard">Redirector for ItemTextAlternate.</param>
 public PaletteContextMenuItemState(PaletteDoubleMetricRedirect redirectItemHighlight,
                                    PaletteTripleJustImageRedirect redirectItemImage,
                                    PaletteContentInheritRedirect redirectItemShortcutText,
                                    PaletteDoubleRedirect redirectItemSplit,
                                    PaletteContentInheritRedirect redirectItemTextStandard,
                                    PaletteContentInheritRedirect redirectItemTextAlternate)
 {
     ItemHighlight     = new PaletteDoubleMetric(redirectItemHighlight);
     ItemImage         = new PaletteTripleJustImage(redirectItemImage);
     ItemShortcutText  = new PaletteContentJustShortText(redirectItemShortcutText);
     ItemSplit         = new PaletteDouble(redirectItemSplit);
     ItemTextStandard  = new PaletteContentJustText(redirectItemTextStandard);
     ItemTextAlternate = new PaletteContentJustText(redirectItemTextAlternate);
 }
Example #8
0
        /// <summary>
        /// Initialize a new instance of the KryptonPanel class.
        /// </summary>
        /// <param name="stateCommon">Common appearance state to inherit from.</param>
        /// <param name="stateDisabled">Disabled appearance state.</param>
        /// <param name="stateNormal">Normal appearance state.</param>
        public KryptonPanel(PaletteDoubleRedirect stateCommon,
                            PaletteDouble stateDisabled,
                            PaletteDouble stateNormal)
        {
            SetStyle(ControlStyles.SupportsTransparentBackColor | ControlStyles.OptimizedDoubleBuffer, true);

            Debug.Assert(stateCommon != null);
            Debug.Assert(stateDisabled != null);
            Debug.Assert(stateNormal != null);

            // Remember the palette storage
            _stateCommon   = stateCommon;
            _stateDisabled = stateDisabled;
            _stateNormal   = stateNormal;

            Construct();
        }
Example #9
0
        /// <summary>
        /// Initialize a new instance of the KryptonGroupPanel class.
        /// </summary>
        /// <param name="alignControl">Container control for alignment.</param>
        /// <param name="stateCommon">Common appearance state to inherit from.</param>
        /// <param name="stateDisabled">Disabled appearance state.</param>
        /// <param name="stateNormal">Normal appearance state.</param>
        /// <param name="layoutHandler">Callback delegate for layout processing.</param>
        public KryptonGroupPanel(Control alignControl,
                                 PaletteDoubleRedirect stateCommon,
                                 PaletteDouble stateDisabled,
                                 PaletteDouble stateNormal,
                                 NeedPaintHandler layoutHandler)
            : base(stateCommon, stateDisabled, stateNormal)
        {
            // Remember the delegate used to notify layouts
            _layoutHandler = layoutHandler;

            // Create the forced overrides to enforce the graphics option we want
            _forcedDisabled = new PaletteBackInheritForced(stateDisabled.Back);
            _forcedNormal   = new PaletteBackInheritForced(stateNormal.Back);

            // We never allow the anti alias option as it prevent transparent background working
            _forcedDisabled.ForceGraphicsHint = PaletteGraphicsHint.None;
            _forcedNormal.ForceGraphicsHint   = PaletteGraphicsHint.None;

            // Set the correct initial palettes
            ViewDrawPanel.SetPalettes(Enabled ? _forcedNormal : _forcedDisabled);

            // Make sure the alignment of the group panel is as that of the parent
            ViewManager.AlignControl = alignControl;
        }
 /// <summary>
 /// Initialize a new instance of the PaletteContextMenuItemStateHighlight class.
 /// </summary>
 /// <param name="redirectItemHighlight">Redirector for the ItemHighlight.</param>
 /// <param name="redirectItemSplit">Redirector for the ItemSplit.</param>
 public PaletteContextMenuItemStateHighlight(PaletteDoubleMetricRedirect redirectItemHighlight,
                                             PaletteDoubleRedirect redirectItemSplit)
 {
     ItemHighlight = new PaletteDoubleMetric(redirectItemHighlight);
     ItemSplit     = new PaletteDouble(redirectItemSplit);
 }
        public KryptonListView()
        {
            SetStyle(ControlStyles.AllPaintingInWmPaint
                     | ControlStyles.OptimizedDoubleBuffer
                     | ControlStyles.SupportsTransparentBackColor // Cannot get thi sto work (Code removed)!!
                     | ControlStyles.EnableNotifyMessage
                     , true);

            base.OwnerDraw = true;
            // We need to repaint entire control whenever resized
            SetStyle(ControlStyles.ResizeRedraw, true);
            // Yes, we want to be drawn double buffered by default
            DoubleBuffered = true;

            // Default fields
            _alwaysActive    = true;
            _style           = ButtonStyle.ListItem;
            Padding          = new Padding(1);
            base.BorderStyle = System.Windows.Forms.BorderStyle.None;

            // We need to create and cache a device context compatible with the display
            _screenDC = PI.CreateCompatibleDC(IntPtr.Zero);

            // Set the palette and renderer to the defaults as specified by the manager
            Redirector = new PaletteRedirect(null);
            CacheNewPalette(KryptonManager.CurrentGlobalPalette);

            KryptonManager.GlobalPaletteChanged += OnGlobalPaletteChanged;

            NeedPaintDelegate = OnNeedPaint;

            // Create the palette storage
            Images = new CheckBoxImages(NeedPaintDelegate);
            _paletteCheckBoxImages = new PaletteRedirectCheckBox(Redirector, Images);
            StateCommon            = new PaletteListStateRedirect(Redirector, PaletteBackStyle.InputControlStandalone, PaletteBorderStyle.InputControlStandalone, NeedPaintDelegate);
            OverrideFocus          = new PaletteListItemTripleRedirect(Redirector, PaletteBackStyle.ButtonListItem, PaletteBorderStyle.ButtonListItem, PaletteContentStyle.ButtonListItem, NeedPaintDelegate);
            StateDisabled          = new PaletteListState(StateCommon, NeedPaintDelegate);
            StateActive            = new PaletteDouble(StateCommon, NeedPaintDelegate);
            StateNormal            = new PaletteListState(StateCommon, NeedPaintDelegate);
            StateTracking          = new PaletteListItemTriple(StateCommon.Item, NeedPaintDelegate);
            StatePressed           = new PaletteListItemTriple(StateCommon.Item, NeedPaintDelegate);
            StateCheckedNormal     = new PaletteListItemTriple(StateCommon.Item, NeedPaintDelegate);
            StateCheckedTracking   = new PaletteListItemTriple(StateCommon.Item, NeedPaintDelegate);
            StateCheckedPressed    = new PaletteListItemTriple(StateCommon.Item, NeedPaintDelegate);
            // Create manager and view for drawing the background
            ViewDrawPanel = new ViewDrawPanel(StateNormal.Back);

            // Create the override handling classes
            _overrideNormal          = new PaletteTripleOverride(OverrideFocus.Item, StateNormal.Item, PaletteState.FocusOverride);
            _overrideTracking        = new PaletteTripleOverride(OverrideFocus.Item, StateTracking.Item, PaletteState.FocusOverride);
            _overridePressed         = new PaletteTripleOverride(OverrideFocus.Item, StatePressed.Item, PaletteState.FocusOverride);
            _overrideCheckedNormal   = new PaletteTripleOverride(OverrideFocus.Item, StateCheckedNormal.Item, PaletteState.FocusOverride);
            _overrideCheckedTracking = new PaletteTripleOverride(OverrideFocus.Item, StateCheckedTracking.Item, PaletteState.FocusOverride);
            _overrideCheckedPressed  = new PaletteTripleOverride(OverrideFocus.Item, StateCheckedPressed.Item, PaletteState.FocusOverride);

            // Create the check box image drawer and place inside element so it is always centered
            _drawCheckBox   = new ViewDrawCheckBox(_paletteCheckBoxImages);
            _layoutCheckBox = new ViewLayoutCenter
            {
                _drawCheckBox
            };
            _layoutCheckBoxAfter = new ViewLayoutSeparator(3, 0);
            _layoutCheckBoxStack = new ViewLayoutStack(true)
            {
                _layoutCheckBox,
                _layoutCheckBoxAfter
            };
            // Stack used to layout the location of the node image
            _layoutImage       = new ViewLayoutSeparator(0, 0);
            _layoutImageAfter  = new ViewLayoutSeparator(3, 0);
            _layoutImageCenter = new ViewLayoutCenter(_layoutImage);
            _layoutImageStack  = new ViewLayoutStack(true)
            {
                _layoutImageCenter,
                _layoutImageAfter
            };
            _layoutImageState       = new ViewLayoutSeparator(16, 16);
            _layoutImageCenterState = new ViewLayoutCenter(_layoutImageState);
            // Create the draw element for owner drawing individual items
            _contentValues = new ShortTextValue();
            _drawButton    = new ViewDrawButton(StateDisabled.Item, _overrideNormal,
                                                _overrideTracking, _overridePressed,
                                                _overrideCheckedNormal, _overrideCheckedTracking,
                                                _overrideCheckedPressed,
                                                new PaletteMetricRedirect(Redirector),
                                                _contentValues, VisualOrientation.Top, false);

            // Place check box on the left and the label in the remainder
            _layoutDockerTile = new ViewLayoutDocker
            {
                { _layoutImageStack, ViewDockStyle.Left },
                { _layoutImageCenterState, ViewDockStyle.Left },
                { _layoutCheckBoxStack, ViewDockStyle.Left },
                { _drawButton, ViewDockStyle.Fill }
            };

            _layoutDockerSmall = new ViewLayoutDocker
            {
                { _drawButton, ViewDockStyle.Left },
                { _layoutImageStack, ViewDockStyle.Left },
                { _layoutImageCenterState, ViewDockStyle.Left },
                { _layoutCheckBoxStack, ViewDockStyle.Left }
            };

            // Place check box on the left and the text to match the width
            _layoutDockerCheckLarge = new ViewLayoutDocker
            {
                { _layoutImageStack, ViewDockStyle.Left },
                { _layoutImageCenterState, ViewDockStyle.Left },
                { _layoutCheckBoxStack, ViewDockStyle.Left },
                { _drawButton, ViewDockStyle.Bottom }
            };

            // Create the element that fills the remainder space and remembers fill rectangle
            _layoutFill = new ViewLayoutFill(this)
            {
                DisplayPadding = new Padding(1)
            };

            // Create inner view for placing inside the drawing docker
            _drawDockerInner = new ViewLayoutDocker
            {
                { _layoutFill, ViewDockStyle.Fill }
            };

            // Create view for the control border and background
            _drawDockerOuter = new ViewDrawDocker(StateNormal.Back, StateNormal.Border)
            {
                { _drawDockerInner, ViewDockStyle.Fill }
            };

            // Create the view manager instance
            ViewManager = new ViewManager(this, _drawDockerOuter);
            // We need to create and cache a device context compatible with the display
            _screenDC = PI.CreateCompatibleDC(IntPtr.Zero);
            StateCommon.Item.Content.ShortText.MultiLine  = InheritBool.True;
            StateCommon.Item.Content.ShortText.MultiLineH = PaletteRelativeAlign.Center;
            StateCommon.Item.Content.ShortText.TextH      = PaletteRelativeAlign.Center;
        }