Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

IconMBS.Constructor(f as folderitem, NoBadge as boolean = false)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Icon Service MBS Picture Plugin 2.6 Yes No No Yes, macOS only No
Function: Loads the icon for this file/folder/volume.
Example:
// in a paint event:

dim i as new IconMBS(SpecialFolder.Desktop)

i.DrawIcon(g, 0, 0, 128, 128)
Notes:
The example "GetIcon.rb" shows how to get the file icons.
A custom icon is preferred (ID -16455).

NoBadge can be set to true to have no badges on the icon.

See also:

Feedback, Comments & Corrections

IconMBS.Constructor(type as string, creator as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Icon Service MBS Picture Plugin 2.6 Yes No No Yes, macOS only No
Function: Loads the icon for this type and creator code combination.
Example:
// in a paint event:

dim i as new IconMBS("FNDR", "MACS")

i.DrawIcon(g, 0, 0, 128, 128)
Notes: The example "GetIcon.rb" shows how to get the predefined icons from the system.

See also:

Feedback, Comments & Corrections

IconMBS.Constructor(type as string, creator as string, extension as string, mime as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Icon Service MBS Picture Plugin 9.2 Yes No No Yes, macOS only No
Function: Loads the icon base on the given information.
Example:
Sub Paint(g As Graphics)
// in a window paint event:

dim i as IconMBS
dim type, creator, extension, mime as string

type=""
creator=""
extension="jpg"
mime=""

i=new iconmbs(type, creator, extension, mime)
// draws jpeg icon
i.DrawIcon(g,0,0,128,128)

type=""
creator=""
extension=""
mime="video/quicktime"

i=new iconmbs(type, creator, extension, mime)
// draws quicktime movie icon
i.DrawIcon(g,128,0,128,128)

type="TEXT"
creator="MSWD"
extension=""
mime=""

i=new iconmbs(type, creator, extension, mime)
// draws microsoft word text file icon
i.DrawIcon(g,0,128,128,128)

type=""
creator="GKON"
extension="jpg"
mime=""

i=new iconmbs(type, creator, extension, mime)
// draws graphic converter jpeg file icon
i.DrawIcon(g,128,128,128,128)

End Sub
Notes:
All parameters can be empty strings if you don't know this information.
Requires Mac OS X 10.3 to work properly.

See also:

Feedback, Comments & Corrections

IconMBS.DrawIcon(g as graphics,x as Integer,y as Integer,width as Integer,height as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Icon Service MBS Picture Plugin 2.6 Yes No No No No
Function: Draws the icon.
Example:
// in a paint event:

dim i as new IconMBS("FNDR", "MACS")

i.DrawIcon(g, 0, 0, 128, 128)
Notes:
DrawIcon with align and transform set to none.

Not supported for Cocoa. Please use DrawIconCGContext there.

See also:

Feedback, Comments & Corrections

IconMBS.DrawIcon(g as graphics,x as Integer,y as Integer,width as Integer,height as Integer,align as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Icon Service MBS Picture Plugin 2.6 Yes No No No No
Function: Draws the icon.
Example:
// in a paint event:

dim i as new IconMBS("FNDR", "MACS")

i.DrawIcon(g, 0, 0, 128, 128, 8)
Notes:
DrawIcon with transform set to none.
Not supported for Cocoa. Please use DrawIconCGContext there.

See also:

Feedback, Comments & Corrections

IconMBS.DrawIcon(g as graphics,x as Integer,y as Integer,width as Integer,height as Integer,align as Integer,transform as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Icon Service MBS Picture Plugin 2.6 Yes No No No No
Function: Draws the icon.
Example:
// in a paint event:

dim i as new IconMBS("FNDR", "MACS")

i.DrawIcon(g, 0, 0, 128, 128, 0, &h4000)
Notes:
Align and Transform are optional parameters.

The coordinates inside the graphics objects are absolute to the picture or window where the graphics object came from.

Align constants:
None 0
VerticalCenter 1
Top 2
Bottom 3
HorizontalCenter 4
AbsoluteCenter 5
CenterTop 6
CenterBottom 7
Left 8
CenterLeft 9
TopLeft 10
BottomLeft 11
Right 12
CenterRight 13
TopRight 14
BottomRight 15

Transform constants:
None 0
Disabled 1
Offline 2
Open 3
Label1 &h0100
Label2 &h0200
Label3 &h0300
Label4 &h0400
Label5 &h0500
Label6 &h0600
Label7 &h0700
Selected &h4000
SelectedDisabled &h4001
SelectedOffline &h4002
SelectedOpen &h4003

Not supported for Cocoa. Please use DrawIconCGContext there.

See also:

Feedback, Comments & Corrections

IconMBS.DrawIconCGContext(CGContextHandle as Integer,x as Integer,y as Integer,width as Integer,height as Integer, align as Integer, transform as Integer, flags as Integer, labelColor as color)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Icon Service MBS Picture Plugin 8.1 Yes No No Yes, macOS only No
Function: Draws the icon in a CoreGraphics Context.
Example:
Function GetIconImage(i as iconmbs, w as Integer, h as Integer) As picture
dim c as new CGPictureContextMBS(w,h)

const DrawNormal=0
const DrawNoImage=2
const DrawNoMask=4
const DrawSelected=&h8000

i.DrawIconCGContext(c.Handle, 0,0,w,h,0,0,DrawNoMask,&c000000)

c.Flush

Return c.CopyPicture
End Function
Notes:
You must make sure that the CGContext handle you pass in is valid. You can use CGContextMBS class for this and use GetCurrentCGContextMBS or Window.CGContextMBS to get a context. Please note that coordinates have the origin typically on the lower left.

Flags:
DrawNormal0
DrawNoImage2
DrawNoMask4
DrawSelected32768

Align constants:
None 0
VerticalCenter 1
Top 2
Bottom 3
HorizontalCenter 4
AbsoluteCenter 5
CenterTop 6
CenterBottom 7
Left 8
CenterLeft 9
TopLeft 10
BottomLeft 11
Right 12
CenterRight 13
TopRight 14
BottomRight 15

Transform constants:
None 0
Disabled 1
Offline 2
Open 3
Label1 &h0100
Label2 &h0200
Label3 &h0300
Label4 &h0400
Label5 &h0500
Label6 &h0600
Label7 &h0700
Selected &h4000
SelectedDisabled &h4001
SelectedOffline &h4002
SelectedOpen &h4003

Feedback, Comments & Corrections

IconMBS.GetBackground as IconMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Icon Service MBS Picture Plugin 2.7 Yes No No Yes, macOS only No
Function: If the icon is a composited one, this function returns the icon used for the background.
Notes:
Returns nil on any error.
Lasterror ist set.

Feedback, Comments & Corrections

IconMBS.GetForeground as IconMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Icon Service MBS Picture Plugin 2.7 Yes No No Yes, macOS only No
Function: If the icon is a composited one, this function returns the icon used for the foreground.
Notes:
Returns nil on any error.
Lasterror ist set.

Feedback, Comments & Corrections

IconMBS.IconFamily as IconFamilyMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Icon Service MBS Picture Plugin 2.6 Yes No No Yes, macOS only No
Function: Returns the icon converted to an Iconfamily.
Example:
dim i as new IconMBS("FNDR", "MACS")

Backdrop = i.IconFamily.Thumbnail32BitData

Feedback, Comments & Corrections

IconMBS.IsIconRefMaskEmpty as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Icon Service MBS Picture Plugin 2.6 Yes No No Yes, macOS only No
Function: Returns true if the mask of the icon is empty.
Example:
dim i as new IconMBS("FNDR", "MACS")

MsgBox str(i.IsIconRefMaskEmpty)
Notes: Lasterror is set.

Feedback, Comments & Corrections

IconMBS.PointInIcon(pointx as Integer,pointy as Integer,x as Integer,y as Integer,width as Integer,height as Integer,align as Integer) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Icon Service MBS Picture Plugin 2.6 Yes No No Yes, macOS only No
Function: Tests whether a point is inside the icon's picture.
Notes:
The coordinates for pointx/pointy and x/y must be in the same system.

Align constants:
None 0
VerticalCenter 1
Top 2
Bottom 3
HorizontalCenter 4
AbsoluteCenter 5
CenterTop 6
CenterBottom 7
Left 8
CenterLeft 9
TopLeft 10
BottomLeft 11
Right 12
CenterRight 13
TopRight 14
BottomRight 15

Feedback, Comments & Corrections

IconMBS.RectInIcon(rectx as Integer,recty as Integer,rectwidth as Integer,rectheight as Integer,x as Integer,y as Integer,width as Integer,height as Integer,align as Integer) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Icon Service MBS Picture Plugin 2.6 Yes No No Yes, macOS only No
Function: Tests whether a rectangle is inside the icon's picture.
Notes:
The coordinates for both rectangles must be in the same coordinate system.

Align constants:
None 0
VerticalCenter 1
Top 2
Bottom 3
HorizontalCenter 4
AbsoluteCenter 5
CenterTop 6
CenterBottom 7
Left 8
CenterLeft 9
TopLeft 10
BottomLeft 11
Right 12
CenterRight 13
TopRight 14
BottomRight 15

This call may fail in some RB versions because of the count of parameters.

Feedback, Comments & Corrections

IconMBS.RetainCount as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Icon Service MBS Picture Plugin 2.7 Yes No No Yes, macOS only No
Function: How many references to this icon are hold on this Mac.
Example:
dim i as new IconMBS("FNDR", "MACS") // Finder Icon

MsgBox str(i.RetainCount)

Feedback, Comments & Corrections

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




Links
MBS FileMaker Plugins