diff --git a/examples/trayicon/wndtray.lpi b/examples/trayicon/wndtray.lpi index ac5f7e4ccc..ef610682ea 100644 --- a/examples/trayicon/wndtray.lpi +++ b/examples/trayicon/wndtray.lpi @@ -29,7 +29,7 @@ - + @@ -44,11 +44,6 @@ - - - - - diff --git a/lcl/interfaces/carbon/carbontrayicon.inc b/lcl/interfaces/carbon/carbontrayicon.inc index a4adc03bd0..46f3a7c012 100644 --- a/lcl/interfaces/carbon/carbontrayicon.inc +++ b/lcl/interfaces/carbon/carbontrayicon.inc @@ -28,6 +28,11 @@ begin Result := True; end; +{ + Documentation for converting a CGImageRef to a NSImage can be found here: + + http://www.cocoadev.com/index.pl?CGImageRef +} class function TCarbonWSCustomTrayIcon.Show(const ATrayIcon: TCustomTrayIcon): Boolean; var APrivateTrayIcon: TPrivateCocoaCarbonTrayIcon; @@ -51,12 +56,6 @@ begin { Convert our CFImageRef to a NSImage } -{ NSImage* image = [[NSImage alloc] initWithSize:rect.size]; - [image lockFocus]; - CGContextDrawImage([[NSGraphicsContext currentContext] - graphicsPort], *(CGRect*)&rect, imageRef); - [image unlockFocus];} - ASize.width := TCarbonBitmap(ATrayIcon.Icon.Handle).Width; ASize.height := TCarbonBitmap(ATrayIcon.Icon.Handle).Height; ACGRect.size.width := ASize.width; @@ -79,11 +78,18 @@ begin {$endif VerboseCarbonTrayIcon} APrivateTrayIcon.image.unlockFocus; + { Inserts the menu } + + if ATrayIcon.PopUpMenu <> nil then + begin + + end; + { Shows the icon } if APrivateTrayIcon.item <> nil then Exit(True); - APrivateTrayIcon.item := APrivateTrayIcon.bar.statusItemWithLength(NSSquareStatusItemLength); + APrivateTrayIcon.item := NSStatusItem.CreateWithHandle(APrivateTrayIcon.bar.statusItemWithLength(NSSquareStatusItemLength)); APrivateTrayIcon.item.retain(); APrivateTrayIcon.item.setImage(APrivateTrayIcon.image);