📄 suithemes.pas
字号:
(Int : 130),
(Int : 0),
(Color : $00E8E8E8),
(Color : clBlack),
(Int : 1),
(Color : $00A04A44),
(Color : $00A04A44),
(Color : clWhite),
(Color : clWhite),
(Color : clBlack),
(Color : $00CED3D6),
(Str : 'DEEPBLUE_PROGRESSBAR'),
(Color : clBlack),
(Color : $00E8E8E8),
(Color : clBlack),
(Str : 'DEEPBLUE_TRACKBAR_BAR'),
(Str : 'DEEPBLUE_TRACKBAR_SLIDER'),
(Str : 'DEEPBLUE_TRACKBAR_SLIDER_V'),
(Color : $00F5F5F5),
(Str : 'DEEPBLUE_SCROLLBAR_BUTTON'),
(Str : 'DEEPBLUE_SCROLLBAR_TRACK'),
(Str : 'DEEPBLUE_CHECKLIST'),
(Color : $00474747),
(Color : $00EFEFEF),
(Color : $00D8D8D8),
(Str : 'MORE_SCROLLBUTTON'),
(Str : 'DEEPBLUE_TAB'),
(Str : 'DEEPBLUE_TAB_LINE'),
(Str : 'DEEPBLUE_SIDECHENNEL_HANDLE'),
(Str : 'DEEPBLUE_SIDECHENNEL_BAR'),
(Str : ''),
(Color : clWhite),
(Str : ''),
(Str : ''),
(Int : 0),
(Color : $00E8E8E8)
);
SUI_PROTEIN_THEME : TsuiThemeDef = (
(Str : 'PROTEIN_BUTTON'),
(Bool : false),
(Str : 'PROTEIN_CHECKBOX'),
(Str : 'PROTEIN_RADIOBUTTON'),
(Str : 'PROTEIN_TITLEBTN'),
(Bool : true),
(Int : 0),
(Int : 0),
(Int : 2),
(Str : 'PROTEIN_TITLE_LEFT'),
(Str : 'PROTEIN_TITLE_CLIENT'),
(Str : 'PROTEIN_TITLE_RIGHT'),
(Int : 130),
(Int : 0),
(Color : $00FBFBFB),
(Color : clBlack),
(Int : 1),
(Color : $00C4302D),
(Color : $00C4302D),
(Color : clWhite),
(Color : clWhite),
(Color : clBlack),
(Color : $00CED3D6),
(Str : 'PROTEIN_PROGRESSBAR'),
(Color : clBlack),
(Color : $00FBFBFB),
(Color : clBlack),
(Str : 'PROTEIN_TRACKBAR_BAR'),
(Str : 'PROTEIN_TRACKBAR_SLIDER'),
(Str : 'PROTEIN_TRACKBAR_SLIDER_V'),
(Color : $00F5F5F5),
(Str : 'PROTEIN_SCROLLBAR_BUTTON'),
(Str : 'PROTEIN_SCROLLBAR_TRACK'),
(Str : 'PROTEIN_CHECKLIST'),
(Color : $00474747),
(Color : $00EFEFEF),
(Color : $00D8D8D8),
(Str : 'MORE_SCROLLBUTTON'),
(Str : 'PROTEIN_TAB'),
(Str : 'PROTEIN_TAB_LINE'),
(Str : 'PROTEIN_SIDECHENNEL_HANDLE'),
(Str : 'PROTEIN_SIDECHENNEL_BAR'),
(Str : ''),
(Color : clWhite),
(Str : ''),
(Str : ''),
(Int : 0),
(Color : $00FBFBFB)
);
SUI_BLUEGLASS_THEME : TsuiThemeDef = (
(Str : 'BLUEGLASS_BUTTON'),
(Bool : true),
(Str : 'BLUEGLASS_CHECKBOX'),
(Str : 'BLUEGLASS_RADIOBUTTON'),
(Str : 'BLUEGLASS_TITLEBTN'),
(Bool : true),
(Int : 4),
(Int : -3),
(Int : 6),
(Str : 'BLUEGLASS_TITLE_LEFT'),
(Str : 'BLUEGLASS_TITLE_CLIENT'),
(Str : 'BLUEGLASS_TITLE_RIGHT'),
(Int : 270),
(Int : 11),
(Color : $00E7E7E7),
(Color : clBlack),
(Int : 1),
(Color : $00EC5E5E),
(Color : $00EC5E5E),
(Color : clWhite),
(Color : $00E7E7E7),
(Color : clBlack),
(Color : $00CED3D6),
(Str : 'BLUEGLASS_PROGRESSBAR'),
(Color : clBlack),
(Color : $00E7E7E7),
(Color : clBlack),
(Str : 'BLUEGLASS_TRACKBAR_BAR'),
(Str : 'BLUEGLASS_TRACKBAR_SLIDER'),
(Str : 'BLUEGLASS_TRACKBAR_SLIDER_V'),
(Color : $00F4F4F4),
(Str : 'BLUEGLASS_SCROLLBAR_BUTTON'),
(Str : 'BLUEGLASS_SCROLLBAR_TRACK'),
(Str : 'BLUEGLASS_CHECKLIST'),
(Color : $00474747),
(Color : $00EFEFEF),
(Color : $00D8D8D8),
(Str : 'MORE_SCROLLBUTTON'),
(Str : 'BLUEGLASS_TAB'),
(Str : 'BLUEGLASS_TAB_LINE'),
(Str : 'BLUEGLASS_SIDECHENNEL_HANDLE'),
(Str : 'BLUEGLASS_SIDECHENNEL_BAR'),
(Str : ''),
(Color : clWhite),
(Str : ''),
(Str : ''),
(Int : 0),
(Color : $00E7E7E7)
);
function GetSUIFormStyle(Owner : TComponent) : TsuiUIStyle;
var
i : Integer;
Form : TCustomForm;
begin
Result := SUI_THEME_DEFAULT;
if Owner = nil then
Exit;
if not (Owner is TCustomForm) then
Exit;
Form := Owner as TCustomForm;
for i := 0 to Form.ControlCount - 1 do
begin
if Form.Controls[i] is TsuiForm then
begin
Result := (Form.Controls[i] as TsuiForm).UIStyle;
break;
end;
end;
end;
// ----------- ThemeMgr ---------------
function GetInsideThemeItem(Theme : TsuiUIStyle; Index : Integer; var ReturnType : TsuiType) : Integer;
var
pTheme : PTsuiThemeDef;
begin
case Theme of
{$IFDEF RES_MACOS}
MacOS : pTheme := @SUI_MACOS_THEME;
{$ENDIF}
{$IFDEF RES_WINXP}
WinXP : pTheme := @SUI_WINXP_THEME;
{$ENDIF}
{$IFDEF RES_DEEPBLUE}
DeepBlue : pTheme := @SUI_DEEPBLUE_THEME;
{$ENDIF}
{$IFDEF RES_PROTEIN}
Protein : pTheme := @SUI_PROTEIN_THEME;
{$ENDIF}
{$IFDEF RES_BLUEGLASS}
BlueGlass : pTheme := @SUI_BLUEGLASS_THEME;
{$ENDIF}
else
begin
ReturnType := Int;
Result := -1;
Exit;
end;
end; // case
ReturnType := SUI_ITEM_TYPE[Index];
Result := Integer(pTheme^[Index]);
end;
procedure GetInsideThemeBitmap(Theme : TsuiUIStyle; const Index : Integer; const Buf : TBitmap; SpitCount : Integer = 0; SpitIndex : Integer = 0);
procedure InternalGetInsideThemeBitmap(Theme : TsuiUIStyle; const Index: Integer; const Buf: TBitmap);
var
ReturnType : TsuiType;
nResult : Integer;
begin
if Buf = nil then
Exit;
nResult := GetInsideThemeItem(Theme, Index, ReturnType);
if ReturnType = Str then
Buf.LoadFromResourceName(hInstance,PCharToStr(PChar(nResult)));
end;
var
TempBmp : TBitmap;
begin
if Buf = nil then
Exit;
if SpitCount = 0 then
begin
InternalGetInsideThemeBitmap(Theme, Index, Buf);
Exit;
end;
TempBmp := TBitmap.Create();
InternalGetInsideThemeBitmap(Theme, Index, TempBmp);
SpitBitmap(TempBmp, Buf, SpitCount, SpitIndex);
TempBmp.Free();
end;
function GetInsideThemeBool(Theme : TsuiUIStyle; const Index: Integer): Boolean;
var
ReturnType : TsuiType;
nResult : Integer;
begin
Result := false;
nResult := GetInsideThemeItem(Theme, Index, ReturnType);
if ReturnType = Bool then
Result := Boolean(nResult);
end;
function GetInsideThemeColor(Theme : TsuiUIStyle; const Index: Integer): TColor;
var
ReturnType : TsuiType;
nResult : Integer;
begin
Result := clBlack;
nResult := GetInsideThemeItem(Theme, Index, ReturnType);
if ReturnType = Color then
Result := nResult;
end;
function GetInsideThemeInt(Theme : TsuiUIStyle; const Index: Integer): Integer;
var
ReturnType : TsuiType;
nResult : Integer;
begin
Result := -1;
nResult := GetInsideThemeItem(Theme, Index, ReturnType);
if ReturnType = Int then
Result := nResult
end;
{ TsuiFileThemeMgr }
constructor TsuiFileThemeMgr.Create;
begin
m_FileReader := nil;
end;
destructor TsuiFileThemeMgr.Destroy;
begin
if m_FileReader <> nil then
begin
m_FileReader.Free();
m_FileReader := nil;
end;
end;
function TsuiFileThemeMgr.LoadFromFile(FileName, Password: String) : Boolean;
begin
Result := false;
if not FileExists(FileName) then
Exit;
if m_FileReader <> nil then
begin
m_FileReader.Free();
m_FileReader := nil;
end;
try
m_FileReader := Tsk2SkinFileReader.Create(FileName, Password);
Result := m_FileReader.Ready;
if not Result then
begin
m_FileReader.Free();
m_FileReader := nil;
end;
except
m_FileReader := nil;
end;
end;
function TsuiFileThemeMgr.GetBitmap(const Index: Tsk2SkinBitmapElement): TBitmap;
begin
Result := nil;
if m_FileReader = nil then
Exit;
Result := m_FileReader.GetBitmap(SKIN2_SKINFILE_KEYNAME[Ord(Index) + SKIN2_BITMAPELEMENT_OFFSET]);
end;
function TsuiFileThemeMgr.GetBool(const Index: Tsk2BoolElement): Boolean;
begin
Result := false;
if m_FileReader = nil then
Exit;
Result := m_FileReader.GetBool(SKIN2_SKINFILE_KEYNAME[Ord(Index) + SKIN2_BOOLELEMENT_OFFSET]);
end;
function TsuiFileThemeMgr.GetColor(const Index: Tsk2SkinColorElement): TColor;
begin
Result := clBlack;
if m_FileReader = nil then
Exit;
Result := m_FileReader.GetInteger(SKIN2_SKINFILE_KEYNAME[ord(Index) + SKIN2_COLORELEMENT_OFFSET]);
end;
function TsuiFileThemeMgr.GetInt(const Index: Tsk2IntElement): Integer;
begin
Result := 0;
if m_FileReader = nil then
Exit;
Result := m_FileReader.GetInteger(SKIN2_SKINFILE_KEYNAME[Ord(Index) + SKIN2_INTELEMENT_OFFSET]);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -