⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 suithemes.pas

📁 suipack ver5控件 suipack ver5控件 suipack ver5控件 suipack ver5控件 suipack ver5控件
💻 PAS
📖 第 1 页 / 共 2 页
字号:
        (Color : $00C66931),
        (Color : $00EFD3C6),
        (Color : $00E1AC93),
        (Str : 'WINXP_SCROLLBUTTON'),
        (Str : 'WINXP_TAB'),
        (Str : 'WINXP_TAB_LINE'),
        (Str : 'WINXP_SIDECHENNEL_HANDLE'),
        (Str : 'WINXP_SIDECHENNEL_BAR'),
        (Str : ''),
        (Color : clWhite),
        (Str : ''),
        (Str : ''),
        (Int : 0),
        (Color : $00DEEBEF)        
    );

    SUI_DEEPBLUE_THEME : TsuiThemeDef = (
        (Str : 'DEEPBLUE_BUTTON'),
        (Bool : false),
        (Str : 'DEEPBLUE_CHECKBOX'),
        (Str : 'DEEPBLUE_RADIOBUTTON'),
        (Str : 'DEEPBLUE_TITLEBTN'),
        (Bool : false),
        (Int : 0),
        (Int : 0),
        (Int : 2),
        (Str : 'DEEPBLUE_TITLE_LEFT'),
        (Str : 'DEEPBLUE_TITLE_CLIENT'),
        (Str : 'DEEPBLUE_TITLE_RIGHT'),
        (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: String) : Boolean;
begin
    Result := false;
    if not FileExists(FileName) then
        Exit;
    if m_FileReader <> nil then
    begin
        m_FileReader.Free();
        m_FileReader := nil;
    end;

    m_FileReader := TsuiThemeFileReader.Create(FileName);
    Result := true;
end;

procedure TsuiFileThemeMgr.GetBitmap(const Index: Integer;
  const Buf: TBitmap);
var
    St : TStream;
begin
    if m_FileReader = nil then
        Exit;
    St := m_FileReader.GetFile(SUI_FILETHEME_ITEMNAME[Index]);
    if St <> nil then
        Buf.LoadFromStream(St);
end;

function TsuiFileThemeMgr.GetBool(const Index: Integer): Boolean;
begin
    Result := false;
    if m_FileReader = nil then
        Exit;
    Result := m_FileReader.GetBool(SUI_FILETHEME_ITEMNAME[Index]);
end;

function TsuiFileThemeMgr.GetColor(const Index: Integer): TColor;
begin
    Result := clBlack;
    if m_FileReader = nil then
        Exit;
    Result := m_FileReader.GetInteger(SUI_FILETHEME_ITEMNAME[Index]);
end;

function TsuiFileThemeMgr.GetInt(const Index: Integer): Integer;
begin
    Result := 0;
    if m_FileReader = nil then
        Exit;
    Result := m_FileReader.GetInteger(SUI_FILETHEME_ITEMNAME[Index]);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -