fixed resize request

git-svn-id: trunk@1342 -
This commit is contained in:
mattias 2002-02-09 01:48:18 +00:00
parent cf9e76c8ff
commit 7f5f2fa537
2 changed files with 51 additions and 39 deletions

View File

@ -2233,8 +2233,7 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TWinControl.DestroyWnd; procedure TWinControl.DestroyWnd;
begin begin
if FHandle <> 0 then if HandleAllocated then begin
begin
DestroyComponent; DestroyComponent;
FHandle := 0; FHandle := 0;
end; end;
@ -2512,6 +2511,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.102 2002/11/27 15:40:36 mattias
fixed resize request
Revision 1.101 2002/11/21 18:49:53 mattias Revision 1.101 2002/11/21 18:49:53 mattias
started OnMouseEnter and OnMouseLeave started OnMouseEnter and OnMouseLeave

View File

@ -42,7 +42,10 @@ begin
FPaintMessages.OwnerHashFunction := @HashPaintMessage; FPaintMessages.OwnerHashFunction := @HashPaintMessage;
WaitingForMessages := false; WaitingForMessages := false;
FWidgetsWithResizeRequest := TDynHashArray.Create(-1); FWidgetsWithResizeRequest := TDynHashArray.Create(-1);
FWidgetsWithResizeRequest.Options:=
FWidgetsWithResizeRequest.Options+[dhaoCacheContains];
FWidgetsResized := TDynHashArray.Create(-1); FWidgetsResized := TDynHashArray.Create(-1);
FWidgetsResized.Options:=FWidgetsResized.Options+[dhaoCacheContains];
FFixWidgetsResized := TDynHashArray.Create(-1); FFixWidgetsResized := TDynHashArray.Create(-1);
FTimerData := TList.Create; FTimerData := TList.Create;
FDefaultFont:= nil; FDefaultFont:= nil;
@ -463,7 +466,7 @@ procedure TGtkObject.SendCachedGtkMessages;
if (FFixWidgetsResized.Count=0) and (FWidgetsResized.Count=0) then exit; if (FFixWidgetsResized.Count=0) and (FWidgetsResized.Count=0) then exit;
List:=TList.Create; List:=TList.Create;
{ if any fixed widget was resized then a client area of a LCL control was { if any fixed widget was resized then a client area of a LCL control was
resized resized
-> invalidate client rectangles -> invalidate client rectangles
@ -492,15 +495,17 @@ procedure TGtkObject.SendCachedGtkMessages;
{$IFDEF VerboseSizeMsg} {$IFDEF VerboseSizeMsg}
writeln('HHH2 SendCachedGtkClientResizeNotifications SizeMsgCount=',FWidgetsResized.Count); writeln('HHH2 SendCachedGtkClientResizeNotifications SizeMsgCount=',FWidgetsResized.Count);
{$ENDIF} {$ENDIF}
FWidgetsResized.AssignTo(List); repeat
for i:=0 to List.Count-1 do begin MainWidget:=FWidgetsResized.First;
MainWidget:=List[i]; if MainWidget<>nil then begin
if not FWidgetsWithResizeRequest.Contains(MainWidget) then begin FWidgetsResized.Remove(MainWidget);
SendSizeNotificationToLCL(MainWidget); if not FWidgetsWithResizeRequest.Contains(MainWidget) then begin
FixWidget:=GetFixedWidget(MainWidget); SendSizeNotificationToLCL(MainWidget);
end; FixWidget:=GetFixedWidget(MainWidget);
end; end;
end else break;
until false;
{ if any client area was resized, which MainWidget Size was already in sync { if any client area was resized, which MainWidget Size was already in sync
with the LCL, no message was send. So, tell each changed client area to with the LCL, no message was send. So, tell each changed client area to
check its size. check its size.
@ -508,17 +513,19 @@ procedure TGtkObject.SendCachedGtkMessages;
{$IFDEF VerboseSizeMsg} {$IFDEF VerboseSizeMsg}
writeln('HHH3 SendCachedGtkClientResizeNotifications Updating ClientRects ...'); writeln('HHH3 SendCachedGtkClientResizeNotifications Updating ClientRects ...');
{$ENDIF} {$ENDIF}
FFixWidgetsResized.AssignTo(List); repeat
for i:=0 to List.Count-1 do begin FixWidget:=FFixWidgetsResized.First;
FixWidget:=List[i]; if FixWidget<>nil then begin
MainWidget:=GetMainWidget(FixWidget); FFixWidgetsResized.Remove(FixWidget);
LCLControl:=TWinControl(GetLCLObject(MainWidget)); MainWidget:=GetMainWidget(FixWidget);
LCLControl.DoAdjustClientRectChange; LCLControl:=TWinControl(GetLCLObject(MainWidget));
end; LCLControl.DoAdjustClientRectChange;
end else begin
break;
end;
until false;
List.Free; List.Free;
FWidgetsResized.Clear;
FFixWidgetsResized.Clear;
{$IFDEF VerboseSizeMsg} {$IFDEF VerboseSizeMsg}
writeln('HHH4 SendCachedGtkClientResizeNotifications completed.'); writeln('HHH4 SendCachedGtkClientResizeNotifications completed.');
{$ENDIF} {$ENDIF}
@ -879,7 +886,7 @@ Begin
aParent := aWinControl.Parent; aParent := aWinControl.Parent;
if aParent<>nil then begin if aParent<>nil then begin
// remove and insert the control // remove and insert the control
// this will destroy all child handles // this will destroy and recreate all child handles
aWinControl.Parent := nil; aWinControl.Parent := nil;
aWinControl.Parent := aParent; aWinControl.Parent := aParent;
end; end;
@ -3156,8 +3163,23 @@ begin
RemoveCallbacks(Sender); RemoveCallbacks(Sender);
if Sender is TControl then begin
case TControl(Sender).fCompStyle of
csComboBox:
begin
SetComboBoxText(PGtkCombo(Handle),nil);
FreeWinWidgetInfo(PGtkCombo(Handle)^.Entry);
FreeWinWidgetInfo(PGtkCombo(Handle)^.Button);
end;
end;
end
else if Sender is TCommonDialog then begin
DestroyCommonDialogAddOns(TCommonDialog(Sender));
end;
// remove pending size messages // remove pending size messages
FWidgetsWithResizeRequest.Remove(Widget); UnsetResizeRequest(Widget);
FWidgetsResized.Remove(Widget); FWidgetsResized.Remove(Widget);
if FixWidget<>Widget then if FixWidget<>Widget then
FFixWidgetsResized.Remove(FixWidget); FFixWidgetsResized.Remove(FixWidget);
@ -3186,21 +3208,6 @@ begin
then then
DestroyCaret(Handle); DestroyCaret(Handle);
if Sender is TControl then begin
case TControl(Sender).fCompStyle of
csComboBox:
begin
SetComboBoxText(PGtkCombo(Handle),nil);
FreeWinWidgetInfo(PGtkCombo(Handle)^.Entry);
FreeWinWidgetInfo(PGtkCombo(Handle)^.Button);
end;
end;
end
else if Sender is TCommonDialog then begin
DestroyCommonDialogAddOns(TCommonDialog(Sender));
end;
// destroy the widget // destroy the widget
DestroyWidget(Widget); DestroyWidget(Widget);
@ -6714,6 +6721,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.293 2002/11/27 15:40:36 mattias
fixed resize request
Revision 1.292 2002/11/23 13:48:44 mattias Revision 1.292 2002/11/23 13:48:44 mattias
added Timer patch from Vincent Snijders added Timer patch from Vincent Snijders