📄 skindata.pas
字号:
FontStyle: TFontStyles;
UnEnabledFontColor, FontColor, ActiveFontColor: TColor;
TextRct: TRect;
StretchEffect: Boolean;
DividerStretchEffect: Boolean;
InActiveStretchEffect: Boolean;
AnimateSkinRect: TRect;
FrameCount: Integer;
AnimateInterval: Integer;
InActiveAnimation: Boolean;
ImageRct: TRect;
UseImageColor: Boolean;
ImageColor, ActiveImageColor: TColor;
InActiveTransparent: Boolean;
CheckImageRect, ActiveCheckImageRect: TRect;
RadioImageRect, ActiveRadioImageRect: TRect;
ArrowImageRect, ActiveArrowImageRect: TRect;
procedure LoadFromFile(IniFile: TCustomIniFile); override;
procedure SaveToFile(IniFile: TCustomIniFile); override;
end;
TspDataSkinMainMenuItem = class(TspDataSkinObject)
public
DownRect: TRect;
FontName: String;
FontHeight: Integer;
FontStyle: TFontStyles;
FontColor, ActiveFontColor, DownFontColor, UnEnabledFontColor: TColor;
TextRct: TRect;
ItemLO, ItemRO: Integer;
StretchEffect: Boolean;
AnimateSkinRect: TRect;
FrameCount: Integer;
AnimateInterval: Integer;
InActiveAnimation: Boolean;
procedure LoadFromFile(IniFile: TCustomIniFile); override;
procedure SaveToFile(IniFile: TCustomIniFile); override;
end;
TspDataSkinMainMenuBarItem = class(TspDataSkinMainMenuItem);
TspDataSkinCaption = class(TspDataSkinObject)
public
FontName: String;
FontHeight: Integer;
FontStyle: TFontStyles;
FontColor, ActiveFontColor: TColor;
ShadowColor, ActiveShadowColor: TColor;
Shadow: Boolean;
Alignment: TAlignment;
TextRct: TRect;
DefaultCaption: Boolean;
FrameRect, ActiveFrameRect: TRect;
FrameLeftOffset, FrameRightOffset: Integer;
FrameTextRect: TRect;
Light: Boolean;
LightColor, ActiveLightColor: TColor;
StretchEffect: Boolean;
AnimateSkinRect: TRect;
FrameCount: Integer;
AnimateInterval: Integer;
InActiveAnimation: Boolean;
FullFrame: Boolean;
procedure LoadFromFile(IniFile: TCustomIniFile); override;
procedure SaveToFile(IniFile: TCustomIniFile); override;
end;
TspSkinData = class;
TspCompressedStoredSkin = class(TComponent)
private
FFileName: String;
FCompressedFileName: String;
FCompressedStream: TMemoryStream;
FDescription: String;
procedure SetFileName(Value: String);
procedure SetCompressedFileName(Value: String);
function GetEmpty: Boolean;
protected
procedure ReadData(Reader: TStream);
procedure WriteData(Writer: TStream);
procedure DefineProperties(Filer: TFiler); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure LoadFromIniFile(AFileName: String);
procedure LoadFromCompressFile(AFileName: String);
procedure SaveToCompressFile(AFileName: String);
procedure DeCompressToStream(var S: TMemoryStream);
procedure LoadFromSkinData(ASkinData: TspSkinData);
procedure LoadFromCompressStream(Stream: TStream);
procedure SaveToCompressStream(Stream: TStream);
property Empty: Boolean read GetEmpty;
published
property Description: String read FDescription write FDescription;
property FileName: String read FFileName write SetFileName;
property CompressedFileName: String read FCompressedFileName write SetCompressedFileName;
end;
TspResourceStrData = class(TComponent)
private
FResStrs: TStrings;
FCharSet: TFontCharSet;
procedure SetResStrs(Value: TStrings);
procedure Init;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function GetResStr(const ResName: String): String;
published
property ResStrings: TStrings read FResStrs write SetResStrs;
property CharSet: TFontCharSet read FCharSet write FCharSet;
end;
TspSkinColors = class(TObject)
protected
FcBtnFace: TColor;
FcBtnText: TColor;
FcWindow: TColor;
FcWindowText: TColor;
FcHighLight: TColor;
FcHighLightText: TColor;
FcBtnHighLight: TColor;
FcBtnShadow: TColor;
Fc3DLight: TColor;
Fc3DDkShadow: TColor;
public
//
constructor Create;
procedure LoadFromFile(IniFile: TCustomIniFile);
procedure SaveToFile(IniFile: TCustomIniFile);
procedure SetColorsToDefault;
//
property cBtnFace: TColor read FcBtnFace write FcBtnFace;
property cBtnText: TColor read FcBtnText write FcBtnText;
property cBtnHighLight: TColor read FcBtnHighLight write FcBtnHighLight;
property cBtnShadow: TColor read FcBtnShadow write FcBtnShadow;
property cHighLight: TColor read FcHighLight write FcHighLight;
property cHighLightText: TColor read FcHighLightText write FcHighLightText;
property cWindow: TColor read FcWindow write FcWindow;
property cWindowText: TColor read FcWindowText write FcWindowText;
property c3DLight: TColor read Fc3DLight write Fc3DLight;
property c3DDkShadow: TColor read Fc3DDkShadow write Fc3DDkShadow;
end;
TspCompressedSkinList = class;
TspSkinData = class(TComponent)
protected
FCompressedSkinList: TspCompressedSkinList;
FCompressedSkinIndex: Integer;
FSkinnableForm: Boolean;
FEnableSkinEffects: Boolean;
FCompressedStoredSkin: TspCompressedStoredSkin;
FResourceStrData: TspResourceStrData;
FSkinColors: TspSkinColors;
procedure SetSkinnableForm(Value: Boolean);
procedure SetCompressedStoredSkin(Value: TspCompressedStoredSkin);
procedure SetResourceStrData(Value: TspResourceStrData);
procedure Notification(AComponent: TComponent;
Operation: TOperation); override;
procedure WriteFormInfo(F: TCustomIniFile);
procedure ReadFormInfo(F: TCustomIniFile);
procedure WriteAreas(F: TCustomIniFile);
procedure ReadAreas(F: TCustomIniFile);
procedure WriteObjects(F: TCustomIniFile);
procedure ReadObjects(F: TCustomIniFile);
procedure WriteCtrls(F: TCustomIniFile);
procedure ReadCtrls(F: TCustomIniFile);
procedure WriteActivePictures(F: TCustomIniFile);
procedure WriteCursors(F: TCustomIniFile);
procedure ReadActivePictures(F: TCustomIniFile; Path: String);
procedure ReadCursors(F: TCustomIniFile; Path: String);
procedure GetObjectTypeName(S: String; var AName, AType: String);
procedure GetAreaNameRect(S: String; var AName: String; var ARect: TRect);
procedure SetCompressedSkinIndex(Value: Integer);
procedure SetCompressedSkinList(Value: TspCompressedSkinList);
public
//
SizeGripArea: TRect;
StatusBarName: String;
//
ButtonsRect, CaptionRect: TRect;
ButtonsOffset: Integer;
CapButtonsInLeft: Boolean;
//
AutoRenderingInActiveImage: Boolean;
InActiveEffect: TspInActiveEffect;
StartCursorIndex: Integer;
CursorIndex: Integer;
BuildMode: Boolean;
PopupWindow: TspDataSkinPopupWindow;
HintWindow: TspDataSkinHintWindow;
Empty: Boolean;
FPicture, FInActivePicture, FMask: TBitMap;
FRollUpPicture, FRollUpMask: TBitMap;
FActivePictures: TList;
FPictureName, FInActivePictureName, FMaskName: String;
FRollUpPictureName, FRollUpMaskName: String;
FActivePicturesNames: TStrings;
FCursorsNames: TStrings;
ObjectList: TList;
AreaList: TList;
CtrlList: TList;
LTPoint, RTPoint, LBPoint, RBPoint: TPoint;
BGPictureIndex: Integer;
MDIBGPictureIndex: Integer;
MainMenuRect: TRect;
IconRect: TRect;
MainMenuPopupUp: Boolean;
MaskRectArea: TRect;
HitTestLTPoint,
HitTestRTPoint,
HitTestLBPoint,
HitTestRBPoint: TPoint;
ClRect: TRect;
BorderW: Integer;
FormMinWidth: Integer;
MDITabsTransparent: Boolean;
MainMenuBarTransparent: Boolean;
TopStretch, LeftStretch,
RightStretch, BottomStretch: Boolean;
StretchEffect: Boolean;
StretchType: TspStretchType;
MDIBGStretchEffect: Boolean;
MDIBGStretchType: TspStretchType;
RollUpLeftPoint, RollUpRightPoint: TPoint;
SkinName: String;
SkinAuthor: String;
AuthorURL: String;
AuthorEmail: String;
SkinComments: String;
ChangeSkinDataProcess: Boolean;
procedure SaveToCustomIniFile(F: TCustomIniFile);
procedure AddBitMap(FileName: String);
procedure DeleteBitMap(Index: Integer);
procedure AddSkinArea(AName: String; ARect: TRect);
procedure SendSkinDataMessage(M: LongInt);
function GetIndex(AIDName: String): Integer;
function GetControlIndex(AIDName: String): Integer;
function GetAreaIndex(AIDName: String): Integer;
procedure ClearObjects;
procedure ClearAll;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
//
procedure LoadFromFile(FileName: String);
procedure SaveToFile(FileName: String);
procedure LoadFromCompressedFile(FileName: String);
procedure SaveToCompressedFile(FileName: String);
procedure StoreToDisk(APath: String);
//
procedure LoadCompressedStoredSkin(AStoredSkin: TspCompressedStoredSkin);
//
procedure ClearSkin;
property SkinColors: TspSkinColors read FSkinColors;
published
property SkinnableForm: Boolean read FSkinnableForm write SetSkinnableForm;
property EnableSkinEffects: Boolean read
FEnableSkinEffects write FEnableSkinEffects;
property CompressedStoredSkin: TspCompressedStoredSkin
read FCompressedStoredSkin write SetCompressedStoredSkin;
property ResourceStrData: TspResourceStrData
read FResourceStrData write SetResourceStrData;
property SkinList: TspCompressedSkinList
read FCompressedSkinList write SetCompressedSkinList;
property SkinIndex: Integer read
FCompressedSkinIndex write SetCompressedSkinIndex;
end;
TspSkinListItem = class(TCollectionItem)
private
FSkin: TspCompressedStoredSkin;
FDescription: String;
FFileName: String;
FCompressedFileName: String;
FName: string;
protected
procedure ReadData(Stream: TStream);
procedure WriteData(Stream: TStream);
procedure DefineProperties(Filer: TFiler); override;
function GetDisplayName: string; override;
public
constructor Create(Collection: TCollection); override;
destructor Destroy; override;
property Skin: TspCompressedStoredSkin read FSkin;
procedure SetDescription(Value: String);
procedure SetFileName(Value: String);
procedure SetCompressedFileName(Value: String);
published
property Description: String read FDescription write SetDescription;
property FileName: String read FFileName write SetFileName;
property CompressedFileName: String read FCompressedFileName write SetCompressedFileName;
property Name: string read FName write FName;
end;
TspSkinListItems = class(TCollection)
private
function GetItem(Index: Integer): TspSkinListItem;
procedure SetItem(Index: Integer; Value: TspSkinListItem);
protected
function GetOwner: TPersistent; override;
public
FSkinList: TspCompressedSkinList;
constructor Create(ASkinList: TspCompressedSkinList);
property Items[Index: Integer]: TspSkinListItem read GetItem write SetItem; default;
end;
TspCompressedSkinList = class(TComponent)
private
FSkins: TspSkinListItems;
procedure SetSkins(Value: TspSkinListItems);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property Skins: TspSkinListItems read FSkins write SetSkins;
end;
function ReadInActiveEffect(IniFile: TCustomIniFile;
Section: String; Ident: String): TspInActiveEffect;
procedure WriteInActiveEffect(IniFile: TCustomIniFile;
Section: String; Ident: String;
IE: TspInActiveEffect);
function ReadMorphKind(IniFile: TCustomIniFile;
Section: String; Ident: String): TMorphKind;
procedure WriteMorphKind(IniFile: TCustomIniFile;
Section: String; Ident: String; MK: TMorphKind);
// Internal messages
const
WM_BEFORECHANGESKINDATA = WM_USER + 201;
WM_CHANGESKINDATA = WM_USER + 202;
WM_AFTERCHANGESKINDATA = WM_USER + 203;
WM_CHANGERESSTRDATA = WM_USER + 250;
WM_CHECKPARENTBG = WM_USER + 260;
WM_CHANGEFORMSKINNABLE = WM_USER + 270;
procedure WriteStretchType(IniFile: TCustomIniFile;
Section: String; Ident: String; ST: TspStretchType);
function ReadStretchType(IniFile: TCustomIniFile;
Section: String; Ident: String): TspStretchType;
implementation
Uses spZLibCompress;
function CheckSkinFile(F: TCustomIniFile): Boolean;
begin
Result := F.SectionExists('VERSION') and F.SectionExists('PICTURES') and
F.SectionExists('FORMINFO') and F.SectionExists('SKINOBJECTS') and
F.SectionExists('SKINCONTROLS');
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -