/// <summary> /// Initialize a new instance of the KryptonGroup class. /// </summary> public KryptonGroup() { // 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, new NeedPaintHandler(OnGroupPanelPaint)); // Make sure the panel back style always mimics our back style _panel.PanelBackStyle = PaletteBackStyle.ControlClient; // Create the element that fills the remainder space and remembers fill rectange _layoutFill = new ViewLayoutFill(_panel); // Create view for the control border and background _drawDocker = new ViewDrawDocker(_stateNormal.Back, _stateNormal.Border); _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; // Add panel to the controls collection ((KryptonReadOnlyControls)Controls).AddInternal(_panel); }
/// <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() { // 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 rectange _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) { }
/// <summary> /// Initialize a new instance of the KryptonPanel class. /// </summary> public KryptonPanel() { // 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 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> public 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); }
/// <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) { _paletteItemHighlight = new PaletteDoubleMetric(redirectItemHighlight); _paletteItemImage = new PaletteTripleJustImage(redirectItemImage); _paletteItemShortcutText = new PaletteContentJustShortText(redirectItemShortcutText); _paletteItemSplit = new PaletteDouble(redirectItemSplit); _paletteItemTextStandard = new PaletteContentJustText(redirectItemTextStandard); _paletteItemTextAlternate = new PaletteContentJustText(redirectItemTextAlternate); }
/// <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) { Debug.Assert(stateCommon != null); Debug.Assert(stateDisabled != null); Debug.Assert(stateNormal != null); // Remember the palette storage _stateCommon = stateCommon; _stateDisabled = stateDisabled; _stateNormal = stateNormal; Construct(); }
/// <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; }
public KryptonListBox() { // Contains another control and needs marking as such for validation to work SetStyle(ControlStyles.ContainerControl, true); // Cannot select this control, only the child ListBox and does not generate a click event SetStyle(ControlStyles.Selectable | ControlStyles.StandardClick, false); // Default fields _alwaysActive = true; _lastSelectedIndex = -1; _style = ButtonStyle.ListItem; base.Padding = new Padding(1); // Create the palette storage _stateCommon = new PaletteListStateRedirect(Redirector, PaletteBackStyle.InputControlStandalone, PaletteBorderStyle.InputControlStandalone, NeedPaintDelegate); _stateFocus = 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 the override handling classes _overrideNormal = new PaletteTripleOverride(_stateFocus.Item, _stateNormal.Item, PaletteState.FocusOverride); _overrideTracking = new PaletteTripleOverride(_stateFocus.Item, _stateTracking.Item, PaletteState.FocusOverride); _overridePressed = new PaletteTripleOverride(_stateFocus.Item, _statePressed.Item, PaletteState.FocusOverride); _overrideCheckedNormal = new PaletteTripleOverride(_stateFocus.Item, _stateCheckedNormal.Item, PaletteState.FocusOverride); _overrideCheckedTracking = new PaletteTripleOverride(_stateFocus.Item, _stateCheckedTracking.Item, PaletteState.FocusOverride); _overrideCheckedPressed = new PaletteTripleOverride(_stateFocus.Item, _stateCheckedPressed.Item, PaletteState.FocusOverride); // Create the draw element for owner drawing individual items _contentValues = new FixedContentValue(); _drawButton = new ViewDrawButton(StateDisabled.Item, _overrideNormal, _overrideTracking, _overridePressed, _overrideCheckedNormal, _overrideCheckedTracking, _overrideCheckedPressed, new PaletteMetricRedirect(Redirector), _contentValues, VisualOrientation.Top, false); // Create the internal list box used for containing content _listBox = new InternalListBox(this); _listBox.DrawItem += new DrawItemEventHandler(OnListBoxDrawItem); _listBox.MeasureItem += new MeasureItemEventHandler(OnListBoxMeasureItem); _listBox.TrackMouseEnter += new EventHandler(OnListBoxMouseChange); _listBox.TrackMouseLeave += new EventHandler(OnListBoxMouseChange); _listBox.DataSourceChanged += new EventHandler(OnListBoxDataSourceChanged); _listBox.DisplayMemberChanged += new EventHandler(OnListBoxDisplayMemberChanged); _listBox.ValueMemberChanged += new EventHandler(OnListBoxValueMemberChanged); _listBox.SelectedIndexChanged += new EventHandler(OnListBoxSelectedIndexChanged); _listBox.SelectedValueChanged += new EventHandler(OnListBoxSelectedValueChanged); _listBox.DisplayMemberChanged += new EventHandler(OnListBoxDisplayMemberChanged); _listBox.Format += new ListControlConvertEventHandler(OnListBoxFormat); _listBox.FormatInfoChanged += new EventHandler(OnListBoxFormatInfoChanged); _listBox.FormatStringChanged += new EventHandler(OnListBoxFormatStringChanged); _listBox.FormattingEnabledChanged += new EventHandler(OnListBoxFormattingEnabledChanged); _listBox.GotFocus += new EventHandler(OnListBoxGotFocus); _listBox.LostFocus += new EventHandler(OnListBoxLostFocus); _listBox.KeyDown += new KeyEventHandler(OnListBoxKeyDown); _listBox.KeyUp += new KeyEventHandler(OnListBoxKeyUp); _listBox.KeyPress += new KeyPressEventHandler(OnListBoxKeyPress); _listBox.PreviewKeyDown += new PreviewKeyDownEventHandler(OnListBoxPreviewKeyDown); _listBox.Validating += new CancelEventHandler(OnListBoxValidating); _listBox.Validated += new EventHandler(OnListBoxValidated); // Create the element that fills the remainder space and remembers fill rectange _layoutFill = new ViewLayoutFill(_listBox); _layoutFill.DisplayPadding = new Padding(1); // Create inner view for placing inside the drawing docker _drawDockerInner = new ViewLayoutDocker(); _drawDockerInner.Add(_layoutFill, ViewDockStyle.Fill); // Create view for the control border and background _drawDockerOuter = new ViewDrawDocker(_stateNormal.Back, _stateNormal.Border); _drawDockerOuter.Add(_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); // Add list box to the controls collection ((KryptonReadOnlyControls)Controls).AddInternal(_listBox); }
public KryptonTreeView() { // Contains another control and needs marking as such for validation to work SetStyle(ControlStyles.ContainerControl, true); // Cannot select this control, only the child tree view and does not generate a click event SetStyle(ControlStyles.Selectable | ControlStyles.StandardClick, false); // Default fields _alwaysActive = true; _style = ButtonStyle.ListItem; _itemHeightDefault = true; _plusMinusImages = new TreeViewImages(); _checkBoxImages = new CheckBoxImages(); base.Padding = new Padding(1); // Create the palette storage _redirectImages = new PaletteRedirectTreeView(Redirector, _plusMinusImages, _checkBoxImages); PaletteBackInheritRedirect backInherit = new PaletteBackInheritRedirect(Redirector, PaletteBackStyle.InputControlStandalone); PaletteBorderInheritRedirect borderInherit = new PaletteBorderInheritRedirect(Redirector, PaletteBorderStyle.InputControlStandalone); PaletteBackColor1 commonBack = new PaletteBackColor1(backInherit, NeedPaintDelegate); PaletteBorder commonBorder = new PaletteBorder(borderInherit, NeedPaintDelegate); _stateCommon = new PaletteTreeStateRedirect(Redirector, commonBack, backInherit, commonBorder, borderInherit, NeedPaintDelegate); PaletteBackColor1 disabledBack = new PaletteBackColor1(_stateCommon.PaletteBack, NeedPaintDelegate); PaletteBorder disabledBorder = new PaletteBorder(_stateCommon.PaletteBorder, NeedPaintDelegate); _stateDisabled = new PaletteTreeState(_stateCommon, disabledBack, disabledBorder, NeedPaintDelegate); PaletteBackColor1 normalBack = new PaletteBackColor1(_stateCommon.PaletteBack, NeedPaintDelegate); PaletteBorder normalBorder = new PaletteBorder(_stateCommon.PaletteBorder, NeedPaintDelegate); _stateNormal = new PaletteTreeState(_stateCommon, normalBack, normalBorder, NeedPaintDelegate); PaletteBackColor1 activeBack = new PaletteBackColor1(_stateCommon.PaletteBack, NeedPaintDelegate); PaletteBorder activeBorder = new PaletteBorder(_stateCommon.PaletteBorder, NeedPaintDelegate); _stateActive = new PaletteDouble(_stateCommon, activeBack, activeBorder, NeedPaintDelegate); _stateFocus = new PaletteTreeNodeTripleRedirect(Redirector, PaletteBackStyle.ButtonListItem, PaletteBorderStyle.ButtonListItem, PaletteContentStyle.ButtonListItem, NeedPaintDelegate); _stateTracking = new PaletteTreeNodeTriple(_stateCommon.Node, NeedPaintDelegate); _statePressed = new PaletteTreeNodeTriple(_stateCommon.Node, NeedPaintDelegate); _stateCheckedNormal = new PaletteTreeNodeTriple(_stateCommon.Node, NeedPaintDelegate); _stateCheckedTracking = new PaletteTreeNodeTriple(_stateCommon.Node, NeedPaintDelegate); _stateCheckedPressed = new PaletteTreeNodeTriple(_stateCommon.Node, NeedPaintDelegate); // Create the override handling classes _overrideNormal = new PaletteTripleOverride(_stateFocus.Node, _stateNormal.Node, PaletteState.FocusOverride); _overrideTracking = new PaletteTripleOverride(_stateFocus.Node, _stateTracking.Node, PaletteState.FocusOverride); _overridePressed = new PaletteTripleOverride(_stateFocus.Node, _statePressed.Node, PaletteState.FocusOverride); _overrideCheckedNormal = new PaletteTripleOverride(_stateFocus.Node, _stateCheckedNormal.Node, PaletteState.FocusOverride); _overrideCheckedTracking = new PaletteTripleOverride(_stateFocus.Node, _stateCheckedTracking.Node, PaletteState.FocusOverride); _overrideCheckedPressed = new PaletteTripleOverride(_stateFocus.Node, _stateCheckedPressed.Node, PaletteState.FocusOverride); _overrideNormalNode = new PaletteNodeOverride(_overrideNormal); // Create the check box image drawer and place inside element so it is always centered _drawCheckBox = new ViewDrawCheckBox(_redirectImages); _layoutCheckBox = new ViewLayoutCenter(); _layoutCheckBox.Add(_drawCheckBox); // 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); _layoutImageStack.Add(_layoutImageCenter); _layoutImageStack.Add(_layoutImageAfter); _layoutImageState = new ViewLayoutSeparator(16, 16); _layoutImageCenterState = new ViewLayoutCenter(_layoutImageState); // Create the draw element for owner drawing individual items _contentValues = new FixedContentValue(); _drawButton = new ViewDrawButton(StateDisabled.Node, _overrideNormalNode, _overrideTracking, _overridePressed, _overrideCheckedNormal, _overrideCheckedTracking, _overrideCheckedPressed, new PaletteMetricRedirect(Redirector), _contentValues, VisualOrientation.Top, false); // Place check box on the left and the label in the remainder _layoutDocker = new ViewLayoutDocker(); _layoutDocker.Add(_layoutImageStack, ViewDockStyle.Left); _layoutDocker.Add(_layoutImageCenterState, ViewDockStyle.Left); _layoutDocker.Add(_layoutCheckBox, ViewDockStyle.Left); _layoutDocker.Add(_drawButton, ViewDockStyle.Fill); // Create the internal tree view used for containing content _treeView = new InternalTreeView(this); _treeView.TrackMouseEnter += new EventHandler(OnTreeViewMouseChange); _treeView.TrackMouseLeave += new EventHandler(OnTreeViewMouseChange); _treeView.GotFocus += new EventHandler(OnTreeViewGotFocus); _treeView.LostFocus += new EventHandler(OnTreeViewLostFocus); _treeView.KeyDown += new KeyEventHandler(OnTreeViewKeyDown); _treeView.KeyUp += new KeyEventHandler(OnTreeViewKeyUp); _treeView.KeyPress += new KeyPressEventHandler(OnTreeViewKeyPress); _treeView.PreviewKeyDown += new PreviewKeyDownEventHandler(OnTreeViewPreviewKeyDown); _treeView.Validating += new CancelEventHandler(OnTreeViewValidating); _treeView.Validated += new EventHandler(OnTreeViewValidated); _treeView.AfterCheck += new TreeViewEventHandler(OnTreeViewAfterCheck); _treeView.AfterCollapse += new TreeViewEventHandler(OnTreeViewAfterCollapse); _treeView.AfterExpand += new TreeViewEventHandler(OnTreeViewAfterExpand); _treeView.AfterLabelEdit += new NodeLabelEditEventHandler(OnTreeViewAfterLabelEdit); _treeView.AfterSelect += new TreeViewEventHandler(OnTreeViewAfterSelect); _treeView.BeforeCheck += new TreeViewCancelEventHandler(OnTreeViewBeforeCheck); _treeView.BeforeCollapse += new TreeViewCancelEventHandler(OnTreeViewBeforeCollapse); _treeView.BeforeExpand += new TreeViewCancelEventHandler(OnTreeViewBeforeExpand); _treeView.BeforeLabelEdit += new NodeLabelEditEventHandler(OnTreeViewBeforeLabelEdit); _treeView.BeforeSelect += new TreeViewCancelEventHandler(OnTreeViewBeforeSelect); _treeView.ItemDrag += new ItemDragEventHandler(OnTreeViewItemDrag); _treeView.NodeMouseClick += new TreeNodeMouseClickEventHandler(OnTreeViewNodeMouseClick); _treeView.NodeMouseDoubleClick += new TreeNodeMouseClickEventHandler(OnTreeViewNodeMouseDoubleClick); _treeView.NodeMouseHover += new TreeNodeMouseHoverEventHandler(OnTreeViewNodeMouseHover); _treeView.DrawNode += new DrawTreeNodeEventHandler(OnTreeViewDrawNode); _treeView.DrawMode = TreeViewDrawMode.OwnerDrawAll; // Create the element that fills the remainder space and remembers fill rectange _layoutFill = new ViewLayoutFill(_treeView); _layoutFill.DisplayPadding = new Padding(1); // Create inner view for placing inside the drawing docker _drawDockerInner = new ViewLayoutDocker(); _drawDockerInner.Add(_layoutFill, ViewDockStyle.Fill); // Create view for the control border and background _drawDockerOuter = new ViewDrawDocker(_stateNormal.Back, _stateNormal.Border); _drawDockerOuter.Add(_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); // Add tree view to the controls collection ((KryptonReadOnlyControls)Controls).AddInternal(_treeView); }
/// <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); }
/// <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) { _paletteItemHighlight = new PaletteDoubleMetric(redirectItemHighlight); _paletteItemSplit = new PaletteDouble(redirectItemSplit); }