LCL, TCoolbar: Replace Resize with WMSize. Issue #26096, patch from Vojtech Cihak.

git-svn-id: trunk@44994 -
This commit is contained in:
juha 2014-05-10 14:40:17 +00:00
parent 6ec7357462
commit 8dc1a9ed65
2 changed files with 6 additions and 18 deletions

View File

@ -2361,8 +2361,6 @@ type
FDragBand: TDragBand; FDragBand: TDragBand;
FDraggedBandIndex: Integer; // -1 .. space below the last row; other negative .. invalid area FDraggedBandIndex: Integer; // -1 .. space below the last row; other negative .. invalid area
FDragInitPos: Integer; // Initial mouse X - position (for resizing Bands) FDragInitPos: Integer; // Initial mouse X - position (for resizing Bands)
FPrevHeight: Integer;
FPrevWidth: Integer;
FTextHeight: Integer; FTextHeight: Integer;
procedure AlignControls(AControl: TControl; var RemainingClientRect: TRect); override; procedure AlignControls(AControl: TControl; var RemainingClientRect: TRect); override;
procedure BitmapOrImageListChange(Sender: TObject); procedure BitmapOrImageListChange(Sender: TObject);
@ -2383,8 +2381,8 @@ type
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override; procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure Paint; override; procedure Paint; override;
procedure Resize; override;
procedure SetAlign(aValue: TAlign); reintroduce; procedure SetAlign(aValue: TAlign); reintroduce;
procedure WMSize(var Message: TLMSize); message LM_SIZE;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;

View File

@ -504,8 +504,6 @@ begin
if aCountM1 >= 0 then EnableAutoSizing; if aCountM1 >= 0 then EnableAutoSizing;
dec(FUpdateCount); dec(FUpdateCount);
end; end;
FPrevWidth := Width;
FPrevHeight := Height;
end; end;
procedure TCustomCoolBar.CalculatePreferredSize(var PreferredWidth, PreferredHeight: Integer; procedure TCustomCoolBar.CalculatePreferredSize(var PreferredWidth, PreferredHeight: Integer;
@ -957,19 +955,11 @@ begin
end; end;
end; end;
procedure TCustomCoolBar.Resize; procedure TCustomCoolBar.WMSize(var Message: TLMSize);
var aWidth, aHeight: Integer;
begin begin
//DebugLn('Resize'); //DebugLn('WMSize');
inherited Resize; inherited WMSize(Message);
aWidth := Width;
aHeight := Height;
if ((aWidth <> FPrevWidth) or (aHeight <> FPrevHeight))
and (aWidth*aHeight > 0) and HandleAllocated then
begin
//DebugLn('Resize calls CalcAndAlign');
CalculateAndAlign; CalculateAndAlign;
Invalidate; //Required by GTK2 Invalidate; //Required by GTK2
end; end;
end;