/* * xproginfo.c * * Fancy scrolling message in a proginfo box * * © 1994-1998 Straylight */ /*----- Licensing note ----------------------------------------------------* * * This file is part of Straylight's Steel library. * * Steel is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * Steel is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Steel. If not, write to the Free Software Foundation, * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define _CORE #define _STDAPP #include "steel.h" #include "scroller.h" #include "xproginfo.h" #define xprogInfo__TITLE 0 #define xprogInfo__NAME 7 #define xprogInfo__PURPOSE 5 #define xprogInfo__AUTHOR 3 #define xprogInfo__VERSION 1 #define xprogInfo__SCROLLER 9 typedef struct { dbox d; scroller s; BOOL hasTitle; } xprogInfo__str; static void xprogInfo__redraw(wimp_redrawstr *r,void *handle) { xprogInfo__str *s=handle; if (!s->hasTitle) dbox_drawEmbeddedTitle(r,s->d); scroller_redraw(s->s,r); } static BOOL xprogInfo__raw(dbox d,wimp_eventstr *e,void *handle) { xprogInfo__str *s=handle; BOOL handled=FALSE; switch (e->e) { case wimp_EREDRAW: wimpt_redraw(xprogInfo__redraw,s); handled=TRUE; break; case wimp_ECLOSE: scroller_destroy(s->s); dbox_delete(s->d); mem_free(s); handled=TRUE; break; } return (handled); } void xprogInfo(char *name, char *purpose, char *author, int version, char *date, char *scrolltext, char *initText, int delay) { xprogInfo__str *s=mem_alloc(sizeof(xprogInfo__str)); if (!s) return; s->d=dbox_create("progInfo"); if (!s->d) { mem_free(s); return; } s->s=scroller_create(s->d,xprogInfo__SCROLLER,scrolltext,initText,delay); if (!s->s) { dbox_delete(s->d); mem_free(s); return; } if (s->hasTitle=dbox_hasTitle(s->d),!s->hasTitle) dbox_setEmbeddedTitle(s->d,xprogInfo__TITLE,TRUE); dbox_setfield(s->d,xprogInfo__NAME,"%s",name); dbox_setfield(s->d,xprogInfo__PURPOSE,"%s",purpose); dbox_setfield(s->d,xprogInfo__AUTHOR,"%s",author); dbox_setfield ( s->d, xprogInfo__VERSION, "%i.%02i (%s)", version/100, version%100, date ); dbox_rawEventHandler(s->d,xprogInfo__raw,s); dbox_display(s->d,dbox_MENU_OVERPTR); scroller_go(s->s); }