Platforms to show: All Mac Windows Linux Cross-Platform

/MacControls/Popupmenu Retina Icons


You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacControls/Popupmenu Retina Icons

This example is the version from Fri, 24th Jul 2014.

Project "Popupmenu Retina Icons.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control PopupMenu1 Inherits PopupMenu
ControlInstance PopupMenu1 Inherits PopupMenu
EventHandler Sub Open() me.DeleteAllRows me.AddRow "Normal resolution" me.AddRow "Double resolution" me.AddRow "Auto select resolution" dim popup as NSPopUpButtonMBS = me.NSPopUpButtonMBS dim menu as NSMenuMBS = popup.menu // make 1x icon dim p1 as Picture = new Picture(16,16,32) dim m1 as Picture = p1.mask dim pg1 as Graphics = p1.Graphics dim mg1 as Graphics = m1.Graphics pg1.ForeColor = &cFF0000 pg1.FillRect 0, 0, pg1.Width, pg1.Height mg1.ForeColor = &cFFFFFF mg1.FillRect 0, 0, pg1.Width, pg1.Height mg1.ForeColor = &c000000 mg1.FillOval 0, 0, pg1.Width, pg1.Height dim n1 as new NSImageMBS(p1,m1) 'Backdrop = n1.CopyPictureWithMask dim item0 as NSMenuItemMBS = menu.Item(0) item0.image = n1 // make 2x icon dim p2 as new Picture(32,32,32) dim m2 as Picture = p2.mask dim pg2 as Graphics = p2.Graphics dim mg2 as Graphics = m2.Graphics pg2.ForeColor = &c00FF00 pg2.FillRect 0, 0, pg2.Width, pg2.Height mg2.ForeColor = &cFFFFFF mg2.FillRect 0, 0, pg2.Width, pg2.Height mg2.ForeColor = &c000000 mg2.FillOval 0, 0, pg2.Width, pg2.Height dim n2 as new NSImageMBS(p2,m2) n2.setSize 16,16 dim item1 as NSMenuItemMBS = menu.Item(1) item1.image = n2 'Backdrop = p2.mask // now make auto select dim n3 as new NSImageMBS(p1,m1) dim n4 as new NSBitmapImageRepMBS(p2) n3.addRepresentation n4 dim item2 as NSMenuItemMBS = menu.Item(2) item2.image = n3 End EventHandler
End Control
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
SetRetina
End SetRetina
End Project

See also:

The items on this page are in the following plugins: MBS MacControls Plugin.


The biggest plugin in space...