PopupNotifier: it's THintWindow now, so it does not activate itself when shown, also small cleanup maded.

git-svn-id: trunk@25797 -
This commit is contained in:
zeljko 2010-05-31 07:31:46 +00:00
parent e2ad22aaa0
commit 03ad994dfc

View File

@ -56,7 +56,7 @@ type
{ TNotifierForm } { TNotifierForm }
TNotifierForm = class(TCustomForm) TNotifierForm = class(THintWindow)
private private
lblTitle: TLabel; lblTitle: TLabel;
lblText: TLabel; lblText: TLabel;
@ -64,10 +64,10 @@ type
btnX: TNotifierXButton; btnX: TNotifierXButton;
procedure HideForm(Sender: TObject); procedure HideForm(Sender: TObject);
procedure HandleResize(Sender: TObject); procedure HandleResize(Sender: TObject);
procedure HandlePaint(Sender: TObject);
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
procedure Paint; override;
end; end;
{ TPopupNotifier } { TPopupNotifier }
@ -241,10 +241,6 @@ begin
// Connects the methods to events // Connects the methods to events
OnClick := HideForm; OnClick := HideForm;
OnShow := HandleResize; OnShow := HandleResize;
{$ifdef Unix}
OnPaint := HandlePaint; // Fix for TForm.Color not working on gtk
{$endif}
end; end;
{******************************************************************* {*******************************************************************
@ -262,6 +258,16 @@ begin
inherited Destroy; inherited Destroy;
end; 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 () * TNotifierForm.HideForm ()
* *
@ -289,16 +295,6 @@ begin
else else
IconAdjust := 0; 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 if (lblTitle <> nil) then
begin begin
lblTitle.Left := IconAdjust + INT_NOTIFIER_SPACING; lblTitle.Left := IconAdjust + INT_NOTIFIER_SPACING;
@ -324,22 +320,6 @@ begin
end; end;
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 } { TPopupNotifier }
{******************************************************************* {*******************************************************************