diff --git a/lcl/extctrls.pp b/lcl/extctrls.pp index 8b2dcc0ea0..65a8f6788e 100644 --- a/lcl/extctrls.pp +++ b/lcl/extctrls.pp @@ -1112,6 +1112,7 @@ type FOnPaint, FOnClick, FOnDblClick: TNotifyEvent; FOnMouseDown, FOnMouseUp: TMouseEvent; FOnMouseMove: TMouseMoveEvent; + function GetCanvas: TCanvas; procedure SetHint(const AValue: string); procedure SetIcon(const AValue: TIcon); procedure SetVisible(Value: Boolean); @@ -1132,6 +1133,7 @@ type property BalloonHint: string read FBalloonHint write FBalloonHint; property BalloonTimeout: Integer read FBalloonTimeout write FBalloonTimeout default 3000; property BalloonTitle: string read FBalloonTitle write FBalloonTitle; + property Canvas: TCanvas read GetCanvas; property PopUpMenu: TPopupMenu read FPopUpMenu write FPopUpMenu; property Icon: TIcon read FIcon write SetIcon; property Hint: string read FHint write SetHint; diff --git a/lcl/graphics.pp b/lcl/graphics.pp index 4e955bc833..885e2bc659 100644 --- a/lcl/graphics.pp +++ b/lcl/graphics.pp @@ -1171,7 +1171,6 @@ type procedure WriteData(Stream: TStream); override; procedure WriteStream(AStream: TMemoryStream); virtual; abstract; function RequestTransparentColor: TColor; - property Canvas: TCanvas read GetCanvas; public constructor Create; override; destructor Destroy; override; @@ -1200,6 +1199,7 @@ type function ReleasePalette: HPALETTE; function CreateIntfImage: TLazIntfImage; public + property Canvas: TCanvas read GetCanvas; function HandleAllocated: boolean; property BitmapHandle: HBITMAP read GetBitmapHandle write SetBitmapHandle; property Masked: Boolean read GetMasked write SetMasked; @@ -1287,7 +1287,6 @@ type procedure SetHandles(ABitmap, AMask: HBITMAP); override; procedure SetSize(AWidth, AHeight: integer); override; - property Canvas; property Handle: HBITMAP read GetBitmapHandle write SetBitmapHandle; // for custombitmap handle = bitmaphandle property HandleType: TBitmapHandleType read GetHandleType write SetHandleType; property Monochrome: Boolean read GetMonochrome write SetMonochrome; diff --git a/lcl/include/customtrayicon.inc b/lcl/include/customtrayicon.inc index c02090b7ca..8c72ded627 100644 --- a/lcl/include/customtrayicon.inc +++ b/lcl/include/customtrayicon.inc @@ -223,6 +223,22 @@ begin Result := TWSCustomTrayIconClass(WidgetSetClass).GetPosition(Self); end; +{******************************************************************* +* TCustomTrayIcon.GetCanvas () +* +* DESCRIPTION: Getter method of the Canvas property +* +* PARAMETERS: None +* +* RETURNS: The canvas of the underlaying Widgetset component +* +*******************************************************************} +function TCustomTrayIcon.GetCanvas: TCanvas; +begin + //Result := Icon.Canvas; + Result := TWSCustomTrayIconClass(WidgetSetClass).GetCanvas(Self); +end; + procedure TCustomTrayIcon.SetHint(const AValue: string); begin FHint := AValue; diff --git a/lcl/include/rasterimage.inc b/lcl/include/rasterimage.inc index 79e868ee3c..a671905c20 100644 --- a/lcl/include/rasterimage.inc +++ b/lcl/include/rasterimage.inc @@ -230,7 +230,8 @@ var SrcDC: hDC; DestDC: hDC; begin - if (DestRect.Right<=DestRect.Left) or (DestRect.Bottom<=DestRect.Top) or Empty + if (DestRect.Right<=DestRect.Left) or (DestRect.Bottom<=DestRect.Top) + or (Width=0) or (Height=0) then Exit; BitmapHandleNeeded; diff --git a/lcl/widgetset/wsextctrls.pp b/lcl/widgetset/wsextctrls.pp index 258773cd19..895e601e53 100644 --- a/lcl/widgetset/wsextctrls.pp +++ b/lcl/widgetset/wsextctrls.pp @@ -172,6 +172,7 @@ type class procedure InternalUpdate(const ATrayIcon: TCustomTrayIcon); virtual; class function ShowBalloonHint(const ATrayIcon: TCustomTrayIcon): Boolean; virtual; class function GetPosition(const ATrayIcon: TCustomTrayIcon): TPoint; virtual; + class function GetCanvas(const ATrayIcon: TCustomTrayIcon): TCanvas; virtual; end; TWSCustomTrayIconClass = class of TWSCustomTrayIcon; @@ -332,6 +333,11 @@ begin Result := Point(0, 0); end; +class function TWSCustomTrayIcon.GetCanvas(const ATrayIcon: TCustomTrayIcon): TCanvas; +begin + Result := ATrayIcon.Icon.Canvas; +end; + initialization ////////////////////////////////////////////////////