From 03ad994dfce8a6a7c29b644656955361c60a79ad Mon Sep 17 00:00:00 2001 From: zeljko Date: Mon, 31 May 2010 07:31:46 +0000 Subject: [PATCH] PopupNotifier: it's THintWindow now, so it does not activate itself when shown, also small cleanup maded. git-svn-id: trunk@25797 - --- lcl/popupnotifier.pas | 44 ++++++++++++------------------------------- 1 file changed, 12 insertions(+), 32 deletions(-) diff --git a/lcl/popupnotifier.pas b/lcl/popupnotifier.pas index db0d48827b..e8c4f2047e 100644 --- a/lcl/popupnotifier.pas +++ b/lcl/popupnotifier.pas @@ -56,7 +56,7 @@ type { TNotifierForm } - TNotifierForm = class(TCustomForm) + TNotifierForm = class(THintWindow) private lblTitle: TLabel; lblText: TLabel; @@ -64,10 +64,10 @@ type btnX: TNotifierXButton; procedure HideForm(Sender: TObject); procedure HandleResize(Sender: TObject); - procedure HandlePaint(Sender: TObject); public constructor Create(AOwner: TComponent); override; destructor Destroy; override; + procedure Paint; override; end; { TPopupNotifier } @@ -241,10 +241,6 @@ begin // Connects the methods to events OnClick := HideForm; OnShow := HandleResize; - -{$ifdef Unix} - OnPaint := HandlePaint; // Fix for TForm.Color not working on gtk -{$endif} end; {******************************************************************* @@ -262,6 +258,16 @@ begin inherited Destroy; end; +procedure TNotifierForm.Paint; +begin + Canvas.Brush.Style := bsSolid; + Canvas.Brush.Color := Color; + Canvas.FillRect(Rect(0,0,width,height)); + + { Paints the icon. We can't use a TImage because it's on ExtCtrls } + if Assigned(imgIcon.Bitmap) then Canvas.Draw(5, 5, imgIcon.Bitmap); +end; + {******************************************************************* * TNotifierForm.HideForm () * @@ -288,16 +294,6 @@ begin IconAdjust := INT_NOTIFIER_SPACING + imgIcon.Bitmap.Width else IconAdjust := 0; - -{ if (ImgIcon.Bitmap <> nil) then - begin - ImgIcon.Left := 5; - ImgIcon.Top := 5; - - // Workaround for autosize not working as expected - ImgIcon.Width := ImgIcon.Picture.Width; - ImgIcon.Height := ImgIcon.Picture.Height; - end;} if (lblTitle <> nil) then begin @@ -324,22 +320,6 @@ begin end; end; -{******************************************************************* -* TNotifierForm.HandlePaint () -* -*******************************************************************} -procedure TNotifierForm.HandlePaint(Sender: TObject); -begin - { Temporary fix for TForm.Color not working on Gtk - Remove when the bug is fixed! } - Canvas.Brush.Style := bsSolid; - Canvas.Brush.Color := Color; - Canvas.FillRect(Rect(0,0,width,height)); - - { Paints the icon. We can't use a TImage because it's on ExtCtrls } - if Assigned(imgIcon.Bitmap) then Canvas.Draw(5, 5, imgIcon.Bitmap); -end; - { TPopupNotifier } {*******************************************************************