Gtk2: fixed TGtk2WSWinControl.SetChildZPosition(). fixes #17298

git-svn-id: trunk@27269 -
This commit is contained in:
zeljko 2010-09-04 17:14:49 +00:00
parent 4cc5ab25bf
commit f2e1d9f50b

View File

@ -617,25 +617,27 @@ begin
if not WSCheckHandleAllocated(AWincontrol, 'SetChildZPosition') if not WSCheckHandleAllocated(AWincontrol, 'SetChildZPosition')
then Exit; then Exit;
if ANewPos < AChildren.Count div 2 then if not WSCheckHandleAllocated(AChild, 'SetChildZPosition (child)') then
Exit;
if (ANewPos <= 0) or (ANewPos >= AChildren.Count - 1) then
begin begin
// move down (and others below us) // simple
for n := ANewPos downto 0 do Child := TWinControlHack(AChild);
begin if ANewPos <= 0 then // bottom
child := TWinControlHack(AChildren[n]); TGtkPrivateWidgetClass(
if child.HandleAllocated then Child.WidgetSetClass.WSPrivate).SetZPosition(Child, wszpBack)
TGtkPrivateWidgetClass( else
child.WidgetSetClass.WSPrivate).SetZPosition(child, wszpBack); TGtkPrivateWidgetClass(
end; Child.WidgetSetClass.WSPrivate).SetZPosition(Child, wszpFront);
end else end else
begin begin
// move up (and others above us) for n := 1 to AChildren.Count - 1 do
for n := ANewPos to AChildren.Count - 1 do
begin begin
child := TWinControlHack(AChildren[n]); Child := TWinControlHack(AChildren[n]);
if child.HandleAllocated then if Child.HandleAllocated then
TGtkPrivateWidgetClass( TGtkPrivateWidgetClass(
child.WidgetSetClass.WSPrivate).SetZPosition(child, wszpFront); Child.WidgetSetClass.WSPrivate).SetZPosition(Child, wszpBack);
end; end;
end; end;
end; end;