Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

IconMBS class

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class Icon Service MBS Picture Plugin 2.6 Yes No No Yes, macOS only No
Function: A class for an icon on Mac OS.
Example:
// A function which will try to return an icon for the given type/creator including the Mask.

Function GetIconPicture(macCreator as string, macType as string, size as Integer) As picture
dim icn as IconMBS
dim icf as IconFamilyMBS
dim pic, tmp as Picture

icn = new IconMBS(macType, macCreator)

if icn<>nil and icn.valid then
icf = icn.IconFamily
end if

if icf<>nil and icf.Valid then
pic = NewPicture(size, size, 32)

// Try Thumbnail
if size>32 then
tmp = icf.Thumbnail32BitData
if tmp<>nil then
pic.Graphics.DrawPicture tmp, 0, 0, size, size, 0, 0, tmp.width,tmp.Height

tmp = icf.Thumbnail8BitMask
if tmp<>nil then
pic.Mask.Graphics.DrawPicture tmp, 0, 0, size, size, 0, 0, tmp.width, tmp.Height
end if
Return pic
end if
end if

// Try Large Icon in 32 bit
tmp = icf.Large32BitData
if tmp<>nil then
pic.Graphics.DrawPicture tmp, 0, 0, size, size, 0, 0, tmp.width,tmp.Height

tmp = icf.Large8BitMask
if tmp<>nil then
pic.Mask.Graphics.DrawPicture tmp, 0, 0, size, size, 0, 0, tmp.width, tmp.Height
end if
Return pic
end if

// Try Large Icon in 8 bit
tmp = icf.Large8BitData
if tmp<>nil then
pic.Graphics.DrawPicture tmp, 0, 0, size, size, 0, 0, tmp.width,tmp.Height

tmp = icf.Large1BitMask
if tmp<>nil then
pic.Mask.Graphics.DrawPicture tmp, 0, 0, size, size, 0, 0, tmp.width, tmp.Height
end if
return pic
end if

// You may add more like e.g. Small or Huge Icons
end if


Exception // on any error, just return nil


// Call like:
// Backdrop=GetIconPicture("R*ch","TEXT",128)
End Function

Feedback, Comments & Corrections

This class has no sub classes.

Some useful global functions for this class:

Some methods using this class:

Some examples which use this class:


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


IconFamilyMBS   -   ICScannerBandDataMBS




Links
MBS Xojo blog