Стартовый пул
This commit is contained in:
38
LCLExtensions/include/generic/independentfunctions.inc
Normal file
38
LCLExtensions/include/generic/independentfunctions.inc
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
function MapWindowPoints(hWndFrom, hWndTo: HWND; var lpPoints; cPoints: UINT): Integer;
|
||||
var
|
||||
i: Integer;
|
||||
XOffset, YOffset: SmallInt;
|
||||
FromPoint, ToPoint: TPoint;
|
||||
begin
|
||||
FromPoint := Point(0, 0);
|
||||
ToPoint := Point(0, 0);
|
||||
if hWndFrom <> 0 then
|
||||
ClientToScreen(hWndFrom, FromPoint);
|
||||
if hWndTo <> 0 then
|
||||
ClientToScreen(hWndTo, ToPoint);
|
||||
XOffset := (FromPoint.X - ToPoint.X);
|
||||
YOffset := (FromPoint.Y - ToPoint.Y);
|
||||
for i := 0 to cPoints - 1 do
|
||||
begin
|
||||
PPoint(@lpPoints)[i].x := XOffset + PPoint(@lpPoints)[i].x;
|
||||
PPoint(@lpPoints)[i].y := YOffset + PPoint(@lpPoints)[i].y;
|
||||
end;
|
||||
Result := MakeLong(XOffset, YOffset);
|
||||
end;
|
||||
|
||||
{$ifndef HAS_GETDOUBLECLICKTIME}
|
||||
function GetDoubleClickTime: UINT;
|
||||
begin
|
||||
//todo: see if gtk has a value. Use Windows default for now
|
||||
Result := 500;
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
{$ifndef HAS_REDRAWWINDOW}
|
||||
function RedrawWindow(hWnd:THandle; lprcUpdate:PRECT; hrgnUpdate:HRGN; flags:LongWord):BOOLEAN;
|
||||
begin
|
||||
//todo: see if there's a better way of doing this
|
||||
Result := LCLIntf.InvalidateRect(hWnd, lprcUpdate, (RDW_ERASE and flags) > 0);
|
||||
end;
|
||||
{$endif}
|
177
LCLExtensions/include/generic/stubs.inc
Normal file
177
LCLExtensions/include/generic/stubs.inc
Normal file
@@ -0,0 +1,177 @@
|
||||
|
||||
function BeginDeferWindowPos(nNumWindows:longint):THandle;
|
||||
begin
|
||||
Result := 0;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
|
||||
function CopyImage(hImage:THANDLE; uType:LongWord; cxDesired, cyDesired: LongInt; fuFlags:LongWord):THandle;
|
||||
begin
|
||||
Result := 0;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
|
||||
function DeferWindowPos(hWinPosInfo, hWnd, hWndInsertAfter:THandle; x, y, cx, cy:longint; uFlags:LongWord):THandle;
|
||||
begin
|
||||
Result := 0;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
|
||||
function EndDeferWindowPos(hWinPosInfo:THandle):Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
|
||||
function GdiFlush: Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
|
||||
function GetACP:LongWord;
|
||||
begin
|
||||
Result := 0;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
|
||||
{$ifndef HAS_GETBKCOLOR}
|
||||
function GetBkColor(DC:HDC):COLORREF;
|
||||
begin
|
||||
Result := 0;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
{$ifndef HAS_GETCURRENTOBJECT}
|
||||
function GetCurrentObject(hdc: HDC; uObjectType: UINT): HGDIOBJ;
|
||||
begin
|
||||
Result := 0;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
function GetDCEx(hWnd:THandle; hrgnClip:HRGN; flags:DWORD):HDC;
|
||||
begin
|
||||
Result := 0;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
|
||||
function GetKeyboardLayout(dwLayout:DWORD):THandle;
|
||||
begin
|
||||
Result := 0;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
|
||||
function GetKeyboardState(lpKeyState: System.PByte):BOOLEAN;
|
||||
begin
|
||||
Result := False;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
|
||||
function GetLocaleInfo(Locale, LCType:LongWord; lpLCData:PChar; cchData:longint):longint;
|
||||
begin
|
||||
Result := 0;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
|
||||
function GetRandomRgn(DC: HDC; Rgn: HRGN; iNum: Integer): Integer; stdcall;
|
||||
begin
|
||||
Result := 0;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
|
||||
{$ifndef HAS_GETTEXTEXTENTEXPOINT}
|
||||
function GetTextExtentExPoint(DC: HDC; Str: PChar;
|
||||
Count, MaxWidth: Integer; MaxCount, PartialWidths: PInteger;
|
||||
var Size: TSize): BOOL;
|
||||
begin
|
||||
Result := False;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
{$ifndef HAS_GETTEXTALIGN}
|
||||
function GetTextAlign(hDC:HDC): LongWord;
|
||||
begin
|
||||
Result := 0;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
{$ifndef HAS_GETWINDOWDC}
|
||||
function GetWindowDC(hWnd:THandle):HDC;
|
||||
begin
|
||||
Result := 0;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
function ImageList_DragShowNolock(fShow: Boolean): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
|
||||
{$ifndef HAS_INVERTRECT}
|
||||
function InvertRect(DC: HDC; const lprc: TRect): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
function MultiByteToWideChar(CodePage, dwFlags:DWORD; lpMultiByteStr:PChar; cchMultiByte:longint; lpWideCharStr:PWideChar;cchWideChar:longint):longint;
|
||||
begin
|
||||
Result := 0;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
|
||||
{$ifndef HAS_OFFSETRGN}
|
||||
function OffsetRgn(hrgn:HRGN; nxOffset, nYOffset:longint):longint;
|
||||
begin
|
||||
Result := 0;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
function ScrollDC(DC:HDC; dx:longint; dy:longint; var lprcScroll:TRECT; var lprcClip:TRECT;hrgnUpdate:HRGN; lprcUpdate:PRECT):Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
|
||||
{$ifndef HAS_SCROLLWINDOW}
|
||||
function ScrollWindow(hWnd:THandle; XAmount, YAmount:longint;lpRect:PRECT; lpClipRect:PRECT):Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
{$ifndef HAS_SETBRUSHORGEX}
|
||||
function SetBrushOrgEx(DC:HDC; nXOrg, nYOrg:longint; lppt:PPOINT):Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
function SubtractRect(var lprcDst: TRect; const lprcSrc1, lprcSrc2: TRect): BOOLEAN;
|
||||
begin
|
||||
Result := False;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
|
||||
function ToAscii(uVirtKey, uScanCode:LongWord; lpKeyState: System.PByte; lpChar: System.PWord; uFlags:LongWord):longint;
|
||||
begin
|
||||
Result := 0;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
|
||||
function UpdateWindow(Handle: HWND): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
{$ifdef DEBUG_DELPHICOMPAT} Logger.SendCallStack('Dummy WinAPI Implementation'); {$endif}
|
||||
end;
|
||||
|
8
LCLExtensions/include/generic/timerfunctions.inc
Normal file
8
LCLExtensions/include/generic/timerfunctions.inc
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
function KillTimer(hWnd:THandle; nIDEvent: LongWord):Boolean;
|
||||
begin
|
||||
end;
|
||||
|
||||
function SetTimer(hWnd:THandle; nIDEvent:LongWord; uElapse:LongWord; lpTimerFunc:TTimerNotify): LongWord;
|
||||
begin
|
||||
end;
|
84
LCLExtensions/include/generic/unicodefunctions.inc
Normal file
84
LCLExtensions/include/generic/unicodefunctions.inc
Normal file
@@ -0,0 +1,84 @@
|
||||
|
||||
{
|
||||
GetUTF8ByteCount returns the number of bytes necessary to hold the requested number
|
||||
of characters (count). Not necessarily the number of characters is equal to the
|
||||
widestring length but here we assume it to skip the extra overhead
|
||||
}
|
||||
//todo do a function that convert the str and the count at one pass
|
||||
function GetUTF8ByteCount(const UTF8Str: UTF8String; WideCount: Integer): Integer;
|
||||
var
|
||||
CharCount, CharLen, StrLen: Integer;
|
||||
P: PChar;
|
||||
begin
|
||||
Result := 0;
|
||||
CharCount := 0;
|
||||
P := PChar(UTF8Str);
|
||||
StrLen := Length(UTF8Str);
|
||||
WideCount := Min(WideCount, StrLen);
|
||||
while (CharCount < WideCount) do
|
||||
begin
|
||||
CharLen := UTF8CharacterLength(P);
|
||||
Inc(P, CharLen);
|
||||
Inc(Result, CharLen);
|
||||
Inc(CharCount);
|
||||
end;
|
||||
Result := Min(Result, StrLen);
|
||||
end;
|
||||
|
||||
{$ifndef HAS_DRAWTEXTW}
|
||||
function DrawTextW(hDC: HDC; lpString: PWideChar; nCount: Integer; var lpRect: TRect; uFormat: LongWord): Integer;
|
||||
var
|
||||
TempStr: UTF8String;
|
||||
begin
|
||||
TempStr := UTF8Encode(WideString(lpString));
|
||||
Result := DrawText(hDC, PChar(TempStr), GetUTF8ByteCount(TempStr, nCount),
|
||||
lpRect, uFormat);
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
function ExtTextOutW(DC: HDC; X, Y: Integer; Options: LongInt; Rect: PRect;
|
||||
Str: PWideChar; Count: LongInt; Dx: ObjPas.PInteger): Boolean;
|
||||
var
|
||||
TempStr: UTF8String;
|
||||
begin
|
||||
TempStr := UTF8Encode(WideString(Str));
|
||||
Result := ExtTextOut(DC, X, Y, Options, Rect, PChar(TempStr),
|
||||
GetUTF8ByteCount(TempStr, Count), Dx);
|
||||
end;
|
||||
|
||||
function GetTextExtentPoint32W(DC: HDC; Str: PWideChar; Count: Integer; out Size: TSize): Boolean;
|
||||
var
|
||||
TempStr: UTF8String;
|
||||
begin
|
||||
TempStr := UTF8Encode(WideString(Str));
|
||||
Result := GetTextExtentPoint(DC, PChar(TempStr),
|
||||
GetUTF8ByteCount(TempStr, Count), Size);
|
||||
end;
|
||||
|
||||
function GetTextExtentExPointW(DC: HDC; Str: PWideChar;
|
||||
Count, MaxWidth: Integer; MaxCount, PartialWidths: ObjPas.PInteger;
|
||||
var Size: TSize): BOOL;
|
||||
var
|
||||
TempStr: UTF8String;
|
||||
begin
|
||||
TempStr := UTF8Encode(WideString(Str));
|
||||
Result := DelphiCompat.GetTextExtentExPoint(DC, PChar(TempStr),
|
||||
Count, MaxWidth, MaxCount, PartialWidths, Size);
|
||||
end;
|
||||
|
||||
function GetTextExtentPointW(DC: HDC; Str: PWideChar; Count: Integer; out Size: TSize): Boolean;
|
||||
var
|
||||
TempStr: UTF8String;
|
||||
begin
|
||||
TempStr := UTF8Encode(WideString(Str));
|
||||
Result := GetTextExtentPoint(DC, PChar(TempStr),
|
||||
GetUTF8ByteCount(TempStr, Count), Size);
|
||||
end;
|
||||
|
||||
function TextOutW(DC: HDC; X,Y : Integer; Str : PWideChar; Count: Integer) : Boolean;
|
||||
var
|
||||
TempStr: UTF8String;
|
||||
begin
|
||||
TempStr := UTF8Encode(WideString(Str));
|
||||
Result := TextOut(DC, X, Y, PChar(TempStr), GetUTF8ByteCount(TempStr, Count));
|
||||
end;
|
Reference in New Issue
Block a user