From aa7a14e2acef08681ac0337bd86ea7431791a14d Mon Sep 17 00:00:00 2001 From: paul Date: Tue, 9 Jun 2009 09:06:40 +0000 Subject: [PATCH] win32: add TWin32ThemeServices.DrawTextEx git-svn-id: trunk@20545 - --- lcl/interfaces/win32/win32proc.pp | 1 - lcl/interfaces/win32/win32themes.pas | 25 +++++++++++++++++++++++++ lcl/interfaces/win32/win32uxtheme.pas | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/lcl/interfaces/win32/win32proc.pp b/lcl/interfaces/win32/win32proc.pp index 5f880e4517..b3188fcbcd 100644 --- a/lcl/interfaces/win32/win32proc.pp +++ b/lcl/interfaces/win32/win32proc.pp @@ -1777,7 +1777,6 @@ begin else WindowsVersion := wvLater; end; - end; else WindowsVersion := wvLater; diff --git a/lcl/interfaces/win32/win32themes.pas b/lcl/interfaces/win32/win32themes.pas index 708dba8b50..5fa19a0ddf 100644 --- a/lcl/interfaces/win32/win32themes.pas +++ b/lcl/interfaces/win32/win32themes.pas @@ -52,6 +52,9 @@ type procedure DrawText(ACanvas: TPersistent; Details: TThemedElementDetails; const S: String; R: TRect; Flags, Flags2: Cardinal); override; + procedure DrawTextEx(DC: HDC; Details: TThemedElementDetails; + const S: String; R: TRect; Flags: Cardinal; Options: PDTTOpts); + function ContentRect(DC: HDC; Details: TThemedElementDetails; BoundingRect: TRect): TRect; override; function HasTransparentParts(Details: TThemedElementDetails): Boolean; override; procedure PaintBorder(Control: TObject; EraseLRCorner: Boolean); override; @@ -432,4 +435,26 @@ begin inherited; end; +procedure TWin32ThemeServices.DrawTextEx(DC: HDC; + Details: TThemedElementDetails; const S: String; R: TRect; Flags: Cardinal; + Options: PDTTOpts); +{$IFDEF WindowsUnicodeSupport} +var + w: widestring; +{$ENDIF} +begin + if ThemesEnabled and (DrawThemeTextEx <> nil) then + with Details do +{$IFDEF WindowsUnicodeSupport} + begin + w := UTF8ToUTF16(S); + DrawThemeTextEx(Theme[Element], DC, Part, State, PWideChar(w), Length(w), Flags, @R, Options); + end +{$ELSE} + DrawThemeTextEx(Theme[Element], DC, Part, State, PWideChar(WideString(S)), Length(S), Flags, @R, Options) +{$ENDIF} + else + DrawText(DC, Details, S, R, Flags, 0); +end; + end. diff --git a/lcl/interfaces/win32/win32uxtheme.pas b/lcl/interfaces/win32/win32uxtheme.pas index 91d3d9cb86..f7ed94392c 100644 --- a/lcl/interfaces/win32/win32uxtheme.pas +++ b/lcl/interfaces/win32/win32uxtheme.pas @@ -1451,7 +1451,7 @@ type {$EXTERNALSYM DTTOPTS} PDTTOPTS = ^_DTTOPTS; {$EXTERNALSYM PDTTOPTS} - TDTOpts = DTTOPTS; + TDTTOpts = DTTOPTS; // if (_WIN32_WINNT >= 0x0600)