A box in the patcher. More...

+ Collaboration diagram for jbox:

Data Structures

struct  t_jboxdrawparams
 The t_jboxdrawparams structure. More...
 

Macros

#define JBOX_DRAWFIRSTIN
 draw first inlet
 
#define JBOX_NODRAWBOX
 don't draw the frame
 
#define JBOX_DRAWINLAST
 draw inlets after update method
 
#define JBOX_TRANSPARENT
 don't make transparent unless you need it (for efficiency)
 
#define JBOX_NOGROW
 don't even draw grow thingie
 
#define JBOX_GROWY
 can grow in y direction by dragging
 
#define JBOX_GROWBOTH
 can grow independently in both x and y
 
#define JBOX_IGNORELOCKCLICK
 box should ignore a click if patcher is locked
 
#define JBOX_HILITE
 flag passed to jbox_new() to tell max that the UI object can receive the focus when clicked on – may be replaced by JBOX_FOCUS in the future
 
#define JBOX_BACKGROUND
 immediately set box into the background
 
#define JBOX_NOFLOATINSPECTOR
 no floating inspector window
 
#define JBOX_TEXTFIELD
 save/load text from textfield, unless JBOX_BINBUF flag is set
 
#define JBOX_FIXWIDTH
 give the box a textfield based fix-width (bfixwidth) method
 
#define JBOX_FONTATTR
 if you want font related attribute you must add this to jbox_initclass()
 
#define JBOX_TEXTJUSTIFICATIONATTR
 give your object a textjustification attr to control textfield
 
#define JBOX_BINBUF
 save/load text from b_binbuf
 
#define JBOX_MOUSEDRAGDELTA
 hides mouse cursor in drag and sends mousedragdelta instead of mousedrag (for infinite scrolling like number)
 
#define JBOX_COLOR
 support the "color" method for color customization
 
#define JBOX_DRAWIOLOCKED
 draw inlets and outlets when locked (default is not to draw them)
 
#define JBOX_DRAWBACKGROUND
 set to have box bg filled in for you based on getdrawparams method or brgba attribute
 
#define JBOX_NOINSPECTFIRSTIN
 flag for objects such as bpatcher that have a different b_firstin, More...
 
#define JBOX_FOCUS
 more advanced focus support (passed to jbox_initclass() to add "nextfocus" and "prevfocus" attributes to the UI object). Not implemented as of 2009-05-11
 
#define JBOX_BOXVIEW
 enable jboxview methods
 
#define JBOX_LEGACYCOLOR
 add undocumented color N message to objects from Max 4 that used it
 
#define JBOX_COPYLEGACYDEFAULT
 if there is a legacy default, copy it instead of the regular default
 
#define JBOX_NOLEGACYDEFAULT
 if there is a legacy default, don't copy any default
 

Enumerations

enum  { JBOX_FONTFACE_REGULAR, JBOX_FONTFACE_BOLD, JBOX_FONTFACE_ITALIC, JBOX_FONTFACE_BOLDITALIC }
 actual numerical values of the b_fontface attribute; use jbox_fontface() to weight More...
 
enum  HitTestResult {
  HitNothing, HitBox, HitInlet, HitOutlet,
  HitGrowBox, HitLine, HitLineLocked
}
 enumerations used for box decorators More...
 

Functions

t_max_err jbox_get_rect_for_view (t_object *box, t_object *patcherview, t_rect *rect)
 Find the rect for a box in a given patcherview. More...
 
t_max_err jbox_set_rect_for_view (t_object *box, t_object *patcherview, t_rect *rect)
 Change the rect for a box in a given patcherview. More...
 
t_max_err jbox_get_rect_for_sym (t_object *box, t_symbol *which, t_rect *pr)
 Find the rect for a box with a given attribute name. More...
 
t_max_err jbox_set_rect_for_sym (t_object *box, t_symbol *which, t_rect *pr)
 Change the rect for a box with a given attribute name. More...
 
t_max_err jbox_set_rect (t_object *box, t_rect *pr)
 Set both the presentation rect and the patching rect. More...
 
t_max_err jbox_get_patching_rect (t_object *box, t_rect *pr)
 Retrieve the patching rect of a box. More...
 
t_max_err jbox_set_patching_rect (t_object *box, t_rect *pr)
 Change the patching rect of a box. More...
 
t_max_err jbox_get_presentation_rect (t_object *box, t_rect *pr)
 Retrieve the presentation rect of a box. More...
 
t_max_err jbox_set_presentation_rect (t_object *box, t_rect *pr)
 Change the presentation rect of a box. More...
 
t_max_err jbox_set_position (t_object *box, t_pt *pos)
 Set the position of a box for both the presentation and patching views. More...
 
t_max_err jbox_get_patching_position (t_object *box, t_pt *pos)
 Fetch the position of a box for the patching view. More...
 
t_max_err jbox_set_patching_position (t_object *box, t_pt *pos)
 Set the position of a box for the patching view. More...
 
t_max_err jbox_get_presentation_position (t_object *box, t_pt *pos)
 Fetch the position of a box for the presentation view. More...
 
t_max_err jbox_set_presentation_position (t_object *box, t_pt *pos)
 Set the position of a box for the presentation view. More...
 
t_max_err jbox_set_size (t_object *box, t_size *size)
 Set the size of a box for both the presentation and patching views. More...
 
t_max_err jbox_get_patching_size (t_object *box, t_size *size)
 Fetch the size of a box for the patching view. More...
 
t_max_err jbox_set_patching_size (t_object *box, t_size *size)
 Set the size of a box for the patching view. More...
 
t_max_err jbox_get_presentation_size (t_object *box, t_size *size)
 Fetch the size of a box for the presentation view. More...
 
t_max_err jbox_set_presentation_size (t_object *box, t_size *size)
 Set the size of a box for the presentation view. More...
 
t_symboljbox_get_maxclass (t_object *b)
 Retrieve the name of the class of the box's object. More...
 
t_objectjbox_get_object (t_object *b)
 Retrieve a pointer to the box's object. More...
 
t_objectjbox_get_patcher (t_object *b)
 Retrieve a box's patcher. More...
 
char jbox_get_hidden (t_object *b)
 Retrieve a box's 'hidden' attribute. More...
 
t_max_err jbox_set_hidden (t_object *b, char c)
 Set a box's 'hidden' attribute. More...
 
t_symboljbox_get_fontname (t_object *b)
 Retrieve a box's 'fontname' attribute. More...
 
t_max_err jbox_set_fontname (t_object *b, t_symbol *ps)
 Set a box's 'fontname' attribute. More...
 
double jbox_get_fontsize (t_object *b)
 Retrieve a box's 'fontsize' attribute. More...
 
t_max_err jbox_set_fontsize (t_object *b, double d)
 Set a box's 'fontsize' attribute. More...
 
t_max_err jbox_get_color (t_object *b, t_jrgba *prgba)
 Retrieve a box's 'color' attribute. More...
 
t_max_err jbox_set_color (t_object *b, t_jrgba *prgba)
 Set a box's 'color' attribute. More...
 
t_symboljbox_get_hint (t_object *b)
 Retrieve a box's hint text as a symbol. More...
 
t_max_err jbox_set_hint (t_object *b, t_symbol *s)
 Set a box's hint text using a symbol. More...
 
char * jbox_get_hintstring (t_object *bb)
 Retrieve a box's hint text as a C-string. More...
 
void jbox_set_hintstring (t_object *bb, char *s)
 Set a box's hint text using a C-string. More...
 
char * jbox_get_annotation (t_object *bb)
 Retrieve a box's annotation string, if the user has given it an annotation. More...
 
void jbox_set_annotation (t_object *bb, char *s)
 Set a box's annotation string. More...
 
t_objectjbox_get_nextobject (t_object *b)
 The next box in the patcher's (linked) list of boxes. More...
 
t_objectjbox_get_prevobject (t_object *b)
 The previous box in the patcher's (linked) list of boxes. More...
 
t_symboljbox_get_varname (t_object *b)
 Retrieve a box's scripting name. More...
 
t_max_err jbox_set_varname (t_object *b, t_symbol *ps)
 Set a box's scripting name. More...
 
t_symboljbox_get_id (t_object *b)
 Retrieve a boxes unique id. More...
 
char jbox_get_canhilite (t_object *b)
 Retrieve a box flag value from a box. More...
 
char jbox_get_background (t_object *b)
 Determine whether a box is located in the patcher's background layer. More...
 
t_max_err jbox_set_background (t_object *b, char c)
 Set whether a box should be in the background or foreground layer of a patcher. More...
 
char jbox_get_ignoreclick (t_object *b)
 Determine whether a box ignores clicks. More...
 
t_max_err jbox_set_ignoreclick (t_object *b, char c)
 Set whether a box ignores clicks. More...
 
char jbox_get_drawfirstin (t_object *b)
 Determine whether a box draws its first inlet. More...
 
char jbox_get_outline (t_object *b)
 Determine whether a box draws an outline. More...
 
t_max_err jbox_set_outline (t_object *b, char c)
 Set whether a box draws an outline. More...
 
char jbox_get_growy (t_object *b)
 Retrieve a box flag value from a box. More...
 
char jbox_get_growboth (t_object *b)
 Retrieve a box flag value from a box. More...
 
char jbox_get_nogrow (t_object *b)
 Retrieve a box flag value from a box. More...
 
char jbox_get_drawinlast (t_object *b)
 Retrieve a box flag value from a box. More...
 
t_objectjbox_get_textfield (t_object *b)
 Retrieve a pointer to a box's textfield. More...
 
char jbox_get_presentation (t_object *b)
 Determine if a box is included in the presentation view. More...
 
t_max_err jbox_set_presentation (t_object *b, char c)
 Determine if a box is included in the presentation view. More...
 
t_max_err jbox_new (t_jbox *b, long flags, long argc, t_atom *argv)
 Set up your UI object's t_jbox member. More...
 
void jbox_free (t_jbox *b)
 Tear down your UI object's t_jbox member. More...
 
void jbox_ready (t_jbox *b)
 Mark the box ready to be accessed and drawn by Max. More...
 
void jbox_redraw (t_jbox *b)
 Request that your object/box be re-drawn by Max. More...
 
t_max_err jbox_notify (t_jbox *b, t_symbol *s, t_symbol *msg, void *sender, void *data)
 Send a notification to a box. More...
 

Detailed Description

A box in the patcher.

Macro Definition Documentation

#define JBOX_NOINSPECTFIRSTIN

flag for objects such as bpatcher that have a different b_firstin,

but the attrs of the b_firstin should not be shown in the inspector

Enumeration Type Documentation

anonymous enum

actual numerical values of the b_fontface attribute; use jbox_fontface() to weight

Enumerator
JBOX_FONTFACE_REGULAR 

normal

JBOX_FONTFACE_BOLD 

bold

JBOX_FONTFACE_ITALIC 

italic

JBOX_FONTFACE_BOLDITALIC 

bold and italic

enumerations used for box decorators

Enumerator
HitNothing 

a hole in the box

HitBox 

the body of the box

HitInlet 

an inlet

HitOutlet 

an outlet

HitGrowBox 

the grow handle

HitLine 

a line

HitLineLocked 

a line in a locked patcher (for probing)

Function Documentation

void jbox_free ( t_jbox b)

Tear down your UI object's t_jbox member.

This should be called from your UI object's free method.

Parameters
bThe address of your object's t_jbox member (which should be the first member of the object's struct).
char* jbox_get_annotation ( t_object bb)

Retrieve a box's annotation string, if the user has given it an annotation.

Parameters
bbThe box to query.
Returns
The user-created annotation string for a box, or NULL if no string exists.
char jbox_get_background ( t_object b)

Determine whether a box is located in the patcher's background layer.

Parameters
bThe box to query.
Returns
Zero if the object is in the foreground, otherwise non-zero.
char jbox_get_canhilite ( t_object b)

Retrieve a box flag value from a box.

Parameters
bThe box to query.
Returns
The value of the canhilite bit in the box's flags.
t_max_err jbox_get_color ( t_object b,
t_jrgba prgba 
)

Retrieve a box's 'color' attribute.

Parameters
bThe box to query.
prgbaThe address of a valid t_rect whose values will be filled-in upon return.
Returns
A Max error code.
char jbox_get_drawfirstin ( t_object b)

Determine whether a box draws its first inlet.

Parameters
bThe box to query.
Returns
Zero if the inlet is not drawn, otherwise non-zero.
char jbox_get_drawinlast ( t_object b)

Retrieve a box flag value from a box.

Parameters
bThe box to query.
Returns
The value of the drawinlast bit in the box's flags.
t_symbol* jbox_get_fontname ( t_object b)

Retrieve a box's 'fontname' attribute.

Parameters
bThe box to query.
Returns
The font name.
double jbox_get_fontsize ( t_object b)

Retrieve a box's 'fontsize' attribute.

Parameters
bThe box to query.
Returns
The font size in points.
char jbox_get_growboth ( t_object b)

Retrieve a box flag value from a box.

Parameters
bThe box to query.
Returns
The value of the growboth bit in the box's flags.
char jbox_get_growy ( t_object b)

Retrieve a box flag value from a box.

Parameters
bThe box to query.
Returns
The value of the growy bit in the box's flags.
char jbox_get_hidden ( t_object b)

Retrieve a box's 'hidden' attribute.

Parameters
bThe box to query.
Returns
True if the box is hidden, otherwise false.
t_symbol* jbox_get_hint ( t_object b)

Retrieve a box's hint text as a symbol.

Parameters
bThe box to query.
Returns
The box's hint text.
char* jbox_get_hintstring ( t_object bb)

Retrieve a box's hint text as a C-string.

Parameters
bbThe box to query.
Returns
The box's hint text.
t_symbol* jbox_get_id ( t_object b)

Retrieve a boxes unique id.

Parameters
bThe box to query.
Returns
The unique id of the object. This is a symbol that is referenced, for example, by patchlines.
char jbox_get_ignoreclick ( t_object b)

Determine whether a box ignores clicks.

Parameters
bThe box to query.
Returns
Zero if the object responds to clicks, otherwise non-zero.
t_symbol* jbox_get_maxclass ( t_object b)

Retrieve the name of the class of the box's object.

Parameters
bThe box to query.
Returns
The name of the class of the box's object.
t_object* jbox_get_nextobject ( t_object b)

The next box in the patcher's (linked) list of boxes.

Parameters
bThe box to query.
Returns
The next box in the list.
char jbox_get_nogrow ( t_object b)

Retrieve a box flag value from a box.

Parameters
bThe box to query.
Returns
The value of the nogrow bit in the box's flags.
t_object* jbox_get_object ( t_object b)

Retrieve a pointer to the box's object.

Parameters
bThe box to query.
Returns
A pointer to the box's object.
char jbox_get_outline ( t_object b)

Determine whether a box draws an outline.

Parameters
bThe box to query.
Returns
Zero if the outline is not drawn, otherwise non-zero.
t_object* jbox_get_patcher ( t_object b)

Retrieve a box's patcher.

Parameters
bThe box to query.
Returns
If the box has a patcher, the patcher's pointer is returned. Otherwise NULL is returned.
t_max_err jbox_get_patching_position ( t_object box,
t_pt pos 
)

Fetch the position of a box for the patching view.

Parameters
boxThe box whose position will be retrieved.
posThe address of a valid t_pt whose x and y values will be filled in.
Returns
A Max error code.
t_max_err jbox_get_patching_rect ( t_object box,
t_rect pr 
)

Retrieve the patching rect of a box.

Parameters
boxThe box whose rect values will be retrieved.
prThe address of a valid t_rect whose values will be filled in.
Returns
A Max error code.
t_max_err jbox_get_patching_size ( t_object box,
t_size size 
)

Fetch the size of a box for the patching view.

Parameters
boxThe box whose size will be retrieved.
sizeThe address of a valid t_size whose width and height values will be filled in.
Returns
A Max error code.
char jbox_get_presentation ( t_object b)

Determine if a box is included in the presentation view.

Parameters
bThe box to query.
Returns
Non-zero if in presentation mode, otherwise zero.
t_max_err jbox_get_presentation_position ( t_object box,
t_pt pos 
)

Fetch the position of a box for the presentation view.

Parameters
boxThe box whose position will be retrieved.
posThe address of a valid t_pt whose x and y values will be filled in.
Returns
A Max error code.
t_max_err jbox_get_presentation_rect ( t_object box,
t_rect pr 
)

Retrieve the presentation rect of a box.

Parameters
boxThe box whose rect values will be retrieved.
prThe address of a valid t_rect whose values will be filled in.
Returns
A Max error code.
t_max_err jbox_get_presentation_size ( t_object box,
t_size size 
)

Fetch the size of a box for the presentation view.

Parameters
boxThe box whose size will be retrieved.
sizeThe address of a valid t_size whose width and height values will be filled in.
Returns
A Max error code.
t_object* jbox_get_prevobject ( t_object b)

The previous box in the patcher's (linked) list of boxes.

Parameters
bThe box to query.
Returns
The next box in the list.
t_max_err jbox_get_rect_for_sym ( t_object box,
t_symbol which,
t_rect pr 
)

Find the rect for a box with a given attribute name.

Parameters
boxThe box whose rect will be fetched.
whichThe name of the rect attribute to be fetched, for example _sym_presentation_rect or _sym_patching_rect.
prThe address of a valid t_rect whose members will be filled in by this function.
Returns
A Max error code.
t_max_err jbox_get_rect_for_view ( t_object box,
t_object patcherview,
t_rect rect 
)

Find the rect for a box in a given patcherview.

Parameters
boxThe box whose rect will be fetched.
patcherviewA patcherview in which the box exists.
rectThe address of a valid t_rect whose members will be filled in by this function.
Returns
A Max error code.
t_object* jbox_get_textfield ( t_object b)

Retrieve a pointer to a box's textfield.

Parameters
bThe box to query.
Returns
The textfield for the box, assuming it has one. If the box does not own a textfield then NULL is returned.
t_symbol* jbox_get_varname ( t_object b)

Retrieve a box's scripting name.

Parameters
bThe box to query.
Returns
The box's scripting name.
t_max_err jbox_new ( t_jbox b,
long  flags,
long  argc,
t_atom argv 
)

Set up your UI object's t_jbox member.

This should be called from your UI object's free method.

Parameters
bThe address of your UI object's t_jbox member (which should be the first member of the object's struct).
flagsFlags to set the box's behavior, such as JBOX_NODRAWBOX.
argcThe count of atoms in the argv parameter.
argvThe address of the first in an array of atoms to be passed to the box constructor. Typically these are simply the argument passed to your object when it is created.
Returns
A Max error code.
t_max_err jbox_notify ( t_jbox b,
t_symbol s,
t_symbol msg,
void *  sender,
void *  data 
)

Send a notification to a box.

This is the same as calling object_notify() for a box.

Parameters
bThe address of your object's t_jbox member.
sThe name of the send object.
msgThe notification name.
senderThe sending object's address.
dataA pointer to some data passed to the box's notify method.
Returns
A Max error code.
void jbox_ready ( t_jbox b)

Mark the box ready to be accessed and drawn by Max.

This should typically be called at the end of your UI object's new method.

Parameters
bThe address of your object's t_jbox member.
void jbox_redraw ( t_jbox b)

Request that your object/box be re-drawn by Max.

Parameters
bThe address of your object's t_jbox member.
void jbox_set_annotation ( t_object bb,
char *  s 
)

Set a box's annotation string.

Parameters
bbThe box to query.
sThe annotation string for the box.
Returns
A Max error code.
t_max_err jbox_set_background ( t_object b,
char  c 
)

Set whether a box should be in the background or foreground layer of a patcher.

Parameters
bThe box to query.
cPass zero to tell the box to appear in the foreground, or non-zero to indicate that the box should be in the background layer.
Returns
A Max error code.
t_max_err jbox_set_color ( t_object b,
t_jrgba prgba 
)

Set a box's 'color' attribute.

Parameters
bThe box to query.
prgbaThe address of a t_rect containing the desired color for the box/object.
Returns
A Max error code.
t_max_err jbox_set_fontname ( t_object b,
t_symbol ps 
)

Set a box's 'fontname' attribute.

Parameters
bThe box to query.
psThe font name. Note that the font name may be case-sensitive.
Returns
A Max error code.
t_max_err jbox_set_fontsize ( t_object b,
double  d 
)

Set a box's 'fontsize' attribute.

Parameters
bThe box to query.
dThe fontsize in points.
Returns
A Max error code.
t_max_err jbox_set_hidden ( t_object b,
char  c 
)

Set a box's 'hidden' attribute.

Parameters
bThe box to query.
cSet to true to hide the box, otherwise false.
Returns
A Max error code.
t_max_err jbox_set_hint ( t_object b,
t_symbol s 
)

Set a box's hint text using a symbol.

Parameters
bThe box to query.
sThe new text to use for the box's hint.
Returns
A Max error code.
void jbox_set_hintstring ( t_object bb,
char *  s 
)

Set a box's hint text using a C-string.

Parameters
bbThe box to query.
sThe new text to use for the box's hint.
Returns
A Max error code.
t_max_err jbox_set_ignoreclick ( t_object b,
char  c 
)

Set whether a box ignores clicks.

Parameters
bThe box to query.
cPass zero to tell the box to respond to clicks, or non-zero to indicate that the box should ignore clicks.
Returns
A Max error code.
t_max_err jbox_set_outline ( t_object b,
char  c 
)

Set whether a box draws an outline.

Parameters
bThe box to query.
cPass zero to hide the outline, or non-zero to indicate that the box should draw the outline.
Returns
A Max error code.
t_max_err jbox_set_patching_position ( t_object box,
t_pt pos 
)

Set the position of a box for the patching view.

Parameters
boxThe box whose positon will be changed.
posThe address of a t_pt with the new x and y values.
Returns
A Max error code.
t_max_err jbox_set_patching_rect ( t_object box,
t_rect pr 
)

Change the patching rect of a box.

Parameters
boxThe box whose rect will be changed.
prThe address of a t_rect with the new rect values.
Returns
A Max error code.
t_max_err jbox_set_patching_size ( t_object box,
t_size size 
)

Set the size of a box for the patching view.

Parameters
boxThe box whose size will be changed.
sizeThe address of a t_size with the new width and height values.
Returns
A Max error code.
t_max_err jbox_set_position ( t_object box,
t_pt pos 
)

Set the position of a box for both the presentation and patching views.

Parameters
boxThe box whose position will be changed.
posThe address of a t_pt with the new x and y values.
Returns
A Max error code.
t_max_err jbox_set_presentation ( t_object b,
char  c 
)

Determine if a box is included in the presentation view.

Parameters
bThe box to query.
cPass zero to remove a box from the presention view, or non-zero to add it to the presentation view.
Returns
Non-zero if in presentation mode, otherwise zero.
t_max_err jbox_set_presentation_position ( t_object box,
t_pt pos 
)

Set the position of a box for the presentation view.

Parameters
boxThe box whose rect will be changed.
posThe address of a t_pt with the new x and y values.
Returns
A Max error code.
t_max_err jbox_set_presentation_rect ( t_object box,
t_rect pr 
)

Change the presentation rect of a box.

Parameters
boxThe box whose rect will be changed.
prThe address of a t_rect with the new rect values.
Returns
A Max error code.
t_max_err jbox_set_presentation_size ( t_object box,
t_size size 
)

Set the size of a box for the presentation view.

Parameters
boxThe box whose size will be changed.
sizeThe address of a t_size with the new width and height values.
Returns
A Max error code.
t_max_err jbox_set_rect ( t_object box,
t_rect pr 
)

Set both the presentation rect and the patching rect.

Parameters
boxThe box whose rect will be changed.
prThe address of a t_rect with the new rect values.
Returns
A Max error code.
t_max_err jbox_set_rect_for_sym ( t_object box,
t_symbol which,
t_rect pr 
)

Change the rect for a box with a given attribute name.

Parameters
boxThe box whose rect will be changed.
whichThe name of the rect attribute to be changed, for example _sym_presentation_rect or _sym_patching_rect.
prThe address of a valid t_rect that will replace the current values used by the box.
Returns
A Max error code.
t_max_err jbox_set_rect_for_view ( t_object box,
t_object patcherview,
t_rect rect 
)

Change the rect for a box in a given patcherview.

Parameters
boxThe box whose rect will be changed.
patcherviewA patcherview in which the box exists.
rectThe address of a valid t_rect that will replace the current values used by the box in the given view.
Returns
A Max error code.
t_max_err jbox_set_size ( t_object box,
t_size size 
)

Set the size of a box for both the presentation and patching views.

Parameters
boxThe box whose size will be changed.
sizeThe address of a t_size with the new size values.
Returns
A Max error code.
t_max_err jbox_set_varname ( t_object b,
t_symbol ps 
)

Set a box's scripting name.

Parameters
bThe box to query.
psThe new scripting name for the box.
Returns
A Max error code.
  Copyright © 2015, Cycling '74