Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        dialog.c 


Log Message:
Use table with normal buttons in dialog footer (for now).

===================================================================
RCS file: /cvs/e/e16/e/src/dialog.c,v
retrieving revision 1.168
retrieving revision 1.169
diff -u -3 -r1.168 -r1.169
--- dialog.c    20 Aug 2006 17:39:32 -0000      1.168
+++ dialog.c    20 Aug 2006 18:40:41 -0000      1.169
@@ -948,10 +948,10 @@
 {
    DItem              *table, *di;
 
-   /* FIXME - Center table horizontally */
    table = DialogAddItem(parent, DITEM_TABLE);
    DialogItemTableSetOptions(table, 2, 0, 0, 0);
    DialogItemSetAlign(table, 512, 0);
+   DialogItemSetFill(table, 0, 0);
 
    di = DialogAddItem(table, DITEM_IMAGE);
    DialogItemImageSetFile(di, img);
@@ -962,31 +962,63 @@
    di = DialogAddItem(parent, DITEM_SEPARATOR);
 }
 
+/*
+ * Hacky wrapper to get the dialog closed as needed
+ * val = 0: Ok (apply, close)
+ *       1: Apply
+ *       2: Close
+ */
+static void
+DialogCallbackWrapper(Dialog * d, int val, void *data)
+{
+   DialogCallbackFunc *cb = data;
+
+   cb(d, val, NULL);
+
+   if (val == 0)
+      DialogClose(d);
+}
+
 static void
 DialogAddFooter(Dialog * d, DItem * parent, int flags, DialogCallbackFunc * cb)
 {
    DItem              *table, *di;
+   int                 n_buttons;
 
    di = DialogAddItem(parent, DITEM_SEPARATOR);
 
    table = DialogAddItem(parent, DITEM_TABLE);
-   DialogItemTableSetOptions(table, 1, 0, 0, 0);
    DialogItemSetAlign(table, 512, 0);
+   DialogItemSetFill(table, 0, 0);
 
+   /* FIXME - The "real" dialog buttons are slightly different */
+   n_buttons = 0;
    if (flags & 4)
      {
-       DialogAddButton(d, _("OK"), cb, 1, DLG_BUTTON_OK);
+       di = DialogAddItem(table, DITEM_BUTTON);
+       DialogItemSetText(di, _("OK"));
+       DialogItemSetCallback(di, DialogCallbackWrapper, 0, cb);
+       n_buttons++;
      }
    if (flags & 2)
      {
-       DialogAddButton(d, _("Apply"), cb, 0, DLG_BUTTON_APPLY);
-       DialogBindKey(d, "Return", cb, 0, NULL);
+       di = DialogAddItem(table, DITEM_BUTTON);
+       DialogItemSetText(di, _("Apply"));
+       DialogItemSetCallback(di, DialogCallbackWrapper, 1, cb);
+       DialogBindKey(d, "Return", DialogCallbackWrapper, 1, cb);
+       n_buttons++;
      }
    if (flags & 1)
      {
-       DialogAddButton(d, _("Close"), cb, 1, DLG_BUTTON_CLOSE);
+       di = DialogAddItem(table, DITEM_BUTTON);
+       DialogItemSetText(di, _("Close"));
+       DialogItemSetCallback(di, DialogCallbackClose, 0, NULL);
        DialogBindKey(d, "Escape", DialogCallbackClose, 0, NULL);
+       n_buttons++;
      }
+
+   DialogItemTableSetOptions(table, n_buttons, 0, 1, 0);
+
    DialogSetExitFunction(d, cb, 2);
 }
 
@@ -1714,6 +1746,21 @@
                   dii->update = 1;
                DialogDrawItem(d, dii);
             }
+
+#if 0                          /* Debug */
+          {
+             XGCValues           gcv;
+             GC                  gc;
+
+             pad = ImageclassGetPadding(d->iclass);
+             gcv.subwindow_mode = IncludeInferiors;
+             gc = EXCreateGC(d->pmap, GCSubwindowMode, &gcv);
+             XSetForeground(disp, gc, BlackPixel(disp, VRoot.scr));
+             XDrawRectangle(disp, d->pmap, gc, pad->left + di->x,
+                            pad->top + di->y, di->w, di->h);
+             EXFreeGC(gc);
+          }
+#endif
        }
        break;
 
@@ -2558,6 +2605,9 @@
        DItemEventMouseOut(win, di, ev);
        break;
      }
+
+   if (di->dlg->close)
+      _DialogClose(di->dlg);
 }
 
 static void



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to