Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

[MBS] Retina and icons in menus (MBS Xojo Plugin Mailinglist archive)

Back to the thread list
Previous thread: [MBS] CheckCache Plugin crashing RS 2012r1.2
Next thread: [MBS] SQL Plugin


[MBS] QLPreviewViewMBS   -   Garth Hjelte
  [MBS] Retina and icons in menus   -   Beatrix Willius
   Re: [MBS] Retina and icons in menus   -   Beatrix Willius
   Re: [MBS] Retina and icons in menus   -   Christian Schmitz

[MBS] Retina and icons in menus
Date: 12.01.13 11:49 (Sat, 12 Jan 2013 11:49:47 +0100)
From: Beatrix Willius
Hi,

I'm in progress on Retina-fying my application. There are 2 places where I have issues with icons in a menu and I'm not sure if it's me, RealStudio or MBS:

1. Add application icon to popup menu:

dim thePopup as NSPopUpButtonMBS = me.NSPopUpButtonMBS
for currentApp = 0 to numberOfMailApps
dim theItem as NSMenuItemMBS = thePopup.itemAtIndex(CurrentApp)
theItem.Image = GetApplicationIcon(SupportedMailApps(currentApp)))
next

where GetApplicationIcon is:

Private Function GetApplicationIcon(theBundleIdentifier as String) As NSImageMBS

dim theApp as FolderItem = LaunchServicesFindApplicationForInfoMBS("", theBundleIdentifier,"")

dim theIcon as Picture
if RetinaScaleFactor = 1 then
theIcon = theApp.IconMBS(16)
else
theIcon = theApp.IconMBS(32)
end if

dim FinalImage as new NSImageMBS(theIcon)
Return FinalImage

End Function

The icons are available at retina, but they are drawn in double size and not with retina resolution.

2. Add icon for desktop etc. folder. Should the following work:

Private Function getIconFromFolder(theFolder as FolderItem) As Picture

dim theIconM as new IconMBS(theFolder)
dim theFamily as IconFamilyMBS = theIconM.IconFamily
dim theIcon as Picture
if RetinaScaleFactor = 1 then
theIcon = theFamily.Small32BitData
theIcon.Mask = theFamily.Small8BitMask
else
theIcon = theFamily.Large32BitData
theIcon.Mask = theFamily.Large8BitMask
end if
Return theIcon

End Function

This returns only 32x32 pixel icons. I need icons for desktop, home and documents folder.



Mit freundlichen Grüßen/Regards

Trixi Willius

http://www.mothsoftware.com
Mail Archiver X: The email archiving solution for professionals
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Re: [MBS] Retina and icons in menus
Date: 13.01.13 14:34 (Sun, 13 Jan 2013 14:34:35 +0100)
From: Beatrix Willius
Thanks! Got it.

On 12.01.2013, at 17:56, Christian Schmitz <<email address removed>> wrote:

>
> Am 12.01.2013 um 11:49 schrieb Beatrix Willius <<email address removed>>:
>
>> Hi,
>>
>> I'm in progress on Retina-fying my application. There are 2 places where I have issues with icons in a menu and I'm not sure if it's me, RealStudio or MBS:
>>
>> The icons are available at retina, but they are drawn in double size and not with retina resolution.
>
> With NSImageMBS you need to create the image and set the size to the half.
>
> dim p as picture = LogoMBS(500)
> dim n as new NSImageMBS(p)
> n.setSize 250,250
>
> so the system knows it's a high res image as pixel width and width are not identical.
>
>> This returns only 32x32 pixel icons. I need icons for desktop, home and documents folder.
>
>
> You may better use the functions where you pass a size. For retina pass double the size and later use setSize for NSImage.

Mit freundlichen Grüßen/Regards

Trixi Willius

http://www.mothsoftware.com
Mail Archiver X: The email archiving solution for professionals

_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Re: [MBS] Retina and icons in menus
Date: 12.01.13 17:56 (Sat, 12 Jan 2013 17:56:20 +0100)
From: Christian Schmitz

Am 12.01.2013 um 11:49 schrieb Beatrix Willius <<email address removed>>:

> Hi,
>
> I'm in progress on Retina-fying my application. There are 2 places where I have issues with icons in a menu and I'm not sure if it's me, RealStudio or MBS:
>
> The icons are available at retina, but they are drawn in double size and not with retina resolution.

With NSImageMBS you need to create the image and set the size to the half.

dim p as picture = LogoMBS(500)
dim n as new NSImageMBS(p)
n.setSize 250,250

so the system knows it's a high res image as pixel width and width are not identical.

> This returns only 32x32 pixel icons. I need icons for desktop, home and documents folder.

You may better use the functions where you pass a size. For retina pass double the size and later use setSize for NSImage.

Greetings
Christian