aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2005-11-06 08:03:13 +0000
committerCarsten Haitzler <raster@rasterman.com>2005-11-06 08:03:13 +0000
commit43e88e956e503489c7ad96e7d7afba33dbfcdaa6 (patch)
treef2be2015d9630b3f155cff5636e691365f193a7b /src
parentading "livethumb" - it uses the ecore evas buffer engine stuff to make a (diff)
downloadenlightenment-43e88e956e503489c7ad96e7d7afba33dbfcdaa6.tar.gz
and working on maing a border selector
does NOTHING YET! BEWARE! do NOT useit if u dont want some pain. i need to make ecore evas canavses accepssible form an evas pointer etc. to make the livethumb stuff cleaner so it can work SVN revision: 18335
Diffstat (limited to 'src')
-rw-r--r--src/bin/Makefile.am6
-rw-r--r--src/bin/e_border.c10
-rw-r--r--src/bin/e_border.h1
-rw-r--r--src/bin/e_includes.h2
-rw-r--r--src/bin/e_int_border_border.c159
-rw-r--r--src/bin/e_int_border_border.h12
-rw-r--r--src/bin/e_int_border_locks.c4
-rw-r--r--src/bin/e_int_border_menu.c17
-rw-r--r--src/bin/e_scrollframe.c7
-rw-r--r--src/bin/e_scrollframe.h1
-rw-r--r--src/bin/e_widget_ilist.c144
-rw-r--r--src/bin/e_widget_ilist.h14
12 files changed, 376 insertions, 1 deletions
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index 10b193366..e50ca4f35 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -110,7 +110,9 @@ e_file_selector.h \
e_file_dialog.h \
e_int_border_menu.h \
e_ilist.h \
-e_livethumb.h
+e_livethumb.h \
+e_int_border_border.h \
+e_widget_ilist.h
enlightenment_src = \
e_user.c \
@@ -202,6 +204,8 @@ e_file_dialog.c \
e_int_border_menu.c \
e_ilist.c \
e_livethumb.c \
+e_int_border_border.c \
+e_widget_ilist.c \
$(ENLIGHTENMENTHEADERS)
enlightenment_SOURCES = \
diff --git a/src/bin/e_border.c b/src/bin/e_border.c
index a8cfbbd78..8d47996af 100644
--- a/src/bin/e_border.c
+++ b/src/bin/e_border.c
@@ -2647,6 +2647,11 @@ _e_border_free(E_Border *bd)
e_object_del(E_OBJECT(bd->border_remember_dialog));
bd->border_remember_dialog = NULL;
}
+ if (bd->border_border_dialog)
+ {
+ e_object_del(E_OBJECT(bd->border_border_dialog));
+ bd->border_border_dialog = NULL;
+ }
e_int_border_menu_del(bd);
@@ -2754,6 +2759,11 @@ _e_border_del(E_Border *bd)
e_object_del(E_OBJECT(bd->border_remember_dialog));
bd->border_remember_dialog = NULL;
}
+ if (bd->border_border_dialog)
+ {
+ e_object_del(E_OBJECT(bd->border_border_dialog));
+ bd->border_border_dialog = NULL;
+ }
e_int_border_menu_del(bd);
diff --git a/src/bin/e_border.h b/src/bin/e_border.h
index 9bc634e71..f642670ac 100644
--- a/src/bin/e_border.h
+++ b/src/bin/e_border.h
@@ -356,6 +356,7 @@ struct _E_Border
E_Menu *border_menu;
E_Config_Dialog *border_locks_dialog;
E_Config_Dialog *border_remember_dialog;
+ E_Config_Dialog *border_border_dialog;
E_Menu *border_stacking_menu;
Evas_List *pending_move_resize;
diff --git a/src/bin/e_includes.h b/src/bin/e_includes.h
index 7ca613e12..16565a138 100644
--- a/src/bin/e_includes.h
+++ b/src/bin/e_includes.h
@@ -91,3 +91,5 @@
#include "e_int_border_menu.h"
#include "e_ilist.h"
#include "e_livethumb.h"
+#include "e_int_border_border.h"
+#include "e_widget_ilist.h"
diff --git a/src/bin/e_int_border_border.c b/src/bin/e_int_border_border.c
new file mode 100644
index 000000000..98b69dfb7
--- /dev/null
+++ b/src/bin/e_int_border_border.c
@@ -0,0 +1,159 @@
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
+#include "e.h"
+
+/* PROTOTYPES - same all the time */
+typedef struct _CFData CFData;
+
+static void *_create_data(E_Config_Dialog *cfd);
+static void _free_data(E_Config_Dialog *cfd, CFData *cfdata);
+static int _basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata);
+static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata);
+
+/* Actual config data we will be playing with whil the dialog is active */
+struct _CFData
+{
+ E_Border *border;
+ int remember_border;
+};
+
+/* a nice easy setup function that does the dirty work */
+void
+e_int_border_border(E_Border *bd)
+{
+ E_Config_Dialog *cfd;
+ E_Config_Dialog_View v;
+
+ /* methods */
+ v.create_cfdata = _create_data;
+ v.free_cfdata = _free_data;
+ v.basic.apply_cfdata = _basic_apply_data;
+ v.basic.create_widgets = _basic_create_widgets;
+ v.advanced.apply_cfdata = NULL;
+ v.advanced.create_widgets = NULL;
+ /* create config diaolg for bd object/data */
+ cfd = e_config_dialog_new(bd->zone->container,
+ _("Window Border Selection"), NULL, 0, &v, bd);
+ bd->border_border_dialog = cfd;
+}
+
+/**--CREATE--**/
+static void
+_fill_data(CFData *cfdata)
+{
+ if ((cfdata->border->remember) &&
+ (cfdata->border->remember->apply & E_REMEMBER_APPLY_BORDER))
+ cfdata->remember_border = 1;
+}
+
+static void *
+_create_data(E_Config_Dialog *cfd)
+{
+ /* Create cfdata - cfdata is a temporary block of config data that this
+ * dialog will be dealing with while configuring. it will be applied to
+ * the running systems/config in the apply methods
+ */
+ CFData *cfdata;
+
+ cfdata = E_NEW(CFData, 1);
+ cfdata->border = cfd->data;
+ _fill_data(cfdata);
+ return cfdata;
+}
+
+static void
+_free_data(E_Config_Dialog *cfd, CFData *cfdata)
+{
+ /* Free the cfdata */
+ cfdata->border->border_border_dialog = NULL;
+ free(cfdata);
+}
+
+/**--APPLY--**/
+static int
+_basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
+{
+ /* FIXME: need to check if the remember stuff will actually work or notx
+ * (see e_int_border_remember.c where it checks and warns) */
+ if (cfdata->remember_border)
+ {
+ if (!cfdata->border->remember)
+ {
+ cfdata->border->remember = e_remember_new();
+ if (cfdata->border->remember)
+ {
+ e_remember_use(cfdata->border->remember);
+ e_remember_update(cfdata->border->remember, cfdata->border);
+ cfdata->border->remember->match |= E_REMEMBER_MATCH_NAME;
+ cfdata->border->remember->match |= E_REMEMBER_MATCH_CLASS;
+ cfdata->border->remember->match |= E_REMEMBER_MATCH_ROLE;
+ cfdata->border->remember->match |= E_REMEMBER_MATCH_TYPE;
+ cfdata->border->remember->match |= E_REMEMBER_MATCH_TRANSIENT;
+ cfdata->border->remember->apply |= E_REMEMBER_APPLY_BORDER;
+ }
+ }
+ }
+ else
+ {
+ if (cfdata->border->remember)
+ {
+ cfdata->border->remember->apply &= ~E_REMEMBER_APPLY_BORDER;
+ if (cfdata->border->remember->apply == 0)
+ {
+ e_remember_unuse(cfdata->border->remember);
+ e_remember_del(cfdata->border->remember);
+ cfdata->border->remember = NULL;
+ }
+ }
+ }
+ e_config_save_queue();
+ return 1; /* Apply was OK */
+}
+
+/**--GUI--**/
+static Evas_Object *
+_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata)
+{
+ /* generate the core widget layout for a basic dialog */
+ Evas_Object *o, *ob, *oi;
+ Evas_Coord wmw, wmh;
+
+ _fill_data(cfdata);
+ o = e_widget_list_add(evas, 0, 0);
+
+ oi = e_widget_ilist_add(evas, 48, 48);
+
+ ob = e_icon_add(evas);
+ e_icon_file_set(ob, "/home/raster/C/stuff/icons/cd.png");
+ e_widget_ilist_append(oi, ob, "Item 1", NULL, NULL);
+ ob = e_icon_add(evas);
+ e_icon_file_set(ob, "/home/raster/C/stuff/icons/cd.png");
+ e_widget_ilist_append(oi, ob, "Item 2", NULL, NULL);
+ ob = e_icon_add(evas);
+ e_icon_file_set(ob, "/home/raster/C/stuff/icons/cd.png");
+ e_widget_ilist_append(oi, ob, "Item 3 (With some very logn text after it to make it stretch out)", NULL, NULL);
+ ob = e_icon_add(evas);
+ e_icon_file_set(ob, "/home/raster/C/stuff/icons/cd.png");
+ e_widget_ilist_append(oi, ob, "Item 4", NULL, NULL);
+ e_widget_min_size_get(oi, &wmw, &wmh);
+ e_widget_min_size_set(oi, wmw, 150);
+
+ e_widget_ilist_go(oi);
+ e_widget_list_object_append(o, oi, 1, 1, 0.5);
+/*
+ of = e_widget_framelist_add(evas, _("Generic Locks"), 0);
+ ob = e_widget_check_add(evas, _("Lock the Window so it does only what I tell it to"), &(cfdata->do_what_i_say));
+ e_widget_framelist_object_append(of, ob);
+ ob = e_widget_check_add(evas, _("Protect this window from me accidentally changing it"), &(cfdata->protect_from_me));
+ e_widget_framelist_object_append(of, ob);
+ ob = e_widget_check_add(evas, _("Protect this window from being accidentally closed because it is important"), &(cfdata->important_window));
+ e_widget_framelist_object_append(of, ob);
+ ob = e_widget_check_add(evas, _("Do not allow the border to change on this window"), &(cfdata->keep_my_border));
+ e_widget_framelist_object_append(of, ob);
+ e_widget_list_object_append(o, of, 1, 1, 0.5);
+ */
+ ob = e_widget_check_add(evas, _("Remember this Border for this window next time it appears"), &(cfdata->remember_border));
+ e_widget_list_object_append(o, ob, 0, 0, 1.0);
+ return o;
+}
diff --git a/src/bin/e_int_border_border.h b/src/bin/e_int_border_border.h
new file mode 100644
index 000000000..fb6218560
--- /dev/null
+++ b/src/bin/e_int_border_border.h
@@ -0,0 +1,12 @@
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
+#ifdef E_TYPEDEFS
+#else
+#ifndef E_INT_BORDER_BORDER_H
+#define E_INT_BORDER_BORDER_H
+
+EAPI void e_int_border_border(E_Border *bd);
+
+#endif
+#endif
diff --git a/src/bin/e_int_border_locks.c b/src/bin/e_int_border_locks.c
index 669b78d80..a0825107b 100644
--- a/src/bin/e_int_border_locks.c
+++ b/src/bin/e_int_border_locks.c
@@ -179,6 +179,8 @@ _basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
{
cfdata->border->lock_border = 1;
}
+ /* FIXME: need to check if the remember stuff will actually work or not
+ * (see e_int_border_remember.c where it checks and warns) */
if (cfdata->remember_locks)
{
if (!cfdata->border->remember)
@@ -241,6 +243,8 @@ _advanced_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
cfdata->border->lock_focus_in = cfdata->lock.focus_in;
cfdata->border->lock_focus_out = cfdata->lock.focus_out;
cfdata->border->lock_life = cfdata->lock.life;
+ /* FIXME: need to check if the remember stuff will actually work or not
+ * (see e_int_border_remember.c where it checks and warns) */
if (cfdata->lock.remember)
{
if (!cfdata->border->remember)
diff --git a/src/bin/e_int_border_menu.c b/src/bin/e_int_border_menu.c
index 785adace2..6c436b188 100644
--- a/src/bin/e_int_border_menu.c
+++ b/src/bin/e_int_border_menu.c
@@ -6,6 +6,7 @@
static void _e_border_cb_border_menu_end(void *data, E_Menu *m);
static void _e_border_menu_cb_locks(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_border_menu_cb_remember(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_border_menu_cb_border(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_border_menu_cb_close(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_border_menu_cb_iconify(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_border_menu_cb_kill(void *data, E_Menu *m, E_Menu_Item *mi);
@@ -88,6 +89,13 @@ e_int_border_menu_show(E_Border *bd, Evas_Coord x, Evas_Coord y, int key, Ecore_
"widgets/border/default/remember"),
"widgets/border/default/remember");
mi = e_menu_item_new(m);
+ e_menu_item_label_set(mi, _("Borders"));
+ e_menu_item_callback_set(mi, _e_border_menu_cb_border, bd);
+ e_menu_item_icon_edje_set(mi,
+ (char *)e_theme_edje_file_get("base/theme/borders",
+ "widgets/border/default/borders"),
+ "widgets/border/default/borders");
+ mi = e_menu_item_new(m);
e_menu_item_separator_set(mi, 1);
mi = e_menu_item_new(m);
@@ -337,6 +345,15 @@ _e_border_menu_cb_remember(void *data, E_Menu *m, E_Menu_Item *mi)
}
static void
+_e_border_menu_cb_border(void *data, E_Menu *m, E_Menu_Item *mi)
+{
+ E_Border *bd;
+ bd = data;
+ if (bd->border_border_dialog) return;
+ e_int_border_border(bd);
+}
+
+static void
_e_border_menu_cb_close(void *data, E_Menu *m, E_Menu_Item *mi)
{
E_Border *bd;
diff --git a/src/bin/e_scrollframe.c b/src/bin/e_scrollframe.c
index db177ae1f..33b4bd16b 100644
--- a/src/bin/e_scrollframe.c
+++ b/src/bin/e_scrollframe.c
@@ -283,6 +283,13 @@ e_scrollframe_policy_get(Evas_Object *obj, E_Scrollframe_Policy *hbar, E_Scrollf
if (vbar) *vbar = sd->vbar_flags;
}
+Evas_Object *
+e_scrollframe_edje_object_get(Evas_Object *obj)
+{
+ API_ENTRY return NULL;
+ return sd->edje_obj;
+}
+
/* local subsystem functions */
static void
_e_smart_edje_drag_v(void *data, Evas_Object *obj, const char *emission, const char *source)
diff --git a/src/bin/e_scrollframe.h b/src/bin/e_scrollframe.h
index f2557ec3d..0d39c3b28 100644
--- a/src/bin/e_scrollframe.h
+++ b/src/bin/e_scrollframe.h
@@ -28,6 +28,7 @@ EAPI void e_scrollframe_page_size_set (Evas_Object *obj, Evas_Coord x,
EAPI void e_scrollframe_page_size_get (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
EAPI void e_scrollframe_policy_set (Evas_Object *obj, E_Scrollframe_Policy hbar, E_Scrollframe_Policy vbar);
EAPI void e_scrollframe_policy_get (Evas_Object *obj, E_Scrollframe_Policy *hbar, E_Scrollframe_Policy *vbar);
+EAPI Evas_Object *e_scrollframe_edje_object_get (Evas_Object *obj);
#endif
#endif
diff --git a/src/bin/e_widget_ilist.c b/src/bin/e_widget_ilist.c
new file mode 100644
index 000000000..e93a47e5c
--- /dev/null
+++ b/src/bin/e_widget_ilist.c
@@ -0,0 +1,144 @@
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
+#include "e.h"
+
+typedef struct _E_Widget_Data E_Widget_Data;
+struct _E_Widget_Data
+{
+ Evas_Object *o_widget, *o_scrollframe, *o_ilist;
+};
+
+static void _e_wid_del_hook(Evas_Object *obj);
+static void _e_wid_focus_hook(Evas_Object *obj);
+static void _e_wid_cb_scrollframe_resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void _e_wid_cb_item_sel(void *data, void *data2);
+static void _e_wid_focus_steal(void *data, Evas *e, Evas_Object *obj, void *event_info);
+
+/* externally accessible functions */
+Evas_Object *
+e_widget_ilist_add(Evas *evas, int icon_w, int icon_h)
+{
+ Evas_Object *obj, *o;
+ E_Widget_Data *wd;
+ Evas_Coord mw, mh;
+
+ obj = e_widget_add(evas);
+
+ e_widget_del_hook_set(obj, _e_wid_del_hook);
+ e_widget_focus_hook_set(obj, _e_wid_focus_hook);
+ wd = calloc(1, sizeof(E_Widget_Data));
+ e_widget_data_set(obj, wd);
+
+ o = e_scrollframe_add(evas);
+ wd->o_scrollframe = o;
+ evas_object_show(o);
+ e_widget_sub_object_add(obj, o);
+ e_widget_resize_object_set(obj, o);
+ evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_focus_steal, obj);
+
+ o = e_ilist_add(evas);
+ wd->o_ilist = o;
+ e_ilist_icon_size_set(o, icon_w, icon_h);
+ evas_object_event_callback_add(wd->o_scrollframe, EVAS_CALLBACK_RESIZE, _e_wid_cb_scrollframe_resize, o);
+ e_scrollframe_child_set(wd->o_scrollframe, o);
+ e_widget_sub_object_add(obj, o);
+ evas_object_show(o);
+
+ evas_object_resize(obj, 32, 32);
+ e_widget_min_size_set(obj, 32, 32);
+// edje_object_size_min_calc(wd->o_frame, &mw, &mh);
+// e_widget_min_size_set(obj, mw, mh);
+
+ return obj;
+}
+
+void
+e_widget_ilist_append(Evas_Object *obj, Evas_Object *icon, char *label, void (*func) (void *data), void *data)
+{
+ E_Widget_Data *wd;
+ Evas_Coord mw, mh, vw, vh, w, h;
+
+ wd = e_widget_data_get(obj);
+ e_ilist_append(wd->o_ilist, icon, label, _e_wid_cb_item_sel, wd, data);
+ if (icon) evas_object_show(icon);
+ e_ilist_min_size_get(wd->o_ilist, &mw, &mh);
+ evas_object_resize(wd->o_ilist, mw, mh);
+ e_scrollframe_child_viewport_size_get(wd->o_scrollframe, &vw, &vh);
+ evas_object_geometry_get(wd->o_scrollframe, NULL, NULL, &w, &h);
+ if (mw > vw)
+ {
+ Evas_Coord wmw, wmh;
+
+ e_widget_min_size_get(obj, &wmw, &wmh);
+ e_widget_min_size_set(obj, mw + (w - vw), wmh);
+ }
+}
+
+void
+e_widget_ilist_go(Evas_Object *obj)
+{
+ E_Widget_Data *wd;
+
+ wd = e_widget_data_get(obj);
+ wd->o_widget = obj;
+}
+
+static void
+_e_wid_del_hook(Evas_Object *obj)
+{
+ E_Widget_Data *wd;
+
+ wd = e_widget_data_get(obj);
+ free(wd);
+}
+
+static void
+_e_wid_focus_hook(Evas_Object *obj)
+{
+ E_Widget_Data *wd;
+
+ wd = e_widget_data_get(obj);
+ if (e_widget_focus_get(obj))
+ {
+ edje_object_signal_emit(e_scrollframe_edje_object_get(wd->o_scrollframe), "focus_in", "");
+ evas_object_focus_set(wd->o_ilist, 1);
+ }
+ else
+ {
+ edje_object_signal_emit(e_scrollframe_edje_object_get(wd->o_scrollframe), "focus_out", "");
+ evas_object_focus_set(wd->o_ilist, 0);
+ }
+}
+
+static void
+_e_wid_cb_scrollframe_resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Coord mw, mh, vw, vh, w, h;
+
+ e_scrollframe_child_viewport_size_get(obj, &vw, &vh);
+ e_ilist_min_size_get(data, &mw, &mh);
+ evas_object_geometry_get(data, NULL, NULL, &w, &h);
+ if (vw >= mw)
+ {
+ if (w != vw) evas_object_resize(data, vw, h);
+ }
+}
+
+static void
+_e_wid_cb_item_sel(void *data, void *data2)
+{
+ E_Widget_Data *wd;
+ Evas_Coord x, y, w, h;
+
+ wd = data;
+ e_ilist_selected_geometry_get(wd->o_ilist, &x, &y, &w, &h);
+ e_scrollframe_child_region_show(wd->o_scrollframe, x, y, w, h);
+ if (wd->o_widget) e_widget_change(wd->o_widget);
+}
+
+static void
+_e_wid_focus_steal(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ e_widget_focus_steal(data);
+}
diff --git a/src/bin/e_widget_ilist.h b/src/bin/e_widget_ilist.h
new file mode 100644
index 000000000..98300d728
--- /dev/null
+++ b/src/bin/e_widget_ilist.h
@@ -0,0 +1,14 @@
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
+#ifdef E_TYPEDEFS
+#else
+#ifndef E_WIDGET_ILIST_H
+#define E_WIDGET_ILIST_H
+
+EAPI Evas_Object *e_widget_ilist_add(Evas *evas, int icon_w, int icon_h);
+EAPI void e_widget_ilist_append(Evas_Object *obj, Evas_Object *icon, char *label, void (*func) (void *data), void *data);
+EAPI void e_widget_ilist_go(Evas_Object *obj);
+
+#endif
+#endif