= SharpThemeAPI Library = ---- The global library for getting informations about the currently loaded theme is ''Sharpthemeapi.dll''[[BR]] To use SharpThemeAPI in any project just include the ''SharpThemeAPI.pas'' header file in your project DLL header file: [http://svn.sourceforge.net/viewvc/sharpe/Common/Libraries/SharpThemeApi/SharpThemeApi.pas?view=markup svn\common\libraries\SharpThemeApi\SharpThemeApi.pas] The SharpThemeAPI.dll library will load the current theme informations into a record stored in the memory of the dll. This means that if an application like SharpBar is using SharpThemeAPI.dll then all other dll files (modules, ...) which are used by this application are using the same instance of this dll file. So if the theme changes the host application (example: SharpBar) will reload the theme using SharpThemeAPI.dll and all modules will receive the updated theme informations the next time the Sharpthemeapi.dll file is used because host application(SharpBar) and all other dlls(Modules) are sharing the same SharpThemeAPI.dll. Keep this in mind to reduce unnecessary reloading of the theme data.[[BR]] The data record of SharpThemeAPI can not be access directly. To access the theme informations several data gathering functions are exported by the dll.[[BR]] For applications like SharpBar or SharpDesk it should be safe to assume that the theme data for any module/object/plugin is always kept up to date by the host application. This means that it should not be necessary to reload the theme out of any module/object/plugin.[[BR]] [[BR]] == Initializing and Loading a Theme == When using Sharpthemeapi for the first time it's important that the data record of the dll is properly initialized. So make sure to check the ''initialized'' property of the dll before loading a theme for the first time. {{{ #!text/x-pascal if not SharpThemeApi.Initialized then SharpThemeApi.InitializeTheme; }}} After this has been done one time in a project (most likely at startup) the [wiki:DevFunctionsThemeApiLoadTheme LoadTheme] functions can be used.[[BR]] Loading a theme can be done in different ways:[[BR]] {{{ #!text/x-pascal function LoadTheme(pName: PChar; ForceReload: Boolean = False; ThemeParts : TThemeParts = ALL_THEME_PARTS) : boolean; function LoadTheme(ForceReload: Boolean = False; ThemeParts : TThemeParts = ALL_THEME_PARTS) : boolean; }}} If no ''Name'' parameter is specified the current theme will loaded (updated).[[BR]] The ''Forcereload'' parameter can be used to ignore the reload block of the dll (it is only possible to reload the theme settings one time in a second).[[BR]] By using the ''Themeparts'' parameter it is possible to specify which parts of the theme will be loaded. The ALL_THEME_PARTS paramter means that the complete theme is going to be loaded. However if you only need certain informations of theme like then make sure to leave those theme parts out which you do not need. The ''Themeparts'' parameter can be a set of: '''tpSkin,tpScheme,tpInfo,tpIconSet,tpDesktopIcon,tpDesktopAnimation'''.[[BR]] Example calls: {{{ #!text/x-pascal LoadTheme(); // Reload the current Theme, no ForceReload, load ALL_THEME_PARTS LoadTheme(False,[tpSkin,tpScheme]); // Reload the current Theme, no ForceReload, load/update only the Skin and Scheme settings }}} [[BR]] == Exported Functions[[BR]] == [[BR]] '''Global Data''' {{{ #!text/x-pascal function GetCurrentSharpEThemeName : PChar; }}} [[BR]] '''Theme Informations''' {{{ #!text/x-pascal function GetThemeName: PChar; function GetThemeAuthor: PChar; function GetThemeComment: PChar; function GetThemeWebsite: PChar; function GetThemeDirectory: PChar; function GetThemeDirectory(pName : PChar): PChar; }}} [[BR]] '''Color Scheme'''[[BR]] The scheme color functions can be used to access the current theme color settings[[BR]] There are two different function types. The data gathering functions are used to just return the scheme data. Therefore two new records are defined for those functions.[[BR]] {{{ #!text/x-pascal TSharpESkinColor = record Name: string; Tag: string; Info: string; Color: integer; end; TSharpEColorSet = array of TSharpESkinColor; function GetSchemeColorSet(pSet : integer) : TSharpEColorSet; function GetSchemeName : PChar; function GetSchemeColorCount: Integer; function GetSchemeColorByIndex(pIndex: integer): TSharpESkinColor; function GetSchemeColorIndexByTag(pTag: string): Integer; function GetSchemeColorByTag(pTag: string): TSharpESkinColor; function GetSchemeDirectory : PChar; }}} There are also some tool functions exported to make using the color schemes easier.[[BR]] The SchemeCodeToColor and ColorToSchemeCode functions can be used to convert any integer color to a color code which can be saved to xml. Those functions are comparing the given color to all current scheme colors and if the color is indeed a scheme color then it will be converted to a negative index value.[[BR]] The ParseColor function can be used to parse any color string into the color integer value. Color strings can be ''RGB(128,64,0)'' for example.[[BR]] {{{ #!text/x-pascal function ColorToSchemeCode(pColor : integer) : integer; function SchemeCodeToColor(pCode : integer) : integer; function ParseColor(AColorStr:PChar):Integer; }}} [[BR]] '''Skin Data''' {{{ #!text/x-pascal function GetSkinName : PChar; function GetSkinColorCount : integer function GetSkinColor(pIndex : integer) : TSharpESkinColor; function GetSkinDirectory : PChar; function GetSkinGEBlurRadius : integer; // glass effect params function GetSkinGEBlurIterations : integer; function GetSkinGEBlend : boolean; function GetSkinGEBlendColor : integer; function GetSkinGEBlendAlpha : integer; function GetSkinGELighten : boolean; function GetSkinGELightenAmount : integer; }}} [[BR]] '''Icon Set''' {{{ #!text/x-pascal TSharpEIcon = record FileName: string; Tag: string; end; function GetIconSetName : PChar; function GetIconSetAuthor : PChar; function GetIconSetWebsite : PChar; function GetIconSetDirectory : PChar; function GetIconSetIconsCount : integer; function GetIconSetIcon(pIndex : integer) : TSharpEIcon; function GetIconSetIcon(pTag : PChar) : TSharpEIcon; function IsIconInIconSet(pTag : PChar) : boolean; }}} [[BR]] '''Desktop Icon Settings''' {{{ #!text/x-pascal function GetDesktopIconSize : integer; function GetDesktopIconAlphaBlend : boolean; function GetDesktopIconAlpha : integer; function GetDesktopIconBlending : boolean; function GetDesktopIconBlendColor : integer; function GetDesktopIconBlendAlpha : integer; function GetDesktopIconShadow : boolean; function GetDesktopIconShadowColor : integer; function GetDesktopIconShadowAlpha : integer; function GetDesktopFontName : PChar; function GetDesktopDisplayText : boolean; function GetDesktopTextSize : integer; function GetDesktopTextBold : boolean; function GetDesktopTextItalic : boolean; function GetDesktopTextUnderline : boolean; function GetDesktopTextColor : integer; function GetDesktopTextAlpha : boolean; function GetDesktopTextAlphaValue : integer; function GetDesktopTextShadow : boolean; function GetDesktopTextShadowAlpha : integer; function GetDesktopTextShadowColor : integer; function GetDesktopTextShadowType : integer; function GetDesktopTextShadowSize : integer; }}} [[BR]] '''Desktop Animation Settings''' {{{ #!text/x-pascal function GetDesktopAnimUseAnimations : boolean; function GetDesktopAnimScale : boolean; function GetDesktopAnimScaleValue : integer; function GetDesktopAnimAlpha : boolean; function GetDesktopAnimAlphaValue : integer; function GetDesktopAnimBlend : boolean; function GetDesktopAnimBlendValue : integer; function GetDesktopAnimBlendColor : integer; function GetDesktopAnimBrightness : boolean; function GetDesktopAnimBrightnessValue : integer; }}}