mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 17:59:16 +02:00
lcl: further work on TWinControl.ParentWindow:
- implement LCLIntf.SetParent for win32, wince and qt - implement TWinControl.SetParentWindow git-svn-id: trunk@23846 -
This commit is contained in:
parent
b548b49db5
commit
d6ffb794fb
@ -1555,6 +1555,11 @@ begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TWidgetSet.SetParent(hWndChild: HWND; hWndParent: HWND): HWND;
|
||||
begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
function TWidgetSet.SetProp(Handle: hwnd; Str : PChar;
|
||||
Data : Pointer) : Boolean;
|
||||
Begin
|
||||
|
@ -821,6 +821,11 @@ begin
|
||||
Result := WidgetSet.SetMenu(AWindowHandle, AMenuHandle);
|
||||
end;
|
||||
|
||||
function SetParent(hWndChild: HWND; hWndParent: HWND): HWND;
|
||||
begin
|
||||
Result := WidgetSet.SetParent(hWndChild, hWndParent);
|
||||
end;
|
||||
|
||||
function SetProp(Handle: hwnd; Str : PChar; Data : Pointer) : Boolean;
|
||||
begin
|
||||
Result := WidgetSet.SetProp(Handle,Str,Data);
|
||||
|
@ -236,6 +236,7 @@ function SetFocus(hWnd: HWND): HWND; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function SetForegroundWindow(hWnd : HWND): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function SetMapMode(DC: HDC; fnMapMode : Integer): Integer; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function SetMenu(AWindowHandle: HWND; AMenuHandle: HMENU): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function SetParent(hWndChild: HWND; hWndParent: HWND): HWND; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function SetProp(Handle: hwnd; Str : PChar; Data : Pointer) : Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
//function SetRect --> independent
|
||||
//function SetRectEmpty --> independent
|
||||
|
@ -3968,8 +3968,14 @@ end;
|
||||
|
||||
procedure TWinControl.SetParentWindow(const AValue: HWND);
|
||||
begin
|
||||
// todo: recreate window?
|
||||
if (ParentWindow = AValue) or Assigned(Parent) then Exit;
|
||||
FParentWindow := AValue;
|
||||
if HandleAllocated then
|
||||
if (AValue <> 0) then
|
||||
LCLIntf.SetParent(Handle, AValue)
|
||||
else
|
||||
DestroyHandle;
|
||||
UpdateControlState
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -1457,9 +1457,14 @@ begin
|
||||
// default color roles
|
||||
SetDefaultColorRoles;
|
||||
FPalette := nil;
|
||||
// Creates the widget
|
||||
|
||||
// creates the widget
|
||||
Widget := CreateWidget(FParams);
|
||||
|
||||
// attach to parent
|
||||
if FParams.WndParent <> 0 then
|
||||
setParent(TQtWidget(FParams.WndParent).GetContainerWidget);
|
||||
|
||||
// retrieve default cursor on create
|
||||
FDefaultCursor := QCursor_create();
|
||||
QWidget_cursor(Widget, FDefaultCursor);
|
||||
|
@ -4651,6 +4651,16 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TQtWidgetSet.SetParent(hWndChild: HWND; hWndParent: HWND): HWND;
|
||||
var
|
||||
OldVisible: Boolean;
|
||||
begin
|
||||
Result := GetParent(hWndChild);
|
||||
OldVisible := TQtWidget(hWndChild).getVisible;
|
||||
TQtWidget(hWndChild).setParent(TQtWidget(hWndParent).GetContainerWidget);
|
||||
TQtWidget(hWndChild).setVisible(OldVisible);
|
||||
end;
|
||||
|
||||
function TQtWidgetSet.SetMapMode(DC: HDC; fnMapMode : Integer): Integer;
|
||||
var
|
||||
AWindowExt: TPoint;
|
||||
|
@ -185,6 +185,7 @@ function SetFocus(hWnd: HWND): HWND; override;
|
||||
function SetForegroundWindow(HWnd: HWND): boolean; override;
|
||||
function SetMapMode(DC: HDC; fnMapMode : Integer): Integer; override;
|
||||
function SetMenu(AWindowHandle: HWND; AMenuHandle: HMENU): Boolean; override;
|
||||
function SetParent(hWndChild: HWND; hWndParent: HWND): HWND; override;
|
||||
function SetProp(Handle: hwnd; Str : PChar; Data : Pointer) : Boolean; override;
|
||||
function SetROP2(DC: HDC; Mode: Integer): Integer; override;
|
||||
function SetScrollInfo(Handle : HWND; SBStyle : Integer; ScrollInfo: TScrollInfo; bRedraw : Boolean): Integer; override;
|
||||
|
@ -3058,6 +3058,11 @@ begin
|
||||
AddToChangedMenus(AWindowHandle);
|
||||
end;
|
||||
|
||||
function TWin32WidgetSet.SetParent(hWndChild: HWND; hWndParent: HWND): HWND;
|
||||
begin
|
||||
Result := Windows.SetParent(hWndchild, hWndParent);
|
||||
end;
|
||||
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: SetMapMode
|
||||
|
@ -196,6 +196,7 @@ function SetFocus(HWnd: HWND): HWND; override;
|
||||
function SetForegroundWindow(HWnd: HWND): boolean; override;
|
||||
function SetMapMode(DC: HDC; fnMapMode : Integer): Integer; override;
|
||||
function SetMenu(AWindowHandle: HWND; AMenuHandle: HMENU): Boolean; override;
|
||||
function SetParent(hWndChild: HWND; hWndParent: HWND): HWND; override;
|
||||
function SetProp(Handle: hwnd; Str: PChar; Data: Pointer): Boolean; override;
|
||||
function SetROP2(DC: HDC; Mode: Integer): Integer; override;
|
||||
function SetScrollInfo(Handle: HWND; SBStyle: Integer; ScrollInfo: TScrollInfo; BRedraw: Boolean): Integer; override;
|
||||
|
@ -2731,6 +2731,11 @@ begin
|
||||
Result := Windows.SetForegroundWindow(HWnd);
|
||||
end;
|
||||
|
||||
function TWinCEWidgetSet.SetParent(hWndChild: HWND; hWndParent: HWND): HWND;
|
||||
begin
|
||||
Result := Windows.SetParent(hWndChild,hWndParent);
|
||||
end;
|
||||
|
||||
function TWinCEWidgetSet.SetMenu(AWindowHandle: HWND; AMenuHandle: HMENU): Boolean;
|
||||
{$ifndef Win32}
|
||||
var
|
||||
|
@ -203,6 +203,7 @@ function SetCursor(hCursor: HICON): HCURSOR; override;
|
||||
//function SetCursorPos(X, Y: Integer): Boolean; override;
|
||||
function SetFocus(hWnd: HWND): HWND; override;
|
||||
function SetForegroundWindow(HWnd: HWND): boolean; override;
|
||||
function SetParent(hWndChild: HWND; hWndParent: HWND): HWND; override;
|
||||
function SetProp(Handle: hwnd; Str : PChar; Data : Pointer) : Boolean; override;
|
||||
function SetMenu(AWindowHandle: HWND; AMenuHandle: HMENU): Boolean; override;
|
||||
function SetROP2(DC: HDC; Mode: Integer): Integer; override;
|
||||
|
Loading…
Reference in New Issue
Block a user