delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/14/05:36:17

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Q: Allegro GUI
Date: Fri, 8 Aug 1997 19:21:05 +0100
Organization: None
Distribution: world
Message-ID: <dzD0YPARO26zEwED@talula.demon.co.uk>
References: <33EAA397 DOT 6A97 AT bohm DOT anu DOT edu DOT au>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 31
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019