[AD] GUI Proc Added: d_titlebox_proc

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


I made a new gui proc, d_titlebox_proc, that draws the dialog box with a titlebar. I added docs for it in allegro._tx too. Attached is the patch for guiproc.c, gui.h, and allegro._tx to add the new proc.
Index: docs/src/allegro._tx
===================================================================
RCS file: /cvsroot/alleg/allegro/docs/src/allegro._tx,v
retrieving revision 1.244
diff -u -r1.244 allegro._tx
--- docs/src/allegro._tx	5 Aug 2004 08:18:18 -0000	1.244
+++ docs/src/allegro._tx	5 Aug 2004 16:12:22 -0000
@@ -8265,6 +8265,12 @@
 @eref exgui, exrgbhsv
    These draw boxes onto the screen, with or without a shadow.
 
+@@int @d_titlebox_proc(int msg, DIALOG *d, int c);
+@eref exgui, exrgbhsv
+   This draws a dialog box with a titlebar. Text is in dp, titlebar color
+   can be specified in d1 (or set it to 0 for the default), and title
+   text color can be set in d2 (or set it to 0 for the default).
+
 @@int @d_bitmap_proc(int msg, DIALOG *d, int c);
 @eref exgui, exrgbhsv
    This draws a bitmap onto the screen, which should be pointed to by the 
Index: include/allegro/gui.h
===================================================================
RCS file: /cvsroot/alleg/allegro/include/allegro/gui.h,v
retrieving revision 1.14
diff -u -r1.14 gui.h
--- include/allegro/gui.h	14 Jul 2004 02:04:34 -0000	1.14
+++ include/allegro/gui.h	5 Aug 2004 16:16:35 -0000
@@ -151,6 +151,7 @@
 AL_FUNC(int, d_clear_proc, (int msg, DIALOG *d, int c));
 AL_FUNC(int, d_box_proc, (int msg, DIALOG *d, int c));
 AL_FUNC(int, d_shadow_box_proc, (int msg, DIALOG *d, int c));
+AL_FUNC(int, d_titlebox_proc, (int msg, DIALOG *d, intc ));
 AL_FUNC(int, d_bitmap_proc, (int msg, DIALOG *d, int c));
 AL_FUNC(int, d_text_proc, (int msg, DIALOG *d, int c));
 AL_FUNC(int, d_ctext_proc, (int msg, DIALOG *d, int c));
Index: src/guiproc.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/guiproc.c,v
retrieving revision 1.26
diff -u -r1.26 guiproc.c
--- src/guiproc.c	27 Jul 2004 10:33:21 -0000	1.26
+++ src/guiproc.c	5 Aug 2004 16:14:54 -0000
@@ -20,6 +20,8 @@
  *
  *      d_text_list_proc by Andy Goth.
  *
+ *      d_titlebox_proc by Bobby Ferris.
+ *
  *      See readme.txt for copyright information.
  */
 
@@ -186,6 +188,33 @@
 
 
 
+/* d_titlebox_proc:
+ *  Simple dialog procedure: draws a box with a titlebar.
+ */
+int d_titlebox_proc(int msg, DIALOG *d, int c)
+{
+  ASSERT(d);
+  if(msg == MSG_DRAW && d->dp)
+  {
+    int fg = (d->flags & D_DISABLED) ? gui_mg_color : d->fg;
+    int tc = d->d1 != 0 ? d->d1 : makecol(0, 0, 128);
+    int ttc = d->d2 != 0 ? d->d2 : makecol(255, 255, 255);
+    int by = d->y + 4 + text_height(font);
+    rectfill(screen, d->x + 1, d->y + 1, d->x + d->w - 3, by - d->y, tc);
+    rectfill(screen, d->x + 1, by, d->x + d->w - 3, by + d->h - (2 + text_height(font)), d->bg);
+    rect(screen, d->x, d->y, d->x + d->w - 1, d->y + d->h - 1, fg);
+    textprintf_ex(screen, font, d->x + 2, d->y + 3, ttc, tc, "%s", (char *)d->dp);
+  }
+  else
+  {
+    return d_box_proc(msg, d, c);
+  }
+  
+  return D_O_K;
+}
+
+
+
 /* d_shadow_box_proc:
  *  Simple dialog procedure: draws a box with a shadow.
  */


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/