📄 dxribbonskins.pas
字号:
{*******************************************************************}
{ }
{ Developer Express Visual Component Library }
{ ExpressBars components }
{ }
{ Copyright (c) 1998-2008 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 EXPRESSBARS 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 dxRibbonSkins;
{$I cxVer.inc}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ImgList, ExtCtrls, cxClasses, cxGraphics, dxBarSkin, dxBar,
dxBarSkinConsts, dxGDIPlusAPI, cxLookAndFeelPainters;
const
//ribbon's form consts
rfspActiveCaption = 10000; //don't change order
rfspInactiveCaption = 10001;
rfspActiveCaptionZoomed = 10002;
rfspInactiveCaptionZoomed = 10003;
rfspActiveCaptionLeftBorder = 10004;
rfspInactiveCaptionLeftBorder = 10005;
rfspActiveCaptionRightBorder = 10006;
rfspInactiveCaptionRightBorder = 10007;
rfspActiveLeftBorder = 10008;
rfspInactiveLeftBorder = 10009;
rfspActiveRightBorder = 10010;
rfspInactiveRightBorder = 10011;
rfspActiveBottomBorder1 = 10012;
rfspInactiveBottomBorder1 = 10013;
rfspActiveBottomBorder2 = 10014;
rfspInactiveBottomBorder2 = 10015;
rfspActiveBottomBorder3 = 10016;
rfspInactiveBottomBorder3 = 10017;
rfspRibbonForm = 10018;
//border icons
rfspBorderIconHot = 10020;
rfspBorderIconPressed = 10021;
rfspBorderIconInactiveHot = 10022;
rfspMinimizeNormalIconGlyph = 10023;
rfspMinimizeHotIconGlyph = 10024;
rfspMinimizePressedIconGlyph = 10025;
rfspMinimizeInactiveIconGlyph = 10026;
rfspMaximizeNormalIconGlyph = 10027;
rfspMaximizeHotIconGlyph = 10028;
rfspMaximizePressedIconGlyph = 10029;
rfspMaximizeInactiveIconGlyph = 10030;
rfspCloseNormalIconGlyph = 10031;
rfspCloseHotIconGlyph = 10032;
rfspClosePressedIconGlyph = 10033;
rfspCloseInactiveIconGlyph = 10034;
rfspRestoreNormalIconGlyph = 10035;
rfspRestoreHotIconGlyph = 10036;
rfspRestorePressedIconGlyph = 10037;
rfspRestoreInactiveIconGlyph = 10038;
rfspHelpNormalIconGlyph = 10039;
rfspHelpHotIconGlyph = 10040;
rfspHelpPressedIconGlyph = 10041;
rfspHelpInactiveIconGlyph = 10042;
//ribbon skin consts
rspTabNormal = 10043;
rspTabHot = 10044;
rspTabActive = 10045;
rspTabActiveHot = 10046;
rspTabFocused = 10047;
rspTabGroupsArea = 10048;
rspTabSeparator = 10049;
rspQATDefaultGlyph = 10052;
rspQATAtBottom = 10053;
rspRibbonClientTopArea = 10054;
rspQATNonClientLeft1Vista = 10055;
rspQATNonClientLeft2Vista = 10056;
rspQATNonClientRightVista = 10057;
rspQATPopup = 10058;
rspQATNonClientLeft1Active = 10059;
rspQATNonClientLeft1Inactive = 10060;
rspQATNonClientLeft2Active = 10061;
rspQATNonClientLeft2Inactive = 10062;
rspQATNonClientRightActive = 10063;
rspQATNonClientRightInactive = 10064;
rspRibbonBackground = 10065;
rspRibbonBottomEdge = 10066;
rspApplicationButtonNormal = 10067;
rspApplicationButtonHot = 10068;
rspApplicationButtonPressed = 10069;
rspApplicationMenuBorder = 10070;
rspApplicationMenuContentHeader= 10071;
rspApplicationMenuContentFooter= 10072;
rspDropDownBorder = 10073;
rspMenuContent = 10074;
rspMenuGlyph = 10075;
rspMenuMark = 10076;
rspMenuSeparatorHorz = 10077;
rspMenuSeparatorVert = 10078;
rspMenuArrowDown = 10079;
rspMenuArrowRight = 10080;
rspProgressSolidBand = 10081;
rspProgressDiscreteBand = 10082;
rspProgressSubstrate = 10083;
rspButtonGroupBorderLeft = 10084;
rspButtonGroupBorderRight = 10085;
rspScrollArrow = 10086;
rspScreenTip = 10087;
rspHelpButton = 10088;
rspApplicationMenuButton = 10089;
rspStatusBar = 10090;
rspStatusBarPanel = 10091;
rspStatusBarPanelLowered = 10092;
rspStatusBarPanelRaised = 10093;
rspStatusBarPanelSeparator = 10094;
rspStatusBarGripBackground = 10095;
rspStatusBarToolbarSeparator = 10096;
rspStatusBarSizeGripColor1 = 10098;
rspStatusBarSizeGripColor2 = 10099;
rspStatusBarFormLeftPart = 10100;
rspStatusBarFormRightPart = 10104;
rspStatusBarFormLeftPartDialog = 10108;
rspStatusBarFormRightPartDialog= 10112;
rspDropDownGalleryTopSizingBand = 10120;
rspDropDownGalleryBottomSizingBand = 10121;
rspDropDownGalleryTopSizeGrip = 10122;
rspDropDownGalleryBottomSizeGrip = 10123;
rspDropDownGalleryVerticalSizeGrip = 10124;
rspGalleryFilterBand = 10125;
rspGalleryGroupHeader = 10126;
//ribbon font colors
rspFormCaptionText = 10130;
rspDocumentNameText = 10131;
rspTabHeaderText = 10132;
rspTabGroupText = 10133;
rspTabGroupHeaderText = 10134;
rspStatusBarText = 10138;
//state's groups const
rspQATGroupButtonActive = 10200;
rspQATGroupButtonInactive = rspQATGroupButtonActive + DXBAR_STATESCOUNT;
rspArrowDownNormal = rspQATGroupButtonInactive + DXBAR_STATESCOUNT;
rspMenuDetachCaptionNormal = rspArrowDownNormal + DXBAR_STATESCOUNT;
rspMenuCheckNormal = rspMenuDetachCaptionNormal + DXBAR_STATESCOUNT;
rspMenuCheckMarkNormal = rspMenuCheckNormal + DXBAR_STATESCOUNT;
rspMenuScrollAreaNormal = rspMenuCheckMarkNormal + DXBAR_STATESCOUNT;
rspCollapsedToolbarNormal = rspMenuScrollAreaNormal + DXBAR_STATESCOUNT;
rspCollapsedToolbarGlyphBackgroundNormal = rspCollapsedToolbarNormal + DXBAR_STATESCOUNT;
rspEditButtonNormal = rspCollapsedToolbarGlyphBackgroundNormal + DXBAR_STATESCOUNT;
rspSmallButtonNormal = rspEditButtonNormal + DXBAR_STATESCOUNT;
rspSmallButtonGlyphBackgroundNormal = rspSmallButtonNormal + DXBAR_STATESCOUNT;
rspSmallButtonDropButtonNormal = rspSmallButtonGlyphBackgroundNormal + DXBAR_STATESCOUNT;
rspLargeButtonNormal = rspSmallButtonDropButtonNormal + DXBAR_STATESCOUNT;
rspLargeButtonGlyphBackgroundNormal = rspLargeButtonNormal + DXBAR_STATESCOUNT;
rspLargeButtonDropButtonNormal = rspLargeButtonGlyphBackgroundNormal + DXBAR_STATESCOUNT;
rspButtonGroupNormal = rspLargeButtonDropButtonNormal + DXBAR_STATESCOUNT;
rspButtonGroupBorderMiddleNormal = rspButtonGroupNormal + DXBAR_STATESCOUNT;
rspButtonGroupSplitButtonSeparatorNormal = rspButtonGroupBorderMiddleNormal + DXBAR_STATESCOUNT;
rspToolbarNormal = rspButtonGroupSplitButtonSeparatorNormal + DXBAR_STATESCOUNT;
rspToolbarHeaderNormal = rspToolbarNormal + DXBAR_STATESCOUNT;
rspMarkArrowNormal = rspToolbarHeaderNormal + DXBAR_STATESCOUNT;
rspMarkTruncatedNormal = rspMarkArrowNormal + DXBAR_STATESCOUNT;
rspLaunchButtonBackgroundNormal= rspMarkTruncatedNormal + DXBAR_STATESCOUNT;
rspLaunchButtonDefaultGlyphNormal = rspLaunchButtonBackgroundNormal + DXBAR_STATESCOUNT;
rspTabScrollLeftButtonNormal = rspLaunchButtonDefaultGlyphNormal + DXBAR_STATESCOUNT;
rspTabScrollRightButtonNormal = rspTabScrollLeftButtonNormal + DXBAR_STATESCOUNT;
rspGroupScrollLeftButtonNormal = rspTabScrollRightButtonNormal + DXBAR_STATESCOUNT;
rspGroupScrollRightButtonNormal= rspGroupScrollLeftButtonNormal + DXBAR_STATESCOUNT;
rspInRibbonGalleryScrollBarLineUpButtonNormal = rspGroupScrollRightButtonNormal + DXBAR_STATESCOUNT;
rspInRibbonGalleryScrollBarLineDownButtonNormal = rspInRibbonGalleryScrollBarLineUpButtonNormal + DXBAR_STATESCOUNT;
rspInRibbonGalleryScrollBarDropDownButtonNormal = rspInRibbonGalleryScrollBarLineDownButtonNormal + DXBAR_STATESCOUNT;
//next = rspGroupScrollRightButtonNormal + DXBAR_STATESCOUNT;
type
TdxApplicationButtonState = (absNormal, absHot, absPressed);
TdxBorderDrawIcon = (bdiMinimize, bdiMaximize, bdiRestore, bdiClose, bdiHelp);
TdxBorderIconState = (bisNormal, bisHot, bisPressed, bisInactive, bisHotInactive);
TdxInRibbonGalleryScrollBarButtonKind = (gsbkLineUp, gsbkLineDown, gsbkDropDown);
TdxRibbonTabState = (rtsNormal, rtsHot, rtsActive, rtsActiveHot, rtsFocused);
TdxRibbonFormData = packed record
Active: Boolean;
Bounds: TRect;
Border: TBorderStyle;
Handle: HWND;
State: TWindowState;
Style: TFormStyle;
DontUseAero: Boolean;
end;
TTwoStateArray = array[Boolean] of Integer;
TThreeStateArray = array[0..2] of Integer;
TFourStateArray = array[0..3] of Integer;
TStatesArray = array[0..DXBAR_STATESCOUNT-1] of Integer;
TdxCustomRibbonSkin = class(TdxCustomBarSkin)
private
// form
FCaption: TTwoStateArray;
FCaptionZoomed: TTwoStateArray;
FCaptionLeftBorder: TTwoStateArray;
FCaptionRightBorder: TTwoStateArray;
FLeftBorder: TTwoStateArray;
FRightBorder: TTwoStateArray;
FBottomBorderThin: TTwoStateArray;
FBottomBorderThick: array[Boolean] of TTwoStateArray;
FBorderIconGlyph: array[TdxBorderDrawIcon] of TFourStateArray;
FBorderIcons: TThreeStateArray;
FFormStatusBarLeftParts: array[Boolean] of TFourStateArray;
FFormStatusBarRightParts: array[Boolean] of TFourStateArray;
//quick access toolbar
FQATAtTopLeft: array[Boolean] of TTwoStateArray;
FQATAtTopRight: TTwoStateArray;
FQATGlassAtTopLeft: array[Boolean] of Integer;
FQATGlassAtTopRight: Integer;
FQATAtBottom: Integer;
FQATPopup: Integer;
FQATDefaultGlyph: Integer;
FRibbonTopArea: Integer;
//
FApplicationButton: TThreeStateArray;
FApplicationMenuButton: Integer;
FApplicationMenuBorder: Integer;
FApplicationMenuContentHeader: Integer;
FApplicationMenuContentFooter: Integer;
FArrowsDown: TStatesArray;
FMenuArrowRight: Integer;
FMenuArrowDown: Integer;
FEditButtons: TStatesArray;
FCollapsedToolbars: TStatesArray;
FCollapsedToolbarGlyphBackgrounds: TStatesArray;
FDropDownGalleryBottomSizeGrip: Integer;
FDropDownGalleryBottomSizingBand: Integer;
FDropDownGalleryTopSizeGrip: Integer;
FDropDownGalleryTopSizingBand: Integer;
FDropDownGalleryVerticalSizeGrip: Integer;
FGalleryFilterBand: Integer;
FGalleryGroupHeader: Integer;
FInRibbonGalleryScrollBarDropDownButton: TStatesArray;
FInRibbonGalleryScrollBarLineDownButton: TStatesArray;
FInRibbonGalleryScrollBarLineUpButton: TStatesArray;
FMenuCheck: TStatesArray;
FMenuCheckMark: TStatesArray;
FMenuDetachCaption: TStatesArray;
FMenuContent: Integer;
FMenuGlyph: Integer;
FMenuMark: Integer;
FMenuSeparatorHorz: Integer;
FMenuSeparatorVert: Integer;
FMenuScrollArea: TStatesArray;
FDropDownBorder: Integer;
FLargeButtons: TStatesArray;
FSmallButtons: TStatesArray;
FLargeButtonGlyphBackgrounds: TStatesArray;
FSmallButtonGlyphBackgrounds: TStatesArray;
FLargeButtonDropButtons: TStatesArray;
FSmallButtonDropButtons: TStatesArray;
FButtonGroup: TStatesArray;
FButtonGroupBorderLeft: Integer;
FButtonGroupBorderMiddle: TStatesArray;
FButtonGroupBorderRight: Integer;
FButtonGroupSplitButtonSeparator: TStatesArray;
FLaunchButtonBackgrounds: TStatesArray;
FLaunchButtonDefaultGlyphs: TStatesArray;
FProgressSolidBand: Integer;
FProgressDiscreteBand: Integer;
FProgressSubstrate: Integer;
FScrollArrow: Integer;
FToolbar: TStatesArray;
FToolbarHeader: TStatesArray;
FMarkArrow: TStatesArray;
FMarkTruncated: TStatesArray;
FTabScrollButtons: array[Boolean] of TThreeStateArray;
FGroupScrollButtons: array[Boolean] of TThreeStateArray;
FQATGroupButtonActive: TStatesArray;
FQATGroupButtonInactive: TStatesArray;
FHelpButton: Integer;
FStatusBar: Integer;
FStatusBarGripBackground: Integer;
FStatusBarPanel: Integer;
FStatusBarPanelLowered: Integer;
FStatusBarPanelRaised: Integer;
FStatusBarPanelSeparator: Integer;
FStatusBarToolbarSeparator: Integer;
FScreenTip: Integer;
FTabIndex: array[TdxRibbonTabState] of Integer;
FTabSeparator: Integer;
FTabGroupsArea: Integer;
FLowColors: Boolean;
procedure InternalDrawPart(const AParts: TStatesArray; DC: HDC; const R: TRect; AState: Integer);
procedure LoadThreeStateArray(ABitmap: GpBitmap; R: TRect; const Fixed: TRect;
var AStateArray: TThreeStateArray; AStartID: Integer;
AInterpolationMode: Integer = InterpolationModeDefault);
procedure LoadCommonButtonParts(ABitmap: GpBitmap);
procedure LoadCommonMenuParts(ABitmap: GpBitmap);
procedure LoadCommonProgressParts(ABitmap: GpBitmap);
procedure LoadInRibbonGalleryScrollBarParts(ABitmap: GpBitmap);
protected
function GetName: string; virtual; abstract;
procedure DrawApplicationButtonLC(DC: HDC; const R: TRect;
AState: TdxApplicationButtonState); virtual;
procedure DrawApplicationMenuBorderLC(DC: HDC; const R: TRect); virtual;
procedure DrawBlackArrow(DC: HDC; const R: TRect; AArrowDirection: TcxArrowDirection);
procedure DrawFormBordersLC(DC: HDC; const ABordersWidth: TRect;
ACaptionHeight: Integer; const AData: TdxRibbonFormData); virtual;
procedure DrawFormBorderIconLC(DC: HDC; const R: TRect;
AIcon: TdxBorderDrawIcon; AState: TdxBorderIconState); virtual;
procedure DrawFormCaptionLC(DC: HDC; const R: TRect;
const AData: TdxRibbonFormData); virtual;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -