Re: [AD] Overriding GUI menu look |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
> Attached is a proposed patch to allow overriding the look of the GUI
> menu (overriding MSG_DRAW for d_menu_proc is not enough; there are
> lots of internal things which I don't want to move out of gui.c).
>
> I tried to keep the changes to a minimum, but that means the size of
> the menu is still automatically calculated, which limits the styles
> you can use (or makes the menu look cramped). Oh well.
>
> Any objections?
>
I have a (IMHO) better idea. It has since long bithered me that there
was no real use in designing your own flashy looking GUI widgets, because
the standard dialogs (alert, file_slect etc) would still use the
old system Why not follow GTK+'s approach and replace all the
standard d_*_proc functiosn by function pointers?
This would not bew very compilcated (just rename everything in
guiproc.c to _d_*_proc and make them static , and add a list of
d_button_porc = _d_button_proc ath the bottom) and would not break the api,
while allowing you completely control the look of all elements,
so that file_select etc would also use your own buttons /listboxes.
maybe we would need to export the _d_*_proc versions as well, so you
can overload just the drawing function, or maybe just create a list of function
pointers for just the drawing part so you can just overload the drawing
part.
maybe something along the line of
struct GUI_STYLE
{
int (*button_draw)(DIALOG *d, int c),
int (*checkbox_draw)(DIALOG *d, int c),
int (*menuitem_draw)(DIALOG *d, int c),
} GUI_STYLE;
with a default style containing the current drawing code.
the d_button_proc() function would then just call
gui_style->button_draw(d,c);
for MSG_DRAW
This might need some more thinking for menus ( never got menus to
work properly in wham either, except by rewrinting the entire set of
menu functions)
What do you all think, I could probably spare some time this week to
make it that way.
(p.s. sorry peter for sending this to you privately
instead of to the list, I forgot to change the adress ;-)
--
Martijn Versteegh