suithemes.pas

来自「新颖按钮控件」· PAS 代码 · 共 1,023 行 · 第 1/3 页

PAS
1,023
字号
////////////////////////////////////////////////////////////////////////////////
//
//
//  FileName    :   SUIThemes.pas
//  Creator     :   Shen Min
//  Date        :   2002-08-30
//  Comment     :
//
//  Copyright (c) 2002-2003 Sunisoft
//  http://www.sunisoft.com
//  Email: support@sunisoft.com
//
////////////////////////////////////////////////////////////////////////////////

unit SUIThemes;

interface

uses Graphics, Forms, Controls;

type
    TsuiUIStyle = (
        Custom,
        MacOS,
        WinXP,
        DeepBlue,
        Protein,
        BlueGlass
    );

const
    SUI_THEME_DEFAULT       = DeepBlue;


    function GetSUIFormColor(Form : TCustomForm) : TColor;
    function GetBorderColor(Form : TCustomForm) : TColor;
    function GetSUIFormStyle(Form : TCustomForm) : TsuiUIStyle;

    procedure ContainerApplyUIStyle(Container : TWinControl; UIStyle : TsuiUIStyle);
    procedure SubContainerApplyUIStyle(Container : TWinControl; UIStyle : TsuiUIStyle);


const
    SUI_THEME_INDEX                         = 1;

    // form
    SUI_FORM_BORDER_COLOR                   = 2;
    SUI_FORM_BACKGROUND_COLOR               = 3;

    SUI_FORM_BORDER_WIDTH                   = 4;

    SUI_FORM_MIN_WIDTH                      = 5;
    SUI_FORM_ROUND_CORNER                   = 6;

    // control
    SUI_CONTROL_BORDER_COLOR                = 7;
    SUI_CONTROL_BACKGROUND_COLOR            = 8;
    SUI_CONTROL_FONT_COLOR                  = 9;

    // menu
    SUI_MENU_SELECTED_BORDER_COLOR          = 10;
    SUI_MENU_SELECTED_BACKGROUND_COLOR      = 11;
    SUI_MENU_SELECTED_FONT_COLOR            = 12;
    SUI_MENU_BORDER_COLOR                   = 13;
    SUI_MENU_BACKGROUND_COLOR               = 14;
    SUI_MENU_FONT_COLOR                     = 15;
    SUI_MENU_LEFTBAR_COLOR                  = 16;
    SUI_MENU_LINE_COLOR                     = 17;
    SUI_MENU_SHADOW_COLOR                   = 18;

    SUI_MENU_HEIGHT                         = 19;
    SUI_MENU_LINE_HEIGHT                    = 20;
    SUI_MENU_LEFTBAR_WIDTH                  = 21;

    SUI_MENU_CHECKED_IMAGE                  = 22;

    // button
    SUI_BUTTON_NORMAL_IMAGE                 = 23;
    SUI_BUTTON_MOUSEON_IMAGE                = 24;
    SUI_BUTTON_MOUSEDOWN_IMAGE              = 25;

    // checkbox
    SUI_CHECKBOX_DISABLE_CHECKED_IMAGE      = 26;
    SUI_CHECKBOX_DISABLE_UNCHECK_IMAGE      = 27;
    SUI_CHECKBOX_NORMAL_CHECKED_IMAGE       = 28;
    SUI_CHECKBOX_NORMAL_UNCHECK_IMAGE       = 29;
    SUI_CHECKBOX_MOUSEON_CHECKED_IMAGE      = 30;
    SUI_CHECKBOX_MOUSEON_UNCHECK_IMAGE      = 31;
    SUI_CHECKBOX_MOUSEDOWN_CHECKED_IMAGE    = 32;
    SUI_CHECKBOX_MOUSEDOWN_UNCHECK_IMAGE    = 33;

    // radiobutton
    SUI_RADIOBUTTON_DISABLE_CHECKED_IMAGE   = 34;
    SUI_RADIOBUTTON_DISABLE_UNCHECK_IMAGE   = 35;
    SUI_RADIOBUTTON_NORMAL_CHECKED_IMAGE    = 36;
    SUI_RADIOBUTTON_NORMAL_UNCHECK_IMAGE    = 37;
    SUI_RADIOBUTTON_MOUSEON_CHECKED_IMAGE   = 38;
    SUI_RADIOBUTTON_MOUSEON_UNCHECK_IMAGE   = 39;
    SUI_RADIOBUTTON_MOUSEDOWN_CHECKED_IMAGE = 40;
    SUI_RADIOBUTTON_MOUSEDOWN_UNCHECK_IMAGE = 41;

    // progressbar
    SUI_PROGRESSBAR_IMAGE                   = 42;
    SUI_PROGRESSBAR_V_IMAGE                 = 43;

    // titlebar
    SUI_TITLEBAR_LEFT_IMAGE                 = 44;
    SUI_TITLEBAR_CLIENT_IMAGE               = 45;
    SUI_TITLEBAR_RIGHT_IMAGE                = 46;

    // titlebar button close
    SUI_TITLEBUTTON_CLOSE_NORMAL_IMAGE      = 47;
    SUI_TITLEBUTTON_CLOSE_MOUSEON_IMAGE     = 48;
    SUI_TITLEBUTTON_CLOSE_MOUSEDOWN_IMAGE   = 49;

    // titlebar button max
    SUI_TITLEBUTTON_MAX_NORMAL_IMAGE        = 50;
    SUI_TITLEBUTTON_MAX_MOUSEON_IMAGE       = 51;
    SUI_TITLEBUTTON_MAX_MOUSEDOWN_IMAGE     = 52;

    // titlebar button min
    SUI_TITLEBUTTON_MIN_NORMAL_IMAGE        = 53;
    SUI_TITLEBUTTON_MIN_MOUSEON_IMAGE       = 54;
    SUI_TITLEBUTTON_MIN_MOUSEDOWN_IMAGE     = 55;

    // titlebar button help
    SUI_TITLEBUTTON_HELP_NORMAL_IMAGE       = 56;
    SUI_TITLEBUTTON_HELP_MOUSEON_IMAGE      = 57;
    SUI_TITLEBUTTON_HELP_MOUSEDOWN_IMAGE    = 58;

    // titlebar button controlbox
    SUI_TITLEBUTTON_CTLBOX_NORMAL_IMAGE     = 59;
    SUI_TITLEBUTTON_CTLBOX_MOUSEON_IMAGE    = 60;
    SUI_TITLEBUTTON_CTLBOX_MOUSEDOWN_IMAGE  = 61;

    // titlebar button restore
    SUI_TITLEBUTTON_RST_NORMAL_IMAGE        = 62;
    SUI_TITLEBUTTON_RST_MOUSEON_IMAGE       = 63;
    SUI_TITLEBUTTON_RST_MOUSEDOWN_IMAGE     = 64;

    // titlebar button transparent
    SUI_TITLEBUTTON_TRANSPARENT_BOOL        = 65;

    // titlebar button position
    SUI_TITLEBUTTON_LEFTXOFFSET             = 66;
    SUI_TITLEBUTTON_RIGHTXOFFSET            = 67;
    SUI_TITLEBUTTON_TOP                     = 68;

    // tab control
    SUI_TAB_ACTIVE_IMAGE                    = 69;
    SUI_TAB_INACTIVE_IMAGE                  = 70;
    SUI_TAB_LINE_IMAGE                      = 71;

    SUI_TAB_TOP_HEIGHT                      = 72;

    // combobox
    SUI_COMBOBOX_BUTTON_COLOR               = 73;

    // trackbar
    SUI_TRACKBAR_BAR                        = 74;
    SUI_TRACKBAR_SLIDER                     = 75;
    SUI_TRACKBAR_BAR_V                      = 76;
    SUI_TRACKBAR_SLIDER_V                   = 77;
    SUI_TRACKBAR_BGCOLOR                    = 78;

    // toolbar
    SUI_TOOLBAR_BUTTON_BORDER_COLOR         = 79;
    SUI_TOOLBAR_BUTTON_COLOR                = 80;
    SUI_TOOLBAR_BUTTON_DOWN_COLOR           = 81;
    SUI_TOOLBAR_COLOR                       = 82;


type
    TsuiType = (
        Int,
        Color,
        Str,
        Bool
    );


    function GetThemeElement(
        UIStyle : TsuiUIStyle;
        Element : Integer;
        var ReturnType : TsuiType
    ) : Integer;

    function GetThemeString(
        UIStyle : TsuiUIStyle;
        Element : Integer
    ) : String;

    function GetThemeInt(
        UIStyle : TsuiUIStyle;
        Element : Integer
    ) : Integer;

    function GetThemeBool(
        UIStyle : TsuiUIStyle;
        Element : Integer
    ) : Boolean;

    function GetThemeColor(
        UIStyle : TsuiUIStyle;
        Element : Integer
    ) : TColor;


implementation

uses SUIPublic, SUIForm, SUIProgressBar, SUIMemo, SUIEdit, SUIGroupBox,
     SUIListBox, SUIButton, SUISideChannel, SUIImagePanel,  SUICheckListBox,
     SUIRadioGroup, SUIComboBox, SUIListView, SUITreeView, SUITabControl,
     SUITrackBar, SUIToolBar, SUIPageControl;

const
    SUI_THEME_ELEMENT_COUNT     = 82;


type
    TsuiThemeElement = record
        case Integer of
            0: (Int : Integer);
            1: (Color : TColor);
            2: (Str : PChar);
            3: (Bool : Boolean);
    end;

    TsuiTheme = array [1 .. SUI_THEME_ELEMENT_COUNT] of TsuiThemeElement;
    PTsuiTheme = ^TsuiTheme;

    TsuiThemeElementType = array [1 .. SUI_THEME_ELEMENT_COUNT] of TsuiType;

const
    MacOSTheme : TsuiTheme = (
        (Int : 1), // Index
        (Color : $007F7F7F), // form border
        (Color : $00E7E7E7), // form background
        (Int : 1), // form border width
        (Int : 130), // form min width
        (Int : 0), // form round corner
        (Color : $007F7F7F), // control border
        (Color : $00E7E7E7), // control background
        (Color : clBlack), // control font
        (Color : 0), // menu selected border
        (Color : 0), // menu selected background
        (Color : clWhite), // menu selected font
        (Color : 0), // menu border
        (Color : 0), // menu background
        (Color : clBlack), // menu font
        (Color : 0), // menu left bar
        (Color : 0), // menu line color
        (Color : 0), // menu shadow color
        (Int : 20), // menu height
        (Int : 12), // menu line height
        (Int : 26), // left bar width
        (Str : 'MENU_CHECKED'), // menu check
        (Str : 'MACOS_BUTTON_NORMAL'), // button normal
        (Str : 'MACOS_BUTTON_MOUSEON'), // button mouseon
        (Str : 'MACOS_BUTTON_MOUSEDOWN'), // button mousedown
        (Str : 'MACOS_CHECKBOX_DISABLE_CHECK'), // checkbox disable check
        (Str : 'MACOS_CHECKBOX_DISABLE_UNCHECK'), // checkbox disable uncheck
        (Str : 'MACOS_CHECKBOX_CHECK'), // checkbox normal check
        (Str : 'MACOS_CHECKBOX_UNCHECK'), // checkbox normal uncheck
        (Str : 'MACOS_CHECKBOX_CHECK'), // checkbox mouseon check
        (Str : 'MACOS_CHECKBOX_UNCHECK'), // checkbox mouseon uncheck
        (Str : 'MACOS_CHECKBOX_CHECK'), // checkbox mousedown check
        (Str : 'MACOS_CHECKBOX_UNCHECK'), // checkbox mousedown uncheck
        (Str : 'MACOS_RADIOBUTTON_DISABLE_CHECK'), // radiobutton disable check
        (Str : 'MACOS_RADIOBUTTON_DISABLE_UNCHECK'), // radiobutton disable uncheck
        (Str : 'MACOS_RADIOBUTTON_CHECK'), // radiobutton normal check
        (Str : 'MACOS_RADIOBUTTON_UNCHECK'), // radiobutton normal uncheck
        (Str : 'MACOS_RADIOBUTTON_CHECK'), // radiobutton mouseon check
        (Str : 'MACOS_RADIOBUTTON_UNCHECK'), // radiobutton mouseon uncheck
        (Str : 'MACOS_RADIOBUTTON_CHECK'), // radiobutton mousedown check
        (Str : 'MACOS_RADIOBUTTON_UNCHECK'), // radiobutton mousedown uncheck
        (Str : 'MACOS_PROGRESSBAR'), // progressbar
        (Str : 'MACOS_PROGRESSBAR_V'), // progressbar v
        (Str : 'MACOS_TITLE_LEFT'), // titlebar left
        (Str : 'MACOS_TITLE_CLIENT'), // titlebar client
        (Str : 'MACOS_TITLE_RIGHT'), // titlebar right
        (Str : 'MACOS_TITLEBTN_CLOSE_NORMAL'), // titlebutton close normal
        (Str : 'MACOS_TITLEBTN_CLOSE_MOUSEON'), // titlebutton close mouseon
        (Str : 'MACOS_TITLEBTN_CLOSE_MOUSEDOWN'), // titlebutton close mousedown
        (Str : 'MACOS_TITLEBTN_MAX_NORMAL'), // titlebutton max normal
        (Str : 'MACOS_TITLEBTN_MAX_MOUSEON'), // titlebutton max mouseon
        (Str : 'MACOS_TITLEBTN_MAX_MOUSEDOWN'), // titlebutton max mousedown
        (Str : 'MACOS_TITLEBTN_MIN_NORMAL'), // titlebutton min normal
        (Str : 'MACOS_TITLEBTN_MIN_MOUSEON'), // titlebutton min mouseon
        (Str : 'MACOS_TITLEBTN_MIN_MOUSEDOWN'), // titlebutton min mousedown
        (Str : 'MACOS_TITLEBTN_HELP_NORMAL'), // titlebutton help normal
        (Str : 'MACOS_TITLEBTN_HELP_MOUSEON'), // titlebutton help mouseon
        (Str : 'MACOS_TITLEBTN_HELP_MOUSEDOWN'), // titlebutton help mousedown
        (Str : 'MACOS_TITLEBTN_CTLBOX_NORMAL'), // titlebutton controlbox normal
        (Str : 'MACOS_TITLEBTN_CTLBOX_MOUSEON'), // titlebutton controlbox mouseon
        (Str : 'MACOS_TITLEBTN_CTLBOX_MOUSEDOWN'), // titlebutton controlbox mousedown
        (Str : 'MACOS_TITLEBTN_MAX_NORMAL'), // titlebutton restore normal
        (Str : 'MACOS_TITLEBTN_MAX_MOUSEON'), // titlebutton restore mouseon
        (Str : 'MACOS_TITLEBTN_MAX_MOUSEDOWN'), // titlebutton restore mousedown
        (Bool : false), // titlebutton transparent
        (Int : 3), // titlebutton left x offset
        (int : -2), // titlebutton right x offset
        (Int : 4), // titlebutton top
        (Str : 'MACOS_TAB_ACTIVE'), // tabcontrol active
        (Str : 'MACOS_TAB_INACTIVE'), // tabcontrol inactive
        (Str : 'MACOS_TAB_LINE'), // tabcontrol line
        (Int : 34), // tabcontrol toppanel height
        (Color : $00E7E7E7), //combobox button color
        (Str : 'MACOS_TRACKBAR_BAR'), // trackbar bar
        (Str : 'MACOS_TRACKBAR_SLIDER'), // trackbar slider normal
        (Str : 'MACOS_TRACKBAR_BAR'), // trackbar slider mouseon
        (Str : 'MACOS_TRACKBAR_SLIDER_V'), // trackbar slider mousedown
        (Color : $00EEEEEE), // trackbar color
        (Color : $00474747), // toolbar button border
        (Color : $00EFEFEF), // toolbar button color
        (Color : $00D8D8D8), // toolbar button down color
        (Color : $00E7E7E7) // toolbar color
    );

    WinXPTheme : TsuiTheme = (
        (Int : 2), // Index
        (Color : $00C82C00), // form border
        (Color : $00DEEBEF), // form background
        (Int : 3), // form border width
        (Int : 150), // form min width
        (Int : 13), // form round corner
        (Color : $00686868), // control border
        (Color : $00DEEBEF), // control background
        (Color : $00CF4602), // control font
        (Color : $00C66931), // menu selected border
        (Color : $00EFD3C6), // menu selected background
        (Color : clBlack), // menu selected font
        (Color : 0), // menu border
        (Color : clWhite), // menu background
        (Color : clBlack), // menu font
        (Color : $00CED3D6), // menu left bar
        (Color : $00848284), // menu line color
        (Color : $009CA6AD), // menu shadow color
        (Int : 21), // menu height
        (Int : 5), // menu line height
        (Int : 26), // left bar width

⌨️ 快捷键说明

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