LCL: gtk2: dropfiles for sub forms

git-svn-id: trunk@45559 -
This commit is contained in:
mattias 2014-06-16 22:24:44 +00:00
parent 3b62c88f2c
commit debddcec44
3 changed files with 25 additions and 12 deletions

View File

@ -2193,6 +2193,7 @@ type
procedure EraseBackground(DC: HDC); virtual; procedure EraseBackground(DC: HDC); virtual;
function IntfUTF8KeyPress(var UTF8Key: TUTF8Char; function IntfUTF8KeyPress(var UTF8Key: TUTF8Char;
RepeatCount: integer; SystemKey: boolean): boolean; virtual; RepeatCount: integer; SystemKey: boolean): boolean; virtual;
function IntfGetDropFilesTarget: TWinControl; virtual;
procedure PaintTo(DC: HDC; X, Y: Integer); virtual; overload; procedure PaintTo(DC: HDC; X, Y: Integer); virtual; overload;
procedure PaintTo(ACanvas: TCanvas; X, Y: Integer); overload; procedure PaintTo(ACanvas: TCanvas; X, Y: Integer); overload;
procedure SetShape(AShape: TBitmap); overload; procedure SetShape(AShape: TBitmap); overload;

View File

@ -4094,7 +4094,7 @@ end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
TWinControl SetBorderWidth TWinControl SetBorderWidth
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TWinControl.SetBorderWidth(value : TBorderWidth); procedure TWinControl.SetBorderWidth(Value: TBorderWidth);
begin begin
if FBorderWidth = Value then exit; if FBorderWidth = Value then exit;
FBorderWidth := Value; FBorderWidth := Value;
@ -4411,7 +4411,7 @@ end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
TWinControl FindChildControl TWinControl FindChildControl
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TWinControl.FindChildControl(const ControlName: string): TControl; function TWinControl.FindChildControl(const ControlName: String): TControl;
var var
I: Integer; I: Integer;
begin begin
@ -4475,8 +4475,8 @@ end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
{ TWinControl FindNextControl } { TWinControl FindNextControl }
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
function TWinControl.FindNextControl(CurrentControl: TWinControl; function TWinControl.FindNextControl(CurrentControl: TWinControl; GoForward,
GoForward, CheckTabStop, CheckParent: boolean): TWinControl; CheckTabStop, CheckParent: Boolean): TWinControl;
var var
List: TFPList; List: TFPList;
Next: TWinControl; Next: TWinControl;
@ -4960,6 +4960,17 @@ begin
end; end;
end; end;
function TWinControl.IntfGetDropFilesTarget: TWinControl;
begin
Result:=Self;
repeat
Result:=GetFirstParentForm(Result);
if Result=nil then exit;
if TCustomForm(Result).AllowDropFiles then exit;
Result:=Result.Parent;
until Result=nil;
end;
procedure TWinControl.PaintTo(DC: HDC; X, Y: Integer); procedure TWinControl.PaintTo(DC: HDC; X, Y: Integer);
begin begin
if HandleAllocated then if HandleAllocated then
@ -5585,7 +5596,7 @@ end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
TWinControl KeyDown TWinControl KeyDown
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TWinControl.KeyDown(var Key: Word; shift : TShiftState); procedure TWinControl.KeyDown(var Key: Word; Shift: TShiftState);
begin begin
if Assigned(FOnKeyDown) then FOnKeyDown(Self, Key, Shift); if Assigned(FOnKeyDown) then FOnKeyDown(Self, Key, Shift);
end; end;
@ -6386,7 +6397,7 @@ end;
Params: NewHandle Params: NewHandle
Returns: Nothing Returns: Nothing
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TWincontrol.SetHandle(NewHandle: HWND); procedure TWinControl.SetHandle(NewHandle: HWND);
begin begin
//if (NewHandle=0) and (AnsiCompareText(ClassName,'TPAGE')=0) then //if (NewHandle=0) and (AnsiCompareText(ClassName,'TPAGE')=0) then
// RaiseGDBException('TWincontrol.SetHandle'); // RaiseGDBException('TWincontrol.SetHandle');
@ -6420,7 +6431,7 @@ end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
TWinControl CreateParented TWinControl CreateParented
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
constructor TWinControl.CreateParented(AParentWindow: hwnd); constructor TWinControl.CreateParented(AParentWindow: HWND);
begin begin
FParentWindow := AParentWindow; FParentWindow := AParentWindow;
Create(nil); Create(nil);
@ -6429,7 +6440,8 @@ end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
TWinControl CreateParentedControl TWinControl CreateParentedControl
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
class function TWinControl.CreateParentedControl(AParentWindow: hwnd): TWinControl; class function TWinControl.CreateParentedControl(AParentWindow: HWND
): TWinControl;
begin begin
Result := CreateParented(AParentWindow); Result := CreateParented(AParentWindow);
end; end;
@ -7134,7 +7146,7 @@ end;
event handler. event handler.
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TWInControl.WMNotify(var Message: TLMNotify); procedure TWinControl.WMNotify(var Message: TLMNotify);
begin begin
if not DoControlMsg(Message.NMHdr^.hwndfrom, Message) then if not DoControlMsg(Message.NMHdr^.hwndfrom, Message) then
inherited; inherited;
@ -7877,7 +7889,7 @@ begin
end; end;
end; end;
function TWinControl.DoUnDockClientMsg(NewTarget, Client: TControl): boolean; function TWinControl.DoUndockClientMsg(NewTarget, Client: TControl): boolean;
begin begin
Result := True; Result := True;
{$IFDEF VerboseDocking} {$IFDEF VerboseDocking}
@ -8127,7 +8139,7 @@ end;
Get the devicecontext for this WinControl. Get the devicecontext for this WinControl.
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TWinControl.GetDeviceContext(var WindowHandle: HWnd): HDC; function TWinControl.GetDeviceContext(var WindowHandle: HWND): HDC;
begin begin
Result := GetDC(Handle); Result := GetDC(Handle);
//DebugLn('[TWinControl.GetDeviceContext] ',ClassName,' DC=',DbgS(Result,8),' Handle=',DbgS(FHandle)); //DebugLn('[TWinControl.GetDeviceContext] ',ClassName,' DC=',DbgS(Result,8),' Handle=',DbgS(FHandle));

View File

@ -3529,7 +3529,7 @@ begin
begin begin
Form := nil; Form := nil;
if (TObject(Data) is TWinControl) then if (TObject(Data) is TWinControl) then
Form := (TObject(Data) as TWinControl).GetTopParent; Form := (TObject(Data) as TWinControl).IntfGetDropFilesTarget;
if Form is TCustomForm then if Form is TCustomForm then
(Form as TCustomForm).IntfDropFiles(Files) (Form as TCustomForm).IntfDropFiles(Files)