Enlightenment CVS committal

Author  : essiene
Project : e17
Module  : proto

Dir     : e17/proto/entrance_edit_gui/src/widgets


Modified Files:
        Entrance_Widgets.h Makefile.am ew_dialog.c ew_dialog.h 
        ew_group.c ew_group.h ew_notice.c ew_notice.h 
Added Files:
        ew_label.c ew_label.h ew_messagebox.c ew_messagebox.h 


Log Message:
- Modified patch sent in from Rhapsodhy for review. This patch does:
        - Provides ew_notice (did this by adding to ew_dialog)
        - due to changes, afftected how ew_dialog worked.
        _ used ew_notice to build ew_notice_ok() dialog.
        - Added an ew_box subsystem with ew_hbox_new and ew_vbox_new.
        _ Modified the part names of the edjes in the icons.edj

- My modifications to his patch are as follows:
        - Revert ew_dialog back to being as simple as it was.
        - rather than add to ew_dialog, make ew_notice inherit from ew_dialog 
and add the new requirements in ew_notice.
        - Based on ew_notice, build an ew_messagebox dialog, currently has 
ew_messagebox_ok() alone.
        - Modified ew_group to support vertical and horizontal directions.
        - Modified ew_group to support being named and unamed (which will add 
or remove the frame borders respectively)
        - due to above, remove ew_box.
        - Added new widget ew_label. Now we have a complete ew_messagebox 
framework, we just need more messageboxes
        - Use the new ew_messagebox_ok() in gui/layout.c to show what it looks 
like.
        - Rename all the ENTRANCE_* constants to EW_*
        - Update TODO file

        With these, out api is closer to complete. We can do some more complex 
layouts, etc.

        Next, we need just a few more key widgets to be abstracted... entry, 
radio-button and check-box then we'll have to fix that crappy preview window to 
load entrance itself instead of images/edje parts.

        Again the rationale is, this thin api shouldn't expose too much of etk, 
or we'll have a hard time getting it to ewl. Also, if we begin to get really 
complex, what's the point? :)



===================================================================
RCS file: /cvs/e/e17/proto/entrance_edit_gui/src/widgets/Entrance_Widgets.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- Entrance_Widgets.h  13 Aug 2006 17:00:15 -0000      1.3
+++ Entrance_Widgets.h  14 Aug 2006 17:08:55 -0000      1.4
@@ -11,6 +11,8 @@
 #include "ew_edjelist.h"
 #include "ew_image.h"
 #include "ew_notice.h"
+#include "ew_messagebox.h"
+#include "ew_label.h"
 
 
 
===================================================================
RCS file: /cvs/e/e17/proto/entrance_edit_gui/src/widgets/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- Makefile.am 13 Aug 2006 17:00:15 -0000      1.4
+++ Makefile.am 14 Aug 2006 17:08:55 -0000      1.5
@@ -5,13 +5,20 @@
 libentrance_widgets_la_HEADERS = \
        Entrance_Widgets.h \
        ew.h \
+       \
        ew_dialog.h \
+       ew_notice.h \
+       \
        ew_group.h \
+       \
        _ew_list.h \
        ew_textlist.h \
        ew_edjelist.h \
+       \
+       ew_messagebox.h \
+       \
        ew_image.h \
-       ew_notice.h
+       ew_label.h
 
 libentrance_widgets_ladir = $(prefix)/include
 
@@ -25,6 +32,8 @@
        ew_edjelist.c \
        ew_image.c \
        ew_notice.c \
+       ew_messagebox.c \
+       ew_label.c
        $(libentrance_widgets_la_HEADERS)
        
 libentrance_widgets_la_LIBADD  = @etk_libs@
===================================================================
RCS file: /cvs/e/e17/proto/entrance_edit_gui/src/widgets/ew_dialog.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ew_dialog.c 13 Aug 2006 00:54:58 -0000      1.3
+++ ew_dialog.c 14 Aug 2006 17:08:55 -0000      1.4
@@ -58,9 +58,9 @@
 }*/
 
 Entrance_Widget
-ew_dialog_group_add(Entrance_Dialog d, const char *title)
+ew_dialog_group_add(Entrance_Dialog d, const char *title, int direction)
 {
-       Entrance_Widget ew = ew_group_new(title);
+       Entrance_Widget ew = ew_group_new(title, direction);
        if(!ew) 
        {
                return;
===================================================================
RCS file: /cvs/e/e17/proto/entrance_edit_gui/src/widgets/ew_dialog.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ew_dialog.h 13 Aug 2006 00:54:58 -0000      1.2
+++ ew_dialog.h 14 Aug 2006 17:08:55 -0000      1.3
@@ -35,6 +35,6 @@
 void ew_dialog_close_button_add(Entrance_Dialog ew, void (*func)(void *, 
void*), void *);
 void ew_dialog_apply_button_add(Entrance_Dialog ew, void (*func)(void *, 
void*), void *);
 void ew_dialog_ok_button_add(Entrance_Dialog ew, void (*func)(void *, void*), 
void *);
-Entrance_Widget ew_dialog_group_add(Entrance_Dialog, const char *);
+Entrance_Widget ew_dialog_group_add(Entrance_Dialog, const char *, int);
 
 #endif
===================================================================
RCS file: /cvs/e/e17/proto/entrance_edit_gui/src/widgets/ew_group.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ew_group.c  12 Aug 2006 15:23:53 -0000      1.2
+++ ew_group.c  14 Aug 2006 17:08:55 -0000      1.3
@@ -2,7 +2,7 @@
 #include "Entrance_Widgets.h"
 
 Entrance_Widget
-ew_group_new(const char *title)
+ew_group_new(const char *title, int direction)
 {
        Entrance_Widget ew = ew_new();
        if(!ew)
@@ -10,9 +10,16 @@
                return NULL;
        }
 
-       ew->owner = etk_frame_new(title);
+       if(title)
+         ew->owner = etk_frame_new(title);
+       else
+         ew->owner = etk_vbox_new(ETK_FALSE, 0);
+
+       if(direction) /*HORIZONTAL*/
+         ew->box = etk_hbox_new(ETK_FALSE, 0);
+       else
+         ew->box = etk_vbox_new(ETK_FALSE, 0);
 
-       ew->box = etk_vbox_new(ETK_FALSE, 0);
        etk_container_add(ETK_CONTAINER(ew->owner), ew->box);
 
        return ew;
===================================================================
RCS file: /cvs/e/e17/proto/entrance_edit_gui/src/widgets/ew_group.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ew_group.h  12 Aug 2006 09:42:13 -0000      1.1
+++ ew_group.h  14 Aug 2006 17:08:55 -0000      1.2
@@ -1,7 +1,10 @@
 #ifndef _EW_GROUP_H
 #define _EW_GROUP_H
 
-Entrance_Widget ew_group_new(const char *);
+#define EW_GROUP_VERTICAL 0
+#define EW_GROUP_HORIZONTAL 1
+
+Entrance_Widget ew_group_new(const char *, int);
 void ew_group_add(Entrance_Widget, void *);
 
 
===================================================================
RCS file: /cvs/e/e17/proto/entrance_edit_gui/src/widgets/ew_notice.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ew_notice.c 13 Aug 2006 17:00:15 -0000      1.1
+++ ew_notice.c 14 Aug 2006 17:08:55 -0000      1.2
@@ -1,84 +1,99 @@
 #include <Etk.h>
 #include "Entrance_Widgets.h"
-#include <string.h>
 
-Entrance_Notice
-_ew_notice_new() {
-       Entrance_Notice ew = calloc(1, sizeof(*ew));
-       if(ew) {
-               ew->owner = NULL;
-               ew->box = NULL;
+static void _ew_cb_destroy(void *);
+static void _ew_cb_emit_response(Etk_Object *, void *data);
+
+Entrance_Dialog 
+ew_notice_new(const char *title)
+{
+       Entrance_Dialog ew = ew_dialog_new(title, EW_FALSE);
+       if(!ew) 
+       {
+               return NULL;
        }
 
+       etk_signal_connect("destroyed", ETK_OBJECT(ew->owner), 
ETK_CALLBACK(_ew_cb_emit_response), NULL);
        return ew;
 }
 
-Entrance_Notice
-ew_notice_new(const char *type, const char *title, const char *message,        
void (*delete_event)(Etk_Window *window)) {
-       Entrance_Notice ew = _ew_notice_new();
-       char image[100] = "status/dialog-";
-       Etk_Widget *_hbox;
-
-       if(!ew) {
-               return NULL;
+void 
+ew_notice_show(Entrance_Dialog ew)
+{
+       ew_dialog_show(ew);
+}
+
+/*void 
+ew_dialog_add(Entrance_Dialog d, Entrance_Widget ew)
+{
+       if(d && ew)
+               etk_box_pack_start(ETK_BOX(d->box), ew->box, ETK_TRUE, 
ETK_TRUE, 0);
+}*/
+
+Entrance_Widget
+ew_notice_group_add(Entrance_Dialog d, const char *title, int direction)
+{
+       Entrance_Widget ew = ew_group_new(title, direction);
+       if(!ew) 
+       {
+               return;
        }
 
-       strcat(image, type);
-       
-       ew->owner = etk_dialog_new();
-       etk_window_title_set(ETK_WINDOW(ew->owner), title);
-       etk_window_wmclass_set(ETK_WINDOW(ew->owner), title, title); /* TODO: 
should use the wmclass and wmname of the main window/dialog instead */
-
-       etk_container_border_width_set(ETK_CONTAINER(ew->owner), 5);
-       etk_dialog_has_separator_set(ETK_DIALOG(ew->owner), ETK_TRUE);
-       if(delete_event)
-               etk_signal_connect("delete_event", ETK_OBJECT(ew->owner), 
ETK_CALLBACK(delete_event), NULL);
-       
-       ew->box = etk_hbox_new(ETK_FALSE, 10);
-       
-       _hbox = etk_hbox_new(ETK_FALSE, 10);
-       etk_box_pack_start(ETK_BOX(_hbox), 
etk_image_new_from_edje(etk_theme_icon_theme_get(), image), ETK_TRUE, ETK_TRUE, 
0);
-       etk_box_pack_end(ETK_BOX(_hbox), etk_label_new(message), ETK_TRUE, 
ETK_TRUE, 0);
-       etk_dialog_pack_in_main_area(ETK_DIALOG(ew->owner), _hbox, ETK_TRUE, 
ETK_TRUE, 0, ETK_FALSE);
+       etk_box_pack_start(ETK_BOX(d->box), ew->owner, ETK_TRUE, ETK_TRUE, 0);
 
        return ew;
 }
 
-int
-ew_notice_show(Entrance_Notice ew) {
-       etk_widget_show_all(ew->owner);
+void 
+ew_notice_button_add(Entrance_Dialog ew, const char *name, int response_id, 
void (*response_event)(void *, int, void *), void *data)
+{
+       Etk_Widget *btn = etk_dialog_button_add(ETK_DIALOG(ew->owner), name, 
response_id);
+       if(response_event)
+               etk_signal_connect("response", ETK_OBJECT(ew->owner), 
ETK_CALLBACK(response_event), data);
+       etk_box_pack_start(ETK_BOX(ew->hbox), btn, ETK_TRUE, ETK_TRUE, 0);
 }
 
-void
-ew_notice_destroy(Entrance_Notice ew) {
-       etk_object_destroy(ETK_OBJECT(ew->owner));      
+void 
+ew_notice_close_button_add(Entrance_Dialog ew, void (*response_event)(void *, 
int, void *), void *data)
+{
+       ew_notice_button_add(ew, _("Close"), EW_NOTICE_CLOSE_BUTTON, 
response_event, data);
+}
+
+void 
+ew_notice_apply_button_add(Entrance_Dialog ew, void (*response_event)(void *, 
int, void *), void *data)
+{
+       ew_notice_button_add(ew, _("Apply"), EW_NOTICE_APPLY_BUTTON, 
response_event, data);
+}
+
+void 
+ew_notice_ok_button_add(Entrance_Dialog ew, void (*response_event)(void *, 
int, void *), void *data)
+{
+       ew_notice_button_add(ew, _("Ok"), EW_NOTICE_OK_BUTTON, response_event, 
data);
 }
 
 void
-ew_notice_yes_button_add(Entrance_Notice ew, void (*response_event)(Etk_Dialog 
*, int, void *)) {
-       Etk_Widget *btn = etk_dialog_button_add(ETK_DIALOG(ew->owner), _("OK"), 
ENTRANCE_NOTICE_YES_BUTTON);
-       if(response_event)
-               etk_signal_connect("response", ETK_OBJECT(ew->owner), 
ETK_CALLBACK(response_event), NULL);
+ew_notice_yes_button_add(Entrance_Dialog ew, void (*response_event)(void *, 
int, void *), void *data) {
+       ew_notice_button_add(ew, _("Yes"), EW_NOTICE_YES_BUTTON, 
response_event, data);
 }
 
 void
-ew_notice_no_button_add(Entrance_Notice ew, void (*response_event)(Etk_Dialog 
*, int, void *)) {
-       Etk_Widget *btn = etk_dialog_button_add(ETK_DIALOG(ew->owner), _("OK"), 
ENTRANCE_NOTICE_NO_BUTTON);
-       if(response_event)
-               etk_signal_connect("response", ETK_OBJECT(ew->owner), 
ETK_CALLBACK(response_event), NULL);
+ew_notice_no_button_add(Entrance_Dialog ew, void (*response_event)(void *, 
int, void *), void *data) {
+       ew_notice_button_add(ew, _("No"), EW_NOTICE_NO_BUTTON, response_event, 
data);
 }
 
 void
-ew_notice_cancel_button_add(Entrance_Notice ew, void 
(*response_event)(Etk_Dialog *, int, void *)) {
-       Etk_Widget *btn = etk_dialog_button_add(ETK_DIALOG(ew->owner), _("OK"), 
ENTRANCE_NOTICE_CANCEL_BUTTON);
-       if(response_event)
-               etk_signal_connect("response", ETK_OBJECT(ew->owner), 
ETK_CALLBACK(response_event), NULL);
+ew_notice_cancel_button_add(Entrance_Dialog ew, void (*response_event)(void *, 
int, void *), void *data) {
+       ew_notice_button_add(ew, _("Cancel"), EW_NOTICE_CANCEL_BUTTON, 
response_event, data);
 }
 
 void
-ew_notice_ok_button_add(Entrance_Notice ew, void (*response_event)(Etk_Dialog 
*, int, void *)) {
-       Etk_Widget *btn = etk_dialog_button_add(ETK_DIALOG(ew->owner), _("OK"), 
ENTRANCE_NOTICE_OK_BUTTON);
-       if(response_event)
-               etk_signal_connect("response", ETK_OBJECT(ew->owner), 
ETK_CALLBACK(response_event), NULL);
+ew_notice_destroy(Entrance_Dialog ew)
+{
+       ew_dialog_destroy(ew);
 }
 
+/*privates*/
+static void
+_ew_cb_emit_response(Etk_Object *win, void *data) {
+       etk_signal_emit_by_name("response", ETK_OBJECT(win), NULL, 
ETK_DIALOG(win), EW_NOTICE_CLOSE_BUTTON, NULL);
+}
===================================================================
RCS file: /cvs/e/e17/proto/entrance_edit_gui/src/widgets/ew_notice.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ew_notice.h 13 Aug 2006 17:00:15 -0000      1.1
+++ ew_notice.h 14 Aug 2006 17:08:55 -0000      1.2
@@ -1,46 +1,25 @@
 #ifndef _EW_NOTICE_H
 #define _EW_NOTICE_H
 
-#define ICON_SIZE "48"
-#define ENTRANCE_NOTICE_QUESTION_DIALOG ("question_" ICON_SIZE)
-#define ENTRANCE_NOTICE_MESSAGE_DIALOG ("information_" ICON_SIZE)
-#define ENTRANCE_NOTICE_WARNING_DIALOG ("warning_" ICON_SIZE)
-#define ENTRANCE_NOTICE_ERROR_DIALOG           ("error_" ICON_SIZE)
 
-#define ENTRANCE_NOTICE_OK_BUTTON -5
-#define ENTRANCE_NOTICE_CANCEL_BUTTON -6
-#define ENTRANCE_NOTICE_YES_BUTTON -8
-#define ENTRANCE_NOTICE_NO_BUTTON  -9
-
-#define _EW_NOTICE_FREE(ew) if(1) \
-{ \
-       if(ew) \
-       { \
-               if(ew->owner) \
-               { \
-                       free(ew->owner); \
-               } \
-               if(ew->box)     \
-               { \
-                       free(ew->box); \
-               } \
-               free(ew); \
-       } \
-} 
-
-typedef struct _Entrance_Notice {
-       Etk_Widget *owner;
-       Etk_Widget *box;
-} *Entrance_Notice;
-
-Entrance_Notice ew_notice_new(const char *type, const char *title, const char 
*message, void (*)(Etk_Window *window));
-
-void ew_notice_ok_button_add(Entrance_Notice ew, void (*)(Etk_Dialog *, int, 
void *));
-void ew_notice_yes_button_add(Entrance_Notice ew, void (*)(Etk_Dialog *, int, 
void *));
-void ew_notice_no_button_add(Entrance_Notice ew, void (*)(Etk_Dialog *, int, 
void *));
-void ew_notice_cancel_button_add(Entrance_Notice ew, void (*)(Etk_Dialog *, 
int, void *));
-
-int ew_notice_show(Entrance_Notice ew);
-void ew_notice_destroy(Entrance_Notice ew);
+#define EW_NOTICE_OK_BUTTON -5
+#define EW_NOTICE_CANCEL_BUTTON -6
+#define EW_NOTICE_CLOSE_BUTTON -7
+#define EW_NOTICE_YES_BUTTON -8
+#define EW_NOTICE_NO_BUTTON  -9
+#define EW_NOTICE_APPLY_BUTTON -10
+
+Entrance_Dialog ew_notice_new(const char *);
+void ew_notice_show(Entrance_Dialog);
+Entrance_Widget ew_notice_group_add(Entrance_Dialog, const char *, int);
+void ew_notice_destroy(Entrance_Dialog);
+
+void ew_notice_button_add(Entrance_Dialog, const char*, int, void (*)(void *, 
int, void *), void *);
+void ew_notice_close_button_add(Entrance_Dialog, void (*)(void *, int, void 
*), void *);
+void ew_notice_apply_button_add(Entrance_Dialog, void (*)(void *, int, void 
*), void *);
+void ew_notice_ok_button_add(Entrance_Dialog, void (*)(void *, int, void *), 
void *);
+void ew_notice_yes_button_add(Entrance_Dialog, void (*)(void *, int, void *), 
void *);
+void ew_notice_no_button_add(Entrance_Dialog, void (*)(void *, int, void *), 
void *);
+void ew_notice_cancel_button_add(Entrance_Dialog, void (*)(void *, int, void 
*), void *);
 
 #endif



-------------------------------------------------------------------------
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