Finished isolation of WinApi functions

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@121 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
blikblum
2007-03-07 14:24:30 +00:00
parent 48d8f6864c
commit dd83bd49fe
3 changed files with 29 additions and 13 deletions

View File

@ -113,6 +113,7 @@ uses
DelphiCompat, DelphiCompat,
{$else} {$else}
Windows, Windows,
DelphiCompat,
{$endif} {$endif}
vtlogger, LCLType, LResources, LCLIntf, LMessages, Types, vtlogger, LCLType, LResources, LCLIntf, LMessages, Types,
SysUtils, Classes, Graphics, Controls, Forms, ImgList, StdCtrls, Menus, Printers, SysUtils, Classes, Graphics, Controls, Forms, ImgList, StdCtrls, Menus, Printers,
@ -22796,9 +22797,10 @@ begin
end; end;
Message.Result := 0; Message.Result := 0;
end end
else else;
with Message do //todo: see how implement panning
Result := DefWindowProc(FPanningWindow, Msg, wParam, lParam); //with Message do
// Result := DefWindowProc(FPanningWindow, Msg, wParam, lParam);
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -23202,7 +23204,7 @@ begin
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
{$ifdef EnableWheelPanning}
var var
PanningWindowClass: TWndClass = ( PanningWindowClass: TWndClass = (
style: 0; style: 0;
@ -23216,7 +23218,7 @@ var
lpszMenuName: nil; lpszMenuName: nil;
lpszClassName: 'VTPanningWindow' lpszClassName: 'VTPanningWindow'
); );
{$endif}
procedure TBaseVirtualTree.StartWheelPanning(Position: TPoint); procedure TBaseVirtualTree.StartWheelPanning(Position: TPoint);
// Called when wheel panning should start. A little helper window is created to indicate the reference position, // Called when wheel panning should start. A little helper window is created to indicate the reference position,
@ -30675,7 +30677,7 @@ procedure TCustomVirtualStringTree.DoTextDrawing(var PaintInfo: TVTPaintInfo; Te
begin begin
if IsWinNT then if IsWinNT then
Windows.DrawTextW(PaintInfo.Canvas.Handle, PWideChar(Text), Length(Text), CellRect, DrawFormat) DelphiCompat.DrawTextW(PaintInfo.Canvas.Handle, PWideChar(Text), Length(Text), CellRect, DrawFormat)
else else
DrawTextW(PaintInfo.Canvas.Handle, PWideChar(Text), Length(Text), CellRect, DrawFormat, False); DrawTextW(PaintInfo.Canvas.Handle, PWideChar(Text), Length(Text), CellRect, DrawFormat, False);
end; end;
@ -30921,7 +30923,7 @@ begin
else else
DrawFormat := DrawFormat or DT_LEFT; DrawFormat := DrawFormat or DT_LEFT;
if IsWinNT then if IsWinNT then
Windows.DrawTextW(Canvas.Handle, PWideChar(S), Length(S), PaintInfo.CellRect, DrawFormat) DelphiCompat.DrawTextW(Canvas.Handle, PWideChar(S), Length(S), PaintInfo.CellRect, DrawFormat)
else else
DrawTextW(Canvas.Handle, PWideChar(S), Length(S), PaintInfo.CellRect, DrawFormat, False); DrawTextW(Canvas.Handle, PWideChar(S), Length(S), PaintInfo.CellRect, DrawFormat, False);
Result := PaintInfo.CellRect.Bottom - PaintInfo.CellRect.Top; Result := PaintInfo.CellRect.Bottom - PaintInfo.CellRect.Top;
@ -31000,7 +31002,6 @@ var
P: Pointer; P: Pointer;
begin begin
{$ifdef NeedWindows}
Result := 0; Result := 0;
case Format of case Format of
CF_TEXT: CF_TEXT:
@ -31035,12 +31036,15 @@ begin
if DataSize > 0 then if DataSize > 0 then
begin begin
{$ifdef UseExternalDragManager}
Result:=AllocateGlobal(Data,DataSize);
{$else}
Result := GlobalAlloc(GHND or GMEM_SHARE, DataSize); Result := GlobalAlloc(GHND or GMEM_SHARE, DataSize);
P := GlobalLock(Result); P := GlobalLock(Result);
Move(Data^, P^, DataSize); Move(Data^, P^, DataSize);
GlobalUnlock(Result); GlobalUnlock(Result);
{$endif}
end; end;
{$endif}
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------

View File

@ -87,13 +87,13 @@ begin
end; end;
{
function InvalidateRect(aHandle : HWND; ARect : pRect; bErase : Boolean) : Boolean; function InvalidateRect(aHandle : HWND; ARect : pRect; bErase : Boolean) : Boolean;
begin begin
Result:=InvalidateRect(aHandle,ARect,bErase); Result:=InvalidateRect(aHandle,ARect,bErase);
end; end;
}
{$ifndef UseExternalDragManager} {$ifndef UseExternalDragManager}
function RegisterDragDrop(hwnd:HWND; pDropTarget:IDropTarget):WINOLEAPI;stdcall;external 'ole32.dll' name 'RegisterDragDrop'; function RegisterDragDrop(hwnd:HWND; pDropTarget:IDropTarget):WINOLEAPI;stdcall;external 'ole32.dll' name 'RegisterDragDrop';

View File

@ -219,6 +219,8 @@ type
procedure UnlockMediumData(Medium:TStgMedium); procedure UnlockMediumData(Medium:TStgMedium);
function GetTreeFromDataObject(const DataObject: IDataObject; var Format: TFormatEtc): TObject; function GetTreeFromDataObject(const DataObject: IDataObject; var Format: TFormatEtc): TObject;
function AllocateGlobal(Data: Pointer; DataSize:Cardinal): HGLOBAL;
implementation implementation
@ -229,12 +231,12 @@ type
TVirtualTreeAccess = class (TBaseVirtualTree) TVirtualTreeAccess = class (TBaseVirtualTree)
end; end;
function Succeeded(Status : HRESULT) : BOOL; function Succeeded(Status : HRESULT) : BOOLEAN;
begin begin
Succeeded:=Status and HRESULT($80000000)=0; Succeeded:=Status and HRESULT($80000000)=0;
end; end;
function Failed(Status : HRESULT) : BOOL; function Failed(Status : HRESULT) : BOOLEAN;
begin begin
Failed:=Status and HRESULT($80000000)<>0; Failed:=Status and HRESULT($80000000)<>0;
end; end;
@ -398,6 +400,16 @@ begin
end; end;
end; end;
function AllocateGlobal(Data: Pointer; DataSize: Cardinal): HGLOBAL;
var
P:Pointer;
begin
Result := GlobalAlloc(GHND or GMEM_SHARE, DataSize);
P := GlobalLock(Result);
Move(Data^, P^, DataSize);
GlobalUnlock(Result);
end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
// OLE drag and drop support classes // OLE drag and drop support classes