first try to make the components unicode aware on win

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@349 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
christian_u
2008-02-11 01:09:19 +00:00
parent 160abc712d
commit 75305bbd3c
6 changed files with 83 additions and 62 deletions

View File

@ -84,7 +84,8 @@ interface
uses
{$IFDEF LCL}
LMessages,LCLProc,LCLType,LCLIntf,
{$ELSE}
{$ENDIF}
{$IFDEF WINDOWS}
Windows,
{$ENDIF}
Classes,
@ -109,7 +110,7 @@ type
protected
procedure DrawRotatedText (x, y : Integer;
Text : string;
Text : Widestring;
Rotate : Boolean);
procedure Swap (var a, b : Integer);
@ -977,7 +978,7 @@ begin
end;
procedure TVpExCanvas.DrawRotatedText (x, y : Integer;
Text : string;
Text : Widestring;
Rotate : Boolean);
var
@ -985,7 +986,6 @@ var
OldFont : TFont;
RealPoint : TPoint;
OldBrushStyle : TBrushStyle;
begin
if not Assigned (FCanvas) then
raise EVpCanvasError.Create (RSNoCanvas);
@ -1035,7 +1035,7 @@ begin
OldBrushStyle := FCanvas.Brush.Style;
try
FCanvas.Brush.Style := bsClear;
FCanvas.TextOut (RealPoint.X, RealPoint.Y, Text);
FCanvas.TextOut(RealPoint.X,RealPoint.Y,Text);
finally
FCanvas.Brush.Style := OldBrushStyle;
end;
@ -1044,6 +1044,26 @@ begin
end;
end;
procedure DrawTextW(Canvas: TCanvas; lpString: PWideChar; var lpRect: TRect; uFormat: Cardinal;
AdjustRight: Boolean);
var Style:TTextStyle;
begin
{$ifndef WINCE}
{$ifdef UNIX}
{$ifdef LCLgtk}
Style.Layout:=tlCenter;
Canvas.TextRect(lpRect,lpRect.Left,lpRect.Top,lpString,Style); // theo 24.2.2007 Gibt sonst Striche auf GTK1
{$else}
DrawTextW(Canvas.Handle, lpString, Length(lpString), lpRect, uFormat, AdjustRight);
{$endif}
{$else}
Canvas.TextOut(lpRect.Left,lpRect.Top,lpString);
{$endif}
{$else}
Canvas.TextOut(lpRect.Left,lpRect.Top,lpString);
{$endif}
end;
function TVpExCanvas.ViewportWidth : Integer;
var
FixRect : TRect;