CicmWrapper  Beta 0.4
A wrapper for Pure Data
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules Pages
Data Structures | Functions | Variables
The Bang Example Part

The example part for t_ebox. More...

Data Structures

struct  t_bang
 The GUI bang structure. More...
 

Functions

void setup_c0x2ebang (void)
 Setups the bang_class for GUI behavior. More...
 
static void * bang_new (t_symbol *s, int argc, t_atom *argv)
 Allocates and initializes the t_bang structure. More...
 
static void bang_free (t_bang *x)
 Frees the t_bang structure. More...
 
static void bang_getdrawparams (t_bang *x, t_object *view, t_edrawparams *params)
 Defines the default graphical parameters of a GUI. More...
 
static void bang_oksize (t_bang *x, t_rect *newrect)
 Defines and validates the size of a GUI. More...
 
static void bang_paint (t_bang *x, t_object *view)
 Paints the t_ebox. More...
 
static void bang_activate (t_bang *x)
 Activates the status of the t_bang. More...
 
static void bang_deactivate (t_bang *x)
 Deactivates the status of the t_bang. More...
 
static void bang_mousedown (t_bang *x, t_object *view, t_pt pt, long modifiers)
 Receives the mouse down notification. More...
 
static void bang_mouseup (t_bang *x, t_object *view, t_pt pt, long modifiers)
 Receives the mouse up notification. More...
 
static void bang_anything (t_bang *x, t_symbol *s, int argc, t_atom *argv)
 Receives the anything notification. More...
 

Variables

static t_eclassbang_class
 
static t_symbolbang_sym_background_layer
 

Detailed Description

The example part for t_ebox.

This part is an example shows how to initialize a GUI class with methods for painting and mouse interractions and attributes.


Data Structure Documentation

struct t_bang

The GUI bang structure.

It is a basic GUI struture with attributes and basic Pd stuffs.

Examples:
c.bang.cpp.
Data Fields
t_ebox b_box

The t_ebox that allows to create a GUI.

t_outlet * b_out

The t_outlet of the object.

t_rgba b_color_background

The struture for the t_eattr background color.

t_rgba b_color_border

The struture for the t_eattr border color.

t_rgba b_color_bang

The struture for the t_eattr bang color.

t_clock * b_clock

The t_clock of the object.

char b_active

If the object is performming a bang.

Function Documentation

C void setup_c0x2ebang ( void  )

Setups the bang_class for GUI behavior.

This function is called by Pd to initialize the bang_class of the c.bang object. In the function, you should set up the default methods, behaviors and attributes of your object. If your object's name is simple like "bang", this function should be named "bang_setup" otherwise, if your object's name is more complex like "c.bang" the function's name should replace the special character with the matching UTF8-hexadecimal value and put "setup" before the name of the object. In this example, the dot is replaced with "c0x2e" and the function name becomes "setup_c0x2ebang".

Examples:
c.bang.cpp.
static void * bang_new ( t_symbol s,
int  argc,
t_atom argv 
)
static

Allocates and initializes the t_bang structure.

The function uses eobj_new to allocate the t_bang with the bang_class and initializes the default values.

Parameters
sThe name of the object (in this case "c.bang").
argcThe number of t_atom parameters.
argvThe array of t_atom parameters.
Returns
The pointer to the t_bang if the allocation has been successful, otherwise NULL.
Examples:
c.bang.cpp.
static void bang_free ( t_bang x)
static

Frees the t_bang structure.

The function just calls ebox_free() and frees the t_clock.

Parameters
xThe t_bang pointer.
Examples:
c.bang.cpp.
static void bang_getdrawparams ( t_bang x,
t_object view,
t_edrawparams params 
)
static

Defines the default graphical parameters of a GUI.

The function is used to defines the border size, the border size (dummy mostly for Max compatibility) the border color and the background color of a t_ebox.

Parameters
xThe t_bang pointer.
viewThe view pointer (dummy).
paramsThe t_edrawparams structure to set up.
Examples:
c.bang.cpp.
static void bang_oksize ( t_bang x,
t_rect newrect 
)
static

Defines and validates the size of a GUI.

The function is validate the new size of a GUI. It can be used to restrict the size.

Parameters
xThe t_bang pointer.
newrectThe t_rect pointer to change if needed.
Examples:
c.bang.cpp.
static void bang_paint ( t_bang x,
t_object view 
)
static

Paints the t_ebox.

The function is called internally when the t_ebox should be repainted. This is where you should draw all the stuffs you want.

Parameters
xThe t_bang pointer.
viewThe view that ask to be repainted (dummy mostly for Max compatibility).
Examples:
c.bang.cpp.
static void bang_activate ( t_bang x)
static

Activates the status of the t_bang.

The function activates the status of the t_bang. Outputs a bang message, sends a bang to the attached objects and ask the t_ebox to be redrawn

Parameters
xThe t_bang pointer.
Examples:
c.bang.cpp.
static void bang_deactivate ( t_bang x)
static

Deactivates the status of the t_bang.

The function deactiveates the status of the t_bang and ask the t_ebox to be redrawn

Parameters
xThe t_bang pointer.
Examples:
c.bang.cpp.
static void bang_mousedown ( t_bang x,
t_object view,
t_pt  pt,
long  modifiers 
)
static

Receives the mouse down notification.

The function is called internally when the object has been clicked.

Parameters
xThe t_bang pointer.
viewThe view (dummy mostly for Max compatibility).
ptThe position of the mouse within the object.
modifiersThe modifiers (alt, ctrl, etc.).
Examples:
c.bang.cpp.
static void bang_mouseup ( t_bang x,
t_object view,
t_pt  pt,
long  modifiers 
)
static

Receives the mouse up notification.

The function is called internally when the mouse has been released from the object.

Parameters
xThe t_bang pointer.
viewThe view (dummy mostly for Max compatibility).
ptThe position of the mouse within the object.
modifiersThe modifiers (alt, ctrl, etc.).
Examples:
c.bang.cpp.
static void bang_anything ( t_bang x,
t_symbol s,
int  argc,
t_atom argv 
)
static

Receives the anything notification.

The function is called when any message has been received from the inlet.

Parameters
xThe t_bang pointer.
sThe message symbol.
argcThe number of t_atom.
argvThe array of t_atom.
Examples:
c.bang.cpp.

Variable Documentation

t_eclass* bang_class
static

The t_eclass for the t_bang.

Examples:
c.bang.cpp.
t_symbol* bang_sym_background_layer
static

The "background_layer" t_symbol.

Examples:
c.bang.cpp.