Mail Archives: djgpp/1997/08/14/05:36:17
Alistair Phillips writes:
>I was wondering if it was possible to use the GUI functions in Allegro
>but instead of having the window drawn as it appears by default you
>could set the buttons to display bitmaps I've already drawn and the
>windows itself displayed as a bitmap I've already drawn.
It is indeed possible. You need to write your own object procedure (a
custom equivalent of d_button_proc, d_list_proc, or whatever you are
using), which calls the Allegro version for most messages but handles
the draw message itself. For example:
int funkybutton_proc(int msg, DIALOG *d, int c)
{
if (msg == MSG_DRAW) {
// do fancy graphics code in here. Look at d->x, d->y, d->w, and
// d->h for the location of the object, d->fg and d->bg for the
// color, etc. If (d->flags & D_SELECTED) is set, the object
// should be displayed in it's selected form, and if (d->flags &
// D_GOTFOCUS) is set, it should be drawn in whatever manner
// indicates that it currently has the input focus.
return D_O_K;
}
return d_button_proc(msg, d, c);
}
--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
Beauty is a French phonetic corruption of a short cloth neck ornament.
- Raw text -