MBS Plugin Documentation

Search:

Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchie

New in Version 7.0 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 8.0 8.1 8.2 8.3 8.4 8.5 8.6 8.7 9.0

The list of the   themes,   classes,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

FAQ.How to draw into a CGContext using DrawThemeTextBox?
Feedback.

Answer: The code below writes using a declare to DrawThemeTextBox into a CGContext.
Example:
dim c as CGPictureContextMBS
dim p as Picture
dim r as MemoryBlock
dim s as CFStringMBS

c=new CGPictureContextMBS(300,300)

c.ClearRect CGMakeRectMBS(0,0,300,300)

declare function DrawThemeTextBox lib "CarbonLib" (cfstringhandle as integer, fontid as integer, state as integer, inWrapToWidth as Boolean, rect as ptr, inJust as integer, contexthandle as integer) as integer
'OSStatus DrawThemeTextBox (
'CFStringRef inString,
'ThemeFontID inFontID,
'ThemeDrawState inState,
'Boolean inWrapToWidth,
'const Rect * inBoundingBox,
'SInt16 inJust,
'void * inContext
');

r=NewMemoryBlock(8)
r.Short(0)=0
r.Short(2)=0
r.Short(4)=300
r.Short(6)=300

s=NewCFStringMBS("Hello World")
title=str(DrawThemeTextBox(s.handle,0,0,false,r,0,c.Handle))

p=NewPicture(300,300,32)
p.Graphics.DrawPicture c.CopyPicture,0,0
p.mask.Graphics.DrawPicture c.CopyPictureMask,0,0

Backdrop=p

Notes: If result is not 0, the method fails.