Skip to content

Commit

Permalink
Merge pull request #257 from Virtual-TreeView/master
Browse files Browse the repository at this point in the history
Narrowing down scopes to apply a scaling and reduce dependencies
  • Loading branch information
RRUZ committed Oct 9, 2019
2 parents 5a518cf + 686fc2c commit e4828aa
Show file tree
Hide file tree
Showing 4 changed files with 3,590 additions and 3,592 deletions.
33 changes: 33 additions & 0 deletions Common/VCL.Styles.Utils.inc
Expand Up @@ -23,3 +23,36 @@
{$DEFINE HOOK_UXTHEME}
{$DEFINE HOOK_TDateTimePicker}
{$DEFINE HOOK_TProgressBar}
{.$DEFINE LimitStylesToCurrentProcess}

{ Feature toggles for supported UxThemes - see Vcl.Styles.UxTheme }

{$DEFINE HOOK_Button}
{$DEFINE HOOK_AllButtons}
{$DEFINE HOOK_Scrollbar}
{$DEFINE HOOK_TaskDialog}
{$DEFINE HOOK_ProgressBar}
{$DEFINE HOOK_DateTimePicker}
{$DEFINE HOOK_TreeView}
{$DEFINE HOOK_ListView}
{$DEFINE HOOK_ListBox}
{$DEFINE HOOK_ComboBox}

{$DEFINE HOOK_Spin}
{$DEFINE HOOK_EDIT}
{$DEFINE HOOK_Rebar}
{$DEFINE HOOK_ToolBar}
{$DEFINE HOOK_Menu}
{$DEFINE HOOK_TrackBar}
{$DEFINE HOOK_ToolTip}
{$DEFINE HOOK_Tab}
// Introduced in Windows Vista
{$DEFINE HOOK_CommandModule}
{$DEFINE HOOK_SearchBox}
{$DEFINE HOOK_AddressBand}
{$DEFINE HOOK_PreviewPane}
{$DEFINE HOOK_TRYHARDER}
{$DEFINE HOOK_BREADCRUMBAR}
{$DEFINE HOOK_InfoBar}
// Introduced in Windows 8
{$DEFINE HOOK_Navigation}
12 changes: 5 additions & 7 deletions Common/Vcl.Styles.Hooks.pas
Expand Up @@ -30,11 +30,6 @@ interface
uses
WinApi.Windows;

var
Trampoline_user32_GetSysColorBrush: function(nIndex: Integer): HBRUSH; stdcall;
Trampoline_user32_GetSysColor: function(nIndex: Integer): DWORD; stdcall;


implementation

{$I VCL.Styles.Utils.inc}
Expand All @@ -52,9 +47,9 @@ implementation
WinApi.UXTheme,
Vcl.Graphics,
Vcl.Styles.Utils.Graphics,
{$IFDEF HOOK_UXTHEME}
{$IFDEF HOOK_UXTHEME}
Vcl.Styles.UxTheme,
{$ENDIF HOOK_UXTHEME}
{$ENDIF HOOK_UXTHEME}
Vcl.Styles.Utils.SysControls,
Vcl.Styles.FontAwesome,
Vcl.Forms,
Expand Down Expand Up @@ -84,8 +79,11 @@ TCommonCalendarClass = class(TCommonCalendar);
Trampoline_user32_DrawEdge : function(hDC: hDC; var qrc: TRect; edge: UINT; grfFlags: UINT): BOOL; stdcall = nil;
Trampoline_user32_DrawFrameControl : function (DC: HDC; Rect: PRect; uType, uState: UINT): BOOL; stdcall = nil;
Trampoline_user32_LoadIconW : function (hInstance: HINST; lpIconName: PWideChar): HICON; stdcall = nil;
Trampoline_user32_GetSysColorBrush: function(nIndex: Integer): HBRUSH; stdcall;
{$IFDEF HOOK_UXTHEME}
Trampoline_user32_LoadImageW: function (hInst: HINST; ImageName: LPCWSTR; ImageType: UINT; X, Y: Integer; Flags: UINT): THandle; stdcall = nil;
{$ELSE}
Trampoline_user32_GetSysColor: function(nIndex: Integer): DWORD; stdcall;
{$ENDIF HOOK_UXTHEME}

{$IFDEF HOOK_TDateTimePicker}
Expand Down
7 changes: 7 additions & 0 deletions Common/Vcl.Styles.Utils.Misc.pas
Expand Up @@ -20,6 +20,8 @@
// **************************************************************************************************
unit Vcl.Styles.Utils.Misc;

{$I VCL.Styles.Utils.inc}

interface

uses
Expand Down Expand Up @@ -49,6 +51,11 @@ implementation

function ExecutingInMainThread: boolean;
begin
{$IFDEF LimitStylesToCurrentProcess}
if (GlobalMainThreadID = 0) then
Exit(GetCurrentThreadId = MainThreadId);
{$ENDIF}

Result := (GlobalMainThreadID = 0) or (GlobalMainThreadID = GetCurrentThreadID);
end;

Expand Down

0 comments on commit e4828aa

Please sign in to comment.