diff --git a/components/virtualtreeview-unstable/VirtualTrees.pas b/components/virtualtreeview-unstable/VirtualTrees.pas index 37a8dcc22..f6ea1fcdd 100644 --- a/components/virtualtreeview-unstable/VirtualTrees.pas +++ b/components/virtualtreeview-unstable/VirtualTrees.pas @@ -113,6 +113,7 @@ uses DelphiCompat, {$else} Windows, + DelphiCompat, {$endif} vtlogger, LCLType, LResources, LCLIntf, LMessages, Types, SysUtils, Classes, Graphics, Controls, Forms, ImgList, StdCtrls, Menus, Printers, @@ -22796,9 +22797,10 @@ begin end; Message.Result := 0; end - else - with Message do - Result := DefWindowProc(FPanningWindow, Msg, wParam, lParam); + else; + //todo: see how implement panning + //with Message do + // Result := DefWindowProc(FPanningWindow, Msg, wParam, lParam); end; //---------------------------------------------------------------------------------------------------------------------- @@ -23202,7 +23204,7 @@ begin end; //---------------------------------------------------------------------------------------------------------------------- - +{$ifdef EnableWheelPanning} var PanningWindowClass: TWndClass = ( style: 0; @@ -23216,7 +23218,7 @@ var lpszMenuName: nil; lpszClassName: 'VTPanningWindow' ); - +{$endif} procedure TBaseVirtualTree.StartWheelPanning(Position: TPoint); // 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 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 DrawTextW(PaintInfo.Canvas.Handle, PWideChar(Text), Length(Text), CellRect, DrawFormat, False); end; @@ -30921,7 +30923,7 @@ begin else DrawFormat := DrawFormat or DT_LEFT; 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 DrawTextW(Canvas.Handle, PWideChar(S), Length(S), PaintInfo.CellRect, DrawFormat, False); Result := PaintInfo.CellRect.Bottom - PaintInfo.CellRect.Top; @@ -31000,7 +31002,6 @@ var P: Pointer; begin - {$ifdef NeedWindows} Result := 0; case Format of CF_TEXT: @@ -31035,12 +31036,15 @@ begin if DataSize > 0 then begin + {$ifdef UseExternalDragManager} + Result:=AllocateGlobal(Data,DataSize); + {$else} Result := GlobalAlloc(GHND or GMEM_SHARE, DataSize); P := GlobalLock(Result); Move(Data^, P^, DataSize); GlobalUnlock(Result); + {$endif} end; - {$endif} end; //---------------------------------------------------------------------------------------------------------------------- diff --git a/components/virtualtreeview-unstable/lclfunctions.inc b/components/virtualtreeview-unstable/lclfunctions.inc index b45a2d753..6cd9ee000 100644 --- a/components/virtualtreeview-unstable/lclfunctions.inc +++ b/components/virtualtreeview-unstable/lclfunctions.inc @@ -87,13 +87,13 @@ begin end; - +{ function InvalidateRect(aHandle : HWND; ARect : pRect; bErase : Boolean) : Boolean; begin Result:=InvalidateRect(aHandle,ARect,bErase); end; - +} {$ifndef UseExternalDragManager} function RegisterDragDrop(hwnd:HWND; pDropTarget:IDropTarget):WINOLEAPI;stdcall;external 'ole32.dll' name 'RegisterDragDrop'; diff --git a/components/virtualtreeview-unstable/units/win32/virtualdragmanager.pas b/components/virtualtreeview-unstable/units/win32/virtualdragmanager.pas index 2bb9c44a4..28533b963 100644 --- a/components/virtualtreeview-unstable/units/win32/virtualdragmanager.pas +++ b/components/virtualtreeview-unstable/units/win32/virtualdragmanager.pas @@ -219,6 +219,8 @@ type procedure UnlockMediumData(Medium:TStgMedium); function GetTreeFromDataObject(const DataObject: IDataObject; var Format: TFormatEtc): TObject; + + function AllocateGlobal(Data: Pointer; DataSize:Cardinal): HGLOBAL; implementation @@ -229,12 +231,12 @@ type TVirtualTreeAccess = class (TBaseVirtualTree) end; -function Succeeded(Status : HRESULT) : BOOL; +function Succeeded(Status : HRESULT) : BOOLEAN; begin Succeeded:=Status and HRESULT($80000000)=0; end; -function Failed(Status : HRESULT) : BOOL; +function Failed(Status : HRESULT) : BOOLEAN; begin Failed:=Status and HRESULT($80000000)<>0; end; @@ -398,6 +400,16 @@ begin 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