{********************************************************************} { } { Developer Express Visual Component Library } { ExpressSkins Library } { } { Copyright (c) 2006-2007 Developer Express Inc. } { ALL RIGHTS RESERVED } { } { The entire contents of this file is protected by U.S. and } { International Copyright Laws. Unauthorized reproduction, } { reverse-engineering, and distribution of all or any portion of } { the code contained in this file is strictly prohibited and may } { result in severe civil and criminal penalties and will be } { prosecuted to the maximum extent possible under the law. } { } { RESTRICTIONS } { } { THIS SOURCE CODE AND ALL RESULTING INTERMEDIATE FILES } { (DCU, OBJ, DLL, ETC.) ARE CONFIDENTIAL AND PROPRIETARY TRADE } { SECRETS OF DEVELOPER EXPRESS INC. THE REGISTERED DEVELOPER IS } { LICENSED TO DISTRIBUTE THE EXPRESSSKINS AND ALL ACCOMPANYING } { VCL CONTROLS AS PART OF AN EXECUTABLE PROGRAM ONLY. } { } { THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED } { FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE } { COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE } { AVAILABLE TO OTHER INDIVIDUALS WITHOUT EXPRESS WRITTEN CONSENT } { AND PERMISSION FROM DEVELOPER EXPRESS INC. } { } { CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON } { ADDITIONAL RESTRICTIONS. } { } {********************************************************************} unit dxSkinsLookAndFeelPainter; {$I cxVer.inc} interface uses Windows, Classes, Graphics, SysUtils, cxLookAndFeels, cxLookAndFeelPainters, cxGraphics, dxSkinsCore, cxClasses, dxSkinsStrs, ImgList, dxGdiPlusApi, cxGeometry; type TdxSkinScrollInfo = class public Element: TdxSkinElement; ImageIndex: Integer; end; TdxSkinFormIcon = (sfiMenu, sfiHelp, sfiMinimize, sfiMaximize, sfiRestore, sfiClose); TdxSkinFormIcons = set of TdxSkinFormIcon; { TdxSkinLookAndFeelPainterInfo } TdxSkinLookAndFeelPainterInfo = class(TObject, IUnknown, IdxSkinChangeListener) private FSkin: TdxSkin; procedure SetSkin(ASkin: TdxSkin); protected Group_Bars: TdxSkinControlGroup; Group_Common: TdxSkinControlGroup; Group_Docking: TdxSkinControlGroup; Group_Editors: TdxSkinControlGroup; Group_Form: TdxSkinControlGroup; Group_Grid: TdxSkinControlGroup; Group_NavBar: TdxSkinControlGroup; Group_NavPane: TdxSkinControlGroup; Group_Ribbon: TdxSkinControlGroup; Group_Scheduler: TdxSkinControlGroup; Group_Tabs: TdxSkinControlGroup; Group_VGrid: TdxSkinControlGroup; // CardViewSeparator: TdxSkinElement; ClockElements: array[Boolean] of TdxSkinElement; CheckboxElement: TdxSkinElement; EditButtonElements: array [Boolean] of TdxSkinElement; EditButtonGlyphs: array [TcxEditBtnKind] of TdxSkinElement; GridGroupByBox: TdxSkinElement; GridGroupRow: TdxSkinElement; GridLine: TdxSkinElement; GridFixedLine: TdxSkinElement; IndicatorImages: TdxSkinElement; NavigatorGlyphs: TdxSkinElement; NavigatorGlyphsVert: TdxSkinElement; RadioGroupButton: TdxSkinElement; Splitter: array[Boolean] of TdxSkinElement; TrackBarThumb: array[Boolean, TcxTrackBarTicksAlign] of TdxSkinElement; TrackBarTrack: array[Boolean] of TdxSkinElement; VGridCategory: TdxSkinElement; VGridLine: array[Boolean] of TdxSkinElement; // Colors ContentEvenColor: TdxSkinColor; ContentOddColor: TdxSkinColor; ContentTextColor: TdxSkinColor; HeaderBackgroundColor: TdxSkinColor; HeaderBackgroundTextColor: TdxSkinColor; SelectionColor: TdxSkinColor; SelectionTextColor: TdxSkinColor; // ExpandButton ExpandButton: TdxSkinElement; // Footer FooterCell, FooterPanel: TdxSkinElement; // header Header, HeaderLeft, HeaderRight, HeaderSpecial: TdxSkinElement; // filter FilterButtons: array[Boolean] of TdxSkinElement; FilterPanel: TdxSkinElement; // procedure CheckItem(AItem: TObject; const AMessage: string; var ACheckedItem); function GetColorByName(AGroup: TdxSkinPersistent; const AName: string): TdxSkinColor; function GetIntPropertyByName(AGroup: TdxSkinPersistent; const AName: string): TdxSkinIntegerProperty; function GetElementColorProperty(AElement: TdxSkinPersistent; const APropName: string): TColor; function GetElementIntProperty(AElement: TdxSkinPersistent; const APropName: string; ADefValue: Integer = 0): Integer; function GetGroupByName(const AName: string): TdxSkinControlGroup; function GetElementByName(AGroup: TdxSkinControlGroup; const AName: string): TdxSkinElement; procedure InitializeGroups; procedure InitializeBarElements; procedure InitializeButtonElements; procedure InitializeCheckboxElements; procedure InitializeClockElements; procedure InitializeColors; procedure InitializeDockControlElements; procedure InitializeEditButtonElements; procedure InitializeFilterElements; procedure InitializeFooterElements; procedure InitializeFormElements; procedure InitializeGridElements; procedure InitializeGroupBoxElements; procedure InitializeHeaderElements; procedure InitializeIndicatorImages; procedure InitializeNavBarElements; procedure InitializeNavigatorElements; procedure InitializeSchedulerElements; procedure InitializePageControlElements; procedure InitializeProgressBarElements; procedure InitializeRadioGroupElements; procedure InitializeRibbonColors; procedure InitializeRibbonElements; procedure InitializeRibbonProperties; procedure InitializeScrollBarElements; procedure InitializeSizeGripElements; procedure InitializeSplitterElements; procedure InitializeToolTipElements; procedure InitializeTrackBarElements; procedure InitializeSkinInfo; virtual; procedure FinalizeScrollBarElements; procedure FinalizeSkinInfo; virtual; { IUnknown } function _AddRef: Integer; stdcall; function _Release: Integer; stdcall; function QueryInterface(const IID: TGUID; out Obj): HResult; virtual; stdcall; { IdxSkinChangeListener } procedure SkinChanged(Sender: TdxSkin); virtual; public // Button ButtonDisabled: TdxSkinColor; ButtonElements: TdxSkinElement; // Colors ContainerBorderColor: TdxSkinColor; ContainerHighlightBorderColor: TdxSkinColor; ContentColor: TdxSkinColor; // ProgressBar ProgressBarElements: array[Boolean, Boolean] of TdxSkinElement; // ScrollBars ScrollBar_Elements: array[Boolean, TcxScrollBarPart] of TdxSkinScrollInfo; // GroupBox GroupBoxCaptionElements: array[TcxGroupBoxCaptionPosition] of TdxSkinElement; GroupBoxClient: TdxSkinElement; GroupBoxElements: array[TcxGroupBoxCaptionPosition] of TdxSkinElement; // DockControl DockControlBorder: TdxSkinElement; DockControlCaption: TdxSkinElement; DockControlCaptionNonFocusedTextColor: TColor; DockControlHideBar: TdxSkinElement; DockControlHideBarLeft: TdxSkinElement; DockControlHideBarRight: TdxSkinElement; DockControlHideBarBottom: TdxSkinElement; DockControlHideBarButtons: TdxSkinElement; DockControlHideBarTextColor: TdxSkinColor; DockControlIndents: array[0..2] of Integer; DockControlTabHeader: TdxSkinElement; DockControlTabHeaderBackground: TdxSkinElement; DockControlTabHeaderLine: TdxSkinElement; DockControlTabTextColor: array[Boolean] of TdxSkinColor; DockControlWindowButton: TdxSkinElement; DockControlWindowButtonGlyphs: TdxSkinElement; // PageControl LayoutControlColor: TdxSkinColor; PageControlButtonHorz: TdxSkinElement; PageControlButtonVert: TdxSkinElement; PageControlHeader: TdxSkinElement; PageControlIndents: array[0..4] of Integer; PageControlPane: TdxSkinElement; TabTextColor: TdxSkinColor; TabTextColorActive: TdxSkinColor; TabTextColorDisabled: TdxSkinColor; TabTextColorHot: TdxSkinColor; // NavBar NavBarBackgroundColor: TdxSkinElement; NavBarGroupButtons: array [Boolean] of TdxSkinElement; NavBarGroupClient: TdxSkinElement; NavBarGroupHeader: TdxSkinElement; NavBarItem: TdxSkinElement; NavPaneCaptionFontSize: TdxSkinIntegerProperty; NavPaneCaptionHeight: TdxSkinIntegerProperty; NavPaneGroupButton: array[Boolean] of TdxSkinElement; NavPaneGroupCaption: TdxSkinElement; NavPaneGroupClient: TdxSkinElement; NavPaneItem: TdxSkinElement; NavPaneOverflowPanel: TdxSkinElement; NavPaneOverflowPanelExpandedItem: TdxSkinElement; NavPaneOverflowPanelItem: TdxSkinElement; NavPaneScrollButtons: array[Boolean] of TdxSkinElement; NavPaneSelectedItem: TdxSkinElement; NavPaneSplitter: TdxSkinElement; // Form FormBorderWidths: array[Boolean] of TRect; FormCaptionDelta: Integer; FormContent: TdxSkinElement; FormFrames: array[Boolean, TcxBorder] of TdxSkinElement; FormIcons: array[Boolean, TdxSkinFormIcon] of TdxSkinElement; FormInactiveColor: TdxSkinColor; FormStatusBar: TdxSkinElement; FormTextShadowColor: TdxSkinColor; SizeGrip: TdxSkinElement; // Scheduler SchedulerAllDayArea: array[Boolean] of TdxSkinElement; SchedulerAppointment: array[Boolean] of TdxSkinElement; SchedulerAppointmentBorder: TdxSkinColor; SchedulerAppointmentBorderSize: TdxSkinIntegerProperty; SchedulerAppointmentMask: TdxSkinElement; SchedulerAppointmentShadow: array[Boolean] of TdxSkinElement; SchedulerCurrentTimeIndicator: TdxSkinElement; SchedulerMoreButton: TdxSkinElement; SchedulerNavigatorColor: TdxSkinColor; SchedulerTimeGridCurrentTimeIndicator: TdxSkinElement; SchedulerTimeGridHeader: array[Boolean] of TdxSkinElement; SchedulerTimeLine: TdxSkinElement; SchedulerTimeRuler: TdxSkinElement; // Bars Bar: TdxSkinElement; BarCustomize: TdxSkinElement; BarCustomizeVertical: TdxSkinElement; BarDisabledTextColor: TdxSkinColor; BarDrag: TdxSkinElement; BarDragVertical: TdxSkinElement; BarSeparator: TdxSkinElement; BarVertical: TdxSkinElement; BarVerticalSeparator: TdxSkinElement; Dock: TdxSkinElement; FloatingBar: TdxSkinElement; LinkBorderPainter: TdxSkinElement; LinkSelected: TdxSkinElement; MainMenu: TdxSkinElement; MainMenuCustomize: TdxSkinElement; MainMenuDrag: TdxSkinElement; MainMenuLinkSelected: TdxSkinElement; MainMenuVertical: TdxSkinElement; PopupMenu: TdxSkinElement; PopupMenuCheck: TdxSkinElement; PopupMenuExpandButton: TdxSkinElement; PopupMenuLinkSelected: TdxSkinElement; PopupMenuSeparator: TdxSkinElement; PopupMenuSideStrip: TdxSkinElement; PopupMenuSideStripNonRecent: TdxSkinElement; PopupMenuSplitButton: TdxSkinElement; PopupMenuSplitButton2: TdxSkinElement; ScreenTipItem: TdxSkinColor; ScreenTipSeparator: TdxSkinElement; ScreenTipTitleItem: TdxSkinColor; ScreenTipWindow: TdxSkinElement; // RibbonApplicationButton: TdxSkinElement; RibbonApplicationMenuBorders: array[Boolean] of TdxSkinElement; RibbonButtonArrow: TdxSkinElement; RibbonButtonGroup: TdxSkinElement; RibbonButtonGroupButton: TdxSkinElement; RibbonButtonGroupSeparator: TdxSkinElement; RibbonButtonText: array[Boolean] of TColor; RibbonCaptionFontDelta: TdxSkinIntegerProperty; RibbonCaptionText: array[Boolean] of TColor; RibbonCollapsedToolBarBackground: TdxSkinElement; RibbonCollapsedToolBarGlyphBackground: TdxSkinElement; RibbonDocumentNameTextColor: array[Boolean] of TColor; RibbonExtraPaneColor: TdxSkinColor; RibbonFormBottom: array[Boolean] of TdxSkinElement; RibbonFormCaption: TdxSkinElement; RibbonFormLeft: array[Boolean] of TdxSkinElement; RibbonFormRight: array[Boolean] of TdxSkinElement; RibbonGalleryBackground: TdxSkinElement; RibbonGalleryButtonDown: TdxSkinElement; RibbonGalleryButtonDropDown: TdxSkinElement; RibbonGalleryButtonUp: TdxSkinElement; RibbonGalleryGroupCaption: TdxSkinElement; RibbonGalleryPane: TdxSkinElement; RibbonGallerySizeGrips: TdxSkinElement; RibbonGallerySizingPanel: TdxSkinElement; RibbonHeaderBackground: TdxSkinElement; RibbonIndents: array[0..2] of Integer; RibbonLargeButton: TdxSkinElement; RibbonLargeSplitButtonBottom: TdxSkinElement; RibbonLargeSplitButtonTop: TdxSkinElement; RibbonQATCustomizeButtonOutsizeQAT: array[Boolean] of TdxSkinBooleanProperty; RibbonQATIndentBeforeCustomizeButton: array[Boolean] of TdxSkinIntegerProperty; RibbonQuickToolbar: array[Boolean] of TdxSkinElement; RibbonQuickToolbarBelow: TdxSkinElement; RibbonQuickToolbarButtonGlyph: TdxSkinElement; RibbonQuickToolbarDropDown: TdxSkinElement; RibbonQuickToolbarGlyph: TdxSkinElement; RibbonSmallButton: TdxSkinElement; RibbonSplitButtonLeft: TdxSkinElement; RibbonSplitButtonRight: TdxSkinElement; RibbonStatusBarBackground: TdxSkinElement; RibbonStatusBarButton: TdxSkinElement; RibbonStatusBarSeparator: TdxSkinElement; RibbonTab: TdxSkinElement; RibbonTabGroup: TdxSkinElement; RibbonTabGroupHeader: TdxSkinElement; RibbonTabPanel: TdxSkinElement; RibbonTabPanelGroupButton: TdxSkinElement; RibbonTabText: array[Boolean] of TColor; // Status bar text colors RibbonStatusBarText: TColor; RibbonStatusBarTextHot: TColor; RibbonStatusBarTextDisabled: TColor; // constructor Create(ASkin: TdxSkin); virtual; destructor Destroy; override; property Skin: TdxSkin read FSkin write SetSkin; end; { TcxSkinLookAndFeelPainter } TdxSkinLookAndFeelPainter = class(TcxOffice11LookAndFeelPainter) protected class function CacheData: TdxSkinLookAndFeelPainterInfo; virtual; class procedure DrawContent(ACanvas: TcxCanvas; const ABounds, ATextAreaBounds: TRect; AState: Integer; AAlignmentHorz: TAlignment; AAlignmentVert: TcxAlignmentVert; AMultiLine, AShowEndEllipsis: Boolean; const AText: string; AFont: TFont; ATextColor, ABkColor: TColor; AOnDrawBackground: TcxDrawBackgroundEvent = nil; AIsFooter: Boolean = False); override; class function DrawEditorButtonBackground(ACanvas: TcxCanvas; const ARect: TRect; ACloseButton: Boolean; AState: TdxSkinElementState): Boolean; virtual; public // colors class function DefaultContentColor: TColor; override; class function DefaultContentEvenColor: TColor; override; class function DefaultContentOddColor: TColor; override; class function DefaultContentTextColor: TColor; override; class function DefaultFilterBoxTextColor: TColor; override; class function DefaultFixedSeparatorColor: TColor; override; class function DefaultGridLineColor: TColor; override; class function DefaultGroupByBoxTextColor: TColor; override; class function DefaultGroupColor: TColor; override; class function DefaultGroupTextColor: TColor; override; class function DefaultHeaderBackgroundColor: TColor; override; class function DefaultHeaderBackgroundTextColor: TColor; override; class function DefaultHeaderColor: TColor; override; class function DefaultHeaderTextColor: TColor; override; class function DefaultRecordSeparatorColor: TColor; override; class function DefaultSchedulerBackgroundColor: TColor; override; class function DefaultSchedulerControlColor: TColor; override; class function DefaultSchedulerNavigatorColor: TColor; override; class function DefaultSchedulerViewTextColor: TColor; override; class function DefaultSelectionColor: TColor; override; class function DefaultSelectionTextColor: TColor; override; class function DefaultSeparatorColor: TColor; override; class function DefaultSizeGripAreaColor: TColor; override; class function DefaultVGridBandLineColor: TColor; override; class function DefaultVGridCategoryColor: TColor; override; class function DefaultVGridCategoryTextColor: TColor; override; class function DefaultVGridLineColor: TColor; override; // borders class procedure DrawBorder(ACanvas: TcxCanvas; R: TRect); override; // buttons class function AdjustGroupButtonDisplayRect(const R: TRect; AButtonCount, AButtonIndex: Integer): TRect; override; class function ButtonBorderSize(AState: TcxButtonState = cxbsNormal): Integer; override; class function ButtonColor(AState: TcxButtonState): TColor; override; class function ButtonFocusRect(ACanvas: TcxCanvas; R: TRect): TRect; override; class function ButtonGroupBorderSizes(AButtonCount, AButtonIndex: Integer): TRect; override; class function ButtonSymbolColor(AState: TcxButtonState; ADefaultColor: TColor = clDefault): TColor; override; class function ButtonTextOffset: Integer; override; class function ButtonTextShift: Integer; override; class procedure DrawButton(ACanvas: TcxCanvas; R: TRect; const ACaption: string; AState: TcxButtonState; ADrawBorder: Boolean = True; AColor: TColor = clDefault; ATextColor: TColor = clDefault; AWordWrap: Boolean = False); override; class procedure DrawButtonGroupBorder(ACanvas: TcxCanvas; R: TRect; AInplace, ASelected: Boolean); override; class procedure DrawButtonInGroup(ACanvas: TcxCanvas; R: TRect; AState: TcxButtonState; AButtonCount, AButtonIndex: Integer; ABackgroundColor: TColor); override; class procedure DrawExpandButton(ACanvas: TcxCanvas; const R: TRect; AExpanded: Boolean; AColor: TColor = clDefault); override; class function DrawExpandButtonFirst: Boolean; override; class procedure DrawGroupExpandButton(ACanvas: TcxCanvas; const R: TRect; AExpanded: Boolean; AState: TcxButtonState); override; class procedure DrawSmallExpandButton(ACanvas: TcxCanvas; R: TRect; AExpanded: Boolean; ABorderColor: TColor; AColor: TColor = clDefault); override; class function ExpandButtonSize: Integer; override; class function GroupExpandButtonSize: Integer; override; class function SmallExpandButtonSize: Integer; override; class function IsButtonHotTrack: Boolean; override; class function IsPointOverGroupExpandButton(const R: TRect; const P: TPoint): Boolean; override; // scroll bars class function ScrollBarMinimalThumbSize(AVertical: Boolean): Integer; override; class procedure DrawScrollBarPart(ACanvas: TcxCanvas; AHorizontal: Boolean; R: TRect; APart: TcxScrollBarPart; AState: TcxButtonState); override; // size grip class function SizeGripSize: TSize; override; class procedure DrawSizeGrip(ACanvas: TcxCanvas; const ARect: TRect; ABackgroundColor: TColor); override; // RadioGroup class procedure DrawRadioButton(ACanvas: TcxCanvas; X, Y: Integer; AButtonState: TcxButtonState; AChecked, AFocused: Boolean; ABrushColor: TColor; AIsDesigning: Boolean = False); override; class function RadioButtonSize: TSize; override; // Checkbox class function CheckButtonSize: TSize; override; class procedure DrawCheckButton(ACanvas: TcxCanvas; R: TRect; AState: TcxButtonState; AChecked: Boolean; AGrayed: Boolean = False); override; // Editors class procedure DrawClock(ACanvas: TcxCanvas; const ARect: TRect; ADateTime: TDateTime; ABackgroundColor: TColor); override; class procedure DrawEditorButton(ACanvas: TcxCanvas; const ARect: TRect; AButtonKind: TcxEditBtnKind; AState: TcxButtonState); override; class function EditButtonTextOffset: Integer; override; class function EditButtonSize: TSize; override; class function EditButtonTextColor: TColor; override; class function GetContainerBorderColor(AIsHighlightBorder: Boolean): TColor; override; // Navigator class procedure DrawNavigatorGlyph(ACanvas: TcxCanvas; AImageList: TCustomImageList; AImageIndex: {$IFDEF DELPHI5}TImageIndex{$ELSE}Integer{$ENDIF}; AButtonIndex: Integer; const AGlyphRect: TRect; AEnabled: Boolean; AUserGlyphs: Boolean); override; class function NavigatorGlyphSize: TSize; override; // ProgressBar class procedure DrawProgressBarBorder(ACanvas: TcxCanvas; ARect: TRect; AVertical: Boolean); override; class procedure DrawProgressBarChunk(ACanvas: TcxCanvas; ARect: TRect; AVertical: Boolean); override; class function ProgressBarBorderSize(AVertical: Boolean): TRect; override; // GroupBox class procedure DrawGroupBoxBackground(ACanvas: TcxCanvas; ABounds: TRect; ARect: TRect); override; class procedure DrawGroupBoxCaption(ACanvas: TcxCanvas; ACaptionRect: TRect; ACaptionPosition: TcxGroupBoxCaptionPosition); override; class procedure DrawGroupBoxContent(ACanvas: TcxCanvas; ABorderRect: TRect; ACaptionPosition: TcxGroupBoxCaptionPosition); override; class function GroupBoxBorderSize(ACaption: Boolean; ACaptionPosition: TcxGroupBoxCaptionPosition): TRect; override; class function IsGroupBoxTransparent(AIsCaption: Boolean; ACaptionPosition: TcxGroupBoxCaptionPosition): Boolean; override; // Header class procedure DrawHeader(ACanvas: TcxCanvas; const ABounds, ATextAreaBounds: TRect; ANeighbors: TcxNeighbors; ABorders: TcxBorders; AState: TcxButtonState; AAlignmentHorz: TAlignment; AAlignmentVert: TcxAlignmentVert; AMultiLine, AShowEndEllipsis: Boolean; const AText: string; AFont: TFont; ATextColor, ABkColor: TColor; AOnDrawBackground: TcxDrawBackgroundEvent = nil; AIsLast: Boolean = False; AIsGroup: Boolean = False); override; class procedure DrawHeaderEx(ACanvas: TcxCanvas; const ABounds, ATextAreaBounds: TRect; ANeighbors: TcxNeighbors; ABorders: TcxBorders; AState: TcxButtonState; AAlignmentHorz: TAlignment; AAlignmentVert: TcxAlignmentVert; AMultiLine, AShowEndEllipsis: Boolean; const AText: string; AFont: TFont; ATextColor, ABkColor: TColor; AOnDrawBackground: TcxDrawBackgroundEvent = nil); override; class procedure DrawHeaderSeparator(ACanvas: TcxCanvas; const ABounds: TRect; AIndentSize: Integer; AColor: TColor; AViewParams: TcxViewParams); override; class function HeaderBorders(ANeighbors: TcxNeighbors): TcxBorders; override; class function HeaderDrawCellsFirst: Boolean; override; // Grid class procedure DrawGroupByBox(ACanvas: TcxCanvas; const ARect: TRect; ATransparent: Boolean; ABackgroundColor: TColor; const ABackgroundBitmap: TBitmap); override; // Footer class procedure DrawFooterBorder(ACanvas: TcxCanvas; const R: TRect); override; class procedure DrawFooterCell(ACanvas: TcxCanvas; const ABounds: TRect; AAlignmentHorz: TAlignment; AAlignmentVert: TcxAlignmentVert; AMultiLine: Boolean; const AText: string; AFont: TFont; ATextColor, ABkColor: TColor; AOnDrawBackground: TcxDrawBackgroundEvent = nil); override; class procedure DrawFooterContent(ACanvas: TcxCanvas; const ARect: TRect; const AViewParams: TcxViewParams); override; class function FooterCellBorderSize: Integer; override; class function FooterDrawCellsFirst: Boolean; override; class function FooterSeparatorColor: TColor; override; // filter class function FilterCloseButtonSize: TPoint; override; class procedure DrawFilterCloseButton(ACanvas: TcxCanvas; R: TRect; AState: TcxButtonState); override; class procedure DrawFilterDropDownButton(ACanvas: TcxCanvas; R: TRect; AState: TcxButtonState; AIsFilterActive: Boolean); override; class procedure DrawFilterPanel(ACanvas: TcxCanvas; const ARect: TRect; ATransparent: Boolean; ABackgroundColor: TColor; const ABackgroundBitmap: TBitmap); override; // TrackBar class procedure DrawTrackBar(ACanvas: TcxCanvas; const ARect: TRect; const ASelection: TRect; AShowSelection: Boolean; AEnabled: Boolean; AHorizontal: Boolean); override; class procedure DrawTrackBarThumb(ACanvas: TcxCanvas; ARect: TRect; AState: TcxButtonState; AHorizontal: Boolean; ATicks: TcxTrackBarTicksAlign); override; class function TrackBarThumbSize(AHorizontal: Boolean): TSize; override; class function TrackBarTrackSize: Integer; override; // Splitter class procedure DrawSplitter(ACanvas: TcxCanvas; const ARect: TRect; AHighlighted: Boolean; AClicked: Boolean; AHorizontal: Boolean); override; class function GetSplitterSize(AHorizontal: Boolean): TSize; override; // Indicator class procedure DrawIndicatorCustomizationMark(ACanvas: TcxCanvas; const R: TRect; AColor: TColor); override; class procedure DrawIndicatorImage(ACanvas: TcxCanvas; const R: TRect; AKind: TcxIndicatorKind); override; class procedure DrawIndicatorItem(ACanvas: TcxCanvas; const R: TRect; AKind: TcxIndicatorKind; AColor: TColor; AOnDrawBackground: TcxDrawBackgroundEvent = nil); override; class procedure DrawIndicatorItemEx(ACanvas: TcxCanvas; const R: TRect; AKind: TcxIndicatorKind; AColor: TColor; AOnDrawBackground: TcxDrawBackgroundEvent = nil); override; class function IndicatorDrawItemsFirst: Boolean; override; // ms outlook class procedure DrawMonthHeader(ACanvas: TcxCanvas; const ABounds: TRect; const AText: string; ANeighbors: TcxNeighbors; const AViewParams: TcxViewParams; AArrows: TcxHeaderArrows; ASideWidth: Integer; AOnDrawBackground: TcxDrawBackgroundEvent = nil); override; // Scheduler class procedure DrawSchedulerNavigatorButton(ACanvas: TcxCanvas; R: TRect; AState: TcxButtonState); override; // Popup class procedure DrawWindowContent(ACanvas: TcxCanvas; const ARect: TRect); override; end; TdxSkinLookAndFeelPainterClass = class of TdxSkinLookAndFeelPainter; procedure RegisterSkin(ASkin: TdxSkin; APainter: TdxSkinLookAndFeelPainterClass); overload; procedure RegisterSkin(const ASkinName: string; APainter: TdxSkinLookAndFeelPainterClass; ALoadFromResource: Boolean; AInstance: THandle); overload; procedure UnregisterSkin(const ASkinName: string); implementation uses Math, dxSkinsDefaultPainters; var PaintersManager: TcxExtendedStylePainters; const ButtonState2SkinState: array[TcxButtonState] of TdxSkinElementState = (esNormal, esNormal, esHot, esPressed, esDisabled); { TdxSkinLookAndFeelPainterInfo } constructor TdxSkinLookAndFeelPainterInfo.Create(ASkin: TdxSkin); begin Skin := ASkin; end; destructor TdxSkinLookAndFeelPainterInfo.Destroy; var ASkin: TdxSkin; begin ASkin := Skin; Skin := nil; FreeAndNil(ASkin); inherited Destroy; end; procedure TdxSkinLookAndFeelPainterInfo.CheckItem( AItem: TObject; const AMessage: string; var ACheckedItem); begin Assert(AItem <> nil, AMessage); TObject(ACheckedItem) := AItem; end; function TdxSkinLookAndFeelPainterInfo.GetColorByName(AGroup: TdxSkinPersistent; const AName: string): TdxSkinColor; begin Result := nil; if AGroup <> nil then begin Result := AGroup.GetPropertyByName(AName) as TdxSkinColor; if Result <> nil then Result.Tag := 1; end; end; function TdxSkinLookAndFeelPainterInfo.GetIntPropertyByName(AGroup: TdxSkinPersistent; const AName: string): TdxSkinIntegerProperty; begin Result := nil; if AGroup <> nil then begin Result := AGroup.GetPropertyByName(AName) as TdxSkinIntegerProperty; if Result <> nil then Result.Tag := 1; end; end; function TdxSkinLookAndFeelPainterInfo.GetElementColorProperty(AElement: TdxSkinPersistent; const APropName: string): TColor; var AProperty: TdxSkinColor; begin Result := clDefault; if AElement <> nil then begin AProperty := AElement.GetPropertyByName(APropName) as TdxSkinColor; if AProperty <> nil then Result := AProperty.Value; end; end; function TdxSkinLookAndFeelPainterInfo.GetElementIntProperty(AElement: TdxSkinPersistent; const APropName: string; ADefValue: Integer = 0): Integer; var AProperty: TdxSkinIntegerProperty; begin Result := ADefValue; if AElement <> nil then begin AProperty := AElement.GetPropertyByName(APropName) as TdxSkinIntegerProperty; if AProperty <> nil then Result := AProperty.Value; end; end; function TdxSkinLookAndFeelPainterInfo.GetGroupByName( const AName: string): TdxSkinControlGroup; begin if Skin = nil then Result := nil else Result := Skin.GetGroupByName(AName); if Result <> nil then Result.Tag := 1; { dxSkinCheck(Result <> nil, Format(sdxSkinGroupNotFound, [AName]));} end; function TdxSkinLookAndFeelPainterInfo.GetElementByName( AGroup: TdxSkinControlGroup; const AName: string): TdxSkinElement; begin if AGroup = nil then Result := nil else Result := AGroup.GetElementByName(AName); if Result <> nil then Result.Tag := 1; { dxSkinCheck(Result <> nil, Format(sdxSkinElementNotFound, [AName]));} end; procedure TdxSkinLookAndFeelPainterInfo.InitializeGroups; begin Group_Bars := GetGroupByName(sdxSkinGroupBars); Group_Common := GetGroupByName(sdxSkinGroupCommon); Group_Docking := GetGroupByName(sdxSkinGroupDocking); Group_Editors := GetGroupByName(sdxSkinGroupEditors); Group_Ribbon := GetGroupByName(sdxSkinGroupRibbon); Group_Form := GetGroupByName(sdxSkinGroupForm); Group_Grid := GetGroupByName(sdxSkinGroupGrid); Group_Tabs := GetGroupByName(sdxSkinGroupTabs); Group_Scheduler := GetGroupByName(sdxSkinGroupScheduler); Group_VGrid := GetGroupByName(sdxSkinGroupVGrid); Group_NavBar := GetGroupByName(sdxSkinGroupNavBar); Group_NavPane := GetGroupByName(sdxSkinGroupNavPane); end; procedure TdxSkinLookAndFeelPainterInfo.InitializeBarElements; begin Bar := GetElementByName(Group_Bars, sdxBarsBar); BarCustomize := GetElementByName(Group_Bars, sdxBarsBarCustomize); BarCustomizeVertical := GetElementByName(Group_Bars, sdxBarsBarCustomizeVertical); BarDrag := GetElementByName(Group_Bars, sdxBarsBarFinger); BarDragVertical := GetElementByName(Group_Bars, sdxBarsBarFingerVertical); BarSeparator := GetElementByName(Group_Bars, sdxBarsBarSeparator); BarVertical := GetElementByName(Group_Bars, sdxBarsBarVertical); BarVerticalSeparator := GetElementByName(Group_Bars, sdxBarsBarVerticalSeparator); Dock := GetElementByName(Group_Bars, sdxBarsDock); FloatingBar := GetElementByName(Group_Bars, sdxBarsFloatBar); LinkBorderPainter := GetElementByName(Group_Bars, sdxBarsLinkStatic); LinkSelected := GetElementByName(Group_Bars, sdxBarsLinkSelected); MainMenu := GetElementByName(Group_Bars, sdxBarsMainMenu); MainMenuCustomize := GetElementByName(Group_Bars, sdxBarsMainMenuCustomize); MainMenuDrag := GetElementByName(Group_Bars, sdxBarsMainMenuDrag); MainMenuLinkSelected := GetElementByName(Group_Bars, sdxBarsMainMenuLinkSelected); MainMenuVertical := GetElementByName(Group_Bars, sdxBarsMainMenuVertical); PopupMenu := GetElementByName(Group_Bars, sdxBarsPopupMenu); PopupMenuCheck := GetElementByName(Group_Bars, sdxBarsPopupMenuCheck); PopupMenuExpandButton := GetElementByName(Group_Bars, sdxBarsPopupMenuExpandButton); PopupMenuLinkSelected := GetElementByName(Group_Bars, sdxBarsPopupMenuLinkSelected); PopupMenuSeparator := GetElementByName(Group_Bars, sdxBarsPopupMenuSeparator); PopupMenuSideStrip := GetElementByName(Group_Bars, sdxBarsPopupMenuSideStrip); PopupMenuSideStripNonRecent := GetElementByName(Group_Bars, sdxBarsPopupMenuSideStripNonRecent); PopupMenuSplitButton := GetElementByName(Group_Bars, sdxBarsPopupMenuDropDownButtonLabel); PopupMenuSplitButton2 := GetElementByName(Group_Bars, sdxBarsPopupMenuDropDownButtonArrow); end; procedure TdxSkinLookAndFeelPainterInfo.InitializeButtonElements; begin ButtonElements := GetElementByName(Group_Common, sdxButton); ExpandButton := GetElementByName(Group_Grid, sdxPlusMinus); if ButtonElements <> nil then ButtonDisabled := GetColorByName(ButtonElements, sdxSkinsButtonDisabledTextColor); end; procedure TdxSkinLookAndFeelPainterInfo.InitializeCheckboxElements; begin CheckboxElement := GetElementByName(Group_Editors, sdxCheckbox); end; procedure TdxSkinLookAndFeelPainterInfo.InitializeClockElements; begin ClockElements[False] := GetElementByName(Group_Editors, sdxClock); ClockElements[True] := GetElementByName(Group_Editors, sdxClockGlass); end; procedure TdxSkinLookAndFeelPainterInfo.InitializeColors; begin BarDisabledTextColor := GetColorByName(Group_Bars, sdxSkinsBarDisabledTextColor); DockControlTabTextColor[False] := GetColorByName(Group_Docking, sdxSkinsTabTextColor); DockControlTabTextColor[True] := GetColorByName(Group_Docking, sdxSkinsTabTextColorActive); SchedulerNavigatorColor := GetColorByName(Group_Scheduler, sdxSkinsSchedulerNavigatorColor); TabTextColor := GetColorByName(PageControlHeader, sdxTextColorNormal); TabTextColorActive := GetColorByName(PageControlHeader, sdxTextColorSelected); TabTextColorDisabled := GetColorByName(PageControlHeader, sdxTextColorDisabled); TabTextColorHot := GetColorByName(PageControlHeader, sdxTextColorHot); if Skin <> nil then begin ContainerBorderColor := Skin.GetColorByName(sdxSkinsContainerBorderColor); ContainerHighlightBorderColor := Skin.GetColorByName(sdxSkinsContainerHighlightBorderColor); ContentColor := Skin.GetColorByName(sdxSkinsContentColor); ContentEvenColor := Skin.GetColorByName(sdxSkinsContentEvenColor); ContentOddColor := Skin.GetColorByName(sdxSkinsContentOddColor); ContentTextColor := Skin.GetColorByName(sdxSkinsContentTextColor); DockControlHideBarTextColor := Skin.GetColorByName(sdxSkinsDCHiddenBarTextColor); HeaderBackgroundColor := Skin.GetColorByName(sdxSkinsHeaderBackgroundColor); HeaderBackgroundTextColor := Skin.GetColorByName(sdxSkinsHeaderBackgroundTextColor); LayoutControlColor := Skin.GetColorByName(sdxSkinsLayoutControlColor); SelectionColor := Skin.GetColorByName(sdxSkinsSelectionColor); SelectionTextColor := Skin.GetColorByName(sdxSkinsSelectionTextColor); end; end; procedure TdxSkinLookAndFeelPainterInfo.InitializeDockControlElements; begin DockControlTabHeaderBackground := GetElementByName(Group_Docking, sdxDockCtrlTabHeaderBackground); DockControlTabHeaderLine := GetElementByName(Group_Docking, sdxDockCtrlTabHeaderLine); DockControlHideBarButtons := GetElementByName(Group_Docking, sdxDockCtrlTabHeaderAutoHideBar); DockControlWindowButton := GetElementByName(Group_Docking, sdxDockCtrlWindowButton); DockControlWindowButtonGlyphs := GetElementByName(Group_Docking, sdxDockCtrlWindowGlyphs); DockControlTabHeader := GetElementByName(Group_Docking, sdxDockCtrlTabHeader); DockControlHideBar := GetElementByName(Group_Docking, sdxDockCtrlAutoHideBar); DockControlHideBarLeft := GetElementByName(Group_Docking, sdxDockCtrlAutoHideBarLeft); DockControlHideBarRight := GetElementByName(Group_Docking, sdxDockCtrlAutoHideBarRight); DockControlHideBarBottom := GetElementByName(Group_Docking, sdxDockCtrlAutoHideBarBottom); DockControlCaption := GetElementByName(Group_Docking, sdxDockCtrlCaption); DockControlBorder := GetElementByName(Group_Docking, sdxDockCtrlBorder); DockControlCaptionNonFocusedTextColor := GetElementColorProperty(DockControlCaption, sdxDockCtrlInactiveCaptionTextColor); FillChar(DockControlIndents, SizeOf(DockControlIndents), 0); if Group_Docking <> nil then begin DockControlIndents[0] := GetElementIntProperty(Group_Docking, sdxDCActiveTabHeaderDownGrow); DockControlIndents[1] := GetElementIntProperty(Group_Docking, sdxDCActiveTabHeaderHGrow); DockControlIndents[2] := GetElementIntProperty(Group_Docking, sdxDCActiveTabHeaderUpGrow); end; end; procedure TdxSkinLookAndFeelPainterInfo.InitializeEditButtonElements; var AKind: TcxEditBtnKind; begin EditButtonElements[False] := GetElementByName(Group_Editors, sdxEditorButton); EditButtonElements[True] := GetElementByName(Group_Editors, sdxCloseButton); for AKind := Low(TcxEditBtnKind) to High(TcxEditBtnKind) do EditButtonGlyphs[AKind] := GetElementByName(Group_Editors, EditButtonsMap[AKind]); end; procedure TdxSkinLookAndFeelPainterInfo.InitializeFilterElements; begin FilterButtons[False] := GetElementByName(Group_Grid, sdxFilterButton); FilterButtons[True] := GetElementByName(Group_Grid, sdxFilterButtonActive); FilterPanel := GetElementByName(Group_Grid, sdxFilterPanel); end; procedure TdxSkinLookAndFeelPainterInfo.InitializeFooterElements; begin FooterCell := GetElementByName(Group_Grid, sdxFooterCell); FooterPanel := GetElementByName(Group_Grid, sdxFooterPanel); end; procedure TdxSkinLookAndFeelPainterInfo.InitializeFormElements; procedure CorrectStateAndStretch(AElement: TdxSkinElement; AInclude, AExclude: TdxSkinElementStates; AStretch: Boolean = False); begin if AElement = nil then Exit; AElement.Image.States := AElement.Image.States + AInclude - AExclude; if AStretch then AElement.Image.Stretch := smStretch; end; var R: TRect; ASide: TcxBorder; AStandard: Boolean; AIcon: TdxSkinFormIcon; begin FillChar(FormIcons, SizeOf(FormIcons), 0); FormInactiveColor := GetColorByName(Group_Form, sdxTextInactiveColor); FormTextShadowColor := GetColorByName(Group_Form, sdxTextShadowColor); FormStatusBar := GetElementByName(Group_Bars, sdxStatusBar); FormIcons[False, sfiClose] := GetElementByName(Group_Form, sdxSmallFormButtonClose); FormIcons[True, sfiClose] := GetElementByName(Group_Form, sdxFormButtonClose); FormIcons[True, sfiMinimize] := GetElementByName(Group_Form, sdxFormButtonMinimize); FormIcons[True, sfiMaximize] := GetElementByName(Group_Form, sdxFormButtonMaximize); FormIcons[True, sfiRestore] := GetElementByName(Group_Form, sdxFormButtonRestore); FormIcons[True, sfiHelp] := GetElementByName(Group_Form, sdxFormButtonHelp); FormContent := GetElementByName(Group_Form, sdxFormContent); for AStandard := False to True do for ASide := bLeft to bBottom do FormFrames[AStandard, ASide] := GetElementByName(Group_Form, FormFrameMap[AStandard, ASide]); if Skin = nil then Exit; Skin.BeginUpdate; try for AStandard := False to True do begin R := cxNullRect; for AIcon := sfiMenu to sfiClose do CorrectStateAndStretch(FormIcons[AStandard, AIcon], [esActiveDisabled], [esActive], True); for ASide := bLeft to bBottom do begin if FormFrames[AStandard, ASide] = nil then Continue; CorrectStateAndStretch(FormFrames[AStandard, ASide], [esActive, esActiveDisabled], [esNormal]); with FormFrames[AStandard, ASide].Image do case ASide of bLeft: begin Margins.Left := 1; Margins.Right := 0; R.Left := Size.cx; end; bRight: begin Margins.Right := 1; Margins.Left := 0; R.Right := Size.cx; end; bBottom: begin Margins.Top := 0; Margins.Bottom := 1; R.Bottom := Size.cy; end; end; end; FormBorderWidths[AStandard] := R; end; FormCaptionDelta := Max(1, GetElementIntProperty(FormFrames[True, bTop], sdxCaptionFontDelta)); finally Skin.CancelUpdate; end; end; procedure TdxSkinLookAndFeelPainterInfo.InitializeGroupBoxElements; begin GroupBoxClient := GetElementByName(Group_Common, sdxGroupPanelNoBorder); GroupBoxElements[cxgpTop] := GetElementByName(Group_Common, sdxGroupPanelTop); GroupBoxElements[cxgpBottom] := GetElementByName(Group_Common, sdxGroupPanelBottom); GroupBoxElements[cxgpLeft] := GetElementByName(Group_Common, sdxGroupPanelLeft); GroupBoxElements[cxgpRight] := GetElementByName(Group_Common, sdxGroupPanelRight); GroupBoxElements[cxgpCenter] := GetElementByName(Group_Common, sdxGroupPanel); GroupBoxCaptionElements[cxgpTop] := GetElementByName(Group_Common, sdxGroupPanelCaptionTop); GroupBoxCaptionElements[cxgpBottom] := GetElementByName(Group_Common, sdxGroupPanelCaptionBottom); GroupBoxCaptionElements[cxgpLeft] := GetElementByName(Group_Common, sdxGroupPanelCaptionLeft); GroupBoxCaptionElements[cxgpRight] := GetElementByName(Group_Common, sdxGroupPanelCaptionRight); end; procedure TdxSkinLookAndFeelPainterInfo.InitializeGridElements; begin GridFixedLine := GetElementByName(Group_Grid, sdxGridFixedLine); CardViewSeparator := GetElementByName(Group_Grid, sdxCardSeparator); GridGroupByBox := GetElementByName(Group_Grid, sdxGroupByBox); if (GridGroupByBox <> nil) and not GridGroupByBox.Image.Empty then GridGroupByBox.Color := clNone; GridGroupRow := GetElementByName(Group_Grid, sdxGroupRow); GridLine := GetElementByName(Group_Grid, sdxGridLine); VGridCategory := GetElementByName(Group_VGrid, sdxVGridRowHeader); VGridLine[False] := GetElementByName(Group_VGrid, sdxVGridLine); VGridLine[True] := GetElementByName(Group_VGrid, sdxVGridBandLine); end; procedure TdxSkinLookAndFeelPainterInfo.InitializeHeaderElements; begin Header := GetElementByName(Group_Common, sdxHeader); HeaderLeft := GetElementByName(Group_Grid, sdxHeaderLeft); HeaderRight := GetElementByName(Group_Grid, sdxHeaderRight); HeaderSpecial := GetElementByName(Group_Common, sdxHeaderSpecial); end; procedure TdxSkinLookAndFeelPainterInfo.InitializeIndicatorImages; begin IndicatorImages := GetElementByName(Group_Grid, sdxIndicatorImages); end; procedure TdxSkinLookAndFeelPainterInfo.InitializeNavBarElements; begin NavBarBackgroundColor := GetElementByName(Group_NavBar, sdxNavBarBackground); NavBarGroupClient := GetElementByName(Group_NavBar, sdxNavBarGroupClient); NavBarItem := GetElementByName(Group_NavBar, sdxNavBarItem); NavBarGroupHeader := GetElementByName(Group_NavBar, sdxNavBarGroupHeader); NavBarGroupButtons[True] := GetElementByName(Group_NavBar, sdxNavBarGroupCloseButton); NavBarGroupButtons[False] := GetElementByName(Group_NavBar, sdxNavBarGroupOpenButton); NavPaneGroupButton[False] := GetElementByName(Group_NavPane, sdxNavPaneGroupButton); NavPaneGroupButton[True] := GetElementByName(Group_NavPane, sdxNavPaneGroupButtonSelected); NavPaneGroupCaption := GetElementByName(Group_NavPane, sdxNavPaneGroupCaption); NavPaneSplitter := GetElementByName(Group_NavPane, sdxNavPaneSplitter); NavPaneScrollButtons[False] := GetElementByName(Group_NavPane, sdxNavPaneScrollUpBtn); NavPaneScrollButtons[True] := GetElementByName(Group_NavPane, sdxNavPaneScrollDownBtn); NavPaneOverflowPanel := GetElementByName(Group_NavPane, sdxNavPaneOverflowPanel); NavPaneOverflowPanelItem := GetElementByName(Group_NavPane, sdxNavPaneOverflowPanelItem); NavPaneOverflowPanelExpandedItem := GetElementByName(Group_NavPane, sdxNavPaneOverflowPanelExpandItem); NavPaneGroupClient := GetElementByName(Group_NavPane, sdxNavPaneGroupClient); NavPaneItem := GetElementByName(Group_NavPane, sdxNavPaneItem); NavPaneSelectedItem := GetElementByName(Group_NavPane, sdxNavPaneItemSelected); NavPaneCaptionHeight := GetIntPropertyByName(NavPaneGroupCaption, sdxNavPaneCaptionHeight); NavPaneCaptionFontSize := GetIntPropertyByName(NavPaneGroupCaption, sdxNavPaneCaptionFontSize); end; procedure TdxSkinLookAndFeelPainterInfo.InitializeNavigatorElements; begin NavigatorGlyphs := GetElementByName(Group_Editors, sdxNavigatorGlyphs); NavigatorGlyphsVert := GetElementByName(Group_Editors, sdxNavigatorGlyphsVert); end; procedure TdxSkinLookAndFeelPainterInfo.InitializePageControlElements; begin PageControlHeader := GetElementByName(Group_Tabs, sdxPageControlHeaderTop); PageControlButtonHorz := GetElementByName(Group_Tabs, sdxPageControlHorz); PageControlButtonVert := GetElementByName(Group_Tabs, sdxPageControlVert); if FormContent <> nil then begin if PageControlButtonHorz <> nil then PageControlButtonHorz.Color := FormContent.Color; if PageControlButtonVert <> nil then PageControlButtonVert.Color := FormContent.Color; end; PageControlPane := GetElementByName(Group_Tabs, sdxPageControlPane); FillChar(PageControlIndents, SizeOf(PageControlIndents), 0); if Group_Tabs <> nil then begin PageControlIndents[0] := GetElementIntProperty(Group_Tabs, sdxRowIndentFar); PageControlIndents[1] := GetElementIntProperty(Group_Tabs, sdxRowIndentNear); PageControlIndents[2] := GetElementIntProperty(Group_Tabs, sdxSelectedHeaderDownGrow); PageControlIndents[3] := GetElementIntProperty(Group_Tabs, sdxSelectedHeaderHGrow); PageControlIndents[4] := GetElementIntProperty(Group_Tabs, sdxSelectedHeaderUpGrow); end; end; procedure TdxSkinLookAndFeelPainterInfo.InitializeProgressBarElements; begin ProgressBarElements[False, False] := GetElementByName(Group_Editors, sdxProgressBorder); ProgressBarElements[False, True] := GetElementByName(Group_Editors, sdxProgressBorderVert); ProgressBarElements[True, False] := GetElementByName(Group_Editors, sdxProgressChunk); ProgressBarElements[True, True] := GetElementByName(Group_Editors, sdxProgressChunkVert); end; procedure TdxSkinLookAndFeelPainterInfo.InitializeRadioGroupElements; begin RadioGroupButton := GetElementByName(Group_Editors, sdxRadioGroup); end; procedure TdxSkinLookAndFeelPainterInfo.InitializeRibbonColors; function GetElementTextColor(AElement: TdxSkinElement): TColor; begin if AElement = nil then Result := clDefault else Result := AElement.TextColor; end; begin RibbonExtraPaneColor := GetColorByName(Group_Ribbon, sdxRibbonExtraPaneColor); RibbonCaptionText[False] := GetElementColorProperty(RibbonFormCaption, sdxTextInactiveColor); RibbonCaptionText[True] := GetElementTextColor(RibbonFormCaption); RibbonTabText[True] := GetElementColorProperty(RibbonTab, sdxTextColorSelected); RibbonTabText[False] := GetElementTextColor(RibbonTab); RibbonDocumentNameTextColor[True] := GetElementColorProperty(RibbonFormCaption, sdxRibbonDocumentNameTextColor); RibbonDocumentNameTextColor[False] := RibbonCaptionText[False]; RibbonStatusBarText := GetElementColorProperty(RibbonStatusBarButton, sdxTextColorNormal); RibbonStatusBarTextHot := GetElementColorProperty(RibbonStatusBarButton, sdxTextColorHot); RibbonStatusBarTextDisabled := GetElementColorProperty(RibbonStatusBarButton, sdxTextColorDisabled); RibbonButtonText[False] := GetElementTextColor(RibbonSmallButton); RibbonButtonText[True] := GetElementColorProperty(Group_Ribbon, sdxRibbonButtonDisabledText); end; procedure TdxSkinLookAndFeelPainterInfo.InitializeRibbonElements; begin RibbonApplicationButton := GetElementByName(Group_Ribbon, sdxRibbonApplicationButton); RibbonApplicationMenuBorders[False] := GetElementByName(Group_Ribbon, sdxRibbonAppMenuHeaderBackground); RibbonApplicationMenuBorders[True] := GetElementByName(Group_Ribbon, sdxRibbonAppMenuFooterBackground); RibbonCollapsedToolBarBackground := GetElementByName(Group_Ribbon, sdxRibbonCollapsedToolBarBackground); RibbonCollapsedToolBarGlyphBackground := GetElementByName(Group_Ribbon, sdxRibbonCollapsedToolBarGlyphBackground); RibbonFormCaption := GetElementByName(Group_Ribbon, sdxRibbonFormCaption); RibbonFormBottom[False] := GetElementByName(Group_Ribbon, sdxRibbonFormBottom); RibbonFormBottom[True] := GetElementByName(Group_Ribbon, sdxRibbonDialogFrameBottom); RibbonFormLeft[False] := GetElementByName(Group_Ribbon, sdxRibbonFormFrameLeft); RibbonFormLeft[True] := GetElementByName(Group_Ribbon, sdxRibbonDialogFrameLeft); RibbonFormRight[False] := GetElementByName(Group_Ribbon, sdxRibbonFormFrameRight); RibbonFormRight[True] := GetElementByName(Group_Ribbon, sdxRibbonDialogFrameRight); RibbonTab := GetElementByName(Group_Ribbon, sdxRibbonTabHeaderPage); RibbonTabPanel := GetElementByName(Group_Ribbon, sdxRibbonTabPanel); RibbonTabPanelGroupButton := GetElementByName(Group_Ribbon, sdxRibbonTabPanelGroupButton); RibbonTabGroup := GetElementByName(Group_Ribbon, sdxRibbonTabGroup); RibbonTabGroupHeader := GetElementByName(Group_Ribbon, sdxRibbonTabGroupHeader); RibbonGalleryBackground := GetElementByName(Group_Ribbon, sdxRibbonGalleryBackground); RibbonGalleryButtonDown := GetElementByName(Group_Ribbon, sdxRibbonGalleryButtonDown); RibbonGalleryButtonDropDown := GetElementByName(Group_Ribbon, sdxRibbonGalleryButtonDropDown); RibbonGalleryButtonUp := GetElementByName(Group_Ribbon, sdxRibbonGalleryButtonUp); RibbonGalleryGroupCaption := GetElementByName(Group_Ribbon, sdxRibbonGalleryGroupCaption); RibbonGalleryPane := GetElementByName(Group_Ribbon, sdxRibbonGalleryPane); RibbonGallerySizingPanel := GetElementByName(Group_Ribbon, sdxRibbonGallerySizingPanel); RibbonGallerySizeGrips := GetElementByName(Group_Ribbon, sdxRibbonGallerySizeGrips); RibbonHeaderBackground := GetElementByName(Group_Ribbon, sdxRibbonHeaderBackground); RibbonSmallButton := GetElementByName(Group_Ribbon, sdxRibbonSmallButton); RibbonSplitButtonLeft := GetElementByName(Group_Ribbon, sdxRibbonSplitButtonLeft); RibbonSplitButtonRight := GetElementByName(Group_Ribbon, sdxRibbonSplitButtonRight); RibbonLargeButton := GetElementByName(Group_Ribbon, sdxRibbonLargeButton); RibbonLargeSplitButtonTop := GetElementByName(Group_Ribbon, sdxRibbonLargeSplitButtonTop); RibbonLargeSplitButtonBottom := GetElementByName(Group_Ribbon, sdxRibbonLargeSplitButtonBottom); RibbonButtonArrow := GetElementByName(Group_Ribbon, sdxRibbonButtonArrow); RibbonButtonGroup := GetElementByName(Group_Ribbon, sdxRibbonButtonGroup); RibbonStatusBarBackground := GetElementByName(Group_Ribbon, sdxRibbonStatusBarBackground); RibbonStatusBarButton := GetElementByName(Group_Ribbon, sdxRibbonStatusBarButton); RibbonStatusBarSeparator := GetElementByName(Group_Ribbon, sdxRibbonStatusBarSeparator); RibbonQuickToolbar[True] := GetElementByName(Group_Ribbon, sdxRibbonQuickToolbarInCaption); RibbonQuickToolbar[False] := GetElementByName(Group_Ribbon, sdxRibbonQuickToolbarAbove); RibbonQuickToolbarBelow := GetElementByName(Group_Ribbon, sdxRibbonQuickToolbarBelow); RibbonQuickToolbarButtonGlyph := GetElementByName(Group_Ribbon, sdxRibbonQuickToolbarButtonGlyph); RibbonQuickToolbarDropDown := GetElementByName(Group_Ribbon, sdxRibbonQuickToolbarDropDown); RibbonQuickToolbarGlyph := GetElementByName(Group_Ribbon, sdxRibbonQuickToolbarGlyph); RibbonButtonGroupButton := GetElementByName(Group_Ribbon, sdxRibbonButtonGroupButton); RibbonButtonGroupSeparator := GetElementByName(Group_Ribbon, sdxRibbonButtonGroupSeparator); InitializeRibbonProperties; InitializeRibbonColors; end; procedure TdxSkinLookAndFeelPainterInfo.InitializeRibbonProperties; var AIndex: Boolean; begin for AIndex := False to True do if RibbonQuickToolbar[AIndex] <> nil then with RibbonQuickToolbar[AIndex] do begin RibbonQATCustomizeButtonOutsizeQAT[AIndex] := GetPropertyByName(sdxRibbonQATCustomizeButtonOutsideQAT) as TdxSkinBooleanProperty; RibbonQATIndentBeforeCustomizeButton[AIndex] := GetPropertyByName(sdxRibbonQATIndentBeforeCustomizeItem) as TdxSkinIntegerProperty; end; RibbonCaptionFontDelta := GetIntPropertyByName(RibbonFormCaption, sdxCaptionFontDelta); if Group_Ribbon = nil then FillChar(RibbonIndents, SizeOf(RibbonIndents), 0) else begin RibbonIndents[0] := GetElementIntProperty(RibbonApplicationButton, sdxRibbonAppButtonRightIndent); RibbonIndents[1] := GetElementIntProperty(RibbonQuickToolbar[True], sdxRibbonQuickAccessToolbarOffset); RibbonIndents[2] := GetElementIntProperty(Group_Ribbon, sdxRibbonTabHeaderDownGrowIndent); end; end; procedure TdxSkinLookAndFeelPainterInfo.InitializeScrollBarElements; procedure SetInfo(AHorz: Boolean; APart: TcxScrollBarPart; AElement: TdxSkinElement; AImageIndex: Integer = 0); begin FreeAndNil(ScrollBar_Elements[AHorz, APart]); if Skin = nil then Exit; ScrollBar_Elements[AHorz, APart] := TdxSkinScrollInfo.Create; ScrollBar_Elements[AHorz, APart].Element := AElement; ScrollBar_Elements[AHorz, APart].ImageIndex := AImageIndex; end; var AElement: TdxSkinElement; begin // buttons AElement := GetElementByName(Group_Common, sdxScrollButton); if FormContent <> nil then AElement.Color := FormContent.Color; //todo: transparent elements bug SetInfo(False, sbpLineUp, AElement); SetInfo(False, sbpLineDown, AElement, 1); SetInfo(True, sbpLineUp, AElement, 2); SetInfo(True, sbpLineDown, AElement, 3); // Thumbnail SetInfo(False, sbpThumbnail, GetElementByName(Group_Common, sdxScrollThumbButtonVert)); SetInfo(True, sbpThumbnail, GetElementByName(Group_Common, sdxScrollThumbButtonHorz)); // Page AElement := GetElementByName(Group_Common, sdxScrollContentVert); SetInfo(False, sbpPageUp, AElement); SetInfo(False, sbpPageDown, AElement); AElement := GetElementByName(Group_Common, sdxScrollContentHorz); SetInfo(True, sbpPageUp, AElement); SetInfo(True, sbpPageDown, AElement); end; procedure TdxSkinLookAndFeelPainterInfo.InitializeSchedulerElements; begin SchedulerTimeGridHeader[False] := GetElementByName(Group_Scheduler, sdxSchedulerTimeGridHeader); SchedulerTimeGridHeader[True] := GetElementByName(Group_Scheduler, sdxSchedulerTimeGridHeaderSelected); SchedulerTimeLine := GetElementByName(Group_Scheduler, sdxSchedulerTimeLine); SchedulerTimeRuler := GetElementByName(Group_Scheduler, sdxSchedulerTimeRuler); SchedulerMoreButton := GetElementByName(Group_Scheduler, sdxSchedulerMoreButton); SchedulerAppointment[False] := GetElementByName(Group_Scheduler, sdxSchedulerAppointmentRight); SchedulerAppointment[True] := GetElementByName(Group_Scheduler, sdxSchedulerAppointment); SchedulerAllDayArea[False] := GetElementByName(Group_Scheduler, sdxSchedulerAllDayArea); SchedulerAllDayArea[True] := GetElementByName(Group_Scheduler, sdxSchedulerAllDayAreaSelected); SchedulerCurrentTimeIndicator := GetElementByName(Group_Scheduler, sdxSchedulerCurrentTimeIndicator); SchedulerTimeGridCurrentTimeIndicator := GetElementByName(Group_Scheduler, sdxSchedulerTimeGridCurrentTimeIndicator); SchedulerAppointmentShadow[False] := GetElementByName(Group_Scheduler, sdxSchedulerAppointmentBottomShadow); SchedulerAppointmentShadow[True] := GetElementByName(Group_Scheduler, sdxSchedulerAppointmentRightShadow); SchedulerAppointmentBorderSize := GetIntPropertyByName(SchedulerAppointment[True], sdxSchedulerAppointmentBorderSize); SchedulerAppointmentMask := GetElementByName(Group_Scheduler, sdxSchedulerAppointmentMask); SchedulerAppointmentBorder := GetColorByName(SchedulerAppointment[True], sdxSchedulerSeparatorColor); end; procedure TdxSkinLookAndFeelPainterInfo.InitializeSizeGripElements; begin SizeGrip := GetElementByName(Group_Common, sdxSizeGrip); end; procedure TdxSkinLookAndFeelPainterInfo.InitializeSplitterElements; begin Splitter[False] := GetElementByName(Group_Common, sdxSplitterVert); Splitter[True] := GetElementByName(Group_Common, sdxSplitterHorz); end; procedure TdxSkinLookAndFeelPainterInfo.InitializeToolTipElements; begin ScreenTipWindow := GetElementByName(Group_Bars, sdxScreenTipWindow); ScreenTipItem := GetColorByName(ScreenTipWindow, sdxScreenTipItem); ScreenTipSeparator := GetElementByName(Group_Bars, sdxScreenTipSeparator); ScreenTipTitleItem := GetColorByName(ScreenTipWindow, sdxScreenTipTitleItem); end; procedure TdxSkinLookAndFeelPainterInfo.InitializeTrackBarElements; begin TrackBarTrack[True] := GetElementByName(Group_Editors, sdxTrackBarTrack); TrackBarTrack[False] := GetElementByName(Group_Editors, sdxTrackBarTrackVert); TrackBarThumb[True, tbtaDown] := GetElementByName(Group_Editors, sdxTrackBarThumb); TrackBarThumb[True, tbtaUp] := GetElementByName(Group_Editors, sdxTrackBarThumbUp); TrackBarThumb[True, tbtaBoth] := GetElementByName(Group_Editors, sdxTrackBarThumbBoth); TrackBarThumb[False, tbtaDown] := GetElementByName(Group_Editors, sdxTrackBarThumbVert); TrackBarThumb[False, tbtaUp] := GetElementByName(Group_Editors, sdxTrackBarThumbVertUp); TrackBarThumb[False, tbtaBoth] := GetElementByName(Group_Editors, sdxTrackBarThumbVertBoth); end; procedure TdxSkinLookAndFeelPainterInfo.InitializeSkinInfo; begin InitializeGroups; InitializeBarElements; InitializeFormElements; InitializeDockControlElements; InitializeButtonElements; InitializeFooterElements; InitializeCheckboxElements; InitializeClockElements; InitializeEditButtonElements; InitializeGroupBoxElements; InitializeGridElements; InitializeIndicatorImages; InitializeNavBarElements; InitializeNavigatorElements; InitializeSchedulerElements; InitializeHeaderElements; InitializeFilterElements; InitializePageControlElements; InitializeProgressBarElements; InitializeRadioGroupElements; InitializeScrollBarElements; InitializeRibbonElements; InitializeSizeGripElements; InitializeSplitterElements; InitializeTrackBarElements; InitializeToolTipElements; InitializeColors; end; procedure TdxSkinLookAndFeelPainterInfo.FinalizeScrollBarElements; var AHorz: Boolean; APart: TcxScrollBarPart; begin for AHorz := False to True do for APart := Low(TcxScrollBarPart) to High(TcxScrollBarPart) do FreeAndNil(ScrollBar_Elements[AHorz, APart]); end; procedure TdxSkinLookAndFeelPainterInfo.FinalizeSkinInfo; begin FinalizeScrollBarElements; end; procedure TdxSkinLookAndFeelPainterInfo.SkinChanged(Sender: TdxSkin); begin FinalizeSkinInfo; InitializeSkinInfo; end; function TdxSkinLookAndFeelPainterInfo._AddRef: Integer; begin Result := -1; end; function TdxSkinLookAndFeelPainterInfo._Release: Integer; begin Result := -1; end; function TdxSkinLookAndFeelPainterInfo.QueryInterface( const IID: TGUID; out Obj): HResult; const E_NOINTERFACE = HResult($80004002); begin if GetInterface(IID, Obj) then Result := 0 else Result := E_NOINTERFACE; end; procedure TdxSkinLookAndFeelPainterInfo.SetSkin(ASkin: TdxSkin); begin if ASkin <> Skin then begin if Skin <> nil then begin FinalizeSkinInfo; Skin.RemoveListener(Self); end; FSkin := ASkin; if Skin <> nil then Skin.AddListener(Self); InitializeSkinInfo; end; end; { TdxSkinLookAndFeelPainter } class function TdxSkinLookAndFeelPainter.DefaultContentColor: TColor; begin with CacheData do if ContentColor = nil then Result := inherited DefaultContentColor else Result := ContentColor.Value; end; class function TdxSkinLookAndFeelPainter.DefaultContentEvenColor: TColor; begin with CacheData do if (ContentEvenColor = nil) or (ContentEvenColor.Value = clDefault) then Result := inherited DefaultContentEvenColor else Result := ContentEvenColor.Value; end; class function TdxSkinLookAndFeelPainter.DefaultContentOddColor: TColor; begin with CacheData do if (ContentOddColor = nil) or (ContentOddColor.Value = clDefault) then Result := inherited DefaultContentOddColor else Result := ContentOddColor.Value; end; class function TdxSkinLookAndFeelPainter.DefaultContentTextColor: TColor; begin with CacheData do if ContentTextColor = nil then Result := inherited DefaultContentTextColor else Result := ContentTextColor.Value; end; class function TdxSkinLookAndFeelPainter.DefaultFilterBoxTextColor: TColor; begin with CacheData do if FilterPanel = nil then Result := inherited DefaultFilterBoxTextColor else Result := FilterPanel.TextColor; end; class function TdxSkinLookAndFeelPainter.DefaultFixedSeparatorColor: TColor; begin with CacheData do if GridFixedLine = nil then Result := inherited DefaultFixedSeparatorColor else Result := GridFixedLine.Color; end; class function TdxSkinLookAndFeelPainter.DefaultGridLineColor: TColor; begin with CacheData do if GridLine = nil then Result := inherited DefaultGridLineColor else Result := GridLine.Color; end; class function TdxSkinLookAndFeelPainter.DefaultGroupColor: TColor; begin with CacheData do if GridGroupRow = nil then Result := inherited DefaultGroupColor else Result := GridGroupRow.Color; end; class function TdxSkinLookAndFeelPainter.DefaultGroupByBoxTextColor: TColor; begin with CacheData do if GridGroupByBox = nil then Result := inherited DefaultGroupByBoxTextColor else Result := GridGroupByBox.TextColor; end; class function TdxSkinLookAndFeelPainter.DefaultGroupTextColor: TColor; begin with CacheData do if GridGroupRow = nil then Result := inherited DefaultGroupTextColor else Result := GridGroupRow.TextColor; end; class function TdxSkinLookAndFeelPainter.DefaultHeaderBackgroundColor: TColor; begin with CacheData do if HeaderBackgroundColor = nil then Result := inherited DefaultHeaderBackgroundColor else Result := HeaderBackgroundColor.Value; end; class function TdxSkinLookAndFeelPainter.DefaultHeaderBackgroundTextColor: TColor; begin with CacheData do if HeaderBackgroundTextColor = nil then Result := inherited DefaultHeaderBackgroundTextColor else Result := HeaderBackgroundTextColor.Value; end; class function TdxSkinLookAndFeelPainter.DefaultHeaderColor: TColor; begin with CacheData do if Header = nil then Result := inherited DefaultHeaderColor else Result := Header.Color; end; class function TdxSkinLookAndFeelPainter.DefaultHeaderTextColor: TColor; begin with CacheData do if Header = nil then Result := inherited DefaultHeaderTextColor else Result := Header.TextColor; end; class function TdxSkinLookAndFeelPainter.DefaultSelectionColor: TColor; begin with CacheData do if SelectionColor = nil then Result := inherited DefaultSelectionColor else Result := SelectionColor.Value; end; class function TdxSkinLookAndFeelPainter.DefaultSelectionTextColor: TColor; begin with CacheData do if SelectionTextColor = nil then Result := inherited DefaultSelectionTextColor else Result := SelectionTextColor.Value; end; class function TdxSkinLookAndFeelPainter.DefaultSeparatorColor: TColor; begin with CacheData do if CardViewSeparator = nil then Result := inherited DefaultSeparatorColor else Result := CardViewSeparator.Color; end; class function TdxSkinLookAndFeelPainter.DefaultSchedulerBackgroundColor: TColor; begin with CacheData do if ContentColor = nil then Result := inherited DefaultSchedulerBackgroundColor else Result := ContentColor.Value; end; class function TdxSkinLookAndFeelPainter.DefaultSchedulerControlColor: TColor; begin with CacheData do if ContentColor = nil then Result := inherited DefaultSchedulerControlColor else Result := ContentColor.Value; end; class function TdxSkinLookAndFeelPainter.DefaultSchedulerNavigatorColor: TColor; begin with CacheData do if SchedulerNavigatorColor = nil then Result := inherited DefaultSchedulerNavigatorColor else Result := SchedulerNavigatorColor.Value; end; class function TdxSkinLookAndFeelPainter.DefaultSchedulerViewTextColor: TColor; begin with CacheData do if SchedulerAppointment[True] = nil then Result := inherited DefaultSelectionTextColor else Result := SchedulerAppointment[True].TextColor; end; class function TdxSkinLookAndFeelPainter.DefaultSizeGripAreaColor: TColor; begin Result := clDefault; with CacheData do if FormContent <> nil then Result := FormContent.Color; if Result = clDefault then Result := inherited DefaultSizeGripAreaColor; end; class function TdxSkinLookAndFeelPainter.DefaultRecordSeparatorColor: TColor; begin with CacheData do if GridFixedLine = nil then Result := inherited DefaultRecordSeparatorColor else Result := GridFixedLine.Color; end; class function TdxSkinLookAndFeelPainter.DefaultVGridBandLineColor: TColor; begin with CacheData do begin if VGridLine[True] = nil then Result := inherited DefaultVGridBandLineColor else Result := VGridLine[True].Color; end; end; class function TdxSkinLookAndFeelPainter.DefaultVGridCategoryColor: TColor; begin with CacheData do if VGridCategory = nil then Result := inherited DefaultVGridCategoryColor else Result := VGridCategory.Color; end; class function TdxSkinLookAndFeelPainter.DefaultVGridCategoryTextColor: TColor; begin with CacheData do if VGridCategory = nil then Result := inherited DefaultVGridCategoryTextColor else Result := VGridCategory.TextColor; end; class function TdxSkinLookAndFeelPainter.DefaultVGridLineColor: TColor; begin with CacheData do begin if VGridLine[False] = nil then Result := inherited DefaultVGridLineColor else Result := VGridLine[False].Color; end; end; class procedure TdxSkinLookAndFeelPainter.DrawBorder(ACanvas: TcxCanvas; R: TRect); begin if CacheData.ContainerBorderColor = nil then inherited DrawBorder(ACanvas, R) else ACanvas.FrameRect(R, CacheData.ContainerBorderColor.Value); end; class function TdxSkinLookAndFeelPainter.AdjustGroupButtonDisplayRect( const R: TRect; AButtonCount, AButtonIndex: Integer): TRect; begin Result := inherited AdjustGroupButtonDisplayRect(R, AButtonCount, AButtonIndex); end; class function TdxSkinLookAndFeelPainter.ButtonBorderSize( AState: TcxButtonState = cxbsNormal): Integer; begin if CacheData.ButtonElements <> nil then Result := 0 else Result := inherited ButtonBorderSize(AState); end; class function TdxSkinLookAndFeelPainter.ButtonColor( AState: TcxButtonState): TColor; begin Result := inherited ButtonColor(AState); end; class function TdxSkinLookAndFeelPainter.ButtonFocusRect( ACanvas: TcxCanvas; R: TRect): TRect; begin Result := inherited ButtonFocusRect(ACanvas, R); end; class function TdxSkinLookAndFeelPainter.ButtonGroupBorderSizes( AButtonCount, AButtonIndex: Integer): TRect; var AGlyphSize: TSize; AXOffset: Integer; AYOffset: Integer; begin with CacheData do begin if EditButtonElements[False] <> nil then begin AGlyphSize := NavigatorGlyphSize; AXOffset := (EditButtonElements[False].Size.cx - AGlyphSize.cx) div 2; AYOffset := (EditButtonElements[False].Size.cy - AGlyphSize.cy) div 2; Result := Rect(AXOffset, AYOffset, AXOffset, AYOffset); end else Result := inherited ButtonGroupBorderSizes(AButtonCount, AButtonIndex); end; end; class function TdxSkinLookAndFeelPainter.ButtonSymbolColor( AState: TcxButtonState; ADefaultColor: TColor = clDefault): TColor; begin with CacheData do if ButtonElements = nil then Result := inherited ButtonSymbolColor(AState, ADefaultColor) else if (AState = cxbsDisabled) and (ButtonDisabled <> nil) then Result := ButtonDisabled.Value else Result := ButtonElements.TextColor; end; class function TdxSkinLookAndFeelPainter.ButtonTextOffset: Integer; begin Result := inherited ButtonTextOffset; end; class function TdxSkinLookAndFeelPainter.ButtonTextShift: Integer; begin Result := inherited ButtonTextShift; end; class procedure TdxSkinLookAndFeelPainter.DrawButton(ACanvas: TcxCanvas; R: TRect; const ACaption: string; AState: TcxButtonState; ADrawBorder: Boolean = True; AColor: TColor = clDefault; ATextColor: TColor = clDefault; AWordWrap: Boolean = False); var AFlags: Integer; begin with ACanvas, CacheData do if ButtonElements <> nil then begin ButtonElements.Draw(ACanvas.Handle, R, 0, ButtonState2SkinState[AState]); R := cxRectContent(R, ButtonElements.ContentOffset.Rect); if ATextColor = clDefault then Font.Color := ButtonSymbolColor(AState) else Font.Color := ATextColor; Brush.Style := bsClear; with R do // for compatible with standard buttons begin Dec(Bottom, Ord(Odd(Bottom - Top))); if (Bottom - Top) < 18 then Dec(Top); end; if AState = cxbsPressed then OffsetRect(R, ButtonTextShift, ButtonTextShift); if Length(ACaption) > 0 then begin AFlags := cxAlignVCenter or cxShowPrefix or cxAlignHCenter; if AWordWrap then AFlags := AFlags or cxWordBreak else AFlags := AFlags or cxSingleLine; DrawText(ACaption, R, AFlags, AState <> cxbsDisabled); end; Brush.Style := bsSolid; end else inherited DrawButton(ACanvas, R, ACaption, AState, ADrawBorder, AColor, ATextColor, AWordWrap); end; class procedure TdxSkinLookAndFeelPainter.DrawButtonGroupBorder(ACanvas: TcxCanvas; R: TRect; AInplace, ASelected: Boolean); begin end; class procedure TdxSkinLookAndFeelPainter.DrawButtonInGroup(ACanvas: TcxCanvas; R: TRect; AState: TcxButtonState; AButtonCount, AButtonIndex: Integer; ABackgroundColor: TColor); begin DrawEditorButton(ACanvas, R, cxbkEditorBtn, AState); end; class procedure TdxSkinLookAndFeelPainter.DrawExpandButton(ACanvas: TcxCanvas; const R: TRect; AExpanded: Boolean; AColor: TColor = clDefault); begin with CacheData do begin if ExpandButton = nil then inherited DrawExpandButton(ACanvas, R, AExpanded, AColor) else ExpandButton.Draw(ACanvas.Handle, R, Byte(AExpanded)); end; end; class function TdxSkinLookAndFeelPainter.DrawExpandButtonFirst: Boolean; begin Result := inherited DrawExpandButtonFirst; end; class procedure TdxSkinLookAndFeelPainter.DrawGroupExpandButton( ACanvas: TcxCanvas; const R: TRect; AExpanded: Boolean; AState: TcxButtonState); begin inherited DrawGroupExpandButton(ACanvas,R, AExpanded, AState); end; class procedure TdxSkinLookAndFeelPainter.DrawSmallExpandButton( ACanvas: TcxCanvas; R: TRect; AExpanded: Boolean; ABorderColor: TColor; AColor: TColor = clDefault); begin with CacheData do begin if ExpandButton = nil then inherited DrawSmallExpandButton(ACanvas, R, AExpanded, ABorderColor, AColor) else ExpandButton.Draw(ACanvas.Handle, R, Byte(AExpanded)); end; end; class function TdxSkinLookAndFeelPainter.ExpandButtonSize: Integer; begin with CacheData do begin if ExpandButton = nil then Result := inherited ExpandButtonSize else Result := ExpandButton.Size.cy; end; end; class function TdxSkinLookAndFeelPainter.GroupExpandButtonSize: Integer; begin Result := inherited GroupExpandButtonSize; end; class function TdxSkinLookAndFeelPainter.SmallExpandButtonSize: Integer; begin Result := inherited SmallExpandButtonSize; end; class function TdxSkinLookAndFeelPainter.IsButtonHotTrack: Boolean; begin Result := inherited IsButtonHotTrack; end; class function TdxSkinLookAndFeelPainter.IsPointOverGroupExpandButton( const R: TRect; const P: TPoint): Boolean; begin Result := inherited IsPointOverGroupExpandButton(R, P); end; class function TdxSkinLookAndFeelPainter.ScrollBarMinimalThumbSize(AVertical: Boolean): Integer; var AInfo: TdxSkinScrollInfo; begin AInfo := CacheData.ScrollBar_Elements[not AVertical, sbpThumbnail]; if (AInfo <> nil) and (AInfo.Element <> nil) then begin if AVertical then Result := AInfo.Element.Size.cy else Result := AInfo.Element.Size.cx; end else Result := inherited ScrollBarMinimalThumbSize(AVertical); end; class procedure TdxSkinLookAndFeelPainter.DrawScrollBarPart(ACanvas: TcxCanvas; AHorizontal: Boolean; R: TRect; APart: TcxScrollBarPart; AState: TcxButtonState); var AInfo: TdxSkinScrollInfo; begin AInfo := CacheData.ScrollBar_Elements[AHorizontal, APart]; if (AInfo <> nil) and (AInfo.Element <> nil) then AInfo.Element.Draw(ACanvas.Handle, R, AInfo.ImageIndex, ButtonState2SkinState[AState]) else inherited DrawScrollBarPart(ACanvas, AHorizontal, R, APart, AState) end; class function TdxSkinLookAndFeelPainter.SizeGripSize: TSize; begin with CacheData do if SizeGrip = nil then Result := inherited SizeGripSize else Result := SizeGrip.Size end; class procedure TdxSkinLookAndFeelPainter.DrawSizeGrip(ACanvas: TcxCanvas; const ARect: TRect; ABackgroundColor: TColor); begin with CacheData do if SizeGrip = nil then inherited DrawSizeGrip(ACanvas, ARect, ABackgroundColor) else begin ACanvas.FillRect(ARect, ABackgroundColor); SizeGrip.Draw(ACanvas.Handle, ARect); end; end; class procedure TdxSkinLookAndFeelPainter.DrawRadioButton(ACanvas: TcxCanvas; X, Y: Integer; AButtonState: TcxButtonState; AChecked, AFocused: Boolean; ABrushColor: TColor; AIsDesigning: Boolean = False); var ADestRect: TRect; begin with CacheData do begin if RadioGroupButton <> nil then begin ADestRect := Rect(X, Y, X + RadioGroupButton.Size.cX, Y + RadioGroupButton.Size.cy); if ABrushColor <> clDefault then ACanvas.FillRect(ADestRect, ABrushColor); RadioGroupButton.Draw(ACanvas.Handle, ADestRect, Byte(AChecked), ButtonState2SkinState[AButtonState]); end else inherited DrawRadioButton(ACanvas, X, Y, AButtonState, AChecked, AFocused, ABrushColor, AIsDesigning); end; end; class function TdxSkinLookAndFeelPainter.RadioButtonSize: TSize; begin with CacheData do if RadioGroupButton <> nil then Result := RadioGroupButton.Size else Result := inherited RadioButtonSize; end; class function TdxSkinLookAndFeelPainter.CheckButtonSize: TSize; begin with CacheData do if CheckboxElement <> nil then Result := CheckboxElement.Size else Result := inherited CheckButtonSize; end; class procedure TdxSkinLookAndFeelPainter.DrawCheckButton(ACanvas: TcxCanvas; R: TRect; AState: TcxButtonState; AChecked: Boolean; AGrayed: Boolean = False); var AStateIndex: Integer; begin if AGrayed then AStateIndex := 2 else if AChecked then AStateIndex := 1 else AStateIndex := 0; with CacheData do if CheckboxElement <> nil then CheckboxElement.Draw(ACanvas.Handle, R, AStateIndex, ButtonState2SkinState[AState]) else inherited DrawCheckButton(ACanvas, R, AState, AChecked, AGrayed); end; class function TdxSkinLookAndFeelPainter.DrawEditorButtonBackground(ACanvas: TcxCanvas; const ARect: TRect; ACloseButton: Boolean; AState: TdxSkinElementState): Boolean; begin with CacheData do begin Result := EditButtonElements[ACloseButton] <> nil; if Result then EditButtonElements[ACloseButton].Draw(ACanvas.Handle, ARect, 0, AState); end; end; class procedure TdxSkinLookAndFeelPainter.DrawClock(ACanvas: TcxCanvas; const ARect: TRect; ADateTime: TDateTime; ABackgroundColor: TColor); procedure DrawHand(ACanvas: TCanvas; ACenter: TPoint; AAngle, L1X, L1Y, L2X, L2Y, L3: Extended; AHandColor: TColor); begin with ACanvas do begin Brush.Color := AHandColor; BeginPath(Handle); Pixels[Round(ACenter.X + L1X * cos(AAngle)), Round(ACenter.Y + L1Y * sin(AAngle))] := clTeal; Pen.Color := clTeal; MoveTo(Round(ACenter.X + L1X * cos(AAngle)), Round(ACenter.Y + L1Y * sin(AAngle))); LineTo(Round(ACenter.X + L3 / 2 * cos(AAngle + Pi / 2)), Round(ACenter.Y + L3 / 2 * sin(AAngle + Pi / 2))); LineTo(Round(ACenter.X + L2X * cos(AAngle + Pi)), Round(ACenter.Y + L2Y * sin(AAngle + Pi))); LineTo(Round(ACenter.X + L3 / 2 * cos(AAngle + Pi * 3 / 2)), Round(ACenter.Y + L3 / 2 * sin(AAngle + Pi * 3 / 2))); LineTo(Round(ACenter.X + L1X * cos(AAngle)), Round(ACenter.Y + L1Y * sin(AAngle))); EndPath(Handle); FillPath(Handle); end; end; procedure DrawHands(ACanvas: TCanvas; AHandColor: TColor); var AAngle: Extended; ACenter: TPoint; AHandRadiusX, AHandRadiusY: Extended; AHour, AMin, AMSec, ASec: Word; begin DecodeTime(ADateTime, AHour, AMin, ASec, AMSec); ACenter.X := (ARect.Right + ARect.Left) div 2; ACenter.Y := (ARect.Bottom + ARect.Top) div 2; AHandRadiusX := (ARect.Right - ARect.Left) / 2 - 2; AHandRadiusY := (ARect.Bottom - ARect.Top) / 2 - 2; with ACanvas do begin AAngle := Pi * 2 * ((AHour mod 12) * 60 * 60 + AMin * 60 + ASec - 3 * 60 * 60) / 12 / 60 / 60; DrawHand(ACanvas, ACenter, AAngle, AHandRadiusX * 0.75, AHandRadiusY * 0.75, AHandRadiusX * 0.15, AHandRadiusY * 0.15, 9, AHandColor); AAngle := Pi * 2 * (AMin * 60 + ASec - 15 * 60) / 60 / 60; DrawHand(ACanvas, ACenter, AAngle, AHandRadiusX * 0.85, AHandRadiusY * 0.85, AHandRadiusX * 0.2, AHandRadiusY * 0.2, 7, AHandColor); Pen.Color := AHandColor; MoveTo(ACenter.X, ACenter.Y); AAngle := Pi * 2 * (ASec - 15) / 60; LineTo(Round(ACenter.X + AHandRadiusX * 0.9 * cos(AAngle)), Round(ACenter.Y + AHandRadiusY * 0.9 * sin(AAngle))); end; end; var ABitmap: TBitmap; begin with CacheData do if (ClockElements[False] = nil) or (ClockElements[True] = nil) then inherited DrawClock(ACanvas, ARect, ADateTime, ABackgroundColor) else begin ABitmap := TBitmap.Create; try ABitmap.Width := ARect.Right - ARect.Left; ABitmap.Height := ARect.Bottom - ARect.Top; ABitmap.Canvas.Brush.Color := ABackgroundColor; ABitmap.Canvas.FillRect(ARect); ClockElements[False].Draw(ABitmap.Canvas.Handle, ARect); DrawHands(ABitmap.Canvas, ClockElements[False].TextColor); ClockElements[True].Draw(ABitmap.Canvas.Handle, ARect); with ARect do BitBlt(ACanvas.Handle, Left, Top, Right - Left, Bottom - Top, ABitmap.Canvas.Handle, 0, 0, SRCCOPY); finally ABitmap.Free; end; end; end; class procedure TdxSkinLookAndFeelPainter.DrawEditorButton(ACanvas: TcxCanvas; const ARect: TRect; AButtonKind: TcxEditBtnKind; AState: TcxButtonState); var AEllipseSize: Integer; AGlyph: TdxSkinElement; ASkinInfo: TdxSkinLookAndFeelPainterInfo; R: TRect; procedure DrawEllipsis(const ARect: TRect; ASize: Integer); var AColor: TColor; begin if ASkinInfo.EditButtonElements[False] <> nil then AColor := ASkinInfo.EditButtonElements[False].TextColor else AColor := clDefault; ACanvas.FillRect(Rect(ARect.Left, ARect.Top, ARect.Left + ASize, ARect.Top + ASize), AColor); ACanvas.FillRect(Rect(ARect.Left + ASize + 2, ARect.Top, ARect.Left + ASize * 2 + 2, ARect.Top + ASize), AColor); ACanvas.FillRect(Rect(ARect.Left + ASize * 2 + 4, ARect.Top, ARect.Left + ASize * 3 + 4, ARect.Top + ASize), AColor); end; begin if not DrawEditorButtonBackground(ACanvas, ARect, AButtonKind = cxbkCloseBtn, ButtonState2SkinState[AState]) then inherited DrawEditorButton(ACanvas, ARect, AButtonKind, AState) else if PaintersManager.GetPainterData(Self, ASkinInfo) then begin if ASkinInfo.EditButtonElements[False] <> nil then R := cxRectContent(ARect, ASkinInfo.EditButtonElements[False].ContentOffset.Rect); case AButtonKind of cxbkComboBtn, cxbkEditorBtn, cxbkSpinUpBtn, cxbkSpinDownBtn, cxbkSpinLeftBtn, cxbkSpinRightBtn: begin AGlyph := ASkinInfo.EditButtonGlyphs[AButtonKind]; if AGlyph <> nil then AGlyph.Glyph.Draw(ACanvas.Handle, R); end; cxbkEllipsisBtn: begin AEllipseSize := 1; if R.Right - R.Left >= 12 then Inc(AEllipseSize); DrawEllipsis(cxRectCenter(R, 3 * AEllipseSize + 4, AEllipseSize), AEllipseSize); end; end; end; end; class function TdxSkinLookAndFeelPainter.EditButtonTextOffset: Integer; begin Result := 1; end; class function TdxSkinLookAndFeelPainter.EditButtonSize: TSize; begin with CacheData do if EditButtonElements[False] = nil then Result := inherited EditButtonSize else Result := EditButtonElements[False].Size; end; class function TdxSkinLookAndFeelPainter.EditButtonTextColor: TColor; begin with CacheData do if EditButtonElements[False] = nil then Result := inherited EditButtonTextColor else Result := EditButtonElements[False].TextColor; end; class function TdxSkinLookAndFeelPainter.GetContainerBorderColor( AIsHighlightBorder: Boolean): TColor; var ASkinColor: TdxSkinColor; begin with CacheData do begin if AIsHighlightBorder then ASkinColor := ContainerHighlightBorderColor else ASkinColor := ContainerBorderColor; if ASkinColor = nil then Result := inherited GetContainerBorderColor(AIsHighlightBorder) else Result := ASkinColor.Value; end; end; class procedure TdxSkinLookAndFeelPainter.DrawNavigatorGlyph(ACanvas: TcxCanvas; AImageList: TCustomImageList; AImageIndex: {$IFDEF DELPHI5}TImageIndex{$ELSE}Integer{$ENDIF}; AButtonIndex: Integer; const AGlyphRect: TRect; AEnabled: Boolean; AUserGlyphs: Boolean); begin with CacheData do if (NavigatorGlyphs = nil) or (NavigatorGlyphsVert = nil) or AUserGlyphs then inherited DrawNavigatorGlyph(ACanvas, AImageList, AImageIndex, AButtonIndex, AGlyphRect, AEnabled, AUserGlyphs) else if NavigatorGlyphs.ImageCount > AImageIndex then NavigatorGlyphs.Draw(ACanvas.Handle, AGlyphRect, AImageIndex) else begin Dec(AImageIndex, NavigatorGlyphs.ImageCount); NavigatorGlyphsVert.Draw(ACanvas.Handle, AGlyphRect, AImageIndex); end; end; class function TdxSkinLookAndFeelPainter.NavigatorGlyphSize: TSize; begin with CacheData do if NavigatorGlyphs <> nil then Result := NavigatorGlyphs.Size else Result := inherited NavigatorGlyphSize; end; class procedure TdxSkinLookAndFeelPainter.DrawProgressBarBorder(ACanvas: TcxCanvas; ARect: TRect; AVertical: Boolean); begin with CacheData do if ProgressBarElements[False, AVertical] <> nil then ProgressBarElements[False, AVertical].Draw(ACanvas.Handle, ARect) else inherited DrawProgressBarBorder(ACanvas, ARect, AVertical); end; class procedure TdxSkinLookAndFeelPainter.DrawProgressBarChunk(ACanvas: TcxCanvas; ARect: TRect; AVertical: Boolean); begin with CacheData do if ProgressBarElements[True, AVertical] <> nil then ProgressBarElements[True, AVertical].Draw(ACanvas.Handle, ARect) else inherited DrawProgressBarChunk(ACanvas, ARect, AVertical); end; class function TdxSkinLookAndFeelPainter.ProgressBarBorderSize(AVertical: Boolean): TRect; begin with CacheData do if ProgressBarElements[False, AVertical] <> nil then Result := ProgressBarElements[False, AVertical].ContentOffset.Rect else Result := inherited ProgressBarBorderSize(AVertical); end; class function TdxSkinLookAndFeelPainter.GroupBoxBorderSize(ACaption: Boolean; ACaptionPosition: TcxGroupBoxCaptionPosition): TRect; var AGroupBoxInfo: TdxSkinElement; begin with CacheData do if ACaption then AGroupBoxInfo := GroupBoxCaptionElements[ACaptionPosition] else AGroupBoxInfo := GroupBoxElements[ACaptionPosition]; if AGroupBoxInfo = nil then Result := inherited GroupBoxBorderSize(ACaption, ACaptionPosition) else Result := AGroupBoxInfo.ContentOffset.Rect; end; class function TdxSkinLookAndFeelPainter.IsGroupBoxTransparent( AIsCaption: Boolean; ACaptionPosition: TcxGroupBoxCaptionPosition): Boolean; var AGroupBoxInfo: TdxSkinElement; begin with CacheData do if AIsCaption then AGroupBoxInfo := GroupBoxCaptionElements[ACaptionPosition] else AGroupBoxInfo := GroupBoxElements[ACaptionPosition]; if AGroupBoxInfo = nil then Result := inherited IsGroupBoxTransparent(AIsCaption, ACaptionPosition) else Result := AGroupBoxInfo.IsAlphaUsed; end; class procedure TdxSkinLookAndFeelPainter.DrawGroupBoxCaption(ACanvas: TcxCanvas; ACaptionRect: TRect; ACaptionPosition: TcxGroupBoxCaptionPosition); begin with CacheData do if GroupBoxCaptionElements[ACaptionPosition] = nil then inherited DrawGroupBoxCaption(ACanvas, ACaptionRect, ACaptionPosition) else GroupBoxCaptionElements[ACaptionPosition].Draw(ACanvas.Handle, ACaptionRect); end; class procedure TdxSkinLookAndFeelPainter.DrawGroupBoxContent(ACanvas: TcxCanvas; ABorderRect: TRect; ACaptionPosition: TcxGroupBoxCaptionPosition); var ARect: TRect; begin with CacheData do if (GroupBoxElements[ACaptionPosition] = nil) or (GroupBoxClient = nil) then inherited DrawGroupBoxContent(ACanvas, ABorderRect, ACaptionPosition) else begin with GroupBoxElements[ACaptionPosition] do ARect := Rect(ABorderRect.Left + ContentOffset.Left + Borders[bLeft].Thin, ABorderRect.Top + ContentOffset.Top + Borders[bTop].Thin, ABorderRect.Right - ContentOffset.Right - Borders[bRight].Thin, ABorderRect.Bottom - ContentOffset.Bottom - Borders[bBottom].Thin); GroupBoxClient.Draw(ACanvas.Handle, ARect); ACanvas.ExcludeClipRect(ARect); GroupBoxElements[ACaptionPosition].Draw(ACanvas.Handle, ABorderRect); end; end; class procedure TdxSkinLookAndFeelPainter.DrawGroupBoxBackground(ACanvas: TcxCanvas; ABounds: TRect; ARect: TRect); begin with CacheData do if GroupBoxClient = nil then inherited DrawGroupBoxBackground(ACanvas, ABounds, ARect) else GroupBoxClient.Draw(ACanvas.Handle, ARect); end; class procedure TdxSkinLookAndFeelPainter.DrawHeader(ACanvas: TcxCanvas; const ABounds, ATextAreaBounds: TRect; ANeighbors: TcxNeighbors; ABorders: TcxBorders; AState: TcxButtonState; AAlignmentHorz: TAlignment; AAlignmentVert: TcxAlignmentVert; AMultiLine, AShowEndEllipsis: Boolean; const AText: string; AFont: TFont; ATextColor, ABkColor: TColor; AOnDrawBackground: TcxDrawBackgroundEvent = nil; AIsLast: Boolean = False; AIsGroup: Boolean = False); var AHeader: TdxSkinElement; ARect: TRect; begin with CacheData do if AIsGroup then AHeader := HeaderSpecial else AHeader := Header; if AHeader = nil then inherited DrawHeader(ACanvas, ABounds, ATextAreaBounds, ANeighbors, ABorders, AState, AAlignmentHorz, AAlignmentVert, AMultiLine, AShowEndEllipsis, AText, AFont, ATextColor, ABkColor, AOnDrawBackGround, AIsLast, AIsGroup) else begin ARect := ABounds; if not (bLeft in ABorders) then Dec(ARect.Left); if not (bTop in ABorders) then Dec(ARect.Top); if not (bRight in ABorders) then Inc(ARect.Right); if not (bBottom in ABorders) then Inc(ARect.Bottom); ACanvas.SaveClipRegion; ACanvas.SetClipRegion(TcxRegion.Create(ABounds), roIntersect); try AHeader.Draw(ACanvas.Handle, ARect, 0, ButtonState2SkinState[AState]); DrawContent(ACanvas, HeaderContentBounds(ABounds, ABorders), ATextAreaBounds, Integer(AState), AAlignmentHorz, AAlignmentVert, AMultiLine, AShowEndEllipsis, AText, AFont, ATextColor, ABkColor, AOnDrawBackground); finally ACanvas.RestoreClipRegion; end; end; end; class procedure TdxSkinLookAndFeelPainter.DrawHeaderEx(ACanvas: TcxCanvas; const ABounds, ATextAreaBounds: TRect; ANeighbors: TcxNeighbors; ABorders: TcxBorders; AState: TcxButtonState; AAlignmentHorz: TAlignment; AAlignmentVert: TcxAlignmentVert; AMultiLine, AShowEndEllipsis: Boolean; const AText: string; AFont: TFont; ATextColor, ABkColor: TColor; AOnDrawBackground: TcxDrawBackgroundEvent = nil); begin DrawHeader(ACanvas, ABounds, ATextAreaBounds, ANeighbors, ABorders, AState, AAlignmentHorz, AAlignmentVert, AMultiLine, AShowEndEllipsis, AText, AFont, ATextColor, ABkColor, AOnDrawBackground); end; class procedure TdxSkinLookAndFeelPainter.DrawHeaderSeparator(ACanvas: TcxCanvas; const ABounds: TRect; AIndentSize: Integer; AColor: TColor; AViewParams: TcxViewParams); begin with CacheData do if HeaderBackgroundColor = nil then inherited DrawHeaderSeparator(ACanvas, ABounds, AIndentSize, AColor, AViewParams) else ACanvas.FillRect(cxRectInflate(ABounds, -AIndentSize, 0), HeaderBackgroundColor.Value); end; class function TdxSkinLookAndFeelPainter.HeaderBorders( ANeighbors: TcxNeighbors): TcxBorders; begin Result := inherited HeaderBorders(ANeighbors); if nLeft in ANeighbors then Exclude(Result, bLeft); if nTop in ANeighbors then Exclude(Result, bTop); end; class function TdxSkinLookAndFeelPainter.HeaderDrawCellsFirst: Boolean; begin Result := False; end; class procedure TdxSkinLookAndFeelPainter.DrawGroupByBox(ACanvas: TcxCanvas; const ARect: TRect; ATransparent: Boolean; ABackgroundColor: TColor; const ABackgroundBitmap: TBitmap); begin with CacheData do begin if GridGroupByBox = nil then inherited DrawGroupByBox(ACanvas, ARect, ATransparent, ABackgroundColor, ABackgroundBitmap) else GridGroupByBox.Draw(ACanvas.Handle, ARect); end; end; class procedure TdxSkinLookAndFeelPainter.DrawFooterBorder(ACanvas: TcxCanvas; const R: TRect); var ABounds: TRect; begin with CacheData do if FooterPanel = nil then inherited DrawFooterBorder(ACanvas, R) else begin ACanvas.SaveClipRegion; with FooterPanel.ContentOffset.Rect do ACanvas.ExcludeClipRect(Rect(R.Left, R.Top, R.Right - Right, R.Bottom - Bottom)); ACanvas.ExcludeClipRect(Rect(R.Left, R.Top - 1, R.Right, R.Top)); try ABounds := R; Dec(ABounds.Top); Dec(ABounds.Left, FooterPanel.ContentOffset.Left); FooterPanel.Draw(ACanvas.Handle, ABounds); finally ACanvas.RestoreClipRegion; end; end; end; class procedure TdxSkinLookAndFeelPainter.DrawFooterCell(ACanvas: TcxCanvas; const ABounds: TRect; AAlignmentHorz: TAlignment; AAlignmentVert: TcxAlignmentVert; AMultiLine: Boolean; const AText: string; AFont: TFont; ATextColor, ABkColor: TColor; AOnDrawBackground: TcxDrawBackgroundEvent = nil); begin with CacheData do begin if FooterCell = nil then inherited DrawFooterCell(ACanvas, ABounds, AAlignmentHorz, AAlignmentVert, AMultiLine, AText, AFont, ATextColor, ABkColor, AOnDrawBackground) else begin FooterCell.Draw(ACanvas.Handle, ABounds); DrawContent(ACanvas, FooterCellContentBounds(ABounds), FooterCellTextAreaBounds(ABounds), 0, AAlignmentHorz, AAlignmentVert, AMultiLine, False, AText, AFont, ATextColor, ABkColor, AOnDrawBackground, True); ACanvas.ExcludeClipRect(ABounds); end; end; end; class procedure TdxSkinLookAndFeelPainter.DrawFooterContent(ACanvas: TcxCanvas; const ARect: TRect; const AViewParams: TcxViewParams); var R: TRect; begin with CacheData do begin if (FooterPanel = nil) or (AViewParams.Bitmap <> nil) and not AViewParams.Bitmap.Empty then inherited DrawFooterContent(ACanvas, ARect, AViewParams) else begin with FooterPanel.ContentOffset do R := Classes.Rect(ARect.Left - Left, ARect.Top, ARect.Right + Right, ARect.Bottom + Bottom); Dec(R.Top); FooterPanel.Draw(ACanvas.Handle, R); end; end; end; class function TdxSkinLookAndFeelPainter.FooterCellBorderSize: Integer; begin with CacheData do if FooterCell = nil then Result := inherited FooterCellBorderSize else with FooterCell.ContentOffset do Result := Max(Max(Left, Top), Max(Right, Bottom)); end; class function TdxSkinLookAndFeelPainter.FooterDrawCellsFirst: Boolean; begin Result := False; end; class function TdxSkinLookAndFeelPainter.FooterSeparatorColor: TColor; begin Result := DefaultGridLineColor; end; class procedure TdxSkinLookAndFeelPainter.DrawFilterDropDownButton( ACanvas: TcxCanvas; R: TRect; AState: TcxButtonState; AIsFilterActive: Boolean); begin with CacheData do if FilterButtons[AIsFilterActive] <> nil then FilterButtons[AIsFilterActive].Draw(ACanvas.Handle, R, 0, ButtonState2SkinState[AState]) else inherited DrawFilterDropDownButton(ACanvas, R, AState, AIsFilterActive); end; class procedure TdxSkinLookAndFeelPainter.DrawFilterCloseButton(ACanvas: TcxCanvas; R: TRect; AState: TcxButtonState); begin with CacheData do begin if EditButtonElements[True] = nil then inherited DrawFilterCloseButton(ACanvas, R, AState) else EditButtonElements[True].Draw(ACanvas.Handle, R, 0, ButtonState2SkinState[AState]); end; end; class procedure TdxSkinLookAndFeelPainter.DrawFilterPanel(ACanvas: TcxCanvas; const ARect: TRect; ATransparent: Boolean; ABackgroundColor: TColor; const ABackgroundBitmap: TBitmap); begin with CacheData do begin if FilterPanel = nil then inherited DrawFilterPanel(ACanvas, ARect, ATransparent, ABackgroundColor, ABackgroundBitmap) else FilterPanel.Draw(ACanvas.Handle, ARect); end; end; class function TdxSkinLookAndFeelPainter.FilterCloseButtonSize: TPoint; begin with CacheData do begin if EditButtonElements[True] = nil then Result := inherited FilterCloseButtonSize else with EditButtonElements[True].Size do Result := Point(cx, cy); end; end; class procedure TdxSkinLookAndFeelPainter.DrawTrackBar(ACanvas: TcxCanvas; const ARect: TRect; const ASelection: TRect; AShowSelection: Boolean; AEnabled: Boolean; AHorizontal: Boolean); begin with CacheData do if TrackBarTrack[AHorizontal] = nil then inherited DrawTrackBar(ACanvas, ARect, ASelection, AShowSelection, AEnabled, AHorizontal) else begin TrackBarTrack[AHorizontal].Draw(ACanvas.Handle, ARect, 2 * Byte(not AEnabled)); if AShowSelection then TrackBarTrack[AHorizontal].Draw(ACanvas.Handle, ASelection, 2 * Byte(not AEnabled) + 1); end; end; class procedure TdxSkinLookAndFeelPainter.DrawTrackBarThumb(ACanvas: TcxCanvas; ARect: TRect; AState: TcxButtonState; AHorizontal: Boolean; ATicks: TcxTrackBarTicksAlign); begin with CacheData do begin if TrackBarThumb[AHorizontal, ATicks] <> nil then TrackBarThumb[AHorizontal, ATicks].Draw( ACanvas.Handle, ARect, 0, ButtonState2SkinState[AState]) else inherited DrawTrackBarThumb(ACanvas, ARect, AState, AHorizontal, ATicks) end; end; class function TdxSkinLookAndFeelPainter.TrackBarThumbSize(AHorizontal: Boolean): TSize; begin with CacheData do begin if TrackBarThumb[AHorizontal, tbtaDown] <> nil then Result := TrackBarThumb[AHorizontal, tbtaDown].Size else Result := inherited TrackBarThumbSize(AHorizontal); end; end; class function TdxSkinLookAndFeelPainter.TrackBarTrackSize: Integer; begin with CacheData do begin if TrackBarTrack[True] <> nil then Result := TrackBarTrack[True].Size.cy else Result := inherited TrackBarTrackSize; end; end; class procedure TdxSkinLookAndFeelPainter.DrawContent(ACanvas: TcxCanvas; const ABounds, ATextAreaBounds: TRect; AState: Integer; AAlignmentHorz: TAlignment; AAlignmentVert: TcxAlignmentVert; AMultiLine, AShowEndEllipsis: Boolean; const AText: string; AFont: TFont; ATextColor, ABkColor: TColor; AOnDrawBackground: TcxDrawBackgroundEvent = nil; AIsFooter: Boolean = False); const AlignmentsHorz: array[TAlignment] of Integer = (cxAlignLeft, cxAlignRight, cxAlignHCenter); AlignmentsVert: array[TcxAlignmentVert] of Integer = (cxAlignTop, cxAlignBottom, cxAlignVCenter); MultiLines: array[Boolean] of Integer = (cxSingleLine, cxWordBreak); ShowEndEllipsises: array[Boolean] of Integer = (0, cxShowEndEllipsis); begin with ACanvas do begin if AText <> '' then begin Brush.Style := bsClear; Font := AFont; Font.Color := ATextColor; DrawText(AText, ATextAreaBounds, AlignmentsHorz[AAlignmentHorz] or AlignmentsVert[AAlignmentVert] or MultiLines[AMultiLine] or ShowEndEllipsises[AShowEndEllipsis]); Brush.Style := bsSolid; end; end; end; class procedure TdxSkinLookAndFeelPainter.DrawSplitter(ACanvas: TcxCanvas; const ARect: TRect; AHighlighted: Boolean; AClicked: Boolean; AHorizontal: Boolean); begin with CacheData do begin if Splitter[AHorizontal] <> nil then Splitter[AHorizontal].Draw(ACanvas.Handle , ARect, Byte(AHighlighted)) else inherited DrawSplitter(ACanvas, ARect, AHighlighted, AClicked, AHorizontal); end; end; class function TdxSkinLookAndFeelPainter.GetSplitterSize(AHorizontal: Boolean): TSize; begin with CacheData do begin if Splitter[AHorizontal] <> nil then Result := Splitter[Ahorizontal].Size else Result := inherited GetSplitterSize(AHorizontal); end; end; class procedure TdxSkinLookAndFeelPainter.DrawIndicatorCustomizationMark( ACanvas: TcxCanvas; const R: TRect; AColor: TColor); const AIndicatorCustomizationMarkID = 2; var ARect: TRect; begin with CacheData do if IndicatorImages = nil then inherited DrawIndicatorCustomizationMark(ACanvas, R, AColor) else begin with IndicatorImages.Image.Size, R do begin ARect := Rect(0, 0, cx, cy); OffsetRect(ARect, (Left + Right - cx) div 2, (Top + Bottom - cy) div 2); end; IndicatorImages.Draw(ACanvas.Handle, ARect, AIndicatorCustomizationMarkID); end; end; class procedure TdxSkinLookAndFeelPainter.DrawIndicatorImage(ACanvas: TcxCanvas; const R: TRect; AKind: TcxIndicatorKind); const AIndicatorImagesMap: array[TcxIndicatorKind] of integer = (0, 0, 1, 2, 0, 0, 8); var ARect: TRect; begin with CacheData do if IndicatorImages = nil then inherited DrawIndicatorImage(ACanvas, R, AKind) else if AKind <> ikNone then begin with IndicatorImages.Image.Size, R do begin ARect := Rect(0, 0, cx, cy); OffsetRect(ARect, (Left + Right - cx) div 2, (Top + Bottom - cy) div 2); end; IndicatorImages.Draw(ACanvas.Handle, ARect, AIndicatorImagesMap[AKind]); end; end; class procedure TdxSkinLookAndFeelPainter.DrawIndicatorItem(ACanvas: TcxCanvas; const R: TRect; AKind: TcxIndicatorKind; AColor: TColor; AOnDrawBackground: TcxDrawBackgroundEvent = nil); var ARect: TRect; begin with R do ARect := Rect(Left, Top - HeaderBorderSize, Right, Bottom); DrawHeader(ACanvas, ARect, ARect, [], HeaderBorders([nTop, nBottom]), cxbsNormal, taLeftJustify, vaTop, False, False, '', nil, clNone, AColor, AOnDrawBackground); DrawIndicatorImage(ACanvas, R, AKind); end; class procedure TdxSkinLookAndFeelPainter.DrawIndicatorItemEx(ACanvas: TcxCanvas; const R: TRect; AKind: TcxIndicatorKind; AColor: TColor; AOnDrawBackground: TcxDrawBackgroundEvent = nil); begin DrawIndicatorItem(ACanvas, R, AKind, AColor, AOnDrawBackground); end; class procedure TdxSkinLookAndFeelPainter.DrawMonthHeader(ACanvas: TcxCanvas; const ABounds: TRect; const AText: string; ANeighbors: TcxNeighbors; const AViewParams: TcxViewParams; AArrows: TcxHeaderArrows; ASideWidth: Integer; AOnDrawBackground: TcxDrawBackgroundEvent = nil); begin DrawHeader(ACanvas, ABounds, ABounds, ANeighbors, HeaderBorders(ANeighbors), cxbsNormal, taCenter, vaCenter, False, False, AText, AViewParams.Font, AViewParams.TextColor, AViewParams.Color, AOnDrawBackground); DrawMonthHeaderArrows(ACanvas, ABounds, AArrows, ASideWidth, clWindowText); end; class procedure TdxSkinLookAndFeelPainter.DrawSchedulerNavigatorButton( ACanvas: TcxCanvas; R: TRect; AState: TcxButtonState); begin DrawEditorButtonBackground(ACanvas, R, False, ButtonState2SkinState[AState]); end; class procedure TdxSkinLookAndFeelPainter.DrawWindowContent(ACanvas: TcxCanvas; const ARect: TRect); begin with CacheData do if FormContent = nil then inherited DrawWindowContent(ACanvas, ARect) else ACanvas.FillRect(ARect, FormContent.Color); end; class function TdxSkinLookAndFeelPainter.IndicatorDrawItemsFirst: Boolean; begin Result := True; end; class function TdxSkinLookAndFeelPainter.CacheData: TdxSkinLookAndFeelPainterInfo; begin PaintersManager.GetPainterData(Self, Result); end; // procedure RegisterSkin(ASkin: TdxSkin; APainter: TdxSkinLookAndFeelPainterClass); begin if not CheckGdiPlus then Exit; PaintersManager.Register(ASkin.Name, TdxSkinLookAndFeelPainter, TdxSkinLookAndFeelPainterInfo.Create(ASkin)); end; procedure RegisterSkin(const ASkinName: string; APainter: TdxSkinLookAndFeelPainterClass; ALoadFromResource: Boolean; AInstance: THandle); var ASkin: TdxSkin; AData: TdxSkinLookAndFeelPainterInfo; begin if not CheckGdiPlus then Exit; if ALoadFromResource then ASkin := TdxSkin.Create(ASkinName, ALoadFromResource, AInstance) else ASkin := nil; AData := APainter.CacheData; if AData = nil then AData := TdxSkinLookAndFeelPainterInfo.Create(ASkin); PaintersManager.Register(ASkinName, APainter, AData); end; procedure UnregisterSkin(const ASkinName: string); begin PaintersManager.Unregister(ASkinName); end; initialization PaintersManager := GetExtendedStylePainters; finalization PaintersManager := nil; end.