TABLE OF CONTENTS

ImageButton.mcc/ImageButton.mcc
ImageButton.mcc/MUIA_ImageButton_Image
ImageButton.mcc/MUIA_ImageButton_Label
ImageButton.mcc/MUIA_ImageButton_LabelPos

ImageButton.mcc/ImageButton.mcc ImageButton.mcc/ImageButton.mcc

Instead of creating simple and rather boring text buttons, ImageButton.mcc
allows the programmer to add every type of static graphics to the buttons.
This way, your graphical user interface will be more user-friendly and the
users will like to use it more often.

You can set the image, the label and the label position of a button at any
time. It is also possible to show/hide the image and/or the label at any
time.

See the supplied demonstration program for more details.

The demonstration program compiles fine under MaxonC++ 4.0, SAS/C 6.57 and
StormC 1.1.


Some additional notes:

ImageButtons can contain the following types of static graphics, only one at
a time for each button:

- graphics loaded via DataTypes
- ILBM BODY data in memory (provides all features of Bodychunk.mui)
- Image specifications (provides all features of Image.mui)

Please note that when an image cannot be created (DataTypes system not
available, not enough free store...), the image will simply be hidden. No
errors will occur.

ImageButton.mcc usually creates a full-featured button, that means with a
button frame, button background and button font. If you want to change these
attributes, just set them as usual (use MUIA_Frame, MUIA_Background and
MUIA_Font). Remember that it's not wise the change them, though. You should
have a good reason for doing that.

Whenever an image and a label are both displayed, ImageButton.mcc will
insert a space between them, which is at least 3 pixels high (in vertical
buttons) or 10 pixels wide (in horizontal buttons).

ImageButtons do not have a fixed size. If you eg. want to create a
fixedheight horizontal button with an image, you should use MUIA_VertWeight
with 0 to limit its height.

If you eg. want a horizontal group with three ImageButtons with the same
height each, but as small as possible, you should use the following:

Child, HGroup,
Child, button1 = ImageButtonObject,
/* ... */
End,
Child, button2 = ImageButtonObject,
/* ... */
End,
Child, button3 = ImageButtonObject,
/* ... */
End,
MUIA_VertWeight, 0,
End,



GO TO CONTENTS

ImageButton.mcc/MUIA_ImageButton_Image ImageButton.mcc/MUIA_ImageButton_Image

MUIA_ImageButton_Image -- [ISG], struct MUIS_ImageButton_Image *

Set or get the image of a button. NULL will hide the image. If there
already is an image being displayed, it will be removed and replaced
by the new one.

You have to pass a pointer to a MUIS_ImageButton_Image structure,
which has the following elements:

ibi_ImageType -- ULONG (always)
Specifies the image type of the image:

MUIV_ImageButton_ImageType_File:
An external file will be loaded into memory via Data-
Types.

MUIV_ImageButton_ImageType_Body:
A BODY chunk of an ILBM file in memory will be displayed.
See Bodychunk.mui/MUIA_Bodychunk_Body for details.

MUIV_ImageButton_ImageType_Image:
A MUI Image specification will be displayed.
See Image.mui for details.


The following elements do not need to be specified always, but only
if their corresponding image type is used. The abbreviations in
brackets have the following meanings:

file -- ibi_ImageType is set to MUIV_ImageButton_ImageType_File
BODY -- ibi_ImageType is set to MUIV_ImageButton_ImageType_Body
Image -- ibi_ImageType is set to MUIV_ImageButton_ImageType_Image


ibi_Precision -- LONG (file & BODY)
Specifies the precision for remapping the image.
See Bitmap.mui/MUIA_Bitmap_Precision and graphics.library/
ObtainBestPenA() for details.

ibi_UseFriend -- BOOL (file & BODY)
Specifies if you want to use a friend bitmap.
See Bitmap.mui/MUIA_Bitmap_UseFriend and picture.datatype/
picture.datatype for details.

ibi_Filename -- STRPTR (file)
Specifies the external file to be loaded into memory via
DataTypes. If the DataTypes system is not available (eg. pre-V39)
or the file cannot be loaded, the image will simply be hidden.

ibi_Body -- UBYTE * (BODY)
Pointer to the BODY chunk of ILBM data in memory to be displayed.
If the image cannot be created, it will simply be hidden.
See Bodychunk.mui/MUIA_Bodychunk_Body for details.

ibi_Width -- ULONG (BODY)
The width of the image.
See Bitmap.mui/MUIA_Bitmap_Width for details.

ibi_Height -- ULONG (BODY)
The height of the image.
See Bitmap.mui/MUIA_Bitmap_Height for details.

ibi_Depth -- ULONG (BODY)
The depth of the image.
See Bodychunk.mui/MUIA_Bodychunk_Depth for details.

ibi_Masking -- UBYTE (BODY)
Specifies the masking planes.
See Bodychunk.mui/MUIA_Bodychunk_Masking for details.

ibi_Compression -- UBYTE (BODY)
Specifies if the BODY chunk is compressed.
See Bodychunk.mui/MUIA_Bodychunk_Compression for details.

ibi_Transparent -- LONG (BODY)
Specifies which color should be transparent (if you don't want
transparency, give MUIV_ImageButton_Transparent_None).
See Bitmap.mui/MUIA_Bitmap_Transparent for details.

ibi_SourceColors -- ULONG * (BODY)
Pointer to color array containing the colors of the image.
See Bitmap.mui/MUIA_Bitmap_SourceColors for details.

ibi_MappingTable -- UBYTE * (BODY)
Pointer to an array of UBYTEs, used for remapping the image.
See Bitmap.mui/MUIA_Bitmap_MappingTable for details.

ibi_FontMatchWidth -- BOOL (Image)
If TRUE, the width of the given image will be scaled to match the
current font.
See Image.mui/MUIA_Image_FontMatchWidth for details.

ibi_FontMatchHeight -- BOOL (Image)
If TRUE, the height of the given image will be scaled to match
the current font.
See Image.mui/MUIA_Image_FontMatchHeight for details.

ibi_FreeHoriz -- BOOL (Image)
Tell the image if it's allowed to get scaled horizontally.
See Image.mui/MUIA_Image_FreeHoriz for details.

ibi_FreeVert -- BOOL (Image)
Tell the image if it's allowed to get scaled vertically.
See Image.mui/MUIA_Image_FreeVert for details.

ibi_OldImage -- struct Image * (Image)
Allows you to use any conventional image structure. If you don't
want use Image structures, supply NULL. If the image cannot be
created, it will simply be hidden.
See Image.mui/MUIA_Image_OldImage for details.

ibi_Spec -- STRPTR (Image)
Specify a MUI Image specification. If you don't want to use MUI
image specifications, supply NULL. If the image cannot be
created, it will simply be hidden.
See Image.mui/MUIA_Image_Spec for details.

ibi_State -- LONG (Image)
Specify the state of the image.
See Image.mui/MUIA_Image_State for details.

EXAMPLE
Please refer to the ImageButton.mcc example program.

NOTES
The input will be buffered, you may destroy your private structure
after setting this attribute.

You may not modify the returned structure.

SEE ALSO
Bodychunk.mui
Bitmap.mui
Image.mui


GO TO CONTENTS

ImageButton.mcc/MUIA_ImageButton_Label ImageButton.mcc/MUIA_ImageButton_Label

MUIA_ImageButton_Label -- [ISG], STRPTR

Set or get the label of a button. NULL will hide the label. If there
is already a label being displayed, it will be removed and replaced
by the new one.

The label may contain an underscore character ("_"), which is used to
indicate to control key.

EXAMPLE
obj = ImageButtonObject,
MUIA_ImageButton_Label, "_Quit",
End;

NOTES
When hiding the label, the control key gets disabled. If you want a
control key though, you have to set MUIA_ControlChar yourself after
hiding the label.

Setting an empty string ("") will *not* hide the label but replace it
with an empty one.

The label is currently limited to a length of 80 characters.

The input will be buffered, you may destroy your private string after
setting this attribute.

You may not modify the returned string.

SEE ALSO
Area.mui/MUIA_ControlChar


GO TO CONTENTS

ImageButton.mcc/MUIA_ImageButton_LabelPosButton.mcc/MUIA_ImageButton_LabelPos

MUIA_ImageButton_LabelPos -- [ISG], ULONG

Forces the label of an ImageButton to be at the specified position.
If the position is already set, nothing will happen.

Default: MUIV_ImageButton_LabelPos_Bottom

SPECIAL INPUTS
MUIV_ImageButton_LabelPos_Bottom
The label will be below the image.

MUIV_ImageButton_LabelPos_Right
The label will be right from the image.

MUIV_ImageButton_LabelPos_Left
The label will be left from the image.

MUIV_ImageButton_LabelPos_Top
The label will be above the image.

NOTES
You may only set one of the special inputs, no other input will work.