mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-04 10:58:18 +02:00
LCL: added TControl.ParentVisibleChanged
git-svn-id: trunk@46184 -
This commit is contained in:
parent
2471a0a5b2
commit
db564054c4
@ -1362,6 +1362,7 @@ type
|
||||
function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean; virtual;
|
||||
procedure VisibleChanging; virtual;
|
||||
procedure VisibleChanged; virtual;
|
||||
procedure ParentVisibleChanged(aParent: TWinControl); virtual;
|
||||
procedure EnabledChanging; virtual;
|
||||
procedure EnabledChanged; virtual;
|
||||
procedure AddHandler(HandlerType: TControlHandlerType;
|
||||
@ -1914,6 +1915,7 @@ type
|
||||
procedure Remove(AControl: TControl);
|
||||
procedure AlignNonAlignedControls(ListOfControls: TFPList;
|
||||
var BoundsModified: Boolean);
|
||||
procedure PropagateParentVisibleChanged(aParent: TWinControl);
|
||||
protected
|
||||
FWinControlFlags: TWinControlFlags;
|
||||
class procedure WSRegisterClass; override;
|
||||
@ -2074,6 +2076,7 @@ type
|
||||
procedure ShowControl(AControl: TControl); virtual;
|
||||
procedure UpdateControlState;
|
||||
procedure UpdateShowing; virtual; // checks control's handle visibility, called by DoAllAutoSize and UpdateControlState
|
||||
procedure ParentVisibleChanged(aParent: TWinControl); override;
|
||||
procedure WndProc(var Message: TLMessage); override;
|
||||
procedure WSSetText(const AText: String); virtual;
|
||||
protected
|
||||
|
@ -1805,6 +1805,15 @@ begin
|
||||
DoCallNotifyHandler(chtOnVisibleChanged);
|
||||
end;
|
||||
|
||||
procedure TControl.ParentVisibleChanged(aParent: TWinControl);
|
||||
// called when a Parent (or grand parent) Visible property changed
|
||||
// and all parents in between have Visible=true
|
||||
// In other words: called when this control visibility changed due to
|
||||
// visibility change of Parent.
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
procedure TControl.EnabledChanging;
|
||||
------------------------------------------------------------------------------}
|
||||
@ -4270,7 +4279,7 @@ begin
|
||||
AdjustSize;
|
||||
if (not Visible) and Assigned(Parent) then
|
||||
begin
|
||||
// control became invisible, so AdjustSize was not propagated
|
||||
// control became invisible, so AdjustSize was not propagated to Parent
|
||||
// => propagate now
|
||||
Parent.InvalidatePreferredSize;
|
||||
Parent.AdjustSize;
|
||||
|
@ -4340,6 +4340,12 @@ begin
|
||||
ChangeShowing(bShow);
|
||||
end;
|
||||
|
||||
procedure TWinControl.ParentVisibleChanged(aParent: TWinControl);
|
||||
begin
|
||||
inherited ParentVisibleChanged(aParent);
|
||||
PropagateParentVisibleChanged(aParent);
|
||||
end;
|
||||
|
||||
procedure TWinControl.Update;
|
||||
begin
|
||||
if HandleAllocated then UpdateWindow(Handle);
|
||||
@ -6136,6 +6142,22 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWinControl.PropagateParentVisibleChanged(aParent: TWinControl);
|
||||
var
|
||||
i: Integer;
|
||||
aControl: TControl;
|
||||
begin
|
||||
for i:=0 to ControlCount-1 do
|
||||
begin
|
||||
aControl:=Controls[i];
|
||||
if not aControl.Visible then
|
||||
continue;
|
||||
ParentVisibleChanged(aParent);
|
||||
if aControl is TWinControl then
|
||||
TWinControl(aControl).PropagateParentVisibleChanged(aParent);
|
||||
end;
|
||||
end;
|
||||
|
||||
class procedure TWinControl.WSRegisterClass;
|
||||
begin
|
||||
inherited WSRegisterClass;
|
||||
|
@ -224,7 +224,7 @@ const
|
||||
LM_CLEAR = $0303;
|
||||
|
||||
const
|
||||
// Moved from Controls to avoid circles
|
||||
// Moved from Controls to avoid circular dependencies
|
||||
CM_BASE = $B000;
|
||||
CM_LCLOFFSET = $100;
|
||||
CM_ACTIVATE = CM_BASE + 0;
|
||||
|
Loading…
Reference in New Issue
Block a user