Enlightenment CVS committal
Author : rbdpngn
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src
Modified Files:
ewl_filedialog.c ewl_filedialog.h
Log Message:
Change in the filedialog API, didn't make sense for it to inherit from the
floater.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_filedialog.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- ewl_filedialog.c 29 Jan 2004 06:49:34 -0000 1.25
+++ ewl_filedialog.c 30 Jan 2004 02:33:34 -0000 1.26
@@ -2,15 +2,13 @@
/**
- * @param follows: the widget this dialog follows
* @param type: type of dialog to display
* @param ok_cb: callback to be called when open/save button is pushed
* @param cancel_cb: callback to be called when cancel button is pushed
* @return Returns a new filedialog in success, NULL on failure.
* @brief Create a new filedialog
*/
-Ewl_Widget *ewl_filedialog_new(Ewl_Widget * follows,
- Ewl_Filedialog_Type type,
+Ewl_Widget *ewl_filedialog_new(Ewl_Filedialog_Type type,
Ewl_Callback_Function ok_cb,
Ewl_Callback_Function cancel_cb)
{
@@ -22,7 +20,7 @@
if (!fd)
DRETURN_PTR(NULL, DLEVEL_STABLE);
- ewl_filedialog_init(fd, follows, type, ok_cb, cancel_cb);
+ ewl_filedialog_init(fd, type, ok_cb, cancel_cb);
DRETURN_PTR(EWL_WIDGET(fd), DLEVEL_STABLE);
}
@@ -30,7 +28,6 @@
/**
* @param fd: the filedialog
- * @param follows: widget to follow for the floater
* @param type: the filedialog type
* @param ok_cb: the callback to call when open/save button is pushed
* @param cancel_cb: the callback to call when cancel button is pushed
@@ -38,79 +35,24 @@
* @brief Initialize a new filedialog
*/
void
-ewl_filedialog_init(Ewl_Filedialog * fd, Ewl_Widget * follows,
- Ewl_Filedialog_Type type, Ewl_Callback_Function ok_cb,
- Ewl_Callback_Function cancel_cb)
+ewl_filedialog_init(Ewl_Filedialog * fd, Ewl_Filedialog_Type type,
+ Ewl_Callback_Function ok_cb, Ewl_Callback_Function cancel_cb)
{
Ewl_Widget *w;
+ Ewl_Widget *vbox;
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR ("fd", fd);
w = EWL_WIDGET(fd);
- ewl_floater_init(EWL_FLOATER(w), follows);
+ ewl_box_init(EWL_BOX(w), EWL_ORIENTATION_VERTICAL);
ewl_object_set_fill_policy(EWL_OBJECT(w), EWL_FLAG_FILL_SHRINK |
EWL_FLAG_FILL_FILL);
fd->type = type;
ewl_widget_set_appearance (EWL_WIDGET (w), "filedialog");
- if (type == EWL_FILEDIALOG_TYPE_OPEN)
- ewl_filedialog_open_init(EWL_FILEDIALOG (fd), ok_cb, cancel_cb);
- else
- ewl_filedialog_save_init(EWL_FILEDIALOG (fd), ok_cb, cancel_cb);
-
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-void ewl_filedialog_change_labels (Ewl_Widget * w, void *ev_data,
- void *user_data)
-{
- char *ptr;
- char str[PATH_MAX + 50];
- Ewl_Filedialog *fd = user_data;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- ptr = ewl_fileselector_get_path (EWL_FILESELECTOR (fd->selector));
-
- snprintf (str, sizeof (str), "Current dir: %s", ptr);
-
- ewl_text_set_text (EWL_TEXT (fd->path_label), str);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-void ewl_filedialog_change_entry (Ewl_Widget * w, void *ev_data,
- void *user_data)
-{
- Ewl_Filedialog *fd = user_data;
- Ewl_Fileselector *fs = EWL_FILESELECTOR (fd->selector);
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- ewl_entry_set_text (EWL_ENTRY (fd->entry), fs->item);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-
-void
-ewl_filedialog_open_init(Ewl_Filedialog * fd, Ewl_Callback_Function ok_cb,
- Ewl_Callback_Function cancel_cb)
-{
- Open_Dialog *od;
- Ewl_Widget *vbox;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- od = NEW(Open_Dialog, 1);
-
- if (!od)
- return;
-
vbox = ewl_vbox_new ();
ewl_object_set_fill_policy(EWL_OBJECT(vbox), EWL_FLAG_FILL_SHRINK |
EWL_FLAG_FILL_FILL);
@@ -131,51 +73,87 @@
EWL_CALLBACK_CLICKED, ewl_filedialog_change_entry, fd);
ewl_widget_show(fd->selector);
- od->box = ewl_box_new(EWL_ORIENTATION_HORIZONTAL);
- ewl_object_set_fill_policy(EWL_OBJECT(od->box), EWL_FLAG_FILL_HFILL |
- EWL_FLAG_FILL_HSHRINK);
- ewl_box_set_spacing(EWL_BOX(od->box), 4);
- ewl_object_set_padding(EWL_OBJECT(od->box), 10, 10, 10, 10);
+ fd->button_box = ewl_box_new(EWL_ORIENTATION_HORIZONTAL);
+ ewl_object_set_fill_policy(EWL_OBJECT(fd->button_box),
+ EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_HSHRINK);
+ ewl_box_set_spacing(EWL_BOX(fd->button_box), 4);
+ ewl_object_set_padding(EWL_OBJECT(fd->button_box), 10, 10, 10, 10);
/*
- ewl_object_set_fill_policy(EWL_OBJECT(od->box), EWL_FLAG_FILL_NONE);
+ ewl_object_set_fill_policy(EWL_OBJECT(fd->button_box), EWL_FLAG_FILL_NONE);
*/
- ewl_object_set_alignment(EWL_OBJECT(od->box), EWL_FLAG_ALIGN_RIGHT);
- ewl_container_append_child(EWL_CONTAINER(vbox), od->box);
- ewl_widget_show(od->box);
+ ewl_object_set_alignment(EWL_OBJECT(fd->button_box), EWL_FLAG_ALIGN_RIGHT);
+ ewl_container_append_child(EWL_CONTAINER(vbox), fd->button_box);
+ ewl_widget_show(fd->button_box);
fd->entry = ewl_entry_new ("");
- ewl_container_append_child(EWL_CONTAINER(od->box), fd->entry);
+ ewl_container_append_child(EWL_CONTAINER(fd->button_box), fd->entry);
ewl_callback_append (fd->entry, EWL_CALLBACK_VALUE_CHANGED,
ewl_filedialog_change_path, fd);
ewl_widget_show (fd->entry);
- od->open = ewl_button_new("Open");
- ewl_object_set_fill_policy(EWL_OBJECT(od->open), EWL_FLAG_FILL_NONE);
- ewl_callback_append(od->open, EWL_CALLBACK_CLICKED,
+
+ if (type == EWL_FILEDIALOG_TYPE_OPEN)
+ fd->ok = ewl_button_new("Open");
+ else
+ fd->ok = ewl_button_new("Save");
+
+ ewl_object_set_fill_policy(EWL_OBJECT(fd->ok), EWL_FLAG_FILL_NONE);
+ ewl_callback_append(fd->ok, EWL_CALLBACK_CLICKED,
ewl_filedialog_hide_cb, fd);
if (ok_cb) {
- ewl_callback_append(od->open, EWL_CALLBACK_CLICKED, ok_cb,
+ ewl_callback_append(fd->ok, EWL_CALLBACK_CLICKED, ok_cb,
fd->selector);
}
- ewl_container_append_child(EWL_CONTAINER(od->box), od->open);
- ewl_widget_show(od->open);
+ ewl_container_append_child(EWL_CONTAINER(fd->button_box), fd->ok);
+ ewl_widget_show(fd->ok);
- od->cancel = ewl_button_new("Cancel");
- ewl_object_set_fill_policy(EWL_OBJECT(od->cancel), EWL_FLAG_FILL_NONE);
- ewl_callback_append(od->cancel, EWL_CALLBACK_CLICKED,
+ fd->cancel = ewl_button_new("Cancel");
+ ewl_object_set_fill_policy(EWL_OBJECT(fd->cancel), EWL_FLAG_FILL_NONE);
+ ewl_callback_append(fd->cancel, EWL_CALLBACK_CLICKED,
ewl_filedialog_hide_cb, fd);
if (cancel_cb) {
- ewl_callback_append(od->cancel, EWL_CALLBACK_CLICKED,
+ ewl_callback_append(fd->cancel, EWL_CALLBACK_CLICKED,
cancel_cb, fd->selector);
}
- ewl_container_append_child(EWL_CONTAINER(od->box), od->cancel);
- ewl_widget_show(od->cancel);
+ ewl_container_append_child(EWL_CONTAINER(fd->button_box), fd->cancel);
+ ewl_widget_show(fd->cancel);
+
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+void ewl_filedialog_change_labels (Ewl_Widget * w, void *ev_data,
+ void *user_data)
+{
+ char *ptr;
+ char str[PATH_MAX + 50];
+ Ewl_Filedialog *fd = user_data;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ ptr = ewl_fileselector_get_path (EWL_FILESELECTOR (fd->selector));
+
+ snprintf (str, sizeof (str), "Current dir: %s", ptr);
- fd->dialog = (void *) od;
+ ewl_text_set_text (EWL_TEXT (fd->path_label), str);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
+void ewl_filedialog_change_entry (Ewl_Widget * w, void *ev_data,
+ void *user_data)
+{
+ Ewl_Filedialog *fd = user_data;
+ Ewl_Fileselector *fs = EWL_FILESELECTOR (fd->selector);
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ ewl_entry_set_text (EWL_ENTRY (fd->entry), fs->item);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+
void ewl_filedialog_change_path(Ewl_Widget * w, void *ev_data, void *user_data)
{
struct stat statbuf;
@@ -193,28 +171,8 @@
}
}
-void
-ewl_filedialog_save_init(Ewl_Filedialog * fd, Ewl_Callback_Function ok_cb,
- Ewl_Callback_Function cancel_cb)
-{
- Save_Dialog *sd;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- sd = NEW(Save_Dialog, 1);
- if (!sd)
- return;
-
- fd->selector = ewl_fileselector_new(ok_cb);
- ewl_container_append_child(EWL_CONTAINER(fd), fd->selector);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
void ewl_filedialog_hide_cb(Ewl_Widget * w, void *ev_data, void *user_data)
{
Ewl_Widget *fd = user_data;
-#if 0
ewl_widget_hide(fd);
-#endif
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_filedialog.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- ewl_filedialog.h 29 Jan 2004 04:26:18 -0000 1.10
+++ ewl_filedialog.h 30 Jan 2004 02:33:34 -0000 1.11
@@ -28,57 +28,24 @@
*/
struct Ewl_Filedialog
{
- Ewl_Floater box; /**< the box container */
+ Ewl_Box box; /**< the box container */
Ewl_Filedialog_Type type; /**< define what type of filedialog */
Ewl_Widget *selector; /**< Ewl_Fileselector */
Ewl_Widget *path_label; /**< label to display current path */
Ewl_Widget *entry; /**< entry for manual input or current selected */
- void *dialog; /**< open or save dialog */
-};
+ Ewl_Widget *button_box; /**< box to hold the buttons */
-/**
- * The Open_Dialog
- */
-typedef struct _open_dialog Open_Dialog;
-
-/**
- * @struct Open_Dialog
- *
- */
-struct _open_dialog
-{
- Ewl_Widget *box; /**< box to hold the buttons */
-
- Ewl_Widget *open; /**< open button */
+ Ewl_Widget *ok; /**< open/save button */
Ewl_Widget *cancel; /**< cancel button */
};
-/**
- * The Save_Dialog
- */
-typedef struct _save_dialog Save_Dialog;
-/**
- * @struct Save_Dialog
- *
- */
-struct _save_dialog
-{
- Ewl_Widget *inputbox; /**< box to hold text input widgets */
- Ewl_Widget *buttonbox; /**< box to hold buttons */
-
- Ewl_Widget *save; /**< save button */
- Ewl_Widget *cancel; /**< cancel button */
-};
-
-
-Ewl_Widget *ewl_filedialog_new (Ewl_Widget * follows, Ewl_Filedialog_Type type,
+Ewl_Widget *ewl_filedialog_new (Ewl_Filedialog_Type type,
Ewl_Callback_Function ok_cb, Ewl_Callback_Function cancel_cb);
-void ewl_filedialog_init (Ewl_Filedialog * fd, Ewl_Widget * follows,
- Ewl_Filedialog_Type type, Ewl_Callback_Function cb,
- Ewl_Callback_Function cancel_cb);
+void ewl_filedialog_init (Ewl_Filedialog * fd, Ewl_Filedialog_Type type,
+ Ewl_Callback_Function cb, Ewl_Callback_Function cancel_cb);
void ewl_filedialog_open_init (Ewl_Filedialog * fd, Ewl_Callback_Function cb,
Ewl_Callback_Function cancel_cb);
void ewl_filedialog_save_init (Ewl_Filedialog * fd, Ewl_Callback_Function cb,
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs