/// <summary> /// Create the view hierarchy for this view mode. /// </summary> protected override void CreateCheckItemView() { // Create a canvas for containing the selected page and put old root inside it _drawGroup = new ViewDrawCanvas(Navigator.StateNormal.HeaderGroup.Back, Navigator.StateNormal.HeaderGroup.Border, VisualOrientation.Top); _drawGroup.Add(_oldRoot); // Create the view element that lays out the check/tab buttons ViewLayoutBarForTabs layoutBar = new ViewLayoutBarForTabs(Navigator.Bar.ItemSizing, Navigator.Bar.ItemAlignment, Navigator.Bar.BarMultiline, Navigator.Bar.ItemMinimumSize, Navigator.Bar.ItemMaximumSize, Navigator.Bar.BarMinimumHeight, Navigator.Bar.TabBorderStyle, true); _layoutBar = layoutBar; // Create the scroll spacer that restricts display _layoutBarViewport = new ViewLayoutViewport(Navigator.StateCommon.Bar, PaletteMetricPadding.BarPaddingTabs, PaletteMetricInt.CheckButtonGap, Navigator.Bar.BarOrientation, Navigator.Bar.ItemAlignment, Navigator.Bar.BarAnimation); _layoutBarViewport.Add(_layoutBar); // Create the button bar area docker _layoutBarDocker = new ViewLayoutDocker(); _layoutBarDocker.Add(_layoutBarViewport, ViewDockStyle.Fill); // Add a separators for insetting items _layoutBarSeparatorFirst = new ViewLayoutSeparator(0); _layoutBarSeparatorLast = new ViewLayoutSeparator(0); _layoutBarDocker.Add(_layoutBarSeparatorFirst, ViewDockStyle.Left); _layoutBarDocker.Add(_layoutBarSeparatorLast, ViewDockStyle.Right); // Create the layout that insets the contents to allow for rounding of the group border _layoutOverlap = new ViewLayoutInsetOverlap(_drawGroup); _layoutOverlap.Add(_layoutBarDocker); // Create the docker used to layout contents of main panel and fill with group _layoutPanelDocker = new ViewLayoutDockerOverlap(_drawGroup, _layoutOverlap, layoutBar); _layoutPanelDocker.Add(_layoutOverlap, ViewDockStyle.Top); _layoutPanelDocker.Add(_drawGroup, ViewDockStyle.Fill); // Create the top level panel and put a layout docker inside it _drawPanel = new ViewDrawPanel(Navigator.StateNormal.Back); _drawPanel.Add(_layoutPanelDocker); _newRoot = _drawPanel; // Set the correct tab style UpdateTabStyle(); // Must call the base class to perform common actions base.CreateCheckItemView(); }
/// <summary> /// Initialize a new instance of the ViewLayoutRibbonQATMini class. /// </summary> /// <param name="ribbon">Owning control instance.</param> /// <param name="needPaintDelegate">Delegate for notifying paint/layout changes.</param> public ViewLayoutRibbonQATMini(KryptonRibbon ribbon, NeedPaintHandler needPaintDelegate) { Debug.Assert(ribbon != null); _ribbon = ribbon; // Create the minibar border suitable for a caption area _border = new ViewDrawRibbonQATBorder(ribbon, needPaintDelegate, true); // Create minibar content that synchs with ribbon collection _borderContents = new ViewLayoutRibbonQATFromRibbon(ribbon, needPaintDelegate, false); _border.Add(_borderContents); // Separator gap before the extra button _extraSeparator = new ViewLayoutSeparator(SEP_GAP); // Need the extra button to show after the border area _extraButton = new ViewDrawRibbonQATExtraButtonMini(ribbon, needPaintDelegate); _extraButton.ClickAndFinish += new ClickAndFinishHandler(OnExtraButtonClick); // Add layout contents Add(_border, ViewDockStyle.Fill); Add(_extraSeparator, ViewDockStyle.Right); Add(_extraButton, ViewDockStyle.Right); }
/// <summary> /// Create the view hierarchy for this view mode. /// </summary> protected override void CreateCheckItemView() { // Create a canvas for containing the selected page and put old root inside it _drawGroup = new ViewDrawCanvas(Navigator.StateNormal.HeaderGroup.Back, Navigator.StateNormal.HeaderGroup.Border, VisualOrientation.Top) { _oldRoot }; // Create the view element that lays out the check buttons _layoutBar = new ViewLayoutBar(Navigator.StateCommon.Bar, PaletteMetricInt.CheckButtonGap, Navigator.Bar.ItemSizing, Navigator.Bar.ItemAlignment, Navigator.Bar.BarMultiline, Navigator.Bar.ItemMinimumSize, Navigator.Bar.ItemMaximumSize, Navigator.Bar.BarMinimumHeight, false); // Create the scroll spacer that restricts display _layoutBarViewport = new ViewLayoutViewport(Navigator.StateCommon.Bar, PaletteMetricPadding.BarPaddingOutside, PaletteMetricInt.CheckButtonGap, Navigator.Bar.BarOrientation, Navigator.Bar.ItemAlignment, Navigator.Bar.BarAnimation) { _layoutBar }; // Create the button bar area docker _layoutBarDocker = new ViewLayoutDocker { { _layoutBarViewport, ViewDockStyle.Fill } }; // Add a separators for insetting items _layoutBarSeparatorFirst = new ViewLayoutSeparator(0); _layoutBarSeparatorLast = new ViewLayoutSeparator(0); _layoutBarDocker.Add(_layoutBarSeparatorFirst, ViewDockStyle.Left); _layoutBarDocker.Add(_layoutBarSeparatorLast, ViewDockStyle.Right); // Create the docker used to layout contents of main panel and fill with group _layoutPanelDocker = new ViewLayoutDocker { { _drawGroup, ViewDockStyle.Fill }, { _layoutBarDocker, ViewDockStyle.Top } }; // Create the top level panel and put a layout docker inside it _drawPanel = new ViewDrawPanel(Navigator.StateNormal.Back) { _layoutPanelDocker }; _newRoot = _drawPanel; // Must call the base class to perform common actions base.CreateCheckItemView(); }
/// <summary> /// Initialize a new instance of the ViewDrawMenuImageColumn class. /// </summary> /// <param name="items">Reference to the owning collection.</param> /// <param name="palette">Palette for obtaining drawing values.</param> public ViewDrawMenuImageColumn(KryptonContextMenuItems items, PaletteDoubleRedirect palette) : base(items.StateNormal.Back, items.StateNormal.Border) { // Give the items collection the redirector to use when inheriting values items.SetPaletteRedirect(palette); _separator = new ViewLayoutSeparator(0); Add(_separator); }
private void CreateViewElements() { // Create redirector for the accessing the background palette _redirectCaption = new PaletteDoubleRedirect(_redirect, PaletteBackStyle.HeaderForm, PaletteBorderStyle.HeaderForm, NeedPaintDelegate); // Create a top half for use in KryptonForm and another for use inside this caption area _captionAppButton = new ViewLayoutRibbonAppButton(_ribbon, false); _otherAppButton = new ViewLayoutRibbonAppButton(_ribbon, false); // Connect up the application button controller to the two button elements _appButtonController = new AppButtonController(_ribbon) { Target1 = _captionAppButton.AppButton, Target2 = _otherAppButton.AppButton }; _appButtonController.NeedPaint += new NeedPaintHandler(OnAppButtonNeedPaint); _captionAppButton.MouseController = _appButtonController; _otherAppButton.MouseController = _appButtonController; _appTabController = new AppTabController(_ribbon); _appTabController.NeedPaint += new NeedPaintHandler(OnAppButtonNeedPaint); // When not showing the app button we show this spacer instead _spaceInsteadOfAppButton = new ViewLayoutSeparator(0) { Visible = false }; // Quick access toolbar, minibar versions _captionQAT = new ViewLayoutRibbonQATMini(_ribbon, _needIntegratedDelegate); _nonCaptionQAT = new ViewLayoutRibbonQATMini(_ribbon, NeedPaintDelegate); // Layout needed to position and draw the context titles _contextTiles = new ViewLayoutRibbonContextTitles(_ribbon, this) { ReverseRenderOrder = true }; // Create composition right border and attach to composition area _compRightBorder = new ViewDrawRibbonCompoRightBorder(); _compositionArea.CompRightBorder = _compRightBorder; // Place app button on left side and fill remainder with context titles Add(_contextTiles, ViewDockStyle.Fill); Add(_nonCaptionQAT, ViewDockStyle.Left); Add(_otherAppButton, ViewDockStyle.Left); // Update base class to use correct palette interface base.SetPalettes(_redirectCaption.PaletteBack, _redirectCaption.PaletteBorder); }
/// <summary> /// Create the view hierarchy for this view mode. /// </summary> protected override void CreateCheckItemView() { // Create the view element that lays out the check buttons _layoutBar = new ViewLayoutBar(Navigator.StateCommon.Bar, PaletteMetricInt.RibbonTabGap, Navigator.Bar.ItemSizing, Navigator.Bar.ItemAlignment, Navigator.Bar.BarMultiline, Navigator.Bar.ItemMinimumSize, Navigator.Bar.ItemMaximumSize, Navigator.Bar.BarMinimumHeight, Navigator.Bar.TabBorderStyle, true); // Create the scroll spacer that restricts display _layoutBarViewport = new ViewLayoutViewport(Navigator.StateCommon.Bar, PaletteMetricPadding.BarPaddingTabs, PaletteMetricInt.RibbonTabGap, Navigator.Bar.BarOrientation, Navigator.Bar.ItemAlignment, Navigator.Bar.BarAnimation); _layoutBarViewport.Add(_layoutBar); // Create the button bar area docker _layoutBarDocker = new ViewLayoutDocker(); _layoutBarDocker.Add(_layoutBarViewport, ViewDockStyle.Fill); // Add a separators for insetting items _layoutBarSeparatorFirst = new ViewLayoutSeparator(0); _layoutBarSeparatorLast = new ViewLayoutSeparator(0); _layoutBarDocker.Add(_layoutBarSeparatorFirst, ViewDockStyle.Left); _layoutBarDocker.Add(_layoutBarSeparatorLast, ViewDockStyle.Right); // Create the docker used to layout contents of main panel and fill with group _layoutPanelDocker = new ViewLayoutDocker(); _layoutPanelDocker.Add(_layoutBarDocker, ViewDockStyle.Fill); _layoutPanelDocker.Add(new ViewLayoutPageHide(Navigator), ViewDockStyle.Top); // Create the top level panel and put a layout docker inside it _drawPanel = new ViewDrawPanel(Navigator.StateNormal.Back); _drawPanel.Add(_layoutPanelDocker); _newRoot = _drawPanel; // Must call the base class to perform common actions base.CreateCheckItemView(); }
private void CreateViewElements(PaletteRedirect redirect) { // Layout for individual tabs inside the header _layoutRibbonTabs = new ViewLayoutRibbonTabs(_ribbon, NeedPaintDelegate); // Put inside a viewport so scrollers are used when tabs cannot be shrunk to fill space _tabsViewport = new ViewLayoutRibbonScrollPort(_ribbon, System.Windows.Forms.Orientation.Horizontal, _layoutRibbonTabs, true, SCROLL_SPEED, NeedPaintDelegate); _tabsViewport.TransparentBackground = true; _tabsViewport.PaintBackground += new PaintEventHandler(OnTabsPaintBackground); _layoutRibbonTabs.ParentControl = _tabsViewport.ViewLayoutControl.ChildControl; _layoutRibbonTabs.NeedPaintDelegate = _tabsViewport.ViewControlPaintDelegate; // We use a layout docker as a child to prevent buttons going to the left of the app button ViewLayoutDocker tabsDocker = new ViewLayoutDocker(); // Place the tabs viewport as the fill inside ourself, the button specs will be placed // to the left and right of this fill element automatically by the button manager below tabsDocker.Add(_tabsViewport, ViewDockStyle.Fill); // We need to draw the bottom half of the application button or a full app tab _layoutAppButton = new ViewLayoutRibbonAppButton(_ribbon, true); _layoutAppTab = new ViewLayoutRibbonAppTab(_ribbon); // Connect up the application button controller to the app button element _appButtonController.Target3 = _layoutAppButton.AppButton; _appButtonController.Click += new EventHandler(OnAppButtonClicked); _appButtonController.MouseReleased += new EventHandler(OnAppButtonReleased); _layoutAppButton.MouseController = _appButtonController; _layoutAppButton.SourceController = _appButtonController; _layoutAppButton.KeyController = _appButtonController; _appTabController.Target1 = _layoutAppTab.AppTab; _appTabController.Click += new EventHandler(OnAppButtonClicked); _appTabController.MouseReleased += new EventHandler(OnAppButtonReleased); _layoutAppTab.MouseController = _appTabController; _layoutAppTab.SourceController = _appTabController; _layoutAppTab.KeyController = _appTabController; // When the app button is not visible we need separator instead before start of first tab _layoutAppButtonSep = new ViewLayoutSeparator(5, 0); _layoutAppButtonSep.Visible = false; // Used separators around the tabs and the edge elements _rightSeparator = new ViewLayoutRibbonSeparator(FAR_TAB_GAP, true); _leftSeparator = new ViewLayoutRibbonSeparator(BUTTON_TAB_GAP_2007, true); // Place application button on left and tabs as the filler (with some separators for neatness) Add(_rightSeparator, ViewDockStyle.Left); Add(_leftSeparator, ViewDockStyle.Left); Add(_layoutAppButton, ViewDockStyle.Left); Add(_layoutAppButtonSep, ViewDockStyle.Left); Add(_layoutAppTab, ViewDockStyle.Left); Add(tabsDocker, ViewDockStyle.Fill); // Create button specification collection manager PaletteRedirect aeroOverrideText = new PaletteRedirectRibbonAeroOverride(_ribbon, redirect); _buttonManager = new ButtonSpecManagerLayoutRibbon(_ribbon, aeroOverrideText, _ribbon.ButtonSpecs, _buttonSpecsFixed, new ViewLayoutDocker[] { tabsDocker }, new IPaletteMetric[] { _ribbon.StateCommon }, new PaletteMetricInt[] { PaletteMetricInt.HeaderButtonEdgeInsetPrimary }, new PaletteMetricPadding[] { PaletteMetricPadding.RibbonButtonPadding }, new GetToolStripRenderer(_ribbon.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> /// Create the view hierarchy for this view mode. /// </summary> protected override void CreateCheckItemView() { // Create the two headers and header content _viewContentPrimary = new ViewDrawContent(Navigator.StateNormal.HeaderGroup.HeaderPrimary.Content, Navigator.Header.HeaderValuesPrimary, VisualOrientation.Top); _viewHeadingPrimary = new ViewDrawDocker(Navigator.StateNormal.HeaderGroup.HeaderPrimary.Back, Navigator.StateNormal.HeaderGroup.HeaderPrimary.Border, Navigator.StateNormal.HeaderGroup.HeaderPrimary, PaletteMetricBool.None, PaletteMetricPadding.HeaderGroupPaddingPrimary, VisualOrientation.Top); _viewContentSecondary = new ViewDrawContent(Navigator.StateNormal.HeaderGroup.HeaderSecondary.Content, Navigator.Header.HeaderValuesSecondary, VisualOrientation.Top); _viewHeadingSecondary = new ViewDrawDocker(Navigator.StateNormal.HeaderGroup.HeaderSecondary.Back, Navigator.StateNormal.HeaderGroup.HeaderSecondary.Border, Navigator.StateNormal.HeaderGroup.HeaderSecondary, PaletteMetricBool.None, PaletteMetricPadding.HeaderGroupPaddingSecondary, VisualOrientation.Top); // Place the the content as fillers in the headers _viewHeadingPrimary.Add(_viewContentPrimary, ViewDockStyle.Fill); _viewHeadingSecondary.Add(_viewContentSecondary, ViewDockStyle.Fill); // Create a canvas for containing the selected page and put old root inside it _drawGroup = new ViewDrawCanvas(Navigator.StateNormal.HeaderGroup.Back, Navigator.StateNormal.HeaderGroup.Border, VisualOrientation.Top) { ApplyIncludeBorderEdge = true }; _drawGroup.Add(_oldRoot); // Create the view element that lays out the check/tab buttons ViewLayoutBarForTabs layoutBar = new ViewLayoutBarForTabs(Navigator.Bar.ItemSizing, Navigator.Bar.ItemAlignment, Navigator.Bar.BarMultiline, Navigator.Bar.ItemMinimumSize, Navigator.Bar.ItemMaximumSize, Navigator.Bar.BarMinimumHeight, Navigator.Bar.TabBorderStyle, true); _layoutBar = layoutBar; // Create the scroll spacer that restricts display _layoutBarViewport = new ViewLayoutViewport(Navigator.StateCommon.Bar, PaletteMetricPadding.BarPaddingTabs, PaletteMetricInt.CheckButtonGap, Navigator.Bar.BarOrientation, Navigator.Bar.ItemAlignment, Navigator.Bar.BarAnimation) { _layoutBar }; // Create the button bar area docker _layoutBarDocker = new ViewLayoutDocker { { _layoutBarViewport, ViewDockStyle.Fill } }; // Add a separators for insetting items _layoutBarSeparatorFirst = new ViewLayoutSeparator(0); _layoutBarSeparatorLast = new ViewLayoutSeparator(0); _layoutBarDocker.Add(_layoutBarSeparatorFirst, ViewDockStyle.Left); _layoutBarDocker.Add(_layoutBarSeparatorLast, ViewDockStyle.Right); // Create the layout that insets the contents to allow for rounding of the group border _layoutOverlap = new ViewLayoutInsetOverlap(_drawGroup) { _layoutBarDocker }; // Create the docker used to layout contents of main panel and fill with group _layoutPanelDocker = new ViewLayoutDockerOverlap(_drawGroup, _layoutOverlap, layoutBar) { { _layoutOverlap, ViewDockStyle.Top }, { _drawGroup, ViewDockStyle.Fill } }; // Place the headers and page holding area into the group _topGroup = new ViewLayoutDocker { { _viewHeadingSecondary, ViewDockStyle.Bottom }, { _viewHeadingPrimary, ViewDockStyle.Top }, { _layoutPanelDocker, ViewDockStyle.Fill } }; // Prevent adjacent headers from having two borders _topGroup.RemoveChildBorders = true; // Create the top level panel and put a layout docker inside it _drawPanel = new ViewDrawPanel(Navigator.StateNormal.Back) { _topGroup }; _newRoot = _drawPanel; // Set initial visible state of headers _viewHeadingPrimary.Visible = Navigator.Header.HeaderVisiblePrimary; _viewHeadingSecondary.Visible = Navigator.Header.HeaderVisibleSecondary; // Set the correct tab style UpdateTabStyle(); // Must call the base class to perform common actions base.CreateCheckItemView(); }
/// <summary> /// Initialize a new instance of the ViewDrawButton class. /// </summary> /// <param name="paletteDisabled">Palette source for the disabled state.</param> /// <param name="paletteNormal">Palette source for the normal state.</param> /// <param name="paletteTracking">Palette source for the tracking state.</param> /// <param name="palettePressed">Palette source for the pressed state.</param> /// <param name="paletteCheckedNormal">Palette source for the normal checked state.</param> /// <param name="paletteCheckedTracking">Palette source for the tracking checked state.</param> /// <param name="paletteCheckedPressed">Palette source for the pressed checked state.</param> /// <param name="paletteMetric">Palette source for metric values.</param> /// <param name="buttonValues">Source for content values.</param> /// <param name="orientation">Visual orientation of the content.</param> /// <param name="useMnemonic">Use mnemonics.</param> public ViewDrawButton(IPaletteTriple paletteDisabled, IPaletteTriple paletteNormal, IPaletteTriple paletteTracking, IPaletteTriple palettePressed, IPaletteTriple paletteCheckedNormal, IPaletteTriple paletteCheckedTracking, IPaletteTriple paletteCheckedPressed, IPaletteMetric paletteMetric, IContentValues buttonValues, VisualOrientation orientation, bool useMnemonic) { // Remember the source information _paletteDisabled = paletteDisabled; _paletteNormal = paletteNormal; _paletteTracking = paletteTracking; _palettePressed = palettePressed; _paletteCheckedNormal = paletteCheckedNormal; _paletteCheckedTracking = paletteCheckedTracking; _paletteCheckedPressed = paletteCheckedPressed; CurrentPalette = _paletteNormal; // Default to not being checked Checked = false; AllowUncheck = true; _dropDown = false; _splitter = false; _dropDownPosition = VisualOrientation.Right; // Create the drop down view _drawDropDown = new ViewLayoutCenter(1); _drawDropDownButton = new ViewDrawDropDownButton(); _drawDropDown.Add(_drawDropDownButton); _drawOuterSeparator = new ViewLayoutSeparator(1); // Create the view used to draw the split edge _edgeRedirect = new PaletteBorderEdgeRedirect(_paletteNormal.PaletteBorder, null); _drawSplitBorder = new ViewDrawBorderEdge(new PaletteBorderEdge(_edgeRedirect, null), CommonHelper.VisualToOrientation(orientation)); // Our view contains background and border with content inside _drawContent = new ViewDrawContent(_paletteNormal.PaletteContent, buttonValues, orientation); _drawCanvas = new ViewDrawSplitCanvas(_paletteNormal.PaletteBack, _paletteNormal.PaletteBorder, paletteMetric, PaletteMetricPadding.None, orientation); // Use a docker layout to organize the contents of the canvas LayoutDocker = new ViewLayoutDocker { { _drawContent, ViewDockStyle.Fill }, { _drawSplitBorder, ViewDockStyle.Right }, { _drawDropDown, ViewDockStyle.Right }, { _drawOuterSeparator, ViewDockStyle.Right } }; LayoutDocker.Tag = this; // Pass the mnemonic default to the content view _drawContent.UseMnemonic = useMnemonic; // Place the content inside the canvas _drawCanvas.Add(LayoutDocker); // Set initial view element visible states UpdateDropDown(); // Place the canvas inside ourself Add(_drawCanvas); }
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; }