mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 22:59:56 +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.contentType := kControlContentCGImageRef;
|
||||||
ContentInfo.imageRef := nil;
|
ContentInfo.imageRef := nil;
|
||||||
|
|
||||||
if AGlyph <> nil then
|
if (AGlyph <> nil) and (AGlyph.Width > 0) and (AGlyph.Height > 0) then
|
||||||
begin
|
begin
|
||||||
if TObject(AGlyph.Handle) is TCarbonBitmap then
|
if TObject(AGlyph.Handle) is TCarbonBitmap then
|
||||||
begin
|
begin
|
||||||
@ -433,6 +433,8 @@ begin
|
|||||||
finally
|
finally
|
||||||
CGImageRelease(ContentInfo.imageRef);
|
CGImageRelease(ContentInfo.imageRef);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
SetLayout((LCLObject as TCustomBitBtn).Layout);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -445,12 +447,18 @@ procedure TCarbonBitBtn.SetLayout(ALayout: TButtonLayout);
|
|||||||
var
|
var
|
||||||
Placement: ControlButtonTextPlacement;
|
Placement: ControlButtonTextPlacement;
|
||||||
begin
|
begin
|
||||||
case ALayout of
|
with (LCLObject as TCustomBitBtn) do
|
||||||
blGlyphLeft : Placement := kControlBevelButtonPlaceToRightOfGraphic;
|
if (Glyph <> nil) and (Glyph.Width > 0) and (Glyph.Height > 0) then
|
||||||
blGlyphRight : Placement := kControlBevelButtonPlaceToLeftOfGraphic;
|
begin
|
||||||
blGlyphTop : Placement := kControlBevelButtonPlaceBelowGraphic;
|
case ALayout of
|
||||||
blGlyphBottom: Placement := kControlBevelButtonPlaceAboveGraphic;
|
blGlyphLeft : Placement := kControlBevelButtonPlaceToRightOfGraphic;
|
||||||
end;
|
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),
|
OSError(SetBevelButtonTextPlacement(ControlRef(Widget), Placement),
|
||||||
Self, 'SetLayout', 'SetBevelButtonTextPlacement');
|
Self, 'SetLayout', 'SetBevelButtonTextPlacement');
|
||||||
|
@ -582,7 +582,7 @@ begin
|
|||||||
AHandle := nil;
|
AHandle := nil;
|
||||||
CGImage := nil;
|
CGImage := nil;
|
||||||
|
|
||||||
if ABitmap <> nil then
|
if (ABitmap <> nil) and (ABitmap.Width > 0) and (ABitmap.Height > 0) then
|
||||||
begin
|
begin
|
||||||
if not CheckBitmap(ABitmap.Handle, SName) then Exit;
|
if not CheckBitmap(ABitmap.Handle, SName) then Exit;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user