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:
tombo 2008-09-17 13:26:28 +00:00
parent c3e3cf9a44
commit cc181b888f
2 changed files with 16 additions and 8 deletions

View File

@ -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');

View File

@ -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;