muimaster.library Reference

Comprehensive function reference for muimaster.library (MUI 3.8 dev), the core engine of MUI: object creation/disposal via MUI_NewObjectA / MUI_DisposeObject, requester handling, pen allocation, clipping/refresh and custom class management. Most of the standard MUI classes are built into muimaster.library; for external ones see the class-specific docs in library-reference/mui-classes/.

Source: MUI 3.8 developer archive, Developer/Autodocs/MUImaster.doc (the autodoc text uses Latin-1; non-ASCII glyphs at column 1 of some C prototypes have been stripped in the rendering here — they were decoration, not part of the actual signature).

Function index


MUI_AllocAslRequest()

MUI_AllocAslRequest

Function

Provide an interface to asl.library. Using this ensures your application will benefit from future expansions to MUI's window and iconification handling.

See also

asl.library/AllocAslRequest


MUI_AslRequest()

Function

Provide an interface to asl.library. Using this ensures your application will benefit from future expansions to MUI's window and iconification handling.

See also

asl.library/AslRequest


MUI_CreateCustomClass()

MUI_CreateCustomClass -- create a public/private custom class.

Synopsis

MUI_CreateCustomClass (base, supername, supermcc, datasize, dispfunc)
A0    A1        A2        D0        A3
struct MUI_CustomClass * MUI_CreateCustomClass(
struct Library *, char *, int, APTR );
�  FUNCTION
This function creates a public or private MUI custom class.
Public custom classes are shared libraries and can be found
in "libs:mui/<foobar>.mcc". Private classes simply consist
of a dispatcher and are built into applications.
MUI_CreateCustomClass() returns a pointer to a struct
MUI_CustomClass which in turn contains a pointer to a
struct IClass. For private classes, this struct IClass
pointer needs to be fed to a intuition.library/NewObject()
call to create new objects.
MUI creates the dispatcher hook for you, you may *not*
use the IClass->cl_Dispatcher.h_Data field! If you need
custom data for your dispatcher, use the cl_UserData
of the IClass structure or the mcc_UserData of the
MUI_CustomClass structure.
For public classes, MUI makes sure that a6 contains
a pointer to your library base when your dispatcher
is called. For private classes, you will need to keep
track of A4 or similiar things the compiler may need yourself.

Inputs

base = if you create a public class, you have to call MUI_CreateCustomClass() from your libraries init function. In this case, place your library base pointer here. For private classes, you must supply NULL. supername = super class of your class. This can either be a builtin MUI class ("xyz.mui") or a external custom class ("xyz.mcc"). supermcc = if (and only if) the super class is a private custom class and hence has no name, you are allowed to pass a NULL supername and a pointer to the MUI_CustomClass structure of the super class here. datasize = size of your classes data structure. dispfunc = your classes dispatcher function (no hook!). The dispatcher will be called with a struct IClass in a0, with your object in a2 and the message in a1.

Results

A pointer to a struct MUI_CustomClass or NULL to indicate an error.

See also

MUI_DeleteCustomClass()


MUI_DeleteCustomClass()

MUI_DeleteCustomClass -- delete a public/private custom class.

Synopsis

MUI_DeleteCustomClass ( mcc )
A0
�  FUNCTION
Delete a public or private custom class. Note that you
must not delete classes with outstanding objects or sub
classes.

BOOL MUI_DeleteCustomClass(struct MUI_CustomClass *);

Inputs

mcc = pointer obtained from MUI_CreateCustomClass().

Results

TRUE if all went well, FALSE if some objects or sub classes were still hanging around. Nothing will be freed in this case.

See also

MUI_CreateCustomClass()


MUI_DisposeObject()

MUI_DisposeObject -- Delete a MUI object.

Synopsis

MUI_DisposeObject( object )
A0
�  FUNCTION
Deletes a MUI object and all of it's auxiliary data.
These objects are all created by MUI_NewObject() or NewObject().
Objects of certain classes "own" other objects, which will also
be deleted when the object is passed to MUI_DisposeObject().
Read the per-class documentation carefully to be aware
of these instances.

VOIDMUI_DisposeObject( APTR );

Inputs

object = abstract pointer to a MUI object returned by MUI_NewObject(). The pointer may be NULL, in which case this function has no effect.

Results

None.

See also

MUI_NewObjectA()


MUI_Error()

MUI_Error -- Return extra information from the MUI system.

Synopsis

�  FUNCTION
Obsolete. Better use SetIoErr()/IoErr().

LONG MUI_Error(VOID);

See also

MUI_SetError()


MUI_FreeAslRequest()

MUI_FreeAslRequest

Function

Provide an interface to asl.library. Using this ensures your application will benefit from future expansions to MUI's window and iconification handling.

See also

asl.library/FreeAslRequest


MUI_FreeClass()

MUI_FreeClass -- Free class.

Synopsis

MUI_FreeClass( classptr )
A0
�  FUNCTION
This function is obsolete since MUI V8.
Use MUI_DeleteCustomClass() instead.

VOID MUI_FreeClass(struct IClass *classptr);

See also

MUI_CreateCustomClass(), MUI_DeleteCustomClass()


MUI_GetClass()

MUI_GetClass -- Get a pointer to a MUI class.

Synopsis

class = MUI_GetClass( classid )
D0                    A0
�  FUNCTION
This function is obsolete since MUI V8.
Use MUI_CreateCustomClass instead.

struct IClass * MUI_GetClass(char *classid);

See also

MUI_CreateCustomClass(), MUI_DeleteCustomClass()


MUI_MakeObjectA()

MUI_MakeObjectA -- create an object from the builtin object collection. — MUI_MakeObject -- Varargs stub for MUI_MakeObjectA

Synopsis

object = MUI_MakeObjectA( objtype, params )
D0                        D0       A0
�  FUNCTION
Prior to muimaster.library V8, MUI was distributed with several macros
to help creating often used objects. This practice was easy, but using
lots of these macros often resulted in big programs. Now, muimaster
library contains an object library with several often used objects
already built in.
MUI_MakeObject() takes the type of the object as first parameter and
a list of additional (type specific) parameters. Note that these
additional values are *not* a taglist!
See the header file mui.h for documentation on object types and the
required parameters.

Object * MUI_MakeObjectA(ULONG type, ULONG *params);

Object * MUI_MakeObject(ULONG type, ...);

See also

MUI_CreateCustomClass(), MUI_DeleteCustomClass()


MUI_NewObjectA()

MUI_NewObjectA -- Create an object from a class. — MUI_NewObject -- Varargs stub for MUI_NewObjectA().

Synopsis

object = MUI_NewObjectA( class, tags )
D0                       A0     A1
object = MUI_NewObject( classID, Tag1, ... )
�  FUNCTION
This is the general method of creating objects from MUI classes.
You specify a class by its ID string. If the class is not
already in memory or built into muimaster.library, it will be
loaded using OpenLibrary("mui/%s",0).
You further specify initial "create-time" attributes for the
object via a TagItem list, and they are applied to the resulting
generic data object that is returned. The attributes, their meanings,
attributes applied only at create-time, and required attributes
are all defined and documented on a class-by-class basis.

APTRMUI_NewObjectA( char *, struct TagItem * );

APTR MUI_NewObject( classID, ULONG, ... );

Inputs

classID = the name/ID string of a MUI class, e.g. "Image.mui". Class names are case sensitive! tagList = pointer to array of TagItems containing attribute/value pairs to be applied to the object being created.

Results

A MUI object, which may be used in different contexts such as an application, window or gadget, and may be manipulated by generic functions. You eventually free the object using MUI_DisposeObject(). NULL indicates failure, more information on the error can be obtained with MUI_Error().

See also

MUI_DisposeObject(), MUI_Error()


MUI_ObtainPen()

MUI_ObtainPen -- Obtain a drawing pen.

Synopsis

MUI_ObtainPen ( mri , spec , flags )
A0    A1     D0
LONG MUI_ObtainPen
(
struct MUI_RenderInfo *mri,
struct MUI_PenSpec *spec,
ULONG flags
);

Function

Whenever your application needs custom drawing pens, you should allow your user to adjust them with a Poppen class. The result from this Poppen class is a struct MUI_PenSpec which you can save somewhere in your preferences and use together with MUI_ObtainPen(), MUI_ReleasePen() and the MUIPEN() macro to transform the spec into a pen number useful for SetAPen(). NOTE This function will work under 2.x but will generally perform better under 3.x and above.

Example

See demo program Class2.c

See also

MUI_ReleasePen()


MUI_Redraw()

MUI_Redraw -- Redraw yourself.

Synopsis

MUI_Redraw( obj, flag )
A0   D0

VOID MUI_Redraw( Object *obj, ULONG flag );

Function

With MUI_Redraw(), an object tells itself to refresh, e.g. when some internal attributes were changed. Calling MUI_Redraw() is only legal within a custom class dispatcher, using this function within an applications main part is invalid! Most objects graphical representation in a window depends on some attributes. A fuel gauge for example would depend on its MUIA_Gauge_Current attribute, an animation object would depend on MUIA_Animation_CurrentFrame. Whenever someone changes such an attribute with a SetAttrs() call, the corresponding object receives an OM_SET method with the new value. Usually, it could just render itself with some graphics.library calls. However, if the object is placed in a virtual group or if some other clipping or coordinate translation is required, this simple rendering will lead into problems. That's why MUI offers the MUI_Redraw() function call. Instead of drawing directly during OM_SET, you should simply call MUI_Redraw(). MUI calculates all necessary coordinates and clip regions (in case of virtual groups) and then sends a MUIM_Draw method to your object. To emphasize this point again: The only time your object is allowed to render something is when you receive a MUIM_Draw method. Drawing during other methods is illegal. Note: As long as no special cases (e.g. virtual groups) are present, MUI_Redraw is very quick and calls your MUIM_Draw method immediately. No coordinate translations or clip regions need to be calculated.

Inputs

obj - pointer to yourself. flag - MADF_DRAWOBJECT or MADF_DRAWUPDATE. The flag given here affects the objects flags when MUI calls the MUIM_Draw method. There are several caveats when implementing MUIM_DRAW, see the developer documentation for details.

Example

/* Note: This example was broken up to version 2.1 of muimaster.doc */
LONG mSet(struct IClass *cl,Object *obj,sruct opSet *msg)
{
struct Data *data = INST_DATA(cl,obj);
struct TagItem *tags,*tag;
for (tags=msg->ops_AttrList;tag=NextTagItem(&tags);)
{
switch (tag->ti_Tag)
{
case MYATTR_PEN_1:
data->pen1 = tag->ti_Data;       /* set the new value  */
data->mark = 1;                  /* set internal marker*/
MUI_Redraw(obj,MADF_DRAWUPDATE); /* update ourselves   */
break;
case MYATTR_PEN_1:
data->pen2 = tag->ti_Data;       /* set the new value  */
data->mark = 2;                  /* set internal marker*/
MUI_Redraw(obj,MADF_DRAWUPDATE); /* update ourselves   */
break;
}
}
return(DoSuperMethodA(cl,obj,msg));
}
LONG mDraw(struct IClass *cl,Object *obj,struct MUIP_Draw *msg)
{
struct Data *data = INST_DATA(cl,obj);
// ** Note: You *must* call the super method prior to do
// ** anything else, otherwise msg->flags will not be set
// ** properly !!!
DoSuperMethodA(cl,obj,msg); // ALWAYS REQUIRED!
if (msg->flags & MADF_DRAWUPDATE)
{
/* called as a result of our MUI_Redraw() during
MUIM_Set method. Depending on our internal
marker, we render different things. */
switch (data->mark)
{
case 1: RenderChangesFromPen1(cl,obj); break;
case 2: RenderChangesFromPen2(cl,obj); break;
}
}
else if (msg->flags & MADF_DRAWOBJECT)
{
/* complete redraw, maybe the window was just opened. */
DrawObjectCompletely(cl,obj);
}
/* if MADF_DRAWOBJECT wasn't set, MUI just wanted to update
the frame or some other part of our object. In this case
we just do nothing. */
return(0);
}

See also

area.mui/MUIM_Draw


MUI_ReleasePen()

MUI_ReleasePen -- Release a drawing pen.

Synopsis

MUI_ReleasePen ( mri , pen )
A0    D0
LONG MUI_ReleasePen
(
struct MUI_RenderInfo *mri,
ULONG pen
);

Function

Release a pen obtained with MUI_ObtainPen(). Usually placed in the Cleanup method of custom classes. NOTE Do not use the MUIPEN() maros when releasing pens!

Example

See demo program Class2.c

See also

MUI_ObtainPen()


MUI_RequestA()

MUI_RequestA -- Pop up a MUI requester.

Synopsis

MUI_RequestA(app,win,flags,title,gadgets,format,params)
D0   D1  D2    A0     A1      A2     A3
LONG MUI_RequestA ( APTR app, APTR win, LONGBITS flags,
char *title, char *gadgets, char *format, APTR params );
LONG MUI_Request ( APTR app, APTR win, LONGBITS flags,
char *title, char *gadgets, char *format, ...);
�  FUNCTION
Pop up a MUI requester. Using a MUI requester instead
of a standard system requester offers you the possibility
to include text containing all the text engine format codes.

Inputs

app - The application object. If you leave this NULL, MUI_RequestA() will fall back to a standard system requester. win - Pointer to a window of the application. If this is used, the requester will appear centered relative to this window. flags - For future expansion, must be 0 for now. title - Title for the requester window. Defaults to the name of the application when NULL (and app!=NULL). gadgets - Pointer to a string containing the possible answers. The format looks like "Save|_Use|_Test|_Cancel". If you precede an entry with a '*', this answer will become the active object. Pressing will terminate the requester with this response. A '' character indicates the keyboard shortcut for this response. format - A printf-style formatting string. params - Pointer to an array of ULONG containing the parameter values for format.

Results

0, 1, ..., N = Successive id values, for the gadgets you specify for the requester. NOTE: The numbering from left to right is actually: 1, 2, ..., N, 0. In case of a problem (e.g. out of memory), the function returns FALSE.

See also

MUIA_Text_Contents


MUI_RejectIDCMP()

MUI_RejectIDCMP -- Reject previously requested input events.

Synopsis

MUI_RejectIDCMP( obj, flags )
A0   D0
�  FUNCTION
Reject previously requested input events. You should
ensure that you reject all input events you requested
for an object before it gets disposed. Rejecting
flags that you never requested has no effect.
Critical flags such as IDCMP_MOUSEMOVE and IDCMP_INTUITICKS
should be rejected as soon as possible. See MUI_RequestIDCMP()
for details.

VOID MUI_RejectIDCMP( Object *obj, ULONG flags );

Inputs

obj - pointer to yourself as an object. flags - one or more IDCMP_XXXX flags.

Example

LONG CleanupMethod(struct IClass *cl, Object *obj, Msg msg)
{
MUI_RejectIDCMP( obj, IDCMP_MOUSEBUTTONS|IDCMP_RAWKEY );
return(DoSuperMethodA(cl,obj,msg));
}

See also

MUI_RequestIDCMP()


MUI_RequestIDCMP()

MUI_RequestIDCMP -- Request input events for your custom class.

Synopsis

MUI_RequestIDCMP( obj, flags )
A0   D0
�  FUNCTION
If your custom class needs to do some input handling, you must
explicitly request the events you want to receive. You can
request (and reject) events at any time.
Whenever an input event you requested arrives at your parent
windows message port, your object will receive a
MUIM_HandleInput method.
Note: Time consuming IDCMP flags such as IDCMP_INTUITICKS and
IDCMP_MOUSEMOVE should be handled with care. Too many
objects receiving them will degrade performance With
the following paragraph in mind, this isn't really
a problem:
You should try to request critical events only when you
really need them and reject them with MUI_RejectIDCMP()
as soon as possible. Usually, mouse controlled objects
only need MOUSEMOVES and INTUITICKS when a button
is pressed. You should request these flags only
on demand, i.e. after receiving a mouse down event
and reject them immediately after the button has been
released.

VOID MUI_RequestIDCMP( Object *obj, ULONG flags );

Inputs

obj - pointer to yourself as an object. flags - one or more IDCMP_XXXX flags.

Example

LONG SetupMethod(struct IClass *cl, Object *obj, Msg msg)
{
if (!DoSuperMethodA(cl,obj,msg))
return(FALSE);
/* do some setup here... */
...;
/* i need mousebutton events and keyboard */
MUI_RequestIDCMP( obj, IDCMP_MOUSEBUTTONS|IDCMP_RAWKEY );
return(TRUE);
}

See also

MUI_RejectIDCMP()


MUI_SetError()

MUI_SetError -- Set an error value.

Synopsis

�  FUNCTION
Obsolete. Better use SetIoErr()/IoErr().

VOID MUI_SetError(LONG);

See also

MUI_Error()