mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 10:59:29 +02:00
LCL carbon: set empty image, if bitbtn or menu item bitmap width or height is zero, fixes #0011710: Carbon: Small dot now on left side of menu items and button labels
git-svn-id: trunk@16619 -
This commit is contained in:
parent
c3e3cf9a44
commit
cc181b888f
@ -408,7 +408,7 @@ begin
|
||||
ContentInfo.contentType := kControlContentCGImageRef;
|
||||
ContentInfo.imageRef := nil;
|
||||
|
||||
if AGlyph <> nil then
|
||||
if (AGlyph <> nil) and (AGlyph.Width > 0) and (AGlyph.Height > 0) then
|
||||
begin
|
||||
if TObject(AGlyph.Handle) is TCarbonBitmap then
|
||||
begin
|
||||
@ -433,6 +433,8 @@ begin
|
||||
finally
|
||||
CGImageRelease(ContentInfo.imageRef);
|
||||
end;
|
||||
|
||||
SetLayout((LCLObject as TCustomBitBtn).Layout);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -445,12 +447,18 @@ procedure TCarbonBitBtn.SetLayout(ALayout: TButtonLayout);
|
||||
var
|
||||
Placement: ControlButtonTextPlacement;
|
||||
begin
|
||||
case ALayout of
|
||||
blGlyphLeft : Placement := kControlBevelButtonPlaceToRightOfGraphic;
|
||||
blGlyphRight : Placement := kControlBevelButtonPlaceToLeftOfGraphic;
|
||||
blGlyphTop : Placement := kControlBevelButtonPlaceBelowGraphic;
|
||||
blGlyphBottom: Placement := kControlBevelButtonPlaceAboveGraphic;
|
||||
end;
|
||||
with (LCLObject as TCustomBitBtn) do
|
||||
if (Glyph <> nil) and (Glyph.Width > 0) and (Glyph.Height > 0) then
|
||||
begin
|
||||
case ALayout of
|
||||
blGlyphLeft : Placement := kControlBevelButtonPlaceToRightOfGraphic;
|
||||
blGlyphRight : Placement := kControlBevelButtonPlaceToLeftOfGraphic;
|
||||
blGlyphTop : Placement := kControlBevelButtonPlaceBelowGraphic;
|
||||
blGlyphBottom: Placement := kControlBevelButtonPlaceAboveGraphic;
|
||||
end;
|
||||
end
|
||||
else // if Glyph is empty, then align center
|
||||
Placement := kControlBevelButtonPlaceNormally;
|
||||
|
||||
OSError(SetBevelButtonTextPlacement(ControlRef(Widget), Placement),
|
||||
Self, 'SetLayout', 'SetBevelButtonTextPlacement');
|
||||
|
@ -582,7 +582,7 @@ begin
|
||||
AHandle := nil;
|
||||
CGImage := nil;
|
||||
|
||||
if ABitmap <> nil then
|
||||
if (ABitmap <> nil) and (ABitmap.Width > 0) and (ABitmap.Height > 0) then
|
||||
begin
|
||||
if not CheckBitmap(ABitmap.Handle, SName) then Exit;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user