wince: copy win32 CriticalSection code to wince

git-svn-id: trunk@13719 -
This commit is contained in:
paul 2008-01-11 01:36:23 +00:00
parent e7d0fde1ac
commit 453f44cad7
2 changed files with 43 additions and 21 deletions

View File

@ -1829,12 +1829,12 @@ end;
Draws a line from the current position up to, but not including, the specified point.
------------------------------------------------------------------------------}
Function TWinCEWidgetSet.LineTo(DC: HDC; X, Y: Integer): Boolean;
Begin
function TWinCEWidgetSet.LineTo(DC: HDC; X, Y: Integer): Boolean;
begin
Assert(False, Format('Trace:> [TWinCEWidgetSet.LineTo] DC:0x%x, X:%d, Y:%d', [DC, X, Y]));
Result := Boolean(Windows.LineTo(DC, X, Y));
Assert(False, Format('Trace:< [TWinCEWidgetSet.LineTo] DC:0x%x, X:%d, Y:%d', [DC, X, Y]));
End;
end;
{------------------------------------------------------------------------------
Method: MessageBox
@ -2816,21 +2816,43 @@ Begin
// Result := 0;
End;
procedure TWinCEWidgetSet.DeleteCriticalSection(var CritSection: TCriticalSection);
begin
{ An OS Compatible TCriticalSection needs to be defined}
if CritSection<>0 then
begin
Windows.DeleteCriticalSection(LPCRITICAL_SECTION(CritSection));
Try
Dispose(LPCRITICAL_SECTION(CritSection));
finally
CritSection := 0;
end;
end;
end;
procedure TWinCEWidgetSet.EnterCriticalSection(var CritSection: TCriticalSection);
begin
{ An OS Compatible TCriticalSection needs to be defined}
Windows.LeaveCriticalSection(LPCRITICAL_SECTION(CritSection));
end;
{We interprete CritSection as a pointer to a LPCRITICAL_SECTION structure}
{procedure TWinCEWidgetSet.InitializeCriticalSection(
var CritSection: TCriticalSection);
procedure TWinCEWidgetSet.InitializeCriticalSection(var CritSection: TCriticalSection);
var
Crit : LPCRITICAL_SECTION;
begin
inherited InitializeCriticalSection(CritSection);
end;}
{procedure TWinCEWidgetSet.EnterCriticalSection(var CritSection: TCriticalSection
);
{ An OS Compatible TCriticalSection needs to be defined}
If CritSection <> 0 then
DeleteCriticalSection(CritSection);
New(Crit);
Windows.InitializeCriticalSection(Crit);
CritSection := TCriticalSection(Crit);
end;
procedure TWinCEWidgetSet.LeaveCriticalSection(var CritSection: TCriticalSection);
begin
inherited EnterCriticalSection(CritSection);
end;}
{ An OS Compatible TCriticalSection needs to be defined}
Windows.LeaveCriticalSection(LPCRITICAL_SECTION(CritSection));
end;
//##apiwiz##epi## // Do not remove

View File

@ -79,7 +79,7 @@ function CreatePenIndirect(const LogPen: TLogPen): HPEN; override;
//function CreatePolygonRgn(Points: PPoint; NumPts: Integer; FillMode: integer): HRGN; override;
function CreateRectRgn(X1,Y1,X2,Y2 : Integer): HRGN; override;
{procedure DeleteCriticalSection(var CritSection: TCriticalSection); override;}
procedure DeleteCriticalSection(var CritSection: TCriticalSection); override;
function DeleteDC(hDC: HDC): Boolean; override;
function DeleteObject(GDIObject: HGDIOBJ): Boolean; override;
//function DestroyCaret(Handle : HWND): Boolean; override;
@ -92,8 +92,8 @@ function DrawText(DC: HDC; Str: PChar; Count: Integer; var Rect: TRect; Flags: C
function EnableScrollBar(Wnd: HWND; wSBflags, wArrows: Cardinal): Boolean; override;}
function EnableWindow(hWnd: HWND; bEnable: Boolean): Boolean; override;
function EndPaint(Handle : hwnd; var PS : TPaintStruct): Integer; override;
{procedure EnterCriticalSection(var CritSection: TCriticalSection); Override;
function EnumFontFamilies(DC: HDC; Family: Pchar; EnumFontFamProc: FontEnumProc; LParam:Lparam):longint; override;
procedure EnterCriticalSection(var CritSection: TCriticalSection); override;
{function EnumFontFamilies(DC: HDC; Family: Pchar; EnumFontFamProc: FontEnumProc; LParam:Lparam):longint; override;
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 ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean; override;
@ -149,15 +149,15 @@ Function GetWindowSize(Handle : hwnd; var Width, Height: integer): boolean; over
function GradientFill(DC: HDC; Vertices: PTriVertex; NumVertices : Longint;
Meshes: Pointer; NumMeshes : Longint; Mode : Longint): Boolean; Override;
function HideCaret(hWnd: HWND): Boolean; override;
function HideCaret(hWnd: HWND): Boolean; override;}
Procedure InitializeCriticalSection(var CritSection: TCriticalSection); Override;}
procedure InitializeCriticalSection(var CritSection: TCriticalSection); override;
function IntersectClipRect(dc: hdc; Left, Top, Right, Bottom: Integer): Integer; override;
function InvalidateRect(aHandle : HWND; Rect : pRect; bErase : Boolean) : Boolean; override;
function IsWindowEnabled(handle: HWND): boolean; override;
function IsWindowVisible(handle: HWND): boolean; override;
//Procedure LeaveCriticalSection(var CritSection: TCriticalSection); Override;
procedure LeaveCriticalSection(var CritSection: TCriticalSection); override;
function LineTo(DC: HDC; X, Y: Integer): Boolean; override;
function MessageBox(hWnd: HWND; lpText, lpCaption: PChar; uType: Cardinal): integer; override;