mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-14 03:19:32 +02:00
customdrawn: Starts the Pascal to Java JNI ifdefs and adds a skeleton for text drawing/metrics support
git-svn-id: trunk@33884 -
This commit is contained in:
parent
7a4de2176d
commit
66de3a943b
@ -3,6 +3,8 @@
|
||||
{$modeswitch objectivec1}
|
||||
{$endif}
|
||||
|
||||
{$define CD_Android_DontUsePascalToJNI}
|
||||
|
||||
// For now default to Android for arm-linux,
|
||||
// because LCL-CustomDrawn is our main Android widgetset.
|
||||
// Remove this when Android gets it's own target
|
||||
@ -10,7 +12,8 @@
|
||||
{$define Android}
|
||||
{$endif}{$endif}{$endif}
|
||||
|
||||
// Check if a backend is already defined
|
||||
|
||||
// Check if a backend which can be utilized in multiple-systems is already defined
|
||||
{$if defined(CD_X11)}
|
||||
{$else}
|
||||
// Choosing the default backend
|
||||
|
@ -133,38 +133,56 @@ const NativeMethods: array[0..1] of JNINativeMethod=
|
||||
function JNI_OnLoad(vm:PJavaVM;reserved:pointer):jint; cdecl;
|
||||
begin
|
||||
curVM:=vm;
|
||||
{ __android_log_write(ANDROID_LOG_INFO,'nativetest','JNI_OnLoad called');
|
||||
__android_log_write(ANDROID_LOG_INFO,'nativetest',PChar(Format('CurVM=%x', [PtrInt(CurVM)])));
|
||||
__android_log_write(ANDROID_LOG_INFO,'nativetest',PChar(Format('CurVM^=%x', [PtrInt(CurVM^)])));
|
||||
__android_log_write(ANDROID_LOG_INFO,'nativetest',PChar(Format('CurVM^^.reserved0=%x', [PtrInt(CurVM^^.reserved0)])));
|
||||
__android_log_write(ANDROID_LOG_INFO,'nativetest',PChar(Format('CurVM^^.GetEnv=%x', [PtrInt(Pointer(@CurVM^^.GetEnv))])));
|
||||
if vm^^.GetEnv(curVM,@curEnv,JNI_VERSION_1_4)<>JNI_OK then begin //<<<--- THIS CRASHES
|
||||
__android_log_write(ANDROID_LOG_INFO{FATAL},'nativetest','curVM^.GetEnv failed');
|
||||
|
||||
{
|
||||
vm^^.GetEnv crashes HTC Wildfire, Alcatel and the Emulator for unknown reasons,
|
||||
see: http://groups.google.com/group/android-ndk/browse_thread/thread/ba542483f062a828/ef9077617794e0f5
|
||||
|
||||
This prevents using Pascal to Java calls completely in those platforms.
|
||||
To turn on a work around one can use CD_Android_DontUsePascalToJNI
|
||||
and then try to implement the missing functionality by other means.
|
||||
|
||||
Not that Java to Pascal calls always work
|
||||
}
|
||||
{$ifndef CD_Android_DontUsePascalToJNI}
|
||||
__android_log_write(ANDROID_LOG_INFO, 'lclapp', 'JNI_OnLoad called');
|
||||
__android_log_write(ANDROID_LOG_INFO, 'lclapp', PChar(Format('CurVM=%x', [PtrInt(CurVM)])));
|
||||
__android_log_write(ANDROID_LOG_INFO, 'lclapp', PChar(Format('CurVM^=%x', [PtrInt(CurVM^)])));
|
||||
__android_log_write(ANDROID_LOG_INFO, 'lclapp', PChar(Format('CurVM^^.reserved0=%x', [PtrInt(CurVM^^.reserved0)])));
|
||||
__android_log_write(ANDROID_LOG_INFO, 'lclapp', PChar(Format('CurVM^^.GetEnv=%x', [PtrInt(Pointer(@CurVM^^.GetEnv))])));
|
||||
|
||||
if vm^^.GetEnv(curVM,@curEnv,JNI_VERSION_1_4)<>JNI_OK then
|
||||
begin
|
||||
__android_log_write(ANDROID_LOG_FATAL, 'lclapp', 'curVM^.GetEnv failed');
|
||||
result:=JNI_ERR;
|
||||
exit;
|
||||
end;
|
||||
|
||||
__android_log_write(ANDROID_LOG_INFO,'nativetest','Reading curClass');
|
||||
curClass:=curEnv^^.FindClass(curEnv,'com/pascal/lcltest/LCLActivity');
|
||||
if not assigned(curClass) then begin
|
||||
__android_log_write(ANDROID_LOG_FATAL,'nativetest','curEnv^.FindClass failed');
|
||||
result:=JNI_ERR;
|
||||
exit;
|
||||
__android_log_write(ANDROID_LOG_INFO,'lclapp','Reading curClass');
|
||||
curJavaClass:=curEnv^^.FindClass(curEnv,'com/pascal/lcltest/LCLActivity');
|
||||
if not assigned(curJavaClass) then
|
||||
begin
|
||||
__android_log_write(ANDROID_LOG_FATAL, 'lclapp', 'curEnv^.FindClass failed');
|
||||
result:=JNI_ERR;
|
||||
exit;
|
||||
end;
|
||||
if curEnv^^.RegisterNatives(curEnv,curClass,@NativeMethods[0],length(NativeMethods))<0 then begin
|
||||
__android_log_write(ANDROID_LOG_FATAL,'nativetest','curEnv^.RegisterNatives failed');
|
||||
result:=JNI_ERR;
|
||||
exit;
|
||||
if curEnv^^.RegisterNatives(curEnv, curJavaClass, @NativeMethods[0],length(NativeMethods))<0 then
|
||||
begin
|
||||
__android_log_write(ANDROID_LOG_FATAL, 'nativetest', 'curEnv^.RegisterNatives failed');
|
||||
result:=JNI_ERR;
|
||||
exit;
|
||||
end;
|
||||
|
||||
nativeCodeLoaded:=curEnv^^.GetFieldID(curEnv,curClass,'nativeCodeLoaded','J');
|
||||
if not assigned(nativeCodeLoaded) then begin
|
||||
__android_log_write(ANDROID_LOG_FATAL,'nativetest','curEnv^.GetFieldID failed');
|
||||
result:=JNI_ERR;
|
||||
exit;
|
||||
end; }
|
||||
nativeCodeLoaded:=curEnv^^.GetFieldID(curEnv, curJavaClass, 'nativeCodeLoaded','J');
|
||||
if not assigned(nativeCodeLoaded) then
|
||||
begin
|
||||
__android_log_write(ANDROID_LOG_FATAL, 'nativetest', 'curEnv^.GetFieldID failed');
|
||||
result:=JNI_ERR;
|
||||
exit;
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
result:=JNI_VERSION_1_4;// 1_6?
|
||||
result:=JNI_VERSION_1_4;// 1_6 is another option
|
||||
end;
|
||||
|
||||
procedure JNI_OnUnload(vm:PJavaVM;reserved:pointer); cdecl;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{%MainUnit customdrawnint.pp}
|
||||
{******************************************************************************
|
||||
All CustomDrawn X11 specific Winapi implementations.
|
||||
All CustomDrawn Android specific Winapi implementations.
|
||||
|
||||
!! Keep alphabetical !!
|
||||
|
||||
@ -2168,7 +2168,7 @@ begin
|
||||
end
|
||||
else
|
||||
Result := inherited ExtSelectClipRGN(DC, RGN, Mode);
|
||||
end;
|
||||
end;*)
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: ExtTextOut
|
||||
@ -2177,20 +2177,20 @@ end;
|
||||
|
||||
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint;
|
||||
function TCDWidgetSet.ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint;
|
||||
Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean;
|
||||
var
|
||||
{var
|
||||
WideStr: WideString;
|
||||
QtDC: TQtDeviceContext absolute DC;
|
||||
B: Boolean;
|
||||
B: Boolean; }
|
||||
begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
{$ifdef VerboseCDWinAPI}
|
||||
WriteLn('[WinAPI ExtTextOut]');
|
||||
{$endif}
|
||||
|
||||
Result := False;
|
||||
|
||||
if ((Options and (ETO_OPAQUE + ETO_CLIPPED)) <> 0) and (Rect = nil) then
|
||||
{ if ((Options and (ETO_OPAQUE + ETO_CLIPPED)) <> 0) and (Rect = nil) then
|
||||
exit;
|
||||
|
||||
if not IsValidDC(DC) then Exit;
|
||||
@ -2220,10 +2220,10 @@ begin
|
||||
QtDC.drawText(X, Y, @WideStr);
|
||||
end;
|
||||
|
||||
Result := True;
|
||||
Result := True;}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
(*{------------------------------------------------------------------------------
|
||||
Function: FillRect
|
||||
Params: none
|
||||
Returns: Nothing
|
||||
@ -4084,29 +4084,29 @@ begin
|
||||
end;
|
||||
end;
|
||||
Result := True;
|
||||
end;
|
||||
end;*)
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: GetTextExtentPoint
|
||||
Params: none
|
||||
Returns: Nothing
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer; var Size: TSize): Boolean;
|
||||
var
|
||||
function TCDWidgetSet.GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer; var Size: TSize): Boolean;
|
||||
{var
|
||||
WideStr: WideString;
|
||||
QtDC: TQtDeviceContext absolute DC;
|
||||
QtDC: TQtDeviceContext absolute DC;}
|
||||
begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
WriteLn('[WinAPI GetTextExtentPoint]');
|
||||
{$ifdef VerboseCDWinAPI}
|
||||
DebugLn('[WinAPI GetTextExtentPoint]');
|
||||
{$endif}
|
||||
|
||||
Result := False;
|
||||
|
||||
if not IsValidDC(DC) then Exit;
|
||||
|
||||
WideStr := GetUtf8String(Str);
|
||||
{ WideStr := GetUtf8String(Str);
|
||||
Size.cx := QtDC.Metrics.width(@WideStr, Count);
|
||||
Size.cy := QtDC.Metrics.height;
|
||||
Size.cy := QtDC.Metrics.height;}
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
@ -4117,20 +4117,20 @@ end;
|
||||
TM - The structure to receive the font information
|
||||
Returns: If successfull
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.GetTextMetrics(DC: HDC; var TM: TTextMetric): Boolean;
|
||||
var
|
||||
function TCDWidgetSet.GetTextMetrics(DC: HDC; var TM: TTextMetric): Boolean;
|
||||
{var
|
||||
QtFontMetrics: TQtFontMetrics;
|
||||
FontFamily: WideString;
|
||||
QtDC: TQtDeviceContext absolute DC;
|
||||
FontWeight: Integer;
|
||||
FontWeight: Integer;}
|
||||
begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
WriteLn('[WinAPI GetTextMetrics]');
|
||||
{$ifdef VerboseCDWinAPI}
|
||||
DebugLn('[WinAPI GetTextMetrics]');
|
||||
{$endif}
|
||||
|
||||
Result := IsValidDC(DC);
|
||||
|
||||
if Result then
|
||||
(* if Result then
|
||||
begin
|
||||
QtFontMetrics := QtDC.Metrics;
|
||||
TM.tmHeight := QtFontMetrics.height;
|
||||
@ -4180,10 +4180,10 @@ begin
|
||||
TM.tmPitchAndFamily := FIXED_PITCH or TRUETYPE_FONTTYPE;
|
||||
|
||||
TM.tmCharSet := DEFAULT_CHARSET;
|
||||
end;
|
||||
end; *)
|
||||
end;
|
||||
|
||||
function TQtWidgetSet.GetViewPortExtEx(DC: HDC; Size: PSize): Integer;
|
||||
(*function TQtWidgetSet.GetViewPortExtEx(DC: HDC; Size: PSize): Integer;
|
||||
var
|
||||
R: TRect;
|
||||
begin
|
||||
@ -6371,7 +6371,7 @@ begin
|
||||
else
|
||||
Result := False;
|
||||
end
|
||||
end;
|
||||
end;*)
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: TextOut
|
||||
@ -6383,29 +6383,27 @@ end;
|
||||
Returns:
|
||||
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.TextOut(DC: HDC; X,Y : Integer; Str : PChar; Count: Integer) : Boolean;
|
||||
var
|
||||
WideStr: WideString;
|
||||
function TCDWidgetSet.TextOut(DC: HDC; X,Y : Integer; Str : PChar; Count: Integer) : Boolean;
|
||||
begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
WriteLn('[WinAPI TextOut]');
|
||||
DebugLn('[WinAPI TextOut]');
|
||||
{$endif}
|
||||
|
||||
Result := False;
|
||||
|
||||
if not IsValidDC(DC) then Exit;
|
||||
|
||||
if Count >= 0 then
|
||||
{ if Count >= 0 then
|
||||
WideStr := GetUtf8String(Copy(Str, 1, Count))
|
||||
else
|
||||
WideStr := GetUtf8String(Str);
|
||||
|
||||
TQtDeviceContext(DC).drawText(X, Y, @WideStr);
|
||||
|
||||
Result := True;
|
||||
Result := True;}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
(*{------------------------------------------------------------------------------
|
||||
Method: UpdateWindow
|
||||
Params: Handle
|
||||
Returns:
|
||||
|
@ -890,7 +890,7 @@ begin
|
||||
Exit;
|
||||
end;
|
||||
with ctx do Result:=RGBToColorFloat(TR, TG, TB);
|
||||
end;
|
||||
end;*)
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: GetTextExtentPoint
|
||||
@ -902,19 +902,19 @@ end;
|
||||
|
||||
Computes the width and height of the specified string of text
|
||||
------------------------------------------------------------------------------}
|
||||
function TCocoaWidgetSet.GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer; var Size: TSize): Boolean;
|
||||
function TCDWidgetSet.GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer; var Size: TSize): Boolean;
|
||||
var
|
||||
ctx : TCocoaContext;
|
||||
begin
|
||||
{$IFDEF VerboseWinAPI}
|
||||
DebugLn('[TCocoaWidgetSet.GetTextExtentPoint] DC: %x Str: %s Count: %d', [DC, Str, Count]);
|
||||
{$IFDEF VerboseCDWinAPI}
|
||||
DebugLn('[TCDWidgetSet.GetTextExtentPoint] DC: %x Str: %s Count: %d', [DC, Str, Count]);
|
||||
{$ENDIF}
|
||||
ctx:=CheckDC(DC);
|
||||
{ ctx:=CheckDC(DC);
|
||||
Result:=Assigned(ctx);
|
||||
if not Assigned(ctx) then Exit(False);
|
||||
Result := ctx.GetTextExtentPoint(Str, Count, Size);
|
||||
{$IFDEF VerboseWinAPI}
|
||||
DebugLn('[TCocoaWidgetSet.GetTextExtentPoint] Size: %d,%d', [Size.cx, Size.cy]);
|
||||
Result := ctx.GetTextExtentPoint(Str, Count, Size);}
|
||||
{$IFDEF VerboseCDWinAPI}
|
||||
DebugLn('[TCDWidgetSet.GetTextExtentPoint] Size: %d,%d', [Size.cx, Size.cy]);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
@ -933,26 +933,26 @@ var
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
{$IFDEF VerboseWinAPI}
|
||||
DebugLn('TCocoaWidgetSet.GetTextMetrics DC: ' + DbgS(DC));
|
||||
{$IFDEF VerboseCDWinAPI}
|
||||
DebugLn('TCDWidgetSet.GetTextMetrics DC: ' + DbgS(DC));
|
||||
{$ENDIF}
|
||||
|
||||
ctx:=CheckDC(DC);
|
||||
{ ctx:=CheckDC(DC);
|
||||
if not Assigned(ctx) then Exit(False);
|
||||
Result := ctx.GetTextMetrics(TM);
|
||||
Result := ctx.GetTextMetrics(TM);}
|
||||
|
||||
{$IFDEF VerboseWinAPI}
|
||||
DebugLn('TCocoaWidgetSet.GetTextMetrics Result: ' + DbgS(Result) +
|
||||
{$IFDEF VerboseCDWinAPI}
|
||||
DebugLn('TCDWidgetSet.GetTextMetrics Result: ' + DbgS(Result) +
|
||||
' TextMetric: ' + DbgS(TM));
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TCocoaWidgetSet.TextOut(DC: HDC; X,Y : Integer; Str : Pchar; Count: Integer) : Boolean;
|
||||
function TCDWidgetSet.TextOut(DC: HDC; X,Y : Integer; Str : Pchar; Count: Integer) : Boolean;
|
||||
begin
|
||||
Result:=ExtTextOut(DC, X, Y, 0, nil, Str, Count, nil);
|
||||
//Result:=ExtTextOut(DC, X, Y, 0, nil, Str, Count, nil);
|
||||
end;
|
||||
|
||||
function TCocoaWidgetSet.SaveDC(DC: HDC): Integer;
|
||||
(*function TCocoaWidgetSet.SaveDC(DC: HDC): Integer;
|
||||
var
|
||||
ctx : TCocoaContext;
|
||||
cg : CGContextRef;
|
||||
|
@ -1346,7 +1346,7 @@ begin
|
||||
LB.lbColor := ColorToRGB(TColor(lplb.lbColor));
|
||||
LB.lbHatch := lplb.lbHatch;
|
||||
Result := Windows.ExtCreatePen(dwPenStyle, dwWidth, LB, dwStyleCount, lpStyle);
|
||||
end;
|
||||
end;*)
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: ExtTextOut
|
||||
@ -1362,14 +1362,11 @@ end;
|
||||
|
||||
Draws a character string by using the currently selected font.
|
||||
------------------------------------------------------------------------------}
|
||||
function TWin32WidgetSet.ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean;
|
||||
{$ifdef WindowsUnicodeSupport}
|
||||
function TCDWidgetSet.ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean;
|
||||
var
|
||||
s: AnsiString;
|
||||
w: WideString;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$ifdef WindowsUnicodeSupport}
|
||||
// use temp buffer, if count is set, there might be no null terminator
|
||||
if count = -1 then
|
||||
s := str
|
||||
@ -1379,24 +1376,12 @@ begin
|
||||
move(str^, PChar(s)^, count);
|
||||
end;
|
||||
// the length of utf8 vs Wide/Ansi the strings differ, so recalc.
|
||||
if UnicodeEnabledOS
|
||||
then
|
||||
begin
|
||||
// TODO: use the real number of chars (and not the lenght)
|
||||
W := UTF8ToUTF16(S);
|
||||
Result := Windows.ExtTextOutW(DC, X, Y, Options, LPRECT(Rect), PWideChar(W), Length(W), Dx);
|
||||
end
|
||||
else
|
||||
begin
|
||||
S := Utf8ToAnsi(S);
|
||||
Result := Windows.ExtTextOut(DC, X, Y, Options, LPRECT(Rect), PChar(S), Length(S), Dx);
|
||||
end;
|
||||
{$else}
|
||||
Result := Windows.ExtTextOut(DC, X, Y, Options, LPRECT(Rect), Str, Count, Dx);
|
||||
{$endif}
|
||||
// TODO: use the real number of chars (and not the lenght)
|
||||
W := UTF8ToUTF16(S);
|
||||
Result := Windows.ExtTextOutW(DC, X, Y, Options, LPRECT(Rect), PWideChar(W), Length(W), Dx);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
(*{------------------------------------------------------------------------------
|
||||
Function: ExtSelectClipRGN
|
||||
Params: dc, RGN, Mode
|
||||
Returns: integer
|
||||
@ -2082,7 +2067,7 @@ begin
|
||||
Result := Windows.GetTextExtentExPoint(DC, pchar(s), length(s),
|
||||
MaxWidth, MaxCount, PartialWidths, Size);
|
||||
end;
|
||||
end;
|
||||
end;*)
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: GetTextExtentPoint
|
||||
@ -2095,14 +2080,11 @@ end;
|
||||
|
||||
Computes the width and height of the specified string of text.
|
||||
------------------------------------------------------------------------------}
|
||||
function TWin32WidgetSet.GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer; var Size: TSize): Boolean;
|
||||
{$ifdef WindowsUnicodeSupport}
|
||||
function TCDWidgetSet.GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer; var Size: TSize): Boolean;
|
||||
var
|
||||
s: AnsiString;
|
||||
w: WideString;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$ifdef WindowsUnicodeSupport}
|
||||
// use temp buffer, if count is set, there might be no null terminator
|
||||
if count = -1 then
|
||||
s := str
|
||||
@ -2112,22 +2094,9 @@ begin
|
||||
move(str^, PChar(s)^, count);
|
||||
end;
|
||||
// the length of utf8 vs Wide/Ansi the strings differ, so recalc.
|
||||
if UnicodeEnabledOS then
|
||||
begin
|
||||
// TODO: use the real number of chars (and not the length)
|
||||
w := UTF8ToUTF16(S);
|
||||
Result := Windows.GetTextExtentPoint32W(DC, PWideChar(W), Length(W), @Size);
|
||||
end else
|
||||
begin
|
||||
// Important: Althougth the MSDN Docs point that GetTextExtentPoint32W
|
||||
// works under Windows 9x, tests showed that this function produces
|
||||
// a wrong output
|
||||
s := Utf8ToAnsi(s);
|
||||
Result := Windows.GetTextExtentPoint32(DC, pchar(s), length(s), @Size);
|
||||
end;
|
||||
{$else}
|
||||
Result := Windows.GetTextExtentPoint32(DC, Str, Count, @Size);
|
||||
{$endif}
|
||||
// TODO: use the real number of chars (and not the length)
|
||||
w := UTF8ToUTF16(S);
|
||||
Result := Windows.GetTextExtentPoint32W(DC, PWideChar(W), Length(W), @Size);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -2138,12 +2107,12 @@ end;
|
||||
|
||||
Fills the specified buffer with the metrics for the currently selected font.
|
||||
------------------------------------------------------------------------------}
|
||||
function TWin32WidgetSet.GetTextMetrics(DC: HDC; Var TM: TTextMetric): Boolean;
|
||||
function TCDWidgetSet.GetTextMetrics(DC: HDC; Var TM: TTextMetric): Boolean;
|
||||
begin
|
||||
Result := Boolean(Windows.GetTextMetrics(DC, @TM));
|
||||
end;
|
||||
|
||||
function TWin32WidgetSet.GetViewPortExtEx(DC: HDC; Size: PSize): Integer;
|
||||
(*function TWin32WidgetSet.GetViewPortExtEx(DC: HDC; Size: PSize): Integer;
|
||||
begin
|
||||
Result := Integer(Windows.GetViewPortExtEx(DC, LPSize(Size)));
|
||||
end;
|
||||
@ -3627,7 +3596,7 @@ end;
|
||||
function TWin32WidgetSet.SystemParametersInfo(uiAction: DWord; uiParam: DWord; pvParam: Pointer; fWinIni: DWord): LongBool;
|
||||
begin
|
||||
Result := Windows.SystemParametersInfo(uiAction, uiParam, pvParam, fWinIni);
|
||||
end;
|
||||
end;*)
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TextOut
|
||||
@ -3641,21 +3610,15 @@ end;
|
||||
Writes a character string at the specified location, using the currently
|
||||
selected font.
|
||||
------------------------------------------------------------------------------}
|
||||
function TWin32WidgetSet.TextOut(DC: HDC; X, Y: Integer; Str: PChar; Count: Integer): Boolean;
|
||||
{$ifdef WindowsUnicodeSupport}
|
||||
function TCDWidgetSet.TextOut(DC: HDC; X, Y: Integer; Str: PChar; Count: Integer): Boolean;
|
||||
var
|
||||
ws: widestring;
|
||||
{$endif}
|
||||
begin
|
||||
{$ifdef WindowsUnicodeSupport}
|
||||
ws := UTF8ToUTF16(copy(str,1,Count));
|
||||
Result := Boolean(Windows.TextOutW(DC, X, Y, PWideChar(ws), length(ws)));
|
||||
{$else}
|
||||
Result := Boolean(Windows.TextOut(DC, X, Y, Str, Count));
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
function TWin32WidgetSet.UpdateWindow(Handle: HWND): Boolean;
|
||||
(*function TWin32WidgetSet.UpdateWindow(Handle: HWND): Boolean;
|
||||
begin
|
||||
Result:=Windows.UpdateWindow(Handle);
|
||||
end;
|
||||
|
@ -2168,7 +2168,7 @@ begin
|
||||
end
|
||||
else
|
||||
Result := inherited ExtSelectClipRGN(DC, RGN, Mode);
|
||||
end;
|
||||
end;*)
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: ExtTextOut
|
||||
@ -2177,11 +2177,11 @@ end;
|
||||
|
||||
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint;
|
||||
function TCDWidgetSet.ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint;
|
||||
Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean;
|
||||
var
|
||||
WideStr: WideString;
|
||||
QtDC: TQtDeviceContext absolute DC;
|
||||
// QtDC: TQtDeviceContext absolute DC;
|
||||
B: Boolean;
|
||||
begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
@ -2190,7 +2190,7 @@ begin
|
||||
|
||||
Result := False;
|
||||
|
||||
if ((Options and (ETO_OPAQUE + ETO_CLIPPED)) <> 0) and (Rect = nil) then
|
||||
{ if ((Options and (ETO_OPAQUE + ETO_CLIPPED)) <> 0) and (Rect = nil) then
|
||||
exit;
|
||||
|
||||
if not IsValidDC(DC) then Exit;
|
||||
@ -2220,10 +2220,10 @@ begin
|
||||
QtDC.drawText(X, Y, @WideStr);
|
||||
end;
|
||||
|
||||
Result := True;
|
||||
Result := True; }
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
(*{------------------------------------------------------------------------------
|
||||
Function: FillRect
|
||||
Params: none
|
||||
Returns: Nothing
|
||||
@ -4084,31 +4084,31 @@ begin
|
||||
end;
|
||||
end;
|
||||
Result := True;
|
||||
end;
|
||||
end;*)
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: GetTextExtentPoint
|
||||
Params: none
|
||||
Returns: Nothing
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer; var Size: TSize): Boolean;
|
||||
var
|
||||
function TCDWidgetSet.GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer; var Size: TSize): Boolean;
|
||||
{var
|
||||
WideStr: WideString;
|
||||
QtDC: TQtDeviceContext absolute DC;
|
||||
QtDC: TQtDeviceContext absolute DC;}
|
||||
begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
WriteLn('[WinAPI GetTextExtentPoint]');
|
||||
{$ifdef VerboseCDWinAPI}
|
||||
DebugLn('[WinAPI GetTextExtentPoint]');
|
||||
{$endif}
|
||||
|
||||
Result := False;
|
||||
|
||||
if not IsValidDC(DC) then Exit;
|
||||
{ if not IsValidDC(DC) then Exit;
|
||||
|
||||
WideStr := GetUtf8String(Str);
|
||||
Size.cx := QtDC.Metrics.width(@WideStr, Count);
|
||||
Size.cy := QtDC.Metrics.height;
|
||||
|
||||
Result := True;
|
||||
Result := True; }
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -4117,20 +4117,15 @@ end;
|
||||
TM - The structure to receive the font information
|
||||
Returns: If successfull
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.GetTextMetrics(DC: HDC; var TM: TTextMetric): Boolean;
|
||||
var
|
||||
QtFontMetrics: TQtFontMetrics;
|
||||
FontFamily: WideString;
|
||||
QtDC: TQtDeviceContext absolute DC;
|
||||
FontWeight: Integer;
|
||||
function TCDWidgetSet.GetTextMetrics(DC: HDC; var TM: TTextMetric): Boolean;
|
||||
begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
{$ifdef VerboseCDWinAPI}
|
||||
WriteLn('[WinAPI GetTextMetrics]');
|
||||
{$endif}
|
||||
|
||||
Result := IsValidDC(DC);
|
||||
|
||||
if Result then
|
||||
{ if Result then
|
||||
begin
|
||||
QtFontMetrics := QtDC.Metrics;
|
||||
TM.tmHeight := QtFontMetrics.height;
|
||||
@ -4180,10 +4175,10 @@ begin
|
||||
TM.tmPitchAndFamily := FIXED_PITCH or TRUETYPE_FONTTYPE;
|
||||
|
||||
TM.tmCharSet := DEFAULT_CHARSET;
|
||||
end;
|
||||
end; }
|
||||
end;
|
||||
|
||||
function TQtWidgetSet.GetViewPortExtEx(DC: HDC; Size: PSize): Integer;
|
||||
(*function TQtWidgetSet.GetViewPortExtEx(DC: HDC; Size: PSize): Integer;
|
||||
var
|
||||
R: TRect;
|
||||
begin
|
||||
@ -6369,7 +6364,7 @@ begin
|
||||
else
|
||||
Result := False;
|
||||
end
|
||||
end;
|
||||
end;*)
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: TextOut
|
||||
@ -6381,16 +6376,16 @@ end;
|
||||
Returns:
|
||||
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.TextOut(DC: HDC; X,Y : Integer; Str : PChar; Count: Integer) : Boolean;
|
||||
var
|
||||
WideStr: WideString;
|
||||
function TCDWidgetSet.TextOut(DC: HDC; X,Y : Integer; Str : PChar; Count: Integer) : Boolean;
|
||||
//var
|
||||
// WideStr: WideString;
|
||||
begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
WriteLn('[WinAPI TextOut]');
|
||||
{$endif}
|
||||
// {$ifdef VerboseQtWinAPI}
|
||||
// WriteLn('[WinAPI TextOut]');
|
||||
// {$endif}
|
||||
|
||||
Result := False;
|
||||
|
||||
{
|
||||
if not IsValidDC(DC) then Exit;
|
||||
|
||||
if Count >= 0 then
|
||||
@ -6400,10 +6395,10 @@ begin
|
||||
|
||||
TQtDeviceContext(DC).drawText(X, Y, @WideStr);
|
||||
|
||||
Result := True;
|
||||
Result := True;}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
(*{------------------------------------------------------------------------------
|
||||
Method: UpdateWindow
|
||||
Params: Handle
|
||||
Returns:
|
||||
|
@ -83,8 +83,8 @@ function EnumDisplayMonitors(hdc: HDC; lprcClip: PRect; lpfnEnum: MonitorEnumPro
|
||||
function EnumFontFamiliesEx(DC: HDC; lpLogFont: PLogFont; Callback: FontEnumExProc; Lparam: LParam; Flags: dword): longint; override;
|
||||
function ExcludeClipRect(dc: hdc; Left, Top, Right, Bottom : Integer) : Integer; override;
|
||||
function ExtCreatePen(dwPenStyle, dwWidth: DWord; const lplb: TLogBrush; dwStyleCount: DWord; lpStyle: PDWord): HPEN; override;
|
||||
function ExtSelectClipRGN(dc: hdc; rgn : hrgn; Mode : Longint) : Integer; override;
|
||||
function ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean; override;*)
|
||||
function ExtSelectClipRGN(dc: hdc; rgn : hrgn; Mode : Longint) : Integer; override;*)
|
||||
function ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean; override;
|
||||
|
||||
function FillRect(DC: HDC; const Rect: TRect; Brush: HBRUSH): Boolean; override;
|
||||
(*function FillRgn(DC: HDC; RegionHnd: HRGN; hbr: HBRUSH): Bool; override;
|
||||
@ -130,10 +130,10 @@ function GetSysColor(nIndex: Integer): DWORD; override;
|
||||
function GetSysColorBrush(nIndex: Integer): HBrush; override;
|
||||
function GetSystemMetrics(nIndex: Integer): Integer; override;
|
||||
function GetTextColor(DC: HDC) : TColorRef; Override;
|
||||
function GetTextExtentExPoint(DC: HDC; Str: PChar; Count, MaxWidth: Integer; MaxCount, PartialWidths: PInteger; var Size: TSize): Boolean; override;
|
||||
function GetTextExtentExPoint(DC: HDC; Str: PChar; Count, MaxWidth: Integer; MaxCount, PartialWidths: PInteger; var Size: TSize): Boolean; override;*)
|
||||
function GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer; var Size: TSize): Boolean; override;
|
||||
function GetTextMetrics(DC: HDC; var TM: TTextMetric): Boolean; override;
|
||||
function GetViewPortExtEx(DC: HDC; Size: PSize): Integer; override;
|
||||
(*function GetViewPortExtEx(DC: HDC; Size: PSize): Integer; override;
|
||||
function GetViewPortOrgEx(DC: HDC; P: PPoint): Integer; override;
|
||||
function GetWindowExtEx(DC: HDC; Size: PSize): Integer; override;
|
||||
function GetWindowLong(Handle : hwnd; int: Integer): PtrInt; override;
|
||||
@ -220,10 +220,10 @@ function StretchBlt(DestDC: HDC; X, Y, Width, Height: Integer;
|
||||
function StretchMaskBlt(DestDC: HDC; X, Y, Width, Height: Integer;
|
||||
SrcDC: HDC; XSrc, YSrc, SrcWidth, SrcHeight: Integer; Mask: HBITMAP;
|
||||
XMask, YMask: Integer; Rop: DWORD): Boolean; override;
|
||||
function SystemParametersInfo(uiAction: DWord; uiParam: DWord; pvParam: Pointer; fWinIni: DWord): LongBool; override;
|
||||
function SystemParametersInfo(uiAction: DWord; uiParam: DWord; pvParam: Pointer; fWinIni: DWord): LongBool; override;*)
|
||||
|
||||
function TextOut(DC: HDC; X,Y : Integer; Str : Pchar; Count: Integer) : Boolean; override;
|
||||
function UpdateWindow(Handle: HWND): Boolean; override;
|
||||
(*function UpdateWindow(Handle: HWND): Boolean; override;
|
||||
function WindowFromPoint(APoint: TPoint): HWND; override;
|
||||
|
||||
//##apiwiz##eps## // Do not remove, no wizard declaration after this line
|
||||
|
Loading…
Reference in New Issue
Block a user