[Pkg-e-commits] [SCM] Enlightenment DR17 toolkit based (based on the EFL) branch, upstream-vcs, updated. 447de88121d145a078f1754a0cfebb704d363821
dj2
dj2 at alioth.debian.org
Sat Jun 7 18:34:27 UTC 2008
The following commit has been merged in the upstream-vcs branch:
commit 216eecd8eb9d475834ca7d8e321fb0d76324f67e
Author: dj2 <dj2>
Date: Tue May 6 20:20:04 2008 +0000
- change tabs to spaces (Ewl uses an 8 space indent now instead of a tab)
diff --git a/src/engines/evas/Ewl_Engine_Evas.h b/src/engines/evas/Ewl_Engine_Evas.h
index 21d20cb..a8b2888 100644
--- a/src/engines/evas/Ewl_Engine_Evas.h
+++ b/src/engines/evas/Ewl_Engine_Evas.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_ENGINE_EVAS_H
#define EWL_ENGINE_EVAS_H
@@ -9,7 +9,7 @@
typedef struct Ewl_Engine_Evas Ewl_Engine_Evas;
struct Ewl_Engine_Evas
{
- Ewl_Engine engine;
+ Ewl_Engine engine;
};
#endif
diff --git a/src/engines/evas/ewl_engine_evas.c b/src/engines/evas/ewl_engine_evas.c
index 0703332..023fdfd 100644
--- a/src/engines/evas/ewl_engine_evas.c
+++ b/src/engines/evas/ewl_engine_evas.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Engine_Evas.h"
#include "ewl_private.h"
#include "ewl_debug.h"
@@ -14,7 +14,7 @@ static int ee_init(Ewl_Engine *engine);
static void ee_shutdown(Ewl_Engine *engine);
static void ee_canvas_output_set(Ewl_Embed *embed, int x, int y, int width,
- int height);
+ int height);
static void ee_canvas_render(Ewl_Embed *embed);
static void ee_canvas_freeze(Ewl_Embed *embed);
static void ee_canvas_thaw(Ewl_Embed *embed);
@@ -28,339 +28,339 @@ static Evas_Object *ewl_widget_layer_neighbor_find_above(Ewl_Widget *w);
static Evas_Object *ewl_widget_layer_neighbor_find_below(Ewl_Widget *w);
static void *canvas_funcs[EWL_ENGINE_CANVAS_MAX] =
- {
- NULL,
- ee_canvas_output_set,
- ee_canvas_render,
- ee_canvas_freeze,
- ee_canvas_thaw,
- ee_canvas_damage_add
- };
+ {
+ NULL,
+ ee_canvas_output_set,
+ ee_canvas_render,
+ ee_canvas_freeze,
+ ee_canvas_thaw,
+ ee_canvas_damage_add
+ };
static void *theme_funcs[EWL_ENGINE_THEME_MAX] =
- {
- /* FIXME: disable these calls for now. They stop ejde reloading
- * the theme object correctly after it was obscured, in some
- * cases. If these problems are solved, please activate them
- * again. For more information see bug #3, #116 and #456*/
- NULL, //edje_freeze,
- NULL, //edje_thaw,
- edje_file_data_get,
- ee_canvas_smart_new,
- NULL,
- evas_object_del,
- evas_object_move,
- evas_object_resize,
- evas_object_show,
- evas_object_hide,
- evas_object_clip_set,
- evas_object_clip_unset,
- NULL, NULL,
- NULL, NULL,
- NULL, NULL, NULL,
- ee_canvas_clip_add,
- evas_object_del,
- evas_object_clipees_get,
- evas_object_color_set,
- ee_canvas_stack_add,
- ee_canvas_layer_update,
- };
+ {
+ /* FIXME: disable these calls for now. They stop ejde reloading
+ * the theme object correctly after it was obscured, in some
+ * cases. If these problems are solved, please activate them
+ * again. For more information see bug #3, #116 and #456*/
+ NULL, //edje_freeze,
+ NULL, //edje_thaw,
+ edje_file_data_get,
+ ee_canvas_smart_new,
+ NULL,
+ evas_object_del,
+ evas_object_move,
+ evas_object_resize,
+ evas_object_show,
+ evas_object_hide,
+ evas_object_clip_set,
+ evas_object_clip_unset,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL, NULL,
+ ee_canvas_clip_add,
+ evas_object_del,
+ evas_object_clipees_get,
+ evas_object_color_set,
+ ee_canvas_stack_add,
+ ee_canvas_layer_update,
+ };
Ecore_DList *
ewl_engine_dependancies(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
}
Ewl_Engine *
ewl_engine_create(int *argc __UNUSED__, char ** argv __UNUSED__)
{
- Ewl_Engine_Evas *engine;
+ Ewl_Engine_Evas *engine;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- engine = NEW(Ewl_Engine_Evas, 1);
- if (!engine)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ engine = NEW(Ewl_Engine_Evas, 1);
+ if (!engine)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ee_init(EWL_ENGINE(engine)))
- {
- FREE(engine);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ee_init(EWL_ENGINE(engine)))
+ {
+ FREE(engine);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
}
static int
ee_init(Ewl_Engine *engine)
{
- Ewl_Engine_Info *info;
+ Ewl_Engine_Info *info;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(engine, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(engine, FALSE);
- info = NEW(Ewl_Engine_Info, 1);
- info->shutdown = ee_shutdown;
- info->hooks.canvas = canvas_funcs;
- info->hooks.theme = theme_funcs;
+ info = NEW(Ewl_Engine_Info, 1);
+ info->shutdown = ee_shutdown;
+ info->hooks.canvas = canvas_funcs;
+ info->hooks.theme = theme_funcs;
- engine->functions = info;
+ engine->functions = info;
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static void
ee_shutdown(Ewl_Engine *engine)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(engine);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(engine);
- IF_FREE(engine->functions);
+ IF_FREE(engine->functions);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
void
ee_canvas_output_set(Ewl_Embed *embed, int x, int y, int width, int height)
{
- evas_output_size_set(embed->canvas, width, height);
- evas_output_viewport_set(embed->canvas, x, y, width, height);
+ evas_output_size_set(embed->canvas, width, height);
+ evas_output_viewport_set(embed->canvas, x, y, width, height);
}
static void
ee_canvas_render(Ewl_Embed *embed)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
- if (embed->canvas)
- evas_render(embed->canvas);
+ if (embed->canvas)
+ evas_render(embed->canvas);
- DRETURN(DLEVEL_STABLE);
+ DRETURN(DLEVEL_STABLE);
}
static void
ee_canvas_freeze(Ewl_Embed *embed)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
- if (embed->canvas && evas_event_freeze_get(embed->canvas) < 1) {
- evas_event_freeze(embed->canvas);
- }
+ if (embed->canvas && evas_event_freeze_get(embed->canvas) < 1) {
+ evas_event_freeze(embed->canvas);
+ }
- DRETURN(DLEVEL_STABLE);
+ DRETURN(DLEVEL_STABLE);
}
static void
ee_canvas_thaw(Ewl_Embed *embed)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
- if (embed->canvas && evas_event_freeze_get(embed->canvas) > 0)
- evas_event_thaw(embed->canvas);
+ if (embed->canvas && evas_event_freeze_get(embed->canvas) > 0)
+ evas_event_thaw(embed->canvas);
- DRETURN(DLEVEL_STABLE);
+ DRETURN(DLEVEL_STABLE);
}
static void
ee_canvas_damage_add(Ewl_Embed *embed, int x, int y, int w, int h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
- if (embed->canvas)
- evas_damage_rectangle_add(embed->canvas, x, y, w, h);
+ if (embed->canvas)
+ evas_damage_rectangle_add(embed->canvas, x, y, w, h);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void *
ee_canvas_smart_new(Ewl_Embed *embed)
{
- Evas_Object *smart_object;
+ Evas_Object *smart_object;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(embed, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(embed, NULL);
- if (!widget_smart) {
- widget_smart = evas_smart_new("Ewl Widget Smart Object",
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL);
- }
+ if (!widget_smart) {
+ widget_smart = evas_smart_new("Ewl Widget Smart Object",
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL);
+ }
- smart_object = evas_object_smart_add(embed->canvas, widget_smart);
- DRETURN_PTR(smart_object, DLEVEL_STABLE);
+ smart_object = evas_object_smart_add(embed->canvas, widget_smart);
+ DRETURN_PTR(smart_object, DLEVEL_STABLE);
}
static void *
ee_canvas_clip_add(Ewl_Embed *embed)
{
- Evas_Object *obj;
+ Evas_Object *obj;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(embed, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(embed, NULL);
- obj = evas_object_rectangle_add(embed->canvas);
- if (obj)
- evas_object_pass_events_set(obj, TRUE);
+ obj = evas_object_rectangle_add(embed->canvas);
+ if (obj)
+ evas_object_pass_events_set(obj, TRUE);
- DRETURN_PTR(obj, DLEVEL_STABLE);
+ DRETURN_PTR(obj, DLEVEL_STABLE);
}
static void
ee_canvas_stack_add(Ewl_Widget *w)
{
- Evas_Object *smart_parent;
+ Evas_Object *smart_parent;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (w->parent && !REVEALED(w->parent))
- DRETURN(DLEVEL_STABLE);
+ if (w->parent && !REVEALED(w->parent))
+ DRETURN(DLEVEL_STABLE);
- if (w->parent && !w->toplayered)
- smart_parent = w->parent->smart_object;
- else {
- Ewl_Embed *emb;
+ if (w->parent && !w->toplayered)
+ smart_parent = w->parent->smart_object;
+ else {
+ Ewl_Embed *emb;
- emb = ewl_embed_widget_find(w);
- smart_parent = emb->smart;
- }
+ emb = ewl_embed_widget_find(w);
+ smart_parent = emb->smart;
+ }
- evas_object_smart_member_add(w->smart_object, smart_parent);
+ evas_object_smart_member_add(w->smart_object, smart_parent);
- if (w->theme_object)
- evas_object_smart_member_add(w->theme_object, w->smart_object);
+ if (w->theme_object)
+ evas_object_smart_member_add(w->theme_object, w->smart_object);
- if (w->fx_clip_box)
- evas_object_smart_member_add(w->fx_clip_box, w->smart_object);
+ if (w->fx_clip_box)
+ evas_object_smart_member_add(w->fx_clip_box, w->smart_object);
- if (w->theme_object && w->fx_clip_box)
- evas_object_stack_below(w->theme_object, w->fx_clip_box);
+ if (w->theme_object && w->fx_clip_box)
+ evas_object_stack_below(w->theme_object, w->fx_clip_box);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_canvas_layer_update(Ewl_Widget *w)
{
- Ewl_Widget *p;
- int layer;
+ Ewl_Widget *p;
+ int layer;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (!(p = w->parent))
- DRETURN(DLEVEL_STABLE);
+ if (!(p = w->parent))
+ DRETURN(DLEVEL_STABLE);
- /* check first if the widget should be on the top */
- if (w->toplayered)
- {
- evas_object_raise(w->smart_object);
- DRETURN(DLEVEL_STABLE);
- }
+ /* check first if the widget should be on the top */
+ if (w->toplayered)
+ {
+ evas_object_raise(w->smart_object);
+ DRETURN(DLEVEL_STABLE);
+ }
- layer = ewl_widget_layer_priority_get(w);
- if (layer == 0)
- evas_object_stack_above(w->smart_object, p->fx_clip_box);
- else if (layer > 0) {
- Evas_Object *above;
+ layer = ewl_widget_layer_priority_get(w);
+ if (layer == 0)
+ evas_object_stack_above(w->smart_object, p->fx_clip_box);
+ else if (layer > 0) {
+ Evas_Object *above;
- if (!(above = ewl_widget_layer_neighbor_find_above(w)))
- DWARNING("No object above.");
+ if (!(above = ewl_widget_layer_neighbor_find_above(w)))
+ DWARNING("No object above.");
- evas_object_stack_above(w->smart_object, above);
- }
- else {
- Evas_Object *below;
+ evas_object_stack_above(w->smart_object, above);
+ }
+ else {
+ Evas_Object *below;
- if (!(below = ewl_widget_layer_neighbor_find_below(w)))
- DWARNING("No object below.");
+ if (!(below = ewl_widget_layer_neighbor_find_below(w)))
+ DWARNING("No object below.");
- evas_object_stack_below(w->smart_object, below);
- }
+ evas_object_stack_below(w->smart_object, below);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static Evas_Object *
ewl_widget_layer_neighbor_find_above(Ewl_Widget *w)
{
- Evas_Object *o, *ol;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, NULL);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
-
- if (!w->parent)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
-
- o = ol = w->parent->fx_clip_box;
-
- while ((o = evas_object_above_get(o)))
- {
- Ewl_Widget *found;
-
- found = evas_object_data_get(o, "EWL");
- /*
- * Perhaps it is a cached object so no reason to stop iterating
- */
- if (found) {
- /* ignore the widget itself */
- if (w == found)
- continue;
- if (ewl_widget_layer_priority_get(w) <=
- ewl_widget_layer_priority_get(found))
- break;
- ol = o;
- }
- }
-
- DRETURN_PTR(ol, DLEVEL_STABLE);
+ Evas_Object *o, *ol;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, NULL);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
+
+ if (!w->parent)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+
+ o = ol = w->parent->fx_clip_box;
+
+ while ((o = evas_object_above_get(o)))
+ {
+ Ewl_Widget *found;
+
+ found = evas_object_data_get(o, "EWL");
+ /*
+ * Perhaps it is a cached object so no reason to stop iterating
+ */
+ if (found) {
+ /* ignore the widget itself */
+ if (w == found)
+ continue;
+ if (ewl_widget_layer_priority_get(w) <=
+ ewl_widget_layer_priority_get(found))
+ break;
+ ol = o;
+ }
+ }
+
+ DRETURN_PTR(ol, DLEVEL_STABLE);
}
static Evas_Object *
ewl_widget_layer_neighbor_find_below(Ewl_Widget *w)
{
- Evas_Object *o, *ol;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, NULL);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
-
- if (!w->parent)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
-
- o = ol = w->parent->fx_clip_box;
-
- while ((o = evas_object_below_get(o)))
- {
- Ewl_Widget *found;
-
- found = evas_object_data_get(o, "EWL");
- /*
- * Perhaps it is a cached object so no reason to stop iterating
- */
- if (found) {
- /* ignore the widget itself */
- if (w == found)
- continue;
- if (ewl_widget_layer_priority_get(w) >=
- ewl_widget_layer_priority_get(found))
- break;
- ol = o;
- }
- }
-
- DRETURN_PTR(ol, DLEVEL_STABLE);
+ Evas_Object *o, *ol;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, NULL);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
+
+ if (!w->parent)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+
+ o = ol = w->parent->fx_clip_box;
+
+ while ((o = evas_object_below_get(o)))
+ {
+ Ewl_Widget *found;
+
+ found = evas_object_data_get(o, "EWL");
+ /*
+ * Perhaps it is a cached object so no reason to stop iterating
+ */
+ if (found) {
+ /* ignore the widget itself */
+ if (w == found)
+ continue;
+ if (ewl_widget_layer_priority_get(w) >=
+ ewl_widget_layer_priority_get(found))
+ break;
+ ol = o;
+ }
+ }
+
+ DRETURN_PTR(ol, DLEVEL_STABLE);
}
diff --git a/src/engines/evas_buffer/Ewl_Engine_Evas_Buffer.h b/src/engines/evas_buffer/Ewl_Engine_Evas_Buffer.h
index 8c840aa..a32c9f3 100644
--- a/src/engines/evas_buffer/Ewl_Engine_Evas_Buffer.h
+++ b/src/engines/evas_buffer/Ewl_Engine_Evas_Buffer.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_ENGINE_EVAS_BUFFER_H
#define EWL_ENGINE_EVAS_BUFFER_H
@@ -7,12 +7,12 @@
#include <Evas_Engine_Buffer.h>
#define EWL_ENGINE_EVAS_BUFFER(engine) \
- ((Ewl_Engine_Evas_Buffer *)engine)
+ ((Ewl_Engine_Evas_Buffer *)engine)
typedef struct Ewl_Engine_Evas_Buffer Ewl_Engine_Evas_Buffer;
struct Ewl_Engine_Evas_Buffer
{
- Ewl_Engine engine;
+ Ewl_Engine engine;
};
#endif
diff --git a/src/engines/evas_buffer/ewl_engine_evas_buffer.c b/src/engines/evas_buffer/ewl_engine_evas_buffer.c
index b96d9d6..541e66a 100644
--- a/src/engines/evas_buffer/ewl_engine_evas_buffer.c
+++ b/src/engines/evas_buffer/ewl_engine_evas_buffer.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Engine_Evas_Buffer.h"
#include "ewl_macros.h"
#include "ewl_private.h"
@@ -6,180 +6,180 @@
static void ee_canvas_setup(Ewl_Window *win, int debug);
static void ee_canvas_output_set(Ewl_Embed *embed, int x, int y, int width,
- int height);
+ int height);
static void ee_canvas_render(Ewl_Embed *emb);
static int ee_init(Ewl_Engine *engine);
static void ee_shutdown(Ewl_Engine *engine);
static void *canvas_funcs[EWL_ENGINE_CANVAS_MAX] =
- {
- ee_canvas_setup,
- ee_canvas_output_set,
- ee_canvas_render, NULL, NULL
- };
+ {
+ ee_canvas_setup,
+ ee_canvas_output_set,
+ ee_canvas_render, NULL, NULL
+ };
Ecore_DList *
ewl_engine_dependancies(void)
{
- Ecore_DList *d;
+ Ecore_DList *d;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- d = ecore_dlist_new();
- ecore_dlist_append(d, strdup("evas"));
+ d = ecore_dlist_new();
+ ecore_dlist_append(d, strdup("evas"));
- DRETURN_PTR(d, DLEVEL_STABLE);
+ DRETURN_PTR(d, DLEVEL_STABLE);
}
Ewl_Engine *
ewl_engine_create(int *argv __UNUSED__, char ** argc __UNUSED__)
{
- Ewl_Engine_Evas_Buffer *engine;
+ Ewl_Engine_Evas_Buffer *engine;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- engine = NEW(Ewl_Engine_Evas_Buffer, 1);
- if (!engine)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ engine = NEW(Ewl_Engine_Evas_Buffer, 1);
+ if (!engine)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ee_init(EWL_ENGINE(engine)))
- {
- FREE(engine);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ee_init(EWL_ENGINE(engine)))
+ {
+ FREE(engine);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
}
static int
ee_init(Ewl_Engine *engine)
{
- Ewl_Engine_Info *info;
+ Ewl_Engine_Info *info;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(engine, TRUE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(engine, TRUE);
- info = NEW(Ewl_Engine_Info, 1);
- info->shutdown = ee_shutdown;
- info->hooks.canvas = canvas_funcs;
+ info = NEW(Ewl_Engine_Info, 1);
+ info->shutdown = ee_shutdown;
+ info->hooks.canvas = canvas_funcs;
- engine->functions = info;
+ engine->functions = info;
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static void
ee_shutdown(Ewl_Engine *engine)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(engine);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(engine);
- IF_FREE(engine->functions);
+ IF_FREE(engine->functions);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_canvas_setup(Ewl_Window *win, int debug __UNUSED__)
{
- Evas *evas;
- Evas_Engine_Info *info = NULL;
- Evas_Engine_Info_Buffer *bufinfo;
- Ewl_Object *o;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
-
- evas = evas_new();
- evas_output_method_set(evas, evas_render_method_lookup("buffer"));
-
- info = evas_engine_info_get(evas);
- if (!info)
- {
- fprintf(stderr, "Unable to use buffer engine for rendering.\n");
- exit(-1);
- }
-
- win->window = bufinfo = (Evas_Engine_Info_Buffer *)info;
-
- bufinfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
- bufinfo->info.dest_buffer = NULL;
- bufinfo->info.dest_buffer_row_bytes = 0;
- bufinfo->info.use_color_key = 0;
- bufinfo->info.alpha_threshold = 0;
- bufinfo->info.func.new_update_region = NULL;
- bufinfo->info.func.free_update_region = NULL;
- evas_engine_info_set(evas, (Evas_Engine_Info *)bufinfo);
-
- o = EWL_OBJECT(win);
- evas_engine_info_set(evas, info);
- evas_output_size_set(evas, ewl_object_current_w_get(o),
- ewl_object_current_h_get(o));
- evas_output_viewport_set(evas, ewl_object_current_x_get(o),
- ewl_object_current_y_get(o),
- ewl_object_current_w_get(o),
- ewl_object_current_h_get(o));
- ewl_embed_canvas_set(EWL_EMBED(win), evas, win->window);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Evas *evas;
+ Evas_Engine_Info *info = NULL;
+ Evas_Engine_Info_Buffer *bufinfo;
+ Ewl_Object *o;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+
+ evas = evas_new();
+ evas_output_method_set(evas, evas_render_method_lookup("buffer"));
+
+ info = evas_engine_info_get(evas);
+ if (!info)
+ {
+ fprintf(stderr, "Unable to use buffer engine for rendering.\n");
+ exit(-1);
+ }
+
+ win->window = bufinfo = (Evas_Engine_Info_Buffer *)info;
+
+ bufinfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
+ bufinfo->info.dest_buffer = NULL;
+ bufinfo->info.dest_buffer_row_bytes = 0;
+ bufinfo->info.use_color_key = 0;
+ bufinfo->info.alpha_threshold = 0;
+ bufinfo->info.func.new_update_region = NULL;
+ bufinfo->info.func.free_update_region = NULL;
+ evas_engine_info_set(evas, (Evas_Engine_Info *)bufinfo);
+
+ o = EWL_OBJECT(win);
+ evas_engine_info_set(evas, info);
+ evas_output_size_set(evas, ewl_object_current_w_get(o),
+ ewl_object_current_h_get(o));
+ evas_output_viewport_set(evas, ewl_object_current_x_get(o),
+ ewl_object_current_y_get(o),
+ ewl_object_current_w_get(o),
+ ewl_object_current_h_get(o));
+ ewl_embed_canvas_set(EWL_EMBED(win), evas, win->window);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_canvas_output_set(Ewl_Embed *emb, int x, int y, int width, int height)
{
- Evas *evas;
- Evas_Engine_Info *info = NULL;
- Evas_Engine_Info_Buffer *bufinfo;
- Ewl_Object *o;
+ Evas *evas;
+ Evas_Engine_Info *info = NULL;
+ Evas_Engine_Info_Buffer *bufinfo;
+ Ewl_Object *o;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(emb);
- DCHECK_TYPE(emb, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(emb);
+ DCHECK_TYPE(emb, EWL_EMBED_TYPE);
- evas = emb->canvas;
+ evas = emb->canvas;
- evas_output_size_set(evas, width, height);
- evas_output_viewport_set(evas, x, y, width, height);
- evas_damage_rectangle_add(evas, 0, 0, width, height);
+ evas_output_size_set(evas, width, height);
+ evas_output_viewport_set(evas, x, y, width, height);
+ evas_damage_rectangle_add(evas, 0, 0, width, height);
- info = evas_engine_info_get(evas);
- if (!info)
- {
- fprintf(stderr, "Unable to use buffer engine for rendering.\n");
- exit(-1);
- }
+ info = evas_engine_info_get(evas);
+ if (!info)
+ {
+ fprintf(stderr, "Unable to use buffer engine for rendering.\n");
+ exit(-1);
+ }
- o = EWL_OBJECT(emb);
- bufinfo = (Evas_Engine_Info_Buffer *)info;
- bufinfo->info.dest_buffer_row_bytes = sizeof(int) * width;
- bufinfo->info.dest_buffer = realloc(bufinfo->info.dest_buffer,
- bufinfo->info.dest_buffer_row_bytes * height);
+ o = EWL_OBJECT(emb);
+ bufinfo = (Evas_Engine_Info_Buffer *)info;
+ bufinfo->info.dest_buffer_row_bytes = sizeof(int) * width;
+ bufinfo->info.dest_buffer = realloc(bufinfo->info.dest_buffer,
+ bufinfo->info.dest_buffer_row_bytes * height);
- evas_engine_info_set(evas, info);
+ evas_engine_info_set(evas, info);
- emb->canvas_window = bufinfo->info.dest_buffer;
+ emb->canvas_window = bufinfo->info.dest_buffer;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_canvas_render(Ewl_Embed *embed)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
- if (embed->canvas) {
- Evas_List *updates;
+ if (embed->canvas) {
+ Evas_List *updates;
- updates = evas_render_updates(embed->canvas);
- if (updates) {
- ewl_callback_call(EWL_WIDGET(embed),
- EWL_CALLBACK_VALUE_CHANGED);
- evas_render_updates_free(updates);
- }
- }
+ updates = evas_render_updates(embed->canvas);
+ if (updates) {
+ ewl_callback_call(EWL_WIDGET(embed),
+ EWL_CALLBACK_VALUE_CHANGED);
+ evas_render_updates_free(updates);
+ }
+ }
- DRETURN(DLEVEL_STABLE);
+ DRETURN(DLEVEL_STABLE);
}
diff --git a/src/engines/evas_fb/Ewl_Engine_Evas_Fb.h b/src/engines/evas_fb/Ewl_Engine_Evas_Fb.h
index 680bf69..d36ddaf 100644
--- a/src/engines/evas_fb/Ewl_Engine_Evas_Fb.h
+++ b/src/engines/evas_fb/Ewl_Engine_Evas_Fb.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_ENGINE_EVAS_FB_H
#define EWL_ENGINE_EVAS_FB_H
@@ -8,15 +8,15 @@
#include <Evas_Engine_FB.h>
#define EWL_ENGINE_EVAS_FB(engine) \
- ((Ewl_Engine_Evas_Fb *)engine)
+ ((Ewl_Engine_Evas_Fb *)engine)
typedef struct Ewl_Engine_Evas_Fb Ewl_Engine_Evas_Fb;
struct Ewl_Engine_Evas_Fb
{
- Ewl_Engine engine;
+ Ewl_Engine engine;
- /* There can be only one window in fb land */
- Ewl_Window *window;
+ /* There can be only one window in fb land */
+ Ewl_Window *window;
};
#endif
diff --git a/src/engines/evas_fb/ewl_engine_evas_fb.c b/src/engines/evas_fb/ewl_engine_evas_fb.c
index 48526c5..8c920c6 100644
--- a/src/engines/evas_fb/ewl_engine_evas_fb.c
+++ b/src/engines/evas_fb/ewl_engine_evas_fb.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Engine_Evas_Fb.h"
#include "ewl_macros.h"
#include "ewl_private.h"
@@ -21,290 +21,290 @@ static int ee_init(Ewl_Engine *engine);
static void ee_shutdown(Ewl_Engine *engine);
static void *canvas_funcs[EWL_ENGINE_CANVAS_MAX] =
- {
- ee_canvas_setup,
- NULL, NULL, NULL, NULL
- };
+ {
+ ee_canvas_setup,
+ NULL, NULL, NULL, NULL
+ };
Ecore_DList *
ewl_engine_dependancies(void)
{
- Ecore_DList *d;
+ Ecore_DList *d;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- d = ecore_dlist_new();
- ecore_dlist_append(d, strdup("evas"));
+ d = ecore_dlist_new();
+ ecore_dlist_append(d, strdup("evas"));
- DRETURN_PTR(d, DLEVEL_STABLE);
+ DRETURN_PTR(d, DLEVEL_STABLE);
}
Ewl_Engine *
ewl_engine_create(int *argc __UNUSED__, char ** argv __UNUSED__)
{
- Ewl_Engine_Evas_Fb *engine;
+ Ewl_Engine_Evas_Fb *engine;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- engine = NEW(Ewl_Engine_Evas_Fb, 1);
- if (!engine)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ engine = NEW(Ewl_Engine_Evas_Fb, 1);
+ if (!engine)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ee_init(EWL_ENGINE(engine)))
- {
- FREE(engine);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ee_init(EWL_ENGINE(engine)))
+ {
+ FREE(engine);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
}
static int
ee_init(Ewl_Engine *engine)
{
- Ewl_Engine_Info *info;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(engine, TRUE);
-
- if (ee_key_down_handler)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
-
- if (!ecore_fb_init(NULL))
- DRETURN_INT(TRUE, DLEVEL_STABLE);
-
- ee_key_down_handler = ecore_event_handler_add(
- ECORE_FB_EVENT_KEY_DOWN,
- ewl_ev_fb_key_down, engine);
- ee_key_up_handler = ecore_event_handler_add(
- ECORE_FB_EVENT_KEY_UP,
- ewl_ev_fb_key_up, engine);
- ee_mouse_down_handler = ecore_event_handler_add(
- ECORE_FB_EVENT_MOUSE_BUTTON_DOWN,
- ewl_ev_fb_mouse_down, engine);
- ee_mouse_up_handler = ecore_event_handler_add(
- ECORE_FB_EVENT_MOUSE_BUTTON_UP,
- ewl_ev_fb_mouse_up, engine);
- ee_mouse_move_handler = ecore_event_handler_add(
- ECORE_FB_EVENT_MOUSE_MOVE,
- ewl_ev_fb_mouse_move, engine);
-
- if (!ee_key_down_handler || !ee_key_up_handler
- || !ee_mouse_down_handler || !ee_mouse_up_handler
- || !ee_mouse_move_handler)
- {
- ee_shutdown(engine);
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
-
- info = NEW(Ewl_Engine_Info, 1);
- info->shutdown = ee_shutdown;
- info->hooks.canvas = canvas_funcs;
-
- engine->functions = info;
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Engine_Info *info;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(engine, TRUE);
+
+ if (ee_key_down_handler)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+
+ if (!ecore_fb_init(NULL))
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+
+ ee_key_down_handler = ecore_event_handler_add(
+ ECORE_FB_EVENT_KEY_DOWN,
+ ewl_ev_fb_key_down, engine);
+ ee_key_up_handler = ecore_event_handler_add(
+ ECORE_FB_EVENT_KEY_UP,
+ ewl_ev_fb_key_up, engine);
+ ee_mouse_down_handler = ecore_event_handler_add(
+ ECORE_FB_EVENT_MOUSE_BUTTON_DOWN,
+ ewl_ev_fb_mouse_down, engine);
+ ee_mouse_up_handler = ecore_event_handler_add(
+ ECORE_FB_EVENT_MOUSE_BUTTON_UP,
+ ewl_ev_fb_mouse_up, engine);
+ ee_mouse_move_handler = ecore_event_handler_add(
+ ECORE_FB_EVENT_MOUSE_MOVE,
+ ewl_ev_fb_mouse_move, engine);
+
+ if (!ee_key_down_handler || !ee_key_up_handler
+ || !ee_mouse_down_handler || !ee_mouse_up_handler
+ || !ee_mouse_move_handler)
+ {
+ ee_shutdown(engine);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+
+ info = NEW(Ewl_Engine_Info, 1);
+ info->shutdown = ee_shutdown;
+ info->hooks.canvas = canvas_funcs;
+
+ engine->functions = info;
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static void
ee_shutdown(Ewl_Engine *engine)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(engine);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(engine);
- if (ee_key_down_handler)
- ecore_event_handler_del(ee_key_down_handler);
- ee_key_down_handler = NULL;
+ if (ee_key_down_handler)
+ ecore_event_handler_del(ee_key_down_handler);
+ ee_key_down_handler = NULL;
- if (ee_key_up_handler)
- ecore_event_handler_del(ee_key_up_handler);
- ee_key_up_handler = NULL;
+ if (ee_key_up_handler)
+ ecore_event_handler_del(ee_key_up_handler);
+ ee_key_up_handler = NULL;
- if (ee_mouse_down_handler)
- ecore_event_handler_del(ee_mouse_down_handler);
- ee_mouse_down_handler = NULL;
+ if (ee_mouse_down_handler)
+ ecore_event_handler_del(ee_mouse_down_handler);
+ ee_mouse_down_handler = NULL;
- if (ee_mouse_up_handler)
- ecore_event_handler_del(ee_mouse_up_handler);
- ee_mouse_up_handler = NULL;
+ if (ee_mouse_up_handler)
+ ecore_event_handler_del(ee_mouse_up_handler);
+ ee_mouse_up_handler = NULL;
- if (ee_mouse_move_handler)
- ecore_event_handler_del(ee_mouse_move_handler);
- ee_mouse_move_handler = NULL;
+ if (ee_mouse_move_handler)
+ ecore_event_handler_del(ee_mouse_move_handler);
+ ee_mouse_move_handler = NULL;
- ecore_fb_shutdown();
+ ecore_fb_shutdown();
- IF_FREE(engine->functions);
+ IF_FREE(engine->functions);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_canvas_setup(Ewl_Window *win, int debug __UNUSED__)
{
- Evas *evas;
- Evas_Engine_Info *info = NULL;
- Evas_Engine_Info_FB *fbinfo;
- Ewl_Object *o;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
-
- evas = evas_new();
- evas_output_method_set(evas, evas_render_method_lookup("fb"));
-
- info = evas_engine_info_get(evas);
- if (!info)
- {
- fprintf(stderr, "Unable to use evas_fb engine for rendering, ");
- exit(-1);
- }
-
- win->window = fbinfo = (Evas_Engine_Info_FB *)info;
-
- fbinfo->info.virtual_terminal = 0;
- fbinfo->info.device_number = 0;
- fbinfo->info.refresh = 0;
- fbinfo->info.rotation = 0;
- evas_engine_info_set(evas, (Evas_Engine_Info *)fbinfo);
- ewl_object_geometry_request(EWL_OBJECT(win), 0, 0, 240, 320);
-
- o = EWL_OBJECT(win);
- evas_engine_info_set(evas, info);
- evas_output_size_set(evas, ewl_object_current_w_get(o),
- ewl_object_current_h_get(o));
- evas_output_viewport_set(evas, ewl_object_current_x_get(o),
- ewl_object_current_y_get(o),
- ewl_object_current_w_get(o),
- ewl_object_current_h_get(o));
- ewl_embed_canvas_set(EWL_EMBED(win), evas, win->window);
-
- EWL_ENGINE_EVAS_FB(EWL_EMBED(win)->engine)->window = win;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Evas *evas;
+ Evas_Engine_Info *info = NULL;
+ Evas_Engine_Info_FB *fbinfo;
+ Ewl_Object *o;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+
+ evas = evas_new();
+ evas_output_method_set(evas, evas_render_method_lookup("fb"));
+
+ info = evas_engine_info_get(evas);
+ if (!info)
+ {
+ fprintf(stderr, "Unable to use evas_fb engine for rendering, ");
+ exit(-1);
+ }
+
+ win->window = fbinfo = (Evas_Engine_Info_FB *)info;
+
+ fbinfo->info.virtual_terminal = 0;
+ fbinfo->info.device_number = 0;
+ fbinfo->info.refresh = 0;
+ fbinfo->info.rotation = 0;
+ evas_engine_info_set(evas, (Evas_Engine_Info *)fbinfo);
+ ewl_object_geometry_request(EWL_OBJECT(win), 0, 0, 240, 320);
+
+ o = EWL_OBJECT(win);
+ evas_engine_info_set(evas, info);
+ evas_output_size_set(evas, ewl_object_current_w_get(o),
+ ewl_object_current_h_get(o));
+ evas_output_viewport_set(evas, ewl_object_current_x_get(o),
+ ewl_object_current_y_get(o),
+ ewl_object_current_w_get(o),
+ ewl_object_current_h_get(o));
+ ewl_embed_canvas_set(EWL_EMBED(win), evas, win->window);
+
+ EWL_ENGINE_EVAS_FB(EWL_EMBED(win)->engine)->window = win;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static int
ewl_ev_fb_key_down(void *data, int type __UNUSED__, void *e)
{
- Ewl_Embed *embed;
- Ewl_Engine_Evas_Fb *engine;
- Ecore_Fb_Event_Key_Down *ev;
+ Ewl_Embed *embed;
+ Ewl_Engine_Evas_Fb *engine;
+ Ecore_Fb_Event_Key_Down *ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
- engine = data;
+ ev = e;
+ engine = data;
- embed = EWL_EMBED(engine->window);
- if (!embed)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ embed = EWL_EMBED(engine->window);
+ if (!embed)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- ewl_embed_key_down_feed(embed, ev->keyname, ewl_ev_modifiers_get());
+ ewl_embed_key_down_feed(embed, ev->keyname, ewl_ev_modifiers_get());
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_fb_key_up(void *data, int type __UNUSED__, void *e)
{
- Ewl_Embed *embed;
- Ewl_Engine_Evas_Fb *engine;
- Ecore_Fb_Event_Key_Up *ev;
+ Ewl_Embed *embed;
+ Ewl_Engine_Evas_Fb *engine;
+ Ecore_Fb_Event_Key_Up *ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
- engine = data;
+ ev = e;
+ engine = data;
- embed = EWL_EMBED(engine->window);
- if (!embed)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ embed = EWL_EMBED(engine->window);
+ if (!embed)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- ewl_embed_key_down_feed(embed, ev->keyname, ewl_ev_modifiers_get());
+ ewl_embed_key_down_feed(embed, ev->keyname, ewl_ev_modifiers_get());
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_fb_mouse_down(void *data, int type __UNUSED__, void *e)
{
- int clicks = 1;
- Ewl_Embed *embed;
- Ewl_Engine_Evas_Fb *engine;
- Ecore_Fb_Event_Mouse_Button_Down *ev;
- unsigned int key_modifiers;
+ int clicks = 1;
+ Ewl_Embed *embed;
+ Ewl_Engine_Evas_Fb *engine;
+ Ecore_Fb_Event_Mouse_Button_Down *ev;
+ unsigned int key_modifiers;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
- engine = data;
+ ev = e;
+ engine = data;
- embed = EWL_EMBED(engine->window);
- if (!embed)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ embed = EWL_EMBED(engine->window);
+ if (!embed)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- if (ev->double_click)
- clicks = 2;
- if (ev->triple_click)
- clicks = 3;
+ if (ev->double_click)
+ clicks = 2;
+ if (ev->triple_click)
+ clicks = 3;
- key_modifiers = ewl_ev_modifiers_get();
+ key_modifiers = ewl_ev_modifiers_get();
- /* Feed a mouse move, since they don't occur prior to mouse down on a
- * touchscreen */
- ewl_embed_mouse_move_feed(embed, ev->x, ev->y, key_modifiers);
+ /* Feed a mouse move, since they don't occur prior to mouse down on a
+ * touchscreen */
+ ewl_embed_mouse_move_feed(embed, ev->x, ev->y, key_modifiers);
- ewl_embed_mouse_down_feed(embed, ev->button, clicks, ev->x, ev->y,
- key_modifiers);
+ ewl_embed_mouse_down_feed(embed, ev->button, clicks, ev->x, ev->y,
+ key_modifiers);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_fb_mouse_up(void *data, int type __UNUSED__, void *e)
{
- Ewl_Embed *embed;
- Ewl_Engine_Evas_Fb *engine;
- Ecore_Fb_Event_Mouse_Button_Up *ev;
- unsigned int key_modifiers;
+ Ewl_Embed *embed;
+ Ewl_Engine_Evas_Fb *engine;
+ Ecore_Fb_Event_Mouse_Button_Up *ev;
+ unsigned int key_modifiers;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
- engine = data;
+ ev = e;
+ engine = data;
- embed = EWL_EMBED(engine->window);
- if (!embed)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ embed = EWL_EMBED(engine->window);
+ if (!embed)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- key_modifiers = ewl_ev_modifiers_get();
- ewl_embed_mouse_move_feed(embed, ev->x, ev->y, key_modifiers);
- ewl_embed_mouse_up_feed(embed, ev->button, ev->x, ev->y, key_modifiers);
+ key_modifiers = ewl_ev_modifiers_get();
+ ewl_embed_mouse_move_feed(embed, ev->x, ev->y, key_modifiers);
+ ewl_embed_mouse_up_feed(embed, ev->button, ev->x, ev->y, key_modifiers);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_fb_mouse_move(void *data, int type __UNUSED__, void *e)
{
- Ewl_Embed *embed;
- Ewl_Engine_Evas_Fb *engine;
- Ecore_Fb_Event_Mouse_Move *ev;
+ Ewl_Embed *embed;
+ Ewl_Engine_Evas_Fb *engine;
+ Ecore_Fb_Event_Mouse_Move *ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
- engine = data;
+ ev = e;
+ engine = data;
- embed = EWL_EMBED(engine->window);
- if (!embed)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ embed = EWL_EMBED(engine->window);
+ if (!embed)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- ewl_embed_mouse_move_feed(embed, ev->x, ev->y,
- ewl_ev_modifiers_get());
+ ewl_embed_mouse_move_feed(embed, ev->x, ev->y,
+ ewl_ev_modifiers_get());
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
diff --git a/src/engines/evas_gl_glew/Ewl_Engine_Evas_Gl_Glew.h b/src/engines/evas_gl_glew/Ewl_Engine_Evas_Gl_Glew.h
index bdabc50..398bfad 100644
--- a/src/engines/evas_gl_glew/Ewl_Engine_Evas_Gl_Glew.h
+++ b/src/engines/evas_gl_glew/Ewl_Engine_Evas_Gl_Glew.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_ENGINE_EVAS_GL_GLEW_H
#define EWL_ENGINE_EVAS_GL_GLEW_H
@@ -8,12 +8,12 @@
#include <Ecore_Win32.h>
#define EWL_ENGINE_EVAS_GL_GLEW(engine) \
- ((Ewl_Engine_Evas_Gl_Glew *)engine)
+ ((Ewl_Engine_Evas_Gl_Glew *)engine)
typedef struct Ewl_Engine_Evas_Gl_Glew Ewl_Engine_Evas_Gl_Glew;
struct Ewl_Engine_Evas_Gl_Glew
{
- Ewl_Engine engine;
+ Ewl_Engine engine;
};
#endif
diff --git a/src/engines/evas_gl_glew/ewl_engine_evas_gl_glew.c b/src/engines/evas_gl_glew/ewl_engine_evas_gl_glew.c
index 7493949..951142a 100644
--- a/src/engines/evas_gl_glew/ewl_engine_evas_gl_glew.c
+++ b/src/engines/evas_gl_glew/ewl_engine_evas_gl_glew.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Engine_Evas_Gl_Glew.h"
#include "ewl_private.h"
#include "ewl_debug.h"
@@ -10,119 +10,119 @@ static void ee_shutdown(Ewl_Engine *engine);
static void ee_canvas_setup(Ewl_Window *win, int debug);
static void *canvas_funcs[EWL_ENGINE_CANVAS_MAX] =
- {
- ee_canvas_setup,
- NULL, NULL, NULL, NULL
- };
+ {
+ ee_canvas_setup,
+ NULL, NULL, NULL, NULL
+ };
Ecore_DList *
ewl_engine_dependancies(void)
{
- Ecore_DList *d;
+ Ecore_DList *d;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- d = ecore_dlist_new();
- ecore_dlist_append(d, strdup("win32"));
- ecore_dlist_append(d, strdup("evas"));
+ d = ecore_dlist_new();
+ ecore_dlist_append(d, strdup("win32"));
+ ecore_dlist_append(d, strdup("evas"));
- DRETURN_PTR(d, DLEVEL_STABLE);
+ DRETURN_PTR(d, DLEVEL_STABLE);
}
Ewl_Engine *
ewl_engine_create(int *argc __UNUSED__, char ** argv __UNUSED__)
{
- Ewl_Engine_Evas_Gl_Glew *engine;
+ Ewl_Engine_Evas_Gl_Glew *engine;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- engine = NEW(Ewl_Engine_Evas_Gl_Glew, 1);
- if (!engine)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ engine = NEW(Ewl_Engine_Evas_Gl_Glew, 1);
+ if (!engine)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ee_init(EWL_ENGINE(engine)))
- {
- FREE(engine);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ee_init(EWL_ENGINE(engine)))
+ {
+ FREE(engine);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
}
static int
ee_init(Ewl_Engine *engine)
{
- Ewl_Engine_Info *info;
+ Ewl_Engine_Info *info;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(engine, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(engine, FALSE);
- info = NEW(Ewl_Engine_Info, 1);
- info->shutdown = ee_shutdown;
- info->hooks.canvas = canvas_funcs;
+ info = NEW(Ewl_Engine_Info, 1);
+ info->shutdown = ee_shutdown;
+ info->hooks.canvas = canvas_funcs;
- engine->functions = info;
+ engine->functions = info;
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static void
ee_shutdown(Ewl_Engine *engine)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(engine);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(engine);
- IF_FREE(engine->functions);
+ IF_FREE(engine->functions);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_canvas_setup(Ewl_Window *win, int debug)
{
- Evas *evas;
- Evas_Engine_Info *info = NULL;
- Evas_Engine_Info_GL_Glew *glinfo;
- Ewl_Object *o;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
-
- if (!ecore_win32_glew_init(win->window))
- {
- fprintf(stderr, "[Ewl] Unable to set OpenGL Glew data "
- "for rendering, ");
- exit(-1);
- }
-
- evas = evas_new();
- evas_output_method_set(evas, evas_render_method_lookup("gl_glew"));
-
- info = evas_engine_info_get(evas);
- if (!info)
- {
- fprintf(stderr, "Unable to use gl_glew engine for rendering, ");
- exit(-1);
- }
-
- glinfo = (Evas_Engine_Info_GL_Glew *)info;
-
- glinfo->info.dc = ecore_win32_glew_dc_get((Ecore_Win32_Window *)win->window);
- glinfo->info.depth = ecore_win32_glew_depth_get((Ecore_Win32_Window *)win->window);
-
- o = EWL_OBJECT(win);
-
- evas_engine_info_set(evas, info);
- evas_output_size_set(evas, ewl_object_current_w_get(o),
- ewl_object_current_h_get(o));
- evas_output_viewport_set(evas, ewl_object_current_x_get(o),
- ewl_object_current_y_get(o),
- ewl_object_current_w_get(o),
- ewl_object_current_h_get(o));
- ewl_embed_canvas_set(EWL_EMBED(win), evas, win->window);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Evas *evas;
+ Evas_Engine_Info *info = NULL;
+ Evas_Engine_Info_GL_Glew *glinfo;
+ Ewl_Object *o;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+
+ if (!ecore_win32_glew_init(win->window))
+ {
+ fprintf(stderr, "[Ewl] Unable to set OpenGL Glew data "
+ "for rendering, ");
+ exit(-1);
+ }
+
+ evas = evas_new();
+ evas_output_method_set(evas, evas_render_method_lookup("gl_glew"));
+
+ info = evas_engine_info_get(evas);
+ if (!info)
+ {
+ fprintf(stderr, "Unable to use gl_glew engine for rendering, ");
+ exit(-1);
+ }
+
+ glinfo = (Evas_Engine_Info_GL_Glew *)info;
+
+ glinfo->info.dc = ecore_win32_glew_dc_get((Ecore_Win32_Window *)win->window);
+ glinfo->info.depth = ecore_win32_glew_depth_get((Ecore_Win32_Window *)win->window);
+
+ o = EWL_OBJECT(win);
+
+ evas_engine_info_set(evas, info);
+ evas_output_size_set(evas, ewl_object_current_w_get(o),
+ ewl_object_current_h_get(o));
+ evas_output_viewport_set(evas, ewl_object_current_x_get(o),
+ ewl_object_current_y_get(o),
+ ewl_object_current_w_get(o),
+ ewl_object_current_h_get(o));
+ ewl_embed_canvas_set(EWL_EMBED(win), evas, win->window);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/engines/evas_gl_x11/Ewl_Engine_Evas_Gl_X11.h b/src/engines/evas_gl_x11/Ewl_Engine_Evas_Gl_X11.h
index 52e8ae2..fd48e68 100644
--- a/src/engines/evas_gl_x11/Ewl_Engine_Evas_Gl_X11.h
+++ b/src/engines/evas_gl_x11/Ewl_Engine_Evas_Gl_X11.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_ENGINE_EVAS_GL_X11_H
#define EWL_ENGINE_EVAS_GL_X11_H
@@ -8,12 +8,12 @@
#include <Evas_Engine_GL_X11.h>
#define EWL_ENGINE_EVAS_GL_X11(engine) \
- ((Ewl_Engine_Evas_Gl_X11 *)engine)
+ ((Ewl_Engine_Evas_Gl_X11 *)engine)
typedef struct Ewl_Engine_Evas_Gl_X11 Ewl_Engine_Evas_Gl_X11;
struct Ewl_Engine_Evas_Gl_X11
{
- Ewl_Engine engine;
+ Ewl_Engine engine;
};
#endif
diff --git a/src/engines/evas_gl_x11/ewl_engine_evas_gl_x11.c b/src/engines/evas_gl_x11/ewl_engine_evas_gl_x11.c
index dfb9e78..a18a5a3 100644
--- a/src/engines/evas_gl_x11/ewl_engine_evas_gl_x11.c
+++ b/src/engines/evas_gl_x11/ewl_engine_evas_gl_x11.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Engine_Evas_Gl_X11.h"
#include "ewl_private.h"
#include "ewl_debug.h"
@@ -10,121 +10,121 @@ static void ee_shutdown(Ewl_Engine *engine);
static void ee_canvas_setup(Ewl_Window *win, int debug);
static void *canvas_funcs[EWL_ENGINE_CANVAS_MAX] =
- {
- ee_canvas_setup,
- NULL, NULL, NULL, NULL
- };
+ {
+ ee_canvas_setup,
+ NULL, NULL, NULL, NULL
+ };
Ecore_DList *
ewl_engine_dependancies(void)
{
- Ecore_DList *d;
+ Ecore_DList *d;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- d = ecore_dlist_new();
- ecore_dlist_append(d, strdup("x11"));
- ecore_dlist_append(d, strdup("evas"));
+ d = ecore_dlist_new();
+ ecore_dlist_append(d, strdup("x11"));
+ ecore_dlist_append(d, strdup("evas"));
- DRETURN_PTR(d, DLEVEL_STABLE);
+ DRETURN_PTR(d, DLEVEL_STABLE);
}
Ewl_Engine *
ewl_engine_create(int *argc __UNUSED__, char ** argv __UNUSED__)
{
- Ewl_Engine_Evas_Gl_X11 *engine;
+ Ewl_Engine_Evas_Gl_X11 *engine;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- engine = NEW(Ewl_Engine_Evas_Gl_X11, 1);
- if (!engine)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ engine = NEW(Ewl_Engine_Evas_Gl_X11, 1);
+ if (!engine)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ee_init(EWL_ENGINE(engine)))
- {
- FREE(engine);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ee_init(EWL_ENGINE(engine)))
+ {
+ FREE(engine);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
}
static int
ee_init(Ewl_Engine *engine)
{
- Ewl_Engine_Info *info;
+ Ewl_Engine_Info *info;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(engine, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(engine, FALSE);
- info = NEW(Ewl_Engine_Info, 1);
- info->shutdown = ee_shutdown;
- info->hooks.canvas = canvas_funcs;
+ info = NEW(Ewl_Engine_Info, 1);
+ info->shutdown = ee_shutdown;
+ info->hooks.canvas = canvas_funcs;
- engine->functions = info;
+ engine->functions = info;
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static void
ee_shutdown(Ewl_Engine *engine)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(engine);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(engine);
- IF_FREE(engine->functions);
+ IF_FREE(engine->functions);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_canvas_setup(Ewl_Window *win, int debug)
{
- Evas *evas;
- Evas_Engine_Info *info = NULL;
- Evas_Engine_Info_GL_X11 *glinfo;
- Ewl_Object *o;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
-
- evas = evas_new();
- evas_output_method_set(evas, evas_render_method_lookup("gl_x11"));
-
- info = evas_engine_info_get(evas);
- if (!info)
- {
- fprintf(stderr, "Unable to use gl_x11 engine for rendering, ");
- exit(-1);
- }
-
- glinfo = (Evas_Engine_Info_GL_X11 *)info;
-
- glinfo->info.display = ecore_x_display_get();
- glinfo->info.visual = glinfo->func.best_visual_get(
- glinfo->info.display,
- DefaultScreen(glinfo->info.display));
- glinfo->info.colormap = glinfo->func.best_colormap_get(
- glinfo->info.display,
- DefaultScreen(glinfo->info.display));
- glinfo->info.drawable = (Ecore_X_Window)win->window;
- glinfo->info.depth = glinfo->func.best_depth_get(
- glinfo->info.display,
- DefaultScreen(glinfo->info.display));
-
- o = EWL_OBJECT(win);
-
- evas_engine_info_set(evas, info);
- evas_output_size_set(evas, ewl_object_current_w_get(o),
- ewl_object_current_h_get(o));
- evas_output_viewport_set(evas, ewl_object_current_x_get(o),
- ewl_object_current_y_get(o),
- ewl_object_current_w_get(o),
- ewl_object_current_h_get(o));
- ewl_embed_canvas_set(EWL_EMBED(win), evas, win->window);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Evas *evas;
+ Evas_Engine_Info *info = NULL;
+ Evas_Engine_Info_GL_X11 *glinfo;
+ Ewl_Object *o;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+
+ evas = evas_new();
+ evas_output_method_set(evas, evas_render_method_lookup("gl_x11"));
+
+ info = evas_engine_info_get(evas);
+ if (!info)
+ {
+ fprintf(stderr, "Unable to use gl_x11 engine for rendering, ");
+ exit(-1);
+ }
+
+ glinfo = (Evas_Engine_Info_GL_X11 *)info;
+
+ glinfo->info.display = ecore_x_display_get();
+ glinfo->info.visual = glinfo->func.best_visual_get(
+ glinfo->info.display,
+ DefaultScreen(glinfo->info.display));
+ glinfo->info.colormap = glinfo->func.best_colormap_get(
+ glinfo->info.display,
+ DefaultScreen(glinfo->info.display));
+ glinfo->info.drawable = (Ecore_X_Window)win->window;
+ glinfo->info.depth = glinfo->func.best_depth_get(
+ glinfo->info.display,
+ DefaultScreen(glinfo->info.display));
+
+ o = EWL_OBJECT(win);
+
+ evas_engine_info_set(evas, info);
+ evas_output_size_set(evas, ewl_object_current_w_get(o),
+ ewl_object_current_h_get(o));
+ evas_output_viewport_set(evas, ewl_object_current_x_get(o),
+ ewl_object_current_y_get(o),
+ ewl_object_current_w_get(o),
+ ewl_object_current_h_get(o));
+ ewl_embed_canvas_set(EWL_EMBED(win), evas, win->window);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/engines/evas_software_16_x11/Ewl_Engine_Evas_Software_16_X11.h b/src/engines/evas_software_16_x11/Ewl_Engine_Evas_Software_16_X11.h
index 85b95f0..3b4c288 100644
--- a/src/engines/evas_software_16_x11/Ewl_Engine_Evas_Software_16_X11.h
+++ b/src/engines/evas_software_16_x11/Ewl_Engine_Evas_Software_16_X11.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_ENGINE_EVAS_SOFTWARE_16_X11_H
#define EWL_ENGINE_EVAS_SOFTWARE_16_X11_H
@@ -8,12 +8,12 @@
#include <Evas_Engine_Software_16_X11.h>
#define EWL_ENGINE_EVAS_SOFTWARE_16_X11(engine) \
- ((Ewl_Engine_Evas_Software_16_X11 *)engine)
+ ((Ewl_Engine_Evas_Software_16_X11 *)engine)
typedef struct Ewl_Engine_Evas_Software_16_X11 Ewl_Engine_Evas_Software_16_X11;
struct Ewl_Engine_Evas_Software_16_X11
{
- Ewl_Engine engine;
+ Ewl_Engine engine;
};
#endif
diff --git a/src/engines/evas_software_16_x11/ewl_engine_evas_software_16_x11.c b/src/engines/evas_software_16_x11/ewl_engine_evas_software_16_x11.c
index 4e58341..47e39b0 100644
--- a/src/engines/evas_software_16_x11/ewl_engine_evas_software_16_x11.c
+++ b/src/engines/evas_software_16_x11/ewl_engine_evas_software_16_x11.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Engine_Evas_Software_16_X11.h"
#include "ewl_private.h"
#include "ewl_debug.h"
@@ -9,115 +9,115 @@ static int ee_init(Ewl_Engine *engine);
static void ee_shutdown(Ewl_Engine *engine);
static void *canvas_funcs[EWL_ENGINE_CANVAS_MAX] =
- {
- ee_canvas_setup,
- NULL, NULL, NULL, NULL
- };
+ {
+ ee_canvas_setup,
+ NULL, NULL, NULL, NULL
+ };
Ecore_DList *
ewl_engine_dependancies(void)
{
- Ecore_DList *d;
+ Ecore_DList *d;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- d = ecore_dlist_new();
- ecore_dlist_append(d, strdup("x11"));
- ecore_dlist_append(d, strdup("evas"));
+ d = ecore_dlist_new();
+ ecore_dlist_append(d, strdup("x11"));
+ ecore_dlist_append(d, strdup("evas"));
- DRETURN_PTR(d, DLEVEL_STABLE);
+ DRETURN_PTR(d, DLEVEL_STABLE);
}
Ewl_Engine *
ewl_engine_create(int *argc __UNUSED__, char ** argv __UNUSED__)
{
- Ewl_Engine_Evas_Software_16_X11 *engine;
+ Ewl_Engine_Evas_Software_16_X11 *engine;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- engine = NEW(Ewl_Engine_Evas_Software_16_X11, 1);
- if (!engine)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ engine = NEW(Ewl_Engine_Evas_Software_16_X11, 1);
+ if (!engine)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ee_init(EWL_ENGINE(engine)))
- {
- FREE(engine);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ee_init(EWL_ENGINE(engine)))
+ {
+ FREE(engine);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
}
static int
ee_init(Ewl_Engine *engine)
{
- Ewl_Engine_Info *info;
+ Ewl_Engine_Info *info;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(engine, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(engine, FALSE);
- info = NEW(Ewl_Engine_Info, 1);
- info->shutdown = ee_shutdown;
- info->hooks.canvas = canvas_funcs;
+ info = NEW(Ewl_Engine_Info, 1);
+ info->shutdown = ee_shutdown;
+ info->hooks.canvas = canvas_funcs;
- engine->functions = info;
+ engine->functions = info;
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static void
ee_shutdown(Ewl_Engine *engine)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(engine);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(engine);
- IF_FREE(engine->functions);
+ IF_FREE(engine->functions);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_canvas_setup(Ewl_Window *win, int debug)
{
- Evas *evas;
- Ewl_Object *o;
- Evas_Engine_Info *info = NULL;
- Evas_Engine_Info_Software_16_X11 *sinfo;
+ Evas *evas;
+ Ewl_Object *o;
+ Evas_Engine_Info *info = NULL;
+ Evas_Engine_Info_Software_16_X11 *sinfo;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- o = EWL_OBJECT(win);
+ o = EWL_OBJECT(win);
- evas = evas_new();
- evas_output_method_set(evas,
- evas_render_method_lookup("software_16_x11"));
+ evas = evas_new();
+ evas_output_method_set(evas,
+ evas_render_method_lookup("software_16_x11"));
- info = evas_engine_info_get(evas);
- if (!info)
- {
- fprintf(stderr, "Unable to use software_16_x11 engine "
- "for rendering, ");
- exit(-1);
- }
+ info = evas_engine_info_get(evas);
+ if (!info)
+ {
+ fprintf(stderr, "Unable to use software_16_x11 engine "
+ "for rendering, ");
+ exit(-1);
+ }
- sinfo = (Evas_Engine_Info_Software_16_X11 *)info;
+ sinfo = (Evas_Engine_Info_Software_16_X11 *)info;
- sinfo->info.display = ecore_x_display_get();
- sinfo->info.drawable = (Ecore_X_Window)win->window;
+ sinfo->info.display = ecore_x_display_get();
+ sinfo->info.drawable = (Ecore_X_Window)win->window;
- evas_engine_info_set(evas, info);
+ evas_engine_info_set(evas, info);
- evas_output_size_set(evas, ewl_object_current_w_get(o),
- ewl_object_current_h_get(o));
- evas_output_viewport_set(evas, ewl_object_current_x_get(o),
- ewl_object_current_y_get(o),
- ewl_object_current_w_get(o),
- ewl_object_current_h_get(o));
- ewl_embed_canvas_set(EWL_EMBED(win), evas, win->window);
+ evas_output_size_set(evas, ewl_object_current_w_get(o),
+ ewl_object_current_h_get(o));
+ evas_output_viewport_set(evas, ewl_object_current_x_get(o),
+ ewl_object_current_y_get(o),
+ ewl_object_current_w_get(o),
+ ewl_object_current_h_get(o));
+ ewl_embed_canvas_set(EWL_EMBED(win), evas, win->window);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/engines/evas_software_sdl/Ewl_Engine_Evas_Software_SDL.h b/src/engines/evas_software_sdl/Ewl_Engine_Evas_Software_SDL.h
index 969fc8d..4cb79cb 100644
--- a/src/engines/evas_software_sdl/Ewl_Engine_Evas_Software_SDL.h
+++ b/src/engines/evas_software_sdl/Ewl_Engine_Evas_Software_SDL.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_ENGINE_EVAS_SOFTWARE_SDL_H
#define EWL_ENGINE_EVAS_SOFTWARE_SDL_H
@@ -8,15 +8,15 @@
#include <Evas_Engine_SDL.h>
#define EWL_ENGINE_EVAS_SOFTWARE_SDL(engine) \
- ((Ewl_Engine_Evas_Software_SDL *)engine)
+ ((Ewl_Engine_Evas_Software_SDL *)engine)
typedef struct Ewl_Engine_Evas_Software_SDL Ewl_Engine_Evas_Software_SDL;
struct Ewl_Engine_Evas_Software_SDL
{
- Ewl_Engine engine;
+ Ewl_Engine engine;
- /* There can be only one window in sdl land */
- Ewl_Window *window;
+ /* There can be only one window in sdl land */
+ Ewl_Window *window;
};
#endif
diff --git a/src/engines/evas_software_sdl/ewl_engine_evas_software_sdl.c b/src/engines/evas_software_sdl/ewl_engine_evas_software_sdl.c
index dfd4a0f..fc382a9 100644
--- a/src/engines/evas_software_sdl/ewl_engine_evas_software_sdl.c
+++ b/src/engines/evas_software_sdl/ewl_engine_evas_software_sdl.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Engine_Evas_Software_SDL.h"
#include "ewl_macros.h"
#include "ewl_private.h"
@@ -23,42 +23,42 @@ static int ee_init(Ewl_Engine *engine);
static void ee_shutdown(Ewl_Engine *engine);
static void *canvas_funcs[EWL_ENGINE_CANVAS_MAX] =
- {
- ee_canvas_setup,
- NULL, NULL, NULL, NULL
- };
+ {
+ ee_canvas_setup,
+ NULL, NULL, NULL, NULL
+ };
Ecore_DList *
ewl_engine_dependancies(void)
{
- Ecore_DList *d;
+ Ecore_DList *d;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- d = ecore_dlist_new();
- ecore_dlist_append(d, strdup("evas"));
+ d = ecore_dlist_new();
+ ecore_dlist_append(d, strdup("evas"));
- DRETURN_PTR(d, DLEVEL_STABLE);
+ DRETURN_PTR(d, DLEVEL_STABLE);
}
Ewl_Engine *
ewl_engine_create(int *argc __UNUSED__, char ** argv __UNUSED__)
{
- Ewl_Engine_Evas_Software_SDL *engine;
+ Ewl_Engine_Evas_Software_SDL *engine;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- engine = NEW(Ewl_Engine_Evas_Software_SDL, 1);
- if (!engine)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ engine = NEW(Ewl_Engine_Evas_Software_SDL, 1);
+ if (!engine)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ee_init(EWL_ENGINE(engine)))
- {
- FREE(engine);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ee_init(EWL_ENGINE(engine)))
+ {
+ FREE(engine);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
}
static int
@@ -79,252 +79,252 @@ ewl_idler_event_setup(void *data __UNUSED__)
static int
ee_init(Ewl_Engine *engine)
{
- Ewl_Engine_Info *info;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(engine, TRUE);
-
- if (ee_key_down_handler)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
-
- if (!ecore_sdl_init(NULL))
- DRETURN_INT(TRUE, DLEVEL_STABLE);
-
- ee_key_down_handler = ecore_event_handler_add(
- ECORE_SDL_EVENT_KEY_DOWN,
- ewl_ev_sdl_key_down, engine);
- ee_key_up_handler = ecore_event_handler_add(
- ECORE_SDL_EVENT_KEY_UP,
- ewl_ev_sdl_key_up, engine);
- ee_mouse_down_handler = ecore_event_handler_add(
- ECORE_SDL_EVENT_MOUSE_BUTTON_DOWN,
- ewl_ev_sdl_mouse_down, engine);
- ee_mouse_up_handler = ecore_event_handler_add(
- ECORE_SDL_EVENT_MOUSE_BUTTON_UP,
- ewl_ev_sdl_mouse_up, engine);
- ee_mouse_move_handler = ecore_event_handler_add(
- ECORE_SDL_EVENT_MOUSE_MOVE,
- ewl_ev_sdl_mouse_move, engine);
+ Ewl_Engine_Info *info;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(engine, TRUE);
+
+ if (ee_key_down_handler)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+
+ if (!ecore_sdl_init(NULL))
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+
+ ee_key_down_handler = ecore_event_handler_add(
+ ECORE_SDL_EVENT_KEY_DOWN,
+ ewl_ev_sdl_key_down, engine);
+ ee_key_up_handler = ecore_event_handler_add(
+ ECORE_SDL_EVENT_KEY_UP,
+ ewl_ev_sdl_key_up, engine);
+ ee_mouse_down_handler = ecore_event_handler_add(
+ ECORE_SDL_EVENT_MOUSE_BUTTON_DOWN,
+ ewl_ev_sdl_mouse_down, engine);
+ ee_mouse_up_handler = ecore_event_handler_add(
+ ECORE_SDL_EVENT_MOUSE_BUTTON_UP,
+ ewl_ev_sdl_mouse_up, engine);
+ ee_mouse_move_handler = ecore_event_handler_add(
+ ECORE_SDL_EVENT_MOUSE_MOVE,
+ ewl_ev_sdl_mouse_move, engine);
if (!ee_key_down_handler || !ee_key_up_handler
- || !ee_mouse_down_handler || !ee_mouse_up_handler
- || !ee_mouse_move_handler)
- {
- ee_shutdown(engine);
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
+ || !ee_mouse_down_handler || !ee_mouse_up_handler
+ || !ee_mouse_move_handler)
+ {
+ ee_shutdown(engine);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
- info = NEW(Ewl_Engine_Info, 1);
- info->shutdown = ee_shutdown;
- info->hooks.canvas = canvas_funcs;
+ info = NEW(Ewl_Engine_Info, 1);
+ info->shutdown = ee_shutdown;
+ info->hooks.canvas = canvas_funcs;
engine->functions = info;
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static void
ee_shutdown(Ewl_Engine *engine)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(engine);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(engine);
- if (ee_key_down_handler)
- ecore_event_handler_del(ee_key_down_handler);
- ee_key_down_handler = NULL;
+ if (ee_key_down_handler)
+ ecore_event_handler_del(ee_key_down_handler);
+ ee_key_down_handler = NULL;
- if (ee_key_up_handler)
- ecore_event_handler_del(ee_key_up_handler);
- ee_key_up_handler = NULL;
+ if (ee_key_up_handler)
+ ecore_event_handler_del(ee_key_up_handler);
+ ee_key_up_handler = NULL;
- if (ee_mouse_down_handler)
- ecore_event_handler_del(ee_mouse_down_handler);
- ee_mouse_down_handler = NULL;
+ if (ee_mouse_down_handler)
+ ecore_event_handler_del(ee_mouse_down_handler);
+ ee_mouse_down_handler = NULL;
- if (ee_mouse_up_handler)
- ecore_event_handler_del(ee_mouse_up_handler);
- ee_mouse_up_handler = NULL;
+ if (ee_mouse_up_handler)
+ ecore_event_handler_del(ee_mouse_up_handler);
+ ee_mouse_up_handler = NULL;
- if (ee_mouse_move_handler)
- ecore_event_handler_del(ee_mouse_move_handler);
- ee_mouse_move_handler = NULL;
+ if (ee_mouse_move_handler)
+ ecore_event_handler_del(ee_mouse_move_handler);
+ ee_mouse_move_handler = NULL;
ecore_timer_del(ewl_event);
- ecore_sdl_shutdown();
+ ecore_sdl_shutdown();
- IF_FREE(engine->functions);
+ IF_FREE(engine->functions);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_canvas_setup(Ewl_Window *win, int debug __UNUSED__)
{
- Evas *evas;
- Evas_Engine_Info *info = NULL;
- Evas_Engine_Info_SDL *sdlinfo;
- Ewl_Object *o;
+ Evas *evas;
+ Evas_Engine_Info *info = NULL;
+ Evas_Engine_Info_SDL *sdlinfo;
+ Ewl_Object *o;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- evas = evas_new();
- evas_output_method_set(evas, evas_render_method_lookup("software_sdl"));
+ evas = evas_new();
+ evas_output_method_set(evas, evas_render_method_lookup("software_sdl"));
- info = evas_engine_info_get(evas);
- if (!info)
- {
- fprintf(stderr, "Unable to use evas_software_sdl engine for rendering, ");
- exit(-1);
- }
+ info = evas_engine_info_get(evas);
+ if (!info)
+ {
+ fprintf(stderr, "Unable to use evas_software_sdl engine for rendering, ");
+ exit(-1);
+ }
- win->window = sdlinfo = (Evas_Engine_Info_SDL *)info;
+ win->window = sdlinfo = (Evas_Engine_Info_SDL *)info;
sdlinfo->info.fullscreen = 0;
sdlinfo->info.hwsurface = 1;
sdlinfo->info.noframe = 0;
sdlinfo->info.alpha = 1;
- evas_engine_info_set(evas, (Evas_Engine_Info *)sdlinfo);
+ evas_engine_info_set(evas, (Evas_Engine_Info *)sdlinfo);
- o = EWL_OBJECT(win);
- evas_engine_info_set(evas, info);
- evas_output_size_set(evas, ewl_object_current_w_get(o),
- ewl_object_current_h_get(o));
- evas_output_viewport_set(evas, ewl_object_current_x_get(o),
- ewl_object_current_y_get(o),
- ewl_object_current_w_get(o),
- ewl_object_current_h_get(o));
+ o = EWL_OBJECT(win);
+ evas_engine_info_set(evas, info);
+ evas_output_size_set(evas, ewl_object_current_w_get(o),
+ ewl_object_current_h_get(o));
+ evas_output_viewport_set(evas, ewl_object_current_x_get(o),
+ ewl_object_current_y_get(o),
+ ewl_object_current_w_get(o),
+ ewl_object_current_h_get(o));
ecore_idler_add(ewl_idler_event_setup, NULL);
- ewl_embed_canvas_set(EWL_EMBED(win), evas, win->window);
+ ewl_embed_canvas_set(EWL_EMBED(win), evas, win->window);
- EWL_ENGINE_EVAS_SOFTWARE_SDL(EWL_EMBED(win)->engine)->window = win;
+ EWL_ENGINE_EVAS_SOFTWARE_SDL(EWL_EMBED(win)->engine)->window = win;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static int
ewl_ev_sdl_key_down(void *data, int type __UNUSED__, void *e)
{
- Ewl_Embed *embed;
- Ewl_Engine_Evas_Software_SDL *engine;
- Ecore_Sdl_Event_Key_Down *ev;
+ Ewl_Embed *embed;
+ Ewl_Engine_Evas_Software_SDL *engine;
+ Ecore_Sdl_Event_Key_Down *ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
- engine = data;
+ ev = e;
+ engine = data;
- embed = EWL_EMBED(engine->window);
- if (!embed)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ embed = EWL_EMBED(engine->window);
+ if (!embed)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- ewl_embed_key_down_feed(embed, ev->keyname, ewl_ev_modifiers_get());
+ ewl_embed_key_down_feed(embed, ev->keyname, ewl_ev_modifiers_get());
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_sdl_key_up(void *data, int type __UNUSED__, void *e)
{
- Ewl_Embed *embed;
- Ewl_Engine_Evas_Software_SDL *engine;
- Ecore_Sdl_Event_Key_Up *ev;
+ Ewl_Embed *embed;
+ Ewl_Engine_Evas_Software_SDL *engine;
+ Ecore_Sdl_Event_Key_Up *ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
- engine = data;
+ ev = e;
+ engine = data;
- embed = EWL_EMBED(engine->window);
- if (!embed)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ embed = EWL_EMBED(engine->window);
+ if (!embed)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- ewl_embed_key_down_feed(embed, ev->keyname, ewl_ev_modifiers_get());
+ ewl_embed_key_down_feed(embed, ev->keyname, ewl_ev_modifiers_get());
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_sdl_mouse_down(void *data, int type __UNUSED__, void *e)
{
- int clicks = 1;
- Ewl_Embed *embed;
- Ewl_Engine_Evas_Software_SDL *engine;
- Ecore_Sdl_Event_Mouse_Button_Down *ev;
- unsigned int key_modifiers;
+ int clicks = 1;
+ Ewl_Embed *embed;
+ Ewl_Engine_Evas_Software_SDL *engine;
+ Ecore_Sdl_Event_Mouse_Button_Down *ev;
+ unsigned int key_modifiers;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
- engine = data;
+ ev = e;
+ engine = data;
- embed = EWL_EMBED(engine->window);
- if (!embed)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ embed = EWL_EMBED(engine->window);
+ if (!embed)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- if (ev->double_click)
- clicks = 2;
- if (ev->triple_click)
- clicks = 3;
+ if (ev->double_click)
+ clicks = 2;
+ if (ev->triple_click)
+ clicks = 3;
- key_modifiers = ewl_ev_modifiers_get();
+ key_modifiers = ewl_ev_modifiers_get();
- /* Feed a mouse move, since they don't occur prior to mouse down on a
- * touchscreen */
- ewl_embed_mouse_move_feed(embed, ev->x, ev->y, key_modifiers);
+ /* Feed a mouse move, since they don't occur prior to mouse down on a
+ * touchscreen */
+ ewl_embed_mouse_move_feed(embed, ev->x, ev->y, key_modifiers);
- ewl_embed_mouse_down_feed(embed, ev->button, clicks, ev->x, ev->y,
- key_modifiers);
+ ewl_embed_mouse_down_feed(embed, ev->button, clicks, ev->x, ev->y,
+ key_modifiers);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_sdl_mouse_up(void *data, int type __UNUSED__, void *e)
{
- Ewl_Embed *embed;
- Ewl_Engine_Evas_Software_SDL *engine;
- Ecore_Sdl_Event_Mouse_Button_Up *ev;
- unsigned int key_modifiers;
+ Ewl_Embed *embed;
+ Ewl_Engine_Evas_Software_SDL *engine;
+ Ecore_Sdl_Event_Mouse_Button_Up *ev;
+ unsigned int key_modifiers;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
- engine = data;
+ ev = e;
+ engine = data;
- embed = EWL_EMBED(engine->window);
- if (!embed)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ embed = EWL_EMBED(engine->window);
+ if (!embed)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- key_modifiers = ewl_ev_modifiers_get();
- ewl_embed_mouse_move_feed(embed, ev->x, ev->y, key_modifiers);
- ewl_embed_mouse_up_feed(embed, ev->button, ev->x, ev->y, key_modifiers);
+ key_modifiers = ewl_ev_modifiers_get();
+ ewl_embed_mouse_move_feed(embed, ev->x, ev->y, key_modifiers);
+ ewl_embed_mouse_up_feed(embed, ev->button, ev->x, ev->y, key_modifiers);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_sdl_mouse_move(void *data, int type __UNUSED__, void *e)
{
- Ewl_Embed *embed;
- Ewl_Engine_Evas_Software_SDL *engine;
- Ecore_Sdl_Event_Mouse_Move *ev;
+ Ewl_Embed *embed;
+ Ewl_Engine_Evas_Software_SDL *engine;
+ Ecore_Sdl_Event_Mouse_Move *ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
- engine = data;
+ ev = e;
+ engine = data;
- embed = EWL_EMBED(engine->window);
- if (!embed)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ embed = EWL_EMBED(engine->window);
+ if (!embed)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- ewl_embed_mouse_move_feed(embed, ev->x, ev->y,
- ewl_ev_modifiers_get());
+ ewl_embed_mouse_move_feed(embed, ev->x, ev->y,
+ ewl_ev_modifiers_get());
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
diff --git a/src/engines/evas_software_x11/Ewl_Engine_Evas_Software_X11.h b/src/engines/evas_software_x11/Ewl_Engine_Evas_Software_X11.h
index c0eca0c..4923a5a 100644
--- a/src/engines/evas_software_x11/Ewl_Engine_Evas_Software_X11.h
+++ b/src/engines/evas_software_x11/Ewl_Engine_Evas_Software_X11.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_ENGINE_EVAS_SOFTWARE_X11_H
#define EWL_ENGINE_EVAS_SOFTWARE_X11_H
@@ -8,12 +8,12 @@
#include <Evas_Engine_Software_X11.h>
#define EWL_ENGINE_EVAS_SOFTWARE_X11(engine) \
- ((Ewl_Engine_Evas_Software_X11 *)engine)
+ ((Ewl_Engine_Evas_Software_X11 *)engine)
typedef struct Ewl_Engine_Evas_Software_X11 Ewl_Engine_Evas_Software_X11;
struct Ewl_Engine_Evas_Software_X11
{
- Ewl_Engine engine;
+ Ewl_Engine engine;
};
#endif
diff --git a/src/engines/evas_software_x11/ewl_engine_evas_software_x11.c b/src/engines/evas_software_x11/ewl_engine_evas_software_x11.c
index e374095..b9df4e0 100644
--- a/src/engines/evas_software_x11/ewl_engine_evas_software_x11.c
+++ b/src/engines/evas_software_x11/ewl_engine_evas_software_x11.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Engine_Evas_Software_X11.h"
#include "ewl_private.h"
#include "ewl_debug.h"
@@ -9,123 +9,123 @@ static int ee_init(Ewl_Engine *engine);
static void ee_shutdown(Ewl_Engine *engine);
static void *canvas_funcs[EWL_ENGINE_CANVAS_MAX] =
- {
- ee_canvas_setup,
- NULL, NULL, NULL, NULL
- };
+ {
+ ee_canvas_setup,
+ NULL, NULL, NULL, NULL
+ };
Ecore_DList *
ewl_engine_dependancies(void)
{
- Ecore_DList *d;
+ Ecore_DList *d;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- d = ecore_dlist_new();
- ecore_dlist_append(d, strdup("x11"));
- ecore_dlist_append(d, strdup("evas"));
+ d = ecore_dlist_new();
+ ecore_dlist_append(d, strdup("x11"));
+ ecore_dlist_append(d, strdup("evas"));
- DRETURN_PTR(d, DLEVEL_STABLE);
+ DRETURN_PTR(d, DLEVEL_STABLE);
}
Ewl_Engine *
ewl_engine_create(int *argc __UNUSED__, char ** argv __UNUSED__)
{
- Ewl_Engine_Evas_Software_X11 *engine;
+ Ewl_Engine_Evas_Software_X11 *engine;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- engine = NEW(Ewl_Engine_Evas_Software_X11, 1);
- if (!engine)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ engine = NEW(Ewl_Engine_Evas_Software_X11, 1);
+ if (!engine)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ee_init(EWL_ENGINE(engine)))
- {
- FREE(engine);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ee_init(EWL_ENGINE(engine)))
+ {
+ FREE(engine);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
}
static int
ee_init(Ewl_Engine *engine)
{
- Ewl_Engine_Info *info;
+ Ewl_Engine_Info *info;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(engine, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(engine, FALSE);
- info = NEW(Ewl_Engine_Info, 1);
- info->shutdown = ee_shutdown;
- info->hooks.canvas = canvas_funcs;
+ info = NEW(Ewl_Engine_Info, 1);
+ info->shutdown = ee_shutdown;
+ info->hooks.canvas = canvas_funcs;
- engine->functions = info;
+ engine->functions = info;
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static void
ee_shutdown(Ewl_Engine *engine)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(engine);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(engine);
- IF_FREE(engine->functions);
+ IF_FREE(engine->functions);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_canvas_setup(Ewl_Window *win, int debug)
{
- Evas *evas;
- Ewl_Object *o;
- Evas_Engine_Info *info = NULL;
- Evas_Engine_Info_Software_X11 *sinfo;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
-
- o = EWL_OBJECT(win);
-
- evas = evas_new();
- evas_output_method_set(evas,
- evas_render_method_lookup("software_x11"));
-
- info = evas_engine_info_get(evas);
- if (!info)
- {
- fprintf(stderr, "Unable to use software_x11 engine "
- "for rendering, ");
- exit(-1);
- }
-
- sinfo = (Evas_Engine_Info_Software_X11 *)info;
-
- sinfo->info.display = ecore_x_display_get();
- sinfo->info.visual = DefaultVisual(sinfo->info.display,
- DefaultScreen(sinfo->info.display));
- sinfo->info.colormap = DefaultColormap(sinfo->info.display,
- DefaultScreen(sinfo->info.display));
- sinfo->info.drawable = (Ecore_X_Window)win->window;
- sinfo->info.depth = DefaultDepth(sinfo->info.display,
- DefaultScreen(sinfo->info.display));
- sinfo->info.rotation = 0;
- sinfo->info.debug = debug;
-
- evas_engine_info_set(evas, info);
-
- evas_output_size_set(evas, ewl_object_current_w_get(o),
- ewl_object_current_h_get(o));
- evas_output_viewport_set(evas, ewl_object_current_x_get(o),
- ewl_object_current_y_get(o),
- ewl_object_current_w_get(o),
- ewl_object_current_h_get(o));
- ewl_embed_canvas_set(EWL_EMBED(win), evas, win->window);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Evas *evas;
+ Ewl_Object *o;
+ Evas_Engine_Info *info = NULL;
+ Evas_Engine_Info_Software_X11 *sinfo;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+
+ o = EWL_OBJECT(win);
+
+ evas = evas_new();
+ evas_output_method_set(evas,
+ evas_render_method_lookup("software_x11"));
+
+ info = evas_engine_info_get(evas);
+ if (!info)
+ {
+ fprintf(stderr, "Unable to use software_x11 engine "
+ "for rendering, ");
+ exit(-1);
+ }
+
+ sinfo = (Evas_Engine_Info_Software_X11 *)info;
+
+ sinfo->info.display = ecore_x_display_get();
+ sinfo->info.visual = DefaultVisual(sinfo->info.display,
+ DefaultScreen(sinfo->info.display));
+ sinfo->info.colormap = DefaultColormap(sinfo->info.display,
+ DefaultScreen(sinfo->info.display));
+ sinfo->info.drawable = (Ecore_X_Window)win->window;
+ sinfo->info.depth = DefaultDepth(sinfo->info.display,
+ DefaultScreen(sinfo->info.display));
+ sinfo->info.rotation = 0;
+ sinfo->info.debug = debug;
+
+ evas_engine_info_set(evas, info);
+
+ evas_output_size_set(evas, ewl_object_current_w_get(o),
+ ewl_object_current_h_get(o));
+ evas_output_viewport_set(evas, ewl_object_current_x_get(o),
+ ewl_object_current_y_get(o),
+ ewl_object_current_w_get(o),
+ ewl_object_current_h_get(o));
+ ewl_embed_canvas_set(EWL_EMBED(win), evas, win->window);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/engines/evas_software_xcb/Ewl_Engine_Evas_Software_Xcb.h b/src/engines/evas_software_xcb/Ewl_Engine_Evas_Software_Xcb.h
index 502ac72..f536b14 100644
--- a/src/engines/evas_software_xcb/Ewl_Engine_Evas_Software_Xcb.h
+++ b/src/engines/evas_software_xcb/Ewl_Engine_Evas_Software_Xcb.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_ENGINE_EVAS_SOFTWARE_XCB_H
#define EWL_ENGINE_EVAS_SOFTWARE_XCB_H
@@ -8,12 +8,12 @@
#include <Evas_Engine_Software_Xcb.h>
#define EWL_ENGINE_EVAS_SOFTWARE_XCB(engine) \
- ((Ewl_Engine_Evas_Software_Xcb *)engine)
+ ((Ewl_Engine_Evas_Software_Xcb *)engine)
typedef struct Ewl_Engine_Evas_Software_Xcb Ewl_Engine_Evas_Software_Xcb;
struct Ewl_Engine_Evas_Software_Xcb
{
- Ewl_Engine engine;
+ Ewl_Engine engine;
};
#endif
diff --git a/src/engines/evas_software_xcb/ewl_engine_evas_software_xcb.c b/src/engines/evas_software_xcb/ewl_engine_evas_software_xcb.c
index 062193c..c7e5de4 100644
--- a/src/engines/evas_software_xcb/ewl_engine_evas_software_xcb.c
+++ b/src/engines/evas_software_xcb/ewl_engine_evas_software_xcb.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Engine_Evas_Software_Xcb.h"
#include "ewl_private.h"
#include "ewl_debug.h"
@@ -9,10 +9,10 @@ static int ee_init(Ewl_Engine *engine);
static void ee_shutdown(Ewl_Engine *engine);
static void *canvas_funcs[EWL_ENGINE_CANVAS_MAX] =
- {
- ee_canvas_setup,
- NULL, NULL, NULL, NULL
- };
+ {
+ ee_canvas_setup,
+ NULL, NULL, NULL, NULL
+ };
static xcb_visualtype_t *
visualtype_get(xcb_connection_t *conn, xcb_screen_t *screen)
@@ -40,112 +40,112 @@ visualtype_get(xcb_connection_t *conn, xcb_screen_t *screen)
Ecore_DList *
ewl_engine_dependancies(void)
{
- Ecore_DList *d;
+ Ecore_DList *d;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- d = ecore_dlist_new();
- ecore_dlist_append(d, strdup("xcb"));
- ecore_dlist_append(d, strdup("evas"));
+ d = ecore_dlist_new();
+ ecore_dlist_append(d, strdup("xcb"));
+ ecore_dlist_append(d, strdup("evas"));
- DRETURN_PTR(d, DLEVEL_STABLE);
+ DRETURN_PTR(d, DLEVEL_STABLE);
}
Ewl_Engine *
ewl_engine_create(int *argc __UNUSED__, char ** argv __UNUSED__)
{
- Ewl_Engine_Evas_Software_Xcb *engine;
+ Ewl_Engine_Evas_Software_Xcb *engine;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- engine = NEW(Ewl_Engine_Evas_Software_Xcb, 1);
- if (!engine)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ engine = NEW(Ewl_Engine_Evas_Software_Xcb, 1);
+ if (!engine)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ee_init(EWL_ENGINE(engine)))
- {
- FREE(engine);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ee_init(EWL_ENGINE(engine)))
+ {
+ FREE(engine);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
}
static int
ee_init(Ewl_Engine *engine)
{
- Ewl_Engine_Info *info;
+ Ewl_Engine_Info *info;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(engine, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(engine, FALSE);
- info = NEW(Ewl_Engine_Info, 1);
- info->shutdown = ee_shutdown;
- info->hooks.canvas = canvas_funcs;
+ info = NEW(Ewl_Engine_Info, 1);
+ info->shutdown = ee_shutdown;
+ info->hooks.canvas = canvas_funcs;
- engine->functions = info;
+ engine->functions = info;
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static void
ee_shutdown(Ewl_Engine *engine)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(engine);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(engine);
- IF_FREE(engine->functions);
+ IF_FREE(engine->functions);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_canvas_setup(Ewl_Window *win, int debug)
{
- Evas *evas;
- Ewl_Object *o;
- Evas_Engine_Info *info = NULL;
- Evas_Engine_Info_Software_Xcb *sinfo;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
-
- o = EWL_OBJECT(win);
-
- evas = evas_new();
- evas_output_method_set(evas,
- evas_render_method_lookup("software_xcb"));
-
- info = evas_engine_info_get(evas);
- if (!info)
- {
- fprintf(stderr, "Unable to use software_xcb engine "
- "for rendering, ");
- exit(-1);
- }
-
- sinfo = (Evas_Engine_Info_Software_Xcb *)info;
-
- sinfo->info.conn = ecore_x_connection_get();
- sinfo->info.screen = ecore_x_default_screen_get();
- sinfo->info.visual = visualtype_get(sinfo->info.conn,
- sinfo->info.screen);
- sinfo->info.colormap = sinfo->info.screen->default_colormap;
- sinfo->info.drawable = (Ecore_X_Window)win->window;
- sinfo->info.depth = sinfo->info.screen->root_depth;
- sinfo->info.rotation = 0;
- sinfo->info.debug = debug;
-
- evas_engine_info_set(evas, info);
-
- evas_output_size_set(evas, ewl_object_current_w_get(o),
- ewl_object_current_h_get(o));
- evas_output_viewport_set(evas, ewl_object_current_x_get(o),
- ewl_object_current_y_get(o),
- ewl_object_current_w_get(o),
- ewl_object_current_h_get(o));
- ewl_embed_canvas_set(EWL_EMBED(win), evas, win->window);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Evas *evas;
+ Ewl_Object *o;
+ Evas_Engine_Info *info = NULL;
+ Evas_Engine_Info_Software_Xcb *sinfo;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+
+ o = EWL_OBJECT(win);
+
+ evas = evas_new();
+ evas_output_method_set(evas,
+ evas_render_method_lookup("software_xcb"));
+
+ info = evas_engine_info_get(evas);
+ if (!info)
+ {
+ fprintf(stderr, "Unable to use software_xcb engine "
+ "for rendering, ");
+ exit(-1);
+ }
+
+ sinfo = (Evas_Engine_Info_Software_Xcb *)info;
+
+ sinfo->info.conn = ecore_x_connection_get();
+ sinfo->info.screen = ecore_x_default_screen_get();
+ sinfo->info.visual = visualtype_get(sinfo->info.conn,
+ sinfo->info.screen);
+ sinfo->info.colormap = sinfo->info.screen->default_colormap;
+ sinfo->info.drawable = (Ecore_X_Window)win->window;
+ sinfo->info.depth = sinfo->info.screen->root_depth;
+ sinfo->info.rotation = 0;
+ sinfo->info.debug = debug;
+
+ evas_engine_info_set(evas, info);
+
+ evas_output_size_set(evas, ewl_object_current_w_get(o),
+ ewl_object_current_h_get(o));
+ evas_output_viewport_set(evas, ewl_object_current_x_get(o),
+ ewl_object_current_y_get(o),
+ ewl_object_current_w_get(o),
+ ewl_object_current_h_get(o));
+ ewl_embed_canvas_set(EWL_EMBED(win), evas, win->window);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/engines/evas_xrender_x11/Ewl_Engine_Evas_Xrender_X11.h b/src/engines/evas_xrender_x11/Ewl_Engine_Evas_Xrender_X11.h
index a6c34c6..649e0e0 100644
--- a/src/engines/evas_xrender_x11/Ewl_Engine_Evas_Xrender_X11.h
+++ b/src/engines/evas_xrender_x11/Ewl_Engine_Evas_Xrender_X11.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_ENGINE_EVAS_XRENDER_X11_H
#define EWL_ENGINE_EVAS_XRENDER_X11_H
@@ -8,12 +8,12 @@
#include <Evas_Engine_XRender_X11.h>
#define EWL_ENGINE_EVAS_XRENDER_X11(engine) \
- ((Ewl_Engine_Evas_Xrender_X11 *)engine)
+ ((Ewl_Engine_Evas_Xrender_X11 *)engine)
typedef struct Ewl_Engine_Evas_Xrender_X11 Ewl_Engine_Evas_Xrender_X11;
struct Ewl_Engine_Evas_Xrender_X11
{
- Ewl_Engine engine;
+ Ewl_Engine engine;
};
#endif
diff --git a/src/engines/evas_xrender_x11/ewl_engine_evas_xrender_x11.c b/src/engines/evas_xrender_x11/ewl_engine_evas_xrender_x11.c
index 5a59528..c987eb8 100644
--- a/src/engines/evas_xrender_x11/ewl_engine_evas_xrender_x11.c
+++ b/src/engines/evas_xrender_x11/ewl_engine_evas_xrender_x11.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Engine_Evas_Xrender_X11.h"
#include <Evas_Engine_XRender_X11.h>
#include "ewl_private.h"
@@ -10,117 +10,117 @@ static int ee_init(Ewl_Engine *engine);
static void ee_shutdown(Ewl_Engine *engine);
static void *canvas_funcs[EWL_ENGINE_CANVAS_MAX] =
- {
- ee_canvas_setup,
- NULL, NULL, NULL, NULL
- };
+ {
+ ee_canvas_setup,
+ NULL, NULL, NULL, NULL
+ };
Ecore_DList *
ewl_engine_dependancies(void)
{
- Ecore_DList *d;
+ Ecore_DList *d;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- d = ecore_dlist_new();
- ecore_dlist_append(d, strdup("x11"));
- ecore_dlist_append(d, strdup("evas"));
+ d = ecore_dlist_new();
+ ecore_dlist_append(d, strdup("x11"));
+ ecore_dlist_append(d, strdup("evas"));
- DRETURN_PTR(d, DLEVEL_STABLE);
+ DRETURN_PTR(d, DLEVEL_STABLE);
}
Ewl_Engine *
ewl_engine_create(int *argc __UNUSED__, char ** argv __UNUSED__)
{
- Ewl_Engine_Evas_Xrender_X11 *engine;
+ Ewl_Engine_Evas_Xrender_X11 *engine;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- engine = NEW(Ewl_Engine_Evas_Xrender_X11, 1);
- if (!engine)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ engine = NEW(Ewl_Engine_Evas_Xrender_X11, 1);
+ if (!engine)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ee_init(EWL_ENGINE(engine)))
- {
- FREE(engine);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ee_init(EWL_ENGINE(engine)))
+ {
+ FREE(engine);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
}
static int
ee_init(Ewl_Engine *engine)
{
- Ewl_Engine_Info *info;
+ Ewl_Engine_Info *info;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(engine, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(engine, FALSE);
- info = NEW(Ewl_Engine_Info, 1);
- info->shutdown = ee_shutdown;
- info->hooks.canvas = canvas_funcs;
+ info = NEW(Ewl_Engine_Info, 1);
+ info->shutdown = ee_shutdown;
+ info->hooks.canvas = canvas_funcs;
- engine->functions = info;
+ engine->functions = info;
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static void
ee_shutdown(Ewl_Engine *engine)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(engine);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(engine);
- IF_FREE(engine->functions);
+ IF_FREE(engine->functions);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_canvas_setup(Ewl_Window *win, int debug __UNUSED__)
{
- Evas *evas;
- Ewl_Object *o;
- Evas_Engine_Info *info = NULL;
- Evas_Engine_Info_XRender_X11 *sinfo;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
-
- o = EWL_OBJECT(win);
-
- evas = evas_new();
- evas_output_method_set(evas,
- evas_render_method_lookup("xrender_x11"));
-
- info = evas_engine_info_get(evas);
- if (!info)
- {
- fprintf(stderr, "Unable to use xrender_x11 engine "
- "for rendering, ");
- exit(-1);
- }
-
- sinfo = (Evas_Engine_Info_XRender_X11 *)info;
-
- sinfo->info.display = ecore_x_display_get();
- sinfo->info.visual = DefaultVisual(sinfo->info.display,
- DefaultScreen(sinfo->info.display));
- sinfo->info.drawable = (Ecore_X_Window)win->window;
-
- evas_engine_info_set(evas, info);
-
- evas_output_size_set(evas, ewl_object_current_w_get(o),
- ewl_object_current_h_get(o));
- evas_output_viewport_set(evas, ewl_object_current_x_get(o),
- ewl_object_current_y_get(o),
- ewl_object_current_w_get(o),
- ewl_object_current_h_get(o));
- ewl_embed_canvas_set(EWL_EMBED(win), evas, win->window);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Evas *evas;
+ Ewl_Object *o;
+ Evas_Engine_Info *info = NULL;
+ Evas_Engine_Info_XRender_X11 *sinfo;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+
+ o = EWL_OBJECT(win);
+
+ evas = evas_new();
+ evas_output_method_set(evas,
+ evas_render_method_lookup("xrender_x11"));
+
+ info = evas_engine_info_get(evas);
+ if (!info)
+ {
+ fprintf(stderr, "Unable to use xrender_x11 engine "
+ "for rendering, ");
+ exit(-1);
+ }
+
+ sinfo = (Evas_Engine_Info_XRender_X11 *)info;
+
+ sinfo->info.display = ecore_x_display_get();
+ sinfo->info.visual = DefaultVisual(sinfo->info.display,
+ DefaultScreen(sinfo->info.display));
+ sinfo->info.drawable = (Ecore_X_Window)win->window;
+
+ evas_engine_info_set(evas, info);
+
+ evas_output_size_set(evas, ewl_object_current_w_get(o),
+ ewl_object_current_h_get(o));
+ evas_output_viewport_set(evas, ewl_object_current_x_get(o),
+ ewl_object_current_y_get(o),
+ ewl_object_current_w_get(o),
+ ewl_object_current_h_get(o));
+ ewl_embed_canvas_set(EWL_EMBED(win), evas, win->window);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/engines/win32/Ewl_Engine_Win32.h b/src/engines/win32/Ewl_Engine_Win32.h
index d363d2b..585ec34 100644
--- a/src/engines/win32/Ewl_Engine_Win32.h
+++ b/src/engines/win32/Ewl_Engine_Win32.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef __EWL_ENGINE_WIN32_H__
#define __EWL_ENGINE_WIN32_H__
@@ -9,7 +9,7 @@
typedef struct Ewl_Engine_Win32 Ewl_Engine_Win32;
struct Ewl_Engine_Win32
{
- Ewl_Engine engine;
+ Ewl_Engine engine;
};
#endif /* __EWL_ENGINE_X11_H__ */
diff --git a/src/engines/win32/ewl_engine_win32.c b/src/engines/win32/ewl_engine_win32.c
index 531fa06..75278e6 100644
--- a/src/engines/win32/ewl_engine_win32.c
+++ b/src/engines/win32/ewl_engine_win32.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include <Ewl_Engine_Win32.h>
#include "ewl_private.h"
#include "ewl_macros.h"
@@ -53,8 +53,8 @@ static void ee_window_dialog_set(Ewl_Window *win);
static void ee_window_states_set(Ewl_Window *win);
static void ee_window_state_request(Ewl_Window *win, int states);
static void ee_window_state_handle(Ewl_Window *win, int states,
- Ewl_Window_Flags ewl_flag,
- Ecore_Win32_Window_State ecore_flag);
+ Ewl_Window_Flags ewl_flag,
+ Ecore_Win32_Window_State ecore_flag);
static void ee_window_states_set_helper(Ewl_Window *win);
static void ee_window_hints_set(Ewl_Window *win);
static void ee_window_transient_for(Ewl_Window *win);
@@ -70,696 +70,696 @@ static void ee_pointer_set(Ewl_Embed *embed, int pointer);
static int ee_pointer_get(Ewl_Embed *embed);
static void *window_funcs[EWL_ENGINE_WINDOW_MAX] =
- {
- ee_window_new,
- ee_window_destroy,
- ee_window_move,
- ee_window_resize,
- ee_window_min_max_size_set,
- ee_window_show,
- ee_window_hide,
- ee_window_title_set,
- NULL,
- ee_window_borderless_set,
- ee_window_dialog_set,
- ee_window_states_set,
- ee_window_hints_set,
- ee_window_transient_for,
- ee_window_leader_set,
- ee_window_raise,
- ee_window_lower,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- ee_window_geometry_set,
- NULL,
- ee_desktop_size_get,
- NULL,
- NULL,
- NULL,
- NULL,
- };
+ {
+ ee_window_new,
+ ee_window_destroy,
+ ee_window_move,
+ ee_window_resize,
+ ee_window_min_max_size_set,
+ ee_window_show,
+ ee_window_hide,
+ ee_window_title_set,
+ NULL,
+ ee_window_borderless_set,
+ ee_window_dialog_set,
+ ee_window_states_set,
+ ee_window_hints_set,
+ ee_window_transient_for,
+ ee_window_leader_set,
+ ee_window_raise,
+ ee_window_lower,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ ee_window_geometry_set,
+ NULL,
+ ee_desktop_size_get,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ };
static void *pointer_funcs[EWL_ENGINE_POINTER_MAX] =
- {
- ee_pointer_data_new,
- ee_pointer_free,
- ee_pointer_get,
- ee_pointer_set,
- };
+ {
+ ee_pointer_data_new,
+ ee_pointer_free,
+ ee_pointer_get,
+ ee_pointer_set,
+ };
Ecore_DList *
ewl_engine_dependancies(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
}
Ewl_Engine *
ewl_engine_create(int *argc, char ** argv)
{
- Ewl_Engine_Win32 *engine;
+ Ewl_Engine_Win32 *engine;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- engine = NEW(Ewl_Engine_Win32, 1);
- if (!engine)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ engine = NEW(Ewl_Engine_Win32, 1);
+ if (!engine)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ee_init(EWL_ENGINE(engine), argc, argv))
- {
- FREE(engine);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ee_init(EWL_ENGINE(engine), argc, argv))
+ {
+ FREE(engine);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
}
static int
ee_init(Ewl_Engine *engine, int *argc, char ** argv)
{
- Ewl_Engine_Info *info;
+ Ewl_Engine_Info *info;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(engine, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(engine, FALSE);
printf (" **** ee_init\n");
- /* If the event handlers are already setup don't do it again */
- if (ee_expose_handler)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ /* If the event handlers are already setup don't do it again */
+ if (ee_expose_handler)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
printf (" **** ee_init : ecore_win32_init\n");
- if (!ecore_win32_init())
- {
- fprintf(stderr, "Unable to initialize Ecore Win32.\n"
- "Is your DISPLAY variable set correctly?\n\n");
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
+ if (!ecore_win32_init())
+ {
+ fprintf(stderr, "Unable to initialize Ecore Win32.\n"
+ "Is your DISPLAY variable set correctly?\n\n");
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
printf (" **** ee_init : events : damage, configure, delete\n");
- ee_expose_handler = ecore_event_handler_add(
- ECORE_WIN32_EVENT_WINDOW_DAMAGE,
- ewl_ev_win32_window_expose, NULL);
- ee_configure_handler = ecore_event_handler_add(
- ECORE_WIN32_EVENT_WINDOW_CONFIGURE,
- ewl_ev_win32_window_configure, NULL);
- ee_delete_request_handler = ecore_event_handler_add(
- ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST,
- ewl_ev_win32_window_delete, NULL);
-
- /*
- * Register dispatching functions for keyboard events.
- */
- ee_key_down_handler = ecore_event_handler_add(
- ECORE_WIN32_EVENT_KEY_DOWN,
- ewl_ev_win32_key_down, NULL);
- ee_key_up_handler = ecore_event_handler_add(
- ECORE_WIN32_EVENT_KEY_UP,
- ewl_ev_win32_key_up, NULL);
-
- /*
- * Register dispatching functions for DND events
- */
- /*
- ee_dnd_position_handler = ecore_event_handler_add(
- ECORE_WIN32_EVENT_XDND_POSITION,
- ewl_ev_dnd_position, NULL);
- ee_dnd_enter_handler = ecore_event_handler_add(
- ECORE_WIN32_EVENT_XDND_ENTER,
- ewl_ev_dnd_enter, NULL);
- ee_dnd_leave_handler = ecore_event_handler_add(
- ECORE_WIN32_EVENT_XDND_LEAVE,
- ewl_ev_dnd_leave, NULL);
- ee_dnd_drop_handler = ecore_event_handler_add(
- ECORE_WIN32_EVENT_XDND_DROP,
- ewl_ev_dnd_drop, NULL);
- */
-
- /*
- * Selection callbacks to allow for data transfers.
- */
- /*
- ee_selection_notify_handler = ecore_event_handler_add(
- ECORE_WIN32_EVENT_SELECTION_NOTIFY,
- ewl_ev_win32_data_received, NULL);
- */
-
- /*
- * Selection callbacks to allow for pasting.
- */
- /*
- ee_selection_request_handler = ecore_event_handler_add(
- ECORE_WIN32_EVENT_SELECTION_REQUEST,
- ewl_ev_win32_data_request, NULL);
- */
-
- /*
- * Finally, register dispatching functions for mouse events.
- */
- ee_mouse_down_handler = ecore_event_handler_add(
- ECORE_WIN32_EVENT_MOUSE_BUTTON_DOWN,
- ewl_ev_win32_mouse_down, NULL);
- ee_mouse_up_handler = ecore_event_handler_add(
- ECORE_WIN32_EVENT_MOUSE_BUTTON_UP,
- ewl_ev_win32_mouse_up, NULL);
- ee_mouse_move_handler = ecore_event_handler_add(
- ECORE_WIN32_EVENT_MOUSE_MOVE,
- ewl_ev_win32_mouse_move, NULL);
- ee_mouse_wheel_handler = ecore_event_handler_add(
- ECORE_WIN32_EVENT_MOUSE_WHEEL,
- ewl_ev_win32_mouse_wheel, NULL);
- ee_mouse_out_handler = ecore_event_handler_add(
- ECORE_WIN32_EVENT_MOUSE_OUT,
- ewl_ev_win32_mouse_out, NULL);
- ee_focus_in_handler = ecore_event_handler_add(
- ECORE_WIN32_EVENT_WINDOW_FOCUS_IN,
- ewl_ev_win32_focus_in, NULL);
- ee_focus_out_handler = ecore_event_handler_add(
- ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT,
- ewl_ev_win32_focus_out, NULL);
-
- if (!ee_expose_handler || !ee_configure_handler
- || !ee_delete_request_handler
- || !ee_key_down_handler || !ee_key_up_handler
- || !ee_mouse_down_handler
- || !ee_mouse_up_handler || !ee_mouse_move_handler
- || !ee_mouse_wheel_handler || !ee_mouse_out_handler
- || !ee_focus_in_handler || !ee_focus_out_handler)
- {
- ee_shutdown(EWL_ENGINE(engine));
-
- fprintf(stderr, "Unable to create Ecore Win32 event handlers.\n");
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
-
- info = NEW(Ewl_Engine_Info, 1);
- info->shutdown = ee_shutdown;
- info->hooks.window = window_funcs;
- info->hooks.pointer = pointer_funcs;
-
- engine->functions = info;
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ ee_expose_handler = ecore_event_handler_add(
+ ECORE_WIN32_EVENT_WINDOW_DAMAGE,
+ ewl_ev_win32_window_expose, NULL);
+ ee_configure_handler = ecore_event_handler_add(
+ ECORE_WIN32_EVENT_WINDOW_CONFIGURE,
+ ewl_ev_win32_window_configure, NULL);
+ ee_delete_request_handler = ecore_event_handler_add(
+ ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST,
+ ewl_ev_win32_window_delete, NULL);
+
+ /*
+ * Register dispatching functions for keyboard events.
+ */
+ ee_key_down_handler = ecore_event_handler_add(
+ ECORE_WIN32_EVENT_KEY_DOWN,
+ ewl_ev_win32_key_down, NULL);
+ ee_key_up_handler = ecore_event_handler_add(
+ ECORE_WIN32_EVENT_KEY_UP,
+ ewl_ev_win32_key_up, NULL);
+
+ /*
+ * Register dispatching functions for DND events
+ */
+ /*
+ ee_dnd_position_handler = ecore_event_handler_add(
+ ECORE_WIN32_EVENT_XDND_POSITION,
+ ewl_ev_dnd_position, NULL);
+ ee_dnd_enter_handler = ecore_event_handler_add(
+ ECORE_WIN32_EVENT_XDND_ENTER,
+ ewl_ev_dnd_enter, NULL);
+ ee_dnd_leave_handler = ecore_event_handler_add(
+ ECORE_WIN32_EVENT_XDND_LEAVE,
+ ewl_ev_dnd_leave, NULL);
+ ee_dnd_drop_handler = ecore_event_handler_add(
+ ECORE_WIN32_EVENT_XDND_DROP,
+ ewl_ev_dnd_drop, NULL);
+ */
+
+ /*
+ * Selection callbacks to allow for data transfers.
+ */
+ /*
+ ee_selection_notify_handler = ecore_event_handler_add(
+ ECORE_WIN32_EVENT_SELECTION_NOTIFY,
+ ewl_ev_win32_data_received, NULL);
+ */
+
+ /*
+ * Selection callbacks to allow for pasting.
+ */
+ /*
+ ee_selection_request_handler = ecore_event_handler_add(
+ ECORE_WIN32_EVENT_SELECTION_REQUEST,
+ ewl_ev_win32_data_request, NULL);
+ */
+
+ /*
+ * Finally, register dispatching functions for mouse events.
+ */
+ ee_mouse_down_handler = ecore_event_handler_add(
+ ECORE_WIN32_EVENT_MOUSE_BUTTON_DOWN,
+ ewl_ev_win32_mouse_down, NULL);
+ ee_mouse_up_handler = ecore_event_handler_add(
+ ECORE_WIN32_EVENT_MOUSE_BUTTON_UP,
+ ewl_ev_win32_mouse_up, NULL);
+ ee_mouse_move_handler = ecore_event_handler_add(
+ ECORE_WIN32_EVENT_MOUSE_MOVE,
+ ewl_ev_win32_mouse_move, NULL);
+ ee_mouse_wheel_handler = ecore_event_handler_add(
+ ECORE_WIN32_EVENT_MOUSE_WHEEL,
+ ewl_ev_win32_mouse_wheel, NULL);
+ ee_mouse_out_handler = ecore_event_handler_add(
+ ECORE_WIN32_EVENT_MOUSE_OUT,
+ ewl_ev_win32_mouse_out, NULL);
+ ee_focus_in_handler = ecore_event_handler_add(
+ ECORE_WIN32_EVENT_WINDOW_FOCUS_IN,
+ ewl_ev_win32_focus_in, NULL);
+ ee_focus_out_handler = ecore_event_handler_add(
+ ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT,
+ ewl_ev_win32_focus_out, NULL);
+
+ if (!ee_expose_handler || !ee_configure_handler
+ || !ee_delete_request_handler
+ || !ee_key_down_handler || !ee_key_up_handler
+ || !ee_mouse_down_handler
+ || !ee_mouse_up_handler || !ee_mouse_move_handler
+ || !ee_mouse_wheel_handler || !ee_mouse_out_handler
+ || !ee_focus_in_handler || !ee_focus_out_handler)
+ {
+ ee_shutdown(EWL_ENGINE(engine));
+
+ fprintf(stderr, "Unable to create Ecore Win32 event handlers.\n");
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+
+ info = NEW(Ewl_Engine_Info, 1);
+ info->shutdown = ee_shutdown;
+ info->hooks.window = window_funcs;
+ info->hooks.pointer = pointer_funcs;
+
+ engine->functions = info;
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static void
ee_shutdown(Ewl_Engine *engine)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(engine);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(engine);
printf (" **** ee_shutdown\n");
- if (ee_expose_handler)
- ecore_event_handler_del(ee_expose_handler);
- ee_expose_handler = NULL;
+ if (ee_expose_handler)
+ ecore_event_handler_del(ee_expose_handler);
+ ee_expose_handler = NULL;
- if (ee_configure_handler)
- ecore_event_handler_del(ee_configure_handler);
- ee_configure_handler = NULL;
+ if (ee_configure_handler)
+ ecore_event_handler_del(ee_configure_handler);
+ ee_configure_handler = NULL;
- if (ee_delete_request_handler)
- ecore_event_handler_del(ee_delete_request_handler);
- ee_delete_request_handler = NULL;
+ if (ee_delete_request_handler)
+ ecore_event_handler_del(ee_delete_request_handler);
+ ee_delete_request_handler = NULL;
- if (ee_key_down_handler)
- ecore_event_handler_del(ee_key_down_handler);
- ee_key_down_handler = NULL;
+ if (ee_key_down_handler)
+ ecore_event_handler_del(ee_key_down_handler);
+ ee_key_down_handler = NULL;
- if (ee_key_up_handler)
- ecore_event_handler_del(ee_key_up_handler);
- ee_key_up_handler = NULL;
+ if (ee_key_up_handler)
+ ecore_event_handler_del(ee_key_up_handler);
+ ee_key_up_handler = NULL;
- /*
- if (ee_dnd_position_handler)
- ecore_event_handler_del(ee_dnd_position_handler);
- ee_dnd_position_handler = NULL;
+ /*
+ if (ee_dnd_position_handler)
+ ecore_event_handler_del(ee_dnd_position_handler);
+ ee_dnd_position_handler = NULL;
- if (ee_dnd_enter_handler)
- ecore_event_handler_del(ee_dnd_enter_handler);
- ee_dnd_enter_handler = NULL;
+ if (ee_dnd_enter_handler)
+ ecore_event_handler_del(ee_dnd_enter_handler);
+ ee_dnd_enter_handler = NULL;
- if (ee_dnd_leave_handler)
- ecore_event_handler_del(ee_dnd_leave_handler);
- ee_dnd_leave_handler = NULL;
+ if (ee_dnd_leave_handler)
+ ecore_event_handler_del(ee_dnd_leave_handler);
+ ee_dnd_leave_handler = NULL;
- if (ee_dnd_drop_handler)
- ecore_event_handler_del(ee_dnd_drop_handler);
- ee_dnd_drop_handler = NULL;
+ if (ee_dnd_drop_handler)
+ ecore_event_handler_del(ee_dnd_drop_handler);
+ ee_dnd_drop_handler = NULL;
- if (ee_selection_notify_handler)
- ecore_event_handler_del(ee_selection_notify_handler);
- ee_selection_notify_handler = NULL;
+ if (ee_selection_notify_handler)
+ ecore_event_handler_del(ee_selection_notify_handler);
+ ee_selection_notify_handler = NULL;
- if (ee_selection_request_handler)
- ecore_event_handler_del(ee_selection_request_handler);
- ee_selection_request_handler = NULL;
- */
+ if (ee_selection_request_handler)
+ ecore_event_handler_del(ee_selection_request_handler);
+ ee_selection_request_handler = NULL;
+ */
- if (ee_mouse_down_handler)
- ecore_event_handler_del(ee_mouse_down_handler);
- ee_mouse_down_handler = NULL;
+ if (ee_mouse_down_handler)
+ ecore_event_handler_del(ee_mouse_down_handler);
+ ee_mouse_down_handler = NULL;
- if (ee_mouse_up_handler)
- ecore_event_handler_del(ee_mouse_up_handler);
- ee_mouse_up_handler = NULL;
+ if (ee_mouse_up_handler)
+ ecore_event_handler_del(ee_mouse_up_handler);
+ ee_mouse_up_handler = NULL;
- if (ee_mouse_move_handler)
- ecore_event_handler_del(ee_mouse_move_handler);
- ee_mouse_move_handler = NULL;
+ if (ee_mouse_move_handler)
+ ecore_event_handler_del(ee_mouse_move_handler);
+ ee_mouse_move_handler = NULL;
- if (ee_mouse_wheel_handler)
- ecore_event_handler_del(ee_mouse_wheel_handler);
- ee_mouse_wheel_handler = NULL;
+ if (ee_mouse_wheel_handler)
+ ecore_event_handler_del(ee_mouse_wheel_handler);
+ ee_mouse_wheel_handler = NULL;
- if (ee_mouse_out_handler)
- ecore_event_handler_del(ee_mouse_out_handler);
- ee_mouse_out_handler = NULL;
+ if (ee_mouse_out_handler)
+ ecore_event_handler_del(ee_mouse_out_handler);
+ ee_mouse_out_handler = NULL;
- if (ee_focus_in_handler)
- ecore_event_handler_del(ee_focus_in_handler);
- ee_focus_in_handler = NULL;
+ if (ee_focus_in_handler)
+ ecore_event_handler_del(ee_focus_in_handler);
+ ee_focus_in_handler = NULL;
- if (ee_focus_out_handler)
- ecore_event_handler_del(ee_focus_out_handler);
- ee_focus_out_handler = NULL;
+ if (ee_focus_out_handler)
+ ecore_event_handler_del(ee_focus_out_handler);
+ ee_focus_out_handler = NULL;
- ecore_win32_shutdown();
+ ecore_win32_shutdown();
- IF_FREE(engine->functions);
+ IF_FREE(engine->functions);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_new(Ewl_Window *win)
{
- Ecore_Win32_Window *xwin;
+ Ecore_Win32_Window *xwin;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
printf (" **** ee_window_new : %d %d\n",
ewl_object_current_w_get(EWL_OBJECT(win)),
ewl_object_current_h_get(EWL_OBJECT(win)));
- if (win->flags & EWL_WINDOW_OVERRIDE)
- xwin = ecore_win32_window_override_new(0,
- EWL_EMBED(win)->x, EWL_EMBED(win)->y,
- ewl_object_current_w_get(EWL_OBJECT(win)),
- ewl_object_current_h_get(EWL_OBJECT(win)));
- else
- xwin = ecore_win32_window_new(0,
- EWL_EMBED(win)->x, EWL_EMBED(win)->y,
- ewl_object_current_w_get(EWL_OBJECT(win)),
- ewl_object_current_h_get(EWL_OBJECT(win)));
- win->window = (void *)xwin;
+ if (win->flags & EWL_WINDOW_OVERRIDE)
+ xwin = ecore_win32_window_override_new(0,
+ EWL_EMBED(win)->x, EWL_EMBED(win)->y,
+ ewl_object_current_w_get(EWL_OBJECT(win)),
+ ewl_object_current_h_get(EWL_OBJECT(win)));
+ else
+ xwin = ecore_win32_window_new(0,
+ EWL_EMBED(win)->x, EWL_EMBED(win)->y,
+ ewl_object_current_w_get(EWL_OBJECT(win)),
+ ewl_object_current_h_get(EWL_OBJECT(win)));
+ win->window = (void *)xwin;
printf ("flags : %d %d\n", win->flags & EWL_WINDOW_OVERRIDE, win->flags & EWL_WINDOW_BORDERLESS);
- if (win->flags & EWL_WINDOW_BORDERLESS)
- ee_window_borderless_set(win);
+ if (win->flags & EWL_WINDOW_BORDERLESS)
+ ee_window_borderless_set(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_destroy(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ee_window_hide(win);
- ecore_win32_window_del((EWL_EMBED(win)->canvas_window));
- ecore_win32_window_del((win->window));
+ ee_window_hide(win);
+ ecore_win32_window_del((EWL_EMBED(win)->canvas_window));
+ ecore_win32_window_del((win->window));
- EWL_EMBED(win)->canvas_window = NULL;
- win->window = NULL;
+ EWL_EMBED(win)->canvas_window = NULL;
+ win->window = NULL;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_move(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_win32_window_move(win->window,
- EWL_EMBED(win)->x,
- EWL_EMBED(win)->y);
+ ecore_win32_window_move(win->window,
+ EWL_EMBED(win)->x,
+ EWL_EMBED(win)->y);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_resize(Ewl_Window *win)
{
- int width, height;
+ int width, height;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- width = ewl_object_current_w_get(EWL_OBJECT(win));
- height = ewl_object_current_h_get(EWL_OBJECT(win));
+ width = ewl_object_current_w_get(EWL_OBJECT(win));
+ height = ewl_object_current_h_get(EWL_OBJECT(win));
printf ("ee_window_resize : %d %d\n", width, height);
- ecore_win32_window_resize(win->window, width, height);
+ ecore_win32_window_resize(win->window, width, height);
- if (EWL_EMBED(win)->canvas_window != win->window)
- ecore_win32_window_resize(EWL_EMBED(win)->canvas_window,
- width, height);
+ if (EWL_EMBED(win)->canvas_window != win->window)
+ ecore_win32_window_resize(EWL_EMBED(win)->canvas_window,
+ width, height);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_min_max_size_set(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
printf ("ee_window_min_max_size_set %p\n", win->window);
- ecore_win32_window_size_min_set(win->window,
- ewl_object_minimum_w_get(EWL_OBJECT(win)),
- ewl_object_minimum_h_get(EWL_OBJECT(win)));
- ecore_win32_window_size_max_set(win->window,
- ewl_object_maximum_w_get(EWL_OBJECT(win)),
- ewl_object_maximum_h_get(EWL_OBJECT(win)));
- ecore_win32_window_size_base_set(win->window, 0, 0);
- ecore_win32_window_size_step_set(win->window, 0, 0);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ ecore_win32_window_size_min_set(win->window,
+ ewl_object_minimum_w_get(EWL_OBJECT(win)),
+ ewl_object_minimum_h_get(EWL_OBJECT(win)));
+ ecore_win32_window_size_max_set(win->window,
+ ewl_object_maximum_w_get(EWL_OBJECT(win)),
+ ewl_object_maximum_h_get(EWL_OBJECT(win)));
+ ecore_win32_window_size_base_set(win->window, 0, 0);
+ ecore_win32_window_size_step_set(win->window, 0, 0);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_show(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
printf ("ee_window_show\n");
- ecore_win32_window_show(win->window);
- ecore_win32_window_show(EWL_EMBED(win)->canvas_window);
+ ecore_win32_window_show(win->window);
+ ecore_win32_window_show(EWL_EMBED(win)->canvas_window);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_hide(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_win32_window_hide(EWL_EMBED(win)->canvas_window);
- ecore_win32_window_hide(EWL_WINDOW(win)->window);
+ ecore_win32_window_hide(EWL_EMBED(win)->canvas_window);
+ ecore_win32_window_hide(EWL_WINDOW(win)->window);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_title_set(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_win32_window_title_set(win->window, win->title);
+ ecore_win32_window_title_set(win->window, win->title);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_borderless_set(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_win32_window_borderless_set(win->window,
- (!!(win->flags & EWL_WINDOW_BORDERLESS)));
+ ecore_win32_window_borderless_set(win->window,
+ (!!(win->flags & EWL_WINDOW_BORDERLESS)));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_dialog_set(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_win32_window_type_set(win->window,
- ((!!(win->flags & EWL_WINDOW_DIALOG)) ?
- ECORE_WIN32_WINDOW_TYPE_DIALOG :
- ECORE_WIN32_WINDOW_TYPE_NORMAL));
+ ecore_win32_window_type_set(win->window,
+ ((!!(win->flags & EWL_WINDOW_DIALOG)) ?
+ ECORE_WIN32_WINDOW_TYPE_DIALOG :
+ ECORE_WIN32_WINDOW_TYPE_NORMAL));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_states_set(Ewl_Window *win)
{
- int diff;
+ int diff;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- diff = win->flags ^ win->old_flags;
- if (!diff) DRETURN(DLEVEL_STABLE);
+ diff = win->flags ^ win->old_flags;
+ if (!diff) DRETURN(DLEVEL_STABLE);
- if (REALIZED(win))
- ee_window_state_request(win, diff);
- else
- ee_window_states_set_helper(win);
+ if (REALIZED(win))
+ ee_window_state_request(win, diff);
+ else
+ ee_window_states_set_helper(win);
- win->old_flags = win->flags;
+ win->old_flags = win->flags;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_state_handle(Ewl_Window *win, int states,
- Ewl_Window_Flags ewl_flag,
- Ecore_Win32_Window_State ecore_flag)
+ Ewl_Window_Flags ewl_flag,
+ Ecore_Win32_Window_State ecore_flag)
{
- int state = 0;
+ int state = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (states & ewl_flag)
- {
- state = (!!(win->flags & ewl_flag));
- ecore_win32_window_state_request_send(win->window,
- ecore_flag, state);
- }
+ if (states & ewl_flag)
+ {
+ state = (!!(win->flags & ewl_flag));
+ ecore_win32_window_state_request_send(win->window,
+ ecore_flag, state);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_state_request(Ewl_Window *win, int states)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ee_window_state_handle(win, states, EWL_WINDOW_FULLSCREEN,
- ECORE_WIN32_WINDOW_STATE_FULLSCREEN);
- ee_window_state_handle(win, states, EWL_WINDOW_MODAL,
- ECORE_WIN32_WINDOW_STATE_MODAL);
- ee_window_state_handle(win, states, EWL_WINDOW_DEMANDS_ATTENTION,
- ECORE_WIN32_WINDOW_STATE_DEMANDS_ATTENTION);
+ ee_window_state_handle(win, states, EWL_WINDOW_FULLSCREEN,
+ ECORE_WIN32_WINDOW_STATE_FULLSCREEN);
+ ee_window_state_handle(win, states, EWL_WINDOW_MODAL,
+ ECORE_WIN32_WINDOW_STATE_MODAL);
+ ee_window_state_handle(win, states, EWL_WINDOW_DEMANDS_ATTENTION,
+ ECORE_WIN32_WINDOW_STATE_DEMANDS_ATTENTION);
- win->flags &= ~EWL_WINDOW_DEMANDS_ATTENTION;
+ win->flags &= ~EWL_WINDOW_DEMANDS_ATTENTION;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_states_set_helper(Ewl_Window *win)
{
- Ecore_Win32_Window_State states[2];
- int count = 0;
+ Ecore_Win32_Window_State states[2];
+ int count = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- /* Note: We're ignoring the attention demand state in here as it is
- * only relevant if the window has been realized */
+ /* Note: We're ignoring the attention demand state in here as it is
+ * only relevant if the window has been realized */
- if (!win->window)
- DRETURN(DLEVEL_STABLE);
+ if (!win->window)
+ DRETURN(DLEVEL_STABLE);
- if (!!(win->flags & EWL_WINDOW_FULLSCREEN))
- states[count++] = ECORE_WIN32_WINDOW_STATE_FULLSCREEN;
+ if (!!(win->flags & EWL_WINDOW_FULLSCREEN))
+ states[count++] = ECORE_WIN32_WINDOW_STATE_FULLSCREEN;
- if (!!(win->flags & EWL_WINDOW_MODAL))
- states[count++] = ECORE_WIN32_WINDOW_STATE_MODAL;
+ if (!!(win->flags & EWL_WINDOW_MODAL))
+ states[count++] = ECORE_WIN32_WINDOW_STATE_MODAL;
- ecore_win32_window_state_set(win->window, states, count);
+ ecore_win32_window_state_set(win->window, states, count);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_hints_set(Ewl_Window *win)
{
- Ewl_Embed_Window *win_group;
- int urgent = FALSE;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
-
-/* if (win->flags & EWL_WINDOW_LEADER) */
-/* win_group = win->leader.ewl->window; */
-/* else if (win->flags & EWL_WINDOW_LEADER_FOREIGN) */
-/* win_group = win->leader.foreign; */
-/* else */
-/* win_group = NULL; */
-
-/* if (win->flags & EWL_WINDOW_URGENT) */
-/* urgent = TRUE; */
-
-/* ecore_x_icccm_hints_set( win->window, */
-/* 1, // accepts focus */
-/* 0, // initial states */
-/* 0, // icon pixmap */
-/* 0, // icon mask */
-/* 0, // icon window */
-/* win_group, // window group */
-/* urgent); // is urgent */
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Embed_Window *win_group;
+ int urgent = FALSE;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+
+/* if (win->flags & EWL_WINDOW_LEADER) */
+/* win_group = win->leader.ewl->window; */
+/* else if (win->flags & EWL_WINDOW_LEADER_FOREIGN) */
+/* win_group = win->leader.foreign; */
+/* else */
+/* win_group = NULL; */
+
+/* if (win->flags & EWL_WINDOW_URGENT) */
+/* urgent = TRUE; */
+
+/* ecore_x_icccm_hints_set( win->window, */
+/* 1, // accepts focus */
+/* 0, // initial states */
+/* 0, // icon pixmap */
+/* 0, // icon mask */
+/* 0, // icon window */
+/* win_group, // window group */
+/* urgent); // is urgent */
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_transient_for(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
-
-/* if (win->flags & EWL_WINDOW_TRANSIENT) */
-/* ecore_x_icccm_transient_for_set(win->window, */
-/* win->transient.ewl->window); */
-/* else if (win->flags & EWL_WINDOW_TRANSIENT_FOREIGN) */
-/* ecore_x_icccm_transient_for_set(win->window, */
-/* win->transient.foreign); */
-/* else */
-/* ecore_x_icccm_transient_for_unset(win->window); */
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+
+/* if (win->flags & EWL_WINDOW_TRANSIENT) */
+/* ecore_x_icccm_transient_for_set(win->window, */
+/* win->transient.ewl->window); */
+/* else if (win->flags & EWL_WINDOW_TRANSIENT_FOREIGN) */
+/* ecore_x_icccm_transient_for_set(win->window, */
+/* win->transient.foreign); */
+/* else */
+/* ecore_x_icccm_transient_for_unset(win->window); */
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_leader_set(Ewl_Window *win)
{
-/* Ewl_Embed_Window *leader; */
+/* Ewl_Embed_Window *leader; */
-/* DENTER_FUNCTION(DLEVEL_STABLE); */
-/* DCHECK_PARAM_PTR(win); */
-/* DCHECK_TYPE(win, EWL_WINDOW_TYPE); */
+/* DENTER_FUNCTION(DLEVEL_STABLE); */
+/* DCHECK_PARAM_PTR(win); */
+/* DCHECK_TYPE(win, EWL_WINDOW_TYPE); */
-/* if (win->flags & EWL_WINDOW_LEADER) */
-/* leader = win->leader.ewl->window; */
-/* else if (win->flags & EWL_WINDOW_LEADER_FOREIGN) */
-/* leader = win->leader.foreign; */
-/* else */
-/* /\* according to the icccm specs a client leader */
-/* * sets itself to the leader *\/ */
-/* leader = win->window; */
+/* if (win->flags & EWL_WINDOW_LEADER) */
+/* leader = win->leader.ewl->window; */
+/* else if (win->flags & EWL_WINDOW_LEADER_FOREIGN) */
+/* leader = win->leader.foreign; */
+/* else */
+/* /\* according to the icccm specs a client leader */
+/* * sets itself to the leader *\/ */
+/* leader = win->window; */
-/* ecore_x_icccm_client_leader_set(win->window, */
-/* leader); */
+/* ecore_x_icccm_client_leader_set(win->window, */
+/* leader); */
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_raise(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_win32_window_raise(win->window);
+ ecore_win32_window_raise(win->window);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_lower(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_win32_window_lower(win->window);
+ ecore_win32_window_lower(win->window);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_geometry_set(Ewl_Window *win, int *width, int *height)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
printf ("ee_window_geometry_set\n");
- ecore_win32_window_size_get((win ? win->window : NULL),
- width, height);
+ ecore_win32_window_size_get((win ? win->window : NULL),
+ width, height);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_desktop_size_get(Ewl_Embed *embed, int *w, int *h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
printf ("ee_desktop_size_get\n");
- ecore_win32_window_size_get(NULL, w, h);
+ ecore_win32_window_size_get(NULL, w, h);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static int
ee_pointer_data_new(Ewl_Embed *embed, int *data, int w, int h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(embed, 0);
- DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(embed, 0);
+ DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, 0);
- DRETURN_INT((int)ecore_win32_cursor_new(embed->canvas_window,
- data, w, h, 0, 0), DLEVEL_STABLE);
+ DRETURN_INT((int)ecore_win32_cursor_new(embed->canvas_window,
+ data, w, h, 0, 0), DLEVEL_STABLE);
}
static void
ee_pointer_free(Ewl_Embed *embed, int pointer)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- ecore_win32_cursor_free((void *)pointer);
+ ecore_win32_cursor_free((void *)pointer);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/*
@@ -769,22 +769,22 @@ ee_pointer_free(Ewl_Embed *embed, int pointer)
static int
ee_pointer_get(Ewl_Embed *embed)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(embed, 0);
- DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(embed, 0);
+ DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, 0);
- DRETURN_INT(ecore_win32_cursor_size_get(), DLEVEL_STABLE);
+ DRETURN_INT(ecore_win32_cursor_size_get(), DLEVEL_STABLE);
}
static void
ee_pointer_set(Ewl_Embed *embed, int pointer)
{
- Ecore_Win32_Cursor *cursor;
- Ecore_Win32_Cursor_Shape shape;
+ Ecore_Win32_Cursor *cursor;
+ Ecore_Win32_Cursor_Shape shape;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
switch (pointer)
{
@@ -842,363 +842,363 @@ ee_pointer_set(Ewl_Embed *embed, int pointer)
shape = ECORE_WIN32_CURSOR_SHAPE_ARROW;
break;
}
- cursor = ecore_win32_cursor_shape_get(shape);
- ecore_win32_window_cursor_set(embed->canvas_window, cursor);
+ cursor = ecore_win32_cursor_shape_get(shape);
+ ecore_win32_window_cursor_set(embed->canvas_window, cursor);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static int
ewl_ev_win32_window_expose(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- /*
- * Widgets don't need to know about this usually, but we still need to
- * let them know in case a widget is using a non-evas based draw method
- */
- Ecore_Win32_Event_Window_Damage *ev;
- Ewl_Event_Window_Expose event;
- Ewl_Window *window;
+ /*
+ * Widgets don't need to know about this usually, but we still need to
+ * let them know in case a widget is using a non-evas based draw method
+ */
+ Ecore_Win32_Event_Window_Damage *ev;
+ Ewl_Event_Window_Expose event;
+ Ewl_Window *window;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
+ ev = e;
- window = ewl_window_window_find((void *)ev->window);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->window);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
printf (" **** ewl_ev_win32_window_expose\n");
- event.x = ev->x;
- event.y = ev->y;
- event.w = ev->width;
- event.h = ev->height;
+ event.x = ev->x;
+ event.y = ev->y;
+ event.w = ev->width;
+ event.h = ev->height;
- ewl_engine_canvas_damage_add(EWL_EMBED(window), ev->x, ev->y, ev->width, ev->height);
- ewl_callback_call_with_event_data(EWL_WIDGET(window), EWL_CALLBACK_EXPOSE, &event);
+ ewl_engine_canvas_damage_add(EWL_EMBED(window), ev->x, ev->y, ev->width, ev->height);
+ ewl_callback_call_with_event_data(EWL_WIDGET(window), EWL_CALLBACK_EXPOSE, &event);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_win32_window_configure(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- /*
- * When a configure event occurs, we must update the windows geometry
- * based on the coordinates and dimensions given in the Ecore_Event.
- */
- Ecore_Win32_Event_Window_Configure *ev;
- Ewl_Window *window;
- Ewl_Embed *embed;
- int config = 0;
+ /*
+ * When a configure event occurs, we must update the windows geometry
+ * based on the coordinates and dimensions given in the Ecore_Event.
+ */
+ Ecore_Win32_Event_Window_Configure *ev;
+ Ewl_Window *window;
+ Ewl_Embed *embed;
+ int config = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
+ ev = e;
if (!ev->window)
printf ("ewl_ev_win32_window_configure : ERROR !!\n");
- embed = ewl_embed_canvas_window_find((void *)ev->window);
- if (!embed)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ embed = ewl_embed_canvas_window_find((void *)ev->window);
+ if (!embed)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- /*
- * Save coords and queue a configure event if the window is moved.
- */
- if (ev->x != embed->x) {
- embed->x = ev->x;
- config = 1;
- }
+ /*
+ * Save coords and queue a configure event if the window is moved.
+ */
+ if (ev->x != embed->x) {
+ embed->x = ev->x;
+ config = 1;
+ }
- if (ev->y != embed->y) {
- embed->y = ev->y;
- config = 1;
- }
+ if (ev->y != embed->y) {
+ embed->y = ev->y;
+ config = 1;
+ }
if (!ev->window)
printf ("ewl_ev_win32_window_configure : ERROR !!\n");
- window = ewl_window_window_find((void *)ev->window);
- /*
- * we can finish when the embed is not a window
- */
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->window);
+ /*
+ * we can finish when the embed is not a window
+ */
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- if (config)
- ewl_widget_configure(EWL_WIDGET(window));
+ if (config)
+ ewl_widget_configure(EWL_WIDGET(window));
printf (" **** ewl_ev_win32_window_configure\n");
- /*
- * Configure events really only need to occur on resize.
- */
- if ((ewl_object_current_w_get(EWL_OBJECT(window)) != ev->width)
- || (ewl_object_current_h_get(EWL_OBJECT(window)) != ev->height)) {
-
- /*
- * Right now this is commented out, as it was preventing windows
- * from resizing when WE were the ones setting the size
- * (mainly on initial show of the window). It would be nice to
- * add this back in to limit the # of window resizes occuring.
- * (As long as it doesn't break initial size.)
- */
- window->flags |= EWL_WINDOW_USER_CONFIGURE;
- ewl_object_geometry_request(EWL_OBJECT(window), 0, 0, ev->width,
- ev->height);
- }
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ /*
+ * Configure events really only need to occur on resize.
+ */
+ if ((ewl_object_current_w_get(EWL_OBJECT(window)) != ev->width)
+ || (ewl_object_current_h_get(EWL_OBJECT(window)) != ev->height)) {
+
+ /*
+ * Right now this is commented out, as it was preventing windows
+ * from resizing when WE were the ones setting the size
+ * (mainly on initial show of the window). It would be nice to
+ * add this back in to limit the # of window resizes occuring.
+ * (As long as it doesn't break initial size.)
+ */
+ window->flags |= EWL_WINDOW_USER_CONFIGURE;
+ ewl_object_geometry_request(EWL_OBJECT(window), 0, 0, ev->width,
+ ev->height);
+ }
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_win32_window_delete(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- /*
- * Retrieve the appropriate ewl_window using the x window id that is
- * held in the eevent, and call it's handlers for a window delete event.
- */
- Ecore_Win32_Event_Window_Destroy *ev;
- Ewl_Window *window;
+ /*
+ * Retrieve the appropriate ewl_window using the x window id that is
+ * held in the eevent, and call it's handlers for a window delete event.
+ */
+ Ecore_Win32_Event_Window_Destroy *ev;
+ Ewl_Window *window;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
+ ev = e;
- window = ewl_window_window_find((void *)ev->window);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->window);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- ewl_callback_call(EWL_WIDGET(window), EWL_CALLBACK_DELETE_WINDOW);
+ ewl_callback_call(EWL_WIDGET(window), EWL_CALLBACK_DELETE_WINDOW);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_win32_key_down(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_Win32_Event_Key_Down *ev;
- unsigned int key_modifiers;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- ev = e;
- window = ewl_window_window_find((void *)ev->window);
-
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
-
- key_modifiers = ewl_ev_modifiers_get();
-
- if (strstr(ev->keyname, "Shift_"))
- key_modifiers |= EWL_KEY_MODIFIER_SHIFT;
- else if (strstr(ev->keyname, "Control_"))
- key_modifiers |= EWL_KEY_MODIFIER_CTRL;
- else if (strstr(ev->keyname, "Alt_"))
- key_modifiers |= EWL_KEY_MODIFIER_ALT;
- else if (strstr(ev->keyname, "Mod_"))
- key_modifiers |= EWL_KEY_MODIFIER_MOD;
- else if (strstr(ev->keyname, "Super_"))
- key_modifiers |= EWL_KEY_MODIFIER_WIN;
- else if (strstr(ev->keyname, "Hyper_"))
- key_modifiers |= EWL_KEY_MODIFIER_WIN;
- else if (!ev->keycompose || iscntrl(*ev->keycompose))
- ewl_embed_key_down_feed(EWL_EMBED(window), ev->keyname,
- key_modifiers);
- else
- ewl_embed_key_down_feed(EWL_EMBED(window), ev->keycompose,
- key_modifiers);
-
- ewl_ev_modifiers_set(key_modifiers);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Window *window;
+ Ecore_Win32_Event_Key_Down *ev;
+ unsigned int key_modifiers;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ ev = e;
+ window = ewl_window_window_find((void *)ev->window);
+
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+
+ key_modifiers = ewl_ev_modifiers_get();
+
+ if (strstr(ev->keyname, "Shift_"))
+ key_modifiers |= EWL_KEY_MODIFIER_SHIFT;
+ else if (strstr(ev->keyname, "Control_"))
+ key_modifiers |= EWL_KEY_MODIFIER_CTRL;
+ else if (strstr(ev->keyname, "Alt_"))
+ key_modifiers |= EWL_KEY_MODIFIER_ALT;
+ else if (strstr(ev->keyname, "Mod_"))
+ key_modifiers |= EWL_KEY_MODIFIER_MOD;
+ else if (strstr(ev->keyname, "Super_"))
+ key_modifiers |= EWL_KEY_MODIFIER_WIN;
+ else if (strstr(ev->keyname, "Hyper_"))
+ key_modifiers |= EWL_KEY_MODIFIER_WIN;
+ else if (!ev->keycompose || iscntrl(*ev->keycompose))
+ ewl_embed_key_down_feed(EWL_EMBED(window), ev->keyname,
+ key_modifiers);
+ else
+ ewl_embed_key_down_feed(EWL_EMBED(window), ev->keycompose,
+ key_modifiers);
+
+ ewl_ev_modifiers_set(key_modifiers);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_win32_key_up(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_Win32_Event_Key_Up *ev;
- unsigned int key_modifiers;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- ev = e;
-
- window = ewl_window_window_find((void *)ev->window);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
-
- key_modifiers = ewl_ev_modifiers_get();
-
- if (strstr(ev->keyname, "Shift_"))
- key_modifiers &= ~EWL_KEY_MODIFIER_SHIFT;
- else if (strstr(ev->keyname, "Control_"))
- key_modifiers &= ~EWL_KEY_MODIFIER_CTRL;
- else if (strstr(ev->keyname, "Alt_"))
- key_modifiers &= ~EWL_KEY_MODIFIER_ALT;
- else if (strstr(ev->keyname, "Mod_"))
- key_modifiers &= ~EWL_KEY_MODIFIER_MOD;
- else if (strstr(ev->keyname, "Super_"))
- key_modifiers &= ~EWL_KEY_MODIFIER_WIN;
- else if (strstr(ev->keyname, "Hyper_"))
- key_modifiers &= ~EWL_KEY_MODIFIER_WIN;
- else if (!ev->keycompose || iscntrl(*ev->keycompose))
- ewl_embed_key_up_feed(EWL_EMBED(window), ev->keyname,
- key_modifiers);
- else
- ewl_embed_key_up_feed(EWL_EMBED(window), ev->keycompose,
- key_modifiers);
-
- ewl_ev_modifiers_set(key_modifiers);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Window *window;
+ Ecore_Win32_Event_Key_Up *ev;
+ unsigned int key_modifiers;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ ev = e;
+
+ window = ewl_window_window_find((void *)ev->window);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+
+ key_modifiers = ewl_ev_modifiers_get();
+
+ if (strstr(ev->keyname, "Shift_"))
+ key_modifiers &= ~EWL_KEY_MODIFIER_SHIFT;
+ else if (strstr(ev->keyname, "Control_"))
+ key_modifiers &= ~EWL_KEY_MODIFIER_CTRL;
+ else if (strstr(ev->keyname, "Alt_"))
+ key_modifiers &= ~EWL_KEY_MODIFIER_ALT;
+ else if (strstr(ev->keyname, "Mod_"))
+ key_modifiers &= ~EWL_KEY_MODIFIER_MOD;
+ else if (strstr(ev->keyname, "Super_"))
+ key_modifiers &= ~EWL_KEY_MODIFIER_WIN;
+ else if (strstr(ev->keyname, "Hyper_"))
+ key_modifiers &= ~EWL_KEY_MODIFIER_WIN;
+ else if (!ev->keycompose || iscntrl(*ev->keycompose))
+ ewl_embed_key_up_feed(EWL_EMBED(window), ev->keyname,
+ key_modifiers);
+ else
+ ewl_embed_key_up_feed(EWL_EMBED(window), ev->keycompose,
+ key_modifiers);
+
+ ewl_ev_modifiers_set(key_modifiers);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_win32_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- int clicks = 1;
- Ewl_Window *window;
- Ecore_Win32_Event_Mouse_Button_Down *ev;
- unsigned int key_modifiers;
+ int clicks = 1;
+ Ewl_Window *window;
+ Ecore_Win32_Event_Mouse_Button_Down *ev;
+ unsigned int key_modifiers;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
+ ev = e;
- window = ewl_window_window_find((void *)ev->window);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->window);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- if (ev->double_click)
- clicks = 2;
- if (ev->triple_click)
- clicks = 3;
+ if (ev->double_click)
+ clicks = 2;
+ if (ev->triple_click)
+ clicks = 3;
- key_modifiers = ewl_ev_modifiers_get();
- ewl_embed_mouse_down_feed(EWL_EMBED(window), ev->button, clicks,
- ev->x, ev->y, key_modifiers);
+ key_modifiers = ewl_ev_modifiers_get();
+ ewl_embed_mouse_down_feed(EWL_EMBED(window), ev->button, clicks,
+ ev->x, ev->y, key_modifiers);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_win32_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_Win32_Event_Mouse_Button_Up *ev;
- unsigned int key_modifiers;
+ Ewl_Window *window;
+ Ecore_Win32_Event_Mouse_Button_Up *ev;
+ unsigned int key_modifiers;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
+ ev = e;
- window = ewl_window_window_find((void *)ev->window);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->window);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- key_modifiers = ewl_ev_modifiers_get();
+ key_modifiers = ewl_ev_modifiers_get();
- ewl_embed_mouse_up_feed(EWL_EMBED(window), ev->button, ev->x,
- ev->y, key_modifiers);
+ ewl_embed_mouse_up_feed(EWL_EMBED(window), ev->button, ev->x,
+ ev->y, key_modifiers);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_win32_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_Win32_Event_Mouse_Move *ev;
- unsigned int key_modifiers;
+ Ewl_Window *window;
+ Ecore_Win32_Event_Mouse_Move *ev;
+ unsigned int key_modifiers;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
+ ev = e;
- window = ewl_window_window_find((void *)ev->window);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->window);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- key_modifiers = ewl_ev_modifiers_get();
- ewl_embed_mouse_move_feed(EWL_EMBED(window), ev->x, ev->y,
- key_modifiers);
+ key_modifiers = ewl_ev_modifiers_get();
+ ewl_embed_mouse_move_feed(EWL_EMBED(window), ev->x, ev->y,
+ key_modifiers);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_win32_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_Win32_Event_Mouse_Out *ev = e;
- unsigned int key_modifiers;
+ Ewl_Window *window;
+ Ecore_Win32_Event_Mouse_Out *ev = e;
+ unsigned int key_modifiers;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- window = ewl_window_window_find((void *)ev->window);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->window);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- key_modifiers = ewl_ev_modifiers_get();
- ewl_embed_mouse_out_feed(EWL_EMBED(window), ev->x, ev->y,
- key_modifiers);
+ key_modifiers = ewl_ev_modifiers_get();
+ ewl_embed_mouse_out_feed(EWL_EMBED(window), ev->x, ev->y,
+ key_modifiers);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_win32_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_Win32_Event_Mouse_Wheel *ev = e;
- unsigned int key_modifiers;
+ Ewl_Window *window;
+ Ecore_Win32_Event_Mouse_Wheel *ev = e;
+ unsigned int key_modifiers;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- window = ewl_window_window_find((void *)ev->window);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->window);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- key_modifiers = ewl_ev_modifiers_get();
- ewl_embed_mouse_wheel_feed(EWL_EMBED(window), ev->x, ev->y,
- ev->z, ev->direction, key_modifiers);
+ key_modifiers = ewl_ev_modifiers_get();
+ ewl_embed_mouse_wheel_feed(EWL_EMBED(window), ev->x, ev->y,
+ ev->z, ev->direction, key_modifiers);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_win32_focus_in(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_Win32_Event_Window_Focus_In *ev = e;
+ Ewl_Window *window;
+ Ecore_Win32_Event_Window_Focus_In *ev = e;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- window = ewl_window_window_find((void *)ev->window);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->window);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- ewl_callback_call(EWL_WIDGET(window), EWL_CALLBACK_FOCUS_IN);
+ ewl_callback_call(EWL_WIDGET(window), EWL_CALLBACK_FOCUS_IN);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_win32_focus_out(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_Win32_Event_Window_Focus_Out *ev = e;
+ Ewl_Window *window;
+ Ecore_Win32_Event_Window_Focus_Out *ev = e;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- window = ewl_window_window_find((void *)ev->window);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->window);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- ewl_callback_call(EWL_WIDGET(window), EWL_CALLBACK_FOCUS_OUT);
+ ewl_callback_call(EWL_WIDGET(window), EWL_CALLBACK_FOCUS_OUT);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
diff --git a/src/engines/x11/Ewl_Engine_X11.h b/src/engines/x11/Ewl_Engine_X11.h
index 96edc88..47670c4 100644
--- a/src/engines/x11/Ewl_Engine_X11.h
+++ b/src/engines/x11/Ewl_Engine_X11.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_ENGINE_X11_H
#define EWL_ENGINE_X11_H
@@ -10,7 +10,7 @@
typedef struct Ewl_Engine_X11 Ewl_Engine_X11;
struct Ewl_Engine_X11
{
- Ewl_Engine engine;
+ Ewl_Engine engine;
};
#endif
diff --git a/src/engines/x11/ewl_engine_x11.c b/src/engines/x11/ewl_engine_x11.c
index f108fbc..e9060a0 100644
--- a/src/engines/x11/ewl_engine_x11.c
+++ b/src/engines/x11/ewl_engine_x11.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include <Ewl_Engine_X11.h>
#include <X11/Xlib.h>
#include "ewl_private.h"
@@ -70,8 +70,8 @@ static void ee_window_dialog_set(Ewl_Window *win);
static void ee_window_states_set(Ewl_Window *win);
static void ee_window_state_request(Ewl_Window *win, int states);
static void ee_window_state_handle(Ewl_Window *win, int states,
- Ewl_Window_Flags ewl_flag,
- Ecore_X_Window_State ecore_flag);
+ Ewl_Window_Flags ewl_flag,
+ Ecore_X_Window_State ecore_flag);
static void ee_window_states_set_helper(Ewl_Window *win);
static void ee_window_hints_set(Ewl_Window *win);
static void ee_window_transient_for(Ewl_Window *win);
@@ -97,878 +97,878 @@ static void ee_pointer_set(Ewl_Embed *embed, int pointer);
static int ee_pointer_get(Ewl_Embed *embed);
static void *window_funcs[EWL_ENGINE_WINDOW_MAX] =
- {
- ee_window_new,
- ee_window_destroy,
- ee_window_move,
- ee_window_resize,
- ee_window_min_max_size_set,
- ee_window_show,
- ee_window_hide,
- ee_window_title_set,
- ee_window_name_class_set,
- ee_window_borderless_set,
- ee_window_dialog_set,
- ee_window_states_set,
- ee_window_hints_set,
- ee_window_transient_for,
- ee_window_leader_set,
- ee_window_raise,
- ee_window_lower,
- ee_keyboard_grab,
- ee_keyboard_ungrab,
- ee_pointer_grab,
- ee_pointer_ungrab,
- ee_window_selection_text_set,
- ee_window_geometry_set,
- ee_dnd_aware_set,
- ee_desktop_size_get,
- ee_dnd_drag_types_set,
- ee_dnd_drag_begin,
- ee_dnd_drag_drop,
- ee_dnd_drag_data_send,
- };
+ {
+ ee_window_new,
+ ee_window_destroy,
+ ee_window_move,
+ ee_window_resize,
+ ee_window_min_max_size_set,
+ ee_window_show,
+ ee_window_hide,
+ ee_window_title_set,
+ ee_window_name_class_set,
+ ee_window_borderless_set,
+ ee_window_dialog_set,
+ ee_window_states_set,
+ ee_window_hints_set,
+ ee_window_transient_for,
+ ee_window_leader_set,
+ ee_window_raise,
+ ee_window_lower,
+ ee_keyboard_grab,
+ ee_keyboard_ungrab,
+ ee_pointer_grab,
+ ee_pointer_ungrab,
+ ee_window_selection_text_set,
+ ee_window_geometry_set,
+ ee_dnd_aware_set,
+ ee_desktop_size_get,
+ ee_dnd_drag_types_set,
+ ee_dnd_drag_begin,
+ ee_dnd_drag_drop,
+ ee_dnd_drag_data_send,
+ };
static void *pointer_funcs[EWL_ENGINE_POINTER_MAX] =
- {
- ee_pointer_data_new,
- ee_pointer_free,
- ee_pointer_get,
- ee_pointer_set,
- };
+ {
+ ee_pointer_data_new,
+ ee_pointer_free,
+ ee_pointer_get,
+ ee_pointer_set,
+ };
Ecore_DList *
ewl_engine_dependancies(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
}
Ewl_Engine *
ewl_engine_create(int *argc, char ** argv)
{
- Ewl_Engine_X11 *engine;
+ Ewl_Engine_X11 *engine;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- engine = NEW(Ewl_Engine_X11, 1);
- if (!engine)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ engine = NEW(Ewl_Engine_X11, 1);
+ if (!engine)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ee_init(EWL_ENGINE(engine), argc, argv))
- {
- FREE(engine);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ee_init(EWL_ENGINE(engine), argc, argv))
+ {
+ FREE(engine);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
}
static int
ee_init(Ewl_Engine *engine, int *argc, char ** argv)
{
- Ewl_Engine_Info *info;
- char *display = NULL;
- int i;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(engine, FALSE);
-
- /* If the event handlers are already setup don't do it again */
- if (ee_expose_handler)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
-
- if (argc && argv)
- {
- for (i = 1; i < *argc; i++)
- {
- if (!strcmp(argv[i], "-display"))
- {
- if (++i < *argc)
- display = argv[i];
- }
- }
- }
-
- if (!ecore_x_init(display))
- {
- fprintf(stderr, "Unable to initialize Ecore X.\n"
- "Is your DISPLAY variable set correctly?\n\n");
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
-
- ee_expose_handler = ecore_event_handler_add(
- ECORE_X_EVENT_WINDOW_DAMAGE,
- ewl_ev_x_window_expose, NULL);
- ee_configure_handler = ecore_event_handler_add(
- ECORE_X_EVENT_WINDOW_CONFIGURE,
- ewl_ev_x_window_configure, NULL);
- ee_delete_request_handler = ecore_event_handler_add(
- ECORE_X_EVENT_WINDOW_DELETE_REQUEST,
- ewl_ev_x_window_delete, NULL);
-
- /*
- * Register dispatching functions for keyboard events.
- */
- ee_key_down_handler = ecore_event_handler_add(
- ECORE_X_EVENT_KEY_DOWN,
- ewl_ev_x_key_down, NULL);
- ee_key_up_handler = ecore_event_handler_add(
- ECORE_X_EVENT_KEY_UP,
- ewl_ev_x_key_up, NULL);
-
- /*
- * Register dispatching functions for DND events
- */
- ee_dnd_position_handler = ecore_event_handler_add(
- ECORE_X_EVENT_XDND_POSITION,
- ewl_ev_dnd_position, NULL);
- ee_dnd_enter_handler = ecore_event_handler_add(
- ECORE_X_EVENT_XDND_ENTER,
- ewl_ev_dnd_enter, NULL);
- ee_dnd_leave_handler = ecore_event_handler_add(
- ECORE_X_EVENT_XDND_LEAVE,
- ewl_ev_dnd_leave, NULL);
- ee_dnd_drop_handler = ecore_event_handler_add(
- ECORE_X_EVENT_XDND_DROP,
- ewl_ev_dnd_drop, NULL);
-
- /*
- * Selection callbacks to allow for data transfers.
- */
- ee_selection_notify_handler = ecore_event_handler_add(
- ECORE_X_EVENT_SELECTION_NOTIFY,
- ewl_ev_x_data_received, NULL);
-
- /*
- * Selection callbacks to allow for pasting.
- */
- ee_selection_request_handler = ecore_event_handler_add(
- ECORE_X_EVENT_SELECTION_REQUEST,
- ewl_ev_x_data_request, NULL);
-
- /*
- * Finally, register dispatching functions for mouse events.
- */
- ee_mouse_down_handler = ecore_event_handler_add(
- ECORE_X_EVENT_MOUSE_BUTTON_DOWN,
- ewl_ev_x_mouse_down, NULL);
- ee_mouse_up_handler = ecore_event_handler_add(
- ECORE_X_EVENT_MOUSE_BUTTON_UP,
- ewl_ev_x_mouse_up, NULL);
- ee_mouse_move_handler = ecore_event_handler_add(
- ECORE_X_EVENT_MOUSE_MOVE,
- ewl_ev_x_mouse_move, NULL);
- ee_mouse_wheel_handler = ecore_event_handler_add(
- ECORE_X_EVENT_MOUSE_WHEEL,
- ewl_ev_x_mouse_wheel, NULL);
- ee_mouse_out_handler = ecore_event_handler_add(
- ECORE_X_EVENT_MOUSE_OUT,
- ewl_ev_x_mouse_out, NULL);
- ee_focus_in_handler = ecore_event_handler_add(
- ECORE_X_EVENT_WINDOW_FOCUS_IN,
- ewl_ev_x_focus_in, NULL);
- ee_focus_out_handler = ecore_event_handler_add(
- ECORE_X_EVENT_WINDOW_FOCUS_OUT,
- ewl_ev_x_focus_out, NULL);
-
- if (!ee_expose_handler || !ee_configure_handler
- || !ee_delete_request_handler
- || !ee_key_down_handler || !ee_key_up_handler
- || !ee_dnd_position_handler || !ee_dnd_enter_handler
- || !ee_dnd_leave_handler || !ee_dnd_drop_handler
- || !ee_selection_notify_handler || !ee_selection_request_handler
- || !ee_mouse_down_handler
- || !ee_mouse_up_handler || !ee_mouse_move_handler
- || !ee_mouse_wheel_handler || !ee_mouse_out_handler
- || !ee_focus_in_handler || !ee_focus_out_handler)
- {
- ee_shutdown(EWL_ENGINE(engine));
-
- fprintf(stderr, "Unable to create Ecore X event handlers.\n");
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
-
- info = NEW(Ewl_Engine_Info, 1);
- info->shutdown = ee_shutdown;
- info->hooks.window = window_funcs;
- info->hooks.pointer = pointer_funcs;
-
- engine->functions = info;
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Engine_Info *info;
+ char *display = NULL;
+ int i;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(engine, FALSE);
+
+ /* If the event handlers are already setup don't do it again */
+ if (ee_expose_handler)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+
+ if (argc && argv)
+ {
+ for (i = 1; i < *argc; i++)
+ {
+ if (!strcmp(argv[i], "-display"))
+ {
+ if (++i < *argc)
+ display = argv[i];
+ }
+ }
+ }
+
+ if (!ecore_x_init(display))
+ {
+ fprintf(stderr, "Unable to initialize Ecore X.\n"
+ "Is your DISPLAY variable set correctly?\n\n");
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+
+ ee_expose_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_WINDOW_DAMAGE,
+ ewl_ev_x_window_expose, NULL);
+ ee_configure_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_WINDOW_CONFIGURE,
+ ewl_ev_x_window_configure, NULL);
+ ee_delete_request_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_WINDOW_DELETE_REQUEST,
+ ewl_ev_x_window_delete, NULL);
+
+ /*
+ * Register dispatching functions for keyboard events.
+ */
+ ee_key_down_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_KEY_DOWN,
+ ewl_ev_x_key_down, NULL);
+ ee_key_up_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_KEY_UP,
+ ewl_ev_x_key_up, NULL);
+
+ /*
+ * Register dispatching functions for DND events
+ */
+ ee_dnd_position_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_XDND_POSITION,
+ ewl_ev_dnd_position, NULL);
+ ee_dnd_enter_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_XDND_ENTER,
+ ewl_ev_dnd_enter, NULL);
+ ee_dnd_leave_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_XDND_LEAVE,
+ ewl_ev_dnd_leave, NULL);
+ ee_dnd_drop_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_XDND_DROP,
+ ewl_ev_dnd_drop, NULL);
+
+ /*
+ * Selection callbacks to allow for data transfers.
+ */
+ ee_selection_notify_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_SELECTION_NOTIFY,
+ ewl_ev_x_data_received, NULL);
+
+ /*
+ * Selection callbacks to allow for pasting.
+ */
+ ee_selection_request_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_SELECTION_REQUEST,
+ ewl_ev_x_data_request, NULL);
+
+ /*
+ * Finally, register dispatching functions for mouse events.
+ */
+ ee_mouse_down_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_MOUSE_BUTTON_DOWN,
+ ewl_ev_x_mouse_down, NULL);
+ ee_mouse_up_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_MOUSE_BUTTON_UP,
+ ewl_ev_x_mouse_up, NULL);
+ ee_mouse_move_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_MOUSE_MOVE,
+ ewl_ev_x_mouse_move, NULL);
+ ee_mouse_wheel_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_MOUSE_WHEEL,
+ ewl_ev_x_mouse_wheel, NULL);
+ ee_mouse_out_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_MOUSE_OUT,
+ ewl_ev_x_mouse_out, NULL);
+ ee_focus_in_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_WINDOW_FOCUS_IN,
+ ewl_ev_x_focus_in, NULL);
+ ee_focus_out_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_WINDOW_FOCUS_OUT,
+ ewl_ev_x_focus_out, NULL);
+
+ if (!ee_expose_handler || !ee_configure_handler
+ || !ee_delete_request_handler
+ || !ee_key_down_handler || !ee_key_up_handler
+ || !ee_dnd_position_handler || !ee_dnd_enter_handler
+ || !ee_dnd_leave_handler || !ee_dnd_drop_handler
+ || !ee_selection_notify_handler || !ee_selection_request_handler
+ || !ee_mouse_down_handler
+ || !ee_mouse_up_handler || !ee_mouse_move_handler
+ || !ee_mouse_wheel_handler || !ee_mouse_out_handler
+ || !ee_focus_in_handler || !ee_focus_out_handler)
+ {
+ ee_shutdown(EWL_ENGINE(engine));
+
+ fprintf(stderr, "Unable to create Ecore X event handlers.\n");
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+
+ info = NEW(Ewl_Engine_Info, 1);
+ info->shutdown = ee_shutdown;
+ info->hooks.window = window_funcs;
+ info->hooks.pointer = pointer_funcs;
+
+ engine->functions = info;
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static void
ee_shutdown(Ewl_Engine *engine)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(engine);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(engine);
- if (ee_expose_handler)
- ecore_event_handler_del(ee_expose_handler);
- ee_expose_handler = NULL;
+ if (ee_expose_handler)
+ ecore_event_handler_del(ee_expose_handler);
+ ee_expose_handler = NULL;
- if (ee_configure_handler)
- ecore_event_handler_del(ee_configure_handler);
- ee_configure_handler = NULL;
+ if (ee_configure_handler)
+ ecore_event_handler_del(ee_configure_handler);
+ ee_configure_handler = NULL;
- if (ee_delete_request_handler)
- ecore_event_handler_del(ee_delete_request_handler);
- ee_delete_request_handler = NULL;
+ if (ee_delete_request_handler)
+ ecore_event_handler_del(ee_delete_request_handler);
+ ee_delete_request_handler = NULL;
- if (ee_key_down_handler)
- ecore_event_handler_del(ee_key_down_handler);
- ee_key_down_handler = NULL;
+ if (ee_key_down_handler)
+ ecore_event_handler_del(ee_key_down_handler);
+ ee_key_down_handler = NULL;
- if (ee_key_up_handler)
- ecore_event_handler_del(ee_key_up_handler);
- ee_key_up_handler = NULL;
+ if (ee_key_up_handler)
+ ecore_event_handler_del(ee_key_up_handler);
+ ee_key_up_handler = NULL;
- if (ee_dnd_position_handler)
- ecore_event_handler_del(ee_dnd_position_handler);
- ee_dnd_position_handler = NULL;
+ if (ee_dnd_position_handler)
+ ecore_event_handler_del(ee_dnd_position_handler);
+ ee_dnd_position_handler = NULL;
- if (ee_dnd_enter_handler)
- ecore_event_handler_del(ee_dnd_enter_handler);
- ee_dnd_enter_handler = NULL;
+ if (ee_dnd_enter_handler)
+ ecore_event_handler_del(ee_dnd_enter_handler);
+ ee_dnd_enter_handler = NULL;
- if (ee_dnd_leave_handler)
- ecore_event_handler_del(ee_dnd_leave_handler);
- ee_dnd_leave_handler = NULL;
+ if (ee_dnd_leave_handler)
+ ecore_event_handler_del(ee_dnd_leave_handler);
+ ee_dnd_leave_handler = NULL;
- if (ee_dnd_drop_handler)
- ecore_event_handler_del(ee_dnd_drop_handler);
- ee_dnd_drop_handler = NULL;
+ if (ee_dnd_drop_handler)
+ ecore_event_handler_del(ee_dnd_drop_handler);
+ ee_dnd_drop_handler = NULL;
- if (ee_selection_notify_handler)
- ecore_event_handler_del(ee_selection_notify_handler);
- ee_selection_notify_handler = NULL;
+ if (ee_selection_notify_handler)
+ ecore_event_handler_del(ee_selection_notify_handler);
+ ee_selection_notify_handler = NULL;
- if (ee_selection_request_handler)
- ecore_event_handler_del(ee_selection_request_handler);
- ee_selection_request_handler = NULL;
+ if (ee_selection_request_handler)
+ ecore_event_handler_del(ee_selection_request_handler);
+ ee_selection_request_handler = NULL;
- if (ee_mouse_down_handler)
- ecore_event_handler_del(ee_mouse_down_handler);
- ee_mouse_down_handler = NULL;
+ if (ee_mouse_down_handler)
+ ecore_event_handler_del(ee_mouse_down_handler);
+ ee_mouse_down_handler = NULL;
- if (ee_mouse_up_handler)
- ecore_event_handler_del(ee_mouse_up_handler);
- ee_mouse_up_handler = NULL;
+ if (ee_mouse_up_handler)
+ ecore_event_handler_del(ee_mouse_up_handler);
+ ee_mouse_up_handler = NULL;
- if (ee_mouse_move_handler)
- ecore_event_handler_del(ee_mouse_move_handler);
- ee_mouse_move_handler = NULL;
+ if (ee_mouse_move_handler)
+ ecore_event_handler_del(ee_mouse_move_handler);
+ ee_mouse_move_handler = NULL;
- if (ee_mouse_wheel_handler)
- ecore_event_handler_del(ee_mouse_wheel_handler);
- ee_mouse_wheel_handler = NULL;
+ if (ee_mouse_wheel_handler)
+ ecore_event_handler_del(ee_mouse_wheel_handler);
+ ee_mouse_wheel_handler = NULL;
- if (ee_mouse_out_handler)
- ecore_event_handler_del(ee_mouse_out_handler);
- ee_mouse_out_handler = NULL;
+ if (ee_mouse_out_handler)
+ ecore_event_handler_del(ee_mouse_out_handler);
+ ee_mouse_out_handler = NULL;
- if (ee_focus_in_handler)
- ecore_event_handler_del(ee_focus_in_handler);
- ee_focus_in_handler = NULL;
+ if (ee_focus_in_handler)
+ ecore_event_handler_del(ee_focus_in_handler);
+ ee_focus_in_handler = NULL;
- if (ee_focus_out_handler)
- ecore_event_handler_del(ee_focus_out_handler);
- ee_focus_out_handler = NULL;
+ if (ee_focus_out_handler)
+ ecore_event_handler_del(ee_focus_out_handler);
+ ee_focus_out_handler = NULL;
- ecore_x_shutdown();
+ ecore_x_shutdown();
- IF_FREE(engine->functions);
+ IF_FREE(engine->functions);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_new(Ewl_Window *win)
{
- Ecore_X_Window xwin;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
-
- if (win->flags & EWL_WINDOW_OVERRIDE)
- xwin = ecore_x_window_override_new(0,
- EWL_EMBED(win)->x, EWL_EMBED(win)->y,
- ewl_object_current_w_get(EWL_OBJECT(win)),
- ewl_object_current_h_get(EWL_OBJECT(win)));
- else
- xwin = ecore_x_window_new(0,
- EWL_EMBED(win)->x, EWL_EMBED(win)->y,
- ewl_object_current_w_get(EWL_OBJECT(win)),
- ewl_object_current_h_get(EWL_OBJECT(win)));
-
- ecore_x_icccm_protocol_set(xwin, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, 1);
- win->window = (void *)xwin;
-
- if (win->flags & EWL_WINDOW_BORDERLESS)
- ee_window_borderless_set(win);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ecore_X_Window xwin;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+
+ if (win->flags & EWL_WINDOW_OVERRIDE)
+ xwin = ecore_x_window_override_new(0,
+ EWL_EMBED(win)->x, EWL_EMBED(win)->y,
+ ewl_object_current_w_get(EWL_OBJECT(win)),
+ ewl_object_current_h_get(EWL_OBJECT(win)));
+ else
+ xwin = ecore_x_window_new(0,
+ EWL_EMBED(win)->x, EWL_EMBED(win)->y,
+ ewl_object_current_w_get(EWL_OBJECT(win)),
+ ewl_object_current_h_get(EWL_OBJECT(win)));
+
+ ecore_x_icccm_protocol_set(xwin, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, 1);
+ win->window = (void *)xwin;
+
+ if (win->flags & EWL_WINDOW_BORDERLESS)
+ ee_window_borderless_set(win);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_destroy(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ee_window_hide(win);
- ecore_x_window_del((Ecore_X_Window)(EWL_EMBED(win)->canvas_window));
- ecore_x_window_del((Ecore_X_Window)(win->window));
+ ee_window_hide(win);
+ ecore_x_window_del((Ecore_X_Window)(EWL_EMBED(win)->canvas_window));
+ ecore_x_window_del((Ecore_X_Window)(win->window));
- EWL_EMBED(win)->canvas_window = NULL;
- win->window = NULL;
+ EWL_EMBED(win)->canvas_window = NULL;
+ win->window = NULL;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_move(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_x_window_move((Ecore_X_Window)win->window,
- EWL_EMBED(win)->x,
- EWL_EMBED(win)->y);
+ ecore_x_window_move((Ecore_X_Window)win->window,
+ EWL_EMBED(win)->x,
+ EWL_EMBED(win)->y);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_resize(Ewl_Window *win)
{
- int width, height;
+ int width, height;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- width = ewl_object_current_w_get(EWL_OBJECT(win));
- height = ewl_object_current_h_get(EWL_OBJECT(win));
+ width = ewl_object_current_w_get(EWL_OBJECT(win));
+ height = ewl_object_current_h_get(EWL_OBJECT(win));
- ecore_x_window_resize((Ecore_X_Window)win->window, width, height);
+ ecore_x_window_resize((Ecore_X_Window)win->window, width, height);
- if (EWL_EMBED(win)->canvas_window != win->window)
- ecore_x_window_resize((Ecore_X_Window)EWL_EMBED(win)->canvas_window,
- width, height);
+ if (EWL_EMBED(win)->canvas_window != win->window)
+ ecore_x_window_resize((Ecore_X_Window)EWL_EMBED(win)->canvas_window,
+ width, height);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_min_max_size_set(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
-
- ecore_x_icccm_size_pos_hints_set((Ecore_X_Window)win->window,
- 0, ECORE_X_GRAVITY_NW,
- ewl_object_minimum_w_get(EWL_OBJECT(win)),
- ewl_object_minimum_h_get(EWL_OBJECT(win)),
- ewl_object_maximum_w_get(EWL_OBJECT(win)),
- ewl_object_maximum_h_get(EWL_OBJECT(win)),
- 0, 0, /* base */
- 0, 0, /* step */
- 0, 0); /* aspect */
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+
+ ecore_x_icccm_size_pos_hints_set((Ecore_X_Window)win->window,
+ 0, ECORE_X_GRAVITY_NW,
+ ewl_object_minimum_w_get(EWL_OBJECT(win)),
+ ewl_object_minimum_h_get(EWL_OBJECT(win)),
+ ewl_object_maximum_w_get(EWL_OBJECT(win)),
+ ewl_object_maximum_h_get(EWL_OBJECT(win)),
+ 0, 0, /* base */
+ 0, 0, /* step */
+ 0, 0); /* aspect */
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_show(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_x_window_show((Ecore_X_Window)win->window);
- ecore_x_window_show((Ecore_X_Window)EWL_EMBED(win)->canvas_window);
+ ecore_x_window_show((Ecore_X_Window)win->window);
+ ecore_x_window_show((Ecore_X_Window)EWL_EMBED(win)->canvas_window);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_hide(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_x_window_hide((Ecore_X_Window)EWL_EMBED(win)->canvas_window);
- ecore_x_window_hide((Ecore_X_Window)EWL_WINDOW(win)->window);
+ ecore_x_window_hide((Ecore_X_Window)EWL_EMBED(win)->canvas_window);
+ ecore_x_window_hide((Ecore_X_Window)EWL_WINDOW(win)->window);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_title_set(Ewl_Window *win)
{
- const char *title;
+ const char *title;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- title = win->title ? win->title : "";
- ecore_x_icccm_title_set((Ecore_X_Window)win->window, title);
- ecore_x_netwm_name_set((Ecore_X_Window)win->window, title);
+ title = win->title ? win->title : "";
+ ecore_x_icccm_title_set((Ecore_X_Window)win->window, title);
+ ecore_x_netwm_name_set((Ecore_X_Window)win->window, title);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_name_class_set(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_x_icccm_name_class_set((Ecore_X_Window)win->window, win->name,
- (win->classname ? win->classname : win->name));
+ ecore_x_icccm_name_class_set((Ecore_X_Window)win->window, win->name,
+ (win->classname ? win->classname : win->name));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_borderless_set(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_x_mwm_borderless_set((Ecore_X_Window)win->window,
- (!!(win->flags & EWL_WINDOW_BORDERLESS)));
+ ecore_x_mwm_borderless_set((Ecore_X_Window)win->window,
+ (!!(win->flags & EWL_WINDOW_BORDERLESS)));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_dialog_set(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_x_netwm_window_type_set((Ecore_X_Window)win->window,
- ((!!(win->flags & EWL_WINDOW_DIALOG)) ?
- ECORE_X_WINDOW_TYPE_DIALOG :
- ECORE_X_WINDOW_TYPE_NORMAL));
+ ecore_x_netwm_window_type_set((Ecore_X_Window)win->window,
+ ((!!(win->flags & EWL_WINDOW_DIALOG)) ?
+ ECORE_X_WINDOW_TYPE_DIALOG :
+ ECORE_X_WINDOW_TYPE_NORMAL));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_states_set(Ewl_Window *win)
{
- int diff;
+ int diff;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- diff = win->flags ^ win->old_flags;
- if (!diff) DRETURN(DLEVEL_STABLE);
+ diff = win->flags ^ win->old_flags;
+ if (!diff) DRETURN(DLEVEL_STABLE);
- if (REALIZED(win))
- ee_window_state_request(win, diff);
- else
- ee_window_states_set_helper(win);
+ if (REALIZED(win))
+ ee_window_state_request(win, diff);
+ else
+ ee_window_states_set_helper(win);
- win->old_flags = win->flags;
+ win->old_flags = win->flags;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_state_handle(Ewl_Window *win, int states,
- Ewl_Window_Flags ewl_flag,
- Ecore_X_Window_State ecore_flag)
+ Ewl_Window_Flags ewl_flag,
+ Ecore_X_Window_State ecore_flag)
{
- int state = 0;
+ int state = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (states & ewl_flag)
- {
- state = (!!(win->flags & ewl_flag));
- ecore_x_netwm_state_request_send((Ecore_X_Window)win->window,
- 0, ecore_flag, ECORE_X_WINDOW_STATE_UNKNOWN, state);
- }
+ if (states & ewl_flag)
+ {
+ state = (!!(win->flags & ewl_flag));
+ ecore_x_netwm_state_request_send((Ecore_X_Window)win->window,
+ 0, ecore_flag, ECORE_X_WINDOW_STATE_UNKNOWN, state);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_state_request(Ewl_Window *win, int states)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
-
- ee_window_state_handle(win, states, EWL_WINDOW_FULLSCREEN,
- ECORE_X_WINDOW_STATE_FULLSCREEN);
- ee_window_state_handle(win, states, EWL_WINDOW_SKIP_TASKBAR,
- ECORE_X_WINDOW_STATE_SKIP_TASKBAR);
- ee_window_state_handle(win, states, EWL_WINDOW_SKIP_PAGER,
- ECORE_X_WINDOW_STATE_SKIP_PAGER);
- ee_window_state_handle(win, states, EWL_WINDOW_MODAL,
- ECORE_X_WINDOW_STATE_MODAL);
- ee_window_state_handle(win, states, EWL_WINDOW_DEMANDS_ATTENTION,
- ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION);
-
- win->flags &= ~EWL_WINDOW_DEMANDS_ATTENTION;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+
+ ee_window_state_handle(win, states, EWL_WINDOW_FULLSCREEN,
+ ECORE_X_WINDOW_STATE_FULLSCREEN);
+ ee_window_state_handle(win, states, EWL_WINDOW_SKIP_TASKBAR,
+ ECORE_X_WINDOW_STATE_SKIP_TASKBAR);
+ ee_window_state_handle(win, states, EWL_WINDOW_SKIP_PAGER,
+ ECORE_X_WINDOW_STATE_SKIP_PAGER);
+ ee_window_state_handle(win, states, EWL_WINDOW_MODAL,
+ ECORE_X_WINDOW_STATE_MODAL);
+ ee_window_state_handle(win, states, EWL_WINDOW_DEMANDS_ATTENTION,
+ ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION);
+
+ win->flags &= ~EWL_WINDOW_DEMANDS_ATTENTION;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_states_set_helper(Ewl_Window *win)
{
- Ecore_X_Window_State states[4];
- int count = 0;
+ Ecore_X_Window_State states[4];
+ int count = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- /* Note: We're ignoring the attention demand state in here as it is
- * only relevant if the window has been realized */
+ /* Note: We're ignoring the attention demand state in here as it is
+ * only relevant if the window has been realized */
- if (!win->window)
- DRETURN(DLEVEL_STABLE);
+ if (!win->window)
+ DRETURN(DLEVEL_STABLE);
- if (!!(win->flags & EWL_WINDOW_FULLSCREEN))
- states[count++] = ECORE_X_WINDOW_STATE_FULLSCREEN;
+ if (!!(win->flags & EWL_WINDOW_FULLSCREEN))
+ states[count++] = ECORE_X_WINDOW_STATE_FULLSCREEN;
- if (!!(win->flags & EWL_WINDOW_SKIP_TASKBAR))
- states[count++] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
+ if (!!(win->flags & EWL_WINDOW_SKIP_TASKBAR))
+ states[count++] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
- if (!!(win->flags & EWL_WINDOW_SKIP_PAGER))
- states[count++] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
+ if (!!(win->flags & EWL_WINDOW_SKIP_PAGER))
+ states[count++] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
- if (!!(win->flags & EWL_WINDOW_MODAL))
- states[count++] = ECORE_X_WINDOW_STATE_MODAL;
+ if (!!(win->flags & EWL_WINDOW_MODAL))
+ states[count++] = ECORE_X_WINDOW_STATE_MODAL;
- ecore_x_netwm_window_state_set((Ecore_X_Window)win->window, states, count);
+ ecore_x_netwm_window_state_set((Ecore_X_Window)win->window, states, count);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_hints_set(Ewl_Window *win)
{
- Ewl_Embed_Window *win_group;
- int urgent = FALSE;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
-
- if (win->flags & EWL_WINDOW_LEADER)
- win_group = win->leader.ewl->window;
- else if (win->flags & EWL_WINDOW_LEADER_FOREIGN)
- win_group = win->leader.foreign;
- else
- win_group = NULL;
-
- if (win->flags & EWL_WINDOW_URGENT)
- urgent = TRUE;
-
- ecore_x_icccm_hints_set((Ecore_X_Window) win->window,
- 1, // accepts focus
- 0, // initial states
- 0, // icon pixmap
- 0, // icon mask
- 0, // icon window
- (Ecore_X_Window) win_group, // window group
- urgent); // is urgent
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Embed_Window *win_group;
+ int urgent = FALSE;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+
+ if (win->flags & EWL_WINDOW_LEADER)
+ win_group = win->leader.ewl->window;
+ else if (win->flags & EWL_WINDOW_LEADER_FOREIGN)
+ win_group = win->leader.foreign;
+ else
+ win_group = NULL;
+
+ if (win->flags & EWL_WINDOW_URGENT)
+ urgent = TRUE;
+
+ ecore_x_icccm_hints_set((Ecore_X_Window) win->window,
+ 1, // accepts focus
+ 0, // initial states
+ 0, // icon pixmap
+ 0, // icon mask
+ 0, // icon window
+ (Ecore_X_Window) win_group, // window group
+ urgent); // is urgent
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_transient_for(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
-
- if (win->flags & EWL_WINDOW_TRANSIENT)
- ecore_x_icccm_transient_for_set((Ecore_X_Window)win->window,
- (Ecore_X_Window)win->transient.ewl->window);
- else if (win->flags & EWL_WINDOW_TRANSIENT_FOREIGN)
- ecore_x_icccm_transient_for_set((Ecore_X_Window)win->window,
- (Ecore_X_Window)win->transient.foreign);
- else
- ecore_x_icccm_transient_for_unset((Ecore_X_Window)win->window);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+
+ if (win->flags & EWL_WINDOW_TRANSIENT)
+ ecore_x_icccm_transient_for_set((Ecore_X_Window)win->window,
+ (Ecore_X_Window)win->transient.ewl->window);
+ else if (win->flags & EWL_WINDOW_TRANSIENT_FOREIGN)
+ ecore_x_icccm_transient_for_set((Ecore_X_Window)win->window,
+ (Ecore_X_Window)win->transient.foreign);
+ else
+ ecore_x_icccm_transient_for_unset((Ecore_X_Window)win->window);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_leader_set(Ewl_Window *win)
{
- Ewl_Embed_Window *leader;
+ Ewl_Embed_Window *leader;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (win->flags & EWL_WINDOW_LEADER)
- leader = win->leader.ewl->window;
- else if (win->flags & EWL_WINDOW_LEADER_FOREIGN)
- leader = win->leader.foreign;
- else
- /* according to the icccm specs a client leader
- * sets itself to the leader */
- leader = win->window;
+ if (win->flags & EWL_WINDOW_LEADER)
+ leader = win->leader.ewl->window;
+ else if (win->flags & EWL_WINDOW_LEADER_FOREIGN)
+ leader = win->leader.foreign;
+ else
+ /* according to the icccm specs a client leader
+ * sets itself to the leader */
+ leader = win->window;
- ecore_x_icccm_client_leader_set((Ecore_X_Window)win->window,
- (Ecore_X_Window)leader);
+ ecore_x_icccm_client_leader_set((Ecore_X_Window)win->window,
+ (Ecore_X_Window)leader);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_raise(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_x_window_raise((Ecore_X_Window)win->window);
+ ecore_x_window_raise((Ecore_X_Window)win->window);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_lower(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_x_window_lower((Ecore_X_Window)win->window);
+ ecore_x_window_lower((Ecore_X_Window)win->window);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static int
ee_keyboard_grab(Ewl_Window *win)
{
- int ret = FALSE;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(win, FALSE);
- DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
-
- if ((!!(win->flags & EWL_WINDOW_GRAB_KEYBOARD)))
- {
- ret = ecore_x_keyboard_grab((Ecore_X_Window)win->window);
- ee_current_key_grab_window = win;
- }
- else if (ee_current_key_grab_window == win)
- {
- ecore_x_keyboard_ungrab();
- ee_current_key_grab_window = NULL;
- }
-
- DRETURN_INT(ret, DLEVEL_STABLE);
+ int ret = FALSE;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(win, FALSE);
+ DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
+
+ if ((!!(win->flags & EWL_WINDOW_GRAB_KEYBOARD)))
+ {
+ ret = ecore_x_keyboard_grab((Ecore_X_Window)win->window);
+ ee_current_key_grab_window = win;
+ }
+ else if (ee_current_key_grab_window == win)
+ {
+ ecore_x_keyboard_ungrab();
+ ee_current_key_grab_window = NULL;
+ }
+
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
static void
ee_keyboard_ungrab(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_x_keyboard_ungrab();
- ee_current_key_grab_window = NULL;
+ ecore_x_keyboard_ungrab();
+ ee_current_key_grab_window = NULL;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static int
ee_pointer_grab(Ewl_Window *win)
{
- int ret = FALSE;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(win, FALSE);
- DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
-
- if ((!!(win->flags & EWL_WINDOW_GRAB_POINTER)))
- {
- ret = ecore_x_pointer_grab((Ecore_X_Window)win->window);
- ee_current_pointer_grab_window = win;
- }
- else if (ee_current_pointer_grab_window == win)
- {
- ecore_x_pointer_ungrab();
- ee_current_pointer_grab_window = NULL;
- }
-
- DRETURN_INT(ret, DLEVEL_STABLE);
+ int ret = FALSE;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(win, FALSE);
+ DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
+
+ if ((!!(win->flags & EWL_WINDOW_GRAB_POINTER)))
+ {
+ ret = ecore_x_pointer_grab((Ecore_X_Window)win->window);
+ ee_current_pointer_grab_window = win;
+ }
+ else if (ee_current_pointer_grab_window == win)
+ {
+ ecore_x_pointer_ungrab();
+ ee_current_pointer_grab_window = NULL;
+ }
+
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
static void
ee_pointer_ungrab(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_x_pointer_ungrab();
- ee_current_pointer_grab_window = NULL;
+ ecore_x_pointer_ungrab();
+ ee_current_pointer_grab_window = NULL;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_selection_text_set(Ewl_Embed *emb, const char *txt)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(emb);
- DCHECK_PARAM_PTR(txt);
- DCHECK_TYPE(emb, EWL_EMBED_TYPE);
-
- if (txt)
- ecore_x_selection_primary_set(
- (Ecore_X_Window)emb->canvas_window,
- (unsigned char *)txt, strlen(txt) + 1);
- else
- ecore_x_selection_primary_clear();
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(emb);
+ DCHECK_PARAM_PTR(txt);
+ DCHECK_TYPE(emb, EWL_EMBED_TYPE);
+
+ if (txt)
+ ecore_x_selection_primary_set(
+ (Ecore_X_Window)emb->canvas_window,
+ (unsigned char *)txt, strlen(txt) + 1);
+ else
+ ecore_x_selection_primary_clear();
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_geometry_set(Ewl_Window *win, int *width, int *height)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ecore_x_window_geometry_get((win ? (Ecore_X_Window)win->window : (Ecore_X_Window)0),
- NULL, NULL, width, height);
+ ecore_x_window_geometry_get((win ? (Ecore_X_Window)win->window : (Ecore_X_Window)0),
+ NULL, NULL, width, height);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_dnd_aware_set(Ewl_Embed *embed)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- ecore_x_dnd_aware_set((Ecore_X_Window)embed->canvas_window, TRUE);
+ ecore_x_dnd_aware_set((Ecore_X_Window)embed->canvas_window, TRUE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_desktop_size_get(Ewl_Embed *embed, int *w, int *h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- ecore_x_window_size_get(0, w, h);
+ ecore_x_window_size_get(0, w, h);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_dnd_drag_types_set(Ewl_Embed *embed, const char **types, unsigned int num)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- ecore_x_dnd_aware_set((Ecore_X_Window)embed->canvas_window,
- (num > 0 ? 1 : 0));
- ecore_x_dnd_types_set((Ecore_X_Window)embed->canvas_window, (char **)types, num);
+ ecore_x_dnd_aware_set((Ecore_X_Window)embed->canvas_window,
+ (num > 0 ? 1 : 0));
+ ecore_x_dnd_types_set((Ecore_X_Window)embed->canvas_window, (char **)types, num);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_dnd_drag_begin(Ewl_Embed *embed)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- ecore_x_dnd_begin((Ecore_X_Window)embed->canvas_window, NULL, 0);
+ ecore_x_dnd_begin((Ecore_X_Window)embed->canvas_window, NULL, 0);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_dnd_drag_drop(Ewl_Embed *embed)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- ecore_x_dnd_drop();
+ ecore_x_dnd_drop();
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static int
ee_dnd_drag_data_send(Ewl_Embed *embed, void *handle, void *data, int len)
{
- Ecore_X_Event_Selection_Request *request = handle;
+ Ecore_X_Event_Selection_Request *request = handle;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(embed, FALSE);
- DCHECK_PARAM_PTR_RET(handle, FALSE);
- DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(embed, FALSE);
+ DCHECK_PARAM_PTR_RET(handle, FALSE);
+ DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, FALSE);
- ecore_x_window_prop_property_set(request->requestor, request->property,
- request->target, 8, data, len);
+ ecore_x_window_prop_property_set(request->requestor, request->property,
+ request->target, 8, data, len);
- DRETURN_INT(ecore_x_selection_notify_send(request->requestor,
- request->selection, request->target,
- request->property, request->time), DLEVEL_STABLE);
+ DRETURN_INT(ecore_x_selection_notify_send(request->requestor,
+ request->selection, request->target,
+ request->property, request->time), DLEVEL_STABLE);
}
static int
ee_pointer_data_new(Ewl_Embed *embed, int *data, int w, int h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(embed, 0);
- DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(embed, 0);
+ DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, 0);
- DRETURN_INT(ecore_x_cursor_new((Ecore_X_Window)embed->canvas_window,
- data, w, h, 0, 0), DLEVEL_STABLE);
+ DRETURN_INT(ecore_x_cursor_new((Ecore_X_Window)embed->canvas_window,
+ data, w, h, 0, 0), DLEVEL_STABLE);
}
static void
ee_pointer_free(Ewl_Embed *embed, int pointer)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- ecore_x_cursor_free(pointer);
+ ecore_x_cursor_free(pointer);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/*
@@ -978,603 +978,603 @@ ee_pointer_free(Ewl_Embed *embed, int pointer)
static int
ee_pointer_get(Ewl_Embed *embed)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(embed, 0);
- DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(embed, 0);
+ DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, 0);
- DRETURN_INT(ecore_x_cursor_size_get(), DLEVEL_STABLE);
+ DRETURN_INT(ecore_x_cursor_size_get(), DLEVEL_STABLE);
}
static void
ee_pointer_set(Ewl_Embed *embed, int pointer)
{
- Ecore_X_Cursor cur;
+ Ecore_X_Cursor cur;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- if (pointer >= EWL_MOUSE_CURSOR_MAX)
- cur = pointer;
- else
- cur = ecore_x_cursor_shape_get(pointer);
- ecore_x_window_cursor_set((Ecore_X_Window)embed->canvas_window, cur);
+ if (pointer >= EWL_MOUSE_CURSOR_MAX)
+ cur = pointer;
+ else
+ cur = ecore_x_cursor_shape_get(pointer);
+ ecore_x_window_cursor_set((Ecore_X_Window)embed->canvas_window, cur);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static int
ewl_ev_x_window_expose(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- /*
- * Widgets don't need to know about this usually, but we still need to
- * let them know in case a widget is using a non-evas based draw method
- */
- Ecore_X_Event_Window_Damage *ev;
- Ewl_Event_Window_Expose event;
- Ewl_Window *window;
+ /*
+ * Widgets don't need to know about this usually, but we still need to
+ * let them know in case a widget is using a non-evas based draw method
+ */
+ Ecore_X_Event_Window_Damage *ev;
+ Ewl_Event_Window_Expose event;
+ Ewl_Window *window;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
+ ev = e;
- window = ewl_window_window_find((void *)ev->win);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->win);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- event.x = ev->x;
- event.y = ev->y;
- event.w = ev->w;
- event.h = ev->h;
+ event.x = ev->x;
+ event.y = ev->y;
+ event.w = ev->w;
+ event.h = ev->h;
- ewl_engine_canvas_damage_add(EWL_EMBED(window), ev->x, ev->y, ev->w, ev->h);
- ewl_callback_call_with_event_data(EWL_WIDGET(window), EWL_CALLBACK_EXPOSE, &event);
+ ewl_engine_canvas_damage_add(EWL_EMBED(window), ev->x, ev->y, ev->w, ev->h);
+ ewl_callback_call_with_event_data(EWL_WIDGET(window), EWL_CALLBACK_EXPOSE, &event);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_window_configure(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- /*
- * When a configure event occurs, we must update the windows geometry
- * based on the coordinates and dimensions given in the Ecore_Event.
- */
- Ecore_X_Event_Window_Configure *ev;
- Ewl_Window *window;
- Ewl_Embed *embed;
- int config = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- ev = e;
-
- embed = ewl_embed_canvas_window_find((void *)ev->win);
- if (!embed)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
-
- /*
- * Save coords and queue a configure event if the window is moved.
- */
- if ((ev->from_wm) && (ev->x != embed->x)) {
- embed->x = ev->x;
- config = 1;
- }
-
- if ((ev->from_wm) && (ev->y != embed->y)) {
- embed->y = ev->y;
- config = 1;
- }
-
- window = ewl_window_window_find((void *)ev->win);
- /*
- * we can finish when the embed is not a window
- */
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
-
- if (config)
- ewl_widget_configure(EWL_WIDGET(window));
-
- /*
- * Configure events really only need to occur on resize.
- */
- if ((ewl_object_current_w_get(EWL_OBJECT(window)) != ev->w)
- || (ewl_object_current_h_get(EWL_OBJECT(window)) != ev->h)) {
-
- /*
- * Right now this is commented out, as it was preventing windows
- * from resizing when WE were the ones setting the size
- * (mainly on initial show of the window). It would be nice to
- * add this back in to limit the # of window resizes occuring.
- * (As long as it doesn't break initial size.)
- */
- if (ev->from_wm) window->flags |= EWL_WINDOW_USER_CONFIGURE;
- ewl_object_geometry_request(EWL_OBJECT(window), 0, 0, ev->w,
- ev->h);
- }
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ /*
+ * When a configure event occurs, we must update the windows geometry
+ * based on the coordinates and dimensions given in the Ecore_Event.
+ */
+ Ecore_X_Event_Window_Configure *ev;
+ Ewl_Window *window;
+ Ewl_Embed *embed;
+ int config = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ ev = e;
+
+ embed = ewl_embed_canvas_window_find((void *)ev->win);
+ if (!embed)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+
+ /*
+ * Save coords and queue a configure event if the window is moved.
+ */
+ if ((ev->from_wm) && (ev->x != embed->x)) {
+ embed->x = ev->x;
+ config = 1;
+ }
+
+ if ((ev->from_wm) && (ev->y != embed->y)) {
+ embed->y = ev->y;
+ config = 1;
+ }
+
+ window = ewl_window_window_find((void *)ev->win);
+ /*
+ * we can finish when the embed is not a window
+ */
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+
+ if (config)
+ ewl_widget_configure(EWL_WIDGET(window));
+
+ /*
+ * Configure events really only need to occur on resize.
+ */
+ if ((ewl_object_current_w_get(EWL_OBJECT(window)) != ev->w)
+ || (ewl_object_current_h_get(EWL_OBJECT(window)) != ev->h)) {
+
+ /*
+ * Right now this is commented out, as it was preventing windows
+ * from resizing when WE were the ones setting the size
+ * (mainly on initial show of the window). It would be nice to
+ * add this back in to limit the # of window resizes occuring.
+ * (As long as it doesn't break initial size.)
+ */
+ if (ev->from_wm) window->flags |= EWL_WINDOW_USER_CONFIGURE;
+ ewl_object_geometry_request(EWL_OBJECT(window), 0, 0, ev->w,
+ ev->h);
+ }
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_window_delete(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- /*
- * Retrieve the appropriate ewl_window using the x window id that is
- * held in the eevent, and call it's handlers for a window delete event.
- */
- Ecore_X_Event_Window_Destroy *ev;
- Ewl_Window *window;
+ /*
+ * Retrieve the appropriate ewl_window using the x window id that is
+ * held in the eevent, and call it's handlers for a window delete event.
+ */
+ Ecore_X_Event_Window_Destroy *ev;
+ Ewl_Window *window;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
+ ev = e;
- window = ewl_window_window_find((void *)ev->win);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->win);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- ewl_callback_call(EWL_WIDGET(window), EWL_CALLBACK_DELETE_WINDOW);
+ ewl_callback_call(EWL_WIDGET(window), EWL_CALLBACK_DELETE_WINDOW);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_key_down(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_X_Event_Key_Down *ev;
- unsigned int key_modifiers;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- ev = e;
- window = ewl_window_window_find((void *)ev->win);
-
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
-
- key_modifiers = ewl_ev_modifiers_get();
-
- if (strstr(ev->keyname, "Shift_"))
- key_modifiers |= EWL_KEY_MODIFIER_SHIFT;
- else if (strstr(ev->keyname, "Control_"))
- key_modifiers |= EWL_KEY_MODIFIER_CTRL;
- else if (strstr(ev->keyname, "Alt_"))
- key_modifiers |= EWL_KEY_MODIFIER_ALT;
- else if (strstr(ev->keyname, "Mod_"))
- key_modifiers |= EWL_KEY_MODIFIER_MOD;
- else if (strstr(ev->keyname, "Super_"))
- key_modifiers |= EWL_KEY_MODIFIER_WIN;
- else if (strstr(ev->keyname, "Hyper_"))
- key_modifiers |= EWL_KEY_MODIFIER_WIN;
- else if (!ev->key_compose || iscntrl(*ev->key_compose))
- ewl_embed_key_down_feed(EWL_EMBED(window), ev->keyname,
- key_modifiers);
- else
- ewl_embed_key_down_feed(EWL_EMBED(window), ev->key_compose,
- key_modifiers);
-
- ewl_ev_modifiers_set(key_modifiers);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Window *window;
+ Ecore_X_Event_Key_Down *ev;
+ unsigned int key_modifiers;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ ev = e;
+ window = ewl_window_window_find((void *)ev->win);
+
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+
+ key_modifiers = ewl_ev_modifiers_get();
+
+ if (strstr(ev->keyname, "Shift_"))
+ key_modifiers |= EWL_KEY_MODIFIER_SHIFT;
+ else if (strstr(ev->keyname, "Control_"))
+ key_modifiers |= EWL_KEY_MODIFIER_CTRL;
+ else if (strstr(ev->keyname, "Alt_"))
+ key_modifiers |= EWL_KEY_MODIFIER_ALT;
+ else if (strstr(ev->keyname, "Mod_"))
+ key_modifiers |= EWL_KEY_MODIFIER_MOD;
+ else if (strstr(ev->keyname, "Super_"))
+ key_modifiers |= EWL_KEY_MODIFIER_WIN;
+ else if (strstr(ev->keyname, "Hyper_"))
+ key_modifiers |= EWL_KEY_MODIFIER_WIN;
+ else if (!ev->key_compose || iscntrl(*ev->key_compose))
+ ewl_embed_key_down_feed(EWL_EMBED(window), ev->keyname,
+ key_modifiers);
+ else
+ ewl_embed_key_down_feed(EWL_EMBED(window), ev->key_compose,
+ key_modifiers);
+
+ ewl_ev_modifiers_set(key_modifiers);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_key_up(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_X_Event_Key_Up *ev;
- unsigned int key_modifiers;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- ev = e;
-
- window = ewl_window_window_find((void *)ev->win);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
-
- key_modifiers = ewl_ev_modifiers_get();
-
- if (strstr(ev->keyname, "Shift_"))
- key_modifiers &= ~EWL_KEY_MODIFIER_SHIFT;
- else if (strstr(ev->keyname, "Control_"))
- key_modifiers &= ~EWL_KEY_MODIFIER_CTRL;
- else if (strstr(ev->keyname, "Alt_"))
- key_modifiers &= ~EWL_KEY_MODIFIER_ALT;
- else if (strstr(ev->keyname, "Mod_"))
- key_modifiers &= ~EWL_KEY_MODIFIER_MOD;
- else if (strstr(ev->keyname, "Super_"))
- key_modifiers &= ~EWL_KEY_MODIFIER_WIN;
- else if (strstr(ev->keyname, "Hyper_"))
- key_modifiers &= ~EWL_KEY_MODIFIER_WIN;
- else if (!ev->key_compose || iscntrl(*ev->key_compose))
- ewl_embed_key_up_feed(EWL_EMBED(window), ev->keyname,
- key_modifiers);
- else
- ewl_embed_key_up_feed(EWL_EMBED(window), ev->key_compose,
- key_modifiers);
-
- ewl_ev_modifiers_set(key_modifiers);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Window *window;
+ Ecore_X_Event_Key_Up *ev;
+ unsigned int key_modifiers;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ ev = e;
+
+ window = ewl_window_window_find((void *)ev->win);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+
+ key_modifiers = ewl_ev_modifiers_get();
+
+ if (strstr(ev->keyname, "Shift_"))
+ key_modifiers &= ~EWL_KEY_MODIFIER_SHIFT;
+ else if (strstr(ev->keyname, "Control_"))
+ key_modifiers &= ~EWL_KEY_MODIFIER_CTRL;
+ else if (strstr(ev->keyname, "Alt_"))
+ key_modifiers &= ~EWL_KEY_MODIFIER_ALT;
+ else if (strstr(ev->keyname, "Mod_"))
+ key_modifiers &= ~EWL_KEY_MODIFIER_MOD;
+ else if (strstr(ev->keyname, "Super_"))
+ key_modifiers &= ~EWL_KEY_MODIFIER_WIN;
+ else if (strstr(ev->keyname, "Hyper_"))
+ key_modifiers &= ~EWL_KEY_MODIFIER_WIN;
+ else if (!ev->key_compose || iscntrl(*ev->key_compose))
+ ewl_embed_key_up_feed(EWL_EMBED(window), ev->keyname,
+ key_modifiers);
+ else
+ ewl_embed_key_up_feed(EWL_EMBED(window), ev->key_compose,
+ key_modifiers);
+
+ ewl_ev_modifiers_set(key_modifiers);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- int clicks = 1;
- Ewl_Window *window;
- Ecore_X_Event_Mouse_Button_Down *ev;
- unsigned int key_modifiers;
+ int clicks = 1;
+ Ewl_Window *window;
+ Ecore_X_Event_Mouse_Button_Down *ev;
+ unsigned int key_modifiers;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
+ ev = e;
- window = ewl_window_window_find((void *)ev->win);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->win);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- if (ev->double_click)
- clicks = 2;
- if (ev->triple_click)
- clicks = 3;
+ if (ev->double_click)
+ clicks = 2;
+ if (ev->triple_click)
+ clicks = 3;
- key_modifiers = ewl_ev_modifiers_get();
- ewl_embed_mouse_down_feed(EWL_EMBED(window), ev->button, clicks,
- ev->x, ev->y, key_modifiers);
+ key_modifiers = ewl_ev_modifiers_get();
+ ewl_embed_mouse_down_feed(EWL_EMBED(window), ev->button, clicks,
+ ev->x, ev->y, key_modifiers);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_X_Event_Mouse_Button_Up *ev;
- unsigned int key_modifiers;
+ Ewl_Window *window;
+ Ecore_X_Event_Mouse_Button_Up *ev;
+ unsigned int key_modifiers;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
+ ev = e;
- window = ewl_window_window_find((void *)ev->win);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->win);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- key_modifiers = ewl_ev_modifiers_get();
+ key_modifiers = ewl_ev_modifiers_get();
- ewl_embed_mouse_up_feed(EWL_EMBED(window), ev->button, ev->x,
- ev->y, key_modifiers);
+ ewl_embed_mouse_up_feed(EWL_EMBED(window), ev->button, ev->x,
+ ev->y, key_modifiers);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_X_Event_Mouse_Move *ev;
- unsigned int key_modifiers;
+ Ewl_Window *window;
+ Ecore_X_Event_Mouse_Move *ev;
+ unsigned int key_modifiers;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
+ ev = e;
- window = ewl_window_window_find((void *)ev->win);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->win);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- key_modifiers = ewl_ev_modifiers_get();
- ewl_embed_mouse_move_feed(EWL_EMBED(window), ev->x, ev->y,
- key_modifiers);
+ key_modifiers = ewl_ev_modifiers_get();
+ ewl_embed_mouse_move_feed(EWL_EMBED(window), ev->x, ev->y,
+ key_modifiers);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_X_Event_Mouse_Out *ev = e;
- unsigned int key_modifiers;
+ Ewl_Window *window;
+ Ecore_X_Event_Mouse_Out *ev = e;
+ unsigned int key_modifiers;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- window = ewl_window_window_find((void *)ev->win);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->win);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- key_modifiers = ewl_ev_modifiers_get();
- ewl_embed_mouse_out_feed(EWL_EMBED(window), ev->x, ev->y,
- key_modifiers);
+ key_modifiers = ewl_ev_modifiers_get();
+ ewl_embed_mouse_out_feed(EWL_EMBED(window), ev->x, ev->y,
+ key_modifiers);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_X_Event_Mouse_Wheel *ev = e;
- unsigned int key_modifiers;
+ Ewl_Window *window;
+ Ecore_X_Event_Mouse_Wheel *ev = e;
+ unsigned int key_modifiers;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- window = ewl_window_window_find((void *)ev->win);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->win);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- key_modifiers = ewl_ev_modifiers_get();
- ewl_embed_mouse_wheel_feed(EWL_EMBED(window), ev->x, ev->y,
- ev->z, ev->direction, key_modifiers);
+ key_modifiers = ewl_ev_modifiers_get();
+ ewl_embed_mouse_wheel_feed(EWL_EMBED(window), ev->x, ev->y,
+ ev->z, ev->direction, key_modifiers);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_focus_in(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_X_Event_Window_Focus_In *ev = e;
+ Ewl_Window *window;
+ Ecore_X_Event_Window_Focus_In *ev = e;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- window = ewl_window_window_find((void *)ev->win);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->win);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- ewl_callback_call(EWL_WIDGET(window), EWL_CALLBACK_FOCUS_IN);
+ ewl_callback_call(EWL_WIDGET(window), EWL_CALLBACK_FOCUS_IN);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_focus_out(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_X_Event_Window_Focus_Out *ev = e;
+ Ewl_Window *window;
+ Ecore_X_Event_Window_Focus_Out *ev = e;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- window = ewl_window_window_find((void *)ev->win);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->win);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- ewl_callback_call(EWL_WIDGET(window), EWL_CALLBACK_FOCUS_OUT);
+ ewl_callback_call(EWL_WIDGET(window), EWL_CALLBACK_FOCUS_OUT);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_data_received(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ecore_X_Event_Selection_Notify *ev;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(e, FALSE);
-
- ev = e;
-
- /* Handle everything *except* XDND selection */
- if (ev->selection != ECORE_X_SELECTION_XDND)
- printf("Paste event received\n");
-
- else
- {
- Ewl_Embed *embed;
- Ecore_X_Selection_Data *data = ev->data;
-
- embed = ewl_embed_canvas_window_find((void *)ev->win);
- if (embed)
- {
- if (data->content == ECORE_X_SELECTION_CONTENT_FILES)
- {
- Ecore_X_Selection_Data_Files *files = ev->data;
- ewl_embed_dnd_data_received_feed(embed,
- ev->target,
- files->files,
- files->num_files,
- data->format);
- }
- else if (data->content == ECORE_X_SELECTION_CONTENT_TEXT)
- {
- Ecore_X_Selection_Data_Text *text = ev->data;
- ewl_embed_dnd_data_received_feed(embed,
- ev->target, text->text,
- data->length,
- data->format);
- }
- else
- {
- ewl_embed_dnd_data_received_feed(embed,
- ev->target, data->data,
- data->length,
- data->format);
- }
- }
-
- ecore_x_dnd_send_finished();
- }
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ecore_X_Event_Selection_Notify *ev;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(e, FALSE);
+
+ ev = e;
+
+ /* Handle everything *except* XDND selection */
+ if (ev->selection != ECORE_X_SELECTION_XDND)
+ printf("Paste event received\n");
+
+ else
+ {
+ Ewl_Embed *embed;
+ Ecore_X_Selection_Data *data = ev->data;
+
+ embed = ewl_embed_canvas_window_find((void *)ev->win);
+ if (embed)
+ {
+ if (data->content == ECORE_X_SELECTION_CONTENT_FILES)
+ {
+ Ecore_X_Selection_Data_Files *files = ev->data;
+ ewl_embed_dnd_data_received_feed(embed,
+ ev->target,
+ files->files,
+ files->num_files,
+ data->format);
+ }
+ else if (data->content == ECORE_X_SELECTION_CONTENT_TEXT)
+ {
+ Ecore_X_Selection_Data_Text *text = ev->data;
+ ewl_embed_dnd_data_received_feed(embed,
+ ev->target, text->text,
+ data->length,
+ data->format);
+ }
+ else
+ {
+ ewl_embed_dnd_data_received_feed(embed,
+ ev->target, data->data,
+ data->length,
+ data->format);
+ }
+ }
+
+ ecore_x_dnd_send_finished();
+ }
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_data_request(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ecore_X_Event_Selection_Request *ev;
+ Ecore_X_Event_Selection_Request *ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(e, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(e, FALSE);
- ev = e;
+ ev = e;
- /* Handle everything *except* XDND selection */
- if (ev->selection != ECORE_X_ATOM_SELECTION_XDND)
- {
- char *rec, *dnd;
+ /* Handle everything *except* XDND selection */
+ if (ev->selection != ECORE_X_ATOM_SELECTION_XDND)
+ {
+ char *rec, *dnd;
- rec = XGetAtomName(ecore_x_display_get(), ev->selection);
- dnd = XGetAtomName(ecore_x_display_get(), ECORE_X_ATOM_SELECTION_XDND);
- printf("Data request event received: %s not %s\n", rec, dnd);
- XFree(rec);
- XFree(dnd);
- }
+ rec = XGetAtomName(ecore_x_display_get(), ev->selection);
+ dnd = XGetAtomName(ecore_x_display_get(), ECORE_X_ATOM_SELECTION_XDND);
+ printf("Data request event received: %s not %s\n", rec, dnd);
+ XFree(rec);
+ XFree(dnd);
+ }
- else if (ev->selection == ECORE_X_ATOM_SELECTION_XDND)
- {
- Ewl_Embed *embed;
- char *atom;
+ else if (ev->selection == ECORE_X_ATOM_SELECTION_XDND)
+ {
+ Ewl_Embed *embed;
+ char *atom;
- embed = ewl_embed_canvas_window_find((void *)ev->owner);
- atom = XGetAtomName(ecore_x_display_get(), ev->target);
- ewl_embed_dnd_data_request_feed(embed, ev, atom);
- XFree(atom);
- }
+ embed = ewl_embed_canvas_window_find((void *)ev->owner);
+ atom = XGetAtomName(ecore_x_display_get(), ev->target);
+ ewl_embed_dnd_data_request_feed(embed, ev, atom);
+ XFree(atom);
+ }
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_dnd_position(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_X_Event_Xdnd_Position *ev;
- int x, y, wx, wy;
- int px, py, pw, ph;
- Ecore_X_Rectangle rect;
- int will_accept = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(e, FALSE);
-
- ev = e;
-
- window = ewl_window_window_find((void *)ev->win);
- if (window) {
- Ewl_Embed *embed;
-
- ewl_embed_window_position_get(EWL_EMBED(window), &wx, &wy);
- x = ev->position.x - wx;
- y = ev->position.y - wy;
-
- /*
- * Look for the child here
- */
- embed = ewl_embed_canvas_window_find((void *)ev->win);
- if (embed) {
- /* First see if we need to send an 'enter'
- * to the widget */
- if (ewl_embed_dnd_position_feed(embed, x, y, &px,
- &py, &pw, &ph))
- will_accept = 1;
-
- if (embed->last.drop_widget) {
- rect.x = px;
- rect.y = py;
- rect.width = pw;
- rect.height = ph;
- } else {
- rect.x = 0;
- rect.y = 0;
- rect.width = 0;
- rect.height = 0;
- }
-
- /* Don't send status for windows we don't own */
- ecore_x_dnd_send_status(will_accept, 0, rect, ECORE_X_DND_ACTION_PRIVATE);
- }
- }
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Window *window;
+ Ecore_X_Event_Xdnd_Position *ev;
+ int x, y, wx, wy;
+ int px, py, pw, ph;
+ Ecore_X_Rectangle rect;
+ int will_accept = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(e, FALSE);
+
+ ev = e;
+
+ window = ewl_window_window_find((void *)ev->win);
+ if (window) {
+ Ewl_Embed *embed;
+
+ ewl_embed_window_position_get(EWL_EMBED(window), &wx, &wy);
+ x = ev->position.x - wx;
+ y = ev->position.y - wy;
+
+ /*
+ * Look for the child here
+ */
+ embed = ewl_embed_canvas_window_find((void *)ev->win);
+ if (embed) {
+ /* First see if we need to send an 'enter'
+ * to the widget */
+ if (ewl_embed_dnd_position_feed(embed, x, y, &px,
+ &py, &pw, &ph))
+ will_accept = 1;
+
+ if (embed->last.drop_widget) {
+ rect.x = px;
+ rect.y = py;
+ rect.width = pw;
+ rect.height = ph;
+ } else {
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = 0;
+ rect.height = 0;
+ }
+
+ /* Don't send status for windows we don't own */
+ ecore_x_dnd_send_status(will_accept, 0, rect, ECORE_X_DND_ACTION_PRIVATE);
+ }
+ }
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_dnd_enter(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Embed *embed;
- Ecore_X_Event_Xdnd_Enter *ev;
- int i = 0;
+ Ewl_Embed *embed;
+ Ecore_X_Event_Xdnd_Enter *ev;
+ int i = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(e, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(e, FALSE);
- ev = e;
+ ev = e;
- embed = ewl_embed_canvas_window_find((void *)ev->win);
- if (embed) {
- embed->dnd_types.num_types = ev->num_types;
- embed->dnd_types.types = malloc(sizeof(char*) * ev->num_types);
+ embed = ewl_embed_canvas_window_find((void *)ev->win);
+ if (embed) {
+ embed->dnd_types.num_types = ev->num_types;
+ embed->dnd_types.types = malloc(sizeof(char*) * ev->num_types);
- for (i = 0; i < ev->num_types; i++)
- embed->dnd_types.types[i] = strdup(ev->types[i]);
- }
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ for (i = 0; i < ev->num_types; i++)
+ embed->dnd_types.types[i] = strdup(ev->types[i]);
+ }
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_dnd_leave(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Embed *embed;
- Ecore_X_Event_Xdnd_Leave *ev;
- int i;
+ Ewl_Embed *embed;
+ Ecore_X_Event_Xdnd_Leave *ev;
+ int i;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(e, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(e, FALSE);
- ev = e;
+ ev = e;
- embed = ewl_embed_canvas_window_find((void *)ev->win);
- if (embed) {
- if (embed->dnd_types.num_types > 0) {
- for (i = 0; i < embed->dnd_types.num_types; i++)
- FREE(embed->dnd_types.types[i]);
+ embed = ewl_embed_canvas_window_find((void *)ev->win);
+ if (embed) {
+ if (embed->dnd_types.num_types > 0) {
+ for (i = 0; i < embed->dnd_types.num_types; i++)
+ FREE(embed->dnd_types.types[i]);
- FREE(embed->dnd_types.types);
- embed->dnd_types.types = NULL;
- embed->dnd_types.num_types = 0;
+ FREE(embed->dnd_types.types);
+ embed->dnd_types.types = NULL;
+ embed->dnd_types.num_types = 0;
- }
- }
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ }
+ }
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_dnd_drop(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Embed *embed;
- Ecore_X_Event_Xdnd_Drop *ev;
- int internal = 0;
+ Ewl_Embed *embed;
+ Ecore_X_Event_Xdnd_Drop *ev;
+ int internal = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(e, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(e, FALSE);
- ev = e;
+ ev = e;
- embed = ewl_embed_canvas_window_find((void *)ev->win);
- if (embed) {
- int x, y, wx, wy;
- const char *type;
+ embed = ewl_embed_canvas_window_find((void *)ev->win);
+ if (embed) {
+ int x, y, wx, wy;
+ const char *type;
- ewl_embed_window_position_get(embed, &wx, &wy);
+ ewl_embed_window_position_get(embed, &wx, &wy);
- if (ev->source == (Ecore_X_Window)embed->canvas_window)
- internal = 1;
+ if (ev->source == (Ecore_X_Window)embed->canvas_window)
+ internal = 1;
- x = ev->position.x - wx;
- y = ev->position.y - wy;
+ x = ev->position.x - wx;
+ y = ev->position.y - wy;
- type = ewl_embed_dnd_drop_feed(embed, x, y, internal);
- if (type)
- ecore_x_selection_xdnd_request(ev->win, (char *)type);
- }
+ type = ewl_embed_dnd_drop_feed(embed, x, y, internal);
+ if (type)
+ ecore_x_selection_xdnd_request(ev->win, (char *)type);
+ }
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
diff --git a/src/engines/xcb/Ewl_Engine_Xcb.h b/src/engines/xcb/Ewl_Engine_Xcb.h
index 1ba68a4..ca40e6f 100644
--- a/src/engines/xcb/Ewl_Engine_Xcb.h
+++ b/src/engines/xcb/Ewl_Engine_Xcb.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_ENGINE_XCB_H
#define EWL_ENGINE_XCB_H
@@ -10,7 +10,7 @@
typedef struct Ewl_Engine_Xcb Ewl_Engine_Xcb;
struct Ewl_Engine_Xcb
{
- Ewl_Engine engine;
+ Ewl_Engine engine;
};
#endif
diff --git a/src/engines/xcb/ewl_engine_xcb.c b/src/engines/xcb/ewl_engine_xcb.c
index 5e5595a..1ec2391 100644
--- a/src/engines/xcb/ewl_engine_xcb.c
+++ b/src/engines/xcb/ewl_engine_xcb.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include <Ewl_Engine_Xcb.h>
#include "ewl_private.h"
#include "ewl_macros.h"
@@ -69,8 +69,8 @@ static void ee_window_dialog_set(Ewl_Window *win);
static void ee_window_states_set(Ewl_Window *win);
static void ee_window_state_request(Ewl_Window *win, int states);
static void ee_window_state_handle(Ewl_Window *win, int states,
- Ewl_Window_Flags ewl_flag,
- Ecore_X_Window_State ecore_flag);
+ Ewl_Window_Flags ewl_flag,
+ Ecore_X_Window_State ecore_flag);
static void ee_window_states_set_helper(Ewl_Window *win);
static void ee_window_hints_set(Ewl_Window *win);
static void ee_window_transient_for(Ewl_Window *win);
@@ -96,889 +96,889 @@ static void ee_pointer_set(Ewl_Embed *embed, int pointer);
static int ee_pointer_get(Ewl_Embed *embed);
static void *window_funcs[EWL_ENGINE_WINDOW_MAX] =
- {
- ee_window_new,
- ee_window_destroy,
- ee_window_move,
- ee_window_resize,
- ee_window_min_max_size_set,
- ee_window_show,
- ee_window_hide,
- ee_window_title_set,
- ee_window_name_class_set,
- ee_window_borderless_set,
- ee_window_dialog_set,
- ee_window_states_set,
- ee_window_hints_set,
- ee_window_transient_for,
- ee_window_leader_set,
- ee_window_raise,
- ee_window_lower,
- ee_keyboard_grab,
- ee_keyboard_ungrab,
- ee_pointer_grab,
- ee_pointer_ungrab,
- ee_window_selection_text_set,
- ee_window_geometry_set,
- ee_dnd_aware_set,
- ee_desktop_size_get,
- ee_dnd_drag_types_set,
- ee_dnd_drag_begin,
- ee_dnd_drag_drop,
- ee_dnd_drag_data_send,
- };
+ {
+ ee_window_new,
+ ee_window_destroy,
+ ee_window_move,
+ ee_window_resize,
+ ee_window_min_max_size_set,
+ ee_window_show,
+ ee_window_hide,
+ ee_window_title_set,
+ ee_window_name_class_set,
+ ee_window_borderless_set,
+ ee_window_dialog_set,
+ ee_window_states_set,
+ ee_window_hints_set,
+ ee_window_transient_for,
+ ee_window_leader_set,
+ ee_window_raise,
+ ee_window_lower,
+ ee_keyboard_grab,
+ ee_keyboard_ungrab,
+ ee_pointer_grab,
+ ee_pointer_ungrab,
+ ee_window_selection_text_set,
+ ee_window_geometry_set,
+ ee_dnd_aware_set,
+ ee_desktop_size_get,
+ ee_dnd_drag_types_set,
+ ee_dnd_drag_begin,
+ ee_dnd_drag_drop,
+ ee_dnd_drag_data_send,
+ };
static void *pointer_funcs[EWL_ENGINE_POINTER_MAX] =
- {
- ee_pointer_data_new,
- ee_pointer_free,
- ee_pointer_get,
- ee_pointer_set,
- };
+ {
+ ee_pointer_data_new,
+ ee_pointer_free,
+ ee_pointer_get,
+ ee_pointer_set,
+ };
Ecore_DList *
ewl_engine_dependancies(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
}
Ewl_Engine *
ewl_engine_create(int *argc, char ** argv)
{
- Ewl_Engine_Xcb *engine;
+ Ewl_Engine_Xcb *engine;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- engine = NEW(Ewl_Engine_Xcb, 1);
- if (!engine)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ engine = NEW(Ewl_Engine_Xcb, 1);
+ if (!engine)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ee_init(EWL_ENGINE(engine), argc, argv))
- {
- FREE(engine);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ee_init(EWL_ENGINE(engine), argc, argv))
+ {
+ FREE(engine);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_ENGINE(engine), DLEVEL_STABLE);
}
static int
ee_init(Ewl_Engine *engine, int *argc, char ** argv)
{
- Ewl_Engine_Info *info;
- char *display = NULL;
- int i;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(engine, FALSE);
-
- /* If the event handlers are already setup don't do it again */
- if (ee_expose_handler)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
-
- if (argc && argv)
- {
- for (i = 1; i < *argc; i++)
- {
- if (!strcmp(argv[i], "-display"))
- {
- if (++i < *argc)
- display = argv[i];
- }
- }
- }
-
- if (!ecore_x_init(display))
- {
- fprintf(stderr, "Unable to initialize Ecore X.\n"
- "Is your DISPLAY variable set correctly?\n\n");
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
-
- ee_expose_handler = ecore_event_handler_add(
- ECORE_X_EVENT_WINDOW_DAMAGE,
- ewl_ev_x_window_expose, NULL);
- ee_configure_handler = ecore_event_handler_add(
- ECORE_X_EVENT_WINDOW_CONFIGURE,
- ewl_ev_x_window_configure, NULL);
- ee_delete_request_handler = ecore_event_handler_add(
- ECORE_X_EVENT_WINDOW_DELETE_REQUEST,
- ewl_ev_x_window_delete, NULL);
-
- /*
- * Register dispatching functions for keyboard events.
- */
- ee_key_down_handler = ecore_event_handler_add(
- ECORE_X_EVENT_KEY_DOWN,
- ewl_ev_x_key_down, NULL);
- ee_key_up_handler = ecore_event_handler_add(
- ECORE_X_EVENT_KEY_UP,
- ewl_ev_x_key_up, NULL);
-
- /*
- * Register dispatching functions for DND events
- */
- ee_dnd_position_handler = ecore_event_handler_add(
- ECORE_X_EVENT_XDND_POSITION,
- ewl_ev_dnd_position, NULL);
- ee_dnd_enter_handler = ecore_event_handler_add(
- ECORE_X_EVENT_XDND_ENTER,
- ewl_ev_dnd_enter, NULL);
- ee_dnd_leave_handler = ecore_event_handler_add(
- ECORE_X_EVENT_XDND_LEAVE,
- ewl_ev_dnd_leave, NULL);
- ee_dnd_drop_handler = ecore_event_handler_add(
- ECORE_X_EVENT_XDND_DROP,
- ewl_ev_dnd_drop, NULL);
-
- /*
- * Selection callbacks to allow for data transfers.
- */
- ee_selection_notify_handler = ecore_event_handler_add(
- ECORE_X_EVENT_SELECTION_NOTIFY,
- ewl_ev_x_data_received, NULL);
-
- /*
- * Selection callbacks to allow for pasting.
- */
- ee_selection_request_handler = ecore_event_handler_add(
- ECORE_X_EVENT_SELECTION_REQUEST,
- ewl_ev_x_data_request, NULL);
-
- /*
- * Finally, register dispatching functions for mouse events.
- */
- ee_mouse_down_handler = ecore_event_handler_add(
- ECORE_X_EVENT_MOUSE_BUTTON_DOWN,
- ewl_ev_x_mouse_down, NULL);
- ee_mouse_up_handler = ecore_event_handler_add(
- ECORE_X_EVENT_MOUSE_BUTTON_UP,
- ewl_ev_x_mouse_up, NULL);
- ee_mouse_move_handler = ecore_event_handler_add(
- ECORE_X_EVENT_MOUSE_MOVE,
- ewl_ev_x_mouse_move, NULL);
- ee_mouse_wheel_handler = ecore_event_handler_add(
- ECORE_X_EVENT_MOUSE_WHEEL,
- ewl_ev_x_mouse_wheel, NULL);
- ee_mouse_out_handler = ecore_event_handler_add(
- ECORE_X_EVENT_MOUSE_OUT,
- ewl_ev_x_mouse_out, NULL);
- ee_focus_in_handler = ecore_event_handler_add(
- ECORE_X_EVENT_WINDOW_FOCUS_IN,
- ewl_ev_x_focus_in, NULL);
- ee_focus_out_handler = ecore_event_handler_add(
- ECORE_X_EVENT_WINDOW_FOCUS_OUT,
- ewl_ev_x_focus_out, NULL);
-
- if (!ee_expose_handler || !ee_configure_handler
- || !ee_delete_request_handler
- || !ee_key_down_handler || !ee_key_up_handler
- || !ee_dnd_position_handler || !ee_dnd_enter_handler
- || !ee_dnd_leave_handler || !ee_dnd_drop_handler
- || !ee_selection_notify_handler || !ee_selection_request_handler
- || !ee_mouse_down_handler
- || !ee_mouse_up_handler || !ee_mouse_move_handler
- || !ee_mouse_wheel_handler || !ee_mouse_out_handler
- || !ee_focus_in_handler || !ee_focus_out_handler)
- {
- ee_shutdown(EWL_ENGINE(engine));
-
- fprintf(stderr, "Unable to create Ecore X event handlers.\n");
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
-
- info = NEW(Ewl_Engine_Info, 1);
- info->shutdown = ee_shutdown;
- info->hooks.window = window_funcs;
- info->hooks.pointer = pointer_funcs;
-
- engine->functions = info;
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Engine_Info *info;
+ char *display = NULL;
+ int i;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(engine, FALSE);
+
+ /* If the event handlers are already setup don't do it again */
+ if (ee_expose_handler)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+
+ if (argc && argv)
+ {
+ for (i = 1; i < *argc; i++)
+ {
+ if (!strcmp(argv[i], "-display"))
+ {
+ if (++i < *argc)
+ display = argv[i];
+ }
+ }
+ }
+
+ if (!ecore_x_init(display))
+ {
+ fprintf(stderr, "Unable to initialize Ecore X.\n"
+ "Is your DISPLAY variable set correctly?\n\n");
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+
+ ee_expose_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_WINDOW_DAMAGE,
+ ewl_ev_x_window_expose, NULL);
+ ee_configure_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_WINDOW_CONFIGURE,
+ ewl_ev_x_window_configure, NULL);
+ ee_delete_request_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_WINDOW_DELETE_REQUEST,
+ ewl_ev_x_window_delete, NULL);
+
+ /*
+ * Register dispatching functions for keyboard events.
+ */
+ ee_key_down_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_KEY_DOWN,
+ ewl_ev_x_key_down, NULL);
+ ee_key_up_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_KEY_UP,
+ ewl_ev_x_key_up, NULL);
+
+ /*
+ * Register dispatching functions for DND events
+ */
+ ee_dnd_position_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_XDND_POSITION,
+ ewl_ev_dnd_position, NULL);
+ ee_dnd_enter_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_XDND_ENTER,
+ ewl_ev_dnd_enter, NULL);
+ ee_dnd_leave_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_XDND_LEAVE,
+ ewl_ev_dnd_leave, NULL);
+ ee_dnd_drop_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_XDND_DROP,
+ ewl_ev_dnd_drop, NULL);
+
+ /*
+ * Selection callbacks to allow for data transfers.
+ */
+ ee_selection_notify_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_SELECTION_NOTIFY,
+ ewl_ev_x_data_received, NULL);
+
+ /*
+ * Selection callbacks to allow for pasting.
+ */
+ ee_selection_request_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_SELECTION_REQUEST,
+ ewl_ev_x_data_request, NULL);
+
+ /*
+ * Finally, register dispatching functions for mouse events.
+ */
+ ee_mouse_down_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_MOUSE_BUTTON_DOWN,
+ ewl_ev_x_mouse_down, NULL);
+ ee_mouse_up_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_MOUSE_BUTTON_UP,
+ ewl_ev_x_mouse_up, NULL);
+ ee_mouse_move_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_MOUSE_MOVE,
+ ewl_ev_x_mouse_move, NULL);
+ ee_mouse_wheel_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_MOUSE_WHEEL,
+ ewl_ev_x_mouse_wheel, NULL);
+ ee_mouse_out_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_MOUSE_OUT,
+ ewl_ev_x_mouse_out, NULL);
+ ee_focus_in_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_WINDOW_FOCUS_IN,
+ ewl_ev_x_focus_in, NULL);
+ ee_focus_out_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_WINDOW_FOCUS_OUT,
+ ewl_ev_x_focus_out, NULL);
+
+ if (!ee_expose_handler || !ee_configure_handler
+ || !ee_delete_request_handler
+ || !ee_key_down_handler || !ee_key_up_handler
+ || !ee_dnd_position_handler || !ee_dnd_enter_handler
+ || !ee_dnd_leave_handler || !ee_dnd_drop_handler
+ || !ee_selection_notify_handler || !ee_selection_request_handler
+ || !ee_mouse_down_handler
+ || !ee_mouse_up_handler || !ee_mouse_move_handler
+ || !ee_mouse_wheel_handler || !ee_mouse_out_handler
+ || !ee_focus_in_handler || !ee_focus_out_handler)
+ {
+ ee_shutdown(EWL_ENGINE(engine));
+
+ fprintf(stderr, "Unable to create Ecore X event handlers.\n");
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+
+ info = NEW(Ewl_Engine_Info, 1);
+ info->shutdown = ee_shutdown;
+ info->hooks.window = window_funcs;
+ info->hooks.pointer = pointer_funcs;
+
+ engine->functions = info;
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static void
ee_shutdown(Ewl_Engine *engine)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(engine);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(engine);
- if (ee_expose_handler)
- ecore_event_handler_del(ee_expose_handler);
- ee_expose_handler = NULL;
+ if (ee_expose_handler)
+ ecore_event_handler_del(ee_expose_handler);
+ ee_expose_handler = NULL;
- if (ee_configure_handler)
- ecore_event_handler_del(ee_configure_handler);
- ee_configure_handler = NULL;
+ if (ee_configure_handler)
+ ecore_event_handler_del(ee_configure_handler);
+ ee_configure_handler = NULL;
- if (ee_delete_request_handler)
- ecore_event_handler_del(ee_delete_request_handler);
- ee_delete_request_handler = NULL;
+ if (ee_delete_request_handler)
+ ecore_event_handler_del(ee_delete_request_handler);
+ ee_delete_request_handler = NULL;
- if (ee_key_down_handler)
- ecore_event_handler_del(ee_key_down_handler);
- ee_key_down_handler = NULL;
+ if (ee_key_down_handler)
+ ecore_event_handler_del(ee_key_down_handler);
+ ee_key_down_handler = NULL;
- if (ee_key_up_handler)
- ecore_event_handler_del(ee_key_up_handler);
- ee_key_up_handler = NULL;
+ if (ee_key_up_handler)
+ ecore_event_handler_del(ee_key_up_handler);
+ ee_key_up_handler = NULL;
- if (ee_dnd_position_handler)
- ecore_event_handler_del(ee_dnd_position_handler);
- ee_dnd_position_handler = NULL;
+ if (ee_dnd_position_handler)
+ ecore_event_handler_del(ee_dnd_position_handler);
+ ee_dnd_position_handler = NULL;
- if (ee_dnd_enter_handler)
- ecore_event_handler_del(ee_dnd_enter_handler);
- ee_dnd_enter_handler = NULL;
+ if (ee_dnd_enter_handler)
+ ecore_event_handler_del(ee_dnd_enter_handler);
+ ee_dnd_enter_handler = NULL;
- if (ee_dnd_leave_handler)
- ecore_event_handler_del(ee_dnd_leave_handler);
- ee_dnd_leave_handler = NULL;
+ if (ee_dnd_leave_handler)
+ ecore_event_handler_del(ee_dnd_leave_handler);
+ ee_dnd_leave_handler = NULL;
- if (ee_dnd_drop_handler)
- ecore_event_handler_del(ee_dnd_drop_handler);
- ee_dnd_drop_handler = NULL;
+ if (ee_dnd_drop_handler)
+ ecore_event_handler_del(ee_dnd_drop_handler);
+ ee_dnd_drop_handler = NULL;
- if (ee_selection_notify_handler)
- ecore_event_handler_del(ee_selection_notify_handler);
- ee_selection_notify_handler = NULL;
+ if (ee_selection_notify_handler)
+ ecore_event_handler_del(ee_selection_notify_handler);
+ ee_selection_notify_handler = NULL;
- if (ee_selection_request_handler)
- ecore_event_handler_del(ee_selection_request_handler);
- ee_selection_request_handler = NULL;
+ if (ee_selection_request_handler)
+ ecore_event_handler_del(ee_selection_request_handler);
+ ee_selection_request_handler = NULL;
- if (ee_mouse_down_handler)
- ecore_event_handler_del(ee_mouse_down_handler);
- ee_mouse_down_handler = NULL;
+ if (ee_mouse_down_handler)
+ ecore_event_handler_del(ee_mouse_down_handler);
+ ee_mouse_down_handler = NULL;
- if (ee_mouse_up_handler)
- ecore_event_handler_del(ee_mouse_up_handler);
- ee_mouse_up_handler = NULL;
+ if (ee_mouse_up_handler)
+ ecore_event_handler_del(ee_mouse_up_handler);
+ ee_mouse_up_handler = NULL;
- if (ee_mouse_move_handler)
- ecore_event_handler_del(ee_mouse_move_handler);
- ee_mouse_move_handler = NULL;
+ if (ee_mouse_move_handler)
+ ecore_event_handler_del(ee_mouse_move_handler);
+ ee_mouse_move_handler = NULL;
- if (ee_mouse_wheel_handler)
- ecore_event_handler_del(ee_mouse_wheel_handler);
- ee_mouse_wheel_handler = NULL;
+ if (ee_mouse_wheel_handler)
+ ecore_event_handler_del(ee_mouse_wheel_handler);
+ ee_mouse_wheel_handler = NULL;
- if (ee_mouse_out_handler)
- ecore_event_handler_del(ee_mouse_out_handler);
- ee_mouse_out_handler = NULL;
+ if (ee_mouse_out_handler)
+ ecore_event_handler_del(ee_mouse_out_handler);
+ ee_mouse_out_handler = NULL;
- if (ee_focus_in_handler)
- ecore_event_handler_del(ee_focus_in_handler);
- ee_focus_in_handler = NULL;
+ if (ee_focus_in_handler)
+ ecore_event_handler_del(ee_focus_in_handler);
+ ee_focus_in_handler = NULL;
- if (ee_focus_out_handler)
- ecore_event_handler_del(ee_focus_out_handler);
- ee_focus_out_handler = NULL;
+ if (ee_focus_out_handler)
+ ecore_event_handler_del(ee_focus_out_handler);
+ ee_focus_out_handler = NULL;
- ecore_x_shutdown();
+ ecore_x_shutdown();
- IF_FREE(engine->functions);
+ IF_FREE(engine->functions);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_new(Ewl_Window *win)
{
- Ecore_X_Window xwin;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
-
- if (win->flags & EWL_WINDOW_OVERRIDE)
- xwin = ecore_x_window_override_new(0,
- EWL_EMBED(win)->x, EWL_EMBED(win)->y,
- ewl_object_current_w_get(EWL_OBJECT(win)),
- ewl_object_current_h_get(EWL_OBJECT(win)));
- else
- xwin = ecore_x_window_new(0,
- EWL_EMBED(win)->x, EWL_EMBED(win)->y,
- ewl_object_current_w_get(EWL_OBJECT(win)),
- ewl_object_current_h_get(EWL_OBJECT(win)));
-
- ecore_x_icccm_protocol_get_prefetch(xwin);
- ecore_x_icccm_protocol_get_fetch();
- ecore_x_icccm_protocol_set(xwin, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, 1);
- win->window = (void *)(long)xwin;
-
- if (win->flags & EWL_WINDOW_BORDERLESS)
- ee_window_borderless_set(win);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ecore_X_Window xwin;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+
+ if (win->flags & EWL_WINDOW_OVERRIDE)
+ xwin = ecore_x_window_override_new(0,
+ EWL_EMBED(win)->x, EWL_EMBED(win)->y,
+ ewl_object_current_w_get(EWL_OBJECT(win)),
+ ewl_object_current_h_get(EWL_OBJECT(win)));
+ else
+ xwin = ecore_x_window_new(0,
+ EWL_EMBED(win)->x, EWL_EMBED(win)->y,
+ ewl_object_current_w_get(EWL_OBJECT(win)),
+ ewl_object_current_h_get(EWL_OBJECT(win)));
+
+ ecore_x_icccm_protocol_get_prefetch(xwin);
+ ecore_x_icccm_protocol_get_fetch();
+ ecore_x_icccm_protocol_set(xwin, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, 1);
+ win->window = (void *)(long)xwin;
+
+ if (win->flags & EWL_WINDOW_BORDERLESS)
+ ee_window_borderless_set(win);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_destroy(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ee_window_hide(win);
- ecore_x_window_del((Ecore_X_Window)(EWL_EMBED(win)->canvas_window));
- ecore_x_window_del((Ecore_X_Window)(win->window));
+ ee_window_hide(win);
+ ecore_x_window_del((Ecore_X_Window)(EWL_EMBED(win)->canvas_window));
+ ecore_x_window_del((Ecore_X_Window)(win->window));
- EWL_EMBED(win)->canvas_window = NULL;
- win->window = NULL;
+ EWL_EMBED(win)->canvas_window = NULL;
+ win->window = NULL;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_move(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_x_window_move((Ecore_X_Window)win->window,
- EWL_EMBED(win)->x,
- EWL_EMBED(win)->y);
+ ecore_x_window_move((Ecore_X_Window)win->window,
+ EWL_EMBED(win)->x,
+ EWL_EMBED(win)->y);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_resize(Ewl_Window *win)
{
- int width, height;
+ int width, height;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- width = ewl_object_current_w_get(EWL_OBJECT(win));
- height = ewl_object_current_h_get(EWL_OBJECT(win));
+ width = ewl_object_current_w_get(EWL_OBJECT(win));
+ height = ewl_object_current_h_get(EWL_OBJECT(win));
- ecore_x_window_resize((Ecore_X_Window)win->window, width, height);
+ ecore_x_window_resize((Ecore_X_Window)win->window, width, height);
- if (EWL_EMBED(win)->canvas_window != win->window)
- ecore_x_window_resize((Ecore_X_Window)EWL_EMBED(win)->canvas_window,
- width, height);
+ if (EWL_EMBED(win)->canvas_window != win->window)
+ ecore_x_window_resize((Ecore_X_Window)EWL_EMBED(win)->canvas_window,
+ width, height);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_min_max_size_set(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
-
- ecore_x_icccm_size_pos_hints_get_prefetch((Ecore_X_Window)win->window);
- ecore_x_icccm_size_pos_hints_get_fetch();
- ecore_x_icccm_size_pos_hints_set((Ecore_X_Window)win->window,
- 0, ECORE_X_GRAVITY_NW,
- ewl_object_minimum_w_get(EWL_OBJECT(win)),
- ewl_object_minimum_h_get(EWL_OBJECT(win)),
- ewl_object_maximum_w_get(EWL_OBJECT(win)),
- ewl_object_maximum_h_get(EWL_OBJECT(win)),
- 0, 0, /* base */
- 0, 0, /* step */
- 0, 0); /* aspect */
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+
+ ecore_x_icccm_size_pos_hints_get_prefetch((Ecore_X_Window)win->window);
+ ecore_x_icccm_size_pos_hints_get_fetch();
+ ecore_x_icccm_size_pos_hints_set((Ecore_X_Window)win->window,
+ 0, ECORE_X_GRAVITY_NW,
+ ewl_object_minimum_w_get(EWL_OBJECT(win)),
+ ewl_object_minimum_h_get(EWL_OBJECT(win)),
+ ewl_object_maximum_w_get(EWL_OBJECT(win)),
+ ewl_object_maximum_h_get(EWL_OBJECT(win)),
+ 0, 0, /* base */
+ 0, 0, /* step */
+ 0, 0); /* aspect */
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_show(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_x_window_show((Ecore_X_Window)win->window);
- ecore_x_window_show((Ecore_X_Window)EWL_EMBED(win)->canvas_window);
+ ecore_x_window_show((Ecore_X_Window)win->window);
+ ecore_x_window_show((Ecore_X_Window)EWL_EMBED(win)->canvas_window);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_hide(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_x_window_hide((Ecore_X_Window)EWL_EMBED(win)->canvas_window);
- ecore_x_window_hide((Ecore_X_Window)EWL_WINDOW(win)->window);
+ ecore_x_window_hide((Ecore_X_Window)EWL_EMBED(win)->canvas_window);
+ ecore_x_window_hide((Ecore_X_Window)EWL_WINDOW(win)->window);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_title_set(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_x_icccm_title_set((Ecore_X_Window)win->window, win->title);
- ecore_x_netwm_name_set((Ecore_X_Window)win->window, win->title);
+ ecore_x_icccm_title_set((Ecore_X_Window)win->window, win->title);
+ ecore_x_netwm_name_set((Ecore_X_Window)win->window, win->title);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_name_class_set(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_x_icccm_name_class_set((Ecore_X_Window)win->window, win->name,
- (win->classname ? win->classname : win->name));
+ ecore_x_icccm_name_class_set((Ecore_X_Window)win->window, win->name,
+ (win->classname ? win->classname : win->name));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_borderless_set(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_x_mwm_borderless_set((Ecore_X_Window)win->window,
- (!!(win->flags & EWL_WINDOW_BORDERLESS)));
+ ecore_x_mwm_borderless_set((Ecore_X_Window)win->window,
+ (!!(win->flags & EWL_WINDOW_BORDERLESS)));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_dialog_set(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_x_netwm_window_type_set((Ecore_X_Window)win->window,
- ((!!(win->flags & EWL_WINDOW_DIALOG)) ?
- ECORE_X_WINDOW_TYPE_DIALOG :
- ECORE_X_WINDOW_TYPE_NORMAL));
+ ecore_x_netwm_window_type_set((Ecore_X_Window)win->window,
+ ((!!(win->flags & EWL_WINDOW_DIALOG)) ?
+ ECORE_X_WINDOW_TYPE_DIALOG :
+ ECORE_X_WINDOW_TYPE_NORMAL));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_states_set(Ewl_Window *win)
{
- int diff;
+ int diff;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- diff = win->flags ^ win->old_flags;
- if (!diff) DRETURN(DLEVEL_STABLE);
+ diff = win->flags ^ win->old_flags;
+ if (!diff) DRETURN(DLEVEL_STABLE);
- if (REALIZED(win))
- ee_window_state_request(win, diff);
- else
- ee_window_states_set_helper(win);
+ if (REALIZED(win))
+ ee_window_state_request(win, diff);
+ else
+ ee_window_states_set_helper(win);
- win->old_flags = win->flags;
+ win->old_flags = win->flags;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_state_handle(Ewl_Window *win, int states,
- Ewl_Window_Flags ewl_flag,
- Ecore_X_Window_State ecore_flag)
+ Ewl_Window_Flags ewl_flag,
+ Ecore_X_Window_State ecore_flag)
{
- int state = 0;
+ int state = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (states & ewl_flag)
- {
- state = (!!(win->flags & ewl_flag));
- ecore_x_netwm_state_request_send((Ecore_X_Window)win->window,
- 0, ecore_flag, ECORE_X_WINDOW_STATE_UNKNOWN, state);
- }
+ if (states & ewl_flag)
+ {
+ state = (!!(win->flags & ewl_flag));
+ ecore_x_netwm_state_request_send((Ecore_X_Window)win->window,
+ 0, ecore_flag, ECORE_X_WINDOW_STATE_UNKNOWN, state);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_state_request(Ewl_Window *win, int states)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
-
- ee_window_state_handle(win, states, EWL_WINDOW_FULLSCREEN,
- ECORE_X_WINDOW_STATE_FULLSCREEN);
- ee_window_state_handle(win, states, EWL_WINDOW_SKIP_TASKBAR,
- ECORE_X_WINDOW_STATE_SKIP_TASKBAR);
- ee_window_state_handle(win, states, EWL_WINDOW_SKIP_PAGER,
- ECORE_X_WINDOW_STATE_SKIP_PAGER);
- ee_window_state_handle(win, states, EWL_WINDOW_MODAL,
- ECORE_X_WINDOW_STATE_MODAL);
- ee_window_state_handle(win, states, EWL_WINDOW_DEMANDS_ATTENTION,
- ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION);
-
- win->flags &= ~EWL_WINDOW_DEMANDS_ATTENTION;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+
+ ee_window_state_handle(win, states, EWL_WINDOW_FULLSCREEN,
+ ECORE_X_WINDOW_STATE_FULLSCREEN);
+ ee_window_state_handle(win, states, EWL_WINDOW_SKIP_TASKBAR,
+ ECORE_X_WINDOW_STATE_SKIP_TASKBAR);
+ ee_window_state_handle(win, states, EWL_WINDOW_SKIP_PAGER,
+ ECORE_X_WINDOW_STATE_SKIP_PAGER);
+ ee_window_state_handle(win, states, EWL_WINDOW_MODAL,
+ ECORE_X_WINDOW_STATE_MODAL);
+ ee_window_state_handle(win, states, EWL_WINDOW_DEMANDS_ATTENTION,
+ ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION);
+
+ win->flags &= ~EWL_WINDOW_DEMANDS_ATTENTION;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_states_set_helper(Ewl_Window *win)
{
- Ecore_X_Window_State states[4];
- int count = 0;
+ Ecore_X_Window_State states[4];
+ int count = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- /* Note: We're ignoring the attention demand state in here as it is
- * only relevant if the window has been realized */
+ /* Note: We're ignoring the attention demand state in here as it is
+ * only relevant if the window has been realized */
- if (!win->window)
- DRETURN(DLEVEL_STABLE);
+ if (!win->window)
+ DRETURN(DLEVEL_STABLE);
- if (!!(win->flags & EWL_WINDOW_FULLSCREEN))
- states[count++] = ECORE_X_WINDOW_STATE_FULLSCREEN;
+ if (!!(win->flags & EWL_WINDOW_FULLSCREEN))
+ states[count++] = ECORE_X_WINDOW_STATE_FULLSCREEN;
- if (!!(win->flags & EWL_WINDOW_SKIP_TASKBAR))
- states[count++] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
+ if (!!(win->flags & EWL_WINDOW_SKIP_TASKBAR))
+ states[count++] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
- if (!!(win->flags & EWL_WINDOW_SKIP_PAGER))
- states[count++] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
+ if (!!(win->flags & EWL_WINDOW_SKIP_PAGER))
+ states[count++] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
- if (!!(win->flags & EWL_WINDOW_MODAL))
- states[count++] = ECORE_X_WINDOW_STATE_MODAL;
+ if (!!(win->flags & EWL_WINDOW_MODAL))
+ states[count++] = ECORE_X_WINDOW_STATE_MODAL;
- ecore_x_netwm_window_state_set((Ecore_X_Window)win->window, states, count);
+ ecore_x_netwm_window_state_set((Ecore_X_Window)win->window, states, count);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_hints_set(Ewl_Window *win)
{
- Ewl_Embed_Window *win_group;
- int urgent = FALSE;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
-
- if (win->flags & EWL_WINDOW_LEADER)
- win_group = win->leader.ewl->window;
- else if (win->flags & EWL_WINDOW_LEADER_FOREIGN)
- win_group = win->leader.foreign;
- else
- win_group = NULL;
-
- if (win->flags & EWL_WINDOW_URGENT)
- urgent = TRUE;
-
- ecore_x_icccm_hints_set((Ecore_X_Window) win->window,
- 1, // accepts focus
- 0, // initial states
- 0, // icon pixmap
- 0, // icon mask
- 0, // icon window
- (Ecore_X_Window) win_group, // window group
- urgent); // is urgent
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Embed_Window *win_group;
+ int urgent = FALSE;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+
+ if (win->flags & EWL_WINDOW_LEADER)
+ win_group = win->leader.ewl->window;
+ else if (win->flags & EWL_WINDOW_LEADER_FOREIGN)
+ win_group = win->leader.foreign;
+ else
+ win_group = NULL;
+
+ if (win->flags & EWL_WINDOW_URGENT)
+ urgent = TRUE;
+
+ ecore_x_icccm_hints_set((Ecore_X_Window) win->window,
+ 1, // accepts focus
+ 0, // initial states
+ 0, // icon pixmap
+ 0, // icon mask
+ 0, // icon window
+ (Ecore_X_Window) win_group, // window group
+ urgent); // is urgent
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_transient_for(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
-
- if (win->flags & EWL_WINDOW_TRANSIENT)
- ecore_x_icccm_transient_for_set((Ecore_X_Window)win->window,
- (Ecore_X_Window)win->transient.ewl->window);
- else if (win->flags & EWL_WINDOW_TRANSIENT_FOREIGN)
- ecore_x_icccm_transient_for_set((Ecore_X_Window)win->window,
- (Ecore_X_Window)win->transient.foreign);
- else
- ecore_x_icccm_transient_for_unset((Ecore_X_Window)win->window);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+
+ if (win->flags & EWL_WINDOW_TRANSIENT)
+ ecore_x_icccm_transient_for_set((Ecore_X_Window)win->window,
+ (Ecore_X_Window)win->transient.ewl->window);
+ else if (win->flags & EWL_WINDOW_TRANSIENT_FOREIGN)
+ ecore_x_icccm_transient_for_set((Ecore_X_Window)win->window,
+ (Ecore_X_Window)win->transient.foreign);
+ else
+ ecore_x_icccm_transient_for_unset((Ecore_X_Window)win->window);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_leader_set(Ewl_Window *win)
{
- Ewl_Embed_Window *leader;
+ Ewl_Embed_Window *leader;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (win->flags & EWL_WINDOW_LEADER)
- leader = win->leader.ewl->window;
- else if (win->flags & EWL_WINDOW_LEADER_FOREIGN)
- leader = win->leader.foreign;
- else
- /* according to the icccm specs a client leader
- * sets itself to the leader */
- leader = win->window;
+ if (win->flags & EWL_WINDOW_LEADER)
+ leader = win->leader.ewl->window;
+ else if (win->flags & EWL_WINDOW_LEADER_FOREIGN)
+ leader = win->leader.foreign;
+ else
+ /* according to the icccm specs a client leader
+ * sets itself to the leader */
+ leader = win->window;
- ecore_x_icccm_client_leader_set((Ecore_X_Window)win->window,
- (Ecore_X_Window)leader);
+ ecore_x_icccm_client_leader_set((Ecore_X_Window)win->window,
+ (Ecore_X_Window)leader);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_raise(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_x_window_raise((Ecore_X_Window)win->window);
+ ecore_x_window_raise((Ecore_X_Window)win->window);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_lower(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_x_window_lower((Ecore_X_Window)win->window);
+ ecore_x_window_lower((Ecore_X_Window)win->window);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static int
ee_keyboard_grab(Ewl_Window *win)
{
- int ret = FALSE;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(win, FALSE);
- DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
-
- if ((!!(win->flags & EWL_WINDOW_GRAB_KEYBOARD)))
- {
- ret = ecore_x_keyboard_grab((Ecore_X_Window)win->window);
- ee_current_key_grab_window = win;
- }
- else if (ee_current_key_grab_window == win)
- {
- ecore_x_keyboard_ungrab();
- ee_current_key_grab_window = NULL;
- }
-
- DRETURN_INT(ret, DLEVEL_STABLE);
+ int ret = FALSE;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(win, FALSE);
+ DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
+
+ if ((!!(win->flags & EWL_WINDOW_GRAB_KEYBOARD)))
+ {
+ ret = ecore_x_keyboard_grab((Ecore_X_Window)win->window);
+ ee_current_key_grab_window = win;
+ }
+ else if (ee_current_key_grab_window == win)
+ {
+ ecore_x_keyboard_ungrab();
+ ee_current_key_grab_window = NULL;
+ }
+
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
static void
ee_keyboard_ungrab(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_x_keyboard_ungrab();
- ee_current_key_grab_window = NULL;
+ ecore_x_keyboard_ungrab();
+ ee_current_key_grab_window = NULL;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static int
ee_pointer_grab(Ewl_Window *win)
{
- int ret = FALSE;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(win, FALSE);
- DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
-
- if ((!!(win->flags & EWL_WINDOW_GRAB_POINTER)))
- {
- ret = ecore_x_pointer_grab((Ecore_X_Window)win->window);
- ee_current_pointer_grab_window = win;
- }
- else if (ee_current_pointer_grab_window == win)
- {
- ecore_x_pointer_ungrab();
- ee_current_pointer_grab_window = NULL;
- }
-
- DRETURN_INT(ret, DLEVEL_STABLE);
+ int ret = FALSE;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(win, FALSE);
+ DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
+
+ if ((!!(win->flags & EWL_WINDOW_GRAB_POINTER)))
+ {
+ ret = ecore_x_pointer_grab((Ecore_X_Window)win->window);
+ ee_current_pointer_grab_window = win;
+ }
+ else if (ee_current_pointer_grab_window == win)
+ {
+ ecore_x_pointer_ungrab();
+ ee_current_pointer_grab_window = NULL;
+ }
+
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
static void
ee_pointer_ungrab(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ecore_x_pointer_ungrab();
- ee_current_pointer_grab_window = NULL;
+ ecore_x_pointer_ungrab();
+ ee_current_pointer_grab_window = NULL;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_selection_text_set(Ewl_Embed *emb, const char *txt)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(emb);
- DCHECK_PARAM_PTR(txt);
- DCHECK_TYPE(emb, EWL_EMBED_TYPE);
-
- ecore_x_selection_primary_prefetch();
- ecore_x_selection_primary_fetch();
- if (txt)
- ecore_x_selection_primary_set(
- (Ecore_X_Window)emb->canvas_window,
- (unsigned char *)txt, strlen(txt) + 1);
- else
- ecore_x_selection_primary_clear();
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(emb);
+ DCHECK_PARAM_PTR(txt);
+ DCHECK_TYPE(emb, EWL_EMBED_TYPE);
+
+ ecore_x_selection_primary_prefetch();
+ ecore_x_selection_primary_fetch();
+ if (txt)
+ ecore_x_selection_primary_set(
+ (Ecore_X_Window)emb->canvas_window,
+ (unsigned char *)txt, strlen(txt) + 1);
+ else
+ ecore_x_selection_primary_clear();
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_window_geometry_set(Ewl_Window *win, int *width, int *height)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ecore_x_drawable_geometry_get_prefetch((win ? (Ecore_X_Window)win->window : (Ecore_X_Window)0));
- ecore_x_drawable_geometry_get_fetch();
- ecore_x_window_geometry_get((win ? (Ecore_X_Window)win->window : (Ecore_X_Window)0),
- NULL, NULL, width, height);
+ ecore_x_drawable_geometry_get_prefetch((win ? (Ecore_X_Window)win->window : (Ecore_X_Window)0));
+ ecore_x_drawable_geometry_get_fetch();
+ ecore_x_window_geometry_get((win ? (Ecore_X_Window)win->window : (Ecore_X_Window)0),
+ NULL, NULL, width, height);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_dnd_aware_set(Ewl_Embed *embed)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- ecore_x_dnd_aware_set((Ecore_X_Window)embed->canvas_window, TRUE);
+ ecore_x_dnd_aware_set((Ecore_X_Window)embed->canvas_window, TRUE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_desktop_size_get(Ewl_Embed *embed, int *w, int *h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- ecore_x_drawable_geometry_get_prefetch((Ecore_X_Window)0);
- ecore_x_drawable_geometry_get_fetch();
- ecore_x_window_size_get(0, w, h);
+ ecore_x_drawable_geometry_get_prefetch((Ecore_X_Window)0);
+ ecore_x_drawable_geometry_get_fetch();
+ ecore_x_window_size_get(0, w, h);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_dnd_drag_types_set(Ewl_Embed *embed, const char **types, unsigned int num)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- ecore_x_dnd_type_get_prefetch((Ecore_X_Window)embed->canvas_window);
- ecore_x_dnd_aware_set((Ecore_X_Window)embed->canvas_window,
- (num > 0 ? 1 : 0));
- ecore_x_dnd_type_get_fetch();
- ecore_x_dnd_types_set((Ecore_X_Window)embed->canvas_window, (char **)types, num);
+ ecore_x_dnd_type_get_prefetch((Ecore_X_Window)embed->canvas_window);
+ ecore_x_dnd_aware_set((Ecore_X_Window)embed->canvas_window,
+ (num > 0 ? 1 : 0));
+ ecore_x_dnd_type_get_fetch();
+ ecore_x_dnd_types_set((Ecore_X_Window)embed->canvas_window, (char **)types, num);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_dnd_drag_begin(Ewl_Embed *embed)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- ecore_x_dnd_begin_prefetch((Ecore_X_Window)embed->canvas_window);
- ecore_x_dnd_begin_fetch();
- ecore_x_dnd_begin((Ecore_X_Window)embed->canvas_window, NULL, 0);
+ ecore_x_dnd_begin_prefetch((Ecore_X_Window)embed->canvas_window);
+ ecore_x_dnd_begin_fetch();
+ ecore_x_dnd_begin((Ecore_X_Window)embed->canvas_window, NULL, 0);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ee_dnd_drag_drop(Ewl_Embed *embed)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- ecore_x_dnd_drop();
+ ecore_x_dnd_drop();
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static int
ee_dnd_drag_data_send(Ewl_Embed *embed, void *handle, void *data, int len)
{
- Ecore_X_Event_Selection_Request *request = handle;
+ Ecore_X_Event_Selection_Request *request = handle;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(embed, FALSE);
- DCHECK_PARAM_PTR_RET(handle, FALSE);
- DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(embed, FALSE);
+ DCHECK_PARAM_PTR_RET(handle, FALSE);
+ DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, FALSE);
- ecore_x_window_prop_property_set(request->requestor, request->property,
- request->target, 8, data, len);
+ ecore_x_window_prop_property_set(request->requestor, request->property,
+ request->target, 8, data, len);
- DRETURN_INT(ecore_x_selection_notify_send(request->requestor,
- request->selection, request->target,
- request->property, request->time), DLEVEL_STABLE);
+ DRETURN_INT(ecore_x_selection_notify_send(request->requestor,
+ request->selection, request->target,
+ request->property, request->time), DLEVEL_STABLE);
}
static int
ee_pointer_data_new(Ewl_Embed *embed, int *data, int w, int h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(embed, 0);
- DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(embed, 0);
+ DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, 0);
- DRETURN_INT(ecore_x_cursor_new((Ecore_X_Window)embed->canvas_window,
- data, w, h, 0, 0), DLEVEL_STABLE);
+ DRETURN_INT(ecore_x_cursor_new((Ecore_X_Window)embed->canvas_window,
+ data, w, h, 0, 0), DLEVEL_STABLE);
}
static void
ee_pointer_free(Ewl_Embed *embed, int pointer)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- ecore_x_cursor_free(pointer);
+ ecore_x_cursor_free(pointer);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/*
@@ -988,609 +988,609 @@ ee_pointer_free(Ewl_Embed *embed, int pointer)
static int
ee_pointer_get(Ewl_Embed *embed)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(embed, 0);
- DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(embed, 0);
+ DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, 0);
- DRETURN_INT(ecore_x_cursor_size_get(), DLEVEL_STABLE);
+ DRETURN_INT(ecore_x_cursor_size_get(), DLEVEL_STABLE);
}
static void
ee_pointer_set(Ewl_Embed *embed, int pointer)
{
- Ecore_X_Cursor cur;
+ Ecore_X_Cursor cur;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- if (pointer >= EWL_MOUSE_CURSOR_MAX)
- cur = pointer;
- else
- cur = ecore_x_cursor_shape_get(pointer);
- ecore_x_window_cursor_set((Ecore_X_Window)embed->canvas_window, cur);
+ if (pointer >= EWL_MOUSE_CURSOR_MAX)
+ cur = pointer;
+ else
+ cur = ecore_x_cursor_shape_get(pointer);
+ ecore_x_window_cursor_set((Ecore_X_Window)embed->canvas_window, cur);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static int
ewl_ev_x_window_expose(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- /*
- * Widgets don't need to know about this usually, but we still need to
- * let them know in case a widget is using a non-evas based draw method
- */
- Ecore_X_Event_Window_Damage *ev;
- Ewl_Event_Window_Expose event;
- Ewl_Window *window;
+ /*
+ * Widgets don't need to know about this usually, but we still need to
+ * let them know in case a widget is using a non-evas based draw method
+ */
+ Ecore_X_Event_Window_Damage *ev;
+ Ewl_Event_Window_Expose event;
+ Ewl_Window *window;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
+ ev = e;
- window = ewl_window_window_find((void *)ev->win);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->win);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- event.x = ev->x;
- event.y = ev->y;
- event.w = ev->w;
- event.h = ev->h;
+ event.x = ev->x;
+ event.y = ev->y;
+ event.w = ev->w;
+ event.h = ev->h;
- ewl_engine_canvas_damage_add(EWL_EMBED(window), ev->x, ev->y, ev->w, ev->h);
- ewl_callback_call_with_event_data(EWL_WIDGET(window), EWL_CALLBACK_EXPOSE, &event);
+ ewl_engine_canvas_damage_add(EWL_EMBED(window), ev->x, ev->y, ev->w, ev->h);
+ ewl_callback_call_with_event_data(EWL_WIDGET(window), EWL_CALLBACK_EXPOSE, &event);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_window_configure(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- /*
- * When a configure event occurs, we must update the windows geometry
- * based on the coordinates and dimensions given in the Ecore_Event.
- */
- Ecore_X_Event_Window_Configure *ev;
- Ewl_Window *window;
- Ewl_Embed *embed;
- int config = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- ev = e;
-
- embed = ewl_embed_canvas_window_find((void *)ev->win);
- if (!embed)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
-
- /*
- * Save coords and queue a configure event if the window is moved.
- */
- if ((ev->from_wm) && (ev->x != embed->x)) {
- embed->x = ev->x;
- config = 1;
- }
-
- if ((ev->from_wm) && (ev->y != embed->y)) {
- embed->y = ev->y;
- config = 1;
- }
-
- window = ewl_window_window_find((void *)ev->win);
- /*
- * we can finish when the embed is not a window
- */
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
-
- if (config)
- ewl_widget_configure(EWL_WIDGET(window));
-
- /*
- * Configure events really only need to occur on resize.
- */
- if ((ewl_object_current_w_get(EWL_OBJECT(window)) != ev->w)
- || (ewl_object_current_h_get(EWL_OBJECT(window)) != ev->h)) {
-
- /*
- * Right now this is commented out, as it was preventing windows
- * from resizing when WE were the ones setting the size
- * (mainly on initial show of the window). It would be nice to
- * add this back in to limit the # of window resizes occuring.
- * (As long as it doesn't break initial size.)
- */
- if (ev->from_wm) window->flags |= EWL_WINDOW_USER_CONFIGURE;
- ewl_object_geometry_request(EWL_OBJECT(window), 0, 0, ev->w,
- ev->h);
- }
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ /*
+ * When a configure event occurs, we must update the windows geometry
+ * based on the coordinates and dimensions given in the Ecore_Event.
+ */
+ Ecore_X_Event_Window_Configure *ev;
+ Ewl_Window *window;
+ Ewl_Embed *embed;
+ int config = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ ev = e;
+
+ embed = ewl_embed_canvas_window_find((void *)ev->win);
+ if (!embed)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+
+ /*
+ * Save coords and queue a configure event if the window is moved.
+ */
+ if ((ev->from_wm) && (ev->x != embed->x)) {
+ embed->x = ev->x;
+ config = 1;
+ }
+
+ if ((ev->from_wm) && (ev->y != embed->y)) {
+ embed->y = ev->y;
+ config = 1;
+ }
+
+ window = ewl_window_window_find((void *)ev->win);
+ /*
+ * we can finish when the embed is not a window
+ */
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+
+ if (config)
+ ewl_widget_configure(EWL_WIDGET(window));
+
+ /*
+ * Configure events really only need to occur on resize.
+ */
+ if ((ewl_object_current_w_get(EWL_OBJECT(window)) != ev->w)
+ || (ewl_object_current_h_get(EWL_OBJECT(window)) != ev->h)) {
+
+ /*
+ * Right now this is commented out, as it was preventing windows
+ * from resizing when WE were the ones setting the size
+ * (mainly on initial show of the window). It would be nice to
+ * add this back in to limit the # of window resizes occuring.
+ * (As long as it doesn't break initial size.)
+ */
+ if (ev->from_wm) window->flags |= EWL_WINDOW_USER_CONFIGURE;
+ ewl_object_geometry_request(EWL_OBJECT(window), 0, 0, ev->w,
+ ev->h);
+ }
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_window_delete(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- /*
- * Retrieve the appropriate ewl_window using the x window id that is
- * held in the eevent, and call it's handlers for a window delete event.
- */
- Ecore_X_Event_Window_Destroy *ev;
- Ewl_Window *window;
+ /*
+ * Retrieve the appropriate ewl_window using the x window id that is
+ * held in the eevent, and call it's handlers for a window delete event.
+ */
+ Ecore_X_Event_Window_Destroy *ev;
+ Ewl_Window *window;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
+ ev = e;
- window = ewl_window_window_find((void *)ev->win);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->win);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- ewl_callback_call(EWL_WIDGET(window), EWL_CALLBACK_DELETE_WINDOW);
+ ewl_callback_call(EWL_WIDGET(window), EWL_CALLBACK_DELETE_WINDOW);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_key_down(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_X_Event_Key_Down *ev;
- unsigned int key_modifiers;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- ev = e;
- window = ewl_window_window_find((void *)ev->win);
-
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
-
- key_modifiers = ewl_ev_modifiers_get();
-
- if (strstr(ev->keyname, "Shift_"))
- key_modifiers |= EWL_KEY_MODIFIER_SHIFT;
- else if (strstr(ev->keyname, "Control_"))
- key_modifiers |= EWL_KEY_MODIFIER_CTRL;
- else if (strstr(ev->keyname, "Alt_"))
- key_modifiers |= EWL_KEY_MODIFIER_ALT;
- else if (strstr(ev->keyname, "Mod_"))
- key_modifiers |= EWL_KEY_MODIFIER_MOD;
- else if (strstr(ev->keyname, "Super_"))
- key_modifiers |= EWL_KEY_MODIFIER_WIN;
- else if (strstr(ev->keyname, "Hyper_"))
- key_modifiers |= EWL_KEY_MODIFIER_WIN;
- else if (!ev->key_compose || iscntrl(*ev->key_compose))
- ewl_embed_key_down_feed(EWL_EMBED(window), ev->keyname,
- key_modifiers);
- else
- ewl_embed_key_down_feed(EWL_EMBED(window), ev->key_compose,
- key_modifiers);
-
- ewl_ev_modifiers_set(key_modifiers);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Window *window;
+ Ecore_X_Event_Key_Down *ev;
+ unsigned int key_modifiers;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ ev = e;
+ window = ewl_window_window_find((void *)ev->win);
+
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+
+ key_modifiers = ewl_ev_modifiers_get();
+
+ if (strstr(ev->keyname, "Shift_"))
+ key_modifiers |= EWL_KEY_MODIFIER_SHIFT;
+ else if (strstr(ev->keyname, "Control_"))
+ key_modifiers |= EWL_KEY_MODIFIER_CTRL;
+ else if (strstr(ev->keyname, "Alt_"))
+ key_modifiers |= EWL_KEY_MODIFIER_ALT;
+ else if (strstr(ev->keyname, "Mod_"))
+ key_modifiers |= EWL_KEY_MODIFIER_MOD;
+ else if (strstr(ev->keyname, "Super_"))
+ key_modifiers |= EWL_KEY_MODIFIER_WIN;
+ else if (strstr(ev->keyname, "Hyper_"))
+ key_modifiers |= EWL_KEY_MODIFIER_WIN;
+ else if (!ev->key_compose || iscntrl(*ev->key_compose))
+ ewl_embed_key_down_feed(EWL_EMBED(window), ev->keyname,
+ key_modifiers);
+ else
+ ewl_embed_key_down_feed(EWL_EMBED(window), ev->key_compose,
+ key_modifiers);
+
+ ewl_ev_modifiers_set(key_modifiers);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_key_up(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_X_Event_Key_Up *ev;
- unsigned int key_modifiers;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- ev = e;
-
- window = ewl_window_window_find((void *)ev->win);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
-
- key_modifiers = ewl_ev_modifiers_get();
-
- if (strstr(ev->keyname, "Shift_"))
- key_modifiers &= ~EWL_KEY_MODIFIER_SHIFT;
- else if (strstr(ev->keyname, "Control_"))
- key_modifiers &= ~EWL_KEY_MODIFIER_CTRL;
- else if (strstr(ev->keyname, "Alt_"))
- key_modifiers &= ~EWL_KEY_MODIFIER_ALT;
- else if (strstr(ev->keyname, "Mod_"))
- key_modifiers &= ~EWL_KEY_MODIFIER_MOD;
- else if (strstr(ev->keyname, "Super_"))
- key_modifiers &= ~EWL_KEY_MODIFIER_WIN;
- else if (strstr(ev->keyname, "Hyper_"))
- key_modifiers &= ~EWL_KEY_MODIFIER_WIN;
- else if (!ev->key_compose || iscntrl(*ev->key_compose))
- ewl_embed_key_up_feed(EWL_EMBED(window), ev->keyname,
- key_modifiers);
- else
- ewl_embed_key_up_feed(EWL_EMBED(window), ev->key_compose,
- key_modifiers);
-
- ewl_ev_modifiers_set(key_modifiers);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Window *window;
+ Ecore_X_Event_Key_Up *ev;
+ unsigned int key_modifiers;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ ev = e;
+
+ window = ewl_window_window_find((void *)ev->win);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+
+ key_modifiers = ewl_ev_modifiers_get();
+
+ if (strstr(ev->keyname, "Shift_"))
+ key_modifiers &= ~EWL_KEY_MODIFIER_SHIFT;
+ else if (strstr(ev->keyname, "Control_"))
+ key_modifiers &= ~EWL_KEY_MODIFIER_CTRL;
+ else if (strstr(ev->keyname, "Alt_"))
+ key_modifiers &= ~EWL_KEY_MODIFIER_ALT;
+ else if (strstr(ev->keyname, "Mod_"))
+ key_modifiers &= ~EWL_KEY_MODIFIER_MOD;
+ else if (strstr(ev->keyname, "Super_"))
+ key_modifiers &= ~EWL_KEY_MODIFIER_WIN;
+ else if (strstr(ev->keyname, "Hyper_"))
+ key_modifiers &= ~EWL_KEY_MODIFIER_WIN;
+ else if (!ev->key_compose || iscntrl(*ev->key_compose))
+ ewl_embed_key_up_feed(EWL_EMBED(window), ev->keyname,
+ key_modifiers);
+ else
+ ewl_embed_key_up_feed(EWL_EMBED(window), ev->key_compose,
+ key_modifiers);
+
+ ewl_ev_modifiers_set(key_modifiers);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- int clicks = 1;
- Ewl_Window *window;
- Ecore_X_Event_Mouse_Button_Down *ev;
- unsigned int key_modifiers;
+ int clicks = 1;
+ Ewl_Window *window;
+ Ecore_X_Event_Mouse_Button_Down *ev;
+ unsigned int key_modifiers;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
+ ev = e;
- window = ewl_window_window_find((void *)ev->win);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->win);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- if (ev->double_click)
- clicks = 2;
- if (ev->triple_click)
- clicks = 3;
+ if (ev->double_click)
+ clicks = 2;
+ if (ev->triple_click)
+ clicks = 3;
- key_modifiers = ewl_ev_modifiers_get();
- ewl_embed_mouse_down_feed(EWL_EMBED(window), ev->button, clicks,
- ev->x, ev->y, key_modifiers);
+ key_modifiers = ewl_ev_modifiers_get();
+ ewl_embed_mouse_down_feed(EWL_EMBED(window), ev->button, clicks,
+ ev->x, ev->y, key_modifiers);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_X_Event_Mouse_Button_Up *ev;
- unsigned int key_modifiers;
+ Ewl_Window *window;
+ Ecore_X_Event_Mouse_Button_Up *ev;
+ unsigned int key_modifiers;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
+ ev = e;
- window = ewl_window_window_find((void *)ev->win);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->win);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- key_modifiers = ewl_ev_modifiers_get();
+ key_modifiers = ewl_ev_modifiers_get();
- ewl_embed_mouse_up_feed(EWL_EMBED(window), ev->button, ev->x,
- ev->y, key_modifiers);
+ ewl_embed_mouse_up_feed(EWL_EMBED(window), ev->button, ev->x,
+ ev->y, key_modifiers);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_X_Event_Mouse_Move *ev;
- unsigned int key_modifiers;
+ Ewl_Window *window;
+ Ecore_X_Event_Mouse_Move *ev;
+ unsigned int key_modifiers;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev = e;
+ ev = e;
- window = ewl_window_window_find((void *)ev->win);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->win);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- key_modifiers = ewl_ev_modifiers_get();
- ewl_embed_mouse_move_feed(EWL_EMBED(window), ev->x, ev->y,
- key_modifiers);
+ key_modifiers = ewl_ev_modifiers_get();
+ ewl_embed_mouse_move_feed(EWL_EMBED(window), ev->x, ev->y,
+ key_modifiers);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_X_Event_Mouse_Out *ev = e;
- unsigned int key_modifiers;
+ Ewl_Window *window;
+ Ecore_X_Event_Mouse_Out *ev = e;
+ unsigned int key_modifiers;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- window = ewl_window_window_find((void *)ev->win);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->win);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- key_modifiers = ewl_ev_modifiers_get();
- ewl_embed_mouse_out_feed(EWL_EMBED(window), ev->x, ev->y,
- key_modifiers);
+ key_modifiers = ewl_ev_modifiers_get();
+ ewl_embed_mouse_out_feed(EWL_EMBED(window), ev->x, ev->y,
+ key_modifiers);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_X_Event_Mouse_Wheel *ev = e;
- unsigned int key_modifiers;
+ Ewl_Window *window;
+ Ecore_X_Event_Mouse_Wheel *ev = e;
+ unsigned int key_modifiers;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- window = ewl_window_window_find((void *)ev->win);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->win);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- key_modifiers = ewl_ev_modifiers_get();
- ewl_embed_mouse_wheel_feed(EWL_EMBED(window), ev->x, ev->y,
- ev->z, ev->direction, key_modifiers);
+ key_modifiers = ewl_ev_modifiers_get();
+ ewl_embed_mouse_wheel_feed(EWL_EMBED(window), ev->x, ev->y,
+ ev->z, ev->direction, key_modifiers);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_focus_in(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_X_Event_Window_Focus_In *ev = e;
+ Ewl_Window *window;
+ Ecore_X_Event_Window_Focus_In *ev = e;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- window = ewl_window_window_find((void *)ev->win);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->win);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- ewl_callback_call(EWL_WIDGET(window), EWL_CALLBACK_FOCUS_IN);
+ ewl_callback_call(EWL_WIDGET(window), EWL_CALLBACK_FOCUS_IN);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_focus_out(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_X_Event_Window_Focus_Out *ev = e;
+ Ewl_Window *window;
+ Ecore_X_Event_Window_Focus_Out *ev = e;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- window = ewl_window_window_find((void *)ev->win);
- if (!window)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ window = ewl_window_window_find((void *)ev->win);
+ if (!window)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- ewl_callback_call(EWL_WIDGET(window), EWL_CALLBACK_FOCUS_OUT);
+ ewl_callback_call(EWL_WIDGET(window), EWL_CALLBACK_FOCUS_OUT);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_data_received(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ecore_X_Event_Selection_Notify *ev;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(e, FALSE);
-
- ev = e;
-
- /* Handle everything *except* XDND selection */
- if (ev->selection != ECORE_X_SELECTION_XDND)
- printf("Paste event received\n");
-
- else
- {
- Ewl_Embed *embed;
- Ecore_X_Selection_Data *data = ev->data;
-
- embed = ewl_embed_canvas_window_find((void *)ev->win);
- if (embed)
- {
- if (data->content == ECORE_X_SELECTION_CONTENT_FILES)
- {
- Ecore_X_Selection_Data_Files *files = ev->data;
- ewl_embed_dnd_data_received_feed(embed,
- ev->target,
- files->files,
- files->num_files,
- data->format);
- }
- else if (data->content == ECORE_X_SELECTION_CONTENT_TEXT)
- {
- Ecore_X_Selection_Data_Text *text = ev->data;
- ewl_embed_dnd_data_received_feed(embed,
- ev->target, text->text,
- data->length,
- data->format);
- }
- else
- {
- ewl_embed_dnd_data_received_feed(embed,
- ev->target, data->data,
- data->length,
- data->format);
- }
- }
-
- ecore_x_dnd_send_finished();
- }
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ecore_X_Event_Selection_Notify *ev;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(e, FALSE);
+
+ ev = e;
+
+ /* Handle everything *except* XDND selection */
+ if (ev->selection != ECORE_X_SELECTION_XDND)
+ printf("Paste event received\n");
+
+ else
+ {
+ Ewl_Embed *embed;
+ Ecore_X_Selection_Data *data = ev->data;
+
+ embed = ewl_embed_canvas_window_find((void *)ev->win);
+ if (embed)
+ {
+ if (data->content == ECORE_X_SELECTION_CONTENT_FILES)
+ {
+ Ecore_X_Selection_Data_Files *files = ev->data;
+ ewl_embed_dnd_data_received_feed(embed,
+ ev->target,
+ files->files,
+ files->num_files,
+ data->format);
+ }
+ else if (data->content == ECORE_X_SELECTION_CONTENT_TEXT)
+ {
+ Ecore_X_Selection_Data_Text *text = ev->data;
+ ewl_embed_dnd_data_received_feed(embed,
+ ev->target, text->text,
+ data->length,
+ data->format);
+ }
+ else
+ {
+ ewl_embed_dnd_data_received_feed(embed,
+ ev->target, data->data,
+ data->length,
+ data->format);
+ }
+ }
+
+ ecore_x_dnd_send_finished();
+ }
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_x_data_request(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ecore_X_Event_Selection_Request *ev;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(e, FALSE);
-
- ev = e;
-
- /* Handle everything *except* XDND selection */
- if (ev->selection != ECORE_X_ATOM_SELECTION_XDND)
- {
- char *rec, *dnd;
-
- ecore_x_atom_name_get_prefetch(ev->selection);
- ecore_x_atom_name_get_prefetch(ECORE_X_ATOM_SELECTION_XDND);
- ecore_x_atom_name_get_fetch();
- rec = ecore_x_atom_name_get(ev->selection);
- ecore_x_atom_name_get_fetch();
- dnd = ecore_x_atom_name_get(ECORE_X_ATOM_SELECTION_XDND);
- printf("Data request event received: %s not %s\n", rec, dnd);
- free(rec);
- free(dnd);
- }
-
- else if (ev->selection == ECORE_X_ATOM_SELECTION_XDND)
- {
- Ewl_Embed *embed;
- char *atom;
-
- ecore_x_atom_name_get_prefetch(ev->target);
- embed = ewl_embed_canvas_window_find((void *)ev->owner);
- ecore_x_atom_name_get_fetch();
- atom = ecore_x_atom_name_get(ev->target);
- ewl_embed_dnd_data_request_feed(embed, ev, atom);
- free(atom);
- }
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ecore_X_Event_Selection_Request *ev;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(e, FALSE);
+
+ ev = e;
+
+ /* Handle everything *except* XDND selection */
+ if (ev->selection != ECORE_X_ATOM_SELECTION_XDND)
+ {
+ char *rec, *dnd;
+
+ ecore_x_atom_name_get_prefetch(ev->selection);
+ ecore_x_atom_name_get_prefetch(ECORE_X_ATOM_SELECTION_XDND);
+ ecore_x_atom_name_get_fetch();
+ rec = ecore_x_atom_name_get(ev->selection);
+ ecore_x_atom_name_get_fetch();
+ dnd = ecore_x_atom_name_get(ECORE_X_ATOM_SELECTION_XDND);
+ printf("Data request event received: %s not %s\n", rec, dnd);
+ free(rec);
+ free(dnd);
+ }
+
+ else if (ev->selection == ECORE_X_ATOM_SELECTION_XDND)
+ {
+ Ewl_Embed *embed;
+ char *atom;
+
+ ecore_x_atom_name_get_prefetch(ev->target);
+ embed = ewl_embed_canvas_window_find((void *)ev->owner);
+ ecore_x_atom_name_get_fetch();
+ atom = ecore_x_atom_name_get(ev->target);
+ ewl_embed_dnd_data_request_feed(embed, ev, atom);
+ free(atom);
+ }
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_dnd_position(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Window *window;
- Ecore_X_Event_Xdnd_Position *ev;
- int x, y, wx, wy;
- int px, py, pw, ph;
- Ecore_X_Rectangle rect;
- int will_accept = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(e, FALSE);
-
- ev = e;
-
- window = ewl_window_window_find((void *)ev->win);
- if (window) {
- Ewl_Embed *embed;
-
- ewl_embed_window_position_get(EWL_EMBED(window), &wx, &wy);
- x = ev->position.x - wx;
- y = ev->position.y - wy;
-
- /*
- * Look for the child here
- */
- embed = ewl_embed_canvas_window_find((void *)ev->win);
- if (embed) {
- /* First see if we need to send an 'enter'
- * to the widget */
- if (ewl_embed_dnd_position_feed(embed, x, y, &px,
- &py, &pw, &ph))
- will_accept = 1;
-
- if (embed->last.drop_widget) {
- rect.x = px;
- rect.y = py;
- rect.width = pw;
- rect.height = ph;
- } else {
- rect.x = 0;
- rect.y = 0;
- rect.width = 0;
- rect.height = 0;
- }
-
- /* Don't send status for windows we don't own */
- ecore_x_dnd_send_status(will_accept, 0, rect, ECORE_X_DND_ACTION_PRIVATE);
- }
- }
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Window *window;
+ Ecore_X_Event_Xdnd_Position *ev;
+ int x, y, wx, wy;
+ int px, py, pw, ph;
+ Ecore_X_Rectangle rect;
+ int will_accept = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(e, FALSE);
+
+ ev = e;
+
+ window = ewl_window_window_find((void *)ev->win);
+ if (window) {
+ Ewl_Embed *embed;
+
+ ewl_embed_window_position_get(EWL_EMBED(window), &wx, &wy);
+ x = ev->position.x - wx;
+ y = ev->position.y - wy;
+
+ /*
+ * Look for the child here
+ */
+ embed = ewl_embed_canvas_window_find((void *)ev->win);
+ if (embed) {
+ /* First see if we need to send an 'enter'
+ * to the widget */
+ if (ewl_embed_dnd_position_feed(embed, x, y, &px,
+ &py, &pw, &ph))
+ will_accept = 1;
+
+ if (embed->last.drop_widget) {
+ rect.x = px;
+ rect.y = py;
+ rect.width = pw;
+ rect.height = ph;
+ } else {
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = 0;
+ rect.height = 0;
+ }
+
+ /* Don't send status for windows we don't own */
+ ecore_x_dnd_send_status(will_accept, 0, rect, ECORE_X_DND_ACTION_PRIVATE);
+ }
+ }
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_dnd_enter(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Embed *embed;
- Ecore_X_Event_Xdnd_Enter *ev;
- int i = 0;
+ Ewl_Embed *embed;
+ Ecore_X_Event_Xdnd_Enter *ev;
+ int i = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(e, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(e, FALSE);
- ev = e;
+ ev = e;
- embed = ewl_embed_canvas_window_find((void *)ev->win);
- if (embed) {
- embed->dnd_types.num_types = ev->num_types;
- embed->dnd_types.types = malloc(sizeof(char*) * ev->num_types);
+ embed = ewl_embed_canvas_window_find((void *)ev->win);
+ if (embed) {
+ embed->dnd_types.num_types = ev->num_types;
+ embed->dnd_types.types = malloc(sizeof(char*) * ev->num_types);
- for (i = 0; i < ev->num_types; i++)
- embed->dnd_types.types[i] = strdup(ev->types[i]);
- }
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ for (i = 0; i < ev->num_types; i++)
+ embed->dnd_types.types[i] = strdup(ev->types[i]);
+ }
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_dnd_leave(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Embed *embed;
- Ecore_X_Event_Xdnd_Leave *ev;
- int i;
+ Ewl_Embed *embed;
+ Ecore_X_Event_Xdnd_Leave *ev;
+ int i;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(e, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(e, FALSE);
- ev = e;
+ ev = e;
- embed = ewl_embed_canvas_window_find((void *)ev->win);
- if (embed) {
- if (embed->dnd_types.num_types > 0) {
- for (i = 0; i < embed->dnd_types.num_types; i++)
- FREE(embed->dnd_types.types[i]);
+ embed = ewl_embed_canvas_window_find((void *)ev->win);
+ if (embed) {
+ if (embed->dnd_types.num_types > 0) {
+ for (i = 0; i < embed->dnd_types.num_types; i++)
+ FREE(embed->dnd_types.types[i]);
- FREE(embed->dnd_types.types);
- embed->dnd_types.types = NULL;
- embed->dnd_types.num_types = 0;
+ FREE(embed->dnd_types.types);
+ embed->dnd_types.types = NULL;
+ embed->dnd_types.num_types = 0;
- }
- }
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ }
+ }
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
ewl_ev_dnd_drop(void *data __UNUSED__, int type __UNUSED__, void *e)
{
- Ewl_Embed *embed;
- Ecore_X_Event_Xdnd_Drop *ev;
- int internal = 0;
+ Ewl_Embed *embed;
+ Ecore_X_Event_Xdnd_Drop *ev;
+ int internal = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(e, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(e, FALSE);
- ev = e;
+ ev = e;
- embed = ewl_embed_canvas_window_find((void *)ev->win);
- if (embed) {
- int x, y, wx, wy;
- const char *type;
+ embed = ewl_embed_canvas_window_find((void *)ev->win);
+ if (embed) {
+ int x, y, wx, wy;
+ const char *type;
- ewl_embed_window_position_get(embed, &wx, &wy);
+ ewl_embed_window_position_get(embed, &wx, &wy);
- if (ev->source == (Ecore_X_Window)embed->canvas_window)
- internal = 1;
+ if (ev->source == (Ecore_X_Window)embed->canvas_window)
+ internal = 1;
- x = ev->position.x - wx;
- y = ev->position.y - wy;
+ x = ev->position.x - wx;
+ y = ev->position.y - wy;
- type = ewl_embed_dnd_drop_feed(embed, x, y, internal);
- if (type)
- ecore_x_selection_xdnd_request(ev->win, (char *)type);
- }
+ type = ewl_embed_dnd_drop_feed(embed, x, y, internal);
+ if (type)
+ ecore_x_selection_xdnd_request(ev->win, (char *)type);
+ }
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
diff --git a/src/lib/Ewl.h b/src/lib/Ewl.h
index 2e83d9b..1b273cf 100644
--- a/src/lib/Ewl.h
+++ b/src/lib/Ewl.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_H
#define EWL_H
diff --git a/src/lib/ewl_attach.c b/src/lib/ewl_attach.c
index bac242b..d8b6bb2 100644
--- a/src/lib/ewl_attach.c
+++ b/src/lib/ewl_attach.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_box.h"
#include "ewl_popup.h"
@@ -20,31 +20,31 @@ typedef struct Ewl_Attach_Tooltip Ewl_Attach_Tooltip;
*/
struct Ewl_Attach_Tooltip
{
- Ewl_Widget *embed;
+ Ewl_Widget *embed;
- Ewl_Widget *win;
- Ewl_Widget *box;
+ Ewl_Widget *win;
+ Ewl_Widget *box;
- Ewl_Attach *attach;
+ Ewl_Attach *attach;
- Evas_Coord x;
- Evas_Coord y;
+ Evas_Coord x;
+ Evas_Coord y;
- Ecore_Timer *timer;
- Ewl_Widget *to;
+ Ecore_Timer *timer;
+ Ewl_Widget *to;
};
static Ewl_Attach_List *ewl_attach_list_new(void);
static void ewl_attach_list_free(Ewl_Attach_List *list);
static void ewl_attach_list_add(Ewl_Attach_List *list, Ewl_Widget *parent,
- Ewl_Attach *attach);
+ Ewl_Attach *attach);
static void *ewl_attach_list_get(Ewl_Attach_List *list, Ewl_Attach_Type type);
static Ewl_Attach *ewl_attach_new(Ewl_Attach_Type t,
- Ewl_Attach_Data_Type dt, void *data);
+ Ewl_Attach_Data_Type dt, void *data);
static int ewl_attach_init(Ewl_Attach *attach, Ewl_Attach_Type t,
- Ewl_Attach_Data_Type dt, void *data);
+ Ewl_Attach_Data_Type dt, void *data);
static void ewl_attach_free(Ewl_Attach *attach);
static void ewl_attach_parent_setup(Ewl_Widget *w);
@@ -73,26 +73,26 @@ static Ewl_Attach_Tooltip *ewl_attach_tooltip = NULL;
void
ewl_attach_text_set(Ewl_Widget *w, Ewl_Attach_Type t, const char *data)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- if (!w->attach)
- ewl_attach_parent_setup(w);
-
- if (data)
- {
- Ewl_Attach *attach;
-
- attach = ewl_attach_new(t, EWL_ATTACH_DATA_TYPE_TEXT,
- (void *)data);
- if (attach)
- ewl_attach_list_add(w->attach, w, attach);
- }
- else
- ewl_attach_list_del(w->attach, t);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ if (!w->attach)
+ ewl_attach_parent_setup(w);
+
+ if (data)
+ {
+ Ewl_Attach *attach;
+
+ attach = ewl_attach_new(t, EWL_ATTACH_DATA_TYPE_TEXT,
+ (void *)data);
+ if (attach)
+ ewl_attach_list_add(w->attach, w, attach);
+ }
+ else
+ ewl_attach_list_del(w->attach, t);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -105,27 +105,27 @@ ewl_attach_text_set(Ewl_Widget *w, Ewl_Attach_Type t, const char *data)
void
ewl_attach_widget_set(Ewl_Widget *w, Ewl_Attach_Type t, Ewl_Widget *data)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- DCHECK_TYPE(data, EWL_WIDGET_TYPE);
-
- if (!w->attach)
- ewl_attach_parent_setup(w);
-
- if (data)
- {
- Ewl_Attach *attach;
-
- attach = ewl_attach_new(t, EWL_ATTACH_DATA_TYPE_WIDGET,
- (void *)data);
- if (attach)
- ewl_attach_list_add(w->attach, w, attach);
- }
- else
- ewl_attach_list_del(w->attach, t);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DCHECK_TYPE(data, EWL_WIDGET_TYPE);
+
+ if (!w->attach)
+ ewl_attach_parent_setup(w);
+
+ if (data)
+ {
+ Ewl_Attach *attach;
+
+ attach = ewl_attach_new(t, EWL_ATTACH_DATA_TYPE_WIDGET,
+ (void *)data);
+ if (attach)
+ ewl_attach_list_add(w->attach, w, attach);
+ }
+ else
+ ewl_attach_list_del(w->attach, t);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -139,25 +139,25 @@ ewl_attach_widget_set(Ewl_Widget *w, Ewl_Attach_Type t, Ewl_Widget *data)
void
ewl_attach_other_set(Ewl_Widget *w, Ewl_Attach_Type t, void *data)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (!w->attach)
- ewl_attach_parent_setup(w);
+ if (!w->attach)
+ ewl_attach_parent_setup(w);
- if (data)
- {
- Ewl_Attach *attach;
+ if (data)
+ {
+ Ewl_Attach *attach;
- attach = ewl_attach_new(t, EWL_ATTACH_DATA_TYPE_OTHER, data);
- if (attach)
- ewl_attach_list_add(w->attach, w, attach);
- }
- else
- ewl_attach_list_del(w->attach, t);
+ attach = ewl_attach_new(t, EWL_ATTACH_DATA_TYPE_OTHER, data);
+ if (attach)
+ ewl_attach_list_add(w->attach, w, attach);
+ }
+ else
+ ewl_attach_list_del(w->attach, t);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -172,28 +172,28 @@ ewl_attach_other_set(Ewl_Widget *w, Ewl_Attach_Type t, void *data)
void
ewl_attach_dnd_drag_set(Ewl_Widget *w, Ewl_Widget *c, void *data, int size)
{
- Ewl_Attach_Dnd *dnd_data;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- dnd_data = ewl_attach_get(w, EWL_ATTACH_TYPE_DND_DATA);
- if (!c && !data) {
- if (dnd_data)
- FREE(dnd_data);
- }
- else {
- if (!dnd_data)
- dnd_data = NEW(Ewl_Attach_Dnd, 1);
- dnd_data->cursor = c;
- dnd_data->data = data;
- dnd_data->size = size;
- }
-
- ewl_attach_other_set(w, EWL_ATTACH_TYPE_DND_DATA, dnd_data);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Attach_Dnd *dnd_data;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ dnd_data = ewl_attach_get(w, EWL_ATTACH_TYPE_DND_DATA);
+ if (!c && !data) {
+ if (dnd_data)
+ FREE(dnd_data);
+ }
+ else {
+ if (!dnd_data)
+ dnd_data = NEW(Ewl_Attach_Dnd, 1);
+ dnd_data->cursor = c;
+ dnd_data->data = data;
+ dnd_data->size = size;
+ }
+
+ ewl_attach_other_set(w, EWL_ATTACH_TYPE_DND_DATA, dnd_data);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -205,147 +205,147 @@ ewl_attach_dnd_drag_set(Ewl_Widget *w, Ewl_Widget *c, void *data, int size)
void *
ewl_attach_get(Ewl_Widget *w, Ewl_Attach_Type t)
{
- Ewl_Attach *attach;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, NULL);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
-
- if (!w->attach)
- {
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
-
- attach = ewl_attach_list_get(w->attach, t);
- if (attach)
- {
- DRETURN_PTR(attach->data, DLEVEL_STABLE);
- }
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ Ewl_Attach *attach;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, NULL);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
+
+ if (!w->attach)
+ {
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
+
+ attach = ewl_attach_list_get(w->attach, t);
+ if (attach)
+ {
+ DRETURN_PTR(attach->data, DLEVEL_STABLE);
+ }
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
}
static Ewl_Attach_List *
ewl_attach_list_new(void)
{
- Ewl_Attach_List *list;
+ Ewl_Attach_List *list;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- list = NEW(Ewl_Attach_List, 1);
+ list = NEW(Ewl_Attach_List, 1);
- DRETURN_PTR(list, DLEVEL_STABLE);
+ DRETURN_PTR(list, DLEVEL_STABLE);
}
static void
ewl_attach_list_free(Ewl_Attach_List *list)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(list);
-
- if (list->direct)
- ewl_attach_list_del(list, EWL_ATTACH(list->list)->type);
- else
- {
- while (list->len)
- {
- if (!list->direct)
- ewl_attach_list_del(list,
- EWL_ATTACH(list->list[0])->type);
- else
- ewl_attach_list_del(list,
- EWL_ATTACH(list->list)->type);
- }
- }
- FREE(list);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(list);
+
+ if (list->direct)
+ ewl_attach_list_del(list, EWL_ATTACH(list->list)->type);
+ else
+ {
+ while (list->len)
+ {
+ if (!list->direct)
+ ewl_attach_list_del(list,
+ EWL_ATTACH(list->list[0])->type);
+ else
+ ewl_attach_list_del(list,
+ EWL_ATTACH(list->list)->type);
+ }
+ }
+ FREE(list);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_attach_list_add(Ewl_Attach_List *list, Ewl_Widget *parent, Ewl_Attach *attach)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(list);
- DCHECK_PARAM_PTR(attach);
-
- if (!list->len)
- {
- list->len = 1;
- list->direct = 1;
- list->list = (void *)attach;
-
- ewl_attach_attach_type_setup(parent, attach);
- DRETURN(DLEVEL_STABLE);
- }
- else if (list->direct)
- {
- Ewl_Attach *tmp;
- tmp = EWL_ATTACH(list->list);
-
- /* replace if the same type */
- if (tmp->type == attach->type)
- {
- ewl_attach_free(tmp);
- list->list = (void *)attach;
-
- ewl_attach_attach_type_setup(parent, attach);
- DRETURN(DLEVEL_STABLE);
- }
-
- list->list = malloc(sizeof(void *));
- list->list[0] = tmp;
- list->direct = 0;
- }
- else
- {
- unsigned int i;
- Ewl_Attach *tmp;
-
- /* replace if in list already */
- for (i = 0; i < list->len; i++)
- {
- tmp = EWL_ATTACH(list->list[i]);
- if (tmp->type == attach->type)
- {
- ewl_attach_free(tmp);
- list->list[i] = attach;
-
- ewl_attach_attach_type_setup(parent, attach);
- DRETURN(DLEVEL_STABLE);
- }
- }
- }
-
- list->len ++;
- list->list = realloc(list->list, list->len * sizeof(void *));
- list->list[list->len - 1] = attach;
-
- ewl_attach_attach_type_setup(parent, attach);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(list);
+ DCHECK_PARAM_PTR(attach);
+
+ if (!list->len)
+ {
+ list->len = 1;
+ list->direct = 1;
+ list->list = (void *)attach;
+
+ ewl_attach_attach_type_setup(parent, attach);
+ DRETURN(DLEVEL_STABLE);
+ }
+ else if (list->direct)
+ {
+ Ewl_Attach *tmp;
+ tmp = EWL_ATTACH(list->list);
+
+ /* replace if the same type */
+ if (tmp->type == attach->type)
+ {
+ ewl_attach_free(tmp);
+ list->list = (void *)attach;
+
+ ewl_attach_attach_type_setup(parent, attach);
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ list->list = malloc(sizeof(void *));
+ list->list[0] = tmp;
+ list->direct = 0;
+ }
+ else
+ {
+ unsigned int i;
+ Ewl_Attach *tmp;
+
+ /* replace if in list already */
+ for (i = 0; i < list->len; i++)
+ {
+ tmp = EWL_ATTACH(list->list[i]);
+ if (tmp->type == attach->type)
+ {
+ ewl_attach_free(tmp);
+ list->list[i] = attach;
+
+ ewl_attach_attach_type_setup(parent, attach);
+ DRETURN(DLEVEL_STABLE);
+ }
+ }
+ }
+
+ list->len ++;
+ list->list = realloc(list->list, list->len * sizeof(void *));
+ list->list[list->len - 1] = attach;
+
+ ewl_attach_attach_type_setup(parent, attach);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_attach_attach_type_setup(Ewl_Widget *w, Ewl_Attach *attach)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(attach);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- switch (attach->type)
- {
- case EWL_ATTACH_TYPE_TOOLTIP:
- ewl_attach_tooltip_attach(w, attach);
- break;
-
- case EWL_ATTACH_TYPE_COLOR:
- case EWL_ATTACH_TYPE_NAME:
- default:
- break;
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(attach);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ switch (attach->type)
+ {
+ case EWL_ATTACH_TYPE_TOOLTIP:
+ ewl_attach_tooltip_attach(w, attach);
+ break;
+
+ case EWL_ATTACH_TYPE_COLOR:
+ case EWL_ATTACH_TYPE_NAME:
+ default:
+ break;
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -357,437 +357,437 @@ ewl_attach_attach_type_setup(Ewl_Widget *w, Ewl_Attach *attach)
void
ewl_attach_list_del(Ewl_Attach_List *list, Ewl_Attach_Type type)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(list);
-
- if (!list->len)
- {
- DRETURN(DLEVEL_STABLE);
- }
- else if (list->direct)
- {
- Ewl_Attach *tmp;
-
- tmp = EWL_ATTACH(list->list);
- if (tmp->type == type)
- {
- ewl_attach_free(tmp);
- list->len --;
- list->direct = 0;
- list->list = NULL;
- }
- DRETURN(DLEVEL_STABLE);
- }
- else
- {
- unsigned int i;
- Ewl_Attach *tmp;
-
- for (i = 0; i < list->len; i++)
- {
- tmp = EWL_ATTACH(list->list[i]);
-
- if (tmp->type == type)
- {
- ewl_attach_free(tmp);
- list->len --;
-
- /* if not the last entry */
- if (i != list->len)
- memmove(list->list + i,
- list->list + i + 1,
- list->len * sizeof(void *));
-
- list->list = realloc(list->list,
- list->len * sizeof(void *));
- }
- }
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(list);
+
+ if (!list->len)
+ {
+ DRETURN(DLEVEL_STABLE);
+ }
+ else if (list->direct)
+ {
+ Ewl_Attach *tmp;
+
+ tmp = EWL_ATTACH(list->list);
+ if (tmp->type == type)
+ {
+ ewl_attach_free(tmp);
+ list->len --;
+ list->direct = 0;
+ list->list = NULL;
+ }
+ DRETURN(DLEVEL_STABLE);
+ }
+ else
+ {
+ unsigned int i;
+ Ewl_Attach *tmp;
+
+ for (i = 0; i < list->len; i++)
+ {
+ tmp = EWL_ATTACH(list->list[i]);
+
+ if (tmp->type == type)
+ {
+ ewl_attach_free(tmp);
+ list->len --;
+
+ /* if not the last entry */
+ if (i != list->len)
+ memmove(list->list + i,
+ list->list + i + 1,
+ list->len * sizeof(void *));
+
+ list->list = realloc(list->list,
+ list->len * sizeof(void *));
+ }
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void *
ewl_attach_list_get(Ewl_Attach_List *list, Ewl_Attach_Type type)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(list, NULL);
-
- if (!list->len)
- {
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
- else if (list->direct)
- {
- Ewl_Attach *tmp;
-
- tmp = EWL_ATTACH(list->list);
- if (tmp->type == type)
- {
- DRETURN_PTR(tmp, DLEVEL_STABLE);
- }
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
- else
- {
- unsigned int i;
- Ewl_Attach *tmp;
-
- for (i = 0; i < list->len; i++)
- {
- tmp = EWL_ATTACH(list->list[i]);
-
- if (tmp->type == type)
- {
- DRETURN_PTR(tmp, DLEVEL_STABLE);
- }
- }
- }
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(list, NULL);
+
+ if (!list->len)
+ {
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
+ else if (list->direct)
+ {
+ Ewl_Attach *tmp;
+
+ tmp = EWL_ATTACH(list->list);
+ if (tmp->type == type)
+ {
+ DRETURN_PTR(tmp, DLEVEL_STABLE);
+ }
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
+ else
+ {
+ unsigned int i;
+ Ewl_Attach *tmp;
+
+ for (i = 0; i < list->len; i++)
+ {
+ tmp = EWL_ATTACH(list->list[i]);
+
+ if (tmp->type == type)
+ {
+ DRETURN_PTR(tmp, DLEVEL_STABLE);
+ }
+ }
+ }
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
}
static Ewl_Attach *
ewl_attach_new(Ewl_Attach_Type t, Ewl_Attach_Data_Type dt, void *data)
{
- Ewl_Attach *attach;
+ Ewl_Attach *attach;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- attach = NEW(Ewl_Attach, 1);
- if (!attach)
- {
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ attach = NEW(Ewl_Attach, 1);
+ if (!attach)
+ {
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- if (!ewl_attach_init(attach, t, dt, data))
- {
- FREE(attach);
- }
+ if (!ewl_attach_init(attach, t, dt, data))
+ {
+ FREE(attach);
+ }
- DRETURN_PTR(attach, DLEVEL_STABLE);
+ DRETURN_PTR(attach, DLEVEL_STABLE);
}
static int
ewl_attach_init(Ewl_Attach *attach, Ewl_Attach_Type t,
- Ewl_Attach_Data_Type dt, void *data)
+ Ewl_Attach_Data_Type dt, void *data)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(attach, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(attach, FALSE);
- attach->type = t;
+ attach->type = t;
- if (dt == EWL_ATTACH_DATA_TYPE_TEXT)
- attach->data = strdup(data);
- else
- attach->data = data;
- attach->data_type = dt;
+ if (dt == EWL_ATTACH_DATA_TYPE_TEXT)
+ attach->data = strdup(data);
+ else
+ attach->data = data;
+ attach->data_type = dt;
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static void
ewl_attach_free(Ewl_Attach *attach)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(attach);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(attach);
- /* XXX should we clean up _WIDGET in here? */
+ /* XXX should we clean up _WIDGET in here? */
- if ((attach->data_type == EWL_ATTACH_DATA_TYPE_TEXT))
- {
- IF_FREE(attach->data);
- }
+ if ((attach->data_type == EWL_ATTACH_DATA_TYPE_TEXT))
+ {
+ IF_FREE(attach->data);
+ }
- IF_FREE(attach);
+ IF_FREE(attach);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_attach_parent_setup(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- w->attach = ewl_attach_list_new();
- ewl_callback_prepend(w, EWL_CALLBACK_DESTROY,
- ewl_attach_cb_parent_destroy, NULL);
+ w->attach = ewl_attach_list_new();
+ ewl_callback_prepend(w, EWL_CALLBACK_DESTROY,
+ ewl_attach_cb_parent_destroy, NULL);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_attach_cb_parent_destroy(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- /* make sure the timer gets cleaned up if the widget goes away */
- if ((ewl_attach_tooltip) && (w == ewl_attach_tooltip->to)
- && (ewl_attach_tooltip->timer))
- {
- ecore_timer_del(ewl_attach_tooltip->timer);
- ewl_attach_tooltip->timer = NULL;
- }
-
- if (w->attach)
- ewl_attach_list_free(w->attach);
- w->attach = NULL;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ /* make sure the timer gets cleaned up if the widget goes away */
+ if ((ewl_attach_tooltip) && (w == ewl_attach_tooltip->to)
+ && (ewl_attach_tooltip->timer))
+ {
+ ecore_timer_del(ewl_attach_tooltip->timer);
+ ewl_attach_tooltip->timer = NULL;
+ }
+
+ if (w->attach)
+ ewl_attach_list_free(w->attach);
+ w->attach = NULL;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_attach_tooltip_attach(Ewl_Widget *w, Ewl_Attach *attach)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(attach);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE,
- ewl_attach_cb_tooltip_mouse_move, NULL);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_DOWN,
- ewl_attach_cb_tooltip_mouse_down, NULL);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_OUT,
- ewl_attach_cb_tooltip_mouse_out, NULL);
- ewl_callback_append(w, EWL_CALLBACK_OBSCURE,
- ewl_attach_cb_tooltip_mouse_out, NULL);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(attach);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE,
+ ewl_attach_cb_tooltip_mouse_move, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_DOWN,
+ ewl_attach_cb_tooltip_mouse_down, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_OUT,
+ ewl_attach_cb_tooltip_mouse_out, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_OBSCURE,
+ ewl_attach_cb_tooltip_mouse_out, NULL);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_attach_tooltip_detach(Ewl_Attach *attach)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(attach);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(attach);
- /* make sure the display attach is our attach */
- if (!ewl_attach_tooltip || (ewl_attach_tooltip->attach != attach))
- DRETURN(DLEVEL_STABLE);
+ /* make sure the display attach is our attach */
+ if (!ewl_attach_tooltip || (ewl_attach_tooltip->attach != attach))
+ DRETURN(DLEVEL_STABLE);
- if (ewl_attach_tooltip->timer)
- ecore_timer_del(ewl_attach_tooltip->timer);
+ if (ewl_attach_tooltip->timer)
+ ecore_timer_del(ewl_attach_tooltip->timer);
- ewl_attach_tooltip->timer = NULL;
- ewl_attach_tooltip->to = NULL;
- ewl_attach_tooltip->x = 0;
- ewl_attach_tooltip->y = 0;
+ ewl_attach_tooltip->timer = NULL;
+ ewl_attach_tooltip->to = NULL;
+ ewl_attach_tooltip->x = 0;
+ ewl_attach_tooltip->y = 0;
- /* cleanup the display window */
- if (ewl_attach_tooltip->box)
- {
- if (attach->data_type != EWL_ATTACH_DATA_TYPE_TEXT)
- ewl_container_child_remove(
- EWL_CONTAINER(ewl_attach_tooltip->box),
- EWL_WIDGET(attach->data));
+ /* cleanup the display window */
+ if (ewl_attach_tooltip->box)
+ {
+ if (attach->data_type != EWL_ATTACH_DATA_TYPE_TEXT)
+ ewl_container_child_remove(
+ EWL_CONTAINER(ewl_attach_tooltip->box),
+ EWL_WIDGET(attach->data));
- ewl_widget_destroy(ewl_attach_tooltip->box);
- ewl_attach_tooltip->box = NULL;
- }
+ ewl_widget_destroy(ewl_attach_tooltip->box);
+ ewl_attach_tooltip->box = NULL;
+ }
- /* destroy window if needed */
- if (ewl_attach_tooltip->win && VISIBLE(ewl_attach_tooltip->win))
- ewl_widget_hide(ewl_attach_tooltip->win);
+ /* destroy window if needed */
+ if (ewl_attach_tooltip->win && VISIBLE(ewl_attach_tooltip->win))
+ ewl_widget_hide(ewl_attach_tooltip->win);
- ewl_attach_tooltip->attach = NULL;
+ ewl_attach_tooltip->attach = NULL;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_attach_cb_tooltip_mouse_move(Ewl_Widget *w, void *ev, void *data __UNUSED__)
{
- Ewl_Attach *attach;
- Ewl_Event_Mouse *e;
- const char *delay_str;
- double delay = 1.0;
+ Ewl_Attach *attach;
+ Ewl_Event_Mouse *e;
+ const char *delay_str;
+ double delay = 1.0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(ev);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(ev);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- e = ev;
- attach = ewl_attach_list_get(w->attach, EWL_ATTACH_TYPE_TOOLTIP);
- if (!attach)
- DRETURN(DLEVEL_STABLE);
+ e = ev;
+ attach = ewl_attach_list_get(w->attach, EWL_ATTACH_TYPE_TOOLTIP);
+ if (!attach)
+ DRETURN(DLEVEL_STABLE);
- if (!ewl_attach_tooltip)
- ewl_attach_tooltip = NEW(Ewl_Attach_Tooltip, 1);
+ if (!ewl_attach_tooltip)
+ ewl_attach_tooltip = NEW(Ewl_Attach_Tooltip, 1);
- /* we only want to kill this tooltip if the move is outside
- * the move tolerance */
- if (ewl_attach_tooltip && (ewl_attach_tooltip->attach == attach))
- {
- int amt = 0;
+ /* we only want to kill this tooltip if the move is outside
+ * the move tolerance */
+ if (ewl_attach_tooltip && (ewl_attach_tooltip->attach == attach))
+ {
+ int amt = 0;
- amt = ewl_theme_data_int_get(w, "/tooltip/tolerance");
- if ((e->x >= (ewl_attach_tooltip->x - amt))
- && (e->x <= (ewl_attach_tooltip->x + amt))
- && (e->y >= (ewl_attach_tooltip->y - amt))
- && (e->y <= (ewl_attach_tooltip->y + amt)))
- DRETURN(DLEVEL_STABLE);
- }
+ amt = ewl_theme_data_int_get(w, "/tooltip/tolerance");
+ if ((e->x >= (ewl_attach_tooltip->x - amt))
+ && (e->x <= (ewl_attach_tooltip->x + amt))
+ && (e->y >= (ewl_attach_tooltip->y - amt))
+ && (e->y <= (ewl_attach_tooltip->y + amt)))
+ DRETURN(DLEVEL_STABLE);
+ }
- ewl_attach_tooltip_detach(attach);
+ ewl_attach_tooltip_detach(attach);
- ewl_attach_tooltip->attach = attach;
- ewl_attach_tooltip->to = w;
+ ewl_attach_tooltip->attach = attach;
+ ewl_attach_tooltip->to = w;
- ewl_attach_tooltip->x = e->x;
- ewl_attach_tooltip->y = e->y;
+ ewl_attach_tooltip->x = e->x;
+ ewl_attach_tooltip->y = e->y;
- delay_str = (const char *)ewl_theme_data_str_get(w, "/tooltip/delay");
- if (delay_str) delay = atof(delay_str);
+ delay_str = (const char *)ewl_theme_data_str_get(w, "/tooltip/delay");
+ if (delay_str) delay = atof(delay_str);
- ewl_attach_tooltip->timer = ecore_timer_add(delay,
- ewl_attach_cb_tooltip_timer, w);
+ ewl_attach_tooltip->timer = ecore_timer_add(delay,
+ ewl_attach_cb_tooltip_timer, w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_attach_cb_tooltip_mouse_down(Ewl_Widget *w __UNUSED__,
- void *ev __UNUSED__, void *data __UNUSED__)
+ void *ev __UNUSED__, void *data __UNUSED__)
{
- Ewl_Attach *attach;
+ Ewl_Attach *attach;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- attach = ewl_attach_list_get(w->attach, EWL_ATTACH_TYPE_TOOLTIP);
- if (!attach) DRETURN(DLEVEL_STABLE);
- ewl_attach_tooltip_detach(attach);
+ attach = ewl_attach_list_get(w->attach, EWL_ATTACH_TYPE_TOOLTIP);
+ if (!attach) DRETURN(DLEVEL_STABLE);
+ ewl_attach_tooltip_detach(attach);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_attach_cb_tooltip_mouse_out(Ewl_Widget *w __UNUSED__,
- void *ev __UNUSED__, void *data __UNUSED__)
+ void *ev __UNUSED__, void *data __UNUSED__)
{
- Ewl_Attach *attach;
+ Ewl_Attach *attach;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- attach = ewl_attach_list_get(w->attach, EWL_ATTACH_TYPE_TOOLTIP);
- if (!attach) DRETURN(DLEVEL_STABLE);
- ewl_attach_tooltip_detach(attach);
+ attach = ewl_attach_list_get(w->attach, EWL_ATTACH_TYPE_TOOLTIP);
+ if (!attach) DRETURN(DLEVEL_STABLE);
+ ewl_attach_tooltip_detach(attach);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static int
ewl_attach_cb_tooltip_timer(void *data)
{
- Ewl_Widget *w;
- Ewl_Embed *emb;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, ECORE_CALLBACK_CANCEL);
-
- /* we are returning false so that will shutdown the timer, just need
- * to make sure we don't try to del it a second time so set it NULL */
- ewl_attach_tooltip->timer = NULL;
-
- w = data;
- emb = ewl_embed_widget_find(w);
- if (!emb)
- DRETURN_INT(ECORE_CALLBACK_CANCEL, DLEVEL_STABLE);
-
- if (!(ewl_attach_tooltip->win))
- {
- int oh, ov;
-
- ewl_attach_tooltip->win = ewl_popup_new();
- ewl_popup_type_set(EWL_POPUP(ewl_attach_tooltip->win),
- EWL_POPUP_TYPE_MOUSE);
- ewl_popup_follow_set(EWL_POPUP(ewl_attach_tooltip->win),
- EWL_WIDGET(emb));
- ewl_attach_tooltip->embed = EWL_WIDGET(emb);
- ewl_callback_prepend(ewl_attach_tooltip->win,
- EWL_CALLBACK_DESTROY,
- ewl_attach_cb_tooltip_win_destroy,
- NULL);
-
- ov = ewl_theme_data_int_get(EWL_WIDGET(w),
- "/tooltip/voffset");
- oh = ewl_theme_data_int_get(EWL_WIDGET(w),
- "/tooltip/hoffset");
-
- ewl_popup_offset_set(EWL_POPUP(ewl_attach_tooltip->win),
- oh, ov);
- ewl_widget_appearance_set(ewl_attach_tooltip->win,
- EWL_ATTACH_TOOLTIP_TYPE);
- ewl_widget_inherit(ewl_attach_tooltip->win,
- EWL_ATTACH_TOOLTIP_TYPE);
- }
- else
- {
- /* see if we need to add to the embed */
- if ((!ewl_attach_tooltip->embed)
- || (ewl_attach_tooltip->embed
- != EWL_WIDGET(emb)))
- {
- ewl_attach_tooltip->embed = EWL_WIDGET(emb);
- ewl_popup_follow_set(EWL_POPUP(ewl_attach_tooltip->win),
- ewl_attach_tooltip->embed);
- }
- }
- ewl_widget_show(ewl_attach_tooltip->win);
-
- if (!(ewl_attach_tooltip->box))
- {
- ewl_attach_tooltip->box = ewl_hbox_new();
- ewl_container_child_append(
- EWL_CONTAINER(ewl_attach_tooltip->win),
- ewl_attach_tooltip->box);
- }
- ewl_widget_show(ewl_attach_tooltip->box);
-
- if (ewl_attach_tooltip->attach->data_type ==
- EWL_ATTACH_DATA_TYPE_WIDGET)
- {
- ewl_container_child_append(
- EWL_CONTAINER(ewl_attach_tooltip->box),
- EWL_WIDGET(ewl_attach_tooltip->attach->data));
-
- ewl_widget_show(EWL_WIDGET(ewl_attach_tooltip->attach->data));
- }
- else
- {
- Ewl_Widget *o;
-
- o = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(o),
- ewl_attach_tooltip->attach->data);
- ewl_container_child_append(
- EWL_CONTAINER(ewl_attach_tooltip->box), o);
- ewl_widget_show(o);
- }
-
- ewl_popup_mouse_position_set(EWL_POPUP(ewl_attach_tooltip->win),
- ewl_attach_tooltip->x,
- ewl_attach_tooltip->y);
-
- DRETURN_INT(ECORE_CALLBACK_CANCEL, DLEVEL_STABLE);
+ Ewl_Widget *w;
+ Ewl_Embed *emb;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, ECORE_CALLBACK_CANCEL);
+
+ /* we are returning false so that will shutdown the timer, just need
+ * to make sure we don't try to del it a second time so set it NULL */
+ ewl_attach_tooltip->timer = NULL;
+
+ w = data;
+ emb = ewl_embed_widget_find(w);
+ if (!emb)
+ DRETURN_INT(ECORE_CALLBACK_CANCEL, DLEVEL_STABLE);
+
+ if (!(ewl_attach_tooltip->win))
+ {
+ int oh, ov;
+
+ ewl_attach_tooltip->win = ewl_popup_new();
+ ewl_popup_type_set(EWL_POPUP(ewl_attach_tooltip->win),
+ EWL_POPUP_TYPE_MOUSE);
+ ewl_popup_follow_set(EWL_POPUP(ewl_attach_tooltip->win),
+ EWL_WIDGET(emb));
+ ewl_attach_tooltip->embed = EWL_WIDGET(emb);
+ ewl_callback_prepend(ewl_attach_tooltip->win,
+ EWL_CALLBACK_DESTROY,
+ ewl_attach_cb_tooltip_win_destroy,
+ NULL);
+
+ ov = ewl_theme_data_int_get(EWL_WIDGET(w),
+ "/tooltip/voffset");
+ oh = ewl_theme_data_int_get(EWL_WIDGET(w),
+ "/tooltip/hoffset");
+
+ ewl_popup_offset_set(EWL_POPUP(ewl_attach_tooltip->win),
+ oh, ov);
+ ewl_widget_appearance_set(ewl_attach_tooltip->win,
+ EWL_ATTACH_TOOLTIP_TYPE);
+ ewl_widget_inherit(ewl_attach_tooltip->win,
+ EWL_ATTACH_TOOLTIP_TYPE);
+ }
+ else
+ {
+ /* see if we need to add to the embed */
+ if ((!ewl_attach_tooltip->embed)
+ || (ewl_attach_tooltip->embed
+ != EWL_WIDGET(emb)))
+ {
+ ewl_attach_tooltip->embed = EWL_WIDGET(emb);
+ ewl_popup_follow_set(EWL_POPUP(ewl_attach_tooltip->win),
+ ewl_attach_tooltip->embed);
+ }
+ }
+ ewl_widget_show(ewl_attach_tooltip->win);
+
+ if (!(ewl_attach_tooltip->box))
+ {
+ ewl_attach_tooltip->box = ewl_hbox_new();
+ ewl_container_child_append(
+ EWL_CONTAINER(ewl_attach_tooltip->win),
+ ewl_attach_tooltip->box);
+ }
+ ewl_widget_show(ewl_attach_tooltip->box);
+
+ if (ewl_attach_tooltip->attach->data_type ==
+ EWL_ATTACH_DATA_TYPE_WIDGET)
+ {
+ ewl_container_child_append(
+ EWL_CONTAINER(ewl_attach_tooltip->box),
+ EWL_WIDGET(ewl_attach_tooltip->attach->data));
+
+ ewl_widget_show(EWL_WIDGET(ewl_attach_tooltip->attach->data));
+ }
+ else
+ {
+ Ewl_Widget *o;
+
+ o = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(o),
+ ewl_attach_tooltip->attach->data);
+ ewl_container_child_append(
+ EWL_CONTAINER(ewl_attach_tooltip->box), o);
+ ewl_widget_show(o);
+ }
+
+ ewl_popup_mouse_position_set(EWL_POPUP(ewl_attach_tooltip->win),
+ ewl_attach_tooltip->x,
+ ewl_attach_tooltip->y);
+
+ DRETURN_INT(ECORE_CALLBACK_CANCEL, DLEVEL_STABLE);
}
static void
ewl_attach_cb_tooltip_win_destroy(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ewl_attach_tooltip->embed = NULL;
- ewl_attach_tooltip->win = NULL;
- ewl_attach_tooltip->box = NULL;
+ ewl_attach_tooltip->embed = NULL;
+ ewl_attach_tooltip->win = NULL;
+ ewl_attach_tooltip->box = NULL;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_attach.h b/src/lib/ewl_attach.h
index 095a81b..7403e1d 100644
--- a/src/lib/ewl_attach.h
+++ b/src/lib/ewl_attach.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_ATTACH_H
#define EWL_ATTACH_H
@@ -37,11 +37,11 @@ typedef struct Ewl_Attach Ewl_Attach;
*/
struct Ewl_Attach
{
- Ewl_Attach_Type type; /**< The type of the attachment */
- Ewl_Attach_Data_Type data_type; /**< The data type of the attachment */
+ Ewl_Attach_Type type; /**< The type of the attachment */
+ Ewl_Attach_Data_Type data_type; /**< The data type of the attachment */
- void *data; /**< The attachment data */
- void *priv_data; /**< Any private data in the attachment */
+ void *data; /**< The attachment data */
+ void *priv_data; /**< Any private data in the attachment */
};
/**
@@ -54,9 +54,9 @@ typedef struct Ewl_Attach_Dnd Ewl_Attach_Dnd;
*/
struct Ewl_Attach_Dnd
{
- Ewl_Widget *cursor; /**< Cursor displayed for DND */
- void *data; /**< The attachment data */
- int size; /**< Any private data in the attachment */
+ Ewl_Widget *cursor; /**< Cursor displayed for DND */
+ void *data; /**< The attachment data */
+ int size; /**< Any private data in the attachment */
};
/**
@@ -64,14 +64,14 @@ struct Ewl_Attach_Dnd
* Convenience method to set a tooltip text attachment
*/
#define ewl_attach_tooltip_text_set(w, data) \
- ewl_attach_text_set(EWL_WIDGET(w), EWL_ATTACH_TYPE_TOOLTIP, data)
+ ewl_attach_text_set(EWL_WIDGET(w), EWL_ATTACH_TYPE_TOOLTIP, data)
/**
* @def ewl_attach_tooltip_widget_set(w, data)
* Convenience method to set a tooltip widget attachement
*/
#define ewl_attach_tooltip_widget_set(w, data) \
- ewl_attach_widget_set(EWL_WIDGET(w), EWL_ATTACH_TYPE_TOOLTIP, data)
+ ewl_attach_widget_set(EWL_WIDGET(w), EWL_ATTACH_TYPE_TOOLTIP, data)
/**
@@ -79,59 +79,59 @@ struct Ewl_Attach_Dnd
* Convenience method to set a cursor widget attachment
*/
#define ewl_attach_mouse_cursor_set(w, data) \
- ewl_attach_other_set(EWL_WIDGET(w), EWL_ATTACH_TYPE_MOUSE_CURSOR, \
- (int *)data)
+ ewl_attach_other_set(EWL_WIDGET(w), EWL_ATTACH_TYPE_MOUSE_CURSOR, \
+ (int *)data)
/**
* @def ewl_attach_mouse_argb_cursor_set(w, cursor)
* Convenience method to attach data to a notebook item
*/
#define ewl_attach_mouse_argb_cursor_set(w, cursor) \
- ewl_attach_other_set(EWL_WIDGET(w), \
- EWL_ATTACH_TYPE_MOUSE_ARGB_CURSOR, cursor)
+ ewl_attach_other_set(EWL_WIDGET(w), \
+ EWL_ATTACH_TYPE_MOUSE_ARGB_CURSOR, cursor)
/**
* @def ewl_attach_color_set(w, data)
* Convenience method to set a colour widget attachment
*/
#define ewl_attach_color_set(w, data) \
- ewl_attach_other_set(EWL_WIDGET(w), EWL_ATTACH_TYPE_COLOR, data)
+ ewl_attach_other_set(EWL_WIDGET(w), EWL_ATTACH_TYPE_COLOR, data)
/**
* @def ewl_attach_color_get(w)
* Convenience method to get a colour attachment back
*/
#define ewl_attach_color_get(w) \
- ewl_attach_get(EWL_WIDGET(w), EWL_ATTACH_TYPE_COLOR)
+ ewl_attach_get(EWL_WIDGET(w), EWL_ATTACH_TYPE_COLOR)
/**
* @def ewl_attach_name_set(w, data)
* Convenience method to set a widget name attachment
*/
#define ewl_attach_name_set(w, data) \
- ewl_attach_text_set(EWL_WIDGET(w), EWL_ATTACH_TYPE_NAME, data)
+ ewl_attach_text_set(EWL_WIDGET(w), EWL_ATTACH_TYPE_NAME, data)
/**
* @def ewl_attach_name_get(w)
* Convenience method to get a widgets name attachment
*/
#define ewl_attach_name_get(w) \
- ewl_attach_get(EWL_WIDGET(w), EWL_ATTACH_TYPE_NAME)
+ ewl_attach_get(EWL_WIDGET(w), EWL_ATTACH_TYPE_NAME)
/**
* @def ewl_attach_widget_association_set(w, data)
* Convenience method to attach data to a notebook item
*/
#define ewl_attach_widget_association_set(w, data) \
- ewl_attach_other_set(EWL_WIDGET(w), \
- EWL_ATTACH_TYPE_WIDGET_ASSOCIATION, data)
+ ewl_attach_other_set(EWL_WIDGET(w), \
+ EWL_ATTACH_TYPE_WIDGET_ASSOCIATION, data)
/**
* @def ewl_attach_widget_association_get(w)
* Convenience method to get the data attached to a notebook item
*/
#define ewl_attach_widget_association_get(w) \
- ewl_attach_get(EWL_WIDGET(w), EWL_ATTACH_TYPE_WIDGET_ASSOCIATION)
+ ewl_attach_get(EWL_WIDGET(w), EWL_ATTACH_TYPE_WIDGET_ASSOCIATION)
void ewl_attach_text_set(Ewl_Widget *w, Ewl_Attach_Type t, const char *data);
void ewl_attach_widget_set(Ewl_Widget *w, Ewl_Attach_Type t, Ewl_Widget *data);
diff --git a/src/lib/ewl_base.h b/src/lib/ewl_base.h
index 7f12ea2..5dcf15d 100644
--- a/src/lib/ewl_base.h
+++ b/src/lib/ewl_base.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
/*
* Header that wraps the core widget functionality includes to insure they are
* included in the proper order.
diff --git a/src/lib/ewl_border.c b/src/lib/ewl_border.c
index 2bbcad5..c8b00b6 100644
--- a/src/lib/ewl_border.c
+++ b/src/lib/ewl_border.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_border.h"
#include "ewl_label.h"
@@ -13,21 +13,21 @@
Ewl_Widget *
ewl_border_new(void)
{
- Ewl_Border *b;
+ Ewl_Border *b;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- b = NEW(Ewl_Border, 1);
- if (!b) {
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ b = NEW(Ewl_Border, 1);
+ if (!b) {
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- if (!ewl_border_init(b)) {
- ewl_widget_destroy(EWL_WIDGET(b));
- b = NULL;
- }
+ if (!ewl_border_init(b)) {
+ ewl_widget_destroy(EWL_WIDGET(b));
+ b = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(b), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(b), DLEVEL_STABLE);
}
/**
@@ -38,37 +38,37 @@ ewl_border_new(void)
int
ewl_border_init(Ewl_Border * b)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(b, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(b, FALSE);
- w = EWL_WIDGET(b);
+ w = EWL_WIDGET(b);
- if (!ewl_box_init(EWL_BOX(w))) {
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
- ewl_box_orientation_set(EWL_BOX(w), EWL_ORIENTATION_VERTICAL);
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_FILL);
+ if (!ewl_box_init(EWL_BOX(w))) {
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+ ewl_box_orientation_set(EWL_BOX(w), EWL_ORIENTATION_VERTICAL);
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_FILL);
- ewl_widget_appearance_set(EWL_WIDGET(b), EWL_BORDER_TYPE);
- ewl_widget_inherit(EWL_WIDGET(b), EWL_BORDER_TYPE);
+ ewl_widget_appearance_set(EWL_WIDGET(b), EWL_BORDER_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(b), EWL_BORDER_TYPE);
- b->label = ewl_label_new();
- ewl_widget_internal_set(b->label, TRUE);
- ewl_container_child_append(EWL_CONTAINER(b), b->label);
- ewl_widget_show(b->label);
+ b->label = ewl_label_new();
+ ewl_widget_internal_set(b->label, TRUE);
+ ewl_container_child_append(EWL_CONTAINER(b), b->label);
+ ewl_widget_show(b->label);
- b->body = ewl_vbox_new();
- ewl_widget_internal_set(b->body, TRUE);
- ewl_container_child_append(EWL_CONTAINER(b), b->body);
- ewl_widget_show(b->body);
+ b->body = ewl_vbox_new();
+ ewl_widget_internal_set(b->body, TRUE);
+ ewl_container_child_append(EWL_CONTAINER(b), b->body);
+ ewl_widget_show(b->body);
- b->label_position = EWL_POSITION_TOP;
+ b->label_position = EWL_POSITION_TOP;
- ewl_container_redirect_set(EWL_CONTAINER(b), EWL_CONTAINER(b->body));
+ ewl_container_redirect_set(EWL_CONTAINER(b), EWL_CONTAINER(b->body));
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -82,13 +82,13 @@ ewl_border_init(Ewl_Border * b)
void
ewl_border_label_set(Ewl_Border *b, const char *t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(b);
- DCHECK_TYPE(b, EWL_BORDER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(b);
+ DCHECK_TYPE(b, EWL_BORDER_TYPE);
- ewl_label_text_set(EWL_LABEL(b->label), t);
+ ewl_label_text_set(EWL_LABEL(b->label), t);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -99,11 +99,11 @@ ewl_border_label_set(Ewl_Border *b, const char *t)
const char *
ewl_border_label_get(Ewl_Border *b)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(b, NULL);
- DCHECK_TYPE_RET(b, EWL_BORDER_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(b, NULL);
+ DCHECK_TYPE_RET(b, EWL_BORDER_TYPE, NULL);
- DRETURN_PTR(ewl_label_text_get(EWL_LABEL(b->label)), DLEVEL_STABLE);
+ DRETURN_PTR(ewl_label_text_get(EWL_LABEL(b->label)), DLEVEL_STABLE);
}
/**
@@ -115,46 +115,46 @@ ewl_border_label_get(Ewl_Border *b)
void
ewl_border_label_position_set(Ewl_Border *b, Ewl_Position pos)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(b);
- DCHECK_TYPE(b, EWL_BORDER_TYPE);
-
- if (b->label_position == pos)
- DRETURN(DLEVEL_STABLE);
-
- b->label_position = pos;
- switch (b->label_position) {
- case EWL_POSITION_LEFT:
- case EWL_POSITION_RIGHT:
- ewl_box_orientation_set(EWL_BOX(b),
- EWL_ORIENTATION_HORIZONTAL);
- break;
-
- case EWL_POSITION_TOP:
- case EWL_POSITION_BOTTOM:
- default:
- ewl_box_orientation_set(EWL_BOX(b),
- EWL_ORIENTATION_VERTICAL);
- break;
- }
- ewl_widget_appearance_set(EWL_WIDGET(b), EWL_BORDER_TYPE);
-
- /* need to remove the redirect so the label gets added back into the
- * border and not into the body. We put the redirect back on after
- */
- ewl_container_redirect_set(EWL_CONTAINER(b), NULL);
- ewl_container_child_remove(EWL_CONTAINER(b), b->label);
-
- if ((b->label_position == EWL_POSITION_LEFT)
- || (b->label_position == EWL_POSITION_TOP))
- ewl_container_child_prepend(EWL_CONTAINER(b), b->label);
- else
- ewl_container_child_append(EWL_CONTAINER(b), b->label);
-
- ewl_container_redirect_set(EWL_CONTAINER(b), EWL_CONTAINER(b->body));
- ewl_widget_configure(EWL_WIDGET(b));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(b);
+ DCHECK_TYPE(b, EWL_BORDER_TYPE);
+
+ if (b->label_position == pos)
+ DRETURN(DLEVEL_STABLE);
+
+ b->label_position = pos;
+ switch (b->label_position) {
+ case EWL_POSITION_LEFT:
+ case EWL_POSITION_RIGHT:
+ ewl_box_orientation_set(EWL_BOX(b),
+ EWL_ORIENTATION_HORIZONTAL);
+ break;
+
+ case EWL_POSITION_TOP:
+ case EWL_POSITION_BOTTOM:
+ default:
+ ewl_box_orientation_set(EWL_BOX(b),
+ EWL_ORIENTATION_VERTICAL);
+ break;
+ }
+ ewl_widget_appearance_set(EWL_WIDGET(b), EWL_BORDER_TYPE);
+
+ /* need to remove the redirect so the label gets added back into the
+ * border and not into the body. We put the redirect back on after
+ */
+ ewl_container_redirect_set(EWL_CONTAINER(b), NULL);
+ ewl_container_child_remove(EWL_CONTAINER(b), b->label);
+
+ if ((b->label_position == EWL_POSITION_LEFT)
+ || (b->label_position == EWL_POSITION_TOP))
+ ewl_container_child_prepend(EWL_CONTAINER(b), b->label);
+ else
+ ewl_container_child_append(EWL_CONTAINER(b), b->label);
+
+ ewl_container_redirect_set(EWL_CONTAINER(b), EWL_CONTAINER(b->body));
+ ewl_widget_configure(EWL_WIDGET(b));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -165,11 +165,11 @@ ewl_border_label_position_set(Ewl_Border *b, Ewl_Position pos)
Ewl_Position
ewl_border_label_position_get(Ewl_Border *b)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(b, EWL_POSITION_LEFT);
- DCHECK_TYPE_RET(b, EWL_BORDER_TYPE, EWL_POSITION_LEFT);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(b, EWL_POSITION_LEFT);
+ DCHECK_TYPE_RET(b, EWL_BORDER_TYPE, EWL_POSITION_LEFT);
- DRETURN_INT(b->label_position, DLEVEL_STABLE);
+ DRETURN_INT(b->label_position, DLEVEL_STABLE);
}
/**
@@ -181,13 +181,13 @@ ewl_border_label_position_get(Ewl_Border *b)
void
ewl_border_label_alignment_set(Ewl_Border *b, unsigned int align)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(b);
- DCHECK_TYPE(b, EWL_BORDER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(b);
+ DCHECK_TYPE(b, EWL_BORDER_TYPE);
- ewl_object_alignment_set(EWL_OBJECT(b->label), align);
+ ewl_object_alignment_set(EWL_OBJECT(b->label), align);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -198,15 +198,15 @@ ewl_border_label_alignment_set(Ewl_Border *b, unsigned int align)
unsigned int
ewl_border_label_alignment_get(Ewl_Border *b)
{
- unsigned int align;
+ unsigned int align;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(b, 0);
- DCHECK_TYPE_RET(b, EWL_BORDER_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(b, 0);
+ DCHECK_TYPE_RET(b, EWL_BORDER_TYPE, 0);
- align = ewl_object_alignment_get(EWL_OBJECT(b->label));
+ align = ewl_object_alignment_get(EWL_OBJECT(b->label));
- DRETURN_INT(align, DLEVEL_STABLE);
+ DRETURN_INT(align, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_border.h b/src/lib/ewl_border.h
index 19720f0..55c68f8 100644
--- a/src/lib/ewl_border.h
+++ b/src/lib/ewl_border.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_BORDER_H
#define EWL_BORDER_H
@@ -51,24 +51,24 @@ typedef struct Ewl_Border Ewl_Border;
*/
struct Ewl_Border
{
- Ewl_Box box; /**< Inherit from Ewl_Box */
- Ewl_Widget *label; /**< Text label for the border */
- Ewl_Widget *body; /**< Box for holding children */
- Ewl_Position label_position; /**< Flags for placing the label */
+ Ewl_Box box; /**< Inherit from Ewl_Box */
+ Ewl_Widget *label; /**< Text label for the border */
+ Ewl_Widget *body; /**< Box for holding children */
+ Ewl_Position label_position; /**< Flags for placing the label */
};
-Ewl_Widget *ewl_border_new(void);
-int ewl_border_init(Ewl_Border * b);
+Ewl_Widget *ewl_border_new(void);
+int ewl_border_init(Ewl_Border * b);
-void ewl_border_label_set(Ewl_Border *b, const char *t);
-const char *ewl_border_label_get(Ewl_Border *b);
+void ewl_border_label_set(Ewl_Border *b, const char *t);
+const char *ewl_border_label_get(Ewl_Border *b);
-void ewl_border_label_position_set(Ewl_Border *b, Ewl_Position pos);
-Ewl_Position ewl_border_label_position_get(Ewl_Border *b);
+void ewl_border_label_position_set(Ewl_Border *b, Ewl_Position pos);
+Ewl_Position ewl_border_label_position_get(Ewl_Border *b);
-void ewl_border_label_alignment_set(Ewl_Border *b,
- unsigned int align);
-unsigned int ewl_border_label_alignment_get(Ewl_Border *b);
+void ewl_border_label_alignment_set(Ewl_Border *b,
+ unsigned int align);
+unsigned int ewl_border_label_alignment_get(Ewl_Border *b);
/**
* @}
diff --git a/src/lib/ewl_box.c b/src/lib/ewl_box.c
index 8efe5ae..b12cb79 100644
--- a/src/lib/ewl_box.c
+++ b/src/lib/ewl_box.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_box.h"
#include "ewl_macros.h"
@@ -10,27 +10,27 @@
*/
typedef struct
{
- /*
- * Alignment is only done in the align direction.
- */
- int f1_align, f3_align;
- int a1_align, a3_align;
-
- /*
- * This is an indicator for filling in the proper directions.
- */
- int f_policy;
-
- /*
- * Function pointers for getting the dimension of the widget that we
- * care about.
- */
- void (*pref_fill_set) (Ewl_Object * ob, int size);
- int (*fill_ask) (Ewl_Object * ob);
- void (*fill_set) (Ewl_Object * ob, int size);
-
- int (*align_ask) (Ewl_Object * ob);
- void (*align_set) (Ewl_Object * ob, int size);
+ /*
+ * Alignment is only done in the align direction.
+ */
+ int f1_align, f3_align;
+ int a1_align, a3_align;
+
+ /*
+ * This is an indicator for filling in the proper directions.
+ */
+ int f_policy;
+
+ /*
+ * Function pointers for getting the dimension of the widget that we
+ * care about.
+ */
+ void (*pref_fill_set) (Ewl_Object * ob, int size);
+ int (*fill_ask) (Ewl_Object * ob);
+ void (*fill_set) (Ewl_Object * ob, int size);
+
+ int (*align_ask) (Ewl_Object * ob);
+ void (*align_set) (Ewl_Object * ob, int size);
} Ewl_Box_Orientation;
/*
@@ -49,14 +49,14 @@ static Ewl_Box_Orientation *ewl_box_info = NULL;
static void ewl_box_setup(void);
static int ewl_box_configure_calc(Ewl_Box * b, Ewl_Object **spread,
- int *fill_size, int *align_size);
+ int *fill_size, int *align_size);
static void ewl_box_configure_fill(Ewl_Object **spread, int fill_count,
- int *fill_size);
+ int *fill_size);
static void ewl_box_configure_layout(Ewl_Box * b, int *x, int *y,
- int *fill, int *align,
- int *align_size);
+ int *fill, int *align,
+ int *align_size);
static void ewl_box_configure_child(Ewl_Box * b, Ewl_Object * c, int *x,
- int *y, int *align, int *align_size);
+ int *y, int *align, int *align_size);
/**
* @return Returns NULL on failure, or a newly allocated box on success.
@@ -65,20 +65,20 @@ static void ewl_box_configure_child(Ewl_Box * b, Ewl_Object * c, int *x,
Ewl_Widget
*ewl_box_new(void)
{
- Ewl_Box *b;
+ Ewl_Box *b;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- b = NEW(Ewl_Box, 1);
- if (!b)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ b = NEW(Ewl_Box, 1);
+ if (!b)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_box_init(b)) {
- ewl_widget_destroy(EWL_WIDGET(b));
- b = NULL;
- }
+ if (!ewl_box_init(b)) {
+ ewl_widget_destroy(EWL_WIDGET(b));
+ b = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(b), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(b), DLEVEL_STABLE);
}
/**
@@ -88,17 +88,17 @@ Ewl_Widget
Ewl_Widget
*ewl_hbox_new(void)
{
- Ewl_Widget *b;
+ Ewl_Widget *b;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- b = ewl_box_new();
- if (!b)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ b = ewl_box_new();
+ if (!b)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- ewl_box_orientation_set(EWL_BOX(b), EWL_ORIENTATION_HORIZONTAL);
+ ewl_box_orientation_set(EWL_BOX(b), EWL_ORIENTATION_HORIZONTAL);
- DRETURN_PTR(EWL_WIDGET(b), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(b), DLEVEL_STABLE);
}
/**
@@ -108,17 +108,17 @@ Ewl_Widget
Ewl_Widget
*ewl_vbox_new(void)
{
- Ewl_Widget *b;
+ Ewl_Widget *b;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- b = ewl_box_new();
- if (!b)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ b = ewl_box_new();
+ if (!b)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- ewl_box_orientation_set(EWL_BOX(b), EWL_ORIENTATION_VERTICAL);
+ ewl_box_orientation_set(EWL_BOX(b), EWL_ORIENTATION_VERTICAL);
- DRETURN_PTR(EWL_WIDGET(b), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(b), DLEVEL_STABLE);
}
/**
@@ -132,60 +132,60 @@ Ewl_Widget
int
ewl_box_init(Ewl_Box * b)
{
- Ewl_Widget *w;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(b, FALSE);
-
- w = EWL_WIDGET(b);
-
- /*
- * Initialize the container portion of the box
- */
- if (!ewl_container_init(EWL_CONTAINER(b))) {
- ewl_widget_destroy(EWL_WIDGET(b));
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
- ewl_widget_inherit(w, EWL_BOX_TYPE);
-
- /*
- * Set the appearance based on default orientation.
- */
- ewl_widget_appearance_set(EWL_WIDGET(b), "hbox");
-
- /*
- * Setup the container size change handlers.
- */
- ewl_container_resize_notify_set(EWL_CONTAINER(b),
- ewl_box_cb_child_resize);
- ewl_container_show_notify_set(EWL_CONTAINER(b), ewl_box_cb_child_show);
- ewl_container_hide_notify_set(EWL_CONTAINER(b), ewl_box_cb_child_hide);
-
- /*
- * Attach the default layout callback.
- */
- ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
- ewl_box_cb_configure, NULL);
- ewl_callback_del(w, EWL_CALLBACK_FOCUS_OUT, ewl_widget_cb_focus_out);
- ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT,
- ewl_container_cb_container_focus_out, NULL);
-
- /*
- * Check if the info structs have been created yet, if not create
- * them.
- */
- if (!ewl_box_horizontal)
- ewl_box_setup();
-
- /*
- * Set the box's appropriate orientation, set to a garbage value so
- * that the orientation does it's job.
- */
- b->orientation = EWL_ORIENTATION_HORIZONTAL;
-
- ewl_widget_focusable_set(w, FALSE);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Widget *w;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(b, FALSE);
+
+ w = EWL_WIDGET(b);
+
+ /*
+ * Initialize the container portion of the box
+ */
+ if (!ewl_container_init(EWL_CONTAINER(b))) {
+ ewl_widget_destroy(EWL_WIDGET(b));
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+ ewl_widget_inherit(w, EWL_BOX_TYPE);
+
+ /*
+ * Set the appearance based on default orientation.
+ */
+ ewl_widget_appearance_set(EWL_WIDGET(b), "hbox");
+
+ /*
+ * Setup the container size change handlers.
+ */
+ ewl_container_resize_notify_set(EWL_CONTAINER(b),
+ ewl_box_cb_child_resize);
+ ewl_container_show_notify_set(EWL_CONTAINER(b), ewl_box_cb_child_show);
+ ewl_container_hide_notify_set(EWL_CONTAINER(b), ewl_box_cb_child_hide);
+
+ /*
+ * Attach the default layout callback.
+ */
+ ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
+ ewl_box_cb_configure, NULL);
+ ewl_callback_del(w, EWL_CALLBACK_FOCUS_OUT, ewl_widget_cb_focus_out);
+ ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT,
+ ewl_container_cb_container_focus_out, NULL);
+
+ /*
+ * Check if the info structs have been created yet, if not create
+ * them.
+ */
+ if (!ewl_box_horizontal)
+ ewl_box_setup();
+
+ /*
+ * Set the box's appropriate orientation, set to a garbage value so
+ * that the orientation does it's job.
+ */
+ b->orientation = EWL_ORIENTATION_HORIZONTAL;
+
+ ewl_widget_focusable_set(w, FALSE);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -200,53 +200,53 @@ ewl_box_init(Ewl_Box * b)
void
ewl_box_orientation_set(Ewl_Box * b, Ewl_Orientation o)
{
- Ewl_Container *c;
- Ewl_Widget *child;
- char *appearance;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(b);
- DCHECK_TYPE(b, EWL_BOX_TYPE);
-
- /*
- * Set the orientation and reconfigure the widget so that child
- * widgets now have the new orientation layout
- */
- if (b->orientation == o)
- DRETURN(DLEVEL_STABLE);
-
- b->orientation = o;
-
- /* We check the previous appearance here to make sure we only change
- * the appearance if it is still set to box. Otherwise we might end
- * up wipeing out the appearance of an inheriting widget (like
- * menubar */
- appearance = ewl_widget_appearance_get(EWL_WIDGET(b));
- if ((b->orientation == EWL_ORIENTATION_HORIZONTAL)
- && (!strcmp(appearance, "vbox")))
- ewl_widget_appearance_set(EWL_WIDGET(b), "hbox");
-
- else if ((b->orientation == EWL_ORIENTATION_VERTICAL)
- && (!strcmp(appearance, "hbox")))
- ewl_widget_appearance_set(EWL_WIDGET(b), "vbox");
-
- IF_FREE(appearance);
-
- /* we need to reset the preferred size of the box after chaning the
- * orientation. We'll cheat by calling ewl_box_child_show_cb foreach
- * child in the list */
- ewl_object_preferred_inner_size_set(EWL_OBJECT(b), 0, 0);
-
- c = EWL_CONTAINER(b);
- ecore_dlist_first_goto(c->children);
- while ((child = ecore_dlist_next(c->children))) {
- if (!UNMANAGED(child))
- ewl_box_cb_child_show(c, child);
- }
-
- ewl_widget_configure(EWL_WIDGET(b));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Container *c;
+ Ewl_Widget *child;
+ char *appearance;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(b);
+ DCHECK_TYPE(b, EWL_BOX_TYPE);
+
+ /*
+ * Set the orientation and reconfigure the widget so that child
+ * widgets now have the new orientation layout
+ */
+ if (b->orientation == o)
+ DRETURN(DLEVEL_STABLE);
+
+ b->orientation = o;
+
+ /* We check the previous appearance here to make sure we only change
+ * the appearance if it is still set to box. Otherwise we might end
+ * up wipeing out the appearance of an inheriting widget (like
+ * menubar */
+ appearance = ewl_widget_appearance_get(EWL_WIDGET(b));
+ if ((b->orientation == EWL_ORIENTATION_HORIZONTAL)
+ && (!strcmp(appearance, "vbox")))
+ ewl_widget_appearance_set(EWL_WIDGET(b), "hbox");
+
+ else if ((b->orientation == EWL_ORIENTATION_VERTICAL)
+ && (!strcmp(appearance, "hbox")))
+ ewl_widget_appearance_set(EWL_WIDGET(b), "vbox");
+
+ IF_FREE(appearance);
+
+ /* we need to reset the preferred size of the box after chaning the
+ * orientation. We'll cheat by calling ewl_box_child_show_cb foreach
+ * child in the list */
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(b), 0, 0);
+
+ c = EWL_CONTAINER(b);
+ ecore_dlist_first_goto(c->children);
+ while ((child = ecore_dlist_next(c->children))) {
+ if (!UNMANAGED(child))
+ ewl_box_cb_child_show(c, child);
+ }
+
+ ewl_widget_configure(EWL_WIDGET(b));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -257,11 +257,11 @@ ewl_box_orientation_set(Ewl_Box * b, Ewl_Orientation o)
Ewl_Orientation
ewl_box_orientation_get(Ewl_Box *b)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(b, 0);
- DCHECK_TYPE_RET(b, EWL_BOX_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(b, 0);
+ DCHECK_TYPE_RET(b, EWL_BOX_TYPE, 0);
- DRETURN_INT(b->orientation, DLEVEL_STABLE);
+ DRETURN_INT(b->orientation, DLEVEL_STABLE);
}
/**
@@ -277,73 +277,73 @@ ewl_box_orientation_get(Ewl_Box *b)
void
ewl_box_homogeneous_set(Ewl_Box *b, unsigned int h)
{
- Ewl_Container *c;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(b);
- DCHECK_TYPE(b, EWL_BOX_TYPE);
-
- if (b->homogeneous == !!h)
- DRETURN(DLEVEL_STABLE);
-
- b->homogeneous = !!h;
- c = EWL_CONTAINER(b);
-
- if (h) {
- ewl_callback_del(EWL_WIDGET(b), EWL_CALLBACK_CONFIGURE,
- ewl_box_cb_configure);
- ewl_callback_append(EWL_WIDGET(b), EWL_CALLBACK_CONFIGURE,
- ewl_box_cb_configure_homogeneous, NULL);
- ewl_container_show_notify_set(c,
- ewl_box_cb_child_homogeneous_show);
- ewl_container_hide_notify_set(c,
- ewl_box_cb_child_homogeneous_show);
- ewl_container_resize_notify_set(c,
- ewl_box_cb_child_homogeneous_resize);
- /*
- * calculate the new preferred size, we use here the show cb
- * since it does exactly what we need to do
- */
- ewl_box_cb_child_homogeneous_show(c, NULL);
- }
- else {
- int nodes;
-
- ewl_callback_del(EWL_WIDGET(b), EWL_CALLBACK_CONFIGURE,
- ewl_box_cb_configure_homogeneous);
- ewl_callback_append(EWL_WIDGET(b), EWL_CALLBACK_CONFIGURE,
- ewl_box_cb_configure, NULL);
- ewl_container_show_notify_set(c,
- ewl_box_cb_child_show);
- ewl_container_hide_notify_set(c,
- ewl_box_cb_child_hide);
- ewl_container_resize_notify_set(c,
- ewl_box_cb_child_resize);
- /*
- * calculate the new preferred size
- */
- nodes = ewl_container_child_count_visible_get(c) - 1;
- if (b->orientation == EWL_ORIENTATION_HORIZONTAL) {
- ewl_container_largest_prefer(c,
- EWL_ORIENTATION_VERTICAL);
- ewl_container_sum_prefer(c,
- EWL_ORIENTATION_HORIZONTAL);
- ewl_object_preferred_inner_w_set(EWL_OBJECT(b),
- PREFERRED_W(b) + b->spacing * nodes);
- }
- else {
- ewl_container_largest_prefer(c,
- EWL_ORIENTATION_HORIZONTAL);
- ewl_container_sum_prefer(c,
- EWL_ORIENTATION_VERTICAL);
- ewl_object_preferred_inner_h_set(EWL_OBJECT(b),
- PREFERRED_H(b) + b->spacing * nodes);
- }
- }
-
- ewl_widget_configure(EWL_WIDGET(b));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Container *c;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(b);
+ DCHECK_TYPE(b, EWL_BOX_TYPE);
+
+ if (b->homogeneous == !!h)
+ DRETURN(DLEVEL_STABLE);
+
+ b->homogeneous = !!h;
+ c = EWL_CONTAINER(b);
+
+ if (h) {
+ ewl_callback_del(EWL_WIDGET(b), EWL_CALLBACK_CONFIGURE,
+ ewl_box_cb_configure);
+ ewl_callback_append(EWL_WIDGET(b), EWL_CALLBACK_CONFIGURE,
+ ewl_box_cb_configure_homogeneous, NULL);
+ ewl_container_show_notify_set(c,
+ ewl_box_cb_child_homogeneous_show);
+ ewl_container_hide_notify_set(c,
+ ewl_box_cb_child_homogeneous_show);
+ ewl_container_resize_notify_set(c,
+ ewl_box_cb_child_homogeneous_resize);
+ /*
+ * calculate the new preferred size, we use here the show cb
+ * since it does exactly what we need to do
+ */
+ ewl_box_cb_child_homogeneous_show(c, NULL);
+ }
+ else {
+ int nodes;
+
+ ewl_callback_del(EWL_WIDGET(b), EWL_CALLBACK_CONFIGURE,
+ ewl_box_cb_configure_homogeneous);
+ ewl_callback_append(EWL_WIDGET(b), EWL_CALLBACK_CONFIGURE,
+ ewl_box_cb_configure, NULL);
+ ewl_container_show_notify_set(c,
+ ewl_box_cb_child_show);
+ ewl_container_hide_notify_set(c,
+ ewl_box_cb_child_hide);
+ ewl_container_resize_notify_set(c,
+ ewl_box_cb_child_resize);
+ /*
+ * calculate the new preferred size
+ */
+ nodes = ewl_container_child_count_visible_get(c) - 1;
+ if (b->orientation == EWL_ORIENTATION_HORIZONTAL) {
+ ewl_container_largest_prefer(c,
+ EWL_ORIENTATION_VERTICAL);
+ ewl_container_sum_prefer(c,
+ EWL_ORIENTATION_HORIZONTAL);
+ ewl_object_preferred_inner_w_set(EWL_OBJECT(b),
+ PREFERRED_W(b) + b->spacing * nodes);
+ }
+ else {
+ ewl_container_largest_prefer(c,
+ EWL_ORIENTATION_HORIZONTAL);
+ ewl_container_sum_prefer(c,
+ EWL_ORIENTATION_VERTICAL);
+ ewl_object_preferred_inner_h_set(EWL_OBJECT(b),
+ PREFERRED_H(b) + b->spacing * nodes);
+ }
+ }
+
+ ewl_widget_configure(EWL_WIDGET(b));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -354,11 +354,11 @@ ewl_box_homogeneous_set(Ewl_Box *b, unsigned int h)
unsigned int
ewl_box_homogeneous_get(Ewl_Box *b)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(b, 0);
- DCHECK_TYPE_RET(b, EWL_BOX_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(b, 0);
+ DCHECK_TYPE_RET(b, EWL_BOX_TYPE, 0);
- DRETURN_INT(b->homogeneous, DLEVEL_STABLE);
+ DRETURN_INT(b->homogeneous, DLEVEL_STABLE);
}
/**
@@ -373,33 +373,33 @@ ewl_box_homogeneous_get(Ewl_Box *b)
void
ewl_box_spacing_set(Ewl_Box * b, int s)
{
- int nodes;
- Ewl_Widget *w;
+ int nodes;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(b);
- DCHECK_TYPE(b, EWL_BOX_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(b);
+ DCHECK_TYPE(b, EWL_BOX_TYPE);
- w = EWL_WIDGET(b);
+ w = EWL_WIDGET(b);
- nodes = ewl_container_child_count_visible_get(EWL_CONTAINER(b)) - 1;
+ nodes = ewl_container_child_count_visible_get(EWL_CONTAINER(b)) - 1;
- if (nodes > 0) {
- if (b->orientation == EWL_ORIENTATION_HORIZONTAL)
- ewl_object_preferred_inner_w_set(EWL_OBJECT(w),
- PREFERRED_W(w) - (nodes * b->spacing) +
- (nodes * s));
- else
- ewl_object_preferred_inner_h_set(EWL_OBJECT(w),
- PREFERRED_H(w) - (nodes * b->spacing) +
- (nodes * s));
- }
+ if (nodes > 0) {
+ if (b->orientation == EWL_ORIENTATION_HORIZONTAL)
+ ewl_object_preferred_inner_w_set(EWL_OBJECT(w),
+ PREFERRED_W(w) - (nodes * b->spacing) +
+ (nodes * s));
+ else
+ ewl_object_preferred_inner_h_set(EWL_OBJECT(w),
+ PREFERRED_H(w) - (nodes * b->spacing) +
+ (nodes * s));
+ }
- b->spacing = s;
+ b->spacing = s;
- ewl_widget_configure(w);
+ ewl_widget_configure(w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -422,81 +422,81 @@ ewl_box_spacing_set(Ewl_Box * b, int s)
*/
void
ewl_box_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Box *b;
-
- int fill_count;
- int total_fill = 0;
- int x, y;
- int width, height;
- int *fill, *align;
- int *fill_size, *align_size;
- Ewl_Object **spread;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_BOX_TYPE);
-
- b = EWL_BOX(w);
-
- fill_count = ewl_container_child_count_visible_get(EWL_CONTAINER(w));
-
- /*
- * Catch the easy case, and return.
- */
- if (!fill_count)
- DRETURN(DLEVEL_STABLE);
-
- spread = alloca(fill_count * sizeof(Ewl_Object *));
-
- /*
- * Get the starting values for the dimensions of the box.
- */
- x = CURRENT_X(w);
- y = CURRENT_Y(w);
- width = CURRENT_W(w);
- height = CURRENT_H(w);
-
- /*
- * These variables avoid large nested if's to handle different
- * orientations.
- */
- if (b->orientation == EWL_ORIENTATION_HORIZONTAL) {
- fill = &x;
- fill_size = &width;
- align = &y;
- align_size = &height;
- ewl_box_info = ewl_box_horizontal;
- } else {
- fill = &y;
- fill_size = &height;
- align = &x;
- align_size = &width;
- ewl_box_info = ewl_box_vertical;
- }
-
- /*
- * Save the starting fill size.
- */
- total_fill = *fill_size;
-
- /*
- * Split the children up for configuration based on alignment.
- */
- fill_count = ewl_box_configure_calc(b, spread, fill_size, align_size);
-
- /*
- * Spread the fill space if necessary.
- */
- ewl_box_configure_fill(spread, fill_count, fill_size);
-
- /*
- * Layout the children in their appropriate positions.
- */
- ewl_box_configure_layout(b, &x, &y, fill, align, align_size);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Box *b;
+
+ int fill_count;
+ int total_fill = 0;
+ int x, y;
+ int width, height;
+ int *fill, *align;
+ int *fill_size, *align_size;
+ Ewl_Object **spread;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_BOX_TYPE);
+
+ b = EWL_BOX(w);
+
+ fill_count = ewl_container_child_count_visible_get(EWL_CONTAINER(w));
+
+ /*
+ * Catch the easy case, and return.
+ */
+ if (!fill_count)
+ DRETURN(DLEVEL_STABLE);
+
+ spread = alloca(fill_count * sizeof(Ewl_Object *));
+
+ /*
+ * Get the starting values for the dimensions of the box.
+ */
+ x = CURRENT_X(w);
+ y = CURRENT_Y(w);
+ width = CURRENT_W(w);
+ height = CURRENT_H(w);
+
+ /*
+ * These variables avoid large nested if's to handle different
+ * orientations.
+ */
+ if (b->orientation == EWL_ORIENTATION_HORIZONTAL) {
+ fill = &x;
+ fill_size = &width;
+ align = &y;
+ align_size = &height;
+ ewl_box_info = ewl_box_horizontal;
+ } else {
+ fill = &y;
+ fill_size = &height;
+ align = &x;
+ align_size = &width;
+ ewl_box_info = ewl_box_vertical;
+ }
+
+ /*
+ * Save the starting fill size.
+ */
+ total_fill = *fill_size;
+
+ /*
+ * Split the children up for configuration based on alignment.
+ */
+ fill_count = ewl_box_configure_calc(b, spread, fill_size, align_size);
+
+ /*
+ * Spread the fill space if necessary.
+ */
+ ewl_box_configure_fill(spread, fill_count, fill_size);
+
+ /*
+ * Layout the children in their appropriate positions.
+ */
+ ewl_box_configure_layout(b, &x, &y, fill, align, align_size);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -509,69 +509,69 @@ ewl_box_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_box_cb_configure_homogeneous(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- int i, num;
- int x, y;
- int width, height;
- int *fill;
- int *fill_size;
- int remainder;
- Ewl_Object *child;
- Ewl_Box *b;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_BOX_TYPE);
-
- if (ecore_dlist_empty_is(EWL_CONTAINER(w)->children))
- DRETURN(DLEVEL_STABLE);
-
- num = ewl_container_child_count_visible_get(EWL_CONTAINER(w));
-
- if (!num)
- DRETURN(DLEVEL_STABLE);
-
- b = EWL_BOX(w);
-
- /*
- * Get the starting values for the dimensions of the box.
- */
- x = CURRENT_X(w);
- y = CURRENT_Y(w);
- width = CURRENT_W(w);
- height = CURRENT_H(w);
-
- /*
- * These variables avoid large nested if's to handle different
- * orientations.
- */
- if (b->orientation == EWL_ORIENTATION_HORIZONTAL) {
- fill = &x;
- fill_size = &width;
- } else {
- fill = &y;
- fill_size = &height;
- }
-
- *fill_size -= b->spacing * (num - 1);
- remainder = *fill_size % num;
- *fill_size = *fill_size / num;
-
- i = 0;
- ecore_dlist_first_goto(EWL_CONTAINER(w)->children);
- while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children))) {
- if (!VISIBLE(child))
- continue;
-
- i++;
- if (i == num)
- *fill_size += remainder;
- ewl_object_place(child, x, y, width, height);
- *fill += *fill_size + b->spacing;
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int i, num;
+ int x, y;
+ int width, height;
+ int *fill;
+ int *fill_size;
+ int remainder;
+ Ewl_Object *child;
+ Ewl_Box *b;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_BOX_TYPE);
+
+ if (ecore_dlist_empty_is(EWL_CONTAINER(w)->children))
+ DRETURN(DLEVEL_STABLE);
+
+ num = ewl_container_child_count_visible_get(EWL_CONTAINER(w));
+
+ if (!num)
+ DRETURN(DLEVEL_STABLE);
+
+ b = EWL_BOX(w);
+
+ /*
+ * Get the starting values for the dimensions of the box.
+ */
+ x = CURRENT_X(w);
+ y = CURRENT_Y(w);
+ width = CURRENT_W(w);
+ height = CURRENT_H(w);
+
+ /*
+ * These variables avoid large nested if's to handle different
+ * orientations.
+ */
+ if (b->orientation == EWL_ORIENTATION_HORIZONTAL) {
+ fill = &x;
+ fill_size = &width;
+ } else {
+ fill = &y;
+ fill_size = &height;
+ }
+
+ *fill_size -= b->spacing * (num - 1);
+ remainder = *fill_size % num;
+ *fill_size = *fill_size / num;
+
+ i = 0;
+ ecore_dlist_first_goto(EWL_CONTAINER(w)->children);
+ while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children))) {
+ if (!VISIBLE(child))
+ continue;
+
+ i++;
+ if (i == num)
+ *fill_size += remainder;
+ ewl_object_place(child, x, y, width, height);
+ *fill += *fill_size + b->spacing;
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/*
@@ -580,70 +580,70 @@ ewl_box_cb_configure_homogeneous(Ewl_Widget *w, void *ev_data __UNUSED__,
static int
ewl_box_configure_calc(Ewl_Box * b, Ewl_Object **spread, int *fill_size, int *align_size)
{
- int i;
- Ewl_Object *child;
- int initial;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(b, 0);
- DCHECK_TYPE_RET(b, EWL_BOX_TYPE, 0);
- DCHECK_PARAM_PTR_RET(spread, 0);
-
- initial = *fill_size /
- ewl_container_child_count_visible_get(EWL_CONTAINER(b));
-
- /*
- * Sort the children into lists dependant on their alignment within the
- * box.
- */
- i = 0;
- ecore_dlist_first_goto(EWL_CONTAINER(b)->children);
- while ((child = ecore_dlist_next(EWL_CONTAINER(b)->children))) {
- int change;
- unsigned int policy;
-
- if (!VISIBLE(child) || UNMANAGED(child))
- continue;
- /*
- * Place the child on a list depending on it's matching
- * alignment. First check for top/left alignment.
- */
- /*
- * Set the initial fill size to the preferred size.
- */
- ewl_box_info->fill_set(child, initial);
-
- change = ewl_box_info->fill_ask(child);
-
- /*
- * Figure out how much extra space is available for
- * filling widgets.
- */
- *fill_size -= change + b->spacing;
-
- /*
- * Attempt to give the widget the full size, this will
- * fail if the fill policy or bounds don't allow it.
- */
- ewl_box_info->align_set(child, *align_size);
-
- /*
- * If it has a fill policy for a direction we're
- * concerned with, add it to the fill list.
- */
- policy = ewl_object_fill_policy_get(child);
- policy &= ewl_box_info->f_policy;
- if (policy || change == initial) {
- spread[i] = child;
- i++;
- }
- }
-
- /* the last widget does not have spacing on its right side, so
- * we need to add it again */
- *fill_size += b->spacing;
-
- DRETURN_INT(i, DLEVEL_STABLE);
+ int i;
+ Ewl_Object *child;
+ int initial;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(b, 0);
+ DCHECK_TYPE_RET(b, EWL_BOX_TYPE, 0);
+ DCHECK_PARAM_PTR_RET(spread, 0);
+
+ initial = *fill_size /
+ ewl_container_child_count_visible_get(EWL_CONTAINER(b));
+
+ /*
+ * Sort the children into lists dependant on their alignment within the
+ * box.
+ */
+ i = 0;
+ ecore_dlist_first_goto(EWL_CONTAINER(b)->children);
+ while ((child = ecore_dlist_next(EWL_CONTAINER(b)->children))) {
+ int change;
+ unsigned int policy;
+
+ if (!VISIBLE(child) || UNMANAGED(child))
+ continue;
+ /*
+ * Place the child on a list depending on it's matching
+ * alignment. First check for top/left alignment.
+ */
+ /*
+ * Set the initial fill size to the preferred size.
+ */
+ ewl_box_info->fill_set(child, initial);
+
+ change = ewl_box_info->fill_ask(child);
+
+ /*
+ * Figure out how much extra space is available for
+ * filling widgets.
+ */
+ *fill_size -= change + b->spacing;
+
+ /*
+ * Attempt to give the widget the full size, this will
+ * fail if the fill policy or bounds don't allow it.
+ */
+ ewl_box_info->align_set(child, *align_size);
+
+ /*
+ * If it has a fill policy for a direction we're
+ * concerned with, add it to the fill list.
+ */
+ policy = ewl_object_fill_policy_get(child);
+ policy &= ewl_box_info->f_policy;
+ if (policy || change == initial) {
+ spread[i] = child;
+ i++;
+ }
+ }
+
+ /* the last widget does not have spacing on its right side, so
+ * we need to add it again */
+ *fill_size += b->spacing;
+
+ DRETURN_INT(i, DLEVEL_STABLE);
}
/*
@@ -653,190 +653,190 @@ ewl_box_configure_calc(Ewl_Box * b, Ewl_Object **spread, int *fill_size, int *al
static void
ewl_box_configure_fill(Ewl_Object **spread, int fill_count, int *fill_size)
{
- int i;
- int space;
- int temp, remainder;
- Ewl_Object *c;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(spread);
-
- /*
- * Calculate the space to give per child. Safeguard against divide by
- * zero.
- */
- space = (!fill_count ? 0 : *fill_size / fill_count);
-
- /*
- * As long as children keep accepting more space, we should loop
- * through and give them what's available.
- */
- while (space && fill_count) {
-
- i = 0;
- while ((i < fill_count) && (c = spread[i])) {
-
- /*
- * Save the current size of the child, then
- * attempt to give it a portion of the space
- * available.
- */
- temp = ewl_box_info->fill_ask(c);
- ewl_box_info->fill_set(c, temp + space);
-
- /*
- * Determine if the child accepted any of the space
- */
- temp = ewl_box_info->fill_ask(c) - temp;
-
- /*
- * If the child did not accept any of the size, then
- * it's at it's max/min and is no longer useful.
- */
- if (!temp) {
- if (i + 1 < fill_count) {
- memmove((spread + i), (spread + i + 1),
- (fill_count - i) *
- sizeof(Ewl_Object *));
- }
- fill_count--;
- }
- else {
- *fill_size -= temp;
- i++;
- }
- }
-
- /*
- * Calculate the space to give per child.
- */
- space = (!fill_count ? 0 : *fill_size / fill_count);
- }
-
- /*
- * Distribute any remaining fill space.
- */
- while (*fill_size && fill_count) {
-
- /*
- * Determine the sign of the amount to be incremented.
- */
- remainder = *fill_size / abs(*fill_size);
-
- /*
- * Add the remainder sign to each child.
- */
- i = 0;
- while (*fill_size && (i < fill_count) && (c = spread[i])) {
-
- /*
- * Store the current size of the child.
- */
- temp = ewl_box_info->fill_ask(c);
-
- /*
- * Attempt to give it a portion of the remaining space
- */
- ewl_box_info->fill_set(c, temp + remainder);
-
- /*
- * Determine if the child accepted the space
- */
- temp = ewl_box_info->fill_ask(c) - temp;
-
- /*
- * Remove the child if it didn't accept any space,
- * otherwise subtract the accepted space from the
- * total.
- */
- if (!temp || (*fill_size - temp < 0)) {
- if (i + 1 < fill_count) {
- memmove((spread + i), (spread + i + 1),
- (fill_count - i) *
- sizeof(Ewl_Object *));
- }
- fill_count--;
- }
- else {
- *fill_size -= remainder;
- i++;
- }
- }
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int i;
+ int space;
+ int temp, remainder;
+ Ewl_Object *c;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(spread);
+
+ /*
+ * Calculate the space to give per child. Safeguard against divide by
+ * zero.
+ */
+ space = (!fill_count ? 0 : *fill_size / fill_count);
+
+ /*
+ * As long as children keep accepting more space, we should loop
+ * through and give them what's available.
+ */
+ while (space && fill_count) {
+
+ i = 0;
+ while ((i < fill_count) && (c = spread[i])) {
+
+ /*
+ * Save the current size of the child, then
+ * attempt to give it a portion of the space
+ * available.
+ */
+ temp = ewl_box_info->fill_ask(c);
+ ewl_box_info->fill_set(c, temp + space);
+
+ /*
+ * Determine if the child accepted any of the space
+ */
+ temp = ewl_box_info->fill_ask(c) - temp;
+
+ /*
+ * If the child did not accept any of the size, then
+ * it's at it's max/min and is no longer useful.
+ */
+ if (!temp) {
+ if (i + 1 < fill_count) {
+ memmove((spread + i), (spread + i + 1),
+ (fill_count - i) *
+ sizeof(Ewl_Object *));
+ }
+ fill_count--;
+ }
+ else {
+ *fill_size -= temp;
+ i++;
+ }
+ }
+
+ /*
+ * Calculate the space to give per child.
+ */
+ space = (!fill_count ? 0 : *fill_size / fill_count);
+ }
+
+ /*
+ * Distribute any remaining fill space.
+ */
+ while (*fill_size && fill_count) {
+
+ /*
+ * Determine the sign of the amount to be incremented.
+ */
+ remainder = *fill_size / abs(*fill_size);
+
+ /*
+ * Add the remainder sign to each child.
+ */
+ i = 0;
+ while (*fill_size && (i < fill_count) && (c = spread[i])) {
+
+ /*
+ * Store the current size of the child.
+ */
+ temp = ewl_box_info->fill_ask(c);
+
+ /*
+ * Attempt to give it a portion of the remaining space
+ */
+ ewl_box_info->fill_set(c, temp + remainder);
+
+ /*
+ * Determine if the child accepted the space
+ */
+ temp = ewl_box_info->fill_ask(c) - temp;
+
+ /*
+ * Remove the child if it didn't accept any space,
+ * otherwise subtract the accepted space from the
+ * total.
+ */
+ if (!temp || (*fill_size - temp < 0)) {
+ if (i + 1 < fill_count) {
+ memmove((spread + i), (spread + i + 1),
+ (fill_count - i) *
+ sizeof(Ewl_Object *));
+ }
+ fill_count--;
+ }
+ else {
+ *fill_size -= remainder;
+ i++;
+ }
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_box_configure_layout(Ewl_Box * b, int *x, int *y, int *fill,
- int *align, int *align_size)
+ int *align, int *align_size)
{
- Ewl_Object *child;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(b);
- DCHECK_TYPE(b, EWL_BOX_TYPE);
-
- /*
- * Configure the widgets on the first list.
- */
- ecore_dlist_first_goto(EWL_CONTAINER(b)->children);
- while ((child = ecore_dlist_next(EWL_CONTAINER(b)->children))) {
-
- if (!VISIBLE(child) || UNMANAGED(child))
- continue;
-
- /*
- * Position this child based on the determined values.
- */
- ewl_box_configure_child(b, child, x, y, align,
- align_size);
-
- /*
- * Move to the next position for the child.
- */
- *fill += ewl_box_info->fill_ask(child) + b->spacing;
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Object *child;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(b);
+ DCHECK_TYPE(b, EWL_BOX_TYPE);
+
+ /*
+ * Configure the widgets on the first list.
+ */
+ ecore_dlist_first_goto(EWL_CONTAINER(b)->children);
+ while ((child = ecore_dlist_next(EWL_CONTAINER(b)->children))) {
+
+ if (!VISIBLE(child) || UNMANAGED(child))
+ continue;
+
+ /*
+ * Position this child based on the determined values.
+ */
+ ewl_box_configure_child(b, child, x, y, align,
+ align_size);
+
+ /*
+ * Move to the next position for the child.
+ */
+ *fill += ewl_box_info->fill_ask(child) + b->spacing;
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_box_configure_child(Ewl_Box * b __UNUSED__, Ewl_Object * c,
- int *x, int *y, int *align, int *align_size)
+ int *x, int *y, int *align, int *align_size)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
-
- /*
- * Adjust the alignment in the direction opposite of the
- * orientation. The first one is the simplest as it it a
- * direct use of the current coordinates.
- */
- if (ewl_object_alignment_get(c) & ewl_box_info->a1_align) {
- ewl_object_position_request(c, *x, *y);
- }
-
- /*
- * The second one is aligned against the furthest edge, so
- * there is some calculation to be made.
- */
- else if (ewl_object_alignment_get(c) & ewl_box_info->a3_align) {
- *align += *align_size - ewl_box_info->align_ask(c);
- ewl_object_position_request(c, *x, *y);
- *align -= *align_size - ewl_box_info->align_ask(c);
- }
-
- /*
- * The final one is for centering the child.
- */
- else {
- *align += (*align_size - ewl_box_info->align_ask(c)) / 2;
- ewl_object_position_request(c, *x, *y);
- *align -= (*align_size - ewl_box_info->align_ask(c)) / 2;
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+
+ /*
+ * Adjust the alignment in the direction opposite of the
+ * orientation. The first one is the simplest as it it a
+ * direct use of the current coordinates.
+ */
+ if (ewl_object_alignment_get(c) & ewl_box_info->a1_align) {
+ ewl_object_position_request(c, *x, *y);
+ }
+
+ /*
+ * The second one is aligned against the furthest edge, so
+ * there is some calculation to be made.
+ */
+ else if (ewl_object_alignment_get(c) & ewl_box_info->a3_align) {
+ *align += *align_size - ewl_box_info->align_ask(c);
+ ewl_object_position_request(c, *x, *y);
+ *align -= *align_size - ewl_box_info->align_ask(c);
+ }
+
+ /*
+ * The final one is for centering the child.
+ */
+ else {
+ *align += (*align_size - ewl_box_info->align_ask(c)) / 2;
+ ewl_object_position_request(c, *x, *y);
+ *align -= (*align_size - ewl_box_info->align_ask(c)) / 2;
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -849,47 +849,47 @@ ewl_box_configure_child(Ewl_Box * b __UNUSED__, Ewl_Object * c,
void
ewl_box_cb_child_show(Ewl_Container *c, Ewl_Widget *w)
{
- int space = 0;
- int width, height;
- int cw, ch;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_BOX_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- if (ewl_container_child_count_visible_get(c) > 1)
- space = EWL_BOX(c)->spacing;
-
- /*
- * Get the sizes common to both calculations.
- */
- width = ewl_object_preferred_inner_w_get(EWL_OBJECT(c));
- height = ewl_object_preferred_inner_h_get(EWL_OBJECT(c));
-
- cw = ewl_object_preferred_w_get(EWL_OBJECT(w));
- ch = ewl_object_preferred_h_get(EWL_OBJECT(w));
-
- /*
- * Base the info used on the orientation of the box.
- */
- if (EWL_BOX(c)->orientation == EWL_ORIENTATION_HORIZONTAL) {
- cw += space;
- ewl_object_preferred_inner_w_set(EWL_OBJECT(c), width + cw);
- if (ch > height)
- ewl_object_preferred_inner_h_set(EWL_OBJECT(c), ch);
- }
- else {
- ch += space;
- if (cw > width)
- ewl_object_preferred_inner_w_set(EWL_OBJECT(c), cw);
- ewl_object_preferred_inner_h_set(EWL_OBJECT(c), height + ch);
- }
-
- /* printf("Box %p children visible %d after show\n", c, ++EWL_BOX(c)->shows); */
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int space = 0;
+ int width, height;
+ int cw, ch;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_BOX_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ if (ewl_container_child_count_visible_get(c) > 1)
+ space = EWL_BOX(c)->spacing;
+
+ /*
+ * Get the sizes common to both calculations.
+ */
+ width = ewl_object_preferred_inner_w_get(EWL_OBJECT(c));
+ height = ewl_object_preferred_inner_h_get(EWL_OBJECT(c));
+
+ cw = ewl_object_preferred_w_get(EWL_OBJECT(w));
+ ch = ewl_object_preferred_h_get(EWL_OBJECT(w));
+
+ /*
+ * Base the info used on the orientation of the box.
+ */
+ if (EWL_BOX(c)->orientation == EWL_ORIENTATION_HORIZONTAL) {
+ cw += space;
+ ewl_object_preferred_inner_w_set(EWL_OBJECT(c), width + cw);
+ if (ch > height)
+ ewl_object_preferred_inner_h_set(EWL_OBJECT(c), ch);
+ }
+ else {
+ ch += space;
+ if (cw > width)
+ ewl_object_preferred_inner_w_set(EWL_OBJECT(c), cw);
+ ewl_object_preferred_inner_h_set(EWL_OBJECT(c), height + ch);
+ }
+
+ /* printf("Box %p children visible %d after show\n", c, ++EWL_BOX(c)->shows); */
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -901,31 +901,31 @@ ewl_box_cb_child_show(Ewl_Container *c, Ewl_Widget *w)
*/
void
ewl_box_cb_child_homogeneous_show(Ewl_Container *c,
- Ewl_Widget *w __UNUSED__)
+ Ewl_Widget *w __UNUSED__)
{
- int numc;
- int size, space = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
-
- numc = ewl_container_child_count_visible_get(c);
- if (numc > 1)
- space = EWL_BOX(c)->spacing;
-
- ewl_container_largest_prefer(c, EWL_ORIENTATION_HORIZONTAL);
- ewl_container_largest_prefer(c, EWL_ORIENTATION_VERTICAL);
- if (EWL_BOX(c)->orientation == EWL_ORIENTATION_HORIZONTAL) {
- size = (PREFERRED_W(c) + space) * numc - space;
- ewl_object_preferred_inner_w_set(EWL_OBJECT(c), size);
- }
- else {
- size = (PREFERRED_H(c) + space) * numc - space;
- ewl_object_preferred_inner_h_set(EWL_OBJECT(c), size);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int numc;
+ int size, space = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+
+ numc = ewl_container_child_count_visible_get(c);
+ if (numc > 1)
+ space = EWL_BOX(c)->spacing;
+
+ ewl_container_largest_prefer(c, EWL_ORIENTATION_HORIZONTAL);
+ ewl_container_largest_prefer(c, EWL_ORIENTATION_VERTICAL);
+ if (EWL_BOX(c)->orientation == EWL_ORIENTATION_HORIZONTAL) {
+ size = (PREFERRED_W(c) + space) * numc - space;
+ ewl_object_preferred_inner_w_set(EWL_OBJECT(c), size);
+ }
+ else {
+ size = (PREFERRED_H(c) + space) * numc - space;
+ ewl_object_preferred_inner_h_set(EWL_OBJECT(c), size);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -938,36 +938,36 @@ ewl_box_cb_child_homogeneous_show(Ewl_Container *c,
void
ewl_box_cb_child_hide(Ewl_Container *c, Ewl_Widget *w)
{
- int space = 0;
- Ewl_Box *b = EWL_BOX(c);
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_BOX_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- if (ewl_container_child_count_visible_get(c) > 1)
- space = b->spacing;
-
- if (b->orientation == EWL_ORIENTATION_HORIZONTAL) {
- int width;
- width = ewl_object_preferred_inner_w_get(EWL_OBJECT(c));
- width -= ewl_object_preferred_w_get(EWL_OBJECT(w));
- ewl_object_preferred_inner_w_set(EWL_OBJECT(c), width - space);
- ewl_container_largest_prefer(c, EWL_ORIENTATION_VERTICAL);
- }
- else {
- int height;
- height = ewl_object_preferred_inner_h_get(EWL_OBJECT(c));
- height -= ewl_object_preferred_h_get(EWL_OBJECT(w));
- ewl_object_preferred_inner_h_set(EWL_OBJECT(c), height - space);
- ewl_container_largest_prefer(c, EWL_ORIENTATION_HORIZONTAL);
- }
-
- /* printf("Box %p children visible %d after hide\n", c, --EWL_BOX(c)->shows); */
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int space = 0;
+ Ewl_Box *b = EWL_BOX(c);
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_BOX_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ if (ewl_container_child_count_visible_get(c) > 1)
+ space = b->spacing;
+
+ if (b->orientation == EWL_ORIENTATION_HORIZONTAL) {
+ int width;
+ width = ewl_object_preferred_inner_w_get(EWL_OBJECT(c));
+ width -= ewl_object_preferred_w_get(EWL_OBJECT(w));
+ ewl_object_preferred_inner_w_set(EWL_OBJECT(c), width - space);
+ ewl_container_largest_prefer(c, EWL_ORIENTATION_VERTICAL);
+ }
+ else {
+ int height;
+ height = ewl_object_preferred_inner_h_get(EWL_OBJECT(c));
+ height -= ewl_object_preferred_h_get(EWL_OBJECT(w));
+ ewl_object_preferred_inner_h_set(EWL_OBJECT(c), height - space);
+ ewl_container_largest_prefer(c, EWL_ORIENTATION_HORIZONTAL);
+ }
+
+ /* printf("Box %p children visible %d after hide\n", c, --EWL_BOX(c)->shows); */
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -981,26 +981,26 @@ ewl_box_cb_child_hide(Ewl_Container *c, Ewl_Widget *w)
*/
void
ewl_box_cb_child_homogeneous_resize(Ewl_Container *c, Ewl_Widget *w __UNUSED__,
- int size __UNUSED__, Ewl_Orientation o)
+ int size __UNUSED__, Ewl_Orientation o)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_BOX_TYPE);
-
- /*
- * If the change is in the orientation direction, we do the same
- * like in the show cb
- */
- if (EWL_BOX(c)->orientation == o)
- ewl_box_cb_child_homogeneous_show(c, NULL);
-
- /*
- * Find the new largest widget in the alignment direction
- */
- else
- ewl_container_largest_prefer(c, o);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_BOX_TYPE);
+
+ /*
+ * If the change is in the orientation direction, we do the same
+ * like in the show cb
+ */
+ if (EWL_BOX(c)->orientation == o)
+ ewl_box_cb_child_homogeneous_show(c, NULL);
+
+ /*
+ * Find the new largest widget in the alignment direction
+ */
+ else
+ ewl_container_largest_prefer(c, o);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
* @internal
@@ -1013,44 +1013,44 @@ ewl_box_cb_child_homogeneous_resize(Ewl_Container *c, Ewl_Widget *w __UNUSED__,
*/
void
ewl_box_cb_child_resize(Ewl_Container *c, Ewl_Widget *w __UNUSED__,
- int size, Ewl_Orientation o)
+ int size, Ewl_Orientation o)
{
- int align_size, fill_size;
- Ewl_Box_Orientation *info;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_BOX_TYPE);
-
- /*
- * Get the appropriate dimension setting functions based on the
- * orientation.
- */
- if (EWL_BOX(c)->orientation == EWL_ORIENTATION_HORIZONTAL) {
- fill_size = PREFERRED_W(c);
- align_size = PREFERRED_H(c);
- info = ewl_box_horizontal;
- }
- else {
- fill_size = PREFERRED_H(c);
- align_size = PREFERRED_W(c);
- info = ewl_box_vertical;
- }
-
- /*
- * If the change is in the orientation direction, just add it to the
- * current orientation size.
- */
- if (EWL_BOX(c)->orientation == o)
- info->pref_fill_set(EWL_OBJECT(c), fill_size + size);
-
- /*
- * Find the new largest widget in the alignment direction
- */
- else
- ewl_container_largest_prefer(c, o);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int align_size, fill_size;
+ Ewl_Box_Orientation *info;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_BOX_TYPE);
+
+ /*
+ * Get the appropriate dimension setting functions based on the
+ * orientation.
+ */
+ if (EWL_BOX(c)->orientation == EWL_ORIENTATION_HORIZONTAL) {
+ fill_size = PREFERRED_W(c);
+ align_size = PREFERRED_H(c);
+ info = ewl_box_horizontal;
+ }
+ else {
+ fill_size = PREFERRED_H(c);
+ align_size = PREFERRED_W(c);
+ info = ewl_box_vertical;
+ }
+
+ /*
+ * If the change is in the orientation direction, just add it to the
+ * current orientation size.
+ */
+ if (EWL_BOX(c)->orientation == o)
+ info->pref_fill_set(EWL_OBJECT(c), fill_size + size);
+
+ /*
+ * Find the new largest widget in the alignment direction
+ */
+ else
+ ewl_container_largest_prefer(c, o);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/*
@@ -1060,104 +1060,104 @@ ewl_box_cb_child_resize(Ewl_Container *c, Ewl_Widget *w __UNUSED__,
static void
ewl_box_setup(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- ewl_shutdown_add(ewl_box_cb_shutdown);
-
- if (!ewl_box_vertical) {
- ewl_box_vertical = NEW(Ewl_Box_Orientation, 1);
- if (!ewl_box_vertical)
- DRETURN(DLEVEL_STABLE);
-
- /*
- * This sets the aligments for filling direction.
- */
- ewl_box_vertical->f1_align = EWL_FLAG_ALIGN_TOP;
- ewl_box_vertical->f3_align = EWL_FLAG_ALIGN_BOTTOM;
-
- /*
- * These are the valid fill policies for this widget.
- */
- ewl_box_vertical->f_policy =
- EWL_FLAG_FILL_VSHRINK | EWL_FLAG_FILL_VFILL;
-
- /*
- * This sets the aligments for the non-filling direction.
- */
- ewl_box_vertical->a1_align = EWL_FLAG_ALIGN_LEFT;
- ewl_box_vertical->a3_align = EWL_FLAG_ALIGN_RIGHT;
-
- /*
- * These functions allow for asking the dimensions of the
- * children.
- */
- ewl_box_vertical->fill_ask = ewl_object_current_h_get;
-
- ewl_box_vertical->align_ask = ewl_object_current_w_get;
-
- /*
- * These functions allow for setting the dimensions of the
- * children.
- */
- ewl_box_vertical->fill_set = ewl_object_h_request;
- ewl_box_vertical->pref_fill_set = ewl_object_preferred_inner_h_set;
-
- ewl_box_vertical->align_set = ewl_object_w_request;
- }
-
- if (!ewl_box_horizontal) {
- ewl_box_horizontal = NEW(Ewl_Box_Orientation, 1);
- if (!ewl_box_horizontal)
- DRETURN(DLEVEL_STABLE);
-
- /*
- * This sets the aligments for the filling direction.
- */
- ewl_box_horizontal->f1_align = EWL_FLAG_ALIGN_LEFT;
- ewl_box_horizontal->f3_align = EWL_FLAG_ALIGN_RIGHT;
-
- /*
- * These are the valid fill policies for this widget.
- */
- ewl_box_horizontal->f_policy =
- EWL_FLAG_FILL_HSHRINK | EWL_FLAG_FILL_HFILL;
-
- /*
- * This sets the aligments for the non-filling direction.
- */
- ewl_box_horizontal->a1_align = EWL_FLAG_ALIGN_TOP;
- ewl_box_horizontal->a3_align = EWL_FLAG_ALIGN_BOTTOM;
-
- /*
- * These functions allow for asking the dimensions of the
- * children.
- */
- ewl_box_horizontal->fill_ask = ewl_object_current_w_get;
-
- ewl_box_horizontal->align_ask = ewl_object_current_h_get;
-
- /*
- * These functions allow for setting the dimensions of the
- * children.
- */
- ewl_box_horizontal->fill_set = ewl_object_w_request;
- ewl_box_horizontal->pref_fill_set = ewl_object_preferred_inner_w_set;
-
- ewl_box_horizontal->align_set = ewl_object_h_request;
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ ewl_shutdown_add(ewl_box_cb_shutdown);
+
+ if (!ewl_box_vertical) {
+ ewl_box_vertical = NEW(Ewl_Box_Orientation, 1);
+ if (!ewl_box_vertical)
+ DRETURN(DLEVEL_STABLE);
+
+ /*
+ * This sets the aligments for filling direction.
+ */
+ ewl_box_vertical->f1_align = EWL_FLAG_ALIGN_TOP;
+ ewl_box_vertical->f3_align = EWL_FLAG_ALIGN_BOTTOM;
+
+ /*
+ * These are the valid fill policies for this widget.
+ */
+ ewl_box_vertical->f_policy =
+ EWL_FLAG_FILL_VSHRINK | EWL_FLAG_FILL_VFILL;
+
+ /*
+ * This sets the aligments for the non-filling direction.
+ */
+ ewl_box_vertical->a1_align = EWL_FLAG_ALIGN_LEFT;
+ ewl_box_vertical->a3_align = EWL_FLAG_ALIGN_RIGHT;
+
+ /*
+ * These functions allow for asking the dimensions of the
+ * children.
+ */
+ ewl_box_vertical->fill_ask = ewl_object_current_h_get;
+
+ ewl_box_vertical->align_ask = ewl_object_current_w_get;
+
+ /*
+ * These functions allow for setting the dimensions of the
+ * children.
+ */
+ ewl_box_vertical->fill_set = ewl_object_h_request;
+ ewl_box_vertical->pref_fill_set = ewl_object_preferred_inner_h_set;
+
+ ewl_box_vertical->align_set = ewl_object_w_request;
+ }
+
+ if (!ewl_box_horizontal) {
+ ewl_box_horizontal = NEW(Ewl_Box_Orientation, 1);
+ if (!ewl_box_horizontal)
+ DRETURN(DLEVEL_STABLE);
+
+ /*
+ * This sets the aligments for the filling direction.
+ */
+ ewl_box_horizontal->f1_align = EWL_FLAG_ALIGN_LEFT;
+ ewl_box_horizontal->f3_align = EWL_FLAG_ALIGN_RIGHT;
+
+ /*
+ * These are the valid fill policies for this widget.
+ */
+ ewl_box_horizontal->f_policy =
+ EWL_FLAG_FILL_HSHRINK | EWL_FLAG_FILL_HFILL;
+
+ /*
+ * This sets the aligments for the non-filling direction.
+ */
+ ewl_box_horizontal->a1_align = EWL_FLAG_ALIGN_TOP;
+ ewl_box_horizontal->a3_align = EWL_FLAG_ALIGN_BOTTOM;
+
+ /*
+ * These functions allow for asking the dimensions of the
+ * children.
+ */
+ ewl_box_horizontal->fill_ask = ewl_object_current_w_get;
+
+ ewl_box_horizontal->align_ask = ewl_object_current_h_get;
+
+ /*
+ * These functions allow for setting the dimensions of the
+ * children.
+ */
+ ewl_box_horizontal->fill_set = ewl_object_w_request;
+ ewl_box_horizontal->pref_fill_set = ewl_object_preferred_inner_w_set;
+
+ ewl_box_horizontal->align_set = ewl_object_h_request;
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_box_cb_shutdown(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- IF_FREE(ewl_box_horizontal);
- IF_FREE(ewl_box_vertical);
+ IF_FREE(ewl_box_horizontal);
+ IF_FREE(ewl_box_vertical);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_box.h b/src/lib/ewl_box.h
index fefb647..d6e7394 100644
--- a/src/lib/ewl_box.h
+++ b/src/lib/ewl_box.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_BOX_H
#define EWL_BOX_H
@@ -54,38 +54,38 @@ typedef struct Ewl_Box Ewl_Box;
*/
struct Ewl_Box
{
- Ewl_Container container; /**< Inherit from Ewl_Container */
+ Ewl_Container container; /**< Inherit from Ewl_Container */
- Ewl_Orientation orientation; /**< Indicate the orientation of layout */
- int spacing; /**< Space between each widget in the box */
+ Ewl_Orientation orientation; /**< Indicate the orientation of layout */
+ int spacing; /**< Space between each widget in the box */
- unsigned int homogeneous; /**< Flag indicating space assignemnt */
+ unsigned int homogeneous; /**< Flag indicating space assignemnt */
};
-Ewl_Widget *ewl_box_new(void);
-Ewl_Widget *ewl_hbox_new(void);
-Ewl_Widget *ewl_vbox_new(void);
-int ewl_box_init(Ewl_Box *box);
-void ewl_box_orientation_set(Ewl_Box *b, Ewl_Orientation o);
+Ewl_Widget *ewl_box_new(void);
+Ewl_Widget *ewl_hbox_new(void);
+Ewl_Widget *ewl_vbox_new(void);
+int ewl_box_init(Ewl_Box *box);
+void ewl_box_orientation_set(Ewl_Box *b, Ewl_Orientation o);
Ewl_Orientation ewl_box_orientation_get(Ewl_Box *b);
-void ewl_box_spacing_set(Ewl_Box *b, int spacing);
-void ewl_box_homogeneous_set(Ewl_Box *b, unsigned int h);
-unsigned int ewl_box_homogeneous_get(Ewl_Box *b);
+void ewl_box_spacing_set(Ewl_Box *b, int spacing);
+void ewl_box_homogeneous_set(Ewl_Box *b, unsigned int h);
+unsigned int ewl_box_homogeneous_get(Ewl_Box *b);
/*
* Internally used callbacks, override at your own risk.
*/
void ewl_box_cb_child_resize(Ewl_Container *c, Ewl_Widget *w, int size,
- Ewl_Orientation o);
+ Ewl_Orientation o);
void ewl_box_cb_child_homogeneous_resize(Ewl_Container *c,
- Ewl_Widget *w, int size, Ewl_Orientation o);
+ Ewl_Widget *w, int size, Ewl_Orientation o);
void ewl_box_cb_child_show(Ewl_Container *c, Ewl_Widget *w);
void ewl_box_cb_child_hide(Ewl_Container *c, Ewl_Widget *w);
void ewl_box_cb_child_homogeneous_show(Ewl_Container *c, Ewl_Widget *w);
void ewl_box_cb_configure(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_box_cb_configure_homogeneous(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
/**
* @}
diff --git a/src/lib/ewl_button.c b/src/lib/ewl_button.c
index 85d8f7b..f34046f 100644
--- a/src/lib/ewl_button.c
+++ b/src/lib/ewl_button.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_button.h"
#include "ewl_image.h"
@@ -8,15 +8,15 @@
#include "ewl_debug.h"
static const Ewl_Stock_Funcs const stock_funcs = {
- EWL_STOCK_LABEL_SET(ewl_button_label_set),
- EWL_STOCK_IMAGE_SET(ewl_button_image_set),
- NULL
+ EWL_STOCK_LABEL_SET(ewl_button_label_set),
+ EWL_STOCK_IMAGE_SET(ewl_button_image_set),
+ NULL
};
static Ewl_Widget *ewl_button_view_cb_widget_fetch(void *data, unsigned int row,
- unsigned int col);
+ unsigned int col);
static Ewl_Widget *ewl_button_view_cb_header_fetch(void *data,
- unsigned int col);
+ unsigned int col);
/**
* @return Returns NULL on failure, a pointer to a new button on success
@@ -25,20 +25,20 @@ static Ewl_Widget *ewl_button_view_cb_header_fetch(void *data,
Ewl_Widget *
ewl_button_new(void)
{
- Ewl_Button *b;
+ Ewl_Button *b;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- b = NEW(Ewl_Button, 1);
- if (!b)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ b = NEW(Ewl_Button, 1);
+ if (!b)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_button_init(b)) {
- ewl_widget_destroy(EWL_WIDGET(b));
- b = NULL;
- }
+ if (!ewl_button_init(b)) {
+ ewl_widget_destroy(EWL_WIDGET(b));
+ b = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(b), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(b), DLEVEL_STABLE);
}
/**
@@ -51,45 +51,45 @@ ewl_button_new(void)
int
ewl_button_init(Ewl_Button *b)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(b, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(b, 0);
- w = EWL_WIDGET(b);
+ w = EWL_WIDGET(b);
- if (!ewl_stock_init(EWL_STOCK(b)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_stock_init(EWL_STOCK(b)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_inherit(w, EWL_BUTTON_TYPE);
- ewl_stock_functions_set(EWL_STOCK(b), &stock_funcs);
- ewl_stock_type_set(EWL_STOCK(b), EWL_STOCK_NONE);
+ ewl_widget_inherit(w, EWL_BUTTON_TYPE);
+ ewl_stock_functions_set(EWL_STOCK(b), &stock_funcs);
+ ewl_stock_type_set(EWL_STOCK(b), EWL_STOCK_NONE);
- ewl_box_orientation_set(EWL_BOX(b), EWL_ORIENTATION_VERTICAL);
- ewl_container_callback_notify(EWL_CONTAINER(b), EWL_CALLBACK_FOCUS_IN);
- ewl_container_callback_notify(EWL_CONTAINER(b), EWL_CALLBACK_FOCUS_OUT);
+ ewl_box_orientation_set(EWL_BOX(b), EWL_ORIENTATION_VERTICAL);
+ ewl_container_callback_notify(EWL_CONTAINER(b), EWL_CALLBACK_FOCUS_IN);
+ ewl_container_callback_notify(EWL_CONTAINER(b), EWL_CALLBACK_FOCUS_OUT);
- b->body = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(b), b->body);
- ewl_widget_appearance_set(b->body, "body");
- ewl_object_alignment_set(EWL_OBJECT(b->body), EWL_FLAG_ALIGN_CENTER);
- ewl_object_fill_policy_set(EWL_OBJECT(b->body), EWL_FLAG_FILL_VFILL);
- ewl_widget_internal_set(b->body, TRUE);
- ewl_widget_show(b->body);
+ b->body = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(b), b->body);
+ ewl_widget_appearance_set(b->body, "body");
+ ewl_object_alignment_set(EWL_OBJECT(b->body), EWL_FLAG_ALIGN_CENTER);
+ ewl_object_fill_policy_set(EWL_OBJECT(b->body), EWL_FLAG_FILL_VFILL);
+ ewl_widget_internal_set(b->body, TRUE);
+ ewl_widget_show(b->body);
- ewl_container_redirect_set(EWL_CONTAINER(b), EWL_CONTAINER(b->body));
- ewl_widget_appearance_set(w, EWL_BUTTON_TYPE);
+ ewl_container_redirect_set(EWL_CONTAINER(b), EWL_CONTAINER(b->body));
+ ewl_widget_appearance_set(w, EWL_BUTTON_TYPE);
- ewl_widget_focusable_set(w, TRUE);
+ ewl_widget_focusable_set(w, TRUE);
- ewl_callback_append(w, EWL_CALLBACK_KEY_DOWN,
- ewl_button_cb_key_down, NULL);
- ewl_callback_append(w, EWL_CALLBACK_FOCUS_IN,
- ewl_container_cb_widget_focus_in, NULL);
- ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT,
- ewl_container_cb_widget_focus_out, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_KEY_DOWN,
+ ewl_button_cb_key_down, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_FOCUS_IN,
+ ewl_container_cb_widget_focus_in, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT,
+ ewl_container_cb_widget_focus_out, NULL);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -99,42 +99,42 @@ ewl_button_init(Ewl_Button *b)
Ewl_View *
ewl_button_view_get(void)
{
- Ewl_View *view;
+ Ewl_View *view;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- view = ewl_view_new();
- ewl_view_widget_fetch_set(view, ewl_button_view_cb_widget_fetch);
- ewl_view_header_fetch_set(view, ewl_button_view_cb_header_fetch);
+ view = ewl_view_new();
+ ewl_view_widget_fetch_set(view, ewl_button_view_cb_widget_fetch);
+ ewl_view_header_fetch_set(view, ewl_button_view_cb_header_fetch);
- DRETURN_PTR(view, DLEVEL_STABLE);
+ DRETURN_PTR(view, DLEVEL_STABLE);
}
static Ewl_Widget *
ewl_button_view_cb_widget_fetch(void *data, unsigned int row __UNUSED__,
- unsigned int col __UNUSED__)
+ unsigned int col __UNUSED__)
{
- Ewl_Widget *button;
+ Ewl_Widget *button;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- button = ewl_label_new();
- ewl_button_label_set(EWL_BUTTON(button), data);
+ button = ewl_label_new();
+ ewl_button_label_set(EWL_BUTTON(button), data);
- DRETURN_PTR(button, DLEVEL_STABLE);
+ DRETURN_PTR(button, DLEVEL_STABLE);
}
static Ewl_Widget *
ewl_button_view_cb_header_fetch(void *data, unsigned int col __UNUSED__)
{
- Ewl_Widget *button;
+ Ewl_Widget *button;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- button = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button), data);
+ button = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button), data);
- DRETURN_PTR(button, DLEVEL_STABLE);
+ DRETURN_PTR(button, DLEVEL_STABLE);
}
/**
@@ -146,39 +146,39 @@ ewl_button_view_cb_header_fetch(void *data, unsigned int col __UNUSED__)
void
ewl_button_label_set(Ewl_Button *b, const char *l)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(b);
- DCHECK_TYPE(b, EWL_BUTTON_TYPE);
-
- if ((!l) && (b->label_object)) {
- ewl_widget_destroy(b->label_object);
- b->label_object = NULL;
- }
- else if (!b->label_object) {
- Ewl_Container *redir;
-
- /*
- * Save the current redirection and focus on the point where
- * our internal widgets belong.
- */
- redir = ewl_container_redirect_get(EWL_CONTAINER(b));
- ewl_container_redirect_set(EWL_CONTAINER(b),
- EWL_CONTAINER(b->body));
-
- b->label_object = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(b->label_object), l);
- ewl_object_fill_policy_set(EWL_OBJECT(b->label_object),
- EWL_FLAG_FILL_VFILL);
- ewl_container_child_append(EWL_CONTAINER(b), b->label_object);
- ewl_widget_internal_set(b->label_object, TRUE);
- ewl_widget_show(b->label_object);
-
- ewl_container_redirect_set(EWL_CONTAINER(b), redir);
- }
- else
- ewl_label_text_set(EWL_LABEL(b->label_object), l);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(b);
+ DCHECK_TYPE(b, EWL_BUTTON_TYPE);
+
+ if ((!l) && (b->label_object)) {
+ ewl_widget_destroy(b->label_object);
+ b->label_object = NULL;
+ }
+ else if (!b->label_object) {
+ Ewl_Container *redir;
+
+ /*
+ * Save the current redirection and focus on the point where
+ * our internal widgets belong.
+ */
+ redir = ewl_container_redirect_get(EWL_CONTAINER(b));
+ ewl_container_redirect_set(EWL_CONTAINER(b),
+ EWL_CONTAINER(b->body));
+
+ b->label_object = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(b->label_object), l);
+ ewl_object_fill_policy_set(EWL_OBJECT(b->label_object),
+ EWL_FLAG_FILL_VFILL);
+ ewl_container_child_append(EWL_CONTAINER(b), b->label_object);
+ ewl_widget_internal_set(b->label_object, TRUE);
+ ewl_widget_show(b->label_object);
+
+ ewl_container_redirect_set(EWL_CONTAINER(b), redir);
+ }
+ else
+ ewl_label_text_set(EWL_LABEL(b->label_object), l);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -189,15 +189,15 @@ ewl_button_label_set(Ewl_Button *b, const char *l)
const char *
ewl_button_label_get(Ewl_Button *b)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(b, NULL);
- DCHECK_TYPE_RET(b, EWL_BUTTON_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(b, NULL);
+ DCHECK_TYPE_RET(b, EWL_BUTTON_TYPE, NULL);
- if (b->label_object)
- DRETURN_PTR(ewl_label_text_get(EWL_LABEL(b->label_object)),
- DLEVEL_STABLE);
+ if (b->label_object)
+ DRETURN_PTR(ewl_label_text_get(EWL_LABEL(b->label_object)),
+ DLEVEL_STABLE);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
}
/**
@@ -210,45 +210,45 @@ ewl_button_label_get(Ewl_Button *b)
void
ewl_button_image_set(Ewl_Button *b, const char *file, const char *key)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(b);
- DCHECK_TYPE(b, EWL_BUTTON_TYPE);
-
- if (!file)
- {
- if (b->image_object)
- ewl_widget_destroy(b->image_object);
- b->image_object = NULL;
-
- DRETURN(DLEVEL_STABLE);
- }
-
- if (!b->image_object)
- {
- Ewl_Container *redir;
-
- /*
- * Save the current redirection and focus on the point where
- * our internal widgets belong.
- */
- redir = ewl_container_redirect_get(EWL_CONTAINER(b));
- ewl_container_redirect_set(EWL_CONTAINER(b),
- EWL_CONTAINER(b->body));
- b->image_object = ewl_image_new();
- ewl_container_child_prepend(EWL_CONTAINER(b), b->image_object);
- ewl_widget_internal_set(b->image_object, TRUE);
- ewl_object_fill_policy_set(EWL_OBJECT(b->image_object),
- EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(b->image_object),
- EWL_FLAG_ALIGN_CENTER);
- ewl_widget_show(b->image_object);
-
- ewl_container_redirect_set(EWL_CONTAINER(b), redir);
- }
-
- ewl_image_file_set(EWL_IMAGE(b->image_object), file, key);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(b);
+ DCHECK_TYPE(b, EWL_BUTTON_TYPE);
+
+ if (!file)
+ {
+ if (b->image_object)
+ ewl_widget_destroy(b->image_object);
+ b->image_object = NULL;
+
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ if (!b->image_object)
+ {
+ Ewl_Container *redir;
+
+ /*
+ * Save the current redirection and focus on the point where
+ * our internal widgets belong.
+ */
+ redir = ewl_container_redirect_get(EWL_CONTAINER(b));
+ ewl_container_redirect_set(EWL_CONTAINER(b),
+ EWL_CONTAINER(b->body));
+ b->image_object = ewl_image_new();
+ ewl_container_child_prepend(EWL_CONTAINER(b), b->image_object);
+ ewl_widget_internal_set(b->image_object, TRUE);
+ ewl_object_fill_policy_set(EWL_OBJECT(b->image_object),
+ EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(b->image_object),
+ EWL_FLAG_ALIGN_CENTER);
+ ewl_widget_show(b->image_object);
+
+ ewl_container_redirect_set(EWL_CONTAINER(b), redir);
+ }
+
+ ewl_image_file_set(EWL_IMAGE(b->image_object), file, key);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -259,18 +259,18 @@ ewl_button_image_set(Ewl_Button *b, const char *file, const char *key)
const char *
ewl_button_image_get(Ewl_Button *b)
{
- const char *file;
+ const char *file;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(b, NULL);
- DCHECK_TYPE_RET(b, EWL_BUTTON_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(b, NULL);
+ DCHECK_TYPE_RET(b, EWL_BUTTON_TYPE, NULL);
- if (!b->image_object)
- file = NULL;
- else
- file = ewl_image_file_path_get(EWL_IMAGE(b->image_object));
+ if (!b->image_object)
+ file = NULL;
+ else
+ file = ewl_image_file_path_get(EWL_IMAGE(b->image_object));
- DRETURN_PTR(file, DLEVEL_STABLE);
+ DRETURN_PTR(file, DLEVEL_STABLE);
}
/**
@@ -283,16 +283,16 @@ ewl_button_image_get(Ewl_Button *b)
void
ewl_button_image_size_set(Ewl_Button *b, int width, int height)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(b);
- DCHECK_TYPE(b, EWL_BUTTON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(b);
+ DCHECK_TYPE(b, EWL_BUTTON_TYPE);
- if (!b->image_object)
- ewl_button_image_set(b, "", NULL);
+ if (!b->image_object)
+ ewl_button_image_set(b, "", NULL);
- ewl_image_size_set(EWL_IMAGE(b->image_object), width, height);
+ ewl_image_size_set(EWL_IMAGE(b->image_object), width, height);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -305,19 +305,19 @@ ewl_button_image_size_set(Ewl_Button *b, int width, int height)
void
ewl_button_image_size_get(Ewl_Button *b, int *width, int *height)
{
- int w = 0, h = 0;
+ int w = 0, h = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(b);
- DCHECK_TYPE(b, EWL_BUTTON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(b);
+ DCHECK_TYPE(b, EWL_BUTTON_TYPE);
- if (b->image_object)
- ewl_image_size_get(EWL_IMAGE(b->image_object), &w, &h);
+ if (b->image_object)
+ ewl_image_size_get(EWL_IMAGE(b->image_object), &w, &h);
- if (width) *width = w;
- if (height) *height = h;
+ if (width) *width = w;
+ if (height) *height = h;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -329,13 +329,13 @@ ewl_button_image_size_get(Ewl_Button *b, int *width, int *height)
void
ewl_button_alignment_set(Ewl_Button *b, unsigned int align)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(b);
- DCHECK_TYPE(b, EWL_BUTTON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(b);
+ DCHECK_TYPE(b, EWL_BUTTON_TYPE);
- ewl_object_alignment_set(EWL_OBJECT(b->body), align);
+ ewl_object_alignment_set(EWL_OBJECT(b->body), align);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -346,12 +346,12 @@ ewl_button_alignment_set(Ewl_Button *b, unsigned int align)
unsigned int
ewl_button_alignment_get(Ewl_Button *b)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(b, 0);
- DCHECK_TYPE_RET(b, EWL_BUTTON_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(b, 0);
+ DCHECK_TYPE_RET(b, EWL_BUTTON_TYPE, 0);
- DRETURN_INT(ewl_object_alignment_get(EWL_OBJECT(b->body)),
- DLEVEL_STABLE);
+ DRETURN_INT(ewl_object_alignment_get(EWL_OBJECT(b->body)),
+ DLEVEL_STABLE);
}
/**
@@ -363,13 +363,13 @@ ewl_button_alignment_get(Ewl_Button *b)
void
ewl_button_fill_policy_set(Ewl_Button *b, unsigned int fill)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(b);
- DCHECK_TYPE(b, EWL_BUTTON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(b);
+ DCHECK_TYPE(b, EWL_BUTTON_TYPE);
- ewl_object_fill_policy_set(EWL_OBJECT(b->body), fill);
+ ewl_object_fill_policy_set(EWL_OBJECT(b->body), fill);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -380,12 +380,12 @@ ewl_button_fill_policy_set(Ewl_Button *b, unsigned int fill)
unsigned int
ewl_button_fill_policy_get(Ewl_Button *b)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(b, 0);
- DCHECK_TYPE_RET(b, EWL_BUTTON_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(b, 0);
+ DCHECK_TYPE_RET(b, EWL_BUTTON_TYPE, 0);
- DRETURN_INT(ewl_object_fill_policy_get(EWL_OBJECT(b->body)),
- DLEVEL_STABLE);
+ DRETURN_INT(ewl_object_fill_policy_get(EWL_OBJECT(b->body)),
+ DLEVEL_STABLE);
}
/**
@@ -399,30 +399,30 @@ ewl_button_fill_policy_get(Ewl_Button *b)
void
ewl_button_cb_key_down(Ewl_Widget *w, void *ev, void *data __UNUSED__)
{
- Ewl_Event_Key *event;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_BUTTON_TYPE);
-
- event = ev;
- if ((!strcmp(event->keyname, "Return"))
- || (!strcmp(event->keyname, "KP_Return"))
- || (!strcmp(event->keyname, "Enter"))
- || (!strcmp(event->keyname, "KP_Enter"))
- || (!strcmp(event->keyname, "\n"))
- || (!strcmp(event->keyname, " ")))
- {
- Ewl_Event_Mouse_Up e;
-
- e.base.modifiers = 0;
- e.base.x = 0;
- e.base.y = 0;
- e.button = 1;
-
- ewl_callback_call_with_event_data(w, EWL_CALLBACK_CLICKED, &e);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Event_Key *event;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_BUTTON_TYPE);
+
+ event = ev;
+ if ((!strcmp(event->keyname, "Return"))
+ || (!strcmp(event->keyname, "KP_Return"))
+ || (!strcmp(event->keyname, "Enter"))
+ || (!strcmp(event->keyname, "KP_Enter"))
+ || (!strcmp(event->keyname, "\n"))
+ || (!strcmp(event->keyname, " ")))
+ {
+ Ewl_Event_Mouse_Up e;
+
+ e.base.modifiers = 0;
+ e.base.x = 0;
+ e.base.y = 0;
+ e.button = 1;
+
+ ewl_callback_call_with_event_data(w, EWL_CALLBACK_CLICKED, &e);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_button.h b/src/lib/ewl_button.h
index 4a76a93..085a511 100644
--- a/src/lib/ewl_button.h
+++ b/src/lib/ewl_button.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_BUTTON_H
#define EWL_BUTTON_H
@@ -55,30 +55,30 @@ typedef struct Ewl_Button Ewl_Button;
*/
struct Ewl_Button
{
- Ewl_Stock stock; /**< Inherit from the box for adding widgets */
- Ewl_Widget *body; /**< The body of the button */
- Ewl_Widget *label_object; /**< Labels are common, make it easy */
- Ewl_Widget *image_object; /**< Add an image to the button if needed */
+ Ewl_Stock stock; /**< Inherit from the box for adding widgets */
+ Ewl_Widget *body; /**< The body of the button */
+ Ewl_Widget *label_object; /**< Labels are common, make it easy */
+ Ewl_Widget *image_object; /**< Add an image to the button if needed */
};
-Ewl_Widget *ewl_button_new(void);
-int ewl_button_init(Ewl_Button *b);
-Ewl_View *ewl_button_view_get(void);
+Ewl_Widget *ewl_button_new(void);
+int ewl_button_init(Ewl_Button *b);
+Ewl_View *ewl_button_view_get(void);
-void ewl_button_label_set(Ewl_Button *b, const char *l);
-const char *ewl_button_label_get(Ewl_Button *b);
+void ewl_button_label_set(Ewl_Button *b, const char *l);
+const char *ewl_button_label_get(Ewl_Button *b);
-void ewl_button_image_set(Ewl_Button *b, const char *file, const char *key);
-const char *ewl_button_image_get(Ewl_Button *b);
+void ewl_button_image_set(Ewl_Button *b, const char *file, const char *key);
+const char *ewl_button_image_get(Ewl_Button *b);
-void ewl_button_image_size_set(Ewl_Button *b, int width, int height);
-void ewl_button_image_size_get(Ewl_Button *b, int *width, int *height);
+void ewl_button_image_size_set(Ewl_Button *b, int width, int height);
+void ewl_button_image_size_get(Ewl_Button *b, int *width, int *height);
-unsigned int ewl_button_alignment_get(Ewl_Button *b);
-void ewl_button_alignment_set(Ewl_Button *b, unsigned int align);
+unsigned int ewl_button_alignment_get(Ewl_Button *b);
+void ewl_button_alignment_set(Ewl_Button *b, unsigned int align);
-unsigned int ewl_button_fill_policy_get(Ewl_Button *b);
-void ewl_button_fill_policy_set(Ewl_Button *b, unsigned int fill);
+unsigned int ewl_button_fill_policy_get(Ewl_Button *b);
+void ewl_button_fill_policy_set(Ewl_Button *b, unsigned int fill);
/*
* Internal
diff --git a/src/lib/ewl_calendar.c b/src/lib/ewl_calendar.c
index 82375e6..bb4a453 100644
--- a/src/lib/ewl_calendar.c
+++ b/src/lib/ewl_calendar.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include <time.h>
#include "ewl_base.h"
#include "ewl_calendar.h"
@@ -13,21 +13,21 @@
static void ewl_calendar_grid_setup(Ewl_Calendar *cal);
static int ewl_calendar_leap_year_detect(unsigned int year);
static void ewl_calendar_highlight_today(struct tm *now, Ewl_Label *day,
- Ewl_Calendar *cal);
+ Ewl_Calendar *cal);
static void ewl_calendar_day_select_cb(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
static void ewl_calendar_day_pick_cb(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
static void ewl_calendar_prev_month_cb(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
static void ewl_calendar_next_month_cb(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
static void ewl_calendar_add_day_labels(Ewl_Calendar *ib);
static const char * const months[] = {"January", "February", "March", "April",
- "May", "June", "July", "August", "September",
- "October", "November", "December"};
+ "May", "June", "July", "August", "September",
+ "October", "November", "December"};
static const int mdays[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
@@ -40,19 +40,19 @@ static const int mdays[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
Ewl_Widget *
ewl_calendar_new(void)
{
- Ewl_Calendar* ib;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ Ewl_Calendar* ib;
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ib = NEW(Ewl_Calendar, 1);
- if (!ib)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ ib = NEW(Ewl_Calendar, 1);
+ if (!ib)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_calendar_init(ib)) {
- ewl_widget_destroy(EWL_WIDGET(ib));
- ib = NULL;
- }
+ if (!ewl_calendar_init(ib)) {
+ ewl_widget_destroy(EWL_WIDGET(ib));
+ ib = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(ib), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(ib), DLEVEL_STABLE);
}
/**
@@ -63,85 +63,85 @@ ewl_calendar_new(void)
int
ewl_calendar_init(Ewl_Calendar* ib)
{
- Ewl_Widget *w, *vbox, *top_hbox, *o;
- struct tm *ptr;
- time_t tm;
- const char *icon;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(ib, FALSE);
-
- w = EWL_WIDGET(ib);
- if (!ewl_box_init(EWL_BOX(ib)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- ewl_box_orientation_set(EWL_BOX(ib), EWL_ORIENTATION_HORIZONTAL);
- ewl_widget_appearance_set(w, EWL_CALENDAR_TYPE);
- ewl_widget_inherit(w, EWL_CALENDAR_TYPE);
- ewl_object_fill_policy_set(EWL_OBJECT(ib), EWL_FLAG_FILL_FILL);
-
- vbox = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(ib), vbox);
- ewl_widget_internal_set(vbox, TRUE);
- ewl_widget_show(vbox);
-
- top_hbox = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(vbox), top_hbox);
- ewl_widget_internal_set(top_hbox, TRUE);
- ewl_widget_show(top_hbox);
-
- o = ewl_icon_new();
- ewl_container_child_append(EWL_CONTAINER(top_hbox), o);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
- icon = ewl_icon_theme_icon_path_get(EWL_ICON_GO_PREVIOUS,
- EWL_ICON_SIZE_SMALL);
- if (icon)
- ewl_icon_image_set(EWL_ICON(o), icon, EWL_ICON_GO_PREVIOUS);
- ewl_icon_alt_text_set(EWL_ICON(o), "<<");
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_calendar_prev_month_cb, ib);
- ewl_widget_show(o);
-
- ib->month_label = ewl_label_new();
- ewl_object_fill_policy_set(EWL_OBJECT(ib->month_label),
- EWL_FLAG_FILL_HFILL |
- EWL_FLAG_FILL_VSHRINK);
- ewl_object_alignment_set(EWL_OBJECT(ib->month_label),
- EWL_FLAG_ALIGN_CENTER);
- ewl_container_child_append(EWL_CONTAINER(top_hbox), ib->month_label);
- ewl_widget_show(ib->month_label);
-
- o = ewl_icon_new();
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_RIGHT);
- ewl_container_child_append(EWL_CONTAINER(top_hbox), o);
- icon = ewl_icon_theme_icon_path_get(EWL_ICON_GO_NEXT,
- EWL_ICON_SIZE_SMALL);
- if (icon)
- ewl_icon_image_set(EWL_ICON(o), icon, EWL_ICON_GO_NEXT);
- ewl_icon_alt_text_set(EWL_ICON(o), ">>");
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_calendar_next_month_cb, ib);
- ewl_widget_show(o);
-
- ib->grid = ewl_grid_new();
- ewl_grid_dimensions_set(EWL_GRID(ib->grid), 7, 7);
- ewl_container_child_append(EWL_CONTAINER(vbox), EWL_WIDGET(ib->grid));
- ewl_object_fill_policy_set(EWL_OBJECT(ib->grid), EWL_FLAG_FILL_FILL);
- ewl_widget_show(ib->grid);
-
- /* Get the start time.. */
- tm = time(NULL);
- ptr = localtime(&tm);
-
- ib->cur_month = ptr->tm_mon;
- ib->cur_day = ptr->tm_mday;
- ib->cur_year = ptr->tm_year + 1900;
-
- ewl_calendar_grid_setup(ib);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Widget *w, *vbox, *top_hbox, *o;
+ struct tm *ptr;
+ time_t tm;
+ const char *icon;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(ib, FALSE);
+
+ w = EWL_WIDGET(ib);
+ if (!ewl_box_init(EWL_BOX(ib)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ ewl_box_orientation_set(EWL_BOX(ib), EWL_ORIENTATION_HORIZONTAL);
+ ewl_widget_appearance_set(w, EWL_CALENDAR_TYPE);
+ ewl_widget_inherit(w, EWL_CALENDAR_TYPE);
+ ewl_object_fill_policy_set(EWL_OBJECT(ib), EWL_FLAG_FILL_FILL);
+
+ vbox = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(ib), vbox);
+ ewl_widget_internal_set(vbox, TRUE);
+ ewl_widget_show(vbox);
+
+ top_hbox = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(vbox), top_hbox);
+ ewl_widget_internal_set(top_hbox, TRUE);
+ ewl_widget_show(top_hbox);
+
+ o = ewl_icon_new();
+ ewl_container_child_append(EWL_CONTAINER(top_hbox), o);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
+ icon = ewl_icon_theme_icon_path_get(EWL_ICON_GO_PREVIOUS,
+ EWL_ICON_SIZE_SMALL);
+ if (icon)
+ ewl_icon_image_set(EWL_ICON(o), icon, EWL_ICON_GO_PREVIOUS);
+ ewl_icon_alt_text_set(EWL_ICON(o), "<<");
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_calendar_prev_month_cb, ib);
+ ewl_widget_show(o);
+
+ ib->month_label = ewl_label_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(ib->month_label),
+ EWL_FLAG_FILL_HFILL |
+ EWL_FLAG_FILL_VSHRINK);
+ ewl_object_alignment_set(EWL_OBJECT(ib->month_label),
+ EWL_FLAG_ALIGN_CENTER);
+ ewl_container_child_append(EWL_CONTAINER(top_hbox), ib->month_label);
+ ewl_widget_show(ib->month_label);
+
+ o = ewl_icon_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_RIGHT);
+ ewl_container_child_append(EWL_CONTAINER(top_hbox), o);
+ icon = ewl_icon_theme_icon_path_get(EWL_ICON_GO_NEXT,
+ EWL_ICON_SIZE_SMALL);
+ if (icon)
+ ewl_icon_image_set(EWL_ICON(o), icon, EWL_ICON_GO_NEXT);
+ ewl_icon_alt_text_set(EWL_ICON(o), ">>");
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_calendar_next_month_cb, ib);
+ ewl_widget_show(o);
+
+ ib->grid = ewl_grid_new();
+ ewl_grid_dimensions_set(EWL_GRID(ib->grid), 7, 7);
+ ewl_container_child_append(EWL_CONTAINER(vbox), EWL_WIDGET(ib->grid));
+ ewl_object_fill_policy_set(EWL_OBJECT(ib->grid), EWL_FLAG_FILL_FILL);
+ ewl_widget_show(ib->grid);
+
+ /* Get the start time.. */
+ tm = time(NULL);
+ ptr = localtime(&tm);
+
+ ib->cur_month = ptr->tm_mon;
+ ib->cur_day = ptr->tm_mday;
+ ib->cur_year = ptr->tm_year + 1900;
+
+ ewl_calendar_grid_setup(ib);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -154,24 +154,24 @@ ewl_calendar_init(Ewl_Calendar* ib)
char *
ewl_calendar_ascii_time_get(Ewl_Calendar *cal)
{
- time_t tm;
- struct tm* month_start;
- char str[1024];
+ time_t tm;
+ struct tm* month_start;
+ char str[1024];
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cal, NULL);
- DCHECK_TYPE_RET(cal, EWL_CALENDAR_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cal, NULL);
+ DCHECK_TYPE_RET(cal, EWL_CALENDAR_TYPE, NULL);
- tm = time(NULL);
- month_start = localtime(&tm);
- month_start->tm_mday = cal->cur_day;
- month_start->tm_mon = cal->cur_month;
- month_start->tm_year = cal->cur_year - 1900;
- mktime(month_start);
+ tm = time(NULL);
+ month_start = localtime(&tm);
+ month_start->tm_mday = cal->cur_day;
+ month_start->tm_mon = cal->cur_month;
+ month_start->tm_year = cal->cur_year - 1900;
+ mktime(month_start);
- snprintf(str, sizeof(str), "%s", asctime(month_start));
+ snprintf(str, sizeof(str), "%s", asctime(month_start));
- DRETURN_PTR(strdup(str), DLEVEL_STABLE);
+ DRETURN_PTR(strdup(str), DLEVEL_STABLE);
}
/**
@@ -182,11 +182,11 @@ ewl_calendar_ascii_time_get(Ewl_Calendar *cal)
int
ewl_calendar_day_get(Ewl_Calendar *c)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(c, FALSE);
- DCHECK_TYPE_RET(c, EWL_CALENDAR_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(c, FALSE);
+ DCHECK_TYPE_RET(c, EWL_CALENDAR_TYPE, FALSE);
- DRETURN_INT(c->cur_day, DLEVEL_STABLE);
+ DRETURN_INT(c->cur_day, DLEVEL_STABLE);
}
/**
@@ -197,11 +197,11 @@ ewl_calendar_day_get(Ewl_Calendar *c)
int
ewl_calendar_month_get(Ewl_Calendar *c)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(c, FALSE);
- DCHECK_TYPE_RET(c, EWL_CALENDAR_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(c, FALSE);
+ DCHECK_TYPE_RET(c, EWL_CALENDAR_TYPE, FALSE);
- DRETURN_INT(c->cur_month, DLEVEL_STABLE);
+ DRETURN_INT(c->cur_month, DLEVEL_STABLE);
}
/**
@@ -212,251 +212,251 @@ ewl_calendar_month_get(Ewl_Calendar *c)
int
ewl_calendar_year_get(Ewl_Calendar *c)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(c, FALSE);
- DCHECK_TYPE_RET(c, EWL_CALENDAR_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(c, FALSE);
+ DCHECK_TYPE_RET(c, EWL_CALENDAR_TYPE, FALSE);
- DRETURN_INT(c->cur_year, DLEVEL_STABLE);
+ DRETURN_INT(c->cur_year, DLEVEL_STABLE);
}
static void
ewl_calendar_grid_setup(Ewl_Calendar *cal)
{
- struct tm *date;
- char display_top[50];
- time_t tm;
- int today = 0;
- int cur_row, cur_col, cur_day, days = 30;
- Ewl_Widget *day_label;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cal);
- DCHECK_TYPE(cal, EWL_CALENDAR_TYPE);
-
- ewl_container_reset(EWL_CONTAINER(cal->grid));
- ewl_calendar_add_day_labels(cal);
-
- /* Make the initial display */
- snprintf(display_top, sizeof(display_top), "%s %d",
- months[cal->cur_month], cal->cur_year);
- ewl_label_text_set(EWL_LABEL(cal->month_label), display_top);
- today = cal->cur_day;
-
- /* Get the DAY of the first day of this month */
- tm = time(NULL);
- date = localtime(&tm);
- date->tm_mday = 0;
- date->tm_mon = cal->cur_month;
- date->tm_year = cal->cur_year - 1900;
- mktime(date);
-
- /* Now add the days to this month */
- cur_row = 2;
- cur_col = date->tm_wday + 1;
- if (cur_col > 7) {
- cur_row = 2;
- cur_col = 1;
- }
-
- cur_day = 0;
- tm = time(NULL);
- date = localtime(&tm);
-
- days = mdays[cal->cur_month];
- /* If february, do leap years... */
- if (cal->cur_month == 1) {
- if (ewl_calendar_leap_year_detect(cal->cur_year))
- days = 29;
- else
- days = 28;
- }
-
- while (cur_day < days) {
- char day[3];
-
- if (cur_col > 7) {
- cur_row++;
- cur_col = 1;
- }
-
- snprintf(day, sizeof(day), "%d", cur_day + 1);
- day_label = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(day_label), day);
- ewl_object_alignment_set(EWL_OBJECT(day_label),
- EWL_FLAG_ALIGN_RIGHT);
- ewl_callback_append(EWL_WIDGET(day_label),
- EWL_CALLBACK_MOUSE_DOWN,
- ewl_calendar_day_select_cb, cal);
- ewl_callback_append(EWL_WIDGET(day_label),
- EWL_CALLBACK_CLICKED,
- ewl_calendar_day_pick_cb, cal);
-
- ewl_container_child_append(EWL_CONTAINER(cal->grid), day_label);
- ewl_grid_child_position_set(EWL_GRID(cal->grid),
- day_label, cur_col - 1,
- cur_col - 1, cur_row - 1,
- cur_row - 1);
- ewl_calendar_highlight_today(date, EWL_LABEL(day_label), cal);
- ewl_widget_show(day_label);
-
- cur_col++;
- cur_day++;
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ struct tm *date;
+ char display_top[50];
+ time_t tm;
+ int today = 0;
+ int cur_row, cur_col, cur_day, days = 30;
+ Ewl_Widget *day_label;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cal);
+ DCHECK_TYPE(cal, EWL_CALENDAR_TYPE);
+
+ ewl_container_reset(EWL_CONTAINER(cal->grid));
+ ewl_calendar_add_day_labels(cal);
+
+ /* Make the initial display */
+ snprintf(display_top, sizeof(display_top), "%s %d",
+ months[cal->cur_month], cal->cur_year);
+ ewl_label_text_set(EWL_LABEL(cal->month_label), display_top);
+ today = cal->cur_day;
+
+ /* Get the DAY of the first day of this month */
+ tm = time(NULL);
+ date = localtime(&tm);
+ date->tm_mday = 0;
+ date->tm_mon = cal->cur_month;
+ date->tm_year = cal->cur_year - 1900;
+ mktime(date);
+
+ /* Now add the days to this month */
+ cur_row = 2;
+ cur_col = date->tm_wday + 1;
+ if (cur_col > 7) {
+ cur_row = 2;
+ cur_col = 1;
+ }
+
+ cur_day = 0;
+ tm = time(NULL);
+ date = localtime(&tm);
+
+ days = mdays[cal->cur_month];
+ /* If february, do leap years... */
+ if (cal->cur_month == 1) {
+ if (ewl_calendar_leap_year_detect(cal->cur_year))
+ days = 29;
+ else
+ days = 28;
+ }
+
+ while (cur_day < days) {
+ char day[3];
+
+ if (cur_col > 7) {
+ cur_row++;
+ cur_col = 1;
+ }
+
+ snprintf(day, sizeof(day), "%d", cur_day + 1);
+ day_label = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(day_label), day);
+ ewl_object_alignment_set(EWL_OBJECT(day_label),
+ EWL_FLAG_ALIGN_RIGHT);
+ ewl_callback_append(EWL_WIDGET(day_label),
+ EWL_CALLBACK_MOUSE_DOWN,
+ ewl_calendar_day_select_cb, cal);
+ ewl_callback_append(EWL_WIDGET(day_label),
+ EWL_CALLBACK_CLICKED,
+ ewl_calendar_day_pick_cb, cal);
+
+ ewl_container_child_append(EWL_CONTAINER(cal->grid), day_label);
+ ewl_grid_child_position_set(EWL_GRID(cal->grid),
+ day_label, cur_col - 1,
+ cur_col - 1, cur_row - 1,
+ cur_row - 1);
+ ewl_calendar_highlight_today(date, EWL_LABEL(day_label), cal);
+ ewl_widget_show(day_label);
+
+ cur_col++;
+ cur_day++;
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static int
ewl_calendar_leap_year_detect(unsigned int year)
{
- int leap = FALSE;
+ int leap = FALSE;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- /* FIXME: Properly handle leap year's prior to 1581. */
- if (year <= 1581) year = 1581;
- leap = (((year % 4 == 0) && (year % 100)) || (year % 400 == 0));
+ /* FIXME: Properly handle leap year's prior to 1581. */
+ if (year <= 1581) year = 1581;
+ leap = (((year % 4 == 0) && (year % 100)) || (year % 400 == 0));
- DRETURN_INT(leap, DLEVEL_STABLE);
+ DRETURN_INT(leap, DLEVEL_STABLE);
}
static void
ewl_calendar_highlight_today(struct tm *now, Ewl_Label *day,
- Ewl_Calendar *cal)
+ Ewl_Calendar *cal)
{
- int i;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(now);
- DCHECK_PARAM_PTR(day);
- DCHECK_PARAM_PTR(cal);
- DCHECK_TYPE(day, EWL_LABEL_TYPE);
- DCHECK_TYPE(cal, EWL_CALENDAR_TYPE);
-
- /* Get the day */
- i = atoi(ewl_label_text_get(EWL_LABEL(day)));
- if ((i == now->tm_mday) && ((now->tm_year + 1900) == cal->cur_year)
- && (now->tm_mon == cal->cur_month)) {
- ewl_widget_color_set(EWL_WIDGET(day), 0, 0, 255, 255);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int i;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(now);
+ DCHECK_PARAM_PTR(day);
+ DCHECK_PARAM_PTR(cal);
+ DCHECK_TYPE(day, EWL_LABEL_TYPE);
+ DCHECK_TYPE(cal, EWL_CALENDAR_TYPE);
+
+ /* Get the day */
+ i = atoi(ewl_label_text_get(EWL_LABEL(day)));
+ if ((i == now->tm_mday) && ((now->tm_year + 1900) == cal->cur_year)
+ && (now->tm_mon == cal->cur_month)) {
+ ewl_widget_color_set(EWL_WIDGET(day), 0, 0, 255, 255);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_calendar_day_select_cb(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data)
+ void *user_data)
{
- struct tm *now;
- time_t now_tm;
- int i;
- Ewl_Widget* it;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(user_data);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- DCHECK_TYPE(user_data, EWL_CALENDAR_TYPE);
-
- now_tm = time(NULL);
- now = localtime(&now_tm);
- i = atoi(ewl_label_text_get(EWL_LABEL(w)));
-
- ewl_container_child_iterate_begin(EWL_CONTAINER(EWL_CALENDAR(user_data)->grid));
- while ((it = ewl_container_child_next(
- EWL_CONTAINER(EWL_CALENDAR(user_data)->grid))) != NULL) {
- ewl_widget_color_set(EWL_WIDGET(it), 255, 255, 255, 255);
- ewl_calendar_highlight_today(now, EWL_LABEL(it), EWL_CALENDAR(user_data));
- }
-
- ewl_widget_color_set(w, 255, 0, 0, 255);
- EWL_CALENDAR(user_data)->cur_day = i;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ struct tm *now;
+ time_t now_tm;
+ int i;
+ Ewl_Widget* it;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(user_data);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DCHECK_TYPE(user_data, EWL_CALENDAR_TYPE);
+
+ now_tm = time(NULL);
+ now = localtime(&now_tm);
+ i = atoi(ewl_label_text_get(EWL_LABEL(w)));
+
+ ewl_container_child_iterate_begin(EWL_CONTAINER(EWL_CALENDAR(user_data)->grid));
+ while ((it = ewl_container_child_next(
+ EWL_CONTAINER(EWL_CALENDAR(user_data)->grid))) != NULL) {
+ ewl_widget_color_set(EWL_WIDGET(it), 255, 255, 255, 255);
+ ewl_calendar_highlight_today(now, EWL_LABEL(it), EWL_CALENDAR(user_data));
+ }
+
+ ewl_widget_color_set(w, 255, 0, 0, 255);
+ EWL_CALENDAR(user_data)->cur_day = i;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_calendar_day_pick_cb(Ewl_Widget *w __UNUSED__, void *ev_data,
- void *user_data)
+ void *user_data)
{
- Ewl_Event_Mouse_Down *ev;
+ Ewl_Event_Mouse_Down *ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(user_data);
- DCHECK_TYPE(user_data, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(user_data);
+ DCHECK_TYPE(user_data, EWL_WIDGET_TYPE);
- ev = ev_data;
- if (ev->clicks == 2)
- ewl_callback_call(EWL_WIDGET(user_data),
- EWL_CALLBACK_VALUE_CHANGED);
+ ev = ev_data;
+ if (ev->clicks == 2)
+ ewl_callback_call(EWL_WIDGET(user_data),
+ EWL_CALLBACK_VALUE_CHANGED);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_calendar_prev_month_cb(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__,
- void *user_data)
+ void *user_data)
{
- Ewl_Calendar *ib;
+ Ewl_Calendar *ib;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(user_data);
- DCHECK_TYPE(user_data, EWL_CALENDAR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(user_data);
+ DCHECK_TYPE(user_data, EWL_CALENDAR_TYPE);
- ib = EWL_CALENDAR(user_data);
- ib->cur_month -= 1;
- if (ib->cur_month < 0) {
- ib->cur_month = 11;
- ib->cur_year--;
- }
- ewl_calendar_grid_setup(ib);
+ ib = EWL_CALENDAR(user_data);
+ ib->cur_month -= 1;
+ if (ib->cur_month < 0) {
+ ib->cur_month = 11;
+ ib->cur_year--;
+ }
+ ewl_calendar_grid_setup(ib);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_calendar_next_month_cb(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__,
- void *user_data)
+ void *user_data)
{
- Ewl_Calendar *ib;
+ Ewl_Calendar *ib;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(user_data);
- DCHECK_TYPE(user_data, EWL_CALENDAR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(user_data);
+ DCHECK_TYPE(user_data, EWL_CALENDAR_TYPE);
- ib = EWL_CALENDAR(user_data);
- ib->cur_month += 1;
- if (ib->cur_month > 11) {
- ib->cur_month = 0;
- ib->cur_year++;
- }
- ewl_calendar_grid_setup(ib);
+ ib = EWL_CALENDAR(user_data);
+ ib->cur_month += 1;
+ if (ib->cur_month > 11) {
+ ib->cur_month = 0;
+ ib->cur_year++;
+ }
+ ewl_calendar_grid_setup(ib);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_calendar_add_day_labels(Ewl_Calendar *ib)
{
- Ewl_Widget* day_label;
- char *days[] = {"M", "T", "W", "T", "F", "S", "S", NULL};
- int i;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(ib);
- DCHECK_TYPE(ib, EWL_CALENDAR_TYPE);
-
- for (i = 0; days[i] != NULL; i++)
- {
- day_label = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(day_label), days[i]);
- ewl_container_child_append(EWL_CONTAINER(ib->grid),
- day_label);
- ewl_object_alignment_set(EWL_OBJECT(day_label),
- EWL_FLAG_ALIGN_CENTER);
- ewl_widget_show(day_label);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Widget* day_label;
+ char *days[] = {"M", "T", "W", "T", "F", "S", "S", NULL};
+ int i;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(ib);
+ DCHECK_TYPE(ib, EWL_CALENDAR_TYPE);
+
+ for (i = 0; days[i] != NULL; i++)
+ {
+ day_label = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(day_label), days[i]);
+ ewl_container_child_append(EWL_CONTAINER(ib->grid),
+ day_label);
+ ewl_object_alignment_set(EWL_OBJECT(day_label),
+ EWL_FLAG_ALIGN_CENTER);
+ ewl_widget_show(day_label);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_calendar.h b/src/lib/ewl_calendar.h
index 2cd3afe..5ff11d6 100644
--- a/src/lib/ewl_calendar.h
+++ b/src/lib/ewl_calendar.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_CALENDAR_H
#define EWL_CALENDAR_H
@@ -51,21 +51,21 @@ typedef struct Ewl_Calendar Ewl_Calendar;
*/
struct Ewl_Calendar
{
- Ewl_Box box; /**< Inherit from Ewl_Box */
+ Ewl_Box box; /**< Inherit from Ewl_Box */
- int cur_day; /**< The current day selected */
- int cur_month; /**< The current month selected */
- int cur_year; /**< The current year selected */
- Ewl_Widget *grid; /**< The layout grid */
- Ewl_Widget *month_label; /**< The month label */
+ int cur_day; /**< The current day selected */
+ int cur_month; /**< The current month selected */
+ int cur_year; /**< The current year selected */
+ Ewl_Widget *grid; /**< The layout grid */
+ Ewl_Widget *month_label; /**< The month label */
};
-Ewl_Widget *ewl_calendar_new(void);
-int ewl_calendar_init(Ewl_Calendar *calendar);
-char *ewl_calendar_ascii_time_get(Ewl_Calendar *cal);
-int ewl_calendar_day_get(Ewl_Calendar *c);
-int ewl_calendar_month_get(Ewl_Calendar *c);
-int ewl_calendar_year_get(Ewl_Calendar *c);
+Ewl_Widget *ewl_calendar_new(void);
+int ewl_calendar_init(Ewl_Calendar *calendar);
+char *ewl_calendar_ascii_time_get(Ewl_Calendar *cal);
+int ewl_calendar_day_get(Ewl_Calendar *c);
+int ewl_calendar_month_get(Ewl_Calendar *c);
+int ewl_calendar_year_get(Ewl_Calendar *c);
/**
* @}
diff --git a/src/lib/ewl_callback.c b/src/lib/ewl_callback.c
index 75a6984..887ef54 100644
--- a/src/lib/ewl_callback.c
+++ b/src/lib/ewl_callback.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_macros.h"
#include "ewl_private.h"
@@ -18,12 +18,12 @@ static unsigned int ewl_callback_hash(const void *key);
static int ewl_callback_compare(const void *key1, const void *key2);
static void ewl_callback_unregister(Ewl_Callback * cb);
static Ewl_Callback *ewl_callback_get(Ewl_Widget *w, unsigned int type,
- unsigned int idx);
+ unsigned int idx);
static void ewl_callback_rm(Ewl_Widget *w, unsigned int t,
- unsigned int pos);
+ unsigned int pos);
static int ewl_callback_insert(Ewl_Widget *w, unsigned int t,
- Ewl_Callback *cb, unsigned int pos);
+ Ewl_Callback *cb, unsigned int pos);
static int callback_type_count;
static int callback_id = 0;
@@ -55,13 +55,13 @@ static Ecore_Hash *cb_registration = NULL;
int
ewl_callbacks_init(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- cb_registration = ecore_hash_new(ewl_callback_hash,
- ewl_callback_compare);
- callback_type_count = EWL_CALLBACK_MAX + 1;
+ cb_registration = ecore_hash_new(ewl_callback_hash,
+ ewl_callback_compare);
+ callback_type_count = EWL_CALLBACK_MAX + 1;
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -74,11 +74,11 @@ ewl_callbacks_init(void)
void
ewl_callbacks_shutdown(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- IF_FREE_HASH(cb_registration);
+ IF_FREE_HASH(cb_registration);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/*
@@ -91,175 +91,175 @@ ewl_callbacks_shutdown(void)
static void
ewl_callback_unregister(Ewl_Callback *cb)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cb);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cb);
- cb->references--;
- if (cb->references < 1) {
- ecore_hash_remove(cb_registration, cb);
- FREE(cb);
- }
+ cb->references--;
+ if (cb->references < 1) {
+ ecore_hash_remove(cb_registration, cb);
+ FREE(cb);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_callback_rm(Ewl_Widget *w, unsigned int t, unsigned int pos)
{
- unsigned int place;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- /* don't type check here as this will get called after most of a
- * widget is already destroyed */
-
- if (t > EWL_CALLBACK_MAX)
- place = EWL_CALLBACK_MAX;
- else
- place = t;
-
- /* deal with the direct case first */
- if (w->callbacks[place].mask & EWL_CALLBACK_TYPE_DIRECT)
- {
- ewl_callback_unregister((Ewl_Callback *)w->callbacks[place].list);
-
- w->callbacks[place].len = 0;
- w->callbacks[place].list = NULL;
- EWL_CALLBACK_SET_NODIRECT(w, place);
-
- DRETURN(DLEVEL_STABLE);
- }
- ewl_callback_unregister(w->callbacks[place].list[pos]);
-
- /* if this will empty the list (we've already handled direct) */
- if ((EWL_CALLBACK_LEN(w, place) - 1) == 0)
- {
- w->callbacks[place].len = 0;
- w->callbacks[place].list[0] = NULL;
- FREE(w->callbacks[place].list);
-
- DRETURN(DLEVEL_STABLE);
- }
-
- /* not the last position */
- if ((int)pos != (EWL_CALLBACK_LEN(w, place) - 1))
- {
- memmove(w->callbacks[place].list + pos,
- w->callbacks[place].list + (pos + 1),
- (w->callbacks[place].len - pos - 1) * sizeof(void *));
- }
-
- w->callbacks[place].len -= 1;
- w->callbacks[place].list[EWL_CALLBACK_LEN(w, place)] = NULL;
- w->callbacks[place].list = realloc(w->callbacks[place].list,
- w->callbacks[place].len * sizeof(void *));
-
- if (pos < EWL_CALLBACK_POS(w, place))
- EWL_CALLBACK_POS(w, place)--;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ unsigned int place;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ /* don't type check here as this will get called after most of a
+ * widget is already destroyed */
+
+ if (t > EWL_CALLBACK_MAX)
+ place = EWL_CALLBACK_MAX;
+ else
+ place = t;
+
+ /* deal with the direct case first */
+ if (w->callbacks[place].mask & EWL_CALLBACK_TYPE_DIRECT)
+ {
+ ewl_callback_unregister((Ewl_Callback *)w->callbacks[place].list);
+
+ w->callbacks[place].len = 0;
+ w->callbacks[place].list = NULL;
+ EWL_CALLBACK_SET_NODIRECT(w, place);
+
+ DRETURN(DLEVEL_STABLE);
+ }
+ ewl_callback_unregister(w->callbacks[place].list[pos]);
+
+ /* if this will empty the list (we've already handled direct) */
+ if ((EWL_CALLBACK_LEN(w, place) - 1) == 0)
+ {
+ w->callbacks[place].len = 0;
+ w->callbacks[place].list[0] = NULL;
+ FREE(w->callbacks[place].list);
+
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ /* not the last position */
+ if ((int)pos != (EWL_CALLBACK_LEN(w, place) - 1))
+ {
+ memmove(w->callbacks[place].list + pos,
+ w->callbacks[place].list + (pos + 1),
+ (w->callbacks[place].len - pos - 1) * sizeof(void *));
+ }
+
+ w->callbacks[place].len -= 1;
+ w->callbacks[place].list[EWL_CALLBACK_LEN(w, place)] = NULL;
+ w->callbacks[place].list = realloc(w->callbacks[place].list,
+ w->callbacks[place].len * sizeof(void *));
+
+ if (pos < EWL_CALLBACK_POS(w, place))
+ EWL_CALLBACK_POS(w, place)--;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static int
ewl_callback_insert(Ewl_Widget *w, unsigned int t,
- Ewl_Callback *cb, unsigned int pos)
+ Ewl_Callback *cb, unsigned int pos)
{
- unsigned int place;
- Ewl_Callback *old = NULL;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, 0);
- DCHECK_PARAM_PTR_RET(cb, 0);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, 0);
-
- if (EWL_CALLBACK_LEN(w, t) == 255) {
- DERROR("Maximum number of callbacks of one type "
- "exceeded on a widget\n");
- DRETURN_INT(0, DLEVEL_STABLE);
- }
-
- if (t > EWL_CALLBACK_MAX)
- place = EWL_CALLBACK_MAX;
- else
- place = t;
-
- /* set direct if possible */
- if (!EWL_CALLBACK_LEN(w, t))
- {
- w->callbacks[place].list = (void *)cb;
- w->callbacks[place].len = 1;
- EWL_CALLBACK_SET_DIRECT(w, t);
-
- DRETURN_INT(cb->id, DLEVEL_STABLE);
- }
- w->callbacks[place].len ++;
-
- /* if we have a type direct then we need to save off the direct
- * pointer and set the list to NULL so it'll be allocd' correctly */
- if (w->callbacks[place].mask & EWL_CALLBACK_TYPE_DIRECT)
- {
- old = (Ewl_Callback *)w->callbacks[place].list;
- w->callbacks[place].list = NULL;
- EWL_CALLBACK_SET_NODIRECT(w, t);
- }
-
- w->callbacks[place].list = realloc(w->callbacks[place].list,
- w->callbacks[place].len * sizeof(void *));
-
- /* if old is set this was a direct so we can just set 0, 1 and be
- * done with it */
- if (old)
- {
- w->callbacks[place].list[0] = (!pos ? cb : old);
- w->callbacks[place].list[1] = ( pos ? cb : old);
- }
- else
- {
- /* only have to move if we aren't at the end (of the
- * original lenth already */
- if ((int)pos != (w->callbacks[place].len - 1))
- {
- memmove(w->callbacks[place].list + (pos + 1),
- w->callbacks[place].list + pos,
- (w->callbacks[place].len - pos - 1)
- * sizeof(void *));
- }
- w->callbacks[place].list[pos] = cb;
- }
-
- if (pos <= EWL_CALLBACK_POS(w, t))
- EWL_CALLBACK_POS(w, t)++;
-
- DRETURN_INT(cb->id, DLEVEL_STABLE);
+ unsigned int place;
+ Ewl_Callback *old = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, 0);
+ DCHECK_PARAM_PTR_RET(cb, 0);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, 0);
+
+ if (EWL_CALLBACK_LEN(w, t) == 255) {
+ DERROR("Maximum number of callbacks of one type "
+ "exceeded on a widget\n");
+ DRETURN_INT(0, DLEVEL_STABLE);
+ }
+
+ if (t > EWL_CALLBACK_MAX)
+ place = EWL_CALLBACK_MAX;
+ else
+ place = t;
+
+ /* set direct if possible */
+ if (!EWL_CALLBACK_LEN(w, t))
+ {
+ w->callbacks[place].list = (void *)cb;
+ w->callbacks[place].len = 1;
+ EWL_CALLBACK_SET_DIRECT(w, t);
+
+ DRETURN_INT(cb->id, DLEVEL_STABLE);
+ }
+ w->callbacks[place].len ++;
+
+ /* if we have a type direct then we need to save off the direct
+ * pointer and set the list to NULL so it'll be allocd' correctly */
+ if (w->callbacks[place].mask & EWL_CALLBACK_TYPE_DIRECT)
+ {
+ old = (Ewl_Callback *)w->callbacks[place].list;
+ w->callbacks[place].list = NULL;
+ EWL_CALLBACK_SET_NODIRECT(w, t);
+ }
+
+ w->callbacks[place].list = realloc(w->callbacks[place].list,
+ w->callbacks[place].len * sizeof(void *));
+
+ /* if old is set this was a direct so we can just set 0, 1 and be
+ * done with it */
+ if (old)
+ {
+ w->callbacks[place].list[0] = (!pos ? cb : old);
+ w->callbacks[place].list[1] = ( pos ? cb : old);
+ }
+ else
+ {
+ /* only have to move if we aren't at the end (of the
+ * original lenth already */
+ if ((int)pos != (w->callbacks[place].len - 1))
+ {
+ memmove(w->callbacks[place].list + (pos + 1),
+ w->callbacks[place].list + pos,
+ (w->callbacks[place].len - pos - 1)
+ * sizeof(void *));
+ }
+ w->callbacks[place].list[pos] = cb;
+ }
+
+ if (pos <= EWL_CALLBACK_POS(w, t))
+ EWL_CALLBACK_POS(w, t)++;
+
+ DRETURN_INT(cb->id, DLEVEL_STABLE);
}
static Ewl_Callback *
ewl_callback_get(Ewl_Widget *w, unsigned int t, unsigned int i)
{
- Ewl_Callback *cb = NULL;
- Ewl_Callback_Custom *ccb = NULL;
- Ewl_Callback_Chain *chain = NULL;
+ Ewl_Callback *cb = NULL;
+ Ewl_Callback_Custom *ccb = NULL;
+ Ewl_Callback_Chain *chain = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, NULL);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, NULL);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
- chain = &(w->callbacks[EWL_CALLBACK_INDEX(t)]);
+ chain = &(w->callbacks[EWL_CALLBACK_INDEX(t)]);
- if (chain->mask & EWL_CALLBACK_TYPE_DIRECT)
- cb = EWL_CALLBACK(chain->list);
+ if (chain->mask & EWL_CALLBACK_TYPE_DIRECT)
+ cb = EWL_CALLBACK(chain->list);
- else if (chain->list)
- cb = chain->list[i];
+ else if (chain->list)
+ cb = chain->list[i];
- if (t >= EWL_CALLBACK_MAX)
- ccb = EWL_CALLBACK_CUSTOM(cb);
+ if (t >= EWL_CALLBACK_MAX)
+ ccb = EWL_CALLBACK_CUSTOM(cb);
- /* make sure the event id's match (if this is a custom callback */
- if (ccb && (ccb->event_id != t))
- cb = NULL;
+ /* make sure the event id's match (if this is a custom callback */
+ if (ccb && (ccb->event_id != t))
+ cb = NULL;
- DRETURN_PTR(cb, DLEVEL_STABLE);
+ DRETURN_PTR(cb, DLEVEL_STABLE);
}
/**
@@ -269,52 +269,52 @@ ewl_callback_get(Ewl_Widget *w, unsigned int t, unsigned int i)
unsigned int
ewl_callback_type_add(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- DRETURN_INT(++callback_type_count, DLEVEL_STABLE);
+ DRETURN_INT(++callback_type_count, DLEVEL_STABLE);
}
static int
ewl_callback_position_insert(Ewl_Widget *w, unsigned int type,
- Ewl_Callback_Function func,
- unsigned int pos, void *user_data)
+ Ewl_Callback_Function func,
+ unsigned int pos, void *user_data)
{
- int ret;
- Ewl_Callback *cb, *found;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, 0);
- DCHECK_PARAM_PTR_RET(func, 0);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, 0);
-
- if (type < EWL_CALLBACK_MAX)
- cb = alloca(sizeof(Ewl_Callback));
- else
- cb = alloca(sizeof(Ewl_Callback_Custom));
-
- cb->func = func;
- cb->user_data = user_data;
-
- found = ecore_hash_get(cb_registration, cb);
- if (!found) {
- if (type < EWL_CALLBACK_MAX) {
- found = NEW(Ewl_Callback, 1);
- }
- else {
- found = NEW(Ewl_Callback_Custom, 1);
- EWL_CALLBACK_CUSTOM(found)->event_id = type;
- }
- found->func = func;
- found->user_data = user_data;
- found->id = ++callback_id;
- ecore_hash_set(cb_registration, found, found);
- }
-
- found->references++;
-
- ret = ewl_callback_insert(w, type, found, pos);
-
- DRETURN_INT(ret, DLEVEL_STABLE);
+ int ret;
+ Ewl_Callback *cb, *found;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, 0);
+ DCHECK_PARAM_PTR_RET(func, 0);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, 0);
+
+ if (type < EWL_CALLBACK_MAX)
+ cb = alloca(sizeof(Ewl_Callback));
+ else
+ cb = alloca(sizeof(Ewl_Callback_Custom));
+
+ cb->func = func;
+ cb->user_data = user_data;
+
+ found = ecore_hash_get(cb_registration, cb);
+ if (!found) {
+ if (type < EWL_CALLBACK_MAX) {
+ found = NEW(Ewl_Callback, 1);
+ }
+ else {
+ found = NEW(Ewl_Callback_Custom, 1);
+ EWL_CALLBACK_CUSTOM(found)->event_id = type;
+ }
+ found->func = func;
+ found->user_data = user_data;
+ found->id = ++callback_id;
+ ecore_hash_set(cb_registration, found, found);
+ }
+
+ found->references++;
+
+ ret = ewl_callback_insert(w, type, found, pos);
+
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
/**
@@ -331,19 +331,19 @@ ewl_callback_position_insert(Ewl_Widget *w, unsigned int type,
*/
int
ewl_callback_append(Ewl_Widget *w, unsigned int t,
- Ewl_Callback_Function f, void *user_data)
+ Ewl_Callback_Function f, void *user_data)
{
- int ret;
+ int ret;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, 0);
- DCHECK_PARAM_PTR_RET(f, 0);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, 0);
+ DCHECK_PARAM_PTR_RET(f, 0);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, 0);
- ret = ewl_callback_position_insert(w, t, f,
- EWL_CALLBACK_LEN(w, t), user_data);
+ ret = ewl_callback_position_insert(w, t, f,
+ EWL_CALLBACK_LEN(w, t), user_data);
- DRETURN_INT(ret, DLEVEL_STABLE);
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
/**
@@ -359,18 +359,18 @@ ewl_callback_append(Ewl_Widget *w, unsigned int t,
*/
int
ewl_callback_prepend(Ewl_Widget *w, unsigned int t,
- Ewl_Callback_Function f, void *user_data)
+ Ewl_Callback_Function f, void *user_data)
{
- int ret;
+ int ret;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, 0);
- DCHECK_PARAM_PTR_RET(f, 0);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, 0);
+ DCHECK_PARAM_PTR_RET(f, 0);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, 0);
- ret = ewl_callback_position_insert(w, t, f, 0, user_data);
+ ret = ewl_callback_position_insert(w, t, f, 0, user_data);
- DRETURN_INT(ret, DLEVEL_STABLE);
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
/**
@@ -388,35 +388,35 @@ ewl_callback_prepend(Ewl_Widget *w, unsigned int t,
*/
int
ewl_callback_insert_after(Ewl_Widget *w, unsigned int t,
- Ewl_Callback_Function f, void *user_data,
- Ewl_Callback_Function after, void *after_data)
+ Ewl_Callback_Function f, void *user_data,
+ Ewl_Callback_Function after, void *after_data)
{
- Ewl_Callback *search;
- int ret;
- unsigned int pos = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, 0);
- DCHECK_PARAM_PTR_RET(f, 0);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, 0);
-
- /*
- * position past the callback we want to insert after.
- */
- for (pos = 0; pos < EWL_CALLBACK_LEN(w, t); pos++)
- {
- search = ewl_callback_get(w, t, pos);
- if (search && (search->func == after) &&
- (search->user_data == after_data))
- {
- pos ++;
- break;
- }
- }
-
- ret = ewl_callback_position_insert(w, t, f, pos, user_data);
-
- DRETURN_INT(ret, DLEVEL_STABLE);
+ Ewl_Callback *search;
+ int ret;
+ unsigned int pos = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, 0);
+ DCHECK_PARAM_PTR_RET(f, 0);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, 0);
+
+ /*
+ * position past the callback we want to insert after.
+ */
+ for (pos = 0; pos < EWL_CALLBACK_LEN(w, t); pos++)
+ {
+ search = ewl_callback_get(w, t, pos);
+ if (search && (search->func == after) &&
+ (search->user_data == after_data))
+ {
+ pos ++;
+ break;
+ }
+ }
+
+ ret = ewl_callback_position_insert(w, t, f, pos, user_data);
+
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
/**
@@ -430,13 +430,13 @@ ewl_callback_insert_after(Ewl_Widget *w, unsigned int t,
void
ewl_callback_call(Ewl_Widget *w, unsigned int t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_callback_call_with_event_data(w, t, NULL);
+ ewl_callback_call_with_event_data(w, t, NULL);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -451,80 +451,80 @@ ewl_callback_call(Ewl_Widget *w, unsigned int t)
*/
void
ewl_callback_call_with_event_data(Ewl_Widget *w, unsigned int t,
- void *ev_data)
+ void *ev_data)
{
- Ewl_Callback *cb;
- Ewl_Widget *parent, *top = NULL;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- /*
- * First search up the tree to find the topmost intercepting widget.
- */
- parent = w->parent;
- while (parent) {
- if (EWL_CALLBACK_FLAGS(parent, t) & EWL_CALLBACK_NOTIFY_INTERCEPT)
- top = parent;
- parent = parent->parent;
- }
-
- if (top)
- w = top;
-
- /*
- * Now search up the tree to find the first notified widget. This may
- * result in some recursion.
- */
- top = NULL;
- parent = w->parent;
- while (parent) {
- if (EWL_CALLBACK_FLAGS(parent, t) & EWL_CALLBACK_NOTIFY_NOTIFY)
- {
- top = parent;
- break;
- }
- parent = parent->parent;
- }
-
- if (top)
- ewl_callback_call_with_event_data(top, t, ev_data);
-
- /*
- * Make sure the widget has callbacks of the given type
- */
- if (!EWL_CALLBACK_LEN(w, t))
- DRETURN(DLEVEL_STABLE);
-
- /*
- * Loop through and execute each of the callbacks of a certain type for
- * the specified widget.
- */
- EWL_CALLBACK_POS(w, t) = 0;
- while (EWL_CALLBACK_POS(w, t) < EWL_CALLBACK_LEN(w, t))
- {
- Ewl_Callback *newcb = NULL;
-
- cb = ewl_callback_get(w, t, EWL_CALLBACK_POS(w, t));
-
- /* keep going if there is no callback at this spot. This can
- * happen with hte custom array */
- if (!cb)
- {
- EWL_CALLBACK_POS(w, t)++;
- continue;
- }
-
- if (cb->func)
- cb->func(w, ev_data, cb->user_data);
-
- newcb = ewl_callback_get(w, t, EWL_CALLBACK_POS(w, t));
- if (cb == newcb)
- EWL_CALLBACK_POS(w, t)++;
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Callback *cb;
+ Ewl_Widget *parent, *top = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ /*
+ * First search up the tree to find the topmost intercepting widget.
+ */
+ parent = w->parent;
+ while (parent) {
+ if (EWL_CALLBACK_FLAGS(parent, t) & EWL_CALLBACK_NOTIFY_INTERCEPT)
+ top = parent;
+ parent = parent->parent;
+ }
+
+ if (top)
+ w = top;
+
+ /*
+ * Now search up the tree to find the first notified widget. This may
+ * result in some recursion.
+ */
+ top = NULL;
+ parent = w->parent;
+ while (parent) {
+ if (EWL_CALLBACK_FLAGS(parent, t) & EWL_CALLBACK_NOTIFY_NOTIFY)
+ {
+ top = parent;
+ break;
+ }
+ parent = parent->parent;
+ }
+
+ if (top)
+ ewl_callback_call_with_event_data(top, t, ev_data);
+
+ /*
+ * Make sure the widget has callbacks of the given type
+ */
+ if (!EWL_CALLBACK_LEN(w, t))
+ DRETURN(DLEVEL_STABLE);
+
+ /*
+ * Loop through and execute each of the callbacks of a certain type for
+ * the specified widget.
+ */
+ EWL_CALLBACK_POS(w, t) = 0;
+ while (EWL_CALLBACK_POS(w, t) < EWL_CALLBACK_LEN(w, t))
+ {
+ Ewl_Callback *newcb = NULL;
+
+ cb = ewl_callback_get(w, t, EWL_CALLBACK_POS(w, t));
+
+ /* keep going if there is no callback at this spot. This can
+ * happen with hte custom array */
+ if (!cb)
+ {
+ EWL_CALLBACK_POS(w, t)++;
+ continue;
+ }
+
+ if (cb->func)
+ cb->func(w, ev_data, cb->user_data);
+
+ newcb = ewl_callback_get(w, t, EWL_CALLBACK_POS(w, t));
+ if (cb == newcb)
+ EWL_CALLBACK_POS(w, t)++;
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -539,37 +539,37 @@ ewl_callback_call_with_event_data(Ewl_Widget *w, unsigned int t,
void
ewl_callback_del_type(Ewl_Widget *w, unsigned int t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- /* don't type check this as most of the widget will probably be
- * destroyed by the time we get here */
-
- if (!EWL_CALLBACK_LEN(w, t))
- DRETURN(DLEVEL_STABLE);
-
- if (t > EWL_CALLBACK_MAX) {
- unsigned int i = 0;
-
- /*
- * Handle custom types by verifying that the event id matches
- * the specified callback type.
- */
- while (i < EWL_CALLBACK_LEN(w, t)) {
- Ewl_Callback_Custom *cb;
-
- cb = (Ewl_Callback_Custom *)ewl_callback_get(w, t, i);
- if (cb && (cb->event_id == t))
- ewl_callback_rm(w, t, i);
- else
- i++;
- }
- }
- else {
- while (EWL_CALLBACK_LEN(w, t))
- ewl_callback_rm(w, t, EWL_CALLBACK_LEN(w, t) - 1);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ /* don't type check this as most of the widget will probably be
+ * destroyed by the time we get here */
+
+ if (!EWL_CALLBACK_LEN(w, t))
+ DRETURN(DLEVEL_STABLE);
+
+ if (t > EWL_CALLBACK_MAX) {
+ unsigned int i = 0;
+
+ /*
+ * Handle custom types by verifying that the event id matches
+ * the specified callback type.
+ */
+ while (i < EWL_CALLBACK_LEN(w, t)) {
+ Ewl_Callback_Custom *cb;
+
+ cb = (Ewl_Callback_Custom *)ewl_callback_get(w, t, i);
+ if (cb && (cb->event_id == t))
+ ewl_callback_rm(w, t, i);
+ else
+ i++;
+ }
+ }
+ else {
+ while (EWL_CALLBACK_LEN(w, t))
+ ewl_callback_rm(w, t, EWL_CALLBACK_LEN(w, t) - 1);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -585,26 +585,26 @@ ewl_callback_del_type(Ewl_Widget *w, unsigned int t)
void
ewl_callback_del_cb_id(Ewl_Widget *w, unsigned int t, int cb_id)
{
- Ewl_Callback *cb;
- unsigned int i;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- if (!EWL_CALLBACK_LEN(w, t) || cb_id > callback_id)
- DRETURN(DLEVEL_STABLE);
-
- for (i = 0; i < EWL_CALLBACK_LEN(w, t); i++)
- {
- cb = ewl_callback_get(w, t, i);
- if (cb && (cb->id == cb_id)) {
- ewl_callback_rm(w, t, i);
- break;
- }
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Callback *cb;
+ unsigned int i;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ if (!EWL_CALLBACK_LEN(w, t) || cb_id > callback_id)
+ DRETURN(DLEVEL_STABLE);
+
+ for (i = 0; i < EWL_CALLBACK_LEN(w, t); i++)
+ {
+ cb = ewl_callback_get(w, t, i);
+ if (cb && (cb->id == cb_id)) {
+ ewl_callback_rm(w, t, i);
+ break;
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -619,25 +619,25 @@ ewl_callback_del_cb_id(Ewl_Widget *w, unsigned int t, int cb_id)
void
ewl_callback_clear(Ewl_Widget *w)
{
- unsigned int i;
+ unsigned int i;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- /*
- * First clear out all standard callback types.
- */
- for (i = 0; i < EWL_CALLBACK_MAX; i++)
- ewl_callback_del_type(w, i);
+ /*
+ * First clear out all standard callback types.
+ */
+ for (i = 0; i < EWL_CALLBACK_MAX; i++)
+ ewl_callback_del_type(w, i);
- /*
- * Finally clear out all custom callbacks.
- */
- while (EWL_CALLBACK_LEN(w, i))
- ewl_callback_rm(w, i, EWL_CALLBACK_LEN(w, i) - 1);
+ /*
+ * Finally clear out all custom callbacks.
+ */
+ while (EWL_CALLBACK_LEN(w, i))
+ ewl_callback_rm(w, i, EWL_CALLBACK_LEN(w, i) - 1);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -653,26 +653,26 @@ ewl_callback_clear(Ewl_Widget *w)
void
ewl_callback_del(Ewl_Widget *w, unsigned int t, Ewl_Callback_Function f)
{
- Ewl_Callback *cb;
- unsigned int i;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- if (!EWL_CALLBACK_LEN(w, t))
- DRETURN(DLEVEL_STABLE);
-
- for (i = 0; i < EWL_CALLBACK_LEN(w, t); i++)
- {
- cb = ewl_callback_get(w, t, i);
- if (cb && (cb->func == f)) {
- ewl_callback_rm(w, t, i);
- break;
- }
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Callback *cb;
+ unsigned int i;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ if (!EWL_CALLBACK_LEN(w, t))
+ DRETURN(DLEVEL_STABLE);
+
+ for (i = 0; i < EWL_CALLBACK_LEN(w, t); i++)
+ {
+ cb = ewl_callback_get(w, t, i);
+ if (cb && (cb->func == f)) {
+ ewl_callback_rm(w, t, i);
+ break;
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -688,28 +688,28 @@ ewl_callback_del(Ewl_Widget *w, unsigned int t, Ewl_Callback_Function f)
*/
void
ewl_callback_del_with_data(Ewl_Widget *w, unsigned int t,
- Ewl_Callback_Function f, void *d)
+ Ewl_Callback_Function f, void *d)
{
- Ewl_Callback *cb;
- unsigned int i;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- if (!EWL_CALLBACK_LEN(w, t))
- DRETURN(DLEVEL_STABLE);
-
- for (i = 0; i < EWL_CALLBACK_LEN(w, t); i++)
- {
- cb = ewl_callback_get(w, t, i);
- if (cb && (cb->func == f) && (cb->user_data == d)) {
- ewl_callback_rm(w, t, i);
- break;
- }
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Callback *cb;
+ unsigned int i;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ if (!EWL_CALLBACK_LEN(w, t))
+ DRETURN(DLEVEL_STABLE);
+
+ for (i = 0; i < EWL_CALLBACK_LEN(w, t); i++)
+ {
+ cb = ewl_callback_get(w, t, i);
+ if (cb && (cb->func == f) && (cb->user_data == d)) {
+ ewl_callback_rm(w, t, i);
+ break;
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/*
@@ -718,15 +718,15 @@ ewl_callback_del_with_data(Ewl_Widget *w, unsigned int t,
static unsigned int
ewl_callback_hash(const void *key)
{
- Ewl_Callback *cb;
+ Ewl_Callback *cb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(key, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(key, 0);
- cb = EWL_CALLBACK(key);
+ cb = EWL_CALLBACK(key);
- DRETURN_INT((unsigned int) (cb->func) ^
- (unsigned int) (cb->user_data), DLEVEL_STABLE);
+ DRETURN_INT((unsigned int) (cb->func) ^
+ (unsigned int) (cb->user_data), DLEVEL_STABLE);
}
/*
@@ -736,19 +736,19 @@ ewl_callback_hash(const void *key)
static int
ewl_callback_compare(const void *key1, const void *key2)
{
- Ewl_Callback *cb1;
- Ewl_Callback *cb2;
+ Ewl_Callback *cb1;
+ Ewl_Callback *cb2;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(key1, -1);
- DCHECK_PARAM_PTR_RET(key2, -1);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(key1, -1);
+ DCHECK_PARAM_PTR_RET(key2, -1);
- cb1 = EWL_CALLBACK(key1);
- cb2 = EWL_CALLBACK(key2);
+ cb1 = EWL_CALLBACK(key1);
+ cb2 = EWL_CALLBACK(key2);
- if ((cb1->func == cb2->func) && (cb1->user_data == cb2->user_data))
- DRETURN_INT(0, DLEVEL_STABLE);
+ if ((cb1->func == cb2->func) && (cb1->user_data == cb2->user_data))
+ DRETURN_INT(0, DLEVEL_STABLE);
- DRETURN_INT(-1, DLEVEL_STABLE);
+ DRETURN_INT(-1, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_callback.h b/src/lib/ewl_callback.h
index d5e8681..c183771 100644
--- a/src/lib/ewl_callback.h
+++ b/src/lib/ewl_callback.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_CALLBACK_H
#define EWL_CALLBACK_H
@@ -24,7 +24,7 @@ typedef struct Ewl_Callback Ewl_Callback;
* A shortcut for declaring functions that take a callback funciton pointer.
*/
typedef void (*Ewl_Callback_Function) (Ewl_Widget * widget, void *ev_data,
- void *user_data);
+ void *user_data);
/**
* @def EWL_CALLBACK_FUNCTION(cb_func)
@@ -37,10 +37,10 @@ typedef void (*Ewl_Callback_Function) (Ewl_Widget * widget, void *ev_data,
*/
struct Ewl_Callback
{
- Ewl_Callback_Function func; /**< Function executed */
- void *user_data; /**< user specified data to pass to func */
- int references; /**< Reference counting */
- int id; /**< id number of this callback */
+ Ewl_Callback_Function func; /**< Function executed */
+ void *user_data; /**< user specified data to pass to func */
+ int references; /**< Reference counting */
+ int id; /**< id number of this callback */
};
@@ -60,8 +60,8 @@ typedef struct Ewl_Callback_Custom Ewl_Callback_Custom;
*/
struct Ewl_Callback_Custom
{
- Ewl_Callback cb; /**< Inherit from Ewl_Callback */
- unsigned int event_id; /**< Add an event id */
+ Ewl_Callback cb; /**< Inherit from Ewl_Callback */
+ unsigned int event_id; /**< Add an event id */
};
/**
@@ -105,72 +105,72 @@ struct Ewl_Callback_Custom
* Sets the callback intercept flag from a widget for a certain event type.
*/
#define EWL_CALLBACK_FLAG_INTERCEPT(w, t) \
- w->callbacks[EWL_CALLBACK_INDEX(t)].mask |= EWL_CALLBACK_NOTIFY_INTERCEPT
+ w->callbacks[EWL_CALLBACK_INDEX(t)].mask |= EWL_CALLBACK_NOTIFY_INTERCEPT
/**
* @def EWL_CALLBACK_FLAG_NOINTERCEPT(w, t)
* Clears the callback intercept flag from a widget for a certain event type.
*/
#define EWL_CALLBACK_FLAG_NOINTERCEPT(w, t) \
- w->callbacks[EWL_CALLBACK_INDEX(t)].mask = \
- w->callbacks[EWL_CALLBACK_INDEX(t)].mask & ~EWL_CALLBACK_NOTIFY_INTERCEPT
+ w->callbacks[EWL_CALLBACK_INDEX(t)].mask = \
+ w->callbacks[EWL_CALLBACK_INDEX(t)].mask & ~EWL_CALLBACK_NOTIFY_INTERCEPT
/**
* @def EWL_CALLBACK_FLAG_NOTIFY(w, t)
* Sets the callback notify flag from a widget for a certain event type.
*/
#define EWL_CALLBACK_FLAG_NOTIFY(w, t) \
- w->callbacks[EWL_CALLBACK_INDEX(t)].mask |= EWL_CALLBACK_NOTIFY_NOTIFY
+ w->callbacks[EWL_CALLBACK_INDEX(t)].mask |= EWL_CALLBACK_NOTIFY_NOTIFY
/**
* @def EWL_CALLBACK_FLAG_NONOTIFY(w, t)
* Remove the callback notify flag from a widget for a certain event type.
*/
#define EWL_CALLBACK_FLAG_NONOTIFY(w, t) \
- w->callbacks[EWL_CALLBACK_INDEX(t)].mask &= ~EWL_CALLBACK_NOTIFY_NOTIFY
+ w->callbacks[EWL_CALLBACK_INDEX(t)].mask &= ~EWL_CALLBACK_NOTIFY_NOTIFY
/**
* @def EWL_CALLBACK_SET_DIRECT(w, t)
* Sets the callback direct flag for a centain event type
*/
#define EWL_CALLBACK_SET_DIRECT(w, t) \
- w->callbacks[EWL_CALLBACK_INDEX(t)].mask |= EWL_CALLBACK_TYPE_DIRECT
+ w->callbacks[EWL_CALLBACK_INDEX(t)].mask |= EWL_CALLBACK_TYPE_DIRECT
/**
* @def EWL_CALLBACK_SET_NODIRECT(w, t)
* Clears the callback direct flag from a widget for a certain event type
*/
#define EWL_CALLBACK_SET_NODIRECT(w, t) \
- w->callbacks[EWL_CALLBACK_INDEX(t)].mask &= ~EWL_CALLBACK_TYPE_DIRECT
-
-int ewl_callbacks_init(void);
-void ewl_callbacks_shutdown(void);
-unsigned int ewl_callback_type_add(void);
-
-int ewl_callback_append(Ewl_Widget * widget, unsigned int type,
- Ewl_Callback_Function func,
- void *user_data);
-int ewl_callback_prepend(Ewl_Widget * widget,
- unsigned int type,
- Ewl_Callback_Function func,
- void *user_data);
-int ewl_callback_insert_after(Ewl_Widget * w, unsigned int t,
- Ewl_Callback_Function f,
- void *user_data,
- Ewl_Callback_Function after,
- void *after_data);
-void ewl_callback_clear(Ewl_Widget * widget);
-void ewl_callback_call(Ewl_Widget * widget, unsigned int type);
-void ewl_callback_call_with_event_data(Ewl_Widget * widget,
- unsigned int type,
- void *event_data);
-void ewl_callback_del_type(Ewl_Widget * w, unsigned int t);
-void ewl_callback_del_cb_id(Ewl_Widget * w, unsigned int t,
- int cb_id);
-void ewl_callback_del(Ewl_Widget * w, unsigned int t,
- Ewl_Callback_Function f);
-void ewl_callback_del_with_data(Ewl_Widget * w, unsigned int t,
- Ewl_Callback_Function f, void *data);
+ w->callbacks[EWL_CALLBACK_INDEX(t)].mask &= ~EWL_CALLBACK_TYPE_DIRECT
+
+int ewl_callbacks_init(void);
+void ewl_callbacks_shutdown(void);
+unsigned int ewl_callback_type_add(void);
+
+int ewl_callback_append(Ewl_Widget * widget, unsigned int type,
+ Ewl_Callback_Function func,
+ void *user_data);
+int ewl_callback_prepend(Ewl_Widget * widget,
+ unsigned int type,
+ Ewl_Callback_Function func,
+ void *user_data);
+int ewl_callback_insert_after(Ewl_Widget * w, unsigned int t,
+ Ewl_Callback_Function f,
+ void *user_data,
+ Ewl_Callback_Function after,
+ void *after_data);
+void ewl_callback_clear(Ewl_Widget * widget);
+void ewl_callback_call(Ewl_Widget * widget, unsigned int type);
+void ewl_callback_call_with_event_data(Ewl_Widget * widget,
+ unsigned int type,
+ void *event_data);
+void ewl_callback_del_type(Ewl_Widget * w, unsigned int t);
+void ewl_callback_del_cb_id(Ewl_Widget * w, unsigned int t,
+ int cb_id);
+void ewl_callback_del(Ewl_Widget * w, unsigned int t,
+ Ewl_Callback_Function f);
+void ewl_callback_del_with_data(Ewl_Widget * w, unsigned int t,
+ Ewl_Callback_Function f, void *data);
/**
* @}
diff --git a/src/lib/ewl_cell.c b/src/lib/ewl_cell.c
index 323e49a..3dc0ce9 100644
--- a/src/lib/ewl_cell.c
+++ b/src/lib/ewl_cell.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_cell.h"
#include "ewl_macros.h"
@@ -14,20 +14,20 @@ static void ewl_cell_cb_state_changed(Ewl_Widget *w, void *ev, void *data);
Ewl_Widget *
ewl_cell_new(void)
{
- Ewl_Widget *cell;
+ Ewl_Widget *cell;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- cell = NEW(Ewl_Cell, 1);
- if (!cell)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ cell = NEW(Ewl_Cell, 1);
+ if (!cell)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_cell_init(EWL_CELL(cell))) {
- FREE(cell);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ewl_cell_init(EWL_CELL(cell))) {
+ FREE(cell);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(cell, DLEVEL_STABLE);
+ DRETURN_PTR(cell, DLEVEL_STABLE);
}
/**
@@ -40,27 +40,27 @@ ewl_cell_new(void)
int
ewl_cell_init(Ewl_Cell *cell)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cell, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cell, FALSE);
- if (!ewl_container_init(EWL_CONTAINER(cell)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_container_init(EWL_CONTAINER(cell)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_object_fill_policy_set(EWL_OBJECT(cell), EWL_FLAG_FILL_FILL |
- EWL_FLAG_FILL_HSHRINK);
- ewl_widget_appearance_set(EWL_WIDGET(cell), EWL_CELL_TYPE);
- ewl_widget_inherit(EWL_WIDGET(cell), EWL_CELL_TYPE);
+ ewl_object_fill_policy_set(EWL_OBJECT(cell), EWL_FLAG_FILL_FILL |
+ EWL_FLAG_FILL_HSHRINK);
+ ewl_widget_appearance_set(EWL_WIDGET(cell), EWL_CELL_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(cell), EWL_CELL_TYPE);
- ewl_container_show_notify_set(EWL_CONTAINER(cell), ewl_cell_cb_child_show);
- ewl_container_resize_notify_set(EWL_CONTAINER(cell),
- ewl_cell_cb_child_resize);
+ ewl_container_show_notify_set(EWL_CONTAINER(cell), ewl_cell_cb_child_show);
+ ewl_container_resize_notify_set(EWL_CONTAINER(cell),
+ ewl_cell_cb_child_resize);
- ewl_callback_append(EWL_WIDGET(cell), EWL_CALLBACK_CONFIGURE,
- ewl_cell_cb_configure, NULL);
- ewl_container_callback_notify(EWL_CONTAINER(cell), EWL_CALLBACK_FOCUS_IN);
- ewl_container_callback_notify(EWL_CONTAINER(cell), EWL_CALLBACK_FOCUS_OUT);
+ ewl_callback_append(EWL_WIDGET(cell), EWL_CALLBACK_CONFIGURE,
+ ewl_cell_cb_configure, NULL);
+ ewl_container_callback_notify(EWL_CONTAINER(cell), EWL_CALLBACK_FOCUS_IN);
+ ewl_container_callback_notify(EWL_CONTAINER(cell), EWL_CALLBACK_FOCUS_OUT);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -73,27 +73,27 @@ ewl_cell_init(Ewl_Cell *cell)
*/
void
ewl_cell_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Container *c;
- Ewl_Object *child;
+ Ewl_Container *c;
+ Ewl_Object *child;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_CELL_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_CELL_TYPE);
- c = EWL_CONTAINER(w);
+ c = EWL_CONTAINER(w);
- /* we need to skip all unmanaged widgets first */
- ecore_dlist_first_goto(c->children);
- while ((child = ecore_dlist_next(c->children)) && UNMANAGED(child))
- ;
+ /* we need to skip all unmanaged widgets first */
+ ecore_dlist_first_goto(c->children);
+ while ((child = ecore_dlist_next(c->children)) && UNMANAGED(child))
+ ;
- if (child)
- ewl_object_place(child, CURRENT_X(w), CURRENT_Y(w),
- CURRENT_W(w), CURRENT_H(w));
+ if (child)
+ ewl_object_place(child, CURRENT_X(w), CURRENT_Y(w),
+ CURRENT_W(w), CURRENT_H(w));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -106,29 +106,29 @@ ewl_cell_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
void
ewl_cell_cb_child_show(Ewl_Container *c, Ewl_Widget *w)
{
- Ewl_Widget *child;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_CELL_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- /*
- * Cell's only allow one child, so remove the rest, this may cause a
- * leak, but they should know better.
- */
- ecore_dlist_first_goto(c->children);
- while ((child = ecore_dlist_next(c->children))) {
- if (child != w)
- ewl_container_child_remove(c, child);
- }
-
- ewl_object_preferred_inner_size_set(EWL_OBJECT(c),
- ewl_object_preferred_w_get(EWL_OBJECT(w)),
- ewl_object_preferred_h_get(EWL_OBJECT(w)));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Widget *child;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_CELL_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ /*
+ * Cell's only allow one child, so remove the rest, this may cause a
+ * leak, but they should know better.
+ */
+ ecore_dlist_first_goto(c->children);
+ while ((child = ecore_dlist_next(c->children))) {
+ if (child != w)
+ ewl_container_child_remove(c, child);
+ }
+
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(c),
+ ewl_object_preferred_w_get(EWL_OBJECT(w)),
+ ewl_object_preferred_h_get(EWL_OBJECT(w)));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -142,19 +142,19 @@ ewl_cell_cb_child_show(Ewl_Container *c, Ewl_Widget *w)
*/
void
ewl_cell_cb_child_resize(Ewl_Container *c, Ewl_Widget *w,
- int size __UNUSED__, Ewl_Orientation o __UNUSED__)
+ int size __UNUSED__, Ewl_Orientation o __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_CELL_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_CELL_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_object_preferred_inner_size_set(EWL_OBJECT(c),
- ewl_object_preferred_w_get(EWL_OBJECT(w)),
- ewl_object_preferred_h_get(EWL_OBJECT(w)));
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(c),
+ ewl_object_preferred_w_get(EWL_OBJECT(w)),
+ ewl_object_preferred_h_get(EWL_OBJECT(w)));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -166,14 +166,14 @@ ewl_cell_cb_child_resize(Ewl_Container *c, Ewl_Widget *w,
void
ewl_cell_state_change_cb_add(Ewl_Cell *cell)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cell);
- DCHECK_TYPE(cell, EWL_CELL_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cell);
+ DCHECK_TYPE(cell, EWL_CELL_TYPE);
- ewl_callback_append(EWL_WIDGET(cell), EWL_CALLBACK_STATE_CHANGED,
- ewl_cell_cb_state_changed, NULL);
+ ewl_callback_append(EWL_WIDGET(cell), EWL_CALLBACK_STATE_CHANGED,
+ ewl_cell_cb_state_changed, NULL);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -184,14 +184,14 @@ ewl_cell_state_change_cb_add(Ewl_Cell *cell)
void
ewl_cell_state_change_cb_del(Ewl_Cell *cell)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cell);
- DCHECK_TYPE(cell, EWL_CELL_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cell);
+ DCHECK_TYPE(cell, EWL_CELL_TYPE);
- ewl_callback_del(EWL_WIDGET(cell), EWL_CALLBACK_STATE_CHANGED,
- ewl_cell_cb_state_changed);
+ ewl_callback_del(EWL_WIDGET(cell), EWL_CALLBACK_STATE_CHANGED,
+ ewl_cell_cb_state_changed);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -205,31 +205,31 @@ ewl_cell_state_change_cb_del(Ewl_Cell *cell)
void
ewl_cell_cb_state_changed(Ewl_Widget *w, void *ev, void *data __UNUSED__)
{
- Ewl_Widget *o;
- Ewl_Event_State_Change *e;
- const char *send_state;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(ev);
- DCHECK_TYPE(w, EWL_CELL_TYPE);
-
- e = EWL_EVENT_STATE_CHANGE(ev);
-
- /* Only want this for selected signals */
- if (!strcmp(e->state, "selected"))
- send_state = "parent,selected";
- else if (!strcmp(e->state, "deselect"))
- send_state = "parent,deselect";
- else if ((!strcmp(e->state, "parent,selected")) ||
- (!strcmp(e->state, "parent,deselect")))
- send_state = e->state;
- else
- DRETURN(DLEVEL_STABLE);
-
- ewl_container_child_iterate_begin(EWL_CONTAINER(w));
- while ((o = ewl_container_child_next(EWL_CONTAINER(w))))
- ewl_widget_state_set(o, send_state, e->flag);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Widget *o;
+ Ewl_Event_State_Change *e;
+ const char *send_state;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(ev);
+ DCHECK_TYPE(w, EWL_CELL_TYPE);
+
+ e = EWL_EVENT_STATE_CHANGE(ev);
+
+ /* Only want this for selected signals */
+ if (!strcmp(e->state, "selected"))
+ send_state = "parent,selected";
+ else if (!strcmp(e->state, "deselect"))
+ send_state = "parent,deselect";
+ else if ((!strcmp(e->state, "parent,selected")) ||
+ (!strcmp(e->state, "parent,deselect")))
+ send_state = e->state;
+ else
+ DRETURN(DLEVEL_STABLE);
+
+ ewl_container_child_iterate_begin(EWL_CONTAINER(w));
+ while ((o = ewl_container_child_next(EWL_CONTAINER(w))))
+ ewl_widget_state_set(o, send_state, e->flag);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_cell.h b/src/lib/ewl_cell.h
index 048c4f7..2f55697 100644
--- a/src/lib/ewl_cell.h
+++ b/src/lib/ewl_cell.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_CELL_H
#define EWL_CELL_H
@@ -47,13 +47,13 @@ typedef struct Ewl_Cell Ewl_Cell;
*/
struct Ewl_Cell
{
- Ewl_Container container; /**< Inherit from Ewl_Container */
+ Ewl_Container container; /**< Inherit from Ewl_Container */
};
-Ewl_Widget *ewl_cell_new(void);
-int ewl_cell_init(Ewl_Cell *cell);
-void ewl_cell_state_change_cb_add(Ewl_Cell *cell);
-void ewl_cell_state_change_cb_del(Ewl_Cell *cell);
+Ewl_Widget *ewl_cell_new(void);
+int ewl_cell_init(Ewl_Cell *cell);
+void ewl_cell_state_change_cb_add(Ewl_Cell *cell);
+void ewl_cell_state_change_cb_del(Ewl_Cell *cell);
/*
* Internally used callbacks, override at your own risk.
@@ -61,7 +61,7 @@ void ewl_cell_state_change_cb_del(Ewl_Cell *cell);
void ewl_cell_cb_configure(Ewl_Widget * w, void *ev_data, void *user_data);
void ewl_cell_cb_child_show(Ewl_Container *c, Ewl_Widget *w);
void ewl_cell_cb_child_resize(Ewl_Container *c, Ewl_Widget *w, int size,
- Ewl_Orientation o);
+ Ewl_Orientation o);
/**
* @}
diff --git a/src/lib/ewl_check.c b/src/lib/ewl_check.c
index 43c2637..4243a23 100644
--- a/src/lib/ewl_check.c
+++ b/src/lib/ewl_check.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_check.h"
#include "ewl_macros.h"
@@ -12,20 +12,20 @@
Ewl_Widget *
ewl_check_new(void)
{
- Ewl_Check *b;
+ Ewl_Check *b;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- b = NEW(Ewl_Check, 1);
- if (!b)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ b = NEW(Ewl_Check, 1);
+ if (!b)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_check_init(EWL_CHECK(b))) {
- ewl_widget_destroy(EWL_WIDGET(b));
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ewl_check_init(EWL_CHECK(b))) {
+ ewl_widget_destroy(EWL_WIDGET(b));
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(EWL_WIDGET(b), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(b), DLEVEL_STABLE);
}
/**
@@ -39,28 +39,28 @@ ewl_check_new(void)
int
ewl_check_init(Ewl_Check *cb)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cb, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cb, FALSE);
- w = EWL_WIDGET(cb);
+ w = EWL_WIDGET(cb);
- if (!ewl_widget_init(w))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_widget_init(w))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_appearance_set(w, EWL_CHECK_TYPE);
- ewl_widget_inherit(w, EWL_CHECK_TYPE);
+ ewl_widget_appearance_set(w, EWL_CHECK_TYPE);
+ ewl_widget_inherit(w, EWL_CHECK_TYPE);
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
- ewl_object_preferred_inner_size_set(EWL_OBJECT(w), 20, 20);
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(w), 20, 20);
- ewl_callback_append(w, EWL_CALLBACK_CLICKED,
- ewl_check_cb_clicked, NULL);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_OUT,
- ewl_check_cb_update_check, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_CLICKED,
+ ewl_check_cb_clicked, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_OUT,
+ ewl_check_cb_update_check, NULL);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -75,17 +75,17 @@ ewl_check_init(Ewl_Check *cb)
void
ewl_check_checked_set(Ewl_Check *cb, int c)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cb);
- DCHECK_TYPE(cb, EWL_CHECK_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cb);
+ DCHECK_TYPE(cb, EWL_CHECK_TYPE);
- if (cb->checked == !!c)
- DRETURN(DLEVEL_STABLE);
+ if (cb->checked == !!c)
+ DRETURN(DLEVEL_STABLE);
- cb->checked = !!c;
- ewl_check_cb_update_check(EWL_WIDGET(cb), NULL, NULL);
+ cb->checked = !!c;
+ ewl_check_cb_update_check(EWL_WIDGET(cb), NULL, NULL);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -96,11 +96,11 @@ ewl_check_checked_set(Ewl_Check *cb, int c)
int
ewl_check_is_checked(Ewl_Check *cb)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cb, 0);
- DCHECK_TYPE_RET(cb, EWL_CHECK_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cb, 0);
+ DCHECK_TYPE_RET(cb, EWL_CHECK_TYPE, 0);
- DRETURN_INT(cb->checked, DLEVEL_STABLE);
+ DRETURN_INT(cb->checked, DLEVEL_STABLE);
}
/**
@@ -113,20 +113,20 @@ ewl_check_is_checked(Ewl_Check *cb)
*/
void
ewl_check_cb_clicked(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Check *cb;
+ Ewl_Check *cb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_CHECK_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_CHECK_TYPE);
- cb = EWL_CHECK(w);
- cb->checked ^= 1;
- ewl_check_cb_update_check(w, NULL, NULL);
- ewl_callback_call(w, EWL_CALLBACK_VALUE_CHANGED);
+ cb = EWL_CHECK(w);
+ cb->checked ^= 1;
+ ewl_check_cb_update_check(w, NULL, NULL);
+ ewl_callback_call(w, EWL_CALLBACK_VALUE_CHANGED);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -139,20 +139,20 @@ ewl_check_cb_clicked(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_check_cb_update_check(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Check *cb;
+ Ewl_Check *cb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_CHECK_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_CHECK_TYPE);
- cb = EWL_CHECK(w);
- if (cb->checked)
- ewl_widget_state_set(w, "checked", EWL_STATE_PERSISTENT);
- else
- ewl_widget_state_set(w, "default", EWL_STATE_PERSISTENT);
+ cb = EWL_CHECK(w);
+ if (cb->checked)
+ ewl_widget_state_set(w, "checked", EWL_STATE_PERSISTENT);
+ else
+ ewl_widget_state_set(w, "default", EWL_STATE_PERSISTENT);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_check.h b/src/lib/ewl_check.h
index 212dbae..05899bd 100644
--- a/src/lib/ewl_check.h
+++ b/src/lib/ewl_check.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_CHECK_H
#define EWL_CHECK_H
@@ -48,15 +48,15 @@ typedef struct Ewl_Check Ewl_Check;
*/
struct Ewl_Check
{
- Ewl_Widget w; /**< Inherit from Ewl_Widget */
- int checked; /**< Indicates if this is checked */
+ Ewl_Widget w; /**< Inherit from Ewl_Widget */
+ int checked; /**< Indicates if this is checked */
};
-Ewl_Widget *ewl_check_new(void);
-int ewl_check_init(Ewl_Check *c);
+Ewl_Widget *ewl_check_new(void);
+int ewl_check_init(Ewl_Check *c);
-int ewl_check_is_checked(Ewl_Check *c);
-void ewl_check_checked_set(Ewl_Check *c, int checked);
+int ewl_check_is_checked(Ewl_Check *c);
+void ewl_check_checked_set(Ewl_Check *c, int checked);
/*
* Internally used callbacks.
diff --git a/src/lib/ewl_checkbutton.c b/src/lib/ewl_checkbutton.c
index 2e0f809..112907e 100644
--- a/src/lib/ewl_checkbutton.c
+++ b/src/lib/ewl_checkbutton.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_checkbutton.h"
#include "ewl_button.h"
@@ -8,10 +8,10 @@
#include "ewl_debug.h"
static Ewl_Widget *ewl_checkbutton_view_cb_widget_fetch(void *data,
- unsigned int row,
- unsigned int col);
+ unsigned int row,
+ unsigned int col);
static Ewl_Widget *ewl_checkbutton_view_cb_header_fetch(void *data,
- unsigned int col);
+ unsigned int col);
/**
* @return Returns the newly allocated checkbutton on success, NULL on failure.
@@ -20,20 +20,20 @@ static Ewl_Widget *ewl_checkbutton_view_cb_header_fetch(void *data,
Ewl_Widget *
ewl_checkbutton_new(void)
{
- Ewl_Checkbutton *b;
+ Ewl_Checkbutton *b;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- b = NEW(Ewl_Checkbutton, 1);
- if (!b)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ b = NEW(Ewl_Checkbutton, 1);
+ if (!b)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_checkbutton_init(b)) {
- ewl_widget_destroy(EWL_WIDGET(b));
- b = NULL;
- }
+ if (!ewl_checkbutton_init(b)) {
+ ewl_widget_destroy(EWL_WIDGET(b));
+ b = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(b), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(b), DLEVEL_STABLE);
}
/**
@@ -47,38 +47,38 @@ ewl_checkbutton_new(void)
int
ewl_checkbutton_init(Ewl_Checkbutton *cb)
{
- Ewl_Button *b;
- Ewl_Widget *w;
+ Ewl_Button *b;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cb, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cb, FALSE);
- b = EWL_BUTTON(cb);
- w = EWL_WIDGET(cb);
+ b = EWL_BUTTON(cb);
+ w = EWL_WIDGET(cb);
- if (!ewl_button_init(b))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_button_init(b))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_appearance_set(w, EWL_CHECKBUTTON_TYPE);
- ewl_widget_inherit(w, EWL_CHECKBUTTON_TYPE);
+ ewl_widget_appearance_set(w, EWL_CHECKBUTTON_TYPE);
+ ewl_widget_inherit(w, EWL_CHECKBUTTON_TYPE);
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_LEFT);
- ewl_callback_append(w, EWL_CALLBACK_CLICKED,
- ewl_checkbutton_cb_clicked, NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_LEFT);
+ ewl_callback_append(w, EWL_CALLBACK_CLICKED,
+ ewl_checkbutton_cb_clicked, NULL);
- cb->label_position = EWL_POSITION_RIGHT;
+ cb->label_position = EWL_POSITION_RIGHT;
- /*
- * Add the check box first.
- */
- cb->check = ewl_check_new();
- ewl_widget_internal_set(cb->check, TRUE);
- ewl_callback_del(cb->check, EWL_CALLBACK_CLICKED, ewl_check_cb_clicked);
- ewl_container_child_prepend(EWL_CONTAINER(cb), cb->check);
- ewl_widget_show(cb->check);
+ /*
+ * Add the check box first.
+ */
+ cb->check = ewl_check_new();
+ ewl_widget_internal_set(cb->check, TRUE);
+ ewl_callback_del(cb->check, EWL_CALLBACK_CLICKED, ewl_check_cb_clicked);
+ ewl_container_child_prepend(EWL_CONTAINER(cb), cb->check);
+ ewl_widget_show(cb->check);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -90,13 +90,13 @@ ewl_checkbutton_init(Ewl_Checkbutton *cb)
void
ewl_checkbutton_checked_set(Ewl_Checkbutton *cb, int c)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cb);
- DCHECK_TYPE(cb, EWL_CHECKBUTTON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cb);
+ DCHECK_TYPE(cb, EWL_CHECKBUTTON_TYPE);
- ewl_check_checked_set(EWL_CHECK(EWL_CHECKBUTTON(cb)->check), c);
+ ewl_check_checked_set(EWL_CHECK(EWL_CHECKBUTTON(cb)->check), c);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -107,12 +107,12 @@ ewl_checkbutton_checked_set(Ewl_Checkbutton *cb, int c)
int
ewl_checkbutton_is_checked(Ewl_Checkbutton *cb)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cb, FALSE);
- DCHECK_TYPE_RET(cb, EWL_CHECKBUTTON_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cb, FALSE);
+ DCHECK_TYPE_RET(cb, EWL_CHECKBUTTON_TYPE, FALSE);
- DRETURN_INT(ewl_check_is_checked(EWL_CHECK(EWL_CHECKBUTTON(cb)->check)),
- DLEVEL_STABLE);
+ DRETURN_INT(ewl_check_is_checked(EWL_CHECK(EWL_CHECKBUTTON(cb)->check)),
+ DLEVEL_STABLE);
}
/**
@@ -126,39 +126,39 @@ ewl_checkbutton_is_checked(Ewl_Checkbutton *cb)
void
ewl_checkbutton_label_position_set(Ewl_Checkbutton *cb, Ewl_Position p)
{
- Ewl_Button *b;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cb);
- DCHECK_TYPE(cb, EWL_CHECKBUTTON_TYPE);
-
- b = EWL_BUTTON(cb);
-
- if (cb->label_position == p)
- DRETURN(DLEVEL_STABLE);
-
- cb->label_position = p;
- ewl_container_child_remove(EWL_CONTAINER(cb),
- EWL_WIDGET(b->label_object));
- ewl_container_child_remove(EWL_CONTAINER(cb), cb->check);
-
- /*
- * Add the label and check back into the checkbutton with the correct
- * order.
- */
- if (p == EWL_POSITION_RIGHT) {
- ewl_container_child_append(EWL_CONTAINER(cb), cb->check);
- ewl_container_child_append(EWL_CONTAINER(cb),
- EWL_WIDGET(b->label_object));
- } else {
- ewl_container_child_append(EWL_CONTAINER(cb),
- EWL_WIDGET(b->label_object));
- ewl_container_child_append(EWL_CONTAINER(cb), cb->check);
- }
-
- ewl_widget_configure(EWL_WIDGET(cb));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Button *b;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cb);
+ DCHECK_TYPE(cb, EWL_CHECKBUTTON_TYPE);
+
+ b = EWL_BUTTON(cb);
+
+ if (cb->label_position == p)
+ DRETURN(DLEVEL_STABLE);
+
+ cb->label_position = p;
+ ewl_container_child_remove(EWL_CONTAINER(cb),
+ EWL_WIDGET(b->label_object));
+ ewl_container_child_remove(EWL_CONTAINER(cb), cb->check);
+
+ /*
+ * Add the label and check back into the checkbutton with the correct
+ * order.
+ */
+ if (p == EWL_POSITION_RIGHT) {
+ ewl_container_child_append(EWL_CONTAINER(cb), cb->check);
+ ewl_container_child_append(EWL_CONTAINER(cb),
+ EWL_WIDGET(b->label_object));
+ } else {
+ ewl_container_child_append(EWL_CONTAINER(cb),
+ EWL_WIDGET(b->label_object));
+ ewl_container_child_append(EWL_CONTAINER(cb), cb->check);
+ }
+
+ ewl_widget_configure(EWL_WIDGET(cb));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -171,23 +171,23 @@ ewl_checkbutton_label_position_set(Ewl_Checkbutton *cb, Ewl_Position p)
*/
void
ewl_checkbutton_cb_clicked(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Checkbutton *cb;
+ Ewl_Checkbutton *cb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_CHECKBUTTON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_CHECKBUTTON_TYPE);
- cb = EWL_CHECKBUTTON(w);
+ cb = EWL_CHECKBUTTON(w);
- if (ewl_check_is_checked(EWL_CHECK(cb->check)))
- ewl_check_checked_set(EWL_CHECK(cb->check), FALSE);
- else
- ewl_check_checked_set(EWL_CHECK(cb->check), TRUE);
- ewl_callback_call(w, EWL_CALLBACK_VALUE_CHANGED);
+ if (ewl_check_is_checked(EWL_CHECK(cb->check)))
+ ewl_check_checked_set(EWL_CHECK(cb->check), FALSE);
+ else
+ ewl_check_checked_set(EWL_CHECK(cb->check), TRUE);
+ ewl_callback_call(w, EWL_CALLBACK_VALUE_CHANGED);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -197,42 +197,42 @@ ewl_checkbutton_cb_clicked(Ewl_Widget *w, void *ev_data __UNUSED__,
Ewl_View *
ewl_checkbutton_view_get(void)
{
- Ewl_View *view;
+ Ewl_View *view;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- view = ewl_view_new();
- ewl_view_widget_fetch_set(view, ewl_checkbutton_view_cb_widget_fetch);
- ewl_view_header_fetch_set(view, ewl_checkbutton_view_cb_header_fetch);
+ view = ewl_view_new();
+ ewl_view_widget_fetch_set(view, ewl_checkbutton_view_cb_widget_fetch);
+ ewl_view_header_fetch_set(view, ewl_checkbutton_view_cb_header_fetch);
- DRETURN_PTR(view, DLEVEL_STABLE);
+ DRETURN_PTR(view, DLEVEL_STABLE);
}
static Ewl_Widget *
ewl_checkbutton_view_cb_widget_fetch(void *data, unsigned int row __UNUSED__,
- unsigned int col __UNUSED__)
+ unsigned int col __UNUSED__)
{
- Ewl_Widget *check;
+ Ewl_Widget *check;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- check = ewl_checkbutton_new();
- ewl_button_label_set(EWL_BUTTON(check), data);
+ check = ewl_checkbutton_new();
+ ewl_button_label_set(EWL_BUTTON(check), data);
- DRETURN_PTR(check, DLEVEL_STABLE);
+ DRETURN_PTR(check, DLEVEL_STABLE);
}
static Ewl_Widget *
ewl_checkbutton_view_cb_header_fetch(void *data, unsigned int col __UNUSED__)
{
- Ewl_Widget *check;
+ Ewl_Widget *check;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- check = ewl_checkbutton_new();
- ewl_button_label_set(EWL_BUTTON(check), data);
+ check = ewl_checkbutton_new();
+ ewl_button_label_set(EWL_BUTTON(check), data);
- DRETURN_PTR(check, DLEVEL_STABLE);
+ DRETURN_PTR(check, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_checkbutton.h b/src/lib/ewl_checkbutton.h
index 7dfc4e9..8f7cf73 100644
--- a/src/lib/ewl_checkbutton.h
+++ b/src/lib/ewl_checkbutton.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_CHECKBUTTON_H
#define EWL_CHECKBUTTON_H
@@ -52,20 +52,20 @@ typedef struct Ewl_Checkbutton Ewl_Checkbutton;
*/
struct Ewl_Checkbutton
{
- Ewl_Button button; /**< Inherit the basic button properties */
- Ewl_Position label_position; /**< Order of label and check */
- Ewl_Widget *check; /**< Check widget represented */
+ Ewl_Button button; /**< Inherit the basic button properties */
+ Ewl_Position label_position; /**< Order of label and check */
+ Ewl_Widget *check; /**< Check widget represented */
};
-Ewl_Widget *ewl_checkbutton_new(void);
-int ewl_checkbutton_init(Ewl_Checkbutton *cb);
+Ewl_Widget *ewl_checkbutton_new(void);
+int ewl_checkbutton_init(Ewl_Checkbutton *cb);
-void ewl_checkbutton_checked_set(Ewl_Checkbutton *cb, int checked);
-int ewl_checkbutton_is_checked(Ewl_Checkbutton *cb);
+void ewl_checkbutton_checked_set(Ewl_Checkbutton *cb, int checked);
+int ewl_checkbutton_is_checked(Ewl_Checkbutton *cb);
-void ewl_checkbutton_label_position_set(Ewl_Checkbutton *cb,
- Ewl_Position p);
-Ewl_View *ewl_checkbutton_view_get(void);
+void ewl_checkbutton_label_position_set(Ewl_Checkbutton *cb,
+ Ewl_Position p);
+Ewl_View *ewl_checkbutton_view_get(void);
/*
* Internally used callbacks, override at your own risk
diff --git a/src/lib/ewl_colordialog.c b/src/lib/ewl_colordialog.c
index 6b3c489..8ee7dac 100644
--- a/src/lib/ewl_colordialog.c
+++ b/src/lib/ewl_colordialog.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_colordialog.h"
#include "ewl_button.h"
@@ -16,23 +16,23 @@ static void ewl_colordialog_respond(Ewl_Colordialog *cd, unsigned int response);
Ewl_Widget *
ewl_colordialog_new(void)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- w = NEW(Ewl_Colordialog, 1);
- if (!w)
- {
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ w = NEW(Ewl_Colordialog, 1);
+ if (!w)
+ {
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- if (!ewl_colordialog_init(EWL_COLORDIALOG(w)))
- {
- ewl_widget_destroy(w);
- w = NULL;
- }
+ if (!ewl_colordialog_init(EWL_COLORDIALOG(w)))
+ {
+ ewl_widget_destroy(w);
+ w = NULL;
+ }
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
/**
@@ -43,55 +43,55 @@ ewl_colordialog_new(void)
int
ewl_colordialog_init(Ewl_Colordialog *cd)
{
- Ewl_Widget *o;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cd, FALSE);
-
- if (!ewl_dialog_init(EWL_DIALOG(cd))) {
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
- ewl_widget_inherit(EWL_WIDGET(cd), EWL_COLORDIALOG_TYPE);
-
- ewl_dialog_action_position_set(EWL_DIALOG(cd), EWL_POSITION_BOTTOM);
- ewl_window_title_set(EWL_WINDOW(cd), "Ewl Colordialog");
- ewl_window_name_set(EWL_WINDOW(cd), "Ewl Colordialog");
- ewl_window_class_set(EWL_WINDOW(cd), "Ewl Colordialog");
-
- ewl_callback_append(EWL_WIDGET(cd), EWL_CALLBACK_DELETE_WINDOW,
- ewl_colordialog_cb_delete_window, NULL);
-
- ewl_dialog_active_area_set(EWL_DIALOG(cd), EWL_POSITION_TOP);
-
- /* create the color picker */
- cd->picker = ewl_colorpicker_new();
- ewl_widget_internal_set(cd->picker, TRUE);
- ewl_container_child_append(EWL_CONTAINER(cd), cd->picker);
- ewl_object_fill_policy_set(EWL_OBJECT(cd->picker),
- EWL_FLAG_FILL_FILL);
- ewl_widget_show(cd->picker);
-
- ewl_dialog_active_area_set(EWL_DIALOG(cd), EWL_POSITION_BOTTOM);
-
- /* create the buttons */
- o = ewl_button_new();
- ewl_container_child_append(EWL_CONTAINER(cd), o);
- ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_OK);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_colordialog_cb_button_click, cd);
- ewl_widget_show(o);
-
- o = ewl_button_new();
- ewl_container_child_append(EWL_CONTAINER(cd), o);
- ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_CANCEL);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_colordialog_cb_button_click, cd);
- ewl_widget_show(o);
-
- /* enable alpha channel by default */
- ewl_colordialog_has_alpha_set(cd, TRUE);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Widget *o;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cd, FALSE);
+
+ if (!ewl_dialog_init(EWL_DIALOG(cd))) {
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+ ewl_widget_inherit(EWL_WIDGET(cd), EWL_COLORDIALOG_TYPE);
+
+ ewl_dialog_action_position_set(EWL_DIALOG(cd), EWL_POSITION_BOTTOM);
+ ewl_window_title_set(EWL_WINDOW(cd), "Ewl Colordialog");
+ ewl_window_name_set(EWL_WINDOW(cd), "Ewl Colordialog");
+ ewl_window_class_set(EWL_WINDOW(cd), "Ewl Colordialog");
+
+ ewl_callback_append(EWL_WIDGET(cd), EWL_CALLBACK_DELETE_WINDOW,
+ ewl_colordialog_cb_delete_window, NULL);
+
+ ewl_dialog_active_area_set(EWL_DIALOG(cd), EWL_POSITION_TOP);
+
+ /* create the color picker */
+ cd->picker = ewl_colorpicker_new();
+ ewl_widget_internal_set(cd->picker, TRUE);
+ ewl_container_child_append(EWL_CONTAINER(cd), cd->picker);
+ ewl_object_fill_policy_set(EWL_OBJECT(cd->picker),
+ EWL_FLAG_FILL_FILL);
+ ewl_widget_show(cd->picker);
+
+ ewl_dialog_active_area_set(EWL_DIALOG(cd), EWL_POSITION_BOTTOM);
+
+ /* create the buttons */
+ o = ewl_button_new();
+ ewl_container_child_append(EWL_CONTAINER(cd), o);
+ ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_OK);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_colordialog_cb_button_click, cd);
+ ewl_widget_show(o);
+
+ o = ewl_button_new();
+ ewl_container_child_append(EWL_CONTAINER(cd), o);
+ ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_CANCEL);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_colordialog_cb_button_click, cd);
+ ewl_widget_show(o);
+
+ /* enable alpha channel by default */
+ ewl_colordialog_has_alpha_set(cd, TRUE);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -103,13 +103,13 @@ ewl_colordialog_init(Ewl_Colordialog *cd)
void
ewl_colordialog_has_alpha_set(Ewl_Colordialog *cd, unsigned int alpha)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cd);
- DCHECK_TYPE(cd, EWL_COLORDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cd);
+ DCHECK_TYPE(cd, EWL_COLORDIALOG_TYPE);
- ewl_colorpicker_has_alpha_set(EWL_COLORPICKER(cd->picker), alpha);
+ ewl_colorpicker_has_alpha_set(EWL_COLORPICKER(cd->picker), alpha);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -121,15 +121,15 @@ ewl_colordialog_has_alpha_set(Ewl_Colordialog *cd, unsigned int alpha)
unsigned int
ewl_colordialog_has_alpha_get(Ewl_Colordialog *cd)
{
- unsigned int alpha;
+ unsigned int alpha;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cd, FALSE);
- DCHECK_TYPE_RET(cd, EWL_COLORDIALOG_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cd, FALSE);
+ DCHECK_TYPE_RET(cd, EWL_COLORDIALOG_TYPE, FALSE);
- alpha = ewl_colorpicker_has_alpha_get(EWL_COLORPICKER(cd->picker));
+ alpha = ewl_colorpicker_has_alpha_get(EWL_COLORPICKER(cd->picker));
- DRETURN_INT(alpha, DLEVEL_STABLE);
+ DRETURN_INT(alpha, DLEVEL_STABLE);
}
/**
@@ -141,13 +141,13 @@ ewl_colordialog_has_alpha_get(Ewl_Colordialog *cd)
void
ewl_colordialog_alpha_set(Ewl_Colordialog *cd, unsigned int alpha)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cd);
- DCHECK_TYPE(cd, EWL_COLORDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cd);
+ DCHECK_TYPE(cd, EWL_COLORDIALOG_TYPE);
- ewl_colorpicker_alpha_set(EWL_COLORPICKER(cd->picker), alpha);
+ ewl_colorpicker_alpha_set(EWL_COLORPICKER(cd->picker), alpha);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -158,15 +158,15 @@ ewl_colordialog_alpha_set(Ewl_Colordialog *cd, unsigned int alpha)
unsigned int
ewl_colordialog_alpha_get(Ewl_Colordialog *cd)
{
- unsigned int alpha;
+ unsigned int alpha;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cd, 255);
- DCHECK_TYPE_RET(cd, EWL_COLORDIALOG_TYPE, 255);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cd, 255);
+ DCHECK_TYPE_RET(cd, EWL_COLORDIALOG_TYPE, 255);
- alpha = ewl_colorpicker_alpha_get(EWL_COLORPICKER(cd->picker));
+ alpha = ewl_colorpicker_alpha_get(EWL_COLORPICKER(cd->picker));
- DRETURN_INT(alpha, DLEVEL_STABLE);
+ DRETURN_INT(alpha, DLEVEL_STABLE);
}
/**
@@ -179,15 +179,15 @@ ewl_colordialog_alpha_get(Ewl_Colordialog *cd)
*/
void
ewl_colordialog_current_rgb_set(Ewl_Colordialog *cd, unsigned int r,
- unsigned int g, unsigned int b)
+ unsigned int g, unsigned int b)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cd);
- DCHECK_TYPE(cd, EWL_COLORDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cd);
+ DCHECK_TYPE(cd, EWL_COLORDIALOG_TYPE);
- ewl_colorpicker_current_rgb_set(EWL_COLORPICKER(cd->picker), r, g, b);
+ ewl_colorpicker_current_rgb_set(EWL_COLORPICKER(cd->picker), r, g, b);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -200,15 +200,15 @@ ewl_colordialog_current_rgb_set(Ewl_Colordialog *cd, unsigned int r,
*/
void
ewl_colordialog_current_rgb_get(Ewl_Colordialog *cd, unsigned int *r,
- unsigned int *g, unsigned int *b)
+ unsigned int *g, unsigned int *b)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cd);
- DCHECK_TYPE(cd, EWL_COLORDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cd);
+ DCHECK_TYPE(cd, EWL_COLORDIALOG_TYPE);
- ewl_colorpicker_current_rgb_get(EWL_COLORPICKER(cd->picker), r, g, b);
+ ewl_colorpicker_current_rgb_get(EWL_COLORPICKER(cd->picker), r, g, b);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -223,16 +223,16 @@ ewl_colordialog_current_rgb_get(Ewl_Colordialog *cd, unsigned int *r,
*/
void
ewl_colordialog_previous_rgba_set(Ewl_Colordialog *cd, unsigned int r,
- unsigned int g, unsigned int b,
- unsigned int a)
+ unsigned int g, unsigned int b,
+ unsigned int a)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cd);
- DCHECK_TYPE(cd, EWL_COLORDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cd);
+ DCHECK_TYPE(cd, EWL_COLORDIALOG_TYPE);
- ewl_colorpicker_previous_rgba_set(EWL_COLORPICKER(cd->picker), r, g, b, a);
+ ewl_colorpicker_previous_rgba_set(EWL_COLORPICKER(cd->picker), r, g, b, a);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -247,16 +247,16 @@ ewl_colordialog_previous_rgba_set(Ewl_Colordialog *cd, unsigned int r,
*/
void
ewl_colordialog_previous_rgba_get(Ewl_Colordialog *cd, unsigned int *r,
- unsigned int *g, unsigned int *b,
- unsigned int *a)
+ unsigned int *g, unsigned int *b,
+ unsigned int *a)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cd);
- DCHECK_TYPE(cd, EWL_COLORDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cd);
+ DCHECK_TYPE(cd, EWL_COLORDIALOG_TYPE);
- ewl_colorpicker_previous_rgba_get(EWL_COLORPICKER(cd->picker), r, g, b, a);
+ ewl_colorpicker_previous_rgba_get(EWL_COLORPICKER(cd->picker), r, g, b, a);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -268,13 +268,13 @@ ewl_colordialog_previous_rgba_get(Ewl_Colordialog *cd, unsigned int *r,
void
ewl_colordialog_color_mode_set(Ewl_Colordialog *cd, Ewl_Color_Mode type)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cd);
- DCHECK_TYPE(cd, EWL_COLORDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cd);
+ DCHECK_TYPE(cd, EWL_COLORDIALOG_TYPE);
- ewl_colorpicker_color_mode_set(EWL_COLORPICKER(cd->picker), type);
+ ewl_colorpicker_color_mode_set(EWL_COLORPICKER(cd->picker), type);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -286,15 +286,15 @@ ewl_colordialog_color_mode_set(Ewl_Colordialog *cd, Ewl_Color_Mode type)
Ewl_Color_Mode
ewl_colordialog_color_mode_get(Ewl_Colordialog *cd)
{
- Ewl_Color_Mode mode;
+ Ewl_Color_Mode mode;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cd, EWL_COLOR_MODE_HSV_HUE);
- DCHECK_TYPE_RET(cd, EWL_COLORDIALOG_TYPE, EWL_COLOR_MODE_HSV_HUE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cd, EWL_COLOR_MODE_HSV_HUE);
+ DCHECK_TYPE_RET(cd, EWL_COLORDIALOG_TYPE, EWL_COLOR_MODE_HSV_HUE);
- mode = ewl_colorpicker_color_mode_get(EWL_COLORPICKER(cd->picker));
+ mode = ewl_colorpicker_color_mode_get(EWL_COLORPICKER(cd->picker));
- DRETURN_INT(mode, DLEVEL_STABLE);
+ DRETURN_INT(mode, DLEVEL_STABLE);
}
/**
@@ -308,18 +308,18 @@ ewl_colordialog_color_mode_get(Ewl_Colordialog *cd)
void
ewl_colordialog_cb_button_click(Ewl_Widget *w, void *ev __UNUSED__, void *data)
{
- unsigned int type;
+ unsigned int type;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(w, EWL_STOCK_TYPE);
- DCHECK_TYPE(data, EWL_COLORDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(w, EWL_STOCK_TYPE);
+ DCHECK_TYPE(data, EWL_COLORDIALOG_TYPE);
- type = ewl_stock_type_get(EWL_STOCK(w));
- ewl_colordialog_respond(EWL_COLORDIALOG(data), type);
+ type = ewl_stock_type_get(EWL_STOCK(w));
+ ewl_colordialog_respond(EWL_COLORDIALOG(data), type);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -332,30 +332,30 @@ ewl_colordialog_cb_button_click(Ewl_Widget *w, void *ev __UNUSED__, void *data)
*/
void
ewl_colordialog_cb_delete_window(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_COLORDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_COLORDIALOG_TYPE);
- ewl_colordialog_respond(EWL_COLORDIALOG(w), EWL_STOCK_CANCEL);
+ ewl_colordialog_respond(EWL_COLORDIALOG(w), EWL_STOCK_CANCEL);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_colordialog_respond(Ewl_Colordialog *cd, unsigned int response)
{
- Ewl_Event_Action_Response cd_ev;
+ Ewl_Event_Action_Response cd_ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cd);
- DCHECK_TYPE(cd, EWL_COLORDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cd);
+ DCHECK_TYPE(cd, EWL_COLORDIALOG_TYPE);
- cd_ev.response = response;
- ewl_callback_call_with_event_data(EWL_WIDGET(cd),
- EWL_CALLBACK_VALUE_CHANGED, &cd_ev);
+ cd_ev.response = response;
+ ewl_callback_call_with_event_data(EWL_WIDGET(cd),
+ EWL_CALLBACK_VALUE_CHANGED, &cd_ev);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_colordialog.h b/src/lib/ewl_colordialog.h
index 3325d0b..3810cd7 100644
--- a/src/lib/ewl_colordialog.h
+++ b/src/lib/ewl_colordialog.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_COLORDIALOG_H
#define EWL_COLORDIALOG_H
@@ -43,33 +43,33 @@ typedef struct Ewl_Colordialog Ewl_Colordialog;
*/
struct Ewl_Colordialog
{
- Ewl_Dialog dialog; /**< Inherits from Ewl_Dialog */
- Ewl_Widget *picker; /**< Store the color picker widget */
+ Ewl_Dialog dialog; /**< Inherits from Ewl_Dialog */
+ Ewl_Widget *picker; /**< Store the color picker widget */
};
-Ewl_Widget *ewl_colordialog_new(void);
-int ewl_colordialog_init(Ewl_Colordialog *cd);
+Ewl_Widget *ewl_colordialog_new(void);
+int ewl_colordialog_init(Ewl_Colordialog *cd);
-void ewl_colordialog_has_alpha_set(Ewl_Colordialog *cp, unsigned int alpha);
-unsigned int ewl_colordialog_has_alpha_get(Ewl_Colordialog *cp);
+void ewl_colordialog_has_alpha_set(Ewl_Colordialog *cp, unsigned int alpha);
+unsigned int ewl_colordialog_has_alpha_get(Ewl_Colordialog *cp);
-void ewl_colordialog_alpha_set(Ewl_Colordialog *cp, unsigned int alpha);
-unsigned int ewl_colordialog_alpha_get(Ewl_Colordialog *cp);
+void ewl_colordialog_alpha_set(Ewl_Colordialog *cp, unsigned int alpha);
+unsigned int ewl_colordialog_alpha_get(Ewl_Colordialog *cp);
-void ewl_colordialog_current_rgb_set(Ewl_Colordialog *cp, unsigned int r,
- unsigned int g, unsigned int b);
-void ewl_colordialog_current_rgb_get(Ewl_Colordialog *cp, unsigned int *r,
- unsigned int *g, unsigned int *b);
+void ewl_colordialog_current_rgb_set(Ewl_Colordialog *cp, unsigned int r,
+ unsigned int g, unsigned int b);
+void ewl_colordialog_current_rgb_get(Ewl_Colordialog *cp, unsigned int *r,
+ unsigned int *g, unsigned int *b);
-void ewl_colordialog_previous_rgba_set(Ewl_Colordialog *cp, unsigned int r,
- unsigned int g, unsigned int b,
- unsigned int a);
-void ewl_colordialog_previous_rgba_get(Ewl_Colordialog *cp, unsigned int *r,
- unsigned int *g, unsigned int *b,
- unsigned int *a);
+void ewl_colordialog_previous_rgba_set(Ewl_Colordialog *cp, unsigned int r,
+ unsigned int g, unsigned int b,
+ unsigned int a);
+void ewl_colordialog_previous_rgba_get(Ewl_Colordialog *cp, unsigned int *r,
+ unsigned int *g, unsigned int *b,
+ unsigned int *a);
-void ewl_colordialog_color_mode_set(Ewl_Colordialog *cp, Ewl_Color_Mode type);
-Ewl_Color_Mode ewl_colordialog_color_mode_get(Ewl_Colordialog *cp);
+void ewl_colordialog_color_mode_set(Ewl_Colordialog *cp, Ewl_Color_Mode type);
+Ewl_Color_Mode ewl_colordialog_color_mode_get(Ewl_Colordialog *cp);
/*
* Internally used callbacks, override at your own risk
diff --git a/src/lib/ewl_colorpicker.c b/src/lib/ewl_colorpicker.c
index 6839c5a..da50737 100644
--- a/src/lib/ewl_colorpicker.c
+++ b/src/lib/ewl_colorpicker.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_colorpicker.h"
#include "ewl_grid.h"
@@ -11,8 +11,8 @@
#include "ewl_debug.h"
static void ewl_colorpicker_display_update(Ewl_Colorpicker *cp, unsigned int r,
- unsigned int g, unsigned int b, double h,
- double s, double v);
+ unsigned int g, unsigned int b, double h,
+ double s, double v);
#define EWL_COLORPICKER_SPINNER_TYPE "colorpicker_spinner"
#define EWL_COLORPICKER_SPINNER(spinner) ((Ewl_Colorpicker_Spinner *)spinner)
@@ -28,8 +28,8 @@ typedef struct Ewl_Colorpicker_Spinner Ewl_Colorpicker_Spinner;
*/
struct Ewl_Colorpicker_Spinner
{
- Ewl_Spinner spinner;
- Ewl_Color_Mode mode;
+ Ewl_Spinner spinner;
+ Ewl_Color_Mode mode;
};
#define EWL_COLORPICKER_RADIOBUTTON_TYPE "colorpicker_radiobutton"
@@ -46,25 +46,25 @@ typedef struct Ewl_Colorpicker_Radiobutton Ewl_Colorpicker_Radiobutton;
*/
struct Ewl_Colorpicker_Radiobutton
{
- Ewl_Radiobutton button;
- Ewl_Color_Mode mode;
+ Ewl_Radiobutton button;
+ Ewl_Color_Mode mode;
};
static Ewl_Widget *ewl_colorpicker_spinner_new(void);
static int ewl_colorpicker_spinner_init(Ewl_Colorpicker_Spinner *sp);
static void ewl_colorpicker_spinner_mode_set(Ewl_Colorpicker_Spinner *sp,
- Ewl_Color_Mode mode);
+ Ewl_Color_Mode mode);
static Ewl_Color_Mode ewl_colorpicker_spinner_mode_get(
- Ewl_Colorpicker_Spinner *sp);
+ Ewl_Colorpicker_Spinner *sp);
static Ewl_Widget *ewl_colorpicker_radiobutton_new(void);
static int ewl_colorpicker_radiobutton_init(Ewl_Colorpicker_Radiobutton *sp);
static void ewl_colorpicker_radiobutton_mode_set(
- Ewl_Colorpicker_Radiobutton *sp,
- Ewl_Color_Mode mode);
+ Ewl_Colorpicker_Radiobutton *sp,
+ Ewl_Color_Mode mode);
static Ewl_Color_Mode ewl_colorpicker_radiobutton_mode_get(
- Ewl_Colorpicker_Radiobutton *sp);
+ Ewl_Colorpicker_Radiobutton *sp);
/**
* @return Returns a new Ewl_Colorpicker widget or NULL on failure
@@ -73,23 +73,23 @@ static Ewl_Color_Mode ewl_colorpicker_radiobutton_mode_get(
Ewl_Widget *
ewl_colorpicker_new(void)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- w = NEW(Ewl_Colorpicker, 1);
- if (!w)
- {
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ w = NEW(Ewl_Colorpicker, 1);
+ if (!w)
+ {
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- if (!ewl_colorpicker_init(EWL_COLORPICKER(w)))
- {
- ewl_widget_destroy(w);
- w = NULL;
- }
+ if (!ewl_colorpicker_init(EWL_COLORPICKER(w)))
+ {
+ ewl_widget_destroy(w);
+ w = NULL;
+ }
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
/**
@@ -100,234 +100,234 @@ ewl_colorpicker_new(void)
int
ewl_colorpicker_init(Ewl_Colorpicker *cp)
{
- Ewl_Widget *vbox, *hbox, *o, *prev = NULL;
- unsigned int r, g, b;
- double h, s, v;
- int i;
- struct
- {
- char *name;
- Ewl_Color_Mode mode;
- int max;
- } modes[] = {
- {"H", EWL_COLOR_MODE_HSV_HUE, 360},
- {"S", EWL_COLOR_MODE_HSV_SATURATION, 100},
- {"V", EWL_COLOR_MODE_HSV_VALUE, 100},
- {"R", EWL_COLOR_MODE_RGB_RED, 255},
- {"G", EWL_COLOR_MODE_RGB_GREEN, 255},
- {"B", EWL_COLOR_MODE_RGB_BLUE, 255},
- {NULL, EWL_COLOR_MODE_RGB_RED, 0}
- };
- const char *types[] = { "application/x-color", NULL };
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cp, FALSE);
-
- if (!ewl_box_init(EWL_BOX(cp)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- ewl_box_orientation_set(EWL_BOX(cp), EWL_ORIENTATION_HORIZONTAL);
- ewl_widget_appearance_set(EWL_WIDGET(cp), EWL_COLORPICKER_TYPE);
- ewl_widget_inherit(EWL_WIDGET(cp), EWL_COLORPICKER_TYPE);
- ewl_dnd_accepted_types_set(EWL_WIDGET(cp), types);
-
- ewl_callback_append(EWL_WIDGET(cp), EWL_CALLBACK_DND_DATA_RECEIVED,
- ewl_colorpicker_cb_dnd_data, NULL);
-
- r = g = b = 0;
-
- vbox = ewl_vbox_new();
- ewl_widget_internal_set(vbox, TRUE);
- ewl_container_child_append(EWL_CONTAINER(cp), vbox);
- ewl_widget_show(vbox);
-
- /* hbox to hold the spectrums */
- hbox = ewl_hbox_new();
- ewl_widget_internal_set(hbox, TRUE);
- ewl_container_child_append(EWL_CONTAINER(vbox), hbox);
- ewl_widget_show(hbox);
-
- o = ewl_spectrum_new();
- ewl_widget_internal_set(o, TRUE);
- ewl_container_child_append(EWL_CONTAINER(hbox), o);
- ewl_spectrum_type_set(EWL_SPECTRUM(o), EWL_SPECTRUM_TYPE_SQUARE);
- ewl_spectrum_rgb_set(EWL_SPECTRUM(o), r, g, b);
- ewl_object_minimum_size_set(EWL_OBJECT(o), 150, 150);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_FILL);
- ewl_object_padding_set(EWL_OBJECT(o), 2, 2, 2, 2);
- ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
- ewl_colorpicker_cb_square_change, cp);
- cp->picker.square = o;
- ewl_widget_show(o);
-
- o = ewl_spectrum_new();
- ewl_widget_internal_set(o, TRUE);
- ewl_container_child_append(EWL_CONTAINER(hbox), o);
- ewl_spectrum_type_set(EWL_SPECTRUM(o), EWL_SPECTRUM_TYPE_VERTICAL);
- ewl_spectrum_rgb_set(EWL_SPECTRUM(o), r, g, b);
- ewl_object_minimum_size_set(EWL_OBJECT(o), 15, 150);
- ewl_object_maximum_size_set(EWL_OBJECT(o), 15, EWL_OBJECT_MAX_SIZE);
- ewl_object_padding_set(EWL_OBJECT(o), 2, 2, 2, 2);
- ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
- ewl_colorpicker_cb_vertical_change, cp);
- cp->picker.vertical = o;
- ewl_widget_show(o);
-
- ewl_spectrum_hsv_get(EWL_SPECTRUM(cp->picker.square), &h, &s, &v);
-
- /* grid to hold the colour previews */
- hbox = ewl_grid_new();
- ewl_widget_internal_set(hbox, TRUE);
- ewl_grid_dimensions_set(EWL_GRID(hbox), 2, 2);
- ewl_grid_vhomogeneous_set(EWL_GRID(hbox), TRUE);
- ewl_grid_column_preferred_w_use(EWL_GRID(hbox), 0);
- ewl_container_child_append(EWL_CONTAINER(vbox), hbox);
- ewl_object_fill_policy_set(EWL_OBJECT(hbox),
- EWL_FLAG_FILL_NONE | EWL_FLAG_FILL_HFILL);
- ewl_widget_show(hbox);
-
- o = ewl_label_new();
- ewl_widget_internal_set(o, TRUE);
- ewl_label_text_set(EWL_LABEL(o), "Current:");
- ewl_container_child_append(EWL_CONTAINER(hbox), o);
- ewl_widget_show(o);
-
- o = NEW(Ewl_Widget, 1);
- ewl_widget_init(o);
- ewl_widget_internal_set(o, TRUE);
- ewl_widget_appearance_set(o, "coloured_rect");
- ewl_container_child_append(EWL_CONTAINER(hbox), o);
- ewl_widget_color_set(o, r, g, b, 255);
- ewl_object_padding_set(EWL_OBJECT(o), 2, 2, 2, 2);
- ewl_object_minimum_h_set(EWL_OBJECT(o), 20);
- ewl_object_fill_policy_set(EWL_OBJECT(o),
- EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
- cp->preview.current = o;
- ewl_widget_show(o);
-
- o = ewl_label_new();
- ewl_widget_internal_set(o, TRUE);
- ewl_label_text_set(EWL_LABEL(o), "Previous:");
- ewl_container_child_append(EWL_CONTAINER(hbox), o);
- ewl_widget_show(o);
-
- o = NEW(Ewl_Widget, 1);
- ewl_widget_init(o);
- ewl_widget_internal_set(o, TRUE);
- ewl_widget_appearance_set(o, "coloured_rect");
- ewl_container_child_append(EWL_CONTAINER(hbox), o);
- ewl_widget_color_set(o, r, g, b, 255);
- ewl_object_padding_set(EWL_OBJECT(o), 2, 2, 2, 2);
- ewl_object_minimum_h_set(EWL_OBJECT(o), 20);
- ewl_object_fill_policy_set(EWL_OBJECT(o),
- EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_colorpicker_cb_previous_clicked, cp);
- cp->preview.previous = o;
- ewl_widget_show(o);
-
- /* do the spinner side */
- vbox = ewl_vbox_new();
- ewl_widget_internal_set(vbox, TRUE);
- ewl_container_child_append(EWL_CONTAINER(cp), vbox);
- ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_SHRINK);
- ewl_widget_show(vbox);
-
- /* setup the spinners and radiobuttons */
- for (i = 0; modes[i].name != NULL; i++)
- {
- hbox = ewl_hbox_new();
- ewl_widget_internal_set(hbox, TRUE);
- ewl_container_child_append(EWL_CONTAINER(vbox), hbox);
- ewl_widget_show(hbox);
-
- o = ewl_colorpicker_radiobutton_new();
- ewl_widget_internal_set(o, TRUE);
- ewl_button_label_set(EWL_BUTTON(o), modes[i].name);
- if (!prev)
- ewl_checkbutton_checked_set(EWL_CHECKBUTTON(o), TRUE);
- else
- ewl_checkbutton_checked_set(EWL_CHECKBUTTON(o), FALSE);
-
- ewl_container_child_append(EWL_CONTAINER(hbox), o);
- ewl_colorpicker_radiobutton_mode_set(EWL_COLORPICKER_RADIOBUTTON(o),
- modes[i].mode);
- if (prev)
- ewl_radiobutton_chain_set(EWL_RADIOBUTTON(o), EWL_RADIOBUTTON(prev));
- ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
- ewl_colorpicker_cb_radio_change, cp);
- prev = o;
- ewl_widget_show(o);
-
- o = ewl_colorpicker_spinner_new();
- ewl_widget_internal_set(o, TRUE);
- ewl_container_child_append(EWL_CONTAINER(hbox), o);
- ewl_range_minimum_value_set(EWL_RANGE(o), 0);
- ewl_range_maximum_value_set(EWL_RANGE(o), modes[i].max);
-
- switch(modes[i].mode)
- {
- case EWL_COLOR_MODE_HSV_HUE:
- ewl_range_value_set(EWL_RANGE(o), h);
- cp->spinners.hsv.h = o;
- break;
- case EWL_COLOR_MODE_HSV_SATURATION:
- ewl_range_value_set(EWL_RANGE(o), s * 100);
- cp->spinners.hsv.s = o;
- break;
- case EWL_COLOR_MODE_HSV_VALUE:
- ewl_range_value_set(EWL_RANGE(o), v * 100);
- cp->spinners.hsv.v = o;
- break;
- case EWL_COLOR_MODE_RGB_RED:
- ewl_range_value_set(EWL_RANGE(o), r);
- cp->spinners.rgb.r = o;
- break;
- case EWL_COLOR_MODE_RGB_GREEN:
- ewl_range_value_set(EWL_RANGE(o), g);
- cp->spinners.rgb.g = o;
- break;
- case EWL_COLOR_MODE_RGB_BLUE:
- ewl_range_value_set(EWL_RANGE(o), b);
- cp->spinners.rgb.b = o;
- break;
- }
-
- ewl_range_step_set(EWL_RANGE(o), 1);
- ewl_spinner_digits_set(EWL_SPINNER(o), 0);
- ewl_colorpicker_spinner_mode_set(EWL_COLORPICKER_SPINNER(o),
- modes[i].mode);
- ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
- ewl_colorpicker_cb_spinner_change, cp);
- ewl_widget_show(o);
- }
-
- o = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(vbox), o);
- cp->alpha_box = o;
-
- o = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(o), "A");
- ewl_container_child_append(EWL_CONTAINER(cp->alpha_box), o);
- ewl_widget_show(o);
-
- /* alpha spinner */
- o = ewl_spinner_new();
- ewl_widget_internal_set(o, TRUE);
- ewl_container_child_append(EWL_CONTAINER(cp->alpha_box), o);
- ewl_range_minimum_value_set(EWL_RANGE(o), 0);
- ewl_range_maximum_value_set(EWL_RANGE(o), 255);
- ewl_range_value_set(EWL_RANGE(o), 255);
- ewl_range_step_set(EWL_RANGE(o), 1);
- ewl_spinner_digits_set(EWL_SPINNER(o), 0);
- ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
- ewl_colorpicker_cb_alpha_change, cp);
- ewl_widget_show(o);
- cp->spinners.alpha = o;
-
- ewl_colorpicker_color_mode_set(cp, EWL_COLOR_MODE_HSV_HUE);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Widget *vbox, *hbox, *o, *prev = NULL;
+ unsigned int r, g, b;
+ double h, s, v;
+ int i;
+ struct
+ {
+ char *name;
+ Ewl_Color_Mode mode;
+ int max;
+ } modes[] = {
+ {"H", EWL_COLOR_MODE_HSV_HUE, 360},
+ {"S", EWL_COLOR_MODE_HSV_SATURATION, 100},
+ {"V", EWL_COLOR_MODE_HSV_VALUE, 100},
+ {"R", EWL_COLOR_MODE_RGB_RED, 255},
+ {"G", EWL_COLOR_MODE_RGB_GREEN, 255},
+ {"B", EWL_COLOR_MODE_RGB_BLUE, 255},
+ {NULL, EWL_COLOR_MODE_RGB_RED, 0}
+ };
+ const char *types[] = { "application/x-color", NULL };
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cp, FALSE);
+
+ if (!ewl_box_init(EWL_BOX(cp)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ ewl_box_orientation_set(EWL_BOX(cp), EWL_ORIENTATION_HORIZONTAL);
+ ewl_widget_appearance_set(EWL_WIDGET(cp), EWL_COLORPICKER_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(cp), EWL_COLORPICKER_TYPE);
+ ewl_dnd_accepted_types_set(EWL_WIDGET(cp), types);
+
+ ewl_callback_append(EWL_WIDGET(cp), EWL_CALLBACK_DND_DATA_RECEIVED,
+ ewl_colorpicker_cb_dnd_data, NULL);
+
+ r = g = b = 0;
+
+ vbox = ewl_vbox_new();
+ ewl_widget_internal_set(vbox, TRUE);
+ ewl_container_child_append(EWL_CONTAINER(cp), vbox);
+ ewl_widget_show(vbox);
+
+ /* hbox to hold the spectrums */
+ hbox = ewl_hbox_new();
+ ewl_widget_internal_set(hbox, TRUE);
+ ewl_container_child_append(EWL_CONTAINER(vbox), hbox);
+ ewl_widget_show(hbox);
+
+ o = ewl_spectrum_new();
+ ewl_widget_internal_set(o, TRUE);
+ ewl_container_child_append(EWL_CONTAINER(hbox), o);
+ ewl_spectrum_type_set(EWL_SPECTRUM(o), EWL_SPECTRUM_TYPE_SQUARE);
+ ewl_spectrum_rgb_set(EWL_SPECTRUM(o), r, g, b);
+ ewl_object_minimum_size_set(EWL_OBJECT(o), 150, 150);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_FILL);
+ ewl_object_padding_set(EWL_OBJECT(o), 2, 2, 2, 2);
+ ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
+ ewl_colorpicker_cb_square_change, cp);
+ cp->picker.square = o;
+ ewl_widget_show(o);
+
+ o = ewl_spectrum_new();
+ ewl_widget_internal_set(o, TRUE);
+ ewl_container_child_append(EWL_CONTAINER(hbox), o);
+ ewl_spectrum_type_set(EWL_SPECTRUM(o), EWL_SPECTRUM_TYPE_VERTICAL);
+ ewl_spectrum_rgb_set(EWL_SPECTRUM(o), r, g, b);
+ ewl_object_minimum_size_set(EWL_OBJECT(o), 15, 150);
+ ewl_object_maximum_size_set(EWL_OBJECT(o), 15, EWL_OBJECT_MAX_SIZE);
+ ewl_object_padding_set(EWL_OBJECT(o), 2, 2, 2, 2);
+ ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
+ ewl_colorpicker_cb_vertical_change, cp);
+ cp->picker.vertical = o;
+ ewl_widget_show(o);
+
+ ewl_spectrum_hsv_get(EWL_SPECTRUM(cp->picker.square), &h, &s, &v);
+
+ /* grid to hold the colour previews */
+ hbox = ewl_grid_new();
+ ewl_widget_internal_set(hbox, TRUE);
+ ewl_grid_dimensions_set(EWL_GRID(hbox), 2, 2);
+ ewl_grid_vhomogeneous_set(EWL_GRID(hbox), TRUE);
+ ewl_grid_column_preferred_w_use(EWL_GRID(hbox), 0);
+ ewl_container_child_append(EWL_CONTAINER(vbox), hbox);
+ ewl_object_fill_policy_set(EWL_OBJECT(hbox),
+ EWL_FLAG_FILL_NONE | EWL_FLAG_FILL_HFILL);
+ ewl_widget_show(hbox);
+
+ o = ewl_label_new();
+ ewl_widget_internal_set(o, TRUE);
+ ewl_label_text_set(EWL_LABEL(o), "Current:");
+ ewl_container_child_append(EWL_CONTAINER(hbox), o);
+ ewl_widget_show(o);
+
+ o = NEW(Ewl_Widget, 1);
+ ewl_widget_init(o);
+ ewl_widget_internal_set(o, TRUE);
+ ewl_widget_appearance_set(o, "coloured_rect");
+ ewl_container_child_append(EWL_CONTAINER(hbox), o);
+ ewl_widget_color_set(o, r, g, b, 255);
+ ewl_object_padding_set(EWL_OBJECT(o), 2, 2, 2, 2);
+ ewl_object_minimum_h_set(EWL_OBJECT(o), 20);
+ ewl_object_fill_policy_set(EWL_OBJECT(o),
+ EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
+ cp->preview.current = o;
+ ewl_widget_show(o);
+
+ o = ewl_label_new();
+ ewl_widget_internal_set(o, TRUE);
+ ewl_label_text_set(EWL_LABEL(o), "Previous:");
+ ewl_container_child_append(EWL_CONTAINER(hbox), o);
+ ewl_widget_show(o);
+
+ o = NEW(Ewl_Widget, 1);
+ ewl_widget_init(o);
+ ewl_widget_internal_set(o, TRUE);
+ ewl_widget_appearance_set(o, "coloured_rect");
+ ewl_container_child_append(EWL_CONTAINER(hbox), o);
+ ewl_widget_color_set(o, r, g, b, 255);
+ ewl_object_padding_set(EWL_OBJECT(o), 2, 2, 2, 2);
+ ewl_object_minimum_h_set(EWL_OBJECT(o), 20);
+ ewl_object_fill_policy_set(EWL_OBJECT(o),
+ EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_colorpicker_cb_previous_clicked, cp);
+ cp->preview.previous = o;
+ ewl_widget_show(o);
+
+ /* do the spinner side */
+ vbox = ewl_vbox_new();
+ ewl_widget_internal_set(vbox, TRUE);
+ ewl_container_child_append(EWL_CONTAINER(cp), vbox);
+ ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_SHRINK);
+ ewl_widget_show(vbox);
+
+ /* setup the spinners and radiobuttons */
+ for (i = 0; modes[i].name != NULL; i++)
+ {
+ hbox = ewl_hbox_new();
+ ewl_widget_internal_set(hbox, TRUE);
+ ewl_container_child_append(EWL_CONTAINER(vbox), hbox);
+ ewl_widget_show(hbox);
+
+ o = ewl_colorpicker_radiobutton_new();
+ ewl_widget_internal_set(o, TRUE);
+ ewl_button_label_set(EWL_BUTTON(o), modes[i].name);
+ if (!prev)
+ ewl_checkbutton_checked_set(EWL_CHECKBUTTON(o), TRUE);
+ else
+ ewl_checkbutton_checked_set(EWL_CHECKBUTTON(o), FALSE);
+
+ ewl_container_child_append(EWL_CONTAINER(hbox), o);
+ ewl_colorpicker_radiobutton_mode_set(EWL_COLORPICKER_RADIOBUTTON(o),
+ modes[i].mode);
+ if (prev)
+ ewl_radiobutton_chain_set(EWL_RADIOBUTTON(o), EWL_RADIOBUTTON(prev));
+ ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
+ ewl_colorpicker_cb_radio_change, cp);
+ prev = o;
+ ewl_widget_show(o);
+
+ o = ewl_colorpicker_spinner_new();
+ ewl_widget_internal_set(o, TRUE);
+ ewl_container_child_append(EWL_CONTAINER(hbox), o);
+ ewl_range_minimum_value_set(EWL_RANGE(o), 0);
+ ewl_range_maximum_value_set(EWL_RANGE(o), modes[i].max);
+
+ switch(modes[i].mode)
+ {
+ case EWL_COLOR_MODE_HSV_HUE:
+ ewl_range_value_set(EWL_RANGE(o), h);
+ cp->spinners.hsv.h = o;
+ break;
+ case EWL_COLOR_MODE_HSV_SATURATION:
+ ewl_range_value_set(EWL_RANGE(o), s * 100);
+ cp->spinners.hsv.s = o;
+ break;
+ case EWL_COLOR_MODE_HSV_VALUE:
+ ewl_range_value_set(EWL_RANGE(o), v * 100);
+ cp->spinners.hsv.v = o;
+ break;
+ case EWL_COLOR_MODE_RGB_RED:
+ ewl_range_value_set(EWL_RANGE(o), r);
+ cp->spinners.rgb.r = o;
+ break;
+ case EWL_COLOR_MODE_RGB_GREEN:
+ ewl_range_value_set(EWL_RANGE(o), g);
+ cp->spinners.rgb.g = o;
+ break;
+ case EWL_COLOR_MODE_RGB_BLUE:
+ ewl_range_value_set(EWL_RANGE(o), b);
+ cp->spinners.rgb.b = o;
+ break;
+ }
+
+ ewl_range_step_set(EWL_RANGE(o), 1);
+ ewl_spinner_digits_set(EWL_SPINNER(o), 0);
+ ewl_colorpicker_spinner_mode_set(EWL_COLORPICKER_SPINNER(o),
+ modes[i].mode);
+ ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
+ ewl_colorpicker_cb_spinner_change, cp);
+ ewl_widget_show(o);
+ }
+
+ o = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(vbox), o);
+ cp->alpha_box = o;
+
+ o = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(o), "A");
+ ewl_container_child_append(EWL_CONTAINER(cp->alpha_box), o);
+ ewl_widget_show(o);
+
+ /* alpha spinner */
+ o = ewl_spinner_new();
+ ewl_widget_internal_set(o, TRUE);
+ ewl_container_child_append(EWL_CONTAINER(cp->alpha_box), o);
+ ewl_range_minimum_value_set(EWL_RANGE(o), 0);
+ ewl_range_maximum_value_set(EWL_RANGE(o), 255);
+ ewl_range_value_set(EWL_RANGE(o), 255);
+ ewl_range_step_set(EWL_RANGE(o), 1);
+ ewl_spinner_digits_set(EWL_SPINNER(o), 0);
+ ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
+ ewl_colorpicker_cb_alpha_change, cp);
+ ewl_widget_show(o);
+ cp->spinners.alpha = o;
+
+ ewl_colorpicker_color_mode_set(cp, EWL_COLOR_MODE_HSV_HUE);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -339,19 +339,19 @@ ewl_colorpicker_init(Ewl_Colorpicker *cp)
void
ewl_colorpicker_has_alpha_set(Ewl_Colorpicker *cp, unsigned int alpha)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cp);
- DCHECK_TYPE(cp, EWL_COLORPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cp);
+ DCHECK_TYPE(cp, EWL_COLORPICKER_TYPE);
- if (cp->has_alpha == !!alpha)
- DRETURN(DLEVEL_STABLE);
+ if (cp->has_alpha == !!alpha)
+ DRETURN(DLEVEL_STABLE);
- cp->has_alpha = !!alpha;
+ cp->has_alpha = !!alpha;
- if (cp->has_alpha) ewl_widget_show(cp->alpha_box);
- else ewl_widget_hide(cp->alpha_box);
+ if (cp->has_alpha) ewl_widget_show(cp->alpha_box);
+ else ewl_widget_hide(cp->alpha_box);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -362,11 +362,11 @@ ewl_colorpicker_has_alpha_set(Ewl_Colorpicker *cp, unsigned int alpha)
unsigned int
ewl_colorpicker_has_alpha_get(Ewl_Colorpicker *cp)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cp, FALSE);
- DCHECK_TYPE_RET(cp, EWL_COLORPICKER_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cp, FALSE);
+ DCHECK_TYPE_RET(cp, EWL_COLORPICKER_TYPE, FALSE);
- DRETURN_INT(cp->has_alpha, DLEVEL_STABLE);
+ DRETURN_INT(cp->has_alpha, DLEVEL_STABLE);
}
/**
@@ -377,14 +377,14 @@ ewl_colorpicker_has_alpha_get(Ewl_Colorpicker *cp)
void
ewl_colorpicker_alpha_set(Ewl_Colorpicker *cp, unsigned int alpha)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cp);
- DCHECK_TYPE(cp, EWL_COLORPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cp);
+ DCHECK_TYPE(cp, EWL_COLORPICKER_TYPE);
- if (alpha > 255) alpha = 255;
- ewl_range_value_set(EWL_RANGE(cp->spinners.alpha), alpha);
+ if (alpha > 255) alpha = 255;
+ ewl_range_value_set(EWL_RANGE(cp->spinners.alpha), alpha);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -395,15 +395,15 @@ ewl_colorpicker_alpha_set(Ewl_Colorpicker *cp, unsigned int alpha)
unsigned int
ewl_colorpicker_alpha_get(Ewl_Colorpicker *cp)
{
- unsigned int alpha;
+ unsigned int alpha;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cp, 255);
- DCHECK_TYPE_RET(cp, EWL_COLORPICKER_TYPE, 255);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cp, 255);
+ DCHECK_TYPE_RET(cp, EWL_COLORPICKER_TYPE, 255);
- alpha = ewl_range_value_get(EWL_RANGE(cp->spinners.alpha));
+ alpha = ewl_range_value_get(EWL_RANGE(cp->spinners.alpha));
- DRETURN_INT(alpha, DLEVEL_STABLE);
+ DRETURN_INT(alpha, DLEVEL_STABLE);
}
/**
@@ -416,27 +416,27 @@ ewl_colorpicker_alpha_get(Ewl_Colorpicker *cp)
*/
void
ewl_colorpicker_current_rgb_set(Ewl_Colorpicker *cp, unsigned int r,
- unsigned int g, unsigned int b)
+ unsigned int g, unsigned int b)
{
- double h, s, v;
+ double h, s, v;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cp);
- DCHECK_TYPE(cp, EWL_COLORPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cp);
+ DCHECK_TYPE(cp, EWL_COLORPICKER_TYPE);
- if (r > 255) r = 255;
- if (g > 255) g = 255;
- if (b > 255) b = 255;
+ if (r > 255) r = 255;
+ if (g > 255) g = 255;
+ if (b > 255) b = 255;
- ewl_widget_color_set(cp->preview.current, r, g, b,
- ewl_range_value_get(EWL_RANGE(cp->spinners.alpha)));
- ewl_spectrum_rgb_set(EWL_SPECTRUM(cp->picker.square), r, g, b);
- ewl_spectrum_rgb_set(EWL_SPECTRUM(cp->picker.vertical), r, g, b);
+ ewl_widget_color_set(cp->preview.current, r, g, b,
+ ewl_range_value_get(EWL_RANGE(cp->spinners.alpha)));
+ ewl_spectrum_rgb_set(EWL_SPECTRUM(cp->picker.square), r, g, b);
+ ewl_spectrum_rgb_set(EWL_SPECTRUM(cp->picker.vertical), r, g, b);
- ewl_spectrum_hsv_get(EWL_SPECTRUM(cp->picker.square), &h, &s, &v);
- ewl_colorpicker_display_update(cp, r, g, b, h, s, v);
+ ewl_spectrum_hsv_get(EWL_SPECTRUM(cp->picker.square), &h, &s, &v);
+ ewl_colorpicker_display_update(cp, r, g, b, h, s, v);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -449,15 +449,15 @@ ewl_colorpicker_current_rgb_set(Ewl_Colorpicker *cp, unsigned int r,
*/
void
ewl_colorpicker_current_rgb_get(Ewl_Colorpicker *cp, unsigned int *r,
- unsigned int *g, unsigned int *b)
+ unsigned int *g, unsigned int *b)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cp);
- DCHECK_TYPE(cp, EWL_COLORPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cp);
+ DCHECK_TYPE(cp, EWL_COLORPICKER_TYPE);
- ewl_spectrum_rgb_get(EWL_SPECTRUM(cp->picker.square), r, g, b);
+ ewl_spectrum_rgb_get(EWL_SPECTRUM(cp->picker.square), r, g, b);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -471,21 +471,21 @@ ewl_colorpicker_current_rgb_get(Ewl_Colorpicker *cp, unsigned int *r,
*/
void
ewl_colorpicker_previous_rgba_set(Ewl_Colorpicker *cp, unsigned int r,
- unsigned int g, unsigned int b,
- unsigned int a)
+ unsigned int g, unsigned int b,
+ unsigned int a)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cp);
- DCHECK_TYPE(cp, EWL_COLORPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cp);
+ DCHECK_TYPE(cp, EWL_COLORPICKER_TYPE);
- cp->previous.r = r;
- cp->previous.g = g;
- cp->previous.b = b;
- cp->previous.a = a;
+ cp->previous.r = r;
+ cp->previous.g = g;
+ cp->previous.b = b;
+ cp->previous.a = a;
- ewl_widget_color_set(cp->preview.previous, r, g, b, a);
+ ewl_widget_color_set(cp->preview.previous, r, g, b, a);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -499,19 +499,19 @@ ewl_colorpicker_previous_rgba_set(Ewl_Colorpicker *cp, unsigned int r,
*/
void
ewl_colorpicker_previous_rgba_get(Ewl_Colorpicker *cp, unsigned int *r,
- unsigned int *g, unsigned int *b,
- unsigned int *a)
+ unsigned int *g, unsigned int *b,
+ unsigned int *a)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cp);
- DCHECK_TYPE(cp, EWL_COLORPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cp);
+ DCHECK_TYPE(cp, EWL_COLORPICKER_TYPE);
- if (r) *r = cp->previous.r;
- if (g) *g = cp->previous.g;
- if (b) *b = cp->previous.b;
- if (a) *a = cp->previous.a;
+ if (r) *r = cp->previous.r;
+ if (g) *g = cp->previous.g;
+ if (b) *b = cp->previous.b;
+ if (a) *a = cp->previous.a;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -523,15 +523,15 @@ ewl_colorpicker_previous_rgba_get(Ewl_Colorpicker *cp, unsigned int *r,
void
ewl_colorpicker_color_mode_set(Ewl_Colorpicker *cp, Ewl_Color_Mode mode)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cp);
- DCHECK_TYPE(cp, EWL_COLORPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cp);
+ DCHECK_TYPE(cp, EWL_COLORPICKER_TYPE);
- cp->mode = mode;
- ewl_spectrum_mode_set(EWL_SPECTRUM(cp->picker.square), mode);
- ewl_spectrum_mode_set(EWL_SPECTRUM(cp->picker.vertical), mode);
+ cp->mode = mode;
+ ewl_spectrum_mode_set(EWL_SPECTRUM(cp->picker.square), mode);
+ ewl_spectrum_mode_set(EWL_SPECTRUM(cp->picker.vertical), mode);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -542,11 +542,11 @@ ewl_colorpicker_color_mode_set(Ewl_Colorpicker *cp, Ewl_Color_Mode mode)
Ewl_Color_Mode
ewl_colorpicker_color_mode_get(Ewl_Colorpicker *cp)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cp, FALSE);
- DCHECK_TYPE_RET(cp, EWL_COLORPICKER_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cp, FALSE);
+ DCHECK_TYPE_RET(cp, EWL_COLORPICKER_TYPE, FALSE);
- DRETURN_INT(cp->mode, DLEVEL_STABLE);
+ DRETURN_INT(cp->mode, DLEVEL_STABLE);
}
/**
@@ -559,23 +559,23 @@ ewl_colorpicker_color_mode_get(Ewl_Colorpicker *cp)
*/
void
ewl_colorpicker_cb_square_change(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Colorpicker *cp;
- unsigned int r, g, b;
- double h, s, v;
+ Ewl_Colorpicker *cp;
+ unsigned int r, g, b;
+ double h, s, v;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_COLORPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_COLORPICKER_TYPE);
- cp = data;
- ewl_spectrum_rgb_get(EWL_SPECTRUM(cp->picker.square), &r, &g, &b);
- ewl_spectrum_hsv_get(EWL_SPECTRUM(cp->picker.square), &h, &s, &v);
+ cp = data;
+ ewl_spectrum_rgb_get(EWL_SPECTRUM(cp->picker.square), &r, &g, &b);
+ ewl_spectrum_hsv_get(EWL_SPECTRUM(cp->picker.square), &h, &s, &v);
- ewl_colorpicker_display_update(cp, r, g, b, h, s, v);
+ ewl_colorpicker_display_update(cp, r, g, b, h, s, v);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -588,66 +588,66 @@ ewl_colorpicker_cb_square_change(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
*/
void
ewl_colorpicker_cb_vertical_change(Ewl_Widget *w __UNUSED__,
- void *ev __UNUSED__, void *data)
+ void *ev __UNUSED__, void *data)
{
- Ewl_Colorpicker *cp;
- unsigned int r, g, b;
- unsigned int r2, g2, b2;
- double h, s, v;
- double h2, s2, v2;
- unsigned int set_hsv = FALSE;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_COLORPICKER_TYPE);
-
- cp = data;
- ewl_spectrum_rgb_get(EWL_SPECTRUM(cp->picker.vertical), &r, &g, &b);
- ewl_spectrum_hsv_get(EWL_SPECTRUM(cp->picker.vertical), &h, &s, &v);
-
- ewl_spectrum_rgb_get(EWL_SPECTRUM(cp->picker.square), &r2, &g2, &b2);
- ewl_spectrum_hsv_get(EWL_SPECTRUM(cp->picker.square), &h2, &s2, &v2);
-
- switch (cp->mode)
- {
- case EWL_COLOR_MODE_RGB_RED:
- r2 = r;
- break;
- case EWL_COLOR_MODE_RGB_GREEN:
- g2 = g;
- break;
- case EWL_COLOR_MODE_RGB_BLUE:
- b2 = b;
- break;
- case EWL_COLOR_MODE_HSV_HUE:
- h2 = h;
- set_hsv = TRUE;
- break;
- case EWL_COLOR_MODE_HSV_SATURATION:
- s2 = s;
- set_hsv = TRUE;
- break;
- case EWL_COLOR_MODE_HSV_VALUE:
- v2 = v;
- set_hsv = TRUE;
- break;
- default:
- break;
- }
-
- if (set_hsv == FALSE)
- {
- ewl_spectrum_rgb_set(EWL_SPECTRUM(cp->picker.square), r2, g2, b2);
- ewl_spectrum_hsv_get(EWL_SPECTRUM(cp->picker.square), &h2, &s2, &v2);
- }
- else
- {
- ewl_spectrum_hsv_set(EWL_SPECTRUM(cp->picker.square), h2, s2, v2);
- ewl_spectrum_rgb_get(EWL_SPECTRUM(cp->picker.square), &r2, &g2, &b2);
- }
- ewl_colorpicker_display_update(cp, r2, g2, b2, h2, s2, v2);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Colorpicker *cp;
+ unsigned int r, g, b;
+ unsigned int r2, g2, b2;
+ double h, s, v;
+ double h2, s2, v2;
+ unsigned int set_hsv = FALSE;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_COLORPICKER_TYPE);
+
+ cp = data;
+ ewl_spectrum_rgb_get(EWL_SPECTRUM(cp->picker.vertical), &r, &g, &b);
+ ewl_spectrum_hsv_get(EWL_SPECTRUM(cp->picker.vertical), &h, &s, &v);
+
+ ewl_spectrum_rgb_get(EWL_SPECTRUM(cp->picker.square), &r2, &g2, &b2);
+ ewl_spectrum_hsv_get(EWL_SPECTRUM(cp->picker.square), &h2, &s2, &v2);
+
+ switch (cp->mode)
+ {
+ case EWL_COLOR_MODE_RGB_RED:
+ r2 = r;
+ break;
+ case EWL_COLOR_MODE_RGB_GREEN:
+ g2 = g;
+ break;
+ case EWL_COLOR_MODE_RGB_BLUE:
+ b2 = b;
+ break;
+ case EWL_COLOR_MODE_HSV_HUE:
+ h2 = h;
+ set_hsv = TRUE;
+ break;
+ case EWL_COLOR_MODE_HSV_SATURATION:
+ s2 = s;
+ set_hsv = TRUE;
+ break;
+ case EWL_COLOR_MODE_HSV_VALUE:
+ v2 = v;
+ set_hsv = TRUE;
+ break;
+ default:
+ break;
+ }
+
+ if (set_hsv == FALSE)
+ {
+ ewl_spectrum_rgb_set(EWL_SPECTRUM(cp->picker.square), r2, g2, b2);
+ ewl_spectrum_hsv_get(EWL_SPECTRUM(cp->picker.square), &h2, &s2, &v2);
+ }
+ else
+ {
+ ewl_spectrum_hsv_set(EWL_SPECTRUM(cp->picker.square), h2, s2, v2);
+ ewl_spectrum_rgb_get(EWL_SPECTRUM(cp->picker.square), &r2, &g2, &b2);
+ }
+ ewl_colorpicker_display_update(cp, r2, g2, b2, h2, s2, v2);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -661,73 +661,73 @@ ewl_colorpicker_cb_vertical_change(Ewl_Widget *w __UNUSED__,
void
ewl_colorpicker_cb_spinner_change(Ewl_Widget *w, void *ev __UNUSED__, void *data)
{
- Ewl_Colorpicker *cp;
- unsigned int r, g, b;
- double h, s, v;
- Ewl_Color_Mode mode;
- int set_hsv = FALSE;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(w, EWL_COLORPICKER_SPINNER_TYPE);
- DCHECK_TYPE(data, EWL_COLORPICKER_TYPE);
-
- cp = data;
- ewl_spectrum_rgb_get(EWL_SPECTRUM(cp->picker.square), &r, &g, &b);
- ewl_spectrum_hsv_get(EWL_SPECTRUM(cp->picker.vertical), &h, &s, &v);
-
- mode = ewl_colorpicker_spinner_mode_get(EWL_COLORPICKER_SPINNER(w));
- switch ((int)mode)
- {
- case EWL_COLOR_MODE_RGB_RED:
- r = ewl_range_value_get(EWL_RANGE(cp->spinners.rgb.r));
- break;
-
- case EWL_COLOR_MODE_RGB_GREEN:
- g = ewl_range_value_get(EWL_RANGE(cp->spinners.rgb.g));
- break;
-
- case EWL_COLOR_MODE_RGB_BLUE:
- b = ewl_range_value_get(EWL_RANGE(cp->spinners.rgb.b));
- break;
-
- case EWL_COLOR_MODE_HSV_HUE:
- h = ewl_range_value_get(EWL_RANGE(cp->spinners.hsv.h));
- set_hsv = TRUE;
- break;
-
- case EWL_COLOR_MODE_HSV_SATURATION:
- s = ewl_range_value_get(EWL_RANGE(cp->spinners.hsv.s)) / 100.0;
- set_hsv = TRUE;
- break;
-
- case EWL_COLOR_MODE_HSV_VALUE:
- v = ewl_range_value_get(EWL_RANGE(cp->spinners.hsv.v)) / 100.0;
- set_hsv = TRUE;
- break;
-
- default:
- break;
- }
-
- if (set_hsv)
- {
- ewl_spectrum_hsv_set(EWL_SPECTRUM(cp->picker.square), h, s, v);
- ewl_spectrum_hsv_set(EWL_SPECTRUM(cp->picker.vertical), h, s, v);
-
- ewl_spectrum_rgb_get(EWL_SPECTRUM(cp->picker.square), &r, &g, &b);
- }
- else
- {
- ewl_spectrum_rgb_set(EWL_SPECTRUM(cp->picker.square), r, g, b);
- ewl_spectrum_rgb_set(EWL_SPECTRUM(cp->picker.vertical), r, g, b);
-
- ewl_spectrum_hsv_get(EWL_SPECTRUM(cp->picker.square), &h, &s, &v);
- }
- ewl_colorpicker_display_update(cp, r, g, b, h, s, v);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Colorpicker *cp;
+ unsigned int r, g, b;
+ double h, s, v;
+ Ewl_Color_Mode mode;
+ int set_hsv = FALSE;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(w, EWL_COLORPICKER_SPINNER_TYPE);
+ DCHECK_TYPE(data, EWL_COLORPICKER_TYPE);
+
+ cp = data;
+ ewl_spectrum_rgb_get(EWL_SPECTRUM(cp->picker.square), &r, &g, &b);
+ ewl_spectrum_hsv_get(EWL_SPECTRUM(cp->picker.vertical), &h, &s, &v);
+
+ mode = ewl_colorpicker_spinner_mode_get(EWL_COLORPICKER_SPINNER(w));
+ switch ((int)mode)
+ {
+ case EWL_COLOR_MODE_RGB_RED:
+ r = ewl_range_value_get(EWL_RANGE(cp->spinners.rgb.r));
+ break;
+
+ case EWL_COLOR_MODE_RGB_GREEN:
+ g = ewl_range_value_get(EWL_RANGE(cp->spinners.rgb.g));
+ break;
+
+ case EWL_COLOR_MODE_RGB_BLUE:
+ b = ewl_range_value_get(EWL_RANGE(cp->spinners.rgb.b));
+ break;
+
+ case EWL_COLOR_MODE_HSV_HUE:
+ h = ewl_range_value_get(EWL_RANGE(cp->spinners.hsv.h));
+ set_hsv = TRUE;
+ break;
+
+ case EWL_COLOR_MODE_HSV_SATURATION:
+ s = ewl_range_value_get(EWL_RANGE(cp->spinners.hsv.s)) / 100.0;
+ set_hsv = TRUE;
+ break;
+
+ case EWL_COLOR_MODE_HSV_VALUE:
+ v = ewl_range_value_get(EWL_RANGE(cp->spinners.hsv.v)) / 100.0;
+ set_hsv = TRUE;
+ break;
+
+ default:
+ break;
+ }
+
+ if (set_hsv)
+ {
+ ewl_spectrum_hsv_set(EWL_SPECTRUM(cp->picker.square), h, s, v);
+ ewl_spectrum_hsv_set(EWL_SPECTRUM(cp->picker.vertical), h, s, v);
+
+ ewl_spectrum_rgb_get(EWL_SPECTRUM(cp->picker.square), &r, &g, &b);
+ }
+ else
+ {
+ ewl_spectrum_rgb_set(EWL_SPECTRUM(cp->picker.square), r, g, b);
+ ewl_spectrum_rgb_set(EWL_SPECTRUM(cp->picker.vertical), r, g, b);
+
+ ewl_spectrum_hsv_get(EWL_SPECTRUM(cp->picker.square), &h, &s, &v);
+ }
+ ewl_colorpicker_display_update(cp, r, g, b, h, s, v);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -741,24 +741,24 @@ ewl_colorpicker_cb_spinner_change(Ewl_Widget *w, void *ev __UNUSED__, void *data
void
ewl_colorpicker_cb_alpha_change(Ewl_Widget *w, void *ev __UNUSED__, void *data)
{
- Ewl_Colorpicker *cp;
- unsigned int r, g, b, a;
+ Ewl_Colorpicker *cp;
+ unsigned int r, g, b, a;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(w, EWL_SPINNER_TYPE);
- DCHECK_TYPE(data, EWL_COLORPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(w, EWL_SPINNER_TYPE);
+ DCHECK_TYPE(data, EWL_COLORPICKER_TYPE);
- cp = data;
- r = ewl_range_value_get(EWL_RANGE(cp->spinners.rgb.r));
- g = ewl_range_value_get(EWL_RANGE(cp->spinners.rgb.g));
- b = ewl_range_value_get(EWL_RANGE(cp->spinners.rgb.b));
- a = ewl_range_value_get(EWL_RANGE(w));
+ cp = data;
+ r = ewl_range_value_get(EWL_RANGE(cp->spinners.rgb.r));
+ g = ewl_range_value_get(EWL_RANGE(cp->spinners.rgb.g));
+ b = ewl_range_value_get(EWL_RANGE(cp->spinners.rgb.b));
+ a = ewl_range_value_get(EWL_RANGE(w));
- ewl_widget_color_set(cp->preview.current, r, g, b, a);
+ ewl_widget_color_set(cp->preview.current, r, g, b, a);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -772,21 +772,21 @@ ewl_colorpicker_cb_alpha_change(Ewl_Widget *w, void *ev __UNUSED__, void *data)
void
ewl_colorpicker_cb_radio_change(Ewl_Widget *w, void *ev __UNUSED__, void *data)
{
- Ewl_Colorpicker *cp;
+ Ewl_Colorpicker *cp;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(w, EWL_COLORPICKER_RADIOBUTTON_TYPE);
- DCHECK_TYPE(data, EWL_COLORPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(w, EWL_COLORPICKER_RADIOBUTTON_TYPE);
+ DCHECK_TYPE(data, EWL_COLORPICKER_TYPE);
- cp = data;
- cp->mode = ewl_colorpicker_radiobutton_mode_get(EWL_COLORPICKER_RADIOBUTTON(w));
+ cp = data;
+ cp->mode = ewl_colorpicker_radiobutton_mode_get(EWL_COLORPICKER_RADIOBUTTON(w));
- ewl_spectrum_mode_set(EWL_SPECTRUM(cp->picker.square), cp->mode);
- ewl_spectrum_mode_set(EWL_SPECTRUM(cp->picker.vertical), cp->mode);
+ ewl_spectrum_mode_set(EWL_SPECTRUM(cp->picker.square), cp->mode);
+ ewl_spectrum_mode_set(EWL_SPECTRUM(cp->picker.vertical), cp->mode);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -799,19 +799,19 @@ ewl_colorpicker_cb_radio_change(Ewl_Widget *w, void *ev __UNUSED__, void *data)
*/
void
ewl_colorpicker_cb_previous_clicked(Ewl_Widget *w __UNUSED__,
- void *ev __UNUSED__, void *data)
+ void *ev __UNUSED__, void *data)
{
- Ewl_Colorpicker *cp;
+ Ewl_Colorpicker *cp;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_COLORPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_COLORPICKER_TYPE);
- cp = data;
- ewl_colorpicker_current_rgb_set(cp, cp->previous.r, cp->previous.g,
- cp->previous.b);
+ cp = data;
+ ewl_colorpicker_current_rgb_set(cp, cp->previous.r, cp->previous.g,
+ cp->previous.b);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -824,190 +824,190 @@ ewl_colorpicker_cb_previous_clicked(Ewl_Widget *w __UNUSED__,
*/
void
ewl_colorpicker_cb_dnd_data(Ewl_Widget *w, void *ev,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- unsigned int i;
- unsigned int curcolors[4];
- Ewl_Colorpicker *cp = EWL_COLORPICKER(w);
- Ewl_Event_Dnd_Data_Received *event = ev;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(ev);
- DCHECK_TYPE(w, EWL_COLORPICKER_TYPE);
-
- ewl_colorpicker_current_rgb_get(cp, &curcolors[0], &curcolors[1],
- &curcolors[2]);
- curcolors[3] = ewl_colorpicker_alpha_get(cp);
-
- if (event->format == 32) {
- unsigned long *colors;
- colors = event->data;
- for (i = 0; i < event->len && i < 4; i++)
- curcolors[i] = colors[i] >> ((sizeof(long) * 8) - 8);
- }
- else if (event->format == 16) {
- unsigned short *colors;
- colors = event->data;
- for (i = 0; i < event->len && i < 4; i++)
- curcolors[i] = colors[i] >> 8;
- }
- else {
- unsigned char *colors;
- colors = event->data;
- for (i = 0; i < event->len && i < 4; i++)
- curcolors[i] = colors[i];
- }
-
- ewl_colorpicker_current_rgb_set(cp, curcolors[0], curcolors[1],
- curcolors[2]);
- ewl_colorpicker_alpha_set(cp, curcolors[3]);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ unsigned int i;
+ unsigned int curcolors[4];
+ Ewl_Colorpicker *cp = EWL_COLORPICKER(w);
+ Ewl_Event_Dnd_Data_Received *event = ev;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(ev);
+ DCHECK_TYPE(w, EWL_COLORPICKER_TYPE);
+
+ ewl_colorpicker_current_rgb_get(cp, &curcolors[0], &curcolors[1],
+ &curcolors[2]);
+ curcolors[3] = ewl_colorpicker_alpha_get(cp);
+
+ if (event->format == 32) {
+ unsigned long *colors;
+ colors = event->data;
+ for (i = 0; i < event->len && i < 4; i++)
+ curcolors[i] = colors[i] >> ((sizeof(long) * 8) - 8);
+ }
+ else if (event->format == 16) {
+ unsigned short *colors;
+ colors = event->data;
+ for (i = 0; i < event->len && i < 4; i++)
+ curcolors[i] = colors[i] >> 8;
+ }
+ else {
+ unsigned char *colors;
+ colors = event->data;
+ for (i = 0; i < event->len && i < 4; i++)
+ curcolors[i] = colors[i];
+ }
+
+ ewl_colorpicker_current_rgb_set(cp, curcolors[0], curcolors[1],
+ curcolors[2]);
+ ewl_colorpicker_alpha_set(cp, curcolors[3]);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_colorpicker_display_update(Ewl_Colorpicker *cp, unsigned int r, unsigned int g,
- unsigned int b, double h, double s, double v)
+ unsigned int b, double h, double s, double v)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cp);
- DCHECK_TYPE(cp, EWL_COLORPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cp);
+ DCHECK_TYPE(cp, EWL_COLORPICKER_TYPE);
- if (cp->updating)
- DRETURN(DLEVEL_STABLE);
+ if (cp->updating)
+ DRETURN(DLEVEL_STABLE);
- cp->updating = TRUE;
+ cp->updating = TRUE;
- ewl_range_value_set(EWL_RANGE(cp->spinners.rgb.r), r);
- ewl_range_value_set(EWL_RANGE(cp->spinners.rgb.g), g);
- ewl_range_value_set(EWL_RANGE(cp->spinners.rgb.b), b);
+ ewl_range_value_set(EWL_RANGE(cp->spinners.rgb.r), r);
+ ewl_range_value_set(EWL_RANGE(cp->spinners.rgb.g), g);
+ ewl_range_value_set(EWL_RANGE(cp->spinners.rgb.b), b);
- ewl_range_value_set(EWL_RANGE(cp->spinners.hsv.h), h);
- ewl_range_value_set(EWL_RANGE(cp->spinners.hsv.s), s * 100);
- ewl_range_value_set(EWL_RANGE(cp->spinners.hsv.v), v * 100);
+ ewl_range_value_set(EWL_RANGE(cp->spinners.hsv.h), h);
+ ewl_range_value_set(EWL_RANGE(cp->spinners.hsv.s), s * 100);
+ ewl_range_value_set(EWL_RANGE(cp->spinners.hsv.v), v * 100);
- ewl_widget_color_set(cp->preview.current, r, g, b,
- ewl_range_value_get(EWL_RANGE(cp->spinners.alpha)));
- ewl_callback_call(EWL_WIDGET(cp), EWL_CALLBACK_VALUE_CHANGED);
+ ewl_widget_color_set(cp->preview.current, r, g, b,
+ ewl_range_value_get(EWL_RANGE(cp->spinners.alpha)));
+ ewl_callback_call(EWL_WIDGET(cp), EWL_CALLBACK_VALUE_CHANGED);
- cp->updating = FALSE;
+ cp->updating = FALSE;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static Ewl_Widget *
ewl_colorpicker_spinner_new(void)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- w = NEW(Ewl_Colorpicker_Spinner, 1);
- if (!w)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ w = NEW(Ewl_Colorpicker_Spinner, 1);
+ if (!w)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_colorpicker_spinner_init(EWL_COLORPICKER_SPINNER(w)))
- {
- ewl_widget_destroy(w);
- w = NULL;
- }
+ if (!ewl_colorpicker_spinner_init(EWL_COLORPICKER_SPINNER(w)))
+ {
+ ewl_widget_destroy(w);
+ w = NULL;
+ }
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
static int
ewl_colorpicker_spinner_init(Ewl_Colorpicker_Spinner *sp)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- if (!ewl_spinner_init(EWL_SPINNER(sp)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_spinner_init(EWL_SPINNER(sp)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_inherit(EWL_WIDGET(sp), EWL_COLORPICKER_SPINNER_TYPE);
- sp->mode = EWL_COLOR_MODE_RGB_RED;
+ ewl_widget_inherit(EWL_WIDGET(sp), EWL_COLORPICKER_SPINNER_TYPE);
+ sp->mode = EWL_COLOR_MODE_RGB_RED;
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static void
ewl_colorpicker_spinner_mode_set(Ewl_Colorpicker_Spinner *sp,
- Ewl_Color_Mode mode)
+ Ewl_Color_Mode mode)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sp);
- DCHECK_TYPE(sp, EWL_COLORPICKER_SPINNER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sp);
+ DCHECK_TYPE(sp, EWL_COLORPICKER_SPINNER_TYPE);
- sp->mode = mode;
+ sp->mode = mode;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static Ewl_Color_Mode
ewl_colorpicker_spinner_mode_get(Ewl_Colorpicker_Spinner *sp)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(sp, EWL_COLOR_MODE_RGB_RED);
- DCHECK_TYPE_RET(sp, EWL_COLORPICKER_SPINNER_TYPE,
- EWL_COLOR_MODE_RGB_RED);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(sp, EWL_COLOR_MODE_RGB_RED);
+ DCHECK_TYPE_RET(sp, EWL_COLORPICKER_SPINNER_TYPE,
+ EWL_COLOR_MODE_RGB_RED);
- DRETURN_INT(sp->mode, DLEVEL_STABLE);
+ DRETURN_INT(sp->mode, DLEVEL_STABLE);
}
static Ewl_Widget *
ewl_colorpicker_radiobutton_new(void)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- w = NEW(Ewl_Colorpicker_Radiobutton, 1);
- if (!w)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ w = NEW(Ewl_Colorpicker_Radiobutton, 1);
+ if (!w)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_colorpicker_radiobutton_init(EWL_COLORPICKER_RADIOBUTTON(w)))
- {
- ewl_widget_destroy(w);
- w = NULL;
- }
+ if (!ewl_colorpicker_radiobutton_init(EWL_COLORPICKER_RADIOBUTTON(w)))
+ {
+ ewl_widget_destroy(w);
+ w = NULL;
+ }
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
static int
ewl_colorpicker_radiobutton_init(Ewl_Colorpicker_Radiobutton *rb)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- if (!ewl_radiobutton_init(EWL_RADIOBUTTON(rb)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_radiobutton_init(EWL_RADIOBUTTON(rb)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_inherit(EWL_WIDGET(rb), EWL_COLORPICKER_RADIOBUTTON_TYPE);
- rb->mode = EWL_COLOR_MODE_RGB_RED;
+ ewl_widget_inherit(EWL_WIDGET(rb), EWL_COLORPICKER_RADIOBUTTON_TYPE);
+ rb->mode = EWL_COLOR_MODE_RGB_RED;
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static void
ewl_colorpicker_radiobutton_mode_set(Ewl_Colorpicker_Radiobutton *rb,
- Ewl_Color_Mode mode)
+ Ewl_Color_Mode mode)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(rb);
- DCHECK_TYPE(rb, EWL_COLORPICKER_RADIOBUTTON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(rb);
+ DCHECK_TYPE(rb, EWL_COLORPICKER_RADIOBUTTON_TYPE);
- rb->mode = mode;
+ rb->mode = mode;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static Ewl_Color_Mode
ewl_colorpicker_radiobutton_mode_get(Ewl_Colorpicker_Radiobutton *rb)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(rb, EWL_COLOR_MODE_RGB_RED);
- DCHECK_TYPE_RET(rb, EWL_COLORPICKER_RADIOBUTTON_TYPE,
- EWL_COLOR_MODE_RGB_RED);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(rb, EWL_COLOR_MODE_RGB_RED);
+ DCHECK_TYPE_RET(rb, EWL_COLORPICKER_RADIOBUTTON_TYPE,
+ EWL_COLOR_MODE_RGB_RED);
- DRETURN_INT(rb->mode, DLEVEL_STABLE);
+ DRETURN_INT(rb->mode, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_colorpicker.h b/src/lib/ewl_colorpicker.h
index 41fc40c..8ffe784 100644
--- a/src/lib/ewl_colorpicker.h
+++ b/src/lib/ewl_colorpicker.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_COLORPICKER_H
#define EWL_COLORPICKER_H
@@ -43,70 +43,70 @@ typedef struct Ewl_Colorpicker Ewl_Colorpicker;
*/
struct Ewl_Colorpicker
{
- Ewl_Box box; /**< Inherit from Ewl_Box */
- struct
- {
- Ewl_Widget *square; /**< The square picker box */
- Ewl_Widget *vertical; /**< The vertical picker box */
- } picker; /**< This holds the two picker boxes */
-
- struct
- {
- Ewl_Widget *current; /**< The current colour preview */
- Ewl_Widget *previous; /**< The previous colour preview */
- } preview; /**< The preview boxes */
-
- struct
- {
- struct
- {
- Ewl_Widget *r; /**< The red value */
- Ewl_Widget *g; /**< The green value */
- Ewl_Widget *b; /**< The blue value */
- } rgb; /**< The pickers RGB values */
-
- struct
- {
- Ewl_Widget *h; /**< The current hue */
- Ewl_Widget *s; /**< The current saturation */
- Ewl_Widget *v; /**< The current value */
- } hsv; /**< The pickers HSV values */
-
- Ewl_Widget *alpha; /**< The alpha value */
- } spinners; /**< The spinners to hold the different values */
-
- Ewl_Widget *alpha_box; /**< Box holding alpha information */
-
- Ewl_Color_Set previous; /**< The previous color */
- Ewl_Color_Mode mode; /**< The current mode */
-
- unsigned int has_alpha:1; /**< Does the picker deal with alpha values */
- unsigned int updating:1; /**< Are we currently updating the widget */
+ Ewl_Box box; /**< Inherit from Ewl_Box */
+ struct
+ {
+ Ewl_Widget *square; /**< The square picker box */
+ Ewl_Widget *vertical; /**< The vertical picker box */
+ } picker; /**< This holds the two picker boxes */
+
+ struct
+ {
+ Ewl_Widget *current; /**< The current colour preview */
+ Ewl_Widget *previous; /**< The previous colour preview */
+ } preview; /**< The preview boxes */
+
+ struct
+ {
+ struct
+ {
+ Ewl_Widget *r; /**< The red value */
+ Ewl_Widget *g; /**< The green value */
+ Ewl_Widget *b; /**< The blue value */
+ } rgb; /**< The pickers RGB values */
+
+ struct
+ {
+ Ewl_Widget *h; /**< The current hue */
+ Ewl_Widget *s; /**< The current saturation */
+ Ewl_Widget *v; /**< The current value */
+ } hsv; /**< The pickers HSV values */
+
+ Ewl_Widget *alpha; /**< The alpha value */
+ } spinners; /**< The spinners to hold the different values */
+
+ Ewl_Widget *alpha_box; /**< Box holding alpha information */
+
+ Ewl_Color_Set previous; /**< The previous color */
+ Ewl_Color_Mode mode; /**< The current mode */
+
+ unsigned int has_alpha:1; /**< Does the picker deal with alpha values */
+ unsigned int updating:1; /**< Are we currently updating the widget */
};
-Ewl_Widget *ewl_colorpicker_new(void);
-int ewl_colorpicker_init(Ewl_Colorpicker *cp);
+Ewl_Widget *ewl_colorpicker_new(void);
+int ewl_colorpicker_init(Ewl_Colorpicker *cp);
-void ewl_colorpicker_has_alpha_set(Ewl_Colorpicker *cp, unsigned int alpha);
-unsigned int ewl_colorpicker_has_alpha_get(Ewl_Colorpicker *cp);
+void ewl_colorpicker_has_alpha_set(Ewl_Colorpicker *cp, unsigned int alpha);
+unsigned int ewl_colorpicker_has_alpha_get(Ewl_Colorpicker *cp);
-void ewl_colorpicker_alpha_set(Ewl_Colorpicker *cp, unsigned int alpha);
-unsigned int ewl_colorpicker_alpha_get(Ewl_Colorpicker *cp);
+void ewl_colorpicker_alpha_set(Ewl_Colorpicker *cp, unsigned int alpha);
+unsigned int ewl_colorpicker_alpha_get(Ewl_Colorpicker *cp);
-void ewl_colorpicker_current_rgb_set(Ewl_Colorpicker *cp, unsigned int r,
- unsigned int g, unsigned int b);
-void ewl_colorpicker_current_rgb_get(Ewl_Colorpicker *cp, unsigned int *r,
- unsigned int *g, unsigned int *b);
+void ewl_colorpicker_current_rgb_set(Ewl_Colorpicker *cp, unsigned int r,
+ unsigned int g, unsigned int b);
+void ewl_colorpicker_current_rgb_get(Ewl_Colorpicker *cp, unsigned int *r,
+ unsigned int *g, unsigned int *b);
-void ewl_colorpicker_previous_rgba_set(Ewl_Colorpicker *cp, unsigned int r,
- unsigned int g, unsigned int b,
- unsigned int a);
-void ewl_colorpicker_previous_rgba_get(Ewl_Colorpicker *cp, unsigned int *r,
- unsigned int *g, unsigned int *b,
- unsigned int *a);
+void ewl_colorpicker_previous_rgba_set(Ewl_Colorpicker *cp, unsigned int r,
+ unsigned int g, unsigned int b,
+ unsigned int a);
+void ewl_colorpicker_previous_rgba_get(Ewl_Colorpicker *cp, unsigned int *r,
+ unsigned int *g, unsigned int *b,
+ unsigned int *a);
-void ewl_colorpicker_color_mode_set(Ewl_Colorpicker *cp, Ewl_Color_Mode type);
-Ewl_Color_Mode ewl_colorpicker_color_mode_get(Ewl_Colorpicker *cp);
+void ewl_colorpicker_color_mode_set(Ewl_Colorpicker *cp, Ewl_Color_Mode type);
+Ewl_Color_Mode ewl_colorpicker_color_mode_get(Ewl_Colorpicker *cp);
/*
* * internally used callbacks, override at your own risk.
diff --git a/src/lib/ewl_combo.c b/src/lib/ewl_combo.c
index 363a761..bbbfeb9 100644
--- a/src/lib/ewl_combo.c
+++ b/src/lib/ewl_combo.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_combo.h"
#include "ewl_button.h"
@@ -12,10 +12,10 @@
static void ewl_combo_cb_selected_change(Ewl_MVC *mvc);
Ewl_Widget *ewl_combo_submenu_new(Ewl_Combo *c, const Ewl_Model *model,
- const Ewl_View *view, void *mvc_data);
+ const Ewl_View *view, void *mvc_data);
static void ewl_combo_popup_fill(Ewl_Combo *combo, Ewl_Container *c,
- const Ewl_Model *model, const Ewl_View *view,
- void *mvc_data);
+ const Ewl_Model *model, const Ewl_View *view,
+ void *mvc_data);
/**
* @return Returns a pointer to a new combo on success, NULL on failure.
@@ -24,21 +24,21 @@ static void ewl_combo_popup_fill(Ewl_Combo *combo, Ewl_Container *c,
Ewl_Widget *
ewl_combo_new(void)
{
- Ewl_Combo *combo;
+ Ewl_Combo *combo;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- combo = NEW(Ewl_Combo, 1);
- if (!combo)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ combo = NEW(Ewl_Combo, 1);
+ if (!combo)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_combo_init(combo))
- {
- ewl_widget_destroy(EWL_WIDGET(combo));
- combo = NULL;
- }
+ if (!ewl_combo_init(combo))
+ {
+ ewl_widget_destroy(EWL_WIDGET(combo));
+ combo = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(combo), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(combo), DLEVEL_STABLE);
}
/**
@@ -49,48 +49,48 @@ ewl_combo_new(void)
int
ewl_combo_init(Ewl_Combo *combo)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(combo, FALSE);
-
- if (!ewl_mvc_init(EWL_MVC(combo)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- ewl_widget_inherit(EWL_WIDGET(combo), EWL_COMBO_TYPE);
- ewl_widget_appearance_set(EWL_WIDGET(combo), EWL_COMBO_TYPE);
- ewl_box_orientation_set(EWL_BOX(combo), EWL_ORIENTATION_HORIZONTAL);
- ewl_mvc_selected_change_cb_set(EWL_MVC(combo),
- ewl_combo_cb_selected_change);
-
- combo->button = ewl_button_new();
- ewl_container_child_append(EWL_CONTAINER(combo), combo->button);
- ewl_widget_internal_set(combo->button, TRUE);
- ewl_object_alignment_set(EWL_OBJECT(combo->button),
- EWL_FLAG_ALIGN_RIGHT);
- ewl_callback_append(combo->button, EWL_CALLBACK_CLICKED,
- ewl_combo_cb_decrement_clicked, combo);
- ewl_widget_show(combo->button);
-
- /*
- * setup the popup
- */
- combo->popup = ewl_context_menu_new();
- ewl_popup_follow_set(EWL_POPUP(combo->popup), EWL_WIDGET(combo));
- ewl_popup_type_set(EWL_POPUP(combo->popup),
- EWL_POPUP_TYPE_MENU_VERTICAL);
- ewl_popup_fit_to_follow_set(EWL_POPUP(combo->popup), TRUE);
- ewl_window_keyboard_grab_set(EWL_WINDOW(combo->popup), TRUE);
- ewl_window_pointer_grab_set(EWL_WINDOW(combo->popup), TRUE);
- ewl_widget_appearance_set(combo->popup, EWL_COMBO_TYPE
- "/"EWL_POPUP_TYPE);
- ewl_object_fill_policy_set(EWL_OBJECT(combo->popup),
- EWL_FLAG_FILL_HFILL
- | EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(combo->popup),
- EWL_FLAG_ALIGN_LEFT | EWL_FLAG_ALIGN_TOP);
- ewl_callback_append(combo->popup, EWL_CALLBACK_HIDE,
- ewl_combo_cb_popup_hide, combo);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(combo, FALSE);
+
+ if (!ewl_mvc_init(EWL_MVC(combo)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ ewl_widget_inherit(EWL_WIDGET(combo), EWL_COMBO_TYPE);
+ ewl_widget_appearance_set(EWL_WIDGET(combo), EWL_COMBO_TYPE);
+ ewl_box_orientation_set(EWL_BOX(combo), EWL_ORIENTATION_HORIZONTAL);
+ ewl_mvc_selected_change_cb_set(EWL_MVC(combo),
+ ewl_combo_cb_selected_change);
+
+ combo->button = ewl_button_new();
+ ewl_container_child_append(EWL_CONTAINER(combo), combo->button);
+ ewl_widget_internal_set(combo->button, TRUE);
+ ewl_object_alignment_set(EWL_OBJECT(combo->button),
+ EWL_FLAG_ALIGN_RIGHT);
+ ewl_callback_append(combo->button, EWL_CALLBACK_CLICKED,
+ ewl_combo_cb_decrement_clicked, combo);
+ ewl_widget_show(combo->button);
+
+ /*
+ * setup the popup
+ */
+ combo->popup = ewl_context_menu_new();
+ ewl_popup_follow_set(EWL_POPUP(combo->popup), EWL_WIDGET(combo));
+ ewl_popup_type_set(EWL_POPUP(combo->popup),
+ EWL_POPUP_TYPE_MENU_VERTICAL);
+ ewl_popup_fit_to_follow_set(EWL_POPUP(combo->popup), TRUE);
+ ewl_window_keyboard_grab_set(EWL_WINDOW(combo->popup), TRUE);
+ ewl_window_pointer_grab_set(EWL_WINDOW(combo->popup), TRUE);
+ ewl_widget_appearance_set(combo->popup, EWL_COMBO_TYPE
+ "/"EWL_POPUP_TYPE);
+ ewl_object_fill_policy_set(EWL_OBJECT(combo->popup),
+ EWL_FLAG_FILL_HFILL
+ | EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(combo->popup),
+ EWL_FLAG_ALIGN_LEFT | EWL_FLAG_ALIGN_TOP);
+ ewl_callback_append(combo->popup, EWL_CALLBACK_HIDE,
+ ewl_combo_cb_popup_hide, combo);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -106,19 +106,19 @@ ewl_combo_init(Ewl_Combo *combo)
void
ewl_combo_editable_set(Ewl_Combo *combo, unsigned int editable)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(combo);
- DCHECK_TYPE(combo, EWL_COMBO_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(combo);
+ DCHECK_TYPE(combo, EWL_COMBO_TYPE);
- if (combo->editable == !!editable)
- DRETURN(DLEVEL_STABLE);
+ if (combo->editable == !!editable)
+ DRETURN(DLEVEL_STABLE);
- combo->editable = !!editable;
+ combo->editable = !!editable;
- /* force the selected display to change */
- ewl_combo_cb_selected_change(EWL_MVC(combo));
+ /* force the selected display to change */
+ ewl_combo_cb_selected_change(EWL_MVC(combo));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -129,11 +129,11 @@ ewl_combo_editable_set(Ewl_Combo *combo, unsigned int editable)
unsigned int
ewl_combo_editable_get(Ewl_Combo *combo)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(combo, FALSE);
- DCHECK_TYPE_RET(combo, EWL_COMBO_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(combo, FALSE);
+ DCHECK_TYPE_RET(combo, EWL_COMBO_TYPE, FALSE);
- DRETURN_INT(combo->editable, DLEVEL_STABLE);
+ DRETURN_INT(combo->editable, DLEVEL_STABLE);
}
/**
@@ -148,42 +148,42 @@ ewl_combo_editable_get(Ewl_Combo *combo)
void
ewl_combo_scrollable_set(Ewl_Combo *combo, unsigned int scrollable)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(combo);
- DCHECK_TYPE(combo, EWL_COMBO_TYPE);
-
- if (combo->scrollable == !!scrollable)
- DRETURN(DLEVEL_STABLE);
-
- combo->scrollable = !!scrollable;
-
- if (scrollable) {
- Ewl_Widget *scroll;
- int max_h;
-
- max_h = ewl_theme_data_int_get(EWL_WIDGET(combo),
- "/combo/popup/height");
- /* set it to sane values if it isn't defined in the theme */
- if (max_h <= 0)
- max_h = 100;
-
- /* setup the new scrollpane container */
- scroll = ewl_scrollpane_new();
- ewl_object_fill_policy_set(EWL_OBJECT(scroll),
- EWL_FLAG_FILL_HFILL
- | EWL_FLAG_FILL_SHRINK);
- ewl_object_maximum_h_set(EWL_OBJECT(scroll), max_h);
- ewl_widget_show(scroll);
-
- ewl_context_menu_container_set(EWL_CONTEXT_MENU(combo->popup),
- EWL_CONTAINER(scroll));
- }
- else
- ewl_context_menu_container_set(EWL_CONTEXT_MENU(combo->popup),
- NULL);
-
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(combo);
+ DCHECK_TYPE(combo, EWL_COMBO_TYPE);
+
+ if (combo->scrollable == !!scrollable)
+ DRETURN(DLEVEL_STABLE);
+
+ combo->scrollable = !!scrollable;
+
+ if (scrollable) {
+ Ewl_Widget *scroll;
+ int max_h;
+
+ max_h = ewl_theme_data_int_get(EWL_WIDGET(combo),
+ "/combo/popup/height");
+ /* set it to sane values if it isn't defined in the theme */
+ if (max_h <= 0)
+ max_h = 100;
+
+ /* setup the new scrollpane container */
+ scroll = ewl_scrollpane_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(scroll),
+ EWL_FLAG_FILL_HFILL
+ | EWL_FLAG_FILL_SHRINK);
+ ewl_object_maximum_h_set(EWL_OBJECT(scroll), max_h);
+ ewl_widget_show(scroll);
+
+ ewl_context_menu_container_set(EWL_CONTEXT_MENU(combo->popup),
+ EWL_CONTAINER(scroll));
+ }
+ else
+ ewl_context_menu_container_set(EWL_CONTEXT_MENU(combo->popup),
+ NULL);
+
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -194,11 +194,11 @@ ewl_combo_scrollable_set(Ewl_Combo *combo, unsigned int scrollable)
unsigned int
ewl_combo_scrollable_get(Ewl_Combo *combo)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(combo, FALSE);
- DCHECK_TYPE_RET(combo, EWL_COMBO_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(combo, FALSE);
+ DCHECK_TYPE_RET(combo, EWL_COMBO_TYPE, FALSE);
- DRETURN_INT(combo->scrollable, DLEVEL_STABLE);
+ DRETURN_INT(combo->scrollable, DLEVEL_STABLE);
}
/**
@@ -209,15 +209,15 @@ ewl_combo_scrollable_get(Ewl_Combo *combo)
void
ewl_combo_popup_container_set(Ewl_Combo *combo, Ewl_Container *c)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(combo);
- DCHECK_TYPE(combo, EWL_COMBO_TYPE);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(combo);
+ DCHECK_TYPE(combo, EWL_COMBO_TYPE);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- combo->scrollable = FALSE;
- ewl_context_menu_container_set(EWL_CONTEXT_MENU(combo->popup), c);
+ combo->scrollable = FALSE;
+ ewl_context_menu_container_set(EWL_CONTEXT_MENU(combo->popup), c);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -230,46 +230,46 @@ ewl_combo_popup_container_set(Ewl_Combo *combo, Ewl_Container *c)
*/
void
ewl_combo_cb_decrement_clicked(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Combo *combo;
- const Ewl_Model *model;
- const Ewl_View *view;
- void *mvc_data;
+ Ewl_Combo *combo;
+ const Ewl_Model *model;
+ const Ewl_View *view;
+ void *mvc_data;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_COMBO_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_COMBO_TYPE);
- combo = data;
- model = ewl_mvc_model_get(EWL_MVC(combo));
- view = ewl_mvc_view_get(EWL_MVC(combo));
- mvc_data = ewl_mvc_data_get(EWL_MVC(combo));
+ combo = data;
+ model = ewl_mvc_model_get(EWL_MVC(combo));
+ view = ewl_mvc_view_get(EWL_MVC(combo));
+ mvc_data = ewl_mvc_data_get(EWL_MVC(combo));
- /* nothing to do if we have no model or view
- * Note that mvc_data == NULL is legal */
- if (!model || !view)
- DRETURN(DLEVEL_STABLE);
+ /* nothing to do if we have no model or view
+ * Note that mvc_data == NULL is legal */
+ if (!model || !view)
+ DRETURN(DLEVEL_STABLE);
- ewl_widget_show(combo->popup);
- ewl_window_raise(EWL_WINDOW(combo->popup));
- ewl_widget_focus_send(EWL_WIDGET(combo->popup));
+ ewl_widget_show(combo->popup);
+ ewl_window_raise(EWL_WINDOW(combo->popup));
+ ewl_widget_focus_send(EWL_WIDGET(combo->popup));
- ewl_widget_state_set(combo->button, "expanded",
- EWL_STATE_PERSISTENT);
- ewl_widget_state_set(EWL_WIDGET(combo), "expanded",
- EWL_STATE_PERSISTENT);
+ ewl_widget_state_set(combo->button, "expanded",
+ EWL_STATE_PERSISTENT);
+ ewl_widget_state_set(EWL_WIDGET(combo), "expanded",
+ EWL_STATE_PERSISTENT);
- if (!ewl_mvc_dirty_get(EWL_MVC(combo)))
- DRETURN(DLEVEL_STABLE);
+ if (!ewl_mvc_dirty_get(EWL_MVC(combo)))
+ DRETURN(DLEVEL_STABLE);
- ewl_container_reset(EWL_CONTAINER(combo->popup));
- ewl_combo_popup_fill(combo, EWL_CONTAINER(combo->popup),
- model, view, mvc_data);
+ ewl_container_reset(EWL_CONTAINER(combo->popup));
+ ewl_combo_popup_fill(combo, EWL_CONTAINER(combo->popup),
+ model, view, mvc_data);
- ewl_mvc_dirty_set(EWL_MVC(combo), FALSE);
+ ewl_mvc_dirty_set(EWL_MVC(combo), FALSE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -282,96 +282,96 @@ ewl_combo_cb_decrement_clicked(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
*/
void
ewl_combo_cb_popup_hide(Ewl_Widget *w __UNUSED__,
- void *ev __UNUSED__, void *data)
+ void *ev __UNUSED__, void *data)
{
- Ewl_Combo *combo;
+ Ewl_Combo *combo;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_COMBO_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_COMBO_TYPE);
- combo = EWL_COMBO(data);
- ewl_widget_state_set(combo->button, "collapsed", EWL_STATE_PERSISTENT);
- ewl_widget_state_set(EWL_WIDGET(combo), "collapsed",
- EWL_STATE_PERSISTENT);
+ combo = EWL_COMBO(data);
+ ewl_widget_state_set(combo->button, "collapsed", EWL_STATE_PERSISTENT);
+ ewl_widget_state_set(EWL_WIDGET(combo), "collapsed",
+ EWL_STATE_PERSISTENT);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_combo_cb_selected_change(Ewl_MVC *mvc)
{
- const Ewl_View *view;
- Ewl_Combo *combo;
- Ewl_Widget *item = NULL;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(mvc);
- DCHECK_TYPE(mvc, EWL_COMBO_TYPE);
-
- combo = EWL_COMBO(mvc);
- view = ewl_mvc_view_get(mvc);
-
- if (!ewl_mvc_data_get(mvc))
- DRETURN(DLEVEL_STABLE);
-
- /*
- * if we haven't already build a cell for the header, build it
- * now
- */
- if (!combo->header) {
- combo->header = ewl_cell_new();
- ewl_container_child_prepend(EWL_CONTAINER(combo),
- combo->header);
- ewl_object_fill_policy_set(EWL_OBJECT(combo->header),
- EWL_FLAG_FILL_FILL);
- ewl_widget_show(combo->header);
- }
- else
- ewl_container_reset(EWL_CONTAINER(combo->header));
-
- if (ewl_mvc_selected_count_get(mvc))
- {
- Ewl_Selection_Idx *idx;
- const Ewl_Model *model;
- void *mvc_data;
-
- idx = ewl_mvc_selected_get(mvc);
- model = idx->sel.model;
- mvc_data = idx->sel.data;
-
- if (combo->editable)
- {
- /* Give the row selected in the column parameter,
- * ewl_filepicker needs this to display proper filter
- */
-
- item = view->header_fetch(ewl_mvc_data_get(mvc),
- idx->row);
- }
-
- else
- {
-
-
- item = view->fetch(model->fetch(mvc_data, idx->row, 0),
- idx->row, 0);
- }
-
- FREE(idx);
- }
-
- else if (view && view->header_fetch)
- item = view->header_fetch(ewl_mvc_data_get(mvc), 0);
-
- if (item)
- {
- ewl_container_child_prepend(EWL_CONTAINER(combo->header), item);
- ewl_widget_show(item);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ const Ewl_View *view;
+ Ewl_Combo *combo;
+ Ewl_Widget *item = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(mvc);
+ DCHECK_TYPE(mvc, EWL_COMBO_TYPE);
+
+ combo = EWL_COMBO(mvc);
+ view = ewl_mvc_view_get(mvc);
+
+ if (!ewl_mvc_data_get(mvc))
+ DRETURN(DLEVEL_STABLE);
+
+ /*
+ * if we haven't already build a cell for the header, build it
+ * now
+ */
+ if (!combo->header) {
+ combo->header = ewl_cell_new();
+ ewl_container_child_prepend(EWL_CONTAINER(combo),
+ combo->header);
+ ewl_object_fill_policy_set(EWL_OBJECT(combo->header),
+ EWL_FLAG_FILL_FILL);
+ ewl_widget_show(combo->header);
+ }
+ else
+ ewl_container_reset(EWL_CONTAINER(combo->header));
+
+ if (ewl_mvc_selected_count_get(mvc))
+ {
+ Ewl_Selection_Idx *idx;
+ const Ewl_Model *model;
+ void *mvc_data;
+
+ idx = ewl_mvc_selected_get(mvc);
+ model = idx->sel.model;
+ mvc_data = idx->sel.data;
+
+ if (combo->editable)
+ {
+ /* Give the row selected in the column parameter,
+ * ewl_filepicker needs this to display proper filter
+ */
+
+ item = view->header_fetch(ewl_mvc_data_get(mvc),
+ idx->row);
+ }
+
+ else
+ {
+
+
+ item = view->fetch(model->fetch(mvc_data, idx->row, 0),
+ idx->row, 0);
+ }
+
+ FREE(idx);
+ }
+
+ else if (view && view->header_fetch)
+ item = view->header_fetch(ewl_mvc_data_get(mvc), 0);
+
+ if (item)
+ {
+ ewl_container_child_prepend(EWL_CONTAINER(combo->header), item);
+ ewl_widget_show(item);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -384,33 +384,33 @@ ewl_combo_cb_selected_change(Ewl_MVC *mvc)
*/
Ewl_Widget *
ewl_combo_submenu_new(Ewl_Combo *combo, const Ewl_Model *model,
- const Ewl_View *view, void *mvc_data)
+ const Ewl_View *view, void *mvc_data)
{
- Ewl_Widget *menu;
+ Ewl_Widget *menu;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(combo, NULL);
- DCHECK_TYPE_RET(combo, EWL_COMBO_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(combo, NULL);
+ DCHECK_TYPE_RET(combo, EWL_COMBO_TYPE, NULL);
- menu = ewl_menu_new();
- ewl_widget_appearance_set(EWL_MENU(menu)->popup, EWL_COMBO_TYPE
- "/"EWL_POPUP_TYPE);
- ewl_widget_appearance_set(menu, EWL_COMBO_TYPE"_menu");
+ menu = ewl_menu_new();
+ ewl_widget_appearance_set(EWL_MENU(menu)->popup, EWL_COMBO_TYPE
+ "/"EWL_POPUP_TYPE);
+ ewl_widget_appearance_set(menu, EWL_COMBO_TYPE"_menu");
- /* nothing to do if we have no model/view or data */
- if (!model || !view)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ /* nothing to do if we have no model/view or data */
+ if (!model || !view)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- ewl_combo_popup_fill(combo, EWL_CONTAINER(menu),
- model, view, mvc_data);
+ ewl_combo_popup_fill(combo, EWL_CONTAINER(menu),
+ model, view, mvc_data);
- ewl_button_label_set(EWL_BUTTON(menu), NULL);
- ewl_button_image_set(EWL_BUTTON(menu), NULL, NULL);
- ewl_object_fill_policy_set(EWL_OBJECT(menu), EWL_FLAG_FILL_HFILL);
- ewl_container_redirect_set(EWL_CONTAINER(menu),
- EWL_CONTAINER(EWL_BUTTON(menu)->body));
+ ewl_button_label_set(EWL_BUTTON(menu), NULL);
+ ewl_button_image_set(EWL_BUTTON(menu), NULL, NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(menu), EWL_FLAG_FILL_HFILL);
+ ewl_container_redirect_set(EWL_CONTAINER(menu),
+ EWL_CONTAINER(EWL_BUTTON(menu)->body));
- DRETURN_PTR(menu, DLEVEL_STABLE);
+ DRETURN_PTR(menu, DLEVEL_STABLE);
}
/**
@@ -424,68 +424,68 @@ ewl_combo_submenu_new(Ewl_Combo *combo, const Ewl_Model *model,
*/
static void
ewl_combo_popup_fill(Ewl_Combo *combo, Ewl_Container *c, const Ewl_Model *model,
- const Ewl_View *view, void *mvc_data)
+ const Ewl_View *view, void *mvc_data)
{
- unsigned int count, i;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(combo);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(combo, EWL_COMBO_TYPE);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
-
- if (!model->count)
- DRETURN(DLEVEL_STABLE);
-
- count = model->count(mvc_data);
- for (i = 0; i < count; i++)
- {
- Ewl_Widget *o, *item;
-
- if (model->expansion.is && model->expansion.is(mvc_data, i))
- {
- const Ewl_Model *em;
- const Ewl_View *ev;
- void *ed;
-
- /* if there shouldn't be a model for the expansion
- * we us the current model */
- if (!model->expansion.model
- || !(em = model->expansion.model(mvc_data, i)))
- em = model;
- /* if there shouldm't be a view for the expansion
- * we us the current view */
- if (!view->expansion
- || !(ev = view->expansion(mvc_data,i)))
- ev = view;
-
- /* if there is no data for the expansion use the
- * current mvc data */
- if (model->expansion.data)
- ed = model->expansion.data(mvc_data, i);
- else
- ed = mvc_data;
-
- o = ewl_combo_submenu_new(combo, em, ev, ed);
- }
- else
- {
- o = ewl_combo_cell_new();
- ewl_combo_cell_combo_set(EWL_COMBO_CELL(o), combo);
- ewl_combo_cell_model_set(EWL_COMBO_CELL(o), model);
- ewl_combo_cell_data_set(EWL_COMBO_CELL(o), mvc_data);
- }
- ewl_container_child_append(c, o);
- ewl_widget_show(o);
-
- if (view->fetch && model->fetch)
- {
- item = view->fetch(model->fetch(mvc_data, i, 0), i, 0);
- ewl_container_child_append(EWL_CONTAINER(o), item);
- ewl_widget_show(item);
- }
- }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ unsigned int count, i;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(combo);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(combo, EWL_COMBO_TYPE);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+
+ if (!model->count)
+ DRETURN(DLEVEL_STABLE);
+
+ count = model->count(mvc_data);
+ for (i = 0; i < count; i++)
+ {
+ Ewl_Widget *o, *item;
+
+ if (model->expansion.is && model->expansion.is(mvc_data, i))
+ {
+ const Ewl_Model *em;
+ const Ewl_View *ev;
+ void *ed;
+
+ /* if there shouldn't be a model for the expansion
+ * we us the current model */
+ if (!model->expansion.model
+ || !(em = model->expansion.model(mvc_data, i)))
+ em = model;
+ /* if there shouldm't be a view for the expansion
+ * we us the current view */
+ if (!view->expansion
+ || !(ev = view->expansion(mvc_data,i)))
+ ev = view;
+
+ /* if there is no data for the expansion use the
+ * current mvc data */
+ if (model->expansion.data)
+ ed = model->expansion.data(mvc_data, i);
+ else
+ ed = mvc_data;
+
+ o = ewl_combo_submenu_new(combo, em, ev, ed);
+ }
+ else
+ {
+ o = ewl_combo_cell_new();
+ ewl_combo_cell_combo_set(EWL_COMBO_CELL(o), combo);
+ ewl_combo_cell_model_set(EWL_COMBO_CELL(o), model);
+ ewl_combo_cell_data_set(EWL_COMBO_CELL(o), mvc_data);
+ }
+ ewl_container_child_append(c, o);
+ ewl_widget_show(o);
+
+ if (view->fetch && model->fetch)
+ {
+ item = view->fetch(model->fetch(mvc_data, i, 0), i, 0);
+ ewl_container_child_append(EWL_CONTAINER(o), item);
+ ewl_widget_show(item);
+ }
+ }
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -495,21 +495,21 @@ ewl_combo_popup_fill(Ewl_Combo *combo, Ewl_Container *c, const Ewl_Model *model,
Ewl_Widget *
ewl_combo_cell_new(void)
{
- Ewl_Combo_Cell *cell;
+ Ewl_Combo_Cell *cell;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- cell = NEW(Ewl_Combo_Cell, 1);
- if (!cell)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ cell = NEW(Ewl_Combo_Cell, 1);
+ if (!cell)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_combo_cell_init(cell))
- {
- ewl_widget_destroy(EWL_WIDGET(cell));
- cell = NULL;
- }
+ if (!ewl_combo_cell_init(cell))
+ {
+ ewl_widget_destroy(EWL_WIDGET(cell));
+ cell = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(cell), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(cell), DLEVEL_STABLE);
}
/**
@@ -520,19 +520,19 @@ ewl_combo_cell_new(void)
int
ewl_combo_cell_init(Ewl_Combo_Cell *cell)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cell, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cell, FALSE);
- if (!ewl_cell_init(EWL_CELL(cell)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_cell_init(EWL_CELL(cell)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_inherit(EWL_WIDGET(cell), EWL_COMBO_CELL_TYPE);
- ewl_widget_appearance_set(EWL_WIDGET(cell), EWL_COMBO_CELL_TYPE);
- ewl_object_fill_policy_set(EWL_OBJECT(cell), EWL_FLAG_FILL_HFILL);
- ewl_callback_append(EWL_WIDGET(cell), EWL_CALLBACK_CLICKED,
- ewl_combo_cell_cb_clicked, NULL);
+ ewl_widget_inherit(EWL_WIDGET(cell), EWL_COMBO_CELL_TYPE);
+ ewl_widget_appearance_set(EWL_WIDGET(cell), EWL_COMBO_CELL_TYPE);
+ ewl_object_fill_policy_set(EWL_OBJECT(cell), EWL_FLAG_FILL_HFILL);
+ ewl_callback_append(EWL_WIDGET(cell), EWL_CALLBACK_CLICKED,
+ ewl_combo_cell_cb_clicked, NULL);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -543,15 +543,15 @@ ewl_combo_cell_init(Ewl_Combo_Cell *cell)
void
ewl_combo_cell_combo_set(Ewl_Combo_Cell *cell, Ewl_Combo *combo)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cell);
- DCHECK_TYPE(cell, EWL_COMBO_CELL_TYPE);
- DCHECK_PARAM_PTR(combo);
- DCHECK_TYPE(combo, EWL_COMBO_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cell);
+ DCHECK_TYPE(cell, EWL_COMBO_CELL_TYPE);
+ DCHECK_PARAM_PTR(combo);
+ DCHECK_TYPE(combo, EWL_COMBO_TYPE);
- cell->combo = combo;
+ cell->combo = combo;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -561,11 +561,11 @@ ewl_combo_cell_combo_set(Ewl_Combo_Cell *cell, Ewl_Combo *combo)
Ewl_Combo *
ewl_combo_cell_combo_get(Ewl_Combo_Cell *cell)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cell, NULL);
- DCHECK_TYPE_RET(cell, EWL_COMBO_CELL_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cell, NULL);
+ DCHECK_TYPE_RET(cell, EWL_COMBO_CELL_TYPE, NULL);
- DRETURN_PTR(cell->combo, DLEVEL_STABLE);
+ DRETURN_PTR(cell->combo, DLEVEL_STABLE);
}
/**
@@ -576,14 +576,14 @@ ewl_combo_cell_combo_get(Ewl_Combo_Cell *cell)
void
ewl_combo_cell_model_set(Ewl_Combo_Cell *cell, const Ewl_Model *model)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cell);
- DCHECK_TYPE(cell, EWL_COMBO_CELL_TYPE);
- DCHECK_PARAM_PTR(model);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cell);
+ DCHECK_TYPE(cell, EWL_COMBO_CELL_TYPE);
+ DCHECK_PARAM_PTR(model);
- cell->model = model;
+ cell->model = model;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -593,11 +593,11 @@ ewl_combo_cell_model_set(Ewl_Combo_Cell *cell, const Ewl_Model *model)
const Ewl_Model *
ewl_combo_cell_model_get(Ewl_Combo_Cell *cell)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cell, NULL);
- DCHECK_TYPE_RET(cell, EWL_COMBO_CELL_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cell, NULL);
+ DCHECK_TYPE_RET(cell, EWL_COMBO_CELL_TYPE, NULL);
- DRETURN_PTR(cell->model, DLEVEL_STABLE);
+ DRETURN_PTR(cell->model, DLEVEL_STABLE);
}
/**
@@ -608,13 +608,13 @@ ewl_combo_cell_model_get(Ewl_Combo_Cell *cell)
void
ewl_combo_cell_data_set(Ewl_Combo_Cell *cell, void *mvc_data)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cell);
- DCHECK_TYPE(cell, EWL_COMBO_CELL_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cell);
+ DCHECK_TYPE(cell, EWL_COMBO_CELL_TYPE);
- cell->mvc_data = mvc_data;
+ cell->mvc_data = mvc_data;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -624,11 +624,11 @@ ewl_combo_cell_data_set(Ewl_Combo_Cell *cell, void *mvc_data)
void *
ewl_combo_cell_data_get(Ewl_Combo_Cell *cell)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cell, NULL);
- DCHECK_TYPE_RET(cell, EWL_COMBO_CELL_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cell, NULL);
+ DCHECK_TYPE_RET(cell, EWL_COMBO_CELL_TYPE, NULL);
- DRETURN_PTR(cell->mvc_data, DLEVEL_STABLE);
+ DRETURN_PTR(cell->mvc_data, DLEVEL_STABLE);
}
/**
* @internal
@@ -640,26 +640,26 @@ ewl_combo_cell_data_get(Ewl_Combo_Cell *cell)
*/
void
ewl_combo_cell_cb_clicked(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Combo *combo;
- const Ewl_Model *model;
- void *mvc_data;
- int i;
+ Ewl_Combo *combo;
+ const Ewl_Model *model;
+ void *mvc_data;
+ int i;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_COMBO_CELL_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_COMBO_CELL_TYPE);
- i = ewl_container_child_index_get(EWL_CONTAINER(w->parent), w);
- if (i < 0) DRETURN(DLEVEL_STABLE);
+ i = ewl_container_child_index_get(EWL_CONTAINER(w->parent), w);
+ if (i < 0) DRETURN(DLEVEL_STABLE);
- combo = ewl_combo_cell_combo_get(EWL_COMBO_CELL(w));
- model = ewl_combo_cell_model_get(EWL_COMBO_CELL(w));
- mvc_data = ewl_combo_cell_data_get(EWL_COMBO_CELL(w));
+ combo = ewl_combo_cell_combo_get(EWL_COMBO_CELL(w));
+ model = ewl_combo_cell_model_get(EWL_COMBO_CELL(w));
+ mvc_data = ewl_combo_cell_data_get(EWL_COMBO_CELL(w));
- ewl_mvc_selected_set(EWL_MVC(combo), model, mvc_data, i, 0);
+ ewl_mvc_selected_set(EWL_MVC(combo), model, mvc_data, i, 0);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_combo.h b/src/lib/ewl_combo.h
index 8af8b1a..f9eccda 100644
--- a/src/lib/ewl_combo.h
+++ b/src/lib/ewl_combo.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_COMBO_H
#define EWL_COMBO_H
@@ -52,27 +52,27 @@ typedef struct Ewl_Combo Ewl_Combo;
*/
struct Ewl_Combo
{
- Ewl_MVC mvc; /**< Inherit from Ewl_MVC */
+ Ewl_MVC mvc; /**< Inherit from Ewl_MVC */
- Ewl_Widget *popup; /**< Use a popup to display with. */
- Ewl_Widget *button; /**< expand/contract button */
- Ewl_Widget *header; /**< The combo header widget */
- unsigned char editable:1; /**< Is the combo editable */
- unsigned char scrollable:1; /**< Is the combo scrollable */
+ Ewl_Widget *popup; /**< Use a popup to display with. */
+ Ewl_Widget *button; /**< expand/contract button */
+ Ewl_Widget *header; /**< The combo header widget */
+ unsigned char editable:1; /**< Is the combo editable */
+ unsigned char scrollable:1; /**< Is the combo scrollable */
};
-Ewl_Widget *ewl_combo_new(void);
-int ewl_combo_init(Ewl_Combo *combo);
+Ewl_Widget *ewl_combo_new(void);
+int ewl_combo_init(Ewl_Combo *combo);
-void ewl_combo_editable_set(Ewl_Combo *combo,
- unsigned int editable);
-unsigned int ewl_combo_editable_get(Ewl_Combo *combo);
-void ewl_combo_scrollable_set(Ewl_Combo *combo,
- unsigned int scrollable);
-unsigned int ewl_combo_scrollable_get(Ewl_Combo *combo);
+void ewl_combo_editable_set(Ewl_Combo *combo,
+ unsigned int editable);
+unsigned int ewl_combo_editable_get(Ewl_Combo *combo);
+void ewl_combo_scrollable_set(Ewl_Combo *combo,
+ unsigned int scrollable);
+unsigned int ewl_combo_scrollable_get(Ewl_Combo *combo);
-void ewl_combo_popup_container_set(Ewl_Combo *combo,
- Ewl_Container *c);
+void ewl_combo_popup_container_set(Ewl_Combo *combo,
+ Ewl_Container *c);
/*
@@ -113,25 +113,25 @@ typedef struct Ewl_Combo_Cell Ewl_Combo_Cell;
*/
struct Ewl_Combo_Cell
{
- Ewl_Cell cell; /**< Inherit from the cell */
- Ewl_Combo *combo; /**< The parent combo */
- const Ewl_Model *model; /**< The model that was used to build the
- content of the cell */
- void *mvc_data; /**< The mvc data that was used to build the
- content of the cell */
+ Ewl_Cell cell; /**< Inherit from the cell */
+ Ewl_Combo *combo; /**< The parent combo */
+ const Ewl_Model *model; /**< The model that was used to build the
+ content of the cell */
+ void *mvc_data; /**< The mvc data that was used to build the
+ content of the cell */
};
-Ewl_Widget *ewl_combo_cell_new(void);
-int ewl_combo_cell_init(Ewl_Combo_Cell *c);
-void ewl_combo_cell_combo_set(Ewl_Combo_Cell *c, Ewl_Combo *combo);
-Ewl_Combo *ewl_combo_cell_combo_get(Ewl_Combo_Cell *c);
+Ewl_Widget *ewl_combo_cell_new(void);
+int ewl_combo_cell_init(Ewl_Combo_Cell *c);
+void ewl_combo_cell_combo_set(Ewl_Combo_Cell *c, Ewl_Combo *combo);
+Ewl_Combo *ewl_combo_cell_combo_get(Ewl_Combo_Cell *c);
-void ewl_combo_cell_model_set(Ewl_Combo_Cell *c,
- const Ewl_Model *model);
-const Ewl_Model *ewl_combo_cell_model_get(Ewl_Combo_Cell *c);
+void ewl_combo_cell_model_set(Ewl_Combo_Cell *c,
+ const Ewl_Model *model);
+const Ewl_Model *ewl_combo_cell_model_get(Ewl_Combo_Cell *c);
-void ewl_combo_cell_data_set(Ewl_Combo_Cell *c, void *mvc_data);
-void *ewl_combo_cell_data_get(Ewl_Combo_Cell *c);
+void ewl_combo_cell_data_set(Ewl_Combo_Cell *c, void *mvc_data);
+void *ewl_combo_cell_data_get(Ewl_Combo_Cell *c);
/**
* @}
diff --git a/src/lib/ewl_config.c b/src/lib/ewl_config.c
index 90c0355..1d2f34e 100644
--- a/src/lib/ewl_config.c
+++ b/src/lib/ewl_config.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_macros.h"
#include "ewl_private.h"
@@ -34,7 +34,7 @@ static int ewl_config_file_write_lock(int fd, long size);
static int ewl_config_file_unlock(int fd, long size);
static int ewl_config_load(Ewl_Config *cfg);
static int ewl_config_file_load(Ewl_Config *cfg, unsigned int is_system,
- const char *file);
+ const char *file);
static void ewl_config_parse(Ewl_Config *cfg, Ecore_Hash *hash, char *data);
static Ecore_Hash *ewl_config_create_hash(void);
@@ -43,7 +43,7 @@ static void ewl_config_create_system_hash(Ewl_Config *cfg);
static void ewl_config_create_user_hash(Ewl_Config *cfg);
static Ecore_Hash *ewl_config_set_hash_get(Ewl_Config *cfg,
- Ewl_State_Type state);
+ Ewl_State_Type state);
static const char *ewl_config_get(Ewl_Config *cfg, const char *key);
static const char * ewl_config_env_get(Ewl_Config *cfg, const char *key);
static char *ewl_config_trim(char *v);
@@ -51,7 +51,7 @@ static char *ewl_config_file_name_user_get(Ewl_Config *cfg);
static char *ewl_config_file_name_system_get(Ewl_Config *cfg);
static char *ewl_config_file_name_clean(Ewl_Config *cfg);
static int ewl_config_save(Ewl_Config *cfg, Ecore_Hash *hash,
- const char *file);
+ const char *file);
/**
* @internal
@@ -61,18 +61,18 @@ static int ewl_config_save(Ewl_Config *cfg, Ecore_Hash *hash,
int
ewl_config_init(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ewl_config = ewl_config_new("ewl");
- if (!ewl_config)
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ ewl_config = ewl_config_new("ewl");
+ if (!ewl_config)
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- if ((!ewl_config_string_get(ewl_config, EWL_CONFIG_THEME_NAME))
- || (!ewl_config_string_get(ewl_config,
- EWL_CONFIG_ENGINE_NAME)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if ((!ewl_config_string_get(ewl_config, EWL_CONFIG_THEME_NAME))
+ || (!ewl_config_string_get(ewl_config,
+ EWL_CONFIG_ENGINE_NAME)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -83,12 +83,12 @@ ewl_config_init(void)
void
ewl_config_shutdown(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ewl_config_destroy(ewl_config);
- ewl_config = NULL;
+ ewl_config_destroy(ewl_config);
+ ewl_config = NULL;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -99,27 +99,27 @@ ewl_config_shutdown(void)
void
ewl_config_cache_init(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- ewl_config_cache.enable = ewl_config_int_get(ewl_config,
- EWL_CONFIG_DEBUG_ENABLE);
- ewl_config_cache.segv = ewl_config_int_get(ewl_config,
- EWL_CONFIG_DEBUG_SEGV);
- ewl_config_cache.backtrace = ewl_config_int_get(ewl_config,
- EWL_CONFIG_DEBUG_BACKTRACE);
- ewl_config_cache.evas_render = ewl_config_int_get(ewl_config,
- EWL_CONFIG_DEBUG_EVAS_RENDER);
- ewl_config_cache.gc_reap = ewl_config_int_get(ewl_config,
- EWL_CONFIG_DEBUG_GC_REAP);
- ewl_config_cache.level = ewl_config_int_get(ewl_config,
- EWL_CONFIG_DEBUG_LEVEL);
-
- ewl_config_cache.print_signals = ewl_config_int_get(ewl_config,
- EWL_CONFIG_THEME_PRINT_SIGNALS);
- ewl_config_cache.print_keys = ewl_config_int_get(ewl_config,
- EWL_CONFIG_THEME_PRINT_KEYS);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ ewl_config_cache.enable = ewl_config_int_get(ewl_config,
+ EWL_CONFIG_DEBUG_ENABLE);
+ ewl_config_cache.segv = ewl_config_int_get(ewl_config,
+ EWL_CONFIG_DEBUG_SEGV);
+ ewl_config_cache.backtrace = ewl_config_int_get(ewl_config,
+ EWL_CONFIG_DEBUG_BACKTRACE);
+ ewl_config_cache.evas_render = ewl_config_int_get(ewl_config,
+ EWL_CONFIG_DEBUG_EVAS_RENDER);
+ ewl_config_cache.gc_reap = ewl_config_int_get(ewl_config,
+ EWL_CONFIG_DEBUG_GC_REAP);
+ ewl_config_cache.level = ewl_config_int_get(ewl_config,
+ EWL_CONFIG_DEBUG_LEVEL);
+
+ ewl_config_cache.print_signals = ewl_config_int_get(ewl_config,
+ EWL_CONFIG_THEME_PRINT_SIGNALS);
+ ewl_config_cache.print_keys = ewl_config_int_get(ewl_config,
+ EWL_CONFIG_THEME_PRINT_KEYS);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -130,18 +130,18 @@ ewl_config_cache_init(void)
Ewl_Config *
ewl_config_new(const char *app_name)
{
- Ewl_Config *cfg;
+ Ewl_Config *cfg;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(app_name, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(app_name, NULL);
- cfg = NEW(Ewl_Config, 1);
- cfg->app_name = strdup(app_name);
- ewl_config_load(cfg);
+ cfg = NEW(Ewl_Config, 1);
+ cfg->app_name = strdup(app_name);
+ ewl_config_load(cfg);
- /* XXX need to hookup to dbus here? */
+ /* XXX need to hookup to dbus here? */
- DRETURN_PTR(cfg, DLEVEL_STABLE);
+ DRETURN_PTR(cfg, DLEVEL_STABLE);
}
/**
@@ -152,17 +152,17 @@ ewl_config_new(const char *app_name)
void
ewl_config_destroy(Ewl_Config *cfg)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cfg);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cfg);
- IF_FREE_HASH(cfg->data.user);
- IF_FREE_HASH(cfg->data.system);
- IF_FREE_HASH(cfg->data.instance);
+ IF_FREE_HASH(cfg->data.user);
+ IF_FREE_HASH(cfg->data.system);
+ IF_FREE_HASH(cfg->data.instance);
- IF_FREE(cfg->app_name);
- FREE(cfg);
+ IF_FREE(cfg->app_name);
+ FREE(cfg);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -178,15 +178,15 @@ ewl_config_destroy(Ewl_Config *cfg)
*/
void
ewl_config_string_set(Ewl_Config *cfg, const char *k, const char *v,
- Ewl_State_Type state)
+ Ewl_State_Type state)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(k);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(k);
- ecore_hash_set(ewl_config_set_hash_get(cfg, state),
- strdup(k), strdup(v));
+ ecore_hash_set(ewl_config_set_hash_get(cfg, state),
+ strdup(k), strdup(v));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -198,10 +198,10 @@ ewl_config_string_set(Ewl_Config *cfg, const char *k, const char *v,
const char *
ewl_config_string_get(Ewl_Config *cfg, const char *k)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(k, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(k, NULL);
- DRETURN_PTR(ewl_config_get(cfg, k), DLEVEL_STABLE);
+ DRETURN_PTR(ewl_config_get(cfg, k), DLEVEL_STABLE);
}
/**
@@ -217,18 +217,18 @@ ewl_config_string_get(Ewl_Config *cfg, const char *k)
*/
void
ewl_config_int_set(Ewl_Config *cfg, const char *k, int v,
- Ewl_State_Type state)
+ Ewl_State_Type state)
{
- char buf[128];
+ char buf[128];
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(k);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(k);
- snprintf(buf, sizeof(buf), "%d", v);
- ecore_hash_set(ewl_config_set_hash_get(cfg, state),
- strdup(k), strdup(buf));
+ snprintf(buf, sizeof(buf), "%d", v);
+ ecore_hash_set(ewl_config_set_hash_get(cfg, state),
+ strdup(k), strdup(buf));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -240,16 +240,16 @@ ewl_config_int_set(Ewl_Config *cfg, const char *k, int v,
int
ewl_config_int_get(Ewl_Config *cfg, const char *k)
{
- const char *val;
- int v = 0;
+ const char *val;
+ int v = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(k, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(k, 0);
- val = ewl_config_get(cfg, k);
- if (val) v = atoi(val);
+ val = ewl_config_get(cfg, k);
+ if (val) v = atoi(val);
- DRETURN_INT(v, DLEVEL_STABLE);
+ DRETURN_INT(v, DLEVEL_STABLE);
}
/**
@@ -265,18 +265,18 @@ ewl_config_int_get(Ewl_Config *cfg, const char *k)
*/
void
ewl_config_float_set(Ewl_Config *cfg, const char *k, float v,
- Ewl_State_Type state)
+ Ewl_State_Type state)
{
- char buf[128];
+ char buf[128];
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(k);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(k);
- snprintf(buf, sizeof(buf), "%f", v);
- ecore_hash_set(ewl_config_set_hash_get(cfg, state),
- strdup(k), strdup(buf));
+ snprintf(buf, sizeof(buf), "%f", v);
+ ecore_hash_set(ewl_config_set_hash_get(cfg, state),
+ strdup(k), strdup(buf));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -288,16 +288,16 @@ ewl_config_float_set(Ewl_Config *cfg, const char *k, float v,
float
ewl_config_float_get(Ewl_Config *cfg, const char *k)
{
- const char *val;
- float v = 0.0;
+ const char *val;
+ float v = 0.0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(k, 0.0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(k, 0.0);
- val = ewl_config_get(cfg, k);
- if (val) v = atof(val);
+ val = ewl_config_get(cfg, k);
+ if (val) v = atof(val);
- DRETURN_FLOAT(v, DLEVEL_STABLE);
+ DRETURN_FLOAT(v, DLEVEL_STABLE);
}
/**
@@ -316,19 +316,19 @@ ewl_config_float_get(Ewl_Config *cfg, const char *k)
*/
void
ewl_config_color_set(Ewl_Config *cfg, const char *k, int r, int g,
- int b, int a,
- Ewl_State_Type state)
+ int b, int a,
+ Ewl_State_Type state)
{
- char buf[128];
+ char buf[128];
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(k);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(k);
- snprintf(buf, sizeof(buf), "%i %i %i %i", r, g, b, a);
- ecore_hash_set(ewl_config_set_hash_get(cfg, state),
- strdup(k), strdup(buf));
+ snprintf(buf, sizeof(buf), "%i %i %i %i", r, g, b, a);
+ ecore_hash_set(ewl_config_set_hash_get(cfg, state),
+ strdup(k), strdup(buf));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -343,23 +343,23 @@ ewl_config_color_set(Ewl_Config *cfg, const char *k, int r, int g,
*/
void
ewl_config_color_get(Ewl_Config *cfg, const char *k, int *r, int *g,
- int *b, int *a)
+ int *b, int *a)
{
- const char *val;
- int tmp_r = 0, tmp_g = 0, tmp_b = 0, tmp_a = 0;
+ const char *val;
+ int tmp_r = 0, tmp_g = 0, tmp_b = 0, tmp_a = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(k);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(k);
- val = ewl_config_get(cfg, k);
- if (val) sscanf(val, "%i %i %i %i", &tmp_r, &tmp_g, &tmp_b, &tmp_a);
+ val = ewl_config_get(cfg, k);
+ if (val) sscanf(val, "%i %i %i %i", &tmp_r, &tmp_g, &tmp_b, &tmp_a);
- if (r) *r = tmp_r;
- if (g) *g = tmp_g;
- if (b) *b = tmp_b;
- if (a) *a = tmp_a;
+ if (r) *r = tmp_r;
+ if (g) *g = tmp_g;
+ if (b) *b = tmp_b;
+ if (a) *a = tmp_a;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -371,15 +371,15 @@ ewl_config_color_get(Ewl_Config *cfg, const char *k, int *r, int *g,
void
ewl_config_key_remove(Ewl_Config *cfg, const char *k)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cfg);
- DCHECK_PARAM_PTR(k);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cfg);
+ DCHECK_PARAM_PTR(k);
- ewl_config_instance_key_remove(cfg, k);
- ewl_config_system_key_remove(cfg, k);
- ewl_config_user_key_remove(cfg, k);
+ ewl_config_instance_key_remove(cfg, k);
+ ewl_config_system_key_remove(cfg, k);
+ ewl_config_user_key_remove(cfg, k);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -391,14 +391,14 @@ ewl_config_key_remove(Ewl_Config *cfg, const char *k)
void
ewl_config_instance_key_remove(Ewl_Config *cfg, const char *k)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cfg);
- DCHECK_PARAM_PTR(k);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cfg);
+ DCHECK_PARAM_PTR(k);
- if (cfg->data.instance && (ecore_hash_get(cfg->data.instance, k)))
- ecore_hash_remove(cfg->data.instance, k);
+ if (cfg->data.instance && (ecore_hash_get(cfg->data.instance, k)))
+ ecore_hash_remove(cfg->data.instance, k);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -410,14 +410,14 @@ ewl_config_instance_key_remove(Ewl_Config *cfg, const char *k)
void
ewl_config_system_key_remove(Ewl_Config *cfg, const char *k)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cfg);
- DCHECK_PARAM_PTR(k);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cfg);
+ DCHECK_PARAM_PTR(k);
- if (cfg->data.system && (ecore_hash_get(cfg->data.system, k)))
- ecore_hash_remove(cfg->data.system, k);
+ if (cfg->data.system && (ecore_hash_get(cfg->data.system, k)))
+ ecore_hash_remove(cfg->data.system, k);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -429,14 +429,14 @@ ewl_config_system_key_remove(Ewl_Config *cfg, const char *k)
void
ewl_config_user_key_remove(Ewl_Config *cfg, const char *k)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cfg);
- DCHECK_PARAM_PTR(k);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cfg);
+ DCHECK_PARAM_PTR(k);
- if (cfg->data.user && (ecore_hash_get(cfg->data.user, k)))
- ecore_hash_remove(cfg->data.user, k);
+ if (cfg->data.user && (ecore_hash_get(cfg->data.user, k)))
+ ecore_hash_remove(cfg->data.user, k);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -448,17 +448,17 @@ ewl_config_user_key_remove(Ewl_Config *cfg, const char *k)
int
ewl_config_can_save_system(Ewl_Config *cfg)
{
- char *fname;
- int ret;
+ char *fname;
+ int ret;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cfg, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cfg, FALSE);
- fname = ewl_config_file_name_system_get(cfg);
- ret = access(fname, W_OK);
- FREE(fname);
+ fname = ewl_config_file_name_system_get(cfg);
+ ret = access(fname, W_OK);
+ FREE(fname);
- DRETURN_INT((!ret ? TRUE : FALSE), DLEVEL_STABLE);
+ DRETURN_INT((!ret ? TRUE : FALSE), DLEVEL_STABLE);
}
/**
@@ -469,17 +469,17 @@ ewl_config_can_save_system(Ewl_Config *cfg)
int
ewl_config_user_save(Ewl_Config *cfg)
{
- char *fname;
- int ret;
+ char *fname;
+ int ret;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cfg, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cfg, FALSE);
- fname = ewl_config_file_name_user_get(cfg);
- ret = ewl_config_save(cfg, cfg->data.user, fname);
- FREE(fname);
+ fname = ewl_config_file_name_user_get(cfg);
+ ret = ewl_config_save(cfg, cfg->data.user, fname);
+ FREE(fname);
- DRETURN_INT(ret, DLEVEL_STABLE);
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
/**
@@ -490,396 +490,396 @@ ewl_config_user_save(Ewl_Config *cfg)
int
ewl_config_system_save(Ewl_Config *cfg)
{
- char *fname, *key;
- int ret;
- Ecore_Hash *hash;
- Ecore_List *keys;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cfg, FALSE);
-
- if (!ewl_config_can_save_system(cfg))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- hash = ecore_hash_new(ecore_str_hash, ecore_str_compare);
-
- /* add all the system data */
- keys = ecore_hash_keys(cfg->data.system);
- ecore_list_first_goto(keys);
- while ((key = ecore_list_next(keys)))
- {
- ecore_hash_set(hash, key,
- ecore_hash_get(cfg->data.system, key));
- }
- IF_FREE_LIST(keys);
-
- /* set the user data over top */
- keys = ecore_hash_keys(cfg->data.user);
- ecore_list_first_goto(keys);
- while ((key = ecore_list_next(keys)))
- {
- ecore_hash_set(hash, key,
- ecore_hash_get(cfg->data.user, key));
- }
- IF_FREE_LIST(keys);
-
- fname = ewl_config_file_name_system_get(cfg);
- ret = ewl_config_save(cfg, hash, fname);
- FREE(fname);
-
- IF_FREE_HASH(hash);
-
- DRETURN_INT(ret, DLEVEL_STABLE);
+ char *fname, *key;
+ int ret;
+ Ecore_Hash *hash;
+ Ecore_List *keys;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cfg, FALSE);
+
+ if (!ewl_config_can_save_system(cfg))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ hash = ecore_hash_new(ecore_str_hash, ecore_str_compare);
+
+ /* add all the system data */
+ keys = ecore_hash_keys(cfg->data.system);
+ ecore_list_first_goto(keys);
+ while ((key = ecore_list_next(keys)))
+ {
+ ecore_hash_set(hash, key,
+ ecore_hash_get(cfg->data.system, key));
+ }
+ IF_FREE_LIST(keys);
+
+ /* set the user data over top */
+ keys = ecore_hash_keys(cfg->data.user);
+ ecore_list_first_goto(keys);
+ while ((key = ecore_list_next(keys)))
+ {
+ ecore_hash_set(hash, key,
+ ecore_hash_get(cfg->data.user, key));
+ }
+ IF_FREE_LIST(keys);
+
+ fname = ewl_config_file_name_system_get(cfg);
+ ret = ewl_config_save(cfg, hash, fname);
+ FREE(fname);
+
+ IF_FREE_HASH(hash);
+
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
static int
ewl_config_file_read_lock(int fd, long size)
{
#if defined(F_SETLKW)
- struct flock fl;
+ struct flock fl;
- fl.l_type = F_RDLCK;
- fl.l_whence = SEEK_SET;
- fl.l_start = 0;
- fl.l_len = 0;
+ fl.l_type = F_RDLCK;
+ fl.l_whence = SEEK_SET;
+ fl.l_start = 0;
+ fl.l_len = 0;
- return (fcntl(fd, F_SETLKW, &fl) == 0);
+ return (fcntl(fd, F_SETLKW, &fl) == 0);
#else
# if HAVE__LOCKING
- return (_locking(fd, _LK_LOCK, size) == 0);
+ return (_locking(fd, _LK_LOCK, size) == 0);
# endif /* HAVE__LOCKING */
#endif /* !defined(F_SETLKW) */
- size = size;
+ size = size;
}
static int
ewl_config_file_write_lock(int fd, long size)
{
#if defined(F_SETLKW)
- struct flock fl;
+ struct flock fl;
- fl.l_type = F_WRLCK;
- fl.l_whence = SEEK_SET;
- fl.l_start = 0;
- fl.l_len = 0;
+ fl.l_type = F_WRLCK;
+ fl.l_whence = SEEK_SET;
+ fl.l_start = 0;
+ fl.l_len = 0;
- return (fcntl(fd, F_SETLKW, &fl) == 0);
+ return (fcntl(fd, F_SETLKW, &fl) == 0);
#else
# if HAVE__LOCKING
- return (_locking(fd, _LK_LOCK, size) == 0);
+ return (_locking(fd, _LK_LOCK, size) == 0);
# endif /* HAVE__LOCKING */
#endif /* !defined(F_SETLKW) */
- size = size;
+ size = size;
}
static int
ewl_config_file_unlock(int fd, long size)
{
#if defined(F_SETLKW)
- struct flock fl;
+ struct flock fl;
- fl.l_type = F_UNLCK;
- fl.l_whence = SEEK_SET;
- fl.l_start = 0;
- fl.l_len = 0;
+ fl.l_type = F_UNLCK;
+ fl.l_whence = SEEK_SET;
+ fl.l_start = 0;
+ fl.l_len = 0;
- return (fcntl(fd, F_SETLK, &fl) == 0);
+ return (fcntl(fd, F_SETLK, &fl) == 0);
#else
# if HAVE__LOCKING
- return (_locking(fd, _LK_UNLCK, size) == 0);
+ return (_locking(fd, _LK_UNLCK, size) == 0);
# endif /* HAVE__LOCKING */
#endif /* !defined(F_SETLKW) */
- size = size;
+ size = size;
}
static int
ewl_config_save(Ewl_Config *cfg, Ecore_Hash *hash, const char *file)
{
- Ecore_List *keys;
- char *key, data[512], *path;
- long size;
- int fd;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cfg, FALSE);
- DCHECK_PARAM_PTR_RET(file, FALSE);
-
- /* make sure the config directory exists */
- path = strdup(file);
- key = dirname(path);
- if (!ecore_file_exists(key) && !ecore_file_mkpath(key))
- {
- DWARNING("Unable to create %s directory path.", key);
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
- FREE(path);
-
- /* if the hash doesn't exist then treat it is empty */
- if (!hash)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ecore_List *keys;
+ char *key, data[512], *path;
+ long size;
+ int fd;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cfg, FALSE);
+ DCHECK_PARAM_PTR_RET(file, FALSE);
+
+ /* make sure the config directory exists */
+ path = strdup(file);
+ key = dirname(path);
+ if (!ecore_file_exists(key) && !ecore_file_mkpath(key))
+ {
+ DWARNING("Unable to create %s directory path.", key);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+ FREE(path);
+
+ /* if the hash doesn't exist then treat it is empty */
+ if (!hash)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
#ifndef _WIN32
- fd = open(file, O_CREAT | O_WRONLY | O_TRUNC,
- S_IRWXU | S_IRGRP | S_IROTH);
+ fd = open(file, O_CREAT | O_WRONLY | O_TRUNC,
+ S_IRWXU | S_IRGRP | S_IROTH);
#else
# ifdef __MINGW32__
- fd = _sopen(file, O_CREAT | O_WRONLY | O_TRUNC, _SH_DENYRD, S_IRWXU);
+ fd = _sopen(file, O_CREAT | O_WRONLY | O_TRUNC, _SH_DENYRD, S_IRWXU);
# else
- _sopen_s(&fd, file, O_CREAT | O_WRONLY | O_TRUNC, _SH_DENYRD, S_IRWXU);
+ _sopen_s(&fd, file, O_CREAT | O_WRONLY | O_TRUNC, _SH_DENYRD, S_IRWXU);
# endif /* __MINGW32 */
#endif /* _WIN32 */
- if (fd == -1)
- {
- DWARNING("Unable to open cfg file %s.", file);
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
+ if (fd == -1)
+ {
+ DWARNING("Unable to open cfg file %s.", file);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
- size = ecore_file_size(file);
+ size = ecore_file_size(file);
- if (!ewl_config_file_write_lock(fd, size))
- {
- DWARNING("Unable to lock %s for write.", file);
- close(fd);
+ if (!ewl_config_file_write_lock(fd, size))
+ {
+ DWARNING("Unable to lock %s for write.", file);
+ close(fd);
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
- keys = ecore_hash_keys(hash);
- ecore_list_first_goto(keys);
- while ((key = ecore_list_next(keys)))
- {
- int len;
+ keys = ecore_hash_keys(hash);
+ ecore_list_first_goto(keys);
+ while ((key = ecore_list_next(keys)))
+ {
+ int len;
- len = snprintf(data, sizeof(data), "%s = %s\n", key,
- (char *)ecore_hash_get(hash, key));
+ len = snprintf(data, sizeof(data), "%s = %s\n", key,
+ (char *)ecore_hash_get(hash, key));
- write(fd, data, len);
- }
+ write(fd, data, len);
+ }
- /* release the lock */
- ewl_config_file_unlock(fd, size);
- close(fd);
+ /* release the lock */
+ ewl_config_file_unlock(fd, size);
+ close(fd);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static char *
ewl_config_file_name_clean(Ewl_Config *cfg)
{
- char *fname = NULL, *p;
+ char *fname = NULL, *p;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cfg, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cfg, NULL);
- /* convert all whitespace, / or \ characters to _ */
- fname = strdup(cfg->app_name);
- for(p = fname; *p != '\0'; p++)
- {
- if (isspace(*p) || (*p == '/') || (*p == '\\'))
- *p = '_';
- }
+ /* convert all whitespace, / or \ characters to _ */
+ fname = strdup(cfg->app_name);
+ for(p = fname; *p != '\0'; p++)
+ {
+ if (isspace(*p) || (*p == '/') || (*p == '\\'))
+ *p = '_';
+ }
- DRETURN_PTR(fname, DLEVEL_STABLE);
+ DRETURN_PTR(fname, DLEVEL_STABLE);
}
static char *
ewl_config_file_name_build_get(Ewl_Config *cfg)
{
- char cfg_filename[PATH_MAX], *fname;
- int is_ewl = FALSE;
+ char cfg_filename[PATH_MAX], *fname;
+ int is_ewl = FALSE;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cfg, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cfg, NULL);
- if (!getenv("srcdir"))
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ if (!getenv("srcdir"))
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!strcmp(cfg->app_name, "ewl"))
- is_ewl = TRUE;
+ if (!strcmp(cfg->app_name, "ewl"))
+ is_ewl = TRUE;
- fname = ewl_config_file_name_clean(cfg);
- snprintf(cfg_filename, sizeof(cfg_filename),
- "%s/../../data/config/%s%s.cfg", getenv("srcdir"),
- (is_ewl ? "" : "apps/"), fname);
+ fname = ewl_config_file_name_clean(cfg);
+ snprintf(cfg_filename, sizeof(cfg_filename),
+ "%s/../../data/config/%s%s.cfg", getenv("srcdir"),
+ (is_ewl ? "" : "apps/"), fname);
- FREE(fname);
+ FREE(fname);
- DRETURN_PTR(strdup(cfg_filename), DLEVEL_STABLE);
+ DRETURN_PTR(strdup(cfg_filename), DLEVEL_STABLE);
}
static char *
ewl_config_file_name_system_get(Ewl_Config *cfg)
{
- char cfg_filename[PATH_MAX], *fname;
- int is_ewl = FALSE;
+ char cfg_filename[PATH_MAX], *fname;
+ int is_ewl = FALSE;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cfg, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cfg, NULL);
- if (!strcmp(cfg->app_name, "ewl"))
- is_ewl = TRUE;
+ if (!strcmp(cfg->app_name, "ewl"))
+ is_ewl = TRUE;
- fname = ewl_config_file_name_clean(cfg);
- snprintf(cfg_filename, sizeof(cfg_filename),
- "%s/ewl/%s%s.cfg", PACKAGE_SYSCONF_DIR,
- (is_ewl ? "" : "apps/"), fname);
+ fname = ewl_config_file_name_clean(cfg);
+ snprintf(cfg_filename, sizeof(cfg_filename),
+ "%s/ewl/%s%s.cfg", PACKAGE_SYSCONF_DIR,
+ (is_ewl ? "" : "apps/"), fname);
- FREE(fname);
+ FREE(fname);
- DRETURN_PTR(strdup(cfg_filename), DLEVEL_STABLE);
+ DRETURN_PTR(strdup(cfg_filename), DLEVEL_STABLE);
}
static char *
ewl_config_file_name_user_get(Ewl_Config *cfg)
{
- char cfg_filename[PATH_MAX], *fname;
- int is_ewl = FALSE;
+ char cfg_filename[PATH_MAX], *fname;
+ int is_ewl = FALSE;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cfg, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cfg, NULL);
- if (!strcmp(cfg->app_name, "ewl"))
- is_ewl = TRUE;
+ if (!strcmp(cfg->app_name, "ewl"))
+ is_ewl = TRUE;
- fname = ewl_config_file_name_clean(cfg);
- snprintf(cfg_filename, sizeof(cfg_filename),
- "%s/.ewl/config/%s%s.cfg",
- (getenv("HOME") ? getenv("HOME") : "/tmp"),
- (is_ewl ? "" : "apps/"),
- fname);
+ fname = ewl_config_file_name_clean(cfg);
+ snprintf(cfg_filename, sizeof(cfg_filename),
+ "%s/.ewl/config/%s%s.cfg",
+ (getenv("HOME") ? getenv("HOME") : "/tmp"),
+ (is_ewl ? "" : "apps/"),
+ fname);
- FREE(fname);
+ FREE(fname);
- DRETURN_PTR(strdup(cfg_filename), DLEVEL_STABLE);
+ DRETURN_PTR(strdup(cfg_filename), DLEVEL_STABLE);
}
static int
ewl_config_load(Ewl_Config *cfg)
{
- char *fname = NULL;
- int sys_ret, user_ret;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cfg, FALSE);
-
- /*
- * Attempt to load a build relative config file first. This allows for
- * testing without installing.
- */
- fname = ewl_config_file_name_build_get(cfg);
- if (!fname) fname = ewl_config_file_name_system_get(cfg);
- sys_ret = ewl_config_file_load(cfg, TRUE, fname);
- FREE(fname);
-
- fname = ewl_config_file_name_user_get(cfg);
- user_ret = ewl_config_file_load(cfg, FALSE, fname);
- FREE(fname);
-
- /* if we failed to load both config files we're in trouble */
- if (!sys_ret && !user_ret)
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- /* XXX deal with the colour classes */
-
- /* XXX not sure if this is in the right spot ... */
- /* XXX This is very much the wrong spot for this. This will happen
- * on all config inits, we just want this to happen on EWL config
- * init ... */
- /* update the evas info for the embeds */
- if (ewl_embed_list && !ecore_list_empty_is(ewl_embed_list))
- {
- Ewl_Embed *e;
-
- ecore_list_first_goto(ewl_embed_list);
- while ((e = ecore_list_next(ewl_embed_list)) != NULL)
- {
- if (!e->canvas) continue;
-
- evas_font_cache_flush(e->canvas);
- evas_font_cache_set(e->canvas,
- ewl_config_int_get(ewl_config,
- EWL_CONFIG_CACHE_EVAS_FONT));
-
- evas_image_cache_flush(e->canvas);
- evas_image_cache_set(e->canvas,
- ewl_config_int_get(ewl_config,
- EWL_CONFIG_CACHE_EVAS_IMAGE));
- }
- }
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ char *fname = NULL;
+ int sys_ret, user_ret;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cfg, FALSE);
+
+ /*
+ * Attempt to load a build relative config file first. This allows for
+ * testing without installing.
+ */
+ fname = ewl_config_file_name_build_get(cfg);
+ if (!fname) fname = ewl_config_file_name_system_get(cfg);
+ sys_ret = ewl_config_file_load(cfg, TRUE, fname);
+ FREE(fname);
+
+ fname = ewl_config_file_name_user_get(cfg);
+ user_ret = ewl_config_file_load(cfg, FALSE, fname);
+ FREE(fname);
+
+ /* if we failed to load both config files we're in trouble */
+ if (!sys_ret && !user_ret)
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ /* XXX deal with the colour classes */
+
+ /* XXX not sure if this is in the right spot ... */
+ /* XXX This is very much the wrong spot for this. This will happen
+ * on all config inits, we just want this to happen on EWL config
+ * init ... */
+ /* update the evas info for the embeds */
+ if (ewl_embed_list && !ecore_list_empty_is(ewl_embed_list))
+ {
+ Ewl_Embed *e;
+
+ ecore_list_first_goto(ewl_embed_list);
+ while ((e = ecore_list_next(ewl_embed_list)) != NULL)
+ {
+ if (!e->canvas) continue;
+
+ evas_font_cache_flush(e->canvas);
+ evas_font_cache_set(e->canvas,
+ ewl_config_int_get(ewl_config,
+ EWL_CONFIG_CACHE_EVAS_FONT));
+
+ evas_image_cache_flush(e->canvas);
+ evas_image_cache_set(e->canvas,
+ ewl_config_int_get(ewl_config,
+ EWL_CONFIG_CACHE_EVAS_IMAGE));
+ }
+ }
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static Ecore_Hash *
ewl_config_create_hash(void)
{
- Ecore_Hash *hash;
+ Ecore_Hash *hash;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- hash = ecore_hash_new(ecore_str_hash, ecore_str_compare);
- ecore_hash_free_key_cb_set(hash, free);
- ecore_hash_free_value_cb_set(hash, free);
+ hash = ecore_hash_new(ecore_str_hash, ecore_str_compare);
+ ecore_hash_free_key_cb_set(hash, free);
+ ecore_hash_free_value_cb_set(hash, free);
- DRETURN_PTR(hash, DLEVEL_STABLE);
+ DRETURN_PTR(hash, DLEVEL_STABLE);
}
static void
ewl_config_create_user_hash(Ewl_Config *cfg)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cfg);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cfg);
- if (!cfg->data.user)
- cfg->data.user = ewl_config_create_hash();
+ if (!cfg->data.user)
+ cfg->data.user = ewl_config_create_hash();
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_config_create_system_hash(Ewl_Config *cfg)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cfg);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cfg);
- if (!cfg->data.system)
- cfg->data.system = ewl_config_create_hash();
+ if (!cfg->data.system)
+ cfg->data.system = ewl_config_create_hash();
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_config_create_instance_hash(Ewl_Config *cfg)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cfg);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cfg);
- if (!cfg->data.instance)
- cfg->data.instance = ewl_config_create_hash();
+ if (!cfg->data.instance)
+ cfg->data.instance = ewl_config_create_hash();
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static Ecore_Hash *
ewl_config_set_hash_get(Ewl_Config *cfg, Ewl_State_Type state)
{
- Ecore_Hash *hash = NULL;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cfg, NULL);
-
- if (state == EWL_STATE_TRANSIENT)
- {
- ewl_config_create_instance_hash(cfg);
- hash = cfg->data.instance;
- }
- else
- {
- ewl_config_create_user_hash(cfg);
- hash = cfg->data.user;
- }
-
- DRETURN_PTR(hash, DLEVEL_STABLE);
+ Ecore_Hash *hash = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cfg, NULL);
+
+ if (state == EWL_STATE_TRANSIENT)
+ {
+ ewl_config_create_instance_hash(cfg);
+ hash = cfg->data.instance;
+ }
+ else
+ {
+ ewl_config_create_user_hash(cfg);
+ hash = cfg->data.user;
+ }
+
+ DRETURN_PTR(hash, DLEVEL_STABLE);
}
/* try to find the given key in our config. We check instance data first,
@@ -887,69 +887,69 @@ ewl_config_set_hash_get(Ewl_Config *cfg, Ewl_State_Type state)
static const char *
ewl_config_get(Ewl_Config *cfg, const char *key)
{
- const char *val = NULL;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cfg, NULL);
- DCHECK_PARAM_PTR_RET(key, NULL);
-
- if (cfg->data.instance
- && (val = ecore_hash_get(cfg->data.instance, key)))
- {
- /* we got our value, just NOP */
- }
- else if ((val = ewl_config_env_get(cfg, key)))
- {
- /* we got our value, just NOP */
- }
- else if (cfg->data.user
- && (val = ecore_hash_get(cfg->data.user, key)))
- {
- /* we got our value, just NOP */
- }
- else if (cfg->data.system
- && (val = ecore_hash_get(cfg->data.system, key)))
- {
- /* we got our value, just NOP */
- }
-
- DRETURN_PTR(val, DLEVEL_STABLE);
+ const char *val = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cfg, NULL);
+ DCHECK_PARAM_PTR_RET(key, NULL);
+
+ if (cfg->data.instance
+ && (val = ecore_hash_get(cfg->data.instance, key)))
+ {
+ /* we got our value, just NOP */
+ }
+ else if ((val = ewl_config_env_get(cfg, key)))
+ {
+ /* we got our value, just NOP */
+ }
+ else if (cfg->data.user
+ && (val = ecore_hash_get(cfg->data.user, key)))
+ {
+ /* we got our value, just NOP */
+ }
+ else if (cfg->data.system
+ && (val = ecore_hash_get(cfg->data.system, key)))
+ {
+ /* we got our value, just NOP */
+ }
+
+ DRETURN_PTR(val, DLEVEL_STABLE);
}
/* Look up hash values in the environment and cache the results. */
static const char *
ewl_config_env_get(Ewl_Config *cfg, const char *key)
{
- int kpos, epos = 0;
- const char *val = NULL;
- char var_name[PATH_MAX];
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cfg, NULL);
- DCHECK_PARAM_PTR_RET(key, NULL);
-
- /* Skip all leading non-alphanumeric characters */
- for (kpos = 0; (key[kpos] && !isalnum(key[kpos])); kpos++);
-
- /*
- * Copy the config variable name in all upper case and substitute _ for
- * any non-alphanumeric characters.
- */
- while (epos < PATH_MAX && key[kpos])
- {
- if (isalnum(key[kpos]))
- var_name[epos] = toupper(key[kpos]);
- else
- var_name[epos] = '_';
- epos++;
- kpos++;
- }
-
- var_name[epos] = '\0';
-
- if (var_name[0]) val = getenv(var_name);
-
- DRETURN_PTR(val, DLEVEL_STABLE);
+ int kpos, epos = 0;
+ const char *val = NULL;
+ char var_name[PATH_MAX];
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cfg, NULL);
+ DCHECK_PARAM_PTR_RET(key, NULL);
+
+ /* Skip all leading non-alphanumeric characters */
+ for (kpos = 0; (key[kpos] && !isalnum(key[kpos])); kpos++);
+
+ /*
+ * Copy the config variable name in all upper case and substitute _ for
+ * any non-alphanumeric characters.
+ */
+ while (epos < PATH_MAX && key[kpos])
+ {
+ if (isalnum(key[kpos]))
+ var_name[epos] = toupper(key[kpos]);
+ else
+ var_name[epos] = '_';
+ epos++;
+ kpos++;
+ }
+
+ var_name[epos] = '\0';
+
+ if (var_name[0]) val = getenv(var_name);
+
+ DRETURN_PTR(val, DLEVEL_STABLE);
}
/* open the given file and add it's key/value pairs to the config structure.
@@ -958,158 +958,158 @@ ewl_config_env_get(Ewl_Config *cfg, const char *key)
static int
ewl_config_file_load(Ewl_Config *cfg, unsigned int is_system, const char *file)
{
- Ecore_Hash *hash;
- int fd;
- long size;
- char *data;
+ Ecore_Hash *hash;
+ int fd;
+ long size;
+ char *data;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cfg, FALSE);
- DCHECK_PARAM_PTR_RET(file, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cfg, FALSE);
+ DCHECK_PARAM_PTR_RET(file, FALSE);
- /* make sure the config file exists */
- if (!ecore_file_exists(file))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ /* make sure the config file exists */
+ if (!ecore_file_exists(file))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
#ifndef _WIN32
- fd = open(file, O_RDONLY, S_IRUSR);
+ fd = open(file, O_RDONLY, S_IRUSR);
#else
# ifdef __MINGW32__
- fd = _sopen(file, O_RDONLY, _SH_DENYWR, S_IRUSR);
+ fd = _sopen(file, O_RDONLY, _SH_DENYWR, S_IRUSR);
# else
- _sopen_s(&fd, file, O_RDONLY, _SH_DENYWR, S_IRUSR);
+ _sopen_s(&fd, file, O_RDONLY, _SH_DENYWR, S_IRUSR);
# endif /* __MINGW32 */
#endif /* _WIN32 */
- if (fd == -1)
- {
- DWARNING("Unable to open cfg file %s.", file);
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
-
- size = ecore_file_size(file);
-
- if (!ewl_config_file_read_lock(fd, size))
- {
- DWARNING("Unable to lock %s for read.", file);
-
- close(fd);
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
-
- /* read the file into memory
- *
- * XXX we may want to do this in chunks as the config could be
- * large ...
- */
- data = malloc(sizeof(char) * (size + 1));
- read(fd, data, size);
- data[size] = '\0';
-
- /* release the lock as the file is in memory */
- ewl_config_file_unlock(fd, size);
- close(fd);
-
- /* create the hash to store the values */
- if (is_system)
- {
- ewl_config_create_system_hash(cfg);
- hash = cfg->data.system;
- }
- else
- {
- ewl_config_create_user_hash(cfg);
- hash = cfg->data.user;
- }
-
- ewl_config_parse(cfg, hash, data);
- FREE(data);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ if (fd == -1)
+ {
+ DWARNING("Unable to open cfg file %s.", file);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+
+ size = ecore_file_size(file);
+
+ if (!ewl_config_file_read_lock(fd, size))
+ {
+ DWARNING("Unable to lock %s for read.", file);
+
+ close(fd);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+
+ /* read the file into memory
+ *
+ * XXX we may want to do this in chunks as the config could be
+ * large ...
+ */
+ data = malloc(sizeof(char) * (size + 1));
+ read(fd, data, size);
+ data[size] = '\0';
+
+ /* release the lock as the file is in memory */
+ ewl_config_file_unlock(fd, size);
+ close(fd);
+
+ /* create the hash to store the values */
+ if (is_system)
+ {
+ ewl_config_create_system_hash(cfg);
+ hash = cfg->data.system;
+ }
+ else
+ {
+ ewl_config_create_user_hash(cfg);
+ hash = cfg->data.user;
+ }
+
+ ewl_config_parse(cfg, hash, data);
+ FREE(data);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static void
ewl_config_parse(Ewl_Config *cfg, Ecore_Hash *hash, char *data)
{
- char *start;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cfg);
- DCHECK_PARAM_PTR(hash);
- DCHECK_PARAM_PTR(data);
-
- start = data;
- while (start)
- {
- char *middle = NULL, *end, *key = NULL, *val = NULL;
-
- /* skip over blank space */
- while (isspace(*start) && (*start != '\0'))
- start ++;
- if (*start == '\0') break;
-
- /* skip over comment lines */
- if (*start == '#')
- {
- while ((*start != '\n') && (*start != '\0'))
- start ++;
- if (*start == '\0') break;
-
- start ++;
-
- continue;
- }
-
- /* at this point we should have an actual key/value pair */
- end = start;
- while ((*end != '\0') && (*end != '\n') && (*end != '\r'))
- {
- if (*end == '=')
- {
- middle = end;
- *middle = '\0';
- }
- end ++;
- }
- *end = '\0';
-
- if (start && middle && end)
- {
- key = strdup(start);
- key = ewl_config_trim(key);
-
- val = strdup(middle + 1);
- val = ewl_config_trim(val);
-
- ecore_hash_set(hash, key, val);
- }
-
- start = end + 1;
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ char *start;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cfg);
+ DCHECK_PARAM_PTR(hash);
+ DCHECK_PARAM_PTR(data);
+
+ start = data;
+ while (start)
+ {
+ char *middle = NULL, *end, *key = NULL, *val = NULL;
+
+ /* skip over blank space */
+ while (isspace(*start) && (*start != '\0'))
+ start ++;
+ if (*start == '\0') break;
+
+ /* skip over comment lines */
+ if (*start == '#')
+ {
+ while ((*start != '\n') && (*start != '\0'))
+ start ++;
+ if (*start == '\0') break;
+
+ start ++;
+
+ continue;
+ }
+
+ /* at this point we should have an actual key/value pair */
+ end = start;
+ while ((*end != '\0') && (*end != '\n') && (*end != '\r'))
+ {
+ if (*end == '=')
+ {
+ middle = end;
+ *middle = '\0';
+ }
+ end ++;
+ }
+ *end = '\0';
+
+ if (start && middle && end)
+ {
+ key = strdup(start);
+ key = ewl_config_trim(key);
+
+ val = strdup(middle + 1);
+ val = ewl_config_trim(val);
+
+ ecore_hash_set(hash, key, val);
+ }
+
+ start = end + 1;
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static char *
ewl_config_trim(char *v2)
{
- char *end, *old, *v;
+ char *end, *old, *v;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(v2, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(v2, NULL);
- old = v2;
- v = v2;
- end = v + strlen(v);
+ old = v2;
+ v = v2;
+ end = v + strlen(v);
- /* strip from beginning */
- while (isspace(*v) && (*v != '\0')) v++;
- while ((isspace(*end) || (*end == '\0')) && (end != v)) end --;
- *(++end) = '\0';
+ /* strip from beginning */
+ while (isspace(*v) && (*v != '\0')) v++;
+ while ((isspace(*end) || (*end == '\0')) && (end != v)) end --;
+ *(++end) = '\0';
- v2 = strdup(v);
- FREE(old);
+ v2 = strdup(v);
+ FREE(old);
- DRETURN_PTR(v2, DLEVEL_STABLE);
+ DRETURN_PTR(v2, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_config.h b/src/lib/ewl_config.h
index 600dd23..ef3b539 100644
--- a/src/lib/ewl_config.h
+++ b/src/lib/ewl_config.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_CONFIG_H
#define EWL_CONFIG_H
@@ -18,52 +18,52 @@ typedef struct Ewl_Config Ewl_Config;
*/
struct Ewl_Config
{
- char *app_name; /**< The application name*/
+ char *app_name; /**< The application name*/
- struct
- {
- Ecore_Hash *user; /**< User data */
- Ecore_Hash *system; /**< System data */
- Ecore_Hash *instance; /**< Data for this instance only */
- } data; /**< The config data */
+ struct
+ {
+ Ecore_Hash *user; /**< User data */
+ Ecore_Hash *system; /**< System data */
+ Ecore_Hash *instance; /**< Data for this instance only */
+ } data; /**< The config data */
};
-int ewl_config_init(void);
-void ewl_config_shutdown(void);
-void ewl_config_cache_init(void);
+int ewl_config_init(void);
+void ewl_config_shutdown(void);
+void ewl_config_cache_init(void);
-Ewl_Config *ewl_config_new(const char *app_name);
-void ewl_config_destroy(Ewl_Config *cfg);
+Ewl_Config *ewl_config_new(const char *app_name);
+void ewl_config_destroy(Ewl_Config *cfg);
-void ewl_config_string_set(Ewl_Config *cfg, const char *k,
- const char *v,
- Ewl_State_Type state);
-const char *ewl_config_string_get(Ewl_Config *cfg, const char *k);
+void ewl_config_string_set(Ewl_Config *cfg, const char *k,
+ const char *v,
+ Ewl_State_Type state);
+const char *ewl_config_string_get(Ewl_Config *cfg, const char *k);
-void ewl_config_int_set(Ewl_Config *cfg, const char *k, int v,
- Ewl_State_Type state);
-int ewl_config_int_get(Ewl_Config *cfg, const char *k);
+void ewl_config_int_set(Ewl_Config *cfg, const char *k, int v,
+ Ewl_State_Type state);
+int ewl_config_int_get(Ewl_Config *cfg, const char *k);
-void ewl_config_float_set(Ewl_Config *cfg, const char *k,
- float v,
- Ewl_State_Type state);
-float ewl_config_float_get(Ewl_Config *cfg, const char *k);
+void ewl_config_float_set(Ewl_Config *cfg, const char *k,
+ float v,
+ Ewl_State_Type state);
+float ewl_config_float_get(Ewl_Config *cfg, const char *k);
-void ewl_config_color_set(Ewl_Config *cfg, const char *k,
- int r, int g, int b, int a,
- Ewl_State_Type state);
-void ewl_config_color_get(Ewl_Config *cfg, const char *k,
- int *r, int *g,
- int *b, int *a);
+void ewl_config_color_set(Ewl_Config *cfg, const char *k,
+ int r, int g, int b, int a,
+ Ewl_State_Type state);
+void ewl_config_color_get(Ewl_Config *cfg, const char *k,
+ int *r, int *g,
+ int *b, int *a);
-void ewl_config_key_remove(Ewl_Config *cfg, const char *k);
-void ewl_config_instance_key_remove(Ewl_Config *cfg, const char *k);
-void ewl_config_system_key_remove(Ewl_Config *cfg, const char *k);
-void ewl_config_user_key_remove(Ewl_Config *cfg, const char *k);
+void ewl_config_key_remove(Ewl_Config *cfg, const char *k);
+void ewl_config_instance_key_remove(Ewl_Config *cfg, const char *k);
+void ewl_config_system_key_remove(Ewl_Config *cfg, const char *k);
+void ewl_config_user_key_remove(Ewl_Config *cfg, const char *k);
-int ewl_config_can_save_system(Ewl_Config *cfg);
-int ewl_config_system_save(Ewl_Config *cfg);
-int ewl_config_user_save(Ewl_Config *cfg);
+int ewl_config_can_save_system(Ewl_Config *cfg);
+int ewl_config_system_save(Ewl_Config *cfg);
+int ewl_config_user_save(Ewl_Config *cfg);
/**
* @}
diff --git a/src/lib/ewl_container.c b/src/lib/ewl_container.c
index 9f36a08..e36eb70 100644
--- a/src/lib/ewl_container.c
+++ b/src/lib/ewl_container.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_macros.h"
#include "ewl_private.h"
@@ -7,9 +7,9 @@
#include <Evas.h>
static void ewl_container_child_insert_helper(Ewl_Container *pc,
- Ewl_Widget *child,
- int index,
- int skip_internal);
+ Ewl_Widget *child,
+ int index,
+ int skip_internal);
static int ewl_container_child_count_get_helper(Ewl_Container *c, int skip);
/**
@@ -23,51 +23,51 @@ static int ewl_container_child_count_get_helper(Ewl_Container *c, int skip);
int
ewl_container_init(Ewl_Container *c)
{
- Ewl_Widget *w;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(c, FALSE);
-
- w = EWL_WIDGET(c);
-
- /*
- * Initialize the fields inherited from the widget class
- */
- if (!ewl_widget_init(w))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- ewl_widget_inherit(w, EWL_CONTAINER_TYPE);
- ewl_object_recursive_set(EWL_OBJECT(w), TRUE);
-
- /*
- * Initialize the fields specific to the container class.
- */
- c->children = ecore_dlist_new();
-
- /*
- * All containers need to perform the function of updating the
- * children with necessary window and evas information.
- */
- ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
- ewl_container_cb_configure, NULL);
- ewl_callback_append(w, EWL_CALLBACK_OBSCURE,
- ewl_container_cb_obscure, NULL);
- ewl_callback_append(w, EWL_CALLBACK_REVEAL,
- ewl_container_cb_reveal, NULL);
- ewl_callback_append(w, EWL_CALLBACK_REALIZE,
- ewl_container_cb_reveal, NULL);
- ewl_callback_append(w, EWL_CALLBACK_REALIZE,
- ewl_container_cb_realize, NULL);
- ewl_callback_append(w, EWL_CALLBACK_UNREALIZE,
- ewl_container_cb_unrealize, NULL);
- ewl_callback_append(w, EWL_CALLBACK_REPARENT,
- ewl_container_cb_reparent, NULL);
- ewl_callback_append(w, EWL_CALLBACK_WIDGET_ENABLE,
- ewl_container_cb_enable, NULL);
- ewl_callback_append(w, EWL_CALLBACK_WIDGET_DISABLE,
- ewl_container_cb_disable, NULL);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Widget *w;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(c, FALSE);
+
+ w = EWL_WIDGET(c);
+
+ /*
+ * Initialize the fields inherited from the widget class
+ */
+ if (!ewl_widget_init(w))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ ewl_widget_inherit(w, EWL_CONTAINER_TYPE);
+ ewl_object_recursive_set(EWL_OBJECT(w), TRUE);
+
+ /*
+ * Initialize the fields specific to the container class.
+ */
+ c->children = ecore_dlist_new();
+
+ /*
+ * All containers need to perform the function of updating the
+ * children with necessary window and evas information.
+ */
+ ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
+ ewl_container_cb_configure, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_OBSCURE,
+ ewl_container_cb_obscure, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_REVEAL,
+ ewl_container_cb_reveal, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_REALIZE,
+ ewl_container_cb_reveal, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_REALIZE,
+ ewl_container_cb_realize, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_UNREALIZE,
+ ewl_container_cb_unrealize, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_REPARENT,
+ ewl_container_cb_reparent, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_WIDGET_ENABLE,
+ ewl_container_cb_enable, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_WIDGET_DISABLE,
+ ewl_container_cb_disable, NULL);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -81,13 +81,13 @@ ewl_container_init(Ewl_Container *c)
void
ewl_container_add_notify_set(Ewl_Container *container, Ewl_Child_Add add)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(container);
- DCHECK_TYPE(container, EWL_CONTAINER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(container);
+ DCHECK_TYPE(container, EWL_CONTAINER_TYPE);
- container->child_add = add;
+ container->child_add = add;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -101,13 +101,13 @@ ewl_container_add_notify_set(Ewl_Container *container, Ewl_Child_Add add)
void
ewl_container_remove_notify_set(Ewl_Container *container, Ewl_Child_Remove remove)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(container);
- DCHECK_TYPE(container, EWL_CONTAINER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(container);
+ DCHECK_TYPE(container, EWL_CONTAINER_TYPE);
- container->child_remove = remove;
+ container->child_remove = remove;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -121,13 +121,13 @@ ewl_container_remove_notify_set(Ewl_Container *container, Ewl_Child_Remove remov
void
ewl_container_resize_notify_set(Ewl_Container *container, Ewl_Child_Resize resize)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(container);
- DCHECK_TYPE(container, EWL_CONTAINER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(container);
+ DCHECK_TYPE(container, EWL_CONTAINER_TYPE);
- container->child_resize = resize;
+ container->child_resize = resize;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -141,13 +141,13 @@ ewl_container_resize_notify_set(Ewl_Container *container, Ewl_Child_Resize resiz
void
ewl_container_show_notify_set(Ewl_Container *container, Ewl_Child_Show show)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(container);
- DCHECK_TYPE(container, EWL_CONTAINER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(container);
+ DCHECK_TYPE(container, EWL_CONTAINER_TYPE);
- container->child_show = show;
+ container->child_show = show;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -161,13 +161,13 @@ ewl_container_show_notify_set(Ewl_Container *container, Ewl_Child_Show show)
void
ewl_container_hide_notify_set(Ewl_Container *container, Ewl_Child_Hide hide)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(container);
- DCHECK_TYPE(container, EWL_CONTAINER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(container);
+ DCHECK_TYPE(container, EWL_CONTAINER_TYPE);
- container->child_hide = hide;
+ container->child_hide = hide;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -181,28 +181,28 @@ ewl_container_hide_notify_set(Ewl_Container *container, Ewl_Child_Hide hide)
void
ewl_container_child_append(Ewl_Container *pc, Ewl_Widget *child)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(pc);
- DCHECK_PARAM_PTR(child);
- DCHECK_TYPE(pc, EWL_CONTAINER_TYPE);
- DCHECK_TYPE(child, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(pc);
+ DCHECK_PARAM_PTR(child);
+ DCHECK_TYPE(pc, EWL_CONTAINER_TYPE);
+ DCHECK_TYPE(child, EWL_WIDGET_TYPE);
- if (pc == EWL_CONTAINER(child->parent))
- DRETURN(DLEVEL_STABLE);
+ if (pc == EWL_CONTAINER(child->parent))
+ DRETURN(DLEVEL_STABLE);
- if (ewl_widget_parent_of(child, EWL_WIDGET(pc))) {
- DWARNING("Attempting to make a child a parent of itself.");
- DRETURN(DLEVEL_STABLE);
- }
+ if (ewl_widget_parent_of(child, EWL_WIDGET(pc))) {
+ DWARNING("Attempting to make a child a parent of itself.");
+ DRETURN(DLEVEL_STABLE);
+ }
- while (pc->redirect)
- pc = pc->redirect;
+ while (pc->redirect)
+ pc = pc->redirect;
- ewl_widget_parent_set(child, EWL_WIDGET(pc));
- ecore_dlist_append(pc->children, child);
- ewl_container_child_add_call(pc, child);
+ ewl_widget_parent_set(child, EWL_WIDGET(pc));
+ ecore_dlist_append(pc->children, child);
+ ewl_container_child_add_call(pc, child);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -216,77 +216,77 @@ ewl_container_child_append(Ewl_Container *pc, Ewl_Widget *child)
void
ewl_container_child_prepend(Ewl_Container *pc, Ewl_Widget *child)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(pc);
- DCHECK_PARAM_PTR(child);
- DCHECK_TYPE(pc, EWL_CONTAINER_TYPE);
- DCHECK_TYPE(child, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(pc);
+ DCHECK_PARAM_PTR(child);
+ DCHECK_TYPE(pc, EWL_CONTAINER_TYPE);
+ DCHECK_TYPE(child, EWL_WIDGET_TYPE);
- if (pc == EWL_CONTAINER(child->parent))
- DRETURN(DLEVEL_STABLE);
+ if (pc == EWL_CONTAINER(child->parent))
+ DRETURN(DLEVEL_STABLE);
- if (ewl_widget_parent_of(child, EWL_WIDGET(pc))) {
- DWARNING("Attempting to make a child a parent of itself.");
- DRETURN(DLEVEL_STABLE);
- }
+ if (ewl_widget_parent_of(child, EWL_WIDGET(pc))) {
+ DWARNING("Attempting to make a child a parent of itself.");
+ DRETURN(DLEVEL_STABLE);
+ }
- while (pc->redirect)
- pc = pc->redirect;
+ while (pc->redirect)
+ pc = pc->redirect;
- ewl_widget_parent_set(child, EWL_WIDGET(pc));
- ecore_dlist_prepend(pc->children, child);
- ewl_container_child_add_call(pc, child);
+ ewl_widget_parent_set(child, EWL_WIDGET(pc));
+ ecore_dlist_prepend(pc->children, child);
+ ewl_container_child_add_call(pc, child);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_container_child_insert_helper(Ewl_Container *pc, Ewl_Widget *child,
- int index, int skip_internal)
+ int index, int skip_internal)
{
- Ewl_Widget *cur;
- int idx = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(pc);
- DCHECK_PARAM_PTR(child);
- DCHECK_TYPE(pc, EWL_CONTAINER_TYPE);
- DCHECK_TYPE(child, EWL_WIDGET_TYPE);
-
- /* already inserted */
- if (pc == EWL_CONTAINER(child->parent))
- DRETURN(DLEVEL_STABLE);
-
- if (ewl_widget_parent_of(child, EWL_WIDGET(pc))) {
- DWARNING("Attempting to make a child a parent of itself.");
- DRETURN(DLEVEL_STABLE);
- }
-
- /* find the real container */
- while (pc->redirect)
- pc = pc->redirect;
-
- /* find our insertion point */
- ecore_dlist_first_goto(pc->children);
- while ((cur = ecore_dlist_current(pc->children)))
- {
- if (skip_internal && ewl_widget_internal_is(cur))
- {
- ecore_dlist_next(pc->children);
- continue;
- }
-
- if (idx == index) break;
-
- idx++;
- ecore_dlist_next(pc->children);
- }
-
- ewl_widget_parent_set(child, EWL_WIDGET(pc));
- ecore_dlist_insert(pc->children, child);
- ewl_container_child_add_call(pc, child);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Widget *cur;
+ int idx = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(pc);
+ DCHECK_PARAM_PTR(child);
+ DCHECK_TYPE(pc, EWL_CONTAINER_TYPE);
+ DCHECK_TYPE(child, EWL_WIDGET_TYPE);
+
+ /* already inserted */
+ if (pc == EWL_CONTAINER(child->parent))
+ DRETURN(DLEVEL_STABLE);
+
+ if (ewl_widget_parent_of(child, EWL_WIDGET(pc))) {
+ DWARNING("Attempting to make a child a parent of itself.");
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ /* find the real container */
+ while (pc->redirect)
+ pc = pc->redirect;
+
+ /* find our insertion point */
+ ecore_dlist_first_goto(pc->children);
+ while ((cur = ecore_dlist_current(pc->children)))
+ {
+ if (skip_internal && ewl_widget_internal_is(cur))
+ {
+ ecore_dlist_next(pc->children);
+ continue;
+ }
+
+ if (idx == index) break;
+
+ idx++;
+ ecore_dlist_next(pc->children);
+ }
+
+ ewl_widget_parent_set(child, EWL_WIDGET(pc));
+ ecore_dlist_insert(pc->children, child);
+ ewl_container_child_add_call(pc, child);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -303,15 +303,15 @@ ewl_container_child_insert_helper(Ewl_Container *pc, Ewl_Widget *child,
void
ewl_container_child_insert(Ewl_Container *pc, Ewl_Widget *child, int index)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(pc);
- DCHECK_PARAM_PTR(child);
- DCHECK_TYPE(pc, EWL_CONTAINER_TYPE);
- DCHECK_TYPE(child, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(pc);
+ DCHECK_PARAM_PTR(child);
+ DCHECK_TYPE(pc, EWL_CONTAINER_TYPE);
+ DCHECK_TYPE(child, EWL_WIDGET_TYPE);
- ewl_container_child_insert_helper(pc, child, index, TRUE);
+ ewl_container_child_insert_helper(pc, child, index, TRUE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -326,17 +326,17 @@ ewl_container_child_insert(Ewl_Container *pc, Ewl_Widget *child, int index)
*/
void
ewl_container_child_insert_internal(Ewl_Container *pc,
- Ewl_Widget *child, int index)
+ Ewl_Widget *child, int index)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(pc);
- DCHECK_PARAM_PTR(child);
- DCHECK_TYPE(pc, EWL_CONTAINER_TYPE);
- DCHECK_TYPE(child, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(pc);
+ DCHECK_PARAM_PTR(child);
+ DCHECK_TYPE(pc, EWL_CONTAINER_TYPE);
+ DCHECK_TYPE(child, EWL_WIDGET_TYPE);
- ewl_container_child_insert_helper(pc, child, index, FALSE);
+ ewl_container_child_insert_helper(pc, child, index, FALSE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -350,83 +350,83 @@ ewl_container_child_insert_internal(Ewl_Container *pc,
void
ewl_container_child_remove(Ewl_Container *pc, Ewl_Widget *child)
{
- Ewl_Widget *temp;
- int idx = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(pc);
- DCHECK_PARAM_PTR(child);
- DCHECK_TYPE(pc, EWL_CONTAINER_TYPE);
- DCHECK_TYPE(child, EWL_WIDGET_TYPE);
-
- if (child == EWL_WIDGET(pc->redirect))
- pc->redirect = NULL;
-
- /*
- * First remove reference to the parent if necessary.
- * Bail out after setting the parent as that will get us back here
- * with a NULL parent on the widget.
- */
- if (child->parent) {
- ewl_widget_parent_set(child, NULL);
- DRETURN(DLEVEL_STABLE);
- }
-
- if (!pc->children)
- DRETURN(DLEVEL_STABLE);
-
- /*
- * Traverse the list to the child.
- */
- temp = ecore_dlist_goto(pc->children, child);
-
- /*
- * If the child isn't found, then this isn't it's parent.
- */
- if (!temp)
- DRETURN(DLEVEL_STABLE);
-
- /* get the index of the widget we are removing */
- idx = ecore_dlist_index(pc->children);
-
- /*
- * Remove the child from the parent and set the childs parent to NULL
- */
- ecore_dlist_remove(pc->children);
- if (VISIBLE(child) && REALIZED(child))
- ewl_container_child_hide_call(pc, child);
-
- ewl_container_child_remove_call(pc, child, idx);
- ewl_widget_configure(EWL_WIDGET(pc));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Widget *temp;
+ int idx = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(pc);
+ DCHECK_PARAM_PTR(child);
+ DCHECK_TYPE(pc, EWL_CONTAINER_TYPE);
+ DCHECK_TYPE(child, EWL_WIDGET_TYPE);
+
+ if (child == EWL_WIDGET(pc->redirect))
+ pc->redirect = NULL;
+
+ /*
+ * First remove reference to the parent if necessary.
+ * Bail out after setting the parent as that will get us back here
+ * with a NULL parent on the widget.
+ */
+ if (child->parent) {
+ ewl_widget_parent_set(child, NULL);
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ if (!pc->children)
+ DRETURN(DLEVEL_STABLE);
+
+ /*
+ * Traverse the list to the child.
+ */
+ temp = ecore_dlist_goto(pc->children, child);
+
+ /*
+ * If the child isn't found, then this isn't it's parent.
+ */
+ if (!temp)
+ DRETURN(DLEVEL_STABLE);
+
+ /* get the index of the widget we are removing */
+ idx = ecore_dlist_index(pc->children);
+
+ /*
+ * Remove the child from the parent and set the childs parent to NULL
+ */
+ ecore_dlist_remove(pc->children);
+ if (VISIBLE(child) && REALIZED(child))
+ ewl_container_child_hide_call(pc, child);
+
+ ewl_container_child_remove_call(pc, child, idx);
+ ewl_widget_configure(EWL_WIDGET(pc));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static int
ewl_container_child_count_get_helper(Ewl_Container *c, int skip)
{
- Ewl_Widget *child = NULL;
- Ewl_Container *container = NULL;
- int count = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(c, 0);
- DCHECK_TYPE_RET(c, EWL_CONTAINER_TYPE, 0);
-
- /*
- * Find the container where children are actually added.
- */
- container = c;
- while (container->redirect) container = container->redirect;
-
- ecore_dlist_first_goto(container->children);
- while ((child = ecore_dlist_next(container->children)))
- {
- if (skip && ewl_widget_internal_is(child)) continue;
- count++;
- }
-
- DRETURN_INT(count, DLEVEL_STABLE);
+ Ewl_Widget *child = NULL;
+ Ewl_Container *container = NULL;
+ int count = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(c, 0);
+ DCHECK_TYPE_RET(c, EWL_CONTAINER_TYPE, 0);
+
+ /*
+ * Find the container where children are actually added.
+ */
+ container = c;
+ while (container->redirect) container = container->redirect;
+
+ ecore_dlist_first_goto(container->children);
+ while ((child = ecore_dlist_next(container->children)))
+ {
+ if (skip && ewl_widget_internal_is(child)) continue;
+ count++;
+ }
+
+ DRETURN_INT(count, DLEVEL_STABLE);
}
/**
@@ -437,15 +437,15 @@ ewl_container_child_count_get_helper(Ewl_Container *c, int skip)
int
ewl_container_child_count_get(Ewl_Container *c)
{
- int count = 0;
+ int count = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(c, 0);
- DCHECK_TYPE_RET(c, EWL_CONTAINER_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(c, 0);
+ DCHECK_TYPE_RET(c, EWL_CONTAINER_TYPE, 0);
- count = ewl_container_child_count_get_helper(c, TRUE);
+ count = ewl_container_child_count_get_helper(c, TRUE);
- DRETURN_INT(count, DLEVEL_STABLE);
+ DRETURN_INT(count, DLEVEL_STABLE);
}
/**
@@ -456,15 +456,15 @@ ewl_container_child_count_get(Ewl_Container *c)
int
ewl_container_child_count_internal_get(Ewl_Container *c)
{
- int count = 0;
+ int count = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(c, 0);
- DCHECK_TYPE_RET(c, EWL_CONTAINER_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(c, 0);
+ DCHECK_TYPE_RET(c, EWL_CONTAINER_TYPE, 0);
- count = ewl_container_child_count_get_helper(c, FALSE);
+ count = ewl_container_child_count_get_helper(c, FALSE);
- DRETURN_INT(count, DLEVEL_STABLE);
+ DRETURN_INT(count, DLEVEL_STABLE);
}
/**
@@ -481,37 +481,37 @@ ewl_container_child_count_internal_get(Ewl_Container *c)
int
ewl_container_child_count_visible_get(Ewl_Container *c)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(c, 0);
- DCHECK_TYPE_RET(c, EWL_CONTAINER_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(c, 0);
+ DCHECK_TYPE_RET(c, EWL_CONTAINER_TYPE, 0);
- DRETURN_INT(c->visible_children, DLEVEL_STABLE);
+ DRETURN_INT(c->visible_children, DLEVEL_STABLE);
}
static Ewl_Widget *
ewl_container_child_helper_get(Ewl_Container *parent, int index,
- unsigned int skip)
+ unsigned int skip)
{
- Ewl_Container *container = NULL;
- Ewl_Widget *child;
- int count = 0;
+ Ewl_Container *container = NULL;
+ Ewl_Widget *child;
+ int count = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(parent, NULL);
- DCHECK_TYPE_RET(parent, EWL_CONTAINER_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(parent, NULL);
+ DCHECK_TYPE_RET(parent, EWL_CONTAINER_TYPE, NULL);
- container = parent;
- while (container->redirect) container = container->redirect;
+ container = parent;
+ while (container->redirect) container = container->redirect;
- ecore_dlist_first_goto(container->children);
+ ecore_dlist_first_goto(container->children);
- while ((child = ecore_dlist_next(container->children))) {
- if (skip && ewl_widget_internal_is(child)) continue;
- if (count == index) break;
- count ++;
- }
+ while ((child = ecore_dlist_next(container->children))) {
+ if (skip && ewl_widget_internal_is(child)) continue;
+ if (count == index) break;
+ count ++;
+ }
- DRETURN_PTR(((count == index) ? child : NULL), DLEVEL_STABLE);
+ DRETURN_PTR(((count == index) ? child : NULL), DLEVEL_STABLE);
}
/**
@@ -523,15 +523,15 @@ ewl_container_child_helper_get(Ewl_Container *parent, int index,
Ewl_Widget *
ewl_container_child_get(Ewl_Container *parent, int index)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(parent, NULL);
- DCHECK_TYPE_RET(parent, EWL_CONTAINER_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(parent, NULL);
+ DCHECK_TYPE_RET(parent, EWL_CONTAINER_TYPE, NULL);
- w = ewl_container_child_helper_get(parent, index, TRUE);
+ w = ewl_container_child_helper_get(parent, index, TRUE);
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
/**
@@ -545,47 +545,47 @@ ewl_container_child_get(Ewl_Container *parent, int index)
Ewl_Widget *
ewl_container_child_internal_get(Ewl_Container *parent, int index)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(parent, NULL);
- DCHECK_TYPE_RET(parent, EWL_CONTAINER_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(parent, NULL);
+ DCHECK_TYPE_RET(parent, EWL_CONTAINER_TYPE, NULL);
- w = ewl_container_child_helper_get(parent, index, FALSE);
+ w = ewl_container_child_helper_get(parent, index, FALSE);
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
static int
ewl_container_child_index_helper_get(Ewl_Container *parent, Ewl_Widget *w,
- unsigned int skip)
+ unsigned int skip)
{
- unsigned int idx = 0;
- int ret = -1;
- Ewl_Container *container;
- Ewl_Widget *child;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(parent, ret);
- DCHECK_PARAM_PTR_RET(w, ret);
- DCHECK_TYPE_RET(parent, EWL_CONTAINER_TYPE, ret);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, ret);
-
- container = parent;
- while (container->redirect) container = container->redirect;
-
- ecore_dlist_first_goto(container->children);
- while ((child = ecore_dlist_next(container->children))) {
- if (skip && ewl_widget_internal_is(child)) continue;
- if (child == w)
- {
- ret = idx;
- break;
- }
- idx ++;
- }
-
- DRETURN_INT(ret, DLEVEL_STABLE);
+ unsigned int idx = 0;
+ int ret = -1;
+ Ewl_Container *container;
+ Ewl_Widget *child;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(parent, ret);
+ DCHECK_PARAM_PTR_RET(w, ret);
+ DCHECK_TYPE_RET(parent, EWL_CONTAINER_TYPE, ret);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, ret);
+
+ container = parent;
+ while (container->redirect) container = container->redirect;
+
+ ecore_dlist_first_goto(container->children);
+ while ((child = ecore_dlist_next(container->children))) {
+ if (skip && ewl_widget_internal_is(child)) continue;
+ if (child == w)
+ {
+ ret = idx;
+ break;
+ }
+ idx ++;
+ }
+
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
/**
@@ -598,17 +598,17 @@ ewl_container_child_index_helper_get(Ewl_Container *parent, Ewl_Widget *w,
int
ewl_container_child_index_get(Ewl_Container *parent, Ewl_Widget *w)
{
- int idx = 0;
+ int idx = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(parent, idx);
- DCHECK_PARAM_PTR_RET(w, idx);
- DCHECK_TYPE_RET(parent, EWL_CONTAINER_TYPE, idx);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, idx);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(parent, idx);
+ DCHECK_PARAM_PTR_RET(w, idx);
+ DCHECK_TYPE_RET(parent, EWL_CONTAINER_TYPE, idx);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, idx);
- idx = ewl_container_child_index_helper_get(parent, w, TRUE);
+ idx = ewl_container_child_index_helper_get(parent, w, TRUE);
- DRETURN_INT(idx, DLEVEL_STABLE);
+ DRETURN_INT(idx, DLEVEL_STABLE);
}
/**
@@ -622,17 +622,17 @@ ewl_container_child_index_get(Ewl_Container *parent, Ewl_Widget *w)
int
ewl_container_child_index_internal_get(Ewl_Container *parent, Ewl_Widget *w)
{
- int idx = 0;
+ int idx = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(parent, idx);
- DCHECK_PARAM_PTR_RET(w, idx);
- DCHECK_TYPE_RET(parent, EWL_CONTAINER_TYPE, idx);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, idx);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(parent, idx);
+ DCHECK_PARAM_PTR_RET(w, idx);
+ DCHECK_TYPE_RET(parent, EWL_CONTAINER_TYPE, idx);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, idx);
- idx = ewl_container_child_index_helper_get(parent, w, FALSE);
+ idx = ewl_container_child_index_helper_get(parent, w, FALSE);
- DRETURN_INT(idx, DLEVEL_STABLE);
+ DRETURN_INT(idx, DLEVEL_STABLE);
}
/**
@@ -645,56 +645,56 @@ ewl_container_child_index_internal_get(Ewl_Container *parent, Ewl_Widget *w)
void
ewl_container_child_resize(Ewl_Widget *w, int size, Ewl_Orientation o)
{
- int old_w, old_h;
- int new_w, new_h;
- Ewl_Container *c;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- if (!size || !REALIZED(w) || ewl_object_queued_has(EWL_OBJECT(w),
- EWL_FLAG_QUEUED_SCHEDULED_REVEAL))
- DRETURN(DLEVEL_STABLE);
-
- c = EWL_CONTAINER(w->parent);
-
- /*
- * If there is no parent to this widget, or it hasn't really changed
- * size just exit. Also exit if it has no function to be notified for
- * child resizes.
- */
- if (HIDDEN(w) || !c || !c->child_resize)
- DRETURN(DLEVEL_STABLE);
-
- /*
- * Store the parents current size so we can determine if it changes
- */
- old_w = PREFERRED_W(w);
- old_h = PREFERRED_H(w);
-
- /*
- * Run the parents child resize function to allow it to update it's
- * preferred size.
- */
- c->child_resize(c, w, size, o);
-
- /*
- * Get the new preferred size of the parent to see if it changed.
- */
- new_w = PREFERRED_W(w);
- new_h = PREFERRED_H(w);
-
- /*
- * The parent will only end up on the configure queue if it didn't
- * change size (ie. it's parent isn't on the configure queue).
- */
- if (EWL_WIDGET(c)->parent)
- ewl_widget_configure(EWL_WIDGET(c)->parent);
- else
- ewl_widget_configure(EWL_WIDGET(c));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int old_w, old_h;
+ int new_w, new_h;
+ Ewl_Container *c;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ if (!size || !REALIZED(w) || ewl_object_queued_has(EWL_OBJECT(w),
+ EWL_FLAG_QUEUED_SCHEDULED_REVEAL))
+ DRETURN(DLEVEL_STABLE);
+
+ c = EWL_CONTAINER(w->parent);
+
+ /*
+ * If there is no parent to this widget, or it hasn't really changed
+ * size just exit. Also exit if it has no function to be notified for
+ * child resizes.
+ */
+ if (HIDDEN(w) || !c || !c->child_resize)
+ DRETURN(DLEVEL_STABLE);
+
+ /*
+ * Store the parents current size so we can determine if it changes
+ */
+ old_w = PREFERRED_W(w);
+ old_h = PREFERRED_H(w);
+
+ /*
+ * Run the parents child resize function to allow it to update it's
+ * preferred size.
+ */
+ c->child_resize(c, w, size, o);
+
+ /*
+ * Get the new preferred size of the parent to see if it changed.
+ */
+ new_w = PREFERRED_W(w);
+ new_h = PREFERRED_H(w);
+
+ /*
+ * The parent will only end up on the configure queue if it didn't
+ * change size (ie. it's parent isn't on the configure queue).
+ */
+ if (EWL_WIDGET(c)->parent)
+ ewl_widget_configure(EWL_WIDGET(c)->parent);
+ else
+ ewl_widget_configure(EWL_WIDGET(c));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -710,40 +710,40 @@ ewl_container_child_resize(Ewl_Widget *w, int size, Ewl_Orientation o)
Ewl_Widget *
ewl_container_child_at_get(Ewl_Container *widget, int x, int y)
{
- Ewl_Widget *found = NULL;
- Ewl_Widget *child = NULL;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(widget, NULL);
- DCHECK_TYPE_RET(widget, EWL_CONTAINER_TYPE, NULL);
-
- if (!widget->children || ecore_dlist_empty_is(widget->children))
- DRETURN_PTR(NULL, DLEVEL_STABLE);
-
- ecore_dlist_first_goto(widget->children);
-
- /*
- * Search through the children to find an intersecting child.
- */
- while ((child = ecore_dlist_next(EWL_CONTAINER(widget)->children))) {
- if (VISIBLE(child) && !DISABLED(child)
- && x >= (CURRENT_X(child) - INSET_LEFT(child))
- && y >= (CURRENT_Y(child) - INSET_TOP(child))
- && (CURRENT_X(child) + CURRENT_W(child) +
- INSET_RIGHT(child)) >= x
- && (CURRENT_Y(child) + CURRENT_H(child) +
- INSET_BOTTOM(child)) >= y) {
- if (child->toplayered) {
- found = child;
- break;
- }
- if ((!found || ewl_widget_layer_priority_get(found) <=
- ewl_widget_layer_priority_get(child)))
- found = child;
- }
- }
-
- DRETURN_PTR(found, DLEVEL_STABLE);
+ Ewl_Widget *found = NULL;
+ Ewl_Widget *child = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(widget, NULL);
+ DCHECK_TYPE_RET(widget, EWL_CONTAINER_TYPE, NULL);
+
+ if (!widget->children || ecore_dlist_empty_is(widget->children))
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+
+ ecore_dlist_first_goto(widget->children);
+
+ /*
+ * Search through the children to find an intersecting child.
+ */
+ while ((child = ecore_dlist_next(EWL_CONTAINER(widget)->children))) {
+ if (VISIBLE(child) && !DISABLED(child)
+ && x >= (CURRENT_X(child) - INSET_LEFT(child))
+ && y >= (CURRENT_Y(child) - INSET_TOP(child))
+ && (CURRENT_X(child) + CURRENT_W(child) +
+ INSET_RIGHT(child)) >= x
+ && (CURRENT_Y(child) + CURRENT_H(child) +
+ INSET_BOTTOM(child)) >= y) {
+ if (child->toplayered) {
+ found = child;
+ break;
+ }
+ if ((!found || ewl_widget_layer_priority_get(found) <=
+ ewl_widget_layer_priority_get(child)))
+ found = child;
+ }
+ }
+
+ DRETURN_PTR(found, DLEVEL_STABLE);
}
/**
@@ -756,45 +756,45 @@ ewl_container_child_at_get(Ewl_Container *widget, int x, int y)
Ewl_Widget *
ewl_container_child_at_recursive_get(Ewl_Container *widget, int x, int y)
{
- /*
- * These temporary variables allow for traversing recursive
- * containers without actually making recursive function calls.
- */
- Ewl_Widget *child = NULL;
- Ewl_Widget *child2 = NULL;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(widget, NULL);
- DCHECK_TYPE_RET(widget, EWL_CONTAINER_TYPE, NULL);
-
- if (!widget->children || ecore_dlist_empty_is(widget->children))
- DRETURN_PTR(NULL, DLEVEL_STABLE);
-
- /*
- * The starting point is the current widget
- */
- child = EWL_WIDGET(widget);
-
- /*
- * Now move down through the tree of widgets until the bottom layer is
- * found.
- */
- if (!DISABLED(child))
- child2 = ewl_container_child_at_get(EWL_CONTAINER(child), x, y);
-
- while (child2) {
- if (RECURSIVE(child2))
- child = child2;
- else
- DRETURN_PTR(child2, DLEVEL_STABLE);
-
- if (!DISABLED(child))
- child2 = ewl_container_child_at_get(EWL_CONTAINER(child), x, y);
- else
- child2 = NULL;
- }
-
- DRETURN_PTR((child2 ? child2 : child), DLEVEL_STABLE);
+ /*
+ * These temporary variables allow for traversing recursive
+ * containers without actually making recursive function calls.
+ */
+ Ewl_Widget *child = NULL;
+ Ewl_Widget *child2 = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(widget, NULL);
+ DCHECK_TYPE_RET(widget, EWL_CONTAINER_TYPE, NULL);
+
+ if (!widget->children || ecore_dlist_empty_is(widget->children))
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+
+ /*
+ * The starting point is the current widget
+ */
+ child = EWL_WIDGET(widget);
+
+ /*
+ * Now move down through the tree of widgets until the bottom layer is
+ * found.
+ */
+ if (!DISABLED(child))
+ child2 = ewl_container_child_at_get(EWL_CONTAINER(child), x, y);
+
+ while (child2) {
+ if (RECURSIVE(child2))
+ child = child2;
+ else
+ DRETURN_PTR(child2, DLEVEL_STABLE);
+
+ if (!DISABLED(child))
+ child2 = ewl_container_child_at_get(EWL_CONTAINER(child), x, y);
+ else
+ child2 = NULL;
+ }
+
+ DRETURN_PTR((child2 ? child2 : child), DLEVEL_STABLE);
}
/**
@@ -808,39 +808,39 @@ ewl_container_child_at_recursive_get(Ewl_Container *widget, int x, int y)
void
ewl_container_reset(Ewl_Container *c)
{
- Ewl_Widget *w;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
-
- while (c->redirect)
- c = c->redirect;
-
- if (!c->children)
- DRETURN(DLEVEL_STABLE);
-
- /*
- * Loop through removing each child and destroying it.
- */
- ecore_dlist_first_goto(c->children);
- while ((w = ecore_dlist_current(c->children))) {
- if (!ewl_object_flags_has(EWL_OBJECT(w),
- EWL_FLAG_PROPERTY_INTERNAL,
- EWL_FLAGS_PROPERTY_MASK)) {
- ewl_widget_destroy(w);
-
- /*
- * Start over in case the list was modified from a
- * callback.
- */
- ecore_dlist_first_goto(c->children);
- }
- else
- ecore_dlist_next(c->children);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Widget *w;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+
+ while (c->redirect)
+ c = c->redirect;
+
+ if (!c->children)
+ DRETURN(DLEVEL_STABLE);
+
+ /*
+ * Loop through removing each child and destroying it.
+ */
+ ecore_dlist_first_goto(c->children);
+ while ((w = ecore_dlist_current(c->children))) {
+ if (!ewl_object_flags_has(EWL_OBJECT(w),
+ EWL_FLAG_PROPERTY_INTERNAL,
+ EWL_FLAGS_PROPERTY_MASK)) {
+ ewl_widget_destroy(w);
+
+ /*
+ * Start over in case the list was modified from a
+ * callback.
+ */
+ ecore_dlist_first_goto(c->children);
+ }
+ else
+ ecore_dlist_next(c->children);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -856,16 +856,16 @@ ewl_container_reset(Ewl_Container *c)
void
ewl_container_child_iterate_begin(Ewl_Container *c)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- while (c->redirect)
- c = c->redirect;
+ while (c->redirect)
+ c = c->redirect;
- ecore_dlist_first_goto(c->children);
+ ecore_dlist_first_goto(c->children);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -876,24 +876,24 @@ ewl_container_child_iterate_begin(Ewl_Container *c)
Ewl_Widget *
ewl_container_child_next(Ewl_Container *c)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(c, NULL);
- DCHECK_TYPE_RET(c, EWL_CONTAINER_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(c, NULL);
+ DCHECK_TYPE_RET(c, EWL_CONTAINER_TYPE, NULL);
- while (c->redirect)
- c = c->redirect;
+ while (c->redirect)
+ c = c->redirect;
- if (c->iterator) {
- w = c->iterator(c);
- }
- else {
- while ((w = ecore_dlist_next(c->children)) &&
- (ewl_widget_internal_is(w)));
- }
+ if (c->iterator) {
+ w = c->iterator(c);
+ }
+ else {
+ while ((w = ecore_dlist_next(c->children)) &&
+ (ewl_widget_internal_is(w)));
+ }
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
/**
@@ -907,13 +907,13 @@ ewl_container_child_next(Ewl_Container *c)
void
ewl_container_child_iterator_set(Ewl_Container *c, Ewl_Container_Iterator i)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- c->iterator = i;
+ c->iterator = i;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -928,13 +928,13 @@ ewl_container_child_iterator_set(Ewl_Container *c, Ewl_Container_Iterator i)
void
ewl_container_callback_intercept(Ewl_Container *c, unsigned int t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- EWL_CALLBACK_FLAG_INTERCEPT(EWL_WIDGET(c), t);
+ EWL_CALLBACK_FLAG_INTERCEPT(EWL_WIDGET(c), t);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -949,13 +949,13 @@ ewl_container_callback_intercept(Ewl_Container *c, unsigned int t)
void
ewl_container_callback_nointercept(Ewl_Container *c, unsigned int t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- EWL_CALLBACK_FLAG_NOINTERCEPT(EWL_WIDGET(c), t);
+ EWL_CALLBACK_FLAG_NOINTERCEPT(EWL_WIDGET(c), t);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -970,13 +970,13 @@ ewl_container_callback_nointercept(Ewl_Container *c, unsigned int t)
void
ewl_container_callback_notify(Ewl_Container *c, unsigned int t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- EWL_CALLBACK_FLAG_NOTIFY(EWL_WIDGET(c), t);
+ EWL_CALLBACK_FLAG_NOTIFY(EWL_WIDGET(c), t);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -990,13 +990,13 @@ ewl_container_callback_notify(Ewl_Container *c, unsigned int t)
void
ewl_container_callback_nonotify(Ewl_Container *c, unsigned int t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- EWL_CALLBACK_FLAG_NONOTIFY(EWL_WIDGET(c), t);
+ EWL_CALLBACK_FLAG_NONOTIFY(EWL_WIDGET(c), t);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1011,37 +1011,37 @@ ewl_container_callback_nonotify(Ewl_Container *c, unsigned int t)
void
ewl_container_largest_prefer(Ewl_Container *c, Ewl_Orientation o)
{
- Ewl_Object *child;
- int max_size = 0;
- int curr_size = 0;
- int (*get_size)(Ewl_Object *object);
- void (*set_size)(Ewl_Object *object, int size);
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
-
- if (o == EWL_ORIENTATION_HORIZONTAL) {
- get_size = ewl_object_preferred_w_get;
- set_size = ewl_object_preferred_inner_w_set;
- }
- else {
- get_size = ewl_object_preferred_h_get;
- set_size = ewl_object_preferred_inner_h_set;
- }
-
- ecore_dlist_first_goto(c->children);
- while ((child = ecore_dlist_next(c->children))) {
- if (VISIBLE(child) && REALIZED(child)) {
- curr_size = get_size(child);
- if (curr_size > max_size)
- max_size = curr_size;
- }
- }
-
- set_size(EWL_OBJECT(c), max_size);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Object *child;
+ int max_size = 0;
+ int curr_size = 0;
+ int (*get_size)(Ewl_Object *object);
+ void (*set_size)(Ewl_Object *object, int size);
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+
+ if (o == EWL_ORIENTATION_HORIZONTAL) {
+ get_size = ewl_object_preferred_w_get;
+ set_size = ewl_object_preferred_inner_w_set;
+ }
+ else {
+ get_size = ewl_object_preferred_h_get;
+ set_size = ewl_object_preferred_inner_h_set;
+ }
+
+ ecore_dlist_first_goto(c->children);
+ while ((child = ecore_dlist_next(c->children))) {
+ if (VISIBLE(child) && REALIZED(child)) {
+ curr_size = get_size(child);
+ if (curr_size > max_size)
+ max_size = curr_size;
+ }
+ }
+
+ set_size(EWL_OBJECT(c), max_size);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1053,33 +1053,33 @@ ewl_container_largest_prefer(Ewl_Container *c, Ewl_Orientation o)
void
ewl_container_sum_prefer(Ewl_Container *c, Ewl_Orientation o)
{
- Ewl_Object *child;
- int curr_size = 0;
- int (*get_size)(Ewl_Object *object);
- void (*set_size)(Ewl_Object *object, int size);
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
-
- if (o == EWL_ORIENTATION_HORIZONTAL) {
- get_size = ewl_object_preferred_w_get;
- set_size = ewl_object_preferred_inner_w_set;
- }
- else {
- get_size = ewl_object_preferred_h_get;
- set_size = ewl_object_preferred_inner_h_set;
- }
-
- ecore_dlist_first_goto(c->children);
- while ((child = ecore_dlist_next(c->children))) {
- if (VISIBLE(child) && REALIZED(child))
- curr_size += get_size(child);
- }
-
- set_size(EWL_OBJECT(c), curr_size);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Object *child;
+ int curr_size = 0;
+ int (*get_size)(Ewl_Object *object);
+ void (*set_size)(Ewl_Object *object, int size);
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+
+ if (o == EWL_ORIENTATION_HORIZONTAL) {
+ get_size = ewl_object_preferred_w_get;
+ set_size = ewl_object_preferred_inner_w_set;
+ }
+ else {
+ get_size = ewl_object_preferred_h_get;
+ set_size = ewl_object_preferred_inner_h_set;
+ }
+
+ ecore_dlist_first_goto(c->children);
+ while ((child = ecore_dlist_next(c->children))) {
+ if (VISIBLE(child) && REALIZED(child))
+ curr_size += get_size(child);
+ }
+
+ set_size(EWL_OBJECT(c), curr_size);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1091,20 +1091,20 @@ ewl_container_sum_prefer(Ewl_Container *c, Ewl_Orientation o)
void
ewl_container_child_add_call(Ewl_Container *c, Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- /* ignore unmanaged children */
- if (UNMANAGED(w))
- DRETURN(DLEVEL_STABLE);
+ /* ignore unmanaged children */
+ if (UNMANAGED(w))
+ DRETURN(DLEVEL_STABLE);
- if (c->child_add)
- c->child_add(c, w);
+ if (c->child_add)
+ c->child_add(c, w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1117,24 +1117,24 @@ ewl_container_child_add_call(Ewl_Container *c, Ewl_Widget *w)
void
ewl_container_child_remove_call(Ewl_Container *c, Ewl_Widget *w, int idx)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- /* do nothing if the container is being destroyed */
- if (DESTROYED(c))
- DRETURN(DLEVEL_STABLE);
-
- /* ignore unmanaged children */
- if (UNMANAGED(w))
- DRETURN(DLEVEL_STABLE);
-
- if (c->child_remove)
- c->child_remove(c, w, idx);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ /* do nothing if the container is being destroyed */
+ if (DESTROYED(c))
+ DRETURN(DLEVEL_STABLE);
+
+ /* ignore unmanaged children */
+ if (UNMANAGED(w))
+ DRETURN(DLEVEL_STABLE);
+
+ if (c->child_remove)
+ c->child_remove(c, w, idx);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1146,34 +1146,34 @@ ewl_container_child_remove_call(Ewl_Container *c, Ewl_Widget *w, int idx)
void
ewl_container_child_show_call(Ewl_Container *c, Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- /* ignore unmanaged children */
- if (UNMANAGED(w))
- DRETURN(DLEVEL_STABLE);
-
- c->visible_children++;
- if (c->visible_children > ecore_dlist_count(c->children))
- DWARNING("visible children count exceed total child count "
- "(%d > %d)\n", c->visible_children,
- ecore_dlist_count(c->children));
-
- if (c->child_show)
- c->child_show(c, w);
-
- /*
- * Only show it if there are visible children.
- */
- if (c->clip_box)
- evas_object_show(c->clip_box);
-
- ewl_widget_configure(EWL_WIDGET(c));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ /* ignore unmanaged children */
+ if (UNMANAGED(w))
+ DRETURN(DLEVEL_STABLE);
+
+ c->visible_children++;
+ if (c->visible_children > ecore_dlist_count(c->children))
+ DWARNING("visible children count exceed total child count "
+ "(%d > %d)\n", c->visible_children,
+ ecore_dlist_count(c->children));
+
+ if (c->child_show)
+ c->child_show(c, w);
+
+ /*
+ * Only show it if there are visible children.
+ */
+ if (c->clip_box)
+ evas_object_show(c->clip_box);
+
+ ewl_widget_configure(EWL_WIDGET(c));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1185,37 +1185,37 @@ ewl_container_child_show_call(Ewl_Container *c, Ewl_Widget *w)
void
ewl_container_child_hide_call(Ewl_Container *c, Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- /* ignore unmanaged children */
- if (UNMANAGED(w))
- DRETURN(DLEVEL_STABLE);
+ /* ignore unmanaged children */
+ if (UNMANAGED(w))
+ DRETURN(DLEVEL_STABLE);
- /* do nothing if the container is being destroyed */
- if (DESTROYED(c))
- DRETURN(DLEVEL_STABLE);
+ /* do nothing if the container is being destroyed */
+ if (DESTROYED(c))
+ DRETURN(DLEVEL_STABLE);
- c->visible_children--;
- if (c->visible_children < 0)
- DWARNING("visible_children is %d\n", c->visible_children);
+ c->visible_children--;
+ if (c->visible_children < 0)
+ DWARNING("visible_children is %d\n", c->visible_children);
- if (c->child_hide)
- c->child_hide(c, w);
+ if (c->child_hide)
+ c->child_hide(c, w);
- if (c->clip_box) {
- const Evas_List *clippees;
- clippees = evas_object_clipees_get(c->clip_box);
- if (!clippees)
- evas_object_hide(c->clip_box);
- }
+ if (c->clip_box) {
+ const Evas_List *clippees;
+ clippees = evas_object_clipees_get(c->clip_box);
+ if (!clippees)
+ evas_object_hide(c->clip_box);
+ }
- ewl_widget_configure(EWL_WIDGET(c));
+ ewl_widget_configure(EWL_WIDGET(c));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1226,30 +1226,30 @@ ewl_container_child_hide_call(Ewl_Container *c, Ewl_Widget *w)
void
ewl_container_destroy(Ewl_Container *c)
{
- Ewl_Widget *child;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
-
- c->redirect = NULL;
- if (c->children) {
- /*
- * Destroy any children still in the container. Do not remove
- * in order to avoid list walking.
- */
- while ((child = ecore_dlist_first_goto(c->children))) {
- ewl_widget_destroy(child);
- }
-
- /*
- * Destroy the container list and set it to NULL.
- */
- ecore_dlist_destroy(c->children);
- c->children = NULL;
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Widget *child;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+
+ c->redirect = NULL;
+ if (c->children) {
+ /*
+ * Destroy any children still in the container. Do not remove
+ * in order to avoid list walking.
+ */
+ while ((child = ecore_dlist_first_goto(c->children))) {
+ ewl_widget_destroy(child);
+ }
+
+ /*
+ * Destroy the container list and set it to NULL.
+ */
+ ecore_dlist_destroy(c->children);
+ c->children = NULL;
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1260,21 +1260,21 @@ ewl_container_destroy(Ewl_Container *c)
Ewl_Container *
ewl_container_end_redirect_get(Ewl_Container *c)
{
- Ewl_Container *rc = NULL;
+ Ewl_Container *rc = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(c, NULL);
- DCHECK_TYPE_RET(c, EWL_CONTAINER_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(c, NULL);
+ DCHECK_TYPE_RET(c, EWL_CONTAINER_TYPE, NULL);
- if (!c->redirect)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ if (!c->redirect)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- while (c->redirect) {
- rc = c->redirect;
- c = c->redirect;
- }
+ while (c->redirect) {
+ rc = c->redirect;
+ c = c->redirect;
+ }
- DRETURN_PTR(rc, DLEVEL_STABLE);
+ DRETURN_PTR(rc, DLEVEL_STABLE);
}
/**
@@ -1285,11 +1285,11 @@ ewl_container_end_redirect_get(Ewl_Container *c)
Ewl_Container *
ewl_container_redirect_get(Ewl_Container *c)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(c, NULL);
- DCHECK_TYPE_RET(c, EWL_CONTAINER_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(c, NULL);
+ DCHECK_TYPE_RET(c, EWL_CONTAINER_TYPE, NULL);
- DRETURN_PTR(c->redirect, DLEVEL_STABLE);
+ DRETURN_PTR(c->redirect, DLEVEL_STABLE);
}
/**
@@ -1301,14 +1301,14 @@ ewl_container_redirect_get(Ewl_Container *c)
void
ewl_container_redirect_set(Ewl_Container *c, Ewl_Container *rc)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- DCHECK_TYPE(rc, EWL_CONTAINER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DCHECK_TYPE(rc, EWL_CONTAINER_TYPE);
- c->redirect = rc;
+ c->redirect = rc;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1322,26 +1322,26 @@ ewl_container_redirect_set(Ewl_Container *c, Ewl_Container *rc)
*/
void
ewl_container_cb_reparent(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Widget *child;
+ Ewl_Widget *child;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_CONTAINER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_CONTAINER_TYPE);
- if (!EWL_CONTAINER(w)->children)
- DRETURN(DLEVEL_STABLE);
+ if (!EWL_CONTAINER(w)->children)
+ DRETURN(DLEVEL_STABLE);
- /*
- * Reparent all of the containers children
- */
- ecore_dlist_first_goto(EWL_CONTAINER(w)->children);
- while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children)) != NULL) {
- ewl_widget_reparent(child);
- }
+ /*
+ * Reparent all of the containers children
+ */
+ ecore_dlist_first_goto(EWL_CONTAINER(w)->children);
+ while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children)) != NULL) {
+ ewl_widget_reparent(child);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1354,26 +1354,26 @@ ewl_container_cb_reparent(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_container_cb_enable(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Widget *child;
+ Ewl_Widget *child;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_CONTAINER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_CONTAINER_TYPE);
- if (!EWL_CONTAINER(w)->children)
- DRETURN(DLEVEL_STABLE);
+ if (!EWL_CONTAINER(w)->children)
+ DRETURN(DLEVEL_STABLE);
- /*
- * Enable all of the containers children
- */
- ecore_dlist_first_goto(EWL_CONTAINER(w)->children);
- while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children)) != NULL) {
- ewl_widget_enable(child);
- }
+ /*
+ * Enable all of the containers children
+ */
+ ecore_dlist_first_goto(EWL_CONTAINER(w)->children);
+ while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children)) != NULL) {
+ ewl_widget_enable(child);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1386,26 +1386,26 @@ ewl_container_cb_enable(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_container_cb_disable(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Widget *child;
+ Ewl_Widget *child;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_CONTAINER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_CONTAINER_TYPE);
- if (!EWL_CONTAINER(w)->children)
- DRETURN(DLEVEL_STABLE);
+ if (!EWL_CONTAINER(w)->children)
+ DRETURN(DLEVEL_STABLE);
- /*
- * Disable all of the containers children
- */
- ecore_dlist_first_goto(EWL_CONTAINER(w)->children);
- while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children)) != NULL) {
- ewl_widget_disable(child);
- }
+ /*
+ * Disable all of the containers children
+ */
+ ecore_dlist_first_goto(EWL_CONTAINER(w)->children);
+ while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children)) != NULL) {
+ ewl_widget_disable(child);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1418,40 +1418,40 @@ ewl_container_cb_disable(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_container_cb_obscure(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Embed *e;
- Ewl_Container *c;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_CONTAINER_TYPE);
-
- c = EWL_CONTAINER(w);
-
- /*
- * Give up the clip box object in use.
- */
- e = ewl_embed_widget_find(EWL_WIDGET(w));
- if (e && c->clip_box) {
- ewl_embed_object_cache(e, c->clip_box);
- c->clip_box = NULL;
- }
-
- /*
- * Notify children that they are now obscured, they will not receive a
- * configure event since the parent won't get configured while
- * obscured.
- */
- if (c->children) {
- ecore_dlist_first_goto(c->children);
- while ((w = ecore_dlist_next(c->children))) {
- if (REALIZED(w))
- ewl_widget_obscure(w);
- }
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Embed *e;
+ Ewl_Container *c;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_CONTAINER_TYPE);
+
+ c = EWL_CONTAINER(w);
+
+ /*
+ * Give up the clip box object in use.
+ */
+ e = ewl_embed_widget_find(EWL_WIDGET(w));
+ if (e && c->clip_box) {
+ ewl_embed_object_cache(e, c->clip_box);
+ c->clip_box = NULL;
+ }
+
+ /*
+ * Notify children that they are now obscured, they will not receive a
+ * configure event since the parent won't get configured while
+ * obscured.
+ */
+ if (c->children) {
+ ecore_dlist_first_goto(c->children);
+ while ((w = ecore_dlist_next(c->children))) {
+ if (REALIZED(w))
+ ewl_widget_obscure(w);
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1464,45 +1464,45 @@ ewl_container_cb_obscure(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_container_cb_reveal(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Embed *e;
- Ewl_Container *c;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_CONTAINER_TYPE);
-
- c = EWL_CONTAINER(w);
-
- e = ewl_embed_widget_find(EWL_WIDGET(w));
- if (e && !c->clip_box) {
- c->clip_box = ewl_embed_object_request(e, "rectangle");
- }
-
- /*
- * Create the clip box for this container, this keeps children clipped
- * to the wanted area.
- */
- if (!c->clip_box)
- c->clip_box = evas_object_rectangle_add(e->canvas);
-
- /*
- * Setup the remaining properties for the clip box.
- */
- if (c->clip_box) {
- evas_object_pass_events_set(c->clip_box, TRUE);
- evas_object_smart_member_add(c->clip_box, w->smart_object);
-
- if (w->fx_clip_box) {
- evas_object_clip_set(c->clip_box, w->fx_clip_box);
- evas_object_stack_below(c->clip_box, w->fx_clip_box);
- }
-
- evas_object_color_set(c->clip_box, 255, 255, 255, 255);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Embed *e;
+ Ewl_Container *c;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_CONTAINER_TYPE);
+
+ c = EWL_CONTAINER(w);
+
+ e = ewl_embed_widget_find(EWL_WIDGET(w));
+ if (e && !c->clip_box) {
+ c->clip_box = ewl_embed_object_request(e, "rectangle");
+ }
+
+ /*
+ * Create the clip box for this container, this keeps children clipped
+ * to the wanted area.
+ */
+ if (!c->clip_box)
+ c->clip_box = evas_object_rectangle_add(e->canvas);
+
+ /*
+ * Setup the remaining properties for the clip box.
+ */
+ if (c->clip_box) {
+ evas_object_pass_events_set(c->clip_box, TRUE);
+ evas_object_smart_member_add(c->clip_box, w->smart_object);
+
+ if (w->fx_clip_box) {
+ evas_object_clip_set(c->clip_box, w->fx_clip_box);
+ evas_object_stack_below(c->clip_box, w->fx_clip_box);
+ }
+
+ evas_object_color_set(c->clip_box, 255, 255, 255, 255);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1517,36 +1517,36 @@ ewl_container_cb_reveal(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_container_cb_realize(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- int i = 0;
- Ewl_Container *c;
- Ewl_Widget *child;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_CONTAINER_TYPE);
-
- c = EWL_CONTAINER(w);
-
- if (!c->children || ecore_dlist_empty_is(c->children))
- DRETURN(DLEVEL_STABLE);
-
- /*
- * If this container has not yet been realized, then it's children
- * haven't either. So we call ewl_widget_reparent to get each child
- * to update it's evas related fields to the new information, and then
- * realize any of them that should be visible.
- */
- while ((child = ecore_dlist_index_goto(c->children, i))) {
- ewl_callback_call_with_event_data(child, EWL_CALLBACK_REPARENT,
- c);
- if (VISIBLE(child))
- ewl_realize_request(child);
- i++;
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int i = 0;
+ Ewl_Container *c;
+ Ewl_Widget *child;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_CONTAINER_TYPE);
+
+ c = EWL_CONTAINER(w);
+
+ if (!c->children || ecore_dlist_empty_is(c->children))
+ DRETURN(DLEVEL_STABLE);
+
+ /*
+ * If this container has not yet been realized, then it's children
+ * haven't either. So we call ewl_widget_reparent to get each child
+ * to update it's evas related fields to the new information, and then
+ * realize any of them that should be visible.
+ */
+ while ((child = ecore_dlist_index_goto(c->children, i))) {
+ ewl_callback_call_with_event_data(child, EWL_CALLBACK_REPARENT,
+ c);
+ if (VISIBLE(child))
+ ewl_realize_request(child);
+ i++;
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1559,24 +1559,24 @@ ewl_container_cb_realize(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_container_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_CONTAINER_TYPE);
-
- if (EWL_CONTAINER(w)->clip_box) {
- /*
- * Move the clip box into the new position and size of the
- * container.
- */
- evas_object_move(EWL_CONTAINER(w)->clip_box,
- CURRENT_X(w), CURRENT_Y(w));
- evas_object_resize(EWL_CONTAINER(w)->clip_box,
- CURRENT_W(w), CURRENT_H(w));
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_CONTAINER_TYPE);
+
+ if (EWL_CONTAINER(w)->clip_box) {
+ /*
+ * Move the clip box into the new position and size of the
+ * container.
+ */
+ evas_object_move(EWL_CONTAINER(w)->clip_box,
+ CURRENT_X(w), CURRENT_Y(w));
+ evas_object_resize(EWL_CONTAINER(w)->clip_box,
+ CURRENT_W(w), CURRENT_H(w));
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1589,37 +1589,37 @@ ewl_container_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_container_cb_unrealize(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Container *c;
- Ewl_Widget *child;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_CONTAINER_TYPE);
-
- c = EWL_CONTAINER(w);
-
- /*
- * Clean up the clip box of the container.
- */
- if (c->clip_box) {
- ewl_canvas_object_destroy(c->clip_box);
- c->clip_box = NULL;
- }
-
- /*
- * FIXME: If called from a destroy callback, the child list may not
- * exist at this point. Is this legitimate ordering?
- */
- if (c->children) {
- ecore_dlist_first_goto(c->children);
- while ((child = ecore_dlist_next(c->children))) {
- ewl_widget_unrealize(child);
- }
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Container *c;
+ Ewl_Widget *child;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_CONTAINER_TYPE);
+
+ c = EWL_CONTAINER(w);
+
+ /*
+ * Clean up the clip box of the container.
+ */
+ if (c->clip_box) {
+ ewl_canvas_object_destroy(c->clip_box);
+ c->clip_box = NULL;
+ }
+
+ /*
+ * FIXME: If called from a destroy callback, the child list may not
+ * exist at this point. Is this legitimate ordering?
+ */
+ if (c->children) {
+ ecore_dlist_first_goto(c->children);
+ while ((child = ecore_dlist_next(c->children))) {
+ ewl_widget_unrealize(child);
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1633,20 +1633,20 @@ ewl_container_cb_unrealize(Ewl_Widget *w, void *ev_data __UNUSED__,
void
ewl_container_cb_container_focus_out(Ewl_Widget *w, void *ev_data, void *user_data)
{
- Ewl_Widget *focus_in = NULL;
+ Ewl_Widget *focus_in = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
- if (ev_data)
- focus_in = EWL_WIDGET(ev_data);
+ if (ev_data)
+ focus_in = EWL_WIDGET(ev_data);
- /* If its a child or is disabled then don't send a signal */
- if ((focus_in) && (!ewl_widget_parent_of(w, focus_in)) &&
- (!DISABLED(w)) && (focus_in != w))
- ewl_widget_state_set(w, "focus,out", EWL_STATE_TRANSIENT);
+ /* If its a child or is disabled then don't send a signal */
+ if ((focus_in) && (!ewl_widget_parent_of(w, focus_in)) &&
+ (!DISABLED(w)) && (focus_in != w))
+ ewl_widget_state_set(w, "focus,out", EWL_STATE_TRANSIENT);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1660,23 +1660,23 @@ ewl_container_cb_container_focus_out(Ewl_Widget *w, void *ev_data, void *user_da
void
ewl_container_cb_widget_focus_out(Ewl_Widget *w, void *ev_data, void *user_data)
{
- Ewl_Container *c;
+ Ewl_Container *c;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
- if (DISABLED(w))
- DRETURN(DLEVEL_STABLE);
+ if (DISABLED(w))
+ DRETURN(DLEVEL_STABLE);
- c = EWL_CONTAINER(w);
- while (c->redirect)
- c = c->redirect;
+ c = EWL_CONTAINER(w);
+ while (c->redirect)
+ c = c->redirect;
- ecore_dlist_first_goto(c->children);
- while ((w = ecore_dlist_next(c->children)))
- ewl_widget_state_set(w, "focus,out", EWL_STATE_TRANSIENT);
+ ecore_dlist_first_goto(c->children);
+ while ((w = ecore_dlist_next(c->children)))
+ ewl_widget_state_set(w, "focus,out", EWL_STATE_TRANSIENT);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1690,23 +1690,23 @@ ewl_container_cb_widget_focus_out(Ewl_Widget *w, void *ev_data, void *user_data)
void
ewl_container_cb_widget_focus_in(Ewl_Widget *w, void *ev_data, void *user_data)
{
- Ewl_Container *c;
+ Ewl_Container *c;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
- if (DISABLED(w))
- DRETURN(DLEVEL_STABLE);
+ if (DISABLED(w))
+ DRETURN(DLEVEL_STABLE);
- c = EWL_CONTAINER(w);
- while (c->redirect)
- c = c->redirect;
+ c = EWL_CONTAINER(w);
+ while (c->redirect)
+ c = c->redirect;
- ecore_dlist_first_goto(c->children);
- while ((w = ecore_dlist_next(c->children)))
- ewl_widget_state_set(w, "focus,in", EWL_STATE_TRANSIENT);
+ ecore_dlist_first_goto(c->children);
+ while ((w = ecore_dlist_next(c->children)))
+ ewl_widget_state_set(w, "focus,in", EWL_STATE_TRANSIENT);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1717,23 +1717,23 @@ ewl_container_cb_widget_focus_in(Ewl_Widget *w, void *ev_data, void *user_data)
void
ewl_container_children_show(Ewl_Container *c)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- ewl_widget_show(EWL_WIDGET(c));
+ ewl_widget_show(EWL_WIDGET(c));
- ewl_container_child_iterate_begin(c);
- while ((w = ewl_container_child_next(c)))
- {
- if (EWL_CONTAINER_IS(w))
- ewl_container_children_show(EWL_CONTAINER(w));
- else
- ewl_widget_show(w);
- }
+ ewl_container_child_iterate_begin(c);
+ while ((w = ewl_container_child_next(c)))
+ {
+ if (EWL_CONTAINER_IS(w))
+ ewl_container_children_show(EWL_CONTAINER(w));
+ else
+ ewl_widget_show(w);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_container.h b/src/lib/ewl_container.h
index 35f90a9..b6dd234 100644
--- a/src/lib/ewl_container.h
+++ b/src/lib/ewl_container.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_CONTAINER_H
#define EWL_CONTAINER_H
@@ -59,7 +59,7 @@ typedef void (*Ewl_Child_Remove) (Ewl_Container *c, Ewl_Widget *w, int idx);
* resized in the Ewl_Container.
*/
typedef void (*Ewl_Child_Resize) (Ewl_Container *c, Ewl_Widget *w,
- int size, Ewl_Orientation o);
+ int size, Ewl_Orientation o);
/**
* A typedef to shorten the definition of the child_show callbacks. This
@@ -89,90 +89,90 @@ typedef Ewl_Widget *(*Ewl_Container_Iterator) (Ewl_Container *c);
*/
struct Ewl_Container
{
- Ewl_Widget widget; /**< Inherit the basics of the widget. */
+ Ewl_Widget widget; /**< Inherit the basics of the widget. */
- Ecore_DList *children; /**< List of children that are contained. */
- int visible_children; /**< the number of visible children */
+ Ecore_DList *children; /**< List of children that are contained. */
+ int visible_children; /**< the number of visible children */
- void *clip_box; /**< Clip box to bound widgets inside. */
+ void *clip_box; /**< Clip box to bound widgets inside. */
- Ewl_Container *redirect; /**< Alternate parent for children */
+ Ewl_Container *redirect; /**< Alternate parent for children */
- Ewl_Child_Add child_add; /**< Function called on child add */
- Ewl_Child_Remove child_remove; /**< Function called on child remove */
- Ewl_Child_Resize child_resize; /**< Function called on child resize */
- Ewl_Child_Show child_show; /**< Function called on child show */
- Ewl_Child_Hide child_hide; /**< Function called on child hide */
+ Ewl_Child_Add child_add; /**< Function called on child add */
+ Ewl_Child_Remove child_remove; /**< Function called on child remove */
+ Ewl_Child_Resize child_resize; /**< Function called on child resize */
+ Ewl_Child_Show child_show; /**< Function called on child show */
+ Ewl_Child_Hide child_hide; /**< Function called on child hide */
- Ewl_Container_Iterator iterator; /**< Function to find next child */
+ Ewl_Container_Iterator iterator; /**< Function to find next child */
};
-int ewl_container_init(Ewl_Container *container);
-
-void ewl_container_add_notify_set(Ewl_Container *container,
- Ewl_Child_Add add);
-void ewl_container_remove_notify_set(Ewl_Container *container,
- Ewl_Child_Remove remove);
-void ewl_container_resize_notify_set(Ewl_Container *container,
- Ewl_Child_Resize resize);
-void ewl_container_show_notify_set(Ewl_Container *container,
- Ewl_Child_Show show);
-void ewl_container_hide_notify_set(Ewl_Container *container,
- Ewl_Child_Hide show);
-
-void ewl_container_child_append(Ewl_Container *parent,
- Ewl_Widget *child);
-void ewl_container_child_prepend(Ewl_Container *parent,
- Ewl_Widget *child);
-void ewl_container_child_insert(Ewl_Container *parent,
- Ewl_Widget *child, int index);
-void ewl_container_child_insert_internal(Ewl_Container *parent,
- Ewl_Widget *child, int index);
-void ewl_container_child_remove(Ewl_Container *parent,
- Ewl_Widget *child);
-void ewl_container_child_resize(Ewl_Widget *w, int size,
- Ewl_Orientation o);
-Ewl_Widget *ewl_container_child_get(Ewl_Container *parent, int index);
-Ewl_Widget *ewl_container_child_internal_get(Ewl_Container *parent, int index);
-int ewl_container_child_index_get(Ewl_Container *parent,
- Ewl_Widget *child);
-int ewl_container_child_index_internal_get(Ewl_Container *parent,
- Ewl_Widget *child);
-void ewl_container_child_iterate_begin(Ewl_Container *c);
-Ewl_Widget *ewl_container_child_next(Ewl_Container *c);
-void ewl_container_child_iterator_set(Ewl_Container *c,
- Ewl_Container_Iterator i);
-int ewl_container_child_count_get(Ewl_Container *c);
-int ewl_container_child_count_internal_get(Ewl_Container *c);
-int ewl_container_child_count_visible_get(Ewl_Container *c);
-void ewl_container_children_show(Ewl_Container *c);
-void ewl_container_destroy(Ewl_Container *c);
-void ewl_container_reset(Ewl_Container *c);
-void ewl_container_callback_notify(Ewl_Container *c,
- unsigned int t);
-void ewl_container_callback_nonotify(Ewl_Container *c,
- unsigned int t);
-void ewl_container_callback_intercept(Ewl_Container *c,
- unsigned int t);
-void ewl_container_callback_nointercept(Ewl_Container *c,
- unsigned int t);
-Ewl_Widget *ewl_container_child_at_get(Ewl_Container *widget,
- int x, int y);
-Ewl_Widget *ewl_container_child_at_recursive_get(Ewl_Container *widget,
- int x, int y);
-void ewl_container_largest_prefer(Ewl_Container *c,
- Ewl_Orientation o);
-void ewl_container_sum_prefer(Ewl_Container *c, Ewl_Orientation o);
-
-void ewl_container_child_add_call(Ewl_Container *c, Ewl_Widget *w);
-void ewl_container_child_remove_call(Ewl_Container *c, Ewl_Widget *w,
- int idx);
-void ewl_container_child_show_call(Ewl_Container *c, Ewl_Widget *w);
-void ewl_container_child_hide_call(Ewl_Container *c, Ewl_Widget *w);
-
-Ewl_Container *ewl_container_end_redirect_get(Ewl_Container *c);
-Ewl_Container *ewl_container_redirect_get(Ewl_Container *c);
-void ewl_container_redirect_set(Ewl_Container *c, Ewl_Container *rc);
+int ewl_container_init(Ewl_Container *container);
+
+void ewl_container_add_notify_set(Ewl_Container *container,
+ Ewl_Child_Add add);
+void ewl_container_remove_notify_set(Ewl_Container *container,
+ Ewl_Child_Remove remove);
+void ewl_container_resize_notify_set(Ewl_Container *container,
+ Ewl_Child_Resize resize);
+void ewl_container_show_notify_set(Ewl_Container *container,
+ Ewl_Child_Show show);
+void ewl_container_hide_notify_set(Ewl_Container *container,
+ Ewl_Child_Hide show);
+
+void ewl_container_child_append(Ewl_Container *parent,
+ Ewl_Widget *child);
+void ewl_container_child_prepend(Ewl_Container *parent,
+ Ewl_Widget *child);
+void ewl_container_child_insert(Ewl_Container *parent,
+ Ewl_Widget *child, int index);
+void ewl_container_child_insert_internal(Ewl_Container *parent,
+ Ewl_Widget *child, int index);
+void ewl_container_child_remove(Ewl_Container *parent,
+ Ewl_Widget *child);
+void ewl_container_child_resize(Ewl_Widget *w, int size,
+ Ewl_Orientation o);
+Ewl_Widget *ewl_container_child_get(Ewl_Container *parent, int index);
+Ewl_Widget *ewl_container_child_internal_get(Ewl_Container *parent, int index);
+int ewl_container_child_index_get(Ewl_Container *parent,
+ Ewl_Widget *child);
+int ewl_container_child_index_internal_get(Ewl_Container *parent,
+ Ewl_Widget *child);
+void ewl_container_child_iterate_begin(Ewl_Container *c);
+Ewl_Widget *ewl_container_child_next(Ewl_Container *c);
+void ewl_container_child_iterator_set(Ewl_Container *c,
+ Ewl_Container_Iterator i);
+int ewl_container_child_count_get(Ewl_Container *c);
+int ewl_container_child_count_internal_get(Ewl_Container *c);
+int ewl_container_child_count_visible_get(Ewl_Container *c);
+void ewl_container_children_show(Ewl_Container *c);
+void ewl_container_destroy(Ewl_Container *c);
+void ewl_container_reset(Ewl_Container *c);
+void ewl_container_callback_notify(Ewl_Container *c,
+ unsigned int t);
+void ewl_container_callback_nonotify(Ewl_Container *c,
+ unsigned int t);
+void ewl_container_callback_intercept(Ewl_Container *c,
+ unsigned int t);
+void ewl_container_callback_nointercept(Ewl_Container *c,
+ unsigned int t);
+Ewl_Widget *ewl_container_child_at_get(Ewl_Container *widget,
+ int x, int y);
+Ewl_Widget *ewl_container_child_at_recursive_get(Ewl_Container *widget,
+ int x, int y);
+void ewl_container_largest_prefer(Ewl_Container *c,
+ Ewl_Orientation o);
+void ewl_container_sum_prefer(Ewl_Container *c, Ewl_Orientation o);
+
+void ewl_container_child_add_call(Ewl_Container *c, Ewl_Widget *w);
+void ewl_container_child_remove_call(Ewl_Container *c, Ewl_Widget *w,
+ int idx);
+void ewl_container_child_show_call(Ewl_Container *c, Ewl_Widget *w);
+void ewl_container_child_hide_call(Ewl_Container *c, Ewl_Widget *w);
+
+Ewl_Container *ewl_container_end_redirect_get(Ewl_Container *c);
+Ewl_Container *ewl_container_redirect_get(Ewl_Container *c);
+void ewl_container_redirect_set(Ewl_Container *c, Ewl_Container *rc);
/*
* Internally used callbacks, override at your own risk.
diff --git a/src/lib/ewl_context_menu.c b/src/lib/ewl_context_menu.c
index 18e3b79..f1202b7 100644
--- a/src/lib/ewl_context_menu.c
+++ b/src/lib/ewl_context_menu.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_box.h"
#include "ewl_menu.h"
@@ -10,7 +10,7 @@
static Ewl_Context_Menu *ewl_context_menu_grabber = NULL;
static int ewl_context_menu_mouse_feed(Ewl_Context_Menu *cm,
- Ewl_Embed *emb, int x, int y);
+ Ewl_Embed *emb, int x, int y);
static void ewl_context_menu_grabber_set(Ewl_Context_Menu *cm);
static void ewl_context_menu_grabber_unset(Ewl_Context_Menu *cm);
@@ -23,20 +23,20 @@ static void ewl_context_menu_grabber_unset(Ewl_Context_Menu *cm);
Ewl_Widget *
ewl_context_menu_new(void)
{
- Ewl_Context_Menu *cm;
+ Ewl_Context_Menu *cm;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- cm = NEW(Ewl_Context_Menu, 1);
- if (!cm)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ cm = NEW(Ewl_Context_Menu, 1);
+ if (!cm)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_context_menu_init(cm)) {
- ewl_widget_destroy(EWL_WIDGET(cm));
- cm = NULL;
- }
+ if (!ewl_context_menu_init(cm)) {
+ ewl_widget_destroy(EWL_WIDGET(cm));
+ cm = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(cm), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(cm), DLEVEL_STABLE);
}
/**
@@ -50,40 +50,40 @@ ewl_context_menu_new(void)
int
ewl_context_menu_init(Ewl_Context_Menu *cm)
{
- Ewl_Widget *w;
- int oh, ov;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cm, FALSE);
-
- w = EWL_WIDGET(cm);
- if (!ewl_popup_init(EWL_POPUP(w)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- ewl_widget_inherit(w, EWL_CONTEXT_MENU_TYPE);
- /* XXX This isn't really correct */
- ewl_widget_appearance_set(w, EWL_MENU_TYPE);
- //ewl_widget_appearance_set(w, EWL_CONTEXT_MENU_TYPE"/"EWL_POPUP_TYPE);
- ewl_object_alignment_set(EWL_OBJECT(w),
- EWL_FLAG_ALIGN_LEFT | EWL_FLAG_ALIGN_TOP);
- ewl_popup_type_set(EWL_POPUP(cm), EWL_POPUP_TYPE_MOUSE);
- oh = ewl_theme_data_int_get(w, "/context_menu/hoffset");
- ov = ewl_theme_data_int_get(w, "/context_menu/voffset");
- ewl_popup_offset_set(EWL_POPUP(cm), oh, ov);
-
- ewl_context_menu_container_set(cm, NULL);
-
- /* add the callbacks */
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_DOWN,
- ewl_context_menu_cb_mouse_down, NULL);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE,
- ewl_context_menu_cb_mouse_move, NULL);
- ewl_callback_append(w, EWL_CALLBACK_HIDE,
- ewl_context_menu_cb_hide, NULL);
- ewl_callback_append(w, EWL_CALLBACK_FOCUS_IN,
- ewl_context_menu_cb_focus_in, NULL);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Widget *w;
+ int oh, ov;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cm, FALSE);
+
+ w = EWL_WIDGET(cm);
+ if (!ewl_popup_init(EWL_POPUP(w)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ ewl_widget_inherit(w, EWL_CONTEXT_MENU_TYPE);
+ /* XXX This isn't really correct */
+ ewl_widget_appearance_set(w, EWL_MENU_TYPE);
+ //ewl_widget_appearance_set(w, EWL_CONTEXT_MENU_TYPE"/"EWL_POPUP_TYPE);
+ ewl_object_alignment_set(EWL_OBJECT(w),
+ EWL_FLAG_ALIGN_LEFT | EWL_FLAG_ALIGN_TOP);
+ ewl_popup_type_set(EWL_POPUP(cm), EWL_POPUP_TYPE_MOUSE);
+ oh = ewl_theme_data_int_get(w, "/context_menu/hoffset");
+ ov = ewl_theme_data_int_get(w, "/context_menu/voffset");
+ ewl_popup_offset_set(EWL_POPUP(cm), oh, ov);
+
+ ewl_context_menu_container_set(cm, NULL);
+
+ /* add the callbacks */
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_DOWN,
+ ewl_context_menu_cb_mouse_down, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE,
+ ewl_context_menu_cb_mouse_move, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_HIDE,
+ ewl_context_menu_cb_hide, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_FOCUS_IN,
+ ewl_context_menu_cb_focus_in, NULL);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -97,35 +97,35 @@ ewl_context_menu_init(Ewl_Context_Menu *cm)
void
ewl_context_menu_attach(Ewl_Context_Menu *cm, Ewl_Widget *w)
{
- Ewl_Embed *emb;
- Ewl_Widget *follow;
+ Ewl_Embed *emb;
+ Ewl_Widget *follow;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cm);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(cm, EWL_CONTEXT_MENU_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cm);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(cm, EWL_CONTEXT_MENU_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- emb = ewl_embed_widget_find(w);
- if (!emb) {
- DWARNING("Provided widget has no embed parent.");
- DRETURN(DLEVEL_STABLE);
- }
+ emb = ewl_embed_widget_find(w);
+ if (!emb) {
+ DWARNING("Provided widget has no embed parent.");
+ DRETURN(DLEVEL_STABLE);
+ }
- follow = ewl_popup_follow_get(EWL_POPUP(cm));
+ follow = ewl_popup_follow_get(EWL_POPUP(cm));
- if (!follow)
- ewl_popup_follow_set(EWL_POPUP(cm), EWL_WIDGET(emb));
+ if (!follow)
+ ewl_popup_follow_set(EWL_POPUP(cm), EWL_WIDGET(emb));
- else if (follow != EWL_WIDGET(emb)) {
- DWARNING("Sorry, the context menu doesn't work in multiple embeds.");
- DRETURN(DLEVEL_STABLE);
- }
+ else if (follow != EWL_WIDGET(emb)) {
+ DWARNING("Sorry, the context menu doesn't work in multiple embeds.");
+ DRETURN(DLEVEL_STABLE);
+ }
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_DOWN,
- ewl_context_menu_cb_attach_mouse_down, cm);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_DOWN,
+ ewl_context_menu_cb_attach_mouse_down, cm);
- DRETURN(DLEVEL_STABLE);
+ DRETURN(DLEVEL_STABLE);
}
/**
@@ -137,22 +137,22 @@ ewl_context_menu_attach(Ewl_Context_Menu *cm, Ewl_Widget *w)
void
ewl_context_menu_detach(Ewl_Context_Menu *cm, Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cm);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(cm, EWL_CONTEXT_MENU_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cm);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(cm, EWL_CONTEXT_MENU_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_callback_del(w, EWL_CALLBACK_MOUSE_DOWN,
- ewl_context_menu_cb_attach_mouse_down);
+ ewl_callback_del(w, EWL_CALLBACK_MOUSE_DOWN,
+ ewl_context_menu_cb_attach_mouse_down);
- DRETURN(DLEVEL_STABLE);
+ DRETURN(DLEVEL_STABLE);
}
/**
* @param cm: the context menu to set the container
* @param c: the container to use inside of the context menu, if @a c is
- * NULL then this function will use a vbox instead
+ * NULL then this function will use a vbox instead
* @brief set a custom container for the context menu
*
* This function give you the ability to set a custom container as
@@ -165,66 +165,66 @@ ewl_context_menu_detach(Ewl_Context_Menu *cm, Ewl_Widget *w)
void
ewl_context_menu_container_set(Ewl_Context_Menu *cm, Ewl_Container *c)
{
- Ewl_Container *old_c = NULL;
- Ewl_Container *red;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cm);
- DCHECK_TYPE(cm, EWL_CONTEXT_MENU_TYPE);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
-
- /* if there is not a container specified we will create a vbox as
- * default */
- if (!c) {
- c = EWL_CONTAINER(ewl_vbox_new());
- ewl_object_fill_policy_set(EWL_OBJECT(c), EWL_FLAG_FILL_HFILL);
- }
-
- /* remove the old container */
- if (cm->container) {
- old_c = EWL_CONTAINER(cm->container);
- ewl_container_redirect_set(EWL_CONTAINER(cm), NULL);
- ewl_container_child_remove(EWL_CONTAINER(cm),
- EWL_WIDGET(old_c));
- cm->container = NULL;
- }
-
- /* now we can append the new container */
- ewl_container_child_append(EWL_CONTAINER(cm), EWL_WIDGET(c));
- ewl_widget_show(EWL_WIDGET(c));
-
- /* redirect the context menu to the new container */
- ewl_container_redirect_set(EWL_CONTAINER(cm), c);
- ewl_widget_internal_set(EWL_WIDGET(c), TRUE);
- /* add the callbacks to the last container in the redirect list */
- red = ewl_container_end_redirect_get(c);
- if (!red)
- red = c;
-
- /* we need to keep a reference to the old callbacks before we
- * override them */
- cm->child_add = red->child_add;
- cm->child_remove = red->child_remove;
- ewl_container_add_notify_set(red, ewl_context_menu_cb_child_add);
- ewl_container_remove_notify_set(red, ewl_context_menu_cb_child_remove);
-
- /* if we already had a container we have to move the existing widgets
- * in to the new one.
- * Note: We leave internal widgets out because they are part of the
- * container and not of the context menu */
- if (old_c) {
- Ewl_Widget *child;
-
- ewl_container_child_iterate_begin(old_c);
- while ((child = ewl_container_child_next(old_c)))
- ewl_container_child_append(c, child);
- /* and now destroy the old container */
- ewl_widget_destroy(EWL_WIDGET(old_c));
- }
-
- cm->container = EWL_WIDGET(c);
-
- DRETURN(DLEVEL_STABLE);
+ Ewl_Container *old_c = NULL;
+ Ewl_Container *red;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cm);
+ DCHECK_TYPE(cm, EWL_CONTEXT_MENU_TYPE);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+
+ /* if there is not a container specified we will create a vbox as
+ * default */
+ if (!c) {
+ c = EWL_CONTAINER(ewl_vbox_new());
+ ewl_object_fill_policy_set(EWL_OBJECT(c), EWL_FLAG_FILL_HFILL);
+ }
+
+ /* remove the old container */
+ if (cm->container) {
+ old_c = EWL_CONTAINER(cm->container);
+ ewl_container_redirect_set(EWL_CONTAINER(cm), NULL);
+ ewl_container_child_remove(EWL_CONTAINER(cm),
+ EWL_WIDGET(old_c));
+ cm->container = NULL;
+ }
+
+ /* now we can append the new container */
+ ewl_container_child_append(EWL_CONTAINER(cm), EWL_WIDGET(c));
+ ewl_widget_show(EWL_WIDGET(c));
+
+ /* redirect the context menu to the new container */
+ ewl_container_redirect_set(EWL_CONTAINER(cm), c);
+ ewl_widget_internal_set(EWL_WIDGET(c), TRUE);
+ /* add the callbacks to the last container in the redirect list */
+ red = ewl_container_end_redirect_get(c);
+ if (!red)
+ red = c;
+
+ /* we need to keep a reference to the old callbacks before we
+ * override them */
+ cm->child_add = red->child_add;
+ cm->child_remove = red->child_remove;
+ ewl_container_add_notify_set(red, ewl_context_menu_cb_child_add);
+ ewl_container_remove_notify_set(red, ewl_context_menu_cb_child_remove);
+
+ /* if we already had a container we have to move the existing widgets
+ * in to the new one.
+ * Note: We leave internal widgets out because they are part of the
+ * container and not of the context menu */
+ if (old_c) {
+ Ewl_Widget *child;
+
+ ewl_container_child_iterate_begin(old_c);
+ while ((child = ewl_container_child_next(old_c)))
+ ewl_container_child_append(c, child);
+ /* and now destroy the old container */
+ ewl_widget_destroy(EWL_WIDGET(old_c));
+ }
+
+ cm->container = EWL_WIDGET(c);
+
+ DRETURN(DLEVEL_STABLE);
}
/**
@@ -237,26 +237,26 @@ ewl_context_menu_container_set(Ewl_Context_Menu *cm, Ewl_Container *c)
*/
void
ewl_context_menu_cb_attach_mouse_down(Ewl_Widget *w __UNUSED__, void *ev_data,
- void *user_data)
+ void *user_data)
{
- Ewl_Event_Mouse_Down *ev;
+ Ewl_Event_Mouse_Down *ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(ev_data);
- DCHECK_PARAM_PTR(user_data);
- DCHECK_TYPE(user_data, EWL_POPUP_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(ev_data);
+ DCHECK_PARAM_PTR(user_data);
+ DCHECK_TYPE(user_data, EWL_POPUP_TYPE);
- ev = ev_data;
+ ev = ev_data;
- if (ev->button != 3)
- DRETURN(DLEVEL_STABLE);
+ if (ev->button != 3)
+ DRETURN(DLEVEL_STABLE);
- ewl_widget_focus_send(EWL_WIDGET(user_data));
- ewl_popup_mouse_position_set(EWL_POPUP(user_data), ev->base.x,
- ev->base.y);
- ewl_widget_show(EWL_WIDGET(user_data));
+ ewl_widget_focus_send(EWL_WIDGET(user_data));
+ ewl_popup_mouse_position_set(EWL_POPUP(user_data), ev->base.x,
+ ev->base.y);
+ ewl_widget_show(EWL_WIDGET(user_data));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -269,33 +269,33 @@ ewl_context_menu_cb_attach_mouse_down(Ewl_Widget *w __UNUSED__, void *ev_data,
*/
void
ewl_context_menu_cb_mouse_down(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_CONTEXT_MENU_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_CONTEXT_MENU_TYPE);
- if (w == ewl_embed_focused_widget_get(EWL_EMBED(w))) {
- Ewl_Context_Menu *cm;
+ if (w == ewl_embed_focused_widget_get(EWL_EMBED(w))) {
+ Ewl_Context_Menu *cm;
- cm = EWL_CONTEXT_MENU(w);
- if (cm->open_menu)
- {
- ewl_menu_collapse(EWL_MENU(cm->open_menu));
- cm->open_menu = NULL;
- }
+ cm = EWL_CONTEXT_MENU(w);
+ if (cm->open_menu)
+ {
+ ewl_menu_collapse(EWL_MENU(cm->open_menu));
+ cm->open_menu = NULL;
+ }
- while (EWL_POPUP_IS(w)) {
- ewl_widget_hide(w);
+ while (EWL_POPUP_IS(w)) {
+ ewl_widget_hide(w);
- w = ewl_popup_follow_get(EWL_POPUP(w));
- if (!w) break;
+ w = ewl_popup_follow_get(EWL_POPUP(w));
+ if (!w) break;
- w = EWL_WIDGET(ewl_embed_widget_find(w));
- }
- }
+ w = EWL_WIDGET(ewl_embed_widget_find(w));
+ }
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -308,24 +308,24 @@ ewl_context_menu_cb_mouse_down(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_context_menu_cb_hide(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Context_Menu *cm;
+ Ewl_Context_Menu *cm;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_CONTEXT_MENU_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_CONTEXT_MENU_TYPE);
- cm = EWL_CONTEXT_MENU(w);
+ cm = EWL_CONTEXT_MENU(w);
- if (cm->open_menu) {
- ewl_menu_collapse(EWL_MENU(cm->open_menu));
- cm->open_menu = NULL;
- }
+ if (cm->open_menu) {
+ ewl_menu_collapse(EWL_MENU(cm->open_menu));
+ cm->open_menu = NULL;
+ }
- ewl_context_menu_grabber_unset(cm);
+ ewl_context_menu_grabber_unset(cm);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -338,63 +338,63 @@ ewl_context_menu_cb_hide(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_context_menu_cb_mouse_move(Ewl_Widget *w, void *ev_data,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Event_Mouse *ev;
- Ewl_Context_Menu *cm;
- Ewl_Embed *popup_embed;
- int width = 0, height = 0;
- int ex = 0, ey = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(ev_data);
- DCHECK_TYPE(w, EWL_CONTEXT_MENU_TYPE);
-
- ev = ev_data;
- cm = EWL_CONTEXT_MENU(w);
-
- popup_embed = ewl_embed_widget_find(w);
-
- ewl_object_current_size_get(EWL_OBJECT(w), &width, &height);
- ewl_embed_window_position_get(EWL_EMBED(w), &ex, &ey);
-
- ex += ev->x;
- ey += ev->y;
-
- if ((ev->x > 0) && (ev->y > 0) &&
- (ev->x <= width) && (ev->y <= height)) {
- /* The mouse is actually in the popup, set the
- * popup to be active if it isn't already */
- if (ewl_embed_active_embed_get() != popup_embed)
- ewl_embed_active_set(popup_embed, TRUE);
-
- DRETURN(DLEVEL_STABLE);
- }
- else if (cm->open_menu &&
- ewl_menu_mouse_feed(EWL_MENU(cm->open_menu), ex, ey)) {
- DRETURN(DLEVEL_STABLE);
- }
- else {
- Ewl_Widget *follow;
- Ewl_Embed *popup;
-
- /* We now feed the mouse moves to only the parent if the mouse
- * is inside of it */
- popup = EWL_EMBED(w);
- do {
- follow = ewl_popup_follow_get(EWL_POPUP(popup));
- if (!follow) break;
-
- popup = ewl_embed_widget_find(follow);
-
- if (ewl_context_menu_mouse_feed(cm, popup, ex, ey))
- break;
-
- } while (EWL_POPUP_IS(popup));
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Event_Mouse *ev;
+ Ewl_Context_Menu *cm;
+ Ewl_Embed *popup_embed;
+ int width = 0, height = 0;
+ int ex = 0, ey = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(ev_data);
+ DCHECK_TYPE(w, EWL_CONTEXT_MENU_TYPE);
+
+ ev = ev_data;
+ cm = EWL_CONTEXT_MENU(w);
+
+ popup_embed = ewl_embed_widget_find(w);
+
+ ewl_object_current_size_get(EWL_OBJECT(w), &width, &height);
+ ewl_embed_window_position_get(EWL_EMBED(w), &ex, &ey);
+
+ ex += ev->x;
+ ey += ev->y;
+
+ if ((ev->x > 0) && (ev->y > 0) &&
+ (ev->x <= width) && (ev->y <= height)) {
+ /* The mouse is actually in the popup, set the
+ * popup to be active if it isn't already */
+ if (ewl_embed_active_embed_get() != popup_embed)
+ ewl_embed_active_set(popup_embed, TRUE);
+
+ DRETURN(DLEVEL_STABLE);
+ }
+ else if (cm->open_menu &&
+ ewl_menu_mouse_feed(EWL_MENU(cm->open_menu), ex, ey)) {
+ DRETURN(DLEVEL_STABLE);
+ }
+ else {
+ Ewl_Widget *follow;
+ Ewl_Embed *popup;
+
+ /* We now feed the mouse moves to only the parent if the mouse
+ * is inside of it */
+ popup = EWL_EMBED(w);
+ do {
+ follow = ewl_popup_follow_get(EWL_POPUP(popup));
+ if (!follow) break;
+
+ popup = ewl_embed_widget_find(follow);
+
+ if (ewl_context_menu_mouse_feed(cm, popup, ex, ey))
+ break;
+
+ } while (EWL_POPUP_IS(popup));
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -407,15 +407,15 @@ ewl_context_menu_cb_mouse_move(Ewl_Widget *w, void *ev_data,
*/
void
ewl_context_menu_cb_focus_in(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_CONTEXT_MENU_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_CONTEXT_MENU_TYPE);
- ewl_context_menu_grabber_set(EWL_CONTEXT_MENU(w));
+ ewl_context_menu_grabber_set(EWL_CONTEXT_MENU(w));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -428,33 +428,33 @@ ewl_context_menu_cb_focus_in(Ewl_Widget *w, void *ev_data __UNUSED__,
void
ewl_context_menu_cb_child_add(Ewl_Container *c, Ewl_Widget *w)
{
- Ewl_Context_Menu *cm;
+ Ewl_Context_Menu *cm;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- cm = EWL_CONTEXT_MENU(ewl_embed_widget_find(EWL_WIDGET(c)));
+ cm = EWL_CONTEXT_MENU(ewl_embed_widget_find(EWL_WIDGET(c)));
- /* call the overridden callback first */
- if (cm->child_add)
- cm->child_add(c, w);
+ /* call the overridden callback first */
+ if (cm->child_add)
+ cm->child_add(c, w);
- if (ewl_widget_internal_is(w) || !ewl_widget_focusable_get(w))
- DRETURN(DLEVEL_STABLE);
+ if (ewl_widget_internal_is(w) || !ewl_widget_focusable_get(w))
+ DRETURN(DLEVEL_STABLE);
- if (EWL_MENU_IS(w))
- EWL_MENU_ITEM(w)->inmenu = EWL_WIDGET(cm);
- else
- ewl_callback_append(w, EWL_CALLBACK_CLICKED,
- ewl_context_menu_cb_child_clicked, cm);
+ if (EWL_MENU_IS(w))
+ EWL_MENU_ITEM(w)->inmenu = EWL_WIDGET(cm);
+ else
+ ewl_callback_append(w, EWL_CALLBACK_CLICKED,
+ ewl_context_menu_cb_child_clicked, cm);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_IN,
- ewl_context_menu_cb_child_mouse_in, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_IN,
+ ewl_context_menu_cb_child_mouse_in, NULL);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -467,33 +467,33 @@ ewl_context_menu_cb_child_add(Ewl_Container *c, Ewl_Widget *w)
void
ewl_context_menu_cb_child_remove(Ewl_Container *c, Ewl_Widget *w, int idx)
{
- Ewl_Context_Menu *cm;
+ Ewl_Context_Menu *cm;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- cm = EWL_CONTEXT_MENU(ewl_embed_widget_find(EWL_WIDGET(c)));
- /* call the overridden callback first */
- if (cm->child_remove)
- cm->child_remove(c, w, idx);
+ cm = EWL_CONTEXT_MENU(ewl_embed_widget_find(EWL_WIDGET(c)));
+ /* call the overridden callback first */
+ if (cm->child_remove)
+ cm->child_remove(c, w, idx);
- if (ewl_widget_internal_is(w) || !ewl_widget_focusable_get(w))
- DRETURN(DLEVEL_STABLE);
+ if (ewl_widget_internal_is(w) || !ewl_widget_focusable_get(w))
+ DRETURN(DLEVEL_STABLE);
- if (EWL_MENU_IS(w)) {
- EWL_MENU_ITEM(w)->inmenu = NULL;
- }
- else
- ewl_callback_del(w, EWL_CALLBACK_CLICKED,
- ewl_context_menu_cb_child_clicked);
+ if (EWL_MENU_IS(w)) {
+ EWL_MENU_ITEM(w)->inmenu = NULL;
+ }
+ else
+ ewl_callback_del(w, EWL_CALLBACK_CLICKED,
+ ewl_context_menu_cb_child_clicked);
- ewl_callback_del(w, EWL_CALLBACK_MOUSE_IN,
- ewl_context_menu_cb_child_mouse_in);
+ ewl_callback_del(w, EWL_CALLBACK_MOUSE_IN,
+ ewl_context_menu_cb_child_mouse_in);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -506,32 +506,32 @@ ewl_context_menu_cb_child_remove(Ewl_Container *c, Ewl_Widget *w, int idx)
*/
void
ewl_context_menu_cb_child_mouse_in(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Context_Menu *cm;
- Ewl_Embed *emb;
+ Ewl_Context_Menu *cm;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- emb = ewl_embed_widget_find(w);
- cm = EWL_CONTEXT_MENU(emb);
+ emb = ewl_embed_widget_find(w);
+ cm = EWL_CONTEXT_MENU(emb);
- /* hide the open sub menu */
- if (cm->open_menu && (cm->open_menu != w))
- {
- ewl_menu_collapse(EWL_MENU(cm->open_menu));
- cm->open_menu = NULL;
- }
+ /* hide the open sub menu */
+ if (cm->open_menu && (cm->open_menu != w))
+ {
+ ewl_menu_collapse(EWL_MENU(cm->open_menu));
+ cm->open_menu = NULL;
+ }
- /* send the focus to the child */
- ewl_widget_focus_send(w);
+ /* send the focus to the child */
+ ewl_widget_focus_send(w);
- /* grab the key and mouse events again for this window */
- ewl_context_menu_grabber_set(cm);
+ /* grab the key and mouse events again for this window */
+ ewl_context_menu_grabber_set(cm);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -544,86 +544,86 @@ ewl_context_menu_cb_child_mouse_in(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_context_menu_cb_child_clicked(Ewl_Widget *w __UNUSED__,
- void *ev_data __UNUSED__, void *user_data)
+ void *ev_data __UNUSED__, void *user_data)
{
- Ewl_Widget *c;
+ Ewl_Widget *c;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(user_data);
- DCHECK_TYPE(user_data, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(user_data);
+ DCHECK_TYPE(user_data, EWL_WIDGET_TYPE);
- c = EWL_WIDGET(user_data);
+ c = EWL_WIDGET(user_data);
- while (EWL_POPUP_IS(c)) {
- ewl_widget_hide(c);
+ while (EWL_POPUP_IS(c)) {
+ ewl_widget_hide(c);
- c = ewl_popup_follow_get(EWL_POPUP(c));
- if (!c) break;
+ c = ewl_popup_follow_get(EWL_POPUP(c));
+ if (!c) break;
- c = EWL_WIDGET(ewl_embed_widget_find(c));
- }
+ c = EWL_WIDGET(ewl_embed_widget_find(c));
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static int
ewl_context_menu_mouse_feed(Ewl_Context_Menu *cm, Ewl_Embed *emb, int x, int y)
{
- int emb_x = 0, emb_y = 0, emb_w = 0, emb_h = 0;
+ int emb_x = 0, emb_y = 0, emb_w = 0, emb_h = 0;
- DCHECK_PARAM_PTR_RET(cm, FALSE);
- DCHECK_PARAM_PTR_RET(emb, FALSE);
- DCHECK_TYPE_RET(cm, EWL_CONTEXT_MENU_TYPE, FALSE);
- DCHECK_TYPE_RET(emb, EWL_EMBED_TYPE, FALSE);
+ DCHECK_PARAM_PTR_RET(cm, FALSE);
+ DCHECK_PARAM_PTR_RET(emb, FALSE);
+ DCHECK_TYPE_RET(cm, EWL_CONTEXT_MENU_TYPE, FALSE);
+ DCHECK_TYPE_RET(emb, EWL_EMBED_TYPE, FALSE);
- ewl_embed_window_position_get(emb, &emb_x, &emb_y);
- ewl_object_current_size_get(EWL_OBJECT(emb), &emb_w, &emb_h);
+ ewl_embed_window_position_get(emb, &emb_x, &emb_y);
+ ewl_object_current_size_get(EWL_OBJECT(emb), &emb_w, &emb_h);
- x -= emb_x;
- y -= emb_y;
+ x -= emb_x;
+ y -= emb_y;
- if ((x > 0) && (y > 0) && (x <= emb_w) && (y <= emb_h)) {
- ewl_embed_mouse_move_feed(emb, x, y, 0);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
- }
+ if ((x > 0) && (y > 0) && (x <= emb_w) && (y <= emb_h)) {
+ ewl_embed_mouse_move_feed(emb, x, y, 0);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+ }
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
}
static void
ewl_context_menu_grabber_set(Ewl_Context_Menu *cm)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cm);
- DCHECK_TYPE(cm, EWL_CONTEXT_MENU_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cm);
+ DCHECK_TYPE(cm, EWL_CONTEXT_MENU_TYPE);
- if (cm == ewl_context_menu_grabber)
- DRETURN(DLEVEL_STABLE);
+ if (cm == ewl_context_menu_grabber)
+ DRETURN(DLEVEL_STABLE);
- if (ewl_context_menu_grabber)
- ewl_context_menu_grabber_unset(ewl_context_menu_grabber);
+ if (ewl_context_menu_grabber)
+ ewl_context_menu_grabber_unset(ewl_context_menu_grabber);
- ewl_context_menu_grabber = cm;
- ewl_window_keyboard_grab_set(EWL_WINDOW(cm), TRUE);
- ewl_window_pointer_grab_set(EWL_WINDOW(cm), TRUE);
+ ewl_context_menu_grabber = cm;
+ ewl_window_keyboard_grab_set(EWL_WINDOW(cm), TRUE);
+ ewl_window_pointer_grab_set(EWL_WINDOW(cm), TRUE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_context_menu_grabber_unset(Ewl_Context_Menu *cm)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cm);
- DCHECK_TYPE(cm, EWL_CONTEXT_MENU_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cm);
+ DCHECK_TYPE(cm, EWL_CONTEXT_MENU_TYPE);
- if (cm == ewl_context_menu_grabber) {
- ewl_window_keyboard_grab_set(EWL_WINDOW(cm), FALSE);
- ewl_window_pointer_grab_set(EWL_WINDOW(cm), FALSE);
+ if (cm == ewl_context_menu_grabber) {
+ ewl_window_keyboard_grab_set(EWL_WINDOW(cm), FALSE);
+ ewl_window_pointer_grab_set(EWL_WINDOW(cm), FALSE);
- ewl_context_menu_grabber = NULL;
- }
+ ewl_context_menu_grabber = NULL;
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_context_menu.h b/src/lib/ewl_context_menu.h
index 0363e20..e83236b 100644
--- a/src/lib/ewl_context_menu.h
+++ b/src/lib/ewl_context_menu.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_CONTEXT_MENU_H
#define EWL_CONTEXT_MENU_H
@@ -25,7 +25,7 @@
* Returns TRUE if the widget is an Ewl_Context_Menu, FALSE otherwise
*/
#define EWL_CONTEXT_MENU_IS(w) (ewl_widget_type_is(EWL_WIDGET(w), \
- EWL_CONTEXT_MENU_TYPE))
+ EWL_CONTEXT_MENU_TYPE))
/**
* Ewl_Context_Menu
@@ -43,39 +43,39 @@ typedef struct Ewl_Context_Menu Ewl_Context_Menu;
*/
struct Ewl_Context_Menu
{
- Ewl_Popup popup; /**< Inherit from Ewl_Popup */
- Ewl_Widget *open_menu; /**< a pointer to the current open submenu */
- Ewl_Widget *container; /**< the container holding the children */
- Ewl_Child_Add child_add; /**< the overridden add cb of the container */
- Ewl_Child_Remove child_remove; /** < the overridden remove cb */
+ Ewl_Popup popup; /**< Inherit from Ewl_Popup */
+ Ewl_Widget *open_menu; /**< a pointer to the current open submenu */
+ Ewl_Widget *container; /**< the container holding the children */
+ Ewl_Child_Add child_add; /**< the overridden add cb of the container */
+ Ewl_Child_Remove child_remove; /** < the overridden remove cb */
};
-Ewl_Widget *ewl_context_menu_new(void);
-int ewl_context_menu_init(Ewl_Context_Menu *cm);
-void ewl_context_menu_attach(Ewl_Context_Menu *cm, Ewl_Widget *w);
-void ewl_context_menu_detach(Ewl_Context_Menu *cm, Ewl_Widget *w);
+Ewl_Widget *ewl_context_menu_new(void);
+int ewl_context_menu_init(Ewl_Context_Menu *cm);
+void ewl_context_menu_attach(Ewl_Context_Menu *cm, Ewl_Widget *w);
+void ewl_context_menu_detach(Ewl_Context_Menu *cm, Ewl_Widget *w);
-void ewl_context_menu_container_set(Ewl_Context_Menu *cm,
- Ewl_Container *c);
+void ewl_context_menu_container_set(Ewl_Context_Menu *cm,
+ Ewl_Container *c);
/*
* Internal, override at your own risk
*/
void ewl_context_menu_cb_hide(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_context_menu_cb_mouse_down(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
void ewl_context_menu_cb_mouse_move(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
void ewl_context_menu_cb_focus_in(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
void ewl_context_menu_cb_attach_mouse_down(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
void ewl_context_menu_cb_child_add(Ewl_Container *c, Ewl_Widget *w);
void ewl_context_menu_cb_child_remove(Ewl_Container *c, Ewl_Widget *w, int idx);
void ewl_context_menu_cb_child_mouse_in(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
void ewl_context_menu_cb_child_clicked(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
/**
* @}
diff --git a/src/lib/ewl_cursor.c b/src/lib/ewl_cursor.c
index 9a0b600..59884bc 100644
--- a/src/lib/ewl_cursor.c
+++ b/src/lib/ewl_cursor.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_cursor.h"
#include "ewl_macros.h"
@@ -15,21 +15,21 @@ static void ewl_cursor_cb_destroy(Ewl_Widget *w, void *ev, void *data);
Ewl_Widget *
ewl_cursor_new(void)
{
- Ewl_Widget *w = NULL;
+ Ewl_Widget *w = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- w = NEW(Ewl_Cursor, 1);
- if (!w)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ w = NEW(Ewl_Cursor, 1);
+ if (!w)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_cursor_init(EWL_CURSOR(w)))
- {
- ewl_widget_destroy(w);
- w = NULL;
- }
+ if (!ewl_cursor_init(EWL_CURSOR(w)))
+ {
+ ewl_widget_destroy(w);
+ w = NULL;
+ }
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
/**
@@ -40,83 +40,83 @@ ewl_cursor_new(void)
int
ewl_cursor_init(Ewl_Cursor *cursor)
{
- Ewl_Widget *w = EWL_WIDGET(cursor);
+ Ewl_Widget *w = EWL_WIDGET(cursor);
- DENTER_FUNCTION(DLEVEL_UNSTABLE);
- DCHECK_PARAM_PTR_RET(cursor, FALSE);
+ DENTER_FUNCTION(DLEVEL_UNSTABLE);
+ DCHECK_PARAM_PTR_RET(cursor, FALSE);
- if (!ewl_window_init(EWL_WINDOW(cursor)))
- DRETURN_INT(FALSE, DLEVEL_UNSTABLE);
+ if (!ewl_window_init(EWL_WINDOW(cursor)))
+ DRETURN_INT(FALSE, DLEVEL_UNSTABLE);
- ewl_widget_appearance_set(w, EWL_CURSOR_TYPE);
- ewl_widget_inherit(w, EWL_CURSOR_TYPE);
+ ewl_widget_appearance_set(w, EWL_CURSOR_TYPE);
+ ewl_widget_inherit(w, EWL_CURSOR_TYPE);
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_ALL);
- ewl_object_size_request(EWL_OBJECT(w), 32, 32);
- ewl_embed_engine_name_set(EWL_EMBED(cursor), "evas_buffer");
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_ALL);
+ ewl_object_size_request(EWL_OBJECT(w), 32, 32);
+ ewl_embed_engine_name_set(EWL_EMBED(cursor), "evas_buffer");
- ewl_callback_append(w, EWL_CALLBACK_VALUE_CHANGED,
- ewl_cursor_cb_render, NULL);
- ewl_callback_append(w, EWL_CALLBACK_DESTROY,
- ewl_cursor_cb_destroy, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_VALUE_CHANGED,
+ ewl_cursor_cb_render, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_DESTROY,
+ ewl_cursor_cb_destroy, NULL);
- DRETURN_INT(TRUE, DLEVEL_UNSTABLE);
+ DRETURN_INT(TRUE, DLEVEL_UNSTABLE);
}
static void
ewl_cursor_cb_render(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
{
- int handle;
- int width, height;
- Ewl_Widget *parent;
- Ewl_Cursor *cursor = EWL_CURSOR(w);
+ int handle;
+ int width, height;
+ Ewl_Widget *parent;
+ Ewl_Cursor *cursor = EWL_CURSOR(w);
- DENTER_FUNCTION(DLEVEL_UNSTABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_CURSOR_TYPE);
+ DENTER_FUNCTION(DLEVEL_UNSTABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_CURSOR_TYPE);
- /*
- * Find the widget setting the current cursor.
- */
- parent = ewl_widget_focused_get();
- if (parent)
- parent = EWL_WIDGET(ewl_embed_widget_find(parent));
+ /*
+ * Find the widget setting the current cursor.
+ */
+ parent = ewl_widget_focused_get();
+ if (parent)
+ parent = EWL_WIDGET(ewl_embed_widget_find(parent));
- if (!parent)
- DRETURN(DLEVEL_UNSTABLE);
+ if (!parent)
+ DRETURN(DLEVEL_UNSTABLE);
- if (cursor->handle)
- ewl_engine_pointer_free(EWL_EMBED(parent), cursor->handle);
+ if (cursor->handle)
+ ewl_engine_pointer_free(EWL_EMBED(parent), cursor->handle);
- width = ewl_object_current_w_get(EWL_OBJECT(cursor));
- height = ewl_object_current_h_get(EWL_OBJECT(cursor));
+ width = ewl_object_current_w_get(EWL_OBJECT(cursor));
+ height = ewl_object_current_h_get(EWL_OBJECT(cursor));
- handle = ewl_engine_pointer_data_new(EWL_EMBED(parent),
- EWL_EMBED(cursor)->canvas_window, width, height);
+ handle = ewl_engine_pointer_data_new(EWL_EMBED(parent),
+ EWL_EMBED(cursor)->canvas_window, width, height);
- if (EWL_EMBED(parent)->cursor == cursor->handle)
- ewl_engine_pointer_set(EWL_EMBED(parent), handle);
+ if (EWL_EMBED(parent)->cursor == cursor->handle)
+ ewl_engine_pointer_set(EWL_EMBED(parent), handle);
- cursor->handle = handle;
+ cursor->handle = handle;
- DLEAVE_FUNCTION(DLEVEL_UNSTABLE);
+ DLEAVE_FUNCTION(DLEVEL_UNSTABLE);
}
static void
ewl_cursor_cb_destroy(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Cursor *cursor = EWL_CURSOR(w);
+ Ewl_Cursor *cursor = EWL_CURSOR(w);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_CURSOR_TYPE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_CURSOR_TYPE);
- /* FIXME: Also needs to be handled for the correct engine refs
- if (cursor->handle)
- ewl_engine_pointer_free(parent, cursor->handle);
- */
- cursor->handle = 0;
+ /* FIXME: Also needs to be handled for the correct engine refs
+ if (cursor->handle)
+ ewl_engine_pointer_free(parent, cursor->handle);
+ */
+ cursor->handle = 0;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_cursor.h b/src/lib/ewl_cursor.h
index 8a3f4ff..8ca4261 100644
--- a/src/lib/ewl_cursor.h
+++ b/src/lib/ewl_cursor.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_CURSOR_H
#define EWL_CURSOR_H
@@ -47,13 +47,13 @@ typedef struct Ewl_Cursor Ewl_Cursor;
*/
struct Ewl_Cursor
{
- Ewl_Window window; /**< Inherit from Ewl_Window */
- int refcount; /**< Number of references to cursor */
- int handle; /**< Engine id for generated cursor */
+ Ewl_Window window; /**< Inherit from Ewl_Window */
+ int refcount; /**< Number of references to cursor */
+ int handle; /**< Engine id for generated cursor */
};
-Ewl_Widget *ewl_cursor_new(void);
-int ewl_cursor_init(Ewl_Cursor *c);
+Ewl_Widget *ewl_cursor_new(void);
+int ewl_cursor_init(Ewl_Cursor *c);
/**
* @}
diff --git a/src/lib/ewl_datepicker.c b/src/lib/ewl_datepicker.c
index 54553ee..898e7f8 100644
--- a/src/lib/ewl_datepicker.c
+++ b/src/lib/ewl_datepicker.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_datepicker.h"
#include "ewl_calendar.h"
@@ -8,7 +8,7 @@
#include "ewl_debug.h"
static void ewl_datepicker_cb_dropdown(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
/**
* @return Returns NULL on failure, a new Ewl_Datepicker on success
@@ -17,20 +17,20 @@ static void ewl_datepicker_cb_dropdown(Ewl_Widget *w, void *ev_data,
Ewl_Widget *
ewl_datepicker_new(void)
{
- Ewl_Datepicker *ib;
+ Ewl_Datepicker *ib;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ib = NEW(Ewl_Datepicker, 1);
- if (!ib)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ ib = NEW(Ewl_Datepicker, 1);
+ if (!ib)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_datepicker_init(ib)) {
- ewl_widget_destroy(EWL_WIDGET(ib));
- ib = NULL;
- }
+ if (!ewl_datepicker_init(ib)) {
+ ewl_widget_destroy(EWL_WIDGET(ib));
+ ib = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(ib), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(ib), DLEVEL_STABLE);
}
/**
@@ -41,48 +41,48 @@ ewl_datepicker_new(void)
int
ewl_datepicker_init(Ewl_Datepicker *dp)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(dp, FALSE);
-
- if (!ewl_text_init(EWL_TEXT(dp)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- ewl_widget_appearance_set(EWL_WIDGET(dp), EWL_DATEPICKER_TYPE);
- ewl_widget_inherit(EWL_WIDGET(dp), EWL_DATEPICKER_TYPE);
- ewl_object_fill_policy_set(EWL_OBJECT(dp), EWL_FLAG_FILL_HFILL |
- EWL_FLAG_FILL_NONE);
-
- dp->calendar_window = ewl_popup_new();
- ewl_widget_appearance_set(dp->calendar_window,
- EWL_DATEPICKER_TYPE"/"EWL_POPUP_TYPE);
- ewl_object_fill_policy_set(EWL_OBJECT(dp->calendar_window),
- EWL_FLAG_FILL_NONE);
- ewl_popup_type_set(EWL_POPUP(dp->calendar_window),
- EWL_POPUP_TYPE_MENU_VERTICAL);
- ewl_popup_follow_set(EWL_POPUP(dp->calendar_window), EWL_WIDGET(dp));
- ewl_window_keyboard_grab_set(EWL_WINDOW(dp->calendar_window), TRUE);
- ewl_window_pointer_grab_set(EWL_WINDOW(dp->calendar_window), TRUE);
- ewl_callback_append(dp->calendar_window, EWL_CALLBACK_MOUSE_DOWN,
- ewl_datepicker_cb_window_mouse_down, dp);
-
- dp->calendar = ewl_calendar_new();
- ewl_object_fill_policy_set(EWL_OBJECT(dp->calendar),
- EWL_FLAG_FILL_NONE);
- ewl_container_child_append(EWL_CONTAINER(dp->calendar_window),
- dp->calendar);
- ewl_callback_append(EWL_WIDGET(dp->calendar),
- EWL_CALLBACK_VALUE_CHANGED,
- ewl_datepicker_cb_value_changed, dp);
- ewl_widget_show(dp->calendar);
-
- ewl_callback_prepend(EWL_WIDGET(dp), EWL_CALLBACK_DESTROY,
- ewl_datepicker_cb_destroy, dp);
- ewl_callback_append(EWL_WIDGET(dp), EWL_CALLBACK_MOUSE_DOWN,
- ewl_datepicker_cb_dropdown, NULL);
-
- ewl_callback_call(EWL_WIDGET(dp->calendar), EWL_CALLBACK_VALUE_CHANGED);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(dp, FALSE);
+
+ if (!ewl_text_init(EWL_TEXT(dp)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ ewl_widget_appearance_set(EWL_WIDGET(dp), EWL_DATEPICKER_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(dp), EWL_DATEPICKER_TYPE);
+ ewl_object_fill_policy_set(EWL_OBJECT(dp), EWL_FLAG_FILL_HFILL |
+ EWL_FLAG_FILL_NONE);
+
+ dp->calendar_window = ewl_popup_new();
+ ewl_widget_appearance_set(dp->calendar_window,
+ EWL_DATEPICKER_TYPE"/"EWL_POPUP_TYPE);
+ ewl_object_fill_policy_set(EWL_OBJECT(dp->calendar_window),
+ EWL_FLAG_FILL_NONE);
+ ewl_popup_type_set(EWL_POPUP(dp->calendar_window),
+ EWL_POPUP_TYPE_MENU_VERTICAL);
+ ewl_popup_follow_set(EWL_POPUP(dp->calendar_window), EWL_WIDGET(dp));
+ ewl_window_keyboard_grab_set(EWL_WINDOW(dp->calendar_window), TRUE);
+ ewl_window_pointer_grab_set(EWL_WINDOW(dp->calendar_window), TRUE);
+ ewl_callback_append(dp->calendar_window, EWL_CALLBACK_MOUSE_DOWN,
+ ewl_datepicker_cb_window_mouse_down, dp);
+
+ dp->calendar = ewl_calendar_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(dp->calendar),
+ EWL_FLAG_FILL_NONE);
+ ewl_container_child_append(EWL_CONTAINER(dp->calendar_window),
+ dp->calendar);
+ ewl_callback_append(EWL_WIDGET(dp->calendar),
+ EWL_CALLBACK_VALUE_CHANGED,
+ ewl_datepicker_cb_value_changed, dp);
+ ewl_widget_show(dp->calendar);
+
+ ewl_callback_prepend(EWL_WIDGET(dp), EWL_CALLBACK_DESTROY,
+ ewl_datepicker_cb_destroy, dp);
+ ewl_callback_append(EWL_WIDGET(dp), EWL_CALLBACK_MOUSE_DOWN,
+ ewl_datepicker_cb_dropdown, NULL);
+
+ ewl_callback_call(EWL_WIDGET(dp->calendar), EWL_CALLBACK_VALUE_CHANGED);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -95,18 +95,18 @@ ewl_datepicker_init(Ewl_Datepicker *dp)
*/
void
ewl_datepicker_cb_destroy(Ewl_Widget *w, void *ev __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Datepicker *dp;
+ Ewl_Datepicker *dp;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_DATEPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_DATEPICKER_TYPE);
- dp = EWL_DATEPICKER(w);
- ewl_widget_destroy(dp->calendar_window);
+ dp = EWL_DATEPICKER(w);
+ ewl_widget_destroy(dp->calendar_window);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -119,23 +119,23 @@ ewl_datepicker_cb_destroy(Ewl_Widget *w, void *ev __UNUSED__,
*/
void
ewl_datepicker_cb_value_changed(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *user_data)
+ void *user_data)
{
- char *date;
- Ewl_Datepicker* dp;
+ char *date;
+ Ewl_Datepicker* dp;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(user_data);
- DCHECK_TYPE(user_data, EWL_DATEPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(user_data);
+ DCHECK_TYPE(user_data, EWL_DATEPICKER_TYPE);
- dp = EWL_DATEPICKER(user_data);
- ewl_widget_hide(dp->calendar_window);
+ dp = EWL_DATEPICKER(user_data);
+ ewl_widget_hide(dp->calendar_window);
- date = ewl_calendar_ascii_time_get(EWL_CALENDAR(dp->calendar));
- ewl_text_text_set(EWL_TEXT(dp), date);
- FREE(date);
+ date = ewl_calendar_ascii_time_get(EWL_CALENDAR(dp->calendar));
+ ewl_text_text_set(EWL_TEXT(dp), date);
+ FREE(date);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -148,32 +148,32 @@ ewl_datepicker_cb_value_changed(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
*/
void
ewl_datepicker_cb_window_mouse_down(Ewl_Widget *w, void *ev __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_EMBED_TYPE);
- if (w == ewl_embed_focused_widget_get(EWL_EMBED(w)))
- ewl_widget_hide(w);
+ if (w == ewl_embed_focused_widget_get(EWL_EMBED(w)))
+ ewl_widget_hide(w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_datepicker_cb_dropdown(Ewl_Widget *w, void *ev __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Datepicker *dp;
+ Ewl_Datepicker *dp;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_DATEPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_DATEPICKER_TYPE);
- dp = EWL_DATEPICKER(w);
- ewl_widget_show(dp->calendar_window);
- ewl_window_raise(EWL_WINDOW(dp->calendar_window));
+ dp = EWL_DATEPICKER(w);
+ ewl_widget_show(dp->calendar_window);
+ ewl_window_raise(EWL_WINDOW(dp->calendar_window));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_datepicker.h b/src/lib/ewl_datepicker.h
index 4b4fee3..7a9cf60 100644
--- a/src/lib/ewl_datepicker.h
+++ b/src/lib/ewl_datepicker.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_DATEPICKER_H
#define EWL_DATEPICKER_H
@@ -49,15 +49,15 @@ typedef struct Ewl_Datepicker Ewl_Datepicker;
*/
struct Ewl_Datepicker
{
- Ewl_Text text; /**< Inherit from Ewl_Text */
+ Ewl_Text text; /**< Inherit from Ewl_Text */
- Ewl_Widget *calendar; /**< The calendar */
- Ewl_Widget *calendar_window; /**< The window */
+ Ewl_Widget *calendar; /**< The calendar */
+ Ewl_Widget *calendar_window; /**< The window */
};
-Ewl_Widget *ewl_datepicker_new(void);
-int ewl_datepicker_init(Ewl_Datepicker* datepicker);
+Ewl_Widget *ewl_datepicker_new(void);
+int ewl_datepicker_init(Ewl_Datepicker* datepicker);
/*
* Internally used callbacks, override at your risk
@@ -65,7 +65,7 @@ int ewl_datepicker_init(Ewl_Datepicker* datepicker);
void ewl_datepicker_cb_destroy(Ewl_Widget *w, void *ev, void *user_data);
void ewl_datepicker_cb_value_changed(Ewl_Widget *w, void *ev, void *user_data);
void ewl_datepicker_cb_window_mouse_down(Ewl_Widget *w, void *ev,
- void *user_data);
+ void *user_data);
/**
* @}
diff --git a/src/lib/ewl_debug.h b/src/lib/ewl_debug.h
index feedfce..ab9089b 100644
--- a/src/lib/ewl_debug.h
+++ b/src/lib/ewl_debug.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_DEBUG_H
#define EWL_DEBUG_H
@@ -25,15 +25,15 @@ typedef struct Ewl_Config_Cache Ewl_Config_Cache;
*/
struct Ewl_Config_Cache
{
- int level; /**< Debug level */
- unsigned char enable:1; /**< Enable debugging */
- unsigned char segv:1; /**< Segv on D* messages */
- unsigned char backtrace:1; /**< Print backtrace on D* messages */
- unsigned char evas_render:1; /**< Debug evas render calls */
- unsigned char gc_reap:1; /**< Debug garbage collection */
-
- unsigned char print_signals:1; /**< Print theme signals */
- unsigned char print_keys:1; /**< Print theem keys */
+ int level; /**< Debug level */
+ unsigned char enable:1; /**< Enable debugging */
+ unsigned char segv:1; /**< Segv on D* messages */
+ unsigned char backtrace:1; /**< Print backtrace on D* messages */
+ unsigned char evas_render:1; /**< Debug evas render calls */
+ unsigned char gc_reap:1; /**< Debug garbage collection */
+
+ unsigned char print_signals:1; /**< Print theme signals */
+ unsigned char print_keys:1; /**< Print theem keys */
};
extern Ewl_Config_Cache ewl_config_cache; /**< system debug data */
@@ -44,157 +44,157 @@ extern Ewl_Config_Cache ewl_config_cache; /**< system debug data */
#define DENTER_FUNCTION(lvl) \
{ \
- if (DEBUGGING(lvl)) \
- { \
- ewl_debug_indent_print(1); \
- fprintf(stderr, "--> %f - %s:%i\tEntering %s();\n", \
- ecore_time_get(), __FILE__, __LINE__, __func__); \
- } \
+ if (DEBUGGING(lvl)) \
+ { \
+ ewl_debug_indent_print(1); \
+ fprintf(stderr, "--> %f - %s:%i\tEntering %s();\n", \
+ ecore_time_get(), __FILE__, __LINE__, __func__); \
+ } \
}
#define DLEAVE_FUNCTION(lvl) \
{ \
- if (DEBUGGING(lvl)) \
- { \
- ewl_debug_indent_print(-1); \
- fprintf(stderr, "<-- %f - %s:%i\tLeaving %s();\n", \
- ecore_time_get(), __FILE__, __LINE__, __func__); \
- } \
+ if (DEBUGGING(lvl)) \
+ { \
+ ewl_debug_indent_print(-1); \
+ fprintf(stderr, "<-- %f - %s:%i\tLeaving %s();\n", \
+ ecore_time_get(), __FILE__, __LINE__, __func__); \
+ } \
}
#define DRETURN(lvl) \
{ \
- DLEAVE_FUNCTION(lvl); \
- if (DEBUGGING(lvl)) \
- { \
- ewl_debug_indent_print(0); \
- fprintf(stderr, "<-- %f - %s:%i\tReturn in %s();\n", \
- ecore_time_get(), __FILE__, __LINE__, __func__); \
- } \
- return; \
+ DLEAVE_FUNCTION(lvl); \
+ if (DEBUGGING(lvl)) \
+ { \
+ ewl_debug_indent_print(0); \
+ fprintf(stderr, "<-- %f - %s:%i\tReturn in %s();\n", \
+ ecore_time_get(), __FILE__, __LINE__, __func__); \
+ } \
+ return; \
}
#define DRETURN_PTR(ptr, lvl) \
{ \
- DLEAVE_FUNCTION(lvl); \
- if (DEBUGGING(lvl)) \
- { \
- ewl_debug_indent_print(0); \
- fprintf(stderr, "<-- %f - %s:%i\tReturning %p in %s();\n", \
- ecore_time_get(), __FILE__, __LINE__, (void *) (ptr), __func__); \
- } \
- return (void *)(ptr); \
+ DLEAVE_FUNCTION(lvl); \
+ if (DEBUGGING(lvl)) \
+ { \
+ ewl_debug_indent_print(0); \
+ fprintf(stderr, "<-- %f - %s:%i\tReturning %p in %s();\n", \
+ ecore_time_get(), __FILE__, __LINE__, (void *) (ptr), __func__); \
+ } \
+ return (void *)(ptr); \
}
#define DRETURN_FLOAT(num, lvl) \
{ \
- DLEAVE_FUNCTION(lvl); \
- if (DEBUGGING(lvl)) \
- { \
- ewl_debug_indent_print(0); \
- fprintf(stderr, "<-- %f - %s:%i\tReturning %f in %s();\n", \
- ecore_time_get(), __FILE__, __LINE__, (float) (num), __func__); \
- } \
- return num; \
+ DLEAVE_FUNCTION(lvl); \
+ if (DEBUGGING(lvl)) \
+ { \
+ ewl_debug_indent_print(0); \
+ fprintf(stderr, "<-- %f - %s:%i\tReturning %f in %s();\n", \
+ ecore_time_get(), __FILE__, __LINE__, (float) (num), __func__); \
+ } \
+ return num; \
}
#define DRETURN_INT(num, lvl) \
{ \
- DLEAVE_FUNCTION(lvl); \
- if (DEBUGGING(lvl)) \
- { \
- ewl_debug_indent_print(0); \
- fprintf(stderr, "<-- %f - %s:%i\tReturning %i in %s();\n", \
- ecore_time_get(), __FILE__, __LINE__, (int) (num), __func__); \
- } \
- return num; \
+ DLEAVE_FUNCTION(lvl); \
+ if (DEBUGGING(lvl)) \
+ { \
+ ewl_debug_indent_print(0); \
+ fprintf(stderr, "<-- %f - %s:%i\tReturning %i in %s();\n", \
+ ecore_time_get(), __FILE__, __LINE__, (int) (num), __func__); \
+ } \
+ return num; \
}
#define DWARNING(fmt, args...) \
{ \
- ewl_print_warning(); \
- fprintf(stderr, "\tIn function:\n\n" \
- "\t%s();\n\n", __func__); \
- fprintf(stderr, fmt, ## args); \
- fprintf(stderr, "\n"); \
- ewl_backtrace(); \
- ewl_segv(); \
+ ewl_print_warning(); \
+ fprintf(stderr, "\tIn function:\n\n" \
+ "\t%s();\n\n", __func__); \
+ fprintf(stderr, fmt, ## args); \
+ fprintf(stderr, "\n"); \
+ ewl_backtrace(); \
+ ewl_segv(); \
}
#define DCHECK_PARAM_PTR(ptr) \
{ \
- if (!(ptr)) \
- { \
- ewl_print_warning(); \
- fprintf(stderr, "\tThis program is calling:\n\n" \
- "\t%s();\n\n" \
- "\tWith the parameter:\n\n" \
- "\t%s\n\n" \
- "\tbeing NULL. Please fix your program.\n", \
- __func__, # ptr); \
- ewl_backtrace(); \
- ewl_segv(); \
- return; \
- } \
+ if (!(ptr)) \
+ { \
+ ewl_print_warning(); \
+ fprintf(stderr, "\tThis program is calling:\n\n" \
+ "\t%s();\n\n" \
+ "\tWith the parameter:\n\n" \
+ "\t%s\n\n" \
+ "\tbeing NULL. Please fix your program.\n", \
+ __func__, # ptr); \
+ ewl_backtrace(); \
+ ewl_segv(); \
+ return; \
+ } \
}
#define DCHECK_PARAM_PTR_RET(ptr, ret) \
{ \
- if (!(ptr)) \
- { \
- ewl_print_warning(); \
- fprintf(stderr, "\tThis program is calling:\n\n" \
- "\t%s();\n\n" \
- "\tWith the parameter:\n\n" \
- "\t%s\n\n" \
- "\tbeing NULL. Please fix your program.\n", \
- __func__, # ptr); \
- ewl_backtrace(); \
- ewl_segv(); \
- return ret; \
- } \
+ if (!(ptr)) \
+ { \
+ ewl_print_warning(); \
+ fprintf(stderr, "\tThis program is calling:\n\n" \
+ "\t%s();\n\n" \
+ "\tWith the parameter:\n\n" \
+ "\t%s\n\n" \
+ "\tbeing NULL. Please fix your program.\n", \
+ __func__, # ptr); \
+ ewl_backtrace(); \
+ ewl_segv(); \
+ return ret; \
+ } \
}
#define DCHECK_TYPE(ptr, type) \
{ \
- if (ptr && !ewl_widget_type_is(EWL_WIDGET(ptr), type)) \
- { \
- ewl_print_warning(); \
- fprintf(stderr, "\tThis program is calling:\n\n" \
- "\t%s();\n\n" \
- "\tWith the paramter:\n\n" \
- "\t%s\n\n" \
- "\tas the wrong type. (%s) instead of (%s).\n" \
- "\tPlease fix your program.\n", \
- __func__, # ptr, \
- (EWL_WIDGET(ptr)->inheritance ? \
- EWL_WIDGET(ptr)->inheritance : \
- "NULL") , type); \
- ewl_backtrace(); \
- ewl_segv(); \
- return; \
- } \
+ if (ptr && !ewl_widget_type_is(EWL_WIDGET(ptr), type)) \
+ { \
+ ewl_print_warning(); \
+ fprintf(stderr, "\tThis program is calling:\n\n" \
+ "\t%s();\n\n" \
+ "\tWith the paramter:\n\n" \
+ "\t%s\n\n" \
+ "\tas the wrong type. (%s) instead of (%s).\n" \
+ "\tPlease fix your program.\n", \
+ __func__, # ptr, \
+ (EWL_WIDGET(ptr)->inheritance ? \
+ EWL_WIDGET(ptr)->inheritance : \
+ "NULL") , type); \
+ ewl_backtrace(); \
+ ewl_segv(); \
+ return; \
+ } \
}
#define DCHECK_TYPE_RET(ptr, type, ret) \
{ \
- if (ptr && !ewl_widget_type_is(EWL_WIDGET(ptr), type)) \
- { \
- ewl_print_warning(); \
- fprintf(stderr, "\tThis program is calling:\n\n" \
- "\t%s();\n\n" \
- "\tWith the paramter:\n\n" \
- "\t%s\n\n" \
- "\tas the wrong type. (%s) instead of (%s).\n" \
- "\tPlease fix your program.\n", \
- __func__, # ptr, \
- (EWL_WIDGET(ptr)->inheritance ? \
- EWL_WIDGET(ptr)->inheritance : \
- "NULL") , type); \
- ewl_backtrace(); \
- ewl_segv(); \
- return ret; \
- } \
+ if (ptr && !ewl_widget_type_is(EWL_WIDGET(ptr), type)) \
+ { \
+ ewl_print_warning(); \
+ fprintf(stderr, "\tThis program is calling:\n\n" \
+ "\t%s();\n\n" \
+ "\tWith the paramter:\n\n" \
+ "\t%s\n\n" \
+ "\tas the wrong type. (%s) instead of (%s).\n" \
+ "\tPlease fix your program.\n", \
+ __func__, # ptr, \
+ (EWL_WIDGET(ptr)->inheritance ? \
+ EWL_WIDGET(ptr)->inheritance : \
+ "NULL") , type); \
+ ewl_backtrace(); \
+ ewl_segv(); \
+ return ret; \
+ } \
}
#else
@@ -208,15 +208,15 @@ extern Ewl_Config_Cache ewl_config_cache; /**< system debug data */
#define DWARNING(fmt, args...) {}
#define DCHECK_PARAM_PTR(ptr) \
{ \
- if (!(ptr)) { \
- return; \
- } \
+ if (!(ptr)) { \
+ return; \
+ } \
}
#define DCHECK_PARAM_PTR_RET(ptr, ret) \
{ \
- if (!(ptr)) { \
- return ret; \
- } \
+ if (!(ptr)) { \
+ return ret; \
+ } \
}
#define DCHECK_TYPE(ptr, type) {}
#define DCHECK_TYPE_RET(ptr, type, ret) {}
@@ -224,10 +224,10 @@ extern Ewl_Config_Cache ewl_config_cache; /**< system debug data */
#define DERROR(fmt) \
{ \
- ewl_print_warning(); \
- fprintf(stderr, "\tIn function:\n\n" \
- "\t%s();\n\n", __func__); \
- fprintf(stderr, fmt); \
+ ewl_print_warning(); \
+ fprintf(stderr, "\tIn function:\n\n" \
+ "\t%s();\n\n", __func__); \
+ fprintf(stderr, fmt); \
}
#endif
diff --git a/src/lib/ewl_dialog.c b/src/lib/ewl_dialog.c
index 0561d39..8486d97 100644
--- a/src/lib/ewl_dialog.c
+++ b/src/lib/ewl_dialog.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_dialog.h"
#include "ewl_box.h"
@@ -15,21 +15,21 @@
Ewl_Widget *
ewl_dialog_new(void)
{
- Ewl_Dialog *d;
+ Ewl_Dialog *d;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- d = NEW(Ewl_Dialog, 1);
- if (!d) {
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ d = NEW(Ewl_Dialog, 1);
+ if (!d) {
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- if (!ewl_dialog_init(d)) {
- ewl_widget_destroy(EWL_WIDGET(d));
- d = NULL;
- }
+ if (!ewl_dialog_init(d)) {
+ ewl_widget_destroy(EWL_WIDGET(d));
+ d = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(d), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(d), DLEVEL_STABLE);
}
/**
@@ -40,83 +40,83 @@ ewl_dialog_new(void)
int
ewl_dialog_init(Ewl_Dialog *dialog)
{
- Ewl_Widget *w;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(dialog, FALSE);
-
- w = EWL_WIDGET(dialog);
-
- if (!ewl_window_init(EWL_WINDOW(dialog))) {
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
-
- ewl_widget_appearance_set(w, EWL_DIALOG_TYPE);
- ewl_widget_inherit(w, EWL_DIALOG_TYPE);
-
- dialog->position = EWL_POSITION_BOTTOM;
-
- /*
- * Create a box for laying out the whole window
- */
- dialog->box = ewl_vbox_new();
- if (!dialog->box) {
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
- ewl_container_child_append(EWL_CONTAINER(dialog), dialog->box);
- ewl_widget_internal_set(dialog->box, TRUE);
- ewl_object_fill_policy_set(EWL_OBJECT(dialog->box), EWL_FLAG_FILL_ALL);
- ewl_widget_show(dialog->box);
-
- /*
- * Setup a vertical box for the displayed window contents.
- */
- dialog->vbox = ewl_vbox_new();
- if (!dialog->vbox) {
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
-
- ewl_container_child_append(EWL_CONTAINER(dialog->box), dialog->vbox);
- ewl_widget_internal_set(dialog->vbox, TRUE);
- ewl_box_homogeneous_set(EWL_BOX(dialog->vbox), FALSE);
- ewl_object_fill_policy_set(EWL_OBJECT(dialog->vbox), EWL_FLAG_FILL_ALL);
- ewl_widget_show(dialog->vbox);
-
- dialog->separator = ewl_hseparator_new();
- if (!dialog->separator) {
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
- ewl_container_child_append(EWL_CONTAINER(dialog->box), dialog->separator);
- ewl_widget_internal_set(dialog->separator, TRUE);
- ewl_widget_show(dialog->separator);
-
- /*
- * Create an action area for buttons
- */
- dialog->action_area = ewl_cell_new();
- ewl_widget_appearance_set(dialog->action_area, "actionarea");
- ewl_object_fill_policy_set(EWL_OBJECT(dialog->action_area),
- EWL_FLAG_FILL_HFILL);
- ewl_widget_internal_set(dialog->action_area, TRUE);
- ewl_container_child_append(EWL_CONTAINER(dialog->box),
- dialog->action_area);
- ewl_widget_show(dialog->action_area);
-
- dialog->action_box = ewl_hbox_new();
- if (!dialog->action_box) {
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
- ewl_container_child_append(EWL_CONTAINER(dialog->action_area),
- dialog->action_box);
- ewl_box_homogeneous_set(EWL_BOX(dialog->action_box), FALSE);
- ewl_object_fill_policy_set(EWL_OBJECT(dialog->action_box),
- EWL_FLAG_FILL_NONE);
- ewl_widget_internal_set(dialog->action_box, TRUE);
- ewl_widget_show(dialog->action_box);
-
- ewl_dialog_active_area_set(dialog, dialog->position);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Widget *w;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(dialog, FALSE);
+
+ w = EWL_WIDGET(dialog);
+
+ if (!ewl_window_init(EWL_WINDOW(dialog))) {
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+
+ ewl_widget_appearance_set(w, EWL_DIALOG_TYPE);
+ ewl_widget_inherit(w, EWL_DIALOG_TYPE);
+
+ dialog->position = EWL_POSITION_BOTTOM;
+
+ /*
+ * Create a box for laying out the whole window
+ */
+ dialog->box = ewl_vbox_new();
+ if (!dialog->box) {
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+ ewl_container_child_append(EWL_CONTAINER(dialog), dialog->box);
+ ewl_widget_internal_set(dialog->box, TRUE);
+ ewl_object_fill_policy_set(EWL_OBJECT(dialog->box), EWL_FLAG_FILL_ALL);
+ ewl_widget_show(dialog->box);
+
+ /*
+ * Setup a vertical box for the displayed window contents.
+ */
+ dialog->vbox = ewl_vbox_new();
+ if (!dialog->vbox) {
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+
+ ewl_container_child_append(EWL_CONTAINER(dialog->box), dialog->vbox);
+ ewl_widget_internal_set(dialog->vbox, TRUE);
+ ewl_box_homogeneous_set(EWL_BOX(dialog->vbox), FALSE);
+ ewl_object_fill_policy_set(EWL_OBJECT(dialog->vbox), EWL_FLAG_FILL_ALL);
+ ewl_widget_show(dialog->vbox);
+
+ dialog->separator = ewl_hseparator_new();
+ if (!dialog->separator) {
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+ ewl_container_child_append(EWL_CONTAINER(dialog->box), dialog->separator);
+ ewl_widget_internal_set(dialog->separator, TRUE);
+ ewl_widget_show(dialog->separator);
+
+ /*
+ * Create an action area for buttons
+ */
+ dialog->action_area = ewl_cell_new();
+ ewl_widget_appearance_set(dialog->action_area, "actionarea");
+ ewl_object_fill_policy_set(EWL_OBJECT(dialog->action_area),
+ EWL_FLAG_FILL_HFILL);
+ ewl_widget_internal_set(dialog->action_area, TRUE);
+ ewl_container_child_append(EWL_CONTAINER(dialog->box),
+ dialog->action_area);
+ ewl_widget_show(dialog->action_area);
+
+ dialog->action_box = ewl_hbox_new();
+ if (!dialog->action_box) {
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+ ewl_container_child_append(EWL_CONTAINER(dialog->action_area),
+ dialog->action_box);
+ ewl_box_homogeneous_set(EWL_BOX(dialog->action_box), FALSE);
+ ewl_object_fill_policy_set(EWL_OBJECT(dialog->action_box),
+ EWL_FLAG_FILL_NONE);
+ ewl_widget_internal_set(dialog->action_box, TRUE);
+ ewl_widget_show(dialog->action_box);
+
+ ewl_dialog_active_area_set(dialog, dialog->position);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -128,60 +128,60 @@ ewl_dialog_init(Ewl_Dialog *dialog)
void
ewl_dialog_action_position_set(Ewl_Dialog *d, Ewl_Position pos)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(d);
- DCHECK_TYPE(d, EWL_DIALOG_TYPE);
-
- if (pos == d->position) {
- DRETURN(DLEVEL_STABLE);
- }
-
- d->position = pos;
-
- /*
- * First determine the orientation of the dialog area.
- */
- if (pos & (EWL_POSITION_LEFT | EWL_POSITION_RIGHT)) {
- ewl_box_orientation_set(EWL_BOX(d->box),
- EWL_ORIENTATION_HORIZONTAL);
- ewl_separator_orientation_set(EWL_SEPARATOR((d->separator)),
- EWL_ORIENTATION_VERTICAL);
- ewl_box_orientation_set(EWL_BOX(d->action_box),
- EWL_ORIENTATION_VERTICAL);
- ewl_object_fill_policy_set(EWL_OBJECT(d->action_area),
- EWL_FLAG_FILL_VFILL);
- }
- else {
- ewl_box_orientation_set(EWL_BOX(d->box),
- EWL_ORIENTATION_VERTICAL);
- ewl_separator_orientation_set(EWL_SEPARATOR((d->separator)),
- EWL_ORIENTATION_HORIZONTAL);
- ewl_box_orientation_set(EWL_BOX(d->action_box),
- EWL_ORIENTATION_HORIZONTAL);
- ewl_object_fill_policy_set(EWL_OBJECT(d->action_area),
- EWL_FLAG_FILL_HFILL);
- }
-
- ewl_container_child_remove(EWL_CONTAINER(d->box), d->separator);
- ewl_container_child_remove(EWL_CONTAINER(d->box), d->action_area);
-
- /*
- * Repack order of the widgets to match new position
- */
- if (pos & (EWL_POSITION_LEFT | EWL_POSITION_TOP)) {
- ewl_container_child_prepend(EWL_CONTAINER(d->box),
- d->separator);
- ewl_container_child_prepend(EWL_CONTAINER(d->box),
- d->action_area);
- }
- else {
- ewl_container_child_append(EWL_CONTAINER(d->box),
- d->separator);
- ewl_container_child_append(EWL_CONTAINER(d->box),
- d->action_area);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(d);
+ DCHECK_TYPE(d, EWL_DIALOG_TYPE);
+
+ if (pos == d->position) {
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ d->position = pos;
+
+ /*
+ * First determine the orientation of the dialog area.
+ */
+ if (pos & (EWL_POSITION_LEFT | EWL_POSITION_RIGHT)) {
+ ewl_box_orientation_set(EWL_BOX(d->box),
+ EWL_ORIENTATION_HORIZONTAL);
+ ewl_separator_orientation_set(EWL_SEPARATOR((d->separator)),
+ EWL_ORIENTATION_VERTICAL);
+ ewl_box_orientation_set(EWL_BOX(d->action_box),
+ EWL_ORIENTATION_VERTICAL);
+ ewl_object_fill_policy_set(EWL_OBJECT(d->action_area),
+ EWL_FLAG_FILL_VFILL);
+ }
+ else {
+ ewl_box_orientation_set(EWL_BOX(d->box),
+ EWL_ORIENTATION_VERTICAL);
+ ewl_separator_orientation_set(EWL_SEPARATOR((d->separator)),
+ EWL_ORIENTATION_HORIZONTAL);
+ ewl_box_orientation_set(EWL_BOX(d->action_box),
+ EWL_ORIENTATION_HORIZONTAL);
+ ewl_object_fill_policy_set(EWL_OBJECT(d->action_area),
+ EWL_FLAG_FILL_HFILL);
+ }
+
+ ewl_container_child_remove(EWL_CONTAINER(d->box), d->separator);
+ ewl_container_child_remove(EWL_CONTAINER(d->box), d->action_area);
+
+ /*
+ * Repack order of the widgets to match new position
+ */
+ if (pos & (EWL_POSITION_LEFT | EWL_POSITION_TOP)) {
+ ewl_container_child_prepend(EWL_CONTAINER(d->box),
+ d->separator);
+ ewl_container_child_prepend(EWL_CONTAINER(d->box),
+ d->action_area);
+ }
+ else {
+ ewl_container_child_append(EWL_CONTAINER(d->box),
+ d->separator);
+ ewl_container_child_append(EWL_CONTAINER(d->box),
+ d->action_area);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -192,11 +192,11 @@ ewl_dialog_action_position_set(Ewl_Dialog *d, Ewl_Position pos)
Ewl_Position
ewl_dialog_action_position_get(Ewl_Dialog *d)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(d, EWL_POSITION_BOTTOM);
- DCHECK_TYPE_RET(d, EWL_DIALOG_TYPE, EWL_POSITION_BOTTOM);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(d, EWL_POSITION_BOTTOM);
+ DCHECK_TYPE_RET(d, EWL_DIALOG_TYPE, EWL_POSITION_BOTTOM);
- DRETURN_INT(d->position, DLEVEL_STABLE);
+ DRETURN_INT(d->position, DLEVEL_STABLE);
}
/**
@@ -208,13 +208,13 @@ ewl_dialog_action_position_get(Ewl_Dialog *d)
void
ewl_dialog_action_fill_policy_set(Ewl_Dialog *d, unsigned int pol)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(d);
- DCHECK_TYPE(d, EWL_DIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(d);
+ DCHECK_TYPE(d, EWL_DIALOG_TYPE);
- ewl_object_fill_policy_set(EWL_OBJECT(d->action_box), pol);
+ ewl_object_fill_policy_set(EWL_OBJECT(d->action_box), pol);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -225,12 +225,12 @@ ewl_dialog_action_fill_policy_set(Ewl_Dialog *d, unsigned int pol)
unsigned int
ewl_dialog_action_fill_policy_get(Ewl_Dialog *d)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(d, EWL_POSITION_BOTTOM);
- DCHECK_TYPE_RET(d, EWL_DIALOG_TYPE, EWL_FLAG_FILL_NONE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(d, EWL_POSITION_BOTTOM);
+ DCHECK_TYPE_RET(d, EWL_DIALOG_TYPE, EWL_FLAG_FILL_NONE);
- DRETURN_INT(ewl_object_fill_policy_get(EWL_OBJECT(d->action_box)),
- DLEVEL_STABLE);
+ DRETURN_INT(ewl_object_fill_policy_get(EWL_OBJECT(d->action_box)),
+ DLEVEL_STABLE);
}
/**
@@ -242,13 +242,13 @@ ewl_dialog_action_fill_policy_get(Ewl_Dialog *d)
void
ewl_dialog_action_alignment_set(Ewl_Dialog *d, unsigned int align)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(d);
- DCHECK_TYPE(d, EWL_DIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(d);
+ DCHECK_TYPE(d, EWL_DIALOG_TYPE);
- ewl_object_alignment_set(EWL_OBJECT(d->action_box), align);
+ ewl_object_alignment_set(EWL_OBJECT(d->action_box), align);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -259,12 +259,12 @@ ewl_dialog_action_alignment_set(Ewl_Dialog *d, unsigned int align)
unsigned int
ewl_dialog_action_alignment_get(Ewl_Dialog *d)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(d, EWL_POSITION_BOTTOM);
- DCHECK_TYPE_RET(d, EWL_DIALOG_TYPE, EWL_FLAG_FILL_NONE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(d, EWL_POSITION_BOTTOM);
+ DCHECK_TYPE_RET(d, EWL_DIALOG_TYPE, EWL_FLAG_FILL_NONE);
- DRETURN_INT(ewl_object_alignment_get(EWL_OBJECT(d->action_box)),
- DLEVEL_STABLE);
+ DRETURN_INT(ewl_object_alignment_get(EWL_OBJECT(d->action_box)),
+ DLEVEL_STABLE);
}
/**
@@ -275,14 +275,14 @@ ewl_dialog_action_alignment_get(Ewl_Dialog *d)
unsigned int
ewl_dialog_has_separator_get(Ewl_Dialog *dialog)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(dialog, FALSE);
- DCHECK_TYPE_RET(dialog, EWL_DIALOG_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(dialog, FALSE);
+ DCHECK_TYPE_RET(dialog, EWL_DIALOG_TYPE, FALSE);
- if (!dialog)
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!dialog)
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- DRETURN_INT(dialog->separator != NULL, DLEVEL_STABLE);
+ DRETURN_INT(dialog->separator != NULL, DLEVEL_STABLE);
}
/**
@@ -294,34 +294,34 @@ ewl_dialog_has_separator_get(Ewl_Dialog *dialog)
void
ewl_dialog_has_separator_set(Ewl_Dialog *dialog, unsigned int has_sep)
{
- Ewl_Widget *child;
- int n;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(dialog);
- DCHECK_TYPE(dialog, EWL_DIALOG_TYPE);
-
- if (has_sep && (dialog->separator == NULL)) {
- ewl_container_child_iterate_begin(EWL_CONTAINER(EWL_DIALOG(dialog)->vbox));
- n = 0;
- child = ewl_container_child_next(EWL_CONTAINER(EWL_DIALOG(dialog)->vbox));
- while (child) {
- n++;
- child = ewl_container_child_next(EWL_CONTAINER(EWL_DIALOG(dialog)->vbox));
- }
- dialog->separator = ewl_hseparator_new();
- ewl_container_child_insert(EWL_CONTAINER(dialog->vbox),
- dialog->separator, n);
- ewl_object_fill_policy_set(EWL_OBJECT(dialog->separator),
- EWL_FLAG_FILL_SHRINK);
- ewl_widget_show(dialog->separator);
-
- } else if (!has_sep && (dialog->separator != NULL)) {
- ewl_widget_destroy(dialog->separator);
- dialog->separator = NULL;
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Widget *child;
+ int n;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(dialog);
+ DCHECK_TYPE(dialog, EWL_DIALOG_TYPE);
+
+ if (has_sep && (dialog->separator == NULL)) {
+ ewl_container_child_iterate_begin(EWL_CONTAINER(EWL_DIALOG(dialog)->vbox));
+ n = 0;
+ child = ewl_container_child_next(EWL_CONTAINER(EWL_DIALOG(dialog)->vbox));
+ while (child) {
+ n++;
+ child = ewl_container_child_next(EWL_CONTAINER(EWL_DIALOG(dialog)->vbox));
+ }
+ dialog->separator = ewl_hseparator_new();
+ ewl_container_child_insert(EWL_CONTAINER(dialog->vbox),
+ dialog->separator, n);
+ ewl_object_fill_policy_set(EWL_OBJECT(dialog->separator),
+ EWL_FLAG_FILL_SHRINK);
+ ewl_widget_show(dialog->separator);
+
+ } else if (!has_sep && (dialog->separator != NULL)) {
+ ewl_widget_destroy(dialog->separator);
+ dialog->separator = NULL;
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -334,20 +334,20 @@ ewl_dialog_has_separator_set(Ewl_Dialog *dialog, unsigned int has_sep)
void
ewl_dialog_active_area_set(Ewl_Dialog *d, Ewl_Position pos)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(d);
- DCHECK_TYPE(d, EWL_DIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(d);
+ DCHECK_TYPE(d, EWL_DIALOG_TYPE);
- d->active_area = pos;
+ d->active_area = pos;
- if (pos == d->position)
- ewl_container_redirect_set(EWL_CONTAINER(d),
- EWL_CONTAINER(d->action_box));
- else
- ewl_container_redirect_set(EWL_CONTAINER(d),
- EWL_CONTAINER(d->vbox));
+ if (pos == d->position)
+ ewl_container_redirect_set(EWL_CONTAINER(d),
+ EWL_CONTAINER(d->action_box));
+ else
+ ewl_container_redirect_set(EWL_CONTAINER(d),
+ EWL_CONTAINER(d->vbox));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -358,11 +358,11 @@ ewl_dialog_active_area_set(Ewl_Dialog *d, Ewl_Position pos)
Ewl_Position
ewl_dialog_active_area_get(Ewl_Dialog *d)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(d, EWL_POSITION_TOP);
- DCHECK_TYPE_RET(d, EWL_DIALOG_TYPE, EWL_POSITION_TOP);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(d, EWL_POSITION_TOP);
+ DCHECK_TYPE_RET(d, EWL_DIALOG_TYPE, EWL_POSITION_TOP);
- DRETURN_INT(d->active_area, DLEVEL_STABLE);
+ DRETURN_INT(d->active_area, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_dialog.h b/src/lib/ewl_dialog.h
index aae8a11..2c9eba5 100644
--- a/src/lib/ewl_dialog.h
+++ b/src/lib/ewl_dialog.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_DIALOG_H
#define EWL_DIALOG_H
@@ -49,35 +49,35 @@ typedef struct Ewl_Dialog Ewl_Dialog;
*/
struct Ewl_Dialog
{
- Ewl_Window window; /**< Inherit from a window */
+ Ewl_Window window; /**< Inherit from a window */
- Ewl_Widget *box; /**< The box for window layout */
- Ewl_Widget *vbox; /**< The box where messages are displayed */
- Ewl_Widget *action_area; /**< The cell holding the action box */
- Ewl_Widget *action_box; /**< The box where the buttons are added */
+ Ewl_Widget *box; /**< The box for window layout */
+ Ewl_Widget *vbox; /**< The box where messages are displayed */
+ Ewl_Widget *action_area; /**< The cell holding the action box */
+ Ewl_Widget *action_box; /**< The box where the buttons are added */
- Ewl_Widget *separator; /**< The separator between vbox and action_area */
+ Ewl_Widget *separator; /**< The separator between vbox and action_area */
- Ewl_Position position; /**< Position of the action_area */
- Ewl_Position active_area; /**< Which section of the dialog is active */
+ Ewl_Position position; /**< Position of the action_area */
+ Ewl_Position active_area; /**< Which section of the dialog is active */
};
-Ewl_Widget *ewl_dialog_new (void);
-int ewl_dialog_init (Ewl_Dialog *dialog);
+Ewl_Widget *ewl_dialog_new (void);
+int ewl_dialog_init (Ewl_Dialog *dialog);
-void ewl_dialog_action_position_set(Ewl_Dialog *d, Ewl_Position pos);
-Ewl_Position ewl_dialog_action_position_get(Ewl_Dialog *dialog);
-void ewl_dialog_action_fill_policy_set(Ewl_Dialog *d, unsigned int pol);
-unsigned int ewl_dialog_action_fill_policy_get(Ewl_Dialog *dialog);
-void ewl_dialog_action_alignment_set(Ewl_Dialog *d, unsigned int a);
-unsigned int ewl_dialog_action_alignment_get(Ewl_Dialog *dialog);
+void ewl_dialog_action_position_set(Ewl_Dialog *d, Ewl_Position pos);
+Ewl_Position ewl_dialog_action_position_get(Ewl_Dialog *dialog);
+void ewl_dialog_action_fill_policy_set(Ewl_Dialog *d, unsigned int pol);
+unsigned int ewl_dialog_action_fill_policy_get(Ewl_Dialog *dialog);
+void ewl_dialog_action_alignment_set(Ewl_Dialog *d, unsigned int a);
+unsigned int ewl_dialog_action_alignment_get(Ewl_Dialog *dialog);
-void ewl_dialog_active_area_set(Ewl_Dialog *d, Ewl_Position pos);
-Ewl_Position ewl_dialog_active_area_get(Ewl_Dialog *d);
+void ewl_dialog_active_area_set(Ewl_Dialog *d, Ewl_Position pos);
+Ewl_Position ewl_dialog_active_area_get(Ewl_Dialog *d);
-unsigned int ewl_dialog_has_separator_get(Ewl_Dialog *dialog);
-void ewl_dialog_has_separator_set(Ewl_Dialog *dialog,
- unsigned int has_sep);
+unsigned int ewl_dialog_has_separator_get(Ewl_Dialog *dialog);
+void ewl_dialog_has_separator_set(Ewl_Dialog *dialog,
+ unsigned int has_sep);
/**
* @}
diff --git a/src/lib/ewl_dnd.c b/src/lib/ewl_dnd.c
index 2eead2d..2edea18 100644
--- a/src/lib/ewl_dnd.c
+++ b/src/lib/ewl_dnd.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_macros.h"
#include "ewl_private.h"
@@ -36,40 +36,40 @@ static int ewl_dnd_types_encoded_contains(char *types, char *type);
int
ewl_dnd_init(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- EWL_CALLBACK_DND_POSITION = ewl_callback_type_add();
- EWL_CALLBACK_DND_ENTER = ewl_callback_type_add();
- EWL_CALLBACK_DND_LEAVE = ewl_callback_type_add();
- EWL_CALLBACK_DND_DROP = ewl_callback_type_add();
- EWL_CALLBACK_DND_DATA_RECEIVED = ewl_callback_type_add();
- EWL_CALLBACK_DND_DATA_REQUEST = ewl_callback_type_add();
-
- ewl_dnd_provided_hash = ecore_hash_new(ecore_direct_hash,
- ecore_direct_compare);
- if (!ewl_dnd_provided_hash)
- goto PROVIDED_ERROR;
-
- ewl_dnd_accepted_hash = ecore_hash_new(ecore_direct_hash,
- ecore_direct_compare);
- if (!ewl_dnd_accepted_hash)
- goto ACCEPTED_ERROR;
-
- ecore_hash_free_value_cb_set(ewl_dnd_accepted_hash, free);
- ewl_dnd_widget = NULL;
- ewl_dnd_default_cursor = NULL;
- ewl_dragging_current = 0;
- ewl_dnd_status = 1;
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
-
- /*
- * Error handlers.
- */
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ EWL_CALLBACK_DND_POSITION = ewl_callback_type_add();
+ EWL_CALLBACK_DND_ENTER = ewl_callback_type_add();
+ EWL_CALLBACK_DND_LEAVE = ewl_callback_type_add();
+ EWL_CALLBACK_DND_DROP = ewl_callback_type_add();
+ EWL_CALLBACK_DND_DATA_RECEIVED = ewl_callback_type_add();
+ EWL_CALLBACK_DND_DATA_REQUEST = ewl_callback_type_add();
+
+ ewl_dnd_provided_hash = ecore_hash_new(ecore_direct_hash,
+ ecore_direct_compare);
+ if (!ewl_dnd_provided_hash)
+ goto PROVIDED_ERROR;
+
+ ewl_dnd_accepted_hash = ecore_hash_new(ecore_direct_hash,
+ ecore_direct_compare);
+ if (!ewl_dnd_accepted_hash)
+ goto ACCEPTED_ERROR;
+
+ ecore_hash_free_value_cb_set(ewl_dnd_accepted_hash, free);
+ ewl_dnd_widget = NULL;
+ ewl_dnd_default_cursor = NULL;
+ ewl_dragging_current = 0;
+ ewl_dnd_status = 1;
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+
+ /*
+ * Error handlers.
+ */
ACCEPTED_ERROR:
- IF_FREE_HASH(ewl_dnd_provided_hash);
+ IF_FREE_HASH(ewl_dnd_provided_hash);
PROVIDED_ERROR:
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
}
/**
@@ -80,12 +80,12 @@ PROVIDED_ERROR:
void
ewl_dnd_shutdown(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- IF_FREE_HASH(ewl_dnd_provided_hash);
- IF_FREE_HASH(ewl_dnd_accepted_hash);
+ IF_FREE_HASH(ewl_dnd_provided_hash);
+ IF_FREE_HASH(ewl_dnd_accepted_hash);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -97,31 +97,31 @@ ewl_dnd_shutdown(void)
void
ewl_dnd_provided_types_set(Ewl_Widget *w, const char **types)
{
- char *type;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- type = ecore_hash_get(ewl_dnd_provided_hash, w);
- IF_FREE(type);
-
- if (types && *types) {
- type = ewl_dnd_types_encode(types);
- ecore_hash_set(ewl_dnd_provided_hash, w, type);
- ewl_object_flags_add(EWL_OBJECT(w),
- EWL_FLAG_PROPERTY_DND_SOURCE,
- EWL_FLAGS_PROPERTY_MASK);
- }
- else {
- type = ecore_hash_remove(ewl_dnd_provided_hash, w);
- IF_FREE(type);
- ewl_object_flags_remove(EWL_OBJECT(w),
- EWL_FLAG_PROPERTY_DND_SOURCE,
- EWL_FLAGS_PROPERTY_MASK);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ char *type;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ type = ecore_hash_get(ewl_dnd_provided_hash, w);
+ IF_FREE(type);
+
+ if (types && *types) {
+ type = ewl_dnd_types_encode(types);
+ ecore_hash_set(ewl_dnd_provided_hash, w, type);
+ ewl_object_flags_add(EWL_OBJECT(w),
+ EWL_FLAG_PROPERTY_DND_SOURCE,
+ EWL_FLAGS_PROPERTY_MASK);
+ }
+ else {
+ type = ecore_hash_remove(ewl_dnd_provided_hash, w);
+ IF_FREE(type);
+ ewl_object_flags_remove(EWL_OBJECT(w),
+ EWL_FLAG_PROPERTY_DND_SOURCE,
+ EWL_FLAGS_PROPERTY_MASK);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -133,17 +133,17 @@ ewl_dnd_provided_types_set(Ewl_Widget *w, const char **types)
int
ewl_dnd_provided_types_contains(Ewl_Widget *w, char *type)
{
- char *types;
- int ret = FALSE;
+ char *types;
+ int ret = FALSE;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, FALSE);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, FALSE);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, FALSE);
- types = ecore_hash_get(ewl_dnd_provided_hash, w);
- if (types) ret = ewl_dnd_types_encoded_contains(types, type);
+ types = ecore_hash_get(ewl_dnd_provided_hash, w);
+ if (types) ret = ewl_dnd_types_encoded_contains(types, type);
- DRETURN_INT(ret, DLEVEL_STABLE);
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
/**
@@ -154,15 +154,15 @@ ewl_dnd_provided_types_contains(Ewl_Widget *w, char *type)
char **
ewl_dnd_provided_types_get(Ewl_Widget *w)
{
- const char *types;
+ const char *types;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, NULL);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, NULL);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
- types = ecore_hash_get(ewl_dnd_provided_hash, w);
+ types = ecore_hash_get(ewl_dnd_provided_hash, w);
- DRETURN_PTR(ewl_dnd_types_decode(types), DLEVEL_STABLE);
+ DRETURN_PTR(ewl_dnd_types_decode(types), DLEVEL_STABLE);
}
/**
@@ -174,43 +174,43 @@ ewl_dnd_provided_types_get(Ewl_Widget *w)
void
ewl_dnd_accepted_types_set(Ewl_Widget *w, const char **types)
{
- char *type;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- type = ecore_hash_remove(ewl_dnd_accepted_hash, w);
- IF_FREE(type);
-
- if (types && *types) {
- type = ewl_dnd_types_encode(types);
- ecore_hash_set(ewl_dnd_accepted_hash, w, type);
- ewl_object_flags_add(EWL_OBJECT(w),
- EWL_FLAG_PROPERTY_DND_TARGET,
- EWL_FLAGS_PROPERTY_MASK);
-
- if (REALIZED(w) && REVEALED(w)) {
- Ewl_Embed *emb;
-
- emb = ewl_embed_widget_find(w);
- if (emb) ewl_embed_dnd_aware_set(emb);
- }
- }
- else {
- ewl_object_flags_remove(EWL_OBJECT(w),
- EWL_FLAG_PROPERTY_DND_TARGET,
- EWL_FLAGS_PROPERTY_MASK);
-
- if (REALIZED(w) && REVEALED(w)) {
- Ewl_Embed *emb;
-
- emb = ewl_embed_widget_find(w);
- if (emb) ewl_embed_dnd_aware_remove(emb);
- }
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ char *type;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ type = ecore_hash_remove(ewl_dnd_accepted_hash, w);
+ IF_FREE(type);
+
+ if (types && *types) {
+ type = ewl_dnd_types_encode(types);
+ ecore_hash_set(ewl_dnd_accepted_hash, w, type);
+ ewl_object_flags_add(EWL_OBJECT(w),
+ EWL_FLAG_PROPERTY_DND_TARGET,
+ EWL_FLAGS_PROPERTY_MASK);
+
+ if (REALIZED(w) && REVEALED(w)) {
+ Ewl_Embed *emb;
+
+ emb = ewl_embed_widget_find(w);
+ if (emb) ewl_embed_dnd_aware_set(emb);
+ }
+ }
+ else {
+ ewl_object_flags_remove(EWL_OBJECT(w),
+ EWL_FLAG_PROPERTY_DND_TARGET,
+ EWL_FLAGS_PROPERTY_MASK);
+
+ if (REALIZED(w) && REVEALED(w)) {
+ Ewl_Embed *emb;
+
+ emb = ewl_embed_widget_find(w);
+ if (emb) ewl_embed_dnd_aware_remove(emb);
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -222,17 +222,17 @@ ewl_dnd_accepted_types_set(Ewl_Widget *w, const char **types)
int
ewl_dnd_accepted_types_contains(Ewl_Widget *w, char *type)
{
- char *types;
- int ret = FALSE;
+ char *types;
+ int ret = FALSE;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, FALSE);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, FALSE);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, FALSE);
- types = ecore_hash_get(ewl_dnd_accepted_hash, w);
- if (types) ret = ewl_dnd_types_encoded_contains(types, type);
+ types = ecore_hash_get(ewl_dnd_accepted_hash, w);
+ if (types) ret = ewl_dnd_types_encoded_contains(types, type);
- DRETURN_INT(ret, DLEVEL_STABLE);
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
/**
@@ -243,15 +243,15 @@ ewl_dnd_accepted_types_contains(Ewl_Widget *w, char *type)
const char **
ewl_dnd_accepted_types_get(Ewl_Widget *w)
{
- const char *types;
+ const char *types;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, NULL);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, NULL);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
- types = ecore_hash_get(ewl_dnd_provided_hash, w);
+ types = ecore_hash_get(ewl_dnd_provided_hash, w);
- DRETURN_PTR(ewl_dnd_types_decode(types), DLEVEL_STABLE);
+ DRETURN_PTR(ewl_dnd_types_decode(types), DLEVEL_STABLE);
}
@@ -263,57 +263,57 @@ ewl_dnd_accepted_types_get(Ewl_Widget *w)
void
ewl_dnd_drag_start(Ewl_Widget *w)
{
- unsigned int i;
- char **types;
- Ewl_Embed *emb;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- if (!ewl_dnd_status || ewl_dragging_current)
- DRETURN(DLEVEL_STABLE);
-
- emb = ewl_embed_widget_find(w);
- if (!emb) DRETURN(DLEVEL_STABLE);
-
- ewl_dragging_current = 1;
- ewl_dnd_widget = w;
-
- types = ewl_dnd_provided_types_get(w);
- /*
- * Count the number of mime types set on the widget.
- */
- for (i = 0; types && types[i]; i++)
- ;
-
- /*
- * Flag the provided DND types on the embed and begin the DND process.
- */
- ewl_engine_embed_dnd_drag_types_set(emb, types, i);
- ewl_engine_embed_dnd_drag_start(emb);
-
- /*
- * Create a fallback cursor to display during DND operations.
- */
- if (!ewl_dnd_default_cursor) {
- ewl_dnd_default_cursor = ewl_cursor_new();
-
- /*
- * Add a theme point as these tend to be a specialized class of cursors.
- */
- ewl_widget_appearance_set(ewl_dnd_default_cursor, "dndcursor");
- ewl_widget_show(ewl_dnd_default_cursor);
- }
-
- /*
- * FIXME: Display the default cursor for now. Needs to check for a
- * custom DND cursor from the widget.
- */
- ewl_attach_mouse_argb_cursor_set(emb, ewl_dnd_default_cursor);
- ewl_embed_mouse_cursor_set(EWL_WIDGET(emb));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ unsigned int i;
+ char **types;
+ Ewl_Embed *emb;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ if (!ewl_dnd_status || ewl_dragging_current)
+ DRETURN(DLEVEL_STABLE);
+
+ emb = ewl_embed_widget_find(w);
+ if (!emb) DRETURN(DLEVEL_STABLE);
+
+ ewl_dragging_current = 1;
+ ewl_dnd_widget = w;
+
+ types = ewl_dnd_provided_types_get(w);
+ /*
+ * Count the number of mime types set on the widget.
+ */
+ for (i = 0; types && types[i]; i++)
+ ;
+
+ /*
+ * Flag the provided DND types on the embed and begin the DND process.
+ */
+ ewl_engine_embed_dnd_drag_types_set(emb, types, i);
+ ewl_engine_embed_dnd_drag_start(emb);
+
+ /*
+ * Create a fallback cursor to display during DND operations.
+ */
+ if (!ewl_dnd_default_cursor) {
+ ewl_dnd_default_cursor = ewl_cursor_new();
+
+ /*
+ * Add a theme point as these tend to be a specialized class of cursors.
+ */
+ ewl_widget_appearance_set(ewl_dnd_default_cursor, "dndcursor");
+ ewl_widget_show(ewl_dnd_default_cursor);
+ }
+
+ /*
+ * FIXME: Display the default cursor for now. Needs to check for a
+ * custom DND cursor from the widget.
+ */
+ ewl_attach_mouse_argb_cursor_set(emb, ewl_dnd_default_cursor);
+ ewl_embed_mouse_cursor_set(EWL_WIDGET(emb));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -324,25 +324,25 @@ ewl_dnd_drag_start(Ewl_Widget *w)
void
ewl_dnd_drag_drop(Ewl_Widget *w)
{
- Ewl_Embed *emb;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_dragging_current = 0;
- ewl_dnd_widget = NULL;
+ ewl_dragging_current = 0;
+ ewl_dnd_widget = NULL;
- emb = ewl_embed_widget_find(w);
- if (!emb) DRETURN(DLEVEL_STABLE);
+ emb = ewl_embed_widget_find(w);
+ if (!emb) DRETURN(DLEVEL_STABLE);
- /*
- * FIXME: Reset the cursor here.
- */
- // ewl_embed_mouse_cursor_set(EWL_WIDGET(emb));
- ewl_engine_embed_dnd_drag_drop(emb);
+ /*
+ * FIXME: Reset the cursor here.
+ */
+ // ewl_embed_mouse_cursor_set(EWL_WIDGET(emb));
+ ewl_engine_embed_dnd_drag_drop(emb);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -352,11 +352,11 @@ ewl_dnd_drag_drop(Ewl_Widget *w)
void
ewl_dnd_disable(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ewl_dnd_status = 0;
+ ewl_dnd_status = 0;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -366,11 +366,11 @@ ewl_dnd_disable(void)
void
ewl_dnd_enable(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ewl_dnd_status = 1;
+ ewl_dnd_status = 1;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -380,9 +380,9 @@ ewl_dnd_enable(void)
int
ewl_dnd_status_get(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- DRETURN_INT(ewl_dnd_status, DLEVEL_STABLE);
+ DRETURN_INT(ewl_dnd_status, DLEVEL_STABLE);
}
/**
@@ -392,9 +392,9 @@ ewl_dnd_status_get(void)
Ewl_Widget *
ewl_dnd_drag_widget_get(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- DRETURN_PTR(ewl_dnd_widget, DLEVEL_STABLE);
+ DRETURN_PTR(ewl_dnd_widget, DLEVEL_STABLE);
}
/**
@@ -404,11 +404,11 @@ ewl_dnd_drag_widget_get(void)
void
ewl_dnd_drag_widget_clear(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ewl_dnd_widget = NULL;
+ ewl_dnd_widget = NULL;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/*
@@ -417,16 +417,16 @@ ewl_dnd_drag_widget_clear(void)
static int
ewl_dnd_types_encoded_contains(char *types, char *type)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- while (*types) {
- if (!(strcmp(types, type)))
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ while (*types) {
+ if (!(strcmp(types, type)))
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- types += strlen(types) + 1;
- }
+ types += strlen(types) + 1;
+ }
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
}
/*
@@ -436,29 +436,29 @@ ewl_dnd_types_encoded_contains(char *types, char *type)
static char *
ewl_dnd_types_encode(const char **types)
{
- char *type, *tmptype;
- int count, i = 0;
- int len = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- /*
- * Determine the length of all types.
- */
- for (tmptype = (char *)types[0]; tmptype; tmptype = (char *)types[i]) {
- len += strlen(tmptype) + 1;
- i++;
- }
-
- type = tmptype = NEW(char, len + 1);
- count = i;
- for (i = 0; i < count; i++) {
- tmptype = ewl_dnd_type_stpcpy(tmptype, types[i]);
- tmptype++;
- }
- *tmptype = '\0';
-
- DRETURN_PTR(type, DLEVEL_STABLE);
+ char *type, *tmptype;
+ int count, i = 0;
+ int len = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ /*
+ * Determine the length of all types.
+ */
+ for (tmptype = (char *)types[0]; tmptype; tmptype = (char *)types[i]) {
+ len += strlen(tmptype) + 1;
+ i++;
+ }
+
+ type = tmptype = NEW(char, len + 1);
+ count = i;
+ for (i = 0; i < count; i++) {
+ tmptype = ewl_dnd_type_stpcpy(tmptype, types[i]);
+ tmptype++;
+ }
+ *tmptype = '\0';
+
+ DRETURN_PTR(type, DLEVEL_STABLE);
}
/*
@@ -467,30 +467,30 @@ ewl_dnd_types_encode(const char **types)
static char **
ewl_dnd_types_decode(const char *types)
{
- int count;
- const char *tmp;
- char **list;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- if (!types)
- DRETURN_PTR(types, DLEVEL_STABLE);
-
- /*
- * Short lists so iterate over multiple times rather than incur
- * allocation overhead.
- */
- for (tmp = types, count = 0; *tmp; tmp++, count++) {
- while (*tmp) tmp++;
- }
-
- list = NEW(char *, count + 1);
- for (tmp = types, count = 0; *tmp; tmp++, count++) {
- list[count] = strdup(tmp);
- while (*tmp) tmp++;
- }
-
- DRETURN_PTR(list, DLEVEL_STABLE);
+ int count;
+ const char *tmp;
+ char **list;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ if (!types)
+ DRETURN_PTR(types, DLEVEL_STABLE);
+
+ /*
+ * Short lists so iterate over multiple times rather than incur
+ * allocation overhead.
+ */
+ for (tmp = types, count = 0; *tmp; tmp++, count++) {
+ while (*tmp) tmp++;
+ }
+
+ list = NEW(char *, count + 1);
+ for (tmp = types, count = 0; *tmp; tmp++, count++) {
+ list[count] = strdup(tmp);
+ while (*tmp) tmp++;
+ }
+
+ DRETURN_PTR(list, DLEVEL_STABLE);
}
/*
@@ -501,16 +501,16 @@ ewl_dnd_types_decode(const char *types)
static char *
ewl_dnd_type_stpcpy(char *dst, const char *src)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(dst, dst);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(dst, dst);
- while (*src) {
- *dst = *src;
- dst++;
- src++;
- }
- *dst = '\0';
+ while (*src) {
+ *dst = *src;
+ dst++;
+ src++;
+ }
+ *dst = '\0';
- DRETURN_PTR(dst, DLEVEL_STABLE);
+ DRETURN_PTR(dst, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_dnd.h b/src/lib/ewl_dnd.h
index 1fcfbc0..01e922b 100644
--- a/src/lib/ewl_dnd.h
+++ b/src/lib/ewl_dnd.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_DND_H
#define EWL_DND_H
@@ -15,26 +15,26 @@ extern unsigned int EWL_CALLBACK_DND_DROP;
extern unsigned int EWL_CALLBACK_DND_DATA_RECEIVED;
extern unsigned int EWL_CALLBACK_DND_DATA_REQUEST;
-int ewl_dnd_init(void);
-void ewl_dnd_shutdown(void);
+int ewl_dnd_init(void);
+void ewl_dnd_shutdown(void);
-void ewl_dnd_drag_start(Ewl_Widget *w);
-void ewl_dnd_drag_drop(Ewl_Widget *w);
-void ewl_dnd_drag_widget_clear(void);
-Ewl_Widget *ewl_dnd_drag_widget_get(void);
+void ewl_dnd_drag_start(Ewl_Widget *w);
+void ewl_dnd_drag_drop(Ewl_Widget *w);
+void ewl_dnd_drag_widget_clear(void);
+Ewl_Widget *ewl_dnd_drag_widget_get(void);
-int ewl_dnd_status_get(void);
+int ewl_dnd_status_get(void);
-void ewl_dnd_provided_types_set(Ewl_Widget *w, const char **types);
-int ewl_dnd_provided_types_contains(Ewl_Widget *w, char *type);
-char **ewl_dnd_provided_types_get(Ewl_Widget *w);
+void ewl_dnd_provided_types_set(Ewl_Widget *w, const char **types);
+int ewl_dnd_provided_types_contains(Ewl_Widget *w, char *type);
+char **ewl_dnd_provided_types_get(Ewl_Widget *w);
-void ewl_dnd_accepted_types_set(Ewl_Widget *w, const char **types);
-int ewl_dnd_accepted_types_contains(Ewl_Widget *w, char *type);
-const char **ewl_dnd_accepted_types_get(Ewl_Widget *w);
+void ewl_dnd_accepted_types_set(Ewl_Widget *w, const char **types);
+int ewl_dnd_accepted_types_contains(Ewl_Widget *w, char *type);
+const char **ewl_dnd_accepted_types_get(Ewl_Widget *w);
-void ewl_dnd_disable(void);
-void ewl_dnd_enable(void);
+void ewl_dnd_disable(void);
+void ewl_dnd_enable(void);
/**
* @}
diff --git a/src/lib/ewl_embed.c b/src/lib/ewl_embed.c
index 4769778..7017d0b 100644
--- a/src/lib/ewl_embed.c
+++ b/src/lib/ewl_embed.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_private.h"
#include "ewl_macros.h"
@@ -16,39 +16,39 @@ static Ewl_Embed *ewl_embed_active_embed = NULL;
static void ewl_embed_smart_cb_del(Evas_Object *obj);
static void ewl_embed_smart_cb_move(Evas_Object *obj, Evas_Coord x,
- Evas_Coord y);
+ Evas_Coord y);
static void ewl_embed_smart_cb_resize(Evas_Object *obj, Evas_Coord w,
- Evas_Coord h);
+ Evas_Coord h);
static void ewl_embed_smart_cb_show(Evas_Object *obj);
static void ewl_embed_smart_cb_hide(Evas_Object *obj);
static void ewl_embed_smart_cb_clip_set(Evas_Object *obj, Evas_Object *clip);
static void ewl_embed_smart_cb_clip_unset(Evas_Object *obj);
static void ewl_embed_tab_order_change(Ewl_Embed *e,
- void *(*change)(Ecore_DList *list),
- void *(*cycle)(Ecore_DList *list));
+ void *(*change)(Ecore_DList *list),
+ void *(*cycle)(Ecore_DList *list));
/*
* Catch mouse events processed through the evas
*/
static void ewl_embed_evas_cb_mouse_out(void *data, Evas *e, Evas_Object *obj,
- void *event_info);
+ void *event_info);
static void ewl_embed_evas_cb_mouse_down(void *data, Evas *e, Evas_Object *obj,
- void *event_info);
+ void *event_info);
static void ewl_embed_evas_cb_mouse_up(void *data, Evas *e, Evas_Object *obj,
- void *event_info);
+ void *event_info);
static void ewl_embed_evas_cb_mouse_move(void *data, Evas *e, Evas_Object *obj,
- void *event_info);
+ void *event_info);
static void ewl_embed_evas_cb_mouse_wheel(void *data, Evas *e, Evas_Object *obj,
- void *event_info);
+ void *event_info);
/*
* Catch key events processed through the evas
*/
static void ewl_embed_evas_cb_key_down(void *data, Evas *e, Evas_Object *obj,
- void *event_info);
+ void *event_info);
static void ewl_embed_evas_cb_key_up(void *data, Evas *e, Evas_Object *obj,
- void *event_info);
+ void *event_info);
/**
* @return Returns a new embed on success, or NULL on failure.
@@ -57,20 +57,20 @@ static void ewl_embed_evas_cb_key_up(void *data, Evas *e, Evas_Object *obj,
Ewl_Widget *
ewl_embed_new(void)
{
- Ewl_Embed *w;
+ Ewl_Embed *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- w = NEW(Ewl_Embed, 1);
- if (!w)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ w = NEW(Ewl_Embed, 1);
+ if (!w)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_embed_init(w)) {
- ewl_widget_destroy(EWL_WIDGET(w));
- w = NULL;
- }
+ if (!ewl_embed_init(w)) {
+ ewl_widget_destroy(EWL_WIDGET(w));
+ w = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(w), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(w), DLEVEL_STABLE);
}
/**
@@ -83,48 +83,48 @@ ewl_embed_new(void)
int
ewl_embed_init(Ewl_Embed *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, FALSE);
- /*
- * Initialize the fields of the inherited container class
- */
- if (!ewl_cell_init(EWL_CELL(w)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ /*
+ * Initialize the fields of the inherited container class
+ */
+ if (!ewl_cell_init(EWL_CELL(w)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_appearance_set(EWL_WIDGET(w), EWL_EMBED_TYPE);
- ewl_widget_inherit(EWL_WIDGET(w), EWL_EMBED_TYPE);
+ ewl_widget_appearance_set(EWL_WIDGET(w), EWL_EMBED_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(w), EWL_EMBED_TYPE);
- if (!ewl_embed_engine_name_set(w, ewl_config_string_get(ewl_config,
- EWL_CONFIG_ENGINE_NAME)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_embed_engine_name_set(w, ewl_config_string_get(ewl_config,
+ EWL_CONFIG_ENGINE_NAME)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
- ewl_object_toplevel_set(EWL_OBJECT(w), EWL_FLAG_PROPERTY_TOPLEVEL);
-
- /* remove the notify flags set by the cell */
- ewl_container_callback_nonotify(EWL_CONTAINER(w),
- EWL_CALLBACK_FOCUS_IN);
- ewl_container_callback_nonotify(EWL_CONTAINER(w),
- EWL_CALLBACK_FOCUS_OUT);
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
+ ewl_object_toplevel_set(EWL_OBJECT(w), EWL_FLAG_PROPERTY_TOPLEVEL);
+
+ /* remove the notify flags set by the cell */
+ ewl_container_callback_nonotify(EWL_CONTAINER(w),
+ EWL_CALLBACK_FOCUS_IN);
+ ewl_container_callback_nonotify(EWL_CONTAINER(w),
+ EWL_CALLBACK_FOCUS_OUT);
- ewl_callback_append(EWL_WIDGET(w), EWL_CALLBACK_REALIZE,
- ewl_embed_cb_realize, NULL);
- ewl_callback_append(EWL_WIDGET(w), EWL_CALLBACK_UNREALIZE,
- ewl_embed_cb_unrealize, NULL);
- ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_DESTROY,
- ewl_embed_cb_destroy, NULL);
- ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_CONFIGURE,
- ewl_embed_cb_configure, NULL);
- ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_FOCUS_OUT,
- ewl_embed_cb_focus_out, NULL);
+ ewl_callback_append(EWL_WIDGET(w), EWL_CALLBACK_REALIZE,
+ ewl_embed_cb_realize, NULL);
+ ewl_callback_append(EWL_WIDGET(w), EWL_CALLBACK_UNREALIZE,
+ ewl_embed_cb_unrealize, NULL);
+ ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_DESTROY,
+ ewl_embed_cb_destroy, NULL);
+ ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_CONFIGURE,
+ ewl_embed_cb_configure, NULL);
+ ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_FOCUS_OUT,
+ ewl_embed_cb_focus_out, NULL);
- ecore_list_append(ewl_embed_list, w);
+ ecore_list_append(ewl_embed_list, w);
- w->tab_order = ecore_dlist_new();
- w->obj_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare);
+ w->tab_order = ecore_dlist_new();
+ w->obj_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -136,32 +136,32 @@ ewl_embed_init(Ewl_Embed *w)
int
ewl_embed_engine_name_set(Ewl_Embed *embed, const char *engine)
{
- int realize = FALSE;
+ int realize = FALSE;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(embed, FALSE);
- DCHECK_PARAM_PTR_RET(engine, FALSE);
- DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(embed, FALSE);
+ DCHECK_PARAM_PTR_RET(engine, FALSE);
+ DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, FALSE);
- if (REALIZED(embed)) {
- ewl_widget_unrealize(EWL_WIDGET(embed));
- realize = TRUE;
- }
+ if (REALIZED(embed)) {
+ ewl_widget_unrealize(EWL_WIDGET(embed));
+ realize = TRUE;
+ }
- IF_RELEASE(embed->engine_name);
- embed->engine_name = ecore_string_instance(engine);
+ IF_RELEASE(embed->engine_name);
+ embed->engine_name = ecore_string_instance(engine);
- embed->engine = ewl_engine_new(engine, NULL, NULL);
- if (!embed->engine)
- {
- DERROR("Error creating engine ...\n");
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
+ embed->engine = ewl_engine_new(engine, NULL, NULL);
+ if (!embed->engine)
+ {
+ DERROR("Error creating engine ...\n");
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
- if (realize)
- ewl_widget_realize(EWL_WIDGET(embed));
+ if (realize)
+ ewl_widget_realize(EWL_WIDGET(embed));
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -172,11 +172,11 @@ ewl_embed_engine_name_set(Ewl_Embed *embed, const char *engine)
const char *
ewl_embed_engine_name_get(Ewl_Embed *embed)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(embed, NULL);
- DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(embed, NULL);
+ DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, NULL);
- DRETURN_PTR(embed->engine_name, DLEVEL_STABLE);
+ DRETURN_PTR(embed->engine_name, DLEVEL_STABLE);
}
/**
@@ -186,14 +186,14 @@ ewl_embed_engine_name_get(Ewl_Embed *embed)
void
ewl_embed_shutdown(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- if (embedded_smart) {
- evas_smart_free(embedded_smart);
- embedded_smart = NULL;
- }
+ if (embedded_smart) {
+ evas_smart_free(embedded_smart);
+ embedded_smart = NULL;
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -209,51 +209,51 @@ ewl_embed_shutdown(void)
void *
ewl_embed_canvas_set(Ewl_Embed *emb, void *canvas, Ewl_Embed_Window *canvas_window)
{
- Ecore_List *paths;
- char *font_path;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(emb, NULL);
- DCHECK_PARAM_PTR_RET(canvas, NULL);
- DCHECK_TYPE_RET(emb, EWL_EMBED_TYPE, NULL);
-
- emb->canvas = canvas;
- emb->canvas_window = canvas_window;
-
- if (!embedded_smart) {
- static const Evas_Smart_Class sc = {
- "EWL Embedded Smart Object",
- EVAS_SMART_CLASS_VERSION,
- NULL,
- ewl_embed_smart_cb_del,
- ewl_embed_smart_cb_move,
- ewl_embed_smart_cb_resize,
- ewl_embed_smart_cb_show,
- ewl_embed_smart_cb_hide,
- NULL,
- ewl_embed_smart_cb_clip_set,
- ewl_embed_smart_cb_clip_unset,
- NULL
- };
- embedded_smart = evas_smart_class_new(&sc);
- }
-
- if (emb->smart) {
- ewl_canvas_object_destroy(emb->smart);
- emb->smart = NULL;
- }
-
- emb->smart = evas_object_smart_add(emb->canvas, embedded_smart);
- evas_object_smart_data_set(emb->smart, emb);
-
- if (VISIBLE(emb))
- ewl_realize_request(EWL_WIDGET(emb));
-
- paths = ewl_theme_font_path_get();
- ecore_list_first_goto(paths);
- while ((font_path = ecore_list_next(paths)))
- evas_font_path_append(canvas, font_path);
-
- DRETURN_PTR(emb->smart, DLEVEL_STABLE);
+ Ecore_List *paths;
+ char *font_path;
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(emb, NULL);
+ DCHECK_PARAM_PTR_RET(canvas, NULL);
+ DCHECK_TYPE_RET(emb, EWL_EMBED_TYPE, NULL);
+
+ emb->canvas = canvas;
+ emb->canvas_window = canvas_window;
+
+ if (!embedded_smart) {
+ static const Evas_Smart_Class sc = {
+ "EWL Embedded Smart Object",
+ EVAS_SMART_CLASS_VERSION,
+ NULL,
+ ewl_embed_smart_cb_del,
+ ewl_embed_smart_cb_move,
+ ewl_embed_smart_cb_resize,
+ ewl_embed_smart_cb_show,
+ ewl_embed_smart_cb_hide,
+ NULL,
+ ewl_embed_smart_cb_clip_set,
+ ewl_embed_smart_cb_clip_unset,
+ NULL
+ };
+ embedded_smart = evas_smart_class_new(&sc);
+ }
+
+ if (emb->smart) {
+ ewl_canvas_object_destroy(emb->smart);
+ emb->smart = NULL;
+ }
+
+ emb->smart = evas_object_smart_add(emb->canvas, embedded_smart);
+ evas_object_smart_data_set(emb->smart, emb);
+
+ if (VISIBLE(emb))
+ ewl_realize_request(EWL_WIDGET(emb));
+
+ paths = ewl_theme_font_path_get();
+ ecore_list_first_goto(paths);
+ while ((font_path = ecore_list_next(paths)))
+ evas_font_path_append(canvas, font_path);
+
+ DRETURN_PTR(emb->smart, DLEVEL_STABLE);
}
/**
@@ -265,15 +265,15 @@ ewl_embed_canvas_set(Ewl_Embed *emb, void *canvas, Ewl_Embed_Window *canvas_wind
void
ewl_embed_focus_set(Ewl_Embed *embed, int f)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- embed->focus = f;
- if (embed->smart)
- evas_object_focus_set(embed->smart, f);
+ embed->focus = f;
+ if (embed->smart)
+ evas_object_focus_set(embed->smart, f);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -284,11 +284,11 @@ ewl_embed_focus_set(Ewl_Embed *embed, int f)
int
ewl_embed_focus_get(Ewl_Embed *embed)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(embed, FALSE);
- DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(embed, FALSE);
+ DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, FALSE);
- DRETURN_INT(embed->focus, DLEVEL_STABLE);
+ DRETURN_INT(embed->focus, DLEVEL_STABLE);
}
/**
@@ -300,58 +300,58 @@ ewl_embed_focus_get(Ewl_Embed *embed)
void
ewl_embed_active_set(Ewl_Embed *embed, unsigned int act)
{
- Ewl_Embed *e;
+ Ewl_Embed *e;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- /* return if we're seting active and we're already the active embed */
- if (act && (embed == ewl_embed_active_embed))
- DRETURN(DLEVEL_STABLE);
+ /* return if we're seting active and we're already the active embed */
+ if (act && (embed == ewl_embed_active_embed))
+ DRETURN(DLEVEL_STABLE);
- if (!act)
- {
- /* if you said false and we aren't actually the active embed
- * just exit */
- if (embed != ewl_embed_active_embed)
- DRETURN(DLEVEL_STABLE);
+ if (!act)
+ {
+ /* if you said false and we aren't actually the active embed
+ * just exit */
+ if (embed != ewl_embed_active_embed)
+ DRETURN(DLEVEL_STABLE);
- e = embed;
- ewl_embed_active_embed = NULL;
- ewl_embed_focus_set(embed, FALSE);
- }
- else
- {
- e = ewl_embed_active_embed;
- ewl_embed_active_embed = embed;
- ewl_embed_focus_set(embed, TRUE);
- }
+ e = embed;
+ ewl_embed_active_embed = NULL;
+ ewl_embed_focus_set(embed, FALSE);
+ }
+ else
+ {
+ e = ewl_embed_active_embed;
+ ewl_embed_active_embed = embed;
+ ewl_embed_focus_set(embed, TRUE);
+ }
- if (e && e->last.clicked)
- {
- Ewl_Widget *temp;
+ if (e && e->last.clicked)
+ {
+ Ewl_Widget *temp;
- ewl_object_state_remove(EWL_OBJECT(e->last.clicked),
- EWL_FLAG_STATE_FOCUSED);
- ewl_object_state_remove(EWL_OBJECT(e->last.clicked),
- EWL_FLAG_STATE_PRESSED);
+ ewl_object_state_remove(EWL_OBJECT(e->last.clicked),
+ EWL_FLAG_STATE_FOCUSED);
+ ewl_object_state_remove(EWL_OBJECT(e->last.clicked),
+ EWL_FLAG_STATE_PRESSED);
- ewl_callback_call(e->last.clicked, EWL_CALLBACK_FOCUS_OUT);
+ ewl_callback_call(e->last.clicked, EWL_CALLBACK_FOCUS_OUT);
- /* Clean the last.clicked up recursively */
- temp = e->last.clicked;
- while (temp) {
- if (!DISABLED(temp))
- ewl_object_state_remove(EWL_OBJECT(temp),
- EWL_FLAG_STATE_PRESSED);
- temp = temp->parent;
- }
+ /* Clean the last.clicked up recursively */
+ temp = e->last.clicked;
+ while (temp) {
+ if (!DISABLED(temp))
+ ewl_object_state_remove(EWL_OBJECT(temp),
+ EWL_FLAG_STATE_PRESSED);
+ temp = temp->parent;
+ }
- e->last.clicked = NULL;
- }
+ e->last.clicked = NULL;
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -361,9 +361,9 @@ ewl_embed_active_set(Ewl_Embed *embed, unsigned int act)
Ewl_Embed *
ewl_embed_active_embed_get(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- DRETURN_PTR(ewl_embed_active_embed, DLEVEL_STABLE);
+ DRETURN_PTR(ewl_embed_active_embed, DLEVEL_STABLE);
}
/**
@@ -381,12 +381,12 @@ ewl_embed_active_embed_get(void)
void
ewl_embed_last_mouse_position_get(int *x, int *y)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- if (x) *x = ewl_embed_last_mouse_x;
- if (y) *y = ewl_embed_last_mouse_y;
+ if (x) *x = ewl_embed_last_mouse_x;
+ if (y) *y = ewl_embed_last_mouse_y;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -398,73 +398,73 @@ ewl_embed_last_mouse_position_get(int *x, int *y)
*/
void
ewl_embed_key_down_feed(Ewl_Embed *embed, const char *keyname,
- unsigned int mods)
-{
- Ewl_Widget *temp;
- Ewl_Event_Key_Down ev;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_PARAM_PTR(keyname);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
-
- /*
- * check if this is a focus change key press and we are not ignoring
- * focus change events
- */
- /* FIXME This "Tab" should probably be made a config variable */
- if ((!(embed->last.focused
- && ewl_widget_ignore_focus_change_get(embed->last.focused)))
- && (!strcmp(keyname, "Tab")))
- {
- if (mods & EWL_KEY_MODIFIER_SHIFT)
- ewl_embed_tab_order_previous(embed);
- else
- ewl_embed_tab_order_next(embed);
-
- DRETURN(DLEVEL_STABLE);
- }
-
- /*
- * setup the event struct
- */
- ev.base.modifiers = mods;
- ev.base.keyname = strdup(keyname);
-
- /*
- * If a widget has been selected then we send the keystroke to the
- * appropriate widget.
- */
- if (!embed->last.focused) {
- if (embed->last.clicked)
- ewl_embed_focused_widget_set(embed,
- embed->last.clicked);
- else
- {
- ewl_embed_focused_widget_set(embed,
- ecore_dlist_first_goto(embed->tab_order));
-
- if (!embed->last.focused)
- ewl_embed_focused_widget_set(embed,
- EWL_WIDGET(embed));
- }
- }
-
- /*
- * Dispatcher of key down events, these get sent to the last widget
- * selected, and every parent above it.
- */
- temp = embed->last.focused;
- while (temp) {
- if (!DISABLED(temp))
- ewl_callback_call_with_event_data(temp,
- EWL_CALLBACK_KEY_DOWN, &ev);
- temp = temp->parent;
- }
-
- FREE(ev.base.keyname);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ unsigned int mods)
+{
+ Ewl_Widget *temp;
+ Ewl_Event_Key_Down ev;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_PARAM_PTR(keyname);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+
+ /*
+ * check if this is a focus change key press and we are not ignoring
+ * focus change events
+ */
+ /* FIXME This "Tab" should probably be made a config variable */
+ if ((!(embed->last.focused
+ && ewl_widget_ignore_focus_change_get(embed->last.focused)))
+ && (!strcmp(keyname, "Tab")))
+ {
+ if (mods & EWL_KEY_MODIFIER_SHIFT)
+ ewl_embed_tab_order_previous(embed);
+ else
+ ewl_embed_tab_order_next(embed);
+
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ /*
+ * setup the event struct
+ */
+ ev.base.modifiers = mods;
+ ev.base.keyname = strdup(keyname);
+
+ /*
+ * If a widget has been selected then we send the keystroke to the
+ * appropriate widget.
+ */
+ if (!embed->last.focused) {
+ if (embed->last.clicked)
+ ewl_embed_focused_widget_set(embed,
+ embed->last.clicked);
+ else
+ {
+ ewl_embed_focused_widget_set(embed,
+ ecore_dlist_first_goto(embed->tab_order));
+
+ if (!embed->last.focused)
+ ewl_embed_focused_widget_set(embed,
+ EWL_WIDGET(embed));
+ }
+ }
+
+ /*
+ * Dispatcher of key down events, these get sent to the last widget
+ * selected, and every parent above it.
+ */
+ temp = embed->last.focused;
+ while (temp) {
+ if (!DISABLED(temp))
+ ewl_callback_call_with_event_data(temp,
+ EWL_CALLBACK_KEY_DOWN, &ev);
+ temp = temp->parent;
+ }
+
+ FREE(ev.base.keyname);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -476,42 +476,42 @@ ewl_embed_key_down_feed(Ewl_Embed *embed, const char *keyname,
*/
void
ewl_embed_key_up_feed(Ewl_Embed *embed, const char *keyname,
- unsigned int mods)
+ unsigned int mods)
{
- Ewl_Widget *temp;
- Ewl_Event_Key_Up ev;
+ Ewl_Widget *temp;
+ Ewl_Event_Key_Up ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_PARAM_PTR(keyname);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_PARAM_PTR(keyname);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- /* handle tab focus change (we just drop it on the floor as the
- * actual focus change was done in key down */
- /* FIXME Should probably make this "Tab" a config variable */
- if ((embed->last.focused
- && (!ewl_widget_ignore_focus_change_get(embed->last.focused)))
- && (!strcmp(keyname, "Tab")))
- DRETURN(DLEVEL_STABLE);
+ /* handle tab focus change (we just drop it on the floor as the
+ * actual focus change was done in key down */
+ /* FIXME Should probably make this "Tab" a config variable */
+ if ((embed->last.focused
+ && (!ewl_widget_ignore_focus_change_get(embed->last.focused)))
+ && (!strcmp(keyname, "Tab")))
+ DRETURN(DLEVEL_STABLE);
- ev.base.modifiers = mods;
- ev.base.keyname = strdup(keyname);
+ ev.base.modifiers = mods;
+ ev.base.keyname = strdup(keyname);
- /*
- * Dispatcher of key up events, these get sent to the last widget
- * selected, and every parent above it.
- */
- temp = embed->last.focused;
- while (temp) {
- if (!DISABLED(temp))
- ewl_callback_call_with_event_data(temp,
- EWL_CALLBACK_KEY_UP, &ev);
- temp = temp->parent;
- }
+ /*
+ * Dispatcher of key up events, these get sent to the last widget
+ * selected, and every parent above it.
+ */
+ temp = embed->last.focused;
+ while (temp) {
+ if (!DISABLED(temp))
+ ewl_callback_call_with_event_data(temp,
+ EWL_CALLBACK_KEY_UP, &ev);
+ temp = temp->parent;
+ }
- FREE(ev.base.keyname);
+ FREE(ev.base.keyname);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -526,111 +526,111 @@ ewl_embed_key_up_feed(Ewl_Embed *embed, const char *keyname,
*/
void
ewl_embed_mouse_down_feed(Ewl_Embed *embed, int b, int clicks, int x, int y,
- unsigned int mods)
-{
- Ewl_Event_Mouse_Down ev;
- Ewl_Widget *temp = NULL;
- Ewl_Widget *widget = NULL;
- Ewl_Widget *deselect = NULL;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
-
- /*
- * Keep track on the mouse position
- */
- ewl_embed_last_mouse_x = x + embed->x;
- ewl_embed_last_mouse_y = y + embed->y;
-
- ewl_embed_active_set(embed, TRUE);
-
- widget = ewl_container_child_at_recursive_get(EWL_CONTAINER(embed), x, y);
- if (!widget) widget = EWL_WIDGET(embed);
-
- /*
- * Save the last focused widget for further reference, do this prior
- * to triggering the callback to avoid funkiness if the callback
- * causes the widget to be destroyed.
- */
- deselect = embed->last.focused;
-
- /* we want the focused and last clicked to be the parent widget, not
- * the internal children */
- temp = widget;
- while (temp && temp->parent && ewl_widget_internal_is(temp))
- temp = temp->parent;
-
- /* Set last focused to new widget */
- embed->last.focused = temp;
-
- /*
- * Make sure we set this _BEFORE_ doing the callbacks below because
- * the CLICK or DOWN callback may trigger the widget itself to be
- * deleted which will trigger a cleanup of the info widgets. if we
- * cleanup this widget we don't want to be setting it as
- * last.clicked after that.
- */
- embed->last.clicked = widget;
-
- ev.base.modifiers = mods;
- ev.base.x = x;
- ev.base.y = y;
- ev.button = b;
- ev.clicks = clicks;
-
- /*
- * While the mouse is down the widget has a pressed state, the widget
- * and its parents are notified in this change of state. Send the
- * click events prior to the selection events to allow containers to
- * take different actions depending on child state.
- */
- temp = widget;
- while (temp) {
- if (!DISABLED(temp)) {
- ewl_object_state_add(EWL_OBJECT(temp),
- EWL_FLAG_STATE_PRESSED);
-
- ewl_callback_call_with_event_data(temp,
- EWL_CALLBACK_MOUSE_DOWN, &ev);
-
- if (ev.clicks > 1)
- ewl_callback_call_with_event_data(temp,
- EWL_CALLBACK_CLICKED, &ev);
- }
- temp = temp->parent;
- }
-
- /* Set to upper widget */
- widget = embed->last.focused;
-
- /*
- * Determine whether this widget has already been selected, if not,
- * deselect the previously selected widget and notify it of the
- * change. Then select the new widget and notify it of the selection.
- */
- if (widget != deselect) {
- /*
- * Make sure these widgets haven't been scheduled for
- * deletion before we send their callbacks.
- */
- if (deselect && !DESTROYED(deselect) &&
- !ewl_widget_parent_of(deselect, widget)) {
- ewl_object_state_remove(EWL_OBJECT(deselect),
- EWL_FLAG_STATE_FOCUSED);
- ewl_callback_call_with_event_data(deselect,
- EWL_CALLBACK_FOCUS_OUT, widget);
- }
-
- if (widget && !DISABLED(widget) && !DESTROYED(widget)) {
- ewl_object_state_add(EWL_OBJECT(widget),
- EWL_FLAG_STATE_FOCUSED);
- ewl_callback_call_with_event_data(widget,
- EWL_CALLBACK_FOCUS_IN, deselect);
- }
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ unsigned int mods)
+{
+ Ewl_Event_Mouse_Down ev;
+ Ewl_Widget *temp = NULL;
+ Ewl_Widget *widget = NULL;
+ Ewl_Widget *deselect = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+
+ /*
+ * Keep track on the mouse position
+ */
+ ewl_embed_last_mouse_x = x + embed->x;
+ ewl_embed_last_mouse_y = y + embed->y;
+
+ ewl_embed_active_set(embed, TRUE);
+
+ widget = ewl_container_child_at_recursive_get(EWL_CONTAINER(embed), x, y);
+ if (!widget) widget = EWL_WIDGET(embed);
+
+ /*
+ * Save the last focused widget for further reference, do this prior
+ * to triggering the callback to avoid funkiness if the callback
+ * causes the widget to be destroyed.
+ */
+ deselect = embed->last.focused;
+
+ /* we want the focused and last clicked to be the parent widget, not
+ * the internal children */
+ temp = widget;
+ while (temp && temp->parent && ewl_widget_internal_is(temp))
+ temp = temp->parent;
+
+ /* Set last focused to new widget */
+ embed->last.focused = temp;
+
+ /*
+ * Make sure we set this _BEFORE_ doing the callbacks below because
+ * the CLICK or DOWN callback may trigger the widget itself to be
+ * deleted which will trigger a cleanup of the info widgets. if we
+ * cleanup this widget we don't want to be setting it as
+ * last.clicked after that.
+ */
+ embed->last.clicked = widget;
+
+ ev.base.modifiers = mods;
+ ev.base.x = x;
+ ev.base.y = y;
+ ev.button = b;
+ ev.clicks = clicks;
+
+ /*
+ * While the mouse is down the widget has a pressed state, the widget
+ * and its parents are notified in this change of state. Send the
+ * click events prior to the selection events to allow containers to
+ * take different actions depending on child state.
+ */
+ temp = widget;
+ while (temp) {
+ if (!DISABLED(temp)) {
+ ewl_object_state_add(EWL_OBJECT(temp),
+ EWL_FLAG_STATE_PRESSED);
+
+ ewl_callback_call_with_event_data(temp,
+ EWL_CALLBACK_MOUSE_DOWN, &ev);
+
+ if (ev.clicks > 1)
+ ewl_callback_call_with_event_data(temp,
+ EWL_CALLBACK_CLICKED, &ev);
+ }
+ temp = temp->parent;
+ }
+
+ /* Set to upper widget */
+ widget = embed->last.focused;
+
+ /*
+ * Determine whether this widget has already been selected, if not,
+ * deselect the previously selected widget and notify it of the
+ * change. Then select the new widget and notify it of the selection.
+ */
+ if (widget != deselect) {
+ /*
+ * Make sure these widgets haven't been scheduled for
+ * deletion before we send their callbacks.
+ */
+ if (deselect && !DESTROYED(deselect) &&
+ !ewl_widget_parent_of(deselect, widget)) {
+ ewl_object_state_remove(EWL_OBJECT(deselect),
+ EWL_FLAG_STATE_FOCUSED);
+ ewl_callback_call_with_event_data(deselect,
+ EWL_CALLBACK_FOCUS_OUT, widget);
+ }
+
+ if (widget && !DISABLED(widget) && !DESTROYED(widget)) {
+ ewl_object_state_add(EWL_OBJECT(widget),
+ EWL_FLAG_STATE_FOCUSED);
+ ewl_callback_call_with_event_data(widget,
+ EWL_CALLBACK_FOCUS_IN, deselect);
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -644,46 +644,46 @@ ewl_embed_mouse_down_feed(Ewl_Embed *embed, int b, int clicks, int x, int y,
*/
void
ewl_embed_mouse_up_feed(Ewl_Embed *embed, int b, int x, int y,
- unsigned int mods)
+ unsigned int mods)
{
- Ewl_Widget *temp;
- Ewl_Event_Mouse_Up ev;
+ Ewl_Widget *temp;
+ Ewl_Event_Mouse_Up ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- /*
- * Keep track on the mouse position
- */
- ewl_embed_last_mouse_x = x + embed->x;
- ewl_embed_last_mouse_y = y + embed->y;
+ /*
+ * Keep track on the mouse position
+ */
+ ewl_embed_last_mouse_x = x + embed->x;
+ ewl_embed_last_mouse_y = y + embed->y;
- ewl_embed_active_set(embed, TRUE);
+ ewl_embed_active_set(embed, TRUE);
- ev.base.modifiers = mods;
- ev.base.x = x;
- ev.base.y = y;
- ev.button = b;
+ ev.base.modifiers = mods;
+ ev.base.x = x;
+ ev.base.y = y;
+ ev.button = b;
- /*
- * When the mouse is released the widget no longer has a pressed state,
- * the widget and its parents are notified in this change of state.
- */
- temp = embed->last.clicked;
- while (temp) {
- if (!DISABLED(temp)) {
- ewl_object_state_remove(EWL_OBJECT(temp),
- EWL_FLAG_STATE_PRESSED);
- ewl_callback_call_with_event_data(temp,
- EWL_CALLBACK_MOUSE_UP, &ev);
+ /*
+ * When the mouse is released the widget no longer has a pressed state,
+ * the widget and its parents are notified in this change of state.
+ */
+ temp = embed->last.clicked;
+ while (temp) {
+ if (!DISABLED(temp)) {
+ ewl_object_state_remove(EWL_OBJECT(temp),
+ EWL_FLAG_STATE_PRESSED);
+ ewl_callback_call_with_event_data(temp,
+ EWL_CALLBACK_MOUSE_UP, &ev);
- }
- temp = temp->parent;
- }
+ }
+ temp = temp->parent;
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -697,132 +697,132 @@ ewl_embed_mouse_up_feed(Ewl_Embed *embed, int b, int x, int y,
void
ewl_embed_mouse_move_feed(Ewl_Embed *embed, int x, int y, unsigned int mods)
{
- Ewl_Object *check;
- Ewl_Widget *temp;
- Ewl_Widget *widget = NULL;
- Ewl_Event_Mouse_Move ev;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
-
- /*
- * Keep track on the mouse position
- */
- ewl_embed_last_mouse_x = x + embed->x;
- ewl_embed_last_mouse_y = y + embed->y;
-
- ewl_embed_active_set(embed, TRUE);
-
- ev.base.modifiers = mods;
- ev.base.x = x;
- ev.base.y = y;
-
- /*
- * Focus a new widget if the mouse isn't pressed on the currently
- * focused widget.
- */
- check = EWL_OBJECT(embed->last.mouse_in);
- if (!check || !ewl_object_state_has(check, EWL_FLAG_STATE_PRESSED)) {
-
- widget = ewl_container_child_at_recursive_get(EWL_CONTAINER(embed), x, y);
- if (!widget) widget = EWL_WIDGET(embed);
- }
- else
- widget = embed->last.mouse_in;
-
-
- /* Cycle through all parents of the widget to see if any have
- * a non-default cursor
- */
- temp = EWL_WIDGET(check);
- check = NULL;
- while (temp)
- {
- if (ewl_attach_get(temp, EWL_ATTACH_TYPE_MOUSE_ARGB_CURSOR) ||
- ewl_attach_get(temp, EWL_ATTACH_TYPE_MOUSE_CURSOR))
- {
- check = EWL_OBJECT(temp);
- break;
- }
-
- temp = temp->parent;
- }
-
- /* Set the cursor to first parent if possible */
- if (check)
- ewl_embed_mouse_cursor_set(EWL_WIDGET(check));
- else if (embed->last.mouse_in && embed->last.mouse_in->parent)
- ewl_embed_mouse_cursor_set(embed->last.mouse_in->parent);
-
- /*
- * Defocus all widgets up to the level of a shared parent of
- * old and newly focused widgets.
- */
- check = EWL_OBJECT(embed->last.mouse_in);
- while (check && (widget != EWL_WIDGET(check))
- && !ewl_widget_parent_of(EWL_WIDGET(check), widget)) {
-
- ewl_object_state_remove(check, EWL_FLAG_STATE_MOUSE_IN);
- ewl_callback_call(EWL_WIDGET(check), EWL_CALLBACK_MOUSE_OUT);
- check = EWL_OBJECT(EWL_WIDGET(check)->parent);
- }
-
- /*
- * Pass out the movement event up the chain, allows parents to
- * react to mouse movement in their children.
- */
- embed->last.mouse_in = widget;
- check = EWL_OBJECT(widget);
- while (check) {
- if (!DISABLED(check)) {
-
- /*
- * First mouse move event in a widget marks it focused.
- */
- if (!(ewl_object_state_has(check,
- EWL_FLAG_STATE_MOUSE_IN))) {
-
- /* Only set the cursor different if it is non-default */
- if (ewl_attach_get(EWL_WIDGET(check),
- EWL_ATTACH_TYPE_MOUSE_ARGB_CURSOR) ||
- ewl_attach_get(EWL_WIDGET(check),
- EWL_ATTACH_TYPE_MOUSE_CURSOR))
- ewl_embed_mouse_cursor_set(EWL_WIDGET(check));
-
- ewl_object_state_add(check,
- EWL_FLAG_STATE_MOUSE_IN);
- ewl_callback_call_with_event_data(EWL_WIDGET(check),
- EWL_CALLBACK_MOUSE_IN, &ev);
- }
-
- ewl_callback_call_with_event_data(EWL_WIDGET(check),
- EWL_CALLBACK_MOUSE_MOVE, &ev);
- }
-
- /*
- * It's possible that the call to MOUSE_IN caused the
- * 'embed->last.mouse_in' to have become null. Make sure this
- * pointer is still here
- */
- if (check) check = EWL_OBJECT(EWL_WIDGET(check)->parent);
- }
-
- /*
- * Determine if the drag widget should be receiving the mouse movement
- * events.
- */
- check = EWL_OBJECT(embed->last.drag_widget);
- if (check && ewl_object_state_has(check, EWL_FLAG_STATE_DND))
- ewl_callback_call_with_event_data(EWL_WIDGET(check),
- EWL_CALLBACK_MOUSE_MOVE, &ev);
-
- check = EWL_OBJECT(embed->last.clicked);
- if (check && ewl_object_state_has(check, EWL_FLAG_STATE_PRESSED))
- ewl_callback_call_with_event_data(EWL_WIDGET(check),
- EWL_CALLBACK_MOUSE_MOVE, &ev);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Object *check;
+ Ewl_Widget *temp;
+ Ewl_Widget *widget = NULL;
+ Ewl_Event_Mouse_Move ev;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+
+ /*
+ * Keep track on the mouse position
+ */
+ ewl_embed_last_mouse_x = x + embed->x;
+ ewl_embed_last_mouse_y = y + embed->y;
+
+ ewl_embed_active_set(embed, TRUE);
+
+ ev.base.modifiers = mods;
+ ev.base.x = x;
+ ev.base.y = y;
+
+ /*
+ * Focus a new widget if the mouse isn't pressed on the currently
+ * focused widget.
+ */
+ check = EWL_OBJECT(embed->last.mouse_in);
+ if (!check || !ewl_object_state_has(check, EWL_FLAG_STATE_PRESSED)) {
+
+ widget = ewl_container_child_at_recursive_get(EWL_CONTAINER(embed), x, y);
+ if (!widget) widget = EWL_WIDGET(embed);
+ }
+ else
+ widget = embed->last.mouse_in;
+
+
+ /* Cycle through all parents of the widget to see if any have
+ * a non-default cursor
+ */
+ temp = EWL_WIDGET(check);
+ check = NULL;
+ while (temp)
+ {
+ if (ewl_attach_get(temp, EWL_ATTACH_TYPE_MOUSE_ARGB_CURSOR) ||
+ ewl_attach_get(temp, EWL_ATTACH_TYPE_MOUSE_CURSOR))
+ {
+ check = EWL_OBJECT(temp);
+ break;
+ }
+
+ temp = temp->parent;
+ }
+
+ /* Set the cursor to first parent if possible */
+ if (check)
+ ewl_embed_mouse_cursor_set(EWL_WIDGET(check));
+ else if (embed->last.mouse_in && embed->last.mouse_in->parent)
+ ewl_embed_mouse_cursor_set(embed->last.mouse_in->parent);
+
+ /*
+ * Defocus all widgets up to the level of a shared parent of
+ * old and newly focused widgets.
+ */
+ check = EWL_OBJECT(embed->last.mouse_in);
+ while (check && (widget != EWL_WIDGET(check))
+ && !ewl_widget_parent_of(EWL_WIDGET(check), widget)) {
+
+ ewl_object_state_remove(check, EWL_FLAG_STATE_MOUSE_IN);
+ ewl_callback_call(EWL_WIDGET(check), EWL_CALLBACK_MOUSE_OUT);
+ check = EWL_OBJECT(EWL_WIDGET(check)->parent);
+ }
+
+ /*
+ * Pass out the movement event up the chain, allows parents to
+ * react to mouse movement in their children.
+ */
+ embed->last.mouse_in = widget;
+ check = EWL_OBJECT(widget);
+ while (check) {
+ if (!DISABLED(check)) {
+
+ /*
+ * First mouse move event in a widget marks it focused.
+ */
+ if (!(ewl_object_state_has(check,
+ EWL_FLAG_STATE_MOUSE_IN))) {
+
+ /* Only set the cursor different if it is non-default */
+ if (ewl_attach_get(EWL_WIDGET(check),
+ EWL_ATTACH_TYPE_MOUSE_ARGB_CURSOR) ||
+ ewl_attach_get(EWL_WIDGET(check),
+ EWL_ATTACH_TYPE_MOUSE_CURSOR))
+ ewl_embed_mouse_cursor_set(EWL_WIDGET(check));
+
+ ewl_object_state_add(check,
+ EWL_FLAG_STATE_MOUSE_IN);
+ ewl_callback_call_with_event_data(EWL_WIDGET(check),
+ EWL_CALLBACK_MOUSE_IN, &ev);
+ }
+
+ ewl_callback_call_with_event_data(EWL_WIDGET(check),
+ EWL_CALLBACK_MOUSE_MOVE, &ev);
+ }
+
+ /*
+ * It's possible that the call to MOUSE_IN caused the
+ * 'embed->last.mouse_in' to have become null. Make sure this
+ * pointer is still here
+ */
+ if (check) check = EWL_OBJECT(EWL_WIDGET(check)->parent);
+ }
+
+ /*
+ * Determine if the drag widget should be receiving the mouse movement
+ * events.
+ */
+ check = EWL_OBJECT(embed->last.drag_widget);
+ if (check && ewl_object_state_has(check, EWL_FLAG_STATE_DND))
+ ewl_callback_call_with_event_data(EWL_WIDGET(check),
+ EWL_CALLBACK_MOUSE_MOVE, &ev);
+
+ check = EWL_OBJECT(embed->last.clicked);
+ if (check && ewl_object_state_has(check, EWL_FLAG_STATE_PRESSED))
+ ewl_callback_call_with_event_data(EWL_WIDGET(check),
+ EWL_CALLBACK_MOUSE_MOVE, &ev);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -836,56 +836,56 @@ ewl_embed_mouse_move_feed(Ewl_Embed *embed, int x, int y, unsigned int mods)
const char *
ewl_embed_dnd_drop_feed(Ewl_Embed *embed, int x, int y, int internal __UNUSED__)
{
- Ewl_Widget *widget = NULL, *parent = NULL;
- const char *result = NULL;
- int i;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(embed, NULL);
- DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, NULL);
-
- ewl_embed_active_set(embed, TRUE);
-
- widget = ewl_container_child_at_recursive_get(EWL_CONTAINER(embed), x, y);
- /*
- * Find the lowest DND aware widget
- */
- while (widget) {
- if (ewl_object_flags_has(EWL_OBJECT(widget),
- EWL_FLAG_PROPERTY_DND_TARGET,
- EWL_FLAGS_PROPERTY_MASK))
- break;
- widget = widget->parent;
- }
- if (!widget) DRETURN_PTR(NULL, DLEVEL_STABLE);
-
- /* Request a DND data request */
- for (i = 0; i < embed->dnd_types.num_types; i++) {
- if (ewl_dnd_accepted_types_contains(widget, embed->dnd_types.types[i])) {
- result = embed->dnd_types.types[i];
- break;
- }
- }
-
- if (result) {
- Ewl_Event_Dnd_Drop ev;
-
- ev.x = x;
- ev.y = y;
- ev.data = NULL;
-
- embed->last.drop_widget = widget;
- parent = widget;
- while (parent) {
- ewl_callback_call_with_event_data(parent,
- EWL_CALLBACK_DND_DROP, &ev);
- parent = parent->parent;
- }
- }
-
- ewl_dnd_drag_widget_clear();
-
- DRETURN_PTR(result, DLEVEL_STABLE);
+ Ewl_Widget *widget = NULL, *parent = NULL;
+ const char *result = NULL;
+ int i;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(embed, NULL);
+ DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, NULL);
+
+ ewl_embed_active_set(embed, TRUE);
+
+ widget = ewl_container_child_at_recursive_get(EWL_CONTAINER(embed), x, y);
+ /*
+ * Find the lowest DND aware widget
+ */
+ while (widget) {
+ if (ewl_object_flags_has(EWL_OBJECT(widget),
+ EWL_FLAG_PROPERTY_DND_TARGET,
+ EWL_FLAGS_PROPERTY_MASK))
+ break;
+ widget = widget->parent;
+ }
+ if (!widget) DRETURN_PTR(NULL, DLEVEL_STABLE);
+
+ /* Request a DND data request */
+ for (i = 0; i < embed->dnd_types.num_types; i++) {
+ if (ewl_dnd_accepted_types_contains(widget, embed->dnd_types.types[i])) {
+ result = embed->dnd_types.types[i];
+ break;
+ }
+ }
+
+ if (result) {
+ Ewl_Event_Dnd_Drop ev;
+
+ ev.x = x;
+ ev.y = y;
+ ev.data = NULL;
+
+ embed->last.drop_widget = widget;
+ parent = widget;
+ while (parent) {
+ ewl_callback_call_with_event_data(parent,
+ EWL_CALLBACK_DND_DROP, &ev);
+ parent = parent->parent;
+ }
+ }
+
+ ewl_dnd_drag_widget_clear();
+
+ DRETURN_PTR(result, DLEVEL_STABLE);
}
/**
@@ -902,85 +902,85 @@ ewl_embed_dnd_drop_feed(Ewl_Embed *embed, int x, int y, int internal __UNUSED__)
const char *
ewl_embed_dnd_position_feed(Ewl_Embed *embed, int x, int y, int* px, int* py, int* pw, int* ph)
{
- const char *result = NULL;
- Ewl_Widget *widget = NULL, *parent = NULL;
- Ewl_Event_Dnd_Position ev;
- int i;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(embed, NULL);
- DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, NULL);
-
- ev.x = x;
- ev.y = y;
-
- ewl_embed_active_set(embed, TRUE);
-
- widget = ewl_container_child_at_recursive_get(EWL_CONTAINER(embed), x, y);
- /*
- * Find the lowest DND aware widget
- */
- while (widget) {
- if (ewl_object_flags_has(EWL_OBJECT(widget),
- EWL_FLAG_PROPERTY_DND_TARGET,
- EWL_FLAGS_PROPERTY_MASK))
- break;
- widget = widget->parent;
- }
-
- if (!widget) {
- DWARNING("Could not find widget for dnd position event.");
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
-
- /* If the last position event was over a different widget,
- * feed the leaving widget a 'null' */
- if (embed->dnd_last_position != widget) {
- if (embed->dnd_last_position) {
- parent = embed->dnd_last_position;
- while (parent) {
- ewl_callback_call_with_event_data(parent,
- EWL_CALLBACK_DND_LEAVE, &ev);
- parent = parent->parent;
- }
- }
-
- parent = widget;
- while (parent) {
- ewl_callback_call_with_event_data(parent,
- EWL_CALLBACK_DND_ENTER, &ev);
- parent = parent->parent;
- }
- }
-
- /*
- * Pass the position event up the chain
- */
- parent = widget;
- while (parent) {
- ewl_callback_call_with_event_data(parent,
- EWL_CALLBACK_DND_POSITION, &ev);
- parent = parent->parent;
- }
-
- embed->last.drop_widget = widget;
- embed->dnd_last_position = widget;
-
- /* Request a DND data request */
- for (i = 0; i < embed->dnd_types.num_types; i++) {
- if (ewl_dnd_accepted_types_contains(widget,
- embed->dnd_types.types[i])) {
- result = embed->dnd_types.types[i];
- break;
- }
- }
-
- if (px) *px = CURRENT_X(widget);
- if (py) *py = CURRENT_Y(widget);
- if (pw) *pw = CURRENT_W(widget);
- if (ph) *ph = CURRENT_H(widget);
-
- DRETURN_PTR(result, DLEVEL_STABLE);
+ const char *result = NULL;
+ Ewl_Widget *widget = NULL, *parent = NULL;
+ Ewl_Event_Dnd_Position ev;
+ int i;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(embed, NULL);
+ DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, NULL);
+
+ ev.x = x;
+ ev.y = y;
+
+ ewl_embed_active_set(embed, TRUE);
+
+ widget = ewl_container_child_at_recursive_get(EWL_CONTAINER(embed), x, y);
+ /*
+ * Find the lowest DND aware widget
+ */
+ while (widget) {
+ if (ewl_object_flags_has(EWL_OBJECT(widget),
+ EWL_FLAG_PROPERTY_DND_TARGET,
+ EWL_FLAGS_PROPERTY_MASK))
+ break;
+ widget = widget->parent;
+ }
+
+ if (!widget) {
+ DWARNING("Could not find widget for dnd position event.");
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
+
+ /* If the last position event was over a different widget,
+ * feed the leaving widget a 'null' */
+ if (embed->dnd_last_position != widget) {
+ if (embed->dnd_last_position) {
+ parent = embed->dnd_last_position;
+ while (parent) {
+ ewl_callback_call_with_event_data(parent,
+ EWL_CALLBACK_DND_LEAVE, &ev);
+ parent = parent->parent;
+ }
+ }
+
+ parent = widget;
+ while (parent) {
+ ewl_callback_call_with_event_data(parent,
+ EWL_CALLBACK_DND_ENTER, &ev);
+ parent = parent->parent;
+ }
+ }
+
+ /*
+ * Pass the position event up the chain
+ */
+ parent = widget;
+ while (parent) {
+ ewl_callback_call_with_event_data(parent,
+ EWL_CALLBACK_DND_POSITION, &ev);
+ parent = parent->parent;
+ }
+
+ embed->last.drop_widget = widget;
+ embed->dnd_last_position = widget;
+
+ /* Request a DND data request */
+ for (i = 0; i < embed->dnd_types.num_types; i++) {
+ if (ewl_dnd_accepted_types_contains(widget,
+ embed->dnd_types.types[i])) {
+ result = embed->dnd_types.types[i];
+ break;
+ }
+ }
+
+ if (px) *px = CURRENT_X(widget);
+ if (py) *py = CURRENT_Y(widget);
+ if (pw) *pw = CURRENT_W(widget);
+ if (ph) *ph = CURRENT_H(widget);
+
+ DRETURN_PTR(result, DLEVEL_STABLE);
}
/**
@@ -994,27 +994,27 @@ ewl_embed_dnd_position_feed(Ewl_Embed *embed, int x, int y, int* px, int* py, in
void
ewl_embed_mouse_out_feed(Ewl_Embed *embed, int x, int y, unsigned int mods)
{
- Ewl_Event_Mouse_Out ev;
+ Ewl_Event_Mouse_Out ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- ewl_embed_active_set(embed, TRUE);
+ ewl_embed_active_set(embed, TRUE);
- ev.base.modifiers = mods;
- ev.base.x = x;
- ev.base.y = y;
+ ev.base.modifiers = mods;
+ ev.base.x = x;
+ ev.base.y = y;
- while (embed->last.mouse_in) {
- ewl_object_state_remove(EWL_OBJECT(embed->last.mouse_in),
- EWL_FLAG_STATE_MOUSE_IN);
- ewl_callback_call_with_event_data(embed->last.mouse_in,
- EWL_CALLBACK_MOUSE_OUT, &ev);
- embed->last.mouse_in = embed->last.mouse_in->parent;
- }
+ while (embed->last.mouse_in) {
+ ewl_object_state_remove(EWL_OBJECT(embed->last.mouse_in),
+ EWL_FLAG_STATE_MOUSE_IN);
+ ewl_callback_call_with_event_data(embed->last.mouse_in,
+ EWL_CALLBACK_MOUSE_OUT, &ev);
+ embed->last.mouse_in = embed->last.mouse_in->parent;
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1029,35 +1029,35 @@ ewl_embed_mouse_out_feed(Ewl_Embed *embed, int x, int y, unsigned int mods)
*/
void
ewl_embed_mouse_wheel_feed(Ewl_Embed *embed, int x, int y, int z, int dir,
- unsigned int mods)
+ unsigned int mods)
{
- Ewl_Widget *w;
- Ewl_Event_Mouse_Wheel ev;
+ Ewl_Widget *w;
+ Ewl_Event_Mouse_Wheel ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- ewl_embed_active_set(embed, TRUE);
+ ewl_embed_active_set(embed, TRUE);
- ev.base.modifiers = mods;
- ev.base.x = x;
- ev.base.y = y;
- ev.z = z;
- ev.dir = dir;
+ ev.base.modifiers = mods;
+ ev.base.x = x;
+ ev.base.y = y;
+ ev.z = z;
+ ev.dir = dir;
- w = embed->last.mouse_in;
- if (!w)
- ewl_callback_call_with_event_data(EWL_WIDGET(embed),
- EWL_CALLBACK_MOUSE_WHEEL, &ev);
+ w = embed->last.mouse_in;
+ if (!w)
+ ewl_callback_call_with_event_data(EWL_WIDGET(embed),
+ EWL_CALLBACK_MOUSE_WHEEL, &ev);
- while (w) {
- ewl_callback_call_with_event_data(w,
- EWL_CALLBACK_MOUSE_WHEEL, &ev);
- w = w->parent;
- }
+ while (w) {
+ ewl_callback_call_with_event_data(w,
+ EWL_CALLBACK_MOUSE_WHEEL, &ev);
+ w = w->parent;
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1071,33 +1071,33 @@ ewl_embed_mouse_wheel_feed(Ewl_Embed *embed, int x, int y, int z, int dir,
*/
void
ewl_embed_dnd_data_received_feed(Ewl_Embed *embed, char *type, void *data,
- unsigned int len, unsigned int format)
-{
- Ewl_Event_Dnd_Data_Received ev;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
-
- /*
- * If a widget is expecting DND data, send the data to the widget
- */
- if (embed->last.drop_widget) {
- if (ewl_dnd_accepted_types_contains(embed->last.drop_widget, type)) {
- /*
- * setup the event struct
- */
- ev.type = type;
- ev.data = data;
- ev.len = len;
- ev.format= format;
- ewl_callback_call_with_event_data(embed->last.drop_widget,
- EWL_CALLBACK_DND_DATA_RECEIVED, &ev);
- }
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ unsigned int len, unsigned int format)
+{
+ Ewl_Event_Dnd_Data_Received ev;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+
+ /*
+ * If a widget is expecting DND data, send the data to the widget
+ */
+ if (embed->last.drop_widget) {
+ if (ewl_dnd_accepted_types_contains(embed->last.drop_widget, type)) {
+ /*
+ * setup the event struct
+ */
+ ev.type = type;
+ ev.data = data;
+ ev.len = len;
+ ev.format= format;
+ ewl_callback_call_with_event_data(embed->last.drop_widget,
+ EWL_CALLBACK_DND_DATA_RECEIVED, &ev);
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1110,27 +1110,27 @@ ewl_embed_dnd_data_received_feed(Ewl_Embed *embed, char *type, void *data,
void
ewl_embed_dnd_data_request_feed(Ewl_Embed *embed, void *handle, char *type)
{
- Ewl_Event_Dnd_Data_Request ev;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- /*
- * If a widget is expecting DND data, send the data to the widget
- */
- if (embed->last.drag_widget) {
- if (ewl_dnd_provided_types_contains(embed->last.drag_widget, type)) {
- /*
- * setup the event struct
- */
- ev.handle = handle;
- ev.type = type;
- ewl_callback_call_with_event_data(embed->last.drag_widget,
- EWL_CALLBACK_DND_DATA_REQUEST, &ev);
- }
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Event_Dnd_Data_Request ev;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ /*
+ * If a widget is expecting DND data, send the data to the widget
+ */
+ if (embed->last.drag_widget) {
+ if (ewl_dnd_provided_types_contains(embed->last.drag_widget, type)) {
+ /*
+ * setup the event struct
+ */
+ ev.handle = handle;
+ ev.type = type;
+ ewl_callback_call_with_event_data(embed->last.drag_widget,
+ EWL_CALLBACK_DND_DATA_REQUEST, &ev);
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1144,20 +1144,20 @@ ewl_embed_dnd_data_request_feed(Ewl_Embed *embed, void *handle, char *type)
void
ewl_embed_font_path_add(char *path)
{
- Ewl_Embed *e;
+ Ewl_Embed *e;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(path);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(path);
- ecore_list_first_goto(ewl_embed_list);
- while ((e = ecore_list_next(ewl_embed_list))) {
- if (REALIZED(e))
- evas_font_path_append(e->canvas, path);
- }
+ ecore_list_first_goto(ewl_embed_list);
+ while ((e = ecore_list_next(ewl_embed_list))) {
+ if (REALIZED(e))
+ evas_font_path_append(e->canvas, path);
+ }
- ecore_list_append(ewl_theme_font_path_get(), strdup(path));
+ ecore_list_append(ewl_theme_font_path_get(), strdup(path));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1168,18 +1168,18 @@ ewl_embed_font_path_add(char *path)
Ewl_Embed *
ewl_embed_canvas_window_find(Ewl_Embed_Window *window)
{
- Ewl_Embed *retemb;
+ Ewl_Embed *retemb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(window, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(window, NULL);
- ecore_list_first_goto(ewl_embed_list);
- while ((retemb = ecore_list_next(ewl_embed_list)) != NULL) {
- if (retemb->canvas_window == window)
- DRETURN_PTR(retemb, DLEVEL_STABLE);
- }
+ ecore_list_first_goto(ewl_embed_list);
+ while ((retemb = ecore_list_next(ewl_embed_list)) != NULL) {
+ if (retemb->canvas_window == window)
+ DRETURN_PTR(retemb, DLEVEL_STABLE);
+ }
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
}
/**
@@ -1190,17 +1190,17 @@ ewl_embed_canvas_window_find(Ewl_Embed_Window *window)
Ewl_Embed *
ewl_embed_widget_find(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, NULL);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, NULL);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
- while (w->parent)
- w = w->parent;
+ while (w->parent)
+ w = w->parent;
- if (!ewl_object_toplevel_get(EWL_OBJECT(w)))
- w = NULL;
+ if (!ewl_object_toplevel_get(EWL_OBJECT(w)))
+ w = NULL;
- DRETURN_PTR(EWL_EMBED(w), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_EMBED(w), DLEVEL_STABLE);
}
/**
@@ -1212,46 +1212,46 @@ ewl_embed_widget_find(Ewl_Widget *w)
void
ewl_embed_object_cache(Ewl_Embed *e, void *obj)
{
- const Evas_List *clippees;
+ const Evas_List *clippees;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_PARAM_PTR(obj);
- DCHECK_TYPE(e, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_PARAM_PTR(obj);
+ DCHECK_TYPE(e, EWL_EMBED_TYPE);
- /* Sanitize the color of this evas pre-cache */
- evas_object_color_set(obj, 255, 255, 255, 255);
+ /* Sanitize the color of this evas pre-cache */
+ evas_object_color_set(obj, 255, 255, 255, 255);
- evas_object_smart_member_del(obj);
- evas_object_clip_unset(obj);
- evas_object_hide(obj);
+ evas_object_smart_member_del(obj);
+ evas_object_clip_unset(obj);
+ evas_object_hide(obj);
- /* we have to unclip all of the clippees so that we don't end up
- * getting into an infinite loop resetting the clip later */
- while ((clippees = evas_object_clipees_get(obj)))
- evas_object_clip_unset(clippees->data);
+ /* we have to unclip all of the clippees so that we don't end up
+ * getting into an infinite loop resetting the clip later */
+ while ((clippees = evas_object_clipees_get(obj)))
+ evas_object_clip_unset(clippees->data);
- if (e->obj_cache) {
- Ecore_List *obj_list;
- const char *type;
+ if (e->obj_cache) {
+ Ecore_List *obj_list;
+ const char *type;
- type = evas_object_type_get(obj);
+ type = evas_object_type_get(obj);
- /* reset the file and the key of the edje object */
- if (!strcmp(type, "edje"))
- edje_object_file_set(obj, "", "");
+ /* reset the file and the key of the edje object */
+ if (!strcmp(type, "edje"))
+ edje_object_file_set(obj, "", "");
- obj_list = ecore_hash_get(e->obj_cache, (void *)type);
- if (!obj_list) {
- obj_list = ecore_list_new();
- ecore_hash_set(e->obj_cache, (void *)type, obj_list);
- }
- ecore_list_prepend(obj_list, obj);
- }
- else
- ewl_canvas_object_destroy(obj);
+ obj_list = ecore_hash_get(e->obj_cache, (void *)type);
+ if (!obj_list) {
+ obj_list = ecore_list_new();
+ ecore_hash_set(e->obj_cache, (void *)type, obj_list);
+ }
+ ecore_list_prepend(obj_list, obj);
+ }
+ else
+ ewl_canvas_object_destroy(obj);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1264,21 +1264,21 @@ ewl_embed_object_cache(Ewl_Embed *e, void *obj)
void *
ewl_embed_object_request(Ewl_Embed *e, char *type)
{
- Evas_Object *obj = NULL;
- Ecore_List *obj_list;
+ Evas_Object *obj = NULL;
+ Ecore_List *obj_list;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(e, NULL);
- DCHECK_PARAM_PTR_RET(type, NULL);
- DCHECK_TYPE_RET(e, EWL_EMBED_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(e, NULL);
+ DCHECK_PARAM_PTR_RET(type, NULL);
+ DCHECK_TYPE_RET(e, EWL_EMBED_TYPE, NULL);
- if (!e->obj_cache)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ if (!e->obj_cache)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- obj_list = ecore_hash_get(e->obj_cache, type);
- if (obj_list) obj = ecore_list_first_remove(obj_list);
+ obj_list = ecore_hash_get(e->obj_cache, type);
+ if (obj_list) obj = ecore_list_first_remove(obj_list);
- DRETURN_PTR(obj, DLEVEL_STABLE);
+ DRETURN_PTR(obj, DLEVEL_STABLE);
}
/**
@@ -1290,15 +1290,15 @@ ewl_embed_object_request(Ewl_Embed *e, char *type)
void
ewl_embed_tab_order_prepend(Ewl_Embed *e, Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(e, EWL_EMBED_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(e, EWL_EMBED_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_embed_tab_order_insert(e, w, 0);
+ ewl_embed_tab_order_insert(e, w, 0);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1310,15 +1310,15 @@ ewl_embed_tab_order_prepend(Ewl_Embed *e, Ewl_Widget *w)
void
ewl_embed_tab_order_append(Ewl_Embed *e, Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(e, EWL_EMBED_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(e, EWL_EMBED_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_embed_tab_order_insert(e, w, ecore_list_count(e->tab_order));
+ ewl_embed_tab_order_insert(e, w, ecore_list_count(e->tab_order));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1331,47 +1331,47 @@ ewl_embed_tab_order_append(Ewl_Embed *e, Ewl_Widget *w)
void
ewl_embed_tab_order_insert(Ewl_Embed *e, Ewl_Widget *w, unsigned int idx)
{
- int current_idx = 0;
+ int current_idx = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(e, EWL_EMBED_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(e, EWL_EMBED_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (!ewl_widget_parent_of(EWL_WIDGET(e), w))
- DRETURN(DLEVEL_STABLE);
+ if (!ewl_widget_parent_of(EWL_WIDGET(e), w))
+ DRETURN(DLEVEL_STABLE);
- /* do nothing if this widget isn't focusable */
- if (!ewl_widget_focusable_get(w))
- DRETURN(DLEVEL_STABLE);
+ /* do nothing if this widget isn't focusable */
+ if (!ewl_widget_focusable_get(w))
+ DRETURN(DLEVEL_STABLE);
- current_idx = ecore_dlist_index(e->tab_order);
+ current_idx = ecore_dlist_index(e->tab_order);
- /* make sure this widget isn't already in the list */
- if (ewl_object_in_tab_list_get(EWL_OBJECT(w))
- && ecore_dlist_goto(e->tab_order, w)) {
- int del_idx;
+ /* make sure this widget isn't already in the list */
+ if (ewl_object_in_tab_list_get(EWL_OBJECT(w))
+ && ecore_dlist_goto(e->tab_order, w)) {
+ int del_idx;
- /* if this widget was before or at our current focused
- * widget then we need to decrement our counter */
- del_idx = ecore_dlist_index(e->tab_order);
- if (del_idx <= current_idx) current_idx --;
+ /* if this widget was before or at our current focused
+ * widget then we need to decrement our counter */
+ del_idx = ecore_dlist_index(e->tab_order);
+ if (del_idx <= current_idx) current_idx --;
- ecore_dlist_remove(e->tab_order);
- }
+ ecore_dlist_remove(e->tab_order);
+ }
- ecore_dlist_index_goto(e->tab_order, idx);
- ecore_dlist_insert(e->tab_order, w);
+ ecore_dlist_index_goto(e->tab_order, idx);
+ ecore_dlist_insert(e->tab_order, w);
- /* if we inserted before or at our currently focused item then we
- * need to advance our current item to the correct spot */
- if (current_idx <= (int)idx) current_idx ++;
- ecore_dlist_index_goto(e->tab_order, current_idx);
+ /* if we inserted before or at our currently focused item then we
+ * need to advance our current item to the correct spot */
+ if (current_idx <= (int)idx) current_idx ++;
+ ecore_dlist_index_goto(e->tab_order, current_idx);
- ewl_object_in_tab_list_set(EWL_OBJECT(w), TRUE);
+ ewl_object_in_tab_list_set(EWL_OBJECT(w), TRUE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1383,31 +1383,31 @@ ewl_embed_tab_order_insert(Ewl_Embed *e, Ewl_Widget *w, unsigned int idx)
*/
void
ewl_embed_tab_order_insert_after(Ewl_Embed *e, Ewl_Widget *w,
- Ewl_Widget *after)
+ Ewl_Widget *after)
{
- int cur_idx, idx;
+ int cur_idx, idx;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(after);
- DCHECK_TYPE(e, EWL_EMBED_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- DCHECK_TYPE(after, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(after);
+ DCHECK_TYPE(e, EWL_EMBED_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DCHECK_TYPE(after, EWL_WIDGET_TYPE);
- cur_idx = ecore_dlist_index(e->tab_order);
- if (!ecore_dlist_goto(e->tab_order, after))
- {
- ewl_embed_tab_order_append(e, w);
- DRETURN(DLEVEL_STABLE);
- }
+ cur_idx = ecore_dlist_index(e->tab_order);
+ if (!ecore_dlist_goto(e->tab_order, after))
+ {
+ ewl_embed_tab_order_append(e, w);
+ DRETURN(DLEVEL_STABLE);
+ }
- idx = ecore_dlist_index(e->tab_order);
- ecore_dlist_index_goto(e->tab_order, cur_idx);
+ idx = ecore_dlist_index(e->tab_order);
+ ecore_dlist_index_goto(e->tab_order, cur_idx);
- ewl_embed_tab_order_insert(e, w, idx + 1);
+ ewl_embed_tab_order_insert(e, w, idx + 1);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1419,31 +1419,31 @@ ewl_embed_tab_order_insert_after(Ewl_Embed *e, Ewl_Widget *w,
*/
void
ewl_embed_tab_order_insert_before(Ewl_Embed *e, Ewl_Widget *w,
- Ewl_Widget *before)
+ Ewl_Widget *before)
{
- int cur_idx, idx;
+ int cur_idx, idx;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(before);
- DCHECK_TYPE(e, EWL_EMBED_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- DCHECK_TYPE(before, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(before);
+ DCHECK_TYPE(e, EWL_EMBED_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DCHECK_TYPE(before, EWL_WIDGET_TYPE);
- cur_idx = ecore_dlist_index(e->tab_order);
- if (!ecore_dlist_goto(e->tab_order, before))
- {
- ewl_embed_tab_order_prepend(e, w);
- DRETURN(DLEVEL_STABLE);
- }
+ cur_idx = ecore_dlist_index(e->tab_order);
+ if (!ecore_dlist_goto(e->tab_order, before))
+ {
+ ewl_embed_tab_order_prepend(e, w);
+ DRETURN(DLEVEL_STABLE);
+ }
- idx = ecore_dlist_index(e->tab_order);
- ecore_dlist_index_goto(e->tab_order, cur_idx);
+ idx = ecore_dlist_index(e->tab_order);
+ ecore_dlist_index_goto(e->tab_order, cur_idx);
- ewl_embed_tab_order_insert(e, w, idx);
+ ewl_embed_tab_order_insert(e, w, idx);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1455,18 +1455,18 @@ ewl_embed_tab_order_insert_before(Ewl_Embed *e, Ewl_Widget *w,
void
ewl_embed_tab_order_remove(Ewl_Embed *e, Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(e, EWL_EMBED_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(e, EWL_EMBED_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (ecore_dlist_goto(e->tab_order, w))
- ecore_dlist_remove(e->tab_order);
+ if (ecore_dlist_goto(e->tab_order, w))
+ ecore_dlist_remove(e->tab_order);
- ewl_object_in_tab_list_set(EWL_OBJECT(w), FALSE);
+ ewl_object_in_tab_list_set(EWL_OBJECT(w), FALSE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1476,14 +1476,14 @@ ewl_embed_tab_order_remove(Ewl_Embed *e, Ewl_Widget *w)
*/
void ewl_embed_tab_order_next(Ewl_Embed *e)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_TYPE(e, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_TYPE(e, EWL_EMBED_TYPE);
- ewl_embed_tab_order_change(e, ecore_dlist_next,
- ecore_dlist_first_goto);
+ ewl_embed_tab_order_change(e, ecore_dlist_next,
+ ecore_dlist_first_goto);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1495,14 +1495,14 @@ void
ewl_embed_tab_order_previous(Ewl_Embed *e)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_TYPE(e, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_TYPE(e, EWL_EMBED_TYPE);
- ewl_embed_tab_order_change(e, ecore_dlist_previous,
- ecore_dlist_last_goto);
+ ewl_embed_tab_order_change(e, ecore_dlist_previous,
+ ecore_dlist_last_goto);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/*
@@ -1515,53 +1515,53 @@ ewl_embed_tab_order_previous(Ewl_Embed *e)
*/
static void
ewl_embed_tab_order_change(Ewl_Embed *e, void *(*change)(Ecore_DList *list),
- void *(*cycle)(Ecore_DList *list))
-{
- Ewl_Widget *w, *start;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_PARAM_PTR(change);
- DCHECK_PARAM_PTR(cycle);
- DCHECK_TYPE(e, EWL_EMBED_TYPE);
-
- /* make sure the list is at the last focused widget */
- if (e->last.focused)
- {
- ecore_dlist_goto(e->tab_order, e->last.focused);
- change(e->tab_order);
- if (!ecore_dlist_current(e->tab_order))
- cycle(e->tab_order);
- }
- else
- cycle(e->tab_order);
-
- w = ecore_dlist_current(e->tab_order);
- if (!w) DRETURN(DLEVEL_STABLE);
-
- start = w;
- while (!VISIBLE(w) || !ewl_widget_focusable_get(w)
- || ewl_widget_internal_is(w)
- || DISABLED(w))
- {
- change(e->tab_order);
- w = ecore_dlist_current(e->tab_order);
-
- /* check if we hit the end of the list and loop to the start */
- if (!w)
- {
- cycle(e->tab_order);
- w = ecore_dlist_current(e->tab_order);
- }
-
- /* make sure we don't cycle */
- if (w == start)
- DRETURN(DLEVEL_STABLE);
- }
-
- if (w) ewl_embed_focused_widget_set(e, w);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ void *(*cycle)(Ecore_DList *list))
+{
+ Ewl_Widget *w, *start;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_PARAM_PTR(change);
+ DCHECK_PARAM_PTR(cycle);
+ DCHECK_TYPE(e, EWL_EMBED_TYPE);
+
+ /* make sure the list is at the last focused widget */
+ if (e->last.focused)
+ {
+ ecore_dlist_goto(e->tab_order, e->last.focused);
+ change(e->tab_order);
+ if (!ecore_dlist_current(e->tab_order))
+ cycle(e->tab_order);
+ }
+ else
+ cycle(e->tab_order);
+
+ w = ecore_dlist_current(e->tab_order);
+ if (!w) DRETURN(DLEVEL_STABLE);
+
+ start = w;
+ while (!VISIBLE(w) || !ewl_widget_focusable_get(w)
+ || ewl_widget_internal_is(w)
+ || DISABLED(w))
+ {
+ change(e->tab_order);
+ w = ecore_dlist_current(e->tab_order);
+
+ /* check if we hit the end of the list and loop to the start */
+ if (!w)
+ {
+ cycle(e->tab_order);
+ w = ecore_dlist_current(e->tab_order);
+ }
+
+ /* make sure we don't cycle */
+ if (w == start)
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ if (w) ewl_embed_focused_widget_set(e, w);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1574,21 +1574,21 @@ ewl_embed_tab_order_change(Ewl_Embed *e, void *(*change)(Ecore_DList *list),
void
ewl_embed_focused_widget_set(Ewl_Embed *embed, Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (embed->last.focused && (embed->last.focused != w))
- ewl_callback_call_with_event_data(embed->last.focused,
- EWL_CALLBACK_FOCUS_OUT, w);
+ if (embed->last.focused && (embed->last.focused != w))
+ ewl_callback_call_with_event_data(embed->last.focused,
+ EWL_CALLBACK_FOCUS_OUT, w);
- embed->last.focused = w;
+ embed->last.focused = w;
- if (embed->last.focused)
- ewl_callback_call(embed->last.focused, EWL_CALLBACK_FOCUS_IN);
+ if (embed->last.focused)
+ ewl_callback_call(embed->last.focused, EWL_CALLBACK_FOCUS_IN);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1599,11 +1599,11 @@ ewl_embed_focused_widget_set(Ewl_Embed *embed, Ewl_Widget *w)
Ewl_Widget *
ewl_embed_focused_widget_get(Ewl_Embed *embed)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(embed, NULL);
- DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(embed, NULL);
+ DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, NULL);
- DRETURN_PTR(embed->last.focused, DLEVEL_STABLE);
+ DRETURN_PTR(embed->last.focused, DLEVEL_STABLE);
}
/**
@@ -1612,18 +1612,18 @@ ewl_embed_focused_widget_get(Ewl_Embed *embed)
static Ewl_Widget *
ewl_embed_info_parent_find(Ewl_Widget *w)
{
- Ewl_Widget *temp;
+ Ewl_Widget *temp;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, NULL);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, NULL);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
- for (temp = w->parent; temp; temp = temp->parent) {
- if (VISIBLE(temp) && !DISABLED(temp) && !DESTROYED(temp))
- break;
- }
+ for (temp = w->parent; temp; temp = temp->parent) {
+ if (VISIBLE(temp) && !DISABLED(temp) && !DESTROYED(temp))
+ break;
+ }
- DRETURN_PTR(temp, DLEVEL_STABLE);
+ DRETURN_PTR(temp, DLEVEL_STABLE);
}
/**
@@ -1637,40 +1637,40 @@ ewl_embed_info_parent_find(Ewl_Widget *w)
void
ewl_embed_info_widgets_cleanup(Ewl_Embed *e, Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(e, EWL_EMBED_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(e, EWL_EMBED_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_object_state_remove(EWL_OBJECT(w), EWL_FLAG_STATE_PRESSED);
+ ewl_object_state_remove(EWL_OBJECT(w), EWL_FLAG_STATE_PRESSED);
- if ((w == e->last.focused)
- || (RECURSIVE(w)
- && ewl_widget_parent_of(w, e->last.focused)))
- e->last.focused = ewl_embed_info_parent_find(w);
+ if ((w == e->last.focused)
+ || (RECURSIVE(w)
+ && ewl_widget_parent_of(w, e->last.focused)))
+ e->last.focused = ewl_embed_info_parent_find(w);
- if ((w == e->last.clicked)
- || (RECURSIVE(w)
- && ewl_widget_parent_of(w, e->last.clicked)))
- e->last.clicked = ewl_embed_info_parent_find(w);
+ if ((w == e->last.clicked)
+ || (RECURSIVE(w)
+ && ewl_widget_parent_of(w, e->last.clicked)))
+ e->last.clicked = ewl_embed_info_parent_find(w);
- if ((w == e->last.mouse_in)
- || (RECURSIVE(w)
- && ewl_widget_parent_of(w, e->last.mouse_in)))
- e->last.mouse_in = ewl_embed_info_parent_find(w);
+ if ((w == e->last.mouse_in)
+ || (RECURSIVE(w)
+ && ewl_widget_parent_of(w, e->last.mouse_in)))
+ e->last.mouse_in = ewl_embed_info_parent_find(w);
- if ((w == e->last.drop_widget)
- || (RECURSIVE(w)
- && ewl_widget_parent_of(w, e->last.drop_widget)))
- e->last.drop_widget = ewl_embed_info_parent_find(w);
+ if ((w == e->last.drop_widget)
+ || (RECURSIVE(w)
+ && ewl_widget_parent_of(w, e->last.drop_widget)))
+ e->last.drop_widget = ewl_embed_info_parent_find(w);
- if ((w == e->last.drag_widget)
- || (RECURSIVE(w)
- && ewl_widget_parent_of(w, e->last.drag_widget)))
- e->last.drag_widget = ewl_embed_info_parent_find(w);
+ if ((w == e->last.drag_widget)
+ || (RECURSIVE(w)
+ && ewl_widget_parent_of(w, e->last.drag_widget)))
+ e->last.drag_widget = ewl_embed_info_parent_find(w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1685,18 +1685,18 @@ ewl_embed_info_widgets_cleanup(Ewl_Embed *e, Ewl_Widget *w)
void
ewl_embed_coord_to_screen(Ewl_Embed *e, int xx, int yy, int *x, int *y)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_TYPE(e, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_TYPE(e, EWL_EMBED_TYPE);
- if (e->canvas) {
- if (x) *x = (int)(evas_coord_world_x_to_screen(e->canvas,
- (Evas_Coord)(xx)));
- if (y) *y = (int)(evas_coord_world_y_to_screen(e->canvas,
- (Evas_Coord)(yy)));
- }
+ if (e->canvas) {
+ if (x) *x = (int)(evas_coord_world_x_to_screen(e->canvas,
+ (Evas_Coord)(xx)));
+ if (y) *y = (int)(evas_coord_world_y_to_screen(e->canvas,
+ (Evas_Coord)(yy)));
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1710,31 +1710,31 @@ ewl_embed_coord_to_screen(Ewl_Embed *e, int xx, int yy, int *x, int *y)
void
ewl_embed_mouse_cursor_set(Ewl_Widget *w)
{
- int pointer = 0;
- Ewl_Cursor *argb;
- Ewl_Embed *embed;
+ int pointer = 0;
+ Ewl_Cursor *argb;
+ Ewl_Embed *embed;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- embed = ewl_embed_widget_find(w);
- if (!embed) DRETURN(DLEVEL_STABLE);
+ embed = ewl_embed_widget_find(w);
+ if (!embed) DRETURN(DLEVEL_STABLE);
- if ((argb = ewl_attach_get(w, EWL_ATTACH_TYPE_MOUSE_ARGB_CURSOR))) {
- pointer = argb->handle;
- ewl_attach_mouse_cursor_set(w, pointer);
- }
+ if ((argb = ewl_attach_get(w, EWL_ATTACH_TYPE_MOUSE_ARGB_CURSOR))) {
+ pointer = argb->handle;
+ ewl_attach_mouse_cursor_set(w, pointer);
+ }
- if (!pointer) {
- if (!(pointer = (int)ewl_attach_get(w,
- EWL_ATTACH_TYPE_MOUSE_CURSOR)))
- pointer = EWL_MOUSE_CURSOR_LEFT_PTR;
- }
- ewl_engine_pointer_set(embed, pointer);
- embed->cursor = pointer;
+ if (!pointer) {
+ if (!(pointer = (int)ewl_attach_get(w,
+ EWL_ATTACH_TYPE_MOUSE_CURSOR)))
+ pointer = EWL_MOUSE_CURSOR_LEFT_PTR;
+ }
+ ewl_engine_pointer_set(embed, pointer);
+ embed->cursor = pointer;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1749,17 +1749,17 @@ ewl_embed_mouse_cursor_set(Ewl_Widget *w)
void
ewl_embed_position_get(Ewl_Embed *e, int *x, int *y)
{
- int sx, sy;
+ int sx, sy;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_TYPE(e, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_TYPE(e, EWL_EMBED_TYPE);
- evas_object_geometry_get(e->smart, &sx, &sy, NULL, NULL);
- if (x) *x = e->x + sx;
- if (y) *y = e->y + sy;
+ evas_object_geometry_get(e->smart, &sx, &sy, NULL, NULL);
+ if (x) *x = e->x + sx;
+ if (y) *y = e->y + sy;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1774,14 +1774,14 @@ ewl_embed_position_get(Ewl_Embed *e, int *x, int *y)
void
ewl_embed_window_position_get(Ewl_Embed *e, int *x, int *y)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_TYPE(e, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_TYPE(e, EWL_EMBED_TYPE);
- if (x) *x = e->x;
- if (y) *y = e->y;
+ if (x) *x = e->x;
+ if (y) *y = e->y;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1796,13 +1796,13 @@ ewl_embed_window_position_get(Ewl_Embed *e, int *x, int *y)
void
ewl_embed_desktop_size_get(Ewl_Embed *e, int *w, int *h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_TYPE(e, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_TYPE(e, EWL_EMBED_TYPE);
- ewl_engine_desktop_size_get(e, w, h);
+ ewl_engine_desktop_size_get(e, w, h);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1813,17 +1813,17 @@ ewl_embed_desktop_size_get(Ewl_Embed *e, int *w, int *h)
void
ewl_embed_freeze(Ewl_Embed *e)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_TYPE(e, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_TYPE(e, EWL_EMBED_TYPE);
- /*
- * Global freeze on theme events while theme's are being manipulated.
- */
- ewl_engine_theme_freeze(e);
- ewl_engine_canvas_freeze(e);
+ /*
+ * Global freeze on theme events while theme's are being manipulated.
+ */
+ ewl_engine_theme_freeze(e);
+ ewl_engine_canvas_freeze(e);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1834,17 +1834,17 @@ ewl_embed_freeze(Ewl_Embed *e)
void
ewl_embed_thaw(Ewl_Embed *e)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_TYPE(e, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_TYPE(e, EWL_EMBED_TYPE);
- /*
- * Thaw the theme and canvas for this embed.
- */
- ewl_engine_theme_thaw(e);
- ewl_engine_canvas_thaw(e);
+ /*
+ * Thaw the theme and canvas for this embed.
+ */
+ ewl_engine_theme_thaw(e);
+ ewl_engine_canvas_thaw(e);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1857,67 +1857,67 @@ ewl_embed_thaw(Ewl_Embed *e)
*/
void
ewl_embed_cb_realize(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
-{
- Ewl_Embed *emb;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_EMBED_TYPE);
-
- emb = EWL_EMBED(w);
-
- ewl_embed_freeze(emb);
-
- if (!emb->ev_clip) {
- /*
- * first try to get the ev_clip from the cach
- */
- emb->ev_clip = ewl_embed_object_request(emb, "rectangle");
- if (!emb->ev_clip)
- emb->ev_clip = evas_object_rectangle_add(emb->canvas);
-
- evas_object_color_set(emb->ev_clip, 0, 0, 0, 0);
- evas_object_smart_member_add(emb->ev_clip, emb->smart);
- evas_object_show(emb->ev_clip);
- }
-
- if (emb->smart) {
- evas_object_focus_set(emb->smart, emb->focus);
- /*
- * Catch mouse events processed through the evas
- */
- evas_object_event_callback_add(emb->smart,
- EVAS_CALLBACK_MOUSE_OUT,
- ewl_embed_evas_cb_mouse_out, emb);
- evas_object_event_callback_add(emb->smart,
- EVAS_CALLBACK_MOUSE_DOWN,
- ewl_embed_evas_cb_mouse_down, emb);
- evas_object_event_callback_add(emb->smart,
- EVAS_CALLBACK_MOUSE_UP,
- ewl_embed_evas_cb_mouse_up, emb);
- evas_object_event_callback_add(emb->smart,
- EVAS_CALLBACK_MOUSE_MOVE,
- ewl_embed_evas_cb_mouse_move, emb);
- evas_object_event_callback_add(emb->smart,
- EVAS_CALLBACK_MOUSE_WHEEL,
- ewl_embed_evas_cb_mouse_wheel, emb);
-
- /*
- * Catch key events processed through the evas
- */
- evas_object_event_callback_add(emb->smart,
- EVAS_CALLBACK_KEY_DOWN,
- ewl_embed_evas_cb_key_down, emb);
- evas_object_event_callback_add(emb->smart,
- EVAS_CALLBACK_KEY_UP, ewl_embed_evas_cb_key_up,
- emb);
- }
-
- if (emb->dnd_count)
- ewl_engine_embed_dnd_aware_set(emb);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ void *user_data __UNUSED__)
+{
+ Ewl_Embed *emb;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_EMBED_TYPE);
+
+ emb = EWL_EMBED(w);
+
+ ewl_embed_freeze(emb);
+
+ if (!emb->ev_clip) {
+ /*
+ * first try to get the ev_clip from the cach
+ */
+ emb->ev_clip = ewl_embed_object_request(emb, "rectangle");
+ if (!emb->ev_clip)
+ emb->ev_clip = evas_object_rectangle_add(emb->canvas);
+
+ evas_object_color_set(emb->ev_clip, 0, 0, 0, 0);
+ evas_object_smart_member_add(emb->ev_clip, emb->smart);
+ evas_object_show(emb->ev_clip);
+ }
+
+ if (emb->smart) {
+ evas_object_focus_set(emb->smart, emb->focus);
+ /*
+ * Catch mouse events processed through the evas
+ */
+ evas_object_event_callback_add(emb->smart,
+ EVAS_CALLBACK_MOUSE_OUT,
+ ewl_embed_evas_cb_mouse_out, emb);
+ evas_object_event_callback_add(emb->smart,
+ EVAS_CALLBACK_MOUSE_DOWN,
+ ewl_embed_evas_cb_mouse_down, emb);
+ evas_object_event_callback_add(emb->smart,
+ EVAS_CALLBACK_MOUSE_UP,
+ ewl_embed_evas_cb_mouse_up, emb);
+ evas_object_event_callback_add(emb->smart,
+ EVAS_CALLBACK_MOUSE_MOVE,
+ ewl_embed_evas_cb_mouse_move, emb);
+ evas_object_event_callback_add(emb->smart,
+ EVAS_CALLBACK_MOUSE_WHEEL,
+ ewl_embed_evas_cb_mouse_wheel, emb);
+
+ /*
+ * Catch key events processed through the evas
+ */
+ evas_object_event_callback_add(emb->smart,
+ EVAS_CALLBACK_KEY_DOWN,
+ ewl_embed_evas_cb_key_down, emb);
+ evas_object_event_callback_add(emb->smart,
+ EVAS_CALLBACK_KEY_UP, ewl_embed_evas_cb_key_up,
+ emb);
+ }
+
+ if (emb->dnd_count)
+ ewl_engine_embed_dnd_aware_set(emb);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1930,27 +1930,27 @@ ewl_embed_cb_realize(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_embed_cb_unrealize(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Embed *emb;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_EMBED_TYPE);
- emb = EWL_EMBED(w);
- if (emb->ev_clip) {
- ewl_canvas_object_destroy(emb->ev_clip);
- emb->ev_clip = NULL;
- }
+ emb = EWL_EMBED(w);
+ if (emb->ev_clip) {
+ ewl_canvas_object_destroy(emb->ev_clip);
+ emb->ev_clip = NULL;
+ }
- if (emb->smart) {
- evas_object_smart_data_set(emb->smart, NULL);
- ewl_canvas_object_destroy(emb->smart);
- emb->smart = NULL;
- }
+ if (emb->smart) {
+ evas_object_smart_data_set(emb->smart, NULL);
+ ewl_canvas_object_destroy(emb->smart);
+ emb->smart = NULL;
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1963,23 +1963,23 @@ ewl_embed_cb_unrealize(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_embed_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Embed *emb;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_EMBED_TYPE);
- emb = EWL_EMBED(w);
- if (emb->ev_clip) {
- evas_object_move(emb->ev_clip, (Evas_Coord)(CURRENT_X(w)),
- (Evas_Coord)(CURRENT_Y(w)));
- evas_object_resize(emb->ev_clip, (Evas_Coord)(CURRENT_W(w)),
- (Evas_Coord)(CURRENT_H(w)));
- }
+ emb = EWL_EMBED(w);
+ if (emb->ev_clip) {
+ evas_object_move(emb->ev_clip, (Evas_Coord)(CURRENT_X(w)),
+ (Evas_Coord)(CURRENT_Y(w)));
+ evas_object_resize(emb->ev_clip, (Evas_Coord)(CURRENT_W(w)),
+ (Evas_Coord)(CURRENT_H(w)));
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1992,23 +1992,23 @@ ewl_embed_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_embed_cb_focus_out(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Embed *emb;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_EMBED_TYPE);
- emb = EWL_EMBED(w);
- if (!emb->last.focused)
- DRETURN(DLEVEL_STABLE);
+ emb = EWL_EMBED(w);
+ if (!emb->last.focused)
+ DRETURN(DLEVEL_STABLE);
- if (ewl_object_state_has(EWL_OBJECT(emb->last.focused),
- EWL_FLAG_STATE_PRESSED))
- ewl_embed_mouse_up_feed(emb, 1, 0, 0, ewl_ev_modifiers_get());
+ if (ewl_object_state_has(EWL_OBJECT(emb->last.focused),
+ EWL_FLAG_STATE_PRESSED))
+ ewl_embed_mouse_up_feed(emb, 1, 0, 0, ewl_ev_modifiers_get());
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2020,27 +2020,27 @@ ewl_embed_cb_focus_out(Ewl_Widget *w, void *ev_data __UNUSED__,
* @brief The destroy callback
*/
void ewl_embed_cb_destroy(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Embed *emb;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_EMBED_TYPE);
- emb = EWL_EMBED(w);
- if (ecore_list_goto(ewl_embed_list, w))
- ecore_list_remove(ewl_embed_list);
+ emb = EWL_EMBED(w);
+ if (ecore_list_goto(ewl_embed_list, w))
+ ecore_list_remove(ewl_embed_list);
- ewl_embed_cache_cleanup(emb);
+ ewl_embed_cache_cleanup(emb);
- ecore_dlist_destroy(emb->tab_order);
- emb->tab_order = NULL;
+ ecore_dlist_destroy(emb->tab_order);
+ emb->tab_order = NULL;
- if (emb == ewl_embed_active_embed)
- ewl_embed_active_embed = NULL;
+ if (emb == ewl_embed_active_embed)
+ ewl_embed_active_embed = NULL;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2051,15 +2051,15 @@ void ewl_embed_cb_destroy(Ewl_Widget *w, void *ev_data __UNUSED__,
void
ewl_embed_dnd_aware_set(Ewl_Embed *embed)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- if (REALIZED(embed) && (embed->dnd_count == 0))
- ewl_engine_embed_dnd_aware_set(embed);
- embed->dnd_count++;
+ if (REALIZED(embed) && (embed->dnd_count == 0))
+ ewl_engine_embed_dnd_aware_set(embed);
+ embed->dnd_count++;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2070,16 +2070,16 @@ ewl_embed_dnd_aware_set(Ewl_Embed *embed)
void
ewl_embed_dnd_aware_remove(Ewl_Embed *embed)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- /* FIXME: Need to remove the XdndAware property on refcount == 0
- if (REALIZED(embed) && (embed->dnd_count == 0))
- ewl_engine_embed_dnd_aware_set(embed); */
- embed->dnd_count--;
+ /* FIXME: Need to remove the XdndAware property on refcount == 0
+ if (REALIZED(embed) && (embed->dnd_count == 0))
+ ewl_engine_embed_dnd_aware_set(embed); */
+ embed->dnd_count--;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2093,13 +2093,13 @@ ewl_embed_dnd_aware_remove(Ewl_Embed *embed)
void
ewl_embed_selection_text_set(Ewl_Embed *emb, const char *txt)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(emb);
- DCHECK_TYPE(emb, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(emb);
+ DCHECK_TYPE(emb, EWL_EMBED_TYPE);
- ewl_engine_embed_selection_text_set(emb, txt);
+ ewl_engine_embed_selection_text_set(emb, txt);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2110,328 +2110,328 @@ ewl_embed_selection_text_set(Ewl_Embed *emb, const char *txt)
void
ewl_embed_cache_cleanup(Ewl_Embed *emb)
{
- Ecore_List *key_list;
+ Ecore_List *key_list;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(emb);
- DCHECK_TYPE(emb, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(emb);
+ DCHECK_TYPE(emb, EWL_EMBED_TYPE);
- if (!emb->obj_cache) DRETURN(DLEVEL_STABLE);
+ if (!emb->obj_cache) DRETURN(DLEVEL_STABLE);
- key_list = ecore_hash_keys(emb->obj_cache);
- if (key_list) {
- char *key;
- Evas_Object *obj;
- Ecore_List *obj_list;
+ key_list = ecore_hash_keys(emb->obj_cache);
+ if (key_list) {
+ char *key;
+ Evas_Object *obj;
+ Ecore_List *obj_list;
- /*
- * Iterate over all object types destroying them as we go. No
- * need to free the key string.
- */
- while ((key = ecore_list_first_remove(key_list))) {
- /*
- * Now queue all objects for destruction.
- */
- obj_list = ecore_hash_remove(emb->obj_cache, key);
- while ((obj = ecore_list_first_remove(obj_list)))
- ewl_canvas_object_destroy(obj);
+ /*
+ * Iterate over all object types destroying them as we go. No
+ * need to free the key string.
+ */
+ while ((key = ecore_list_first_remove(key_list))) {
+ /*
+ * Now queue all objects for destruction.
+ */
+ obj_list = ecore_hash_remove(emb->obj_cache, key);
+ while ((obj = ecore_list_first_remove(obj_list)))
+ ewl_canvas_object_destroy(obj);
- IF_FREE_LIST(obj_list);
- }
- IF_FREE_LIST(key_list);
- }
- IF_FREE_HASH(emb->obj_cache);
+ IF_FREE_LIST(obj_list);
+ }
+ IF_FREE_LIST(key_list);
+ }
+ IF_FREE_HASH(emb->obj_cache);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_embed_smart_cb_del(Evas_Object *obj)
{
- Ewl_Embed *emb;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(obj);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(obj);
- emb = evas_object_smart_data_get(obj);
- if (emb) {
- emb->smart = NULL;
- ewl_widget_unrealize(EWL_WIDGET(emb));
- }
+ emb = evas_object_smart_data_get(obj);
+ if (emb) {
+ emb->smart = NULL;
+ ewl_widget_unrealize(EWL_WIDGET(emb));
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_embed_smart_cb_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
{
- Ewl_Embed *emb;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(obj);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(obj);
- emb = evas_object_smart_data_get(obj);
- if (emb)
- ewl_object_position_request(EWL_OBJECT(emb),
- (int)(x), (int)(y));
+ emb = evas_object_smart_data_get(obj);
+ if (emb)
+ ewl_object_position_request(EWL_OBJECT(emb),
+ (int)(x), (int)(y));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_embed_smart_cb_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
{
- Ewl_Embed *emb;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(obj);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(obj);
- emb = evas_object_smart_data_get(obj);
- if (emb)
- ewl_object_size_request(EWL_OBJECT(emb), (int)(w), (int)(h));
+ emb = evas_object_smart_data_get(obj);
+ if (emb)
+ ewl_object_size_request(EWL_OBJECT(emb), (int)(w), (int)(h));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_embed_smart_cb_show(Evas_Object *obj)
{
- Ewl_Embed *emb;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(obj);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(obj);
- emb = evas_object_smart_data_get(obj);
- if (emb) ewl_widget_show(EWL_WIDGET(emb));
+ emb = evas_object_smart_data_get(obj);
+ if (emb) ewl_widget_show(EWL_WIDGET(emb));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_embed_smart_cb_hide(Evas_Object *obj)
{
- Ewl_Embed *emb;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(obj);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(obj);
- emb = evas_object_smart_data_get(obj);
- if (emb) ewl_widget_hide(EWL_WIDGET(emb));
+ emb = evas_object_smart_data_get(obj);
+ if (emb) ewl_widget_hide(EWL_WIDGET(emb));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_embed_smart_cb_clip_set(Evas_Object *obj, Evas_Object *clip)
{
- Ewl_Embed *emb;
- Ewl_Widget *w;
+ Ewl_Embed *emb;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(obj);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(obj);
- emb = evas_object_smart_data_get(obj);
- w = EWL_WIDGET(emb);
- if (emb && w->fx_clip_box && (clip != w->fx_clip_box))
- evas_object_clip_set(w->fx_clip_box, clip);
+ emb = evas_object_smart_data_get(obj);
+ w = EWL_WIDGET(emb);
+ if (emb && w->fx_clip_box && (clip != w->fx_clip_box))
+ evas_object_clip_set(w->fx_clip_box, clip);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_embed_smart_cb_clip_unset(Evas_Object *obj)
{
- Ewl_Embed *emb;
- Ewl_Widget *w;
+ Ewl_Embed *emb;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(obj);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(obj);
- emb = evas_object_smart_data_get(obj);
- w = EWL_WIDGET(emb);
- if (emb && w->fx_clip_box)
- evas_object_clip_unset(w->fx_clip_box);
+ emb = evas_object_smart_data_get(obj);
+ w = EWL_WIDGET(emb);
+ if (emb && w->fx_clip_box)
+ evas_object_clip_unset(w->fx_clip_box);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_embed_evas_cb_mouse_out(void *data, Evas *e __UNUSED__,
- Evas_Object *obj __UNUSED__, void *event_info)
+ Evas_Object *obj __UNUSED__, void *event_info)
{
- Ewl_Embed *embed;
- Evas_Event_Mouse_Out *ev = event_info;
+ Ewl_Embed *embed;
+ Evas_Event_Mouse_Out *ev = event_info;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_EMBED_TYPE);
- embed = data;
+ embed = data;
- if (ev->canvas.x < CURRENT_X(embed)
- || ev->canvas.x >= (CURRENT_X(embed) + CURRENT_W(embed))
- || ev->canvas.y < CURRENT_Y(embed)
- || ev->canvas.y >= (CURRENT_Y(embed) + CURRENT_H(embed)))
- ewl_embed_mouse_out_feed(embed, ev->canvas.x, ev->canvas.y,
- ewl_ev_modifiers_get());
+ if (ev->canvas.x < CURRENT_X(embed)
+ || ev->canvas.x >= (CURRENT_X(embed) + CURRENT_W(embed))
+ || ev->canvas.y < CURRENT_Y(embed)
+ || ev->canvas.y >= (CURRENT_Y(embed) + CURRENT_H(embed)))
+ ewl_embed_mouse_out_feed(embed, ev->canvas.x, ev->canvas.y,
+ ewl_ev_modifiers_get());
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_embed_evas_cb_mouse_down(void *data, Evas *e __UNUSED__,
- Evas_Object *obj __UNUSED__, void *event_info)
+ Evas_Object *obj __UNUSED__, void *event_info)
{
- Ewl_Embed *embed;
- Evas_Event_Mouse_Down *ev;
+ Ewl_Embed *embed;
+ Evas_Event_Mouse_Down *ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_EMBED_TYPE);
- ev = event_info;
- embed = data;
- ewl_embed_mouse_down_feed(embed, ev->button, 1, ev->canvas.x,
- ev->canvas.y, ewl_ev_modifiers_get());
+ ev = event_info;
+ embed = data;
+ ewl_embed_mouse_down_feed(embed, ev->button, 1, ev->canvas.x,
+ ev->canvas.y, ewl_ev_modifiers_get());
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_embed_evas_cb_mouse_up(void *data, Evas *e __UNUSED__,
- Evas_Object *obj __UNUSED__, void *event_info)
+ Evas_Object *obj __UNUSED__, void *event_info)
{
- Ewl_Embed *embed;
- Evas_Event_Mouse_Up *ev;
+ Ewl_Embed *embed;
+ Evas_Event_Mouse_Up *ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_EMBED_TYPE);
- ev = event_info;
- embed = data;
- ewl_embed_mouse_up_feed(embed, ev->button, ev->canvas.x,
- ev->canvas.y, ewl_ev_modifiers_get());
+ ev = event_info;
+ embed = data;
+ ewl_embed_mouse_up_feed(embed, ev->button, ev->canvas.x,
+ ev->canvas.y, ewl_ev_modifiers_get());
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_embed_evas_cb_mouse_move(void *data, Evas *e __UNUSED__,
- Evas_Object *obj __UNUSED__, void *event_info)
+ Evas_Object *obj __UNUSED__, void *event_info)
{
- Ewl_Embed *embed;
- Evas_Event_Mouse_Move *ev;
+ Ewl_Embed *embed;
+ Evas_Event_Mouse_Move *ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_EMBED_TYPE);
- ev = event_info;
- embed = data;
- ewl_embed_mouse_move_feed(embed, ev->cur.canvas.x, ev->cur.canvas.y,
- ewl_ev_modifiers_get());
+ ev = event_info;
+ embed = data;
+ ewl_embed_mouse_move_feed(embed, ev->cur.canvas.x, ev->cur.canvas.y,
+ ewl_ev_modifiers_get());
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_embed_evas_cb_mouse_wheel(void *data, Evas *e __UNUSED__,
- Evas_Object *obj __UNUSED__,
- void *event_info)
+ Evas_Object *obj __UNUSED__,
+ void *event_info)
{
- Ewl_Embed *embed;
- Evas_Event_Mouse_Wheel *ev;
+ Ewl_Embed *embed;
+ Evas_Event_Mouse_Wheel *ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_EMBED_TYPE);
- ev = event_info;
- embed = data;
+ ev = event_info;
+ embed = data;
- ewl_embed_mouse_wheel_feed(embed, ev->canvas.x, ev->canvas.y, ev->z,
- ev->direction, ewl_ev_modifiers_get());
+ ewl_embed_mouse_wheel_feed(embed, ev->canvas.x, ev->canvas.y, ev->z,
+ ev->direction, ewl_ev_modifiers_get());
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_embed_evas_cb_key_down(void *data, Evas *e __UNUSED__,
- Evas_Object *obj __UNUSED__, void *event_info)
+ Evas_Object *obj __UNUSED__, void *event_info)
{
- Ewl_Embed *embed;
- Evas_Event_Key_Down *ev;
- unsigned int key_modifiers = 0;
+ Ewl_Embed *embed;
+ Evas_Event_Key_Down *ev;
+ unsigned int key_modifiers = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_EMBED_TYPE);
- ev = event_info;
- embed = data;
+ ev = event_info;
+ embed = data;
- if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
- key_modifiers |= EWL_KEY_MODIFIER_SHIFT;
- else if (evas_key_modifier_is_set(ev->modifiers, "Alt"))
- key_modifiers |= EWL_KEY_MODIFIER_ALT;
- else if (evas_key_modifier_is_set(ev->modifiers, "Control"))
- key_modifiers |= EWL_KEY_MODIFIER_CTRL;
- else if (evas_key_modifier_is_set(ev->modifiers, "Meta"))
- key_modifiers |= EWL_KEY_MODIFIER_MOD;
- else if (evas_key_modifier_is_set(ev->modifiers, "Super"))
- key_modifiers |= EWL_KEY_MODIFIER_WIN;
- else if (evas_key_modifier_is_set(ev->modifiers, "Hyper"))
- key_modifiers |= EWL_KEY_MODIFIER_WIN;
+ if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
+ key_modifiers |= EWL_KEY_MODIFIER_SHIFT;
+ else if (evas_key_modifier_is_set(ev->modifiers, "Alt"))
+ key_modifiers |= EWL_KEY_MODIFIER_ALT;
+ else if (evas_key_modifier_is_set(ev->modifiers, "Control"))
+ key_modifiers |= EWL_KEY_MODIFIER_CTRL;
+ else if (evas_key_modifier_is_set(ev->modifiers, "Meta"))
+ key_modifiers |= EWL_KEY_MODIFIER_MOD;
+ else if (evas_key_modifier_is_set(ev->modifiers, "Super"))
+ key_modifiers |= EWL_KEY_MODIFIER_WIN;
+ else if (evas_key_modifier_is_set(ev->modifiers, "Hyper"))
+ key_modifiers |= EWL_KEY_MODIFIER_WIN;
- ewl_ev_modifiers_set(key_modifiers);
+ ewl_ev_modifiers_set(key_modifiers);
- if (!ev->string || iscntrl(*ev->string))
- ewl_embed_key_down_feed(embed, ev->keyname,
- ewl_ev_modifiers_get());
- else
- ewl_embed_key_down_feed(embed, ev->string,
- ewl_ev_modifiers_get());
+ if (!ev->string || iscntrl(*ev->string))
+ ewl_embed_key_down_feed(embed, ev->keyname,
+ ewl_ev_modifiers_get());
+ else
+ ewl_embed_key_down_feed(embed, ev->string,
+ ewl_ev_modifiers_get());
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_embed_evas_cb_key_up(void *data, Evas *e __UNUSED__,
- Evas_Object *obj __UNUSED__, void *event_info)
-{
- Ewl_Embed *embed;
- Evas_Event_Key_Down *ev = event_info;
- unsigned int key_modifiers = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_EMBED_TYPE);
-
- embed = data;
- key_modifiers = ewl_ev_modifiers_get();
- if (!evas_key_modifier_is_set(ev->modifiers, "Shift"))
- key_modifiers &= ~EWL_KEY_MODIFIER_SHIFT;
- else if (!evas_key_modifier_is_set(ev->modifiers, "Alt"))
- key_modifiers &= ~EWL_KEY_MODIFIER_ALT;
- else if (!evas_key_modifier_is_set(ev->modifiers, "Control"))
- key_modifiers &= ~EWL_KEY_MODIFIER_CTRL;
- else if (!evas_key_modifier_is_set(ev->modifiers, "Meta"))
- key_modifiers &= ~EWL_KEY_MODIFIER_MOD;
- else if (!evas_key_modifier_is_set(ev->modifiers, "Super"))
- key_modifiers &= ~EWL_KEY_MODIFIER_WIN;
- else if (!evas_key_modifier_is_set(ev->modifiers, "Hyper"))
- key_modifiers &= ~EWL_KEY_MODIFIER_WIN;
-
- ewl_ev_modifiers_set(key_modifiers);
-
- if (!ev->string || iscntrl(*ev->string))
- ewl_embed_key_up_feed(embed, ev->keyname,
- ewl_ev_modifiers_get());
- else
- ewl_embed_key_up_feed(embed, ev->string,
- ewl_ev_modifiers_get());
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Evas_Object *obj __UNUSED__, void *event_info)
+{
+ Ewl_Embed *embed;
+ Evas_Event_Key_Down *ev = event_info;
+ unsigned int key_modifiers = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_EMBED_TYPE);
+
+ embed = data;
+ key_modifiers = ewl_ev_modifiers_get();
+ if (!evas_key_modifier_is_set(ev->modifiers, "Shift"))
+ key_modifiers &= ~EWL_KEY_MODIFIER_SHIFT;
+ else if (!evas_key_modifier_is_set(ev->modifiers, "Alt"))
+ key_modifiers &= ~EWL_KEY_MODIFIER_ALT;
+ else if (!evas_key_modifier_is_set(ev->modifiers, "Control"))
+ key_modifiers &= ~EWL_KEY_MODIFIER_CTRL;
+ else if (!evas_key_modifier_is_set(ev->modifiers, "Meta"))
+ key_modifiers &= ~EWL_KEY_MODIFIER_MOD;
+ else if (!evas_key_modifier_is_set(ev->modifiers, "Super"))
+ key_modifiers &= ~EWL_KEY_MODIFIER_WIN;
+ else if (!evas_key_modifier_is_set(ev->modifiers, "Hyper"))
+ key_modifiers &= ~EWL_KEY_MODIFIER_WIN;
+
+ ewl_ev_modifiers_set(key_modifiers);
+
+ if (!ev->string || iscntrl(*ev->string))
+ ewl_embed_key_up_feed(embed, ev->keyname,
+ ewl_ev_modifiers_get());
+ else
+ ewl_embed_key_up_feed(embed, ev->string,
+ ewl_ev_modifiers_get());
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_embed.h b/src/lib/ewl_embed.h
index 6009da0..21313e3 100644
--- a/src/lib/ewl_embed.h
+++ b/src/lib/ewl_embed.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_EMBED_H
#define EWL_EMBED_H
@@ -61,121 +61,121 @@ typedef void *Ewl_Embed_Window;
*/
struct Ewl_Embed
{
- Ewl_Cell cell; /**< Inherits from the Ewl_Cell class */
+ Ewl_Cell cell; /**< Inherits from the Ewl_Cell class */
- const char *engine_name; /**< Name of current engine used */
- void *engine; /**< The display engine */
+ const char *engine_name; /**< Name of current engine used */
+ void *engine; /**< The display engine */
- void *canvas; /**< Canvas where drawing takes place. */
- void *canvas_window; /**< The window holding the canvas. */
- int cursor; /**< Id for current cursor in use */
+ void *canvas; /**< Canvas where drawing takes place. */
+ void *canvas_window; /**< The window holding the canvas. */
+ int cursor; /**< Id for current cursor in use */
- void *smart; /**< Manipulate Ewl_Embed from canvas */
- void *ev_clip; /**< Clip box to receive canvas events */
- Ecore_DList *tab_order; /**< Order of widgets to send focus */
+ void *smart; /**< Manipulate Ewl_Embed from canvas */
+ void *ev_clip; /**< Clip box to receive canvas events */
+ Ecore_DList *tab_order; /**< Order of widgets to send focus */
- Ecore_Hash *obj_cache; /**< Hash of object queues for reuse */
+ Ecore_Hash *obj_cache; /**< Hash of object queues for reuse */
- struct
- {
- Ewl_Widget *clicked; /**< Last clicked widget */
- Ewl_Widget *focused; /**< Last focused widget */
- Ewl_Widget *mouse_in; /**< Last widget to receive a mouse_in */
- Ewl_Widget *drop_widget; /**< The current DND drop target */
- Ewl_Widget *drag_widget; /**< The current DND drag source */
- } last; /**< Collection of widgets to last receive events */
+ struct
+ {
+ Ewl_Widget *clicked; /**< Last clicked widget */
+ Ewl_Widget *focused; /**< Last focused widget */
+ Ewl_Widget *mouse_in; /**< Last widget to receive a mouse_in */
+ Ewl_Widget *drop_widget; /**< The current DND drop target */
+ Ewl_Widget *drag_widget; /**< The current DND drag source */
+ } last; /**< Collection of widgets to last receive events */
- int x; /**< Screen relative horizontal position of window */
- int y; /**< Screen relative vertical position of window */
+ int x; /**< Screen relative horizontal position of window */
+ int y; /**< Screen relative vertical position of window */
- int dnd_count; /**< DND aware widget count */
- int focus; /**< Indicates if it receives focus */
+ int dnd_count; /**< DND aware widget count */
+ int focus; /**< Indicates if it receives focus */
- Ewl_Dnd_Types dnd_types; /**< The dnd type */
- Ewl_Widget *dnd_last_position; /**< The last dnd position */
+ Ewl_Dnd_Types dnd_types; /**< The dnd type */
+ Ewl_Widget *dnd_last_position; /**< The last dnd position */
};
-Ewl_Widget *ewl_embed_new(void);
-int ewl_embed_init(Ewl_Embed *emb);
-int ewl_embed_engine_name_set(Ewl_Embed *embed, const char *engine);
-const char *ewl_embed_engine_name_get(Ewl_Embed *embed);
-void ewl_embed_shutdown(void);
-void *ewl_embed_canvas_set(Ewl_Embed *emb, void *canvas,
- Ewl_Embed_Window *canvas_window);
-
-void ewl_embed_focus_set(Ewl_Embed *embed, int f);
-int ewl_embed_focus_get(Ewl_Embed *embed);
-
-void ewl_embed_active_set(Ewl_Embed *embed, unsigned int act);
-Ewl_Embed *ewl_embed_active_embed_get(void);
-
-void ewl_embed_last_mouse_position_get(int *x, int *y);
-
-void ewl_embed_key_down_feed(Ewl_Embed *embed, const char *keyname,
- unsigned int modifiers);
-void ewl_embed_key_up_feed(Ewl_Embed *embed, const char *keyname,
- unsigned int modifiers);
-void ewl_embed_mouse_down_feed(Ewl_Embed *embed, int b, int clicks,
- int x, int y, unsigned int modifiers);
-void ewl_embed_mouse_up_feed(Ewl_Embed *embed, int b, int x,
- int y, unsigned int modifiers);
-void ewl_embed_mouse_move_feed(Ewl_Embed *embed, int x, int y,
- unsigned int modifiers);
-
-const char *ewl_embed_dnd_position_feed(Ewl_Embed *embed, int x, int y,
- int *, int *, int *, int *);
-const char *ewl_embed_dnd_drop_feed(Ewl_Embed* embed, int x, int y,
- int internal);
-void ewl_embed_dnd_data_received_feed(Ewl_Embed* embed, char *type,
- void *data,
- unsigned int len,
- unsigned int format);
-void ewl_embed_dnd_data_request_feed(Ewl_Embed* embed, void *handle,
- char *type);
-
-void ewl_embed_mouse_out_feed(Ewl_Embed *embed, int x, int y,
- unsigned int modifiers);
-void ewl_embed_mouse_wheel_feed(Ewl_Embed *embed, int x, int y,
- int z, int dir, unsigned int mods);
-
-void ewl_embed_font_path_add(char *path);
-Ewl_Embed *ewl_embed_canvas_window_find(Ewl_Embed_Window *win);
-Ewl_Embed *ewl_embed_widget_find(Ewl_Widget *w);
-void ewl_embed_object_cache(Ewl_Embed *e, void *obj);
-void *ewl_embed_object_request(Ewl_Embed *e, char *type);
-
-void ewl_embed_tab_order_append(Ewl_Embed *e, Ewl_Widget *w);
-void ewl_embed_tab_order_prepend(Ewl_Embed *e, Ewl_Widget *w);
-void ewl_embed_tab_order_insert(Ewl_Embed *e, Ewl_Widget *w,
- unsigned int idx);
-void ewl_embed_tab_order_insert_before(Ewl_Embed *e, Ewl_Widget *w,
- Ewl_Widget *before);
-void ewl_embed_tab_order_insert_after(Ewl_Embed *e, Ewl_Widget *w,
- Ewl_Widget *after);
-void ewl_embed_tab_order_remove(Ewl_Embed *e, Ewl_Widget *w);
-void ewl_embed_tab_order_next(Ewl_Embed *e);
-void ewl_embed_tab_order_previous(Ewl_Embed *e);
-
-void ewl_embed_focused_widget_set(Ewl_Embed *e, Ewl_Widget *w);
-Ewl_Widget *ewl_embed_focused_widget_get(Ewl_Embed *e);
-void ewl_embed_info_widgets_cleanup(Ewl_Embed *e, Ewl_Widget *w);
-
-void ewl_embed_coord_to_screen(Ewl_Embed *e, int xx, int yy,
- int *x, int *y);
-
-void ewl_embed_mouse_cursor_set(Ewl_Widget *w);
-void ewl_embed_position_get(Ewl_Embed *e, int *x, int *y);
-void ewl_embed_window_position_get(Ewl_Embed *e, int *x, int *y);
-void ewl_embed_desktop_size_get(Ewl_Embed *e, int *w, int *y);
-void ewl_embed_freeze(Ewl_Embed *e);
-void ewl_embed_thaw(Ewl_Embed *e);
-
-void ewl_embed_dnd_aware_set(Ewl_Embed *embed);
-void ewl_embed_dnd_aware_remove(Ewl_Embed *embed);
-
-void ewl_embed_selection_text_set(Ewl_Embed *emb, const char *txt);
-
-void ewl_embed_cache_cleanup(Ewl_Embed *emb);
+Ewl_Widget *ewl_embed_new(void);
+int ewl_embed_init(Ewl_Embed *emb);
+int ewl_embed_engine_name_set(Ewl_Embed *embed, const char *engine);
+const char *ewl_embed_engine_name_get(Ewl_Embed *embed);
+void ewl_embed_shutdown(void);
+void *ewl_embed_canvas_set(Ewl_Embed *emb, void *canvas,
+ Ewl_Embed_Window *canvas_window);
+
+void ewl_embed_focus_set(Ewl_Embed *embed, int f);
+int ewl_embed_focus_get(Ewl_Embed *embed);
+
+void ewl_embed_active_set(Ewl_Embed *embed, unsigned int act);
+Ewl_Embed *ewl_embed_active_embed_get(void);
+
+void ewl_embed_last_mouse_position_get(int *x, int *y);
+
+void ewl_embed_key_down_feed(Ewl_Embed *embed, const char *keyname,
+ unsigned int modifiers);
+void ewl_embed_key_up_feed(Ewl_Embed *embed, const char *keyname,
+ unsigned int modifiers);
+void ewl_embed_mouse_down_feed(Ewl_Embed *embed, int b, int clicks,
+ int x, int y, unsigned int modifiers);
+void ewl_embed_mouse_up_feed(Ewl_Embed *embed, int b, int x,
+ int y, unsigned int modifiers);
+void ewl_embed_mouse_move_feed(Ewl_Embed *embed, int x, int y,
+ unsigned int modifiers);
+
+const char *ewl_embed_dnd_position_feed(Ewl_Embed *embed, int x, int y,
+ int *, int *, int *, int *);
+const char *ewl_embed_dnd_drop_feed(Ewl_Embed* embed, int x, int y,
+ int internal);
+void ewl_embed_dnd_data_received_feed(Ewl_Embed* embed, char *type,
+ void *data,
+ unsigned int len,
+ unsigned int format);
+void ewl_embed_dnd_data_request_feed(Ewl_Embed* embed, void *handle,
+ char *type);
+
+void ewl_embed_mouse_out_feed(Ewl_Embed *embed, int x, int y,
+ unsigned int modifiers);
+void ewl_embed_mouse_wheel_feed(Ewl_Embed *embed, int x, int y,
+ int z, int dir, unsigned int mods);
+
+void ewl_embed_font_path_add(char *path);
+Ewl_Embed *ewl_embed_canvas_window_find(Ewl_Embed_Window *win);
+Ewl_Embed *ewl_embed_widget_find(Ewl_Widget *w);
+void ewl_embed_object_cache(Ewl_Embed *e, void *obj);
+void *ewl_embed_object_request(Ewl_Embed *e, char *type);
+
+void ewl_embed_tab_order_append(Ewl_Embed *e, Ewl_Widget *w);
+void ewl_embed_tab_order_prepend(Ewl_Embed *e, Ewl_Widget *w);
+void ewl_embed_tab_order_insert(Ewl_Embed *e, Ewl_Widget *w,
+ unsigned int idx);
+void ewl_embed_tab_order_insert_before(Ewl_Embed *e, Ewl_Widget *w,
+ Ewl_Widget *before);
+void ewl_embed_tab_order_insert_after(Ewl_Embed *e, Ewl_Widget *w,
+ Ewl_Widget *after);
+void ewl_embed_tab_order_remove(Ewl_Embed *e, Ewl_Widget *w);
+void ewl_embed_tab_order_next(Ewl_Embed *e);
+void ewl_embed_tab_order_previous(Ewl_Embed *e);
+
+void ewl_embed_focused_widget_set(Ewl_Embed *e, Ewl_Widget *w);
+Ewl_Widget *ewl_embed_focused_widget_get(Ewl_Embed *e);
+void ewl_embed_info_widgets_cleanup(Ewl_Embed *e, Ewl_Widget *w);
+
+void ewl_embed_coord_to_screen(Ewl_Embed *e, int xx, int yy,
+ int *x, int *y);
+
+void ewl_embed_mouse_cursor_set(Ewl_Widget *w);
+void ewl_embed_position_get(Ewl_Embed *e, int *x, int *y);
+void ewl_embed_window_position_get(Ewl_Embed *e, int *x, int *y);
+void ewl_embed_desktop_size_get(Ewl_Embed *e, int *w, int *y);
+void ewl_embed_freeze(Ewl_Embed *e);
+void ewl_embed_thaw(Ewl_Embed *e);
+
+void ewl_embed_dnd_aware_set(Ewl_Embed *embed);
+void ewl_embed_dnd_aware_remove(Ewl_Embed *embed);
+
+void ewl_embed_selection_text_set(Ewl_Embed *emb, const char *txt);
+
+void ewl_embed_cache_cleanup(Ewl_Embed *emb);
/*
* Internally used callbacks, override at your own risk.
diff --git a/src/lib/ewl_engines.c b/src/lib/ewl_engines.c
index 487cfc5..a401f72 100644
--- a/src/lib/ewl_engines.c
+++ b/src/lib/ewl_engines.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_private.h"
#include "ewl_macros.h"
@@ -14,10 +14,10 @@
enum Ewl_Engine_Hook_Type
{
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_HOOK_TYPE_CANVAS,
- EWL_ENGINE_HOOK_TYPE_THEME,
- EWL_ENGINE_HOOK_TYPE_POINTER
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_HOOK_TYPE_CANVAS,
+ EWL_ENGINE_HOOK_TYPE_THEME,
+ EWL_ENGINE_HOOK_TYPE_POINTER
};
typedef enum Ewl_Engine_Hook_Type Ewl_Engine_Hook_Type;
@@ -27,7 +27,7 @@ static Ecore_Hash *ewl_engines = NULL;
static void ewl_engine_free(Ewl_Engine *engine);
static void **ewl_engine_hooks_get(Ewl_Engine *engine, Ewl_Engine_Hook_Type type);
static void *ewl_engine_hook_get(Ewl_Embed *embed,
- Ewl_Engine_Hook_Type type, int hook);
+ Ewl_Engine_Hook_Type type, int hook);
/**
* @return Returns no value
@@ -36,16 +36,16 @@ static void *ewl_engine_hook_get(Ewl_Embed *embed,
int
ewl_engines_init(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ewl_engines = ecore_hash_new(ecore_str_hash, ecore_str_compare);
- if (!ewl_engines)
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ ewl_engines = ecore_hash_new(ecore_str_hash, ecore_str_compare);
+ if (!ewl_engines)
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ecore_hash_free_key_cb_set(ewl_engines, ECORE_FREE_CB(free));
- ecore_hash_free_value_cb_set(ewl_engines, ECORE_FREE_CB(ewl_engine_free));
+ ecore_hash_free_key_cb_set(ewl_engines, ECORE_FREE_CB(free));
+ ecore_hash_free_value_cb_set(ewl_engines, ECORE_FREE_CB(ewl_engine_free));
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -55,16 +55,16 @@ ewl_engines_init(void)
void
ewl_engines_shutdown(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- IF_FREE_HASH(ewl_engines);
- if (ewl_engines_path)
- {
- ecore_path_group_del(ewl_engines_path);
- ewl_engines_path = 0;
- }
+ IF_FREE_HASH(ewl_engines);
+ if (ewl_engines_path)
+ {
+ ecore_path_group_del(ewl_engines_path);
+ ewl_engines_path = 0;
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -74,44 +74,44 @@ ewl_engines_shutdown(void)
Ecore_List *
ewl_engine_names_get(void)
{
- char dir[PATH_MAX], *file;
- Ecore_List *files, *names;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- snprintf(dir, sizeof(dir), "%s/ewl/%s", PACKAGE_LIB_DIR,
- EWL_ENGINE_DIR);
- if (!ecore_file_exists(dir))
- DRETURN_PTR(NULL, DLEVEL_STABLE);
-
- files = ecore_file_ls(dir);
- if (!files || (ecore_list_count(files) == 0))
- DRETURN_PTR(NULL, DLEVEL_STABLE);
-
- names = ecore_list_new();
- if (!names)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- ecore_list_free_cb_set(names, ECORE_FREE_CB(free));
-
- ecore_list_first_goto(files);
- while ((file = ecore_list_next(files)))
- {
- char *ext;
-
- ext = strchr(file, '.');
- if (ext)
- {
- char *lastext;
- lastext = strrchr(file, '.');
- if (!strncmp(lastext, EWL_ENGINE_EXT, strlen(EWL_ENGINE_EXT)) && ext == lastext) {
- *ext = '\0';
- ecore_list_append(names, strdup(file));
- }
- }
- }
- IF_FREE_LIST(files);
-
- DRETURN_PTR(names, DLEVEL_STABLE);
+ char dir[PATH_MAX], *file;
+ Ecore_List *files, *names;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ snprintf(dir, sizeof(dir), "%s/ewl/%s", PACKAGE_LIB_DIR,
+ EWL_ENGINE_DIR);
+ if (!ecore_file_exists(dir))
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+
+ files = ecore_file_ls(dir);
+ if (!files || (ecore_list_count(files) == 0))
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+
+ names = ecore_list_new();
+ if (!names)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ ecore_list_free_cb_set(names, ECORE_FREE_CB(free));
+
+ ecore_list_first_goto(files);
+ while ((file = ecore_list_next(files)))
+ {
+ char *ext;
+
+ ext = strchr(file, '.');
+ if (ext)
+ {
+ char *lastext;
+ lastext = strrchr(file, '.');
+ if (!strncmp(lastext, EWL_ENGINE_EXT, strlen(EWL_ENGINE_EXT)) && ext == lastext) {
+ *ext = '\0';
+ ecore_list_append(names, strdup(file));
+ }
+ }
+ }
+ IF_FREE_LIST(files);
+
+ DRETURN_PTR(names, DLEVEL_STABLE);
}
/**
@@ -124,95 +124,95 @@ ewl_engine_names_get(void)
Ewl_Engine *
ewl_engine_new(const char *name, int *argc, char ** argv)
{
- Ewl_Engine *engine = NULL;
- Ewl_Engine *(*create_engine)(int *argc, char ** argv);
- Ecore_DList *(*dependancies)(void);
- Ecore_DList *deps = NULL;
- Ecore_DList *dep_list;
- Ecore_Plugin *plugin;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(name, NULL);
-
- /* see if we've created this engine already */
- engine = ecore_hash_get(ewl_engines, name);
- if (engine)
- DRETURN_PTR(engine, DLEVEL_STABLE);
-
- if (!ewl_engines_path)
- {
- char pathname[PATH_MAX];
-
- ewl_engines_path = ecore_path_group_new();
- snprintf(pathname, sizeof(pathname), "%s/ewl/%s/",
- PACKAGE_LIB_DIR,
- EWL_ENGINE_DIR);
- ecore_path_group_add(ewl_engines_path, pathname);
- }
-
- plugin = ecore_plugin_load(ewl_engines_path, name, INTERFACE_CURRENT);
- if (!plugin)
- {
- DWARNING("Unable to open engine %s.", name);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
-
- dependancies = ecore_plugin_symbol_get(plugin, "ewl_engine_dependancies");
- if (!dependancies)
- {
- DWARNING("Unable to find ewl_engine_dependancies for "
- "the %s engine.", name);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
-
- /* create all the needed parent engines for this engine */
- dep_list = dependancies();
- if (dep_list)
- {
- char *dep_name;
-
- /* this doesn't have a free callback attached to it because
- * the engines are cached and the _shutdown() function will
- * cleanup the cache */
- deps = ecore_dlist_new();
- while ((dep_name = ecore_list_first_remove(dep_list)))
- {
- Ewl_Engine *parent;
-
- parent = ewl_engine_new(dep_name, argc, argv);
- if (!parent)
- {
- FREE(dep_name);
- ecore_dlist_destroy(dep_list);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
-
- ecore_dlist_append(deps, parent);
- FREE(dep_name);
- }
- ecore_dlist_destroy(dep_list);
- }
-
- create_engine = ecore_plugin_symbol_get(plugin, "ewl_engine_create");
- if (!create_engine)
- {
- DWARNING("Unable to find ewl_engine_create for the %s engine.", name);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
-
- engine = EWL_ENGINE(create_engine(argc, argv));
- if (!engine)
- {
- fprintf(stderr, "Unable to create %s engine.\n", name);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
-
- engine->plugin = plugin;
- engine->dependancies = deps;
-
- ecore_hash_set(ewl_engines, strdup(name), engine);
-
- DRETURN_PTR(engine, DLEVEL_STABLE);
+ Ewl_Engine *engine = NULL;
+ Ewl_Engine *(*create_engine)(int *argc, char ** argv);
+ Ecore_DList *(*dependancies)(void);
+ Ecore_DList *deps = NULL;
+ Ecore_DList *dep_list;
+ Ecore_Plugin *plugin;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(name, NULL);
+
+ /* see if we've created this engine already */
+ engine = ecore_hash_get(ewl_engines, name);
+ if (engine)
+ DRETURN_PTR(engine, DLEVEL_STABLE);
+
+ if (!ewl_engines_path)
+ {
+ char pathname[PATH_MAX];
+
+ ewl_engines_path = ecore_path_group_new();
+ snprintf(pathname, sizeof(pathname), "%s/ewl/%s/",
+ PACKAGE_LIB_DIR,
+ EWL_ENGINE_DIR);
+ ecore_path_group_add(ewl_engines_path, pathname);
+ }
+
+ plugin = ecore_plugin_load(ewl_engines_path, name, INTERFACE_CURRENT);
+ if (!plugin)
+ {
+ DWARNING("Unable to open engine %s.", name);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
+
+ dependancies = ecore_plugin_symbol_get(plugin, "ewl_engine_dependancies");
+ if (!dependancies)
+ {
+ DWARNING("Unable to find ewl_engine_dependancies for "
+ "the %s engine.", name);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
+
+ /* create all the needed parent engines for this engine */
+ dep_list = dependancies();
+ if (dep_list)
+ {
+ char *dep_name;
+
+ /* this doesn't have a free callback attached to it because
+ * the engines are cached and the _shutdown() function will
+ * cleanup the cache */
+ deps = ecore_dlist_new();
+ while ((dep_name = ecore_list_first_remove(dep_list)))
+ {
+ Ewl_Engine *parent;
+
+ parent = ewl_engine_new(dep_name, argc, argv);
+ if (!parent)
+ {
+ FREE(dep_name);
+ ecore_dlist_destroy(dep_list);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
+
+ ecore_dlist_append(deps, parent);
+ FREE(dep_name);
+ }
+ ecore_dlist_destroy(dep_list);
+ }
+
+ create_engine = ecore_plugin_symbol_get(plugin, "ewl_engine_create");
+ if (!create_engine)
+ {
+ DWARNING("Unable to find ewl_engine_create for the %s engine.", name);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
+
+ engine = EWL_ENGINE(create_engine(argc, argv));
+ if (!engine)
+ {
+ fprintf(stderr, "Unable to create %s engine.\n", name);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
+
+ engine->plugin = plugin;
+ engine->dependancies = deps;
+
+ ecore_hash_set(ewl_engines, strdup(name), engine);
+
+ DRETURN_PTR(engine, DLEVEL_STABLE);
}
/**
@@ -223,19 +223,19 @@ ewl_engine_new(const char *name, int *argc, char ** argv)
void
ewl_engine_window_new(Ewl_Window *win)
{
- Ewl_Engine_Cb_Window_New window_new;
+ Ewl_Engine_Cb_Window_New window_new;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- window_new = ewl_engine_hook_get(EWL_EMBED(win),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_NEW);
- if (window_new)
- window_new(win);
+ window_new = ewl_engine_hook_get(EWL_EMBED(win),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_NEW);
+ if (window_new)
+ window_new(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -246,22 +246,22 @@ ewl_engine_window_new(Ewl_Window *win)
void
ewl_engine_window_destroy(Ewl_Window *win)
{
- Ewl_Engine_Cb_Window_Destroy window_destroy;
+ Ewl_Engine_Cb_Window_Destroy window_destroy;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (!REALIZED(win))
- DRETURN(DLEVEL_STABLE);
+ if (!REALIZED(win))
+ DRETURN(DLEVEL_STABLE);
- window_destroy = ewl_engine_hook_get(EWL_EMBED(win),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_DESTROY);
- if (window_destroy)
- window_destroy(win);
+ window_destroy = ewl_engine_hook_get(EWL_EMBED(win),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_DESTROY);
+ if (window_destroy)
+ window_destroy(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -272,22 +272,22 @@ ewl_engine_window_destroy(Ewl_Window *win)
void
ewl_engine_window_move(Ewl_Window *win)
{
- Ewl_Engine_Cb_Window_Move window_move;
+ Ewl_Engine_Cb_Window_Move window_move;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (!REALIZED(win))
- DRETURN(DLEVEL_STABLE);
+ if (!REALIZED(win))
+ DRETURN(DLEVEL_STABLE);
- window_move = ewl_engine_hook_get(EWL_EMBED(win),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_MOVE);
- if (window_move)
- window_move(win);
+ window_move = ewl_engine_hook_get(EWL_EMBED(win),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_MOVE);
+ if (window_move)
+ window_move(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -298,22 +298,22 @@ ewl_engine_window_move(Ewl_Window *win)
void
ewl_engine_window_resize(Ewl_Window *win)
{
- Ewl_Engine_Cb_Window_Resize window_resize;
+ Ewl_Engine_Cb_Window_Resize window_resize;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (!REALIZED(win))
- DRETURN(DLEVEL_STABLE);
+ if (!REALIZED(win))
+ DRETURN(DLEVEL_STABLE);
- window_resize = ewl_engine_hook_get(EWL_EMBED(win),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_RESIZE);
- if (window_resize)
- window_resize(win);
+ window_resize = ewl_engine_hook_get(EWL_EMBED(win),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_RESIZE);
+ if (window_resize)
+ window_resize(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -324,19 +324,19 @@ ewl_engine_window_resize(Ewl_Window *win)
void
ewl_engine_window_min_max_size_set(Ewl_Window *win)
{
- Ewl_Engine_Cb_Window_Min_Max_Size_Set window_min_max_size_set;
+ Ewl_Engine_Cb_Window_Min_Max_Size_Set window_min_max_size_set;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- window_min_max_size_set = ewl_engine_hook_get(EWL_EMBED(win),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_MIN_MAX_SIZE_SET);
- if (window_min_max_size_set)
- window_min_max_size_set(win);
+ window_min_max_size_set = ewl_engine_hook_get(EWL_EMBED(win),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_MIN_MAX_SIZE_SET);
+ if (window_min_max_size_set)
+ window_min_max_size_set(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -347,19 +347,19 @@ ewl_engine_window_min_max_size_set(Ewl_Window *win)
void
ewl_engine_window_show(Ewl_Window *win)
{
- Ewl_Engine_Cb_Window_Show window_show;
+ Ewl_Engine_Cb_Window_Show window_show;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- window_show = ewl_engine_hook_get(EWL_EMBED(win),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_SHOW);
- if (window_show)
- window_show(win);
+ window_show = ewl_engine_hook_get(EWL_EMBED(win),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_SHOW);
+ if (window_show)
+ window_show(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -370,19 +370,19 @@ ewl_engine_window_show(Ewl_Window *win)
void
ewl_engine_window_hide(Ewl_Window *win)
{
- Ewl_Engine_Cb_Window_Hide window_hide;
+ Ewl_Engine_Cb_Window_Hide window_hide;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- window_hide = ewl_engine_hook_get(EWL_EMBED(win),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_HIDE);
- if (window_hide)
- window_hide(win);
+ window_hide = ewl_engine_hook_get(EWL_EMBED(win),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_HIDE);
+ if (window_hide)
+ window_hide(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -393,22 +393,22 @@ ewl_engine_window_hide(Ewl_Window *win)
void
ewl_engine_window_title_set(Ewl_Window *win)
{
- Ewl_Engine_Cb_Window_Title_Set window_title_set;
+ Ewl_Engine_Cb_Window_Title_Set window_title_set;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (!(win->window))
- DRETURN(DLEVEL_STABLE);
+ if (!(win->window))
+ DRETURN(DLEVEL_STABLE);
- window_title_set = ewl_engine_hook_get(EWL_EMBED(win),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_TITLE_SET);
- if (window_title_set)
- window_title_set(win);
+ window_title_set = ewl_engine_hook_get(EWL_EMBED(win),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_TITLE_SET);
+ if (window_title_set)
+ window_title_set(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -419,22 +419,22 @@ ewl_engine_window_title_set(Ewl_Window *win)
void
ewl_engine_window_name_class_set(Ewl_Window *win)
{
- Ewl_Engine_Cb_Window_Name_Class_Set window_name_class_set;
+ Ewl_Engine_Cb_Window_Name_Class_Set window_name_class_set;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (!(win->window))
- DRETURN(DLEVEL_STABLE);
+ if (!(win->window))
+ DRETURN(DLEVEL_STABLE);
- window_name_class_set = ewl_engine_hook_get(EWL_EMBED(win),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_NAME_CLASS_SET);
- if (window_name_class_set)
- window_name_class_set(win);
+ window_name_class_set = ewl_engine_hook_get(EWL_EMBED(win),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_NAME_CLASS_SET);
+ if (window_name_class_set)
+ window_name_class_set(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -445,22 +445,22 @@ ewl_engine_window_name_class_set(Ewl_Window *win)
void
ewl_engine_window_borderless_set(Ewl_Window *win)
{
- Ewl_Engine_Cb_Window_Borderless_Set window_borderless_set;
+ Ewl_Engine_Cb_Window_Borderless_Set window_borderless_set;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (!(win->window))
- DRETURN(DLEVEL_STABLE);
+ if (!(win->window))
+ DRETURN(DLEVEL_STABLE);
- window_borderless_set = ewl_engine_hook_get(EWL_EMBED(win),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_NAME_CLASS_SET);
- if (window_borderless_set)
- window_borderless_set(win);
+ window_borderless_set = ewl_engine_hook_get(EWL_EMBED(win),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_NAME_CLASS_SET);
+ if (window_borderless_set)
+ window_borderless_set(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -471,22 +471,22 @@ ewl_engine_window_borderless_set(Ewl_Window *win)
void
ewl_engine_window_dialog_set(Ewl_Window *win)
{
- Ewl_Engine_Cb_Window_Dialog_Set window_dialog_set;
+ Ewl_Engine_Cb_Window_Dialog_Set window_dialog_set;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (!(win->window))
- DRETURN(DLEVEL_STABLE);
+ if (!(win->window))
+ DRETURN(DLEVEL_STABLE);
- window_dialog_set = ewl_engine_hook_get(EWL_EMBED(win),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_DIALOG_SET);
- if (window_dialog_set)
- window_dialog_set(win);
+ window_dialog_set = ewl_engine_hook_get(EWL_EMBED(win),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_DIALOG_SET);
+ if (window_dialog_set)
+ window_dialog_set(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -497,22 +497,22 @@ ewl_engine_window_dialog_set(Ewl_Window *win)
void
ewl_engine_window_states_set(Ewl_Window *win)
{
- Ewl_Engine_Cb_Window_States_Set window_states_set;
+ Ewl_Engine_Cb_Window_States_Set window_states_set;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (!(win->window))
- DRETURN(DLEVEL_STABLE);
+ if (!(win->window))
+ DRETURN(DLEVEL_STABLE);
- window_states_set = ewl_engine_hook_get(EWL_EMBED(win),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_STATES_SET);
- if (window_states_set)
- window_states_set(win);
+ window_states_set = ewl_engine_hook_get(EWL_EMBED(win),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_STATES_SET);
+ if (window_states_set)
+ window_states_set(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -523,22 +523,22 @@ ewl_engine_window_states_set(Ewl_Window *win)
void
ewl_engine_window_hints_set(Ewl_Window *win)
{
- Ewl_Engine_Cb_Window_Hints_Set window_hints_set;
+ Ewl_Engine_Cb_Window_Hints_Set window_hints_set;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (!(win->window))
- DRETURN(DLEVEL_STABLE);
+ if (!(win->window))
+ DRETURN(DLEVEL_STABLE);
- window_hints_set = ewl_engine_hook_get(EWL_EMBED(win),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_HINTS_SET);
- if (window_hints_set)
- window_hints_set(win);
+ window_hints_set = ewl_engine_hook_get(EWL_EMBED(win),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_HINTS_SET);
+ if (window_hints_set)
+ window_hints_set(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -549,22 +549,22 @@ ewl_engine_window_hints_set(Ewl_Window *win)
void
ewl_engine_window_transient_for(Ewl_Window *win)
{
- Ewl_Engine_Cb_Window_Transient_For window_transient_for;
+ Ewl_Engine_Cb_Window_Transient_For window_transient_for;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (!(win->window))
- DRETURN(DLEVEL_STABLE);
+ if (!(win->window))
+ DRETURN(DLEVEL_STABLE);
- window_transient_for = ewl_engine_hook_get(EWL_EMBED(win),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_TRANSIENT_FOR);
- if (window_transient_for)
- window_transient_for(win);
+ window_transient_for = ewl_engine_hook_get(EWL_EMBED(win),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_TRANSIENT_FOR);
+ if (window_transient_for)
+ window_transient_for(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -575,22 +575,22 @@ ewl_engine_window_transient_for(Ewl_Window *win)
void
ewl_engine_window_leader_set(Ewl_Window *win)
{
- Ewl_Engine_Cb_Window_Leader_Set window_leader_set;
+ Ewl_Engine_Cb_Window_Leader_Set window_leader_set;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (!(win->window))
- DRETURN(DLEVEL_STABLE);
+ if (!(win->window))
+ DRETURN(DLEVEL_STABLE);
- window_leader_set = ewl_engine_hook_get(EWL_EMBED(win),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_LEADER_SET);
- if (window_leader_set)
- window_leader_set(win);
+ window_leader_set = ewl_engine_hook_get(EWL_EMBED(win),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_LEADER_SET);
+ if (window_leader_set)
+ window_leader_set(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -601,22 +601,22 @@ ewl_engine_window_leader_set(Ewl_Window *win)
void
ewl_engine_window_raise(Ewl_Window *win)
{
- Ewl_Engine_Cb_Window_Raise window_raise;
+ Ewl_Engine_Cb_Window_Raise window_raise;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (!REALIZED(win))
- DRETURN(DLEVEL_STABLE);
+ if (!REALIZED(win))
+ DRETURN(DLEVEL_STABLE);
- window_raise = ewl_engine_hook_get(EWL_EMBED(win),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_RAISE);
- if (window_raise)
- window_raise(win);
+ window_raise = ewl_engine_hook_get(EWL_EMBED(win),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_RAISE);
+ if (window_raise)
+ window_raise(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -627,22 +627,22 @@ ewl_engine_window_raise(Ewl_Window *win)
void
ewl_engine_window_lower(Ewl_Window *win)
{
- Ewl_Engine_Cb_Window_Lower window_lower;
+ Ewl_Engine_Cb_Window_Lower window_lower;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (!REALIZED(win))
- DRETURN(DLEVEL_STABLE);
+ if (!REALIZED(win))
+ DRETURN(DLEVEL_STABLE);
- window_lower = ewl_engine_hook_get(EWL_EMBED(win),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_LOWER);
- if (window_lower)
- window_lower(win);
+ window_lower = ewl_engine_hook_get(EWL_EMBED(win),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_LOWER);
+ if (window_lower)
+ window_lower(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -653,22 +653,22 @@ ewl_engine_window_lower(Ewl_Window *win)
int
ewl_engine_keyboard_grab(Ewl_Window *win)
{
- Ewl_Engine_Cb_Keyboard_Grab keyboard_grab;
+ Ewl_Engine_Cb_Keyboard_Grab keyboard_grab;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(win, 0);
- DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(win, 0);
+ DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, 0);
- if (!VISIBLE(win) || !REALIZED(win))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!VISIBLE(win) || !REALIZED(win))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- keyboard_grab = ewl_engine_hook_get(EWL_EMBED(win),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_KEYBOARD_GRAB);
- if (keyboard_grab)
- DRETURN_INT(keyboard_grab(win), DLEVEL_STABLE);
+ keyboard_grab = ewl_engine_hook_get(EWL_EMBED(win),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_KEYBOARD_GRAB);
+ if (keyboard_grab)
+ DRETURN_INT(keyboard_grab(win), DLEVEL_STABLE);
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
}
/**
@@ -679,22 +679,22 @@ ewl_engine_keyboard_grab(Ewl_Window *win)
void
ewl_engine_keyboard_ungrab(Ewl_Window *win)
{
- Ewl_Engine_Cb_Keyboard_Ungrab keyboard_ungrab;
+ Ewl_Engine_Cb_Keyboard_Ungrab keyboard_ungrab;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (!VISIBLE(win) || !REALIZED(win))
- DRETURN(DLEVEL_STABLE);
+ if (!VISIBLE(win) || !REALIZED(win))
+ DRETURN(DLEVEL_STABLE);
- keyboard_ungrab = ewl_engine_hook_get(EWL_EMBED(win),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_KEYBOARD_UNGRAB);
- if (keyboard_ungrab)
- keyboard_ungrab(win);
+ keyboard_ungrab = ewl_engine_hook_get(EWL_EMBED(win),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_KEYBOARD_UNGRAB);
+ if (keyboard_ungrab)
+ keyboard_ungrab(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -705,22 +705,22 @@ ewl_engine_keyboard_ungrab(Ewl_Window *win)
int
ewl_engine_pointer_grab(Ewl_Window *win)
{
- Ewl_Engine_Cb_Pointer_Grab pointer_grab;
+ Ewl_Engine_Cb_Pointer_Grab pointer_grab;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(win, 0);
- DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(win, 0);
+ DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, 0);
- if (!VISIBLE(win) || !REALIZED(win))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!VISIBLE(win) || !REALIZED(win))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- pointer_grab = ewl_engine_hook_get(EWL_EMBED(win),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_POINTER_GRAB);
- if (pointer_grab)
- DRETURN_INT(pointer_grab(win), DLEVEL_STABLE);
+ pointer_grab = ewl_engine_hook_get(EWL_EMBED(win),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_POINTER_GRAB);
+ if (pointer_grab)
+ DRETURN_INT(pointer_grab(win), DLEVEL_STABLE);
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
}
/**
@@ -731,22 +731,22 @@ ewl_engine_pointer_grab(Ewl_Window *win)
void
ewl_engine_pointer_ungrab(Ewl_Window *win)
{
- Ewl_Engine_Cb_Pointer_Ungrab pointer_ungrab;
+ Ewl_Engine_Cb_Pointer_Ungrab pointer_ungrab;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (!VISIBLE(win) || !REALIZED(win))
- DRETURN(DLEVEL_STABLE);
+ if (!VISIBLE(win) || !REALIZED(win))
+ DRETURN(DLEVEL_STABLE);
- pointer_ungrab = ewl_engine_hook_get(EWL_EMBED(win),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_POINTER_UNGRAB);
- if (pointer_ungrab)
- pointer_ungrab(win);
+ pointer_ungrab = ewl_engine_hook_get(EWL_EMBED(win),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_POINTER_UNGRAB);
+ if (pointer_ungrab)
+ pointer_ungrab(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -758,23 +758,23 @@ ewl_engine_pointer_ungrab(Ewl_Window *win)
void
ewl_engine_embed_selection_text_set(Ewl_Embed *emb, const char *txt)
{
- Ewl_Engine_Cb_Window_Selection_Text_Set embed_selection_text_set;
+ Ewl_Engine_Cb_Window_Selection_Text_Set embed_selection_text_set;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(emb);
- DCHECK_PARAM_PTR(txt);
- DCHECK_TYPE(emb, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(emb);
+ DCHECK_PARAM_PTR(txt);
+ DCHECK_TYPE(emb, EWL_EMBED_TYPE);
- if (!REALIZED(emb))
- DRETURN(DLEVEL_STABLE);
+ if (!REALIZED(emb))
+ DRETURN(DLEVEL_STABLE);
- embed_selection_text_set = ewl_engine_hook_get(EWL_EMBED(emb),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_SELECTION_TEXT_SET);
- if (embed_selection_text_set)
- embed_selection_text_set(emb, txt);
+ embed_selection_text_set = ewl_engine_hook_get(EWL_EMBED(emb),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_SELECTION_TEXT_SET);
+ if (embed_selection_text_set)
+ embed_selection_text_set(emb, txt);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -790,23 +790,23 @@ ewl_engine_embed_selection_text_set(Ewl_Embed *emb, const char *txt)
void
ewl_engine_window_geometry_get(Ewl_Window *win, int root, int *width, int *height)
{
- Ewl_Engine_Cb_Window_Geometry_Get window_geometry_get;
+ Ewl_Engine_Cb_Window_Geometry_Get window_geometry_get;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- /* make sure these get set to _something_ */
- if (width) *width = 0;
- if (height) *height = 0;
+ /* make sure these get set to _something_ */
+ if (width) *width = 0;
+ if (height) *height = 0;
- window_geometry_get = ewl_engine_hook_get(EWL_EMBED(win),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_GEOMETRY_GET);
- if (window_geometry_get)
- window_geometry_get((root ? NULL : win), width, height);
+ window_geometry_get = ewl_engine_hook_get(EWL_EMBED(win),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_GEOMETRY_GET);
+ if (window_geometry_get)
+ window_geometry_get((root ? NULL : win), width, height);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -817,22 +817,22 @@ ewl_engine_window_geometry_get(Ewl_Window *win, int root, int *width, int *heigh
void
ewl_engine_embed_dnd_aware_set(Ewl_Embed *embed)
{
- Ewl_Engine_Cb_Window_Dnd_Aware_Set embed_dnd_aware_set;
+ Ewl_Engine_Cb_Window_Dnd_Aware_Set embed_dnd_aware_set;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- if (!(embed->canvas_window))
- DRETURN(DLEVEL_STABLE);
+ if (!(embed->canvas_window))
+ DRETURN(DLEVEL_STABLE);
- embed_dnd_aware_set = ewl_engine_hook_get(EWL_EMBED(embed),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_DND_AWARE_SET);
- if (embed_dnd_aware_set)
- embed_dnd_aware_set(embed);
+ embed_dnd_aware_set = ewl_engine_hook_get(EWL_EMBED(embed),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_DND_AWARE_SET);
+ if (embed_dnd_aware_set)
+ embed_dnd_aware_set(embed);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -845,22 +845,22 @@ ewl_engine_embed_dnd_aware_set(Ewl_Embed *embed)
void
ewl_engine_embed_dnd_drag_types_set(Ewl_Embed *embed, char **types, unsigned int num)
{
- Ewl_Engine_Cb_Window_Dnd_Drag_Types_Set embed_dnd_drag_types_set;
+ Ewl_Engine_Cb_Window_Dnd_Drag_Types_Set embed_dnd_drag_types_set;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- if (!(embed->canvas_window))
- DRETURN(DLEVEL_STABLE);
+ if (!(embed->canvas_window))
+ DRETURN(DLEVEL_STABLE);
- embed_dnd_drag_types_set = ewl_engine_hook_get(EWL_EMBED(embed),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_DND_DRAG_TYPES_SET);
- if (embed_dnd_drag_types_set)
- embed_dnd_drag_types_set(embed, types, num);
+ embed_dnd_drag_types_set = ewl_engine_hook_get(EWL_EMBED(embed),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_DND_DRAG_TYPES_SET);
+ if (embed_dnd_drag_types_set)
+ embed_dnd_drag_types_set(embed, types, num);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -871,22 +871,22 @@ ewl_engine_embed_dnd_drag_types_set(Ewl_Embed *embed, char **types, unsigned int
void
ewl_engine_embed_dnd_drag_start(Ewl_Embed *embed)
{
- Ewl_Engine_Cb_Window_Dnd_Drag_Start embed_dnd_drag_start;
+ Ewl_Engine_Cb_Window_Dnd_Drag_Start embed_dnd_drag_start;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- if (!(embed->canvas_window))
- DRETURN(DLEVEL_STABLE);
+ if (!(embed->canvas_window))
+ DRETURN(DLEVEL_STABLE);
- embed_dnd_drag_start = ewl_engine_hook_get(EWL_EMBED(embed),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_DND_DRAG_START);
- if (embed_dnd_drag_start)
- embed_dnd_drag_start(embed);
+ embed_dnd_drag_start = ewl_engine_hook_get(EWL_EMBED(embed),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_DND_DRAG_START);
+ if (embed_dnd_drag_start)
+ embed_dnd_drag_start(embed);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -897,22 +897,22 @@ ewl_engine_embed_dnd_drag_start(Ewl_Embed *embed)
void
ewl_engine_embed_dnd_drag_drop(Ewl_Embed *embed)
{
- Ewl_Engine_Cb_Window_Dnd_Drag_Drop embed_dnd_drag_drop;
+ Ewl_Engine_Cb_Window_Dnd_Drag_Drop embed_dnd_drag_drop;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- if (!(embed->canvas_window))
- DRETURN(DLEVEL_STABLE);
+ if (!(embed->canvas_window))
+ DRETURN(DLEVEL_STABLE);
- embed_dnd_drag_drop = ewl_engine_hook_get(EWL_EMBED(embed),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_DND_DRAG_DROP);
- if (embed_dnd_drag_drop)
- embed_dnd_drag_drop(embed);
+ embed_dnd_drag_drop = ewl_engine_hook_get(EWL_EMBED(embed),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_DND_DRAG_DROP);
+ if (embed_dnd_drag_drop)
+ embed_dnd_drag_drop(embed);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -925,25 +925,25 @@ ewl_engine_embed_dnd_drag_drop(Ewl_Embed *embed)
*/
int
ewl_engine_embed_dnd_drag_data_send(Ewl_Embed *embed, void *handle, void *data,
- int size)
+ int size)
{
- Ewl_Engine_Cb_Window_Dnd_Drag_Data_Send embed_dnd_drag_data_send;
+ Ewl_Engine_Cb_Window_Dnd_Drag_Data_Send embed_dnd_drag_data_send;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(embed, FALSE);
- DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(embed, FALSE);
+ DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, FALSE);
- if (!(embed->canvas_window))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!(embed->canvas_window))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- embed_dnd_drag_data_send = ewl_engine_hook_get(EWL_EMBED(embed),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_DND_DRAG_DATA_SEND);
- if (embed_dnd_drag_data_send)
- DRETURN_INT(embed_dnd_drag_data_send(embed, handle, data, size),
- DLEVEL_STABLE);
+ embed_dnd_drag_data_send = ewl_engine_hook_get(EWL_EMBED(embed),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_DND_DRAG_DATA_SEND);
+ if (embed_dnd_drag_data_send)
+ DRETURN_INT(embed_dnd_drag_data_send(embed, handle, data, size),
+ DLEVEL_STABLE);
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
}
/**
@@ -956,19 +956,19 @@ ewl_engine_embed_dnd_drag_data_send(Ewl_Embed *embed, void *handle, void *data,
void
ewl_engine_desktop_size_get(Ewl_Embed *embed, int *w, int *h)
{
- Ewl_Engine_Cb_Window_Desktop_Size_Get desktop_size_get;
+ Ewl_Engine_Cb_Window_Desktop_Size_Get desktop_size_get;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- desktop_size_get = ewl_engine_hook_get(EWL_EMBED(embed),
- EWL_ENGINE_HOOK_TYPE_WINDOW,
- EWL_ENGINE_WINDOW_DESKTOP_SIZE_GET);
- if (desktop_size_get)
- desktop_size_get(embed, w, h);
+ desktop_size_get = ewl_engine_hook_get(EWL_EMBED(embed),
+ EWL_ENGINE_HOOK_TYPE_WINDOW,
+ EWL_ENGINE_WINDOW_DESKTOP_SIZE_GET);
+ if (desktop_size_get)
+ desktop_size_get(embed, w, h);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -980,19 +980,19 @@ ewl_engine_desktop_size_get(Ewl_Embed *embed, int *w, int *h)
void
ewl_engine_canvas_setup(Ewl_Window *win, int debug)
{
- Ewl_Engine_Cb_Canvas_Setup canvas_setup;
+ Ewl_Engine_Cb_Canvas_Setup canvas_setup;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- canvas_setup = ewl_engine_hook_get(EWL_EMBED(win),
- EWL_ENGINE_HOOK_TYPE_CANVAS,
- EWL_ENGINE_CANVAS_SETUP);
- if (canvas_setup)
- canvas_setup(win, debug);
+ canvas_setup = ewl_engine_hook_get(EWL_EMBED(win),
+ EWL_ENGINE_HOOK_TYPE_CANVAS,
+ EWL_ENGINE_CANVAS_SETUP);
+ if (canvas_setup)
+ canvas_setup(win, debug);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1007,19 +1007,19 @@ ewl_engine_canvas_setup(Ewl_Window *win, int debug)
void
ewl_engine_canvas_output_set(Ewl_Embed *emb, int x, int y, int width, int height)
{
- Ewl_Engine_Cb_Canvas_Output_Set canvas_output_set;
+ Ewl_Engine_Cb_Canvas_Output_Set canvas_output_set;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(emb);
- DCHECK_TYPE(emb, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(emb);
+ DCHECK_TYPE(emb, EWL_EMBED_TYPE);
- canvas_output_set = ewl_engine_hook_get(emb,
- EWL_ENGINE_HOOK_TYPE_CANVAS,
- EWL_ENGINE_CANVAS_OUTPUT_SET);
- if (canvas_output_set)
- canvas_output_set(emb, x, y, width, height);
+ canvas_output_set = ewl_engine_hook_get(emb,
+ EWL_ENGINE_HOOK_TYPE_CANVAS,
+ EWL_ENGINE_CANVAS_OUTPUT_SET);
+ if (canvas_output_set)
+ canvas_output_set(emb, x, y, width, height);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1030,19 +1030,19 @@ ewl_engine_canvas_output_set(Ewl_Embed *emb, int x, int y, int width, int height
void
ewl_engine_canvas_render(Ewl_Embed *embed)
{
- Ewl_Engine_Cb_Canvas_Render canvas_render;
+ Ewl_Engine_Cb_Canvas_Render canvas_render;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- canvas_render = ewl_engine_hook_get(embed,
- EWL_ENGINE_HOOK_TYPE_CANVAS,
- EWL_ENGINE_CANVAS_RENDER);
- if (canvas_render)
- canvas_render(embed);
+ canvas_render = ewl_engine_hook_get(embed,
+ EWL_ENGINE_HOOK_TYPE_CANVAS,
+ EWL_ENGINE_CANVAS_RENDER);
+ if (canvas_render)
+ canvas_render(embed);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1053,19 +1053,19 @@ ewl_engine_canvas_render(Ewl_Embed *embed)
void
ewl_engine_canvas_freeze(Ewl_Embed *embed)
{
- Ewl_Engine_Cb_Canvas_Freeze canvas_freeze;
+ Ewl_Engine_Cb_Canvas_Freeze canvas_freeze;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- canvas_freeze = ewl_engine_hook_get(embed,
- EWL_ENGINE_HOOK_TYPE_CANVAS,
- EWL_ENGINE_CANVAS_FREEZE);
- if (canvas_freeze)
- canvas_freeze(embed);
+ canvas_freeze = ewl_engine_hook_get(embed,
+ EWL_ENGINE_HOOK_TYPE_CANVAS,
+ EWL_ENGINE_CANVAS_FREEZE);
+ if (canvas_freeze)
+ canvas_freeze(embed);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1076,37 +1076,37 @@ ewl_engine_canvas_freeze(Ewl_Embed *embed)
void
ewl_engine_canvas_thaw(Ewl_Embed *embed)
{
- Ewl_Engine_Cb_Canvas_Thaw canvas_thaw;
+ Ewl_Engine_Cb_Canvas_Thaw canvas_thaw;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- canvas_thaw = ewl_engine_hook_get(embed,
- EWL_ENGINE_HOOK_TYPE_CANVAS,
- EWL_ENGINE_CANVAS_THAW);
- if (canvas_thaw)
- canvas_thaw(embed);
+ canvas_thaw = ewl_engine_hook_get(embed,
+ EWL_ENGINE_HOOK_TYPE_CANVAS,
+ EWL_ENGINE_CANVAS_THAW);
+ if (canvas_thaw)
+ canvas_thaw(embed);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
void
ewl_engine_canvas_damage_add(Ewl_Embed *embed, int x, int y, int w, int h)
{
- Ewl_Engine_Cb_Canvas_Damage_Add damage_add;
+ Ewl_Engine_Cb_Canvas_Damage_Add damage_add;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- damage_add = ewl_engine_hook_get(embed,
- EWL_ENGINE_HOOK_TYPE_CANVAS,
- EWL_ENGINE_CANVAS_DAMAGE_ADD);
- if (damage_add)
- damage_add(embed, x, y, w, h);
+ damage_add = ewl_engine_hook_get(embed,
+ EWL_ENGINE_HOOK_TYPE_CANVAS,
+ EWL_ENGINE_CANVAS_DAMAGE_ADD);
+ if (damage_add)
+ damage_add(embed, x, y, w, h);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1117,19 +1117,19 @@ ewl_engine_canvas_damage_add(Ewl_Embed *embed, int x, int y, int w, int h)
void
ewl_engine_theme_freeze(Ewl_Embed *embed)
{
- Ewl_Engine_Cb_Theme_Freeze theme_freeze;
+ Ewl_Engine_Cb_Theme_Freeze theme_freeze;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- theme_freeze = ewl_engine_hook_get(embed,
- EWL_ENGINE_HOOK_TYPE_THEME,
- EWL_ENGINE_THEME_FREEZE);
- if (theme_freeze)
- theme_freeze();
+ theme_freeze = ewl_engine_hook_get(embed,
+ EWL_ENGINE_HOOK_TYPE_THEME,
+ EWL_ENGINE_THEME_FREEZE);
+ if (theme_freeze)
+ theme_freeze();
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1140,19 +1140,19 @@ ewl_engine_theme_freeze(Ewl_Embed *embed)
void
ewl_engine_theme_thaw(Ewl_Embed *embed)
{
- Ewl_Engine_Cb_Theme_Thaw theme_thaw;
+ Ewl_Engine_Cb_Theme_Thaw theme_thaw;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- theme_thaw = ewl_engine_hook_get(embed,
- EWL_ENGINE_HOOK_TYPE_THEME,
- EWL_ENGINE_THEME_THAW);
- if (theme_thaw)
- theme_thaw();
+ theme_thaw = ewl_engine_hook_get(embed,
+ EWL_ENGINE_HOOK_TYPE_THEME,
+ EWL_ENGINE_THEME_THAW);
+ if (theme_thaw)
+ theme_thaw();
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1164,24 +1164,24 @@ ewl_engine_theme_thaw(Ewl_Embed *embed)
char *
ewl_engine_theme_data_get(Ewl_Widget *w, char *key)
{
- Ewl_Embed *embed;
- Ewl_Engine_Cb_Theme_Data_Get theme_data_get;
- char *value = NULL;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, NULL);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
-
- embed = ewl_embed_widget_find(w);
- if (embed) {
- theme_data_get = ewl_engine_hook_get(embed,
- EWL_ENGINE_HOOK_TYPE_THEME,
- EWL_ENGINE_THEME_DATA_GET);
- if (theme_data_get)
- value = theme_data_get(ewl_theme_path_get(), key);
- }
-
- DRETURN_PTR(value, DLEVEL_STABLE);
+ Ewl_Embed *embed;
+ Ewl_Engine_Cb_Theme_Data_Get theme_data_get;
+ char *value = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, NULL);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
+
+ embed = ewl_embed_widget_find(w);
+ if (embed) {
+ theme_data_get = ewl_engine_hook_get(embed,
+ EWL_ENGINE_HOOK_TYPE_THEME,
+ EWL_ENGINE_THEME_DATA_GET);
+ if (theme_data_get)
+ value = theme_data_get(ewl_theme_path_get(), key);
+ }
+
+ DRETURN_PTR(value, DLEVEL_STABLE);
}
/**
@@ -1191,23 +1191,23 @@ ewl_engine_theme_data_get(Ewl_Widget *w, char *key)
void *
ewl_engine_theme_widget_group(Ewl_Widget *w)
{
- Ewl_Embed *embed;
- Ewl_Engine_Cb_Theme_Widget_Group theme_widget_group;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, NULL);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
-
- embed = ewl_embed_widget_find(w);
- if (embed) {
- theme_widget_group = ewl_engine_hook_get(embed,
- EWL_ENGINE_HOOK_TYPE_THEME,
- EWL_ENGINE_THEME_WIDGET_GROUP);
- if (theme_widget_group)
- DRETURN_PTR(theme_widget_group(w), DLEVEL_STABLE);
- }
-
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ Ewl_Embed *embed;
+ Ewl_Engine_Cb_Theme_Widget_Group theme_widget_group;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, NULL);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
+
+ embed = ewl_embed_widget_find(w);
+ if (embed) {
+ theme_widget_group = ewl_engine_hook_get(embed,
+ EWL_ENGINE_HOOK_TYPE_THEME,
+ EWL_ENGINE_THEME_WIDGET_GROUP);
+ if (theme_widget_group)
+ DRETURN_PTR(theme_widget_group(w), DLEVEL_STABLE);
+ }
+
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
}
/**
@@ -1217,19 +1217,19 @@ ewl_engine_theme_widget_group(Ewl_Widget *w)
void *
ewl_engine_theme_object_add(Ewl_Embed *embed)
{
- Ewl_Engine_Cb_Theme_Object_Add theme_object_add;
+ Ewl_Engine_Cb_Theme_Object_Add theme_object_add;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(embed, NULL);
- DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(embed, NULL);
+ DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, NULL);
- theme_object_add = ewl_engine_hook_get(embed,
- EWL_ENGINE_HOOK_TYPE_THEME,
- EWL_ENGINE_THEME_OBJECT_ADD);
- if (theme_object_add)
- DRETURN_PTR(theme_object_add(embed), DLEVEL_STABLE);
+ theme_object_add = ewl_engine_hook_get(embed,
+ EWL_ENGINE_HOOK_TYPE_THEME,
+ EWL_ENGINE_THEME_OBJECT_ADD);
+ if (theme_object_add)
+ DRETURN_PTR(theme_object_add(embed), DLEVEL_STABLE);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
}
/**
@@ -1239,20 +1239,20 @@ ewl_engine_theme_object_add(Ewl_Embed *embed)
void
ewl_engine_theme_object_del(Ewl_Embed *embed, void *obj)
{
- Ewl_Engine_Cb_Theme_Object_Del theme_object_del;
+ Ewl_Engine_Cb_Theme_Object_Del theme_object_del;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(obj);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(obj);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- theme_object_del = ewl_engine_hook_get(embed,
- EWL_ENGINE_HOOK_TYPE_THEME,
- EWL_ENGINE_THEME_OBJECT_DEL);
- if (theme_object_del)
- theme_object_del(obj);
+ theme_object_del = ewl_engine_hook_get(embed,
+ EWL_ENGINE_HOOK_TYPE_THEME,
+ EWL_ENGINE_THEME_OBJECT_DEL);
+ if (theme_object_del)
+ theme_object_del(obj);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1262,19 +1262,19 @@ ewl_engine_theme_object_del(Ewl_Embed *embed, void *obj)
void
ewl_engine_theme_object_move(Ewl_Embed *embed, void *obj, int x, int y)
{
- Ewl_Engine_Cb_Theme_Object_Move theme_object_move;
+ Ewl_Engine_Cb_Theme_Object_Move theme_object_move;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- theme_object_move = ewl_engine_hook_get(EWL_EMBED(embed),
- EWL_ENGINE_HOOK_TYPE_THEME,
- EWL_ENGINE_THEME_OBJECT_MOVE);
- if (theme_object_move)
- theme_object_move(obj, x, y);
+ theme_object_move = ewl_engine_hook_get(EWL_EMBED(embed),
+ EWL_ENGINE_HOOK_TYPE_THEME,
+ EWL_ENGINE_THEME_OBJECT_MOVE);
+ if (theme_object_move)
+ theme_object_move(obj, x, y);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1284,19 +1284,19 @@ ewl_engine_theme_object_move(Ewl_Embed *embed, void *obj, int x, int y)
void
ewl_engine_theme_object_resize(Ewl_Embed *embed, void *obj, int width, int height)
{
- Ewl_Engine_Cb_Theme_Object_Resize theme_object_resize;
+ Ewl_Engine_Cb_Theme_Object_Resize theme_object_resize;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_WIDGET_TYPE);
- theme_object_resize = ewl_engine_hook_get(embed,
- EWL_ENGINE_HOOK_TYPE_THEME,
- EWL_ENGINE_THEME_OBJECT_RESIZE);
- if (theme_object_resize)
- theme_object_resize(obj, width, height);
+ theme_object_resize = ewl_engine_hook_get(embed,
+ EWL_ENGINE_HOOK_TYPE_THEME,
+ EWL_ENGINE_THEME_OBJECT_RESIZE);
+ if (theme_object_resize)
+ theme_object_resize(obj, width, height);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1306,19 +1306,19 @@ ewl_engine_theme_object_resize(Ewl_Embed *embed, void *obj, int width, int heigh
void
ewl_engine_theme_object_show(Ewl_Embed *embed, void *obj)
{
- Ewl_Engine_Cb_Theme_Object_Show theme_object_show;
+ Ewl_Engine_Cb_Theme_Object_Show theme_object_show;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- theme_object_show = ewl_engine_hook_get(embed,
- EWL_ENGINE_HOOK_TYPE_THEME,
- EWL_ENGINE_THEME_OBJECT_SHOW);
- if (theme_object_show)
- theme_object_show(obj);
+ theme_object_show = ewl_engine_hook_get(embed,
+ EWL_ENGINE_HOOK_TYPE_THEME,
+ EWL_ENGINE_THEME_OBJECT_SHOW);
+ if (theme_object_show)
+ theme_object_show(obj);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1328,19 +1328,19 @@ ewl_engine_theme_object_show(Ewl_Embed *embed, void *obj)
void
ewl_engine_theme_object_hide(Ewl_Embed *embed, void *obj)
{
- Ewl_Engine_Cb_Theme_Object_Hide theme_object_hide;
+ Ewl_Engine_Cb_Theme_Object_Hide theme_object_hide;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- theme_object_hide = ewl_engine_hook_get(embed,
- EWL_ENGINE_HOOK_TYPE_THEME,
- EWL_ENGINE_THEME_OBJECT_HIDE);
- if (theme_object_hide)
- theme_object_hide(obj);
+ theme_object_hide = ewl_engine_hook_get(embed,
+ EWL_ENGINE_HOOK_TYPE_THEME,
+ EWL_ENGINE_THEME_OBJECT_HIDE);
+ if (theme_object_hide)
+ theme_object_hide(obj);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1350,19 +1350,19 @@ ewl_engine_theme_object_hide(Ewl_Embed *embed, void *obj)
void
ewl_engine_theme_object_clip_set(Ewl_Embed *embed, void *obj, void *clip)
{
- Ewl_Engine_Cb_Theme_Object_Clip_Set theme_object_clip_set;
+ Ewl_Engine_Cb_Theme_Object_Clip_Set theme_object_clip_set;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- theme_object_clip_set = ewl_engine_hook_get(embed,
- EWL_ENGINE_HOOK_TYPE_THEME,
- EWL_ENGINE_THEME_OBJECT_CLIP_SET);
- if (theme_object_clip_set)
- theme_object_clip_set(obj, clip);
+ theme_object_clip_set = ewl_engine_hook_get(embed,
+ EWL_ENGINE_HOOK_TYPE_THEME,
+ EWL_ENGINE_THEME_OBJECT_CLIP_SET);
+ if (theme_object_clip_set)
+ theme_object_clip_set(obj, clip);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1372,19 +1372,19 @@ ewl_engine_theme_object_clip_set(Ewl_Embed *embed, void *obj, void *clip)
void
ewl_engine_theme_object_clip_unset(Ewl_Embed *embed, void *obj)
{
- Ewl_Engine_Cb_Theme_Object_Clip_Unset theme_object_clip_unset;
+ Ewl_Engine_Cb_Theme_Object_Clip_Unset theme_object_clip_unset;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- theme_object_clip_unset = ewl_engine_hook_get(embed,
- EWL_ENGINE_HOOK_TYPE_THEME,
- EWL_ENGINE_THEME_OBJECT_CLIP_UNSET);
- if (theme_object_clip_unset)
- theme_object_clip_unset(obj);
+ theme_object_clip_unset = ewl_engine_hook_get(embed,
+ EWL_ENGINE_HOOK_TYPE_THEME,
+ EWL_ENGINE_THEME_OBJECT_CLIP_UNSET);
+ if (theme_object_clip_unset)
+ theme_object_clip_unset(obj);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1394,19 +1394,19 @@ ewl_engine_theme_object_clip_unset(Ewl_Embed *embed, void *obj)
void
ewl_engine_theme_object_file_set(Ewl_Embed *embed, void *obj, char *file, char *group)
{
- Ewl_Engine_Cb_Theme_Object_File_Set theme_object_file_set;
+ Ewl_Engine_Cb_Theme_Object_File_Set theme_object_file_set;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- theme_object_file_set = ewl_engine_hook_get(embed,
- EWL_ENGINE_HOOK_TYPE_THEME,
- EWL_ENGINE_THEME_OBJECT_FILE_SET);
- if (theme_object_file_set)
- theme_object_file_set(obj, file, group);
+ theme_object_file_set = ewl_engine_hook_get(embed,
+ EWL_ENGINE_HOOK_TYPE_THEME,
+ EWL_ENGINE_THEME_OBJECT_FILE_SET);
+ if (theme_object_file_set)
+ theme_object_file_set(obj, file, group);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1416,19 +1416,19 @@ ewl_engine_theme_object_file_set(Ewl_Embed *embed, void *obj, char *file, char *
int
ewl_engine_pointer_data_new(Ewl_Embed *embed, unsigned int *data, int w, int h)
{
- Ewl_Engine_Cb_Pointer_Data_New pointer_data_new;
+ Ewl_Engine_Cb_Pointer_Data_New pointer_data_new;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(embed, 0);
- DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(embed, 0);
+ DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, 0);
- pointer_data_new = ewl_engine_hook_get(embed,
- EWL_ENGINE_HOOK_TYPE_POINTER,
- EWL_ENGINE_POINTER_DATA_NEW);
- if (pointer_data_new)
- DRETURN_INT(pointer_data_new(embed, data, w, h), DLEVEL_STABLE);
+ pointer_data_new = ewl_engine_hook_get(embed,
+ EWL_ENGINE_HOOK_TYPE_POINTER,
+ EWL_ENGINE_POINTER_DATA_NEW);
+ if (pointer_data_new)
+ DRETURN_INT(pointer_data_new(embed, data, w, h), DLEVEL_STABLE);
- DRETURN_INT(0, DLEVEL_STABLE);
+ DRETURN_INT(0, DLEVEL_STABLE);
}
/**
@@ -1438,20 +1438,20 @@ ewl_engine_pointer_data_new(Ewl_Embed *embed, unsigned int *data, int w, int h)
void
ewl_engine_pointer_set(Ewl_Embed *embed, int pointer)
{
- Ewl_Engine_Cb_Pointer_Set pointer_set;
+ Ewl_Engine_Cb_Pointer_Set pointer_set;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- pointer_set = ewl_engine_hook_get(embed,
- EWL_ENGINE_HOOK_TYPE_POINTER,
- EWL_ENGINE_POINTER_SET);
- if (pointer_set)
- pointer_set(embed, pointer);
- embed->cursor = pointer;
+ pointer_set = ewl_engine_hook_get(embed,
+ EWL_ENGINE_HOOK_TYPE_POINTER,
+ EWL_ENGINE_POINTER_SET);
+ if (pointer_set)
+ pointer_set(embed, pointer);
+ embed->cursor = pointer;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1461,19 +1461,19 @@ ewl_engine_pointer_set(Ewl_Embed *embed, int pointer)
void
ewl_engine_pointer_free(Ewl_Embed *embed, int pointer)
{
- Ewl_Engine_Cb_Pointer_Set pointer_free;
+ Ewl_Engine_Cb_Pointer_Set pointer_free;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(embed);
- DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
- pointer_free = ewl_engine_hook_get(embed,
- EWL_ENGINE_HOOK_TYPE_POINTER,
- EWL_ENGINE_POINTER_FREE);
- if (pointer_free)
- pointer_free(embed, pointer);
+ pointer_free = ewl_engine_hook_get(embed,
+ EWL_ENGINE_HOOK_TYPE_POINTER,
+ EWL_ENGINE_POINTER_FREE);
+ if (pointer_free)
+ pointer_free(embed, pointer);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1483,52 +1483,52 @@ ewl_engine_pointer_free(Ewl_Embed *embed, int pointer)
int
ewl_engine_pointer_get(Ewl_Embed *embed)
{
- Ewl_Engine_Cb_Pointer_Get pointer_get;
+ Ewl_Engine_Cb_Pointer_Get pointer_get;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(embed, 0);
- DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(embed, 0);
+ DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, 0);
- pointer_get = ewl_engine_hook_get(embed,
- EWL_ENGINE_HOOK_TYPE_POINTER,
- EWL_ENGINE_POINTER_GET);
- if (pointer_get)
- DRETURN_INT(pointer_get(embed), DLEVEL_STABLE);
+ pointer_get = ewl_engine_hook_get(embed,
+ EWL_ENGINE_HOOK_TYPE_POINTER,
+ EWL_ENGINE_POINTER_GET);
+ if (pointer_get)
+ DRETURN_INT(pointer_get(embed), DLEVEL_STABLE);
- DRETURN_INT(0, DLEVEL_STABLE);
+ DRETURN_INT(0, DLEVEL_STABLE);
}
static void **
ewl_engine_hooks_get(Ewl_Engine *engine, Ewl_Engine_Hook_Type type)
{
- void **hooks = NULL;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(engine, NULL);
-
- switch (type)
- {
- case EWL_ENGINE_HOOK_TYPE_WINDOW:
- hooks = engine->functions->hooks.window;
- break;
-
- case EWL_ENGINE_HOOK_TYPE_CANVAS:
- hooks = engine->functions->hooks.canvas;
- break;
-
- case EWL_ENGINE_HOOK_TYPE_THEME:
- hooks = engine->functions->hooks.theme;
- break;
- case EWL_ENGINE_HOOK_TYPE_POINTER:
- hooks = engine->functions->hooks.pointer;
- break;
-
- default:
- DWARNING("Unknown hook type.");
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
-
- DRETURN_PTR(hooks, DLEVEL_STABLE);
+ void **hooks = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(engine, NULL);
+
+ switch (type)
+ {
+ case EWL_ENGINE_HOOK_TYPE_WINDOW:
+ hooks = engine->functions->hooks.window;
+ break;
+
+ case EWL_ENGINE_HOOK_TYPE_CANVAS:
+ hooks = engine->functions->hooks.canvas;
+ break;
+
+ case EWL_ENGINE_HOOK_TYPE_THEME:
+ hooks = engine->functions->hooks.theme;
+ break;
+ case EWL_ENGINE_HOOK_TYPE_POINTER:
+ hooks = engine->functions->hooks.pointer;
+ break;
+
+ default:
+ DWARNING("Unknown hook type.");
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
+
+ DRETURN_PTR(hooks, DLEVEL_STABLE);
}
/**
@@ -1541,51 +1541,51 @@ ewl_engine_hooks_get(Ewl_Engine *engine, Ewl_Engine_Hook_Type type)
static void *
ewl_engine_hook_get(Ewl_Embed *embed, Ewl_Engine_Hook_Type type, int hook)
{
- Ewl_Engine *caller;
- void *match = NULL;
- void **hooks = NULL;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(embed, NULL);
- DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, NULL);
-
- caller = EWL_ENGINE(embed->engine);
- hooks = ewl_engine_hooks_get(caller, type);
- if ((!hooks || !hooks[hook]) && caller->dependancies)
- {
- Ecore_DList *deps;
-
- deps = caller->dependancies;
- ecore_dlist_first_goto(deps);
- while ((caller = ecore_dlist_next(deps)))
- {
- hooks = ewl_engine_hooks_get(caller, type);
- if (hooks && hooks[hook]) break;
- }
- }
- if (hooks) match = hooks[hook];
-
- DRETURN_PTR(match, DLEVEL_STABLE);
+ Ewl_Engine *caller;
+ void *match = NULL;
+ void **hooks = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(embed, NULL);
+ DCHECK_TYPE_RET(embed, EWL_EMBED_TYPE, NULL);
+
+ caller = EWL_ENGINE(embed->engine);
+ hooks = ewl_engine_hooks_get(caller, type);
+ if ((!hooks || !hooks[hook]) && caller->dependancies)
+ {
+ Ecore_DList *deps;
+
+ deps = caller->dependancies;
+ ecore_dlist_first_goto(deps);
+ while ((caller = ecore_dlist_next(deps)))
+ {
+ hooks = ewl_engine_hooks_get(caller, type);
+ if (hooks && hooks[hook]) break;
+ }
+ }
+ if (hooks) match = hooks[hook];
+
+ DRETURN_PTR(match, DLEVEL_STABLE);
}
static void
ewl_engine_free(Ewl_Engine *engine)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(engine);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(engine);
- if (engine->functions->shutdown)
- engine->functions->shutdown(engine);
+ if (engine->functions->shutdown)
+ engine->functions->shutdown(engine);
- /* parents will be shutdown when their freed by the cleanup code */
- if (engine->dependancies)
- ecore_dlist_destroy(engine->dependancies);
+ /* parents will be shutdown when their freed by the cleanup code */
+ if (engine->dependancies)
+ ecore_dlist_destroy(engine->dependancies);
- ecore_plugin_unload(engine->plugin);
- engine->plugin = NULL;
+ ecore_plugin_unload(engine->plugin);
+ engine->plugin = NULL;
- FREE(engine);
+ FREE(engine);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_engines.h b/src/lib/ewl_engines.h
index 79d67f6..981d312 100644
--- a/src/lib/ewl_engines.h
+++ b/src/lib/ewl_engines.h
@@ -1,107 +1,107 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_ENGINES_H
#define EWL_ENGINES_H
enum Ewl_Engine_Window_Hooks
{
- EWL_ENGINE_WINDOW_NEW, /**< Create the window */
- EWL_ENGINE_WINDOW_DESTROY,/**< Destroy the window */
-
- EWL_ENGINE_WINDOW_MOVE, /**< Move the window to
- the given location */
- EWL_ENGINE_WINDOW_RESIZE, /**< Resize the window */
- EWL_ENGINE_WINDOW_MIN_MAX_SIZE_SET, /**< Set the min and max sizes */
- EWL_ENGINE_WINDOW_SHOW, /**< Show the window */
- EWL_ENGINE_WINDOW_HIDE, /**< Hide the window */
-
- EWL_ENGINE_WINDOW_TITLE_SET, /**< Set the window title */
- EWL_ENGINE_WINDOW_NAME_CLASS_SET,/**< Set the window name/class */
-
- EWL_ENGINE_WINDOW_BORDERLESS_SET,/**< Set the borderless
- state of the window */
- EWL_ENGINE_WINDOW_DIALOG_SET, /**< Set the dialog setting of the window */
- EWL_ENGINE_WINDOW_STATES_SET, /**< Set the window state flags */
- EWL_ENGINE_WINDOW_HINTS_SET, /**< Set the hints */
- EWL_ENGINE_WINDOW_TRANSIENT_FOR,/**< Set the window transient */
- EWL_ENGINE_WINDOW_LEADER_SET, /**< Set the windo to be a client */
- EWL_ENGINE_WINDOW_RAISE, /**< Raise the window */
- EWL_ENGINE_WINDOW_LOWER, /**< Lower the window */
-
- EWL_ENGINE_WINDOW_KEYBOARD_GRAB, /**< Set the keyboard grab */
- EWL_ENGINE_WINDOW_KEYBOARD_UNGRAB, /**< Set the keyboard ungrab */
- EWL_ENGINE_WINDOW_POINTER_GRAB, /**< Set the pointer grab */
- EWL_ENGINE_WINDOW_POINTER_UNGRAB, /**< Set the pointer ungrab */
-
- EWL_ENGINE_WINDOW_SELECTION_TEXT_SET, /**< Set the selection text */
- EWL_ENGINE_WINDOW_GEOMETRY_GET, /**< Get the window geometry */
-
- EWL_ENGINE_WINDOW_DND_AWARE_SET, /**< Set the window dnd aware */
- EWL_ENGINE_WINDOW_DESKTOP_SIZE_GET, /**< Get the size of the desktop */
-
- EWL_ENGINE_WINDOW_DND_DRAG_TYPES_SET, /**< Set window drag types */
- EWL_ENGINE_WINDOW_DND_DRAG_START, /**< Begin DND drag process */
- EWL_ENGINE_WINDOW_DND_DRAG_DROP, /**< Complete DND drag process */
- EWL_ENGINE_WINDOW_DND_DRAG_DATA_SEND, /**< Send data after request */
-
- EWL_ENGINE_WINDOW_MAX
+ EWL_ENGINE_WINDOW_NEW, /**< Create the window */
+ EWL_ENGINE_WINDOW_DESTROY,/**< Destroy the window */
+
+ EWL_ENGINE_WINDOW_MOVE, /**< Move the window to
+ the given location */
+ EWL_ENGINE_WINDOW_RESIZE, /**< Resize the window */
+ EWL_ENGINE_WINDOW_MIN_MAX_SIZE_SET, /**< Set the min and max sizes */
+ EWL_ENGINE_WINDOW_SHOW, /**< Show the window */
+ EWL_ENGINE_WINDOW_HIDE, /**< Hide the window */
+
+ EWL_ENGINE_WINDOW_TITLE_SET, /**< Set the window title */
+ EWL_ENGINE_WINDOW_NAME_CLASS_SET,/**< Set the window name/class */
+
+ EWL_ENGINE_WINDOW_BORDERLESS_SET,/**< Set the borderless
+ state of the window */
+ EWL_ENGINE_WINDOW_DIALOG_SET, /**< Set the dialog setting of the window */
+ EWL_ENGINE_WINDOW_STATES_SET, /**< Set the window state flags */
+ EWL_ENGINE_WINDOW_HINTS_SET, /**< Set the hints */
+ EWL_ENGINE_WINDOW_TRANSIENT_FOR,/**< Set the window transient */
+ EWL_ENGINE_WINDOW_LEADER_SET, /**< Set the windo to be a client */
+ EWL_ENGINE_WINDOW_RAISE, /**< Raise the window */
+ EWL_ENGINE_WINDOW_LOWER, /**< Lower the window */
+
+ EWL_ENGINE_WINDOW_KEYBOARD_GRAB, /**< Set the keyboard grab */
+ EWL_ENGINE_WINDOW_KEYBOARD_UNGRAB, /**< Set the keyboard ungrab */
+ EWL_ENGINE_WINDOW_POINTER_GRAB, /**< Set the pointer grab */
+ EWL_ENGINE_WINDOW_POINTER_UNGRAB, /**< Set the pointer ungrab */
+
+ EWL_ENGINE_WINDOW_SELECTION_TEXT_SET, /**< Set the selection text */
+ EWL_ENGINE_WINDOW_GEOMETRY_GET, /**< Get the window geometry */
+
+ EWL_ENGINE_WINDOW_DND_AWARE_SET, /**< Set the window dnd aware */
+ EWL_ENGINE_WINDOW_DESKTOP_SIZE_GET, /**< Get the size of the desktop */
+
+ EWL_ENGINE_WINDOW_DND_DRAG_TYPES_SET, /**< Set window drag types */
+ EWL_ENGINE_WINDOW_DND_DRAG_START, /**< Begin DND drag process */
+ EWL_ENGINE_WINDOW_DND_DRAG_DROP, /**< Complete DND drag process */
+ EWL_ENGINE_WINDOW_DND_DRAG_DATA_SEND, /**< Send data after request */
+
+ EWL_ENGINE_WINDOW_MAX
};
enum Ewl_Engine_Canvas_Hooks
{
- EWL_ENGINE_CANVAS_SETUP, /**< Setup the render canvas */
- EWL_ENGINE_CANVAS_OUTPUT_SET, /**< Set the canvas size */
+ EWL_ENGINE_CANVAS_SETUP, /**< Setup the render canvas */
+ EWL_ENGINE_CANVAS_OUTPUT_SET, /**< Set the canvas size */
- EWL_ENGINE_CANVAS_RENDER,
- EWL_ENGINE_CANVAS_FREEZE,
- EWL_ENGINE_CANVAS_THAW,
+ EWL_ENGINE_CANVAS_RENDER,
+ EWL_ENGINE_CANVAS_FREEZE,
+ EWL_ENGINE_CANVAS_THAW,
- EWL_ENGINE_CANVAS_DAMAGE_ADD,
+ EWL_ENGINE_CANVAS_DAMAGE_ADD,
- EWL_ENGINE_CANVAS_MAX
+ EWL_ENGINE_CANVAS_MAX
};
enum Ewl_Engine_Theme_Hooks
{
- EWL_ENGINE_THEME_FREEZE,
- EWL_ENGINE_THEME_THAW,
-
- EWL_ENGINE_THEME_DATA_GET,
-
- EWL_ENGINE_THEME_WIDGET_GROUP,
-
- EWL_ENGINE_THEME_OBJECT_ADD,
- EWL_ENGINE_THEME_OBJECT_DEL,
- EWL_ENGINE_THEME_OBJECT_MOVE,
- EWL_ENGINE_THEME_OBJECT_RESIZE,
- EWL_ENGINE_THEME_OBJECT_SHOW,
- EWL_ENGINE_THEME_OBJECT_HIDE,
- EWL_ENGINE_THEME_OBJECT_CLIP_SET,
- EWL_ENGINE_THEME_OBJECT_CLIP_UNSET,
- EWL_ENGINE_THEME_OBJECT_FILE_SET,
- EWL_ENGINE_THEME_OBJECT_LOAD_ERROR,
- EWL_ENGINE_THEME_OBJECT_MIN_SIZE_GET,
- EWL_ENGINE_THEME_OBJECT_MAX_SIZE_GET,
- EWL_ENGINE_THEME_OBJECT_SIGNAL_SEND,
- EWL_ENGINE_THEME_OBJECT_PART_TEXT_SET,
- EWL_ENGINE_THEME_OBJECT_COLOR_CLASS_SET,
-
- EWL_ENGINE_THEME_CLIP_ADD,
- EWL_ENGINE_THEME_CLIP_DEL,
- EWL_ENGINE_THEME_CLIP_CLIPEES_GET,
- EWL_ENGINE_THEME_CLIP_COLOR_SET,
-
- EWL_ENGINE_THEME_WIDGET_STACK_ADD,
- EWL_ENGINE_THEME_WIDGET_LAYER_UPDATE,
- EWL_ENGINE_THEME_MAX,
+ EWL_ENGINE_THEME_FREEZE,
+ EWL_ENGINE_THEME_THAW,
+
+ EWL_ENGINE_THEME_DATA_GET,
+
+ EWL_ENGINE_THEME_WIDGET_GROUP,
+
+ EWL_ENGINE_THEME_OBJECT_ADD,
+ EWL_ENGINE_THEME_OBJECT_DEL,
+ EWL_ENGINE_THEME_OBJECT_MOVE,
+ EWL_ENGINE_THEME_OBJECT_RESIZE,
+ EWL_ENGINE_THEME_OBJECT_SHOW,
+ EWL_ENGINE_THEME_OBJECT_HIDE,
+ EWL_ENGINE_THEME_OBJECT_CLIP_SET,
+ EWL_ENGINE_THEME_OBJECT_CLIP_UNSET,
+ EWL_ENGINE_THEME_OBJECT_FILE_SET,
+ EWL_ENGINE_THEME_OBJECT_LOAD_ERROR,
+ EWL_ENGINE_THEME_OBJECT_MIN_SIZE_GET,
+ EWL_ENGINE_THEME_OBJECT_MAX_SIZE_GET,
+ EWL_ENGINE_THEME_OBJECT_SIGNAL_SEND,
+ EWL_ENGINE_THEME_OBJECT_PART_TEXT_SET,
+ EWL_ENGINE_THEME_OBJECT_COLOR_CLASS_SET,
+
+ EWL_ENGINE_THEME_CLIP_ADD,
+ EWL_ENGINE_THEME_CLIP_DEL,
+ EWL_ENGINE_THEME_CLIP_CLIPEES_GET,
+ EWL_ENGINE_THEME_CLIP_COLOR_SET,
+
+ EWL_ENGINE_THEME_WIDGET_STACK_ADD,
+ EWL_ENGINE_THEME_WIDGET_LAYER_UPDATE,
+ EWL_ENGINE_THEME_MAX,
};
enum Ewl_Engine_Pointer_Hooks
{
- EWL_ENGINE_POINTER_DATA_NEW, /**< Create pointer from ARGB data */
- EWL_ENGINE_POINTER_FREE, /**< Free a created pointer */
- EWL_ENGINE_POINTER_GET, /**< Get the current pointer */
- EWL_ENGINE_POINTER_SET, /**< Set the current pointer */
- EWL_ENGINE_POINTER_MAX
+ EWL_ENGINE_POINTER_DATA_NEW, /**< Create pointer from ARGB data */
+ EWL_ENGINE_POINTER_FREE, /**< Free a created pointer */
+ EWL_ENGINE_POINTER_GET, /**< Get the current pointer */
+ EWL_ENGINE_POINTER_SET, /**< Set the current pointer */
+ EWL_ENGINE_POINTER_MAX
};
typedef enum Ewl_Engine_Window_Hooks Ewl_Engine_Window_Hooks;
@@ -126,15 +126,15 @@ typedef struct Ewl_Engine_Info Ewl_Engine_Info;
*/
struct Ewl_Engine_Info
{
- void (*shutdown)(Ewl_Engine *engine); /**< Shutdown the engine */
-
- struct
- {
- void **window; /**< The window hooks */
- void **canvas; /**< The canvas hooks */
- void **theme; /**< The theme hooks */
- void **pointer; /**< The pointer hooks */
- } hooks; /**< The engine hooks */
+ void (*shutdown)(Ewl_Engine *engine); /**< Shutdown the engine */
+
+ struct
+ {
+ void **window; /**< The window hooks */
+ void **canvas; /**< The canvas hooks */
+ void **theme; /**< The theme hooks */
+ void **pointer; /**< The pointer hooks */
+ } hooks; /**< The engine hooks */
};
/**
@@ -142,147 +142,147 @@ struct Ewl_Engine_Info
*/
struct Ewl_Engine
{
- Ecore_Plugin * plugin; /**< The plugin of the engine */
+ Ecore_Plugin * plugin; /**< The plugin of the engine */
- Ecore_DList *dependancies; /**< The engines this one depends on */
- Ewl_Engine_Info *functions; /**< The functions used by ewl,
- suppled by the engine */
+ Ecore_DList *dependancies; /**< The engines this one depends on */
+ Ewl_Engine_Info *functions; /**< The functions used by ewl,
+ suppled by the engine */
};
extern Ecore_Path_Group *ewl_engines_path;
-int ewl_engines_init(void);
-void ewl_engines_shutdown(void);
+int ewl_engines_init(void);
+void ewl_engines_shutdown(void);
-Ecore_List *ewl_engine_names_get(void);
+Ecore_List *ewl_engine_names_get(void);
-Ewl_Engine *ewl_engine_new(const char *name,
- int *argc, char ** argv);
+Ewl_Engine *ewl_engine_new(const char *name,
+ int *argc, char ** argv);
-void ewl_engine_event_handlers_init(void);
-void ewl_engine_event_handlers_shutdown(void);
+void ewl_engine_event_handlers_init(void);
+void ewl_engine_event_handlers_shutdown(void);
-void ewl_engine_engine_shutdown(Ewl_Window *win);
+void ewl_engine_engine_shutdown(Ewl_Window *win);
-void ewl_engine_window_new(Ewl_Window *win);
-void ewl_engine_window_destroy(Ewl_Window *win);
+void ewl_engine_window_new(Ewl_Window *win);
+void ewl_engine_window_destroy(Ewl_Window *win);
-void ewl_engine_window_move(Ewl_Window *win);
-void ewl_engine_window_resize(Ewl_Window *win);
-void ewl_engine_window_min_max_size_set(Ewl_Window *win);
-void ewl_engine_window_show(Ewl_Window *win);
-void ewl_engine_window_hide(Ewl_Window *win);
+void ewl_engine_window_move(Ewl_Window *win);
+void ewl_engine_window_resize(Ewl_Window *win);
+void ewl_engine_window_min_max_size_set(Ewl_Window *win);
+void ewl_engine_window_show(Ewl_Window *win);
+void ewl_engine_window_hide(Ewl_Window *win);
-void ewl_engine_window_title_set(Ewl_Window *win);
-void ewl_engine_window_name_class_set(Ewl_Window *win);
+void ewl_engine_window_title_set(Ewl_Window *win);
+void ewl_engine_window_name_class_set(Ewl_Window *win);
-void ewl_engine_window_borderless_set(Ewl_Window *win);
-void ewl_engine_window_dialog_set(Ewl_Window *win);
-void ewl_engine_window_states_set(Ewl_Window *win);
-void ewl_engine_window_hints_set(Ewl_Window *win);
-void ewl_engine_window_transient_for(Ewl_Window *win);
-void ewl_engine_window_leader_set(Ewl_Window *win);
+void ewl_engine_window_borderless_set(Ewl_Window *win);
+void ewl_engine_window_dialog_set(Ewl_Window *win);
+void ewl_engine_window_states_set(Ewl_Window *win);
+void ewl_engine_window_hints_set(Ewl_Window *win);
+void ewl_engine_window_transient_for(Ewl_Window *win);
+void ewl_engine_window_leader_set(Ewl_Window *win);
-void ewl_engine_window_raise(Ewl_Window *win);
-void ewl_engine_window_lower(Ewl_Window *win);
+void ewl_engine_window_raise(Ewl_Window *win);
+void ewl_engine_window_lower(Ewl_Window *win);
-int ewl_engine_keyboard_grab(Ewl_Window *win);
-void ewl_engine_keyboard_ungrab(Ewl_Window *win);
-int ewl_engine_pointer_grab(Ewl_Window *win);
-void ewl_engine_pointer_ungrab(Ewl_Window *win);
+int ewl_engine_keyboard_grab(Ewl_Window *win);
+void ewl_engine_keyboard_ungrab(Ewl_Window *win);
+int ewl_engine_pointer_grab(Ewl_Window *win);
+void ewl_engine_pointer_ungrab(Ewl_Window *win);
-void ewl_engine_window_geometry_get(Ewl_Window *win, int root,
- int *width, int *height);
-void ewl_engine_embed_selection_text_set(Ewl_Embed *emb,
- const char *txt);
-void ewl_engine_embed_dnd_aware_set(Ewl_Embed *embed);
-void ewl_engine_embed_dnd_drag_types_set(Ewl_Embed *embed,
- char **types,
- unsigned int num);
-void ewl_engine_embed_dnd_drag_start(Ewl_Embed *embed);
-void ewl_engine_embed_dnd_drag_drop(Ewl_Embed *embed);
+void ewl_engine_window_geometry_get(Ewl_Window *win, int root,
+ int *width, int *height);
+void ewl_engine_embed_selection_text_set(Ewl_Embed *emb,
+ const char *txt);
+void ewl_engine_embed_dnd_aware_set(Ewl_Embed *embed);
+void ewl_engine_embed_dnd_drag_types_set(Ewl_Embed *embed,
+ char **types,
+ unsigned int num);
+void ewl_engine_embed_dnd_drag_start(Ewl_Embed *embed);
+void ewl_engine_embed_dnd_drag_drop(Ewl_Embed *embed);
int ewl_engine_embed_dnd_drag_data_send(Ewl_Embed *embed,
- void *handle,
- void *data,
- int size);
-void ewl_engine_desktop_size_get(Ewl_Embed *embed, int *w, int *h);
-
-void ewl_engine_canvas_setup(Ewl_Window *win, int debug);
-void ewl_engine_canvas_output_set(Ewl_Embed *emb, int x, int y,
- int width, int height);
-void ewl_engine_canvas_render(Ewl_Embed *embed);
-void ewl_engine_canvas_freeze(Ewl_Embed *embed);
-void ewl_engine_canvas_thaw(Ewl_Embed *embed);
-void ewl_engine_canvas_damage_add(Ewl_Embed *embed, int x, int y,
- int w, int h);
-
-void ewl_engine_theme_freeze(Ewl_Embed *embed);
-void ewl_engine_theme_thaw(Ewl_Embed *embed);
-char *ewl_engine_theme_data_get(Ewl_Widget *w, char *key);
-
-int ewl_engine_pointer_data_new(Ewl_Embed *embed,
- unsigned int *data, int w, int h);
-void ewl_engine_pointer_free(Ewl_Embed *embed, int pointer);
-void ewl_engine_pointer_set(Ewl_Embed *embed, int pointer);
-int ewl_engine_pointer_get(Ewl_Embed *embed);
+ void *handle,
+ void *data,
+ int size);
+void ewl_engine_desktop_size_get(Ewl_Embed *embed, int *w, int *h);
+
+void ewl_engine_canvas_setup(Ewl_Window *win, int debug);
+void ewl_engine_canvas_output_set(Ewl_Embed *emb, int x, int y,
+ int width, int height);
+void ewl_engine_canvas_render(Ewl_Embed *embed);
+void ewl_engine_canvas_freeze(Ewl_Embed *embed);
+void ewl_engine_canvas_thaw(Ewl_Embed *embed);
+void ewl_engine_canvas_damage_add(Ewl_Embed *embed, int x, int y,
+ int w, int h);
+
+void ewl_engine_theme_freeze(Ewl_Embed *embed);
+void ewl_engine_theme_thaw(Ewl_Embed *embed);
+char *ewl_engine_theme_data_get(Ewl_Widget *w, char *key);
+
+int ewl_engine_pointer_data_new(Ewl_Embed *embed,
+ unsigned int *data, int w, int h);
+void ewl_engine_pointer_free(Ewl_Embed *embed, int pointer);
+void ewl_engine_pointer_set(Ewl_Embed *embed, int pointer);
+int ewl_engine_pointer_get(Ewl_Embed *embed);
/**
* Internal engine hook typedefs, you only need these if you're writing an
* engine.
*/
-typedef void (*Ewl_Engine_Cb_Window_New)(Ewl_Window *win); /**< Create the window */
+typedef void (*Ewl_Engine_Cb_Window_New)(Ewl_Window *win); /**< Create the window */
typedef void (*Ewl_Engine_Cb_Window_Destroy)(Ewl_Window *win);/**< Destroy the window */
-typedef void (*Ewl_Engine_Cb_Window_Move)(Ewl_Window *win); /**< Move the window to
- the given location */
-typedef void (*Ewl_Engine_Cb_Window_Resize)(Ewl_Window *win); /**< Resize the window */
+typedef void (*Ewl_Engine_Cb_Window_Move)(Ewl_Window *win); /**< Move the window to
+ the given location */
+typedef void (*Ewl_Engine_Cb_Window_Resize)(Ewl_Window *win); /**< Resize the window */
typedef void (*Ewl_Engine_Cb_Window_Min_Max_Size_Set)(Ewl_Window *win); /**< Set the min
- and max sizes */
-typedef void (*Ewl_Engine_Cb_Window_Show)(Ewl_Window *win); /**< Show the window */
-typedef void (*Ewl_Engine_Cb_Window_Hide)(Ewl_Window *win); /**< Hide the window */
+ and max sizes */
+typedef void (*Ewl_Engine_Cb_Window_Show)(Ewl_Window *win); /**< Show the window */
+typedef void (*Ewl_Engine_Cb_Window_Hide)(Ewl_Window *win); /**< Hide the window */
typedef void (*Ewl_Engine_Cb_Window_Title_Set)(Ewl_Window *win); /**< Set the window title */
-typedef void (*Ewl_Engine_Cb_Window_Name_Class_Set)(Ewl_Window *win); /**< Set the window
- name/class */
-typedef void (*Ewl_Engine_Cb_Window_Borderless_Set)(Ewl_Window *win); /**< Set the borderless
- state of the window */
-typedef void (*Ewl_Engine_Cb_Window_Dialog_Set)(Ewl_Window *win); /**< Set the dialog
- setting of the window */
-typedef void (*Ewl_Engine_Cb_Window_Transient_For)(Ewl_Window *win); /**< Set the window
- transient */
-typedef void (*Ewl_Engine_Cb_Window_Leader_Set)(Ewl_Window *win); /**< Set the window's
- leader */
+typedef void (*Ewl_Engine_Cb_Window_Name_Class_Set)(Ewl_Window *win); /**< Set the window
+ name/class */
+typedef void (*Ewl_Engine_Cb_Window_Borderless_Set)(Ewl_Window *win); /**< Set the borderless
+ state of the window */
+typedef void (*Ewl_Engine_Cb_Window_Dialog_Set)(Ewl_Window *win); /**< Set the dialog
+ setting of the window */
+typedef void (*Ewl_Engine_Cb_Window_Transient_For)(Ewl_Window *win); /**< Set the window
+ transient */
+typedef void (*Ewl_Engine_Cb_Window_Leader_Set)(Ewl_Window *win); /**< Set the window's
+ leader */
typedef void (*Ewl_Engine_Cb_Window_States_Set)(Ewl_Window *win); /**< Set the window states */
typedef void (*Ewl_Engine_Cb_Window_Hints_Set)(Ewl_Window *win); /**< Set the window hints */
-typedef void (*Ewl_Engine_Cb_Window_Raise)(Ewl_Window *win); /**< Raise the window */
-typedef void (*Ewl_Engine_Cb_Window_Lower)(Ewl_Window *win); /**< Lower the window */
-typedef int (*Ewl_Engine_Cb_Keyboard_Grab)(Ewl_Window *win); /**< Set the keyboard grab */
+typedef void (*Ewl_Engine_Cb_Window_Raise)(Ewl_Window *win); /**< Raise the window */
+typedef void (*Ewl_Engine_Cb_Window_Lower)(Ewl_Window *win); /**< Lower the window */
+typedef int (*Ewl_Engine_Cb_Keyboard_Grab)(Ewl_Window *win); /**< Set the keyboard grab */
typedef void (*Ewl_Engine_Cb_Keyboard_Ungrab)(Ewl_Window *win); /**< Set the keyboard
- ungrab */
-typedef int (*Ewl_Engine_Cb_Pointer_Grab)(Ewl_Window *win); /**< Set the pointer grab */
+ ungrab */
+typedef int (*Ewl_Engine_Cb_Pointer_Grab)(Ewl_Window *win); /**< Set the pointer grab */
typedef void (*Ewl_Engine_Cb_Pointer_Ungrab)(Ewl_Window *win); /**< Set the pointer ungrab */
typedef void (*Ewl_Engine_Cb_Window_Selection_Text_Set)(Ewl_Embed *emb,
- const char *txt); /**< Set the
- selection text */
+ const char *txt); /**< Set the
+ selection text */
typedef void (*Ewl_Engine_Cb_Window_Geometry_Get)(Ewl_Window *win,
- int *width, int *height); /**< Get the window
- geometry */
-typedef void (*Ewl_Engine_Cb_Window_Dnd_Aware_Set)(Ewl_Embed *embed); /**< Set the embed
- dnd aware */
-typedef void (*Ewl_Engine_Cb_Window_Dnd_Drag_Types_Set)(Ewl_Embed *embed, char **types, unsigned int num); /**< Set the drag types */
-typedef void (*Ewl_Engine_Cb_Window_Dnd_Drag_Start)(Ewl_Embed *embed); /**< Start the drag process */
-typedef void (*Ewl_Engine_Cb_Window_Dnd_Drag_Drop)(Ewl_Embed *embed); /**< End the drag process with a drop event */
-typedef int (*Ewl_Engine_Cb_Window_Dnd_Drag_Data_Send)(Ewl_Embed *embed, void *handle, void *data, int size); /**< Send the drag data */
+ int *width, int *height); /**< Get the window
+ geometry */
+typedef void (*Ewl_Engine_Cb_Window_Dnd_Aware_Set)(Ewl_Embed *embed); /**< Set the embed
+ dnd aware */
+typedef void (*Ewl_Engine_Cb_Window_Dnd_Drag_Types_Set)(Ewl_Embed *embed, char **types, unsigned int num); /**< Set the drag types */
+typedef void (*Ewl_Engine_Cb_Window_Dnd_Drag_Start)(Ewl_Embed *embed); /**< Start the drag process */
+typedef void (*Ewl_Engine_Cb_Window_Dnd_Drag_Drop)(Ewl_Embed *embed); /**< End the drag process with a drop event */
+typedef int (*Ewl_Engine_Cb_Window_Dnd_Drag_Data_Send)(Ewl_Embed *embed, void *handle, void *data, int size); /**< Send the drag data */
typedef void (*Ewl_Engine_Cb_Window_Desktop_Size_Get)(Ewl_Embed *embed,
- int *w, int *h); /**< Get the desktop
- size */
+ int *w, int *h); /**< Get the desktop
+ size */
typedef void (*Ewl_Engine_Cb_Canvas_Setup)(Ewl_Window *win, int debug); /**< Setup the render canvas */
typedef void (*Ewl_Engine_Cb_Canvas_Output_Set)(Ewl_Embed *emb, int x, int y,
- int width, int height);
+ int width, int height);
typedef void (*Ewl_Engine_Cb_Canvas_Render)(Ewl_Embed *embed);
typedef void (*Ewl_Engine_Cb_Canvas_Freeze)(Ewl_Embed *embed);
typedef void (*Ewl_Engine_Cb_Canvas_Thaw)(Ewl_Embed *embed);
typedef void (*Ewl_Engine_Cb_Canvas_Damage_Add)(Ewl_Embed *embed,
- int x, int y, int w, int h);
+ int x, int y, int w, int h);
typedef void (*Ewl_Engine_Cb_Theme_Freeze)();
typedef void (*Ewl_Engine_Cb_Theme_Thaw)();
typedef char *(*Ewl_Engine_Cb_Theme_Data_Get)(const char *path, char *key);
@@ -298,27 +298,27 @@ typedef void *(*Ewl_Engine_Cb_Theme_Object_Clip_Unset)(void *obj);
typedef void (*Ewl_Engine_Cb_Theme_Object_Stack_Add)(Ewl_Widget *w);
typedef void (*Ewl_Engine_Cb_Theme_Object_Layer_Update)(Ewl_Widget *w);
typedef void (*Ewl_Engine_Cb_Theme_Object_File_Set)(void *obj, char *path,
- char *group);
+ char *group);
typedef void *(*Ewl_Engine_Cb_Theme_Object_Load_Error)(void *obj);
typedef void (*Ewl_Engine_Cb_Theme_Object_Min_Size_Get)(void *obj, int *w, int *h);
typedef void (*Ewl_Engine_Cb_Theme_Object_Max_Size_Get)(void *obj, int *w, int *h);
typedef void (*Ewl_Engine_Cb_Theme_Object_Signal_Send)(void *obj,
- char *state, char *source);
+ char *state, char *source);
typedef void (*Ewl_Engine_Cb_Theme_Object_Part_Text_Set)(void *obj,
- char *part, char *text);
+ char *part, char *text);
typedef void (*Ewl_Engine_Cb_Theme_Object_Color_Class_Set)(char *name, int r,
- int g, int b, int r2,
- int g2, int b2, int r3,
- int g3, int b3);
+ int g, int b, int r2,
+ int g2, int b2, int r3,
+ int g3, int b3);
typedef void *(*Ewl_Engine_Cb_Theme_Clip_Add)(Ewl_Embed *embed);
typedef void (*Ewl_Engine_Cb_Theme_Clip_Del)(void *clip);
typedef void *(*Ewl_Engine_Cb_Theme_Clip_Clipees_Get)(void *clip);
typedef void (*Ewl_Engine_Cb_Theme_Clip_Color_Set)(void *clip, int r, int g,
- int b, int a);
+ int b, int a);
typedef int (*Ewl_Engine_Cb_Pointer_Data_New)(Ewl_Embed *embed,
- unsigned int *data,
- int w, int h);
+ unsigned int *data,
+ int w, int h);
typedef void (*Ewl_Engine_Cb_Pointer_Free)(Ewl_Embed *embed, int pointer);
typedef void (*Ewl_Engine_Cb_Pointer_Set)(Ewl_Embed *embed, int pointer);
typedef int (*Ewl_Engine_Cb_Pointer_Get)(Ewl_Embed *embed);
diff --git a/src/lib/ewl_entry.c b/src/lib/ewl_entry.c
index f7d09e6..6eb2122 100644
--- a/src/lib/ewl_entry.c
+++ b/src/lib/ewl_entry.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_entry.h"
#include "ewl_text_trigger.h"
@@ -11,7 +11,7 @@
#include "ewl_debug.h"
static Ewl_Widget *ewl_entry_view_cb_widget_fetch(void *data, unsigned int row,
- unsigned int col);
+ unsigned int col);
static Ewl_Widget *ewl_entry_view_cb_header_fetch(void *data, unsigned int col);
#ifdef _WIN32
@@ -71,13 +71,13 @@ char *nl_langinfo( nl_item index )
char *p;
result = replace( result, setlocale( LC_CTYPE, NULL ));
if( (p = strrchr( result, '.' )) == NULL )
- return nothing;
+ return nothing;
- if( (++p - result) > 2 )
- strcpy( result, "cp" );
- else
- *result = '\0';
- strcat( result, p );
+ if( (++p - result) > 2 )
+ strcpy( result, "cp" );
+ else
+ *result = '\0';
+ strcat( result, p );
return result;
}
}
@@ -93,21 +93,21 @@ char *nl_langinfo( nl_item index )
Ewl_Widget *
ewl_entry_new(void)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- w = NEW(Ewl_Entry, 1);
- if (!w)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ w = NEW(Ewl_Entry, 1);
+ if (!w)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_entry_init(EWL_ENTRY(w)))
- {
- ewl_widget_destroy(w);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ewl_entry_init(EWL_ENTRY(w)))
+ {
+ ewl_widget_destroy(w);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
/**
@@ -120,15 +120,15 @@ ewl_entry_new(void)
Ewl_Widget *
ewl_password_new(void)
{
- Ewl_Widget *e;
+ Ewl_Widget *e;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- e = ewl_entry_new();
- ewl_widget_appearance_set(e, "password/"EWL_ENTRY_TYPE);
- ewl_text_obscure_set(EWL_TEXT(e), "*");
+ e = ewl_entry_new();
+ ewl_widget_appearance_set(e, "password/"EWL_ENTRY_TYPE);
+ ewl_text_obscure_set(EWL_TEXT(e), "*");
- DRETURN_PTR(e, DLEVEL_STABLE);
+ DRETURN_PTR(e, DLEVEL_STABLE);
}
/**
@@ -139,66 +139,66 @@ ewl_password_new(void)
int
ewl_entry_init(Ewl_Entry *e)
{
- const char *text_types[] = { "UTF8_STRING", "text/plain", NULL };
- Ewl_Widget *w;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(e, FALSE);
-
- w = EWL_WIDGET(e);
-
- if (!ewl_text_init(EWL_TEXT(e)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- ewl_widget_inherit(w, EWL_ENTRY_TYPE);
- ewl_widget_appearance_set(w, EWL_ENTRY_TYPE);
- ewl_widget_focusable_set(EWL_WIDGET(e), TRUE);
-
- ewl_object_fill_policy_set(EWL_OBJECT(e), EWL_FLAG_FILL_HSHRINK |
- EWL_FLAG_FILL_HFILL);
-
- ewl_container_callback_intercept(EWL_CONTAINER(w), EWL_CALLBACK_FOCUS_IN);
- ewl_container_callback_intercept(EWL_CONTAINER(w), EWL_CALLBACK_FOCUS_OUT);
- ewl_container_callback_intercept(EWL_CONTAINER(w), EWL_CALLBACK_DND_POSITION);
- ewl_container_callback_intercept(EWL_CONTAINER(w), EWL_CALLBACK_DND_DATA_RECEIVED);
-
- /* setup the cursor */
- e->cursor = ewl_entry_cursor_new(e);
- ewl_container_child_append(EWL_CONTAINER(e), e->cursor);
- ewl_widget_internal_set(e->cursor, TRUE);
- ewl_object_fill_policy_set(EWL_OBJECT(e->cursor), EWL_FLAG_FILL_VFILL);
-
- /* Set the pointer */
- ewl_attach_mouse_cursor_set(EWL_WIDGET(e), EWL_MOUSE_CURSOR_XTERM);
-
- /* this has to be called after the cursor is created as it will try
- * to show the cursor */
- ewl_entry_multiline_set(e, FALSE);
- ewl_entry_editable_set(e, TRUE);
- ewl_text_selectable_set(EWL_TEXT(e), TRUE);
- ewl_dnd_accepted_types_set(EWL_WIDGET(e), text_types);
-
- /* setup callbacks */
- ewl_callback_append(w, EWL_CALLBACK_FOCUS_IN,
- ewl_entry_cb_focus_in, NULL);
- ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT,
- ewl_entry_cb_focus_out, NULL);
- ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE,
- ewl_entry_cb_configure, NULL);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_DOWN,
- ewl_entry_cb_mouse_down, NULL);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_UP,
- ewl_entry_cb_mouse_up, NULL);
- ewl_callback_append(w, EWL_CALLBACK_WIDGET_DISABLE,
- ewl_entry_cb_disable, NULL);
- ewl_callback_append(w, EWL_CALLBACK_WIDGET_ENABLE,
- ewl_entry_cb_enable, NULL);
- ewl_callback_append(w, EWL_CALLBACK_DND_POSITION,
- ewl_entry_cb_dnd_position, NULL);
- ewl_callback_append(w, EWL_CALLBACK_DND_DATA_RECEIVED,
- ewl_entry_cb_dnd_data, NULL);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ const char *text_types[] = { "UTF8_STRING", "text/plain", NULL };
+ Ewl_Widget *w;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(e, FALSE);
+
+ w = EWL_WIDGET(e);
+
+ if (!ewl_text_init(EWL_TEXT(e)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ ewl_widget_inherit(w, EWL_ENTRY_TYPE);
+ ewl_widget_appearance_set(w, EWL_ENTRY_TYPE);
+ ewl_widget_focusable_set(EWL_WIDGET(e), TRUE);
+
+ ewl_object_fill_policy_set(EWL_OBJECT(e), EWL_FLAG_FILL_HSHRINK |
+ EWL_FLAG_FILL_HFILL);
+
+ ewl_container_callback_intercept(EWL_CONTAINER(w), EWL_CALLBACK_FOCUS_IN);
+ ewl_container_callback_intercept(EWL_CONTAINER(w), EWL_CALLBACK_FOCUS_OUT);
+ ewl_container_callback_intercept(EWL_CONTAINER(w), EWL_CALLBACK_DND_POSITION);
+ ewl_container_callback_intercept(EWL_CONTAINER(w), EWL_CALLBACK_DND_DATA_RECEIVED);
+
+ /* setup the cursor */
+ e->cursor = ewl_entry_cursor_new(e);
+ ewl_container_child_append(EWL_CONTAINER(e), e->cursor);
+ ewl_widget_internal_set(e->cursor, TRUE);
+ ewl_object_fill_policy_set(EWL_OBJECT(e->cursor), EWL_FLAG_FILL_VFILL);
+
+ /* Set the pointer */
+ ewl_attach_mouse_cursor_set(EWL_WIDGET(e), EWL_MOUSE_CURSOR_XTERM);
+
+ /* this has to be called after the cursor is created as it will try
+ * to show the cursor */
+ ewl_entry_multiline_set(e, FALSE);
+ ewl_entry_editable_set(e, TRUE);
+ ewl_text_selectable_set(EWL_TEXT(e), TRUE);
+ ewl_dnd_accepted_types_set(EWL_WIDGET(e), text_types);
+
+ /* setup callbacks */
+ ewl_callback_append(w, EWL_CALLBACK_FOCUS_IN,
+ ewl_entry_cb_focus_in, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT,
+ ewl_entry_cb_focus_out, NULL);
+ ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE,
+ ewl_entry_cb_configure, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_DOWN,
+ ewl_entry_cb_mouse_down, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_UP,
+ ewl_entry_cb_mouse_up, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_WIDGET_DISABLE,
+ ewl_entry_cb_disable, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_WIDGET_ENABLE,
+ ewl_entry_cb_enable, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_DND_POSITION,
+ ewl_entry_cb_dnd_position, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_DND_DATA_RECEIVED,
+ ewl_entry_cb_dnd_data, NULL);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -210,13 +210,13 @@ ewl_entry_init(Ewl_Entry *e)
void
ewl_entry_multiline_set(Ewl_Entry *e, unsigned int multiline)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_TYPE(e, EWL_ENTRY_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_TYPE(e, EWL_ENTRY_TYPE);
- e->multiline = !!multiline;
+ e->multiline = !!multiline;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -227,11 +227,11 @@ ewl_entry_multiline_set(Ewl_Entry *e, unsigned int multiline)
unsigned int
ewl_entry_multiline_get(Ewl_Entry *e)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(e, 0);
- DCHECK_TYPE_RET(e, EWL_ENTRY_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(e, 0);
+ DCHECK_TYPE_RET(e, EWL_ENTRY_TYPE, 0);
- DRETURN_INT(e->multiline, DLEVEL_STABLE);
+ DRETURN_INT(e->multiline, DLEVEL_STABLE);
}
/**
@@ -243,39 +243,39 @@ ewl_entry_multiline_get(Ewl_Entry *e)
void
ewl_entry_editable_set(Ewl_Entry *e, unsigned int editable)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_TYPE(e, EWL_ENTRY_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_TYPE(e, EWL_ENTRY_TYPE);
- if (e->editable == !!editable)
- DRETURN(DLEVEL_STABLE);
+ if (e->editable == !!editable)
+ DRETURN(DLEVEL_STABLE);
- e->editable = !!editable;
+ e->editable = !!editable;
- if (e->editable)
- {
- ewl_callback_append(EWL_WIDGET(e), EWL_CALLBACK_KEY_DOWN,
- ewl_entry_cb_key_down, NULL);
+ if (e->editable)
+ {
+ ewl_callback_append(EWL_WIDGET(e), EWL_CALLBACK_KEY_DOWN,
+ ewl_entry_cb_key_down, NULL);
- if (ewl_object_state_has(EWL_OBJECT(e), EWL_FLAG_STATE_FOCUSED))
- ewl_widget_show(e->cursor);
+ if (ewl_object_state_has(EWL_OBJECT(e), EWL_FLAG_STATE_FOCUSED))
+ ewl_widget_show(e->cursor);
- ewl_widget_state_set(EWL_WIDGET(e), "enabled",
- EWL_STATE_PERSISTENT);
- }
- else
- {
- ewl_callback_del(EWL_WIDGET(e), EWL_CALLBACK_KEY_DOWN,
- ewl_entry_cb_key_down);
+ ewl_widget_state_set(EWL_WIDGET(e), "enabled",
+ EWL_STATE_PERSISTENT);
+ }
+ else
+ {
+ ewl_callback_del(EWL_WIDGET(e), EWL_CALLBACK_KEY_DOWN,
+ ewl_entry_cb_key_down);
- if (ewl_object_state_has(EWL_OBJECT(e), EWL_FLAG_STATE_FOCUSED))
- ewl_widget_hide(e->cursor);
+ if (ewl_object_state_has(EWL_OBJECT(e), EWL_FLAG_STATE_FOCUSED))
+ ewl_widget_hide(e->cursor);
- ewl_widget_state_set(EWL_WIDGET(e), "disabled",
- EWL_STATE_PERSISTENT);
- }
+ ewl_widget_state_set(EWL_WIDGET(e), "disabled",
+ EWL_STATE_PERSISTENT);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -286,11 +286,11 @@ ewl_entry_editable_set(Ewl_Entry *e, unsigned int editable)
unsigned int
ewl_entry_editable_get(Ewl_Entry *e)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(e, 0);
- DCHECK_TYPE_RET(e, EWL_ENTRY_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(e, 0);
+ DCHECK_TYPE_RET(e, EWL_ENTRY_TYPE, 0);
- DRETURN_INT(e->editable, DLEVEL_STABLE);
+ DRETURN_INT(e->editable, DLEVEL_STABLE);
}
/**
@@ -301,29 +301,29 @@ ewl_entry_editable_get(Ewl_Entry *e)
unsigned int
ewl_entry_selection_clear(Ewl_Entry *e)
{
- Ewl_Text_Trigger *sel;
+ Ewl_Text_Trigger *sel;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(e, FALSE);
- DCHECK_TYPE_RET(e, EWL_ENTRY_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(e, FALSE);
+ DCHECK_TYPE_RET(e, EWL_ENTRY_TYPE, FALSE);
- sel = EWL_TEXT_TRIGGER(ewl_text_selection_get(EWL_TEXT(e)));
- if (sel)
- {
- unsigned int len, pos;
+ sel = EWL_TEXT_TRIGGER(ewl_text_selection_get(EWL_TEXT(e)));
+ if (sel)
+ {
+ unsigned int len, pos;
- len = ewl_text_trigger_length_get(sel);
- pos = ewl_text_trigger_start_pos_get(sel);
- ewl_text_cursor_position_set(EWL_TEXT(e), pos);
- ewl_text_text_delete(EWL_TEXT(e), len);
+ len = ewl_text_trigger_length_get(sel);
+ pos = ewl_text_trigger_start_pos_get(sel);
+ ewl_text_cursor_position_set(EWL_TEXT(e), pos);
+ ewl_text_text_delete(EWL_TEXT(e), len);
- /* remove the selection */
- ewl_text_trigger_length_set(sel, 0);
+ /* remove the selection */
+ ewl_text_trigger_length_set(sel, 0);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
- }
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+ }
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
}
/*
@@ -340,40 +340,40 @@ ewl_entry_selection_clear(Ewl_Entry *e)
*/
void
ewl_entry_cb_configure(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Entry *e;
- unsigned int c_pos;
- int cx = 0, cy = 0, cw = 0, ch = 0;
- int ox = 0, oy = 0;
+ Ewl_Entry *e;
+ unsigned int c_pos;
+ int cx = 0, cy = 0, cw = 0, ch = 0;
+ int ox = 0, oy = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- e = EWL_ENTRY(w);
- if (!e->editable)
- DRETURN(DLEVEL_STABLE);
+ e = EWL_ENTRY(w);
+ if (!e->editable)
+ DRETURN(DLEVEL_STABLE);
- c_pos = ewl_entry_cursor_position_get(EWL_ENTRY_CURSOR(e->cursor));
- ewl_text_index_geometry_map(EWL_TEXT(e), c_pos, &cx, &cy, &cw, &ch);
+ c_pos = ewl_entry_cursor_position_get(EWL_ENTRY_CURSOR(e->cursor));
+ ewl_text_index_geometry_map(EWL_TEXT(e), c_pos, &cx, &cy, &cw, &ch);
- if (!cw) cw = CURRENT_W(e->cursor);
- if (!ch) ch = CURRENT_H(e->cursor);
+ if (!cw) cw = CURRENT_W(e->cursor);
+ if (!ch) ch = CURRENT_H(e->cursor);
- ox = (cx + cw) - (CURRENT_X(e) + CURRENT_W(e));
- oy = (cy + ch) - (CURRENT_Y(e) + CURRENT_H(e));
+ ox = (cx + cw) - (CURRENT_X(e) + CURRENT_W(e));
+ oy = (cy + ch) - (CURRENT_Y(e) + CURRENT_H(e));
- if (ox < 0)
- ox = 0;
- if (oy < 0)
- oy = 0;
+ if (ox < 0)
+ ox = 0;
+ if (oy < 0)
+ oy = 0;
- ewl_text_offsets_set(EWL_TEXT(e), -ox, -oy);
+ ewl_text_offsets_set(EWL_TEXT(e), -ox, -oy);
- ewl_object_geometry_request(EWL_OBJECT(e->cursor), cx, cy, cw, ch);
+ ewl_object_geometry_request(EWL_OBJECT(e->cursor), cx, cy, cw, ch);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -386,19 +386,19 @@ ewl_entry_cb_configure(Ewl_Widget *w, void *ev __UNUSED__,
*/
void
ewl_entry_cb_focus_in(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Entry *entry;
+ Ewl_Entry *entry;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- entry = EWL_ENTRY(w);
- if (entry->editable && !VISIBLE(entry->cursor))
- ewl_widget_show(entry->cursor);
+ entry = EWL_ENTRY(w);
+ if (entry->editable && !VISIBLE(entry->cursor))
+ ewl_widget_show(entry->cursor);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -411,19 +411,19 @@ ewl_entry_cb_focus_in(Ewl_Widget *w, void *ev __UNUSED__,
*/
void
ewl_entry_cb_focus_out(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Entry *entry;
+ Ewl_Entry *entry;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- entry = EWL_ENTRY(w);
- if (entry->editable && VISIBLE(entry->cursor))
- ewl_widget_hide(entry->cursor);
+ entry = EWL_ENTRY(w);
+ if (entry->editable && VISIBLE(entry->cursor))
+ ewl_widget_hide(entry->cursor);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -437,72 +437,72 @@ ewl_entry_cb_focus_out(Ewl_Widget *w, void *ev __UNUSED__,
void
ewl_entry_cb_key_down(Ewl_Widget *w, void *ev, void *data __UNUSED__)
{
- Ewl_Event_Key *event;
- Ewl_Entry *e;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- event = ev;
- e = EWL_ENTRY(w);
-
- /* reset the cursor blink */
- ewl_widget_state_set(EWL_WIDGET(e->cursor), "noblink",
- EWL_STATE_PERSISTENT);
-
- if (!event->keyname)
- DRETURN(DLEVEL_STABLE);
-
- if (!strcmp(event->keyname, "Left"))
- ewl_entry_cursor_move_left(e);
-
- else if (!strcmp(event->keyname, "Right"))
- ewl_entry_cursor_move_right(e);
-
- else if (!strcmp(event->keyname, "Up"))
- ewl_entry_cursor_move_up(e);
-
- else if (!strcmp(event->keyname, "Down"))
- ewl_entry_cursor_move_down(e);
-
- else if (!strcmp(event->keyname, "BackSpace"))
- {
- if (!ewl_entry_selection_clear(e))
- ewl_entry_delete_left(e);
- }
- else if (!strcmp(event->keyname, "Delete"))
- {
- if (!ewl_entry_selection_clear(e))
- ewl_entry_delete_right(e);
- }
- else if ((!strcmp(event->keyname, "Return"))
- || (!strcmp(event->keyname, "KP_Return"))
- || (!strcmp(event->keyname, "Enter"))
- || (!strcmp(event->keyname, "KP_Enter"))
- || (!strcmp(event->keyname, "\n")))
- {
- if (!e->multiline)
- ewl_callback_call(w, EWL_CALLBACK_VALUE_CHANGED);
- else
- {
- ewl_entry_selection_clear(e);
-
- ewl_text_text_insert(EWL_TEXT(e), "\n",
- ewl_entry_cursor_position_get(EWL_ENTRY_CURSOR(e->cursor)));
- }
- }
- else if (!(event->modifiers & EWL_KEY_MODIFIER_CTRL))
- {
- ewl_entry_selection_clear(e);
-
- if ((strlen(event->keyname) == 1) || (*event->keyname < 0))
- ewl_text_text_insert(EWL_TEXT(e), event->keyname,
- ewl_entry_cursor_position_get(
- EWL_ENTRY_CURSOR(e->cursor)));
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Event_Key *event;
+ Ewl_Entry *e;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ event = ev;
+ e = EWL_ENTRY(w);
+
+ /* reset the cursor blink */
+ ewl_widget_state_set(EWL_WIDGET(e->cursor), "noblink",
+ EWL_STATE_PERSISTENT);
+
+ if (!event->keyname)
+ DRETURN(DLEVEL_STABLE);
+
+ if (!strcmp(event->keyname, "Left"))
+ ewl_entry_cursor_move_left(e);
+
+ else if (!strcmp(event->keyname, "Right"))
+ ewl_entry_cursor_move_right(e);
+
+ else if (!strcmp(event->keyname, "Up"))
+ ewl_entry_cursor_move_up(e);
+
+ else if (!strcmp(event->keyname, "Down"))
+ ewl_entry_cursor_move_down(e);
+
+ else if (!strcmp(event->keyname, "BackSpace"))
+ {
+ if (!ewl_entry_selection_clear(e))
+ ewl_entry_delete_left(e);
+ }
+ else if (!strcmp(event->keyname, "Delete"))
+ {
+ if (!ewl_entry_selection_clear(e))
+ ewl_entry_delete_right(e);
+ }
+ else if ((!strcmp(event->keyname, "Return"))
+ || (!strcmp(event->keyname, "KP_Return"))
+ || (!strcmp(event->keyname, "Enter"))
+ || (!strcmp(event->keyname, "KP_Enter"))
+ || (!strcmp(event->keyname, "\n")))
+ {
+ if (!e->multiline)
+ ewl_callback_call(w, EWL_CALLBACK_VALUE_CHANGED);
+ else
+ {
+ ewl_entry_selection_clear(e);
+
+ ewl_text_text_insert(EWL_TEXT(e), "\n",
+ ewl_entry_cursor_position_get(EWL_ENTRY_CURSOR(e->cursor)));
+ }
+ }
+ else if (!(event->modifiers & EWL_KEY_MODIFIER_CTRL))
+ {
+ ewl_entry_selection_clear(e);
+
+ if ((strlen(event->keyname) == 1) || (*event->keyname < 0))
+ ewl_text_text_insert(EWL_TEXT(e), event->keyname,
+ ewl_entry_cursor_position_get(
+ EWL_ENTRY_CURSOR(e->cursor)));
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -516,26 +516,26 @@ ewl_entry_cb_key_down(Ewl_Widget *w, void *ev, void *data __UNUSED__)
void
ewl_entry_cb_mouse_down(Ewl_Widget *w, void *ev, void *data __UNUSED__)
{
- Ewl_Event_Mouse *event;
- Ewl_Entry *e;
- unsigned int idx = 0;
+ Ewl_Event_Mouse *event;
+ Ewl_Entry *e;
+ unsigned int idx = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- event = ev;
- e = EWL_ENTRY(w);
+ event = ev;
+ e = EWL_ENTRY(w);
- e->in_select_mode = TRUE;
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE,
- ewl_entry_cb_mouse_move, NULL);
+ e->in_select_mode = TRUE;
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE,
+ ewl_entry_cb_mouse_move, NULL);
- idx = ewl_text_coord_index_map(EWL_TEXT(e), event->x, event->y);
- ewl_entry_cursor_position_set(EWL_ENTRY_CURSOR(e->cursor), idx);
- ewl_widget_configure(w);
+ idx = ewl_text_coord_index_map(EWL_TEXT(e), event->x, event->y);
+ ewl_entry_cursor_position_set(EWL_ENTRY_CURSOR(e->cursor), idx);
+ ewl_widget_configure(w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -548,20 +548,20 @@ ewl_entry_cb_mouse_down(Ewl_Widget *w, void *ev, void *data __UNUSED__)
*/
void
ewl_entry_cb_mouse_up(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Entry *e;
+ Ewl_Entry *e;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- e = EWL_ENTRY(w);
+ e = EWL_ENTRY(w);
- e->in_select_mode = FALSE;
- ewl_callback_del(w, EWL_CALLBACK_MOUSE_MOVE, ewl_entry_cb_mouse_move);
+ e->in_select_mode = FALSE;
+ ewl_callback_del(w, EWL_CALLBACK_MOUSE_MOVE, ewl_entry_cb_mouse_move);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -575,13 +575,13 @@ ewl_entry_cb_mouse_up(Ewl_Widget *w, void *ev __UNUSED__,
void
ewl_entry_cb_disable(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_entry_editable_set(EWL_ENTRY(w), FALSE);
+ ewl_entry_editable_set(EWL_ENTRY(w), FALSE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -595,13 +595,13 @@ ewl_entry_cb_disable(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
void
ewl_entry_cb_enable(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_entry_editable_set(EWL_ENTRY(w), TRUE);
+ ewl_entry_editable_set(EWL_ENTRY(w), TRUE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -614,15 +614,15 @@ ewl_entry_cb_enable(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
*/
void
ewl_entry_cb_mouse_move(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- /* XXX do we leave the cursor at the start? or move to the end? */
+ /* XXX do we leave the cursor at the start? or move to the end? */
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -636,25 +636,25 @@ ewl_entry_cb_mouse_move(Ewl_Widget *w, void *ev __UNUSED__,
void
ewl_entry_cb_dnd_position(Ewl_Widget *w, void *ev, void *data __UNUSED__)
{
- Ewl_Event_Dnd_Position *event;
- Ewl_Text *txt;
+ Ewl_Event_Dnd_Position *event;
+ Ewl_Text *txt;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(ev);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(ev);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- event = ev;
- txt = EWL_TEXT(w);
+ event = ev;
+ txt = EWL_TEXT(w);
- if (EWL_ENTRY(w)->editable && !DISABLED(w)) {
- ewl_widget_focus_send(w);
- ewl_text_cursor_position_set(txt,
- ewl_text_coord_index_map(txt, event->x,
- event->y));
- }
+ if (EWL_ENTRY(w)->editable && !DISABLED(w)) {
+ ewl_widget_focus_send(w);
+ ewl_text_cursor_position_set(txt,
+ ewl_text_coord_index_map(txt, event->x,
+ event->y));
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -668,41 +668,41 @@ ewl_entry_cb_dnd_position(Ewl_Widget *w, void *ev, void *data __UNUSED__)
void
ewl_entry_cb_dnd_data(Ewl_Widget *w, void *ev, void *data __UNUSED__)
{
- Ewl_Event_Dnd_Data_Received *event;
- Ewl_Text *txt;
+ Ewl_Event_Dnd_Data_Received *event;
+ Ewl_Text *txt;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(ev);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(ev);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- event = ev;
- txt = EWL_TEXT(w);
+ event = ev;
+ txt = EWL_TEXT(w);
- if (EWL_ENTRY(w)->editable && !DISABLED(w)) {
- if (!strcmp(event->type, "text/plain")
- && strcmp(nl_langinfo(CODESET), "UTF-8")) {
- char *text;
+ if (EWL_ENTRY(w)->editable && !DISABLED(w)) {
+ if (!strcmp(event->type, "text/plain")
+ && strcmp(nl_langinfo(CODESET), "UTF-8")) {
+ char *text;
- text = ecore_txt_convert(nl_langinfo(CODESET), "UTF-8",
- event->data);
- if (text) {
- ewl_text_text_insert(txt, text,
- ewl_text_cursor_position_get(txt));
- }
- else {
- ewl_text_text_insert(txt, event->data,
- ewl_text_cursor_position_get(txt));
- }
+ text = ecore_txt_convert(nl_langinfo(CODESET), "UTF-8",
+ event->data);
+ if (text) {
+ ewl_text_text_insert(txt, text,
+ ewl_text_cursor_position_get(txt));
+ }
+ else {
+ ewl_text_text_insert(txt, event->data,
+ ewl_text_cursor_position_get(txt));
+ }
- IF_FREE(text);
- }
- else
- ewl_text_text_insert(txt, event->data,
- ewl_text_cursor_position_get(txt));
- }
+ IF_FREE(text);
+ }
+ else
+ ewl_text_text_insert(txt, event->data,
+ ewl_text_cursor_position_get(txt));
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -713,22 +713,22 @@ ewl_entry_cb_dnd_data(Ewl_Widget *w, void *ev, void *data __UNUSED__)
void
ewl_entry_cursor_move_left(Ewl_Entry *e)
{
- unsigned int pos;
+ unsigned int pos;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_TYPE(e, EWL_ENTRY_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_TYPE(e, EWL_ENTRY_TYPE);
- pos = ewl_entry_cursor_position_get(EWL_ENTRY_CURSOR(e->cursor));
+ pos = ewl_entry_cursor_position_get(EWL_ENTRY_CURSOR(e->cursor));
- /* we're already at the start */
- if (pos == 0)
- DRETURN(DLEVEL_STABLE);
+ /* we're already at the start */
+ if (pos == 0)
+ DRETURN(DLEVEL_STABLE);
- ewl_entry_cursor_position_set(EWL_ENTRY_CURSOR(e->cursor), pos - 1);
- ewl_widget_configure(EWL_WIDGET(e));
+ ewl_entry_cursor_position_set(EWL_ENTRY_CURSOR(e->cursor), pos - 1);
+ ewl_widget_configure(EWL_WIDGET(e));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -739,22 +739,22 @@ ewl_entry_cursor_move_left(Ewl_Entry *e)
void
ewl_entry_cursor_move_right(Ewl_Entry *e)
{
- unsigned int pos;
+ unsigned int pos;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_TYPE(e, EWL_ENTRY_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_TYPE(e, EWL_ENTRY_TYPE);
- pos = ewl_entry_cursor_position_get(EWL_ENTRY_CURSOR(e->cursor));
+ pos = ewl_entry_cursor_position_get(EWL_ENTRY_CURSOR(e->cursor));
- /* if we are already at the end, stop */
- if (pos == ewl_text_length_get(EWL_TEXT(e)))
- DRETURN(DLEVEL_STABLE);
+ /* if we are already at the end, stop */
+ if (pos == ewl_text_length_get(EWL_TEXT(e)))
+ DRETURN(DLEVEL_STABLE);
- ewl_entry_cursor_position_set(EWL_ENTRY_CURSOR(e->cursor), pos + 1);
- ewl_widget_configure(EWL_WIDGET(e));
+ ewl_entry_cursor_position_set(EWL_ENTRY_CURSOR(e->cursor), pos + 1);
+ ewl_widget_configure(EWL_WIDGET(e));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -765,17 +765,17 @@ ewl_entry_cursor_move_right(Ewl_Entry *e)
void
ewl_entry_cursor_move_up(Ewl_Entry *e)
{
- unsigned int current_pos = 0;
+ unsigned int current_pos = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_TYPE(e, EWL_ENTRY_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_TYPE(e, EWL_ENTRY_TYPE);
- current_pos = ewl_text_cursor_position_line_up_get(EWL_TEXT(e));
- ewl_entry_cursor_position_set(EWL_ENTRY_CURSOR(e->cursor), current_pos);
- ewl_widget_configure(EWL_WIDGET(e));
+ current_pos = ewl_text_cursor_position_line_up_get(EWL_TEXT(e));
+ ewl_entry_cursor_position_set(EWL_ENTRY_CURSOR(e->cursor), current_pos);
+ ewl_widget_configure(EWL_WIDGET(e));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -786,17 +786,17 @@ ewl_entry_cursor_move_up(Ewl_Entry *e)
void
ewl_entry_cursor_move_down(Ewl_Entry *e)
{
- unsigned int current_pos = 0;
+ unsigned int current_pos = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_TYPE(e, EWL_ENTRY_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_TYPE(e, EWL_ENTRY_TYPE);
- current_pos = ewl_text_cursor_position_line_down_get(EWL_TEXT(e));
- ewl_entry_cursor_position_set(EWL_ENTRY_CURSOR(e->cursor), current_pos);
- ewl_widget_configure(EWL_WIDGET(e));
+ current_pos = ewl_text_cursor_position_line_down_get(EWL_TEXT(e));
+ ewl_entry_cursor_position_set(EWL_ENTRY_CURSOR(e->cursor), current_pos);
+ ewl_widget_configure(EWL_WIDGET(e));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -807,25 +807,25 @@ ewl_entry_cursor_move_down(Ewl_Entry *e)
void
ewl_entry_delete_left(Ewl_Entry *e)
{
- unsigned int pos;
+ unsigned int pos;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_TYPE(e, EWL_ENTRY_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_TYPE(e, EWL_ENTRY_TYPE);
- if (!EWL_TEXT(e)->text)
- DRETURN(DLEVEL_STABLE);
+ if (!EWL_TEXT(e)->text)
+ DRETURN(DLEVEL_STABLE);
- pos = ewl_entry_cursor_position_get(EWL_ENTRY_CURSOR(e->cursor));
+ pos = ewl_entry_cursor_position_get(EWL_ENTRY_CURSOR(e->cursor));
- /* we cannot delete anything if we are at the beginning of the text */
- if (pos == 0)
- DRETURN(DLEVEL_STABLE);
+ /* we cannot delete anything if we are at the beginning of the text */
+ if (pos == 0)
+ DRETURN(DLEVEL_STABLE);
- ewl_entry_cursor_position_set(EWL_ENTRY_CURSOR(e->cursor), pos - 1);
- ewl_text_text_delete(EWL_TEXT(e), 1);
+ ewl_entry_cursor_position_set(EWL_ENTRY_CURSOR(e->cursor), pos - 1);
+ ewl_text_text_delete(EWL_TEXT(e), 1);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -836,16 +836,16 @@ ewl_entry_delete_left(Ewl_Entry *e)
void
ewl_entry_delete_right(Ewl_Entry *e)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(e);
- DCHECK_TYPE(e, EWL_ENTRY_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(e);
+ DCHECK_TYPE(e, EWL_ENTRY_TYPE);
- if (!EWL_TEXT(e)->text)
- DRETURN(DLEVEL_STABLE);
+ if (!EWL_TEXT(e)->text)
+ DRETURN(DLEVEL_STABLE);
- ewl_text_text_delete(EWL_TEXT(e), 1);
+ ewl_text_text_delete(EWL_TEXT(e), 1);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/*
@@ -860,21 +860,21 @@ ewl_entry_delete_right(Ewl_Entry *e)
Ewl_Widget *
ewl_entry_cursor_new(Ewl_Entry *parent)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- w = NEW(Ewl_Entry_Cursor, 1);
- if (!w)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ w = NEW(Ewl_Entry_Cursor, 1);
+ if (!w)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_entry_cursor_init(EWL_ENTRY_CURSOR(w), parent))
- {
- ewl_widget_destroy(w);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ewl_entry_cursor_init(EWL_ENTRY_CURSOR(w), parent))
+ {
+ ewl_widget_destroy(w);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
/**
@@ -886,21 +886,21 @@ ewl_entry_cursor_new(Ewl_Entry *parent)
int
ewl_entry_cursor_init(Ewl_Entry_Cursor *c, Ewl_Entry *parent)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(c, FALSE);
- DCHECK_PARAM_PTR_RET(parent, FALSE);
- DCHECK_TYPE_RET(parent, EWL_ENTRY_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(c, FALSE);
+ DCHECK_PARAM_PTR_RET(parent, FALSE);
+ DCHECK_TYPE_RET(parent, EWL_ENTRY_TYPE, FALSE);
- if (!ewl_widget_init(EWL_WIDGET(c)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_widget_init(EWL_WIDGET(c)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_appearance_set(EWL_WIDGET(c), EWL_ENTRY_CURSOR_TYPE);
- ewl_widget_inherit(EWL_WIDGET(c), EWL_ENTRY_CURSOR_TYPE);
- c->parent = parent;
+ ewl_widget_appearance_set(EWL_WIDGET(c), EWL_ENTRY_CURSOR_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(c), EWL_ENTRY_CURSOR_TYPE);
+ c->parent = parent;
- ewl_widget_focusable_set(EWL_WIDGET(c), FALSE);
+ ewl_widget_focusable_set(EWL_WIDGET(c), FALSE);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -912,13 +912,13 @@ ewl_entry_cursor_init(Ewl_Entry_Cursor *c, Ewl_Entry *parent)
void
ewl_entry_cursor_position_set(Ewl_Entry_Cursor *c, unsigned int pos)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_ENTRY_CURSOR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_ENTRY_CURSOR_TYPE);
- ewl_text_cursor_position_set(EWL_TEXT(c->parent), pos);
+ ewl_text_cursor_position_set(EWL_TEXT(c->parent), pos);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -929,12 +929,12 @@ ewl_entry_cursor_position_set(Ewl_Entry_Cursor *c, unsigned int pos)
unsigned int
ewl_entry_cursor_position_get(Ewl_Entry_Cursor *c)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(c, 0);
- DCHECK_TYPE_RET(c, EWL_ENTRY_CURSOR_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(c, 0);
+ DCHECK_TYPE_RET(c, EWL_ENTRY_CURSOR_TYPE, 0);
- DRETURN_INT(ewl_text_cursor_position_get(EWL_TEXT(c->parent)),
- DLEVEL_STABLE);
+ DRETURN_INT(ewl_text_cursor_position_get(EWL_TEXT(c->parent)),
+ DLEVEL_STABLE);
}
/**
@@ -944,40 +944,40 @@ ewl_entry_cursor_position_get(Ewl_Entry_Cursor *c)
Ewl_View *
ewl_entry_view_get(void)
{
- Ewl_View *view;
+ Ewl_View *view;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- view = ewl_view_new();
- ewl_view_widget_fetch_set(view, ewl_entry_view_cb_widget_fetch);
- ewl_view_header_fetch_set(view, ewl_entry_view_cb_header_fetch);
+ view = ewl_view_new();
+ ewl_view_widget_fetch_set(view, ewl_entry_view_cb_widget_fetch);
+ ewl_view_header_fetch_set(view, ewl_entry_view_cb_header_fetch);
- DRETURN_PTR(view, DLEVEL_STABLE);
+ DRETURN_PTR(view, DLEVEL_STABLE);
}
static Ewl_Widget *
ewl_entry_view_cb_widget_fetch(void *data, unsigned int row __UNUSED__,
- unsigned int col __UNUSED__)
+ unsigned int col __UNUSED__)
{
- Ewl_Widget *entry;
+ Ewl_Widget *entry;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- entry = ewl_entry_new();
- ewl_text_text_set(EWL_TEXT(entry), data);
+ entry = ewl_entry_new();
+ ewl_text_text_set(EWL_TEXT(entry), data);
- DRETURN_PTR(entry, DLEVEL_STABLE);
+ DRETURN_PTR(entry, DLEVEL_STABLE);
}
static Ewl_Widget *
ewl_entry_view_cb_header_fetch(void *data, unsigned int col __UNUSED__)
{
- Ewl_Widget *entry;
+ Ewl_Widget *entry;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- entry = ewl_entry_new();
- ewl_text_text_set(EWL_TEXT(entry), data);
+ entry = ewl_entry_new();
+ ewl_text_text_set(EWL_TEXT(entry), data);
- DRETURN_PTR(entry, DLEVEL_STABLE);
+ DRETURN_PTR(entry, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_entry.h b/src/lib/ewl_entry.h
index f394cf0..b28f97a 100644
--- a/src/lib/ewl_entry.h
+++ b/src/lib/ewl_entry.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_ENTRY_H
#define EWL_ENTRY_H
@@ -57,26 +57,26 @@ typedef struct Ewl_Entry Ewl_Entry;
*/
struct Ewl_Entry
{
- Ewl_Text text; /**< The Ewl_Text parent */
- Ewl_Widget *cursor; /**< The cursor */
+ Ewl_Text text; /**< The Ewl_Text parent */
+ Ewl_Widget *cursor; /**< The cursor */
- unsigned int multiline:1; /**< Is the entry multi-line */
- unsigned int editable:1; /**< Is the entry editable */
- unsigned int in_select_mode:1; /**< Are we in select mode */
+ unsigned int multiline:1; /**< Is the entry multi-line */
+ unsigned int editable:1; /**< Is the entry editable */
+ unsigned int in_select_mode:1; /**< Are we in select mode */
};
-Ewl_Widget *ewl_entry_new(void);
-Ewl_Widget *ewl_password_new(void);
-int ewl_entry_init(Ewl_Entry *e);
+Ewl_Widget *ewl_entry_new(void);
+Ewl_Widget *ewl_password_new(void);
+int ewl_entry_init(Ewl_Entry *e);
-void ewl_entry_multiline_set(Ewl_Entry *e, unsigned int multiline);
-unsigned int ewl_entry_multiline_get(Ewl_Entry *e);
+void ewl_entry_multiline_set(Ewl_Entry *e, unsigned int multiline);
+unsigned int ewl_entry_multiline_get(Ewl_Entry *e);
-void ewl_entry_editable_set(Ewl_Entry *e, unsigned int editable);
-unsigned int ewl_entry_editable_get(Ewl_Entry *e);
+void ewl_entry_editable_set(Ewl_Entry *e, unsigned int editable);
+unsigned int ewl_entry_editable_get(Ewl_Entry *e);
-unsigned int ewl_entry_selection_clear(Ewl_Entry *e);
-Ewl_View *ewl_entry_view_get(void);
+unsigned int ewl_entry_selection_clear(Ewl_Entry *e);
+Ewl_View *ewl_entry_view_get(void);
/*
* Internal stuff
@@ -120,14 +120,14 @@ typedef struct Ewl_Entry_Cursor Ewl_Entry_Cursor;
*/
struct Ewl_Entry_Cursor
{
- Ewl_Widget widget; /**< Inherit from Ewl_Widget */
- Ewl_Entry *parent; /**< The parent Ewl_Text */
+ Ewl_Widget widget; /**< Inherit from Ewl_Widget */
+ Ewl_Entry *parent; /**< The parent Ewl_Text */
};
-Ewl_Widget *ewl_entry_cursor_new(Ewl_Entry *parent);
-int ewl_entry_cursor_init(Ewl_Entry_Cursor *c, Ewl_Entry *parent);
-void ewl_entry_cursor_position_set(Ewl_Entry_Cursor *c, unsigned int pos);
-unsigned int ewl_entry_cursor_position_get(Ewl_Entry_Cursor *c);
+Ewl_Widget *ewl_entry_cursor_new(Ewl_Entry *parent);
+int ewl_entry_cursor_init(Ewl_Entry_Cursor *c, Ewl_Entry *parent);
+void ewl_entry_cursor_position_set(Ewl_Entry_Cursor *c, unsigned int pos);
+unsigned int ewl_entry_cursor_position_get(Ewl_Entry_Cursor *c);
/**
* @}
diff --git a/src/lib/ewl_enums.h b/src/lib/ewl_enums.h
index 48ad538..6a77327 100644
--- a/src/lib/ewl_enums.h
+++ b/src/lib/ewl_enums.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_ENUMS_H
#define EWL_ENUMS_H
@@ -16,32 +16,32 @@
*/
enum Ewl_Callback_Type
{
- EWL_CALLBACK_REALIZE, /**< Event when a widget is first drawn */
- EWL_CALLBACK_UNREALIZE, /**< When a widget is no longer drawn */
- EWL_CALLBACK_SHOW, /**< A widget has been marked visible */
- EWL_CALLBACK_HIDE, /**< A widget is marked hidden */
- EWL_CALLBACK_OBSCURE, /**< Widget is offscreen */
- EWL_CALLBACK_REVEAL, /**< Widget returned to screen */
- EWL_CALLBACK_DESTROY, /**< The widget is freed */
- EWL_CALLBACK_CONFIGURE, /**< The object is being resized */
- EWL_CALLBACK_REPARENT, /**< A widget has been placed in a container */
- EWL_CALLBACK_KEY_DOWN, /**< A key was pressed down */
- EWL_CALLBACK_KEY_UP, /**< A key was released */
- EWL_CALLBACK_MOUSE_DOWN, /**< Mouse was pressed down */
- EWL_CALLBACK_MOUSE_UP, /**< Mouse was released */
- EWL_CALLBACK_MOUSE_MOVE, /**< Mouse was moved */
- EWL_CALLBACK_MOUSE_WHEEL, /**< Mouse wheel scrolled */
- EWL_CALLBACK_MOUSE_IN, /**< Mouse was placed over the widget */
- EWL_CALLBACK_MOUSE_OUT, /**< Mouse was moved away from the widget */
- EWL_CALLBACK_CLICKED, /**< Mouse was pressed and released on a widget */
- EWL_CALLBACK_FOCUS_IN, /**< Widget was selected by mouse or key */
- EWL_CALLBACK_FOCUS_OUT, /**< Widget was deselected by mouse or key */
- EWL_CALLBACK_VALUE_CHANGED, /**< Value in widget changed */
- EWL_CALLBACK_STATE_CHANGED, /**< Alter the state of the appearance */
- EWL_CALLBACK_WIDGET_ENABLE, /**< Widget has been re-enabled */
- EWL_CALLBACK_WIDGET_DISABLE, /**< Widget no longer takes input */
-
- EWL_CALLBACK_MAX /**< Flag to indicate last value */
+ EWL_CALLBACK_REALIZE, /**< Event when a widget is first drawn */
+ EWL_CALLBACK_UNREALIZE, /**< When a widget is no longer drawn */
+ EWL_CALLBACK_SHOW, /**< A widget has been marked visible */
+ EWL_CALLBACK_HIDE, /**< A widget is marked hidden */
+ EWL_CALLBACK_OBSCURE, /**< Widget is offscreen */
+ EWL_CALLBACK_REVEAL, /**< Widget returned to screen */
+ EWL_CALLBACK_DESTROY, /**< The widget is freed */
+ EWL_CALLBACK_CONFIGURE, /**< The object is being resized */
+ EWL_CALLBACK_REPARENT, /**< A widget has been placed in a container */
+ EWL_CALLBACK_KEY_DOWN, /**< A key was pressed down */
+ EWL_CALLBACK_KEY_UP, /**< A key was released */
+ EWL_CALLBACK_MOUSE_DOWN, /**< Mouse was pressed down */
+ EWL_CALLBACK_MOUSE_UP, /**< Mouse was released */
+ EWL_CALLBACK_MOUSE_MOVE, /**< Mouse was moved */
+ EWL_CALLBACK_MOUSE_WHEEL, /**< Mouse wheel scrolled */
+ EWL_CALLBACK_MOUSE_IN, /**< Mouse was placed over the widget */
+ EWL_CALLBACK_MOUSE_OUT, /**< Mouse was moved away from the widget */
+ EWL_CALLBACK_CLICKED, /**< Mouse was pressed and released on a widget */
+ EWL_CALLBACK_FOCUS_IN, /**< Widget was selected by mouse or key */
+ EWL_CALLBACK_FOCUS_OUT, /**< Widget was deselected by mouse or key */
+ EWL_CALLBACK_VALUE_CHANGED, /**< Value in widget changed */
+ EWL_CALLBACK_STATE_CHANGED, /**< Alter the state of the appearance */
+ EWL_CALLBACK_WIDGET_ENABLE, /**< Widget has been re-enabled */
+ EWL_CALLBACK_WIDGET_DISABLE, /**< Widget no longer takes input */
+
+ EWL_CALLBACK_MAX /**< Flag to indicate last value */
};
/**
@@ -56,10 +56,10 @@ typedef enum Ewl_Callback_Type Ewl_Callback_Type;
*/
enum Ewl_Event_Notify
{
- EWL_CALLBACK_NOTIFY_NONE = 0, /**< No notification or interception */
- EWL_CALLBACK_NOTIFY_NOTIFY = 1, /**< Notify of call */
- EWL_CALLBACK_NOTIFY_INTERCEPT = 2, /**< Intercept call */
- EWL_CALLBACK_TYPE_DIRECT = 4 /**< Direct call */
+ EWL_CALLBACK_NOTIFY_NONE = 0, /**< No notification or interception */
+ EWL_CALLBACK_NOTIFY_NOTIFY = 1, /**< Notify of call */
+ EWL_CALLBACK_NOTIFY_INTERCEPT = 2, /**< Intercept call */
+ EWL_CALLBACK_TYPE_DIRECT = 4 /**< Direct call */
};
/**
@@ -74,8 +74,8 @@ typedef enum Ewl_Event_Notify Ewl_Event_Notify;
*/
enum Ewl_Orientation
{
- EWL_ORIENTATION_HORIZONTAL, /**< Horizontal layout */
- EWL_ORIENTATION_VERTICAL /**< Vertical layout */
+ EWL_ORIENTATION_HORIZONTAL, /**< Horizontal layout */
+ EWL_ORIENTATION_VERTICAL /**< Vertical layout */
};
/**
@@ -90,72 +90,72 @@ typedef enum Ewl_Orientation Ewl_Orientation;
*/
enum Ewl_Flags
{
- /*
- * The alignment enumeration allows for specifying how an element is
- * aligned within it's container.
- */
- EWL_FLAG_ALIGN_CENTER = 0, /**< Center align bit */
- EWL_FLAG_ALIGN_LEFT = 0x1, /**< Left align bit */
- EWL_FLAG_ALIGN_RIGHT = 0x2, /**< Right align bit */
- EWL_FLAG_ALIGN_TOP = 0x4, /**< Top align bit */
- EWL_FLAG_ALIGN_BOTTOM = 0x8, /**< Bottom align bit */
-
- /*
- * Fill policy identifies to containers whether child widgets should be
- * stretched to fill available space or keep their current size.
- */
- EWL_FLAG_FILL_NONE = 0, /**< Do not fill or shrink in any direction */
- EWL_FLAG_FILL_HSHRINK = 0x10, /**< Horizontally shrink bit */
- EWL_FLAG_FILL_VSHRINK = 0x20, /**< Horizontally shrink bit */
- EWL_FLAG_FILL_SHRINK =
- EWL_FLAG_FILL_HSHRINK | EWL_FLAG_FILL_VSHRINK, /**< Shrink bit */
- EWL_FLAG_FILL_HFILL = 0x40, /**< Horizontal fill bit */
- EWL_FLAG_FILL_VFILL = 0x80, /**< Vertical fill bit */
- EWL_FLAG_FILL_FILL = EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VFILL, /**< Fill bit */
- EWL_FLAG_FILL_ALL = EWL_FLAG_FILL_FILL | EWL_FLAG_FILL_SHRINK, /**< Shrunk and fill bit */
-
- /*
- * Flags identifying the visibility status of the widget
- */
- EWL_FLAG_VISIBLE_HIDDEN = 0, /**< Widget hidden */
- EWL_FLAG_VISIBLE_SHOWN = 0x100, /**< Widget shown */
- EWL_FLAG_VISIBLE_REALIZED = 0x200, /**< Widget realized */
- EWL_FLAG_VISIBLE_REVEALED = 0x400, /**< Widget revealed */
- EWL_FLAG_VISIBLE_NOCLIP = 0x800, /**< Widget has no clip */
-
- /*
- * Behavior modifying properties.
- */
- EWL_FLAG_PROPERTY_RECURSIVE = 0x1000, /**< Widget is recursive */
- EWL_FLAG_PROPERTY_TOPLEVEL = 0x2000, /**< Widget is a top level widget */
- EWL_FLAG_PROPERTY_INTERNAL = 0x4000, /**< Widget is internal */
- EWL_FLAG_PROPERTY_BLOCK_TAB_FOCUS = 0x8000, /**< Widget will block tab focus changes */
- EWL_FLAG_PROPERTY_FOCUSABLE = 0x10000, /**< Widget is focusable */
- EWL_FLAG_PROPERTY_IN_TAB_LIST = 0x20000, /**< Widget is in the tab order */
- EWL_FLAG_PROPERTY_DND_TARGET = 0x40000, /**< Widget is DND aware */
- EWL_FLAG_PROPERTY_DND_SOURCE = 0x80000, /**< Widget is dragable */
-
- /*
- * Flags to indicate queues this object is on.
- */
- EWL_FLAG_QUEUED_SCHEDULED_CONFIGURE = 0x100000, /**< Configure scheduled */
- EWL_FLAG_QUEUED_SCHEDULED_REVEAL = 0x200000, /**< Reveal scheduled */
- EWL_FLAG_QUEUED_SCHEDULED_DESTROY = 0x400000, /**< Delete scheduled */
-
- EWL_FLAG_QUEUED_PROCESS_CONFIGURE = 0x800000, /**< Configure in progress */
- EWL_FLAG_QUEUED_PROCESS_REVEAL = 0x1000000, /**< Reveal in progress */
- EWL_FLAG_QUEUED_PROCESS_DESTROY = 0x2000000, /**< Delete in progress */
-
- /*
- * The state enum specifies the current state of a widget, ie. has it
- * been clicked, does it have the keyboard focus, etc.
- */
- EWL_FLAG_STATE_NORMAL = 0, /**< Widget state normal */
- EWL_FLAG_STATE_MOUSE_IN = 0x4000000, /**< Mouse is in the widget */
- EWL_FLAG_STATE_PRESSED = 0x8000000, /**< Widget is pressed */
- EWL_FLAG_STATE_FOCUSED = 0x10000000, /**< Widget has focus */
- EWL_FLAG_STATE_DISABLED = 0x20000000, /**< Widget is disabled */
- EWL_FLAG_STATE_DND = 0x40000000, /**< Widget is engaged in DND */
+ /*
+ * The alignment enumeration allows for specifying how an element is
+ * aligned within it's container.
+ */
+ EWL_FLAG_ALIGN_CENTER = 0, /**< Center align bit */
+ EWL_FLAG_ALIGN_LEFT = 0x1, /**< Left align bit */
+ EWL_FLAG_ALIGN_RIGHT = 0x2, /**< Right align bit */
+ EWL_FLAG_ALIGN_TOP = 0x4, /**< Top align bit */
+ EWL_FLAG_ALIGN_BOTTOM = 0x8, /**< Bottom align bit */
+
+ /*
+ * Fill policy identifies to containers whether child widgets should be
+ * stretched to fill available space or keep their current size.
+ */
+ EWL_FLAG_FILL_NONE = 0, /**< Do not fill or shrink in any direction */
+ EWL_FLAG_FILL_HSHRINK = 0x10, /**< Horizontally shrink bit */
+ EWL_FLAG_FILL_VSHRINK = 0x20, /**< Horizontally shrink bit */
+ EWL_FLAG_FILL_SHRINK =
+ EWL_FLAG_FILL_HSHRINK | EWL_FLAG_FILL_VSHRINK, /**< Shrink bit */
+ EWL_FLAG_FILL_HFILL = 0x40, /**< Horizontal fill bit */
+ EWL_FLAG_FILL_VFILL = 0x80, /**< Vertical fill bit */
+ EWL_FLAG_FILL_FILL = EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VFILL, /**< Fill bit */
+ EWL_FLAG_FILL_ALL = EWL_FLAG_FILL_FILL | EWL_FLAG_FILL_SHRINK, /**< Shrunk and fill bit */
+
+ /*
+ * Flags identifying the visibility status of the widget
+ */
+ EWL_FLAG_VISIBLE_HIDDEN = 0, /**< Widget hidden */
+ EWL_FLAG_VISIBLE_SHOWN = 0x100, /**< Widget shown */
+ EWL_FLAG_VISIBLE_REALIZED = 0x200, /**< Widget realized */
+ EWL_FLAG_VISIBLE_REVEALED = 0x400, /**< Widget revealed */
+ EWL_FLAG_VISIBLE_NOCLIP = 0x800, /**< Widget has no clip */
+
+ /*
+ * Behavior modifying properties.
+ */
+ EWL_FLAG_PROPERTY_RECURSIVE = 0x1000, /**< Widget is recursive */
+ EWL_FLAG_PROPERTY_TOPLEVEL = 0x2000, /**< Widget is a top level widget */
+ EWL_FLAG_PROPERTY_INTERNAL = 0x4000, /**< Widget is internal */
+ EWL_FLAG_PROPERTY_BLOCK_TAB_FOCUS = 0x8000, /**< Widget will block tab focus changes */
+ EWL_FLAG_PROPERTY_FOCUSABLE = 0x10000, /**< Widget is focusable */
+ EWL_FLAG_PROPERTY_IN_TAB_LIST = 0x20000, /**< Widget is in the tab order */
+ EWL_FLAG_PROPERTY_DND_TARGET = 0x40000, /**< Widget is DND aware */
+ EWL_FLAG_PROPERTY_DND_SOURCE = 0x80000, /**< Widget is dragable */
+
+ /*
+ * Flags to indicate queues this object is on.
+ */
+ EWL_FLAG_QUEUED_SCHEDULED_CONFIGURE = 0x100000, /**< Configure scheduled */
+ EWL_FLAG_QUEUED_SCHEDULED_REVEAL = 0x200000, /**< Reveal scheduled */
+ EWL_FLAG_QUEUED_SCHEDULED_DESTROY = 0x400000, /**< Delete scheduled */
+
+ EWL_FLAG_QUEUED_PROCESS_CONFIGURE = 0x800000, /**< Configure in progress */
+ EWL_FLAG_QUEUED_PROCESS_REVEAL = 0x1000000, /**< Reveal in progress */
+ EWL_FLAG_QUEUED_PROCESS_DESTROY = 0x2000000, /**< Delete in progress */
+
+ /*
+ * The state enum specifies the current state of a widget, ie. has it
+ * been clicked, does it have the keyboard focus, etc.
+ */
+ EWL_FLAG_STATE_NORMAL = 0, /**< Widget state normal */
+ EWL_FLAG_STATE_MOUSE_IN = 0x4000000, /**< Mouse is in the widget */
+ EWL_FLAG_STATE_PRESSED = 0x8000000, /**< Widget is pressed */
+ EWL_FLAG_STATE_FOCUSED = 0x10000000, /**< Widget has focus */
+ EWL_FLAG_STATE_DISABLED = 0x20000000, /**< Widget is disabled */
+ EWL_FLAG_STATE_DND = 0x40000000, /**< Widget is engaged in DND */
};
/**
@@ -169,51 +169,51 @@ enum Ewl_Flags
* The alignment mask
*/
#define EWL_FLAGS_ALIGN_MASK (EWL_FLAG_ALIGN_CENTER | EWL_FLAG_ALIGN_LEFT | \
- EWL_FLAG_ALIGN_RIGHT | EWL_FLAG_ALIGN_TOP | \
- EWL_FLAG_ALIGN_BOTTOM)
+ EWL_FLAG_ALIGN_RIGHT | EWL_FLAG_ALIGN_TOP | \
+ EWL_FLAG_ALIGN_BOTTOM)
/**
* @def EWL_FLAGS_FILL_MASK
* The fill mask
*/
#define EWL_FLAGS_FILL_MASK (EWL_FLAG_FILL_NONE | EWL_FLAG_FILL_SHRINK | \
- EWL_FLAG_FILL_FILL)
+ EWL_FLAG_FILL_FILL)
/**
* @def EWL_FLAGS_VISIBLE_MASK
* The visibility mask
*/
#define EWL_FLAGS_VISIBLE_MASK (EWL_FLAG_VISIBLE_HIDDEN | \
- EWL_FLAG_VISIBLE_SHOWN | EWL_FLAG_VISIBLE_REALIZED | \
- EWL_FLAG_VISIBLE_REVEALED | EWL_FLAG_VISIBLE_NOCLIP)
+ EWL_FLAG_VISIBLE_SHOWN | EWL_FLAG_VISIBLE_REALIZED | \
+ EWL_FLAG_VISIBLE_REVEALED | EWL_FLAG_VISIBLE_NOCLIP)
/**
* @def EWL_FLAGS_PROPERTY_MASK
* The property mask
*/
#define EWL_FLAGS_PROPERTY_MASK (EWL_FLAG_PROPERTY_RECURSIVE | \
- EWL_FLAG_PROPERTY_TOPLEVEL | EWL_FLAG_PROPERTY_INTERNAL | \
- EWL_FLAG_PROPERTY_BLOCK_TAB_FOCUS | EWL_FLAG_PROPERTY_FOCUSABLE | \
- EWL_FLAG_PROPERTY_DND_TARGET | EWL_FLAG_PROPERTY_DND_SOURCE | \
- EWL_FLAG_PROPERTY_IN_TAB_LIST)
+ EWL_FLAG_PROPERTY_TOPLEVEL | EWL_FLAG_PROPERTY_INTERNAL | \
+ EWL_FLAG_PROPERTY_BLOCK_TAB_FOCUS | EWL_FLAG_PROPERTY_FOCUSABLE | \
+ EWL_FLAG_PROPERTY_DND_TARGET | EWL_FLAG_PROPERTY_DND_SOURCE | \
+ EWL_FLAG_PROPERTY_IN_TAB_LIST)
/**
* @def EWL_FLAGS_QUEUED_MASK
* The queue mask
*/
#define EWL_FLAGS_QUEUED_MASK (EWL_FLAG_QUEUED_SCHEDULED_CONFIGURE | \
- EWL_FLAG_QUEUED_SCHEDULED_REVEAL | EWL_FLAG_QUEUED_SCHEDULED_DESTROY | \
- EWL_FLAG_QUEUED_PROCESS_CONFIGURE | EWL_FLAG_QUEUED_PROCESS_REVEAL | \
- EWL_FLAG_QUEUED_PROCESS_DESTROY)
+ EWL_FLAG_QUEUED_SCHEDULED_REVEAL | EWL_FLAG_QUEUED_SCHEDULED_DESTROY | \
+ EWL_FLAG_QUEUED_PROCESS_CONFIGURE | EWL_FLAG_QUEUED_PROCESS_REVEAL | \
+ EWL_FLAG_QUEUED_PROCESS_DESTROY)
/**
* @def EWL_FLAGS_STATE_MASK
* The state mask
*/
#define EWL_FLAGS_STATE_MASK (EWL_FLAG_STATE_NORMAL | \
- EWL_FLAG_STATE_MOUSE_IN | EWL_FLAG_STATE_PRESSED | \
- EWL_FLAG_STATE_FOCUSED | EWL_FLAG_STATE_DND | \
- EWL_FLAG_STATE_DISABLED)
+ EWL_FLAG_STATE_MOUSE_IN | EWL_FLAG_STATE_PRESSED | \
+ EWL_FLAG_STATE_FOCUSED | EWL_FLAG_STATE_DND | \
+ EWL_FLAG_STATE_DISABLED)
/**
* @enum Ewl_Position
@@ -221,10 +221,10 @@ enum Ewl_Flags
*/
enum Ewl_Position
{
- EWL_POSITION_LEFT = 0x1, /**< Left position */
- EWL_POSITION_RIGHT = 0x2, /**< Right position */
- EWL_POSITION_TOP = 0x4, /**< Top position */
- EWL_POSITION_BOTTOM = 0x8 /**< Bottom position */
+ EWL_POSITION_LEFT = 0x1, /**< Left position */
+ EWL_POSITION_RIGHT = 0x2, /**< Right position */
+ EWL_POSITION_TOP = 0x4, /**< Top position */
+ EWL_POSITION_BOTTOM = 0x8 /**< Bottom position */
};
/**
@@ -244,22 +244,22 @@ typedef enum Ewl_Position Ewl_Position;
*/
enum Ewl_Window_Flags
{
- EWL_WINDOW_BORDERLESS = 0x1, /**< Window is borderless */
- EWL_WINDOW_USER_CONFIGURE = 0x2, /**< User configure */
- EWL_WINDOW_GRAB_POINTER = 0x4, /**< Window grabs pointer */
- EWL_WINDOW_GRAB_KEYBOARD = 0x8, /**< Window grabs keyboard */
- EWL_WINDOW_OVERRIDE = 0x10, /**< Window override setting */
- EWL_WINDOW_FULLSCREEN = 0x20, /**< Window is fullscreen */
- EWL_WINDOW_DIALOG = 0x40, /**< Window has no max and min buttons */
- EWL_WINDOW_MODAL = 0x80, /**< Window is modal */
- EWL_WINDOW_TRANSIENT = 0x100, /**< Window is transient for */
- EWL_WINDOW_TRANSIENT_FOREIGN = 0x200, /**< Window is transient for */
- EWL_WINDOW_LEADER = 0x400, /**< Window HAS a leader */
- EWL_WINDOW_LEADER_FOREIGN = 0x800, /**< Window HAS a leader */
- EWL_WINDOW_SKIP_TASKBAR = 0x1000, /**< Window skips taskbar */
- EWL_WINDOW_SKIP_PAGER = 0x2000, /**< Window skips pager */
- EWL_WINDOW_DEMANDS_ATTENTION = 0x4000, /**< Window requires attention */
- EWL_WINDOW_URGENT = 0x8000 /**< Window is urgent */
+ EWL_WINDOW_BORDERLESS = 0x1, /**< Window is borderless */
+ EWL_WINDOW_USER_CONFIGURE = 0x2, /**< User configure */
+ EWL_WINDOW_GRAB_POINTER = 0x4, /**< Window grabs pointer */
+ EWL_WINDOW_GRAB_KEYBOARD = 0x8, /**< Window grabs keyboard */
+ EWL_WINDOW_OVERRIDE = 0x10, /**< Window override setting */
+ EWL_WINDOW_FULLSCREEN = 0x20, /**< Window is fullscreen */
+ EWL_WINDOW_DIALOG = 0x40, /**< Window has no max and min buttons */
+ EWL_WINDOW_MODAL = 0x80, /**< Window is modal */
+ EWL_WINDOW_TRANSIENT = 0x100, /**< Window is transient for */
+ EWL_WINDOW_TRANSIENT_FOREIGN = 0x200, /**< Window is transient for */
+ EWL_WINDOW_LEADER = 0x400, /**< Window HAS a leader */
+ EWL_WINDOW_LEADER_FOREIGN = 0x800, /**< Window HAS a leader */
+ EWL_WINDOW_SKIP_TASKBAR = 0x1000, /**< Window skips taskbar */
+ EWL_WINDOW_SKIP_PAGER = 0x2000, /**< Window skips pager */
+ EWL_WINDOW_DEMANDS_ATTENTION = 0x4000, /**< Window requires attention */
+ EWL_WINDOW_URGENT = 0x8000 /**< Window is urgent */
};
/**
@@ -273,10 +273,10 @@ typedef enum Ewl_Window_Flags Ewl_Window_Flags;
*/
enum Ewl_Popup_Type
{
- EWL_POPUP_TYPE_NONE, /**< No popup type */
- EWL_POPUP_TYPE_MOUSE, /**< Popup off the mouse */
- EWL_POPUP_TYPE_MENU_HORIZONTAL, /**< Popup with horizontal data */
- EWL_POPUP_TYPE_MENU_VERTICAL /**< Popup with vertical data */
+ EWL_POPUP_TYPE_NONE, /**< No popup type */
+ EWL_POPUP_TYPE_MOUSE, /**< Popup off the mouse */
+ EWL_POPUP_TYPE_MENU_HORIZONTAL, /**< Popup with horizontal data */
+ EWL_POPUP_TYPE_MENU_VERTICAL /**< Popup with vertical data */
};
/**
@@ -290,9 +290,9 @@ typedef enum Ewl_Popup_Type Ewl_Popup_Type;
*/
enum Ewl_Tree_Node_Flags
{
- EWL_TREE_NODE_NOEXPAND = 0, /**< Node does not expand */
- EWL_TREE_NODE_COLLAPSED = 1, /**< Node is collapsed */
- EWL_TREE_NODE_EXPANDED = 2, /**< Node is expanded */
+ EWL_TREE_NODE_NOEXPAND = 0, /**< Node does not expand */
+ EWL_TREE_NODE_COLLAPSED = 1, /**< Node is collapsed */
+ EWL_TREE_NODE_EXPANDED = 2, /**< Node is expanded */
};
/**
@@ -306,7 +306,7 @@ typedef enum Ewl_Tree_Node_Flags Ewl_Tree_Node_Flags;
*/
enum Ewl_Notebook_Flags
{
- EWL_NOTEBOOK_FLAG_TABS_HIDDEN = 0x10 /**< Tabbar is hidden */
+ EWL_NOTEBOOK_FLAG_TABS_HIDDEN = 0x10 /**< Tabbar is hidden */
};
/**
@@ -320,9 +320,9 @@ typedef enum Ewl_Notebook_Flags Ewl_Notebook_Flags;
*/
enum Ewl_Scrollpane_Flags
{
- EWL_SCROLLPANE_FLAG_NONE, /**< No flags set */
- EWL_SCROLLPANE_FLAG_AUTO_VISIBLE, /**< Hide if possible */
- EWL_SCROLLPANE_FLAG_ALWAYS_HIDDEN /**< Always hide */
+ EWL_SCROLLPANE_FLAG_NONE, /**< No flags set */
+ EWL_SCROLLPANE_FLAG_AUTO_VISIBLE, /**< Hide if possible */
+ EWL_SCROLLPANE_FLAG_ALWAYS_HIDDEN /**< Always hide */
};
/**
@@ -336,11 +336,11 @@ typedef enum Ewl_Scrollpane_Flags Ewl_Scrollpane_Flags;
*/
enum Ewl_Key_Modifiers
{
- EWL_KEY_MODIFIER_SHIFT = 0x1, /**< Shift key */
- EWL_KEY_MODIFIER_CTRL = 0x2, /**< Ctrl key */
- EWL_KEY_MODIFIER_ALT = 0x4, /**< Alt key */
- EWL_KEY_MODIFIER_MOD = 0x8, /**< Mod key */
- EWL_KEY_MODIFIER_WIN = 0x10, /**< Win key */
+ EWL_KEY_MODIFIER_SHIFT = 0x1, /**< Shift key */
+ EWL_KEY_MODIFIER_CTRL = 0x2, /**< Ctrl key */
+ EWL_KEY_MODIFIER_ALT = 0x4, /**< Alt key */
+ EWL_KEY_MODIFIER_MOD = 0x8, /**< Mod key */
+ EWL_KEY_MODIFIER_WIN = 0x10, /**< Win key */
};
/**
@@ -354,8 +354,8 @@ typedef enum Ewl_Key_Modifiers Ewl_Key_Modifiers;
*/
enum Ewl_State_Type
{
- EWL_STATE_TRANSIENT,
- EWL_STATE_PERSISTENT
+ EWL_STATE_TRANSIENT,
+ EWL_STATE_PERSISTENT
};
/**
@@ -369,23 +369,23 @@ typedef enum Ewl_State_Type Ewl_State_Type;
*/
enum Ewl_Stock_Type
{
- EWL_STOCK_APPLY = 0,
- EWL_STOCK_ARROW_DOWN,
- EWL_STOCK_ARROW_LEFT,
- EWL_STOCK_ARROW_RIGHT,
- EWL_STOCK_ARROW_UP,
- EWL_STOCK_CANCEL,
- EWL_STOCK_FASTFORWARD,
- EWL_STOCK_HOME,
- EWL_STOCK_OK,
- EWL_STOCK_OPEN,
- EWL_STOCK_PAUSE,
- EWL_STOCK_PLAY,
- EWL_STOCK_QUIT,
- EWL_STOCK_REWIND,
- EWL_STOCK_SAVE,
- EWL_STOCK_STOP,
- EWL_STOCK_NONE
+ EWL_STOCK_APPLY = 0,
+ EWL_STOCK_ARROW_DOWN,
+ EWL_STOCK_ARROW_LEFT,
+ EWL_STOCK_ARROW_RIGHT,
+ EWL_STOCK_ARROW_UP,
+ EWL_STOCK_CANCEL,
+ EWL_STOCK_FASTFORWARD,
+ EWL_STOCK_HOME,
+ EWL_STOCK_OK,
+ EWL_STOCK_OPEN,
+ EWL_STOCK_PAUSE,
+ EWL_STOCK_PLAY,
+ EWL_STOCK_QUIT,
+ EWL_STOCK_REWIND,
+ EWL_STOCK_SAVE,
+ EWL_STOCK_STOP,
+ EWL_STOCK_NONE
};
/**
@@ -399,12 +399,12 @@ typedef enum Ewl_Stock_Type Ewl_Stock_Type;
*/
enum Ewl_Color_Mode
{
- EWL_COLOR_MODE_RGB_RED,
- EWL_COLOR_MODE_RGB_GREEN,
- EWL_COLOR_MODE_RGB_BLUE,
- EWL_COLOR_MODE_HSV_HUE,
- EWL_COLOR_MODE_HSV_SATURATION,
- EWL_COLOR_MODE_HSV_VALUE
+ EWL_COLOR_MODE_RGB_RED,
+ EWL_COLOR_MODE_RGB_GREEN,
+ EWL_COLOR_MODE_RGB_BLUE,
+ EWL_COLOR_MODE_HSV_HUE,
+ EWL_COLOR_MODE_HSV_SATURATION,
+ EWL_COLOR_MODE_HSV_VALUE
};
/**
@@ -418,8 +418,8 @@ typedef enum Ewl_Color_Mode Ewl_Color_Mode;
*/
enum Ewl_Spectrum_Type
{
- EWL_SPECTRUM_TYPE_SQUARE,
- EWL_SPECTRUM_TYPE_VERTICAL
+ EWL_SPECTRUM_TYPE_SQUARE,
+ EWL_SPECTRUM_TYPE_VERTICAL
};
/**
@@ -433,15 +433,15 @@ typedef enum Ewl_Spectrum_Type Ewl_Spectrum_Type;
*/
enum Ewl_Text_Style
{
- EWL_TEXT_STYLE_NONE = 0x00,
- EWL_TEXT_STYLE_UNDERLINE = 0x01,
- EWL_TEXT_STYLE_DOUBLE_UNDERLINE = 0x02,
- EWL_TEXT_STYLE_STRIKETHROUGH = 0x04,
- EWL_TEXT_STYLE_SHADOW = 0x08,
- EWL_TEXT_STYLE_SOFT_SHADOW = 0x10,
- EWL_TEXT_STYLE_FAR_SHADOW = 0x20,
- EWL_TEXT_STYLE_OUTLINE = 0x40,
- EWL_TEXT_STYLE_GLOW = 0x80
+ EWL_TEXT_STYLE_NONE = 0x00,
+ EWL_TEXT_STYLE_UNDERLINE = 0x01,
+ EWL_TEXT_STYLE_DOUBLE_UNDERLINE = 0x02,
+ EWL_TEXT_STYLE_STRIKETHROUGH = 0x04,
+ EWL_TEXT_STYLE_SHADOW = 0x08,
+ EWL_TEXT_STYLE_SOFT_SHADOW = 0x10,
+ EWL_TEXT_STYLE_FAR_SHADOW = 0x20,
+ EWL_TEXT_STYLE_OUTLINE = 0x40,
+ EWL_TEXT_STYLE_GLOW = 0x80
};
/**
@@ -455,9 +455,9 @@ typedef enum Ewl_Text_Style Ewl_Text_Style;
*/
enum Ewl_Text_Trigger_Type
{
- EWL_TEXT_TRIGGER_TYPE_NONE,
- EWL_TEXT_TRIGGER_TYPE_SELECTION,
- EWL_TEXT_TRIGGER_TYPE_TRIGGER
+ EWL_TEXT_TRIGGER_TYPE_NONE,
+ EWL_TEXT_TRIGGER_TYPE_SELECTION,
+ EWL_TEXT_TRIGGER_TYPE_TRIGGER
};
/**
@@ -471,13 +471,13 @@ typedef enum Ewl_Text_Trigger_Type Ewl_Text_Trigger_Type;
*/
enum Ewl_Attach_Type
{
- EWL_ATTACH_TYPE_TOOLTIP,
- EWL_ATTACH_TYPE_COLOR,
- EWL_ATTACH_TYPE_NAME,
- EWL_ATTACH_TYPE_MOUSE_CURSOR,
- EWL_ATTACH_TYPE_MOUSE_ARGB_CURSOR,
- EWL_ATTACH_TYPE_WIDGET_ASSOCIATION,
- EWL_ATTACH_TYPE_DND_DATA
+ EWL_ATTACH_TYPE_TOOLTIP,
+ EWL_ATTACH_TYPE_COLOR,
+ EWL_ATTACH_TYPE_NAME,
+ EWL_ATTACH_TYPE_MOUSE_CURSOR,
+ EWL_ATTACH_TYPE_MOUSE_ARGB_CURSOR,
+ EWL_ATTACH_TYPE_WIDGET_ASSOCIATION,
+ EWL_ATTACH_TYPE_DND_DATA
};
/**
@@ -491,9 +491,9 @@ typedef enum Ewl_Attach_Type Ewl_Attach_Type;
*/
enum Ewl_Attach_Data_Type
{
- EWL_ATTACH_DATA_TYPE_TEXT,
- EWL_ATTACH_DATA_TYPE_WIDGET,
- EWL_ATTACH_DATA_TYPE_OTHER
+ EWL_ATTACH_DATA_TYPE_TEXT,
+ EWL_ATTACH_DATA_TYPE_WIDGET,
+ EWL_ATTACH_DATA_TYPE_OTHER
};
/**
@@ -507,8 +507,8 @@ typedef enum Ewl_Attach_Data_Type Ewl_Attach_Data_Type;
*/
enum Ewl_Media_Module_Type
{
- EWL_MEDIA_MODULE_XINE,
- EWL_MEDIA_MODULE_GSTREAMER
+ EWL_MEDIA_MODULE_XINE,
+ EWL_MEDIA_MODULE_GSTREAMER
};
/**
@@ -522,20 +522,20 @@ typedef enum Ewl_Media_Module_Type Ewl_Media_Module_Type;
*/
enum Ewl_Text_Context_Mask
{
- EWL_TEXT_CONTEXT_MASK_NONE = 0x00,
- EWL_TEXT_CONTEXT_MASK_FONT = 0x01,
- EWL_TEXT_CONTEXT_MASK_SIZE = 0x02,
- EWL_TEXT_CONTEXT_MASK_STYLES = 0x04,
- EWL_TEXT_CONTEXT_MASK_ALIGN = 0x08,
- EWL_TEXT_CONTEXT_MASK_WRAP = 0x10,
- EWL_TEXT_CONTEXT_MASK_COLOR = 0x20,
- EWL_TEXT_CONTEXT_MASK_BG_COLOR = 0x40,
- EWL_TEXT_CONTEXT_MASK_GLOW_COLOR = 0x80,
- EWL_TEXT_CONTEXT_MASK_OUTLINE_COLOR = 0x100,
- EWL_TEXT_CONTEXT_MASK_SHADOW_COLOR = 0x200,
- EWL_TEXT_CONTEXT_MASK_STRIKETHROUGH_COLOR = 0x400,
- EWL_TEXT_CONTEXT_MASK_UNDERLINE_COLOR = 0x800,
- EWL_TEXT_CONTEXT_MASK_DOUBLE_UNDERLINE_COLOR = 0x1000
+ EWL_TEXT_CONTEXT_MASK_NONE = 0x00,
+ EWL_TEXT_CONTEXT_MASK_FONT = 0x01,
+ EWL_TEXT_CONTEXT_MASK_SIZE = 0x02,
+ EWL_TEXT_CONTEXT_MASK_STYLES = 0x04,
+ EWL_TEXT_CONTEXT_MASK_ALIGN = 0x08,
+ EWL_TEXT_CONTEXT_MASK_WRAP = 0x10,
+ EWL_TEXT_CONTEXT_MASK_COLOR = 0x20,
+ EWL_TEXT_CONTEXT_MASK_BG_COLOR = 0x40,
+ EWL_TEXT_CONTEXT_MASK_GLOW_COLOR = 0x80,
+ EWL_TEXT_CONTEXT_MASK_OUTLINE_COLOR = 0x100,
+ EWL_TEXT_CONTEXT_MASK_SHADOW_COLOR = 0x200,
+ EWL_TEXT_CONTEXT_MASK_STRIKETHROUGH_COLOR = 0x400,
+ EWL_TEXT_CONTEXT_MASK_UNDERLINE_COLOR = 0x800,
+ EWL_TEXT_CONTEXT_MASK_DOUBLE_UNDERLINE_COLOR = 0x1000
};
/**
@@ -549,8 +549,8 @@ typedef enum Ewl_Text_Context_Mask Ewl_Text_Context_Mask;
*/
enum Ewl_Icon_Type
{
- EWL_ICON_TYPE_SHORT,
- EWL_ICON_TYPE_LONG
+ EWL_ICON_TYPE_SHORT,
+ EWL_ICON_TYPE_LONG
};
/**
@@ -564,9 +564,9 @@ typedef enum Ewl_Icon_Type Ewl_Icon_Type;
*/
enum Ewl_Icon_Part
{
- EWL_ICON_PART_NONE,
- EWL_ICON_PART_IMAGE,
- EWL_ICON_PART_LABEL
+ EWL_ICON_PART_NONE,
+ EWL_ICON_PART_IMAGE,
+ EWL_ICON_PART_LABEL
};
/**
@@ -580,9 +580,9 @@ typedef enum Ewl_Icon_Part Ewl_Icon_Part;
*/
enum Ewl_Freebox_Layout_Type
{
- EWL_FREEBOX_LAYOUT_MANUAL,
- EWL_FREEBOX_LAYOUT_COMPARATOR,
- EWL_FREEBOX_LAYOUT_AUTO
+ EWL_FREEBOX_LAYOUT_MANUAL,
+ EWL_FREEBOX_LAYOUT_COMPARATOR,
+ EWL_FREEBOX_LAYOUT_AUTO
};
/**
@@ -596,11 +596,11 @@ typedef enum Ewl_Freebox_Layout_Type Ewl_Freebox_Layout_Type;
*/
enum Ewl_Filelist_Event_Type
{
- EWL_FILELIST_EVENT_DIR_CHANGE,
- EWL_FILELIST_EVENT_SELECTION_CHANGE,
- EWL_FILELIST_EVENT_FILE_SELECTED,
- EWL_FILELIST_EVENT_MULTI_TRUE,
- EWL_FILELIST_EVENT_MULTI_FALSE
+ EWL_FILELIST_EVENT_DIR_CHANGE,
+ EWL_FILELIST_EVENT_SELECTION_CHANGE,
+ EWL_FILELIST_EVENT_FILE_SELECTED,
+ EWL_FILELIST_EVENT_MULTI_TRUE,
+ EWL_FILELIST_EVENT_MULTI_FALSE
};
/**
@@ -614,10 +614,10 @@ typedef enum Ewl_Filelist_Event_Type Ewl_Filelist_Event_Type;
*/
enum Ewl_Grid_Resize_Type
{
- EWL_GRID_RESIZE_NORMAL, /**< use the standard resize methode */
- EWL_GRID_RESIZE_FIXED, /**< use the user set size */
- EWL_GRID_RESIZE_RELATIVE, /**< use the user set relative size */
- EWL_GRID_RESIZE_NONE /**< use the preferred size of the row */
+ EWL_GRID_RESIZE_NORMAL, /**< use the standard resize methode */
+ EWL_GRID_RESIZE_FIXED, /**< use the user set size */
+ EWL_GRID_RESIZE_RELATIVE, /**< use the user set relative size */
+ EWL_GRID_RESIZE_NONE /**< use the preferred size of the row */
};
/**
@@ -631,83 +631,83 @@ typedef enum Ewl_Grid_Resize_Type Ewl_Grid_Resize_Type;
*/
enum Ewl_Mouse_Cursor_Type
{
- EWL_MOUSE_CURSOR_X = 0,
- EWL_MOUSE_CURSOR_ARROW = 2,
- EWL_MOUSE_CURSOR_BASED_ARROW_DOWN = 4,
- EWL_MOUSE_CURSOR_UP = 6,
- EWL_MOUSE_CURSOR_BOAT = 8,
- EWL_MOUSE_CURSOR_BOTTOM_LEFT_CORNER = 12,
- EWL_MOUSE_CURSOR_BOTTOM_RIGHT_CORNER = 14,
- EWL_MOUSE_CURSOR_BOTTOM_SIDE = 16,
- EWL_MOUSE_CURSOR_BOTTOM_TEE = 18,
- EWL_MOUSE_CURSOR_BOX_SPIRAL = 20,
- EWL_MOUSE_CURSOR_CENTER_PTR = 22,
- EWL_MOUSE_CURSOR_CIRCLE = 24,
- EWL_MOUSE_CURSOR_CLOCK = 26,
- EWL_MOUSE_CURSOR_COFFEE_MUG = 28,
- EWL_MOUSE_CURSOR_CROSS = 30,
- EWL_MOUSE_CURSOR_CROSS_REVERSE = 32,
- EWL_MOUSE_CURSOR_CROSSHAIR = 34,
- EWL_MOUSE_CURSOR_DIAMOND_CROSS = 36,
- EWL_MOUSE_CURSOR_DOT = 38,
- EWL_MOUSE_CURSOR_DOT_BOX_MASK = 40,
- EWL_MOUSE_CURSOR_DOUBLE_ARROW = 42,
- EWL_MOUSE_CURSOR_DRAFT_LARGE = 44,
- EWL_MOUSE_CURSOR_DRAFT_SMALL = 46,
- EWL_MOUSE_CURSOR_DRAPED_BOX = 48,
- EWL_MOUSE_CURSOR_EXCHANGE = 50,
- EWL_MOUSE_CURSOR_FLEUR = 52,
- EWL_MOUSE_CURSOR_GOBBLER = 54,
- EWL_MOUSE_CURSOR_GUMBY = 56,
- EWL_MOUSE_CURSOR_HAND1 = 58,
- EWL_MOUSE_CURSOR_HAND2 = 60,
- EWL_MOUSE_CURSOR_HEART = 62,
- EWL_MOUSE_CURSOR_ICON = 64,
- EWL_MOUSE_CURSOR_IRON_CROSS = 66,
- EWL_MOUSE_CURSOR_LEFT_PTR = 68,
- EWL_MOUSE_CURSOR_LEFT_SIDE = 70,
- EWL_MOUSE_CURSOR_LEFT_TEE = 72,
- EWL_MOUSE_CURSOR_LEFTBUTTON = 74,
- EWL_MOUSE_CURSOR_LL_ANGLE = 76,
- EWL_MOUSE_CURSOR_LR_ANGLE = 78,
- EWL_MOUSE_CURSOR_MAN = 80,
- EWL_MOUSE_CURSOR_MIDDLEBUTTON = 82,
- EWL_MOUSE_CURSOR_MOUSE = 84,
- EWL_MOUSE_CURSOR_PENCIL = 86,
- EWL_MOUSE_CURSOR_PIRATE = 88,
- EWL_MOUSE_CURSOR_PLUS = 90,
- EWL_MOUSE_CURSOR_QUESTION_ARROW = 92,
- EWL_MOUSE_CURSOR_RIGHT_PTR = 94,
- EWL_MOUSE_CURSOR_RIGHT_SIDE = 96,
- EWL_MOUSE_CURSOR_RIGHT_TEE = 98,
- EWL_MOUSE_CURSOR_RIGHTBUTTON = 100,
- EWL_MOUSE_CURSOR_RTL_LOGO = 102,
- EWL_MOUSE_CURSOR_SAILBOAT = 104,
- EWL_MOUSE_CURSOR_SB_DOWN_ARROW = 106,
- EWL_MOUSE_CURSOR_SB_H_DOUBLE_ARROW = 108,
- EWL_MOUSE_CURSOR_SB_LEFT_ARROW = 110,
- EWL_MOUSE_CURSOR_SB_RIGHT_ARROW = 112,
- EWL_MOUSE_CURSOR_SB_UP_ARROW = 114,
- EWL_MOUSE_CURSOR_SB_V_DOUBLE_ARROW = 116,
- EWL_MOUSE_CURSOR_SHUTTLE = 118,
- EWL_MOUSE_CURSOR_SIZING = 120,
- EWL_MOUSE_CURSOR_SPIDER = 122,
- EWL_MOUSE_CURSOR_SPRAYCAN = 124,
- EWL_MOUSE_CURSOR_STAR = 126,
- EWL_MOUSE_CURSOR_TARGET = 128,
- EWL_MOUSE_CURSOR_TCROSS = 130,
- EWL_MOUSE_CURSOR_TOP_LEFT_ARROW = 132,
- EWL_MOUSE_CURSOR_TOP_LEFT_CORNER = 134,
- EWL_MOUSE_CURSOR_TOP_RIGHT_CORNER = 136,
- EWL_MOUSE_CURSOR_TOP_SIDE = 138,
- EWL_MOUSE_CURSOR_TOP_TEE = 140,
- EWL_MOUSE_CURSOR_TREK = 142,
- EWL_MOUSE_CURSOR_UL_ANGLE = 144,
- EWL_MOUSE_CURSOR_UMBRELLA = 146,
- EWL_MOUSE_CURSOR_UR_ANGLE = 148,
- EWL_MOUSE_CURSOR_WATCH = 150,
- EWL_MOUSE_CURSOR_XTERM = 152,
- EWL_MOUSE_CURSOR_MAX = 153
+ EWL_MOUSE_CURSOR_X = 0,
+ EWL_MOUSE_CURSOR_ARROW = 2,
+ EWL_MOUSE_CURSOR_BASED_ARROW_DOWN = 4,
+ EWL_MOUSE_CURSOR_UP = 6,
+ EWL_MOUSE_CURSOR_BOAT = 8,
+ EWL_MOUSE_CURSOR_BOTTOM_LEFT_CORNER = 12,
+ EWL_MOUSE_CURSOR_BOTTOM_RIGHT_CORNER = 14,
+ EWL_MOUSE_CURSOR_BOTTOM_SIDE = 16,
+ EWL_MOUSE_CURSOR_BOTTOM_TEE = 18,
+ EWL_MOUSE_CURSOR_BOX_SPIRAL = 20,
+ EWL_MOUSE_CURSOR_CENTER_PTR = 22,
+ EWL_MOUSE_CURSOR_CIRCLE = 24,
+ EWL_MOUSE_CURSOR_CLOCK = 26,
+ EWL_MOUSE_CURSOR_COFFEE_MUG = 28,
+ EWL_MOUSE_CURSOR_CROSS = 30,
+ EWL_MOUSE_CURSOR_CROSS_REVERSE = 32,
+ EWL_MOUSE_CURSOR_CROSSHAIR = 34,
+ EWL_MOUSE_CURSOR_DIAMOND_CROSS = 36,
+ EWL_MOUSE_CURSOR_DOT = 38,
+ EWL_MOUSE_CURSOR_DOT_BOX_MASK = 40,
+ EWL_MOUSE_CURSOR_DOUBLE_ARROW = 42,
+ EWL_MOUSE_CURSOR_DRAFT_LARGE = 44,
+ EWL_MOUSE_CURSOR_DRAFT_SMALL = 46,
+ EWL_MOUSE_CURSOR_DRAPED_BOX = 48,
+ EWL_MOUSE_CURSOR_EXCHANGE = 50,
+ EWL_MOUSE_CURSOR_FLEUR = 52,
+ EWL_MOUSE_CURSOR_GOBBLER = 54,
+ EWL_MOUSE_CURSOR_GUMBY = 56,
+ EWL_MOUSE_CURSOR_HAND1 = 58,
+ EWL_MOUSE_CURSOR_HAND2 = 60,
+ EWL_MOUSE_CURSOR_HEART = 62,
+ EWL_MOUSE_CURSOR_ICON = 64,
+ EWL_MOUSE_CURSOR_IRON_CROSS = 66,
+ EWL_MOUSE_CURSOR_LEFT_PTR = 68,
+ EWL_MOUSE_CURSOR_LEFT_SIDE = 70,
+ EWL_MOUSE_CURSOR_LEFT_TEE = 72,
+ EWL_MOUSE_CURSOR_LEFTBUTTON = 74,
+ EWL_MOUSE_CURSOR_LL_ANGLE = 76,
+ EWL_MOUSE_CURSOR_LR_ANGLE = 78,
+ EWL_MOUSE_CURSOR_MAN = 80,
+ EWL_MOUSE_CURSOR_MIDDLEBUTTON = 82,
+ EWL_MOUSE_CURSOR_MOUSE = 84,
+ EWL_MOUSE_CURSOR_PENCIL = 86,
+ EWL_MOUSE_CURSOR_PIRATE = 88,
+ EWL_MOUSE_CURSOR_PLUS = 90,
+ EWL_MOUSE_CURSOR_QUESTION_ARROW = 92,
+ EWL_MOUSE_CURSOR_RIGHT_PTR = 94,
+ EWL_MOUSE_CURSOR_RIGHT_SIDE = 96,
+ EWL_MOUSE_CURSOR_RIGHT_TEE = 98,
+ EWL_MOUSE_CURSOR_RIGHTBUTTON = 100,
+ EWL_MOUSE_CURSOR_RTL_LOGO = 102,
+ EWL_MOUSE_CURSOR_SAILBOAT = 104,
+ EWL_MOUSE_CURSOR_SB_DOWN_ARROW = 106,
+ EWL_MOUSE_CURSOR_SB_H_DOUBLE_ARROW = 108,
+ EWL_MOUSE_CURSOR_SB_LEFT_ARROW = 110,
+ EWL_MOUSE_CURSOR_SB_RIGHT_ARROW = 112,
+ EWL_MOUSE_CURSOR_SB_UP_ARROW = 114,
+ EWL_MOUSE_CURSOR_SB_V_DOUBLE_ARROW = 116,
+ EWL_MOUSE_CURSOR_SHUTTLE = 118,
+ EWL_MOUSE_CURSOR_SIZING = 120,
+ EWL_MOUSE_CURSOR_SPIDER = 122,
+ EWL_MOUSE_CURSOR_SPRAYCAN = 124,
+ EWL_MOUSE_CURSOR_STAR = 126,
+ EWL_MOUSE_CURSOR_TARGET = 128,
+ EWL_MOUSE_CURSOR_TCROSS = 130,
+ EWL_MOUSE_CURSOR_TOP_LEFT_ARROW = 132,
+ EWL_MOUSE_CURSOR_TOP_LEFT_CORNER = 134,
+ EWL_MOUSE_CURSOR_TOP_RIGHT_CORNER = 136,
+ EWL_MOUSE_CURSOR_TOP_SIDE = 138,
+ EWL_MOUSE_CURSOR_TOP_TEE = 140,
+ EWL_MOUSE_CURSOR_TREK = 142,
+ EWL_MOUSE_CURSOR_UL_ANGLE = 144,
+ EWL_MOUSE_CURSOR_UMBRELLA = 146,
+ EWL_MOUSE_CURSOR_UR_ANGLE = 148,
+ EWL_MOUSE_CURSOR_WATCH = 150,
+ EWL_MOUSE_CURSOR_XTERM = 152,
+ EWL_MOUSE_CURSOR_MAX = 153
};
/**
@@ -721,10 +721,10 @@ typedef enum Ewl_Mouse_Cursor_Type Ewl_Mouse_Cursor_Type;
*/
enum Ewl_Sort_Direction
{
- EWL_SORT_DIRECTION_NONE = 0,
- EWL_SORT_DIRECTION_ASCENDING,
- EWL_SORT_DIRECTION_DESCENDING,
- EWL_SORT_DIRECTION_MAX
+ EWL_SORT_DIRECTION_NONE = 0,
+ EWL_SORT_DIRECTION_ASCENDING,
+ EWL_SORT_DIRECTION_DESCENDING,
+ EWL_SORT_DIRECTION_MAX
};
/**
@@ -738,9 +738,9 @@ typedef enum Ewl_Sort_Direction Ewl_Sort_Direction;
*/
enum Ewl_Text_Wrap
{
- EWL_TEXT_WRAP_NONE = 0,
- EWL_TEXT_WRAP_CHAR,
- EWL_TEXT_WRAP_WORD
+ EWL_TEXT_WRAP_NONE = 0,
+ EWL_TEXT_WRAP_CHAR,
+ EWL_TEXT_WRAP_WORD
};
/**
@@ -754,11 +754,11 @@ typedef enum Ewl_Text_Wrap Ewl_Text_Wrap;
*/
enum Ewl_Rotate
{
- EWL_ROTATE_CW_90, /**< 90 degree clockwise rotation */
- EWL_ROTATE_180, /**< 180 degree rotation */
- EWL_ROTATE_CW_270, /**< 270 degree clockwise rotation */
- EWL_ROTATE_CC_90, /**< 90 degree counter-clockwise rotation */
- EWL_ROTATE_CC_270 /**< 270 degree counter-clockwise rotation */
+ EWL_ROTATE_CW_90, /**< 90 degree clockwise rotation */
+ EWL_ROTATE_180, /**< 180 degree rotation */
+ EWL_ROTATE_CW_270, /**< 270 degree clockwise rotation */
+ EWL_ROTATE_CC_90, /**< 90 degree counter-clockwise rotation */
+ EWL_ROTATE_CC_270 /**< 270 degree counter-clockwise rotation */
};
/**
@@ -772,8 +772,8 @@ typedef enum Ewl_Rotate Ewl_Rotate;
*/
enum Ewl_Selection_Type
{
- EWL_SELECTION_TYPE_INDEX, /**< Single index */
- EWL_SELECTION_TYPE_RANGE /**< Range of indices */
+ EWL_SELECTION_TYPE_INDEX, /**< Single index */
+ EWL_SELECTION_TYPE_RANGE /**< Range of indices */
};
/**
@@ -787,9 +787,9 @@ typedef enum Ewl_Selection_Type Ewl_Selection_Type;
*/
enum Ewl_Selection_Mode
{
- EWL_SELECTION_MODE_NONE, /**< No selection allowed */
- EWL_SELECTION_MODE_SINGLE, /**< Single select only */
- EWL_SELECTION_MODE_MULTI /**< Multi select mode */
+ EWL_SELECTION_MODE_NONE, /**< No selection allowed */
+ EWL_SELECTION_MODE_SINGLE, /**< Single select only */
+ EWL_SELECTION_MODE_MULTI /**< Multi select mode */
};
/**
@@ -803,8 +803,8 @@ typedef enum Ewl_Selection_Mode Ewl_Selection_Mode;
*/
enum Ewl_Tree_Selection_Type
{
- EWL_TREE_SELECTION_TYPE_ROW, /**< Row selection */
- EWL_TREE_SELECTION_TYPE_CELL /**< Cell selection */
+ EWL_TREE_SELECTION_TYPE_ROW, /**< Row selection */
+ EWL_TREE_SELECTION_TYPE_CELL /**< Cell selection */
};
/**
@@ -818,11 +818,11 @@ typedef enum Ewl_Tree_Selection_Type Ewl_Tree_Selection_Type;
*/
enum Ewl_Histogram_Channel
{
- EWL_HISTOGRAM_CHANNEL_Y,
- EWL_HISTOGRAM_CHANNEL_R,
- EWL_HISTOGRAM_CHANNEL_G,
- EWL_HISTOGRAM_CHANNEL_B,
- EWL_HISTOGRAM_CHANNEL_MAX
+ EWL_HISTOGRAM_CHANNEL_Y,
+ EWL_HISTOGRAM_CHANNEL_R,
+ EWL_HISTOGRAM_CHANNEL_G,
+ EWL_HISTOGRAM_CHANNEL_B,
+ EWL_HISTOGRAM_CHANNEL_MAX
};
/**
@@ -836,8 +836,8 @@ typedef enum Ewl_Histogram_Channel Ewl_Histogram_Channel;
*/
enum Ewl_Image_Type
{
- EWL_IMAGE_TYPE_NORMAL, /**< Standard image type */
- EWL_IMAGE_TYPE_EDJE /**< Edje image type */
+ EWL_IMAGE_TYPE_NORMAL, /**< Standard image type */
+ EWL_IMAGE_TYPE_EDJE /**< Edje image type */
};
/**
@@ -851,8 +851,8 @@ typedef enum Ewl_Image_Type Ewl_Image_Type;
*/
enum Ewl_Thumbnail_Size
{
- EWL_THUMBNAIL_SIZE_NORMAL, /**< Normal size thumbnail */
- EWL_THUMBNAIL_SIZE_LARGE, /**< A large thumbnail*/
+ EWL_THUMBNAIL_SIZE_NORMAL, /**< Normal size thumbnail */
+ EWL_THUMBNAIL_SIZE_LARGE, /**< A large thumbnail*/
};
/**
@@ -866,10 +866,10 @@ typedef enum Ewl_Thumbnail_Size Ewl_Thumbnail_Size;
*/
enum Ewl_Filelist_View
{
- EWL_FILELIST_VIEW_ICON, /**< Uses freebox view of tree */
- EWL_FILELIST_VIEW_LIST, /**< Normal tree with no expansions */
- EWL_FILELIST_VIEW_TREE, /**< Normal tree with expansions */
- EWL_FILELIST_VIEW_COLUMN, /**< A custom column view */
+ EWL_FILELIST_VIEW_ICON, /**< Uses freebox view of tree */
+ EWL_FILELIST_VIEW_LIST, /**< Normal tree with no expansions */
+ EWL_FILELIST_VIEW_TREE, /**< Normal tree with expansions */
+ EWL_FILELIST_VIEW_COLUMN, /**< A custom column view */
};
/**
@@ -883,9 +883,9 @@ typedef enum Ewl_Filelist_View Ewl_Filelist_View;
*/
enum Ewl_Kinetic_Scroll
{
- EWL_KINETIC_SCROLL_NONE,
- EWL_KINETIC_SCROLL_NORMAL,
- EWL_KINETIC_SCROLL_EMBEDDED
+ EWL_KINETIC_SCROLL_NONE,
+ EWL_KINETIC_SCROLL_NORMAL,
+ EWL_KINETIC_SCROLL_EMBEDDED
};
/*
diff --git a/src/lib/ewl_events.c b/src/lib/ewl_events.c
index d1fd862..075cd0e 100644
--- a/src/lib/ewl_events.c
+++ b/src/lib/ewl_events.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_private.h"
#include "ewl_macros.h"
@@ -14,9 +14,9 @@ static unsigned int key_modifiers = 0;
unsigned int
ewl_ev_modifiers_get(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- DRETURN_INT(key_modifiers, DLEVEL_STABLE);
+ DRETURN_INT(key_modifiers, DLEVEL_STABLE);
}
/**
@@ -27,10 +27,10 @@ ewl_ev_modifiers_get(void)
void
ewl_ev_modifiers_set(unsigned int modifiers)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- key_modifiers = modifiers;
+ key_modifiers = modifiers;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_events.h b/src/lib/ewl_events.h
index 6ce7aa4..bd90912 100644
--- a/src/lib/ewl_events.h
+++ b/src/lib/ewl_events.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_EVENTS_H
#define EWL_EVENTS_H
@@ -25,10 +25,10 @@ typedef struct Ewl_Event_Window_Expose Ewl_Event_Window_Expose;
*/
struct Ewl_Event_Window_Expose
{
- int x; /**< Beginning X coordinate for the expose rectangle */
- int y; /**< Beginning Y coordinate for the expose rectangle */
- int w; /**< Width of the expose rectangle */
- int h; /**< Height of the expose rectangle */
+ int x; /**< Beginning X coordinate for the expose rectangle */
+ int y; /**< Beginning Y coordinate for the expose rectangle */
+ int w; /**< Width of the expose rectangle */
+ int h; /**< Height of the expose rectangle */
};
/**
@@ -48,8 +48,8 @@ typedef struct Ewl_Event_Key Ewl_Event_Key;
*/
struct Ewl_Event_Key
{
- unsigned int modifiers; /**< Key modifiers that were pressed */
- char *keyname; /**< Name of the key that was pressed */
+ unsigned int modifiers; /**< Key modifiers that were pressed */
+ char *keyname; /**< Name of the key that was pressed */
};
/**
@@ -68,7 +68,7 @@ typedef struct Ewl_Event_Key_Down Ewl_Event_Key_Down;
*/
struct Ewl_Event_Key_Down
{
- Ewl_Event_Key base; /**< Basic key information */
+ Ewl_Event_Key base; /**< Basic key information */
};
/**
@@ -87,7 +87,7 @@ typedef struct Ewl_Event_Key_Up Ewl_Event_Key_Up;
*/
struct Ewl_Event_Key_Up
{
- Ewl_Event_Key base; /**< Basic key information */
+ Ewl_Event_Key base; /**< Basic key information */
};
/**
@@ -106,9 +106,9 @@ typedef struct Ewl_Event_Mouse Ewl_Event_Mouse;
*/
struct Ewl_Event_Mouse
{
- unsigned int modifiers; /**< Modifiers that were pressed */
- int x; /**< X coordinate the mouse release occurred at */
- int y; /**< Y coordinate the mouse release occurred at */
+ unsigned int modifiers; /**< Modifiers that were pressed */
+ int x; /**< X coordinate the mouse release occurred at */
+ int y; /**< Y coordinate the mouse release occurred at */
};
/**
@@ -127,9 +127,9 @@ typedef struct Ewl_Event_Mouse_Down Ewl_Event_Mouse_Down;
*/
struct Ewl_Event_Mouse_Down
{
- Ewl_Event_Mouse base; /**< Base mouse information */
- int button; /**< The mouse button that was released */
- int clicks; /**< Number of consecutive clicks */
+ Ewl_Event_Mouse base; /**< Base mouse information */
+ int button; /**< The mouse button that was released */
+ int clicks; /**< Number of consecutive clicks */
};
/**
@@ -148,8 +148,8 @@ typedef struct Ewl_Event_Mouse_Up Ewl_Event_Mouse_Up;
*/
struct Ewl_Event_Mouse_Up
{
- Ewl_Event_Mouse base; /**< Base mouse information */
- int button; /**< The mouse button that was released */
+ Ewl_Event_Mouse base; /**< Base mouse information */
+ int button; /**< The mouse button that was released */
};
/**
@@ -168,7 +168,7 @@ typedef struct Ewl_Event_Mouse_Move Ewl_Event_Mouse_Move;
*/
struct Ewl_Event_Mouse_Move
{
- Ewl_Event_Mouse base; /**< Base mouse information */
+ Ewl_Event_Mouse base; /**< Base mouse information */
};
/**
@@ -187,7 +187,7 @@ typedef struct Ewl_Event_Mouse_In Ewl_Event_Mouse_In;
*/
struct Ewl_Event_Mouse_In
{
- Ewl_Event_Mouse base; /**< Base mouse information */
+ Ewl_Event_Mouse base; /**< Base mouse information */
};
/**
@@ -206,7 +206,7 @@ typedef struct Ewl_Event_Mouse_Out Ewl_Event_Mouse_Out;
*/
struct Ewl_Event_Mouse_Out
{
- Ewl_Event_Mouse base; /**< Base mouse information */
+ Ewl_Event_Mouse base; /**< Base mouse information */
};
/**
@@ -225,9 +225,9 @@ typedef struct Ewl_Event_Mouse_Wheel Ewl_Event_Mouse_Wheel;
*/
struct Ewl_Event_Mouse_Wheel
{
- Ewl_Event_Mouse base; /**< Base mouse information */
- int z; /**< Z value of mouse wheel */
- int dir; /**< Direction mouse wheel scrolled */
+ Ewl_Event_Mouse base; /**< Base mouse information */
+ int z; /**< Z value of mouse wheel */
+ int dir; /**< Direction mouse wheel scrolled */
};
/**
@@ -246,8 +246,8 @@ typedef struct Ewl_Dnd_Types Ewl_Dnd_Types;
*/
struct Ewl_Dnd_Types
{
- int num_types; /**< The number of DND types */
- char** types; /**< The list of DND types */
+ int num_types; /**< The number of DND types */
+ char** types; /**< The list of DND types */
};
/**
@@ -266,8 +266,8 @@ typedef struct Ewl_Event_Dnd_Position Ewl_Event_Dnd_Position;
*/
struct Ewl_Event_Dnd_Position
{
- int x; /**< X coordinate the mouse moved to */
- int y; /**< Y coordinate the mouse moved to */
+ int x; /**< X coordinate the mouse moved to */
+ int y; /**< Y coordinate the mouse moved to */
};
/**
@@ -286,9 +286,9 @@ typedef struct Ewl_Event_Dnd_Drop Ewl_Event_Dnd_Drop;
*/
struct Ewl_Event_Dnd_Drop
{
- int x; /**< X coordinate the mouse moved to */
- int y; /**< Y coordinate the mouse moved to */
- void* data; /**< Data from drop source */
+ int x; /**< X coordinate the mouse moved to */
+ int y; /**< Y coordinate the mouse moved to */
+ void* data; /**< Data from drop source */
};
/**
@@ -307,10 +307,10 @@ typedef struct Ewl_Event_Dnd_Data_Received Ewl_Event_Dnd_Data_Received;
*/
struct Ewl_Event_Dnd_Data_Received
{
- char *type; /**< Type of data from drop source */
- void *data; /**< Data from drop source */
- unsigned int len; /**< Length of received data */
- unsigned int format; /**< Bit format of received data */
+ char *type; /**< Type of data from drop source */
+ void *data; /**< Data from drop source */
+ unsigned int len; /**< Length of received data */
+ unsigned int format; /**< Bit format of received data */
};
/**
@@ -329,8 +329,8 @@ typedef struct Ewl_Event_Dnd_Data_Request Ewl_Event_Dnd_Data_Request;
*/
struct Ewl_Event_Dnd_Data_Request
{
- void *handle; /**< Engine specific handle for responding to request */
- char *type; /**< Type of data requested */
+ void *handle; /**< Engine specific handle for responding to request */
+ char *type; /**< Type of data requested */
};
/**
@@ -349,7 +349,7 @@ typedef struct Ewl_Event_Action_Response Ewl_Event_Action_Response;
*/
struct Ewl_Event_Action_Response
{
- unsigned int response; /**< The response ID */
+ unsigned int response; /**< The response ID */
};
/**
@@ -368,12 +368,12 @@ typedef struct Ewl_Event_State_Change Ewl_Event_State_Change;
*/
struct Ewl_Event_State_Change
{
- const char *state;
- Ewl_State_Type flag;
+ const char *state;
+ Ewl_State_Type flag;
};
-unsigned int ewl_ev_modifiers_get(void);
-void ewl_ev_modifiers_set(unsigned int modifiers);
+unsigned int ewl_ev_modifiers_get(void);
+void ewl_ev_modifiers_set(unsigned int modifiers);
/**
* @}
diff --git a/src/lib/ewl_expansion.c b/src/lib/ewl_expansion.c
index 8d2ec86..4fe8f38 100644
--- a/src/lib/ewl_expansion.c
+++ b/src/lib/ewl_expansion.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_check.h"
#include "ewl_expansion.h"
@@ -14,20 +14,20 @@ static void ewl_expansion_expandable_update(Ewl_Expansion *ex);
Ewl_Widget *
ewl_expansion_new(void)
{
- Ewl_Expansion *b;
+ Ewl_Expansion *b;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- b = NEW(Ewl_Expansion, 1);
- if (!b)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ b = NEW(Ewl_Expansion, 1);
+ if (!b)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_expansion_init(EWL_EXPANSION(b))) {
- ewl_widget_destroy(EWL_WIDGET(b));
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ewl_expansion_init(EWL_EXPANSION(b))) {
+ ewl_widget_destroy(EWL_WIDGET(b));
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(EWL_WIDGET(b), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(b), DLEVEL_STABLE);
}
/**
@@ -41,24 +41,24 @@ ewl_expansion_new(void)
int
ewl_expansion_init(Ewl_Expansion *cb)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cb, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cb, FALSE);
- w = EWL_WIDGET(cb);
- if (!ewl_check_init(EWL_CHECK(w)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ w = EWL_WIDGET(cb);
+ if (!ewl_check_init(EWL_CHECK(w)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_appearance_set(w, EWL_EXPANSION_TYPE);
- ewl_widget_inherit(w, EWL_EXPANSION_TYPE);
+ ewl_widget_appearance_set(w, EWL_EXPANSION_TYPE);
+ ewl_widget_inherit(w, EWL_EXPANSION_TYPE);
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_TOP);
- ewl_callback_append(w, EWL_CALLBACK_REVEAL,
- ewl_expansion_cb_reveal, NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_TOP);
+ ewl_callback_append(w, EWL_CALLBACK_REVEAL,
+ ewl_expansion_cb_reveal, NULL);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -73,14 +73,14 @@ ewl_expansion_init(Ewl_Expansion *cb)
void
ewl_expansion_expandable_set(Ewl_Expansion *cb, int c)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cb);
- DCHECK_TYPE(cb, EWL_EXPANSION_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cb);
+ DCHECK_TYPE(cb, EWL_EXPANSION_TYPE);
- cb->expandable = !!c;
- ewl_expansion_expandable_update(cb);
+ cb->expandable = !!c;
+ ewl_expansion_expandable_update(cb);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -91,11 +91,11 @@ ewl_expansion_expandable_set(Ewl_Expansion *cb, int c)
int
ewl_expansion_is_expandable(Ewl_Expansion *cb)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cb, FALSE);
- DCHECK_TYPE_RET(cb, EWL_EXPANSION_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cb, FALSE);
+ DCHECK_TYPE_RET(cb, EWL_EXPANSION_TYPE, FALSE);
- DRETURN_INT(cb->expandable, DLEVEL_STABLE);
+ DRETURN_INT(cb->expandable, DLEVEL_STABLE);
}
/**
@@ -109,18 +109,18 @@ ewl_expansion_is_expandable(Ewl_Expansion *cb)
static void
ewl_expansion_expandable_update(Ewl_Expansion *ex)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(ex);
- DCHECK_TYPE(ex, EWL_EXPANSION_TYPE);
-
- if (ex->expandable)
- ewl_widget_state_set(EWL_WIDGET(ex), "expandable",
- EWL_STATE_TRANSIENT);
- else
- ewl_widget_state_set(EWL_WIDGET(ex), "nonexpandable",
- EWL_STATE_TRANSIENT);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(ex);
+ DCHECK_TYPE(ex, EWL_EXPANSION_TYPE);
+
+ if (ex->expandable)
+ ewl_widget_state_set(EWL_WIDGET(ex), "expandable",
+ EWL_STATE_TRANSIENT);
+ else
+ ewl_widget_state_set(EWL_WIDGET(ex), "nonexpandable",
+ EWL_STATE_TRANSIENT);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -133,14 +133,14 @@ ewl_expansion_expandable_update(Ewl_Expansion *ex)
*/
void
ewl_expansion_cb_reveal(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_EXPANSION_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_EXPANSION_TYPE);
- ewl_expansion_expandable_update(EWL_EXPANSION(w));
+ ewl_expansion_expandable_update(EWL_EXPANSION(w));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_expansion.h b/src/lib/ewl_expansion.h
index 7a978dd..a5d80f2 100644
--- a/src/lib/ewl_expansion.h
+++ b/src/lib/ewl_expansion.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_EXPANSION_H
#define EWL_EXPANSION_H
@@ -46,16 +46,16 @@ typedef struct Ewl_Expansion Ewl_Expansion;
*/
struct Ewl_Expansion
{
- Ewl_Check w; /**< Inherit from Ewl_Check */
- int expandable; /**< Indicates if this node is expandable or not */
+ Ewl_Check w; /**< Inherit from Ewl_Check */
+ int expandable; /**< Indicates if this node is expandable or not */
};
-Ewl_Widget *ewl_expansion_new(void);
-int ewl_expansion_init(Ewl_Expansion *c);
+Ewl_Widget *ewl_expansion_new(void);
+int ewl_expansion_init(Ewl_Expansion *c);
-int ewl_expansion_is_expandable(Ewl_Expansion *c);
-void ewl_expansion_expandable_set(Ewl_Expansion *c,
- int expandable);
+int ewl_expansion_is_expandable(Ewl_Expansion *c);
+void ewl_expansion_expandable_set(Ewl_Expansion *c,
+ int expandable);
/*
* Internally used callbacks.
*/
diff --git a/src/lib/ewl_filedialog.c b/src/lib/ewl_filedialog.c
index 99a638d..cfa1311 100644
--- a/src/lib/ewl_filedialog.c
+++ b/src/lib/ewl_filedialog.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_filedialog.h"
#include "ewl_filepicker.h"
@@ -10,7 +10,7 @@
static void ewl_filedialog_respond(Ewl_Filedialog *fd, unsigned int response);
static void ewl_filedialog_cb_value_changed(Ewl_Widget *w, void *ev,
- void *data);
+ void *data);
static void ewl_filedialog_cb_column_view(Ewl_Widget *w, void *ev, void *data);
static void ewl_filedialog_cb_icon_view(Ewl_Widget *w, void *ev, void *data);
static void ewl_filedialog_cb_list_view(Ewl_Widget *w, void *ev, void *data);
@@ -26,17 +26,17 @@ static void ewl_filedialog_cb_show_favorites(Ewl_Widget *w, void *ev, void *data
Ewl_Widget *
ewl_filedialog_multiselect_new(void)
{
- Ewl_Widget *fd;
+ Ewl_Widget *fd;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- fd = ewl_filedialog_new();
- if (!fd)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ fd = ewl_filedialog_new();
+ if (!fd)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- ewl_filedialog_multiselect_set(EWL_FILEDIALOG(fd), TRUE);
+ ewl_filedialog_multiselect_set(EWL_FILEDIALOG(fd), TRUE);
- DRETURN_PTR(EWL_WIDGET(fd), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(fd), DLEVEL_STABLE);
}
/**
@@ -46,21 +46,21 @@ ewl_filedialog_multiselect_new(void)
Ewl_Widget *
ewl_filedialog_new(void)
{
- Ewl_Filedialog *fd;
+ Ewl_Filedialog *fd;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- fd = NEW(Ewl_Filedialog, 1);
- if (!fd)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ fd = NEW(Ewl_Filedialog, 1);
+ if (!fd)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_filedialog_init(fd))
- {
- ewl_widget_destroy(EWL_WIDGET(fd));
- fd = NULL;
- }
+ if (!ewl_filedialog_init(fd))
+ {
+ ewl_widget_destroy(EWL_WIDGET(fd));
+ fd = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(fd), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(fd), DLEVEL_STABLE);
}
/**
@@ -71,90 +71,90 @@ ewl_filedialog_new(void)
int
ewl_filedialog_init(Ewl_Filedialog *fd)
{
- Ewl_Widget *w, *menu, *o;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fd, FALSE);
-
- w = EWL_WIDGET(fd);
- if (!ewl_dialog_init(EWL_DIALOG(fd)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- ewl_widget_inherit(w, EWL_FILEDIALOG_TYPE);
-
- ewl_window_title_set(EWL_WINDOW(fd), "Ewl Filedialog");
- ewl_window_name_set(EWL_WINDOW(fd), "Ewl Filedialog");
- ewl_window_class_set(EWL_WINDOW(fd), "Ewl Filedialog");
-
- ewl_callback_append(EWL_WIDGET(fd), EWL_CALLBACK_DELETE_WINDOW,
- ewl_filedialog_cb_delete_window, NULL);
-
- ewl_dialog_active_area_set(EWL_DIALOG(fd), EWL_POSITION_TOP);
-
- /* the file picker */
- fd->fp = ewl_filepicker_new();
- ewl_widget_internal_set(fd->fp, TRUE);
- ewl_container_child_append(EWL_CONTAINER(fd), fd->fp);
- ewl_callback_append(fd->fp, EWL_CALLBACK_VALUE_CHANGED,
- ewl_filedialog_cb_value_changed, fd);
- ewl_widget_show(fd->fp);
-
- /* we don't want an action area with this as the filepicker provides
- * it's own ok/cancel buttons */
- ewl_dialog_has_separator_set(EWL_DIALOG(fd), FALSE);
- ewl_widget_hide(EWL_DIALOG(fd)->action_area);
-
- fd->menu = ewl_context_menu_new();
- ewl_context_menu_attach(EWL_CONTEXT_MENU(fd->menu), EWL_WIDGET(fd));
-
- menu = ewl_menu_new();
- ewl_button_label_set(EWL_BUTTON(menu), "View");
- ewl_container_child_append(EWL_CONTAINER(fd->menu), menu);
- ewl_widget_show(menu);
-
- o = ewl_menu_item_new();
- ewl_button_label_set(EWL_BUTTON(o), "Icon view");
- ewl_container_child_append(EWL_CONTAINER(menu), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_filedialog_cb_icon_view, fd);
- ewl_widget_show(o);
-
- o = ewl_menu_item_new();
- ewl_button_label_set(EWL_BUTTON(o), "List view");
- ewl_container_child_append(EWL_CONTAINER(menu), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_filedialog_cb_list_view, fd);
- ewl_widget_show(o);
-
- o = ewl_menu_item_new();
- ewl_button_label_set(EWL_BUTTON(o), "Column view");
- ewl_container_child_append(EWL_CONTAINER(menu), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_filedialog_cb_column_view, fd);
- ewl_widget_show(o);
-
- o = ewl_menu_item_new();
- ewl_button_label_set(EWL_BUTTON(o), "Tree view");
- ewl_container_child_append(EWL_CONTAINER(menu), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_filedialog_cb_tree_view, fd);
- ewl_widget_show(o);
-
- o = ewl_menu_item_new();
- ewl_button_label_set(EWL_BUTTON(o), "Show Dot Files");
- ewl_container_child_append(EWL_CONTAINER(fd->menu), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_filedialog_cb_show_dot, fd);
- ewl_widget_show(o);
-
- o = ewl_menu_item_new();
- ewl_button_label_set(EWL_BUTTON(o), "Show Favorites");
- ewl_container_child_append(EWL_CONTAINER(fd->menu), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_filedialog_cb_show_favorites, fd);
- ewl_widget_show(o);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Widget *w, *menu, *o;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fd, FALSE);
+
+ w = EWL_WIDGET(fd);
+ if (!ewl_dialog_init(EWL_DIALOG(fd)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ ewl_widget_inherit(w, EWL_FILEDIALOG_TYPE);
+
+ ewl_window_title_set(EWL_WINDOW(fd), "Ewl Filedialog");
+ ewl_window_name_set(EWL_WINDOW(fd), "Ewl Filedialog");
+ ewl_window_class_set(EWL_WINDOW(fd), "Ewl Filedialog");
+
+ ewl_callback_append(EWL_WIDGET(fd), EWL_CALLBACK_DELETE_WINDOW,
+ ewl_filedialog_cb_delete_window, NULL);
+
+ ewl_dialog_active_area_set(EWL_DIALOG(fd), EWL_POSITION_TOP);
+
+ /* the file picker */
+ fd->fp = ewl_filepicker_new();
+ ewl_widget_internal_set(fd->fp, TRUE);
+ ewl_container_child_append(EWL_CONTAINER(fd), fd->fp);
+ ewl_callback_append(fd->fp, EWL_CALLBACK_VALUE_CHANGED,
+ ewl_filedialog_cb_value_changed, fd);
+ ewl_widget_show(fd->fp);
+
+ /* we don't want an action area with this as the filepicker provides
+ * it's own ok/cancel buttons */
+ ewl_dialog_has_separator_set(EWL_DIALOG(fd), FALSE);
+ ewl_widget_hide(EWL_DIALOG(fd)->action_area);
+
+ fd->menu = ewl_context_menu_new();
+ ewl_context_menu_attach(EWL_CONTEXT_MENU(fd->menu), EWL_WIDGET(fd));
+
+ menu = ewl_menu_new();
+ ewl_button_label_set(EWL_BUTTON(menu), "View");
+ ewl_container_child_append(EWL_CONTAINER(fd->menu), menu);
+ ewl_widget_show(menu);
+
+ o = ewl_menu_item_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Icon view");
+ ewl_container_child_append(EWL_CONTAINER(menu), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_filedialog_cb_icon_view, fd);
+ ewl_widget_show(o);
+
+ o = ewl_menu_item_new();
+ ewl_button_label_set(EWL_BUTTON(o), "List view");
+ ewl_container_child_append(EWL_CONTAINER(menu), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_filedialog_cb_list_view, fd);
+ ewl_widget_show(o);
+
+ o = ewl_menu_item_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Column view");
+ ewl_container_child_append(EWL_CONTAINER(menu), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_filedialog_cb_column_view, fd);
+ ewl_widget_show(o);
+
+ o = ewl_menu_item_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Tree view");
+ ewl_container_child_append(EWL_CONTAINER(menu), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_filedialog_cb_tree_view, fd);
+ ewl_widget_show(o);
+
+ o = ewl_menu_item_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Show Dot Files");
+ ewl_container_child_append(EWL_CONTAINER(fd->menu), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_filedialog_cb_show_dot, fd);
+ ewl_widget_show(o);
+
+ o = ewl_menu_item_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Show Favorites");
+ ewl_container_child_append(EWL_CONTAINER(fd->menu), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_filedialog_cb_show_favorites, fd);
+ ewl_widget_show(o);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -166,13 +166,13 @@ ewl_filedialog_init(Ewl_Filedialog *fd)
void
ewl_filedialog_list_view_set(Ewl_Filedialog *fd, Ewl_Filelist_View view)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fd);
- DCHECK_TYPE(fd, EWL_FILEDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fd);
+ DCHECK_TYPE(fd, EWL_FILEDIALOG_TYPE);
- ewl_filepicker_list_view_set(EWL_FILEPICKER(fd->fp), view);
+ ewl_filepicker_list_view_set(EWL_FILEPICKER(fd->fp), view);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -183,12 +183,12 @@ ewl_filedialog_list_view_set(Ewl_Filedialog *fd, Ewl_Filelist_View view)
Ewl_Filelist_View *
ewl_filedialog_list_view_get(Ewl_Filedialog *fd)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fd, NULL);
- DCHECK_TYPE_RET(fd, EWL_FILEDIALOG_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fd, NULL);
+ DCHECK_TYPE_RET(fd, EWL_FILEDIALOG_TYPE, NULL);
- DRETURN_PTR(ewl_filepicker_list_view_get(EWL_FILEPICKER(fd->fp)),
- DLEVEL_STABLE);
+ DRETURN_PTR(ewl_filepicker_list_view_get(EWL_FILEPICKER(fd->fp)),
+ DLEVEL_STABLE);
}
/**
@@ -200,14 +200,14 @@ ewl_filedialog_list_view_get(Ewl_Filedialog *fd)
void
ewl_filedialog_directory_set(Ewl_Filedialog *fd, const char *path)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fd);
- DCHECK_PARAM_PTR(path);
- DCHECK_TYPE(fd, EWL_FILEDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fd);
+ DCHECK_PARAM_PTR(path);
+ DCHECK_TYPE(fd, EWL_FILEDIALOG_TYPE);
- ewl_filepicker_directory_set(EWL_FILEPICKER(fd->fp), path);
+ ewl_filepicker_directory_set(EWL_FILEPICKER(fd->fp), path);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -218,12 +218,12 @@ ewl_filedialog_directory_set(Ewl_Filedialog *fd, const char *path)
const char *
ewl_filedialog_directory_get(Ewl_Filedialog *fd)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fd, NULL);
- DCHECK_TYPE_RET(fd, EWL_FILEDIALOG_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fd, NULL);
+ DCHECK_TYPE_RET(fd, EWL_FILEDIALOG_TYPE, NULL);
- DRETURN_PTR(ewl_filepicker_directory_get(EWL_FILEPICKER(fd->fp)),
- DLEVEL_STABLE);
+ DRETURN_PTR(ewl_filepicker_directory_get(EWL_FILEPICKER(fd->fp)),
+ DLEVEL_STABLE);
}
/**
@@ -235,13 +235,13 @@ ewl_filedialog_directory_get(Ewl_Filedialog *fd)
void
ewl_filedialog_multiselect_set(Ewl_Filedialog *fd, unsigned int val)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fd);
- DCHECK_TYPE(fd, EWL_FILEDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fd);
+ DCHECK_TYPE(fd, EWL_FILEDIALOG_TYPE);
- ewl_filepicker_multiselect_set(EWL_FILEPICKER(fd->fp), val);
+ ewl_filepicker_multiselect_set(EWL_FILEPICKER(fd->fp), val);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -252,12 +252,12 @@ ewl_filedialog_multiselect_set(Ewl_Filedialog *fd, unsigned int val)
unsigned int
ewl_filedialog_multiselect_get(Ewl_Filedialog *fd)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fd, FALSE);
- DCHECK_TYPE_RET(fd, EWL_FILEDIALOG_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fd, FALSE);
+ DCHECK_TYPE_RET(fd, EWL_FILEDIALOG_TYPE, FALSE);
- DRETURN_INT(ewl_filepicker_multiselect_get(EWL_FILEPICKER(fd->fp)),
- DLEVEL_STABLE);
+ DRETURN_INT(ewl_filepicker_multiselect_get(EWL_FILEPICKER(fd->fp)),
+ DLEVEL_STABLE);
}
/**
@@ -269,13 +269,13 @@ ewl_filedialog_multiselect_get(Ewl_Filedialog *fd)
void
ewl_filedialog_show_dot_files_set(Ewl_Filedialog *fd, unsigned int dot)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fd);
- DCHECK_TYPE(fd, EWL_FILEDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fd);
+ DCHECK_TYPE(fd, EWL_FILEDIALOG_TYPE);
- ewl_filepicker_show_dot_files_set(EWL_FILEPICKER(fd->fp), dot);
+ ewl_filepicker_show_dot_files_set(EWL_FILEPICKER(fd->fp), dot);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -286,12 +286,12 @@ ewl_filedialog_show_dot_files_set(Ewl_Filedialog *fd, unsigned int dot)
unsigned int
ewl_filedialog_show_dot_files_get(Ewl_Filedialog *fd)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fd, FALSE);
- DCHECK_TYPE_RET(fd, EWL_FILEDIALOG_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fd, FALSE);
+ DCHECK_TYPE_RET(fd, EWL_FILEDIALOG_TYPE, FALSE);
- DRETURN_INT(ewl_filepicker_show_dot_files_get(EWL_FILEPICKER(fd->fp)),
- DLEVEL_STABLE);
+ DRETURN_INT(ewl_filepicker_show_dot_files_get(EWL_FILEPICKER(fd->fp)),
+ DLEVEL_STABLE);
}
/**
@@ -303,13 +303,13 @@ ewl_filedialog_show_dot_files_get(Ewl_Filedialog *fd)
void
ewl_filedialog_show_favorites_set(Ewl_Filedialog *fd, unsigned int show)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fd);
- DCHECK_TYPE(fd, EWL_FILEDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fd);
+ DCHECK_TYPE(fd, EWL_FILEDIALOG_TYPE);
- ewl_filepicker_show_favorites_set(EWL_FILEPICKER(fd->fp), show);
+ ewl_filepicker_show_favorites_set(EWL_FILEPICKER(fd->fp), show);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -320,12 +320,12 @@ ewl_filedialog_show_favorites_set(Ewl_Filedialog *fd, unsigned int show)
unsigned int
ewl_filedialog_show_favorites_get(Ewl_Filedialog *fd)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fd, FALSE);
- DCHECK_TYPE_RET(fd, EWL_FILEDIALOG_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fd, FALSE);
+ DCHECK_TYPE_RET(fd, EWL_FILEDIALOG_TYPE, FALSE);
- DRETURN_INT(ewl_filepicker_show_favorites_get(EWL_FILEPICKER(fd->fp)),
- DLEVEL_STABLE);
+ DRETURN_INT(ewl_filepicker_show_favorites_get(EWL_FILEPICKER(fd->fp)),
+ DLEVEL_STABLE);
}
/**
@@ -337,13 +337,13 @@ ewl_filedialog_show_favorites_get(Ewl_Filedialog *fd)
void
ewl_filedialog_selected_file_set(Ewl_Filedialog *fd, const char *file)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fd);
- DCHECK_TYPE(fd, EWL_FILEDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fd);
+ DCHECK_TYPE(fd, EWL_FILEDIALOG_TYPE);
- ewl_filepicker_selected_file_set(EWL_FILEPICKER(fd->fp), file);
+ ewl_filepicker_selected_file_set(EWL_FILEPICKER(fd->fp), file);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -354,12 +354,12 @@ ewl_filedialog_selected_file_set(Ewl_Filedialog *fd, const char *file)
char *
ewl_filedialog_selected_file_get(Ewl_Filedialog *fd)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fd, NULL);
- DCHECK_TYPE_RET(fd, EWL_FILEDIALOG_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fd, NULL);
+ DCHECK_TYPE_RET(fd, EWL_FILEDIALOG_TYPE, NULL);
- DRETURN_PTR(ewl_filepicker_selected_file_get(EWL_FILEPICKER(fd->fp)),
- DLEVEL_STABLE);
+ DRETURN_PTR(ewl_filepicker_selected_file_get(EWL_FILEPICKER(fd->fp)),
+ DLEVEL_STABLE);
}
/**
@@ -371,13 +371,13 @@ ewl_filedialog_selected_file_get(Ewl_Filedialog *fd)
void
ewl_filedialog_selected_files_set(Ewl_Filedialog *fd, Ecore_List *files)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fd);
- DCHECK_TYPE(fd, EWL_FILEDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fd);
+ DCHECK_TYPE(fd, EWL_FILEDIALOG_TYPE);
- ewl_filepicker_selected_files_set(EWL_FILEPICKER(fd->fp), files);
+ ewl_filepicker_selected_files_set(EWL_FILEPICKER(fd->fp), files);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -388,12 +388,12 @@ ewl_filedialog_selected_files_set(Ewl_Filedialog *fd, Ecore_List *files)
Ecore_List *
ewl_filedialog_selected_files_get(Ewl_Filedialog *fd)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fd, NULL);
- DCHECK_TYPE_RET(fd, EWL_FILEDIALOG_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fd, NULL);
+ DCHECK_TYPE_RET(fd, EWL_FILEDIALOG_TYPE, NULL);
- DRETURN_PTR(ewl_filepicker_selected_files_get(EWL_FILEPICKER(fd->fp)),
- DLEVEL_STABLE);
+ DRETURN_PTR(ewl_filepicker_selected_files_get(EWL_FILEPICKER(fd->fp)),
+ DLEVEL_STABLE);
}
/**
@@ -406,17 +406,17 @@ ewl_filedialog_selected_files_get(Ewl_Filedialog *fd)
*/
void
ewl_filedialog_filter_add(Ewl_Filedialog *fd, const char *name,
- const char *filter,
- Ecore_List *mime_types)
+ const char *filter,
+ Ecore_List *mime_types)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fd);
- DCHECK_PARAM_PTR(name);
- DCHECK_TYPE(fd, EWL_FILEDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fd);
+ DCHECK_PARAM_PTR(name);
+ DCHECK_TYPE(fd, EWL_FILEDIALOG_TYPE);
- ewl_filepicker_filter_add(EWL_FILEPICKER(fd->fp), name, filter, mime_types);
+ ewl_filepicker_filter_add(EWL_FILEPICKER(fd->fp), name, filter, mime_types);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/*
@@ -433,150 +433,150 @@ ewl_filedialog_filter_add(Ewl_Filedialog *fd, const char *name,
*/
void
ewl_filedialog_cb_delete_window(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Filedialog *fd;
+ Ewl_Filedialog *fd;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_FILEDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_FILEDIALOG_TYPE);
- fd = EWL_FILEDIALOG(w);
- ewl_filedialog_respond(fd, EWL_STOCK_CANCEL);
+ fd = EWL_FILEDIALOG(w);
+ ewl_filedialog_respond(fd, EWL_STOCK_CANCEL);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_filedialog_respond(Ewl_Filedialog *fd, unsigned int response)
{
- Ewl_Event_Action_Response ev;
+ Ewl_Event_Action_Response ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ev.response = response;
- ewl_callback_call_with_event_data(EWL_WIDGET(fd),
- EWL_CALLBACK_VALUE_CHANGED, &ev);
+ ev.response = response;
+ ewl_callback_call_with_event_data(EWL_WIDGET(fd),
+ EWL_CALLBACK_VALUE_CHANGED, &ev);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_filedialog_cb_value_changed(Ewl_Widget *w __UNUSED__, void *ev,
- void *data)
+ void *data)
{
- Ewl_Filedialog *fd;
- Ewl_Event_Action_Response *e;
+ Ewl_Filedialog *fd;
+ Ewl_Event_Action_Response *e;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_FILEDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_FILEDIALOG_TYPE);
- fd = data;
- e = ev;
+ fd = data;
+ e = ev;
- ewl_filedialog_respond(fd, e->response);
+ ewl_filedialog_respond(fd, e->response);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_filedialog_cb_column_view(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Filedialog *fd;
+ Ewl_Filedialog *fd;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_FILEDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_FILEDIALOG_TYPE);
- fd = data;
- ewl_filedialog_list_view_set(fd, EWL_FILELIST_VIEW_COLUMN);
+ fd = data;
+ ewl_filedialog_list_view_set(fd, EWL_FILELIST_VIEW_COLUMN);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_filedialog_cb_icon_view(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Filedialog *fd;
+ Ewl_Filedialog *fd;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_FILEDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_FILEDIALOG_TYPE);
- fd = data;
- ewl_filedialog_list_view_set(fd, EWL_FILELIST_VIEW_ICON);
+ fd = data;
+ ewl_filedialog_list_view_set(fd, EWL_FILELIST_VIEW_ICON);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_filedialog_cb_list_view(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Filedialog *fd;
+ Ewl_Filedialog *fd;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_FILEDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_FILEDIALOG_TYPE);
- fd = data;
- ewl_filedialog_list_view_set(fd, EWL_FILELIST_VIEW_LIST);
+ fd = data;
+ ewl_filedialog_list_view_set(fd, EWL_FILELIST_VIEW_LIST);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_filedialog_cb_tree_view(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Filedialog *fd;
+ Ewl_Filedialog *fd;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_FILEDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_FILEDIALOG_TYPE);
- fd = data;
- ewl_filedialog_list_view_set(fd, EWL_FILELIST_VIEW_TREE);
+ fd = data;
+ ewl_filedialog_list_view_set(fd, EWL_FILELIST_VIEW_TREE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_filedialog_cb_show_dot(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Filedialog *fd;
+ Ewl_Filedialog *fd;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_FILEDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_FILEDIALOG_TYPE);
- fd = data;
- ewl_filedialog_show_dot_files_set(fd,
- !ewl_filedialog_show_dot_files_get(fd));
+ fd = data;
+ ewl_filedialog_show_dot_files_set(fd,
+ !ewl_filedialog_show_dot_files_get(fd));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_filedialog_cb_show_favorites(Ewl_Widget *w __UNUSED__,
- void *ev __UNUSED__, void *data)
+ void *ev __UNUSED__, void *data)
{
- Ewl_Filedialog *fd;
+ Ewl_Filedialog *fd;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_FILEDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_FILEDIALOG_TYPE);
- fd = data;
- ewl_filedialog_show_favorites_set(fd,
- !ewl_filedialog_show_favorites_get(fd));
+ fd = data;
+ ewl_filedialog_show_favorites_set(fd,
+ !ewl_filedialog_show_favorites_get(fd));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -588,12 +588,12 @@ ewl_filedialog_cb_show_favorites(Ewl_Widget *w __UNUSED__,
void
ewl_filedialog_save_as_set(Ewl_Filedialog *fd, unsigned int t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fd);
- DCHECK_TYPE(fd, EWL_FILEDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fd);
+ DCHECK_TYPE(fd, EWL_FILEDIALOG_TYPE);
- ewl_filepicker_save_as_set(EWL_FILEPICKER(fd->fp), t);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ ewl_filepicker_save_as_set(EWL_FILEPICKER(fd->fp), t);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -604,12 +604,12 @@ ewl_filedialog_save_as_set(Ewl_Filedialog *fd, unsigned int t)
unsigned int
ewl_filedialog_save_as_get(Ewl_Filedialog *fd)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fd, FALSE);
- DCHECK_TYPE_RET(fd, EWL_FILEDIALOG_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fd, FALSE);
+ DCHECK_TYPE_RET(fd, EWL_FILEDIALOG_TYPE, FALSE);
- DRETURN_INT(ewl_filepicker_save_as_get(EWL_FILEPICKER(fd->fp)),
- DLEVEL_STABLE);
+ DRETURN_INT(ewl_filepicker_save_as_get(EWL_FILEPICKER(fd->fp)),
+ DLEVEL_STABLE);
}
/**
@@ -621,12 +621,12 @@ ewl_filedialog_save_as_get(Ewl_Filedialog *fd)
void
ewl_filedialog_return_directories_set(Ewl_Filedialog *fd, unsigned int t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fd);
- DCHECK_TYPE(fd, EWL_FILEDIALOG_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fd);
+ DCHECK_TYPE(fd, EWL_FILEDIALOG_TYPE);
- ewl_filepicker_return_directories_set(EWL_FILEPICKER(fd->fp), t);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ ewl_filepicker_return_directories_set(EWL_FILEPICKER(fd->fp), t);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -637,12 +637,12 @@ ewl_filedialog_return_directories_set(Ewl_Filedialog *fd, unsigned int t)
unsigned int
ewl_filedialog_return_directories_get(Ewl_Filedialog *fd)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fd, FALSE);
- DCHECK_TYPE_RET(fd, EWL_FILEDIALOG_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fd, FALSE);
+ DCHECK_TYPE_RET(fd, EWL_FILEDIALOG_TYPE, FALSE);
- DRETURN_INT(ewl_filepicker_return_directories_get
- (EWL_FILEPICKER(fd->fp)), DLEVEL_STABLE);
+ DRETURN_INT(ewl_filepicker_return_directories_get
+ (EWL_FILEPICKER(fd->fp)), DLEVEL_STABLE);
}
/**
@@ -652,13 +652,13 @@ ewl_filedialog_return_directories_get(Ewl_Filedialog *fd)
Ewl_Widget *
ewl_filedialog_save_as_new(void)
{
- Ewl_Widget *ret;
+ Ewl_Widget *ret;
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- ret = ewl_filedialog_new();
- ewl_filedialog_save_as_set(EWL_FILEDIALOG(ret), TRUE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ ret = ewl_filedialog_new();
+ ewl_filedialog_save_as_set(EWL_FILEDIALOG(ret), TRUE);
- DRETURN_PTR(ret, DLEVEL_STABLE);
+ DRETURN_PTR(ret, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_filedialog.h b/src/lib/ewl_filedialog.h
index 2696a07..021c5a3 100644
--- a/src/lib/ewl_filedialog.h
+++ b/src/lib/ewl_filedialog.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_FILEDIALOG_H
#define EWL_FILEDIALOG_H
@@ -50,53 +50,53 @@ typedef struct Ewl_Filedialog Ewl_Filedialog;
*/
struct Ewl_Filedialog
{
- Ewl_Dialog dialog; /**< The dialog base class */
- Ewl_Widget *fp; /**< Ewl_Filepicker */
- Ewl_Widget *menu; /**< The menu */
+ Ewl_Dialog dialog; /**< The dialog base class */
+ Ewl_Widget *fp; /**< Ewl_Filepicker */
+ Ewl_Widget *menu; /**< The menu */
};
-Ewl_Widget *ewl_filedialog_multiselect_new(void);
-Ewl_Widget *ewl_filedialog_new(void);
-int ewl_filedialog_init(Ewl_Filedialog *fd);
+Ewl_Widget *ewl_filedialog_multiselect_new(void);
+Ewl_Widget *ewl_filedialog_new(void);
+int ewl_filedialog_init(Ewl_Filedialog *fd);
-void ewl_filedialog_list_view_set(Ewl_Filedialog *fd,
- Ewl_Filelist_View view);
+void ewl_filedialog_list_view_set(Ewl_Filedialog *fd,
+ Ewl_Filelist_View view);
Ewl_Filelist_View *ewl_filedialog_list_view_get(Ewl_Filedialog *fd);
-void ewl_filedialog_directory_set(Ewl_Filedialog *fd,
- const char *dir);
-const char *ewl_filedialog_directory_get(Ewl_Filedialog *fd);
-
-void ewl_filedialog_multiselect_set(Ewl_Filedialog *fd,
- unsigned int ms);
-unsigned int ewl_filedialog_multiselect_get(Ewl_Filedialog *fd);
-
-void ewl_filedialog_show_dot_files_set(Ewl_Filedialog *fd,
- unsigned int dot);
-unsigned int ewl_filedialog_show_dot_files_get(Ewl_Filedialog *fd);
-
-void ewl_filedialog_show_favorites_set(Ewl_Filedialog *fd,
- unsigned int show);
-unsigned int ewl_filedialog_show_favorites_get(Ewl_Filedialog *fd);
-
-void ewl_filedialog_selected_file_set(Ewl_Filedialog *fd,
- const char *file);
-char *ewl_filedialog_selected_file_get(Ewl_Filedialog *fd);
-
-void ewl_filedialog_selected_files_set(Ewl_Filedialog *fd,
- Ecore_List *files);
-Ecore_List *ewl_filedialog_selected_files_get(Ewl_Filedialog *fd);
-
-void ewl_filedialog_filter_add(Ewl_Filedialog *fd,
- const char *name,
- const char *filter,
- Ecore_List *mime_types);
-void ewl_filedialog_save_as_set(Ewl_Filedialog *fd,
- unsigned int t);
-unsigned int ewl_filedialog_save_as_get(Ewl_Filedialog *fd);
-void ewl_filedialog_return_directories_set(Ewl_Filedialog *fd,
- unsigned int t);
-unsigned int ewl_filedialog_return_directories_get(Ewl_Filedialog *fd);
+void ewl_filedialog_directory_set(Ewl_Filedialog *fd,
+ const char *dir);
+const char *ewl_filedialog_directory_get(Ewl_Filedialog *fd);
+
+void ewl_filedialog_multiselect_set(Ewl_Filedialog *fd,
+ unsigned int ms);
+unsigned int ewl_filedialog_multiselect_get(Ewl_Filedialog *fd);
+
+void ewl_filedialog_show_dot_files_set(Ewl_Filedialog *fd,
+ unsigned int dot);
+unsigned int ewl_filedialog_show_dot_files_get(Ewl_Filedialog *fd);
+
+void ewl_filedialog_show_favorites_set(Ewl_Filedialog *fd,
+ unsigned int show);
+unsigned int ewl_filedialog_show_favorites_get(Ewl_Filedialog *fd);
+
+void ewl_filedialog_selected_file_set(Ewl_Filedialog *fd,
+ const char *file);
+char *ewl_filedialog_selected_file_get(Ewl_Filedialog *fd);
+
+void ewl_filedialog_selected_files_set(Ewl_Filedialog *fd,
+ Ecore_List *files);
+Ecore_List *ewl_filedialog_selected_files_get(Ewl_Filedialog *fd);
+
+void ewl_filedialog_filter_add(Ewl_Filedialog *fd,
+ const char *name,
+ const char *filter,
+ Ecore_List *mime_types);
+void ewl_filedialog_save_as_set(Ewl_Filedialog *fd,
+ unsigned int t);
+unsigned int ewl_filedialog_save_as_get(Ewl_Filedialog *fd);
+void ewl_filedialog_return_directories_set(Ewl_Filedialog *fd,
+ unsigned int t);
+unsigned int ewl_filedialog_return_directories_get(Ewl_Filedialog *fd);
Ewl_Widget *ewl_filedialog_save_as_new(void);
/*
diff --git a/src/lib/ewl_filelist.c b/src/lib/ewl_filelist.c
index eb1e21e..0806444 100644
--- a/src/lib/ewl_filelist.c
+++ b/src/lib/ewl_filelist.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_filelist.h"
#include "ewl_filelist_model.h"
@@ -24,7 +24,7 @@
static void ewl_filelist_setup(Ewl_Filelist *fl);
static void ewl_filelist_view_setup(Ewl_Filelist *fl);
static void ewl_filelist_cb_clicked(Ewl_Widget *w, void *ev,
- void *data __UNUSED__);
+ void *data __UNUSED__);
/**
* @return Returns a new Ewl_Filelist widget or NULL on failure
@@ -33,21 +33,21 @@ static void ewl_filelist_cb_clicked(Ewl_Widget *w, void *ev,
Ewl_Widget *
ewl_filelist_new(void)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- w = NEW(Ewl_Filelist, 1);
- if (!w)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ w = NEW(Ewl_Filelist, 1);
+ if (!w)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_filelist_init(EWL_FILELIST(w)))
- {
- ewl_widget_destroy(w);
- w = NULL;
- }
+ if (!ewl_filelist_init(EWL_FILELIST(w)))
+ {
+ ewl_widget_destroy(w);
+ w = NULL;
+ }
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
/**
@@ -58,30 +58,30 @@ ewl_filelist_new(void)
int
ewl_filelist_init(Ewl_Filelist *fl)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fl, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fl, FALSE);
- if (!ewl_box_init(EWL_BOX(fl)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_box_init(EWL_BOX(fl)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_inherit(EWL_WIDGET(fl), EWL_FILELIST_TYPE);
- ewl_object_fill_policy_set(EWL_OBJECT(fl), EWL_FLAG_FILL_FILL);
+ ewl_widget_inherit(EWL_WIDGET(fl), EWL_FILELIST_TYPE);
+ ewl_object_fill_policy_set(EWL_OBJECT(fl), EWL_FLAG_FILL_FILL);
- fl->scroll_flags.h = EWL_SCROLLPANE_FLAG_AUTO_VISIBLE;
- fl->scroll_flags.v = EWL_SCROLLPANE_FLAG_AUTO_VISIBLE;
+ fl->scroll_flags.h = EWL_SCROLLPANE_FLAG_AUTO_VISIBLE;
+ fl->scroll_flags.v = EWL_SCROLLPANE_FLAG_AUTO_VISIBLE;
- ewl_callback_prepend(EWL_WIDGET(fl), EWL_CALLBACK_DESTROY,
- ewl_filelist_cb_destroy, NULL);
+ ewl_callback_prepend(EWL_WIDGET(fl), EWL_CALLBACK_DESTROY,
+ ewl_filelist_cb_destroy, NULL);
- fl->view_flag = EWL_FILELIST_VIEW_ICON;
- fl->multiselect = FALSE;
- fl->show_dot = FALSE;
+ fl->view_flag = EWL_FILELIST_VIEW_ICON;
+ fl->multiselect = FALSE;
+ fl->show_dot = FALSE;
- fl->directory = NULL;
- fl->filter = NULL;
- ewl_filelist_setup(fl);
+ fl->directory = NULL;
+ fl->filter = NULL;
+ ewl_filelist_setup(fl);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -92,49 +92,49 @@ ewl_filelist_init(Ewl_Filelist *fl)
static void
ewl_filelist_setup(Ewl_Filelist *fl)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fl);
- DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
-
- fl->view = ewl_view_new();
- ewl_view_widget_fetch_set(fl->view,
- ewl_filelist_view_widget_fetch);
- ewl_view_header_fetch_set(fl->view,
- ewl_filelist_view_header_fetch);
-
- fl->model = ewl_model_new();
- ewl_model_data_count_set(fl->model,
- ewl_filelist_model_data_count);
- ewl_model_data_fetch_set(fl->model,
- ewl_filelist_model_data_fetch);
- ewl_model_data_sort_set(fl->model,
- ewl_filelist_model_data_sort);
- ewl_model_column_sortable_set(fl->model,
- ewl_filelist_model_column_sortable);
- ewl_model_data_unref_set(fl->model,
- ewl_filelist_model_data_unref);
-
- /* For now just create a tree and set different views */
- fl->controller = ewl_tree_new();
- ewl_mvc_view_set(EWL_MVC(fl->controller), fl->view);
- ewl_mvc_model_set(EWL_MVC(fl->controller), fl->model);
- ewl_tree_selection_type_set(EWL_TREE(fl->controller),
- EWL_TREE_SELECTION_TYPE_ROW);
- ewl_container_child_append(EWL_CONTAINER(fl), fl->controller);
- ewl_callback_append(EWL_WIDGET(fl->controller),
- EWL_CALLBACK_CLICKED, ewl_filelist_cb_clicked, fl);
- ewl_widget_show(fl->controller);
-
- if (fl->multiselect)
- ewl_mvc_selection_mode_set(EWL_MVC(fl->controller),
- EWL_SELECTION_MODE_MULTI);
- else
- ewl_mvc_selection_mode_set(EWL_MVC(fl->controller),
- EWL_SELECTION_MODE_SINGLE);
-
- ewl_filelist_view_setup(fl);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fl);
+ DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
+
+ fl->view = ewl_view_new();
+ ewl_view_widget_fetch_set(fl->view,
+ ewl_filelist_view_widget_fetch);
+ ewl_view_header_fetch_set(fl->view,
+ ewl_filelist_view_header_fetch);
+
+ fl->model = ewl_model_new();
+ ewl_model_data_count_set(fl->model,
+ ewl_filelist_model_data_count);
+ ewl_model_data_fetch_set(fl->model,
+ ewl_filelist_model_data_fetch);
+ ewl_model_data_sort_set(fl->model,
+ ewl_filelist_model_data_sort);
+ ewl_model_column_sortable_set(fl->model,
+ ewl_filelist_model_column_sortable);
+ ewl_model_data_unref_set(fl->model,
+ ewl_filelist_model_data_unref);
+
+ /* For now just create a tree and set different views */
+ fl->controller = ewl_tree_new();
+ ewl_mvc_view_set(EWL_MVC(fl->controller), fl->view);
+ ewl_mvc_model_set(EWL_MVC(fl->controller), fl->model);
+ ewl_tree_selection_type_set(EWL_TREE(fl->controller),
+ EWL_TREE_SELECTION_TYPE_ROW);
+ ewl_container_child_append(EWL_CONTAINER(fl), fl->controller);
+ ewl_callback_append(EWL_WIDGET(fl->controller),
+ EWL_CALLBACK_CLICKED, ewl_filelist_cb_clicked, fl);
+ ewl_widget_show(fl->controller);
+
+ if (fl->multiselect)
+ ewl_mvc_selection_mode_set(EWL_MVC(fl->controller),
+ EWL_SELECTION_MODE_MULTI);
+ else
+ ewl_mvc_selection_mode_set(EWL_MVC(fl->controller),
+ EWL_SELECTION_MODE_SINGLE);
+
+ ewl_filelist_view_setup(fl);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -143,69 +143,69 @@ ewl_filelist_setup(Ewl_Filelist *fl)
static void
ewl_filelist_view_setup(Ewl_Filelist *fl)
{
- const Ewl_View *view;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fl);
- DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
-
- /* Set expansions callbacks to NULL right off the bat */
- ewl_model_expansion_data_fetch_set(fl->model, NULL);
- ewl_model_data_expandable_set(fl->model, NULL);
-
- if (fl->view_flag == EWL_FILELIST_VIEW_TREE)
- {
- ewl_tree_column_count_set(EWL_TREE(fl->controller), 2);
- ewl_tree_headers_visible_set(EWL_TREE(fl->controller),
- TRUE);
- ewl_tree_alternate_row_colors_set
- (EWL_TREE(fl->controller), TRUE);
- ewl_model_expansion_data_fetch_set(fl->model,
- ewl_filelist_model_data_expansion_data_fetch);
- ewl_model_data_expandable_set(fl->model,
- ewl_filelist_model_data_expandable_get);
- view = ewl_tree_view_scrolled_get();
- }
- else if (fl->view_flag == EWL_FILELIST_VIEW_LIST)
- {
- ewl_tree_column_count_set(EWL_TREE(fl->controller), 6);
- ewl_tree_headers_visible_set(EWL_TREE(fl->controller),
- TRUE);
- ewl_tree_alternate_row_colors_set
- (EWL_TREE(fl->controller), TRUE);
- view = ewl_tree_view_scrolled_get();
- }
- /* Until column view is written just default and throw a warning */
- else if (fl->view_flag == EWL_FILELIST_VIEW_COLUMN)
- {
- ewl_tree_column_count_set(EWL_TREE(fl->controller), 1);
- ewl_tree_headers_visible_set(EWL_TREE(fl->controller),
- FALSE);
- ewl_tree_alternate_row_colors_set
- (EWL_TREE(fl->controller), FALSE);
- view = ewl_tree_view_freebox_get();
- DWARNING("Column view not implemented");
- }
- /* Make icon view default */
- else
- {
- ewl_tree_column_count_set(EWL_TREE(fl->controller), 1);
- /* XXX dirty hack, please remove it after we have a
- * freebox mvc implementation */
- ewl_container_reset(EWL_CONTAINER(EWL_TREE(fl->controller)->header));
- ewl_tree_headers_visible_set(EWL_TREE(fl->controller),
- FALSE);
- ewl_tree_alternate_row_colors_set
- (EWL_TREE(fl->controller), FALSE);
- view = ewl_tree_view_freebox_get();
- fl->view_flag = EWL_FILELIST_VIEW_ICON;
- }
-
- /* Set the view and redraw the tree */
- ewl_tree_content_view_set(EWL_TREE(fl->controller), view);
- ewl_mvc_dirty_set(EWL_MVC(fl->controller), TRUE);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ const Ewl_View *view;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fl);
+ DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
+
+ /* Set expansions callbacks to NULL right off the bat */
+ ewl_model_expansion_data_fetch_set(fl->model, NULL);
+ ewl_model_data_expandable_set(fl->model, NULL);
+
+ if (fl->view_flag == EWL_FILELIST_VIEW_TREE)
+ {
+ ewl_tree_column_count_set(EWL_TREE(fl->controller), 2);
+ ewl_tree_headers_visible_set(EWL_TREE(fl->controller),
+ TRUE);
+ ewl_tree_alternate_row_colors_set
+ (EWL_TREE(fl->controller), TRUE);
+ ewl_model_expansion_data_fetch_set(fl->model,
+ ewl_filelist_model_data_expansion_data_fetch);
+ ewl_model_data_expandable_set(fl->model,
+ ewl_filelist_model_data_expandable_get);
+ view = ewl_tree_view_scrolled_get();
+ }
+ else if (fl->view_flag == EWL_FILELIST_VIEW_LIST)
+ {
+ ewl_tree_column_count_set(EWL_TREE(fl->controller), 6);
+ ewl_tree_headers_visible_set(EWL_TREE(fl->controller),
+ TRUE);
+ ewl_tree_alternate_row_colors_set
+ (EWL_TREE(fl->controller), TRUE);
+ view = ewl_tree_view_scrolled_get();
+ }
+ /* Until column view is written just default and throw a warning */
+ else if (fl->view_flag == EWL_FILELIST_VIEW_COLUMN)
+ {
+ ewl_tree_column_count_set(EWL_TREE(fl->controller), 1);
+ ewl_tree_headers_visible_set(EWL_TREE(fl->controller),
+ FALSE);
+ ewl_tree_alternate_row_colors_set
+ (EWL_TREE(fl->controller), FALSE);
+ view = ewl_tree_view_freebox_get();
+ DWARNING("Column view not implemented");
+ }
+ /* Make icon view default */
+ else
+ {
+ ewl_tree_column_count_set(EWL_TREE(fl->controller), 1);
+ /* XXX dirty hack, please remove it after we have a
+ * freebox mvc implementation */
+ ewl_container_reset(EWL_CONTAINER(EWL_TREE(fl->controller)->header));
+ ewl_tree_headers_visible_set(EWL_TREE(fl->controller),
+ FALSE);
+ ewl_tree_alternate_row_colors_set
+ (EWL_TREE(fl->controller), FALSE);
+ view = ewl_tree_view_freebox_get();
+ fl->view_flag = EWL_FILELIST_VIEW_ICON;
+ }
+
+ /* Set the view and redraw the tree */
+ ewl_tree_content_view_set(EWL_TREE(fl->controller), view);
+ ewl_mvc_dirty_set(EWL_MVC(fl->controller), TRUE);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -217,17 +217,17 @@ ewl_filelist_view_setup(Ewl_Filelist *fl)
void
ewl_filelist_view_set(Ewl_Filelist *fl, Ewl_Filelist_View view)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fl);
- DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fl);
+ DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
- if (fl->view_flag == view)
- DRETURN(DLEVEL_STABLE);
+ if (fl->view_flag == view)
+ DRETURN(DLEVEL_STABLE);
- fl->view_flag = view;
- ewl_filelist_view_setup(fl);
+ fl->view_flag = view;
+ ewl_filelist_view_setup(fl);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -238,10 +238,10 @@ ewl_filelist_view_set(Ewl_Filelist *fl, Ewl_Filelist_View view)
Ewl_Filelist_View *
ewl_filelist_view_get(Ewl_Filelist *fl)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fl, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fl, NULL);
- DRETURN_PTR(fl->view_flag, DLEVEL_STABLE);
+ DRETURN_PTR(fl->view_flag, DLEVEL_STABLE);
}
/**
@@ -254,37 +254,37 @@ ewl_filelist_view_get(Ewl_Filelist *fl)
void
ewl_filelist_directory_set(Ewl_Filelist *fl, const char *dir)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fl);
- DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
-
- if (dir == NULL)
- {
- IF_FREE(fl->directory);
- fl->directory = NULL;
- }
- else if ((!fl->directory) || (strcmp(dir, fl->directory)))
- {
- Ewl_Filelist_Directory *data;
- Ewl_Event_Action_Response ev_data;
-
- IF_FREE(fl->directory);
- fl->directory = strdup(dir);
-
- data = ewl_mvc_data_get(EWL_MVC(fl->controller));
- if (data) ewl_filelist_model_data_unref(data);
-
- data = ewl_filelist_model_directory_new(fl->directory,
- fl->show_dot, TRUE, fl->filter);
- ewl_mvc_data_set(EWL_MVC(fl->controller), data);
- ewl_mvc_dirty_set(EWL_MVC(fl->controller), TRUE);
-
- ev_data.response = EWL_FILELIST_EVENT_DIR_CHANGE;
- ewl_callback_call_with_event_data(EWL_WIDGET(fl),
- EWL_CALLBACK_VALUE_CHANGED, &ev_data);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fl);
+ DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
+
+ if (dir == NULL)
+ {
+ IF_FREE(fl->directory);
+ fl->directory = NULL;
+ }
+ else if ((!fl->directory) || (strcmp(dir, fl->directory)))
+ {
+ Ewl_Filelist_Directory *data;
+ Ewl_Event_Action_Response ev_data;
+
+ IF_FREE(fl->directory);
+ fl->directory = strdup(dir);
+
+ data = ewl_mvc_data_get(EWL_MVC(fl->controller));
+ if (data) ewl_filelist_model_data_unref(data);
+
+ data = ewl_filelist_model_directory_new(fl->directory,
+ fl->show_dot, TRUE, fl->filter);
+ ewl_mvc_data_set(EWL_MVC(fl->controller), data);
+ ewl_mvc_dirty_set(EWL_MVC(fl->controller), TRUE);
+
+ ev_data.response = EWL_FILELIST_EVENT_DIR_CHANGE;
+ ewl_callback_call_with_event_data(EWL_WIDGET(fl),
+ EWL_CALLBACK_VALUE_CHANGED, &ev_data);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -295,11 +295,11 @@ ewl_filelist_directory_set(Ewl_Filelist *fl, const char *dir)
const char *
ewl_filelist_directory_get(Ewl_Filelist *fl)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fl, NULL);
- DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fl, NULL);
+ DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, NULL);
- DRETURN_PTR(fl->directory, DLEVEL_STABLE);
+ DRETURN_PTR(fl->directory, DLEVEL_STABLE);
}
/**
@@ -311,25 +311,25 @@ ewl_filelist_directory_get(Ewl_Filelist *fl)
void
ewl_filelist_filter_set(Ewl_Filelist *fl, Ewl_Filelist_Filter *filter)
{
- Ewl_Filelist_Directory *dir;
- int ret = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fl);
- DCHECK_PARAM_PTR(filter);
- DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
-
- fl->filter = NULL;
- fl->filter = filter;
- dir = ewl_mvc_data_get(EWL_MVC(fl->controller));
-
- /* Set the filelist and test if there is any change in data */
- if (dir)
- ret = ewl_filelist_model_filter_set(dir, filter);
- if (ret)
- ewl_mvc_dirty_set(EWL_MVC(fl->controller), TRUE);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Filelist_Directory *dir;
+ int ret = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fl);
+ DCHECK_PARAM_PTR(filter);
+ DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
+
+ fl->filter = NULL;
+ fl->filter = filter;
+ dir = ewl_mvc_data_get(EWL_MVC(fl->controller));
+
+ /* Set the filelist and test if there is any change in data */
+ if (dir)
+ ret = ewl_filelist_model_filter_set(dir, filter);
+ if (ret)
+ ewl_mvc_dirty_set(EWL_MVC(fl->controller), TRUE);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -340,11 +340,11 @@ ewl_filelist_filter_set(Ewl_Filelist *fl, Ewl_Filelist_Filter *filter)
Ewl_Filelist_Filter *
ewl_filelist_filter_get(Ewl_Filelist *fl)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fl, NULL);
- DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fl, NULL);
+ DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, NULL);
- DRETURN_PTR(fl->filter, DLEVEL_STABLE);
+ DRETURN_PTR(fl->filter, DLEVEL_STABLE);
}
/**
@@ -356,34 +356,34 @@ ewl_filelist_filter_get(Ewl_Filelist *fl)
void
ewl_filelist_multiselect_set(Ewl_Filelist *fl, unsigned int ms)
{
- Ewl_Event_Action_Response ev_data;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fl);
- DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
-
- if (fl->multiselect == !!ms)
- DRETURN(DLEVEL_STABLE);
-
- fl->multiselect = !!ms;
-
- if (fl->multiselect)
- {
- ewl_mvc_selection_mode_set(EWL_MVC(fl->controller),
- EWL_SELECTION_MODE_MULTI);
- ev_data.response = EWL_FILELIST_EVENT_MULTI_TRUE;
- }
- else
- {
- ewl_mvc_selection_mode_set(EWL_MVC(fl->controller),
- EWL_SELECTION_MODE_SINGLE);
- ev_data.response = EWL_FILELIST_EVENT_MULTI_FALSE;
- }
-
- ewl_callback_call_with_event_data(EWL_WIDGET(fl),
- EWL_CALLBACK_VALUE_CHANGED, &ev_data);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Event_Action_Response ev_data;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fl);
+ DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
+
+ if (fl->multiselect == !!ms)
+ DRETURN(DLEVEL_STABLE);
+
+ fl->multiselect = !!ms;
+
+ if (fl->multiselect)
+ {
+ ewl_mvc_selection_mode_set(EWL_MVC(fl->controller),
+ EWL_SELECTION_MODE_MULTI);
+ ev_data.response = EWL_FILELIST_EVENT_MULTI_TRUE;
+ }
+ else
+ {
+ ewl_mvc_selection_mode_set(EWL_MVC(fl->controller),
+ EWL_SELECTION_MODE_SINGLE);
+ ev_data.response = EWL_FILELIST_EVENT_MULTI_FALSE;
+ }
+
+ ewl_callback_call_with_event_data(EWL_WIDGET(fl),
+ EWL_CALLBACK_VALUE_CHANGED, &ev_data);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -394,11 +394,11 @@ ewl_filelist_multiselect_set(Ewl_Filelist *fl, unsigned int ms)
unsigned int
ewl_filelist_multiselect_get(Ewl_Filelist *fl)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fl, FALSE);
- DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fl, FALSE);
+ DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, FALSE);
- DRETURN_INT((unsigned int)fl->multiselect, DLEVEL_STABLE);
+ DRETURN_INT((unsigned int)fl->multiselect, DLEVEL_STABLE);
}
/**
@@ -410,26 +410,26 @@ ewl_filelist_multiselect_get(Ewl_Filelist *fl)
void
ewl_filelist_show_dot_files_set(Ewl_Filelist *fl, unsigned int dot)
{
- Ewl_Filelist_Directory *dir;
- int ret = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fl);
- DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
-
- if (fl->show_dot == !!dot)
- DRETURN(DLEVEL_STABLE);
-
- fl->show_dot = !!dot;
- dir = ewl_mvc_data_get(EWL_MVC(fl->controller));
-
- /* check if data and then call the model function */
- if (dir)
- ret = ewl_filelist_model_show_dot_files_set(dir, dot);
- if (ret)
- ewl_mvc_dirty_set(EWL_MVC(fl->controller), TRUE);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Filelist_Directory *dir;
+ int ret = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fl);
+ DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
+
+ if (fl->show_dot == !!dot)
+ DRETURN(DLEVEL_STABLE);
+
+ fl->show_dot = !!dot;
+ dir = ewl_mvc_data_get(EWL_MVC(fl->controller));
+
+ /* check if data and then call the model function */
+ if (dir)
+ ret = ewl_filelist_model_show_dot_files_set(dir, dot);
+ if (ret)
+ ewl_mvc_dirty_set(EWL_MVC(fl->controller), TRUE);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -440,11 +440,11 @@ ewl_filelist_show_dot_files_set(Ewl_Filelist *fl, unsigned int dot)
unsigned int
ewl_filelist_show_dot_files_get(Ewl_Filelist *fl)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fl, FALSE);
- DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fl, FALSE);
+ DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, FALSE);
- DRETURN_INT((unsigned int)fl->show_dot, DLEVEL_STABLE);
+ DRETURN_INT((unsigned int)fl->show_dot, DLEVEL_STABLE);
}
/**
@@ -456,54 +456,54 @@ ewl_filelist_show_dot_files_get(Ewl_Filelist *fl)
void
ewl_filelist_selected_file_set(Ewl_Filelist *fl, const char *file)
{
- char *filename;
- Ewl_Filelist_Directory *data;
- Ewl_Filelist_File *file_temp;
- int dir = 0, index = -1;
- Ecore_List *temp;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fl);
- DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
-
- if (!file)
- {
- ewl_mvc_selected_clear(EWL_MVC(fl->controller));
- DRETURN(DLEVEL_STABLE);
- }
-
- filename = ewl_filelist_expand_path(fl, file);
- data = ewl_mvc_data_get(EWL_MVC(fl->controller));
- if (ecore_file_is_dir(filename))
- {
- temp = data->dirs;
- dir = 1;
- }
- else
- temp = data->files;
-
- ecore_list_first_goto(temp);
- while ((file_temp = ecore_list_next(temp)))
- {
- if (!strcoll(file_temp->name, file))
- {
- index = ecore_list_index(temp);
- break;
- }
- }
-
- if ((index >= 0) && (dir == 0))
- ewl_mvc_selected_set(EWL_MVC(fl->controller), NULL,
- NULL, (index + data->num_dirs - 1), 0);
-
- else if ((index >= 0) && (dir == 1))
- ewl_mvc_selected_set(EWL_MVC(fl->controller), NULL,
- NULL, (index - 1), 0);
-
- FREE(filename);
- ewl_filelist_selected_files_change_notify(fl);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ char *filename;
+ Ewl_Filelist_Directory *data;
+ Ewl_Filelist_File *file_temp;
+ int dir = 0, index = -1;
+ Ecore_List *temp;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fl);
+ DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
+
+ if (!file)
+ {
+ ewl_mvc_selected_clear(EWL_MVC(fl->controller));
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ filename = ewl_filelist_expand_path(fl, file);
+ data = ewl_mvc_data_get(EWL_MVC(fl->controller));
+ if (ecore_file_is_dir(filename))
+ {
+ temp = data->dirs;
+ dir = 1;
+ }
+ else
+ temp = data->files;
+
+ ecore_list_first_goto(temp);
+ while ((file_temp = ecore_list_next(temp)))
+ {
+ if (!strcoll(file_temp->name, file))
+ {
+ index = ecore_list_index(temp);
+ break;
+ }
+ }
+
+ if ((index >= 0) && (dir == 0))
+ ewl_mvc_selected_set(EWL_MVC(fl->controller), NULL,
+ NULL, (index + data->num_dirs - 1), 0);
+
+ else if ((index >= 0) && (dir == 1))
+ ewl_mvc_selected_set(EWL_MVC(fl->controller), NULL,
+ NULL, (index - 1), 0);
+
+ FREE(filename);
+ ewl_filelist_selected_files_change_notify(fl);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -514,47 +514,47 @@ ewl_filelist_selected_file_set(Ewl_Filelist *fl, const char *file)
char *
ewl_filelist_selected_file_get(Ewl_Filelist *fl)
{
- Ewl_Filelist_Directory *data;
- Ewl_Filelist_File *file;
- Ewl_Selection_Idx *idx;
- char path[PATH_MAX];
- int i;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fl, NULL);
- DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, NULL);
-
- if (!ewl_mvc_selected_count_get(EWL_MVC(fl->controller)))
- DRETURN_PTR(NULL, DLEVEL_STABLE);
-
- idx = ewl_mvc_selected_get(EWL_MVC(fl->controller));
- data = EWL_SELECTION(idx)->data;
- if (idx->row < data->num_dirs)
- file = ecore_list_index_goto(data->dirs, idx->row);
- else
- {
- i = (idx->row - data->num_dirs);
- file = ecore_list_index_goto(data->files, i);
- }
- FREE(idx);
-
- if (!file)
- {
- /* This should be fixed now */
- DWARNING("MVC has selected file, but cannot find the data!");
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
-
- if (!strcmp(file->name, ".."))
- snprintf(path, PATH_MAX, "%s", data->name);
-
- else if (!strcmp(data->name, "/"))
- snprintf(path, PATH_MAX, "%s%s", data->name, file->name);
-
- else
- snprintf(path, PATH_MAX, "%s/%s", data->name, file->name);
-
- DRETURN_PTR(strdup(path), DLEVEL_STABLE);
+ Ewl_Filelist_Directory *data;
+ Ewl_Filelist_File *file;
+ Ewl_Selection_Idx *idx;
+ char path[PATH_MAX];
+ int i;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fl, NULL);
+ DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, NULL);
+
+ if (!ewl_mvc_selected_count_get(EWL_MVC(fl->controller)))
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+
+ idx = ewl_mvc_selected_get(EWL_MVC(fl->controller));
+ data = EWL_SELECTION(idx)->data;
+ if (idx->row < data->num_dirs)
+ file = ecore_list_index_goto(data->dirs, idx->row);
+ else
+ {
+ i = (idx->row - data->num_dirs);
+ file = ecore_list_index_goto(data->files, i);
+ }
+ FREE(idx);
+
+ if (!file)
+ {
+ /* This should be fixed now */
+ DWARNING("MVC has selected file, but cannot find the data!");
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
+
+ if (!strcmp(file->name, ".."))
+ snprintf(path, PATH_MAX, "%s", data->name);
+
+ else if (!strcmp(data->name, "/"))
+ snprintf(path, PATH_MAX, "%s%s", data->name, file->name);
+
+ else
+ snprintf(path, PATH_MAX, "%s/%s", data->name, file->name);
+
+ DRETURN_PTR(strdup(path), DLEVEL_STABLE);
}
/**
@@ -565,34 +565,34 @@ ewl_filelist_selected_file_get(Ewl_Filelist *fl)
char *
ewl_filelist_size_get(off_t st_size)
{
- double dsize;
- char size[1024], *suffix;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- dsize = (double)st_size;
- if (dsize < 1024)
- snprintf(size, sizeof(size), "%.0f b", dsize);
- else
- {
- dsize /= 1024.0;
- if (dsize < 1024)
- suffix = "kb";
- else
- {
- dsize /= 1024.0;
- if (dsize < 1024)
- suffix = "mb";
- else
- {
- dsize /= 1024.0;
- suffix = "gb";
- }
- }
- snprintf(size, sizeof(size), "%.1f %s", dsize, suffix);
- }
-
- DRETURN_PTR(strdup(size), DLEVEL_STABLE);
+ double dsize;
+ char size[1024], *suffix;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ dsize = (double)st_size;
+ if (dsize < 1024)
+ snprintf(size, sizeof(size), "%.0f b", dsize);
+ else
+ {
+ dsize /= 1024.0;
+ if (dsize < 1024)
+ suffix = "kb";
+ else
+ {
+ dsize /= 1024.0;
+ if (dsize < 1024)
+ suffix = "mb";
+ else
+ {
+ dsize /= 1024.0;
+ suffix = "gb";
+ }
+ }
+ snprintf(size, sizeof(size), "%.1f %s", dsize, suffix);
+ }
+
+ DRETURN_PTR(strdup(size), DLEVEL_STABLE);
}
/**
@@ -603,32 +603,32 @@ ewl_filelist_size_get(off_t st_size)
char *
ewl_filelist_perms_get(mode_t st_mode)
{
- char *perm;
- int i;
+ char *perm;
+ int i;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- perm = (char *)malloc(sizeof(char) * 10);
- for (i = 0; i < 9; i++)
- perm[i] = '-';
+ perm = (char *)malloc(sizeof(char) * 10);
+ for (i = 0; i < 9; i++)
+ perm[i] = '-';
- perm[9] = '\0';
+ perm[9] = '\0';
- if ((S_IRUSR & st_mode) == S_IRUSR) perm[0] = 'r';
- if ((S_IWUSR & st_mode) == S_IWUSR) perm[1] = 'w';
- if ((S_IXUSR & st_mode) == S_IXUSR) perm[2] = 'x';
+ if ((S_IRUSR & st_mode) == S_IRUSR) perm[0] = 'r';
+ if ((S_IWUSR & st_mode) == S_IWUSR) perm[1] = 'w';
+ if ((S_IXUSR & st_mode) == S_IXUSR) perm[2] = 'x';
#ifndef _WIN32
- if ((S_IRGRP & st_mode) == S_IRGRP) perm[3] = 'r';
- if ((S_IWGRP & st_mode) == S_IWGRP) perm[4] = 'w';
- if ((S_IXGRP & st_mode) == S_IXGRP) perm[5] = 'x';
+ if ((S_IRGRP & st_mode) == S_IRGRP) perm[3] = 'r';
+ if ((S_IWGRP & st_mode) == S_IWGRP) perm[4] = 'w';
+ if ((S_IXGRP & st_mode) == S_IXGRP) perm[5] = 'x';
- if ((S_IROTH & st_mode) == S_IROTH) perm[6] = 'r';
- if ((S_IWOTH & st_mode) == S_IWOTH) perm[7] = 'w';
- if ((S_IXOTH & st_mode) == S_IXOTH) perm[8] = 'x';
+ if ((S_IROTH & st_mode) == S_IROTH) perm[6] = 'r';
+ if ((S_IWOTH & st_mode) == S_IWOTH) perm[7] = 'w';
+ if ((S_IXOTH & st_mode) == S_IXOTH) perm[8] = 'x';
#endif /* _WIN32 */
- DRETURN_PTR(perm, DLEVEL_STABLE);
+ DRETURN_PTR(perm, DLEVEL_STABLE);
}
/**
@@ -640,46 +640,46 @@ ewl_filelist_perms_get(mode_t st_mode)
char *
ewl_filelist_username_get(uid_t st_uid)
{
- char name[PATH_MAX];
+ char name[PATH_MAX];
#ifdef HAVE_PWD_H
- struct passwd *pwd = NULL;
+ struct passwd *pwd = NULL;
#else
# ifdef _WIN32
- char *homedir;
+ char *homedir;
# endif /* _WIN32 */
#endif /* HAVE_PWD_H */
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
#ifdef HAVE_PWD_H
- pwd = getpwuid(st_uid);
- if (pwd)
- snprintf(name, PATH_MAX, "%s", pwd->pw_name);
- else
+ pwd = getpwuid(st_uid);
+ if (pwd)
+ snprintf(name, PATH_MAX, "%s", pwd->pw_name);
+ else
#else
# ifdef _WIN32
- /* we are on Windows, so we get the user name from */
- /* the environment variable HOME or USERPROFILE */
- homedir = getenv("HOME");
- if (!homedir) homedir = getenv("USERPROFILE");
- if (homedir)
- {
- char *p;
- p = homedir;
- while (p)
- {
- if (*p == '\\') *p = '/';
- p++;
- }
- p = strrchr(homedir, '/');
- snprintf(name, PATH_MAX, "%s", p);
- }
- else
+ /* we are on Windows, so we get the user name from */
+ /* the environment variable HOME or USERPROFILE */
+ homedir = getenv("HOME");
+ if (!homedir) homedir = getenv("USERPROFILE");
+ if (homedir)
+ {
+ char *p;
+ p = homedir;
+ while (p)
+ {
+ if (*p == '\\') *p = '/';
+ p++;
+ }
+ p = strrchr(homedir, '/');
+ snprintf(name, PATH_MAX, "%s", p);
+ }
+ else
# endif /* _WIN32 */
#endif /* HAVE_PWD_H */
- snprintf(name, PATH_MAX, "%-8d", (int)st_uid);
+ snprintf(name, PATH_MAX, "%-8d", (int)st_uid);
- DRETURN_PTR(strdup(name), DLEVEL_STABLE);
+ DRETURN_PTR(strdup(name), DLEVEL_STABLE);
}
/**
@@ -690,22 +690,22 @@ ewl_filelist_username_get(uid_t st_uid)
char *
ewl_filelist_groupname_get(gid_t st_gid)
{
- char name[PATH_MAX];
+ char name[PATH_MAX];
#ifdef HAVE_GRP_H
- struct group *grp;
+ struct group *grp;
#endif /* HAVE_GRP_H */
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
#ifdef HAVE_GRP_H
- grp = getgrgid(st_gid);
- if (grp)
- snprintf(name, PATH_MAX, "%s", grp->gr_name);
- else
+ grp = getgrgid(st_gid);
+ if (grp)
+ snprintf(name, PATH_MAX, "%s", grp->gr_name);
+ else
#endif /* HAVE_GRP_H */
- snprintf(name, PATH_MAX, "%-8d", (int)st_gid);
+ snprintf(name, PATH_MAX, "%-8d", (int)st_gid);
- DRETURN_PTR(strdup(name), DLEVEL_STABLE);
+ DRETURN_PTR(strdup(name), DLEVEL_STABLE);
}
/**
@@ -716,19 +716,19 @@ ewl_filelist_groupname_get(gid_t st_gid)
char *
ewl_filelist_modtime_get(time_t st_modtime)
{
- char *time;
+ char *time;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- time = ctime(&st_modtime);
- if (time)
- {
- time = strdup(time);
- time[strlen(time) - 1] = '\0';
- }
- else time = strdup("Unknown");
+ time = ctime(&st_modtime);
+ if (time)
+ {
+ time = strdup(time);
+ time[strlen(time) - 1] = '\0';
+ }
+ else time = strdup("Unknown");
- DRETURN_PTR(time, DLEVEL_STABLE);
+ DRETURN_PTR(time, DLEVEL_STABLE);
}
/**
@@ -740,69 +740,69 @@ ewl_filelist_modtime_get(time_t st_modtime)
Ewl_Widget *
ewl_filelist_selected_file_preview_get(Ewl_Filelist *fl, const char *path)
{
- Ewl_Widget *box, *icon, *text, *image;
- const char *path2;
- char path3[PATH_MAX], file_info[PATH_MAX];
- char *size, *perms, *username, *groupname, *time;
- struct stat buf;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fl, NULL);
- DCHECK_PARAM_PTR_RET(path, NULL);
- DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, NULL);
-
- path2 = ewl_filelist_directory_get(EWL_FILELIST(fl));
- snprintf(path3, PATH_MAX, "%s/%s", path2, path);
-
- stat(path3, &buf);
-
- size = ewl_filelist_size_get(buf.st_size);
- perms = ewl_filelist_perms_get(buf.st_mode);
- username = ewl_filelist_username_get(buf.st_uid);
- groupname = ewl_filelist_groupname_get(buf.st_gid);
- time = ewl_filelist_modtime_get(buf.st_mtime);
-
- snprintf(file_info, PATH_MAX,
- "Size: %s\n"
- "User ID: %s\n"
- "Group ID: %s\n"
- "Permissions: %s\n"
- "Last Modified: %s\n",
- size, username, groupname,
- perms, time);
-
- box = ewl_vbox_new();
- ewl_widget_show(box);
-
- image = ewl_image_thumbnail_new();
- ewl_image_proportional_set(EWL_IMAGE(image), TRUE);
- ewl_image_constrain_set(EWL_IMAGE(image), 100);
- ewl_image_thumbnail_request(EWL_IMAGE_THUMBNAIL(image), path3);
- ewl_container_child_append(EWL_CONTAINER(box), image);
- ewl_object_alignment_set(EWL_OBJECT(image), EWL_FLAG_ALIGN_CENTER);
- ewl_widget_show(image);
-
- text = ewl_text_new();
- ewl_text_text_set(EWL_TEXT(text), file_info);
- ewl_object_alignment_set(EWL_OBJECT(text), EWL_FLAG_ALIGN_CENTER);
- ewl_widget_show(text);
-
- icon = ewl_icon_new();
- ewl_box_orientation_set(EWL_BOX(icon),
- EWL_ORIENTATION_VERTICAL);
- ewl_icon_label_set(EWL_ICON(icon), path);
- ewl_icon_extended_data_set(EWL_ICON(icon), text);
- ewl_icon_type_set(EWL_ICON(icon), EWL_ICON_TYPE_LONG);
- ewl_container_child_append(EWL_CONTAINER(box), icon);
- ewl_widget_show(icon);
-
- FREE(size);
- FREE(perms);
- FREE(username);
- FREE(groupname);
- FREE(time);
-
- DRETURN_PTR(box, DLEVEL_STABLE);
+ Ewl_Widget *box, *icon, *text, *image;
+ const char *path2;
+ char path3[PATH_MAX], file_info[PATH_MAX];
+ char *size, *perms, *username, *groupname, *time;
+ struct stat buf;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fl, NULL);
+ DCHECK_PARAM_PTR_RET(path, NULL);
+ DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, NULL);
+
+ path2 = ewl_filelist_directory_get(EWL_FILELIST(fl));
+ snprintf(path3, PATH_MAX, "%s/%s", path2, path);
+
+ stat(path3, &buf);
+
+ size = ewl_filelist_size_get(buf.st_size);
+ perms = ewl_filelist_perms_get(buf.st_mode);
+ username = ewl_filelist_username_get(buf.st_uid);
+ groupname = ewl_filelist_groupname_get(buf.st_gid);
+ time = ewl_filelist_modtime_get(buf.st_mtime);
+
+ snprintf(file_info, PATH_MAX,
+ "Size: %s\n"
+ "User ID: %s\n"
+ "Group ID: %s\n"
+ "Permissions: %s\n"
+ "Last Modified: %s\n",
+ size, username, groupname,
+ perms, time);
+
+ box = ewl_vbox_new();
+ ewl_widget_show(box);
+
+ image = ewl_image_thumbnail_new();
+ ewl_image_proportional_set(EWL_IMAGE(image), TRUE);
+ ewl_image_constrain_set(EWL_IMAGE(image), 100);
+ ewl_image_thumbnail_request(EWL_IMAGE_THUMBNAIL(image), path3);
+ ewl_container_child_append(EWL_CONTAINER(box), image);
+ ewl_object_alignment_set(EWL_OBJECT(image), EWL_FLAG_ALIGN_CENTER);
+ ewl_widget_show(image);
+
+ text = ewl_text_new();
+ ewl_text_text_set(EWL_TEXT(text), file_info);
+ ewl_object_alignment_set(EWL_OBJECT(text), EWL_FLAG_ALIGN_CENTER);
+ ewl_widget_show(text);
+
+ icon = ewl_icon_new();
+ ewl_box_orientation_set(EWL_BOX(icon),
+ EWL_ORIENTATION_VERTICAL);
+ ewl_icon_label_set(EWL_ICON(icon), path);
+ ewl_icon_extended_data_set(EWL_ICON(icon), text);
+ ewl_icon_type_set(EWL_ICON(icon), EWL_ICON_TYPE_LONG);
+ ewl_container_child_append(EWL_CONTAINER(box), icon);
+ ewl_widget_show(icon);
+
+ FREE(size);
+ FREE(perms);
+ FREE(username);
+ FREE(groupname);
+ FREE(time);
+
+ DRETURN_PTR(box, DLEVEL_STABLE);
}
/**
@@ -813,23 +813,23 @@ ewl_filelist_selected_file_preview_get(Ewl_Filelist *fl, const char *path)
Ewl_Widget *
ewl_filelist_multi_select_preview_get(Ewl_Filelist *fl)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fl, NULL);
- DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fl, NULL);
+ DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, NULL);
- Ewl_Widget *box, *icon;
+ Ewl_Widget *box, *icon;
- box = ewl_vbox_new();
- ewl_widget_show(box);
+ box = ewl_vbox_new();
+ ewl_widget_show(box);
- icon = ewl_icon_simple_new();
- ewl_box_orientation_set(EWL_BOX(icon),
- EWL_ORIENTATION_VERTICAL);
- ewl_icon_label_set(EWL_ICON(icon), "Multiple files selected");
- ewl_container_child_append(EWL_CONTAINER(box), icon);
- ewl_widget_show(icon);
+ icon = ewl_icon_simple_new();
+ ewl_box_orientation_set(EWL_BOX(icon),
+ EWL_ORIENTATION_VERTICAL);
+ ewl_icon_label_set(EWL_ICON(icon), "Multiple files selected");
+ ewl_container_child_append(EWL_CONTAINER(box), icon);
+ ewl_widget_show(icon);
- DRETURN_PTR(box, DLEVEL_STABLE);
+ DRETURN_PTR(box, DLEVEL_STABLE);
}
/**
@@ -841,64 +841,64 @@ ewl_filelist_multi_select_preview_get(Ewl_Filelist *fl)
void
ewl_filelist_selected_files_set(Ewl_Filelist *fl, Ecore_List *files)
{
- Ewl_Filelist_Directory *data;
- Ewl_Filelist_File *file;
- Ecore_List *selected, *temp;
- Ewl_Selection *sel;
- int i, index;
- char *path;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fl);
- DCHECK_PARAM_PTR(files);
- DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
-
- /* Get the mvc data and get ready for looping */
- data = ewl_mvc_data_get(EWL_MVC(fl->controller));
- selected = ecore_list_new();
-
- ecore_list_first_goto(data->dirs);
- ecore_list_first_goto(data->files);
- ecore_list_first_goto(files);
-
- /* For every file, search for a match */
- for (i = 0; i < ecore_list_count(files); i++)
- {
- path = ecore_list_next(files);
-
- /* Set temp to whichever list the file could be in */
- if (ecore_file_is_dir(path))
- {
- temp = data->dirs;
- index = 0;
- }
- else
- {
- temp = data->files;
- index = data->num_dirs;
- }
-
- /* Search the list and return the index if found */
- while ((file = ecore_list_next(temp)))
- {
- if (!strcmp(file->name, ecore_file_file_get(path)))
- {
- index = (index + ecore_list_index(temp) - 1);
- sel = ewl_mvc_selection_index_new(fl->model,
- NULL, index, 0);
- ecore_list_append(selected, sel);
- break;
- }
- }
- ecore_list_first_goto(temp);
- }
-
- ewl_mvc_selected_list_set(EWL_MVC(fl->controller), selected);
- ewl_filelist_selected_files_change_notify(fl);
- ecore_list_destroy(files);
- ecore_list_destroy(selected);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Filelist_Directory *data;
+ Ewl_Filelist_File *file;
+ Ecore_List *selected, *temp;
+ Ewl_Selection *sel;
+ int i, index;
+ char *path;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fl);
+ DCHECK_PARAM_PTR(files);
+ DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
+
+ /* Get the mvc data and get ready for looping */
+ data = ewl_mvc_data_get(EWL_MVC(fl->controller));
+ selected = ecore_list_new();
+
+ ecore_list_first_goto(data->dirs);
+ ecore_list_first_goto(data->files);
+ ecore_list_first_goto(files);
+
+ /* For every file, search for a match */
+ for (i = 0; i < ecore_list_count(files); i++)
+ {
+ path = ecore_list_next(files);
+
+ /* Set temp to whichever list the file could be in */
+ if (ecore_file_is_dir(path))
+ {
+ temp = data->dirs;
+ index = 0;
+ }
+ else
+ {
+ temp = data->files;
+ index = data->num_dirs;
+ }
+
+ /* Search the list and return the index if found */
+ while ((file = ecore_list_next(temp)))
+ {
+ if (!strcmp(file->name, ecore_file_file_get(path)))
+ {
+ index = (index + ecore_list_index(temp) - 1);
+ sel = ewl_mvc_selection_index_new(fl->model,
+ NULL, index, 0);
+ ecore_list_append(selected, sel);
+ break;
+ }
+ }
+ ecore_list_first_goto(temp);
+ }
+
+ ewl_mvc_selected_list_set(EWL_MVC(fl->controller), selected);
+ ewl_filelist_selected_files_change_notify(fl);
+ ecore_list_destroy(files);
+ ecore_list_destroy(selected);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -909,99 +909,99 @@ ewl_filelist_selected_files_set(Ewl_Filelist *fl, Ecore_List *files)
Ecore_List *
ewl_filelist_selected_files_get(Ewl_Filelist *fl)
{
- Ecore_List *selected, *ret;
- Ewl_Selection *sel;
- Ewl_Filelist_Directory *data;
- Ewl_Filelist_File *file;
- char path[PATH_MAX];
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fl, NULL);
- DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, NULL);
-
- ret = ecore_list_new();
-
- selected = ewl_mvc_selected_list_get(EWL_MVC(fl->controller));
- ecore_list_first_goto(selected);
- while ((sel = ecore_list_next(selected)))
- {
- data = sel->data;
- /* If using Index instead of range */
- if (sel->type == EWL_SELECTION_TYPE_INDEX)
- {
- Ewl_Selection_Idx *idx;
-
- idx = EWL_SELECTION_IDX(sel);
- /* Get the file data */
- if (idx->row < data->num_dirs)
- file = ecore_list_index_goto(data->dirs, idx->row);
- else
- file = ecore_list_index_goto(data->files,
- (idx->row - data->num_dirs));
-
- if (!file)
- {
- /* This should be fixed now */
- DWARNING("MVC has selected file, but cannot "
- "find the data!");
- continue;
- }
-
- if (!strcmp(file->name, ".."))
- snprintf(path, PATH_MAX, "%s", data->name);
-
- else if (!strcmp(data->name, "/"))
- snprintf(path, PATH_MAX, "%s%s",
- data->name, file->name);
-
- else
- snprintf(path, PATH_MAX, "%s/%s",
- data->name, file->name);
-
- ecore_list_append(ret, strdup(path));
- }
-
- /* If using range instead of index */
- else if (sel->type == EWL_SELECTION_TYPE_RANGE)
- {
- Ewl_Selection_Range *r;
- unsigned int i;
-
- r = EWL_SELECTION_RANGE(sel);
- for (i = r->start.row; i <= r->end.row; i++)
- {
- /* Get the file data */
- if (i < data->num_dirs)
- file = ecore_list_index_goto(data->dirs, i);
- else
- file = ecore_list_index_goto(data->files,
- (i - data->num_dirs));
-
- if (!file)
- {
- /* This should be fixed now */
- DWARNING("MVC has selected file, but "
- "cannot find the data!");
- continue;
- }
-
- if (!strcmp(file->name, ".."))
- snprintf(path, PATH_MAX, "%s", data->name);
-
- else if (!strcmp(data->name, "/"))
- snprintf(path, PATH_MAX, "%s%s",
- data->name, file->name);
-
- else
- snprintf(path, PATH_MAX, "%s/%s",
- data->name, file->name);
-
- ecore_list_append(ret, strdup(path));
- }
- }
- }
-
- DRETURN_PTR(ret, DLEVEL_STABLE);
+ Ecore_List *selected, *ret;
+ Ewl_Selection *sel;
+ Ewl_Filelist_Directory *data;
+ Ewl_Filelist_File *file;
+ char path[PATH_MAX];
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fl, NULL);
+ DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, NULL);
+
+ ret = ecore_list_new();
+
+ selected = ewl_mvc_selected_list_get(EWL_MVC(fl->controller));
+ ecore_list_first_goto(selected);
+ while ((sel = ecore_list_next(selected)))
+ {
+ data = sel->data;
+ /* If using Index instead of range */
+ if (sel->type == EWL_SELECTION_TYPE_INDEX)
+ {
+ Ewl_Selection_Idx *idx;
+
+ idx = EWL_SELECTION_IDX(sel);
+ /* Get the file data */
+ if (idx->row < data->num_dirs)
+ file = ecore_list_index_goto(data->dirs, idx->row);
+ else
+ file = ecore_list_index_goto(data->files,
+ (idx->row - data->num_dirs));
+
+ if (!file)
+ {
+ /* This should be fixed now */
+ DWARNING("MVC has selected file, but cannot "
+ "find the data!");
+ continue;
+ }
+
+ if (!strcmp(file->name, ".."))
+ snprintf(path, PATH_MAX, "%s", data->name);
+
+ else if (!strcmp(data->name, "/"))
+ snprintf(path, PATH_MAX, "%s%s",
+ data->name, file->name);
+
+ else
+ snprintf(path, PATH_MAX, "%s/%s",
+ data->name, file->name);
+
+ ecore_list_append(ret, strdup(path));
+ }
+
+ /* If using range instead of index */
+ else if (sel->type == EWL_SELECTION_TYPE_RANGE)
+ {
+ Ewl_Selection_Range *r;
+ unsigned int i;
+
+ r = EWL_SELECTION_RANGE(sel);
+ for (i = r->start.row; i <= r->end.row; i++)
+ {
+ /* Get the file data */
+ if (i < data->num_dirs)
+ file = ecore_list_index_goto(data->dirs, i);
+ else
+ file = ecore_list_index_goto(data->files,
+ (i - data->num_dirs));
+
+ if (!file)
+ {
+ /* This should be fixed now */
+ DWARNING("MVC has selected file, but "
+ "cannot find the data!");
+ continue;
+ }
+
+ if (!strcmp(file->name, ".."))
+ snprintf(path, PATH_MAX, "%s", data->name);
+
+ else if (!strcmp(data->name, "/"))
+ snprintf(path, PATH_MAX, "%s%s",
+ data->name, file->name);
+
+ else
+ snprintf(path, PATH_MAX, "%s/%s",
+ data->name, file->name);
+
+ ecore_list_append(ret, strdup(path));
+ }
+ }
+ }
+
+ DRETURN_PTR(ret, DLEVEL_STABLE);
}
/**
@@ -1013,17 +1013,17 @@ ewl_filelist_selected_files_get(Ewl_Filelist *fl)
void
ewl_filelist_selected_files_change_notify(Ewl_Filelist *fl)
{
- Ewl_Event_Action_Response ev_data;
+ Ewl_Event_Action_Response ev_data;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fl);
- DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fl);
+ DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
- ev_data.response = EWL_FILELIST_EVENT_SELECTION_CHANGE;
- ewl_callback_call_with_event_data(EWL_WIDGET(fl),
- EWL_CALLBACK_VALUE_CHANGED, &ev_data);
+ ev_data.response = EWL_FILELIST_EVENT_SELECTION_CHANGE;
+ ewl_callback_call_with_event_data(EWL_WIDGET(fl),
+ EWL_CALLBACK_VALUE_CHANGED, &ev_data);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1035,13 +1035,13 @@ ewl_filelist_selected_files_change_notify(Ewl_Filelist *fl)
void
ewl_filelist_vscroll_flag_set(Ewl_Filelist *fl, Ewl_Scrollpane_Flags v)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fl);
- DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fl);
+ DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
- fl->scroll_flags.v = v;
+ fl->scroll_flags.v = v;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1052,12 +1052,12 @@ ewl_filelist_vscroll_flag_set(Ewl_Filelist *fl, Ewl_Scrollpane_Flags v)
Ewl_Scrollpane_Flags
ewl_filelist_vscroll_flag_get(Ewl_Filelist *fl)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fl, EWL_SCROLLPANE_FLAG_NONE);
- DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE,
- EWL_SCROLLPANE_FLAG_NONE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fl, EWL_SCROLLPANE_FLAG_NONE);
+ DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE,
+ EWL_SCROLLPANE_FLAG_NONE);
- DRETURN_INT(fl->scroll_flags.v, DLEVEL_STABLE);
+ DRETURN_INT(fl->scroll_flags.v, DLEVEL_STABLE);
}
/**
@@ -1069,13 +1069,13 @@ ewl_filelist_vscroll_flag_get(Ewl_Filelist *fl)
void
ewl_filelist_hscroll_flag_set(Ewl_Filelist *fl, Ewl_Scrollpane_Flags h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fl);
- DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fl);
+ DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
- fl->scroll_flags.h = h;
+ fl->scroll_flags.h = h;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1086,12 +1086,12 @@ ewl_filelist_hscroll_flag_set(Ewl_Filelist *fl, Ewl_Scrollpane_Flags h)
Ewl_Scrollpane_Flags
ewl_filelist_hscroll_flag_get(Ewl_Filelist *fl)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fl, EWL_SCROLLPANE_FLAG_NONE);
- DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE,
- EWL_SCROLLPANE_FLAG_NONE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fl, EWL_SCROLLPANE_FLAG_NONE);
+ DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE,
+ EWL_SCROLLPANE_FLAG_NONE);
- DRETURN_INT(fl->scroll_flags.h, DLEVEL_STABLE);
+ DRETURN_INT(fl->scroll_flags.h, DLEVEL_STABLE);
}
/**
@@ -1102,28 +1102,28 @@ ewl_filelist_hscroll_flag_get(Ewl_Filelist *fl)
const char *
ewl_filelist_stock_icon_get(const char *path)
{
- const char *ret = NULL;
- char *ptr = NULL;
+ const char *ret = NULL;
+ char *ptr = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(path, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(path, NULL);
- if (ecore_file_is_dir(path))
- DRETURN_PTR(EWL_ICON_FOLDER, DLEVEL_STABLE);
+ if (ecore_file_is_dir(path))
+ DRETURN_PTR(EWL_ICON_FOLDER, DLEVEL_STABLE);
- ptr = strrchr(path, '.');
- if (ptr)
- {
- ret = ewl_io_manager_extension_icon_name_get(ptr);
- if (ret) DRETURN_PTR(ret, DLEVEL_STABLE);
- }
+ ptr = strrchr(path, '.');
+ if (ptr)
+ {
+ ret = ewl_io_manager_extension_icon_name_get(ptr);
+ if (ret) DRETURN_PTR(ret, DLEVEL_STABLE);
+ }
- if (ecore_file_can_exec(path))
- ret = EWL_ICON_APPLICATION_X_EXECUTABLE;
- else
- ret = EWL_ICON_TEXT_X_GENERIC;
+ if (ecore_file_can_exec(path))
+ ret = EWL_ICON_APPLICATION_X_EXECUTABLE;
+ else
+ ret = EWL_ICON_TEXT_X_GENERIC;
- DRETURN_PTR(ret, DLEVEL_STABLE);
+ DRETURN_PTR(ret, DLEVEL_STABLE);
}
/**
@@ -1136,48 +1136,48 @@ ewl_filelist_stock_icon_get(const char *path)
char *
ewl_filelist_expand_path(Ewl_Filelist *fl, const char *dir)
{
- char path[PATH_MAX];
- const char *cur_dir;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fl, NULL);
- DCHECK_PARAM_PTR_RET(dir, NULL);
- DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, NULL);
-
- cur_dir = ewl_filelist_directory_get(EWL_FILELIST(fl));
- if (!strcmp(dir, ".."))
- {
- char *t, *t2;
-
- snprintf(path, PATH_MAX, "%s", cur_dir);
- t = path;
- t2 = t;
- while ((*t != '\0'))
- {
- if ((*t == '/') && (*(t + 1) != '\0')) t2 = t;
- t++;
- }
- *t2 = '\0';
-
- /* make sure we always have at least / in there */
- if (path[0] == '\0')
- {
- path[0] = '/';
- path[1] = '\0';
- }
- }
- else
- {
- /* if the current directory is just / we dont' want to end
- * up with // on the start of the path. So, check to see if
- * the second item in cur_dir is a \0, and if so just append
- * "" instead of getting // twice */
- snprintf(path, PATH_MAX, "%s/%s",
- ((cur_dir[1] != '\0') ? cur_dir : ""),
- dir);
- }
-
- DRETURN_PTR(strdup(path), DLEVEL_STABLE);
+ char path[PATH_MAX];
+ const char *cur_dir;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fl, NULL);
+ DCHECK_PARAM_PTR_RET(dir, NULL);
+ DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, NULL);
+
+ cur_dir = ewl_filelist_directory_get(EWL_FILELIST(fl));
+ if (!strcmp(dir, ".."))
+ {
+ char *t, *t2;
+
+ snprintf(path, PATH_MAX, "%s", cur_dir);
+ t = path;
+ t2 = t;
+ while ((*t != '\0'))
+ {
+ if ((*t == '/') && (*(t + 1) != '\0')) t2 = t;
+ t++;
+ }
+ *t2 = '\0';
+
+ /* make sure we always have at least / in there */
+ if (path[0] == '\0')
+ {
+ path[0] = '/';
+ path[1] = '\0';
+ }
+ }
+ else
+ {
+ /* if the current directory is just / we dont' want to end
+ * up with // on the start of the path. So, check to see if
+ * the second item in cur_dir is a \0, and if so just append
+ * "" instead of getting // twice */
+ snprintf(path, PATH_MAX, "%s/%s",
+ ((cur_dir[1] != '\0') ? cur_dir : ""),
+ dir);
+ }
+
+ DRETURN_PTR(strdup(path), DLEVEL_STABLE);
}
/**
@@ -1190,85 +1190,85 @@ ewl_filelist_expand_path(Ewl_Filelist *fl, const char *dir)
*/
void
ewl_filelist_cb_destroy(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Filelist *fl;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_FILELIST_TYPE);
-
- fl = EWL_FILELIST(w);
- IF_FREE(fl->directory);
- IF_FREE(fl->view);
- IF_FREE(fl->model);
- fl->filter = NULL;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Filelist *fl;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_FILELIST_TYPE);
+
+ fl = EWL_FILELIST(w);
+ IF_FREE(fl->directory);
+ IF_FREE(fl->view);
+ IF_FREE(fl->model);
+ fl->filter = NULL;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_filelist_cb_clicked(Ewl_Widget *w, void *ev,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Event_Mouse_Down *md;
- char *file, *t;
- int i = 0;
- Ewl_Widget *c;
- Ewl_Filelist *fl;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(ev);
-
- md = ev;
- fl = data;
-
- if (!ewl_mvc_selected_count_get(EWL_MVC(fl->controller)))
- DRETURN(DLEVEL_STABLE);
-
- /* Single clicks only */
- if (md->clicks != 2)
- {
- ewl_filelist_selected_files_change_notify(fl);
- DRETURN(DLEVEL_STABLE);
- }
-
- /* Ensure that the click is on an icon, need to check for a
- * highlight as the first click callback will create
- */
- c = ewl_container_child_at_recursive_get(EWL_CONTAINER(fl),
- md->base.x, md->base.y);
- while (c && c->parent)
- {
- if (!ewl_widget_internal_is(c))
- {
- i = 1;
- break;
- }
- c = c->parent;
- }
-
- if (!i)
- DRETURN(DLEVEL_STABLE);
-
- /* Handle double clicks */
- file = ewl_filelist_selected_file_get(fl);
- /* If .. */
- if (!strcmp(file, fl->directory))
- {
- t = ecore_file_dir_get(fl->directory);
- ewl_filelist_directory_set(fl, t);
- FREE(t);
- }
- /* Change dir if dir, else call above */
- else if (ecore_file_is_dir(file))
- ewl_filelist_directory_set(fl, file);
-
- /* Send signal of file selected */
- else
- ewl_filelist_selected_files_change_notify(fl);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Event_Mouse_Down *md;
+ char *file, *t;
+ int i = 0;
+ Ewl_Widget *c;
+ Ewl_Filelist *fl;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(ev);
+
+ md = ev;
+ fl = data;
+
+ if (!ewl_mvc_selected_count_get(EWL_MVC(fl->controller)))
+ DRETURN(DLEVEL_STABLE);
+
+ /* Single clicks only */
+ if (md->clicks != 2)
+ {
+ ewl_filelist_selected_files_change_notify(fl);
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ /* Ensure that the click is on an icon, need to check for a
+ * highlight as the first click callback will create
+ */
+ c = ewl_container_child_at_recursive_get(EWL_CONTAINER(fl),
+ md->base.x, md->base.y);
+ while (c && c->parent)
+ {
+ if (!ewl_widget_internal_is(c))
+ {
+ i = 1;
+ break;
+ }
+ c = c->parent;
+ }
+
+ if (!i)
+ DRETURN(DLEVEL_STABLE);
+
+ /* Handle double clicks */
+ file = ewl_filelist_selected_file_get(fl);
+ /* If .. */
+ if (!strcmp(file, fl->directory))
+ {
+ t = ecore_file_dir_get(fl->directory);
+ ewl_filelist_directory_set(fl, t);
+ FREE(t);
+ }
+ /* Change dir if dir, else call above */
+ else if (ecore_file_is_dir(file))
+ ewl_filelist_directory_set(fl, file);
+
+ /* Send signal of file selected */
+ else
+ ewl_filelist_selected_files_change_notify(fl);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_filelist.h b/src/lib/ewl_filelist.h
index 9ba79b0..0acd191 100644
--- a/src/lib/ewl_filelist.h
+++ b/src/lib/ewl_filelist.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_FILELIST_H
#define EWL_FILELIST_H
@@ -40,9 +40,9 @@ typedef struct Ewl_Filelist_Filter Ewl_Filelist_Filter;
* **/
struct Ewl_Filelist_Filter
{
- char *name;
- char *extension;
- Ecore_List *mime_list;
+ char *name;
+ char *extension;
+ Ecore_List *mime_list;
};
/**
@@ -73,24 +73,24 @@ typedef struct Ewl_Filelist Ewl_Filelist;
*/
struct Ewl_Filelist
{
- Ewl_Box box; /**< Inherits from Ewl_Box */
- Ewl_Widget *controller; /**< Must inherit from mvc **/
+ Ewl_Box box; /**< Inherits from Ewl_Box */
+ Ewl_Widget *controller; /**< Must inherit from mvc **/
- Ewl_View *view; /**< The view for mvc */
- Ewl_Model *model; /**< The model for the mvc */
+ Ewl_View *view; /**< The view for mvc */
+ Ewl_Model *model; /**< The model for the mvc */
- char *directory; /**< The directory to display */
- Ewl_Filelist_Filter *filter; /**< The file filter to employ */
+ char *directory; /**< The directory to display */
+ Ewl_Filelist_Filter *filter; /**< The file filter to employ */
- unsigned char multiselect:1; /**< Allow multiple file selctions */
- unsigned char show_dot:1; /**< Show . files */
+ unsigned char multiselect:1; /**< Allow multiple file selctions */
+ unsigned char show_dot:1; /**< Show . files */
- Ewl_Filelist_View view_flag; /**< The view to use for controller */
+ Ewl_Filelist_View view_flag; /**< The view to use for controller */
- struct
- { Ewl_Scrollpane_Flags h; /**< Horizontal scroll flag */
- Ewl_Scrollpane_Flags v; /**< Vertical scroll flag */
- } scroll_flags; /**< Flags to modify a containing scrollpane */
+ struct
+ { Ewl_Scrollpane_Flags h; /**< Horizontal scroll flag */
+ Ewl_Scrollpane_Flags v; /**< Vertical scroll flag */
+ } scroll_flags; /**< Flags to modify a containing scrollpane */
};
/**
@@ -112,15 +112,15 @@ typedef struct Ewl_Filelist_File Ewl_Filelist_File;
*/
struct Ewl_Filelist_File
{
- const char *name;
- off_t size;
- mode_t mode;
- uid_t username;
- gid_t groupname;
- time_t modtime;
- unsigned char readable:1;
- unsigned char writeable:1;
- unsigned char is_dir:1;
+ const char *name;
+ off_t size;
+ mode_t mode;
+ uid_t username;
+ gid_t groupname;
+ time_t modtime;
+ unsigned char readable:1;
+ unsigned char writeable:1;
+ unsigned char is_dir:1;
};
/**
@@ -142,73 +142,73 @@ typedef struct Ewl_Filelist_Directory Ewl_Filelist_Directory;
* */
struct Ewl_Filelist_Directory
{
- const char *name;
- Ecore_List *rfiles;
- Ecore_List *rdirs;
- Ecore_List *files;
- Ecore_List *dirs;
- Ewl_Filelist_Filter *filter;
- unsigned char show_dot:1;
- unsigned int num_dirs;
- unsigned int num_files;
+ const char *name;
+ Ecore_List *rfiles;
+ Ecore_List *rdirs;
+ Ecore_List *files;
+ Ecore_List *dirs;
+ Ewl_Filelist_Filter *filter;
+ unsigned char show_dot:1;
+ unsigned int num_dirs;
+ unsigned int num_files;
};
-Ewl_Widget *ewl_filelist_new(void);
+Ewl_Widget *ewl_filelist_new(void);
-int ewl_filelist_init(Ewl_Filelist *fl);
+int ewl_filelist_init(Ewl_Filelist *fl);
-void ewl_filelist_directory_set(Ewl_Filelist *fl,
- const char *dir);
-const char *ewl_filelist_directory_get(Ewl_Filelist *fl);
+void ewl_filelist_directory_set(Ewl_Filelist *fl,
+ const char *dir);
+const char *ewl_filelist_directory_get(Ewl_Filelist *fl);
-void ewl_filelist_filter_set(Ewl_Filelist *fl,
- Ewl_Filelist_Filter *filter);
-Ewl_Filelist_Filter *ewl_filelist_filter_get(Ewl_Filelist *fl);
+void ewl_filelist_filter_set(Ewl_Filelist *fl,
+ Ewl_Filelist_Filter *filter);
+Ewl_Filelist_Filter *ewl_filelist_filter_get(Ewl_Filelist *fl);
-void ewl_filelist_view_set(Ewl_Filelist *fl,
- Ewl_Filelist_View view);
+void ewl_filelist_view_set(Ewl_Filelist *fl,
+ Ewl_Filelist_View view);
Ewl_Filelist_View *ewl_filelist_view_get(Ewl_Filelist *fl);
-void ewl_filelist_multiselect_set(Ewl_Filelist *fl,
- unsigned int ms);
-unsigned int ewl_filelist_multiselect_get(Ewl_Filelist *fl);
-
-void ewl_filelist_show_dot_files_set(Ewl_Filelist *fl,
- unsigned int dot);
-unsigned int ewl_filelist_show_dot_files_get(Ewl_Filelist *fl);
-
-void ewl_filelist_selected_file_set(Ewl_Filelist *fl,
- const char *file);
-char *ewl_filelist_selected_file_get(Ewl_Filelist *fl);
-char *ewl_filelist_size_get(off_t st_size);
-char *ewl_filelist_perms_get(mode_t st_mode);
-char *ewl_filelist_username_get(uid_t st_uid);
-char *ewl_filelist_groupname_get(gid_t st_gid);
-char *ewl_filelist_modtime_get(time_t modtime);
-Ewl_Widget *ewl_filelist_selected_file_preview_get(Ewl_Filelist *fl,
- const char *path);
-Ewl_Widget *ewl_filelist_multi_select_preview_get(Ewl_Filelist *fl);
-
-void ewl_filelist_selected_files_set(Ewl_Filelist *fl,
- Ecore_List *files);
-Ecore_List *ewl_filelist_selected_files_get(Ewl_Filelist *fl);
-void ewl_filelist_selected_files_change_notify(Ewl_Filelist *fl);
-
-void ewl_filelist_selected_signal_all(Ewl_Filelist *fl,
- const char *signal);
-
-void ewl_filelist_vscroll_flag_set(Ewl_Filelist *fl,
- Ewl_Scrollpane_Flags v);
+void ewl_filelist_multiselect_set(Ewl_Filelist *fl,
+ unsigned int ms);
+unsigned int ewl_filelist_multiselect_get(Ewl_Filelist *fl);
+
+void ewl_filelist_show_dot_files_set(Ewl_Filelist *fl,
+ unsigned int dot);
+unsigned int ewl_filelist_show_dot_files_get(Ewl_Filelist *fl);
+
+void ewl_filelist_selected_file_set(Ewl_Filelist *fl,
+ const char *file);
+char *ewl_filelist_selected_file_get(Ewl_Filelist *fl);
+char *ewl_filelist_size_get(off_t st_size);
+char *ewl_filelist_perms_get(mode_t st_mode);
+char *ewl_filelist_username_get(uid_t st_uid);
+char *ewl_filelist_groupname_get(gid_t st_gid);
+char *ewl_filelist_modtime_get(time_t modtime);
+Ewl_Widget *ewl_filelist_selected_file_preview_get(Ewl_Filelist *fl,
+ const char *path);
+Ewl_Widget *ewl_filelist_multi_select_preview_get(Ewl_Filelist *fl);
+
+void ewl_filelist_selected_files_set(Ewl_Filelist *fl,
+ Ecore_List *files);
+Ecore_List *ewl_filelist_selected_files_get(Ewl_Filelist *fl);
+void ewl_filelist_selected_files_change_notify(Ewl_Filelist *fl);
+
+void ewl_filelist_selected_signal_all(Ewl_Filelist *fl,
+ const char *signal);
+
+void ewl_filelist_vscroll_flag_set(Ewl_Filelist *fl,
+ Ewl_Scrollpane_Flags v);
Ewl_Scrollpane_Flags ewl_filelist_vscroll_flag_get(Ewl_Filelist *fl);
-void ewl_filelist_hscroll_flag_set(Ewl_Filelist *fl,
- Ewl_Scrollpane_Flags h);
+void ewl_filelist_hscroll_flag_set(Ewl_Filelist *fl,
+ Ewl_Scrollpane_Flags h);
Ewl_Scrollpane_Flags ewl_filelist_hscroll_flag_get(Ewl_Filelist *fl);
-const char *ewl_filelist_stock_icon_get(const char *path);
+const char *ewl_filelist_stock_icon_get(const char *path);
-char *ewl_filelist_expand_path(Ewl_Filelist *fl, const char *dir);
+char *ewl_filelist_expand_path(Ewl_Filelist *fl, const char *dir);
/*
* Internally used functions, override at your own risk
diff --git a/src/lib/ewl_filelist_model.c b/src/lib/ewl_filelist_model.c
index 6ba41d1..13bf9d9 100644
--- a/src/lib/ewl_filelist_model.c
+++ b/src/lib/ewl_filelist_model.c
@@ -10,14 +10,14 @@
#include <fnmatch.h>
static int ewl_filelist_model_data_name_sort(Ewl_Filelist_File *file1,
- Ewl_Filelist_File *file2);
+ Ewl_Filelist_File *file2);
static int ewl_filelist_model_data_size_sort(Ewl_Filelist_File *file1,
- Ewl_Filelist_File *file2);
+ Ewl_Filelist_File *file2);
static void free_file(Ewl_Filelist_File *file);
void ewl_filelist_model_filter(Ewl_Filelist_Directory *dir);
static unsigned int ewl_filelist_model_filter_main
- (Ewl_Filelist_Directory *dir,
- Ewl_Filelist_File *file);
+ (Ewl_Filelist_Directory *dir,
+ Ewl_Filelist_File *file);
/**
* @param path: The path to the directory to read
@@ -29,96 +29,96 @@ static unsigned int ewl_filelist_model_filter_main
*/
Ewl_Filelist_Directory *
ewl_filelist_model_directory_new(const char *path,
- unsigned char show_dot,
- unsigned int show_dot_dot,
- Ewl_Filelist_Filter *filter)
+ unsigned char show_dot,
+ unsigned int show_dot_dot,
+ Ewl_Filelist_Filter *filter)
{
- Ewl_Filelist_Directory *dir;
- Ewl_Filelist_File *file;
-
- struct stat st;
- char filename[PATH_MAX], *file_temp;
- int nf = 0, nd = 0;
- Ecore_List *files, *dirs, *all_files;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(path, NULL);
-
- files = ecore_list_new();
- dirs = ecore_list_new();
- ecore_list_free_cb_set(files, ECORE_FREE_CB(free_file));
- ecore_list_free_cb_set(dirs, ECORE_FREE_CB(free_file));
-
- all_files = ecore_file_ls(path);
- if (!all_files)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
-
- /* Add in the ".." entry for now */
- if ((show_dot_dot) && (strcmp(path, "/")))
- ecore_list_prepend(all_files, strdup(path));
-
- while ((file_temp = ecore_list_first_remove(all_files)))
- {
- /* allocate the memory for the file structure */
- file = NEW(Ewl_Filelist_File, 1);
-
- /* test for .. */
- if (strcmp(file_temp, path))
- {
- snprintf(filename, PATH_MAX, "%s/%s", path,
- file_temp);
- file->name = ecore_string_instance(file_temp);
- }
- else
- {
- snprintf(filename, PATH_MAX, "%s", file_temp);
- file->name = ecore_string_instance("..");
- }
-
- /* info about the filename */
- stat(filename, &st);
- file->size = st.st_size;
- file->modtime = st.st_mtime;
- file->mode = st.st_mode;
- file->groupname = st.st_gid;
- file->username = st.st_uid;
- file->is_dir = ecore_file_is_dir(filename);
- file->readable = ecore_file_can_read(filename);
- file->writeable = ecore_file_can_write(filename);
-
- if ((file->is_dir))
- {
- ecore_list_append(dirs, file);
- nd = nd + 1;
- }
-
- else
- {
- ecore_list_append(files, file);
- nf = nf + 1;
- }
-
- FREE(file_temp);
- }
-
- /* create the new directory structure */
- dir = NEW(Ewl_Filelist_Directory, 1);
-
- dir->rfiles = files;
- dir->rdirs = dirs;
- dir->files = ecore_list_new();
- dir->dirs = ecore_list_new();
- dir->name = ecore_string_instance(path);
- dir->show_dot = !!show_dot;
- dir->filter = filter;
- dir->num_dirs = nd;
- dir->num_files = nf;
-
- /* Filter the directory */
- ewl_filelist_model_filter(dir);
-
- IF_FREE_LIST(all_files);
- DRETURN_PTR(dir, DLEVEL_STABLE);
+ Ewl_Filelist_Directory *dir;
+ Ewl_Filelist_File *file;
+
+ struct stat st;
+ char filename[PATH_MAX], *file_temp;
+ int nf = 0, nd = 0;
+ Ecore_List *files, *dirs, *all_files;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(path, NULL);
+
+ files = ecore_list_new();
+ dirs = ecore_list_new();
+ ecore_list_free_cb_set(files, ECORE_FREE_CB(free_file));
+ ecore_list_free_cb_set(dirs, ECORE_FREE_CB(free_file));
+
+ all_files = ecore_file_ls(path);
+ if (!all_files)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+
+ /* Add in the ".." entry for now */
+ if ((show_dot_dot) && (strcmp(path, "/")))
+ ecore_list_prepend(all_files, strdup(path));
+
+ while ((file_temp = ecore_list_first_remove(all_files)))
+ {
+ /* allocate the memory for the file structure */
+ file = NEW(Ewl_Filelist_File, 1);
+
+ /* test for .. */
+ if (strcmp(file_temp, path))
+ {
+ snprintf(filename, PATH_MAX, "%s/%s", path,
+ file_temp);
+ file->name = ecore_string_instance(file_temp);
+ }
+ else
+ {
+ snprintf(filename, PATH_MAX, "%s", file_temp);
+ file->name = ecore_string_instance("..");
+ }
+
+ /* info about the filename */
+ stat(filename, &st);
+ file->size = st.st_size;
+ file->modtime = st.st_mtime;
+ file->mode = st.st_mode;
+ file->groupname = st.st_gid;
+ file->username = st.st_uid;
+ file->is_dir = ecore_file_is_dir(filename);
+ file->readable = ecore_file_can_read(filename);
+ file->writeable = ecore_file_can_write(filename);
+
+ if ((file->is_dir))
+ {
+ ecore_list_append(dirs, file);
+ nd = nd + 1;
+ }
+
+ else
+ {
+ ecore_list_append(files, file);
+ nf = nf + 1;
+ }
+
+ FREE(file_temp);
+ }
+
+ /* create the new directory structure */
+ dir = NEW(Ewl_Filelist_Directory, 1);
+
+ dir->rfiles = files;
+ dir->rdirs = dirs;
+ dir->files = ecore_list_new();
+ dir->dirs = ecore_list_new();
+ dir->name = ecore_string_instance(path);
+ dir->show_dot = !!show_dot;
+ dir->filter = filter;
+ dir->num_dirs = nd;
+ dir->num_files = nf;
+
+ /* Filter the directory */
+ ewl_filelist_model_filter(dir);
+
+ IF_FREE_LIST(all_files);
+ DRETURN_PTR(dir, DLEVEL_STABLE);
}
@@ -127,10 +127,10 @@ ewl_filelist_model_directory_new(const char *path,
*/
int
ewl_filelist_model_column_sortable(void *data __UNUSED__,
- unsigned int column)
+ unsigned int column)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DRETURN_INT(((column == 0) || (column == 1)), DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DRETURN_INT(((column == 0) || (column == 1)), DLEVEL_STABLE);
}
/**
@@ -139,12 +139,12 @@ ewl_filelist_model_column_sortable(void *data __UNUSED__,
unsigned int
ewl_filelist_model_data_count(void *data)
{
- Ewl_Filelist_Directory *fld = data;
+ Ewl_Filelist_Directory *fld = data;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, 0);
- DRETURN_INT((fld->num_dirs + fld->num_files), DLEVEL_STABLE);
+ DRETURN_INT((fld->num_dirs + fld->num_files), DLEVEL_STABLE);
}
/**
@@ -152,45 +152,45 @@ ewl_filelist_model_data_count(void *data)
*/
void *
ewl_filelist_model_data_fetch(void *data, unsigned int row,
- unsigned int column)
+ unsigned int column)
{
- Ewl_Filelist_Directory *fld;
- Ewl_Filelist_File *file;
- int i;
- void *ret;
- char path[PATH_MAX];
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, NULL);
-
- fld = data;
-
- /* Check if in dirs or files list */
- if (row < fld->num_dirs)
- file = ecore_list_index_goto(fld->dirs, row);
- else
- {
- i = (row - fld->num_dirs);
- file = ecore_list_index_goto(fld->files, i);
- }
-
- if ((column == 0) && (strcmp(file->name, "..")))
- {
- snprintf(path, PATH_MAX, "%s/%s", fld->name, file->name);
- ret = strdup(path);
- }
- else if (column == 1) ret = ewl_filelist_size_get(file->size);
- else if (column == 2) ret = ewl_filelist_perms_get(file->mode);
- else if (column == 3) ret = ewl_filelist_username_get
- (file->username);
- else if (column == 4) ret = ewl_filelist_groupname_get
- (file->groupname);
- else if (column == 5) ret = ewl_filelist_modtime_get
- (file->modtime);
- else ret = strdup(file->name);
-
- /* ret needs to be freed by the view or with model_data_free_set */
- DRETURN_PTR(ret, DLEVEL_STABLE);
+ Ewl_Filelist_Directory *fld;
+ Ewl_Filelist_File *file;
+ int i;
+ void *ret;
+ char path[PATH_MAX];
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, NULL);
+
+ fld = data;
+
+ /* Check if in dirs or files list */
+ if (row < fld->num_dirs)
+ file = ecore_list_index_goto(fld->dirs, row);
+ else
+ {
+ i = (row - fld->num_dirs);
+ file = ecore_list_index_goto(fld->files, i);
+ }
+
+ if ((column == 0) && (strcmp(file->name, "..")))
+ {
+ snprintf(path, PATH_MAX, "%s/%s", fld->name, file->name);
+ ret = strdup(path);
+ }
+ else if (column == 1) ret = ewl_filelist_size_get(file->size);
+ else if (column == 2) ret = ewl_filelist_perms_get(file->mode);
+ else if (column == 3) ret = ewl_filelist_username_get
+ (file->username);
+ else if (column == 4) ret = ewl_filelist_groupname_get
+ (file->groupname);
+ else if (column == 5) ret = ewl_filelist_modtime_get
+ (file->modtime);
+ else ret = strdup(file->name);
+
+ /* ret needs to be freed by the view or with model_data_free_set */
+ DRETURN_PTR(ret, DLEVEL_STABLE);
}
/**
@@ -198,81 +198,81 @@ ewl_filelist_model_data_fetch(void *data, unsigned int row,
*/
void
ewl_filelist_model_data_sort(void *data, unsigned int column,
- Ewl_Sort_Direction sort)
+ Ewl_Sort_Direction sort)
{
-
- Ewl_Filelist_Directory *fld = data;
- Ewl_Filelist_File *file, *root = NULL;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_PARAM_PTR(sort);
-
- if (sort == EWL_SORT_DIRECTION_NONE)
- DRETURN(DLEVEL_STABLE);
-
- /* Remove .. entry to add in later */
- if (fld->num_dirs != 0)
- {
- file = ecore_list_first(fld->dirs);
- if (!strcmp(file->name, ".."))
- root = ecore_list_first_remove(fld->dirs);
- }
-
- if (column == 0)
- {
- if (sort == EWL_SORT_DIRECTION_ASCENDING)
- {
- ecore_list_sort(fld->dirs,
- ECORE_COMPARE_CB
- (ewl_filelist_model_data_name_sort),
- ECORE_SORT_MIN);
-
- ecore_list_sort(fld->files,
- ECORE_COMPARE_CB
- (ewl_filelist_model_data_name_sort),
- ECORE_SORT_MIN);
- }
-
- else if (sort == EWL_SORT_DIRECTION_DESCENDING)
- {
- ecore_list_sort(fld->dirs,
- ECORE_COMPARE_CB
- (ewl_filelist_model_data_name_sort),
- ECORE_SORT_MAX);
-
- ecore_list_sort(fld->files,
- ECORE_COMPARE_CB
- (ewl_filelist_model_data_name_sort),
- ECORE_SORT_MAX);
- }
- }
-
- /* size sort does nothing for directories so don't sort dirs */
- else if (column == 1)
- {
- if (sort == EWL_SORT_DIRECTION_ASCENDING)
- {
- ecore_list_sort(fld->files,
- ECORE_COMPARE_CB
- (ewl_filelist_model_data_size_sort),
- ECORE_SORT_MIN);
- }
-
- else if (sort == EWL_SORT_DIRECTION_DESCENDING)
- {
- ecore_list_sort(fld->files,
- ECORE_COMPARE_CB
- (ewl_filelist_model_data_size_sort),
- ECORE_SORT_MAX);
- }
- }
-
- /* Put .. entry back in */
- if (root)
- ecore_list_prepend(fld->dirs, root);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+
+ Ewl_Filelist_Directory *fld = data;
+ Ewl_Filelist_File *file, *root = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_PARAM_PTR(sort);
+
+ if (sort == EWL_SORT_DIRECTION_NONE)
+ DRETURN(DLEVEL_STABLE);
+
+ /* Remove .. entry to add in later */
+ if (fld->num_dirs != 0)
+ {
+ file = ecore_list_first(fld->dirs);
+ if (!strcmp(file->name, ".."))
+ root = ecore_list_first_remove(fld->dirs);
+ }
+
+ if (column == 0)
+ {
+ if (sort == EWL_SORT_DIRECTION_ASCENDING)
+ {
+ ecore_list_sort(fld->dirs,
+ ECORE_COMPARE_CB
+ (ewl_filelist_model_data_name_sort),
+ ECORE_SORT_MIN);
+
+ ecore_list_sort(fld->files,
+ ECORE_COMPARE_CB
+ (ewl_filelist_model_data_name_sort),
+ ECORE_SORT_MIN);
+ }
+
+ else if (sort == EWL_SORT_DIRECTION_DESCENDING)
+ {
+ ecore_list_sort(fld->dirs,
+ ECORE_COMPARE_CB
+ (ewl_filelist_model_data_name_sort),
+ ECORE_SORT_MAX);
+
+ ecore_list_sort(fld->files,
+ ECORE_COMPARE_CB
+ (ewl_filelist_model_data_name_sort),
+ ECORE_SORT_MAX);
+ }
+ }
+
+ /* size sort does nothing for directories so don't sort dirs */
+ else if (column == 1)
+ {
+ if (sort == EWL_SORT_DIRECTION_ASCENDING)
+ {
+ ecore_list_sort(fld->files,
+ ECORE_COMPARE_CB
+ (ewl_filelist_model_data_size_sort),
+ ECORE_SORT_MIN);
+ }
+
+ else if (sort == EWL_SORT_DIRECTION_DESCENDING)
+ {
+ ecore_list_sort(fld->files,
+ ECORE_COMPARE_CB
+ (ewl_filelist_model_data_size_sort),
+ ECORE_SORT_MAX);
+ }
+ }
+
+ /* Put .. entry back in */
+ if (root)
+ ecore_list_prepend(fld->dirs, root);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -280,12 +280,12 @@ ewl_filelist_model_data_sort(void *data, unsigned int column,
*/
static int
ewl_filelist_model_data_name_sort(Ewl_Filelist_File *file1,
- Ewl_Filelist_File *file2)
+ Ewl_Filelist_File *file2)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(file1, 0);
- DCHECK_PARAM_PTR_RET(file2, 0);
- DRETURN_INT((strcoll(file1->name, file2->name)), DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(file1, 0);
+ DCHECK_PARAM_PTR_RET(file2, 0);
+ DRETURN_INT((strcoll(file1->name, file2->name)), DLEVEL_STABLE);
}
/**
@@ -293,21 +293,21 @@ ewl_filelist_model_data_name_sort(Ewl_Filelist_File *file1,
*/
static int
ewl_filelist_model_data_size_sort(Ewl_Filelist_File *file1,
- Ewl_Filelist_File *file2)
+ Ewl_Filelist_File *file2)
{
- int ret;
+ int ret;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(file1, 0);
- DCHECK_PARAM_PTR_RET(file2, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(file1, 0);
+ DCHECK_PARAM_PTR_RET(file2, 0);
- if (file1->size > file2->size)
- ret = 1;
- else if (file1->size < file2->size)
- ret = -1;
- else ret = 0;
+ if (file1->size > file2->size)
+ ret = 1;
+ else if (file1->size < file2->size)
+ ret = -1;
+ else ret = 0;
- DRETURN_INT(ret, DLEVEL_STABLE);
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
/**
@@ -316,20 +316,20 @@ ewl_filelist_model_data_size_sort(Ewl_Filelist_File *file1,
int
ewl_filelist_model_data_expandable_get(void *data, unsigned int row)
{
- Ewl_Filelist_File *file;
- Ewl_Filelist_Directory *fld = data;
+ Ewl_Filelist_File *file;
+ Ewl_Filelist_Directory *fld = data;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, 0);
- if (row >= fld->num_dirs)
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (row >= fld->num_dirs)
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- file = ecore_list_index_goto(fld->dirs, row);
- if (!strcmp(file->name, ".."))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ file = ecore_list_index_goto(fld->dirs, row);
+ if (!strcmp(file->name, ".."))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -337,22 +337,22 @@ ewl_filelist_model_data_expandable_get(void *data, unsigned int row)
*/
void *
ewl_filelist_model_data_expansion_data_fetch(void *data,
- unsigned int parent)
+ unsigned int parent)
{
- char path[PATH_MAX];
- Ewl_Filelist_File *file;
- Ewl_Filelist_Directory *fld = data, *subdir;
+ char path[PATH_MAX];
+ Ewl_Filelist_File *file;
+ Ewl_Filelist_Directory *fld = data, *subdir;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, NULL);
- file = ecore_list_index_goto(fld->dirs, parent);
- snprintf(path, PATH_MAX, "%s/%s", fld->name, file->name);
- subdir = ewl_filelist_model_directory_new
- (path, fld->show_dot,
- FALSE, fld->filter);
+ file = ecore_list_index_goto(fld->dirs, parent);
+ snprintf(path, PATH_MAX, "%s/%s", fld->name, file->name);
+ subdir = ewl_filelist_model_directory_new
+ (path, fld->show_dot,
+ FALSE, fld->filter);
- DRETURN_PTR(subdir, DLEVEL_STABLE);
+ DRETURN_PTR(subdir, DLEVEL_STABLE);
}
/**
@@ -361,20 +361,20 @@ ewl_filelist_model_data_expansion_data_fetch(void *data,
unsigned int
ewl_filelist_model_data_unref(void *data)
{
- Ewl_Filelist_Directory *dir;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, FALSE);
-
- dir = data;
- ecore_string_release(dir->name);
- ecore_list_destroy(dir->files);
- ecore_list_destroy(dir->dirs);
- ecore_list_destroy(dir->rfiles);
- ecore_list_destroy(dir->rdirs);
- FREE(dir);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Filelist_Directory *dir;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, FALSE);
+
+ dir = data;
+ ecore_string_release(dir->name);
+ ecore_list_destroy(dir->files);
+ ecore_list_destroy(dir->dirs);
+ ecore_list_destroy(dir->rfiles);
+ ecore_list_destroy(dir->rdirs);
+ FREE(dir);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -382,13 +382,13 @@ ewl_filelist_model_data_unref(void *data)
*/
static void free_file(Ewl_Filelist_File *file)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(file);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(file);
- ecore_string_release(file->name);
- FREE(file);
+ ecore_string_release(file->name);
+ FREE(file);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -399,22 +399,22 @@ static void free_file(Ewl_Filelist_File *file)
*/
unsigned int
ewl_filelist_model_show_dot_files_set(Ewl_Filelist_Directory *dir,
- unsigned int show_dot)
+ unsigned int show_dot)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(dir, FALSE);
-
- /* If nothing has changed, leave */
- if (show_dot == !!dir->show_dot)
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(dir, FALSE);
+
+ /* If nothing has changed, leave */
+ if (show_dot == !!dir->show_dot)
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- /* Else set value in */
- dir->show_dot = !!show_dot;
+ /* Else set value in */
+ dir->show_dot = !!show_dot;
- /* Refilter the files */
- ewl_filelist_model_filter(dir);
+ /* Refilter the files */
+ ewl_filelist_model_filter(dir);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -425,9 +425,9 @@ ewl_filelist_model_show_dot_files_set(Ewl_Filelist_Directory *dir,
unsigned int
ewl_filelist_model_show_dot_files_get(Ewl_Filelist_Directory *dir)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(dir, FALSE);
- DRETURN_INT((unsigned int)dir->show_dot, DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(dir, FALSE);
+ DRETURN_INT((unsigned int)dir->show_dot, DLEVEL_STABLE);
}
/**
@@ -438,64 +438,64 @@ ewl_filelist_model_show_dot_files_get(Ewl_Filelist_Directory *dir)
void
ewl_filelist_model_filter(Ewl_Filelist_Directory *dir)
{
- Ewl_Filelist_File *file;
- int ret = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(dir);
-
- /* Set up temporary filelist */
- ecore_list_clear(dir->files);
- ecore_list_clear(dir->dirs);
-
-
- /* Hidden files first */
- if (!dir->show_dot)
- {
-
- /* Run through files and filter hidden first, then others */
- ecore_list_first_goto(dir->rfiles);
- while ((file = ecore_list_next(dir->rfiles)))
- {
- ret = ewl_filelist_model_filter_main(dir, file);
- if ((file->name[0] != '.') && (ret))
- ecore_list_append(dir->files, file);
-
- }
-
- /* Now directories */
- ecore_list_first_goto(dir->rdirs);
- while ((file = ecore_list_next(dir->rdirs)))
- {
- if ((file->name[0] != '.') ||
- (!strcmp(file->name, "..")))
- ecore_list_append(dir->dirs, file);
- }
- }
-
- /* If showing hidden */
- else
- {
- /* Still loop through to check if pass filter */
- ecore_list_first_goto(dir->rfiles);
- while ((file = ecore_list_next(dir->rfiles)))
- {
- ret = ewl_filelist_model_filter_main(dir, file);
- if (ret)
- ecore_list_append(dir->files, file);
- }
-
- ecore_list_first_goto(dir->rdirs);
- while ((file = ecore_list_next(dir->rdirs)))
- ecore_list_append(dir->dirs, file);
- }
-
-
- /* Set numbers into directory data */
- dir->num_dirs = ecore_list_count(dir->dirs);
- dir->num_files = ecore_list_count(dir->files);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Filelist_File *file;
+ int ret = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(dir);
+
+ /* Set up temporary filelist */
+ ecore_list_clear(dir->files);
+ ecore_list_clear(dir->dirs);
+
+
+ /* Hidden files first */
+ if (!dir->show_dot)
+ {
+
+ /* Run through files and filter hidden first, then others */
+ ecore_list_first_goto(dir->rfiles);
+ while ((file = ecore_list_next(dir->rfiles)))
+ {
+ ret = ewl_filelist_model_filter_main(dir, file);
+ if ((file->name[0] != '.') && (ret))
+ ecore_list_append(dir->files, file);
+
+ }
+
+ /* Now directories */
+ ecore_list_first_goto(dir->rdirs);
+ while ((file = ecore_list_next(dir->rdirs)))
+ {
+ if ((file->name[0] != '.') ||
+ (!strcmp(file->name, "..")))
+ ecore_list_append(dir->dirs, file);
+ }
+ }
+
+ /* If showing hidden */
+ else
+ {
+ /* Still loop through to check if pass filter */
+ ecore_list_first_goto(dir->rfiles);
+ while ((file = ecore_list_next(dir->rfiles)))
+ {
+ ret = ewl_filelist_model_filter_main(dir, file);
+ if (ret)
+ ecore_list_append(dir->files, file);
+ }
+
+ ecore_list_first_goto(dir->rdirs);
+ while ((file = ecore_list_next(dir->rdirs)))
+ ecore_list_append(dir->dirs, file);
+ }
+
+
+ /* Set numbers into directory data */
+ dir->num_dirs = ecore_list_count(dir->dirs);
+ dir->num_files = ecore_list_count(dir->files);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -506,22 +506,22 @@ ewl_filelist_model_filter(Ewl_Filelist_Directory *dir)
*/
unsigned int
ewl_filelist_model_filter_set(Ewl_Filelist_Directory *dir,
- Ewl_Filelist_Filter *filter)
+ Ewl_Filelist_Filter *filter)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(dir, FALSE);
- DCHECK_PARAM_PTR_RET(filter, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(dir, FALSE);
+ DCHECK_PARAM_PTR_RET(filter, FALSE);
- /* If nothing has changed, leave */
- if ((dir->filter) && (!memcmp(dir->filter, filter,
- sizeof(dir->filter))))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ /* If nothing has changed, leave */
+ if ((dir->filter) && (!memcmp(dir->filter, filter,
+ sizeof(dir->filter))))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- /* Set the filter and call the function */
- dir->filter = filter;
- ewl_filelist_model_filter(dir);
+ /* Set the filter and call the function */
+ dir->filter = filter;
+ ewl_filelist_model_filter(dir);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -532,9 +532,9 @@ ewl_filelist_model_filter_set(Ewl_Filelist_Directory *dir,
Ewl_Filelist_Filter *
ewl_filelist_model_filter_get(Ewl_Filelist_Directory *dir)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(dir, NULL);
- DRETURN_PTR(dir->filter, DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(dir, NULL);
+ DRETURN_PTR(dir->filter, DLEVEL_STABLE);
}
/**
@@ -546,46 +546,46 @@ ewl_filelist_model_filter_get(Ewl_Filelist_Directory *dir)
*/
static unsigned int
ewl_filelist_model_filter_main(Ewl_Filelist_Directory *dir,
- Ewl_Filelist_File *file)
+ Ewl_Filelist_File *file)
{
- Ewl_Filelist_Filter *filter = dir->filter;
- const char *mime_check;
- char *mime_given;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(dir, FALSE);
- DCHECK_PARAM_PTR_RET(file, FALSE);
-
- /* If there's no filter return all files */
- if (!filter)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
-
- /* First check mime types */
- if (filter->mime_list)
- {
- mime_check = ewl_io_manager_uri_mime_type_get(file->name);
- ecore_list_first_goto(filter->mime_list);
- while ((mime_given = ecore_list_next(filter->mime_list)))
- {
- if ((mime_check) && (!strcmp(mime_given,
- mime_check)))
- DRETURN_INT(TRUE, DLEVEL_STABLE);
- }
- }
-
- /* Next check extension */
- else if (filter->extension)
- {
- if (!fnmatch(filter->extension, file->name, 0))
- DRETURN_INT(TRUE, DLEVEL_STABLE);
- }
-
- /* If no filter at all is in effect */
- else if ((!filter->extension) && (!filter->mime_list))
- {
- DRETURN_INT(TRUE, DLEVEL_STABLE);
- }
-
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ Ewl_Filelist_Filter *filter = dir->filter;
+ const char *mime_check;
+ char *mime_given;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(dir, FALSE);
+ DCHECK_PARAM_PTR_RET(file, FALSE);
+
+ /* If there's no filter return all files */
+ if (!filter)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+
+ /* First check mime types */
+ if (filter->mime_list)
+ {
+ mime_check = ewl_io_manager_uri_mime_type_get(file->name);
+ ecore_list_first_goto(filter->mime_list);
+ while ((mime_given = ecore_list_next(filter->mime_list)))
+ {
+ if ((mime_check) && (!strcmp(mime_given,
+ mime_check)))
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+ }
+ }
+
+ /* Next check extension */
+ else if (filter->extension)
+ {
+ if (!fnmatch(filter->extension, file->name, 0))
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+ }
+
+ /* If no filter at all is in effect */
+ else if ((!filter->extension) && (!filter->mime_list))
+ {
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+ }
+
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_filelist_model.h b/src/lib/ewl_filelist_model.h
index 764056c..9131c00 100644
--- a/src/lib/ewl_filelist_model.h
+++ b/src/lib/ewl_filelist_model.h
@@ -9,31 +9,31 @@
* @{
*/
-Ewl_Filelist_Directory *ewl_filelist_model_directory_new(const char *path,
- unsigned char show_dot,
- unsigned int show_dot_dot,
- Ewl_Filelist_Filter *filter);
+Ewl_Filelist_Directory *ewl_filelist_model_directory_new(const char *path,
+ unsigned char show_dot,
+ unsigned int show_dot_dot,
+ Ewl_Filelist_Filter *filter);
unsigned int ewl_filelist_model_data_count(void *data);
void *ewl_filelist_model_data_fetch(void *data, unsigned int row,
- unsigned int column);
+ unsigned int column);
void ewl_filelist_model_data_sort(void *data, unsigned int column,
- Ewl_Sort_Direction sort);
+ Ewl_Sort_Direction sort);
int ewl_filelist_model_data_expandable_get(void *data,
- unsigned int row);
+ unsigned int row);
void *ewl_filelist_model_data_expansion_data_fetch(void *data,
- unsigned int parent);
+ unsigned int parent);
unsigned int ewl_filelist_model_data_unref(void *data);
int ewl_filelist_model_column_sortable(void *data,
- unsigned int column);
+ unsigned int column);
unsigned int ewl_filelist_model_show_dot_files_set(Ewl_Filelist_Directory *dir,
- unsigned int show_dot);
+ unsigned int show_dot);
unsigned int ewl_filelist_model_show_dot_files_get(Ewl_Filelist_Directory *dir);
unsigned int ewl_filelist_model_filter_set(Ewl_Filelist_Directory *dir,
- Ewl_Filelist_Filter *filter);
+ Ewl_Filelist_Filter *filter);
Ewl_Filelist_Filter *ewl_filelist_model_filter_get
- (Ewl_Filelist_Directory *dir);
+ (Ewl_Filelist_Directory *dir);
/**
* @}
diff --git a/src/lib/ewl_filelist_view.c b/src/lib/ewl_filelist_view.c
index f336241..70220f6 100644
--- a/src/lib/ewl_filelist_view.c
+++ b/src/lib/ewl_filelist_view.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_filelist_view.h"
#include "ewl_filelist.h"
@@ -10,70 +10,70 @@
#include "ewl_debug.h"
Ewl_Widget *ewl_filelist_view_widget_fetch(void *data,
- unsigned int row __UNUSED__, unsigned int column)
+ unsigned int row __UNUSED__, unsigned int column)
{
- Ewl_Widget *ret;
- const char *img = NULL, *stock, *filename;
+ Ewl_Widget *ret;
+ const char *img = NULL, *stock, *filename;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, NULL);
- /* Create icon */
- ret = ewl_icon_simple_new();
- ewl_icon_constrain_set(EWL_ICON(ret), EWL_ICON_SIZE_MEDIUM);
- ewl_box_orientation_set(EWL_BOX(ret),
- EWL_ORIENTATION_HORIZONTAL);
- ewl_object_alignment_set(EWL_OBJECT(ret), EWL_FLAG_ALIGN_LEFT);
+ /* Create icon */
+ ret = ewl_icon_simple_new();
+ ewl_icon_constrain_set(EWL_ICON(ret), EWL_ICON_SIZE_MEDIUM);
+ ewl_box_orientation_set(EWL_BOX(ret),
+ EWL_ORIENTATION_HORIZONTAL);
+ ewl_object_alignment_set(EWL_OBJECT(ret), EWL_FLAG_ALIGN_LEFT);
- /* Get and set data into icon */
- if (column == 0)
- {
- if (!strcmp(data, ".."))
- img = ewl_icon_theme_icon_path_get
- (EWL_ICON_GO_UP,
- EWL_ICON_SIZE_MEDIUM);
- else
- {
- stock = ewl_filelist_stock_icon_get(data);
- img = ewl_icon_theme_icon_path_get(stock,
- EWL_ICON_SIZE_MEDIUM);
- }
- if (img) ewl_icon_image_set(EWL_ICON(ret),
- img, NULL);
+ /* Get and set data into icon */
+ if (column == 0)
+ {
+ if (!strcmp(data, ".."))
+ img = ewl_icon_theme_icon_path_get
+ (EWL_ICON_GO_UP,
+ EWL_ICON_SIZE_MEDIUM);
+ else
+ {
+ stock = ewl_filelist_stock_icon_get(data);
+ img = ewl_icon_theme_icon_path_get(stock,
+ EWL_ICON_SIZE_MEDIUM);
+ }
+ if (img) ewl_icon_image_set(EWL_ICON(ret),
+ img, NULL);
- filename = ecore_file_file_get(data);
- ewl_icon_label_set(EWL_ICON(ret), filename);
- }
- else
- {
- ewl_icon_label_set(EWL_ICON(ret), data);
- }
-
- FREE(data);
- ewl_widget_show(ret);
+ filename = ecore_file_file_get(data);
+ ewl_icon_label_set(EWL_ICON(ret), filename);
+ }
+ else
+ {
+ ewl_icon_label_set(EWL_ICON(ret), data);
+ }
+
+ FREE(data);
+ ewl_widget_show(ret);
- DRETURN_PTR(ret, DLEVEL_STABLE);
+ DRETURN_PTR(ret, DLEVEL_STABLE);
}
Ewl_Widget *ewl_filelist_view_header_fetch(void *data __UNUSED__,
- unsigned int column)
+ unsigned int column)
{
- Ewl_Widget *l;
- char *t;
+ Ewl_Widget *l;
+ char *t;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- if (column == 0) t = "Filename";
- else if (column == 1) t = "Size";
- else if (column == 2) t = "Permissions";
- else if (column == 3) t = "Username";
- else if (column == 4) t = "Groupname";
- else if (column == 5) t = "Modified";
- else t = "N/A";
+ if (column == 0) t = "Filename";
+ else if (column == 1) t = "Size";
+ else if (column == 2) t = "Permissions";
+ else if (column == 3) t = "Username";
+ else if (column == 4) t = "Groupname";
+ else if (column == 5) t = "Modified";
+ else t = "N/A";
- l = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(l), t);
- ewl_widget_show(l);
+ l = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(l), t);
+ ewl_widget_show(l);
- DRETURN_PTR(l, DLEVEL_STABLE);
+ DRETURN_PTR(l, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_filelist_view.h b/src/lib/ewl_filelist_view.h
index 4357cbe..2ff2b67 100644
--- a/src/lib/ewl_filelist_view.h
+++ b/src/lib/ewl_filelist_view.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_FILELIST_VIEW_H
#define EWL_FILELIST_VIEW_H
@@ -9,7 +9,7 @@
*/
Ewl_Widget *ewl_filelist_view_widget_fetch(void *data, unsigned int row,
- unsigned int column);
+ unsigned int column);
Ewl_Widget *ewl_filelist_view_header_fetch(void *data, unsigned int column);
/**
diff --git a/src/lib/ewl_filepicker.c b/src/lib/ewl_filepicker.c
index 79f91f7..f70a2b2 100644
--- a/src/lib/ewl_filepicker.c
+++ b/src/lib/ewl_filepicker.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_filepicker.h"
#include "ewl_filelist.h"
@@ -24,45 +24,45 @@ typedef struct Ewl_Filepicker_Dialog Ewl_Filepicker_Dialog;
*/
struct Ewl_Filepicker_Dialog
{
- Ewl_Filepicker *fp;
- Ewl_Widget *d;
- Ewl_Widget *e;
+ Ewl_Filepicker *fp;
+ Ewl_Widget *d;
+ Ewl_Widget *e;
};
static void ewl_filepicker_favorites_populate(Ewl_Filepicker *fp);
static void ewl_filepicker_cb_list_value_changed(Ewl_Widget *w, void *ev,
- void *data);
+ void *data);
static void ewl_filepicker_cb_button_clicked(Ewl_Widget *w, void *ev,
- void *data);
+ void *data);
static void ewl_filepicker_cb_destroy(Ewl_Widget *w, void *ev, void *data);
static void ewl_filepicker_path_populate(Ewl_Filepicker *fp, char *path);
static void ewl_filepicker_cb_path_change(Ewl_Widget *w, void *ev,
- void *data);
+ void *data);
static void ewl_filepicker_cb_filter_change(Ewl_Widget *w, void *ev,
- void *data);
+ void *data);
static void ewl_filepicker_cb_path_entry_change(Ewl_Widget *w, void *ev,
- void *data);
+ void *data);
static void ewl_filepicker_cb_type_change(Ewl_Widget *w, void *ev,
- void *data);
+ void *data);
static void ewl_filepicker_cb_dir_new(Ewl_Widget *w, void *ev,
- void *data);
+ void *data);
static void ewl_filepicker_cb_dialog_response(Ewl_Widget *w, void *ev,
- void *data);
+ void *data);
static void ewl_filepicker_cb_dialog_delete(Ewl_Widget *w, void *ev,
- void *data);
+ void *data);
static void *ewl_filepicker_cb_type_fetch(void *data, unsigned int row,
- unsigned int col);
+ unsigned int col);
static unsigned int ewl_filepicker_cb_type_count(void *data);
static Ewl_Widget *ewl_filepicker_cb_type_header(void *data, unsigned int col);
static void *ewl_filepicker_cb_path_fetch(void *data, unsigned int row,
- unsigned int col);
+ unsigned int col);
static unsigned int ewl_filepicker_cb_path_count(void *data);
static Ewl_Widget *ewl_filepicker_cb_path_header(void *data,
- unsigned int col);
+ unsigned int col);
static void ewl_filepicker_filter_free_cb(Ewl_Filelist_Filter *filter);
static void ewl_filepicker_type_change(Ewl_Filepicker *fp);
@@ -75,21 +75,21 @@ static void ewl_filepicker_type_change(Ewl_Filepicker *fp);
Ewl_Widget *
ewl_filepicker_new(void)
{
- Ewl_Widget *w = NULL;
+ Ewl_Widget *w = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- w = NEW(Ewl_Filepicker, 1);
- if (!w)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ w = NEW(Ewl_Filepicker, 1);
+ if (!w)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_filepicker_init(EWL_FILEPICKER(w)))
- {
- ewl_widget_destroy(w);
- w = NULL;
- }
+ if (!ewl_filepicker_init(EWL_FILEPICKER(w)))
+ {
+ ewl_widget_destroy(w);
+ w = NULL;
+ }
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
/**
@@ -100,166 +100,166 @@ ewl_filepicker_new(void)
int
ewl_filepicker_init(Ewl_Filepicker *fp)
{
- Ewl_Widget *o, *box;
- const char *path;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fp, FALSE);
-
- if (!ewl_box_init(EWL_BOX(fp)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- fp->ret_dir = TRUE;
- ewl_box_orientation_set(EWL_BOX(fp), EWL_ORIENTATION_VERTICAL);
- ewl_widget_inherit(EWL_WIDGET(fp), EWL_FILEPICKER_TYPE);
- ewl_widget_appearance_set(EWL_WIDGET(fp), EWL_FILEPICKER_TYPE);
-
- ewl_callback_prepend(EWL_WIDGET(fp), EWL_CALLBACK_DESTROY,
- ewl_filepicker_cb_destroy, NULL);
-
- ewl_object_preferred_inner_size_set(EWL_OBJECT(fp), 400, 300);
-
- fp->mvc_path.model = ewl_model_new();
- ewl_model_data_fetch_set(fp->mvc_path.model,
- ewl_filepicker_cb_path_fetch);
- ewl_model_data_count_set(fp->mvc_path.model,
- ewl_filepicker_cb_path_count);
-
- fp->mvc_path.view = ewl_label_view_get();
- ewl_view_header_fetch_set(fp->mvc_path.view,
- ewl_filepicker_cb_path_header);
-
- fp->path = ecore_list_new();
- ecore_list_free_cb_set(fp->path, ECORE_FREE_CB(free));
-
- box = ewl_htoolbar_new();
- ewl_container_child_append(EWL_CONTAINER(fp), box);
- ewl_object_fill_policy_set(EWL_OBJECT(box),
- EWL_FLAG_FILL_NONE | EWL_FLAG_FILL_HFILL);
- ewl_widget_show(box);
-
- fp->dir_button = ewl_icon_new();
- ewl_icon_alt_text_set(EWL_ICON(fp->dir_button), "New Directory");
-
- path = ewl_icon_theme_icon_path_get(EWL_ICON_FOLDER_NEW,
- EWL_ICON_SIZE_MEDIUM);
- if (path)
- ewl_icon_image_set(EWL_ICON(fp->dir_button), path, NULL);
- ewl_callback_append(fp->dir_button, EWL_CALLBACK_CLICKED,
- ewl_filepicker_cb_dir_new, fp);
- ewl_container_child_append(EWL_CONTAINER(box), fp->dir_button);
- ewl_object_fill_policy_set(EWL_OBJECT(fp->dir_button),
- EWL_FLAG_FILL_NONE);
- ewl_widget_show(fp->dir_button);
-
- fp->mvc_path.combo = ewl_combo_new();
- ewl_combo_editable_set(EWL_COMBO(fp->mvc_path.combo), TRUE);
- ewl_container_child_prepend(EWL_CONTAINER(box),
- fp->mvc_path.combo);
- ewl_mvc_model_set(EWL_MVC(fp->mvc_path.combo),
- fp->mvc_path.model);
- ewl_mvc_view_set(EWL_MVC(fp->mvc_path.combo),
- fp->mvc_path.view);
- ewl_mvc_data_set(EWL_MVC(fp->mvc_path.combo), fp);
- ewl_callback_append(fp->mvc_path.combo,
- EWL_CALLBACK_VALUE_CHANGED,
- ewl_filepicker_cb_path_change, fp);
- ewl_object_fill_policy_set(EWL_OBJECT(fp->mvc_path.combo),
- EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
- ewl_widget_show(fp->mvc_path.combo);
-
- o = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(fp), o);
- ewl_widget_show(o);
-
- fp->favorites_box = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(o), fp->favorites_box);
- ewl_object_fill_policy_set(EWL_OBJECT(fp->favorites_box),
- EWL_FLAG_FILL_HSHRINK | EWL_FLAG_FILL_VFILL);
- ewl_filepicker_favorites_populate(fp);
- ewl_filepicker_show_favorites_set(fp, FALSE);
-
- fp->file_list = ewl_filelist_new();
- ewl_container_child_append(EWL_CONTAINER(o), fp->file_list);
- ewl_callback_append(EWL_WIDGET(fp->file_list),
- EWL_CALLBACK_VALUE_CHANGED,
- ewl_filepicker_cb_list_value_changed,
- fp);
- ewl_widget_show(fp->file_list);
-
- o = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(fp), o);
- ewl_widget_show(o);
-
- box = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(o), box);
- ewl_object_fill_policy_set(EWL_OBJECT(o),
- EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
- ewl_widget_show(box);
-
- fp->file_entry = ewl_entry_new();
- ewl_container_child_append(EWL_CONTAINER(box), fp->file_entry);
- ewl_widget_show(fp->file_entry);
-
- fp->filters = ecore_list_new();
- ecore_list_free_cb_set(fp->filters,
- ECORE_FREE_CB(ewl_filepicker_filter_free_cb));
-
- fp->mvc_filters.model = ewl_model_new();
- ewl_model_data_fetch_set(fp->mvc_filters.model,
- ewl_filepicker_cb_type_fetch);
- ewl_model_data_count_set(fp->mvc_filters.model,
- ewl_filepicker_cb_type_count);
-
- fp->mvc_filters.view = ewl_label_view_get();
- ewl_view_header_fetch_set(fp->mvc_filters.view,
- ewl_filepicker_cb_type_header);
-
- fp->mvc_filters.combo = ewl_combo_new();
- ewl_mvc_model_set(EWL_MVC(fp->mvc_filters.combo),
- fp->mvc_filters.model);
- ewl_mvc_view_set(EWL_MVC(fp->mvc_filters.combo),
- fp->mvc_filters.view);
- ewl_mvc_data_set(EWL_MVC(fp->mvc_filters.combo), fp);
- ewl_combo_editable_set(EWL_COMBO(fp->mvc_filters.combo), TRUE);
- ewl_callback_append(fp->mvc_filters.combo,
- EWL_CALLBACK_VALUE_CHANGED,
- ewl_filepicker_cb_type_change, fp);
- ewl_container_child_append(EWL_CONTAINER(box),
- fp->mvc_filters.combo);
- ewl_object_fill_policy_set(EWL_OBJECT(fp->mvc_filters.combo),
- EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
- ewl_widget_show(fp->mvc_filters.combo);
-
- box = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(o), box);
- ewl_object_fill_policy_set(EWL_OBJECT(box), EWL_FLAG_FILL_SHRINK);
- ewl_widget_show(box);
-
- fp->ret_button = ewl_button_new();
- ewl_container_child_append(EWL_CONTAINER(box), fp->ret_button);
- ewl_stock_type_set(EWL_STOCK(fp->ret_button), EWL_STOCK_OPEN);
- ewl_callback_append(fp->ret_button, EWL_CALLBACK_CLICKED,
- ewl_filepicker_cb_button_clicked, fp);
- ewl_object_fill_policy_set(EWL_OBJECT(fp->ret_button),
- EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
- ewl_widget_show(fp->ret_button);
-
- o = ewl_button_new();
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_CANCEL);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_filepicker_cb_button_clicked, fp);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
- ewl_widget_show(o);
-
- /* Set up filelist */
- ewl_filepicker_filter_add(fp, "All files", NULL, NULL);
- ewl_filepicker_directory_set(fp, NULL);
- ewl_mvc_selected_set(EWL_MVC(fp->mvc_filters.combo),
- NULL, fp, 0, 0);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Widget *o, *box;
+ const char *path;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fp, FALSE);
+
+ if (!ewl_box_init(EWL_BOX(fp)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ fp->ret_dir = TRUE;
+ ewl_box_orientation_set(EWL_BOX(fp), EWL_ORIENTATION_VERTICAL);
+ ewl_widget_inherit(EWL_WIDGET(fp), EWL_FILEPICKER_TYPE);
+ ewl_widget_appearance_set(EWL_WIDGET(fp), EWL_FILEPICKER_TYPE);
+
+ ewl_callback_prepend(EWL_WIDGET(fp), EWL_CALLBACK_DESTROY,
+ ewl_filepicker_cb_destroy, NULL);
+
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(fp), 400, 300);
+
+ fp->mvc_path.model = ewl_model_new();
+ ewl_model_data_fetch_set(fp->mvc_path.model,
+ ewl_filepicker_cb_path_fetch);
+ ewl_model_data_count_set(fp->mvc_path.model,
+ ewl_filepicker_cb_path_count);
+
+ fp->mvc_path.view = ewl_label_view_get();
+ ewl_view_header_fetch_set(fp->mvc_path.view,
+ ewl_filepicker_cb_path_header);
+
+ fp->path = ecore_list_new();
+ ecore_list_free_cb_set(fp->path, ECORE_FREE_CB(free));
+
+ box = ewl_htoolbar_new();
+ ewl_container_child_append(EWL_CONTAINER(fp), box);
+ ewl_object_fill_policy_set(EWL_OBJECT(box),
+ EWL_FLAG_FILL_NONE | EWL_FLAG_FILL_HFILL);
+ ewl_widget_show(box);
+
+ fp->dir_button = ewl_icon_new();
+ ewl_icon_alt_text_set(EWL_ICON(fp->dir_button), "New Directory");
+
+ path = ewl_icon_theme_icon_path_get(EWL_ICON_FOLDER_NEW,
+ EWL_ICON_SIZE_MEDIUM);
+ if (path)
+ ewl_icon_image_set(EWL_ICON(fp->dir_button), path, NULL);
+ ewl_callback_append(fp->dir_button, EWL_CALLBACK_CLICKED,
+ ewl_filepicker_cb_dir_new, fp);
+ ewl_container_child_append(EWL_CONTAINER(box), fp->dir_button);
+ ewl_object_fill_policy_set(EWL_OBJECT(fp->dir_button),
+ EWL_FLAG_FILL_NONE);
+ ewl_widget_show(fp->dir_button);
+
+ fp->mvc_path.combo = ewl_combo_new();
+ ewl_combo_editable_set(EWL_COMBO(fp->mvc_path.combo), TRUE);
+ ewl_container_child_prepend(EWL_CONTAINER(box),
+ fp->mvc_path.combo);
+ ewl_mvc_model_set(EWL_MVC(fp->mvc_path.combo),
+ fp->mvc_path.model);
+ ewl_mvc_view_set(EWL_MVC(fp->mvc_path.combo),
+ fp->mvc_path.view);
+ ewl_mvc_data_set(EWL_MVC(fp->mvc_path.combo), fp);
+ ewl_callback_append(fp->mvc_path.combo,
+ EWL_CALLBACK_VALUE_CHANGED,
+ ewl_filepicker_cb_path_change, fp);
+ ewl_object_fill_policy_set(EWL_OBJECT(fp->mvc_path.combo),
+ EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
+ ewl_widget_show(fp->mvc_path.combo);
+
+ o = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(fp), o);
+ ewl_widget_show(o);
+
+ fp->favorites_box = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(o), fp->favorites_box);
+ ewl_object_fill_policy_set(EWL_OBJECT(fp->favorites_box),
+ EWL_FLAG_FILL_HSHRINK | EWL_FLAG_FILL_VFILL);
+ ewl_filepicker_favorites_populate(fp);
+ ewl_filepicker_show_favorites_set(fp, FALSE);
+
+ fp->file_list = ewl_filelist_new();
+ ewl_container_child_append(EWL_CONTAINER(o), fp->file_list);
+ ewl_callback_append(EWL_WIDGET(fp->file_list),
+ EWL_CALLBACK_VALUE_CHANGED,
+ ewl_filepicker_cb_list_value_changed,
+ fp);
+ ewl_widget_show(fp->file_list);
+
+ o = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(fp), o);
+ ewl_widget_show(o);
+
+ box = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(o), box);
+ ewl_object_fill_policy_set(EWL_OBJECT(o),
+ EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
+ ewl_widget_show(box);
+
+ fp->file_entry = ewl_entry_new();
+ ewl_container_child_append(EWL_CONTAINER(box), fp->file_entry);
+ ewl_widget_show(fp->file_entry);
+
+ fp->filters = ecore_list_new();
+ ecore_list_free_cb_set(fp->filters,
+ ECORE_FREE_CB(ewl_filepicker_filter_free_cb));
+
+ fp->mvc_filters.model = ewl_model_new();
+ ewl_model_data_fetch_set(fp->mvc_filters.model,
+ ewl_filepicker_cb_type_fetch);
+ ewl_model_data_count_set(fp->mvc_filters.model,
+ ewl_filepicker_cb_type_count);
+
+ fp->mvc_filters.view = ewl_label_view_get();
+ ewl_view_header_fetch_set(fp->mvc_filters.view,
+ ewl_filepicker_cb_type_header);
+
+ fp->mvc_filters.combo = ewl_combo_new();
+ ewl_mvc_model_set(EWL_MVC(fp->mvc_filters.combo),
+ fp->mvc_filters.model);
+ ewl_mvc_view_set(EWL_MVC(fp->mvc_filters.combo),
+ fp->mvc_filters.view);
+ ewl_mvc_data_set(EWL_MVC(fp->mvc_filters.combo), fp);
+ ewl_combo_editable_set(EWL_COMBO(fp->mvc_filters.combo), TRUE);
+ ewl_callback_append(fp->mvc_filters.combo,
+ EWL_CALLBACK_VALUE_CHANGED,
+ ewl_filepicker_cb_type_change, fp);
+ ewl_container_child_append(EWL_CONTAINER(box),
+ fp->mvc_filters.combo);
+ ewl_object_fill_policy_set(EWL_OBJECT(fp->mvc_filters.combo),
+ EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
+ ewl_widget_show(fp->mvc_filters.combo);
+
+ box = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(o), box);
+ ewl_object_fill_policy_set(EWL_OBJECT(box), EWL_FLAG_FILL_SHRINK);
+ ewl_widget_show(box);
+
+ fp->ret_button = ewl_button_new();
+ ewl_container_child_append(EWL_CONTAINER(box), fp->ret_button);
+ ewl_stock_type_set(EWL_STOCK(fp->ret_button), EWL_STOCK_OPEN);
+ ewl_callback_append(fp->ret_button, EWL_CALLBACK_CLICKED,
+ ewl_filepicker_cb_button_clicked, fp);
+ ewl_object_fill_policy_set(EWL_OBJECT(fp->ret_button),
+ EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
+ ewl_widget_show(fp->ret_button);
+
+ o = ewl_button_new();
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_CANCEL);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_filepicker_cb_button_clicked, fp);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
+ ewl_widget_show(o);
+
+ /* Set up filelist */
+ ewl_filepicker_filter_add(fp, "All files", NULL, NULL);
+ ewl_filepicker_directory_set(fp, NULL);
+ ewl_mvc_selected_set(EWL_MVC(fp->mvc_filters.combo),
+ NULL, fp, 0, 0);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -269,14 +269,14 @@ ewl_filepicker_init(Ewl_Filepicker *fp)
Ewl_Widget *
ewl_filepicker_save_as_new(void)
{
- Ewl_Widget *ret;
+ Ewl_Widget *ret;
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- ret = ewl_filepicker_new();
- ewl_filepicker_save_as_set(EWL_FILEPICKER(ret), TRUE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ ret = ewl_filepicker_new();
+ ewl_filepicker_save_as_set(EWL_FILEPICKER(ret), TRUE);
- DRETURN_PTR(ret, DLEVEL_STABLE);
+ DRETURN_PTR(ret, DLEVEL_STABLE);
}
/**
@@ -288,23 +288,23 @@ ewl_filepicker_save_as_new(void)
static void
ewl_filepicker_type_change(Ewl_Filepicker *fp)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fp);
- DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
-
- if (fp->saveas_dialog)
- {
- ewl_widget_enable(fp->file_entry);
- ewl_stock_type_set(EWL_STOCK(fp->ret_button), EWL_STOCK_SAVE);
- }
- else
- {
- if (ewl_filelist_multiselect_get(EWL_FILELIST(fp->file_list)))
- ewl_widget_disable(fp->file_entry);
- ewl_stock_type_set(EWL_STOCK(fp->ret_button), EWL_STOCK_OPEN);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fp);
+ DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
+
+ if (fp->saveas_dialog)
+ {
+ ewl_widget_enable(fp->file_entry);
+ ewl_stock_type_set(EWL_STOCK(fp->ret_button), EWL_STOCK_SAVE);
+ }
+ else
+ {
+ if (ewl_filelist_multiselect_get(EWL_FILELIST(fp->file_list)))
+ ewl_widget_disable(fp->file_entry);
+ ewl_stock_type_set(EWL_STOCK(fp->ret_button), EWL_STOCK_OPEN);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -316,17 +316,17 @@ ewl_filepicker_type_change(Ewl_Filepicker *fp)
void
ewl_filepicker_save_as_set(Ewl_Filepicker *fp, unsigned int t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fp);
- DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fp);
+ DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
- if (fp->saveas_dialog == t)
- DRETURN(DLEVEL_STABLE);
+ if (fp->saveas_dialog == t)
+ DRETURN(DLEVEL_STABLE);
- fp->saveas_dialog = !!t;
- ewl_filepicker_type_change(fp);
+ fp->saveas_dialog = !!t;
+ ewl_filepicker_type_change(fp);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -337,11 +337,11 @@ ewl_filepicker_save_as_set(Ewl_Filepicker *fp, unsigned int t)
unsigned int
ewl_filepicker_save_as_get(Ewl_Filepicker *fp)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fp, FALSE);
- DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fp, FALSE);
+ DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, FALSE);
- DRETURN_INT(fp->saveas_dialog, DLEVEL_STABLE);
+ DRETURN_INT(fp->saveas_dialog, DLEVEL_STABLE);
}
/**
@@ -353,12 +353,12 @@ ewl_filepicker_save_as_get(Ewl_Filepicker *fp)
void
ewl_filepicker_return_directories_set(Ewl_Filepicker *fp, unsigned int t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fp);
- DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fp);
+ DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
- fp->ret_dir = !!t;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ fp->ret_dir = !!t;
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -369,11 +369,11 @@ ewl_filepicker_return_directories_set(Ewl_Filepicker *fp, unsigned int t)
unsigned int
ewl_filepicker_return_directories_get(Ewl_Filepicker *fp)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fp, FALSE);
- DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fp, FALSE);
+ DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, FALSE);
- DRETURN_INT(fp->ret_dir, DLEVEL_STABLE);
+ DRETURN_INT(fp->ret_dir, DLEVEL_STABLE);
}
/**
@@ -385,20 +385,20 @@ ewl_filepicker_return_directories_get(Ewl_Filepicker *fp)
void
ewl_filepicker_show_favorites_set(Ewl_Filepicker *fp, unsigned int show)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fp);
- DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fp);
+ DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
- if (show == fp->show_favorites)
- DRETURN(DLEVEL_STABLE);
+ if (show == fp->show_favorites)
+ DRETURN(DLEVEL_STABLE);
- fp->show_favorites = !!show;
- if (fp->show_favorites)
- ewl_widget_show(fp->favorites_box);
- else
- ewl_widget_hide(fp->favorites_box);
+ fp->show_favorites = !!show;
+ if (fp->show_favorites)
+ ewl_widget_show(fp->favorites_box);
+ else
+ ewl_widget_hide(fp->favorites_box);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -409,11 +409,11 @@ ewl_filepicker_show_favorites_set(Ewl_Filepicker *fp, unsigned int show)
unsigned int
ewl_filepicker_show_favorites_get(Ewl_Filepicker *fp)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fp, 0);
- DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fp, 0);
+ DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, 0);
- DRETURN_INT(fp->show_favorites, DLEVEL_STABLE);
+ DRETURN_INT(fp->show_favorites, DLEVEL_STABLE);
}
/**
@@ -425,18 +425,18 @@ ewl_filepicker_show_favorites_get(Ewl_Filepicker *fp)
void
ewl_filepicker_list_view_set(Ewl_Filepicker *fp, Ewl_Filelist_View view)
{
- Ewl_Filelist *temp;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fp);
- DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
-
- temp = EWL_FILELIST(fp->file_list);
-
- if (temp->view_flag == view)
- DRETURN(DLEVEL_STABLE);
- ewl_filelist_view_set(EWL_FILELIST(fp->file_list), view);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Filelist *temp;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fp);
+ DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
+
+ temp = EWL_FILELIST(fp->file_list);
+
+ if (temp->view_flag == view)
+ DRETURN(DLEVEL_STABLE);
+ ewl_filelist_view_set(EWL_FILELIST(fp->file_list), view);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -447,12 +447,12 @@ ewl_filepicker_list_view_set(Ewl_Filepicker *fp, Ewl_Filelist_View view)
Ewl_Filelist_View *
ewl_filepicker_list_view_get(Ewl_Filepicker *fp)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fp, NULL);
- DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fp, NULL);
+ DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, NULL);
- DRETURN_PTR(ewl_filelist_view_get(EWL_FILELIST(fp->file_list)),
- DLEVEL_STABLE);
+ DRETURN_PTR(ewl_filelist_view_get(EWL_FILELIST(fp->file_list)),
+ DLEVEL_STABLE);
}
/**
@@ -464,40 +464,40 @@ ewl_filepicker_list_view_get(Ewl_Filepicker *fp)
void
ewl_filepicker_directory_set(Ewl_Filepicker *fp, const char *dir)
{
- char *tmp;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fp);
- DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
-
- /* if no directory is given try to default to the HOME directory,
- * and if that failes try /tmp and if that fails try / */
- if (!dir)
- {
- char *t;
-
- t = getenv("HOME");
- if (t) tmp = strdup(t);
- else tmp = strdup("/tmp");
-
- if (!ecore_file_exists(tmp))
- {
- FREE(tmp);
- tmp = strdup("/");
- }
- }
- else
- tmp = strdup(dir);
-
- if ((ecore_file_is_dir(tmp)) && (ecore_file_can_read(tmp)))
- {
- ewl_filepicker_path_populate(fp, tmp);
- ewl_filelist_directory_set(EWL_FILELIST(fp->file_list), tmp);
- }
-
- FREE(tmp);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ char *tmp;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fp);
+ DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
+
+ /* if no directory is given try to default to the HOME directory,
+ * and if that failes try /tmp and if that fails try / */
+ if (!dir)
+ {
+ char *t;
+
+ t = getenv("HOME");
+ if (t) tmp = strdup(t);
+ else tmp = strdup("/tmp");
+
+ if (!ecore_file_exists(tmp))
+ {
+ FREE(tmp);
+ tmp = strdup("/");
+ }
+ }
+ else
+ tmp = strdup(dir);
+
+ if ((ecore_file_is_dir(tmp)) && (ecore_file_can_read(tmp)))
+ {
+ ewl_filepicker_path_populate(fp, tmp);
+ ewl_filelist_directory_set(EWL_FILELIST(fp->file_list), tmp);
+ }
+
+ FREE(tmp);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -508,12 +508,12 @@ ewl_filepicker_directory_set(Ewl_Filepicker *fp, const char *dir)
const char *
ewl_filepicker_directory_get(Ewl_Filepicker *fp)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fp, NULL);
- DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fp, NULL);
+ DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, NULL);
- DRETURN_PTR(ewl_filelist_directory_get(EWL_FILELIST(fp->file_list)),
- DLEVEL_STABLE);
+ DRETURN_PTR(ewl_filelist_directory_get(EWL_FILELIST(fp->file_list)),
+ DLEVEL_STABLE);
}
/**
@@ -524,22 +524,22 @@ ewl_filepicker_directory_get(Ewl_Filepicker *fp)
*/
void
ewl_filepicker_filter_set(Ewl_Filepicker *fp,
- Ewl_Filelist_Filter *filter)
+ Ewl_Filelist_Filter *filter)
{
- int idx;
+ int idx;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fp);
- DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fp);
+ DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
- if (filter == ewl_filepicker_filter_get(fp))
- DRETURN(DLEVEL_STABLE);
+ if (filter == ewl_filepicker_filter_get(fp))
+ DRETURN(DLEVEL_STABLE);
- ecore_list_goto(fp->filters, filter);
- idx = ecore_list_index(fp->filters);
- ewl_mvc_selected_set(EWL_MVC(fp->mvc_filters.combo), NULL, fp, idx, 0);
+ ecore_list_goto(fp->filters, filter);
+ idx = ecore_list_index(fp->filters);
+ ewl_mvc_selected_set(EWL_MVC(fp->mvc_filters.combo), NULL, fp, idx, 0);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -550,12 +550,12 @@ ewl_filepicker_filter_set(Ewl_Filepicker *fp,
Ewl_Filelist_Filter *
ewl_filepicker_filter_get(Ewl_Filepicker *fp)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fp, NULL);
- DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fp, NULL);
+ DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, NULL);
- DRETURN_PTR(ewl_filelist_filter_get(EWL_FILELIST(fp->file_list)),
- DLEVEL_STABLE);
+ DRETURN_PTR(ewl_filelist_filter_get(EWL_FILELIST(fp->file_list)),
+ DLEVEL_STABLE);
}
/**
@@ -567,13 +567,13 @@ ewl_filepicker_filter_get(Ewl_Filepicker *fp)
void
ewl_filepicker_multiselect_set(Ewl_Filepicker *fp, unsigned int ms)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fp);
- DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fp);
+ DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
- ewl_filelist_multiselect_set(EWL_FILELIST(fp->file_list), ms);
+ ewl_filelist_multiselect_set(EWL_FILELIST(fp->file_list), ms);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -584,12 +584,12 @@ ewl_filepicker_multiselect_set(Ewl_Filepicker *fp, unsigned int ms)
unsigned int
ewl_filepicker_multiselect_get(Ewl_Filepicker *fp)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fp, FALSE);
- DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fp, FALSE);
+ DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, FALSE);
- DRETURN_INT(ewl_filelist_multiselect_get(EWL_FILELIST(fp->file_list)),
- DLEVEL_STABLE);
+ DRETURN_INT(ewl_filelist_multiselect_get(EWL_FILELIST(fp->file_list)),
+ DLEVEL_STABLE);
}
/**
@@ -602,13 +602,13 @@ ewl_filepicker_multiselect_get(Ewl_Filepicker *fp)
void
ewl_filepicker_show_dot_files_set(Ewl_Filepicker *fp, unsigned int dot)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fp);
- DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fp);
+ DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
- ewl_filelist_show_dot_files_set(EWL_FILELIST(fp->file_list), dot);
+ ewl_filelist_show_dot_files_set(EWL_FILELIST(fp->file_list), dot);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -619,12 +619,12 @@ ewl_filepicker_show_dot_files_set(Ewl_Filepicker *fp, unsigned int dot)
unsigned int
ewl_filepicker_show_dot_files_get(Ewl_Filepicker *fp)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fp, FALSE);
- DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fp, FALSE);
+ DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, FALSE);
- DRETURN_INT(ewl_filelist_show_dot_files_get(EWL_FILELIST(fp->file_list)),
- DLEVEL_STABLE);
+ DRETURN_INT(ewl_filelist_show_dot_files_get(EWL_FILELIST(fp->file_list)),
+ DLEVEL_STABLE);
}
/**
@@ -636,13 +636,13 @@ ewl_filepicker_show_dot_files_get(Ewl_Filepicker *fp)
void
ewl_filepicker_selected_file_set(Ewl_Filepicker *fp, const char *file)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fp);
- DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fp);
+ DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
- ewl_filelist_selected_file_set(EWL_FILELIST(fp->file_list), file);
+ ewl_filelist_selected_file_set(EWL_FILELIST(fp->file_list), file);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -653,53 +653,53 @@ ewl_filepicker_selected_file_set(Ewl_Filepicker *fp, const char *file)
char *
ewl_filepicker_selected_file_get(Ewl_Filepicker *fp)
{
- char *file, *ret;
- const char *dir;
- size_t len, dir_len, file_len;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fp, NULL);
- DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, NULL);
-
- /* we try to grab whats in the text entry first as the user may have
- * changed the selected name. Otherwise we try to grab whats in the
- * selected array from the file list */
- file = ewl_text_text_get(EWL_TEXT(fp->file_entry));
- if (!file)
- ret = ewl_filelist_selected_file_get(EWL_FILELIST(fp->file_list));
- else
- {
- dir = ewl_filelist_directory_get(EWL_FILELIST(fp->file_list));
- file_len = strlen(file);
- if (file_len)
- {
- if (file[0] != '/')
- {
- dir_len = strlen(dir);
- if (dir_len == 1)
- dir_len = 0;
- len = dir_len + file_len + 2;
- ret = NEW(char, len);
- strcat(ret, dir);
- if (dir_len > 1)
- strcat(ret, "/");
- strcat(ret, file);
- }
- else
- {
- ret = file;
- file = NULL;
- }
- }
- else
- ret = NULL;
- }
-
- IF_FREE(file);
- if ((!fp->ret_dir) && (ret) && (ecore_file_is_dir(ret)))
- FREE(ret);
-
- DRETURN_PTR(ret, DLEVEL_STABLE);
+ char *file, *ret;
+ const char *dir;
+ size_t len, dir_len, file_len;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fp, NULL);
+ DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, NULL);
+
+ /* we try to grab whats in the text entry first as the user may have
+ * changed the selected name. Otherwise we try to grab whats in the
+ * selected array from the file list */
+ file = ewl_text_text_get(EWL_TEXT(fp->file_entry));
+ if (!file)
+ ret = ewl_filelist_selected_file_get(EWL_FILELIST(fp->file_list));
+ else
+ {
+ dir = ewl_filelist_directory_get(EWL_FILELIST(fp->file_list));
+ file_len = strlen(file);
+ if (file_len)
+ {
+ if (file[0] != '/')
+ {
+ dir_len = strlen(dir);
+ if (dir_len == 1)
+ dir_len = 0;
+ len = dir_len + file_len + 2;
+ ret = NEW(char, len);
+ strcat(ret, dir);
+ if (dir_len > 1)
+ strcat(ret, "/");
+ strcat(ret, file);
+ }
+ else
+ {
+ ret = file;
+ file = NULL;
+ }
+ }
+ else
+ ret = NULL;
+ }
+
+ IF_FREE(file);
+ if ((!fp->ret_dir) && (ret) && (ecore_file_is_dir(ret)))
+ FREE(ret);
+
+ DRETURN_PTR(ret, DLEVEL_STABLE);
}
/**
@@ -711,13 +711,13 @@ ewl_filepicker_selected_file_get(Ewl_Filepicker *fp)
void
ewl_filepicker_selected_files_set(Ewl_Filepicker *fp, Ecore_List *files)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fp);
- DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fp);
+ DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
- ewl_filelist_selected_files_set(EWL_FILELIST(fp->file_list), files);
+ ewl_filelist_selected_files_set(EWL_FILELIST(fp->file_list), files);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -728,12 +728,12 @@ ewl_filepicker_selected_files_set(Ewl_Filepicker *fp, Ecore_List *files)
Ecore_List *
ewl_filepicker_selected_files_get(Ewl_Filepicker *fp)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fp, NULL);
- DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fp, NULL);
+ DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, NULL);
- DRETURN_PTR(ewl_filelist_selected_files_get(EWL_FILELIST(fp->file_list)),
- DLEVEL_STABLE);
+ DRETURN_PTR(ewl_filelist_selected_files_get(EWL_FILELIST(fp->file_list)),
+ DLEVEL_STABLE);
}
/**
@@ -746,556 +746,556 @@ ewl_filepicker_selected_files_get(Ewl_Filepicker *fp)
*/
Ewl_Filelist_Filter *
ewl_filepicker_filter_add(Ewl_Filepicker *fp, const char *name,
- const char *extension,
- Ecore_List *mime_types)
+ const char *extension,
+ Ecore_List *mime_types)
{
- Ewl_Filelist_Filter *f;
+ Ewl_Filelist_Filter *f;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fp, NULL);
- DCHECK_PARAM_PTR_RET(name, NULL);
- DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fp, NULL);
+ DCHECK_PARAM_PTR_RET(name, NULL);
+ DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, NULL);
- f= NEW(Ewl_Filelist_Filter, 1);
- if (!f)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ f= NEW(Ewl_Filelist_Filter, 1);
+ if (!f)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- f->name = strdup(name);
- if (extension) f->extension = strdup(extension);
- else f->extension = NULL;
- if (mime_types) f->mime_list = mime_types;
- else f->mime_list = NULL;
+ f->name = strdup(name);
+ if (extension) f->extension = strdup(extension);
+ else f->extension = NULL;
+ if (mime_types) f->mime_list = mime_types;
+ else f->mime_list = NULL;
- ecore_list_prepend(fp->filters, f);
- ewl_mvc_dirty_set(EWL_MVC(fp->mvc_filters.combo), TRUE);
- ewl_mvc_selected_set(EWL_MVC(fp->mvc_filters.combo), NULL, fp, 0, 0);
+ ecore_list_prepend(fp->filters, f);
+ ewl_mvc_dirty_set(EWL_MVC(fp->mvc_filters.combo), TRUE);
+ ewl_mvc_selected_set(EWL_MVC(fp->mvc_filters.combo), NULL, fp, 0, 0);
- DRETURN_PTR(f, DLEVEL_STABLE);
+ DRETURN_PTR(f, DLEVEL_STABLE);
}
static void
ewl_filepicker_cb_list_value_changed(Ewl_Widget *w, void *ev, void *data)
{
- Ewl_Filepicker *fp;
- Ewl_Filelist *fl;
- Ewl_Event_Action_Response *e;
- char *file;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(data);
-
- fl = EWL_FILELIST(w);
- fp = data;
- e = ev;
-
- /* clear the text and get the selected file */
- file = ewl_filelist_selected_file_get(fl);
-
- if (e->response == EWL_FILELIST_EVENT_DIR_CHANGE)
- {
- char *dir;
-
- dir = strdup(ewl_filelist_directory_get(fl));
- ewl_filepicker_path_populate(fp, dir);
-
- if (!ecore_file_can_write(dir))
- ewl_widget_disable(fp->dir_button);
- else
- ewl_widget_enable(fp->dir_button);
- ewl_text_clear(EWL_TEXT(fp->file_entry));
- FREE(dir);
- }
- else if (e->response == EWL_FILELIST_EVENT_SELECTION_CHANGE)
- {
- if (ecore_file_is_dir(file))
- {
- if ((!fp->saveas_dialog) && (!fl->multiselect) &&
- (fp->ret_dir))
- ewl_text_text_set(EWL_TEXT(fp->file_entry),
- file);
- }
- else
- {
- if (!fl->multiselect)
- ewl_text_text_set(EWL_TEXT(fp->file_entry),
- ecore_file_file_get(file));
- }
- }
-
- else if ((e->response == EWL_FILELIST_EVENT_MULTI_TRUE) &&
- (!fp->saveas_dialog))
- {
- ewl_widget_disable(fp->file_entry);
- ewl_text_clear(EWL_TEXT(fp->file_entry));
- }
-
- else if ((e->response == EWL_FILELIST_EVENT_MULTI_FALSE) &&
- (!fp->saveas_dialog))
- {
- if ((ecore_file_is_dir(file)) && (fp->ret_dir))
- {
- ewl_text_text_set(EWL_TEXT(fp->file_entry),
- file);
- }
- else
- {
- ewl_text_text_set(EWL_TEXT(fp->file_entry),
- ecore_file_file_get(file));
- }
- ewl_widget_enable(fp->file_entry);
- }
-
- FREE(file);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Filepicker *fp;
+ Ewl_Filelist *fl;
+ Ewl_Event_Action_Response *e;
+ char *file;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(data);
+
+ fl = EWL_FILELIST(w);
+ fp = data;
+ e = ev;
+
+ /* clear the text and get the selected file */
+ file = ewl_filelist_selected_file_get(fl);
+
+ if (e->response == EWL_FILELIST_EVENT_DIR_CHANGE)
+ {
+ char *dir;
+
+ dir = strdup(ewl_filelist_directory_get(fl));
+ ewl_filepicker_path_populate(fp, dir);
+
+ if (!ecore_file_can_write(dir))
+ ewl_widget_disable(fp->dir_button);
+ else
+ ewl_widget_enable(fp->dir_button);
+ ewl_text_clear(EWL_TEXT(fp->file_entry));
+ FREE(dir);
+ }
+ else if (e->response == EWL_FILELIST_EVENT_SELECTION_CHANGE)
+ {
+ if (ecore_file_is_dir(file))
+ {
+ if ((!fp->saveas_dialog) && (!fl->multiselect) &&
+ (fp->ret_dir))
+ ewl_text_text_set(EWL_TEXT(fp->file_entry),
+ file);
+ }
+ else
+ {
+ if (!fl->multiselect)
+ ewl_text_text_set(EWL_TEXT(fp->file_entry),
+ ecore_file_file_get(file));
+ }
+ }
+
+ else if ((e->response == EWL_FILELIST_EVENT_MULTI_TRUE) &&
+ (!fp->saveas_dialog))
+ {
+ ewl_widget_disable(fp->file_entry);
+ ewl_text_clear(EWL_TEXT(fp->file_entry));
+ }
+
+ else if ((e->response == EWL_FILELIST_EVENT_MULTI_FALSE) &&
+ (!fp->saveas_dialog))
+ {
+ if ((ecore_file_is_dir(file)) && (fp->ret_dir))
+ {
+ ewl_text_text_set(EWL_TEXT(fp->file_entry),
+ file);
+ }
+ else
+ {
+ ewl_text_text_set(EWL_TEXT(fp->file_entry),
+ ecore_file_file_get(file));
+ }
+ ewl_widget_enable(fp->file_entry);
+ }
+
+ FREE(file);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_filepicker_cb_button_clicked(Ewl_Widget *w, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Filepicker *fp;
- Ewl_Stock *s;
- Ewl_Event_Action_Response e;
+ Ewl_Filepicker *fp;
+ Ewl_Stock *s;
+ Ewl_Event_Action_Response e;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- fp = data;
- s = EWL_STOCK(w);
+ fp = data;
+ s = EWL_STOCK(w);
- e.response = ewl_stock_type_get(s);
+ e.response = ewl_stock_type_get(s);
- if (e.response == EWL_STOCK_CANCEL)
- {
- ewl_text_text_set(EWL_TEXT(fp->file_entry), NULL);
- ewl_filepicker_selected_file_set(fp, NULL);
- }
- ewl_callback_call_with_event_data(EWL_WIDGET(fp),
- EWL_CALLBACK_VALUE_CHANGED, &e);
+ if (e.response == EWL_STOCK_CANCEL)
+ {
+ ewl_text_text_set(EWL_TEXT(fp->file_entry), NULL);
+ ewl_filepicker_selected_file_set(fp, NULL);
+ }
+ ewl_callback_call_with_event_data(EWL_WIDGET(fp),
+ EWL_CALLBACK_VALUE_CHANGED, &e);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_filepicker_favorites_populate(Ewl_Filepicker *fp)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fp);
- DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fp);
+ DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
- /* XXX Write me */
+ /* XXX Write me */
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void *
ewl_filepicker_cb_type_fetch(void *data, unsigned int row,
- unsigned int col __UNUSED__)
+ unsigned int col __UNUSED__)
{
- Ewl_Filepicker *fp;
- Ewl_Filelist_Filter *filter;
+ Ewl_Filepicker *fp;
+ Ewl_Filelist_Filter *filter;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, NULL);
- fp = data;
- filter = ecore_list_index_goto(fp->filters, row);
+ fp = data;
+ filter = ecore_list_index_goto(fp->filters, row);
- DRETURN_PTR(filter->name, DLEVEL_STABLE);
+ DRETURN_PTR(filter->name, DLEVEL_STABLE);
}
static unsigned int
ewl_filepicker_cb_type_count(void *data)
{
- Ewl_Filepicker *fp;
+ Ewl_Filepicker *fp;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, FALSE);
- fp = data;
+ fp = data;
- DRETURN_INT(ecore_list_count(fp->filters), DLEVEL_STABLE);
+ DRETURN_INT(ecore_list_count(fp->filters), DLEVEL_STABLE);
}
static Ewl_Widget *
ewl_filepicker_cb_type_header(void *data, unsigned int col)
{
- Ewl_Filepicker *fp;
- Ewl_Filelist_Filter *filter;
- Ewl_Widget *w;
+ Ewl_Filepicker *fp;
+ Ewl_Filelist_Filter *filter;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, NULL);
- fp = data;
- ecore_list_index_goto(fp->filters, col);
- filter = ecore_list_current(fp->filters);
+ fp = data;
+ ecore_list_index_goto(fp->filters, col);
+ filter = ecore_list_current(fp->filters);
- w = ewl_entry_new();
- if (filter)
- ewl_text_text_set(EWL_TEXT(w), filter->name);
- ewl_callback_append(w, EWL_CALLBACK_VALUE_CHANGED,
- ewl_filepicker_cb_filter_change, fp);
+ w = ewl_entry_new();
+ if (filter)
+ ewl_text_text_set(EWL_TEXT(w), filter->name);
+ ewl_callback_append(w, EWL_CALLBACK_VALUE_CHANGED,
+ ewl_filepicker_cb_filter_change, fp);
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
static void *
ewl_filepicker_cb_path_fetch(void *data, unsigned int row,
- unsigned int col __UNUSED__)
+ unsigned int col __UNUSED__)
{
- Ewl_Filepicker *fp;
+ Ewl_Filepicker *fp;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, NULL);
- fp = data;
+ fp = data;
- DRETURN_PTR(ecore_list_index_goto(fp->path, row), DLEVEL_STABLE);
+ DRETURN_PTR(ecore_list_index_goto(fp->path, row), DLEVEL_STABLE);
}
static unsigned int
ewl_filepicker_cb_path_count(void *data)
{
- Ewl_Filepicker *fp;
+ Ewl_Filepicker *fp;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, FALSE);
- fp = data;
+ fp = data;
- DRETURN_INT(ecore_list_count(fp->path), DLEVEL_STABLE);
+ DRETURN_INT(ecore_list_count(fp->path), DLEVEL_STABLE);
}
static Ewl_Widget *
ewl_filepicker_cb_path_header(void *data, unsigned int col __UNUSED__)
{
- Ewl_Filepicker *fp;
- Ewl_Widget *entry;
- char *path;
+ Ewl_Filepicker *fp;
+ Ewl_Widget *entry;
+ char *path;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, NULL);
- fp = data;
- path = ecore_list_index_goto(fp->path, col);
+ fp = data;
+ path = ecore_list_index_goto(fp->path, col);
- entry = ewl_entry_new();
- ewl_text_text_set(EWL_TEXT(entry), path);
- ewl_callback_append(entry, EWL_CALLBACK_VALUE_CHANGED,
- ewl_filepicker_cb_path_entry_change, fp);
+ entry = ewl_entry_new();
+ ewl_text_text_set(EWL_TEXT(entry), path);
+ ewl_callback_append(entry, EWL_CALLBACK_VALUE_CHANGED,
+ ewl_filepicker_cb_path_entry_change, fp);
- DRETURN_PTR(entry, DLEVEL_STABLE);
+ DRETURN_PTR(entry, DLEVEL_STABLE);
}
static void
ewl_filepicker_path_populate(Ewl_Filepicker *fp, char *path)
{
- char *p, *t;
+ char *p, *t;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fp);
- DCHECK_PARAM_PTR(path);
- DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fp);
+ DCHECK_PARAM_PTR(path);
+ DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
- /* Clear the list and free the data first */
- while ((p = ecore_list_first_remove(fp->path)))
- FREE(p);
+ /* Clear the list and free the data first */
+ while ((p = ecore_list_first_remove(fp->path)))
+ FREE(p);
- ecore_list_append(fp->path, strdup("/"));
+ ecore_list_append(fp->path, strdup("/"));
- p = path;
- while ((t = strchr((p + 1), '/')))
- {
- *t = '\0';
- ecore_list_prepend(fp->path, strdup(path));
+ p = path;
+ while ((t = strchr((p + 1), '/')))
+ {
+ *t = '\0';
+ ecore_list_prepend(fp->path, strdup(path));
- *t = '/';
- p = t;
- }
+ *t = '/';
+ p = t;
+ }
- /* do we have more stuff? if so, make sure we get the last path */
- if (p && (*(p + 1) != '\0'))
- ecore_list_prepend(fp->path, strdup(path));
+ /* do we have more stuff? if so, make sure we get the last path */
+ if (p && (*(p + 1) != '\0'))
+ ecore_list_prepend(fp->path, strdup(path));
- ewl_mvc_dirty_set(EWL_MVC(fp->mvc_path.combo), TRUE);
- ewl_mvc_selected_set(EWL_MVC(fp->mvc_path.combo), NULL, fp->path, 0, 0);
+ ewl_mvc_dirty_set(EWL_MVC(fp->mvc_path.combo), TRUE);
+ ewl_mvc_selected_set(EWL_MVC(fp->mvc_path.combo), NULL, fp->path, 0, 0);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_filepicker_cb_path_change(Ewl_Widget *w, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Filepicker *fp;
- Ewl_Selection_Idx *idx;
+ Ewl_Filepicker *fp;
+ Ewl_Selection_Idx *idx;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- fp = data;
- idx = ewl_mvc_selected_get(EWL_MVC(w));
+ fp = data;
+ idx = ewl_mvc_selected_get(EWL_MVC(w));
- if (idx->row == 0)
- {
- free(idx);
- DRETURN(DLEVEL_STABLE);
- }
+ if (idx->row == 0)
+ {
+ free(idx);
+ DRETURN(DLEVEL_STABLE);
+ }
- ecore_list_index_goto(fp->path, idx->row);
- ewl_filepicker_directory_set(fp, ecore_list_current(fp->path));
- free(idx);
+ ecore_list_index_goto(fp->path, idx->row);
+ ewl_filepicker_directory_set(fp, ecore_list_current(fp->path));
+ free(idx);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_filepicker_cb_filter_change(Ewl_Widget *w, void *ev __UNUSED__, void *data)
{
- Ewl_Filepicker *fp;
- char *name;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- fp = data;
- name = ewl_text_text_get(EWL_TEXT(w));
-
- if (!name)
- DRETURN(DLEVEL_STABLE);
-
- ewl_filepicker_filter_add(fp, name, name, NULL);
- ewl_filepicker_cb_type_change(fp->mvc_filters.combo, NULL, fp);
- FREE(name);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Filepicker *fp;
+ char *name;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ fp = data;
+ name = ewl_text_text_get(EWL_TEXT(w));
+
+ if (!name)
+ DRETURN(DLEVEL_STABLE);
+
+ ewl_filepicker_filter_add(fp, name, name, NULL);
+ ewl_filepicker_cb_type_change(fp->mvc_filters.combo, NULL, fp);
+ FREE(name);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_filepicker_cb_path_entry_change(Ewl_Widget *w, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Filepicker *fp;
- char *path;
+ Ewl_Filepicker *fp;
+ char *path;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- fp = data;
- path = ewl_text_text_get(EWL_TEXT(w));
+ fp = data;
+ path = ewl_text_text_get(EWL_TEXT(w));
- if (!path)
- DRETURN(DLEVEL_STABLE);
+ if (!path)
+ DRETURN(DLEVEL_STABLE);
- ewl_filepicker_directory_set(fp, path);
- FREE(path);
+ ewl_filepicker_directory_set(fp, path);
+ FREE(path);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_filepicker_cb_type_change(Ewl_Widget *w, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Filepicker *fp;
- Ewl_Filelist_Filter *filter;
- Ewl_Selection_Idx *idx;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- fp = data;
- idx = ewl_mvc_selected_get(EWL_MVC(w));
- if (idx)
- {
- ecore_list_index_goto(fp->filters, idx->row);
- filter = ecore_list_current(fp->filters);
- ewl_filelist_filter_set(EWL_FILELIST(fp->file_list), filter);
- }
-
- FREE(idx);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Filepicker *fp;
+ Ewl_Filelist_Filter *filter;
+ Ewl_Selection_Idx *idx;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ fp = data;
+ idx = ewl_mvc_selected_get(EWL_MVC(w));
+ if (idx)
+ {
+ ecore_list_index_goto(fp->filters, idx->row);
+ filter = ecore_list_current(fp->filters);
+ ewl_filelist_filter_set(EWL_FILELIST(fp->file_list), filter);
+ }
+
+ FREE(idx);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_filepicker_cb_destroy(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Filepicker *fp;
+ Ewl_Filepicker *fp;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- fp = EWL_FILEPICKER(w);
+ fp = EWL_FILEPICKER(w);
- IF_FREE(fp->mvc_path.model);
- IF_FREE(fp->mvc_path.view);
- IF_FREE(fp->mvc_filters.model);
- IF_FREE(fp->mvc_filters.view);
- IF_FREE_LIST(fp->path);
- IF_FREE_LIST(fp->filters);
+ IF_FREE(fp->mvc_path.model);
+ IF_FREE(fp->mvc_path.view);
+ IF_FREE(fp->mvc_filters.model);
+ IF_FREE(fp->mvc_filters.view);
+ IF_FREE_LIST(fp->path);
+ IF_FREE_LIST(fp->filters);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_filepicker_filter_free_cb(Ewl_Filelist_Filter *filter)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- if (!filter) DRETURN(DLEVEL_STABLE);
+ if (!filter) DRETURN(DLEVEL_STABLE);
- IF_FREE(filter->name);
- IF_FREE(filter->extension);
- IF_FREE_LIST(filter->mime_list);
+ IF_FREE(filter->name);
+ IF_FREE(filter->extension);
+ IF_FREE_LIST(filter->mime_list);
- FREE(filter);
+ FREE(filter);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_filepicker_cb_dir_new(Ewl_Widget *w, void *ev,
- void *data)
+ void *data)
{
- Ewl_Widget *d;
- Ewl_Embed *win;
- Ewl_Widget *o;
- Ewl_Widget *box;
- const char *path;
- Ewl_Filepicker_Dialog *resp;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
-
- resp = NEW(Ewl_Filepicker_Dialog, 1);
- win = ewl_embed_widget_find(w);
-
- d = ewl_dialog_new();
- ewl_window_title_set(EWL_WINDOW(d), "Create New Folder");
- ewl_window_name_set(EWL_WINDOW(d), "Create New Folder");
- ewl_window_class_set(EWL_WINDOW(d), "Create New Folder");
- ewl_window_transient_for_foreign(EWL_WINDOW(d), win->canvas_window);
- ewl_callback_append(d, EWL_CALLBACK_DELETE_WINDOW,
- ewl_filepicker_cb_dialog_delete, resp);
- ewl_object_fill_policy_set(EWL_OBJECT(d), EWL_FLAG_FILL_NONE);
- ewl_dialog_active_area_set(EWL_DIALOG(d), EWL_POSITION_TOP);
- ewl_widget_show(d);
-
- box = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(d), box);
- ewl_object_padding_set(EWL_OBJECT(box), 5, 5, 5, 0);
- ewl_widget_show(box);
-
- path = ewl_icon_theme_icon_path_get(EWL_ICON_FOLDER_NEW,
- 32);
- o = ewl_image_new();
- if (path) ewl_image_file_path_set(EWL_IMAGE(o), path);
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_widget_show(o);
-
- o = ewl_entry_new();
- ewl_text_text_set(EWL_TEXT(o), "New Folder");
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
- ewl_filepicker_cb_dialog_response, resp);
- ewl_widget_show(o);
-
- ewl_dialog_active_area_set(EWL_DIALOG(d), EWL_POSITION_BOTTOM);
- resp->fp = EWL_FILEPICKER(data);
- resp->d = d;
- resp->e = o;
-
- o = ewl_button_new();
- ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_OK);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_filepicker_cb_dialog_response, resp);
- ewl_container_child_append(EWL_CONTAINER(d), o);
- ewl_widget_show(o);
-
- o = ewl_button_new();
- ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_CANCEL);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_filepicker_cb_dialog_response, resp);
- ewl_container_child_append(EWL_CONTAINER(d), o);
- ewl_widget_show(o);
+ Ewl_Widget *d;
+ Ewl_Embed *win;
+ Ewl_Widget *o;
+ Ewl_Widget *box;
+ const char *path;
+ Ewl_Filepicker_Dialog *resp;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+
+ resp = NEW(Ewl_Filepicker_Dialog, 1);
+ win = ewl_embed_widget_find(w);
+
+ d = ewl_dialog_new();
+ ewl_window_title_set(EWL_WINDOW(d), "Create New Folder");
+ ewl_window_name_set(EWL_WINDOW(d), "Create New Folder");
+ ewl_window_class_set(EWL_WINDOW(d), "Create New Folder");
+ ewl_window_transient_for_foreign(EWL_WINDOW(d), win->canvas_window);
+ ewl_callback_append(d, EWL_CALLBACK_DELETE_WINDOW,
+ ewl_filepicker_cb_dialog_delete, resp);
+ ewl_object_fill_policy_set(EWL_OBJECT(d), EWL_FLAG_FILL_NONE);
+ ewl_dialog_active_area_set(EWL_DIALOG(d), EWL_POSITION_TOP);
+ ewl_widget_show(d);
+
+ box = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(d), box);
+ ewl_object_padding_set(EWL_OBJECT(box), 5, 5, 5, 0);
+ ewl_widget_show(box);
+
+ path = ewl_icon_theme_icon_path_get(EWL_ICON_FOLDER_NEW,
+ 32);
+ o = ewl_image_new();
+ if (path) ewl_image_file_path_set(EWL_IMAGE(o), path);
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_widget_show(o);
+
+ o = ewl_entry_new();
+ ewl_text_text_set(EWL_TEXT(o), "New Folder");
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
+ ewl_filepicker_cb_dialog_response, resp);
+ ewl_widget_show(o);
+
+ ewl_dialog_active_area_set(EWL_DIALOG(d), EWL_POSITION_BOTTOM);
+ resp->fp = EWL_FILEPICKER(data);
+ resp->d = d;
+ resp->e = o;
+
+ o = ewl_button_new();
+ ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_OK);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_filepicker_cb_dialog_response, resp);
+ ewl_container_child_append(EWL_CONTAINER(d), o);
+ ewl_widget_show(o);
+
+ o = ewl_button_new();
+ ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_CANCEL);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_filepicker_cb_dialog_response, resp);
+ ewl_container_child_append(EWL_CONTAINER(d), o);
+ ewl_widget_show(o);
}
static void
ewl_filepicker_cb_dialog_delete(Ewl_Widget *w, void *ev,
- void *data)
+ void *data)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_widget_destroy(w);
- FREE(data);
+ ewl_widget_destroy(w);
+ FREE(data);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_filepicker_cb_dialog_response(Ewl_Widget *w, void *ev,
- void *data)
+ void *data)
{
- Ewl_Filepicker_Dialog *resp;
- const char *path;
- char *name, res[PATH_MAX];
- Ewl_Stock_Type response;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- resp = data;
-
- /* There is a callback on the entry that calls this */
- if (ewl_widget_type_is(w, EWL_STOCK_TYPE))
- response = ewl_stock_type_get(EWL_STOCK(w));
- else
- response = EWL_STOCK_OK;
-
- name = ewl_text_text_get(EWL_TEXT(resp->e));
-
- if ((response == EWL_STOCK_CANCEL) || (!name))
- {
- ewl_widget_destroy(resp->d);
- FREE(resp);
- DRETURN(DLEVEL_STABLE);
- }
-
- path = ewl_filelist_directory_get(EWL_FILELIST(resp->fp->file_list));
-
- if (name[0] == '/')
- snprintf(res, PATH_MAX, "%s%s", path, name);
- else
- snprintf(res, PATH_MAX, "%s/%s", path, name);
-
- if (ecore_file_mkpath(res))
- ewl_filepicker_directory_set(EWL_FILEPICKER(resp->fp), res);
-
- ewl_widget_destroy(resp->d);
- FREE(name);
- FREE(resp);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Filepicker_Dialog *resp;
+ const char *path;
+ char *name, res[PATH_MAX];
+ Ewl_Stock_Type response;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ resp = data;
+
+ /* There is a callback on the entry that calls this */
+ if (ewl_widget_type_is(w, EWL_STOCK_TYPE))
+ response = ewl_stock_type_get(EWL_STOCK(w));
+ else
+ response = EWL_STOCK_OK;
+
+ name = ewl_text_text_get(EWL_TEXT(resp->e));
+
+ if ((response == EWL_STOCK_CANCEL) || (!name))
+ {
+ ewl_widget_destroy(resp->d);
+ FREE(resp);
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ path = ewl_filelist_directory_get(EWL_FILELIST(resp->fp->file_list));
+
+ if (name[0] == '/')
+ snprintf(res, PATH_MAX, "%s%s", path, name);
+ else
+ snprintf(res, PATH_MAX, "%s/%s", path, name);
+
+ if (ecore_file_mkpath(res))
+ ewl_filepicker_directory_set(EWL_FILEPICKER(resp->fp), res);
+
+ ewl_widget_destroy(resp->d);
+ FREE(name);
+ FREE(resp);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_filepicker.h b/src/lib/ewl_filepicker.h
index 478e5a3..7ccce35 100644
--- a/src/lib/ewl_filepicker.h
+++ b/src/lib/ewl_filepicker.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_FILEPICKER_H
#define EWL_FILEPICKER_H
@@ -47,78 +47,78 @@ typedef struct Ewl_Filepicker Ewl_Filepicker;
*/
struct Ewl_Filepicker
{
- Ewl_Box box; /**< Inherit from Ewl_Box */
+ Ewl_Box box; /**< Inherit from Ewl_Box */
- Ewl_Widget *file_list; /**< The file list widet */
+ Ewl_Widget *file_list; /**< The file list widet */
- Ewl_Widget *type_combo; /**< File type combo */
- Ewl_Widget *file_entry; /**< Filename entry box */
- Ewl_Widget *favorites_box; /**< Favoirte directory box */
- Ewl_Widget *path_combo; /**< Path combo box */
- Ewl_Widget *dir_button; /**< Button to create a directory */
- Ewl_Widget *ret_button; /**< The save/open button */
+ Ewl_Widget *type_combo; /**< File type combo */
+ Ewl_Widget *file_entry; /**< Filename entry box */
+ Ewl_Widget *favorites_box; /**< Favoirte directory box */
+ Ewl_Widget *path_combo; /**< Path combo box */
+ Ewl_Widget *dir_button; /**< Button to create a directory */
+ Ewl_Widget *ret_button; /**< The save/open button */
- Ecore_List *path; /**< The path components */
- Ecore_List *filters; /**< The type filters */
+ Ecore_List *path; /**< The path components */
+ Ecore_List *filters; /**< The type filters */
- struct
- {
- Ewl_Model *model;
- Ewl_View *view;
- Ewl_Widget *combo;
- } mvc_filters, mvc_path;
+ struct
+ {
+ Ewl_Model *model;
+ Ewl_View *view;
+ Ewl_Widget *combo;
+ } mvc_filters, mvc_path;
- unsigned char show_favorites:1; /**< Show the favorite box */
- unsigned char saveas_dialog:1; /**< Open or save dialog */
- unsigned char ret_dir:1; /**< Allow directories to be returned */
+ unsigned char show_favorites:1; /**< Show the favorite box */
+ unsigned char saveas_dialog:1; /**< Open or save dialog */
+ unsigned char ret_dir:1; /**< Allow directories to be returned */
};
-Ewl_Widget *ewl_filepicker_new(void);
-int ewl_filepicker_init(Ewl_Filepicker *fp);
+Ewl_Widget *ewl_filepicker_new(void);
+int ewl_filepicker_init(Ewl_Filepicker *fp);
-void ewl_filepicker_directory_set(Ewl_Filepicker *fp,
- const char *dir);
-const char *ewl_filepicker_directory_get(Ewl_Filepicker *fp);
+void ewl_filepicker_directory_set(Ewl_Filepicker *fp,
+ const char *dir);
+const char *ewl_filepicker_directory_get(Ewl_Filepicker *fp);
-void ewl_filepicker_filter_set(Ewl_Filepicker *fp,
- Ewl_Filelist_Filter *filter);
-Ewl_Filelist_Filter *ewl_filepicker_filter_get(Ewl_Filepicker *fp);
+void ewl_filepicker_filter_set(Ewl_Filepicker *fp,
+ Ewl_Filelist_Filter *filter);
+Ewl_Filelist_Filter *ewl_filepicker_filter_get(Ewl_Filepicker *fp);
-void ewl_filepicker_multiselect_set(Ewl_Filepicker *fp,
- unsigned int ms);
-unsigned int ewl_filepicker_multiselect_get(Ewl_Filepicker *fp);
+void ewl_filepicker_multiselect_set(Ewl_Filepicker *fp,
+ unsigned int ms);
+unsigned int ewl_filepicker_multiselect_get(Ewl_Filepicker *fp);
-void ewl_filepicker_show_dot_files_set(Ewl_Filepicker *fp,
- unsigned int dot);
-unsigned int ewl_filepicker_show_dot_files_get(Ewl_Filepicker *fp);
+void ewl_filepicker_show_dot_files_set(Ewl_Filepicker *fp,
+ unsigned int dot);
+unsigned int ewl_filepicker_show_dot_files_get(Ewl_Filepicker *fp);
-void ewl_filepicker_selected_file_set(Ewl_Filepicker *fp,
- const char *file);
-char *ewl_filepicker_selected_file_get(Ewl_Filepicker *fp);
+void ewl_filepicker_selected_file_set(Ewl_Filepicker *fp,
+ const char *file);
+char *ewl_filepicker_selected_file_get(Ewl_Filepicker *fp);
-void ewl_filepicker_selected_files_set(Ewl_Filepicker *fp,
- Ecore_List *files);
-Ecore_List *ewl_filepicker_selected_files_get(Ewl_Filepicker *fp);
+void ewl_filepicker_selected_files_set(Ewl_Filepicker *fp,
+ Ecore_List *files);
+Ecore_List *ewl_filepicker_selected_files_get(Ewl_Filepicker *fp);
-void ewl_filepicker_show_favorites_set(Ewl_Filepicker *fp,
- unsigned int show);
-unsigned int ewl_filepicker_show_favorites_get(Ewl_Filepicker *fp);
+void ewl_filepicker_show_favorites_set(Ewl_Filepicker *fp,
+ unsigned int show);
+unsigned int ewl_filepicker_show_favorites_get(Ewl_Filepicker *fp);
-void ewl_filepicker_list_view_set(Ewl_Filepicker *fp,
- Ewl_Filelist_View view);
+void ewl_filepicker_list_view_set(Ewl_Filepicker *fp,
+ Ewl_Filelist_View view);
Ewl_Filelist_View *ewl_filepicker_list_view_get(Ewl_Filepicker *fp);
-Ewl_Filelist_Filter *ewl_filepicker_filter_add(Ewl_Filepicker *fp,
- const char *name,
- const char *extension,
- Ecore_List *mime_types);
-void ewl_filepicker_save_as_set(Ewl_Filepicker *fp,
- unsigned int t);
-unsigned int ewl_filepicker_save_as_get(Ewl_Filepicker *fp);
-void ewl_filepicker_return_directories_set(Ewl_Filepicker *fp,
- unsigned int t);
-unsigned int ewl_filepicker_return_directories_get(Ewl_Filepicker *fp);
+Ewl_Filelist_Filter *ewl_filepicker_filter_add(Ewl_Filepicker *fp,
+ const char *name,
+ const char *extension,
+ Ecore_List *mime_types);
+void ewl_filepicker_save_as_set(Ewl_Filepicker *fp,
+ unsigned int t);
+unsigned int ewl_filepicker_save_as_get(Ewl_Filepicker *fp);
+void ewl_filepicker_return_directories_set(Ewl_Filepicker *fp,
+ unsigned int t);
+unsigned int ewl_filepicker_return_directories_get(Ewl_Filepicker *fp);
Ewl_Widget *ewl_filepicker_save_as_new(void);
/**
* @}
diff --git a/src/lib/ewl_floater.c b/src/lib/ewl_floater.c
index 48dbdb4..8e8f942 100644
--- a/src/lib/ewl_floater.c
+++ b/src/lib/ewl_floater.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_floater.h"
#include "ewl_macros.h"
@@ -12,20 +12,20 @@
Ewl_Widget *
ewl_floater_new(void)
{
- Ewl_Widget *f;
+ Ewl_Widget *f;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- f = NEW(Ewl_Floater, 1);
- if (!f)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ f = NEW(Ewl_Floater, 1);
+ if (!f)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_floater_init(EWL_FLOATER(f))) {
- ewl_widget_destroy(f);
- f = NULL;
- }
+ if (!ewl_floater_init(EWL_FLOATER(f))) {
+ ewl_widget_destroy(f);
+ f = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(f), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(f), DLEVEL_STABLE);
}
/**
@@ -38,31 +38,31 @@ ewl_floater_new(void)
int
ewl_floater_init(Ewl_Floater *f)
{
- Ewl_Widget *w;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(f, FALSE);
-
- w = EWL_WIDGET(f);
-
- /*
- * Initialize the inherited box fields, set the fill policy to
- * normal, and the widget to follow.
- */
- if (!ewl_box_init(EWL_BOX(w))) {
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
-
- ewl_box_orientation_set(EWL_BOX(w), EWL_ORIENTATION_VERTICAL);
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NORMAL);
- ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_LEFT
- | EWL_FLAG_ALIGN_TOP);
- ewl_widget_appearance_set(w, EWL_FLOATER_TYPE);
- ewl_widget_inherit(w, EWL_FLOATER_TYPE);
- ewl_callback_prepend(w, EWL_CALLBACK_DESTROY,
- ewl_floater_cb_destroy, NULL);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Widget *w;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(f, FALSE);
+
+ w = EWL_WIDGET(f);
+
+ /*
+ * Initialize the inherited box fields, set the fill policy to
+ * normal, and the widget to follow.
+ */
+ if (!ewl_box_init(EWL_BOX(w))) {
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+
+ ewl_box_orientation_set(EWL_BOX(w), EWL_ORIENTATION_VERTICAL);
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NORMAL);
+ ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_LEFT
+ | EWL_FLAG_ALIGN_TOP);
+ ewl_widget_appearance_set(w, EWL_FLOATER_TYPE);
+ ewl_widget_inherit(w, EWL_FLOATER_TYPE);
+ ewl_callback_prepend(w, EWL_CALLBACK_DESTROY,
+ ewl_floater_cb_destroy, NULL);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -74,38 +74,38 @@ ewl_floater_init(Ewl_Floater *f)
void
ewl_floater_follow_set(Ewl_Floater *f, Ewl_Widget *p)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(f);
- DCHECK_TYPE(f, EWL_FLOATER_TYPE);
- DCHECK_TYPE(p, EWL_WIDGET_TYPE);
-
- /*
- * Don't follow the old parent.
- */
- if (f->follows) {
- ewl_callback_del_with_data(f->follows, EWL_CALLBACK_CONFIGURE,
- ewl_floater_cb_follow_configure, f);
- ewl_callback_del_with_data(EWL_WIDGET(f->follows),
- EWL_CALLBACK_DESTROY,
- ewl_floater_cb_follow_destroy, f);
- }
-
- /*
- * Need to add callbacks to the window that contains it as well the
- * widget it follows, if they are not the same.
- */
- if (p) {
- ewl_callback_append(p, EWL_CALLBACK_CONFIGURE,
- ewl_floater_cb_follow_configure, f);
- ewl_callback_prepend(p, EWL_CALLBACK_DESTROY,
- ewl_floater_cb_follow_destroy, f);
- }
-
- f->follows = p;
-
- ewl_widget_configure(EWL_WIDGET(f));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(f);
+ DCHECK_TYPE(f, EWL_FLOATER_TYPE);
+ DCHECK_TYPE(p, EWL_WIDGET_TYPE);
+
+ /*
+ * Don't follow the old parent.
+ */
+ if (f->follows) {
+ ewl_callback_del_with_data(f->follows, EWL_CALLBACK_CONFIGURE,
+ ewl_floater_cb_follow_configure, f);
+ ewl_callback_del_with_data(EWL_WIDGET(f->follows),
+ EWL_CALLBACK_DESTROY,
+ ewl_floater_cb_follow_destroy, f);
+ }
+
+ /*
+ * Need to add callbacks to the window that contains it as well the
+ * widget it follows, if they are not the same.
+ */
+ if (p) {
+ ewl_callback_append(p, EWL_CALLBACK_CONFIGURE,
+ ewl_floater_cb_follow_configure, f);
+ ewl_callback_prepend(p, EWL_CALLBACK_DESTROY,
+ ewl_floater_cb_follow_destroy, f);
+ }
+
+ f->follows = p;
+
+ ewl_widget_configure(EWL_WIDGET(f));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -116,11 +116,11 @@ ewl_floater_follow_set(Ewl_Floater *f, Ewl_Widget *p)
Ewl_Widget *
ewl_floater_follow_get(Ewl_Floater *f)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(f, NULL);
- DCHECK_TYPE_RET(f, EWL_FLOATER_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(f, NULL);
+ DCHECK_TYPE_RET(f, EWL_FLOATER_TYPE, NULL);
- DRETURN_PTR(f->follows, DLEVEL_STABLE);
+ DRETURN_PTR(f->follows, DLEVEL_STABLE);
}
/**
@@ -133,26 +133,26 @@ ewl_floater_follow_get(Ewl_Floater *f)
void
ewl_floater_position_set(Ewl_Floater *f, int x, int y)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(f);
- DCHECK_TYPE(f, EWL_FLOATER_TYPE);
-
- if (x == f->x && y == f->y)
- DRETURN(DLEVEL_STABLE);
-
- /*
- * Set the coordinates of the floater, this will be used for either
- * absolute or relative positioning.
- */
- f->x = x;
- f->y = y;
-
- if (f->follows)
- ewl_widget_configure(f->follows);
- else
- ewl_object_position_request(EWL_OBJECT(f), f->x, f->y);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(f);
+ DCHECK_TYPE(f, EWL_FLOATER_TYPE);
+
+ if (x == f->x && y == f->y)
+ DRETURN(DLEVEL_STABLE);
+
+ /*
+ * Set the coordinates of the floater, this will be used for either
+ * absolute or relative positioning.
+ */
+ f->x = x;
+ f->y = y;
+
+ if (f->follows)
+ ewl_widget_configure(f->follows);
+ else
+ ewl_object_position_request(EWL_OBJECT(f), f->x, f->y);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -167,29 +167,29 @@ ewl_floater_position_set(Ewl_Floater *f, int x, int y)
void
ewl_floater_relative_set(Ewl_Floater *f, Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(f);
- DCHECK_TYPE(f, EWL_FLOATER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(f);
+ DCHECK_TYPE(f, EWL_FLOATER_TYPE);
- if (f->follows == w)
- DRETURN(DLEVEL_STABLE);
+ if (f->follows == w)
+ DRETURN(DLEVEL_STABLE);
- /*
- * Remove the callback attached to the configure event for the
- * followed widget.
- */
- if (f->follows)
- ewl_callback_del(f->follows, EWL_CALLBACK_CONFIGURE,
- ewl_floater_cb_follow_configure);
+ /*
+ * Remove the callback attached to the configure event for the
+ * followed widget.
+ */
+ if (f->follows)
+ ewl_callback_del(f->follows, EWL_CALLBACK_CONFIGURE,
+ ewl_floater_cb_follow_configure);
- /*
- * Set the widget that the floater follows.
- */
- f->follows = w;
+ /*
+ * Set the widget that the floater follows.
+ */
+ f->follows = w;
- ewl_widget_configure(EWL_WIDGET(w));
+ ewl_widget_configure(EWL_WIDGET(w));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -202,15 +202,15 @@ ewl_floater_relative_set(Ewl_Floater *f, Ewl_Widget *w)
*/
void
ewl_floater_cb_destroy(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_FLOATER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_FLOATER_TYPE);
- ewl_floater_follow_set(EWL_FLOATER(w), NULL);
+ ewl_floater_follow_set(EWL_FLOATER(w), NULL);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -224,59 +224,59 @@ ewl_floater_cb_destroy(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_floater_cb_follow_configure(Ewl_Widget *w __UNUSED__,
- void *ev_data __UNUSED__, void *user_data)
+ void *ev_data __UNUSED__, void *user_data)
{
- int align, x, y;
- Ewl_Floater *f;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(user_data);
- DCHECK_TYPE(user_data, EWL_FLOATER_TYPE);
-
- f = EWL_FLOATER(user_data);
-
- /*
- * Determine actual coordinates based on absolute or relative
- * positioning.
- */
- if (f->follows) {
- x = ewl_object_current_x_get(EWL_OBJECT(f->follows)) + f->x;
- y = ewl_object_current_y_get(EWL_OBJECT(f->follows)) + f->y;
- } else {
- x = f->x;
- y = f->y;
- }
-
- /*
- * Store the alignment in a temporary variable for fast access to
- * determine positioning.
- */
- align = ewl_object_alignment_get(EWL_OBJECT(f));
-
- /*
- * Determine the horizontal placement of the widget based on alignment
- */
- if (align & EWL_FLAG_ALIGN_RIGHT) {
- x -= CURRENT_W(f);
- } else if (!(align & EWL_FLAG_ALIGN_LEFT)) {
- x -= CURRENT_W(f) / 2;
- }
-
- /*
- * Determine the vertical placement of the widget based on alignment
- */
- if (align & EWL_FLAG_ALIGN_BOTTOM) {
- y -= CURRENT_H(f);
- } else if (!(align & EWL_FLAG_ALIGN_TOP)) {
- y -= CURRENT_H(f) / 2;
- }
-
- /*
- * Now request the calculated coordinates for the floater.
- */
- ewl_object_position_request(EWL_OBJECT(f), x, y);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int align, x, y;
+ Ewl_Floater *f;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(user_data);
+ DCHECK_TYPE(user_data, EWL_FLOATER_TYPE);
+
+ f = EWL_FLOATER(user_data);
+
+ /*
+ * Determine actual coordinates based on absolute or relative
+ * positioning.
+ */
+ if (f->follows) {
+ x = ewl_object_current_x_get(EWL_OBJECT(f->follows)) + f->x;
+ y = ewl_object_current_y_get(EWL_OBJECT(f->follows)) + f->y;
+ } else {
+ x = f->x;
+ y = f->y;
+ }
+
+ /*
+ * Store the alignment in a temporary variable for fast access to
+ * determine positioning.
+ */
+ align = ewl_object_alignment_get(EWL_OBJECT(f));
+
+ /*
+ * Determine the horizontal placement of the widget based on alignment
+ */
+ if (align & EWL_FLAG_ALIGN_RIGHT) {
+ x -= CURRENT_W(f);
+ } else if (!(align & EWL_FLAG_ALIGN_LEFT)) {
+ x -= CURRENT_W(f) / 2;
+ }
+
+ /*
+ * Determine the vertical placement of the widget based on alignment
+ */
+ if (align & EWL_FLAG_ALIGN_BOTTOM) {
+ y -= CURRENT_H(f);
+ } else if (!(align & EWL_FLAG_ALIGN_TOP)) {
+ y -= CURRENT_H(f) / 2;
+ }
+
+ /*
+ * Now request the calculated coordinates for the floater.
+ */
+ ewl_object_position_request(EWL_OBJECT(f), x, y);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -289,14 +289,14 @@ ewl_floater_cb_follow_configure(Ewl_Widget *w __UNUSED__,
*/
void
ewl_floater_cb_follow_destroy(Ewl_Widget *w __UNUSED__ ,
- void *ev_data __UNUSED__, void *user_data)
+ void *ev_data __UNUSED__, void *user_data)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(user_data);
- DCHECK_TYPE(user_data, EWL_FLOATER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(user_data);
+ DCHECK_TYPE(user_data, EWL_FLOATER_TYPE);
- EWL_FLOATER(user_data)->follows = NULL;
+ EWL_FLOATER(user_data)->follows = NULL;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_floater.h b/src/lib/ewl_floater.h
index 4eacf4b..b6768af 100644
--- a/src/lib/ewl_floater.h
+++ b/src/lib/ewl_floater.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_FLOATER_H
#define EWL_FLOATER_H
@@ -52,27 +52,27 @@ typedef struct Ewl_Floater Ewl_Floater;
*/
struct Ewl_Floater
{
- Ewl_Box box; /**< Inherit from Ewl_Box */
- Ewl_Widget *follows; /**< The widget to position relative to */
- int x; /**< The x offset from follows x positon */
- int y; /**< The y offset from follows y positon */
+ Ewl_Box box; /**< Inherit from Ewl_Box */
+ Ewl_Widget *follows; /**< The widget to position relative to */
+ int x; /**< The x offset from follows x positon */
+ int y; /**< The y offset from follows y positon */
};
-Ewl_Widget *ewl_floater_new(void);
-int ewl_floater_init(Ewl_Floater *f);
-void ewl_floater_follow_set(Ewl_Floater *f, Ewl_Widget *p);
-Ewl_Widget *ewl_floater_follow_get(Ewl_Floater *f);
-void ewl_floater_position_set(Ewl_Floater *parent, int x, int y);
+Ewl_Widget *ewl_floater_new(void);
+int ewl_floater_init(Ewl_Floater *f);
+void ewl_floater_follow_set(Ewl_Floater *f, Ewl_Widget *p);
+Ewl_Widget *ewl_floater_follow_get(Ewl_Floater *f);
+void ewl_floater_position_set(Ewl_Floater *parent, int x, int y);
/*
* Internally used callbacks, override at your own risk.
*/
void ewl_floater_cb_destroy(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_floater_cb_follow_configure(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
void ewl_floater_cb_follow_destroy(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
/**
* @}
diff --git a/src/lib/ewl_freebox.c b/src/lib/ewl_freebox.c
index be3b0d5..3610d59 100644
--- a/src/lib/ewl_freebox.c
+++ b/src/lib/ewl_freebox.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_freebox.h"
#include "ewl_macros.h"
@@ -34,9 +34,9 @@ static void ewl_freebox_layout_comparator(Ewl_Freebox *fb);
Ewl_Widget *
ewl_hfreebox_new(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- DRETURN_PTR(ewl_freebox_new(), DLEVEL_STABLE);
+ DRETURN_PTR(ewl_freebox_new(), DLEVEL_STABLE);
}
/**
@@ -46,14 +46,14 @@ ewl_hfreebox_new(void)
Ewl_Widget *
ewl_vfreebox_new(void)
{
- Ewl_Widget *fb;
+ Ewl_Widget *fb;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- fb = ewl_freebox_new();
- EWL_FREEBOX(fb)->orientation = EWL_ORIENTATION_VERTICAL;
+ fb = ewl_freebox_new();
+ EWL_FREEBOX(fb)->orientation = EWL_ORIENTATION_VERTICAL;
- DRETURN_PTR(fb, DLEVEL_STABLE);
+ DRETURN_PTR(fb, DLEVEL_STABLE);
}
/**
@@ -63,21 +63,21 @@ ewl_vfreebox_new(void)
Ewl_Widget *
ewl_freebox_new(void)
{
- Ewl_Widget *fb;
+ Ewl_Widget *fb;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- fb = NEW(Ewl_Freebox, 1);
- if (!fb)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ fb = NEW(Ewl_Freebox, 1);
+ if (!fb)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_freebox_init(EWL_FREEBOX(fb)))
- {
- ewl_widget_destroy(fb);
- fb = NULL;
- }
+ if (!ewl_freebox_init(EWL_FREEBOX(fb)))
+ {
+ ewl_widget_destroy(fb);
+ fb = NULL;
+ }
- DRETURN_PTR(fb, DLEVEL_STABLE);
+ DRETURN_PTR(fb, DLEVEL_STABLE);
}
/**
@@ -88,28 +88,28 @@ ewl_freebox_new(void)
int
ewl_freebox_init(Ewl_Freebox *fb)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fb, TRUE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fb, TRUE);
- if (!ewl_container_init(EWL_CONTAINER(fb)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_container_init(EWL_CONTAINER(fb)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_appearance_set(EWL_WIDGET(fb), EWL_FREEBOX_TYPE);
- ewl_widget_inherit(EWL_WIDGET(fb), EWL_FREEBOX_TYPE);
+ ewl_widget_appearance_set(EWL_WIDGET(fb), EWL_FREEBOX_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(fb), EWL_FREEBOX_TYPE);
- ewl_callback_append(EWL_WIDGET(fb), EWL_CALLBACK_CONFIGURE,
- ewl_freebox_cb_configure, NULL);
- ewl_container_add_notify_set(EWL_CONTAINER(fb),
- ewl_freebox_cb_child_add);
- ewl_container_show_notify_set(EWL_CONTAINER(fb),
- ewl_freebox_cb_child_show);
+ ewl_callback_append(EWL_WIDGET(fb), EWL_CALLBACK_CONFIGURE,
+ ewl_freebox_cb_configure, NULL);
+ ewl_container_add_notify_set(EWL_CONTAINER(fb),
+ ewl_freebox_cb_child_add);
+ ewl_container_show_notify_set(EWL_CONTAINER(fb),
+ ewl_freebox_cb_child_show);
- fb->layout = EWL_FREEBOX_LAYOUT_AUTO;
- fb->orientation = EWL_ORIENTATION_HORIZONTAL;
+ fb->layout = EWL_FREEBOX_LAYOUT_AUTO;
+ fb->orientation = EWL_ORIENTATION_HORIZONTAL;
- ewl_widget_focusable_set(EWL_WIDGET(fb), FALSE);
+ ewl_widget_focusable_set(EWL_WIDGET(fb), FALSE);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -121,17 +121,17 @@ ewl_freebox_init(Ewl_Freebox *fb)
void
ewl_freebox_orientation_set(Ewl_Freebox *fb, Ewl_Orientation orientation)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fb);
- DCHECK_TYPE(fb, EWL_FREEBOX_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fb);
+ DCHECK_TYPE(fb, EWL_FREEBOX_TYPE);
- if (orientation == fb->orientation)
- DRETURN(DLEVEL_STABLE);
+ if (orientation == fb->orientation)
+ DRETURN(DLEVEL_STABLE);
- fb->orientation = orientation;
- ewl_widget_configure(EWL_WIDGET(fb));
+ fb->orientation = orientation;
+ ewl_widget_configure(EWL_WIDGET(fb));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -142,12 +142,12 @@ ewl_freebox_orientation_set(Ewl_Freebox *fb, Ewl_Orientation orientation)
Ewl_Orientation
ewl_freebox_orientation_get(Ewl_Freebox *fb)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fb, EWL_ORIENTATION_HORIZONTAL);
- DCHECK_TYPE_RET(fb, EWL_FREEBOX_TYPE,
- EWL_ORIENTATION_HORIZONTAL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fb, EWL_ORIENTATION_HORIZONTAL);
+ DCHECK_TYPE_RET(fb, EWL_FREEBOX_TYPE,
+ EWL_ORIENTATION_HORIZONTAL);
- DRETURN_INT(fb->orientation, DLEVEL_STABLE);
+ DRETURN_INT(fb->orientation, DLEVEL_STABLE);
}
/**
@@ -159,17 +159,17 @@ ewl_freebox_orientation_get(Ewl_Freebox *fb)
void
ewl_freebox_layout_type_set(Ewl_Freebox *fb, Ewl_Freebox_Layout_Type type)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fb);
- DCHECK_TYPE(fb, EWL_FREEBOX_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fb);
+ DCHECK_TYPE(fb, EWL_FREEBOX_TYPE);
- if (fb->layout == type)
- DRETURN(DLEVEL_STABLE);
+ if (fb->layout == type)
+ DRETURN(DLEVEL_STABLE);
- fb->layout = type;
- ewl_widget_configure(EWL_WIDGET(fb));
+ fb->layout = type;
+ ewl_widget_configure(EWL_WIDGET(fb));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -180,11 +180,11 @@ ewl_freebox_layout_type_set(Ewl_Freebox *fb, Ewl_Freebox_Layout_Type type)
Ewl_Freebox_Layout_Type
ewl_freebox_layout_type_get(Ewl_Freebox *fb)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fb, EWL_FREEBOX_LAYOUT_AUTO);
- DCHECK_TYPE_RET(fb, EWL_FREEBOX_TYPE, EWL_FREEBOX_LAYOUT_AUTO);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fb, EWL_FREEBOX_LAYOUT_AUTO);
+ DCHECK_TYPE_RET(fb, EWL_FREEBOX_TYPE, EWL_FREEBOX_LAYOUT_AUTO);
- DRETURN_INT(fb->layout, DLEVEL_STABLE);
+ DRETURN_INT(fb->layout, DLEVEL_STABLE);
}
/**
@@ -196,19 +196,19 @@ ewl_freebox_layout_type_get(Ewl_Freebox *fb)
void
ewl_freebox_comparator_set(Ewl_Freebox *fb, Ewl_Freebox_Comparator cmp)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fb);
- DCHECK_PARAM_PTR(cmp);
- DCHECK_TYPE(fb, EWL_FREEBOX_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fb);
+ DCHECK_PARAM_PTR(cmp);
+ DCHECK_TYPE(fb, EWL_FREEBOX_TYPE);
- if (fb->comparator == cmp)
- DRETURN(DLEVEL_STABLE);
+ if (fb->comparator == cmp)
+ DRETURN(DLEVEL_STABLE);
- fb->comparator = cmp;
- fb->sorted = FALSE;
- ewl_widget_configure(EWL_WIDGET(fb));
+ fb->comparator = cmp;
+ fb->sorted = FALSE;
+ ewl_widget_configure(EWL_WIDGET(fb));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -220,11 +220,11 @@ ewl_freebox_comparator_set(Ewl_Freebox *fb, Ewl_Freebox_Comparator cmp)
Ewl_Freebox_Comparator
ewl_freebox_comparator_get(Ewl_Freebox *fb)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fb, NULL);
- DCHECK_TYPE_RET(fb, EWL_FREEBOX_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fb, NULL);
+ DCHECK_TYPE_RET(fb, EWL_FREEBOX_TYPE, NULL);
- DRETURN_PTR(fb->comparator, DLEVEL_STABLE);
+ DRETURN_PTR(fb->comparator, DLEVEL_STABLE);
}
/**
@@ -237,14 +237,14 @@ ewl_freebox_comparator_get(Ewl_Freebox *fb)
void
ewl_freebox_resort(Ewl_Freebox *fb)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fb);
- DCHECK_TYPE(fb, EWL_FREEBOX_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fb);
+ DCHECK_TYPE(fb, EWL_FREEBOX_TYPE);
- fb->sorted = FALSE;
- ewl_widget_configure(EWL_WIDGET(fb));
+ fb->sorted = FALSE;
+ ewl_widget_configure(EWL_WIDGET(fb));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -257,25 +257,25 @@ ewl_freebox_resort(Ewl_Freebox *fb)
*/
void
ewl_freebox_cb_configure(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Freebox *fb;
+ Ewl_Freebox *fb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_FREEBOX_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_FREEBOX_TYPE);
- fb = EWL_FREEBOX(w);
- if (fb->layout == EWL_FREEBOX_LAYOUT_AUTO)
- ewl_freebox_layout_auto(fb);
+ fb = EWL_FREEBOX(w);
+ if (fb->layout == EWL_FREEBOX_LAYOUT_AUTO)
+ ewl_freebox_layout_auto(fb);
- else if (fb->layout == EWL_FREEBOX_LAYOUT_MANUAL)
- ewl_freebox_layout_manual(fb);
+ else if (fb->layout == EWL_FREEBOX_LAYOUT_MANUAL)
+ ewl_freebox_layout_manual(fb);
- else if (fb->layout == EWL_FREEBOX_LAYOUT_COMPARATOR)
- ewl_freebox_layout_comparator(fb);
+ else if (fb->layout == EWL_FREEBOX_LAYOUT_COMPARATOR)
+ ewl_freebox_layout_comparator(fb);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -288,21 +288,21 @@ ewl_freebox_cb_configure(Ewl_Widget *w, void *ev __UNUSED__,
void
ewl_freebox_cb_child_add(Ewl_Container *c, Ewl_Widget *w __UNUSED__)
{
- Ewl_Freebox *fb;
+ Ewl_Freebox *fb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_FREEBOX_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_FREEBOX_TYPE);
- /* This only does a sorted = FALSE because in the COMPARATOR layout
- * it will remove all of the widgets from the container and
- * re-insert them. So, if we're doing anything more compilcated
- * it'll get all fucked up */
+ /* This only does a sorted = FALSE because in the COMPARATOR layout
+ * it will remove all of the widgets from the container and
+ * re-insert them. So, if we're doing anything more compilcated
+ * it'll get all fucked up */
- fb = EWL_FREEBOX(c);
- fb->sorted = FALSE;
+ fb = EWL_FREEBOX(c);
+ fb->sorted = FALSE;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -315,16 +315,16 @@ ewl_freebox_cb_child_add(Ewl_Container *c, Ewl_Widget *w __UNUSED__)
void
ewl_freebox_cb_child_show(Ewl_Container *c, Ewl_Widget *w __UNUSED__)
{
- Ewl_Freebox *fb;
+ Ewl_Freebox *fb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_FREEBOX_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_FREEBOX_TYPE);
- fb = EWL_FREEBOX(c);
- fb->sorted = FALSE;
+ fb = EWL_FREEBOX(c);
+ fb->sorted = FALSE;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/* This will run through the list of child widgets and lay them out in rows
@@ -332,114 +332,114 @@ ewl_freebox_cb_child_show(Ewl_Container *c, Ewl_Widget *w __UNUSED__)
static void
ewl_freebox_layout_auto(Ewl_Freebox *fb)
{
- Ewl_Container *c;
- Ewl_Widget *child;
- int max_pos, cur_pos = 0, cur_align;
- int base_pos, start_pos, pad = 0, *x, *y;
- int *stable_dir, *grow_dir, child_h, child_w;
- int *column_sizes, *col_size;
-
- void (*pref_inner)(Ewl_Object *obj, int size);
- int (*current_pos)(Ewl_Object *obj);
- int (*current_size)(Ewl_Object *obj);
- int (*current_anchor)(Ewl_Object *obj);
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fb);
- DCHECK_TYPE(fb, EWL_FREEBOX_TYPE);
-
- pad = ewl_theme_data_int_get(EWL_WIDGET(fb),
- "auto/padding");
-
- if (fb->orientation == EWL_ORIENTATION_HORIZONTAL)
- {
- pref_inner = ewl_object_preferred_inner_h_set;
- current_pos = ewl_object_current_x_get;
- current_size = ewl_object_current_w_get;
- current_anchor = ewl_object_current_y_get;
-
- stable_dir = &child_w;
- grow_dir = &child_h;
-
- x = &cur_align;
- y = &cur_pos;
- }
- else
- {
- pref_inner = ewl_object_preferred_inner_w_set;
- current_pos = ewl_object_current_y_get;
- current_size = ewl_object_current_h_get;
- current_anchor = ewl_object_current_x_get;
-
- stable_dir = &child_h;
- grow_dir = &child_w;
-
- x = &cur_pos;
- y = &cur_align;
- }
-
- base_pos = current_pos(EWL_OBJECT(fb));
- max_pos = base_pos + current_size(EWL_OBJECT(fb));
-
- start_pos = cur_pos = current_anchor(EWL_OBJECT(fb));
- cur_align = base_pos;
-
- c = EWL_CONTAINER(fb);
-
- /* determine the column sizes first */
- col_size = column_sizes = NEW(int, ecore_dlist_count(c->children) + 1);
- *col_size = 0;
-
- ecore_dlist_first_goto(c->children);
- while ((child = ecore_dlist_next(c->children)))
- {
- if (!VISIBLE(child) || UNMANAGED(child)) continue;
- ewl_object_preferred_size_get(EWL_OBJECT(child),
- &child_w, &child_h);
-
- /* past end of widget, wrap */
- if ((cur_align + *stable_dir) > max_pos)
- {
- cur_align = base_pos;
- cur_pos += *col_size + pad;
- *(++col_size) = 0;
- }
-
- *col_size = MAX(*col_size, *grow_dir);
- cur_align += *stable_dir + pad;
- }
-
- /* reset the start values */
- cur_pos = start_pos;
- cur_align = base_pos;
- col_size = column_sizes;
-
- /* and now place the children */
- ecore_dlist_first_goto(c->children);
- while ((child = ecore_dlist_next(c->children)))
- {
- if (!VISIBLE(child) || UNMANAGED(child)) continue;
- ewl_object_preferred_size_get(EWL_OBJECT(child),
- &child_w, &child_h);
-
- /* past end of widget, wrap */
- if ((cur_align + *stable_dir) > max_pos)
- {
- cur_align = base_pos;
- cur_pos += *col_size + pad;
- col_size++;
- }
-
- *grow_dir = *col_size;
-
- ewl_object_place(EWL_OBJECT(child), *x, *y, child_w, child_h);
- cur_align += *stable_dir + pad;
- }
- pref_inner(EWL_OBJECT(fb), cur_pos - start_pos + *col_size + pad);
-
- FREE(column_sizes);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Container *c;
+ Ewl_Widget *child;
+ int max_pos, cur_pos = 0, cur_align;
+ int base_pos, start_pos, pad = 0, *x, *y;
+ int *stable_dir, *grow_dir, child_h, child_w;
+ int *column_sizes, *col_size;
+
+ void (*pref_inner)(Ewl_Object *obj, int size);
+ int (*current_pos)(Ewl_Object *obj);
+ int (*current_size)(Ewl_Object *obj);
+ int (*current_anchor)(Ewl_Object *obj);
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fb);
+ DCHECK_TYPE(fb, EWL_FREEBOX_TYPE);
+
+ pad = ewl_theme_data_int_get(EWL_WIDGET(fb),
+ "auto/padding");
+
+ if (fb->orientation == EWL_ORIENTATION_HORIZONTAL)
+ {
+ pref_inner = ewl_object_preferred_inner_h_set;
+ current_pos = ewl_object_current_x_get;
+ current_size = ewl_object_current_w_get;
+ current_anchor = ewl_object_current_y_get;
+
+ stable_dir = &child_w;
+ grow_dir = &child_h;
+
+ x = &cur_align;
+ y = &cur_pos;
+ }
+ else
+ {
+ pref_inner = ewl_object_preferred_inner_w_set;
+ current_pos = ewl_object_current_y_get;
+ current_size = ewl_object_current_h_get;
+ current_anchor = ewl_object_current_x_get;
+
+ stable_dir = &child_h;
+ grow_dir = &child_w;
+
+ x = &cur_pos;
+ y = &cur_align;
+ }
+
+ base_pos = current_pos(EWL_OBJECT(fb));
+ max_pos = base_pos + current_size(EWL_OBJECT(fb));
+
+ start_pos = cur_pos = current_anchor(EWL_OBJECT(fb));
+ cur_align = base_pos;
+
+ c = EWL_CONTAINER(fb);
+
+ /* determine the column sizes first */
+ col_size = column_sizes = NEW(int, ecore_dlist_count(c->children) + 1);
+ *col_size = 0;
+
+ ecore_dlist_first_goto(c->children);
+ while ((child = ecore_dlist_next(c->children)))
+ {
+ if (!VISIBLE(child) || UNMANAGED(child)) continue;
+ ewl_object_preferred_size_get(EWL_OBJECT(child),
+ &child_w, &child_h);
+
+ /* past end of widget, wrap */
+ if ((cur_align + *stable_dir) > max_pos)
+ {
+ cur_align = base_pos;
+ cur_pos += *col_size + pad;
+ *(++col_size) = 0;
+ }
+
+ *col_size = MAX(*col_size, *grow_dir);
+ cur_align += *stable_dir + pad;
+ }
+
+ /* reset the start values */
+ cur_pos = start_pos;
+ cur_align = base_pos;
+ col_size = column_sizes;
+
+ /* and now place the children */
+ ecore_dlist_first_goto(c->children);
+ while ((child = ecore_dlist_next(c->children)))
+ {
+ if (!VISIBLE(child) || UNMANAGED(child)) continue;
+ ewl_object_preferred_size_get(EWL_OBJECT(child),
+ &child_w, &child_h);
+
+ /* past end of widget, wrap */
+ if ((cur_align + *stable_dir) > max_pos)
+ {
+ cur_align = base_pos;
+ cur_pos += *col_size + pad;
+ col_size++;
+ }
+
+ *grow_dir = *col_size;
+
+ ewl_object_place(EWL_OBJECT(child), *x, *y, child_w, child_h);
+ cur_align += *stable_dir + pad;
+ }
+ pref_inner(EWL_OBJECT(fb), cur_pos - start_pos + *col_size + pad);
+
+ FREE(column_sizes);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/* If the widget has been placed, (assuming (x, y) (0, 0) to mean unplaced)
@@ -448,11 +448,11 @@ ewl_freebox_layout_auto(Ewl_Freebox *fb)
static void
ewl_freebox_layout_manual(Ewl_Freebox *fb)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fb);
- DCHECK_TYPE(fb, EWL_FREEBOX_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fb);
+ DCHECK_TYPE(fb, EWL_FREEBOX_TYPE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/*
@@ -462,40 +462,40 @@ ewl_freebox_layout_manual(Ewl_Freebox *fb)
static void
ewl_freebox_layout_comparator(Ewl_Freebox *fb)
{
- Ewl_Container *c;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fb);
- DCHECK_TYPE(fb, EWL_FREEBOX_TYPE);
-
- /* we're boned if we don't have a comparator */
- if (!fb->comparator)
- {
- DWARNING("No comparator set and using "
- "EWL_FREEBOX_LAYOUT_COMPARATOR. "
- "Bad programmer, bad.");
- DRETURN(DLEVEL_STABLE);
- }
-
- c = EWL_CONTAINER(fb);
-
- /* sort the data if needed */
- if (!fb->sorted)
- {
- ecore_dlist_sort(c->children, ECORE_COMPARE_CB(fb->comparator),
- ECORE_SORT_MIN);
-
- /* we set sorted to TRUE at the end here as each of those
- * inserts into the container will trigger our child_add
- * callback which will set sorted to FALSE */
- fb->sorted = TRUE;
- }
-
- /* just use the autolayout which will layout in the order the items
- * are in the container. So, since we've already sorted the items
- * their in the correct order for auto layout */
- ewl_freebox_layout_auto(fb);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Container *c;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fb);
+ DCHECK_TYPE(fb, EWL_FREEBOX_TYPE);
+
+ /* we're boned if we don't have a comparator */
+ if (!fb->comparator)
+ {
+ DWARNING("No comparator set and using "
+ "EWL_FREEBOX_LAYOUT_COMPARATOR. "
+ "Bad programmer, bad.");
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ c = EWL_CONTAINER(fb);
+
+ /* sort the data if needed */
+ if (!fb->sorted)
+ {
+ ecore_dlist_sort(c->children, ECORE_COMPARE_CB(fb->comparator),
+ ECORE_SORT_MIN);
+
+ /* we set sorted to TRUE at the end here as each of those
+ * inserts into the container will trigger our child_add
+ * callback which will set sorted to FALSE */
+ fb->sorted = TRUE;
+ }
+
+ /* just use the autolayout which will layout in the order the items
+ * are in the container. So, since we've already sorted the items
+ * their in the correct order for auto layout */
+ ewl_freebox_layout_auto(fb);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_freebox.h b/src/lib/ewl_freebox.h
index 6e37ee1..bf97edb 100644
--- a/src/lib/ewl_freebox.h
+++ b/src/lib/ewl_freebox.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_FREEBOX_H
#define EWL_FREEBOX_H
@@ -51,32 +51,32 @@ typedef struct Ewl_Freebox Ewl_Freebox;
*/
struct Ewl_Freebox
{
- Ewl_Container container; /**< Inherit from Ewl_Container */
+ Ewl_Container container; /**< Inherit from Ewl_Container */
- Ewl_Freebox_Layout_Type layout; /**< The current layout type */
- Ewl_Freebox_Comparator comparator; /**< The item comparator */
- Ewl_Orientation orientation; /**< The orientation of the box */
- unsigned short sorted; /**< Is the box sorted */
+ Ewl_Freebox_Layout_Type layout; /**< The current layout type */
+ Ewl_Freebox_Comparator comparator; /**< The item comparator */
+ Ewl_Orientation orientation; /**< The orientation of the box */
+ unsigned short sorted; /**< Is the box sorted */
};
-Ewl_Widget *ewl_vfreebox_new(void);
-Ewl_Widget *ewl_hfreebox_new(void);
-Ewl_Widget *ewl_freebox_new(void);
-int ewl_freebox_init(Ewl_Freebox *fb);
+Ewl_Widget *ewl_vfreebox_new(void);
+Ewl_Widget *ewl_hfreebox_new(void);
+Ewl_Widget *ewl_freebox_new(void);
+int ewl_freebox_init(Ewl_Freebox *fb);
-void ewl_freebox_orientation_set(Ewl_Freebox *fb,
- Ewl_Orientation orientation);
-Ewl_Orientation ewl_freebox_orientation_get(Ewl_Freebox *fb);
+void ewl_freebox_orientation_set(Ewl_Freebox *fb,
+ Ewl_Orientation orientation);
+Ewl_Orientation ewl_freebox_orientation_get(Ewl_Freebox *fb);
-void ewl_freebox_layout_type_set(Ewl_Freebox *fb,
- Ewl_Freebox_Layout_Type type);
+void ewl_freebox_layout_type_set(Ewl_Freebox *fb,
+ Ewl_Freebox_Layout_Type type);
Ewl_Freebox_Layout_Type ewl_freebox_layout_type_get(Ewl_Freebox *fb);
-void ewl_freebox_comparator_set(Ewl_Freebox *fb,
- Ewl_Freebox_Comparator cmp);
-Ewl_Freebox_Comparator ewl_freebox_comparator_get(Ewl_Freebox *fb);
+void ewl_freebox_comparator_set(Ewl_Freebox *fb,
+ Ewl_Freebox_Comparator cmp);
+Ewl_Freebox_Comparator ewl_freebox_comparator_get(Ewl_Freebox *fb);
-void ewl_freebox_resort(Ewl_Freebox *fb);
+void ewl_freebox_resort(Ewl_Freebox *fb);
/*
* Internal callbacks, override at your risk
diff --git a/src/lib/ewl_grid.c b/src/lib/ewl_grid.c
index 3dfee93..ad218d8 100644
--- a/src/lib/ewl_grid.c
+++ b/src/lib/ewl_grid.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_grid.h"
#include "ewl_macros.h"
@@ -19,20 +19,20 @@ static void ewl_grid_map_start_position_get(Ewl_Grid *g, int *c, int *r);
Ewl_Widget *
ewl_grid_new(void)
{
- Ewl_Grid *g;
+ Ewl_Grid *g;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- g = NEW(Ewl_Grid, 1);
- if (!g)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ g = NEW(Ewl_Grid, 1);
+ if (!g)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_grid_init(g)) {
- ewl_widget_destroy(EWL_WIDGET(g));
- g = NULL;
- }
+ if (!ewl_grid_init(g)) {
+ ewl_widget_destroy(EWL_WIDGET(g));
+ g = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(g), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(g), DLEVEL_STABLE);
}
/**
@@ -44,50 +44,50 @@ ewl_grid_new(void)
int
ewl_grid_init(Ewl_Grid *g)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(g, FALSE);
-
- /*
- * Initialize the grids inherited fields
- */
- if (!ewl_container_init(EWL_CONTAINER(g)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- ewl_widget_appearance_set(EWL_WIDGET(g), EWL_GRID_TYPE);
- ewl_widget_inherit(EWL_WIDGET(g), EWL_GRID_TYPE);
-
- ewl_container_add_notify_set(EWL_CONTAINER(g), ewl_grid_cb_child_add);
- ewl_container_remove_notify_set(EWL_CONTAINER(g),
- ewl_grid_cb_child_remove);
- ewl_container_show_notify_set(EWL_CONTAINER(g),
- ewl_grid_cb_child_show);
- ewl_container_hide_notify_set(EWL_CONTAINER(g),
- ewl_grid_cb_child_show);
- ewl_container_resize_notify_set(EWL_CONTAINER(g),
- ewl_grid_cb_child_resize);
-
- /*
- * the smallest size where a grid make sense
- */
- ewl_grid_dimensions_set(g, 2, 2);
-
- g->homogeneous_h = FALSE;
- g->homogeneous_v = FALSE;
- g->data_dirty = TRUE;
-
- g->orientation = EWL_ORIENTATION_HORIZONTAL;
-
- /*
- * Append callbacks
- */
- ewl_callback_append(EWL_WIDGET(g), EWL_CALLBACK_CONFIGURE,
- ewl_grid_cb_configure, NULL);
- ewl_callback_prepend(EWL_WIDGET(g), EWL_CALLBACK_DESTROY,
- ewl_grid_cb_destroy, NULL);
-
- ewl_widget_focusable_set(EWL_WIDGET(g), FALSE);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(g, FALSE);
+
+ /*
+ * Initialize the grids inherited fields
+ */
+ if (!ewl_container_init(EWL_CONTAINER(g)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ ewl_widget_appearance_set(EWL_WIDGET(g), EWL_GRID_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(g), EWL_GRID_TYPE);
+
+ ewl_container_add_notify_set(EWL_CONTAINER(g), ewl_grid_cb_child_add);
+ ewl_container_remove_notify_set(EWL_CONTAINER(g),
+ ewl_grid_cb_child_remove);
+ ewl_container_show_notify_set(EWL_CONTAINER(g),
+ ewl_grid_cb_child_show);
+ ewl_container_hide_notify_set(EWL_CONTAINER(g),
+ ewl_grid_cb_child_show);
+ ewl_container_resize_notify_set(EWL_CONTAINER(g),
+ ewl_grid_cb_child_resize);
+
+ /*
+ * the smallest size where a grid make sense
+ */
+ ewl_grid_dimensions_set(g, 2, 2);
+
+ g->homogeneous_h = FALSE;
+ g->homogeneous_v = FALSE;
+ g->data_dirty = TRUE;
+
+ g->orientation = EWL_ORIENTATION_HORIZONTAL;
+
+ /*
+ * Append callbacks
+ */
+ ewl_callback_append(EWL_WIDGET(g), EWL_CALLBACK_CONFIGURE,
+ ewl_grid_cb_configure, NULL);
+ ewl_callback_prepend(EWL_WIDGET(g), EWL_CALLBACK_DESTROY,
+ ewl_grid_cb_destroy, NULL);
+
+ ewl_widget_focusable_set(EWL_WIDGET(g), FALSE);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -100,61 +100,61 @@ ewl_grid_init(Ewl_Grid *g)
void
ewl_grid_dimensions_set(Ewl_Grid *g, int cols, int rows)
{
- Ewl_Widget *w;
- Ewl_Grid_Info *col_new, *row_new;
- int i;
+ Ewl_Widget *w;
+ Ewl_Grid_Info *col_new, *row_new;
+ int i;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(g);
- DCHECK_TYPE(g, EWL_GRID_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(g);
+ DCHECK_TYPE(g, EWL_GRID_TYPE);
- w = EWL_WIDGET(g);
+ w = EWL_WIDGET(g);
- if ((cols == g->cols) && (rows == g->rows))
- DRETURN(DLEVEL_STABLE);
+ if ((cols == g->cols) && (rows == g->rows))
+ DRETURN(DLEVEL_STABLE);
- IF_FREE(g->map);
- g->data_dirty = TRUE;
+ IF_FREE(g->map);
+ g->data_dirty = TRUE;
- if (cols != g->cols) {
- col_new = NEW(Ewl_Grid_Info, cols);
- if (!col_new)
- DRETURN(DLEVEL_STABLE);
+ if (cols != g->cols) {
+ col_new = NEW(Ewl_Grid_Info, cols);
+ if (!col_new)
+ DRETURN(DLEVEL_STABLE);
- if (g->col_size) {
- int num;
+ if (g->col_size) {
+ int num;
- num = MIN(cols, g->cols);
- for (i = 0; i < num; i++)
- col_new[i] = g->col_size[i];
+ num = MIN(cols, g->cols);
+ for (i = 0; i < num; i++)
+ col_new[i] = g->col_size[i];
- FREE(g->col_size);
- }
- g->col_size = col_new;
- g->cols = cols;
- }
+ FREE(g->col_size);
+ }
+ g->col_size = col_new;
+ g->cols = cols;
+ }
- if (rows != g->rows) {
- row_new = NEW(Ewl_Grid_Info, rows);
- if (!row_new)
- DRETURN(DLEVEL_STABLE);
+ if (rows != g->rows) {
+ row_new = NEW(Ewl_Grid_Info, rows);
+ if (!row_new)
+ DRETURN(DLEVEL_STABLE);
- if (g->row_size) {
- int num;
+ if (g->row_size) {
+ int num;
- num = MIN(rows, g->rows);
- for (i = 0; i < num; i++)
- row_new[i] = g->row_size[i];
+ num = MIN(rows, g->rows);
+ for (i = 0; i < num; i++)
+ row_new[i] = g->row_size[i];
- FREE(g->row_size);
- }
- g->row_size = row_new;
- g->rows = rows;
- }
+ FREE(g->row_size);
+ }
+ g->row_size = row_new;
+ g->rows = rows;
+ }
- ewl_widget_configure(w);
+ ewl_widget_configure(w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -167,14 +167,14 @@ ewl_grid_dimensions_set(Ewl_Grid *g, int cols, int rows)
void
ewl_grid_dimensions_get(Ewl_Grid *g, int *cols, int *rows)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(g);
- DCHECK_TYPE(g, EWL_GRID_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(g);
+ DCHECK_TYPE(g, EWL_GRID_TYPE);
- if (cols) *cols = g->cols;
- if (rows) *rows = g->rows;
+ if (cols) *cols = g->cols;
+ if (rows) *rows = g->rows;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -186,19 +186,19 @@ ewl_grid_dimensions_get(Ewl_Grid *g, int *cols, int *rows)
void
ewl_grid_orientation_set(Ewl_Grid *g, Ewl_Orientation orientation)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(g);
- DCHECK_TYPE(g, EWL_GRID_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(g);
+ DCHECK_TYPE(g, EWL_GRID_TYPE);
- if (g->orientation == orientation)
- DRETURN(DLEVEL_STABLE);
+ if (g->orientation == orientation)
+ DRETURN(DLEVEL_STABLE);
- g->orientation = orientation;
- g->data_dirty = TRUE;
+ g->orientation = orientation;
+ g->data_dirty = TRUE;
- ewl_widget_configure(EWL_WIDGET(g));
+ ewl_widget_configure(EWL_WIDGET(g));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -209,11 +209,11 @@ ewl_grid_orientation_set(Ewl_Grid *g, Ewl_Orientation orientation)
Ewl_Orientation
ewl_grid_orientation_get(Ewl_Grid *g)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(g, 0);
- DCHECK_TYPE_RET(g, EWL_GRID_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(g, 0);
+ DCHECK_TYPE_RET(g, EWL_GRID_TYPE, 0);
- DRETURN_INT(g->orientation, DLEVEL_STABLE);
+ DRETURN_INT(g->orientation, DLEVEL_STABLE);
}
/**
@@ -228,17 +228,17 @@ ewl_grid_orientation_get(Ewl_Grid *g)
void
ewl_grid_homogeneous_set(Ewl_Grid *g, unsigned int h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(g);
- DCHECK_TYPE(g, EWL_GRID_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(g);
+ DCHECK_TYPE(g, EWL_GRID_TYPE);
- if (g->homogeneous_h != h)
- ewl_grid_hhomogeneous_set(g, h);
+ if (g->homogeneous_h != h)
+ ewl_grid_hhomogeneous_set(g, h);
- if (g->homogeneous_v != h)
- ewl_grid_vhomogeneous_set(g, h);
+ if (g->homogeneous_v != h)
+ ewl_grid_vhomogeneous_set(g, h);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -254,18 +254,18 @@ ewl_grid_homogeneous_set(Ewl_Grid *g, unsigned int h)
void
ewl_grid_hhomogeneous_set(Ewl_Grid *g, unsigned int h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(g);
- DCHECK_TYPE(g, EWL_GRID_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(g);
+ DCHECK_TYPE(g, EWL_GRID_TYPE);
- if (g->homogeneous_h == h)
- DRETURN(DLEVEL_STABLE);
+ if (g->homogeneous_h == h)
+ DRETURN(DLEVEL_STABLE);
- g->homogeneous_h = h;
- g->data_dirty = TRUE;
- ewl_widget_configure(EWL_WIDGET(g));
+ g->homogeneous_h = h;
+ g->data_dirty = TRUE;
+ ewl_widget_configure(EWL_WIDGET(g));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -281,18 +281,18 @@ ewl_grid_hhomogeneous_set(Ewl_Grid *g, unsigned int h)
void
ewl_grid_vhomogeneous_set(Ewl_Grid *g, unsigned int h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(g);
- DCHECK_TYPE(g, EWL_GRID_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(g);
+ DCHECK_TYPE(g, EWL_GRID_TYPE);
- if (g->homogeneous_v == h)
- DRETURN(DLEVEL_STABLE);
+ if (g->homogeneous_v == h)
+ DRETURN(DLEVEL_STABLE);
- g->homogeneous_v = h;
- g->data_dirty = TRUE;
- ewl_widget_configure(EWL_WIDGET(g));
+ g->homogeneous_v = h;
+ g->data_dirty = TRUE;
+ ewl_widget_configure(EWL_WIDGET(g));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -303,11 +303,11 @@ ewl_grid_vhomogeneous_set(Ewl_Grid *g, unsigned int h)
unsigned int
ewl_grid_hhomogeneous_get(Ewl_Grid *g)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(g, 0);
- DCHECK_TYPE_RET(g, EWL_GRID_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(g, 0);
+ DCHECK_TYPE_RET(g, EWL_GRID_TYPE, 0);
- DRETURN_INT(g->homogeneous_h, DLEVEL_STABLE);
+ DRETURN_INT(g->homogeneous_h, DLEVEL_STABLE);
}
/**
@@ -318,11 +318,11 @@ ewl_grid_hhomogeneous_get(Ewl_Grid *g)
unsigned int
ewl_grid_vhomogeneous_get(Ewl_Grid *g)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(g, 0);
- DCHECK_TYPE_RET(g, EWL_GRID_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(g, 0);
+ DCHECK_TYPE_RET(g, EWL_GRID_TYPE, 0);
- DRETURN_INT(g->homogeneous_v, DLEVEL_STABLE);
+ DRETURN_INT(g->homogeneous_v, DLEVEL_STABLE);
}
/**
@@ -337,81 +337,81 @@ ewl_grid_vhomogeneous_get(Ewl_Grid *g)
*/
void
ewl_grid_child_position_set(Ewl_Grid *g, Ewl_Widget *w,
- int start_col, int end_col,
- int start_row, int end_row)
+ int start_col, int end_col,
+ int start_row, int end_row)
{
- Ewl_Grid_Child *child;
- int new_cols, new_rows;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(g);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(g, EWL_GRID_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- IF_FREE(g->map);
- g->data_dirty = TRUE;
-
- /*
- * check bounds
- */
- if (start_col < 0) {
- DWARNING("start_col out of bounds. min is 0.");
- DRETURN(DLEVEL_STABLE);
- }
-
- if (end_col >= g->cols)
- new_cols = end_col + 1;
- else
- new_cols = g->cols;
-
- if (start_row < 0) {
- DWARNING("start_row out of bounds. min is 0.");
- DRETURN(DLEVEL_STABLE);
- }
-
- if (end_row >= g->rows)
- new_rows = end_row + 1;
- else
- new_rows = g->rows;
-
- /*
- * create a new child
- */
- if (!(child = ewl_widget_data_get(w,g))) {
- child = NEW(Ewl_Grid_Child, 1);
- if (!child)
- DRETURN(DLEVEL_STABLE);
- }
- else {
- g->space -= (child->end_col - child->start_col + 1)
- * (child->end_row - child->start_row + 1) + 1;
- }
- child->start_col = start_col;
- child->end_col = end_col;
- child->start_row = start_row;
- child->end_row = end_row;
-
- g->space += (end_col - start_col + 1) * (end_row - start_row + 1) - 1;
-
- /*
- * if there is to less space resize the grid
- */
- if (g->space > (new_cols * new_rows)) {
- if (g->orientation == EWL_ORIENTATION_HORIZONTAL)
- new_rows = g->space / new_cols + 1;
- else
- new_cols = g->space / new_rows + 1;
- }
-
- /*
- * store the child info in the child widget
- */
- ewl_widget_data_set(w, (void *)g, child);
- ewl_grid_dimensions_set(g, new_cols, new_rows);
- ewl_widget_configure(EWL_WIDGET(g));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Grid_Child *child;
+ int new_cols, new_rows;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(g);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(g, EWL_GRID_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ IF_FREE(g->map);
+ g->data_dirty = TRUE;
+
+ /*
+ * check bounds
+ */
+ if (start_col < 0) {
+ DWARNING("start_col out of bounds. min is 0.");
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ if (end_col >= g->cols)
+ new_cols = end_col + 1;
+ else
+ new_cols = g->cols;
+
+ if (start_row < 0) {
+ DWARNING("start_row out of bounds. min is 0.");
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ if (end_row >= g->rows)
+ new_rows = end_row + 1;
+ else
+ new_rows = g->rows;
+
+ /*
+ * create a new child
+ */
+ if (!(child = ewl_widget_data_get(w,g))) {
+ child = NEW(Ewl_Grid_Child, 1);
+ if (!child)
+ DRETURN(DLEVEL_STABLE);
+ }
+ else {
+ g->space -= (child->end_col - child->start_col + 1)
+ * (child->end_row - child->start_row + 1) + 1;
+ }
+ child->start_col = start_col;
+ child->end_col = end_col;
+ child->start_row = start_row;
+ child->end_row = end_row;
+
+ g->space += (end_col - start_col + 1) * (end_row - start_row + 1) - 1;
+
+ /*
+ * if there is to less space resize the grid
+ */
+ if (g->space > (new_cols * new_rows)) {
+ if (g->orientation == EWL_ORIENTATION_HORIZONTAL)
+ new_rows = g->space / new_cols + 1;
+ else
+ new_cols = g->space / new_rows + 1;
+ }
+
+ /*
+ * store the child info in the child widget
+ */
+ ewl_widget_data_set(w, (void *)g, child);
+ ewl_grid_dimensions_set(g, new_cols, new_rows);
+ ewl_widget_configure(EWL_WIDGET(g));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -426,71 +426,71 @@ ewl_grid_child_position_set(Ewl_Grid *g, Ewl_Widget *w,
*/
void
ewl_grid_child_position_get(Ewl_Grid *g, Ewl_Widget *w,
- int *start_col, int *end_col,
- int *start_row, int *end_row)
+ int *start_col, int *end_col,
+ int *start_row, int *end_row)
{
- Ewl_Grid_Child *child;
- int sc, ec, sr, er;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(g);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(g, EWL_GRID_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- child = ewl_widget_data_get(w, g);
- if (child) {
- /*
- * for a fixed-positioned widget we can
- * just return the data
- */
- sc = child->start_col;
- ec = child->end_col;
- sr = child->start_row;
- er = child->end_row;
- }
- else {
- Ewl_Widget *c;
- int col, row;
- void (*go_next)(Ewl_Grid *g, int *c, int *r);
- /*
- * for a floating widget we have to search
- * for the current position
- */
- if (!g->map)
- ewl_grid_map_recalc(g);
- /*
- * setup the position stuff for the floating
- * widgets
- */
- ewl_grid_map_start_position_get(g, &col, &row);
- if (g->orientation == EWL_ORIENTATION_HORIZONTAL)
- go_next = ewl_grid_hmap_position_next;
- else
- go_next = ewl_grid_vmap_position_next;
-
- /*
- * and now find the current position
- */
- ecore_dlist_first_goto(EWL_CONTAINER(g)->children);
- while ((c = ecore_dlist_next(EWL_CONTAINER(g)->children))
- && c != w) {
- if (UNMANAGED(c))
- continue;
-
- if (!ewl_widget_data_get(c, g))
- go_next(g, &col, &row);
- }
- sc = ec = col;
- sr = er = row;
- }
-
- if (start_col) *start_col = sc;
- if (end_col) *end_col = ec;
- if (start_row) *start_row = sr;
- if (end_row) *end_row = er;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Grid_Child *child;
+ int sc, ec, sr, er;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(g);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(g, EWL_GRID_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ child = ewl_widget_data_get(w, g);
+ if (child) {
+ /*
+ * for a fixed-positioned widget we can
+ * just return the data
+ */
+ sc = child->start_col;
+ ec = child->end_col;
+ sr = child->start_row;
+ er = child->end_row;
+ }
+ else {
+ Ewl_Widget *c;
+ int col, row;
+ void (*go_next)(Ewl_Grid *g, int *c, int *r);
+ /*
+ * for a floating widget we have to search
+ * for the current position
+ */
+ if (!g->map)
+ ewl_grid_map_recalc(g);
+ /*
+ * setup the position stuff for the floating
+ * widgets
+ */
+ ewl_grid_map_start_position_get(g, &col, &row);
+ if (g->orientation == EWL_ORIENTATION_HORIZONTAL)
+ go_next = ewl_grid_hmap_position_next;
+ else
+ go_next = ewl_grid_vmap_position_next;
+
+ /*
+ * and now find the current position
+ */
+ ecore_dlist_first_goto(EWL_CONTAINER(g)->children);
+ while ((c = ecore_dlist_next(EWL_CONTAINER(g)->children))
+ && c != w) {
+ if (UNMANAGED(c))
+ continue;
+
+ if (!ewl_widget_data_get(c, g))
+ go_next(g, &col, &row);
+ }
+ sc = ec = col;
+ sr = er = row;
+ }
+
+ if (start_col) *start_col = sc;
+ if (end_col) *end_col = ec;
+ if (start_row) *start_row = sr;
+ if (end_row) *end_row = er;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -504,14 +504,14 @@ ewl_grid_child_position_get(Ewl_Grid *g, Ewl_Widget *w,
int
ewl_grid_column_current_w_get(Ewl_Grid *g, int col)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(g, 0);
- DCHECK_TYPE_RET(g, EWL_GRID_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(g, 0);
+ DCHECK_TYPE_RET(g, EWL_GRID_TYPE, 0);
- if ((col >= g->cols) || (col < 0))
- DRETURN_INT(0, DLEVEL_STABLE);
+ if ((col >= g->cols) || (col < 0))
+ DRETURN_INT(0, DLEVEL_STABLE);
- DRETURN_INT(g->col_size[col].current_size, DLEVEL_STABLE);
+ DRETURN_INT(g->col_size[col].current_size, DLEVEL_STABLE);
}
/**
@@ -524,27 +524,27 @@ ewl_grid_column_current_w_get(Ewl_Grid *g, int col)
void
ewl_grid_column_fixed_w_set(Ewl_Grid *g, int col, int width)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(g);
- DCHECK_TYPE(g, EWL_GRID_TYPE);
-
- /*
- * check bounds
- */
- if (col < 0) {
- DWARNING("parameter 'col' is out of bounds.");
- DRETURN(DLEVEL_STABLE);
- }
- else if (col >= g->cols)
- ewl_grid_dimensions_set(g, col + 1, g->rows);
-
- g->col_size[col].resize_type = EWL_GRID_RESIZE_FIXED;
- g->col_size[col].user.size = width;
- g->data_dirty = TRUE;
-
- ewl_widget_configure(EWL_WIDGET(g));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(g);
+ DCHECK_TYPE(g, EWL_GRID_TYPE);
+
+ /*
+ * check bounds
+ */
+ if (col < 0) {
+ DWARNING("parameter 'col' is out of bounds.");
+ DRETURN(DLEVEL_STABLE);
+ }
+ else if (col >= g->cols)
+ ewl_grid_dimensions_set(g, col + 1, g->rows);
+
+ g->col_size[col].resize_type = EWL_GRID_RESIZE_FIXED;
+ g->col_size[col].user.size = width;
+ g->data_dirty = TRUE;
+
+ ewl_widget_configure(EWL_WIDGET(g));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -558,14 +558,14 @@ ewl_grid_column_fixed_w_set(Ewl_Grid *g, int col, int width)
int
ewl_grid_column_fixed_w_get(Ewl_Grid *g, int col)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(g, 0);
- DCHECK_TYPE_RET(g, EWL_GRID_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(g, 0);
+ DCHECK_TYPE_RET(g, EWL_GRID_TYPE, 0);
- if ((col >= g->cols) || (col < 0))
- DRETURN_INT(0, DLEVEL_STABLE);
+ if ((col >= g->cols) || (col < 0))
+ DRETURN_INT(0, DLEVEL_STABLE);
- DRETURN_INT(g->col_size[col].user.size, DLEVEL_STABLE);
+ DRETURN_INT(g->col_size[col].user.size, DLEVEL_STABLE);
}
/**
@@ -578,27 +578,27 @@ ewl_grid_column_fixed_w_get(Ewl_Grid *g, int col)
void
ewl_grid_column_relative_w_set(Ewl_Grid *g, int col, float relw)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(g);
- DCHECK_TYPE(g, EWL_GRID_TYPE);
-
- /*
- * check bounds
- */
- if (col < 0) {
- DWARNING("parameter 'col' is out of bounds.");
- DRETURN(DLEVEL_STABLE);
- }
- else if (col >= g->cols)
- ewl_grid_dimensions_set(g, col + 1, g->rows);
-
- g->col_size[col].resize_type = EWL_GRID_RESIZE_RELATIVE;
- g->col_size[col].user.rel_size = relw;
- g->data_dirty = TRUE;
-
- ewl_widget_configure(EWL_WIDGET(g));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(g);
+ DCHECK_TYPE(g, EWL_GRID_TYPE);
+
+ /*
+ * check bounds
+ */
+ if (col < 0) {
+ DWARNING("parameter 'col' is out of bounds.");
+ DRETURN(DLEVEL_STABLE);
+ }
+ else if (col >= g->cols)
+ ewl_grid_dimensions_set(g, col + 1, g->rows);
+
+ g->col_size[col].resize_type = EWL_GRID_RESIZE_RELATIVE;
+ g->col_size[col].user.rel_size = relw;
+ g->data_dirty = TRUE;
+
+ ewl_widget_configure(EWL_WIDGET(g));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -612,14 +612,14 @@ ewl_grid_column_relative_w_set(Ewl_Grid *g, int col, float relw)
float
ewl_grid_column_relative_w_get(Ewl_Grid *g, int col)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(g, 0.0);
- DCHECK_TYPE_RET(g, EWL_GRID_TYPE, 0.0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(g, 0.0);
+ DCHECK_TYPE_RET(g, EWL_GRID_TYPE, 0.0);
- if ((col >= g->cols) || (col < 0))
- DRETURN_FLOAT(0.0, DLEVEL_STABLE);
+ if ((col >= g->cols) || (col < 0))
+ DRETURN_FLOAT(0.0, DLEVEL_STABLE);
- DRETURN_FLOAT(g->col_size[col].user.rel_size, DLEVEL_STABLE);
+ DRETURN_FLOAT(g->col_size[col].user.rel_size, DLEVEL_STABLE);
}
/**
@@ -631,27 +631,27 @@ ewl_grid_column_relative_w_get(Ewl_Grid *g, int col)
void
ewl_grid_column_preferred_w_use(Ewl_Grid *g, int col)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(g);
- DCHECK_TYPE(g, EWL_GRID_TYPE);
-
- /*
- * check bounds
- */
- if (col < 0) {
- DWARNING("parameter 'col' is out of bounds.");
- DRETURN(DLEVEL_STABLE);
- }
- else if (col >= g->cols)
- ewl_grid_dimensions_set(g, col + 1, g->rows);
-
- g->col_size[col].resize_type = EWL_GRID_RESIZE_NONE;
- g->col_size[col].user.size = 0;
- g->data_dirty = TRUE;
-
- ewl_widget_configure(EWL_WIDGET(g));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(g);
+ DCHECK_TYPE(g, EWL_GRID_TYPE);
+
+ /*
+ * check bounds
+ */
+ if (col < 0) {
+ DWARNING("parameter 'col' is out of bounds.");
+ DRETURN(DLEVEL_STABLE);
+ }
+ else if (col >= g->cols)
+ ewl_grid_dimensions_set(g, col + 1, g->rows);
+
+ g->col_size[col].resize_type = EWL_GRID_RESIZE_NONE;
+ g->col_size[col].user.size = 0;
+ g->data_dirty = TRUE;
+
+ ewl_widget_configure(EWL_WIDGET(g));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -663,27 +663,27 @@ ewl_grid_column_preferred_w_use(Ewl_Grid *g, int col)
void
ewl_grid_column_w_remove(Ewl_Grid *g, int col)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(g);
- DCHECK_TYPE(g, EWL_GRID_TYPE);
-
- /*
- * check bounds
- */
- if (col < 0) {
- DWARNING("parameter 'col' is out of bounds.");
- DRETURN(DLEVEL_STABLE);
- }
- else if (col >= g->cols)
- ewl_grid_dimensions_set(g, col + 1, g->rows);
-
- g->col_size[col].resize_type = EWL_GRID_RESIZE_NORMAL;
- g->col_size[col].user.size = 0;
- g->data_dirty = TRUE;
-
- ewl_widget_configure(EWL_WIDGET(g));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(g);
+ DCHECK_TYPE(g, EWL_GRID_TYPE);
+
+ /*
+ * check bounds
+ */
+ if (col < 0) {
+ DWARNING("parameter 'col' is out of bounds.");
+ DRETURN(DLEVEL_STABLE);
+ }
+ else if (col >= g->cols)
+ ewl_grid_dimensions_set(g, col + 1, g->rows);
+
+ g->col_size[col].resize_type = EWL_GRID_RESIZE_NORMAL;
+ g->col_size[col].user.size = 0;
+ g->data_dirty = TRUE;
+
+ ewl_widget_configure(EWL_WIDGET(g));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -697,14 +697,14 @@ ewl_grid_column_w_remove(Ewl_Grid *g, int col)
int
ewl_grid_row_current_h_get(Ewl_Grid *g, int row)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(g, 0);
- DCHECK_TYPE_RET(g, EWL_GRID_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(g, 0);
+ DCHECK_TYPE_RET(g, EWL_GRID_TYPE, 0);
- if ((row >= g->rows) || (row < 0))
- DRETURN_INT(0, DLEVEL_STABLE);
+ if ((row >= g->rows) || (row < 0))
+ DRETURN_INT(0, DLEVEL_STABLE);
- DRETURN_INT(g->row_size[row].current_size, DLEVEL_STABLE);
+ DRETURN_INT(g->row_size[row].current_size, DLEVEL_STABLE);
}
/**
@@ -717,27 +717,27 @@ ewl_grid_row_current_h_get(Ewl_Grid *g, int row)
void
ewl_grid_row_fixed_h_set(Ewl_Grid *g, int row, int height)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(g);
- DCHECK_TYPE(g, EWL_GRID_TYPE);
-
- /*
- * check bounds
- */
- if (row < 0) {
- DWARNING("parameter 'row' is out of bounds.");
- DRETURN(DLEVEL_STABLE);
- }
- else if (row >= g->rows)
- ewl_grid_dimensions_set(g, g->cols, row + 1);
-
- g->row_size[row].resize_type = EWL_GRID_RESIZE_FIXED;
- g->row_size[row].user.size = height;
- g->data_dirty = TRUE;
-
- ewl_widget_configure(EWL_WIDGET(g));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(g);
+ DCHECK_TYPE(g, EWL_GRID_TYPE);
+
+ /*
+ * check bounds
+ */
+ if (row < 0) {
+ DWARNING("parameter 'row' is out of bounds.");
+ DRETURN(DLEVEL_STABLE);
+ }
+ else if (row >= g->rows)
+ ewl_grid_dimensions_set(g, g->cols, row + 1);
+
+ g->row_size[row].resize_type = EWL_GRID_RESIZE_FIXED;
+ g->row_size[row].user.size = height;
+ g->data_dirty = TRUE;
+
+ ewl_widget_configure(EWL_WIDGET(g));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -751,14 +751,14 @@ ewl_grid_row_fixed_h_set(Ewl_Grid *g, int row, int height)
int
ewl_grid_row_fixed_h_get(Ewl_Grid *g, int row)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(g, 0);
- DCHECK_TYPE_RET(g, EWL_GRID_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(g, 0);
+ DCHECK_TYPE_RET(g, EWL_GRID_TYPE, 0);
- if ((row >= g->rows) || (row < 0))
- DRETURN_INT(0, DLEVEL_STABLE);
+ if ((row >= g->rows) || (row < 0))
+ DRETURN_INT(0, DLEVEL_STABLE);
- DRETURN_INT(g->row_size[row].user.size, DLEVEL_STABLE);
+ DRETURN_INT(g->row_size[row].user.size, DLEVEL_STABLE);
}
/**
@@ -771,27 +771,27 @@ ewl_grid_row_fixed_h_get(Ewl_Grid *g, int row)
void
ewl_grid_row_relative_h_set(Ewl_Grid *g, int row, float relh)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(g);
- DCHECK_TYPE(g, EWL_GRID_TYPE);
-
- /*
- * check bounds
- */
- if (row < 0) {
- DWARNING("parameter 'row' is out of bounds.");
- DRETURN(DLEVEL_STABLE);
- }
- else if (row >= g->rows)
- ewl_grid_dimensions_set(g, g->cols, row + 1);
-
- g->row_size[row].resize_type = EWL_GRID_RESIZE_RELATIVE;
- g->row_size[row].user.rel_size = relh;
- g->data_dirty = TRUE;
-
- ewl_widget_configure(EWL_WIDGET(g));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(g);
+ DCHECK_TYPE(g, EWL_GRID_TYPE);
+
+ /*
+ * check bounds
+ */
+ if (row < 0) {
+ DWARNING("parameter 'row' is out of bounds.");
+ DRETURN(DLEVEL_STABLE);
+ }
+ else if (row >= g->rows)
+ ewl_grid_dimensions_set(g, g->cols, row + 1);
+
+ g->row_size[row].resize_type = EWL_GRID_RESIZE_RELATIVE;
+ g->row_size[row].user.rel_size = relh;
+ g->data_dirty = TRUE;
+
+ ewl_widget_configure(EWL_WIDGET(g));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -805,14 +805,14 @@ ewl_grid_row_relative_h_set(Ewl_Grid *g, int row, float relh)
float
ewl_grid_row_relative_h_get(Ewl_Grid *g, int row)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(g, 0.0);
- DCHECK_TYPE_RET(g, EWL_GRID_TYPE, 0.0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(g, 0.0);
+ DCHECK_TYPE_RET(g, EWL_GRID_TYPE, 0.0);
- if ((row >= g->rows) || (row < 0))
- DRETURN_FLOAT(0.0, DLEVEL_STABLE);
+ if ((row >= g->rows) || (row < 0))
+ DRETURN_FLOAT(0.0, DLEVEL_STABLE);
- DRETURN_FLOAT(g->row_size[row].user.rel_size, DLEVEL_STABLE);
+ DRETURN_FLOAT(g->row_size[row].user.rel_size, DLEVEL_STABLE);
}
/**
@@ -824,27 +824,27 @@ ewl_grid_row_relative_h_get(Ewl_Grid *g, int row)
void
ewl_grid_row_preferred_h_use(Ewl_Grid *g, int row)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(g);
- DCHECK_TYPE(g, EWL_GRID_TYPE);
-
- /*
- * check bounds
- */
- if (row < 0) {
- DWARNING("parameter 'row' is out of bounds.");
- DRETURN(DLEVEL_STABLE);
- }
- else if (row >= g->rows)
- ewl_grid_dimensions_set(g, g->cols, row + 1);
-
- g->row_size[row].resize_type = EWL_GRID_RESIZE_NONE;
- g->row_size[row].user.size = 0;
- g->data_dirty = TRUE;
-
- ewl_widget_configure(EWL_WIDGET(g));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(g);
+ DCHECK_TYPE(g, EWL_GRID_TYPE);
+
+ /*
+ * check bounds
+ */
+ if (row < 0) {
+ DWARNING("parameter 'row' is out of bounds.");
+ DRETURN(DLEVEL_STABLE);
+ }
+ else if (row >= g->rows)
+ ewl_grid_dimensions_set(g, g->cols, row + 1);
+
+ g->row_size[row].resize_type = EWL_GRID_RESIZE_NONE;
+ g->row_size[row].user.size = 0;
+ g->data_dirty = TRUE;
+
+ ewl_widget_configure(EWL_WIDGET(g));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -856,27 +856,27 @@ ewl_grid_row_preferred_h_use(Ewl_Grid *g, int row)
void
ewl_grid_row_h_remove(Ewl_Grid *g, int row)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(g);
- DCHECK_TYPE(g, EWL_GRID_TYPE);
-
- /*
- * check bounds
- */
- if (row < 0) {
- DWARNING("parameter 'row' is out of bounds.");
- DRETURN(DLEVEL_STABLE);
- }
- else if (row >= g->rows)
- ewl_grid_dimensions_set(g, g->cols, row + 1);
-
- g->row_size[row].resize_type = EWL_GRID_RESIZE_NORMAL;
- g->row_size[row].user.size = 0;
- g->data_dirty = TRUE;
-
- ewl_widget_configure(EWL_WIDGET(g));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(g);
+ DCHECK_TYPE(g, EWL_GRID_TYPE);
+
+ /*
+ * check bounds
+ */
+ if (row < 0) {
+ DWARNING("parameter 'row' is out of bounds.");
+ DRETURN(DLEVEL_STABLE);
+ }
+ else if (row >= g->rows)
+ ewl_grid_dimensions_set(g, g->cols, row + 1);
+
+ g->row_size[row].resize_type = EWL_GRID_RESIZE_NORMAL;
+ g->row_size[row].user.size = 0;
+ g->data_dirty = TRUE;
+
+ ewl_widget_configure(EWL_WIDGET(g));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -889,83 +889,83 @@ ewl_grid_row_h_remove(Ewl_Grid *g, int row)
*/
void
ewl_grid_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Grid *g;
- Ewl_Grid_Child *c;
- Ewl_Widget *child;
- int c_w = 0, c_h = 0; /* child width/height */
- int c_x = 0, c_y = 0; /* child x/y coordinate */
- int col, row;
- void (*go_next)(Ewl_Grid *g, int *c, int *r);
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_GRID_TYPE);
-
- g = EWL_GRID(w);
-
- if (!g->map)
- ewl_grid_map_recalc(g);
-
- if (g->data_dirty)
- ewl_grid_child_data_collect(g);
-
- ewl_grid_resize(g);
-
- /*
- * setup the position stuff for the floating
- * widgets
- */
- ewl_grid_map_start_position_get(g, &col, &row);
- if (g->orientation == EWL_ORIENTATION_HORIZONTAL)
- go_next = ewl_grid_hmap_position_next;
- else
- go_next = ewl_grid_vmap_position_next;
-
- ecore_dlist_first_goto(EWL_CONTAINER(w)->children);
- while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children))) {
- if (UNMANAGED(child))
- continue;
-
- c = (Ewl_Grid_Child *)ewl_widget_data_get(child, (void *) g);
- if (c) {
- /*
- * calculate the geometry of the fixed widgets
- */
- /* calculate child widgets width */
- c_w = g->col_size[c->end_col].current_pos
- - g->col_size[c->start_col].current_pos
- + g->col_size[c->end_col].current_size;
-
- /* calculate child widgets height */
- c_h = g->row_size[c->end_row].current_pos
- - g->row_size[c->start_row].current_pos
- + g->row_size[c->end_row].current_size;
-
- /* calculate child widgets x coordinate */
- c_x = g->col_size[c->start_col].current_pos;
-
- /* calculate child widgets y coordinate */
- c_y = g->row_size[c->start_row].current_pos;
- }
- else {
- /*
- * get the geometry of the non-fixed widgets
- */
- c_w = g->col_size[col].current_size;
- c_h = g->row_size[row].current_size;
- c_x = g->col_size[col].current_pos;
- c_y = g->row_size[row].current_pos;
-
- go_next(g, &col, &row);
- }
-
- ewl_object_place(EWL_OBJECT(child), c_x, c_y, c_w, c_h);
- ewl_widget_configure(child);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Grid *g;
+ Ewl_Grid_Child *c;
+ Ewl_Widget *child;
+ int c_w = 0, c_h = 0; /* child width/height */
+ int c_x = 0, c_y = 0; /* child x/y coordinate */
+ int col, row;
+ void (*go_next)(Ewl_Grid *g, int *c, int *r);
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_GRID_TYPE);
+
+ g = EWL_GRID(w);
+
+ if (!g->map)
+ ewl_grid_map_recalc(g);
+
+ if (g->data_dirty)
+ ewl_grid_child_data_collect(g);
+
+ ewl_grid_resize(g);
+
+ /*
+ * setup the position stuff for the floating
+ * widgets
+ */
+ ewl_grid_map_start_position_get(g, &col, &row);
+ if (g->orientation == EWL_ORIENTATION_HORIZONTAL)
+ go_next = ewl_grid_hmap_position_next;
+ else
+ go_next = ewl_grid_vmap_position_next;
+
+ ecore_dlist_first_goto(EWL_CONTAINER(w)->children);
+ while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children))) {
+ if (UNMANAGED(child))
+ continue;
+
+ c = (Ewl_Grid_Child *)ewl_widget_data_get(child, (void *) g);
+ if (c) {
+ /*
+ * calculate the geometry of the fixed widgets
+ */
+ /* calculate child widgets width */
+ c_w = g->col_size[c->end_col].current_pos
+ - g->col_size[c->start_col].current_pos
+ + g->col_size[c->end_col].current_size;
+
+ /* calculate child widgets height */
+ c_h = g->row_size[c->end_row].current_pos
+ - g->row_size[c->start_row].current_pos
+ + g->row_size[c->end_row].current_size;
+
+ /* calculate child widgets x coordinate */
+ c_x = g->col_size[c->start_col].current_pos;
+
+ /* calculate child widgets y coordinate */
+ c_y = g->row_size[c->start_row].current_pos;
+ }
+ else {
+ /*
+ * get the geometry of the non-fixed widgets
+ */
+ c_w = g->col_size[col].current_size;
+ c_h = g->row_size[row].current_size;
+ c_x = g->col_size[col].current_pos;
+ c_y = g->row_size[row].current_pos;
+
+ go_next(g, &col, &row);
+ }
+
+ ewl_object_place(EWL_OBJECT(child), c_x, c_y, c_w, c_h);
+ ewl_widget_configure(child);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -978,21 +978,21 @@ ewl_grid_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_grid_cb_destroy(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Grid *g;
+ Ewl_Grid *g;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_GRID_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_GRID_TYPE);
- g = EWL_GRID(w);
+ g = EWL_GRID(w);
- IF_FREE(g->map);
- IF_FREE(g->col_size)
- IF_FREE(g->row_size)
+ IF_FREE(g->map);
+ IF_FREE(g->col_size)
+ IF_FREE(g->row_size)
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1004,35 +1004,35 @@ ewl_grid_cb_destroy(Ewl_Widget *w, void *ev_data __UNUSED__,
static void
ewl_grid_map_recalc(Ewl_Grid *g)
{
- Ewl_Widget *child;
- Ewl_Grid_Child *c;
- int l, k;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(g);
- DCHECK_TYPE(g, EWL_GRID_TYPE);
-
- IF_FREE(g->map);
- g->map = NEW(char, g->cols * g->rows);
-
- ecore_dlist_first_goto(EWL_CONTAINER(g)->children);
- while ((child = ecore_dlist_next(EWL_CONTAINER(g)->children))) {
- if (UNMANAGED(child))
- continue;
-
- c = (Ewl_Grid_Child *) ewl_widget_data_get(child, (void *)g);
- if (!c) continue;
-
- /*
- * mark all positions that content a positioned widget
- */
- for (l = c->start_col; l <= c->end_col && l < g->cols; l++)
- for (k = c->start_row; k <= c->end_row
- && k < g->rows; k++)
- g->map[g->cols * k + l] = 1;
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Widget *child;
+ Ewl_Grid_Child *c;
+ int l, k;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(g);
+ DCHECK_TYPE(g, EWL_GRID_TYPE);
+
+ IF_FREE(g->map);
+ g->map = NEW(char, g->cols * g->rows);
+
+ ecore_dlist_first_goto(EWL_CONTAINER(g)->children);
+ while ((child = ecore_dlist_next(EWL_CONTAINER(g)->children))) {
+ if (UNMANAGED(child))
+ continue;
+
+ c = (Ewl_Grid_Child *) ewl_widget_data_get(child, (void *)g);
+ if (!c) continue;
+
+ /*
+ * mark all positions that content a positioned widget
+ */
+ for (l = c->start_col; l <= c->end_col && l < g->cols; l++)
+ for (k = c->start_row; k <= c->end_row
+ && k < g->rows; k++)
+ g->map[g->cols * k + l] = 1;
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1044,164 +1044,164 @@ ewl_grid_map_recalc(Ewl_Grid *g)
static void
ewl_grid_child_data_collect(Ewl_Grid *g)
{
- int col, row;
- Ewl_Grid_Child *c;
- Ewl_Widget *child;
- void (*go_next)(Ewl_Grid *g, int *c, int *r);
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(g);
- DCHECK_TYPE(g, EWL_GRID_TYPE);
-
- if (!g->map)
- ewl_grid_map_recalc(g);
-
- /*
- * setup the position stuff for the floating
- * widgets
- */
- ewl_grid_map_start_position_get(g, &col, &row);
- if (g->orientation == EWL_ORIENTATION_HORIZONTAL)
- go_next = ewl_grid_hmap_position_next;
- else
- go_next = ewl_grid_vmap_position_next;
-
- /*
- * First collect the data of the non-fixed postion widgets
- */
- ecore_dlist_first_goto(EWL_CONTAINER(g)->children);
- while ((child = ecore_dlist_next(EWL_CONTAINER(g)->children))) {
- int pref_w, pref_h;
-
- if (UNMANAGED(child))
- continue;
-
- c = (Ewl_Grid_Child *) ewl_widget_data_get(child, (void *) g);
- if (c) continue;
-
- /*
- * go to the next free place
- */
- pref_w = ewl_object_preferred_w_get(EWL_OBJECT(child));
- pref_h = ewl_object_preferred_h_get(EWL_OBJECT(child));
- g->col_size[col].preferred_size =
- MAX(g->col_size[col].preferred_size, pref_w);
- g->row_size[row].preferred_size =
- MAX(g->row_size[row].preferred_size, pref_h);
-
- go_next(g, &col, &row);
- }
-
- /*
- * and now collect the data of the fixed postion widgets
- */
- ecore_dlist_first_goto(EWL_CONTAINER(g)->children);
- while ((child = ecore_dlist_next(EWL_CONTAINER(g)->children))) {
- int pref_w = 0, pref_h = 0;
- int i;
-
- if (UNMANAGED(child))
- continue;
-
- c = (Ewl_Grid_Child *) ewl_widget_data_get(child, (void *) g);
- if (!c) continue;
-
- /*
- * first calculate the current preferred size
- * of the cells
- */
- for (i = c->start_col; i <= c->end_col; i++)
- pref_w += g->col_size[i].preferred_size;
-
- for (i = c->start_row; i <= c->end_row; i++)
- pref_h += g->row_size[i].preferred_size;
-
- pref_w = ewl_object_preferred_w_get(EWL_OBJECT(child)) - pref_w;
- pref_h = ewl_object_preferred_h_get(EWL_OBJECT(child)) - pref_h;
-
- if (pref_w > 0) {
- pref_w /= c->end_col - c->start_col + 1;
- for (i = c->start_col; i <= c->end_col; i++)
- g->col_size[i].preferred_size += pref_w;
- }
-
- if (pref_h > 0) {
- pref_h /= c->end_row - c->start_row + 1;
- for (i = c->start_row; i <= c->end_row; i++)
- g->row_size[i].preferred_size += pref_h;
- }
- }
-
- /*
- * calculate the preferred size
- */
- if (g->homogeneous_h) {
- int i, size;
-
- for (i = 0, size = 0; i < g->cols; i++)
- size = MAX(size, g->col_size[i].preferred_size);
-
- ewl_object_preferred_inner_w_set(EWL_OBJECT(g), size * g->cols);
- }
- else {
- float rel;
- int i, fixed;
-
- rel = 0.0;
- fixed = 0;
- for (i = 0; i < g->cols; i++) {
- switch (g->col_size[i].resize_type) {
- case EWL_GRID_RESIZE_RELATIVE:
- rel += g->col_size[i].user.rel_size;
- break;
-
- case EWL_GRID_RESIZE_FIXED:
- fixed += g->col_size[i].user.size;
- break;
-
- default:
- fixed += g->col_size[i].preferred_size;
- }
- }
- ewl_object_preferred_inner_w_set(EWL_OBJECT(g),
- (int)(fixed / (1.0 - rel)));
- }
-
- if (g->homogeneous_v) {
- int i, size;
-
- for (i = 0, size = 0; i < g->rows; i++)
- size = MAX(size, g->row_size[i].preferred_size);
-
- ewl_object_preferred_inner_h_set(EWL_OBJECT(g), size * g->rows);
- }
- else {
- float rel;
- int i, fixed;
-
- rel = 0.0;
- fixed = 0;
- for (i = 0; i < g->rows; i++) {
- switch (g->row_size[i].resize_type) {
- case EWL_GRID_RESIZE_RELATIVE:
- rel += g->row_size[i].user.rel_size;
- break;
-
- case EWL_GRID_RESIZE_FIXED:
- fixed += g->row_size[i].user.size;
- break;
-
- default:
- fixed += g->row_size[i].preferred_size;
- }
- }
- ewl_object_preferred_inner_h_set(EWL_OBJECT(g),
- (int)(fixed / (1.0 - rel)));
- }
-
- g->data_dirty = FALSE;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int col, row;
+ Ewl_Grid_Child *c;
+ Ewl_Widget *child;
+ void (*go_next)(Ewl_Grid *g, int *c, int *r);
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(g);
+ DCHECK_TYPE(g, EWL_GRID_TYPE);
+
+ if (!g->map)
+ ewl_grid_map_recalc(g);
+
+ /*
+ * setup the position stuff for the floating
+ * widgets
+ */
+ ewl_grid_map_start_position_get(g, &col, &row);
+ if (g->orientation == EWL_ORIENTATION_HORIZONTAL)
+ go_next = ewl_grid_hmap_position_next;
+ else
+ go_next = ewl_grid_vmap_position_next;
+
+ /*
+ * First collect the data of the non-fixed postion widgets
+ */
+ ecore_dlist_first_goto(EWL_CONTAINER(g)->children);
+ while ((child = ecore_dlist_next(EWL_CONTAINER(g)->children))) {
+ int pref_w, pref_h;
+
+ if (UNMANAGED(child))
+ continue;
+
+ c = (Ewl_Grid_Child *) ewl_widget_data_get(child, (void *) g);
+ if (c) continue;
+
+ /*
+ * go to the next free place
+ */
+ pref_w = ewl_object_preferred_w_get(EWL_OBJECT(child));
+ pref_h = ewl_object_preferred_h_get(EWL_OBJECT(child));
+ g->col_size[col].preferred_size =
+ MAX(g->col_size[col].preferred_size, pref_w);
+ g->row_size[row].preferred_size =
+ MAX(g->row_size[row].preferred_size, pref_h);
+
+ go_next(g, &col, &row);
+ }
+
+ /*
+ * and now collect the data of the fixed postion widgets
+ */
+ ecore_dlist_first_goto(EWL_CONTAINER(g)->children);
+ while ((child = ecore_dlist_next(EWL_CONTAINER(g)->children))) {
+ int pref_w = 0, pref_h = 0;
+ int i;
+
+ if (UNMANAGED(child))
+ continue;
+
+ c = (Ewl_Grid_Child *) ewl_widget_data_get(child, (void *) g);
+ if (!c) continue;
+
+ /*
+ * first calculate the current preferred size
+ * of the cells
+ */
+ for (i = c->start_col; i <= c->end_col; i++)
+ pref_w += g->col_size[i].preferred_size;
+
+ for (i = c->start_row; i <= c->end_row; i++)
+ pref_h += g->row_size[i].preferred_size;
+
+ pref_w = ewl_object_preferred_w_get(EWL_OBJECT(child)) - pref_w;
+ pref_h = ewl_object_preferred_h_get(EWL_OBJECT(child)) - pref_h;
+
+ if (pref_w > 0) {
+ pref_w /= c->end_col - c->start_col + 1;
+ for (i = c->start_col; i <= c->end_col; i++)
+ g->col_size[i].preferred_size += pref_w;
+ }
+
+ if (pref_h > 0) {
+ pref_h /= c->end_row - c->start_row + 1;
+ for (i = c->start_row; i <= c->end_row; i++)
+ g->row_size[i].preferred_size += pref_h;
+ }
+ }
+
+ /*
+ * calculate the preferred size
+ */
+ if (g->homogeneous_h) {
+ int i, size;
+
+ for (i = 0, size = 0; i < g->cols; i++)
+ size = MAX(size, g->col_size[i].preferred_size);
+
+ ewl_object_preferred_inner_w_set(EWL_OBJECT(g), size * g->cols);
+ }
+ else {
+ float rel;
+ int i, fixed;
+
+ rel = 0.0;
+ fixed = 0;
+ for (i = 0; i < g->cols; i++) {
+ switch (g->col_size[i].resize_type) {
+ case EWL_GRID_RESIZE_RELATIVE:
+ rel += g->col_size[i].user.rel_size;
+ break;
+
+ case EWL_GRID_RESIZE_FIXED:
+ fixed += g->col_size[i].user.size;
+ break;
+
+ default:
+ fixed += g->col_size[i].preferred_size;
+ }
+ }
+ ewl_object_preferred_inner_w_set(EWL_OBJECT(g),
+ (int)(fixed / (1.0 - rel)));
+ }
+
+ if (g->homogeneous_v) {
+ int i, size;
+
+ for (i = 0, size = 0; i < g->rows; i++)
+ size = MAX(size, g->row_size[i].preferred_size);
+
+ ewl_object_preferred_inner_h_set(EWL_OBJECT(g), size * g->rows);
+ }
+ else {
+ float rel;
+ int i, fixed;
+
+ rel = 0.0;
+ fixed = 0;
+ for (i = 0; i < g->rows; i++) {
+ switch (g->row_size[i].resize_type) {
+ case EWL_GRID_RESIZE_RELATIVE:
+ rel += g->row_size[i].user.rel_size;
+ break;
+
+ case EWL_GRID_RESIZE_FIXED:
+ fixed += g->row_size[i].user.size;
+ break;
+
+ default:
+ fixed += g->row_size[i].preferred_size;
+ }
+ }
+ ewl_object_preferred_inner_h_set(EWL_OBJECT(g),
+ (int)(fixed / (1.0 - rel)));
+ }
+
+ g->data_dirty = FALSE;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1213,197 +1213,197 @@ ewl_grid_child_data_collect(Ewl_Grid *g)
static void
ewl_grid_resize(Ewl_Grid *g)
{
- int i, new_w = 0, new_h = 0;
- int left_over, left_over2;
- int pos;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(g);
- DCHECK_TYPE(g, EWL_GRID_TYPE);
-
- new_w = CURRENT_W(g);
- new_h = CURRENT_H(g);
-
- /*
- * calculated the new columns' widths
- */
- if (g->homogeneous_h) {
- for (i = 0; i < g->cols; i++)
- g->col_size[i].current_size = new_w / g->cols;
- }
- else {
- int var; /* the variable size part */
- int fixed; /* the fixed size part */
- double rel;
-
- var = fixed = 0;
- /*
- * first we calculate the different parts of the size
- */
- for (i = 0; i < g->cols; i++) {
- switch (g->col_size[i].resize_type) {
- case EWL_GRID_RESIZE_RELATIVE:
- fixed += g->col_size[i].user.rel_size
- * new_w;
- g->col_size[i].current_size =
- g->col_size[i].user.rel_size
- * new_w;
- break;
-
- case EWL_GRID_RESIZE_FIXED:
- fixed += g->col_size[i].user.size;
- g->col_size[i].current_size =
- g->col_size[i].user.size;
- break;
-
- case EWL_GRID_RESIZE_NONE:
- fixed += g->col_size[i].preferred_size;
- g->col_size[i].current_size =
- g->col_size[i].preferred_size;
- break;
-
- default:
- var += g->col_size[i].preferred_size;
-
- }
- }
-
- /*
- * we can only distribute the rest size to the
- * non-fixed ones
- */
- if (var != 0) {
- rel = (double)(new_w - fixed) / (double)var;
- for (i = 0; i < g->cols; i++) {
- if (g->col_size[i].resize_type
- != EWL_GRID_RESIZE_NORMAL)
- continue;
-
- g->col_size[i].current_size =
- (int)(g->col_size[i].preferred_size
- * rel);
- }
- }
- }
-
- /*
- * calculated the new rows' heights
- */
- if (g->homogeneous_v) {
- for (i = 0; i < g->rows; i++)
- g->row_size[i].current_size = new_h / g->rows;
- }
- else {
- int var; /* the variable size part */
- int fixed; /* the fixed size part */
- double rel;
-
- var = fixed = 0;
- /*
- * first we calculate the different parts of the size
- */
- for (i = 0; i < g->rows; i++) {
- switch (g->row_size[i].resize_type) {
- case EWL_GRID_RESIZE_RELATIVE:
- fixed += g->row_size[i].user.rel_size
- * new_h;
- g->row_size[i].current_size =
- g->row_size[i].user.rel_size
- * new_h;
- break;
-
- case EWL_GRID_RESIZE_FIXED:
- fixed += g->row_size[i].user.size;
- g->row_size[i].current_size =
- g->row_size[i].user.size;
- break;
-
- case EWL_GRID_RESIZE_NONE:
- fixed += g->row_size[i].preferred_size;
- g->row_size[i].current_size =
- g->row_size[i].preferred_size;
- break;
-
- default:
- var += g->row_size[i].preferred_size;
- }
- }
-
- /*
- * we can only distribute the rest size to the
- * non-fixed ones
- */
- if (var != 0) {
- rel = (double)(new_h - fixed) / (double)var;
- for (i = 0; i < g->rows; i++) {
- if (g->row_size[i].resize_type
- != EWL_GRID_RESIZE_NORMAL)
- continue;
-
- g->row_size[i].current_size =
- (int)(g->row_size[i].preferred_size
- * rel);
- }
- }
- }
-
- /*
- * since the above set values may be doubles rounded down there
- * might be some more space to fill at the right and bottom.
- * this claims the left over space
- */
- left_over = new_w;
- for (i = 0; i < g->cols; i++)
- left_over -= g->col_size[i].current_size;
-
- if (g->cols == 0)
- g->cols = 1;
-
- while (left_over != 0) {
- if (left_over > 0) {
- g->col_size[left_over % g->cols].current_size += 1;
- left_over--;
- } else if (left_over < 0) {
- left_over2 = 0 - left_over;
- g->col_size[left_over2 % g->cols].current_size -= 1;
- left_over++;
- }
- }
-
- left_over = new_h;
- for (i = 0; i < g->rows; i++)
- left_over -= g->row_size[i].current_size;
-
- if (g->rows == 0)
- g->rows = 1;
-
- while (left_over != 0) {
- if (left_over > 0) {
- g->row_size[left_over % g->rows].current_size += 1;
- left_over--;
- } else if (left_over < 0) {
- left_over2 = 0 - left_over;
- g->row_size[left_over2 % g->rows].current_size -= 1;
- left_over++;
- }
- }
-
- /*
- * calculate the positions
- */
- pos = CURRENT_X(g);
- for (i = 0; i < g->cols; i++) {
- g->col_size[i].current_pos = pos;
- pos += g->col_size[i].current_size;
- }
-
- pos = CURRENT_Y(g);
- for (i = 0; i < g->rows; i++) {
- g->row_size[i].current_pos = pos;
- pos += g->row_size[i].current_size;
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int i, new_w = 0, new_h = 0;
+ int left_over, left_over2;
+ int pos;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(g);
+ DCHECK_TYPE(g, EWL_GRID_TYPE);
+
+ new_w = CURRENT_W(g);
+ new_h = CURRENT_H(g);
+
+ /*
+ * calculated the new columns' widths
+ */
+ if (g->homogeneous_h) {
+ for (i = 0; i < g->cols; i++)
+ g->col_size[i].current_size = new_w / g->cols;
+ }
+ else {
+ int var; /* the variable size part */
+ int fixed; /* the fixed size part */
+ double rel;
+
+ var = fixed = 0;
+ /*
+ * first we calculate the different parts of the size
+ */
+ for (i = 0; i < g->cols; i++) {
+ switch (g->col_size[i].resize_type) {
+ case EWL_GRID_RESIZE_RELATIVE:
+ fixed += g->col_size[i].user.rel_size
+ * new_w;
+ g->col_size[i].current_size =
+ g->col_size[i].user.rel_size
+ * new_w;
+ break;
+
+ case EWL_GRID_RESIZE_FIXED:
+ fixed += g->col_size[i].user.size;
+ g->col_size[i].current_size =
+ g->col_size[i].user.size;
+ break;
+
+ case EWL_GRID_RESIZE_NONE:
+ fixed += g->col_size[i].preferred_size;
+ g->col_size[i].current_size =
+ g->col_size[i].preferred_size;
+ break;
+
+ default:
+ var += g->col_size[i].preferred_size;
+
+ }
+ }
+
+ /*
+ * we can only distribute the rest size to the
+ * non-fixed ones
+ */
+ if (var != 0) {
+ rel = (double)(new_w - fixed) / (double)var;
+ for (i = 0; i < g->cols; i++) {
+ if (g->col_size[i].resize_type
+ != EWL_GRID_RESIZE_NORMAL)
+ continue;
+
+ g->col_size[i].current_size =
+ (int)(g->col_size[i].preferred_size
+ * rel);
+ }
+ }
+ }
+
+ /*
+ * calculated the new rows' heights
+ */
+ if (g->homogeneous_v) {
+ for (i = 0; i < g->rows; i++)
+ g->row_size[i].current_size = new_h / g->rows;
+ }
+ else {
+ int var; /* the variable size part */
+ int fixed; /* the fixed size part */
+ double rel;
+
+ var = fixed = 0;
+ /*
+ * first we calculate the different parts of the size
+ */
+ for (i = 0; i < g->rows; i++) {
+ switch (g->row_size[i].resize_type) {
+ case EWL_GRID_RESIZE_RELATIVE:
+ fixed += g->row_size[i].user.rel_size
+ * new_h;
+ g->row_size[i].current_size =
+ g->row_size[i].user.rel_size
+ * new_h;
+ break;
+
+ case EWL_GRID_RESIZE_FIXED:
+ fixed += g->row_size[i].user.size;
+ g->row_size[i].current_size =
+ g->row_size[i].user.size;
+ break;
+
+ case EWL_GRID_RESIZE_NONE:
+ fixed += g->row_size[i].preferred_size;
+ g->row_size[i].current_size =
+ g->row_size[i].preferred_size;
+ break;
+
+ default:
+ var += g->row_size[i].preferred_size;
+ }
+ }
+
+ /*
+ * we can only distribute the rest size to the
+ * non-fixed ones
+ */
+ if (var != 0) {
+ rel = (double)(new_h - fixed) / (double)var;
+ for (i = 0; i < g->rows; i++) {
+ if (g->row_size[i].resize_type
+ != EWL_GRID_RESIZE_NORMAL)
+ continue;
+
+ g->row_size[i].current_size =
+ (int)(g->row_size[i].preferred_size
+ * rel);
+ }
+ }
+ }
+
+ /*
+ * since the above set values may be doubles rounded down there
+ * might be some more space to fill at the right and bottom.
+ * this claims the left over space
+ */
+ left_over = new_w;
+ for (i = 0; i < g->cols; i++)
+ left_over -= g->col_size[i].current_size;
+
+ if (g->cols == 0)
+ g->cols = 1;
+
+ while (left_over != 0) {
+ if (left_over > 0) {
+ g->col_size[left_over % g->cols].current_size += 1;
+ left_over--;
+ } else if (left_over < 0) {
+ left_over2 = 0 - left_over;
+ g->col_size[left_over2 % g->cols].current_size -= 1;
+ left_over++;
+ }
+ }
+
+ left_over = new_h;
+ for (i = 0; i < g->rows; i++)
+ left_over -= g->row_size[i].current_size;
+
+ if (g->rows == 0)
+ g->rows = 1;
+
+ while (left_over != 0) {
+ if (left_over > 0) {
+ g->row_size[left_over % g->rows].current_size += 1;
+ left_over--;
+ } else if (left_over < 0) {
+ left_over2 = 0 - left_over;
+ g->row_size[left_over2 % g->rows].current_size -= 1;
+ left_over++;
+ }
+ }
+
+ /*
+ * calculate the positions
+ */
+ pos = CURRENT_X(g);
+ for (i = 0; i < g->cols; i++) {
+ g->col_size[i].current_pos = pos;
+ pos += g->col_size[i].current_size;
+ }
+
+ pos = CURRENT_Y(g);
+ for (i = 0; i < g->rows; i++) {
+ g->row_size[i].current_pos = pos;
+ pos += g->row_size[i].current_size;
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1419,29 +1419,29 @@ ewl_grid_resize(Ewl_Grid *g)
static void
ewl_grid_hmap_position_next(Ewl_Grid *g, int *c, int *r)
{
- int col, row;
+ int col, row;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(g);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(r);
- DCHECK_TYPE(g, EWL_GRID_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(g);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(r);
+ DCHECK_TYPE(g, EWL_GRID_TYPE);
- col = *c;
- row = *r;
+ col = *c;
+ row = *r;
- do {
- col++;
- if (col >= g->cols) {
- col = 0;
- row++;
- }
- } while (g->map[col + (row * g->cols)] != 0);
+ do {
+ col++;
+ if (col >= g->cols) {
+ col = 0;
+ row++;
+ }
+ } while (g->map[col + (row * g->cols)] != 0);
- *c = col;
- *r = row;
+ *c = col;
+ *r = row;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1457,29 +1457,29 @@ ewl_grid_hmap_position_next(Ewl_Grid *g, int *c, int *r)
static void
ewl_grid_vmap_position_next(Ewl_Grid *g, int *c, int *r)
{
- int col, row;
+ int col, row;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(g);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(r);
- DCHECK_TYPE(g, EWL_GRID_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(g);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(r);
+ DCHECK_TYPE(g, EWL_GRID_TYPE);
- col = *c;
- row = *r;
+ col = *c;
+ row = *r;
- do {
- row++;
- if (row >= g->rows) {
- row = 0;
- col++;
- }
- } while (g->map[col + (row * g->cols)] != 0);
+ do {
+ row++;
+ if (row >= g->rows) {
+ row = 0;
+ col++;
+ }
+ } while (g->map[col + (row * g->cols)] != 0);
- *c = col;
- *r = row;
+ *c = col;
+ *r = row;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1493,23 +1493,23 @@ ewl_grid_vmap_position_next(Ewl_Grid *g, int *c, int *r)
static void
ewl_grid_map_start_position_get(Ewl_Grid *g, int *c, int *r)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(g);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(r);
- DCHECK_TYPE(g, EWL_GRID_TYPE);
-
- *c = 0;
- *r = 0;
-
- if (g->map && *g->map != 0) {
- if (g->orientation == EWL_ORIENTATION_HORIZONTAL)
- ewl_grid_hmap_position_next(g, c, r);
- else
- ewl_grid_vmap_position_next(g, c, r);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(g);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(r);
+ DCHECK_TYPE(g, EWL_GRID_TYPE);
+
+ *c = 0;
+ *r = 0;
+
+ if (g->map && *g->map != 0) {
+ if (g->orientation == EWL_ORIENTATION_HORIZONTAL)
+ ewl_grid_hmap_position_next(g, c, r);
+ else
+ ewl_grid_vmap_position_next(g, c, r);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1522,26 +1522,26 @@ ewl_grid_map_start_position_get(Ewl_Grid *g, int *c, int *r)
void
ewl_grid_cb_child_add(Ewl_Container *p, Ewl_Widget *c __UNUSED__)
{
- Ewl_Grid *g;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_TYPE(p, EWL_GRID_TYPE);
-
- g = EWL_GRID(p);
- g->data_dirty = TRUE;
- g->space++;
-
- if (g->space > (g->cols * g->rows)) {
- if (g->orientation == EWL_ORIENTATION_HORIZONTAL)
- ewl_grid_dimensions_set(g, g->cols,
- (g->space / g->cols) + 1);
- else
- ewl_grid_dimensions_set(g, (g->space / g->rows) + 1,
- g->rows);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Grid *g;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_TYPE(p, EWL_GRID_TYPE);
+
+ g = EWL_GRID(p);
+ g->data_dirty = TRUE;
+ g->space++;
+
+ if (g->space > (g->cols * g->rows)) {
+ if (g->orientation == EWL_ORIENTATION_HORIZONTAL)
+ ewl_grid_dimensions_set(g, g->cols,
+ (g->space / g->cols) + 1);
+ else
+ ewl_grid_dimensions_set(g, (g->space / g->rows) + 1,
+ g->rows);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1555,30 +1555,30 @@ ewl_grid_cb_child_add(Ewl_Container *p, Ewl_Widget *c __UNUSED__)
void
ewl_grid_cb_child_remove(Ewl_Container *c, Ewl_Widget *w, int idx __UNUSED__)
{
- Ewl_Grid_Child *child;
- Ewl_Grid *g;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_GRID_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- g = EWL_GRID(c);
- child = (Ewl_Grid_Child *)ewl_widget_data_get(w, g);
-
- if (child) {
- g->space -= (child->end_row - child->start_row + 1)
- * (child->end_col - child->start_col + 1);
- FREE(child);
- }
- else
- g->space--;
-
- IF_FREE(g->map);
- g->data_dirty = TRUE;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Grid_Child *child;
+ Ewl_Grid *g;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_GRID_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ g = EWL_GRID(c);
+ child = (Ewl_Grid_Child *)ewl_widget_data_get(w, g);
+
+ if (child) {
+ g->space -= (child->end_row - child->start_row + 1)
+ * (child->end_col - child->start_col + 1);
+ FREE(child);
+ }
+ else
+ g->space--;
+
+ IF_FREE(g->map);
+ g->data_dirty = TRUE;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1591,14 +1591,14 @@ ewl_grid_cb_child_remove(Ewl_Container *c, Ewl_Widget *w, int idx __UNUSED__)
void
ewl_grid_cb_child_show(Ewl_Container *p, Ewl_Widget *child __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_TYPE(p, EWL_GRID_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_TYPE(p, EWL_GRID_TYPE);
- EWL_GRID(p)->data_dirty = TRUE;
- ewl_grid_child_data_collect(EWL_GRID(p));
+ EWL_GRID(p)->data_dirty = TRUE;
+ ewl_grid_child_data_collect(EWL_GRID(p));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1612,16 +1612,16 @@ ewl_grid_cb_child_show(Ewl_Container *p, Ewl_Widget *child __UNUSED__)
*/
void
ewl_grid_cb_child_resize(Ewl_Container *p, Ewl_Widget *child __UNUSED__,
- int size __UNUSED__,
- Ewl_Orientation o __UNUSED__)
+ int size __UNUSED__,
+ Ewl_Orientation o __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_TYPE(p, EWL_GRID_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_TYPE(p, EWL_GRID_TYPE);
- EWL_GRID(p)->data_dirty = TRUE;
- ewl_widget_configure(EWL_WIDGET(p));
+ EWL_GRID(p)->data_dirty = TRUE;
+ ewl_widget_configure(EWL_WIDGET(p));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_grid.h b/src/lib/ewl_grid.h
index 8d0e076..841e2ae 100644
--- a/src/lib/ewl_grid.h
+++ b/src/lib/ewl_grid.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_GRID_H
#define EWL_GRID_H
@@ -41,15 +41,15 @@ typedef struct Ewl_Grid_Info Ewl_Grid_Info;
*/
struct Ewl_Grid_Info
{
- int current_size; /**< the current size */
- int current_pos; /**< the current position */
- int preferred_size; /**< The greatest preferred size of a widget inside */
- union {
- int size; /**< The size set by the user */
- float rel_size; /**< The relative size */
- } user; /**< The user set values for the grid */
-
- Ewl_Grid_Resize_Type resize_type; /**< Are there values set by the user */
+ int current_size; /**< the current size */
+ int current_pos; /**< the current position */
+ int preferred_size; /**< The greatest preferred size of a widget inside */
+ union {
+ int size; /**< The size set by the user */
+ float rel_size; /**< The relative size */
+ } user; /**< The user set values for the grid */
+
+ Ewl_Grid_Resize_Type resize_type; /**< Are there values set by the user */
};
/**
@@ -68,22 +68,22 @@ typedef struct Ewl_Grid Ewl_Grid;
*/
struct Ewl_Grid
{
- Ewl_Container container; /**< Inherit from Ewl_Container */
+ Ewl_Container container; /**< Inherit from Ewl_Container */
- Ewl_Grid_Info *col_size; /**< Horizontal/vertical size of the columns */
- Ewl_Grid_Info *row_size; /**< Horizontal/vertical size of the rows */
- unsigned char data_dirty:1; /**< flag if the size of the columns and rows must
- be recalculated */
- unsigned char homogeneous_h:1; /**< Horizontal homogeneous flag */
- unsigned char homogeneous_v:1; /**< Vertical homogeneous flag */
+ Ewl_Grid_Info *col_size; /**< Horizontal/vertical size of the columns */
+ Ewl_Grid_Info *row_size; /**< Horizontal/vertical size of the rows */
+ unsigned char data_dirty:1; /**< flag if the size of the columns and rows must
+ be recalculated */
+ unsigned char homogeneous_h:1; /**< Horizontal homogeneous flag */
+ unsigned char homogeneous_v:1; /**< Vertical homogeneous flag */
- Ewl_Orientation orientation; /**< The grid orientation */
+ Ewl_Orientation orientation; /**< The grid orientation */
- int rows; /**< Row count */
- int cols; /**< Column count */
- int space; /**< Space count */
+ int rows; /**< Row count */
+ int cols; /**< Column count */
+ int space; /**< Space count */
- char *map; /**< Map of the child that have a postion */
+ char *map; /**< Map of the child that have a postion */
};
/**
@@ -96,52 +96,52 @@ typedef struct Ewl_Grid_Child Ewl_Grid_Child;
*/
struct Ewl_Grid_Child
{
- int start_col; /**< The start column */
- int start_row; /**< The start row */
+ int start_col; /**< The start column */
+ int start_row; /**< The start row */
- int end_col; /**< The end column */
- int end_row; /**< The end row */
+ int end_col; /**< The end column */
+ int end_row; /**< The end row */
};
-Ewl_Widget *ewl_grid_new(void);
-int ewl_grid_init(Ewl_Grid *g);
+Ewl_Widget *ewl_grid_new(void);
+int ewl_grid_init(Ewl_Grid *g);
-void ewl_grid_child_position_set(Ewl_Grid *g, Ewl_Widget *child,
- int start_col, int end_col, int start_row,
- int end_row);
-void ewl_grid_child_position_get(Ewl_Grid *g, Ewl_Widget *child,
- int *start_col, int *end_col, int *start_row,
- int *end_row);
+void ewl_grid_child_position_set(Ewl_Grid *g, Ewl_Widget *child,
+ int start_col, int end_col, int start_row,
+ int end_row);
+void ewl_grid_child_position_get(Ewl_Grid *g, Ewl_Widget *child,
+ int *start_col, int *end_col, int *start_row,
+ int *end_row);
-void ewl_grid_dimensions_set(Ewl_Grid *g, int col, int row);
-void ewl_grid_dimensions_get(Ewl_Grid *g, int *col, int *row);
+void ewl_grid_dimensions_set(Ewl_Grid *g, int col, int row);
+void ewl_grid_dimensions_get(Ewl_Grid *g, int *col, int *row);
-int ewl_grid_column_current_w_get(Ewl_Grid *g, int col);
-void ewl_grid_column_fixed_w_set(Ewl_Grid *g, int col, int width);
-int ewl_grid_column_fixed_w_get(Ewl_Grid *g, int col);
-void ewl_grid_column_relative_w_set(Ewl_Grid *g, int col, float relw);
-float ewl_grid_column_relative_w_get(Ewl_Grid *g, int col);
-void ewl_grid_column_preferred_w_use(Ewl_Grid *g, int col);
-void ewl_grid_column_w_remove(Ewl_Grid *g, int col);
+int ewl_grid_column_current_w_get(Ewl_Grid *g, int col);
+void ewl_grid_column_fixed_w_set(Ewl_Grid *g, int col, int width);
+int ewl_grid_column_fixed_w_get(Ewl_Grid *g, int col);
+void ewl_grid_column_relative_w_set(Ewl_Grid *g, int col, float relw);
+float ewl_grid_column_relative_w_get(Ewl_Grid *g, int col);
+void ewl_grid_column_preferred_w_use(Ewl_Grid *g, int col);
+void ewl_grid_column_w_remove(Ewl_Grid *g, int col);
-int ewl_grid_row_current_h_get(Ewl_Grid *g, int row);
-void ewl_grid_row_fixed_h_set(Ewl_Grid *g, int row, int height);
-int ewl_grid_row_fixed_h_get(Ewl_Grid *g, int row);
-void ewl_grid_row_relative_h_set(Ewl_Grid *g, int col, float relh);
-float ewl_grid_row_relative_h_get(Ewl_Grid *g, int col);
-void ewl_grid_row_preferred_h_use(Ewl_Grid *g, int col);
-void ewl_grid_row_h_remove(Ewl_Grid *g, int row);
+int ewl_grid_row_current_h_get(Ewl_Grid *g, int row);
+void ewl_grid_row_fixed_h_set(Ewl_Grid *g, int row, int height);
+int ewl_grid_row_fixed_h_get(Ewl_Grid *g, int row);
+void ewl_grid_row_relative_h_set(Ewl_Grid *g, int col, float relh);
+float ewl_grid_row_relative_h_get(Ewl_Grid *g, int col);
+void ewl_grid_row_preferred_h_use(Ewl_Grid *g, int col);
+void ewl_grid_row_h_remove(Ewl_Grid *g, int row);
-void ewl_grid_orientation_set(Ewl_Grid *g, Ewl_Orientation orientation);
-Ewl_Orientation ewl_grid_orientation_get(Ewl_Grid *g);
+void ewl_grid_orientation_set(Ewl_Grid *g, Ewl_Orientation orientation);
+Ewl_Orientation ewl_grid_orientation_get(Ewl_Grid *g);
-void ewl_grid_homogeneous_set(Ewl_Grid *g, unsigned int h);
+void ewl_grid_homogeneous_set(Ewl_Grid *g, unsigned int h);
-void ewl_grid_hhomogeneous_set(Ewl_Grid *g, unsigned int h);
-unsigned int ewl_grid_hhomogeneous_get(Ewl_Grid *g);
+void ewl_grid_hhomogeneous_set(Ewl_Grid *g, unsigned int h);
+unsigned int ewl_grid_hhomogeneous_get(Ewl_Grid *g);
-void ewl_grid_vhomogeneous_set(Ewl_Grid *g, unsigned int h);
-unsigned int ewl_grid_vhomogeneous_get(Ewl_Grid *g);
+void ewl_grid_vhomogeneous_set(Ewl_Grid *g, unsigned int h);
+unsigned int ewl_grid_vhomogeneous_get(Ewl_Grid *g);
/*
* Internally used callbacks, override at your own risk.
@@ -152,7 +152,7 @@ void ewl_grid_cb_child_add(Ewl_Container *p, Ewl_Widget *c);
void ewl_grid_cb_child_remove(Ewl_Container *p, Ewl_Widget *c, int idx);
void ewl_grid_cb_child_show(Ewl_Container *p, Ewl_Widget *child);
void ewl_grid_cb_child_resize(Ewl_Container *p, Ewl_Widget *child,
- int size, Ewl_Orientation o);
+ int size, Ewl_Orientation o);
/**
* @}
diff --git a/src/lib/ewl_histogram.c b/src/lib/ewl_histogram.c
index 291d99b..ad12042 100644
--- a/src/lib/ewl_histogram.c
+++ b/src/lib/ewl_histogram.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_histogram.h"
#include "ewl_macros.h"
@@ -17,19 +17,19 @@ static void ewl_histogram_draw(Ewl_Histogram *hist);
Ewl_Widget *
ewl_histogram_new(void)
{
- Ewl_Histogram *hist;
+ Ewl_Histogram *hist;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- hist = NEW(Ewl_Histogram, 1);
- if (!hist)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ hist = NEW(Ewl_Histogram, 1);
+ if (!hist)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_histogram_init(hist)) {
- FREE(hist);
- }
+ if (!ewl_histogram_init(hist)) {
+ FREE(hist);
+ }
- DRETURN_PTR(EWL_WIDGET(hist), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(hist), DLEVEL_STABLE);
}
/**
@@ -40,22 +40,22 @@ ewl_histogram_new(void)
int
ewl_histogram_init(Ewl_Histogram *hist)
{
- Ewl_Widget *w = EWL_WIDGET(hist);
+ Ewl_Widget *w = EWL_WIDGET(hist);
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(hist, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(hist, FALSE);
- if (!ewl_image_init(EWL_IMAGE(hist)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_image_init(EWL_IMAGE(hist)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_appearance_set(w, EWL_HISTOGRAM_TYPE);
- ewl_widget_inherit(w, EWL_HISTOGRAM_TYPE);
- ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
- ewl_histogram_cb_configure, NULL);
- ewl_object_preferred_inner_size_set(EWL_OBJECT(hist), 256, 256);
- hist->channel = EWL_HISTOGRAM_CHANNEL_R;
+ ewl_widget_appearance_set(w, EWL_HISTOGRAM_TYPE);
+ ewl_widget_inherit(w, EWL_HISTOGRAM_TYPE);
+ ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
+ ewl_histogram_cb_configure, NULL);
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(hist), 256, 256);
+ hist->channel = EWL_HISTOGRAM_CHANNEL_R;
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -69,19 +69,19 @@ ewl_histogram_init(Ewl_Histogram *hist)
*/
void
ewl_histogram_color_set(Ewl_Histogram *hist, unsigned int r, unsigned int g,
- unsigned int b, unsigned int a)
+ unsigned int b, unsigned int a)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(hist);
- DCHECK_TYPE(hist, EWL_HISTOGRAM_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(hist);
+ DCHECK_TYPE(hist, EWL_HISTOGRAM_TYPE);
- hist->color.r = r;
- hist->color.g = g;
- hist->color.b = b;
- hist->color.a = a;
- ewl_widget_configure(EWL_WIDGET(hist));
+ hist->color.r = r;
+ hist->color.g = g;
+ hist->color.b = b;
+ hist->color.a = a;
+ ewl_widget_configure(EWL_WIDGET(hist));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -95,18 +95,18 @@ ewl_histogram_color_set(Ewl_Histogram *hist, unsigned int r, unsigned int g,
*/
void
ewl_histogram_color_get(Ewl_Histogram *hist, unsigned int *r, unsigned int *g,
- unsigned int *b, unsigned int *a)
+ unsigned int *b, unsigned int *a)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(hist);
- DCHECK_TYPE(hist, EWL_HISTOGRAM_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(hist);
+ DCHECK_TYPE(hist, EWL_HISTOGRAM_TYPE);
- if (r) *r = hist->color.r;
- if (g) *g = hist->color.g;
- if (b) *b = hist->color.b;
- if (a) *a = hist->color.a;
+ if (r) *r = hist->color.r;
+ if (g) *g = hist->color.g;
+ if (b) *b = hist->color.b;
+ if (a) *a = hist->color.a;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -118,21 +118,21 @@ ewl_histogram_color_get(Ewl_Histogram *hist, unsigned int *r, unsigned int *g,
void
ewl_histogram_channel_set(Ewl_Histogram *hist, Ewl_Histogram_Channel channel)
{
- /*
- * FIXME: Handle different histogram types, currently only outputs the Y
- * component of a YIQ conversion and RGB channels, need to handle HSV,
- * CMYK, etc.
- */
+ /*
+ * FIXME: Handle different histogram types, currently only outputs the Y
+ * component of a YIQ conversion and RGB channels, need to handle HSV,
+ * CMYK, etc.
+ */
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(hist);
- DCHECK_TYPE(hist, EWL_HISTOGRAM_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(hist);
+ DCHECK_TYPE(hist, EWL_HISTOGRAM_TYPE);
- hist->channel = channel;
- if (hist->source && REALIZED(hist->source))
- ewl_histogram_cb_data_load(EWL_WIDGET(hist), NULL, hist);
+ hist->channel = channel;
+ if (hist->source && REALIZED(hist->source))
+ ewl_histogram_cb_data_load(EWL_WIDGET(hist), NULL, hist);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -143,11 +143,11 @@ ewl_histogram_channel_set(Ewl_Histogram *hist, Ewl_Histogram_Channel channel)
Ewl_Histogram_Channel
ewl_histogram_channel_get(Ewl_Histogram *hist)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(hist, EWL_HISTOGRAM_CHANNEL_Y);
- DCHECK_TYPE_RET(hist, EWL_HISTOGRAM_TYPE, EWL_HISTOGRAM_CHANNEL_Y);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(hist, EWL_HISTOGRAM_CHANNEL_Y);
+ DCHECK_TYPE_RET(hist, EWL_HISTOGRAM_TYPE, EWL_HISTOGRAM_CHANNEL_Y);
- DRETURN_INT(hist->channel, DLEVEL_STABLE);
+ DRETURN_INT(hist->channel, DLEVEL_STABLE);
}
/**
@@ -159,21 +159,21 @@ ewl_histogram_channel_get(Ewl_Histogram *hist)
void
ewl_histogram_image_set(Ewl_Histogram *hist, Ewl_Image *image)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(hist);
- DCHECK_PARAM_PTR(image);
- DCHECK_TYPE(hist, EWL_HISTOGRAM_TYPE);
- DCHECK_TYPE(image, EWL_IMAGE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(hist);
+ DCHECK_PARAM_PTR(image);
+ DCHECK_TYPE(hist, EWL_HISTOGRAM_TYPE);
+ DCHECK_TYPE(image, EWL_IMAGE_TYPE);
- hist->source = image;
- if (REALIZED(image))
- ewl_histogram_cb_data_load(EWL_WIDGET(hist), NULL, hist);
+ hist->source = image;
+ if (REALIZED(image))
+ ewl_histogram_cb_data_load(EWL_WIDGET(hist), NULL, hist);
- /* Append the callback to catch an obscure/reveal */
- ewl_callback_append(EWL_WIDGET(image), EWL_CALLBACK_REVEAL,
- ewl_histogram_cb_data_load, hist);
+ /* Append the callback to catch an obscure/reveal */
+ ewl_callback_append(EWL_WIDGET(image), EWL_CALLBACK_REVEAL,
+ ewl_histogram_cb_data_load, hist);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -184,11 +184,11 @@ ewl_histogram_image_set(Ewl_Histogram *hist, Ewl_Image *image)
Ewl_Image *
ewl_histogram_image_get(Ewl_Histogram *hist)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(hist, NULL);
- DCHECK_TYPE_RET(hist, EWL_HISTOGRAM_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(hist, NULL);
+ DCHECK_TYPE_RET(hist, EWL_HISTOGRAM_TYPE, NULL);
- DRETURN_PTR(EWL_IMAGE(hist->source), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_IMAGE(hist->source), DLEVEL_STABLE);
}
/**
@@ -201,17 +201,17 @@ ewl_histogram_image_get(Ewl_Histogram *hist)
*/
void
ewl_histogram_cb_configure(Ewl_Widget *w, void *event __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_HISTOGRAM_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_HISTOGRAM_TYPE);
- /* Only bother drawing if we've seen some usable data. */
- if (EWL_HISTOGRAM(w)->maxv)
- ewl_histogram_draw(EWL_HISTOGRAM(w));
+ /* Only bother drawing if we've seen some usable data. */
+ if (EWL_HISTOGRAM(w)->maxv)
+ ewl_histogram_draw(EWL_HISTOGRAM(w));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
#define A_CALC(color) ((color) >> 24)
@@ -223,153 +223,153 @@ ewl_histogram_cb_configure(Ewl_Widget *w, void *event __UNUSED__,
static void
ewl_histogram_cb_data_load(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, void *h)
{
- int x, y;
- int maxv = 0;
- unsigned int *data;
- Evas_Coord width, height;
- Ewl_Histogram *hist = EWL_HISTOGRAM(h);
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(hist);
- DCHECK_TYPE(hist, EWL_HISTOGRAM_TYPE);
-
- if (!hist->source || !REALIZED(hist->source))
- DRETURN(DLEVEL_STABLE);
-
- data = evas_object_image_data_get(hist->source->image, 0);
- evas_object_image_size_get(hist->source->image, &width, &height);
-
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- unsigned int color;
- unsigned char brightness;
-
- color = *data;
- switch (hist->channel) {
-
- case EWL_HISTOGRAM_CHANNEL_R:
- brightness = R_CALC(color);
- break;
- case EWL_HISTOGRAM_CHANNEL_G:
- brightness = G_CALC(color);
- break;
- case EWL_HISTOGRAM_CHANNEL_B:
- brightness = B_CALC(color);
- break;
- case EWL_HISTOGRAM_CHANNEL_Y:
- default:
- brightness = Y_CALC(color);
- break;
- }
- hist->graph[brightness]++;
- data++;
- }
- }
-
- /*
- * Find the maximum value in the range to scale the graph. This is done
- * outside the data loop since that may have a much higher cost
- * and this lookup is over a fixed data size.
- */
- for (x = 0; x < 256; x++) {
- if (hist->graph[x] > maxv)
- maxv = hist->graph[x];
- }
-
- hist->maxv = maxv;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int x, y;
+ int maxv = 0;
+ unsigned int *data;
+ Evas_Coord width, height;
+ Ewl_Histogram *hist = EWL_HISTOGRAM(h);
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(hist);
+ DCHECK_TYPE(hist, EWL_HISTOGRAM_TYPE);
+
+ if (!hist->source || !REALIZED(hist->source))
+ DRETURN(DLEVEL_STABLE);
+
+ data = evas_object_image_data_get(hist->source->image, 0);
+ evas_object_image_size_get(hist->source->image, &width, &height);
+
+ for (y = 0; y < height; y++) {
+ for (x = 0; x < width; x++) {
+ unsigned int color;
+ unsigned char brightness;
+
+ color = *data;
+ switch (hist->channel) {
+
+ case EWL_HISTOGRAM_CHANNEL_R:
+ brightness = R_CALC(color);
+ break;
+ case EWL_HISTOGRAM_CHANNEL_G:
+ brightness = G_CALC(color);
+ break;
+ case EWL_HISTOGRAM_CHANNEL_B:
+ brightness = B_CALC(color);
+ break;
+ case EWL_HISTOGRAM_CHANNEL_Y:
+ default:
+ brightness = Y_CALC(color);
+ break;
+ }
+ hist->graph[brightness]++;
+ data++;
+ }
+ }
+
+ /*
+ * Find the maximum value in the range to scale the graph. This is done
+ * outside the data loop since that may have a much higher cost
+ * and this lookup is over a fixed data size.
+ */
+ for (x = 0; x < 256; x++) {
+ if (hist->graph[x] > maxv)
+ maxv = hist->graph[x];
+ }
+
+ hist->maxv = maxv;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_histogram_draw(Ewl_Histogram *hist)
{
- int x, y;
- unsigned int color;
- unsigned int *data, *dst;
- Evas_Coord img_w = 0, img_h = 0;
- Evas_Object *img;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(hist);
- DCHECK_TYPE(hist, EWL_HISTOGRAM_TYPE);
-
- img = EWL_IMAGE(hist)->image;
-
- evas_object_image_size_set(img, CURRENT_W(hist), CURRENT_H(hist));
- evas_object_image_alpha_set(img, 1);
- evas_object_image_size_get(img, &img_w, &img_h);
-
- dst = data = evas_object_image_data_get(img, 1);
- if (!data)
- DRETURN(DLEVEL_STABLE);
-
- /*
- * If no color specified, choose a sane default for the channel
- * represented.
- */
- if (!hist->color.a) {
- color = (unsigned int)(128 << 24);
- switch (hist->channel) {
- case EWL_HISTOGRAM_CHANNEL_R:
- color |= (unsigned int)(128 << 16);
- break;
- case EWL_HISTOGRAM_CHANNEL_G:
- color |= (unsigned int)(128 << 8);
- break;
- case EWL_HISTOGRAM_CHANNEL_B:
- color |= (unsigned int)(128);
- break;
- default:
- break;
- }
- }
- else
- color = (unsigned int)(hist->color.a << 24 |
- hist->color.r << 16 |
- hist->color.g << 8 |
- hist->color.b);
-
- for (y = 0; y < img_h; y++) {
- for (x = 0; x < img_w; x++) {
- int index;
- int cutoff;
- int x_scale;
- int w1, w2;
-
- /* Determine the base index for this x position */
- x_scale = x << 8;
- index = x_scale / img_w;
-
- /*
- * Determine distance between index points.
- * Used to determine rounding error and distance from
- * next point.
- * This is at x * 256 scale.
- */
- w1 = index * img_w;
- w2 = w1 + img_w;
-
- cutoff = hist->graph[index];
-
- /* Determine if this index should be weighted */
- if ((x_scale != w1) && (index < 255)
- && (cutoff || hist->graph[index + 1])) {
- cutoff = (cutoff * (w2 - x_scale));
- cutoff += (hist->graph[index + 1] * (x_scale - w1));
- cutoff = (cutoff / (w2 - w1));
- }
-
- cutoff = (img_h * cutoff) / hist->maxv;
-
- *dst = ((img_h - y) < cutoff ? color : 0x0);
- dst++;
- }
- }
-
- evas_object_image_data_set(img, data);
- evas_object_image_data_update_add(img, 0, 0, img_w, img_h);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int x, y;
+ unsigned int color;
+ unsigned int *data, *dst;
+ Evas_Coord img_w = 0, img_h = 0;
+ Evas_Object *img;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(hist);
+ DCHECK_TYPE(hist, EWL_HISTOGRAM_TYPE);
+
+ img = EWL_IMAGE(hist)->image;
+
+ evas_object_image_size_set(img, CURRENT_W(hist), CURRENT_H(hist));
+ evas_object_image_alpha_set(img, 1);
+ evas_object_image_size_get(img, &img_w, &img_h);
+
+ dst = data = evas_object_image_data_get(img, 1);
+ if (!data)
+ DRETURN(DLEVEL_STABLE);
+
+ /*
+ * If no color specified, choose a sane default for the channel
+ * represented.
+ */
+ if (!hist->color.a) {
+ color = (unsigned int)(128 << 24);
+ switch (hist->channel) {
+ case EWL_HISTOGRAM_CHANNEL_R:
+ color |= (unsigned int)(128 << 16);
+ break;
+ case EWL_HISTOGRAM_CHANNEL_G:
+ color |= (unsigned int)(128 << 8);
+ break;
+ case EWL_HISTOGRAM_CHANNEL_B:
+ color |= (unsigned int)(128);
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ color = (unsigned int)(hist->color.a << 24 |
+ hist->color.r << 16 |
+ hist->color.g << 8 |
+ hist->color.b);
+
+ for (y = 0; y < img_h; y++) {
+ for (x = 0; x < img_w; x++) {
+ int index;
+ int cutoff;
+ int x_scale;
+ int w1, w2;
+
+ /* Determine the base index for this x position */
+ x_scale = x << 8;
+ index = x_scale / img_w;
+
+ /*
+ * Determine distance between index points.
+ * Used to determine rounding error and distance from
+ * next point.
+ * This is at x * 256 scale.
+ */
+ w1 = index * img_w;
+ w2 = w1 + img_w;
+
+ cutoff = hist->graph[index];
+
+ /* Determine if this index should be weighted */
+ if ((x_scale != w1) && (index < 255)
+ && (cutoff || hist->graph[index + 1])) {
+ cutoff = (cutoff * (w2 - x_scale));
+ cutoff += (hist->graph[index + 1] * (x_scale - w1));
+ cutoff = (cutoff / (w2 - w1));
+ }
+
+ cutoff = (img_h * cutoff) / hist->maxv;
+
+ *dst = ((img_h - y) < cutoff ? color : 0x0);
+ dst++;
+ }
+ }
+
+ evas_object_image_data_set(img, data);
+ evas_object_image_data_update_add(img, 0, 0, img_w, img_h);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_histogram.h b/src/lib/ewl_histogram.h
index 7355110..2bfeca6 100644
--- a/src/lib/ewl_histogram.h
+++ b/src/lib/ewl_histogram.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_HISTOGRAM_H
#define EWL_HISTOGRAM_H
@@ -43,31 +43,31 @@ typedef struct Ewl_Histogram Ewl_Histogram;
*/
struct Ewl_Histogram
{
- Ewl_Image image; /**< Inherit from the image widget */
- Ewl_Image *source; /**< Source image used for data graph */
- Ewl_Color_Set color; /**< Color for drawing the histogram */
+ Ewl_Image image; /**< Inherit from the image widget */
+ Ewl_Image *source; /**< Source image used for data graph */
+ Ewl_Color_Set color; /**< Color for drawing the histogram */
- int graph[256]; /**< Calculated histogram points */
- int maxv; /**< Largest data point in graph */
- Ewl_Histogram_Channel channel; /**< Channel of data for graphing */
+ int graph[256]; /**< Calculated histogram points */
+ int maxv; /**< Largest data point in graph */
+ Ewl_Histogram_Channel channel; /**< Channel of data for graphing */
};
-Ewl_Widget *ewl_histogram_new(void);
-int ewl_histogram_init(Ewl_Histogram *histogram);
+Ewl_Widget *ewl_histogram_new(void);
+int ewl_histogram_init(Ewl_Histogram *histogram);
-void ewl_histogram_color_set(Ewl_Histogram *histogram,
- unsigned int r, unsigned int g,
- unsigned int b, unsigned int a);
-void ewl_histogram_color_get(Ewl_Histogram *histogram,
- unsigned int *r, unsigned int *g,
- unsigned int *b, unsigned int *a);
+void ewl_histogram_color_set(Ewl_Histogram *histogram,
+ unsigned int r, unsigned int g,
+ unsigned int b, unsigned int a);
+void ewl_histogram_color_get(Ewl_Histogram *histogram,
+ unsigned int *r, unsigned int *g,
+ unsigned int *b, unsigned int *a);
-void ewl_histogram_image_set(Ewl_Histogram *histogram,
- Ewl_Image *image);
-Ewl_Image *ewl_histogram_image_get(Ewl_Histogram *histogram);
+void ewl_histogram_image_set(Ewl_Histogram *histogram,
+ Ewl_Image *image);
+Ewl_Image *ewl_histogram_image_get(Ewl_Histogram *histogram);
-void ewl_histogram_channel_set(Ewl_Histogram *histogram,
- Ewl_Histogram_Channel channel);
+void ewl_histogram_channel_set(Ewl_Histogram *histogram,
+ Ewl_Histogram_Channel channel);
Ewl_Histogram_Channel ewl_histogram_channel_get(Ewl_Histogram *histogram);
/*
diff --git a/src/lib/ewl_icon.c b/src/lib/ewl_icon.c
index 72a6651..fffcd0d 100644
--- a/src/lib/ewl_icon.c
+++ b/src/lib/ewl_icon.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_icon.h"
#include "ewl_entry.h"
@@ -11,9 +11,9 @@
#include "ewl_debug.h"
static const Ewl_Stock_Funcs const stock_funcs = {
- EWL_STOCK_LABEL_SET(ewl_icon_label_set),
- EWL_STOCK_IMAGE_SET(ewl_icon_image_set),
- NULL
+ EWL_STOCK_LABEL_SET(ewl_icon_label_set),
+ EWL_STOCK_IMAGE_SET(ewl_icon_image_set),
+ NULL
};
/* XXX may want to make this configurable, possibly per icon? */
@@ -36,21 +36,21 @@ static void ewl_icon_label_update(Ewl_Icon *icon);
Ewl_Widget *
ewl_icon_new(void)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- w = NEW(Ewl_Icon, 1);
- if (!w)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ w = NEW(Ewl_Icon, 1);
+ if (!w)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_icon_init(EWL_ICON(w)))
- {
- ewl_widget_destroy(w);
- w = NULL;
- }
+ if (!ewl_icon_init(EWL_ICON(w)))
+ {
+ ewl_widget_destroy(w);
+ w = NULL;
+ }
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
/**
@@ -68,20 +68,20 @@ ewl_icon_new(void)
Ewl_Widget *
ewl_icon_simple_new(void)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- w = ewl_icon_new();
- if (!w)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ w = ewl_icon_new();
+ if (!w)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- ewl_icon_label_complex_set(EWL_ICON(w), FALSE);
- ewl_icon_label_compressed_set(EWL_ICON(w), FALSE);
- ewl_icon_thumbnailing_set(EWL_ICON(w), FALSE);
- ewl_icon_editable_set(EWL_ICON(w), FALSE);
+ ewl_icon_label_complex_set(EWL_ICON(w), FALSE);
+ ewl_icon_label_compressed_set(EWL_ICON(w), FALSE);
+ ewl_icon_thumbnailing_set(EWL_ICON(w), FALSE);
+ ewl_icon_editable_set(EWL_ICON(w), FALSE);
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
/**
@@ -92,32 +92,32 @@ ewl_icon_simple_new(void)
int
ewl_icon_init(Ewl_Icon *icon)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(icon, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(icon, FALSE);
- if (!ewl_stock_init(EWL_STOCK((icon))))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_stock_init(EWL_STOCK((icon))))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_stock_functions_set(EWL_STOCK(icon), &stock_funcs);
- ewl_stock_type_set(EWL_STOCK(icon), EWL_STOCK_NONE);
+ ewl_stock_functions_set(EWL_STOCK(icon), &stock_funcs);
+ ewl_stock_type_set(EWL_STOCK(icon), EWL_STOCK_NONE);
- ewl_object_fill_policy_set(EWL_OBJECT(icon), EWL_FLAG_FILL_NONE);
- ewl_box_orientation_set(EWL_BOX(icon), EWL_ORIENTATION_VERTICAL);
- ewl_box_spacing_set(EWL_BOX(icon), 4);
+ ewl_object_fill_policy_set(EWL_OBJECT(icon), EWL_FLAG_FILL_NONE);
+ ewl_box_orientation_set(EWL_BOX(icon), EWL_ORIENTATION_VERTICAL);
+ ewl_box_spacing_set(EWL_BOX(icon), 4);
- ewl_widget_appearance_set(EWL_WIDGET(icon), EWL_ICON_TYPE);
- ewl_widget_inherit(EWL_WIDGET(icon), EWL_ICON_TYPE);
+ ewl_widget_appearance_set(EWL_WIDGET(icon), EWL_ICON_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(icon), EWL_ICON_TYPE);
- ewl_callback_prepend(EWL_WIDGET(icon), EWL_CALLBACK_DESTROY,
- ewl_icon_cb_destroy, NULL);
- /*
- * set some defaults
- */
- icon->thumbnailing = TRUE;
- icon->complex_label = TRUE;
- icon->constrain = 16;
+ ewl_callback_prepend(EWL_WIDGET(icon), EWL_CALLBACK_DESTROY,
+ ewl_icon_cb_destroy, NULL);
+ /*
+ * set some defaults
+ */
+ icon->thumbnailing = TRUE;
+ icon->complex_label = TRUE;
+ icon->constrain = 16;
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -129,26 +129,26 @@ ewl_icon_init(Ewl_Icon *icon)
void
ewl_icon_type_set(Ewl_Icon *icon, Ewl_Icon_Type type)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(icon);
- DCHECK_TYPE(icon, EWL_ICON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(icon);
+ DCHECK_TYPE(icon, EWL_ICON_TYPE);
- if (icon->type == type)
- DRETURN(DLEVEL_STABLE);
+ if (icon->type == type)
+ DRETURN(DLEVEL_STABLE);
- icon->type = type;
+ icon->type = type;
- /* if we are no longer extended then clear out the current extended
- * data */
- if (icon->extended)
- {
- if (type == EWL_ICON_TYPE_SHORT)
- ewl_widget_hide(icon->extended);
- else
- ewl_widget_show(icon->extended);
- }
+ /* if we are no longer extended then clear out the current extended
+ * data */
+ if (icon->extended)
+ {
+ if (type == EWL_ICON_TYPE_SHORT)
+ ewl_widget_hide(icon->extended);
+ else
+ ewl_widget_show(icon->extended);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -159,11 +159,11 @@ ewl_icon_type_set(Ewl_Icon *icon, Ewl_Icon_Type type)
Ewl_Icon_Type
ewl_icon_type_get(Ewl_Icon *icon)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(icon, EWL_ICON_TYPE_SHORT);
- DCHECK_TYPE_RET(icon, EWL_ICON_TYPE, EWL_ICON_TYPE_SHORT);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(icon, EWL_ICON_TYPE_SHORT);
+ DCHECK_TYPE_RET(icon, EWL_ICON_TYPE, EWL_ICON_TYPE_SHORT);
- DRETURN_INT(icon->type, DLEVEL_STABLE);
+ DRETURN_INT(icon->type, DLEVEL_STABLE);
}
/**
@@ -175,18 +175,18 @@ ewl_icon_type_get(Ewl_Icon *icon)
void
ewl_icon_part_hide(Ewl_Icon *icon, Ewl_Icon_Part part)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(icon);
- DCHECK_TYPE(icon, EWL_ICON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(icon);
+ DCHECK_TYPE(icon, EWL_ICON_TYPE);
- if (icon->hidden == part)
- DRETURN(DLEVEL_STABLE);
+ if (icon->hidden == part)
+ DRETURN(DLEVEL_STABLE);
- icon->hidden = part;
+ icon->hidden = part;
- ewl_icon_parts_update(icon);
+ ewl_icon_parts_update(icon);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -199,54 +199,54 @@ ewl_icon_part_hide(Ewl_Icon *icon, Ewl_Icon_Part part)
void
ewl_icon_image_set(Ewl_Icon *icon, const char *file, const char *key)
{
- Ewl_Widget *img;
+ Ewl_Widget *img;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(icon);
- DCHECK_PARAM_PTR(file);
- DCHECK_TYPE(icon, EWL_ICON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(icon);
+ DCHECK_PARAM_PTR(file);
+ DCHECK_TYPE(icon, EWL_ICON_TYPE);
- if (icon->image)
- ewl_widget_destroy(icon->image);
+ if (icon->image)
+ ewl_widget_destroy(icon->image);
- img = ewl_image_new();
- ewl_image_file_set(EWL_IMAGE(img), file, key);
+ img = ewl_image_new();
+ ewl_image_file_set(EWL_IMAGE(img), file, key);
- if (icon->thumbnailing)
- {
- icon->image = ewl_image_thumbnail_get(EWL_IMAGE(img));
- ewl_callback_append(icon->image, EWL_CALLBACK_VALUE_CHANGED,
- ewl_icon_cb_thumb_value_changed, icon);
- }
- else
- icon->image = img;
+ if (icon->thumbnailing)
+ {
+ icon->image = ewl_image_thumbnail_get(EWL_IMAGE(img));
+ ewl_callback_append(icon->image, EWL_CALLBACK_VALUE_CHANGED,
+ ewl_icon_cb_thumb_value_changed, icon);
+ }
+ else
+ icon->image = img;
- ewl_icon_constrain_set(icon, icon->constrain);
- ewl_image_proportional_set(EWL_IMAGE(icon->image), TRUE);
- ewl_object_alignment_set(EWL_OBJECT(icon->image),
- EWL_FLAG_ALIGN_CENTER);
- ewl_widget_internal_set(icon->image, TRUE);
- ewl_container_child_prepend(EWL_CONTAINER(icon), icon->image);
+ ewl_icon_constrain_set(icon, icon->constrain);
+ ewl_image_proportional_set(EWL_IMAGE(icon->image), TRUE);
+ ewl_object_alignment_set(EWL_OBJECT(icon->image),
+ EWL_FLAG_ALIGN_CENTER);
+ ewl_widget_internal_set(icon->image, TRUE);
+ ewl_container_child_prepend(EWL_CONTAINER(icon), icon->image);
- if (icon->hidden == EWL_ICON_PART_IMAGE)
- DRETURN(DLEVEL_STABLE);
+ if (icon->hidden == EWL_ICON_PART_IMAGE)
+ DRETURN(DLEVEL_STABLE);
- if (!icon->thumbnailing)
- ewl_icon_parts_update(icon);
- else if (!icon->alt)
- {
- const char *path;
+ if (!icon->thumbnailing)
+ ewl_icon_parts_update(icon);
+ else if (!icon->alt)
+ {
+ const char *path;
- path = ewl_icon_theme_icon_path_get(
- EWL_ICON_IMAGE_LOADING, 0),
- ewl_image_file_set(EWL_IMAGE(icon->image), path,
- EWL_ICON_IMAGE_LOADING);
- ewl_widget_show(icon->image);
- }
- else
- ewl_widget_show(icon->alt);
+ path = ewl_icon_theme_icon_path_get(
+ EWL_ICON_IMAGE_LOADING, 0),
+ ewl_image_file_set(EWL_IMAGE(icon->image), path,
+ EWL_ICON_IMAGE_LOADING);
+ ewl_widget_show(icon->image);
+ }
+ else
+ ewl_widget_show(icon->alt);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -258,16 +258,16 @@ ewl_icon_image_set(Ewl_Icon *icon, const char *file, const char *key)
const char *
ewl_icon_image_file_get(Ewl_Icon *icon)
{
- const char *file = NULL;
+ const char *file = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(icon, NULL);
- DCHECK_TYPE_RET(icon, EWL_ICON_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(icon, NULL);
+ DCHECK_TYPE_RET(icon, EWL_ICON_TYPE, NULL);
- if (icon->image)
- file = ewl_image_file_path_get(EWL_IMAGE(icon->image));
+ if (icon->image)
+ file = ewl_image_file_path_get(EWL_IMAGE(icon->image));
- DRETURN_PTR(file, DLEVEL_STABLE);
+ DRETURN_PTR(file, DLEVEL_STABLE);
}
/**
@@ -279,22 +279,22 @@ ewl_icon_image_file_get(Ewl_Icon *icon)
void
ewl_icon_editable_set(Ewl_Icon *icon, unsigned int e)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(icon);
- DCHECK_TYPE(icon, EWL_ICON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(icon);
+ DCHECK_TYPE(icon, EWL_ICON_TYPE);
- if (icon->editable == e)
- DRETURN(DLEVEL_STABLE);
+ if (icon->editable == e)
+ DRETURN(DLEVEL_STABLE);
- icon->editable = e;
- if (icon->editable && icon->label)
- ewl_callback_append(icon->label, EWL_CALLBACK_MOUSE_DOWN,
- ewl_icon_cb_label_mouse_down, icon);
- else if (icon->label)
- ewl_callback_del(icon->label, EWL_CALLBACK_MOUSE_DOWN,
- ewl_icon_cb_label_mouse_down);
+ icon->editable = e;
+ if (icon->editable && icon->label)
+ ewl_callback_append(icon->label, EWL_CALLBACK_MOUSE_DOWN,
+ ewl_icon_cb_label_mouse_down, icon);
+ else if (icon->label)
+ ewl_callback_del(icon->label, EWL_CALLBACK_MOUSE_DOWN,
+ ewl_icon_cb_label_mouse_down);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -305,11 +305,11 @@ ewl_icon_editable_set(Ewl_Icon *icon, unsigned int e)
unsigned int
ewl_icon_editable_get(Ewl_Icon *icon)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(icon, FALSE);
- DCHECK_TYPE_RET(icon, EWL_ICON_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(icon, FALSE);
+ DCHECK_TYPE_RET(icon, EWL_ICON_TYPE, FALSE);
- DRETURN_INT(icon->editable, DLEVEL_STABLE);
+ DRETURN_INT(icon->editable, DLEVEL_STABLE);
}
/**
@@ -321,28 +321,28 @@ ewl_icon_editable_get(Ewl_Icon *icon)
void
ewl_icon_label_set(Ewl_Icon *icon, const char *label)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(icon);
- DCHECK_TYPE(icon, EWL_ICON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(icon);
+ DCHECK_TYPE(icon, EWL_ICON_TYPE);
- if (!label)
- {
- if (icon->label)
- {
- ewl_icon_label_text_set(icon, NULL);
- IF_FREE(icon->label_text);
- }
+ if (!label)
+ {
+ if (icon->label)
+ {
+ ewl_icon_label_text_set(icon, NULL);
+ IF_FREE(icon->label_text);
+ }
- DRETURN(DLEVEL_STABLE);
- }
+ DRETURN(DLEVEL_STABLE);
+ }
- if (!icon->label)
- ewl_icon_label_build(icon);
+ if (!icon->label)
+ ewl_icon_label_build(icon);
- icon->label_text = strdup(label);
- ewl_icon_label_update(icon);
+ icon->label_text = strdup(label);
+ ewl_icon_label_update(icon);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -353,14 +353,14 @@ ewl_icon_label_set(Ewl_Icon *icon, const char *label)
const char *
ewl_icon_label_get(Ewl_Icon *icon)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(icon, NULL);
- DCHECK_TYPE_RET(icon, EWL_ICON_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(icon, NULL);
+ DCHECK_TYPE_RET(icon, EWL_ICON_TYPE, NULL);
- if (!icon->label)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ if (!icon->label)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- DRETURN_PTR(icon->label_text, DLEVEL_STABLE);
+ DRETURN_PTR(icon->label_text, DLEVEL_STABLE);
}
/**
@@ -376,23 +376,23 @@ ewl_icon_label_get(Ewl_Icon *icon)
void
ewl_icon_extended_data_set(Ewl_Icon *icon, Ewl_Widget *ext)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(icon);
- DCHECK_TYPE(icon, EWL_ICON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(icon);
+ DCHECK_TYPE(icon, EWL_ICON_TYPE);
- if (icon->extended)
- ewl_widget_destroy(icon->extended);
+ if (icon->extended)
+ ewl_widget_destroy(icon->extended);
- icon->extended = ext;
- ewl_widget_internal_set(icon->extended, TRUE);
- ewl_container_child_append(EWL_CONTAINER(icon), icon->extended);
+ icon->extended = ext;
+ ewl_widget_internal_set(icon->extended, TRUE);
+ ewl_container_child_append(EWL_CONTAINER(icon), icon->extended);
- if (icon->type == EWL_ICON_TYPE_SHORT)
- ewl_widget_hide(icon->extended);
- else
- ewl_widget_show(icon->extended);
+ if (icon->type == EWL_ICON_TYPE_SHORT)
+ ewl_widget_hide(icon->extended);
+ else
+ ewl_widget_show(icon->extended);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -403,11 +403,11 @@ ewl_icon_extended_data_set(Ewl_Icon *icon, Ewl_Widget *ext)
Ewl_Widget *
ewl_icon_extended_data_get(Ewl_Icon *icon)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(icon, NULL);
- DCHECK_TYPE_RET(icon, EWL_ICON_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(icon, NULL);
+ DCHECK_TYPE_RET(icon, EWL_ICON_TYPE, NULL);
- DRETURN_PTR(icon->extended, DLEVEL_STABLE);
+ DRETURN_PTR(icon->extended, DLEVEL_STABLE);
}
/**
@@ -419,15 +419,15 @@ ewl_icon_extended_data_get(Ewl_Icon *icon)
void
ewl_icon_constrain_set(Ewl_Icon *icon, unsigned int val)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(icon);
- DCHECK_TYPE(icon, EWL_ICON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(icon);
+ DCHECK_TYPE(icon, EWL_ICON_TYPE);
- icon->constrain = val;
- if (icon->image)
- ewl_image_constrain_set(EWL_IMAGE(icon->image), val);
+ icon->constrain = val;
+ if (icon->image)
+ ewl_image_constrain_set(EWL_IMAGE(icon->image), val);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -438,11 +438,11 @@ ewl_icon_constrain_set(Ewl_Icon *icon, unsigned int val)
unsigned int
ewl_icon_constrain_get(Ewl_Icon *icon)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(icon, 0);
- DCHECK_TYPE_RET(icon, EWL_ICON_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(icon, 0);
+ DCHECK_TYPE_RET(icon, EWL_ICON_TYPE, 0);
- DRETURN_INT(icon->constrain, DLEVEL_STABLE);
+ DRETURN_INT(icon->constrain, DLEVEL_STABLE);
}
/**
@@ -454,18 +454,18 @@ ewl_icon_constrain_get(Ewl_Icon *icon)
void
ewl_icon_label_compressed_set(Ewl_Icon *icon, unsigned int compress)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(icon);
- DCHECK_TYPE(icon, EWL_ICON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(icon);
+ DCHECK_TYPE(icon, EWL_ICON_TYPE);
- /* nothing to do if no compression change */
- if (compress == icon->compress_label)
- DRETURN(DLEVEL_STABLE);
+ /* nothing to do if no compression change */
+ if (compress == icon->compress_label)
+ DRETURN(DLEVEL_STABLE);
- icon->compress_label = !!compress;
- ewl_icon_label_update(icon);
+ icon->compress_label = !!compress;
+ ewl_icon_label_update(icon);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -476,11 +476,11 @@ ewl_icon_label_compressed_set(Ewl_Icon *icon, unsigned int compress)
unsigned int
ewl_icon_label_compressed_get(Ewl_Icon *icon)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(icon, FALSE);
- DCHECK_TYPE_RET(icon, EWL_ICON_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(icon, FALSE);
+ DCHECK_TYPE_RET(icon, EWL_ICON_TYPE, FALSE);
- DRETURN_INT(icon->compress_label, DLEVEL_STABLE);
+ DRETURN_INT(icon->compress_label, DLEVEL_STABLE);
}
/**
@@ -493,30 +493,30 @@ ewl_icon_label_compressed_get(Ewl_Icon *icon)
void
ewl_icon_label_complex_set(Ewl_Icon *icon, unsigned int c)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(icon);
- DCHECK_TYPE(icon, EWL_ICON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(icon);
+ DCHECK_TYPE(icon, EWL_ICON_TYPE);
- if (icon->complex_label == !!c)
- DRETURN(DLEVEL_STABLE);
+ if (icon->complex_label == !!c)
+ DRETURN(DLEVEL_STABLE);
- icon->complex_label = !!c;
+ icon->complex_label = !!c;
- if (!icon->label)
- DRETURN(DLEVEL_STABLE);
+ if (!icon->label)
+ DRETURN(DLEVEL_STABLE);
- /*
- * we are now switching from Ewl_Label to Ewl_Text
- * or vice-verse, so first of all destroy the current
- * widget
- */
- ewl_widget_destroy(icon->label);
- icon->label = NULL;
+ /*
+ * we are now switching from Ewl_Label to Ewl_Text
+ * or vice-verse, so first of all destroy the current
+ * widget
+ */
+ ewl_widget_destroy(icon->label);
+ icon->label = NULL;
- ewl_icon_label_build(icon);
- ewl_icon_label_update(icon);
+ ewl_icon_label_build(icon);
+ ewl_icon_label_update(icon);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -527,11 +527,11 @@ ewl_icon_label_complex_set(Ewl_Icon *icon, unsigned int c)
unsigned int
ewl_icon_label_complex_get(Ewl_Icon *icon)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(icon, FALSE);
- DCHECK_TYPE_RET(icon, EWL_ICON_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(icon, FALSE);
+ DCHECK_TYPE_RET(icon, EWL_ICON_TYPE, FALSE);
- DRETURN_INT(icon->complex_label, DLEVEL_STABLE);
+ DRETURN_INT(icon->complex_label, DLEVEL_STABLE);
}
@@ -544,16 +544,16 @@ ewl_icon_label_complex_get(Ewl_Icon *icon)
void
ewl_icon_thumbnailing_set(Ewl_Icon *icon, unsigned int t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(icon);
- DCHECK_TYPE(icon, EWL_ICON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(icon);
+ DCHECK_TYPE(icon, EWL_ICON_TYPE);
- if (icon->thumbnailing == !!t)
- DRETURN(DLEVEL_STABLE);
+ if (icon->thumbnailing == !!t)
+ DRETURN(DLEVEL_STABLE);
- icon->thumbnailing = !!t;
+ icon->thumbnailing = !!t;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -564,11 +564,11 @@ ewl_icon_thumbnailing_set(Ewl_Icon *icon, unsigned int t)
unsigned int
ewl_icon_thumbnailing_get(Ewl_Icon *icon)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(icon, FALSE);
- DCHECK_TYPE_RET(icon, EWL_ICON_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(icon, FALSE);
+ DCHECK_TYPE_RET(icon, EWL_ICON_TYPE, FALSE);
- DRETURN_INT(icon->thumbnailing, DLEVEL_STABLE);
+ DRETURN_INT(icon->thumbnailing, DLEVEL_STABLE);
}
/**
@@ -580,36 +580,36 @@ ewl_icon_thumbnailing_get(Ewl_Icon *icon)
void
ewl_icon_alt_text_set(Ewl_Icon *icon, const char *txt)
{
- const char *img, *file;
+ const char *img, *file;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(icon);
- DCHECK_TYPE(icon, EWL_ICON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(icon);
+ DCHECK_TYPE(icon, EWL_ICON_TYPE);
- if (icon->alt)
- {
- ewl_label_text_set(EWL_LABEL(icon->alt), txt);
- DRETURN(DLEVEL_STABLE);
- }
+ if (icon->alt)
+ {
+ ewl_label_text_set(EWL_LABEL(icon->alt), txt);
+ DRETURN(DLEVEL_STABLE);
+ }
- icon->alt = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(icon->alt), txt);
- ewl_object_alignment_set(EWL_OBJECT(icon->alt), EWL_FLAG_ALIGN_CENTER);
- ewl_object_fill_policy_set(EWL_OBJECT(icon->alt), EWL_FLAG_FILL_VFILL);
- ewl_container_child_prepend(EWL_CONTAINER(icon), icon->alt);
+ icon->alt = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(icon->alt), txt);
+ ewl_object_alignment_set(EWL_OBJECT(icon->alt), EWL_FLAG_ALIGN_CENTER);
+ ewl_object_fill_policy_set(EWL_OBJECT(icon->alt), EWL_FLAG_FILL_VFILL);
+ ewl_container_child_prepend(EWL_CONTAINER(icon), icon->alt);
- /* if the image displayed is the loading image then we switch to the
- * alt text. Also switch to alt text if the image doesn't exist */
- img = ewl_icon_theme_icon_path_get(EWL_ICON_IMAGE_LOADING, 0);
- file = ewl_icon_image_file_get(icon);
- if ((!file || !ecore_file_exists(ewl_icon_image_file_get(icon))) ||
- (icon->image && !strcmp(img, file)))
- {
- if (icon->image) ewl_widget_hide(icon->image);
- ewl_widget_show(icon->alt);
- }
+ /* if the image displayed is the loading image then we switch to the
+ * alt text. Also switch to alt text if the image doesn't exist */
+ img = ewl_icon_theme_icon_path_get(EWL_ICON_IMAGE_LOADING, 0);
+ file = ewl_icon_image_file_get(icon);
+ if ((!file || !ecore_file_exists(ewl_icon_image_file_get(icon))) ||
+ (icon->image && !strcmp(img, file)))
+ {
+ if (icon->image) ewl_widget_hide(icon->image);
+ ewl_widget_show(icon->alt);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -620,11 +620,11 @@ ewl_icon_alt_text_set(Ewl_Icon *icon, const char *txt)
const char *
ewl_icon_alt_text_get(Ewl_Icon *icon)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(icon, NULL);
- DCHECK_TYPE_RET(icon, EWL_ICON_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(icon, NULL);
+ DCHECK_TYPE_RET(icon, EWL_ICON_TYPE, NULL);
- DRETURN_PTR(ewl_label_text_get(EWL_LABEL(icon->alt)), DLEVEL_STABLE);
+ DRETURN_PTR(ewl_label_text_get(EWL_LABEL(icon->alt)), DLEVEL_STABLE);
}
/**
@@ -638,251 +638,251 @@ ewl_icon_alt_text_get(Ewl_Icon *icon)
void
ewl_icon_cb_destroy(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
{
- Ewl_Icon *icon;
+ Ewl_Icon *icon;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_ICON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_ICON_TYPE);
- icon = EWL_ICON(w);
- IF_FREE(icon->label_text);
+ icon = EWL_ICON(w);
+ IF_FREE(icon->label_text);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_icon_cb_label_mouse_down(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Icon *icon;
- Ewl_Widget *entry;
- Ewl_Embed *emb;
- int x, y;
+ Ewl_Icon *icon;
+ Ewl_Widget *entry;
+ Ewl_Embed *emb;
+ int x, y;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_ICON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_ICON_TYPE);
- icon = data;
- emb = ewl_embed_widget_find(EWL_WIDGET(icon));
+ icon = data;
+ emb = ewl_embed_widget_find(EWL_WIDGET(icon));
- ewl_widget_hide(icon->label);
+ ewl_widget_hide(icon->label);
- entry = ewl_entry_new();
- ewl_text_text_set(EWL_TEXT(entry), icon->label_text);
- ewl_container_child_append(EWL_CONTAINER(emb), entry);
+ entry = ewl_entry_new();
+ ewl_text_text_set(EWL_TEXT(entry), icon->label_text);
+ ewl_container_child_append(EWL_CONTAINER(emb), entry);
- /* put the entry in the same spot as the label */
- ewl_object_current_geometry_get(EWL_OBJECT(icon->label), &x, &y,
- NULL, NULL);
- ewl_object_position_request(EWL_OBJECT(entry), x, y);
- ewl_widget_show(entry);
+ /* put the entry in the same spot as the label */
+ ewl_object_current_geometry_get(EWL_OBJECT(icon->label), &x, &y,
+ NULL, NULL);
+ ewl_object_position_request(EWL_OBJECT(entry), x, y);
+ ewl_widget_show(entry);
- ewl_callback_append(entry, EWL_CALLBACK_FOCUS_OUT,
- ewl_icon_cb_entry_focus_out, icon);
- ewl_callback_append(entry, EWL_CALLBACK_VALUE_CHANGED,
- ewl_icon_cb_entry_value_changed, icon);
+ ewl_callback_append(entry, EWL_CALLBACK_FOCUS_OUT,
+ ewl_icon_cb_entry_focus_out, icon);
+ ewl_callback_append(entry, EWL_CALLBACK_VALUE_CHANGED,
+ ewl_icon_cb_entry_value_changed, icon);
- ewl_embed_focused_widget_set(emb, entry);
+ ewl_embed_focused_widget_set(emb, entry);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
-ewl_icon_cb_entry_focus_out(Ewl_Widget *w, void *ev __UNUSED__, void *data)
+ewl_icon_cb_entry_focus_out(Ewl_Widget *w, void *ev __UNUSED__, void *data)
{
- Ewl_Icon *icon;
+ Ewl_Icon *icon;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- DCHECK_TYPE(data, EWL_ICON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DCHECK_TYPE(data, EWL_ICON_TYPE);
- icon = data;
+ icon = data;
- ewl_widget_show(icon->label);
- ewl_widget_destroy(w);
+ ewl_widget_show(icon->label);
+ ewl_widget_destroy(w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_icon_cb_entry_value_changed(Ewl_Widget *w, void *ev __UNUSED__, void *data)
{
- Ewl_Icon *icon;
+ Ewl_Icon *icon;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- DCHECK_TYPE(data, EWL_ICON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DCHECK_TYPE(data, EWL_ICON_TYPE);
- icon = data;
- ewl_icon_label_set(icon, ewl_text_text_get(EWL_TEXT(w)));
+ icon = data;
+ ewl_icon_label_set(icon, ewl_text_text_get(EWL_TEXT(w)));
- ewl_widget_show(icon->label);
- ewl_widget_destroy(w);
+ ewl_widget_show(icon->label);
+ ewl_widget_destroy(w);
- ewl_callback_call(EWL_WIDGET(icon), EWL_CALLBACK_VALUE_CHANGED);
+ ewl_callback_call(EWL_WIDGET(icon), EWL_CALLBACK_VALUE_CHANGED);
}
static void
ewl_icon_parts_update(Ewl_Icon *icon)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(icon);
- DCHECK_TYPE(icon, EWL_ICON_TYPE);
-
- /*
- * show both the label and the image
- */
- if (icon->hidden == EWL_ICON_PART_NONE) {
- if (icon->label)
- ewl_widget_show(icon->label);
- if (icon->image)
- ewl_widget_show(icon->image);
- }
- /*
- * show only the label
- */
- else if (icon->hidden == EWL_ICON_PART_IMAGE) {
- if (icon->label && icon->image) {
- ewl_widget_show(icon->label);
- ewl_widget_hide(icon->image);
- }
- else if (icon->label)
- ewl_widget_show(icon->label);
- /*
- * show the image if there is no label
- */
- else if (icon->image)
- ewl_widget_show(icon->image);
- }
- /*
- * show only the image
- */
- else if (icon->hidden == EWL_ICON_PART_LABEL) {
- if (icon->label && icon->image) {
- ewl_widget_show(icon->image);
- ewl_widget_hide(icon->label);
- }
- else if (icon->image)
- ewl_widget_show(icon->image);
- /*
- * show label if there is no image
- */
- else if (icon->label)
- ewl_widget_show(icon->label);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(icon);
+ DCHECK_TYPE(icon, EWL_ICON_TYPE);
+
+ /*
+ * show both the label and the image
+ */
+ if (icon->hidden == EWL_ICON_PART_NONE) {
+ if (icon->label)
+ ewl_widget_show(icon->label);
+ if (icon->image)
+ ewl_widget_show(icon->image);
+ }
+ /*
+ * show only the label
+ */
+ else if (icon->hidden == EWL_ICON_PART_IMAGE) {
+ if (icon->label && icon->image) {
+ ewl_widget_show(icon->label);
+ ewl_widget_hide(icon->image);
+ }
+ else if (icon->label)
+ ewl_widget_show(icon->label);
+ /*
+ * show the image if there is no label
+ */
+ else if (icon->image)
+ ewl_widget_show(icon->image);
+ }
+ /*
+ * show only the image
+ */
+ else if (icon->hidden == EWL_ICON_PART_LABEL) {
+ if (icon->label && icon->image) {
+ ewl_widget_show(icon->image);
+ ewl_widget_hide(icon->label);
+ }
+ else if (icon->image)
+ ewl_widget_show(icon->image);
+ /*
+ * show label if there is no image
+ */
+ else if (icon->label)
+ ewl_widget_show(icon->label);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_icon_label_build(Ewl_Icon *icon)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(icon);
- DCHECK_TYPE(icon, EWL_ICON_TYPE);
-
- if (icon->complex_label)
- icon->label = ewl_text_new();
- else
- icon->label = ewl_label_new();
-
- ewl_object_fill_policy_set(EWL_OBJECT(icon->label),
- EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(icon->label),
- EWL_FLAG_ALIGN_CENTER);
-
- if (icon->editable)
- ewl_callback_append(icon->label,
- EWL_CALLBACK_MOUSE_DOWN,
- ewl_icon_cb_label_mouse_down, icon);
-
- if (icon->hidden != EWL_ICON_PART_LABEL)
- ewl_widget_show(icon->label);
-
- /* if we have a image make sure we are after it, but
- * before anything that is after the image */
- if (icon->image && icon->extended)
- {
- int idx;
- idx = ewl_container_child_index_get(EWL_CONTAINER(icon),
- icon->image);
- ewl_container_child_insert_internal(EWL_CONTAINER(icon),
- icon->label, idx + 1);
- }
- else
- ewl_container_child_append(EWL_CONTAINER(icon),
- icon->label);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(icon);
+ DCHECK_TYPE(icon, EWL_ICON_TYPE);
+
+ if (icon->complex_label)
+ icon->label = ewl_text_new();
+ else
+ icon->label = ewl_label_new();
+
+ ewl_object_fill_policy_set(EWL_OBJECT(icon->label),
+ EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(icon->label),
+ EWL_FLAG_ALIGN_CENTER);
+
+ if (icon->editable)
+ ewl_callback_append(icon->label,
+ EWL_CALLBACK_MOUSE_DOWN,
+ ewl_icon_cb_label_mouse_down, icon);
+
+ if (icon->hidden != EWL_ICON_PART_LABEL)
+ ewl_widget_show(icon->label);
+
+ /* if we have a image make sure we are after it, but
+ * before anything that is after the image */
+ if (icon->image && icon->extended)
+ {
+ int idx;
+ idx = ewl_container_child_index_get(EWL_CONTAINER(icon),
+ icon->image);
+ ewl_container_child_insert_internal(EWL_CONTAINER(icon),
+ icon->label, idx + 1);
+ }
+ else
+ ewl_container_child_append(EWL_CONTAINER(icon),
+ icon->label);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_icon_label_text_set(Ewl_Icon *icon, const char *txt)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(icon);
- DCHECK_TYPE(icon, EWL_ICON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(icon);
+ DCHECK_TYPE(icon, EWL_ICON_TYPE);
- if (icon->complex_label)
- ewl_text_text_set(EWL_TEXT(icon->label), txt);
- else
- ewl_label_text_set(EWL_LABEL(icon->label), txt);
+ if (icon->complex_label)
+ ewl_text_text_set(EWL_TEXT(icon->label), txt);
+ else
+ ewl_label_text_set(EWL_LABEL(icon->label), txt);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_icon_label_update(Ewl_Icon *icon)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(icon);
- DCHECK_TYPE(icon, EWL_ICON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(icon);
+ DCHECK_TYPE(icon, EWL_ICON_TYPE);
- /* nothing to do if no label set */
- if (!icon->label_text)
- DRETURN(DLEVEL_STABLE);
+ /* nothing to do if no label set */
+ if (!icon->label_text)
+ DRETURN(DLEVEL_STABLE);
- if (icon->compress_label &&
- (strlen(icon->label_text) > EWL_ICON_COMPRESS_SIZE))
- {
- char *c;
+ if (icon->compress_label &&
+ (strlen(icon->label_text) > EWL_ICON_COMPRESS_SIZE))
+ {
+ char *c;
- c = NEW(char, EWL_ICON_COMPRESS_SIZE + 4);
- strncpy(c, icon->label_text, EWL_ICON_COMPRESS_SIZE);
- strcat(c, "...");
+ c = NEW(char, EWL_ICON_COMPRESS_SIZE + 4);
+ strncpy(c, icon->label_text, EWL_ICON_COMPRESS_SIZE);
+ strcat(c, "...");
- ewl_icon_label_text_set(icon, c);
- FREE(c);
- }
- else
- ewl_icon_label_text_set(icon, icon->label_text);
+ ewl_icon_label_text_set(icon, c);
+ FREE(c);
+ }
+ else
+ ewl_icon_label_text_set(icon, icon->label_text);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_icon_cb_thumb_value_changed(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Icon *icon;
+ Ewl_Icon *icon;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_ICON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_ICON_TYPE);
- icon = EWL_ICON(data);
- if (icon->alt && VISIBLE(icon->alt))
- ewl_widget_hide(icon->alt);
+ icon = EWL_ICON(data);
+ if (icon->alt && VISIBLE(icon->alt))
+ ewl_widget_hide(icon->alt);
- if (!VISIBLE(icon->image))
- ewl_widget_show(icon->image);
+ if (!VISIBLE(icon->image))
+ ewl_widget_show(icon->image);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_icon.h b/src/lib/ewl_icon.h
index 89d1ec4..f870e14 100644
--- a/src/lib/ewl_icon.h
+++ b/src/lib/ewl_icon.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_ICON_H
#define EWL_ICON_H
@@ -44,62 +44,62 @@ typedef struct Ewl_Icon Ewl_Icon;
*/
struct Ewl_Icon
{
- Ewl_Stock stock; /**< Inherit from Ewl_Box */
- Ewl_Widget *label; /**< The icons label */
- Ewl_Widget *image; /**< The icons image */
- Ewl_Widget *alt; /**< The icons alt text */
- Ewl_Widget *extended; /**< The icons extended information */
-
- char *label_text; /**< The label text */
-
- unsigned int constrain; /**< The image constrain value */
-
- Ewl_Icon_Type type; /**< The icons type */
- Ewl_Icon_Part hidden; /**< The hidden part */
- unsigned char editable:1; /**< Is the icon editable? */
- unsigned char compress_label:1; /**< Should the label be compressed? */
- unsigned char complex_label:1; /**< Should the label be a Ewl_Text? */
- unsigned char thumbnailing:1; /**< Should the image be thumbnailed?*/
+ Ewl_Stock stock; /**< Inherit from Ewl_Box */
+ Ewl_Widget *label; /**< The icons label */
+ Ewl_Widget *image; /**< The icons image */
+ Ewl_Widget *alt; /**< The icons alt text */
+ Ewl_Widget *extended; /**< The icons extended information */
+
+ char *label_text; /**< The label text */
+
+ unsigned int constrain; /**< The image constrain value */
+
+ Ewl_Icon_Type type; /**< The icons type */
+ Ewl_Icon_Part hidden; /**< The hidden part */
+ unsigned char editable:1; /**< Is the icon editable? */
+ unsigned char compress_label:1; /**< Should the label be compressed? */
+ unsigned char complex_label:1; /**< Should the label be a Ewl_Text? */
+ unsigned char thumbnailing:1; /**< Should the image be thumbnailed?*/
};
-Ewl_Widget *ewl_icon_new(void);
+Ewl_Widget *ewl_icon_new(void);
Ewl_Widget *ewl_icon_simple_new(void);
-int ewl_icon_init(Ewl_Icon *icon);
+int ewl_icon_init(Ewl_Icon *icon);
-void ewl_icon_type_set(Ewl_Icon *icon, Ewl_Icon_Type type);
-Ewl_Icon_Type ewl_icon_type_get(Ewl_Icon *icon);
+void ewl_icon_type_set(Ewl_Icon *icon, Ewl_Icon_Type type);
+Ewl_Icon_Type ewl_icon_type_get(Ewl_Icon *icon);
void ewl_icon_part_hide(Ewl_Icon *icon, Ewl_Icon_Part part);
-void ewl_icon_image_set(Ewl_Icon *icon, const char *file,
- const char *key);
-const char *ewl_icon_image_file_get(Ewl_Icon *icon);
+void ewl_icon_image_set(Ewl_Icon *icon, const char *file,
+ const char *key);
+const char *ewl_icon_image_file_get(Ewl_Icon *icon);
void ewl_icon_thumbnailing_set(Ewl_Icon *icon, unsigned int thumb);
unsigned int ewl_icon_thumbnailing_get(Ewl_Icon *icon);
-void ewl_icon_constrain_set(Ewl_Icon *icon, unsigned int val);
-unsigned int ewl_icon_constrain_get(Ewl_Icon *icon);
+void ewl_icon_constrain_set(Ewl_Icon *icon, unsigned int val);
+unsigned int ewl_icon_constrain_get(Ewl_Icon *icon);
-void ewl_icon_alt_text_set(Ewl_Icon *icon, const char *txt);
-const char *ewl_icon_alt_text_get(Ewl_Icon *icon);
+void ewl_icon_alt_text_set(Ewl_Icon *icon, const char *txt);
+const char *ewl_icon_alt_text_get(Ewl_Icon *icon);
-void ewl_icon_label_set(Ewl_Icon *icon, const char *label);
-const char *ewl_icon_label_get(Ewl_Icon *icon);
+void ewl_icon_label_set(Ewl_Icon *icon, const char *label);
+const char *ewl_icon_label_get(Ewl_Icon *icon);
-void ewl_icon_editable_set(Ewl_Icon *icon, unsigned int e);
-unsigned int ewl_icon_editable_get(Ewl_Icon *icon);
+void ewl_icon_editable_set(Ewl_Icon *icon, unsigned int e);
+unsigned int ewl_icon_editable_get(Ewl_Icon *icon);
-void ewl_icon_label_compressed_set(Ewl_Icon *icon,
- unsigned int compress);
-unsigned int ewl_icon_label_compressed_get(Ewl_Icon *icon);
+void ewl_icon_label_compressed_set(Ewl_Icon *icon,
+ unsigned int compress);
+unsigned int ewl_icon_label_compressed_get(Ewl_Icon *icon);
void ewl_icon_label_complex_set(Ewl_Icon *icon,
- unsigned int complex_label);
+ unsigned int complex_label);
unsigned int ewl_icon_label_complex_get(Ewl_Icon *icon);
-void ewl_icon_extended_data_set(Ewl_Icon *icon, Ewl_Widget *ext);
-Ewl_Widget *ewl_icon_extended_data_get(Ewl_Icon *icon);
+void ewl_icon_extended_data_set(Ewl_Icon *icon, Ewl_Widget *ext);
+Ewl_Widget *ewl_icon_extended_data_get(Ewl_Icon *icon);
/*
* Internal stuff
diff --git a/src/lib/ewl_icon_theme.c b/src/lib/ewl_icon_theme.c
index db6312c..3938820 100644
--- a/src/lib/ewl_icon_theme.c
+++ b/src/lib/ewl_icon_theme.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_icon_theme.h"
#include "ewl_macros.h"
@@ -12,8 +12,8 @@ static Ecore_Hash *ewl_icon_theme_cache = NULL;
static Ecore_Hash *ewl_icon_fallback_theme_cache = NULL;
static void ewl_icon_theme_cb_free(void *data);
static const char *ewl_icon_theme_icon_path_get_helper(const char *icon,
- const char *size, const char *theme,
- const char *key, Ecore_Hash *cache);
+ const char *size, const char *theme,
+ const char *key, Ecore_Hash *cache);
/**
* @return Returns TRUE on success or FALSE on failure
@@ -22,23 +22,23 @@ static const char *ewl_icon_theme_icon_path_get_helper(const char *icon,
int
ewl_icon_theme_init(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- if (!ewl_icon_theme_cache)
- {
- ewl_icon_theme_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare);
- ecore_hash_free_key_cb_set(ewl_icon_theme_cache, ewl_icon_theme_cb_free);
- ecore_hash_free_value_cb_set(ewl_icon_theme_cache, free);
-
- ewl_icon_fallback_theme_cache = ecore_hash_new(
- ecore_str_hash, ecore_str_compare);
- ecore_hash_free_key_cb_set(ewl_icon_fallback_theme_cache,
- ewl_icon_theme_cb_free);
- ecore_hash_free_value_cb_set(ewl_icon_fallback_theme_cache,
- free);
- }
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ if (!ewl_icon_theme_cache)
+ {
+ ewl_icon_theme_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare);
+ ecore_hash_free_key_cb_set(ewl_icon_theme_cache, ewl_icon_theme_cb_free);
+ ecore_hash_free_value_cb_set(ewl_icon_theme_cache, free);
+
+ ewl_icon_fallback_theme_cache = ecore_hash_new(
+ ecore_str_hash, ecore_str_compare);
+ ecore_hash_free_key_cb_set(ewl_icon_fallback_theme_cache,
+ ewl_icon_theme_cb_free);
+ ecore_hash_free_value_cb_set(ewl_icon_fallback_theme_cache,
+ free);
+ }
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -48,12 +48,12 @@ ewl_icon_theme_init(void)
void
ewl_icon_theme_shutdown(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- IF_FREE_HASH(ewl_icon_theme_cache);
- IF_FREE_HASH(ewl_icon_fallback_theme_cache);
+ IF_FREE_HASH(ewl_icon_theme_cache);
+ IF_FREE_HASH(ewl_icon_fallback_theme_cache);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -64,27 +64,27 @@ ewl_icon_theme_shutdown(void)
void
ewl_icon_theme_theme_change(void)
{
- const char *icon_theme;
+ const char *icon_theme;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- icon_theme = ewl_config_string_get(ewl_config, EWL_CONFIG_THEME_ICON_THEME);
+ icon_theme = ewl_config_string_get(ewl_config, EWL_CONFIG_THEME_ICON_THEME);
- /* check if this is an edje theme */
- if (icon_theme && (!strncasecmp(icon_theme + (strlen(icon_theme) - 4),
- ".edj", 4)))
- ewl_icon_theme_is_edje = 1;
- else
- ewl_icon_theme_is_edje = 0;
+ /* check if this is an edje theme */
+ if (icon_theme && (!strncasecmp(icon_theme + (strlen(icon_theme) - 4),
+ ".edj", 4)))
+ ewl_icon_theme_is_edje = 1;
+ else
+ ewl_icon_theme_is_edje = 0;
- /* destroy the cache and re-create it */
- IF_FREE_HASH(ewl_icon_theme_cache);
+ /* destroy the cache and re-create it */
+ IF_FREE_HASH(ewl_icon_theme_cache);
- ewl_icon_theme_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare);
- ecore_hash_free_key_cb_set(ewl_icon_theme_cache, ewl_icon_theme_cb_free);
- ecore_hash_free_value_cb_set(ewl_icon_theme_cache, free);
+ ewl_icon_theme_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare);
+ ecore_hash_free_key_cb_set(ewl_icon_theme_cache, ewl_icon_theme_cb_free);
+ ecore_hash_free_value_cb_set(ewl_icon_theme_cache, free);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -97,77 +97,77 @@ ewl_icon_theme_theme_change(void)
const char *
ewl_icon_theme_icon_path_get(const char *icon, int size)
{
- const char *ret;
- const char *icon_theme;
- char icon_size[16];
- char key[256];
+ const char *ret;
+ const char *icon_theme;
+ char icon_size[16];
+ char key[256];
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(icon, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(icon, NULL);
- icon_theme = ewl_config_string_get(ewl_config,
- EWL_CONFIG_THEME_ICON_THEME);
+ icon_theme = ewl_config_string_get(ewl_config,
+ EWL_CONFIG_THEME_ICON_THEME);
- /* make sure we have an icon theme */
- if (!icon_theme)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ /* make sure we have an icon theme */
+ if (!icon_theme)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- /* if our theme is an edje just return the .edj file */
- if (ewl_icon_theme_is_edje)
- DRETURN_PTR(icon_theme, DLEVEL_STABLE);
+ /* if our theme is an edje just return the .edj file */
+ if (ewl_icon_theme_is_edje)
+ DRETURN_PTR(icon_theme, DLEVEL_STABLE);
- if (size == 0)
- size = ewl_config_int_get(ewl_config,
- EWL_CONFIG_THEME_ICON_SIZE);
+ if (size == 0)
+ size = ewl_config_int_get(ewl_config,
+ EWL_CONFIG_THEME_ICON_SIZE);
- snprintf(icon_size, sizeof(icon_size), "%dx%d", size, size);
- snprintf(key, sizeof(key), "%s@%s", icon, icon_size);
- ret = ewl_icon_theme_icon_path_get_helper(icon, icon_size, icon_theme,
- key, ewl_icon_theme_cache);
+ snprintf(icon_size, sizeof(icon_size), "%dx%d", size, size);
+ snprintf(key, sizeof(key), "%s@%s", icon, icon_size);
+ ret = ewl_icon_theme_icon_path_get_helper(icon, icon_size, icon_theme,
+ key, ewl_icon_theme_cache);
- if (ret == EWL_THEME_KEY_NOMATCH)
- ret = ewl_icon_theme_icon_path_get_helper(icon, icon_size, "EWL",
- key, ewl_icon_fallback_theme_cache);
+ if (ret == EWL_THEME_KEY_NOMATCH)
+ ret = ewl_icon_theme_icon_path_get_helper(icon, icon_size, "EWL",
+ key, ewl_icon_fallback_theme_cache);
- if (ret == EWL_THEME_KEY_NOMATCH)
- ret = NULL;
+ if (ret == EWL_THEME_KEY_NOMATCH)
+ ret = NULL;
- DRETURN_PTR(ret, DLEVEL_STABLE);
+ DRETURN_PTR(ret, DLEVEL_STABLE);
}
static const char *
ewl_icon_theme_icon_path_get_helper(const char *icon, const char *size,
- const char *theme, const char *key,
- Ecore_Hash *cache)
+ const char *theme, const char *key,
+ Ecore_Hash *cache)
{
- char *ret;
+ char *ret;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(icon, EWL_THEME_KEY_NOMATCH);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(icon, EWL_THEME_KEY_NOMATCH);
- ret = ecore_hash_get(cache, key);
- if (!ret)
- {
- /* XXX: How to store NOMATCH in the cache? The cache is strings which must be free'd */
- ret = efreet_icon_path_find(theme, icon, size);
- if (!ret) ret = EWL_THEME_KEY_NOMATCH;
- else ecore_hash_set(cache, strdup(key), (void *)ret);
- }
+ ret = ecore_hash_get(cache, key);
+ if (!ret)
+ {
+ /* XXX: How to store NOMATCH in the cache? The cache is strings which must be free'd */
+ ret = efreet_icon_path_find(theme, icon, size);
+ if (!ret) ret = EWL_THEME_KEY_NOMATCH;
+ else ecore_hash_set(cache, strdup(key), (void *)ret);
+ }
- DRETURN_PTR(ret, DLEVEL_STABLE);;
+ DRETURN_PTR(ret, DLEVEL_STABLE);;
}
static void
ewl_icon_theme_cb_free(void *data)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- if (data == EWL_THEME_KEY_NOMATCH)
- DRETURN(DLEVEL_STABLE);
+ if (data == EWL_THEME_KEY_NOMATCH)
+ DRETURN(DLEVEL_STABLE);
- IF_FREE(data);
+ IF_FREE(data);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_icon_theme.h b/src/lib/ewl_icon_theme.h
index c58aca7..51fde2e 100644
--- a/src/lib/ewl_icon_theme.h
+++ b/src/lib/ewl_icon_theme.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_ICON_THEME_H
#define EWL_ICON_THEME_H
@@ -9,283 +9,283 @@
* @{
*/
-int ewl_icon_theme_init(void);
-void ewl_icon_theme_shutdown(void);
+int ewl_icon_theme_init(void);
+void ewl_icon_theme_shutdown(void);
-void ewl_icon_theme_theme_change(void);
+void ewl_icon_theme_theme_change(void);
-const char *ewl_icon_theme_icon_path_get(const char *icon, int size);
+const char *ewl_icon_theme_icon_path_get(const char *icon, int size);
-#define EWL_ICON_SIZE_SMALL 16 /**< 16x16 icons */
-#define EWL_ICON_SIZE_MEDIUM 22 /**< 22x22 icons */
-#define EWL_ICON_SIZE_LARGE 24 /**< 24x24 icons */
+#define EWL_ICON_SIZE_SMALL 16 /**< 16x16 icons */
+#define EWL_ICON_SIZE_MEDIUM 22 /**< 22x22 icons */
+#define EWL_ICON_SIZE_LARGE 24 /**< 24x24 icons */
-#define EWL_ICON_ADDRESS_BOOK_NEW "address-book-new" /**< address book icon */
-#define EWL_ICON_APPLICATION_EXIT "application-exit" /**< application exit */
-#define EWL_ICON_APPOINTMENT_NEW "appointment-new" /**< appointment new */
-#define EWL_ICON_CONTACT_NEW "contact-new" /**< contact new */
-#define EWL_ICON_DIALOG_APPLY "dialog-apply" /**< dialog apply */
-#define EWL_ICON_DIALOG_CANCEL "dialog-cancel" /**< dialog cancel */
-#define EWL_ICON_DIALOG_CLOSE "dialog-close" /**< dialog close */
-#define EWL_ICON_DIALOG_OK "dialog-ok" /**< dialog ok */
-#define EWL_ICON_DOCUMENT_NEW "document-new" /**< document new */
-#define EWL_ICON_DOCUMENT_OPEN "document-open" /**< document open */
-#define EWL_ICON_DOCUMENT_OPEN_RECENT "document-open-recent" /**< document open recent */
-#define EWL_ICON_DOCUMENT_PAGE_SETUP "document-page-setup" /**< document page setup */
-#define EWL_ICON_DOCUMENT_PRINT "document-print" /**< document print */
-#define EWL_ICON_DOCUMENT_PRINT_PREVIEW "document-print-preview" /**< document print preview */
-#define EWL_ICON_DOCUMENT_PROPERTIES "document-properties" /**< document properities */
-#define EWL_ICON_DOCUMENT_REVERT "document-revert" /**< document revent */
-#define EWL_ICON_DOCUMENT_SAVE "document-save" /**< document save */
-#define EWL_ICON_DOCUMENT_SAVE_AS "document-save-as" /**< document save as */
-#define EWL_ICON_EDIT_COPY "edit-copy" /**< edit copy */
-#define EWL_ICON_EDIT_CUT "edit-cut" /**< edit cut */
-#define EWL_ICON_EDIT_DELETE "edit-delete" /**< edit delete */
-#define EWL_ICON_EDIT_FIND "edit-find" /**< edit find */
-#define EWL_ICON_EDIT_FIND_REPLACE "edit-find-replace" /**< edit find replace */
-#define EWL_ICON_EDIT_PASTE "edit-paste" /**< edit paste */
-#define EWL_ICON_EDIT_REDO "edit-redo" /**< edit redo */
-#define EWL_ICON_EDIT_SELECT_ALL "edit-select-all" /**< edit select all */
-#define EWL_ICON_EDIT_UNDO "edit-undo" /**< edit undo */
-#define EWL_ICON_FORMAT_INDENT_LESS "format-indent-less" /**< format indent less */
-#define EWL_ICON_FORMAT_INDENT_MORE "format-indent-more" /**< format indent more */
-#define EWL_ICON_FORMAT_JUSTIFY_CENTER "format-justify-center" /**< format justify center */
-#define EWL_ICON_FORMAT_JUSTIFY_FILL "format-justify-fill" /**< format justify fill */
-#define EWL_ICON_FORMAT_JUSTIFY_LEFT "format-justify-left" /**< format justify left */
-#define EWL_ICON_FORMAT_JUSTIFY_RIGHT "format-justify-right" /**< format justify right */
-#define EWL_ICON_FORMAT_TEXT_DIRECTION_LTR "format-text-direction-ltr" /**< format text direction left to right */
-#define EWL_ICON_FORMAT_TEXT_DIRECTION_RTL "format-text-direction-rtl" /**< format text direction right to left */
-#define EWL_ICON_FORMAT_TEXT_BOLD "format-text-bold" /**< format text bold */
-#define EWL_ICON_FORMAT_TEXT_ITALIC "format-text-italic" /**< format text italic */
-#define EWL_ICON_FORMAT_TEXT_UNDERLINE "format-text-underline" /**< format text underline */
-#define EWL_ICON_FORMAT_TEXT_STRIKETHROUGH "format-text-strikethrough" /**< format text strikethrough */
-#define EWL_ICON_GO_BOTTOM "go-bottom" /**< go bottom */
-#define EWL_ICON_GO_DOWN "go-down" /**< go down */
-#define EWL_ICON_GO_FIRST "go-first" /**< go first */
-#define EWL_ICON_GO_HOME "go-home" /**< go home */
-#define EWL_ICON_GO_JUMP "go-jump" /**< go jump */
-#define EWL_ICON_GO_LAST "go-last" /**< go last */
-#define EWL_ICON_GO_NEXT "go-next" /**< go next */
-#define EWL_ICON_GO_PREVIOUS "go-previous" /**< go previous */
-#define EWL_ICON_GO_TOP "go-top" /**< go top */
-#define EWL_ICON_GO_UP "go-up" /**< go up */
-#define EWL_ICON_HELP_ABOUT "help-about" /**< help about */
-#define EWL_ICON_HELP_CONTENTS "help-contents" /**< help contents */
-#define EWL_ICON_HELP_FAQ "help-faq" /**< help faq */
-#define EWL_ICON_INSERT_IMAGE "insert-image" /**< insert image */
-#define EWL_ICON_INSERT_LINK "insert-link" /**< insert link */
-#define EWL_ICON_INSERT_OBJECT "insert-object" /**< insert object */
-#define EWL_ICON_INSERT_TEXT "insert-text" /**< insert text */
-#define EWL_ICON_LIST_ADD "list-add" /**< list add */
-#define EWL_ICON_LIST_REMOVE "list-remove" /**< list remove */
-#define EWL_ICON_MAIL_FORWARD "mail-forward" /**< mail forward */
-#define EWL_ICON_MAIL_MARK_IMPORTANT "mail-mark-important" /**< mail mark important */
-#define EWL_ICON_MAIL_MARK_JUNK "mail-mark-junk" /**< mail mark junk */
-#define EWL_ICON_MAIL_MARK_NOTJUNK "mail-mark-notjunk" /**< mail mark not junk */
-#define EWL_ICON_MAIL_MARK_READ "mail-mark-read" /**< mail mark read */
-#define EWL_ICON_MAIL_MARK_UNREAD "mail-mark-unread" /**< mail mark unread */
-#define EWL_ICON_MAIL_MESSAGE_NEW "mail-message-new" /**< mail message new */
-#define EWL_ICON_MAIL_REPLY_ALL "mail-reply-all" /**< mail reply all */
-#define EWL_ICON_MAIL_REPLY_SENDER "mail-reply-sender" /**< mail reply sender */
-#define EWL_ICON_MAIL_SEND_RECEIVE "mail-send-receive" /**< mail send receive */
-#define EWL_ICON_MEDIA_EJECT "media-eject" /**< media eject */
-#define EWL_ICON_MEDIA_PLAYBACK_PAUSE "media-playback-pause" /**< media playback pause */
-#define EWL_ICON_MEDIA_PLAYBACK_START "media-playback-start" /**< media playback start */
-#define EWL_ICON_MEDIA_PLAYBACK_STOP "media-playback-stop" /**< media playback stop */
-#define EWL_ICON_MEDIA_RECORD "media-record" /**< media record */
-#define EWL_ICON_MEDIA_SEEK_BACKWARD "media-seek-backward" /**< media seek backward */
-#define EWL_ICON_MEDIA_SEEK_FORWARD "media-seek-forward" /**< media seek forward */
-#define EWL_ICON_MEDIA_SKIP_BACKWARD "media-skip-backward" /**< media skip backward */
-#define EWL_ICON_MEDIA_SKIP_FORWARD "media-skip-forward" /**< media skip forward */
-#define EWL_ICON_SYSTEM_LOCK_SCREEN "system-lock-screen" /**< system lock screen */
-#define EWL_ICON_SYSTEM_LOG_OUT "system-log-out" /**< system log out */
-#define EWL_ICON_SYSTEM_RUN "system-run" /**< system run */
-#define EWL_ICON_SYSTEM_SEARCH "system-search" /**< system search */
-#define EWL_ICON_TOOLS_CHECK_SPELLING "tools-check-spelling" /**< tools check spelling */
-#define EWL_ICON_VIEW_FULLSCREEN "view-fullscreen" /**< view fullscreen */
-#define EWL_ICON_VIEW_REFRESH "view-refresh" /**< view refresh */
-#define EWL_ICON_VIEW_SORT_ASCENDING "view-sort-ascending" /**< view sort assending */
-#define EWL_ICON_VIEW_SORT_DESCENDING "view-sort-descending" /**< view sort descending */
-#define EWL_ICON_WINDOW_CLOSE "window-close" /**< window close */
-#define EWL_ICON_WINDOW_NEW "window-new" /**< window new */
-#define EWL_ICON_ZOOM_BEST_FIT "zoom-best-fit" /**< zoom best fit */
-#define EWL_ICON_ZOOM_IN "zoom-in" /**< zoom in */
-#define EWL_ICON_ZOOM_ORIGINAL "zoom-original" /**< zoom original */
-#define EWL_ICON_ZOOM_OUT "zoom-out" /**< zoom out */
+#define EWL_ICON_ADDRESS_BOOK_NEW "address-book-new" /**< address book icon */
+#define EWL_ICON_APPLICATION_EXIT "application-exit" /**< application exit */
+#define EWL_ICON_APPOINTMENT_NEW "appointment-new" /**< appointment new */
+#define EWL_ICON_CONTACT_NEW "contact-new" /**< contact new */
+#define EWL_ICON_DIALOG_APPLY "dialog-apply" /**< dialog apply */
+#define EWL_ICON_DIALOG_CANCEL "dialog-cancel" /**< dialog cancel */
+#define EWL_ICON_DIALOG_CLOSE "dialog-close" /**< dialog close */
+#define EWL_ICON_DIALOG_OK "dialog-ok" /**< dialog ok */
+#define EWL_ICON_DOCUMENT_NEW "document-new" /**< document new */
+#define EWL_ICON_DOCUMENT_OPEN "document-open" /**< document open */
+#define EWL_ICON_DOCUMENT_OPEN_RECENT "document-open-recent" /**< document open recent */
+#define EWL_ICON_DOCUMENT_PAGE_SETUP "document-page-setup" /**< document page setup */
+#define EWL_ICON_DOCUMENT_PRINT "document-print" /**< document print */
+#define EWL_ICON_DOCUMENT_PRINT_PREVIEW "document-print-preview" /**< document print preview */
+#define EWL_ICON_DOCUMENT_PROPERTIES "document-properties" /**< document properities */
+#define EWL_ICON_DOCUMENT_REVERT "document-revert" /**< document revent */
+#define EWL_ICON_DOCUMENT_SAVE "document-save" /**< document save */
+#define EWL_ICON_DOCUMENT_SAVE_AS "document-save-as" /**< document save as */
+#define EWL_ICON_EDIT_COPY "edit-copy" /**< edit copy */
+#define EWL_ICON_EDIT_CUT "edit-cut" /**< edit cut */
+#define EWL_ICON_EDIT_DELETE "edit-delete" /**< edit delete */
+#define EWL_ICON_EDIT_FIND "edit-find" /**< edit find */
+#define EWL_ICON_EDIT_FIND_REPLACE "edit-find-replace" /**< edit find replace */
+#define EWL_ICON_EDIT_PASTE "edit-paste" /**< edit paste */
+#define EWL_ICON_EDIT_REDO "edit-redo" /**< edit redo */
+#define EWL_ICON_EDIT_SELECT_ALL "edit-select-all" /**< edit select all */
+#define EWL_ICON_EDIT_UNDO "edit-undo" /**< edit undo */
+#define EWL_ICON_FORMAT_INDENT_LESS "format-indent-less" /**< format indent less */
+#define EWL_ICON_FORMAT_INDENT_MORE "format-indent-more" /**< format indent more */
+#define EWL_ICON_FORMAT_JUSTIFY_CENTER "format-justify-center" /**< format justify center */
+#define EWL_ICON_FORMAT_JUSTIFY_FILL "format-justify-fill" /**< format justify fill */
+#define EWL_ICON_FORMAT_JUSTIFY_LEFT "format-justify-left" /**< format justify left */
+#define EWL_ICON_FORMAT_JUSTIFY_RIGHT "format-justify-right" /**< format justify right */
+#define EWL_ICON_FORMAT_TEXT_DIRECTION_LTR "format-text-direction-ltr" /**< format text direction left to right */
+#define EWL_ICON_FORMAT_TEXT_DIRECTION_RTL "format-text-direction-rtl" /**< format text direction right to left */
+#define EWL_ICON_FORMAT_TEXT_BOLD "format-text-bold" /**< format text bold */
+#define EWL_ICON_FORMAT_TEXT_ITALIC "format-text-italic" /**< format text italic */
+#define EWL_ICON_FORMAT_TEXT_UNDERLINE "format-text-underline" /**< format text underline */
+#define EWL_ICON_FORMAT_TEXT_STRIKETHROUGH "format-text-strikethrough" /**< format text strikethrough */
+#define EWL_ICON_GO_BOTTOM "go-bottom" /**< go bottom */
+#define EWL_ICON_GO_DOWN "go-down" /**< go down */
+#define EWL_ICON_GO_FIRST "go-first" /**< go first */
+#define EWL_ICON_GO_HOME "go-home" /**< go home */
+#define EWL_ICON_GO_JUMP "go-jump" /**< go jump */
+#define EWL_ICON_GO_LAST "go-last" /**< go last */
+#define EWL_ICON_GO_NEXT "go-next" /**< go next */
+#define EWL_ICON_GO_PREVIOUS "go-previous" /**< go previous */
+#define EWL_ICON_GO_TOP "go-top" /**< go top */
+#define EWL_ICON_GO_UP "go-up" /**< go up */
+#define EWL_ICON_HELP_ABOUT "help-about" /**< help about */
+#define EWL_ICON_HELP_CONTENTS "help-contents" /**< help contents */
+#define EWL_ICON_HELP_FAQ "help-faq" /**< help faq */
+#define EWL_ICON_INSERT_IMAGE "insert-image" /**< insert image */
+#define EWL_ICON_INSERT_LINK "insert-link" /**< insert link */
+#define EWL_ICON_INSERT_OBJECT "insert-object" /**< insert object */
+#define EWL_ICON_INSERT_TEXT "insert-text" /**< insert text */
+#define EWL_ICON_LIST_ADD "list-add" /**< list add */
+#define EWL_ICON_LIST_REMOVE "list-remove" /**< list remove */
+#define EWL_ICON_MAIL_FORWARD "mail-forward" /**< mail forward */
+#define EWL_ICON_MAIL_MARK_IMPORTANT "mail-mark-important" /**< mail mark important */
+#define EWL_ICON_MAIL_MARK_JUNK "mail-mark-junk" /**< mail mark junk */
+#define EWL_ICON_MAIL_MARK_NOTJUNK "mail-mark-notjunk" /**< mail mark not junk */
+#define EWL_ICON_MAIL_MARK_READ "mail-mark-read" /**< mail mark read */
+#define EWL_ICON_MAIL_MARK_UNREAD "mail-mark-unread" /**< mail mark unread */
+#define EWL_ICON_MAIL_MESSAGE_NEW "mail-message-new" /**< mail message new */
+#define EWL_ICON_MAIL_REPLY_ALL "mail-reply-all" /**< mail reply all */
+#define EWL_ICON_MAIL_REPLY_SENDER "mail-reply-sender" /**< mail reply sender */
+#define EWL_ICON_MAIL_SEND_RECEIVE "mail-send-receive" /**< mail send receive */
+#define EWL_ICON_MEDIA_EJECT "media-eject" /**< media eject */
+#define EWL_ICON_MEDIA_PLAYBACK_PAUSE "media-playback-pause" /**< media playback pause */
+#define EWL_ICON_MEDIA_PLAYBACK_START "media-playback-start" /**< media playback start */
+#define EWL_ICON_MEDIA_PLAYBACK_STOP "media-playback-stop" /**< media playback stop */
+#define EWL_ICON_MEDIA_RECORD "media-record" /**< media record */
+#define EWL_ICON_MEDIA_SEEK_BACKWARD "media-seek-backward" /**< media seek backward */
+#define EWL_ICON_MEDIA_SEEK_FORWARD "media-seek-forward" /**< media seek forward */
+#define EWL_ICON_MEDIA_SKIP_BACKWARD "media-skip-backward" /**< media skip backward */
+#define EWL_ICON_MEDIA_SKIP_FORWARD "media-skip-forward" /**< media skip forward */
+#define EWL_ICON_SYSTEM_LOCK_SCREEN "system-lock-screen" /**< system lock screen */
+#define EWL_ICON_SYSTEM_LOG_OUT "system-log-out" /**< system log out */
+#define EWL_ICON_SYSTEM_RUN "system-run" /**< system run */
+#define EWL_ICON_SYSTEM_SEARCH "system-search" /**< system search */
+#define EWL_ICON_TOOLS_CHECK_SPELLING "tools-check-spelling" /**< tools check spelling */
+#define EWL_ICON_VIEW_FULLSCREEN "view-fullscreen" /**< view fullscreen */
+#define EWL_ICON_VIEW_REFRESH "view-refresh" /**< view refresh */
+#define EWL_ICON_VIEW_SORT_ASCENDING "view-sort-ascending" /**< view sort assending */
+#define EWL_ICON_VIEW_SORT_DESCENDING "view-sort-descending" /**< view sort descending */
+#define EWL_ICON_WINDOW_CLOSE "window-close" /**< window close */
+#define EWL_ICON_WINDOW_NEW "window-new" /**< window new */
+#define EWL_ICON_ZOOM_BEST_FIT "zoom-best-fit" /**< zoom best fit */
+#define EWL_ICON_ZOOM_IN "zoom-in" /**< zoom in */
+#define EWL_ICON_ZOOM_ORIGINAL "zoom-original" /**< zoom original */
+#define EWL_ICON_ZOOM_OUT "zoom-out" /**< zoom out */
-#define EWL_ICON_PROCESS_WORKING "process-working" /**< process working */
+#define EWL_ICON_PROCESS_WORKING "process-working" /**< process working */
-#define EWL_ICON_ACCESSORIES_CALCULATOR "accessories-calculator" /**< accessories calculator */
-#define EWL_ICON_ACCESSORIES_CHARACTER_MAP "accessories-character-map" /**< accessories character map */
-#define EWL_ICON_ACCESSORIES_DICTIONARY "accessories-dictionary" /**< accessories dictionary */
-#define EWL_ICON_ACCESSORIES_TEXT_EDITOR "accessories-text-editor" /**< accessories text editor */
-#define EWL_ICON_HELP_BROWSER "help-browser" /**< help browser */
-#define EWL_ICON_MULTIMEDIA_VOLUME_CONTROL "multimedia-volume-control" /**< multimedia volume control */
-#define EWL_ICON_PREFERENCES_DESKTOP_ACCESSIBILITY "preferences-desktop-accessibility" /**< pref desktop
- accessibility */
-#define EWL_ICON_PREFERENCES_DESKTOP_FONT "preferences-desktop-font" /**< pref desktop font */
+#define EWL_ICON_ACCESSORIES_CALCULATOR "accessories-calculator" /**< accessories calculator */
+#define EWL_ICON_ACCESSORIES_CHARACTER_MAP "accessories-character-map" /**< accessories character map */
+#define EWL_ICON_ACCESSORIES_DICTIONARY "accessories-dictionary" /**< accessories dictionary */
+#define EWL_ICON_ACCESSORIES_TEXT_EDITOR "accessories-text-editor" /**< accessories text editor */
+#define EWL_ICON_HELP_BROWSER "help-browser" /**< help browser */
+#define EWL_ICON_MULTIMEDIA_VOLUME_CONTROL "multimedia-volume-control" /**< multimedia volume control */
+#define EWL_ICON_PREFERENCES_DESKTOP_ACCESSIBILITY "preferences-desktop-accessibility" /**< pref desktop
+ accessibility */
+#define EWL_ICON_PREFERENCES_DESKTOP_FONT "preferences-desktop-font" /**< pref desktop font */
#define EWL_ICON_PREFERENCES_DESKTOP_KEYBOARD "preferences-desktop-keyboard" /**< pref desktop keyboard */
#define EWL_ICON_PREFERENCES_DESKTOP_LOCALE "preferences-desktop-locale" /**< pref desktop locale */
#define EWL_ICON_PREFERENCES_DESKTOP_MULTIMEDIA "preferences-desktop-multimedia" /**< pref desktop multimedia */
#define EWL_ICON_PREFERENCES_DESKTOP_SCREENSAVER "preferences-desktop-screensaver" /**< pref desktop scrensaver*/
-#define EWL_ICON_PREFERENCES_DESKTOP_THEME "preferences-desktop-theme" /**< pref desktop theme */
+#define EWL_ICON_PREFERENCES_DESKTOP_THEME "preferences-desktop-theme" /**< pref desktop theme */
#define EWL_ICON_PREFERENCES_DESKTOP_WALLPAPER "preferences-desktop-wallpaper" /**< pref desktop wallpaper */
-#define EWL_ICON_SYSTEM_FILE_MANAGER "system-file-manager" /**< system file manager */
-#define EWL_ICON_SYSTEM_SOFTWARE_UPDATE "system-software-update" /**< system software update */
-#define EWL_ICON_UTILITIES_TERMINAL "utilities-terminal" /**< utilities terminal */
+#define EWL_ICON_SYSTEM_FILE_MANAGER "system-file-manager" /**< system file manager */
+#define EWL_ICON_SYSTEM_SOFTWARE_UPDATE "system-software-update" /**< system software update */
+#define EWL_ICON_UTILITIES_TERMINAL "utilities-terminal" /**< utilities terminal */
-#define EWL_ICON_APPLICATIONS_ACCESSORIES "applications-accessories" /**< apps accessories */
-#define EWL_ICON_APPLICATIONS_DEVELOPMENT "applications-development" /**< apps development */
-#define EWL_ICON_APPLICATIONS_GAMES "applications-games" /**< apps games*/
-#define EWL_ICON_APPLICATIONS_GRAPHICS "applications-graphics" /**< apps graphics */
-#define EWL_ICON_APPLICATIONS_INTERNET "applications-internet" /**< apps internet */
-#define EWL_ICON_APPLICATIONS_MULTIMEDIA "applications-multimedia" /**< apps multimedia */
-#define EWL_ICON_APPLICATIONS_OFFICE "applications-office" /**< apps office */
-#define EWL_ICON_APPLICATIONS_OTHER "applications-other" /**< apps other */
-#define EWL_ICON_APPLICATIONS_SYSTEM "applications-system" /**< apps system */
-#define EWL_ICON_APPLICATIONS_UTILITIES "applications-utilities" /**< apps utilities */
-#define EWL_ICON_PREFERENCES_DESKTOP "preferences-desktop" /**< prefs desktop */
-#define EWL_ICON_PREFERENCES_DESKTOP_ACCESSIBILITY "preferences-desktop-accessibility" /**< prefs desktop
- accessibility */
+#define EWL_ICON_APPLICATIONS_ACCESSORIES "applications-accessories" /**< apps accessories */
+#define EWL_ICON_APPLICATIONS_DEVELOPMENT "applications-development" /**< apps development */
+#define EWL_ICON_APPLICATIONS_GAMES "applications-games" /**< apps games*/
+#define EWL_ICON_APPLICATIONS_GRAPHICS "applications-graphics" /**< apps graphics */
+#define EWL_ICON_APPLICATIONS_INTERNET "applications-internet" /**< apps internet */
+#define EWL_ICON_APPLICATIONS_MULTIMEDIA "applications-multimedia" /**< apps multimedia */
+#define EWL_ICON_APPLICATIONS_OFFICE "applications-office" /**< apps office */
+#define EWL_ICON_APPLICATIONS_OTHER "applications-other" /**< apps other */
+#define EWL_ICON_APPLICATIONS_SYSTEM "applications-system" /**< apps system */
+#define EWL_ICON_APPLICATIONS_UTILITIES "applications-utilities" /**< apps utilities */
+#define EWL_ICON_PREFERENCES_DESKTOP "preferences-desktop" /**< prefs desktop */
+#define EWL_ICON_PREFERENCES_DESKTOP_ACCESSIBILITY "preferences-desktop-accessibility" /**< prefs desktop
+ accessibility */
#define EWL_ICON_PREFERENCES_DESKTOP_PERIPHERALS "preferences-desktop-peripherals" /**< prefs desktop
- peripherals */
+ peripherals */
#define EWL_ICON_PREFERENCES_DESKTOP_PERSONAL "preferences-desktop-personal" /**< prefs desktop personal */
-#define EWL_ICON_PREFERENCES_OTHER "preferences-other" /**< prefs other */
-#define EWL_ICON_PREFERENCES_SYSTEM "preferences-system" /**< prefs system */
+#define EWL_ICON_PREFERENCES_OTHER "preferences-other" /**< prefs other */
+#define EWL_ICON_PREFERENCES_SYSTEM "preferences-system" /**< prefs system */
#define EWL_ICON_PREFERENCES_SYSTEM_NETWORK "preferences-system-network" /**< prefs system network */
-#define EWL_ICON_SYSTEM_HELP "system-help" /**< system help */
+#define EWL_ICON_SYSTEM_HELP "system-help" /**< system help */
-#define EWL_ICON_AUDIO_CARD "audio-card" /**< audio card */
+#define EWL_ICON_AUDIO_CARD "audio-card" /**< audio card */
#define EWL_ICON_AUDIO_INPUT_MICROPHONE "audio-input-microphone" /**< audio input microphone */
-#define EWL_ICON_BATTERY "battery" /**< battery */
-#define EWL_ICON_CAMERA_PHOTO "camera-photo" /**< camera photo */
-#define EWL_ICON_CAMERA_VIDEO "camera-video" /**< camera video */
-#define EWL_ICON_COMPUTER "computer" /**< computer */
-#define EWL_ICON_DRIVE_CDROM "drive-cdrom" /**< drive cdrom */
-#define EWL_ICON_DRIVE_HARDDISK "drive-harddisk" /**< drive harddisk */
-#define EWL_ICON_DRIVE_REMOVABLE_MEDIA "drive-removable-media" /**< drive removable media */
-#define EWL_ICON_INPUT_GAMING "input-gaming" /**< input gaming */
-#define EWL_ICON_INPUT_KEYBOARD "input-keyboard" /**< input keyboard */
-#define EWL_ICON_INPUT_MOUSE "input-mouse" /**< input mouse */
-#define EWL_ICON_MEDIA_CDROM "media-cdrom" /**< media cdrom */
-#define EWL_ICON_MEDIA_FLOPPY "media-floppy" /**< media floppy */
-#define EWL_ICON_MULTIMEDIA_PLAYER "multimedia-player" /**< multimedia player */
-#define EWL_ICON_NETWORK_WIRED "network-wired" /**< network wired */
-#define EWL_ICON_NETWORK_WIRELESS "network-wireless" /**< network wireless */
-#define EWL_ICON_PRINTER "printer" /**< printer */
+#define EWL_ICON_BATTERY "battery" /**< battery */
+#define EWL_ICON_CAMERA_PHOTO "camera-photo" /**< camera photo */
+#define EWL_ICON_CAMERA_VIDEO "camera-video" /**< camera video */
+#define EWL_ICON_COMPUTER "computer" /**< computer */
+#define EWL_ICON_DRIVE_CDROM "drive-cdrom" /**< drive cdrom */
+#define EWL_ICON_DRIVE_HARDDISK "drive-harddisk" /**< drive harddisk */
+#define EWL_ICON_DRIVE_REMOVABLE_MEDIA "drive-removable-media" /**< drive removable media */
+#define EWL_ICON_INPUT_GAMING "input-gaming" /**< input gaming */
+#define EWL_ICON_INPUT_KEYBOARD "input-keyboard" /**< input keyboard */
+#define EWL_ICON_INPUT_MOUSE "input-mouse" /**< input mouse */
+#define EWL_ICON_MEDIA_CDROM "media-cdrom" /**< media cdrom */
+#define EWL_ICON_MEDIA_FLOPPY "media-floppy" /**< media floppy */
+#define EWL_ICON_MULTIMEDIA_PLAYER "multimedia-player" /**< multimedia player */
+#define EWL_ICON_NETWORK_WIRED "network-wired" /**< network wired */
+#define EWL_ICON_NETWORK_WIRELESS "network-wireless" /**< network wireless */
+#define EWL_ICON_PRINTER "printer" /**< printer */
-#define EWL_ICON_EMBLEM_DEFAULT "emblem-default" /**< emblem default */
-#define EWL_ICON_EMBLEM_DOCUMENTS "emblem-documents" /**< emblem documents */
-#define EWL_ICON_EMBLEM_DOWNLOADS "emblem-downloads" /**< emblem downloads */
-#define EWL_ICON_EMBLEM_FAVORITE "emblem-favorite" /**< emblem favorite */
-#define EWL_ICON_EMBLEM_IMPORTANT "emblem-important" /**< emblem important */
-#define EWL_ICON_EMBLEM_MAIL "emblem-mail" /**< emblem mail */
-#define EWL_ICON_EMBLEM_PHOTOS "emblem-photos" /**< emblem photos */
-#define EWL_ICON_EMBLEM_READONLY "emblem-readonly" /**< emblem readonly */
-#define EWL_ICON_EMBLEM_SHARED "emblem-shared" /**< emblem shared */
-#define EWL_ICON_EMBLEM_SYMBOLIC_LINK "emblem-symbolic-link" /**< emblem symbolic link */
-#define EWL_ICON_EMBLEM_SYNCHRONIZED "emblem-synchronized" /**< emblem synchronized */
-#define EWL_ICON_EMBLEM_SYSTEM "emblem-system" /**< emblem system */
-#define EWL_ICON_EMBLEM_UNREADABLE "emblem-unreadable" /**< emblem unreadable */
+#define EWL_ICON_EMBLEM_DEFAULT "emblem-default" /**< emblem default */
+#define EWL_ICON_EMBLEM_DOCUMENTS "emblem-documents" /**< emblem documents */
+#define EWL_ICON_EMBLEM_DOWNLOADS "emblem-downloads" /**< emblem downloads */
+#define EWL_ICON_EMBLEM_FAVORITE "emblem-favorite" /**< emblem favorite */
+#define EWL_ICON_EMBLEM_IMPORTANT "emblem-important" /**< emblem important */
+#define EWL_ICON_EMBLEM_MAIL "emblem-mail" /**< emblem mail */
+#define EWL_ICON_EMBLEM_PHOTOS "emblem-photos" /**< emblem photos */
+#define EWL_ICON_EMBLEM_READONLY "emblem-readonly" /**< emblem readonly */
+#define EWL_ICON_EMBLEM_SHARED "emblem-shared" /**< emblem shared */
+#define EWL_ICON_EMBLEM_SYMBOLIC_LINK "emblem-symbolic-link" /**< emblem symbolic link */
+#define EWL_ICON_EMBLEM_SYNCHRONIZED "emblem-synchronized" /**< emblem synchronized */
+#define EWL_ICON_EMBLEM_SYSTEM "emblem-system" /**< emblem system */
+#define EWL_ICON_EMBLEM_UNREADABLE "emblem-unreadable" /**< emblem unreadable */
-#define EWL_ICON_FACE_ANGEL "face-angel" /**< face angel */
-#define EWL_ICON_FACE_CRYING "face-crying" /**< face crying */
-#define EWL_ICON_FACE_DEVIL_GRIN "face-devil-grin" /**< face devil grin */
-#define EWL_ICON_FACE_DEVIL_SAD "face-devil-sad" /**< face devil sad */
-#define EWL_ICON_FACE_GLASSES "face-glasses" /**< face glasses */
-#define EWL_ICON_FACE_KISS "face-kiss" /**< face kiss */
-#define EWL_ICON_FACE_MONKEY "face-monkey" /**< face monkey */
-#define EWL_ICON_FACE_PLAIN "face-plain" /**< face plain */
-#define EWL_ICON_FACE_SAD "face-sad" /**< face sad */
-#define EWL_ICON_FACE_SMILE "face-smile" /**< face smile */
-#define EWL_ICON_FACE_SMILE_BIG "face-smile-big" /**< face smile big */
-#define EWL_ICON_FACE_SMIRK "face-smirk" /**< face smirk */
-#define EWL_ICON_FACE_SURPRISE "face-surprise" /**< face surprise */
-#define EWL_ICON_FACE_WINK "face-wink" /**< face wink */
+#define EWL_ICON_FACE_ANGEL "face-angel" /**< face angel */
+#define EWL_ICON_FACE_CRYING "face-crying" /**< face crying */
+#define EWL_ICON_FACE_DEVIL_GRIN "face-devil-grin" /**< face devil grin */
+#define EWL_ICON_FACE_DEVIL_SAD "face-devil-sad" /**< face devil sad */
+#define EWL_ICON_FACE_GLASSES "face-glasses" /**< face glasses */
+#define EWL_ICON_FACE_KISS "face-kiss" /**< face kiss */
+#define EWL_ICON_FACE_MONKEY "face-monkey" /**< face monkey */
+#define EWL_ICON_FACE_PLAIN "face-plain" /**< face plain */
+#define EWL_ICON_FACE_SAD "face-sad" /**< face sad */
+#define EWL_ICON_FACE_SMILE "face-smile" /**< face smile */
+#define EWL_ICON_FACE_SMILE_BIG "face-smile-big" /**< face smile big */
+#define EWL_ICON_FACE_SMIRK "face-smirk" /**< face smirk */
+#define EWL_ICON_FACE_SURPRISE "face-surprise" /**< face surprise */
+#define EWL_ICON_FACE_WINK "face-wink" /**< face wink */
-#define EWL_ICON_APPLICATION_X_EXECUTABLE "application-x-executable" /**< application/x-executable */
-#define EWL_ICON_AUDIO_X_GENERIC "audio-x-generic" /**< audio/x-generic */
-#define EWL_ICON_FONT_X_GENERIC "font-x-generic" /**< font/x-generic */
-#define EWL_ICON_IMAGE_X_GENERIC "image-x-generic" /**< image/x-generic */
-#define EWL_ICON_PACKAGE_X_GENERIC "package-x-generic" /**< package/x-generic */
-#define EWL_ICON_TEXT_HTML "text-html" /**< text/html */
-#define EWL_ICON_TEXT_X_GENERIC "text-x-generic" /**< text/x-generic */
+#define EWL_ICON_APPLICATION_X_EXECUTABLE "application-x-executable" /**< application/x-executable */
+#define EWL_ICON_AUDIO_X_GENERIC "audio-x-generic" /**< audio/x-generic */
+#define EWL_ICON_FONT_X_GENERIC "font-x-generic" /**< font/x-generic */
+#define EWL_ICON_IMAGE_X_GENERIC "image-x-generic" /**< image/x-generic */
+#define EWL_ICON_PACKAGE_X_GENERIC "package-x-generic" /**< package/x-generic */
+#define EWL_ICON_TEXT_HTML "text-html" /**< text/html */
+#define EWL_ICON_TEXT_X_GENERIC "text-x-generic" /**< text/x-generic */
#define EWL_ICON_TEXT_X_GENERIC_TEMPLATE "text-x-generic-template" /**< text/x-generic-template */
-#define EWL_ICON_TEXT_X_SCRIPT "text-x-script" /**< text/x-script*/
-#define EWL_ICON_VIDEO_X_GENERIC "video-x-generic" /**< video/x-generic */
-#define EWL_ICON_X_OFFICE_ADDRESS_BOOK "x-office-address-book" /**< x-office/address-book */
-#define EWL_ICON_X_OFFICE_CALENDAR "x-office-calendar" /**< x-office/calendar */
-#define EWL_ICON_X_OFFICE_DOCUMENT "x-office-document" /**< x-office/document */
-#define EWL_ICON_X_OFFICE_PRESENTATION "x-office-presentation" /**< x-office/presentation */
-#define EWL_ICON_X_OFFICE_SPREADSHEET "x-office-spreadsheet" /**< x-office/spreadsheet */
+#define EWL_ICON_TEXT_X_SCRIPT "text-x-script" /**< text/x-script*/
+#define EWL_ICON_VIDEO_X_GENERIC "video-x-generic" /**< video/x-generic */
+#define EWL_ICON_X_OFFICE_ADDRESS_BOOK "x-office-address-book" /**< x-office/address-book */
+#define EWL_ICON_X_OFFICE_CALENDAR "x-office-calendar" /**< x-office/calendar */
+#define EWL_ICON_X_OFFICE_DOCUMENT "x-office-document" /**< x-office/document */
+#define EWL_ICON_X_OFFICE_PRESENTATION "x-office-presentation" /**< x-office/presentation */
+#define EWL_ICON_X_OFFICE_SPREADSHEET "x-office-spreadsheet" /**< x-office/spreadsheet */
-#define EWL_ICON_FOLDER "folder" /**< folder */
-#define EWL_ICON_FOLDER_NEW "folder-new" /**< new folder */
-#define EWL_ICON_FOLDER_REMOTE "folder-remote" /**< folder remote */
-#define EWL_ICON_NETWORK_SERVER "network-server" /**< network server */
-#define EWL_ICON_NETWORK_WORKGROUP "network-workgroup" /**< network workgroup */
-#define EWL_ICON_START_HERE "start-here" /**< start here */
-#define EWL_ICON_USER_DESKTOP "user-desktop" /**< user desktop */
-#define EWL_ICON_USER_HOME "user-home" /**< user home */
-#define EWL_ICON_USER_TRASH "user-trash" /**< user trash */
+#define EWL_ICON_FOLDER "folder" /**< folder */
+#define EWL_ICON_FOLDER_NEW "folder-new" /**< new folder */
+#define EWL_ICON_FOLDER_REMOTE "folder-remote" /**< folder remote */
+#define EWL_ICON_NETWORK_SERVER "network-server" /**< network server */
+#define EWL_ICON_NETWORK_WORKGROUP "network-workgroup" /**< network workgroup */
+#define EWL_ICON_START_HERE "start-here" /**< start here */
+#define EWL_ICON_USER_DESKTOP "user-desktop" /**< user desktop */
+#define EWL_ICON_USER_HOME "user-home" /**< user home */
+#define EWL_ICON_USER_TRASH "user-trash" /**< user trash */
-#define EWL_ICON_APPOINTMENT_MISSED "appointment-missed" /**< appointment missed */
-#define EWL_ICON_APPOINTMENT_SOON "appointment-soon" /**< appointment soon */
-#define EWL_ICON_AUDIO_VOLUME_HIGH "audio-volume-high" /**< audio volume high */
-#define EWL_ICON_AUDIO_VOLUME_LOW "audio-volume-low" /**< audio volume low */
-#define EWL_ICON_AUDIO_VOLUME_MEDIUM "audio-volume-medium" /**< audio volume medium */
-#define EWL_ICON_AUDIO_VOLUME_MUTED "audio-volume-muted" /**< audio volume muted */
-#define EWL_ICON_BATTERY_CAUTION "battery-caution" /**< battery caution */
-#define EWL_ICON_BATTERY_LOW "battery-low" /**< battery low */
-#define EWL_ICON_DIALOG_ERROR "dialog-error" /**< dialog error */
-#define EWL_ICON_DIALOG_INFORMATION "dialog-information" /**< dialog information */
-#define EWL_ICON_DIALOG_PASSWORD "dialog-password" /**< dialog password */
-#define EWL_ICON_DIALOG_QUESTION "dialog-question" /**< dialog question */
-#define EWL_ICON_DIALOG_WARNING "dialog-warning" /**< dialog warning */
-#define EWL_ICON_FOLDER_DRAG_ACCEPT "folder-drag-accept" /**< folder drag accept */
-#define EWL_ICON_FOLDER_OPEN "folder-open" /**< folder open */
-#define EWL_ICON_FOLDER_VISITING "folder-visiting" /**< folder visiting */
-#define EWL_ICON_IMAGE_LOADING "image-loading" /**< image loading */
-#define EWL_ICON_IMAGE_MISSING "image-missing" /**< image missing */
-#define EWL_ICON_MAIL_ATTACHMENT "mail-attachment" /**< mail attachment */
-#define EWL_ICON_MAIL_UNREAD "mail-unread" /**< mail unread */
-#define EWL_ICON_MAIL_READ "mail-read" /**< mail read */
-#define EWL_ICON_MAIL_REPLIED "mail-replied" /**< mail replied */
-#define EWL_ICON_MAIL_SIGNED "mail-signed" /**< mail signed */
-#define EWL_ICON_MAIL_SIGNED_VERIFIED "mail-signed-verified" /**< mail signed verified */
-#define EWL_ICON_MEDIA_PLAYLIST_REPEAT "media-playlist-repeat" /**< media playlist repeat */
+#define EWL_ICON_APPOINTMENT_MISSED "appointment-missed" /**< appointment missed */
+#define EWL_ICON_APPOINTMENT_SOON "appointment-soon" /**< appointment soon */
+#define EWL_ICON_AUDIO_VOLUME_HIGH "audio-volume-high" /**< audio volume high */
+#define EWL_ICON_AUDIO_VOLUME_LOW "audio-volume-low" /**< audio volume low */
+#define EWL_ICON_AUDIO_VOLUME_MEDIUM "audio-volume-medium" /**< audio volume medium */
+#define EWL_ICON_AUDIO_VOLUME_MUTED "audio-volume-muted" /**< audio volume muted */
+#define EWL_ICON_BATTERY_CAUTION "battery-caution" /**< battery caution */
+#define EWL_ICON_BATTERY_LOW "battery-low" /**< battery low */
+#define EWL_ICON_DIALOG_ERROR "dialog-error" /**< dialog error */
+#define EWL_ICON_DIALOG_INFORMATION "dialog-information" /**< dialog information */
+#define EWL_ICON_DIALOG_PASSWORD "dialog-password" /**< dialog password */
+#define EWL_ICON_DIALOG_QUESTION "dialog-question" /**< dialog question */
+#define EWL_ICON_DIALOG_WARNING "dialog-warning" /**< dialog warning */
+#define EWL_ICON_FOLDER_DRAG_ACCEPT "folder-drag-accept" /**< folder drag accept */
+#define EWL_ICON_FOLDER_OPEN "folder-open" /**< folder open */
+#define EWL_ICON_FOLDER_VISITING "folder-visiting" /**< folder visiting */
+#define EWL_ICON_IMAGE_LOADING "image-loading" /**< image loading */
+#define EWL_ICON_IMAGE_MISSING "image-missing" /**< image missing */
+#define EWL_ICON_MAIL_ATTACHMENT "mail-attachment" /**< mail attachment */
+#define EWL_ICON_MAIL_UNREAD "mail-unread" /**< mail unread */
+#define EWL_ICON_MAIL_READ "mail-read" /**< mail read */
+#define EWL_ICON_MAIL_REPLIED "mail-replied" /**< mail replied */
+#define EWL_ICON_MAIL_SIGNED "mail-signed" /**< mail signed */
+#define EWL_ICON_MAIL_SIGNED_VERIFIED "mail-signed-verified" /**< mail signed verified */
+#define EWL_ICON_MEDIA_PLAYLIST_REPEAT "media-playlist-repeat" /**< media playlist repeat */
#define EWL_ICON_MEDIA_PLAYLIST_SHUFFLE "media-playlist-shuffle" /**< media playlist shuffle */
-#define EWL_ICON_NETWORK_ERROR "network-error" /**< network error */
-#define EWL_ICON_NETWORK_IDLE "network-idle" /**< network idle */
+#define EWL_ICON_NETWORK_ERROR "network-error" /**< network error */
+#define EWL_ICON_NETWORK_IDLE "network-idle" /**< network idle */
-#define EWL_ICON_NETWORK_OFFLINE "network-offline" /**< network offline */
-#define EWL_ICON_NETWORK_RECEIVE "network-receive" /**< network receive */
-#define EWL_ICON_NETWORK_TRANSMIT "network-transmit" /**< network transmit */
-#define EWL_ICON_NETWORK_TRANSMIT_RECEIVE "network-transmit-receive" /**< network transmit receive */
-#define EWL_ICON_PRINTER_ERROR "printer-error" /**< printer error */
-#define EWL_ICON_PRINTER_PRINTING "printer-printing" /**< printer printing */
-#define EWL_ICON_SOFTWARE_UPDATE_AVAILABLE "software-update-available" /**< software update*/
+#define EWL_ICON_NETWORK_OFFLINE "network-offline" /**< network offline */
+#define EWL_ICON_NETWORK_RECEIVE "network-receive" /**< network receive */
+#define EWL_ICON_NETWORK_TRANSMIT "network-transmit" /**< network transmit */
+#define EWL_ICON_NETWORK_TRANSMIT_RECEIVE "network-transmit-receive" /**< network transmit receive */
+#define EWL_ICON_PRINTER_ERROR "printer-error" /**< printer error */
+#define EWL_ICON_PRINTER_PRINTING "printer-printing" /**< printer printing */
+#define EWL_ICON_SOFTWARE_UPDATE_AVAILABLE "software-update-available" /**< software update*/
#define EWL_ICON_SOFTWARE_UPDATE_URGENT "software-update-urgent" /**< software update urgent */
-#define EWL_ICON_SYNC_ERROR "sync-error" /**< sync error */
-#define EWL_ICON_SYNC_SYNCHRONIZING "sync-synchronizing" /**< sync synchronizing */
-#define EWL_ICON_TASK_DUE "task-due" /**< task due */
-#define EWL_ICON_TASK_PASSED_DUE "task-passed-due" /**< task passwd due */
-#define EWL_ICON_USER_AWAY "user-away" /**< user away */
-#define EWL_ICON_USER_IDLE "user-idle" /**< user idle */
-#define EWL_ICON_USER_OFFLINE "user-offline" /**< user offline */
-#define EWL_ICON_USER_ONLINE "user-online" /**< user online */
-#define EWL_ICON_USER_TRASH_FULL "user-trash-full" /**< user trash full */
-#define EWL_ICON_WEATHER_CLEAR "weather-clear" /**< weather clear */
-#define EWL_ICON_WEATHER_CLEAR_NIGHT "weather-clear-night" /**< weather clear night */
-#define EWL_ICON_WEATHER_FEW_CLOUDS "weather-few-clouds" /**< weather few clouds */
-#define EWL_ICON_WEATHER_FEW_CLOUDS_NIGHT "weather-few-clouds-night" /**< weather few clouds night */
-#define EWL_ICON_WEATHER_FOG "weather-fog" /**< weather fog */
-#define EWL_ICON_WEATHER_OVERCAST "weather-overcast" /**< weather overcast */
-#define EWL_ICON_WEATHER_SEVERE_ALERT "weather-severe-alert" /**< weather severe alert */
-#define EWL_ICON_WEATHER_SHOWERS "weather-showers" /**< weather showers */
-#define EWL_ICON_WEATHER_SHOWERS_SCATTERED "weather-showers-scattered" /**< weather showers scattered */
-#define EWL_ICON_WEATHER_SNOW "weather-snow" /**< weather snow */
-#define EWL_ICON_WEATHER_STORM "weather-storm" /**< weather storm */
+#define EWL_ICON_SYNC_ERROR "sync-error" /**< sync error */
+#define EWL_ICON_SYNC_SYNCHRONIZING "sync-synchronizing" /**< sync synchronizing */
+#define EWL_ICON_TASK_DUE "task-due" /**< task due */
+#define EWL_ICON_TASK_PASSED_DUE "task-passed-due" /**< task passwd due */
+#define EWL_ICON_USER_AWAY "user-away" /**< user away */
+#define EWL_ICON_USER_IDLE "user-idle" /**< user idle */
+#define EWL_ICON_USER_OFFLINE "user-offline" /**< user offline */
+#define EWL_ICON_USER_ONLINE "user-online" /**< user online */
+#define EWL_ICON_USER_TRASH_FULL "user-trash-full" /**< user trash full */
+#define EWL_ICON_WEATHER_CLEAR "weather-clear" /**< weather clear */
+#define EWL_ICON_WEATHER_CLEAR_NIGHT "weather-clear-night" /**< weather clear night */
+#define EWL_ICON_WEATHER_FEW_CLOUDS "weather-few-clouds" /**< weather few clouds */
+#define EWL_ICON_WEATHER_FEW_CLOUDS_NIGHT "weather-few-clouds-night" /**< weather few clouds night */
+#define EWL_ICON_WEATHER_FOG "weather-fog" /**< weather fog */
+#define EWL_ICON_WEATHER_OVERCAST "weather-overcast" /**< weather overcast */
+#define EWL_ICON_WEATHER_SEVERE_ALERT "weather-severe-alert" /**< weather severe alert */
+#define EWL_ICON_WEATHER_SHOWERS "weather-showers" /**< weather showers */
+#define EWL_ICON_WEATHER_SHOWERS_SCATTERED "weather-showers-scattered" /**< weather showers scattered */
+#define EWL_ICON_WEATHER_SNOW "weather-snow" /**< weather snow */
+#define EWL_ICON_WEATHER_STORM "weather-storm" /**< weather storm */
/**
* @}
diff --git a/src/lib/ewl_image.c b/src/lib/ewl_image.c
index 8e243a5..8d513b4 100644
--- a/src/lib/ewl_image.c
+++ b/src/lib/ewl_image.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_image.h"
#include "ewl_private.h"
@@ -26,7 +26,7 @@ static void ewl_image_rotate_90(Ewl_Image *img, int cc);
static Ewl_Widget *ewl_image_view_cb_header_fetch(void *data, unsigned int col);
static Ewl_Widget *ewl_image_view_cb_widget_fetch(void *data, unsigned int row,
- unsigned int col);
+ unsigned int col);
/**
* @return Returns a pointer to a new image widget on success, NULL on failure.
@@ -38,20 +38,20 @@ static Ewl_Widget *ewl_image_view_cb_widget_fetch(void *data, unsigned int row,
Ewl_Widget *
ewl_image_new(void)
{
- Ewl_Image *image;
+ Ewl_Image *image;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- image = NEW(Ewl_Image, 1);
- if (!image)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ image = NEW(Ewl_Image, 1);
+ if (!image)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_image_init(image)) {
- ewl_widget_destroy(EWL_WIDGET(image));
- image = NULL;
- }
+ if (!ewl_image_init(image)) {
+ ewl_widget_destroy(EWL_WIDGET(image));
+ image = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(image), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(image), DLEVEL_STABLE);
}
/**
@@ -61,42 +61,42 @@ ewl_image_new(void)
Ewl_View *
ewl_image_view_get(void)
{
- Ewl_View *view;
+ Ewl_View *view;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- view = ewl_view_new();
- ewl_view_widget_fetch_set(view, ewl_image_view_cb_widget_fetch);
- ewl_view_header_fetch_set(view, ewl_image_view_cb_header_fetch);
+ view = ewl_view_new();
+ ewl_view_widget_fetch_set(view, ewl_image_view_cb_widget_fetch);
+ ewl_view_header_fetch_set(view, ewl_image_view_cb_header_fetch);
- DRETURN_PTR(view, DLEVEL_STABLE);
+ DRETURN_PTR(view, DLEVEL_STABLE);
}
static Ewl_Widget *
ewl_image_view_cb_widget_fetch(void *data, unsigned int row __UNUSED__,
- unsigned int col __UNUSED__)
+ unsigned int col __UNUSED__)
{
- Ewl_Widget *image;
+ Ewl_Widget *image;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- image = ewl_image_new();
- ewl_image_file_path_set(EWL_IMAGE(image), data);
+ image = ewl_image_new();
+ ewl_image_file_path_set(EWL_IMAGE(image), data);
- DRETURN_PTR(image, DLEVEL_STABLE);
+ DRETURN_PTR(image, DLEVEL_STABLE);
}
static Ewl_Widget *
ewl_image_view_cb_header_fetch(void *data, unsigned int col __UNUSED__)
{
- Ewl_Widget *image;
+ Ewl_Widget *image;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- image = ewl_image_new();
- ewl_image_file_path_set(EWL_IMAGE(image), data);
+ image = ewl_image_new();
+ ewl_image_file_path_set(EWL_IMAGE(image), data);
- DRETURN_PTR(image, DLEVEL_STABLE);
+ DRETURN_PTR(image, DLEVEL_STABLE);
}
/**
@@ -109,50 +109,50 @@ ewl_image_view_cb_header_fetch(void *data, unsigned int col __UNUSED__)
int
ewl_image_init(Ewl_Image *i)
{
- Ewl_Widget *w;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(i, FALSE);
-
- w = EWL_WIDGET(i);
-
- if (!ewl_widget_init(w))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- ewl_widget_appearance_set(w, EWL_IMAGE_TYPE);
- ewl_widget_inherit(w, EWL_IMAGE_TYPE);
-
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
-
- /*
- * Append necessary callbacks.
- */
- ewl_callback_append(w, EWL_CALLBACK_REVEAL, ewl_image_cb_reveal,
- NULL);
- ewl_callback_append(w, EWL_CALLBACK_OBSCURE, ewl_image_cb_obscure,
- NULL);
- ewl_callback_prepend(w, EWL_CALLBACK_DESTROY, ewl_image_cb_destroy,
- NULL);
- ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, ewl_image_cb_configure,
- NULL);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_DOWN, ewl_image_cb_mouse_down,
- NULL);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_UP, ewl_image_cb_mouse_up,
- NULL);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE, ewl_image_cb_mouse_move,
- NULL);
-
- i->sw = 1.0;
- i->sh = 1.0;
-
- i->cs = 0;
-
- i->tile.x = 0;
- i->tile.y = 0;
- i->tile.w = 0;
- i->tile.h = 0;
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Widget *w;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(i, FALSE);
+
+ w = EWL_WIDGET(i);
+
+ if (!ewl_widget_init(w))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ ewl_widget_appearance_set(w, EWL_IMAGE_TYPE);
+ ewl_widget_inherit(w, EWL_IMAGE_TYPE);
+
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
+
+ /*
+ * Append necessary callbacks.
+ */
+ ewl_callback_append(w, EWL_CALLBACK_REVEAL, ewl_image_cb_reveal,
+ NULL);
+ ewl_callback_append(w, EWL_CALLBACK_OBSCURE, ewl_image_cb_obscure,
+ NULL);
+ ewl_callback_prepend(w, EWL_CALLBACK_DESTROY, ewl_image_cb_destroy,
+ NULL);
+ ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, ewl_image_cb_configure,
+ NULL);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_DOWN, ewl_image_cb_mouse_down,
+ NULL);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_UP, ewl_image_cb_mouse_up,
+ NULL);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE, ewl_image_cb_mouse_move,
+ NULL);
+
+ i->sw = 1.0;
+ i->sh = 1.0;
+
+ i->cs = 0;
+
+ i->tile.x = 0;
+ i->tile.y = 0;
+ i->tile.w = 0;
+ i->tile.h = 0;
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -164,14 +164,14 @@ ewl_image_init(Ewl_Image *i)
void
ewl_image_file_path_set(Ewl_Image *i, const char *path)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(i);
- DCHECK_PARAM_PTR(path);
- DCHECK_TYPE(i, EWL_IMAGE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(i);
+ DCHECK_PARAM_PTR(path);
+ DCHECK_TYPE(i, EWL_IMAGE_TYPE);
- ewl_image_file_set(i, path, i->key);
+ ewl_image_file_set(i, path, i->key);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -182,11 +182,11 @@ ewl_image_file_path_set(Ewl_Image *i, const char *path)
const char *
ewl_image_file_path_get(Ewl_Image *i)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(i, NULL);
- DCHECK_TYPE_RET(i, EWL_IMAGE_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(i, NULL);
+ DCHECK_TYPE_RET(i, EWL_IMAGE_TYPE, NULL);
- DRETURN_PTR(i->path, DLEVEL_STABLE);
+ DRETURN_PTR(i->path, DLEVEL_STABLE);
}
/**
@@ -198,19 +198,19 @@ ewl_image_file_path_get(Ewl_Image *i)
void
ewl_image_file_key_set(Ewl_Image *i, const char *key)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(i);
- DCHECK_TYPE(i, EWL_IMAGE_TYPE);
-
- if (i->path)
- ewl_image_file_set(i, i->path, key);
- else
- {
- IF_FREE(i->key);
- if (key) i->key = strdup(key);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(i);
+ DCHECK_TYPE(i, EWL_IMAGE_TYPE);
+
+ if (i->path)
+ ewl_image_file_set(i, i->path, key);
+ else
+ {
+ IF_FREE(i->key);
+ if (key) i->key = strdup(key);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -220,11 +220,11 @@ ewl_image_file_key_set(Ewl_Image *i, const char *key)
const char *
ewl_image_file_key_get(Ewl_Image *i)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(i, NULL);
- DCHECK_TYPE_RET(i, EWL_IMAGE_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(i, NULL);
+ DCHECK_TYPE_RET(i, EWL_IMAGE_TYPE, NULL);
- DRETURN_PTR(i->key, DLEVEL_STABLE);
+ DRETURN_PTR(i->key, DLEVEL_STABLE);
}
/**
@@ -240,39 +240,39 @@ ewl_image_file_key_get(Ewl_Image *i)
void
ewl_image_file_set(Ewl_Image *i, const char *im, const char *key)
{
- Ewl_Widget *w;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(i);
- DCHECK_TYPE(i, EWL_IMAGE_TYPE);
-
- w = EWL_WIDGET(i);
-
- IF_FREE(i->path);
- IF_FREE(i->key);
-
- /*
- * Determine the type of image to be loaded.
- */
- if (im) {
- i->type = ewl_image_type_get(im);
- i->path = strdup(im);
- if (key) i->key = strdup(key);
- }
- else
- i->type = EWL_IMAGE_TYPE_NORMAL;
-
- /*
- * Load the new image if widget has been realized
- */
- if (REALIZED(w)) {
- ewl_widget_obscure(w);
- ewl_widget_reveal(w);
- }
-
- ewl_callback_call(w, EWL_CALLBACK_VALUE_CHANGED);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Widget *w;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(i);
+ DCHECK_TYPE(i, EWL_IMAGE_TYPE);
+
+ w = EWL_WIDGET(i);
+
+ IF_FREE(i->path);
+ IF_FREE(i->key);
+
+ /*
+ * Determine the type of image to be loaded.
+ */
+ if (im) {
+ i->type = ewl_image_type_get(im);
+ i->path = strdup(im);
+ if (key) i->key = strdup(key);
+ }
+ else
+ i->type = EWL_IMAGE_TYPE_NORMAL;
+
+ /*
+ * Load the new image if widget has been realized
+ */
+ if (REALIZED(w)) {
+ ewl_widget_obscure(w);
+ ewl_widget_reveal(w);
+ }
+
+ ewl_callback_call(w, EWL_CALLBACK_VALUE_CHANGED);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -286,32 +286,32 @@ ewl_image_file_set(Ewl_Image *i, const char *im, const char *key)
void
ewl_image_constrain_set(Ewl_Image *i, unsigned int size)
{
- int osize;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(i);
- DCHECK_TYPE(i, EWL_IMAGE_TYPE);
-
- osize = i->cs;
- i->cs = size;
- if (size) {
- ewl_object_preferred_inner_w_set(EWL_OBJECT(i), size);
- ewl_object_preferred_inner_h_set(EWL_OBJECT(i), size);
- }
- else if (i->sw != 1.0 || i->sh != 1.0) {
- ewl_image_scale_set(i, i->sw, i->sh);
- }
- else if (i->aw != i->ow || i->ah != i->oh) {
- ewl_image_size_set(i, i->aw, i->ah);
- }
- else {
- if (ewl_object_preferred_inner_w_get(EWL_OBJECT(i)) == osize)
- ewl_object_preferred_inner_w_set(EWL_OBJECT(i), i->ow);
- if (ewl_object_preferred_inner_h_get(EWL_OBJECT(i)) == osize)
- ewl_object_preferred_inner_h_set(EWL_OBJECT(i), i->oh);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int osize;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(i);
+ DCHECK_TYPE(i, EWL_IMAGE_TYPE);
+
+ osize = i->cs;
+ i->cs = size;
+ if (size) {
+ ewl_object_preferred_inner_w_set(EWL_OBJECT(i), size);
+ ewl_object_preferred_inner_h_set(EWL_OBJECT(i), size);
+ }
+ else if (i->sw != 1.0 || i->sh != 1.0) {
+ ewl_image_scale_set(i, i->sw, i->sh);
+ }
+ else if (i->aw != i->ow || i->ah != i->oh) {
+ ewl_image_size_set(i, i->aw, i->ah);
+ }
+ else {
+ if (ewl_object_preferred_inner_w_get(EWL_OBJECT(i)) == osize)
+ ewl_object_preferred_inner_w_set(EWL_OBJECT(i), i->ow);
+ if (ewl_object_preferred_inner_h_get(EWL_OBJECT(i)) == osize)
+ ewl_object_preferred_inner_h_set(EWL_OBJECT(i), i->oh);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -322,11 +322,11 @@ ewl_image_constrain_set(Ewl_Image *i, unsigned int size)
unsigned int
ewl_image_constrain_get(Ewl_Image *i)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(i, 0);
- DCHECK_TYPE_RET(i, EWL_IMAGE_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(i, 0);
+ DCHECK_TYPE_RET(i, EWL_IMAGE_TYPE, 0);
- DRETURN_INT(i->cs, DLEVEL_STABLE);
+ DRETURN_INT(i->cs, DLEVEL_STABLE);
}
/**
@@ -340,14 +340,14 @@ ewl_image_constrain_get(Ewl_Image *i)
void
ewl_image_proportional_set(Ewl_Image *i, char p)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(i);
- DCHECK_TYPE(i, EWL_IMAGE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(i);
+ DCHECK_TYPE(i, EWL_IMAGE_TYPE);
- i->proportional = p;
- ewl_widget_configure(EWL_WIDGET(i));
+ i->proportional = p;
+ ewl_widget_configure(EWL_WIDGET(i));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -358,11 +358,11 @@ ewl_image_proportional_set(Ewl_Image *i, char p)
char
ewl_image_proportional_get(Ewl_Image *i)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(i, FALSE);
- DCHECK_TYPE_RET(i, EWL_IMAGE_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(i, FALSE);
+ DCHECK_TYPE_RET(i, EWL_IMAGE_TYPE, FALSE);
- DRETURN_INT(i->proportional, DLEVEL_STABLE);
+ DRETURN_INT(i->proportional, DLEVEL_STABLE);
}
/**
@@ -379,47 +379,47 @@ ewl_image_proportional_get(Ewl_Image *i)
void
ewl_image_scale_set(Ewl_Image *i, double wp, double hp)
{
- int aw, ah;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(i);
- DCHECK_TYPE(i, EWL_IMAGE_TYPE);
-
- i->sw = wp;
- i->sh = hp;
-
- /*
- * Use set bounds if available, otherwise original image size.
- */
- if (i->cs) {
- aw = ah = i->cs;
- }
- else {
- if (i->aw)
- aw = i->aw;
- else
- aw = i->ow;
-
- if (i->ah)
- ah = i->ah;
- else
- ah = i->oh;
- }
-
- /*
- * Check for proportional scaling and adjust to fit.
- */
- if (i->proportional) {
- if (wp < hp)
- hp = wp;
- else
- hp = wp;
- }
-
- ewl_object_preferred_inner_w_set(EWL_OBJECT(i), wp * aw);
- ewl_object_preferred_inner_h_set(EWL_OBJECT(i), hp * ah);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int aw, ah;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(i);
+ DCHECK_TYPE(i, EWL_IMAGE_TYPE);
+
+ i->sw = wp;
+ i->sh = hp;
+
+ /*
+ * Use set bounds if available, otherwise original image size.
+ */
+ if (i->cs) {
+ aw = ah = i->cs;
+ }
+ else {
+ if (i->aw)
+ aw = i->aw;
+ else
+ aw = i->ow;
+
+ if (i->ah)
+ ah = i->ah;
+ else
+ ah = i->oh;
+ }
+
+ /*
+ * Check for proportional scaling and adjust to fit.
+ */
+ if (i->proportional) {
+ if (wp < hp)
+ hp = wp;
+ else
+ hp = wp;
+ }
+
+ ewl_object_preferred_inner_w_set(EWL_OBJECT(i), wp * aw);
+ ewl_object_preferred_inner_h_set(EWL_OBJECT(i), hp * ah);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -433,16 +433,16 @@ ewl_image_scale_set(Ewl_Image *i, double wp, double hp)
void
ewl_image_scale_get(Ewl_Image *i, double *wp, double *hp)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(i);
- DCHECK_TYPE(i, EWL_IMAGE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(i);
+ DCHECK_TYPE(i, EWL_IMAGE_TYPE);
- if (wp)
- *wp = i->sw;
- if (hp)
- *hp = i->sh;
+ if (wp)
+ *wp = i->sw;
+ if (hp)
+ *hp = i->sh;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -460,15 +460,15 @@ void
ewl_image_size_set(Ewl_Image *i, int w, int h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(i);
- DCHECK_TYPE(i, EWL_IMAGE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(i);
+ DCHECK_TYPE(i, EWL_IMAGE_TYPE);
- i->aw = w;
- i->ah = h;
- ewl_object_preferred_inner_size_set(EWL_OBJECT(i), w, h);
+ i->aw = w;
+ i->ah = h;
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(i), w, h);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -486,16 +486,16 @@ void
ewl_image_size_get(Ewl_Image *i, int *w, int *h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(i);
- DCHECK_TYPE(i, EWL_IMAGE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(i);
+ DCHECK_TYPE(i, EWL_IMAGE_TYPE);
- if (w)
- *w = i->aw;
- if (h)
- *h = i->ah;
+ if (w)
+ *w = i->aw;
+ if (h)
+ *h = i->ah;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -513,17 +513,17 @@ ewl_image_size_get(Ewl_Image *i, int *w, int *h)
void
ewl_image_tile_set(Ewl_Image *i, int x, int y, int w, int h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(i);
- DCHECK_TYPE(i, EWL_IMAGE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(i);
+ DCHECK_TYPE(i, EWL_IMAGE_TYPE);
- i->tile.set = 1;
- i->tile.x = x;
- i->tile.y = y;
- i->tile.w = w;
- i->tile.h = h;
+ i->tile.set = 1;
+ i->tile.x = x;
+ i->tile.y = y;
+ i->tile.w = w;
+ i->tile.h = h;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -535,59 +535,59 @@ ewl_image_tile_set(Ewl_Image *i, int x, int y, int w, int h)
void
ewl_image_flip(Ewl_Image *img, Ewl_Orientation orient)
{
- int ix, iy, ox, oy, mx, my, i, j, w, h;
- int *ia, *ib, *oa, *ob, s;
- unsigned int *in;
- unsigned int tmp;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(img);
- DCHECK_TYPE(img, EWL_IMAGE_TYPE);
-
- evas_object_image_size_get(img->image, &w, &h);
- in = evas_object_image_data_get(img->image, TRUE);
-
- if (orient == EWL_ORIENTATION_VERTICAL)
- {
- mx = w;
- my = h / 2;
- ia = &iy;
- ib = &ix;
- oa = &oy;
- ob = &ox;
- s = h;
- }
- else
- {
- mx = w / 2;
- my = h;
- ia = &ix;
- ib = &iy;
- oa = &ox;
- ob = &oy;
- s = w;
- }
-
- for (iy = 0; iy < my; iy++)
- {
- for (ix = 0; ix < mx; ix++)
- {
- *oa = s - 1 - *ia;
- *ob = *ib;
-
- i = iy * w + ix;
- j = oy * w + ox;
-
- tmp = in[j];
- in[j] = in[i];
- in[i] = tmp;
- }
- }
-
- evas_object_image_data_set(img->image, in);
- evas_object_image_data_update_add(img->image, 0, 0, w, h);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int ix, iy, ox, oy, mx, my, i, j, w, h;
+ int *ia, *ib, *oa, *ob, s;
+ unsigned int *in;
+ unsigned int tmp;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(img);
+ DCHECK_TYPE(img, EWL_IMAGE_TYPE);
+
+ evas_object_image_size_get(img->image, &w, &h);
+ in = evas_object_image_data_get(img->image, TRUE);
+
+ if (orient == EWL_ORIENTATION_VERTICAL)
+ {
+ mx = w;
+ my = h / 2;
+ ia = &iy;
+ ib = &ix;
+ oa = &oy;
+ ob = &ox;
+ s = h;
+ }
+ else
+ {
+ mx = w / 2;
+ my = h;
+ ia = &ix;
+ ib = &iy;
+ oa = &ox;
+ ob = &oy;
+ s = w;
+ }
+
+ for (iy = 0; iy < my; iy++)
+ {
+ for (ix = 0; ix < mx; ix++)
+ {
+ *oa = s - 1 - *ia;
+ *ob = *ib;
+
+ i = iy * w + ix;
+ j = oy * w + ox;
+
+ tmp = in[j];
+ in[j] = in[i];
+ in[i] = tmp;
+ }
+ }
+
+ evas_object_image_data_set(img->image, in);
+ evas_object_image_data_update_add(img->image, 0, 0, w, h);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -599,22 +599,22 @@ ewl_image_flip(Ewl_Image *img, Ewl_Orientation orient)
void
ewl_image_rotate(Ewl_Image *i, Ewl_Rotate rotate)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(i);
- DCHECK_TYPE(i, EWL_IMAGE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(i);
+ DCHECK_TYPE(i, EWL_IMAGE_TYPE);
- if (rotate == EWL_ROTATE_180)
- ewl_image_rotate_180(i);
+ if (rotate == EWL_ROTATE_180)
+ ewl_image_rotate_180(i);
- else if ((rotate == EWL_ROTATE_CW_90) ||
- (rotate == EWL_ROTATE_CC_270))
- ewl_image_rotate_90(i, FALSE);
+ else if ((rotate == EWL_ROTATE_CW_90) ||
+ (rotate == EWL_ROTATE_CC_270))
+ ewl_image_rotate_90(i, FALSE);
- else
- ewl_image_rotate_90(i, TRUE);
+ else
+ ewl_image_rotate_90(i, TRUE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -625,48 +625,48 @@ ewl_image_rotate(Ewl_Image *i, Ewl_Rotate rotate)
Ewl_Widget *
ewl_image_thumbnail_get(Ewl_Image *i)
{
- Ewl_Widget *thumb = NULL;
+ Ewl_Widget *thumb = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(i, NULL);
- DCHECK_TYPE_RET(i, EWL_IMAGE_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(i, NULL);
+ DCHECK_TYPE_RET(i, EWL_IMAGE_TYPE, NULL);
#ifdef BUILD_EPSILON_SUPPORT
- if (i->path && (i->type == EWL_IMAGE_TYPE_NORMAL)) {
- thumb = ewl_image_thumbnail_new();
- if (thumb) {
- ewl_image_thumbnail_request(EWL_IMAGE_THUMBNAIL(thumb),
- (char *)ewl_image_file_path_get(i));
- EWL_IMAGE_THUMBNAIL(thumb)->orig = EWL_WIDGET(i);
- ewl_callback_append(EWL_WIDGET(i),
- EWL_CALLBACK_VALUE_CHANGED,
- ewl_image_thumbnail_cb_value_changed,
- thumb);
- }
- }
+ if (i->path && (i->type == EWL_IMAGE_TYPE_NORMAL)) {
+ thumb = ewl_image_thumbnail_new();
+ if (thumb) {
+ ewl_image_thumbnail_request(EWL_IMAGE_THUMBNAIL(thumb),
+ (char *)ewl_image_file_path_get(i));
+ EWL_IMAGE_THUMBNAIL(thumb)->orig = EWL_WIDGET(i);
+ ewl_callback_append(EWL_WIDGET(i),
+ EWL_CALLBACK_VALUE_CHANGED,
+ ewl_image_thumbnail_cb_value_changed,
+ thumb);
+ }
+ }
#endif
- DRETURN_PTR(thumb, DLEVEL_STABLE);
+ DRETURN_PTR(thumb, DLEVEL_STABLE);
}
#ifdef BUILD_EPSILON_SUPPORT
static void
ewl_image_thumbnail_cb_value_changed(Ewl_Widget *w, void *ev, void *data)
{
- Ewl_Widget *thumb;
- Ewl_Widget *image;
+ Ewl_Widget *thumb;
+ Ewl_Widget *image;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(data);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(data);
- thumb = data;
- image = w;
+ thumb = data;
+ image = w;
- ewl_image_thumbnail_request(EWL_IMAGE_THUMBNAIL(thumb),
- ewl_image_file_path_get(EWL_IMAGE(image)));
+ ewl_image_thumbnail_request(EWL_IMAGE_THUMBNAIL(thumb),
+ ewl_image_file_path_get(EWL_IMAGE(image)));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
#endif
@@ -677,17 +677,17 @@ ewl_image_thumbnail_cb_value_changed(Ewl_Widget *w, void *ev, void *data)
Ewl_Widget *
ewl_image_thumbnail_new(void)
{
- Ewl_Image_Thumbnail *thumb;
+ Ewl_Image_Thumbnail *thumb;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- thumb = NEW(Ewl_Image_Thumbnail, 1);
- if (!ewl_image_thumbnail_init(EWL_IMAGE_THUMBNAIL(thumb))) {
- ewl_widget_destroy(EWL_WIDGET(thumb));
- thumb = NULL;
- }
+ thumb = NEW(Ewl_Image_Thumbnail, 1);
+ if (!ewl_image_thumbnail_init(EWL_IMAGE_THUMBNAIL(thumb))) {
+ ewl_widget_destroy(EWL_WIDGET(thumb));
+ thumb = NULL;
+ }
- DRETURN_PTR(thumb, DLEVEL_STABLE);
+ DRETURN_PTR(thumb, DLEVEL_STABLE);
}
/**
@@ -698,31 +698,31 @@ ewl_image_thumbnail_new(void)
int
ewl_image_thumbnail_init(Ewl_Image_Thumbnail *image)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(image, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(image, FALSE);
- if (!ewl_image_init(EWL_IMAGE(image)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_image_init(EWL_IMAGE(image)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_appearance_set(EWL_WIDGET(image),
- EWL_IMAGE_THUMBNAIL_TYPE);
- ewl_widget_inherit(EWL_WIDGET(image), EWL_IMAGE_THUMBNAIL_TYPE);
+ ewl_widget_appearance_set(EWL_WIDGET(image),
+ EWL_IMAGE_THUMBNAIL_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(image), EWL_IMAGE_THUMBNAIL_TYPE);
- ewl_callback_prepend(EWL_WIDGET(image), EWL_CALLBACK_DESTROY,
- ewl_image_thumbnail_cb_destroy, NULL);
- image->size = EWL_THUMBNAIL_SIZE_NORMAL;
+ ewl_callback_prepend(EWL_WIDGET(image), EWL_CALLBACK_DESTROY,
+ ewl_image_thumbnail_cb_destroy, NULL);
+ image->size = EWL_THUMBNAIL_SIZE_NORMAL;
#ifdef BUILD_EPSILON_SUPPORT
- if (!ewl_image_epsilon_handler) {
- epsilon_request_init();
- ewl_image_epsilon_handler =
- ecore_event_handler_add(EPSILON_EVENT_DONE,
- ewl_image_thumbnail_cb_complete,
- NULL);
- }
+ if (!ewl_image_epsilon_handler) {
+ epsilon_request_init();
+ ewl_image_epsilon_handler =
+ ecore_event_handler_add(EPSILON_EVENT_DONE,
+ ewl_image_thumbnail_cb_complete,
+ NULL);
+ }
#endif
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -734,13 +734,13 @@ ewl_image_thumbnail_init(Ewl_Image_Thumbnail *image)
void
ewl_image_thumbnail_size_set(Ewl_Image_Thumbnail *thumb, Ewl_Thumbnail_Size s)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(thumb);
- DCHECK_TYPE(thumb, EWL_IMAGE_THUMBNAIL_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(thumb);
+ DCHECK_TYPE(thumb, EWL_IMAGE_THUMBNAIL_TYPE);
- thumb->size = s;
+ thumb->size = s;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -751,10 +751,10 @@ ewl_image_thumbnail_size_set(Ewl_Image_Thumbnail *thumb, Ewl_Thumbnail_Size s)
Ewl_Thumbnail_Size
ewl_image_thumbnail_size_get(Ewl_Image_Thumbnail *thumb)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(thumb, EWL_THUMBNAIL_SIZE_NORMAL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(thumb, EWL_THUMBNAIL_SIZE_NORMAL);
- DRETURN_INT(thumb->size, DLEVEL_STABLE);
+ DRETURN_INT(thumb->size, DLEVEL_STABLE);
}
/**
@@ -768,74 +768,74 @@ void
ewl_image_thumbnail_request(Ewl_Image_Thumbnail *thumb, const char *path)
{
#ifdef BUILD_EPSILON_SUPPORT
- Ewl_Thumbnail_Size size;
+ Ewl_Thumbnail_Size size;
#endif
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(thumb);
- DCHECK_TYPE(thumb, EWL_IMAGE_THUMBNAIL_TYPE);
- DCHECK_PARAM_PTR(path);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(thumb);
+ DCHECK_TYPE(thumb, EWL_IMAGE_THUMBNAIL_TYPE);
+ DCHECK_PARAM_PTR(path);
#ifdef BUILD_EPSILON_SUPPORT
- if (thumb->size == EWL_THUMBNAIL_SIZE_NORMAL)
- size = EPSILON_THUMB_NORMAL;
- else size = EPSILON_THUMB_LARGE;
+ if (thumb->size == EWL_THUMBNAIL_SIZE_NORMAL)
+ size = EPSILON_THUMB_NORMAL;
+ else size = EPSILON_THUMB_LARGE;
- thumb->thumb = epsilon_request_add(path, size, thumb);
+ thumb->thumb = epsilon_request_add(path, size, thumb);
#else
- thumb->thumb = NULL;
+ thumb->thumb = NULL;
#endif
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_image_thumbnail_cb_destroy(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Image_Thumbnail *thumb;
+ Ewl_Image_Thumbnail *thumb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_IMAGE_THUMBNAIL_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_IMAGE_THUMBNAIL_TYPE);
- thumb = EWL_IMAGE_THUMBNAIL(w);
- if (thumb->thumb) {
+ thumb = EWL_IMAGE_THUMBNAIL(w);
+ if (thumb->thumb) {
#ifdef BUILD_EPSILON_SUPPORT
- epsilon_request_del(thumb->thumb);
+ epsilon_request_del(thumb->thumb);
#endif
- thumb->thumb = NULL;
- }
+ thumb->thumb = NULL;
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
#ifdef BUILD_EPSILON_SUPPORT
static int
ewl_image_thumbnail_cb_complete(void *data __UNUSED__, int type __UNUSED__,
- void *event)
+ void *event)
{
- Ewl_Image_Thumbnail *thumb;
- Epsilon_Request *ev;
+ Ewl_Image_Thumbnail *thumb;
+ Epsilon_Request *ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(event, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(event, FALSE);
- ev = event;
- thumb = ev->data;
+ ev = event;
+ thumb = ev->data;
- if (thumb)
- {
- if (ev->dest)
- {
- ewl_image_file_path_set(EWL_IMAGE(thumb), ev->dest);
- ewl_callback_call(EWL_WIDGET(thumb),
- EWL_CALLBACK_VALUE_CHANGED);
- }
+ if (thumb)
+ {
+ if (ev->dest)
+ {
+ ewl_image_file_path_set(EWL_IMAGE(thumb), ev->dest);
+ ewl_callback_call(EWL_WIDGET(thumb),
+ EWL_CALLBACK_VALUE_CHANGED);
+ }
- thumb->thumb = NULL;
- }
+ thumb->thumb = NULL;
+ }
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
#endif
@@ -849,97 +849,97 @@ ewl_image_thumbnail_cb_complete(void *data __UNUSED__, int type __UNUSED__,
*/
void
ewl_image_cb_reveal(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Image *i;
- Ewl_Embed *emb;
- int ww, hh;
- double sw, sh;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_IMAGE_TYPE);
-
- i = EWL_IMAGE(w);
- emb = ewl_embed_widget_find(w);
-
- /*
- * Load the image based on the type.
- */
- if (i->type == EWL_IMAGE_TYPE_EDJE) {
- if (!i->image)
- i->image = ewl_embed_object_request(emb, "edje");
- if (!i->image)
- i->image = edje_object_add(emb->canvas);
- if (!i->image)
- DRETURN(DLEVEL_STABLE);
-
- if (i->path)
- edje_object_file_set(i->image, i->path, i->key);
- edje_object_size_min_get(i->image, &i->ow, &i->oh);
- } else {
- if (!i->image)
- i->image = ewl_embed_object_request(emb, EWL_IMAGE_TYPE);
- if (!i->image)
- i->image = evas_object_image_add(emb->canvas);
- if (!i->image)
- DRETURN(DLEVEL_STABLE);
-
- if (i->path)
- evas_object_image_file_set(i->image, i->path, i->key);
- evas_object_image_size_get(i->image, &i->ow, &i->oh);
- }
-
- evas_object_smart_member_add(i->image, w->smart_object);
- if (w->fx_clip_box)
- evas_object_stack_below(i->image, w->fx_clip_box);
-
- if (w->fx_clip_box)
- evas_object_clip_set(i->image, w->fx_clip_box);
-
- evas_object_pass_events_set(i->image, TRUE);
- evas_object_show(i->image);
-
- if (!i->ow)
- i->ow = 1;
- if (!i->oh)
- i->oh = 1;
-
- /*
- * Bound the scales when proportional.
- */
- if (i->proportional) {
- if (i->sw < i->sh)
- sh = i->sw;
- else
- sw = i->sh;
- }
-
- sw = i->sw;
- sh = i->sh;
-
- /*
- * Bound to absolute size.
- */
- if (i->cs) {
- ww = hh = i->cs;
- }
- else {
- if (i->aw)
- ww = i->aw;
- else
- ww = i->ow;
-
- if (i->ah)
- hh = i->ah;
- else
- hh = i->oh;
- }
-
- ewl_object_preferred_inner_w_set(EWL_OBJECT(i), sw * ww);
- ewl_object_preferred_inner_h_set(EWL_OBJECT(i), sh * hh);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Image *i;
+ Ewl_Embed *emb;
+ int ww, hh;
+ double sw, sh;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_IMAGE_TYPE);
+
+ i = EWL_IMAGE(w);
+ emb = ewl_embed_widget_find(w);
+
+ /*
+ * Load the image based on the type.
+ */
+ if (i->type == EWL_IMAGE_TYPE_EDJE) {
+ if (!i->image)
+ i->image = ewl_embed_object_request(emb, "edje");
+ if (!i->image)
+ i->image = edje_object_add(emb->canvas);
+ if (!i->image)
+ DRETURN(DLEVEL_STABLE);
+
+ if (i->path)
+ edje_object_file_set(i->image, i->path, i->key);
+ edje_object_size_min_get(i->image, &i->ow, &i->oh);
+ } else {
+ if (!i->image)
+ i->image = ewl_embed_object_request(emb, EWL_IMAGE_TYPE);
+ if (!i->image)
+ i->image = evas_object_image_add(emb->canvas);
+ if (!i->image)
+ DRETURN(DLEVEL_STABLE);
+
+ if (i->path)
+ evas_object_image_file_set(i->image, i->path, i->key);
+ evas_object_image_size_get(i->image, &i->ow, &i->oh);
+ }
+
+ evas_object_smart_member_add(i->image, w->smart_object);
+ if (w->fx_clip_box)
+ evas_object_stack_below(i->image, w->fx_clip_box);
+
+ if (w->fx_clip_box)
+ evas_object_clip_set(i->image, w->fx_clip_box);
+
+ evas_object_pass_events_set(i->image, TRUE);
+ evas_object_show(i->image);
+
+ if (!i->ow)
+ i->ow = 1;
+ if (!i->oh)
+ i->oh = 1;
+
+ /*
+ * Bound the scales when proportional.
+ */
+ if (i->proportional) {
+ if (i->sw < i->sh)
+ sh = i->sw;
+ else
+ sw = i->sh;
+ }
+
+ sw = i->sw;
+ sh = i->sh;
+
+ /*
+ * Bound to absolute size.
+ */
+ if (i->cs) {
+ ww = hh = i->cs;
+ }
+ else {
+ if (i->aw)
+ ww = i->aw;
+ else
+ ww = i->ow;
+
+ if (i->ah)
+ hh = i->ah;
+ else
+ hh = i->oh;
+ }
+
+ ewl_object_preferred_inner_w_set(EWL_OBJECT(i), sw * ww);
+ ewl_object_preferred_inner_h_set(EWL_OBJECT(i), sh * hh);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -952,25 +952,25 @@ ewl_image_cb_reveal(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_image_cb_obscure(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Image *i;
- Ewl_Embed *emb;
+ Ewl_Image *i;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_IMAGE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_IMAGE_TYPE);
- emb = ewl_embed_widget_find(w);
+ emb = ewl_embed_widget_find(w);
- i = EWL_IMAGE(w);
- if (emb && i->image) {
- evas_object_image_file_set(i->image, NULL, NULL);
- ewl_embed_object_cache(emb, i->image);
- i->image = NULL;
- }
+ i = EWL_IMAGE(w);
+ if (emb && i->image) {
+ evas_object_image_file_set(i->image, NULL, NULL);
+ ewl_embed_object_cache(emb, i->image);
+ i->image = NULL;
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -983,20 +983,20 @@ ewl_image_cb_obscure(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_image_cb_destroy(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Image *i;
+ Ewl_Image *i;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_IMAGE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_IMAGE_TYPE);
- i = EWL_IMAGE(w);
+ i = EWL_IMAGE(w);
- IF_FREE(i->path);
- IF_FREE(i->key);
+ IF_FREE(i->path);
+ IF_FREE(i->key);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1009,19 +1009,19 @@ ewl_image_cb_destroy(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_image_cb_reparent(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Image *i;
+ Ewl_Image *i;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_IMAGE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_IMAGE_TYPE);
- i = EWL_IMAGE(w);
- if (!i->image)
- DRETURN(DLEVEL_STABLE);
+ i = EWL_IMAGE(w);
+ if (!i->image)
+ DRETURN(DLEVEL_STABLE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1034,79 +1034,79 @@ ewl_image_cb_reparent(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_image_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Image *i;
- int ww, hh;
- int dx = 0, dy = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- i = EWL_IMAGE(w);
- if (!i->image)
- DRETURN(DLEVEL_STABLE);
-
- ww = CURRENT_W(w);
- hh = CURRENT_H(w);
- if (i->cs) {
- /*
- * Limit to the constraining size
- */
- if (ww > i->cs)
- ww = i->cs;
- if (hh > i->cs)
- hh = i->cs;
-
- /*
- * Use images original size if smaller than constraint.
- */
- if (ww > i->ow)
- ww = i->ow;
- if (hh > i->oh)
- hh = i->oh;
- }
-
- /*
- * Fit the proportional scale.
- */
- if (i->proportional) {
- double sw, sh;
-
- sw = (double)ww / (double)i->ow;
- sh = (double)hh / (double)i->oh;
- if (sw < sh) {
- hh = sw * i->oh;
- }
- else {
- ww = sh * i->ow;
- }
- }
-
- /*
- * set the tile width and height if not set already
- */
- if (!i->tile.set) {
- i->tile.x = i->tile.y = 0;
- i->tile.w = ww;
- i->tile.h = hh;
- }
-
- dx = (CURRENT_W(w) - ww) / 2;
- dy = (CURRENT_H(w) - hh) / 2;
-
- /*
- * Move the image into place based on type.
- */
- if (i->type != EWL_IMAGE_TYPE_EDJE)
- evas_object_image_fill_set(i->image, i->tile.x, i->tile.y,
- i->tile.w, i->tile.h);
-
- evas_object_move(i->image, CURRENT_X(w) + dx, CURRENT_Y(w) + dy);
- evas_object_resize(i->image, ww, hh);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Image *i;
+ int ww, hh;
+ int dx = 0, dy = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ i = EWL_IMAGE(w);
+ if (!i->image)
+ DRETURN(DLEVEL_STABLE);
+
+ ww = CURRENT_W(w);
+ hh = CURRENT_H(w);
+ if (i->cs) {
+ /*
+ * Limit to the constraining size
+ */
+ if (ww > i->cs)
+ ww = i->cs;
+ if (hh > i->cs)
+ hh = i->cs;
+
+ /*
+ * Use images original size if smaller than constraint.
+ */
+ if (ww > i->ow)
+ ww = i->ow;
+ if (hh > i->oh)
+ hh = i->oh;
+ }
+
+ /*
+ * Fit the proportional scale.
+ */
+ if (i->proportional) {
+ double sw, sh;
+
+ sw = (double)ww / (double)i->ow;
+ sh = (double)hh / (double)i->oh;
+ if (sw < sh) {
+ hh = sw * i->oh;
+ }
+ else {
+ ww = sh * i->ow;
+ }
+ }
+
+ /*
+ * set the tile width and height if not set already
+ */
+ if (!i->tile.set) {
+ i->tile.x = i->tile.y = 0;
+ i->tile.w = ww;
+ i->tile.h = hh;
+ }
+
+ dx = (CURRENT_W(w) - ww) / 2;
+ dy = (CURRENT_H(w) - hh) / 2;
+
+ /*
+ * Move the image into place based on type.
+ */
+ if (i->type != EWL_IMAGE_TYPE_EDJE)
+ evas_object_image_fill_set(i->image, i->tile.x, i->tile.y,
+ i->tile.w, i->tile.h);
+
+ evas_object_move(i->image, CURRENT_X(w) + dx, CURRENT_Y(w) + dy);
+ evas_object_resize(i->image, ww, hh);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/*
@@ -1115,20 +1115,20 @@ ewl_image_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
static Ewl_Image_Type
ewl_image_type_get(const char *i)
{
- int l;
+ int l;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(i, -1);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(i, -1);
- l = strlen(i);
+ l = strlen(i);
- if ((l >= 8 && !(strncasecmp(i + l - 8, ".bits.db", 8)))
- || (l >= 4 && !(strncasecmp(i + l - 4, ".eet", 4)))
- || (l >= 4 && !(strncasecmp(i + l - 4, ".edj", 4)))
- || (l >= 4 && !(strncasecmp(i + l - 4, ".eap", 4))))
- DRETURN_INT(EWL_IMAGE_TYPE_EDJE, DLEVEL_STABLE);
+ if ((l >= 8 && !(strncasecmp(i + l - 8, ".bits.db", 8)))
+ || (l >= 4 && !(strncasecmp(i + l - 4, ".eet", 4)))
+ || (l >= 4 && !(strncasecmp(i + l - 4, ".edj", 4)))
+ || (l >= 4 && !(strncasecmp(i + l - 4, ".eap", 4))))
+ DRETURN_INT(EWL_IMAGE_TYPE_EDJE, DLEVEL_STABLE);
- DRETURN_INT(EWL_IMAGE_TYPE_NORMAL, DLEVEL_STABLE);
+ DRETURN_INT(EWL_IMAGE_TYPE_NORMAL, DLEVEL_STABLE);
}
/**
@@ -1141,27 +1141,27 @@ ewl_image_type_get(const char *i)
*/
void
ewl_image_cb_mouse_down(Ewl_Widget *w, void *ev_data,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Image *i;
- Ewl_Embed *emb;
- Ewl_Event_Mouse_Down *ev;
+ Ewl_Image *i;
+ Ewl_Embed *emb;
+ Ewl_Event_Mouse_Down *ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_IMAGE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_IMAGE_TYPE);
- i = EWL_IMAGE(w);
- emb = ewl_embed_widget_find(w);
- ev = ev_data;
+ i = EWL_IMAGE(w);
+ emb = ewl_embed_widget_find(w);
+ ev = ev_data;
- if (i->type == EWL_IMAGE_TYPE_EDJE)
- evas_event_feed_mouse_down(emb->canvas, ev->button,
- EVAS_BUTTON_NONE,
- (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff),
- NULL);
+ if (i->type == EWL_IMAGE_TYPE_EDJE)
+ evas_event_feed_mouse_down(emb->canvas, ev->button,
+ EVAS_BUTTON_NONE,
+ (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff),
+ NULL);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1174,27 +1174,27 @@ ewl_image_cb_mouse_down(Ewl_Widget *w, void *ev_data,
*/
void
ewl_image_cb_mouse_up(Ewl_Widget *w, void *ev_data,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Image *i;
- Ewl_Embed *emb;
- Ewl_Event_Mouse_Up *ev;
+ Ewl_Image *i;
+ Ewl_Embed *emb;
+ Ewl_Event_Mouse_Up *ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_IMAGE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_IMAGE_TYPE);
- i = EWL_IMAGE(w);
- emb = ewl_embed_widget_find(w);
- ev = ev_data;
+ i = EWL_IMAGE(w);
+ emb = ewl_embed_widget_find(w);
+ ev = ev_data;
- if (i->type == EWL_IMAGE_TYPE_EDJE && emb)
- evas_event_feed_mouse_up(emb->canvas, ev->button,
- EVAS_BUTTON_NONE,
- (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff),
- NULL);
+ if (i->type == EWL_IMAGE_TYPE_EDJE && emb)
+ evas_event_feed_mouse_up(emb->canvas, ev->button,
+ EVAS_BUTTON_NONE,
+ (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff),
+ NULL);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1207,122 +1207,122 @@ ewl_image_cb_mouse_up(Ewl_Widget *w, void *ev_data,
*/
void
ewl_image_cb_mouse_move(Ewl_Widget *w, void *ev_data,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Image *i;
- Ewl_Embed *emb;
- Ewl_Event_Mouse *ev;
+ Ewl_Image *i;
+ Ewl_Embed *emb;
+ Ewl_Event_Mouse *ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_IMAGE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_IMAGE_TYPE);
- i = EWL_IMAGE(w);
- emb = ewl_embed_widget_find(w);
- ev = ev_data;
+ i = EWL_IMAGE(w);
+ emb = ewl_embed_widget_find(w);
+ ev = ev_data;
- if (i->type == EWL_IMAGE_TYPE_EDJE)
- evas_event_feed_mouse_move(emb->canvas, ev->x, ev->y,
- (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff),
- NULL);
+ if (i->type == EWL_IMAGE_TYPE_EDJE)
+ evas_event_feed_mouse_move(emb->canvas, ev->x, ev->y,
+ (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff),
+ NULL);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_image_rotate_90(Ewl_Image *img, int cc)
{
- int i, j, w = 0, h = 0, ix, iy, ox, oy, os, ow, oh;
- int *ia, *ib, *oa, *ob;
- unsigned int *in, *out;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(img);
- DCHECK_TYPE(img, EWL_IMAGE_TYPE);
-
- evas_object_image_size_get(img->image, &w, &h);
- in = evas_object_image_data_get(img->image, FALSE);
-
- out = malloc(w * h * sizeof(unsigned int));
-
- ow = h;
- oh = w;
-
- /* these pointers pull the invarient conditional out of the loop */
- if (cc)
- {
- oa = &oy;
- ob = &ox;
- ia = &iy;
- ib = &ix;
- os = oh;
- }
- else
- {
- oa = &ox;
- ob = &oy;
- ia = &ix;
- ib = &iy;
- os = ow;
- }
-
- for (i = 0; i < (w * h); i++)
- {
- ix = i % w;
- iy = i / w;
-
- /* rotate */
- *oa = os - 1 - *ib;
- *ob = *ia;
-
- /* convert back to array index */
- j = oy * ow + ox;
-
- out[j] = in[i];
- }
-
- img->ow = ow;
- img->oh = oh;
-
- evas_object_image_size_set(img->image, ow, oh);
- evas_object_image_data_set(img->image, out);
- evas_object_image_data_update_add(img->image, 0, 0, ow, oh);
-
- ewl_object_preferred_inner_size_set(EWL_OBJECT(img), ow, oh);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int i, j, w = 0, h = 0, ix, iy, ox, oy, os, ow, oh;
+ int *ia, *ib, *oa, *ob;
+ unsigned int *in, *out;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(img);
+ DCHECK_TYPE(img, EWL_IMAGE_TYPE);
+
+ evas_object_image_size_get(img->image, &w, &h);
+ in = evas_object_image_data_get(img->image, FALSE);
+
+ out = malloc(w * h * sizeof(unsigned int));
+
+ ow = h;
+ oh = w;
+
+ /* these pointers pull the invarient conditional out of the loop */
+ if (cc)
+ {
+ oa = &oy;
+ ob = &ox;
+ ia = &iy;
+ ib = &ix;
+ os = oh;
+ }
+ else
+ {
+ oa = &ox;
+ ob = &oy;
+ ia = &ix;
+ ib = &iy;
+ os = ow;
+ }
+
+ for (i = 0; i < (w * h); i++)
+ {
+ ix = i % w;
+ iy = i / w;
+
+ /* rotate */
+ *oa = os - 1 - *ib;
+ *ob = *ia;
+
+ /* convert back to array index */
+ j = oy * ow + ox;
+
+ out[j] = in[i];
+ }
+
+ img->ow = ow;
+ img->oh = oh;
+
+ evas_object_image_size_set(img->image, ow, oh);
+ evas_object_image_data_set(img->image, out);
+ evas_object_image_data_update_add(img->image, 0, 0, ow, oh);
+
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(img), ow, oh);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_image_rotate_180(Ewl_Image *img)
{
- int ix, iy, ox, oy, i, j, size, w, h;
- unsigned int *in, tmp;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(img);
- DCHECK_TYPE(img, EWL_IMAGE_TYPE);
-
- evas_object_image_size_get(img->image, &w, &h);
- in = evas_object_image_data_get(img->image, TRUE);
-
- size = w * h / 2;
- for (i = 0; i < size; i++)
- {
- ix = i % w;
- iy = i / w;
- ox = w - 1 - ix;
- oy = h - 1 - iy;
- j = oy * w + ox;
-
- tmp = in[j];
- in[j] = in[i];
- in[i] = tmp;
- }
-
- evas_object_image_data_set(img->image, in);
- evas_object_image_data_update_add(img->image, 0, 0, w, h);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int ix, iy, ox, oy, i, j, size, w, h;
+ unsigned int *in, tmp;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(img);
+ DCHECK_TYPE(img, EWL_IMAGE_TYPE);
+
+ evas_object_image_size_get(img->image, &w, &h);
+ in = evas_object_image_data_get(img->image, TRUE);
+
+ size = w * h / 2;
+ for (i = 0; i < size; i++)
+ {
+ ix = i % w;
+ iy = i / w;
+ ox = w - 1 - ix;
+ oy = h - 1 - iy;
+ j = oy * w + ox;
+
+ tmp = in[j];
+ in[j] = in[i];
+ in[i] = tmp;
+ }
+
+ evas_object_image_data_set(img->image, in);
+ evas_object_image_data_update_add(img->image, 0, 0, w, h);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_image.h b/src/lib/ewl_image.h
index 0b3547f..bedd5b1 100644
--- a/src/lib/ewl_image.h
+++ b/src/lib/ewl_image.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_IMAGE_H
#define EWL_IMAGE_H
@@ -48,27 +48,27 @@ typedef struct Ewl_Image Ewl_Image;
*/
struct Ewl_Image
{
- Ewl_Widget widget; /**< Inherit from Ewl_Widget */
- Ewl_Image_Type type; /**< The type of the image */
- void *image; /**< The evas object for the image */
- char *path; /**< The path to the image */
- char *key; /**< The key for the image */
- char proportional; /**< Is the image displayed proportional */
- int ow, /**< Original image width */
- oh; /**< Original image height */
- double sw, /**< Scale width */
- sh; /**< Scale height */
- int cs; /**< Constrain size */
- int aw, /**< Scale width */
- ah; /**< Scale height */
-
- struct {
- int set; /**< Tiling set? */
- int x, /**< Tile x start */
- y, /**< Tile y start */
- w, /**< Tile width */
- h; /**< Tile height */
- } tile; /**< Image tiling information */
+ Ewl_Widget widget; /**< Inherit from Ewl_Widget */
+ Ewl_Image_Type type; /**< The type of the image */
+ void *image; /**< The evas object for the image */
+ char *path; /**< The path to the image */
+ char *key; /**< The key for the image */
+ char proportional; /**< Is the image displayed proportional */
+ int ow, /**< Original image width */
+ oh; /**< Original image height */
+ double sw, /**< Scale width */
+ sh; /**< Scale height */
+ int cs; /**< Constrain size */
+ int aw, /**< Scale width */
+ ah; /**< Scale height */
+
+ struct {
+ int set; /**< Tiling set? */
+ int x, /**< Tile x start */
+ y, /**< Tile y start */
+ w, /**< Tile width */
+ h; /**< Tile height */
+ } tile; /**< Image tiling information */
};
/**
@@ -82,10 +82,10 @@ struct Ewl_Image
*/
struct Ewl_Image_Thumbnail
{
- Ewl_Image image; /**< Inherit from Ewl_Image */
- void *thumb; /**< Outstanding request to thumbnail image */
- Ewl_Thumbnail_Size size; /**< Size of the thumbnails>*/
- Ewl_Widget *orig; /**< Reference to image used to create thumb */
+ Ewl_Image image; /**< Inherit from Ewl_Image */
+ void *thumb; /**< Outstanding request to thumbnail image */
+ Ewl_Thumbnail_Size size; /**< Size of the thumbnails>*/
+ Ewl_Widget *orig; /**< Reference to image used to create thumb */
};
/**
@@ -99,41 +99,41 @@ typedef struct Ewl_Image_Thumbnail Ewl_Image_Thumbnail;
*/
#define EWL_IMAGE_THUMBNAIL(image) ((Ewl_Image_Thumbnail *) image)
-Ewl_Widget *ewl_image_new(void);
-int ewl_image_init(Ewl_Image *i);
-Ewl_View *ewl_image_view_get(void);
-
-void ewl_image_file_set(Ewl_Image *i, const char *im,
- const char *key);
-void ewl_image_file_path_set(Ewl_Image *i, const char *im);
-const char *ewl_image_file_path_get(Ewl_Image *i);
-
-void ewl_image_file_key_set(Ewl_Image *i, const char *key);
-const char *ewl_image_file_key_get(Ewl_Image *i);
-
-void ewl_image_proportional_set(Ewl_Image *i, char p);
-char ewl_image_proportional_get(Ewl_Image *i);
-void ewl_image_scale_set(Ewl_Image *i, double wp, double hp);
-void ewl_image_scale_get(Ewl_Image *i, double *wp, double *hp);
-void ewl_image_size_set(Ewl_Image *i, int w, int h);
-void ewl_image_size_get(Ewl_Image *i, int *w, int *h);
-void ewl_image_tile_set(Ewl_Image *i, int x, int y,
- int w, int h);
-void ewl_image_constrain_set(Ewl_Image *i, unsigned int size);
-unsigned int ewl_image_constrain_get(Ewl_Image *i);
-
-void ewl_image_flip(Ewl_Image *img, Ewl_Orientation orient);
-void ewl_image_rotate(Ewl_Image *i, Ewl_Rotate rotate);
-
-Ewl_Widget *ewl_image_thumbnail_get(Ewl_Image *i);
-
-Ewl_Widget *ewl_image_thumbnail_new(void);
-int ewl_image_thumbnail_init(Ewl_Image_Thumbnail *image);
-void ewl_image_thumbnail_size_set(Ewl_Image_Thumbnail *thumb,
- Ewl_Thumbnail_Size s);
+Ewl_Widget *ewl_image_new(void);
+int ewl_image_init(Ewl_Image *i);
+Ewl_View *ewl_image_view_get(void);
+
+void ewl_image_file_set(Ewl_Image *i, const char *im,
+ const char *key);
+void ewl_image_file_path_set(Ewl_Image *i, const char *im);
+const char *ewl_image_file_path_get(Ewl_Image *i);
+
+void ewl_image_file_key_set(Ewl_Image *i, const char *key);
+const char *ewl_image_file_key_get(Ewl_Image *i);
+
+void ewl_image_proportional_set(Ewl_Image *i, char p);
+char ewl_image_proportional_get(Ewl_Image *i);
+void ewl_image_scale_set(Ewl_Image *i, double wp, double hp);
+void ewl_image_scale_get(Ewl_Image *i, double *wp, double *hp);
+void ewl_image_size_set(Ewl_Image *i, int w, int h);
+void ewl_image_size_get(Ewl_Image *i, int *w, int *h);
+void ewl_image_tile_set(Ewl_Image *i, int x, int y,
+ int w, int h);
+void ewl_image_constrain_set(Ewl_Image *i, unsigned int size);
+unsigned int ewl_image_constrain_get(Ewl_Image *i);
+
+void ewl_image_flip(Ewl_Image *img, Ewl_Orientation orient);
+void ewl_image_rotate(Ewl_Image *i, Ewl_Rotate rotate);
+
+Ewl_Widget *ewl_image_thumbnail_get(Ewl_Image *i);
+
+Ewl_Widget *ewl_image_thumbnail_new(void);
+int ewl_image_thumbnail_init(Ewl_Image_Thumbnail *image);
+void ewl_image_thumbnail_size_set(Ewl_Image_Thumbnail *thumb,
+ Ewl_Thumbnail_Size s);
Ewl_Thumbnail_Size ewl_image_thumbnail_size_get(Ewl_Image_Thumbnail *thumb);
-void ewl_image_thumbnail_request(Ewl_Image_Thumbnail *thumb,
- const char *path);
+void ewl_image_thumbnail_request(Ewl_Image_Thumbnail *thumb,
+ const char *path);
/*
* Internally used callbacks, override at your own risk.
diff --git a/src/lib/ewl_io_manager.c b/src/lib/ewl_io_manager.c
index 94244aa..f130e26 100644
--- a/src/lib/ewl_io_manager.c
+++ b/src/lib/ewl_io_manager.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_io_manager.h"
#include "ewl_icon_theme.h"
@@ -23,71 +23,71 @@ static Ewl_IO_Manager_Plugin *ewl_io_manager_plugin_get(const char *mime);
int
ewl_io_manager_init(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- if (!ewl_io_manager_ext_icon_map)
- {
- /* XXX this is a dumb way to do this.... */
- ewl_io_manager_ext_icon_map = ecore_hash_new(ecore_str_hash,
- ewl_io_manager_strcasecompare);
- /* Images */
- ecore_hash_set(ewl_io_manager_ext_icon_map, ".png",
- EWL_ICON_IMAGE_X_GENERIC);
- ecore_hash_set(ewl_io_manager_ext_icon_map, ".jpg",
- EWL_ICON_IMAGE_X_GENERIC);
- ecore_hash_set(ewl_io_manager_ext_icon_map, ".gif",
- EWL_ICON_IMAGE_X_GENERIC);
-
- /* Videos */
- ecore_hash_set(ewl_io_manager_ext_icon_map, ".wmv",
- EWL_ICON_VIDEO_X_GENERIC);
- ecore_hash_set(ewl_io_manager_ext_icon_map, ".mpg",
- EWL_ICON_VIDEO_X_GENERIC);
- ecore_hash_set(ewl_io_manager_ext_icon_map, ".mpeg",
- EWL_ICON_VIDEO_X_GENERIC);
- ecore_hash_set(ewl_io_manager_ext_icon_map, ".avi",
- EWL_ICON_VIDEO_X_GENERIC);
- ecore_hash_set(ewl_io_manager_ext_icon_map, ".mov",
- EWL_ICON_VIDEO_X_GENERIC);
- ecore_hash_set(ewl_io_manager_ext_icon_map, ".asf",
- EWL_ICON_VIDEO_X_GENERIC);
- ecore_hash_set(ewl_io_manager_ext_icon_map, ".mp4",
- EWL_ICON_VIDEO_X_GENERIC);
- ecore_hash_set(ewl_io_manager_ext_icon_map, ".mkv",
- EWL_ICON_VIDEO_X_GENERIC);
- ecore_hash_set(ewl_io_manager_ext_icon_map, ".ogm",
- EWL_ICON_VIDEO_X_GENERIC);
-
- /* Audio */
- ecore_hash_set(ewl_io_manager_ext_icon_map, ".mp3",
- EWL_ICON_AUDIO_X_GENERIC);
- ecore_hash_set(ewl_io_manager_ext_icon_map, ".mka",
- EWL_ICON_AUDIO_X_GENERIC);
- ecore_hash_set(ewl_io_manager_ext_icon_map, ".ogg",
- EWL_ICON_AUDIO_X_GENERIC);
-
- /* HTML */
- ecore_hash_set(ewl_io_manager_ext_icon_map, ".html",
- EWL_ICON_TEXT_HTML);
- ecore_hash_set(ewl_io_manager_ext_icon_map, ".htm",
- EWL_ICON_TEXT_HTML);
-
- /* Scirpts */
- ecore_hash_set(ewl_io_manager_ext_icon_map, ".pl",
- EWL_ICON_TEXT_X_SCRIPT);
- ecore_hash_set(ewl_io_manager_ext_icon_map, ".sh",
- EWL_ICON_TEXT_X_SCRIPT);
- ecore_hash_set(ewl_io_manager_ext_icon_map, ".ksh",
- EWL_ICON_TEXT_X_SCRIPT);
-
- ewl_io_manager_plugins = ecore_hash_new(ecore_str_hash,
- ecore_str_compare);
- ecore_hash_free_key_cb_set(ewl_io_manager_plugins, free);
- ecore_hash_free_value_cb_set(ewl_io_manager_plugins,
- ewl_io_manager_cb_free_plugin);
- }
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ if (!ewl_io_manager_ext_icon_map)
+ {
+ /* XXX this is a dumb way to do this.... */
+ ewl_io_manager_ext_icon_map = ecore_hash_new(ecore_str_hash,
+ ewl_io_manager_strcasecompare);
+ /* Images */
+ ecore_hash_set(ewl_io_manager_ext_icon_map, ".png",
+ EWL_ICON_IMAGE_X_GENERIC);
+ ecore_hash_set(ewl_io_manager_ext_icon_map, ".jpg",
+ EWL_ICON_IMAGE_X_GENERIC);
+ ecore_hash_set(ewl_io_manager_ext_icon_map, ".gif",
+ EWL_ICON_IMAGE_X_GENERIC);
+
+ /* Videos */
+ ecore_hash_set(ewl_io_manager_ext_icon_map, ".wmv",
+ EWL_ICON_VIDEO_X_GENERIC);
+ ecore_hash_set(ewl_io_manager_ext_icon_map, ".mpg",
+ EWL_ICON_VIDEO_X_GENERIC);
+ ecore_hash_set(ewl_io_manager_ext_icon_map, ".mpeg",
+ EWL_ICON_VIDEO_X_GENERIC);
+ ecore_hash_set(ewl_io_manager_ext_icon_map, ".avi",
+ EWL_ICON_VIDEO_X_GENERIC);
+ ecore_hash_set(ewl_io_manager_ext_icon_map, ".mov",
+ EWL_ICON_VIDEO_X_GENERIC);
+ ecore_hash_set(ewl_io_manager_ext_icon_map, ".asf",
+ EWL_ICON_VIDEO_X_GENERIC);
+ ecore_hash_set(ewl_io_manager_ext_icon_map, ".mp4",
+ EWL_ICON_VIDEO_X_GENERIC);
+ ecore_hash_set(ewl_io_manager_ext_icon_map, ".mkv",
+ EWL_ICON_VIDEO_X_GENERIC);
+ ecore_hash_set(ewl_io_manager_ext_icon_map, ".ogm",
+ EWL_ICON_VIDEO_X_GENERIC);
+
+ /* Audio */
+ ecore_hash_set(ewl_io_manager_ext_icon_map, ".mp3",
+ EWL_ICON_AUDIO_X_GENERIC);
+ ecore_hash_set(ewl_io_manager_ext_icon_map, ".mka",
+ EWL_ICON_AUDIO_X_GENERIC);
+ ecore_hash_set(ewl_io_manager_ext_icon_map, ".ogg",
+ EWL_ICON_AUDIO_X_GENERIC);
+
+ /* HTML */
+ ecore_hash_set(ewl_io_manager_ext_icon_map, ".html",
+ EWL_ICON_TEXT_HTML);
+ ecore_hash_set(ewl_io_manager_ext_icon_map, ".htm",
+ EWL_ICON_TEXT_HTML);
+
+ /* Scirpts */
+ ecore_hash_set(ewl_io_manager_ext_icon_map, ".pl",
+ EWL_ICON_TEXT_X_SCRIPT);
+ ecore_hash_set(ewl_io_manager_ext_icon_map, ".sh",
+ EWL_ICON_TEXT_X_SCRIPT);
+ ecore_hash_set(ewl_io_manager_ext_icon_map, ".ksh",
+ EWL_ICON_TEXT_X_SCRIPT);
+
+ ewl_io_manager_plugins = ecore_hash_new(ecore_str_hash,
+ ecore_str_compare);
+ ecore_hash_free_key_cb_set(ewl_io_manager_plugins, free);
+ ecore_hash_free_value_cb_set(ewl_io_manager_plugins,
+ ewl_io_manager_cb_free_plugin);
+ }
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -97,17 +97,17 @@ ewl_io_manager_init(void)
void
ewl_io_manager_shutdown(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- IF_FREE_HASH(ewl_io_manager_ext_icon_map);
- IF_FREE_HASH(ewl_io_manager_plugins);
- if (ewl_io_manager_path)
- {
- ecore_path_group_del(ewl_io_manager_path);
- ewl_io_manager_path = 0;
- }
+ IF_FREE_HASH(ewl_io_manager_ext_icon_map);
+ IF_FREE_HASH(ewl_io_manager_plugins);
+ if (ewl_io_manager_path)
+ {
+ ecore_path_group_del(ewl_io_manager_path);
+ ewl_io_manager_path = 0;
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -118,15 +118,15 @@ ewl_io_manager_shutdown(void)
const char *
ewl_io_manager_extension_icon_name_get(const char *ext)
{
- char *ret = NULL;
+ char *ret = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(ext, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(ext, NULL);
- ret = ecore_hash_get(ewl_io_manager_ext_icon_map, ext);
- if (ret) DRETURN_PTR(ret, DLEVEL_STABLE);
+ ret = ecore_hash_get(ewl_io_manager_ext_icon_map, ext);
+ if (ret) DRETURN_PTR(ret, DLEVEL_STABLE);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
}
/**
@@ -137,12 +137,12 @@ ewl_io_manager_extension_icon_name_get(const char *ext)
const char *
ewl_io_manager_mime_type_icon_name_get(const char *mime)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(mime, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(mime, NULL);
- DWARNING("NOT WRITTEN");
+ DWARNING("NOT WRITTEN");
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
}
/**
@@ -153,14 +153,14 @@ ewl_io_manager_mime_type_icon_name_get(const char *mime)
const char *
ewl_io_manager_uri_mime_type_get(const char *uri)
{
- const char *mime = NULL;
+ const char *mime = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(uri, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(uri, NULL);
- mime = efreet_mime_type_get(uri);
+ mime = efreet_mime_type_get(uri);
- DRETURN_PTR(mime, DLEVEL_STABLE);
+ DRETURN_PTR(mime, DLEVEL_STABLE);
}
/**
@@ -171,30 +171,30 @@ ewl_io_manager_uri_mime_type_get(const char *uri)
Ewl_Widget *
ewl_io_manager_uri_read(const char *uri)
{
- Ewl_Widget *ret = NULL;
- Ewl_IO_Manager_Plugin *plugin = NULL;
- const char *mime;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(uri, NULL);
-
- mime = ewl_io_manager_uri_mime_type_get(uri);
- if (!mime)
- {
- DWARNING("Unable to determine mime type for %s.", uri);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
-
- plugin = ewl_io_manager_plugin_get(mime);
- if (!plugin)
- {
- DWARNING("No plugin available to read mime type: %s.", mime);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
-
- ret = plugin->uri_read(uri);
-
- DRETURN_PTR(ret, DLEVEL_STABLE);
+ Ewl_Widget *ret = NULL;
+ Ewl_IO_Manager_Plugin *plugin = NULL;
+ const char *mime;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(uri, NULL);
+
+ mime = ewl_io_manager_uri_mime_type_get(uri);
+ if (!mime)
+ {
+ DWARNING("Unable to determine mime type for %s.", uri);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
+
+ plugin = ewl_io_manager_plugin_get(mime);
+ if (!plugin)
+ {
+ DWARNING("No plugin available to read mime type: %s.", mime);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
+
+ ret = plugin->uri_read(uri);
+
+ DRETURN_PTR(ret, DLEVEL_STABLE);
}
/**
@@ -206,23 +206,23 @@ ewl_io_manager_uri_read(const char *uri)
Ewl_Widget *
ewl_io_manager_string_read(const char *string, const char *mime)
{
- Ewl_IO_Manager_Plugin *plugin = NULL;
- Ewl_Widget *ret = NULL;
+ Ewl_IO_Manager_Plugin *plugin = NULL;
+ Ewl_Widget *ret = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(string, NULL);
- DCHECK_PARAM_PTR_RET(mime, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(string, NULL);
+ DCHECK_PARAM_PTR_RET(mime, NULL);
- plugin = ewl_io_manager_plugin_get(mime);
- if (!plugin)
- {
- DWARNING("No plugin available to read mime type: %s.", mime);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ plugin = ewl_io_manager_plugin_get(mime);
+ if (!plugin)
+ {
+ DWARNING("No plugin available to read mime type: %s.", mime);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- ret = plugin->string_read(string);
+ ret = plugin->string_read(string);
- DRETURN_PTR(ret, DLEVEL_STABLE);
+ DRETURN_PTR(ret, DLEVEL_STABLE);
}
/**
@@ -234,27 +234,27 @@ ewl_io_manager_string_read(const char *string, const char *mime)
*/
int
ewl_io_manager_uri_write(Ewl_Widget *data, const char *uri,
- const char *mime)
+ const char *mime)
{
- Ewl_IO_Manager_Plugin *plugin = NULL;
- int ret;
+ Ewl_IO_Manager_Plugin *plugin = NULL;
+ int ret;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, FALSE);
- DCHECK_PARAM_PTR_RET(uri, FALSE);
- DCHECK_PARAM_PTR_RET(mime, FALSE);
- DCHECK_TYPE_RET(data, EWL_WIDGET_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, FALSE);
+ DCHECK_PARAM_PTR_RET(uri, FALSE);
+ DCHECK_PARAM_PTR_RET(mime, FALSE);
+ DCHECK_TYPE_RET(data, EWL_WIDGET_TYPE, FALSE);
- plugin = ewl_io_manager_plugin_get(mime);
- if (!plugin)
- {
- DWARNING("No plugin available to write mime type: %s.", mime);
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
+ plugin = ewl_io_manager_plugin_get(mime);
+ if (!plugin)
+ {
+ DWARNING("No plugin available to write mime type: %s.", mime);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
- ret = plugin->uri_write(data, uri);
+ ret = plugin->uri_write(data, uri);
- DRETURN_INT(ret, DLEVEL_STABLE);
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
/**
@@ -266,143 +266,143 @@ ewl_io_manager_uri_write(Ewl_Widget *data, const char *uri,
*/
int
ewl_io_manager_string_write(Ewl_Widget *data, char **string,
- const char *mime)
+ const char *mime)
{
- Ewl_IO_Manager_Plugin *plugin = NULL;
- int ret = 0;
+ Ewl_IO_Manager_Plugin *plugin = NULL;
+ int ret = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, FALSE);
- DCHECK_PARAM_PTR_RET(mime, FALSE);
- DCHECK_TYPE_RET(data, EWL_WIDGET_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, FALSE);
+ DCHECK_PARAM_PTR_RET(mime, FALSE);
+ DCHECK_TYPE_RET(data, EWL_WIDGET_TYPE, FALSE);
- plugin = ewl_io_manager_plugin_get(mime);
- if (!plugin)
- {
- DWARNING("No plugin available to write mime type: %s.", mime);
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
+ plugin = ewl_io_manager_plugin_get(mime);
+ if (!plugin)
+ {
+ DWARNING("No plugin available to write mime type: %s.", mime);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
- ret = plugin->string_write(data, string);
+ ret = plugin->string_write(data, string);
- DRETURN_INT(ret, DLEVEL_STABLE);
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
static Ewl_IO_Manager_Plugin *
ewl_io_manager_plugin_get(const char *mime)
{
- Ewl_IO_Manager_Plugin *plugin = NULL;
- char name[PATH_MAX];
- char *m = NULL, *ptr;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(mime, NULL);
-
- /* see if this was already cached */
- plugin = ecore_hash_get(ewl_io_manager_plugins, mime);
- if (plugin)
- DRETURN_PTR(plugin, DLEVEL_STABLE);
-
- if (!ewl_io_manager_path)
- {
- ewl_io_manager_path = ecore_path_group_new();
- ecore_path_group_add(ewl_io_manager_path,
- PACKAGE_LIB_DIR"/ewl/plugins/");
- }
-
- m = strdup(mime);
- while ((ptr = strchr(m, '/')))
- *ptr = '_';
-
- snprintf(name, sizeof(name), "ewl_io_manager_%s_plugin", m);
- FREE(m);
-
- plugin = NEW(Ewl_IO_Manager_Plugin, 1);
- plugin->plugin = ecore_plugin_load(ewl_io_manager_path, name, NULL);
- if (!plugin->plugin)
- {
- FREE(plugin);
- m = strdup(mime);
- plugin = NULL;
-
- /* check for fallback plugins */
- ptr = strrchr(m, '/');
- if (ptr)
- {
- *ptr = '\0';
- plugin = ewl_io_manager_plugin_get(m);
- }
-
- FREE(m);
- DRETURN_PTR(plugin, DLEVEL_STABLE);
- }
-
- plugin->uri_read =
- ecore_plugin_symbol_get(plugin->plugin,
- "ewl_io_manager_plugin_uri_read");
- plugin->string_read =
- ecore_plugin_symbol_get(plugin->plugin,
- "ewl_io_manager_plugin_string_read");
-
- plugin->uri_write =
- ecore_plugin_symbol_get(plugin->plugin,
- "ewl_io_manager_plugin_uri_write");
- plugin->string_write =
- ecore_plugin_symbol_get(plugin->plugin,
- "ewl_io_manager_plugin_string_write");
-
- if (!plugin->uri_read || !plugin->uri_write
- || !plugin->uri_write || !plugin->string_write)
- {
- if (plugin->plugin)
- ecore_plugin_unload(plugin->plugin);
-
- FREE(plugin);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
-
- ecore_hash_set(ewl_io_manager_plugins, strdup(mime), plugin);
-
- DRETURN_PTR(plugin, DLEVEL_STABLE);
+ Ewl_IO_Manager_Plugin *plugin = NULL;
+ char name[PATH_MAX];
+ char *m = NULL, *ptr;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(mime, NULL);
+
+ /* see if this was already cached */
+ plugin = ecore_hash_get(ewl_io_manager_plugins, mime);
+ if (plugin)
+ DRETURN_PTR(plugin, DLEVEL_STABLE);
+
+ if (!ewl_io_manager_path)
+ {
+ ewl_io_manager_path = ecore_path_group_new();
+ ecore_path_group_add(ewl_io_manager_path,
+ PACKAGE_LIB_DIR"/ewl/plugins/");
+ }
+
+ m = strdup(mime);
+ while ((ptr = strchr(m, '/')))
+ *ptr = '_';
+
+ snprintf(name, sizeof(name), "ewl_io_manager_%s_plugin", m);
+ FREE(m);
+
+ plugin = NEW(Ewl_IO_Manager_Plugin, 1);
+ plugin->plugin = ecore_plugin_load(ewl_io_manager_path, name, NULL);
+ if (!plugin->plugin)
+ {
+ FREE(plugin);
+ m = strdup(mime);
+ plugin = NULL;
+
+ /* check for fallback plugins */
+ ptr = strrchr(m, '/');
+ if (ptr)
+ {
+ *ptr = '\0';
+ plugin = ewl_io_manager_plugin_get(m);
+ }
+
+ FREE(m);
+ DRETURN_PTR(plugin, DLEVEL_STABLE);
+ }
+
+ plugin->uri_read =
+ ecore_plugin_symbol_get(plugin->plugin,
+ "ewl_io_manager_plugin_uri_read");
+ plugin->string_read =
+ ecore_plugin_symbol_get(plugin->plugin,
+ "ewl_io_manager_plugin_string_read");
+
+ plugin->uri_write =
+ ecore_plugin_symbol_get(plugin->plugin,
+ "ewl_io_manager_plugin_uri_write");
+ plugin->string_write =
+ ecore_plugin_symbol_get(plugin->plugin,
+ "ewl_io_manager_plugin_string_write");
+
+ if (!plugin->uri_read || !plugin->uri_write
+ || !plugin->uri_write || !plugin->string_write)
+ {
+ if (plugin->plugin)
+ ecore_plugin_unload(plugin->plugin);
+
+ FREE(plugin);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
+
+ ecore_hash_set(ewl_io_manager_plugins, strdup(mime), plugin);
+
+ DRETURN_PTR(plugin, DLEVEL_STABLE);
}
static int
ewl_io_manager_strcasecompare(const void *key1, const void *key2)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- if (!key1 || !key2)
- {
- DRETURN_INT(ecore_direct_compare(key1, key2), DLEVEL_STABLE);
- }
- else if (key1 == key2)
- {
- DRETURN_INT(0, DLEVEL_STABLE);
- }
-
- DRETURN_INT(strcasecmp((const char *)key1,
- (const char *)key2), DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ if (!key1 || !key2)
+ {
+ DRETURN_INT(ecore_direct_compare(key1, key2), DLEVEL_STABLE);
+ }
+ else if (key1 == key2)
+ {
+ DRETURN_INT(0, DLEVEL_STABLE);
+ }
+
+ DRETURN_INT(strcasecmp((const char *)key1,
+ (const char *)key2), DLEVEL_STABLE);
}
static void
ewl_io_manager_cb_free_plugin(void *data)
{
- Ewl_IO_Manager_Plugin *plugin;
+ Ewl_IO_Manager_Plugin *plugin;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
- plugin = data;
- if (plugin->plugin)
- ecore_plugin_unload(plugin->plugin);
+ plugin = data;
+ if (plugin->plugin)
+ ecore_plugin_unload(plugin->plugin);
- plugin->plugin = NULL;
- plugin->uri_write = NULL;
- plugin->uri_read = NULL;
- plugin->string_read = NULL;
- plugin->string_write = NULL;
- FREE(plugin);
+ plugin->plugin = NULL;
+ plugin->uri_write = NULL;
+ plugin->uri_read = NULL;
+ plugin->string_read = NULL;
+ plugin->string_write = NULL;
+ FREE(plugin);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_io_manager.h b/src/lib/ewl_io_manager.h
index 3d2dfa4..4cce1d6 100644
--- a/src/lib/ewl_io_manager.h
+++ b/src/lib/ewl_io_manager.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_IO_MANAGER_H
#define EWL_IO_MANAGER_H
@@ -19,31 +19,31 @@ typedef struct Ewl_IO_Manager_Plugin Ewl_IO_Manager_Plugin;
*/
struct Ewl_IO_Manager_Plugin
{
- Ecore_Plugin *plugin; /**< The libray handle */
+ Ecore_Plugin *plugin; /**< The libray handle */
- Ewl_Widget *(*uri_read)(const char *uri); /**< The URI read fuction */
- Ewl_Widget *(*string_read)(const char *string); /**< The string read function */
+ Ewl_Widget *(*uri_read)(const char *uri); /**< The URI read fuction */
+ Ewl_Widget *(*string_read)(const char *string); /**< The string read function */
- int (*uri_write)(Ewl_Widget *data, const char *uri); /**< The URI write function */
- int (*string_write)(Ewl_Widget *data, char **string); /**< The string write function */
+ int (*uri_write)(Ewl_Widget *data, const char *uri); /**< The URI write function */
+ int (*string_write)(Ewl_Widget *data, char **string); /**< The string write function */
};
-int ewl_io_manager_init(void);
-void ewl_io_manager_shutdown(void);
+int ewl_io_manager_init(void);
+void ewl_io_manager_shutdown(void);
-const char *ewl_io_manager_extension_icon_name_get(const char *ext);
-const char *ewl_io_manager_mime_type_icon_name_get(const char *mime);
+const char *ewl_io_manager_extension_icon_name_get(const char *ext);
+const char *ewl_io_manager_mime_type_icon_name_get(const char *mime);
-const char *ewl_io_manager_uri_mime_type_get(const char *uri);
+const char *ewl_io_manager_uri_mime_type_get(const char *uri);
-Ewl_Widget *ewl_io_manager_uri_read(const char *uri);
-Ewl_Widget *ewl_io_manager_string_read(const char *string,
- const char *mime);
+Ewl_Widget *ewl_io_manager_uri_read(const char *uri);
+Ewl_Widget *ewl_io_manager_string_read(const char *string,
+ const char *mime);
-int ewl_io_manager_uri_write(Ewl_Widget *data, const
- char *uri, const char *mime);
-int ewl_io_manager_string_write(Ewl_Widget *data,
- char **string, const char *mime);
+int ewl_io_manager_uri_write(Ewl_Widget *data, const
+ char *uri, const char *mime);
+int ewl_io_manager_string_write(Ewl_Widget *data,
+ char **string, const char *mime);
/**
* @}
diff --git a/src/lib/ewl_label.c b/src/lib/ewl_label.c
index b3e3249..9d4fe6d 100644
--- a/src/lib/ewl_label.c
+++ b/src/lib/ewl_label.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_label.h"
#include "ewl_macros.h"
@@ -6,7 +6,7 @@
#include "ewl_debug.h"
static Ewl_Widget *ewl_label_view_cb_widget_fetch(void *data, unsigned int row,
- unsigned int col);
+ unsigned int col);
static Ewl_Widget *ewl_label_view_cb_header_fetch(void *data, unsigned int col);
/**
@@ -16,21 +16,21 @@ static Ewl_Widget *ewl_label_view_cb_header_fetch(void *data, unsigned int col);
Ewl_Widget *
ewl_label_new(void)
{
- Ewl_Label *label;
+ Ewl_Label *label;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- label = NEW(Ewl_Label, 1);
- if (!label) {
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ label = NEW(Ewl_Label, 1);
+ if (!label) {
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- if (!ewl_label_init(label)) {
- ewl_widget_destroy(EWL_WIDGET(label));
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ewl_label_init(label)) {
+ ewl_widget_destroy(EWL_WIDGET(label));
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(EWL_WIDGET(label), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(label), DLEVEL_STABLE);
}
/**
@@ -41,22 +41,22 @@ ewl_label_new(void)
int
ewl_label_init(Ewl_Label *la)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(la, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(la, FALSE);
- w = EWL_WIDGET(la);
- if (!ewl_widget_init(w))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ w = EWL_WIDGET(la);
+ if (!ewl_widget_init(w))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_appearance_set(w, EWL_LABEL_TYPE);
- ewl_widget_inherit(w, EWL_LABEL_TYPE);
- ewl_object_alignment_set(EWL_OBJECT(la), EWL_FLAG_ALIGN_LEFT);
- ewl_object_fill_policy_set(EWL_OBJECT(la), EWL_FLAG_FILL_NONE);
- ewl_widget_focusable_set(w, FALSE);
+ ewl_widget_appearance_set(w, EWL_LABEL_TYPE);
+ ewl_widget_inherit(w, EWL_LABEL_TYPE);
+ ewl_object_alignment_set(EWL_OBJECT(la), EWL_FLAG_ALIGN_LEFT);
+ ewl_object_fill_policy_set(EWL_OBJECT(la), EWL_FLAG_FILL_NONE);
+ ewl_widget_focusable_set(w, FALSE);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -68,13 +68,13 @@ ewl_label_init(Ewl_Label *la)
void
ewl_label_text_set(Ewl_Label *la, const char *text)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(la);
- DCHECK_TYPE(la, EWL_LABEL_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(la);
+ DCHECK_TYPE(la, EWL_LABEL_TYPE);
- ewl_widget_appearance_text_set(EWL_WIDGET(la), (char *)text);
+ ewl_widget_appearance_text_set(EWL_WIDGET(la), (char *)text);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -86,11 +86,11 @@ ewl_label_text_set(Ewl_Label *la, const char *text)
const char *
ewl_label_text_get(Ewl_Label *la)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(la, NULL);
- DCHECK_TYPE_RET(la, EWL_LABEL_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(la, NULL);
+ DCHECK_TYPE_RET(la, EWL_LABEL_TYPE, NULL);
- DRETURN_PTR(ewl_widget_appearance_text_get(EWL_WIDGET(la)), DLEVEL_STABLE);
+ DRETURN_PTR(ewl_widget_appearance_text_get(EWL_WIDGET(la)), DLEVEL_STABLE);
}
/**
@@ -100,40 +100,40 @@ ewl_label_text_get(Ewl_Label *la)
Ewl_View *
ewl_label_view_get(void)
{
- Ewl_View *view;
+ Ewl_View *view;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- view = ewl_view_new();
- ewl_view_widget_fetch_set(view, ewl_label_view_cb_widget_fetch);
- ewl_view_header_fetch_set(view, ewl_label_view_cb_header_fetch);
+ view = ewl_view_new();
+ ewl_view_widget_fetch_set(view, ewl_label_view_cb_widget_fetch);
+ ewl_view_header_fetch_set(view, ewl_label_view_cb_header_fetch);
- DRETURN_PTR(view, DLEVEL_STABLE);
+ DRETURN_PTR(view, DLEVEL_STABLE);
}
static Ewl_Widget *
ewl_label_view_cb_widget_fetch(void *data, unsigned int row __UNUSED__,
- unsigned int col __UNUSED__)
+ unsigned int col __UNUSED__)
{
- Ewl_Widget *label;
+ Ewl_Widget *label;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- label = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(label), data);
+ label = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(label), data);
- DRETURN_PTR(label, DLEVEL_STABLE);
+ DRETURN_PTR(label, DLEVEL_STABLE);
}
static Ewl_Widget *
ewl_label_view_cb_header_fetch(void *data, unsigned int col __UNUSED__)
{
- Ewl_Widget *label;
+ Ewl_Widget *label;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- label = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(label), data);
+ label = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(label), data);
- DRETURN_PTR(label, DLEVEL_STABLE);
+ DRETURN_PTR(label, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_label.h b/src/lib/ewl_label.h
index c692671..f46819f 100644
--- a/src/lib/ewl_label.h
+++ b/src/lib/ewl_label.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_LABEL_H
#define EWL_LABEL_H
@@ -48,17 +48,17 @@ typedef struct Ewl_Label Ewl_Label;
*/
struct Ewl_Label
{
- Ewl_Widget widget; /**< Inherit from Ewl_Widget */
+ Ewl_Widget widget; /**< Inherit from Ewl_Widget */
};
-Ewl_Widget *ewl_label_new(void);
-int ewl_label_init(Ewl_Label *la);
-Ewl_View *ewl_label_view_get(void);
+Ewl_Widget *ewl_label_new(void);
+int ewl_label_init(Ewl_Label *la);
+Ewl_View *ewl_label_view_get(void);
-void ewl_label_text_set(Ewl_Label *la, const char *text);
-const char *ewl_label_text_get(Ewl_Label *la);
+void ewl_label_text_set(Ewl_Label *la, const char *text);
+const char *ewl_label_text_get(Ewl_Label *la);
-Ewl_View *ewl_label_view_get(void);
+Ewl_View *ewl_label_view_get(void);
/**
* @}
diff --git a/src/lib/ewl_list.c b/src/lib/ewl_list.c
index 0048057..1f18a7f 100644
--- a/src/lib/ewl_list.c
+++ b/src/lib/ewl_list.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_list.h"
#include "ewl_macros.h"
@@ -6,8 +6,8 @@
#include "ewl_debug.h"
static Ewl_Widget *ewl_list_widget_at(Ewl_MVC *mvc, void *data,
- unsigned int row,
- unsigned int column);
+ unsigned int row,
+ unsigned int column);
/**
* @return Returns a new Ewl_Widget on success or NULL on failure
@@ -16,21 +16,21 @@ static Ewl_Widget *ewl_list_widget_at(Ewl_MVC *mvc, void *data,
Ewl_Widget *
ewl_list_new(void)
{
- Ewl_Widget *list = NULL;
+ Ewl_Widget *list = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- list = NEW(Ewl_List, 1);
- if (!list)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ list = NEW(Ewl_List, 1);
+ if (!list)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_list_init(EWL_LIST(list)))
- {
- ewl_widget_destroy(list);
- list = NULL;
- }
+ if (!ewl_list_init(EWL_LIST(list)))
+ {
+ ewl_widget_destroy(list);
+ list = NULL;
+ }
- DRETURN_PTR(list, DLEVEL_STABLE);
+ DRETURN_PTR(list, DLEVEL_STABLE);
}
/**
@@ -41,21 +41,21 @@ ewl_list_new(void)
int
ewl_list_init(Ewl_List *list)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(list, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(list, FALSE);
- if (!ewl_mvc_init(EWL_MVC(list)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_mvc_init(EWL_MVC(list)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_appearance_set(EWL_WIDGET(list), EWL_LIST_TYPE);
- ewl_widget_inherit(EWL_WIDGET(list), EWL_LIST_TYPE);
+ ewl_widget_appearance_set(EWL_WIDGET(list), EWL_LIST_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(list), EWL_LIST_TYPE);
- ewl_mvc_selected_change_cb_set(EWL_MVC(list), ewl_list_cb_selected_change);
+ ewl_mvc_selected_change_cb_set(EWL_MVC(list), ewl_list_cb_selected_change);
- ewl_callback_append(EWL_WIDGET(list), EWL_CALLBACK_CONFIGURE,
- ewl_list_cb_configure, NULL);
+ ewl_callback_append(EWL_WIDGET(list), EWL_CALLBACK_CONFIGURE,
+ ewl_list_cb_configure, NULL);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -68,53 +68,53 @@ ewl_list_init(Ewl_List *list)
*/
void
ewl_list_cb_configure(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_List *list;
- const Ewl_Model *model;
- const Ewl_View *view;
- void *mvc_data;
- int i;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_LIST_TYPE);
-
- list = EWL_LIST(w);
-
- model = ewl_mvc_model_get(EWL_MVC(list));
- view = ewl_mvc_view_get(EWL_MVC(list));
- mvc_data = ewl_mvc_data_get(EWL_MVC(list));
-
- /* if either the list isn't dirty or some of the MVC controls have
- * not been set on the list just leave this up to the box to handle */
- if ((!ewl_mvc_dirty_get(EWL_MVC(list)))
- || !model || !view || !mvc_data)
- DRETURN(DLEVEL_STABLE);
-
- /* create all the widgets and pack into the container */
- ewl_container_reset(EWL_CONTAINER(list));
- for (i = 0; i < (int)model->count(mvc_data); i++)
- {
- Ewl_Widget *o, *cell;
-
- cell = ewl_cell_new();
- ewl_cell_state_change_cb_add(EWL_CELL(cell));
- ewl_container_child_append(EWL_CONTAINER(list), cell);
- ewl_callback_append(cell, EWL_CALLBACK_CLICKED,
- ewl_list_cb_item_clicked, list);
- ewl_widget_show(cell);
-
- o = view->fetch(model->fetch(mvc_data, i, 0), i, 0);
- ewl_widget_show(o);
-
- ewl_container_child_append(EWL_CONTAINER(cell), o);
- }
-
- ewl_list_cb_selected_change(EWL_MVC(list));
- ewl_mvc_dirty_set(EWL_MVC(list), FALSE);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_List *list;
+ const Ewl_Model *model;
+ const Ewl_View *view;
+ void *mvc_data;
+ int i;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_LIST_TYPE);
+
+ list = EWL_LIST(w);
+
+ model = ewl_mvc_model_get(EWL_MVC(list));
+ view = ewl_mvc_view_get(EWL_MVC(list));
+ mvc_data = ewl_mvc_data_get(EWL_MVC(list));
+
+ /* if either the list isn't dirty or some of the MVC controls have
+ * not been set on the list just leave this up to the box to handle */
+ if ((!ewl_mvc_dirty_get(EWL_MVC(list)))
+ || !model || !view || !mvc_data)
+ DRETURN(DLEVEL_STABLE);
+
+ /* create all the widgets and pack into the container */
+ ewl_container_reset(EWL_CONTAINER(list));
+ for (i = 0; i < (int)model->count(mvc_data); i++)
+ {
+ Ewl_Widget *o, *cell;
+
+ cell = ewl_cell_new();
+ ewl_cell_state_change_cb_add(EWL_CELL(cell));
+ ewl_container_child_append(EWL_CONTAINER(list), cell);
+ ewl_callback_append(cell, EWL_CALLBACK_CLICKED,
+ ewl_list_cb_item_clicked, list);
+ ewl_widget_show(cell);
+
+ o = view->fetch(model->fetch(mvc_data, i, 0), i, 0);
+ ewl_widget_show(o);
+
+ ewl_container_child_append(EWL_CONTAINER(cell), o);
+ }
+
+ ewl_list_cb_selected_change(EWL_MVC(list));
+ ewl_mvc_dirty_set(EWL_MVC(list), FALSE);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -128,34 +128,34 @@ ewl_list_cb_configure(Ewl_Widget *w, void *ev __UNUSED__,
void
ewl_list_cb_item_clicked(Ewl_Widget *w, void *ev __UNUSED__, void *data)
{
- const Ewl_Model *model;
- void *mvc_data;
- int row;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- DCHECK_TYPE(data, EWL_LIST_TYPE);
-
- if (ewl_mvc_selection_mode_get(EWL_MVC(data)) ==
- EWL_SELECTION_MODE_NONE)
- DRETURN(DLEVEL_STABLE);
-
- model = ewl_mvc_model_get(EWL_MVC(data));
- mvc_data = ewl_mvc_data_get(EWL_MVC(data));
- row = ewl_container_child_index_get(EWL_CONTAINER(data), w);
- if (row < 0) DRETURN(DLEVEL_STABLE);
-
- if ((unsigned int) row > model->count(mvc_data))
- {
- DWARNING("Don't use container function on MVC widget!");
- DRETURN(DLEVEL_STABLE);
- }
-
- ewl_mvc_handle_click(EWL_MVC(data), NULL, mvc_data, row, 0);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ const Ewl_Model *model;
+ void *mvc_data;
+ int row;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DCHECK_TYPE(data, EWL_LIST_TYPE);
+
+ if (ewl_mvc_selection_mode_get(EWL_MVC(data)) ==
+ EWL_SELECTION_MODE_NONE)
+ DRETURN(DLEVEL_STABLE);
+
+ model = ewl_mvc_model_get(EWL_MVC(data));
+ mvc_data = ewl_mvc_data_get(EWL_MVC(data));
+ row = ewl_container_child_index_get(EWL_CONTAINER(data), w);
+ if (row < 0) DRETURN(DLEVEL_STABLE);
+
+ if ((unsigned int) row > model->count(mvc_data))
+ {
+ DWARNING("Don't use container function on MVC widget!");
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ ewl_mvc_handle_click(EWL_MVC(data), NULL, mvc_data, row, 0);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -167,27 +167,27 @@ ewl_list_cb_item_clicked(Ewl_Widget *w, void *ev __UNUSED__, void *data)
void
ewl_list_cb_selected_change(Ewl_MVC *mvc)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(mvc);
- DCHECK_TYPE(mvc, EWL_LIST_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(mvc);
+ DCHECK_TYPE(mvc, EWL_LIST_TYPE);
- ewl_mvc_highlight(mvc, EWL_CONTAINER(mvc), ewl_list_widget_at);
+ ewl_mvc_highlight(mvc, EWL_CONTAINER(mvc), ewl_list_widget_at);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static Ewl_Widget *
ewl_list_widget_at(Ewl_MVC *mvc, void *data __UNUSED__, unsigned int row,
- unsigned int column __UNUSED__)
+ unsigned int column __UNUSED__)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(mvc, NULL);
- DCHECK_TYPE_RET(mvc, EWL_MVC_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(mvc, NULL);
+ DCHECK_TYPE_RET(mvc, EWL_MVC_TYPE, NULL);
- w = ewl_container_child_get(EWL_CONTAINER(mvc), row);
+ w = ewl_container_child_get(EWL_CONTAINER(mvc), row);
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_list.h b/src/lib/ewl_list.h
index f2d9afc..599cdc3 100644
--- a/src/lib/ewl_list.h
+++ b/src/lib/ewl_list.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_LIST_H
#define EWL_LIST_H
@@ -44,11 +44,11 @@ typedef struct Ewl_List Ewl_List;
*/
struct Ewl_List
{
- Ewl_MVC mvc; /**< The mvc parent */
+ Ewl_MVC mvc; /**< The mvc parent */
};
-Ewl_Widget *ewl_list_new(void);
-int ewl_list_init(Ewl_List *list);
+Ewl_Widget *ewl_list_new(void);
+int ewl_list_init(Ewl_List *list);
/*
* Internal stuff.
diff --git a/src/lib/ewl_macros.h b/src/lib/ewl_macros.h
index 07b9bdd..8c800ac 100644
--- a/src/lib/ewl_macros.h
+++ b/src/lib/ewl_macros.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_MACROS_H
#define EWL_MACROS_H
@@ -24,10 +24,10 @@
*/
#define REALLOC(dat, type, num) \
{ \
- if (dat) \
- { \
- dat = realloc(dat, sizeof(type) * num); \
- } \
+ if (dat) \
+ { \
+ dat = realloc(dat, sizeof(type) * num); \
+ } \
}
#undef FREE
@@ -37,7 +37,7 @@
*/
#define FREE(dat) \
{ \
- free(dat); dat = NULL; \
+ free(dat); dat = NULL; \
}
@@ -48,7 +48,7 @@
*/
#define IF_FREE(dat) \
{ \
- if (dat) FREE(dat); \
+ if (dat) FREE(dat); \
}
#undef IF_FREE_LIST
@@ -58,10 +58,10 @@
*/
#define IF_FREE_LIST(list) \
{ \
- if (list) { \
- ecore_list_destroy(list); \
- list = NULL; \
- } \
+ if (list) { \
+ ecore_list_destroy(list); \
+ list = NULL; \
+ } \
}
#undef IF_FREE_HASH
@@ -71,10 +71,10 @@
*/
#define IF_FREE_HASH(hash) \
{ \
- if (hash) { \
- ecore_hash_destroy(hash); \
- hash = NULL; \
- } \
+ if (hash) { \
+ ecore_hash_destroy(hash); \
+ hash = NULL; \
+ } \
}
#undef IF_RELEASE
@@ -84,10 +84,10 @@
*/
#define IF_RELEASE(item) \
{ \
- if (item) { \
- ecore_string_release(item); \
- item = NULL; \
- } \
+ if (item) { \
+ ecore_string_release(item); \
+ item = NULL; \
+ } \
}
#undef ZERO
diff --git a/src/lib/ewl_media.c b/src/lib/ewl_media.c
index d384e56..af42866 100644
--- a/src/lib/ewl_media.c
+++ b/src/lib/ewl_media.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_media.h"
#include "ewl_macros.h"
@@ -13,7 +13,7 @@
static void ewl_media_size_update(Ewl_Media *m);
static void ewl_media_cb_update_timer(void *data, Evas_Object *obj, void
- *event_info);
+ *event_info);
/**
* @return Returns a pointer to a new media on success, NULL on failure.
@@ -22,22 +22,22 @@ static void ewl_media_cb_update_timer(void *data, Evas_Object *obj, void
Ewl_Widget *
ewl_media_new(void)
{
- Ewl_Media *m = NULL;
+ Ewl_Media *m = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
#ifdef BUILD_EMOTION_SUPPORT
- m = NEW(Ewl_Media, 1);
- if (!m)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
-
- if (!ewl_media_init(m)) {
- ewl_widget_destroy(EWL_WIDGET(m));
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ m = NEW(Ewl_Media, 1);
+ if (!m)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+
+ if (!ewl_media_init(m)) {
+ ewl_widget_destroy(EWL_WIDGET(m));
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
#endif
- DRETURN_PTR(EWL_WIDGET(m), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(m), DLEVEL_STABLE);
}
/**
@@ -50,29 +50,29 @@ ewl_media_new(void)
int
ewl_media_init(Ewl_Media *m)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(m, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(m, FALSE);
- w = EWL_WIDGET(m);
+ w = EWL_WIDGET(m);
- if (!ewl_widget_init(w))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_widget_init(w))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_appearance_set(w, EWL_MEDIA_TYPE);
- ewl_widget_inherit(EWL_WIDGET(w), EWL_MEDIA_TYPE);
+ ewl_widget_appearance_set(w, EWL_MEDIA_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(w), EWL_MEDIA_TYPE);
- ewl_callback_append(w, EWL_CALLBACK_REALIZE,
- ewl_media_cb_realize, NULL);
- ewl_callback_append(w, EWL_CALLBACK_REVEAL,
- ewl_media_cb_reveal, NULL);
- ewl_callback_append(w, EWL_CALLBACK_UNREALIZE,
- ewl_media_cb_unrealize, NULL);
- ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
- ewl_media_cb_configure, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_REALIZE,
+ ewl_media_cb_realize, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_REVEAL,
+ ewl_media_cb_reveal, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_UNREALIZE,
+ ewl_media_cb_unrealize, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
+ ewl_media_cb_configure, NULL);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -83,12 +83,12 @@ ewl_media_init(Ewl_Media *m)
unsigned int
ewl_media_is_available(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
#ifdef BUILD_EMOTION_SUPPORT
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
#else
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
#endif
}
@@ -103,37 +103,37 @@ ewl_media_is_available(void)
int
ewl_media_module_set(Ewl_Media *m, Ewl_Media_Module_Type module)
{
- int ret = FALSE;
+ int ret = FALSE;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(m, FALSE);
- DCHECK_TYPE_RET(m, EWL_MEDIA_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(m, FALSE);
+ DCHECK_TYPE_RET(m, EWL_MEDIA_TYPE, FALSE);
- m->module = module;
+ m->module = module;
#ifdef BUILD_EMOTION_SUPPORT
- /*
- * Initialize emotion
- */
- if (m->video)
- {
- switch (module)
- {
- case EWL_MEDIA_MODULE_GSTREAMER:
- ret = emotion_object_init(m->video,
- "gstreamer");
- break;
-
- case EWL_MEDIA_MODULE_XINE:
- default:
- ret = emotion_object_init(m->video,
- "xine");
- break;
- }
- }
+ /*
+ * Initialize emotion
+ */
+ if (m->video)
+ {
+ switch (module)
+ {
+ case EWL_MEDIA_MODULE_GSTREAMER:
+ ret = emotion_object_init(m->video,
+ "gstreamer");
+ break;
+
+ case EWL_MEDIA_MODULE_XINE:
+ default:
+ ret = emotion_object_init(m->video,
+ "xine");
+ break;
+ }
+ }
#endif
- DRETURN_INT(ret, DLEVEL_STABLE);
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
/**
@@ -144,11 +144,11 @@ ewl_media_module_set(Ewl_Media *m, Ewl_Media_Module_Type module)
Ewl_Media_Module_Type
ewl_media_module_get(Ewl_Media *m)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(m, EWL_MEDIA_MODULE_XINE);
- DCHECK_TYPE_RET(m, EWL_MEDIA_TYPE, EWL_MEDIA_MODULE_XINE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(m, EWL_MEDIA_MODULE_XINE);
+ DCHECK_TYPE_RET(m, EWL_MEDIA_TYPE, EWL_MEDIA_MODULE_XINE);
- DRETURN_INT(m->module, DLEVEL_STABLE);
+ DRETURN_INT(m->module, DLEVEL_STABLE);
}
/**
@@ -162,31 +162,31 @@ ewl_media_module_get(Ewl_Media *m)
void
ewl_media_media_set(Ewl_Media *m, const char *media)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(m);
- DCHECK_PARAM_PTR(media);
- DCHECK_TYPE(m, EWL_MEDIA_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(m);
+ DCHECK_PARAM_PTR(media);
+ DCHECK_TYPE(m, EWL_MEDIA_TYPE);
- IF_FREE(m->media);
- m->media = strdup(media);
+ IF_FREE(m->media);
+ m->media = strdup(media);
#ifdef BUILD_EMOTION_SUPPORT
- /*
- * Update the emotion to the new file
- */
- if (m->video)
- emotion_object_file_set(m->video, m->media);
+ /*
+ * Update the emotion to the new file
+ */
+ if (m->video)
+ emotion_object_file_set(m->video, m->media);
#endif
- /*
- * Move this check outside the optional build to avoid warnings, and
- * to keep it generic in the event something other than emotion is
- * added.
- */
- if (m->video)
- ewl_media_size_update(m);
+ /*
+ * Move this check outside the optional build to avoid warnings, and
+ * to keep it generic in the event something other than emotion is
+ * added.
+ */
+ if (m->video)
+ ewl_media_size_update(m);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -197,11 +197,11 @@ ewl_media_media_set(Ewl_Media *m, const char *media)
const char *
ewl_media_media_get(Ewl_Media *m)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(m, NULL);
- DCHECK_TYPE_RET(m, EWL_MEDIA_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(m, NULL);
+ DCHECK_TYPE_RET(m, EWL_MEDIA_TYPE, NULL);
- DRETURN_PTR(m->media, DLEVEL_STABLE);
+ DRETURN_PTR(m->media, DLEVEL_STABLE);
}
/**
@@ -212,18 +212,18 @@ ewl_media_media_get(Ewl_Media *m)
int
ewl_media_length_get(Ewl_Media *m)
{
- int length = 0;
+ int length = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(m, 0);
- DCHECK_TYPE_RET(m, EWL_MEDIA_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(m, 0);
+ DCHECK_TYPE_RET(m, EWL_MEDIA_TYPE, 0);
#ifdef BUILD_EMOTION_SUPPORT
- if (m->video)
- length = emotion_object_play_length_get(m->video);
+ if (m->video)
+ length = emotion_object_play_length_get(m->video);
#endif
- DRETURN_INT(length, DLEVEL_STABLE);
+ DRETURN_INT(length, DLEVEL_STABLE);
}
/**
@@ -236,26 +236,26 @@ ewl_media_length_get(Ewl_Media *m)
void
ewl_media_length_time_get(Ewl_Media *m, int *h, int *min, double *s)
{
- double pos;
- int mh, mm;
- double ms;
+ double pos;
+ int mh, mm;
+ double ms;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(m);
- DCHECK_TYPE(m, EWL_MEDIA_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(m);
+ DCHECK_TYPE(m, EWL_MEDIA_TYPE);
- pos = ewl_media_length_get(m);
+ pos = ewl_media_length_get(m);
- /* stolen from envision by benr */
- mh = (int)pos / (60 * 60);
- mm = ((int)pos / 60) - (mh * 60);
- ms = pos - (mh * 60 * 60) - (mm * 60);
+ /* stolen from envision by benr */
+ mh = (int)pos / (60 * 60);
+ mm = ((int)pos / 60) - (mh * 60);
+ ms = pos - (mh * 60 * 60) - (mm * 60);
- if (h) *h = mh;
- if (min) *min = mm;
- if (s) *s = ms;
+ if (h) *h = mh;
+ if (min) *min = mm;
+ if (s) *s = ms;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -267,17 +267,17 @@ ewl_media_length_time_get(Ewl_Media *m, int *h, int *min, double *s)
void
ewl_media_play_set(Ewl_Media *m, int p)
{
- DENTER_FUNCTION(DLEVEL_STABLE)
- DCHECK_PARAM_PTR(m);
- DCHECK_TYPE(m, EWL_MEDIA_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE)
+ DCHECK_PARAM_PTR(m);
+ DCHECK_TYPE(m, EWL_MEDIA_TYPE);
#ifdef BUILD_EMOTION_SUPPORT
- if (m->video)
- emotion_object_play_set(m->video, p);
+ if (m->video)
+ emotion_object_play_set(m->video, p);
#endif
- DRETURN(DLEVEL_STABLE);
- p = p;
+ DRETURN(DLEVEL_STABLE);
+ p = p;
}
/**
@@ -288,18 +288,18 @@ ewl_media_play_set(Ewl_Media *m, int p)
int
ewl_media_seekable_get(Ewl_Media *m)
{
- int seekable = 0;
+ int seekable = 0;
- DENTER_FUNCTION(DLEVEL_STABLE)
- DCHECK_PARAM_PTR_RET(m, 0);
- DCHECK_TYPE_RET(m, EWL_MEDIA_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE)
+ DCHECK_PARAM_PTR_RET(m, 0);
+ DCHECK_TYPE_RET(m, EWL_MEDIA_TYPE, 0);
#ifdef BUILD_EMOTION_SUPPORT
- if (m->video && !m->block_seek)
- seekable = emotion_object_seekable_get(m->video);
+ if (m->video && !m->block_seek)
+ seekable = emotion_object_seekable_get(m->video);
#endif
- DRETURN_INT(seekable, DLEVEL_STABLE);
+ DRETURN_INT(seekable, DLEVEL_STABLE);
}
/**
@@ -310,18 +310,18 @@ ewl_media_seekable_get(Ewl_Media *m)
double
ewl_media_position_get(Ewl_Media *m)
{
- double p = 0.0;
+ double p = 0.0;
- DENTER_FUNCTION(DLEVEL_STABLE)
- DCHECK_PARAM_PTR_RET(m, 0);
- DCHECK_TYPE_RET(m, EWL_MEDIA_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE)
+ DCHECK_PARAM_PTR_RET(m, 0);
+ DCHECK_TYPE_RET(m, EWL_MEDIA_TYPE, 0);
#ifdef BUILD_EMOTION_SUPPORT
- if (m->video)
- p = emotion_object_position_get(m->video);
+ if (m->video)
+ p = emotion_object_position_get(m->video);
#endif
- DRETURN_FLOAT(p, DLEVEL_STABLE);
+ DRETURN_FLOAT(p, DLEVEL_STABLE);
}
/**
@@ -334,25 +334,25 @@ ewl_media_position_get(Ewl_Media *m)
void
ewl_media_position_time_get(Ewl_Media *m, int *h, int *min, double *s)
{
- double pos;
- int mh, mm;
- double ms;
+ double pos;
+ int mh, mm;
+ double ms;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(m);
- DCHECK_TYPE(m, EWL_MEDIA_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(m);
+ DCHECK_TYPE(m, EWL_MEDIA_TYPE);
- pos = ewl_media_position_get(m);
- /* stolen from envision by benr */
- mh = (int)pos / (60 * 60);
- mm = ((int)pos / 60) - (mh * 60);
- ms = pos - (mh * 60 * 60) - (mm * 60);
+ pos = ewl_media_position_get(m);
+ /* stolen from envision by benr */
+ mh = (int)pos / (60 * 60);
+ mm = ((int)pos / 60) - (mh * 60);
+ ms = pos - (mh * 60 * 60) - (mm * 60);
- if (h) *h = mh;
- if (min) *min = mm;
- if (s) *s = ms;
+ if (h) *h = mh;
+ if (min) *min = mm;
+ if (s) *s = ms;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -364,24 +364,24 @@ ewl_media_position_time_get(Ewl_Media *m, int *h, int *min, double *s)
void
ewl_media_position_set(Ewl_Media *m, double p)
{
- DENTER_FUNCTION(DLEVEL_STABLE)
- DCHECK_PARAM_PTR(m);
- DCHECK_TYPE(m, EWL_MEDIA_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE)
+ DCHECK_PARAM_PTR(m);
+ DCHECK_TYPE(m, EWL_MEDIA_TYPE);
- if (p == m->position)
- DRETURN(DLEVEL_STABLE);
+ if (p == m->position)
+ DRETURN(DLEVEL_STABLE);
- m->position = p;
+ m->position = p;
#ifdef BUILD_EMOTION_SUPPORT
- if (m->video && ewl_media_seekable_get(m)) {
- m->block_seek = 1;
- emotion_object_position_set(m->video, m->position);
- m->block_seek = 0;
- }
+ if (m->video && ewl_media_seekable_get(m)) {
+ m->block_seek = 1;
+ emotion_object_position_set(m->video, m->position);
+ m->block_seek = 0;
+ }
#endif
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -392,11 +392,11 @@ ewl_media_position_set(Ewl_Media *m, double p)
int
ewl_media_audio_mute_get(Ewl_Media *m)
{
- DENTER_FUNCTION(DLEVEL_STABLE)
- DCHECK_PARAM_PTR_RET(m, 0);
- DCHECK_TYPE_RET(m, EWL_MEDIA_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE)
+ DCHECK_PARAM_PTR_RET(m, 0);
+ DCHECK_TYPE_RET(m, EWL_MEDIA_TYPE, 0);
- DRETURN_INT(m->mute, DLEVEL_STABLE);
+ DRETURN_INT(m->mute, DLEVEL_STABLE);
}
/**
@@ -408,21 +408,21 @@ ewl_media_audio_mute_get(Ewl_Media *m)
void
ewl_media_audio_mute_set(Ewl_Media *m, int mute)
{
- DENTER_FUNCTION(DLEVEL_STABLE)
- DCHECK_PARAM_PTR(m);
- DCHECK_TYPE(m, EWL_MEDIA_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE)
+ DCHECK_PARAM_PTR(m);
+ DCHECK_TYPE(m, EWL_MEDIA_TYPE);
- if (m->mute == !!mute)
- DRETURN(DLEVEL_STABLE);
+ if (m->mute == !!mute)
+ DRETURN(DLEVEL_STABLE);
- m->mute = !!mute;
+ m->mute = !!mute;
#ifdef BUILD_EMOTION_SUPPORT
- if (m->video)
- emotion_object_audio_mute_set(m->video, m->mute);
+ if (m->video)
+ emotion_object_audio_mute_set(m->video, m->mute);
#endif
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -433,11 +433,11 @@ ewl_media_audio_mute_set(Ewl_Media *m, int mute)
double
ewl_media_audio_volume_get(Ewl_Media *m)
{
- DENTER_FUNCTION(DLEVEL_STABLE)
- DCHECK_PARAM_PTR_RET(m, 0);
- DCHECK_TYPE_RET(m, EWL_MEDIA_TYPE, 0.0);
+ DENTER_FUNCTION(DLEVEL_STABLE)
+ DCHECK_PARAM_PTR_RET(m, 0);
+ DCHECK_TYPE_RET(m, EWL_MEDIA_TYPE, 0.0);
- DRETURN_FLOAT(m->volume, DLEVEL_STABLE);
+ DRETURN_FLOAT(m->volume, DLEVEL_STABLE);
}
/**
@@ -449,21 +449,21 @@ ewl_media_audio_volume_get(Ewl_Media *m)
void
ewl_media_audio_volume_set(Ewl_Media *m, double v)
{
- DENTER_FUNCTION(DLEVEL_STABLE)
- DCHECK_PARAM_PTR(m);
- DCHECK_TYPE(m, EWL_MEDIA_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE)
+ DCHECK_PARAM_PTR(m);
+ DCHECK_TYPE(m, EWL_MEDIA_TYPE);
- if (m->volume == v)
- DRETURN(DLEVEL_STABLE);
+ if (m->volume == v)
+ DRETURN(DLEVEL_STABLE);
- m->volume = v;
+ m->volume = v;
#ifdef BUILD_EMOTION_SUPPORT
- if (m->video)
- emotion_object_audio_volume_set(m->video, m->volume);
+ if (m->video)
+ emotion_object_audio_volume_set(m->video, m->volume);
#endif
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -476,38 +476,38 @@ ewl_media_audio_volume_set(Ewl_Media *m, double v)
*/
void
ewl_media_cb_realize(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Media *m;
- Ewl_Embed *emb;
+ Ewl_Media *m;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_MEDIA_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_MEDIA_TYPE);
- m = EWL_MEDIA(w);
+ m = EWL_MEDIA(w);
- /*
- * Find the embed so we know which canvas to draw onto.
- */
- emb = ewl_embed_widget_find(w);
+ /*
+ * Find the embed so we know which canvas to draw onto.
+ */
+ emb = ewl_embed_widget_find(w);
#ifdef BUILD_EMOTION_SUPPORT
- /*
- * Create the emotion
- */
- m->video = emotion_object_add(emb->canvas);
- if (ewl_media_module_set(m, m->module) && m->media) {
- emotion_object_file_set(m->video, m->media);
- ewl_media_size_update(m);
- }
+ /*
+ * Create the emotion
+ */
+ m->video = emotion_object_add(emb->canvas);
+ if (ewl_media_module_set(m, m->module) && m->media) {
+ emotion_object_file_set(m->video, m->media);
+ ewl_media_size_update(m);
+ }
#endif
- /*
- * Now set the media and display it.
- */
- evas_object_show(m->video);
+ /*
+ * Now set the media and display it.
+ */
+ evas_object_show(m->video);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -520,25 +520,25 @@ ewl_media_cb_realize(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_media_cb_reveal(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Media *m;
+ Ewl_Media *m;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_MEDIA_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_MEDIA_TYPE);
- m = EWL_MEDIA(w);
+ m = EWL_MEDIA(w);
- if (m->video) {
- evas_object_smart_member_add(m->video, w->smart_object);
- if (w->fx_clip_box) {
- evas_object_clip_set(m->video, w->fx_clip_box);
- evas_object_stack_above(m->video, w->fx_clip_box);
- }
- }
+ if (m->video) {
+ evas_object_smart_member_add(m->video, w->smart_object);
+ if (w->fx_clip_box) {
+ evas_object_clip_set(m->video, w->fx_clip_box);
+ evas_object_stack_above(m->video, w->fx_clip_box);
+ }
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -551,20 +551,20 @@ ewl_media_cb_reveal(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_media_cb_unrealize(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Media *m;
+ Ewl_Media *m;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_MEDIA_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_MEDIA_TYPE);
- m = EWL_MEDIA(w);
+ m = EWL_MEDIA(w);
- evas_object_clip_unset(m->video);
- evas_object_del(m->video);
+ evas_object_clip_unset(m->video);
+ evas_object_del(m->video);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -577,65 +577,65 @@ ewl_media_cb_unrealize(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_media_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Media *m;
+ Ewl_Media *m;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_MEDIA_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_MEDIA_TYPE);
- m = EWL_MEDIA(w);
+ m = EWL_MEDIA(w);
- /*
- * Update the emotion position and size.
- */
- if (m->video) {
- evas_object_move(m->video, CURRENT_X(w), CURRENT_Y(w));
- evas_object_resize(m->video, CURRENT_W(w), CURRENT_H(w));
- evas_object_smart_callback_add(m->video, "frame_decode",
- ewl_media_cb_update_timer, m);
- }
+ /*
+ * Update the emotion position and size.
+ */
+ if (m->video) {
+ evas_object_move(m->video, CURRENT_X(w), CURRENT_Y(w));
+ evas_object_resize(m->video, CURRENT_W(w), CURRENT_H(w));
+ evas_object_smart_callback_add(m->video, "frame_decode",
+ ewl_media_cb_update_timer, m);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_media_size_update(Ewl_Media *m)
{
- int width = 0, height = 0;
+ int width = 0, height = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(m);
- DCHECK_TYPE(m, EWL_MEDIA_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(m);
+ DCHECK_TYPE(m, EWL_MEDIA_TYPE);
#ifdef BUILD_EMOTION_SUPPORT
- emotion_object_size_get(m->video, &width, &height);
+ emotion_object_size_get(m->video, &width, &height);
#endif
- if (width && height)
- ewl_object_preferred_inner_size_set(EWL_OBJECT(m), width, height);
+ if (width && height)
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(m), width, height);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_media_cb_update_timer(void *data,
- Evas_Object *obj __UNUSED__,
- void *event_info __UNUSED__)
+ Evas_Object *obj __UNUSED__,
+ void *event_info __UNUSED__)
{
- Ewl_Media *m;
+ Ewl_Media *m;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_MEDIA_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_MEDIA_TYPE);
- m = data;
+ m = data;
- m->block_seek = 1;
- ewl_callback_call(EWL_WIDGET(m), EWL_CALLBACK_VALUE_CHANGED);
- m->block_seek = 0;
+ m->block_seek = 1;
+ ewl_callback_call(EWL_WIDGET(m), EWL_CALLBACK_VALUE_CHANGED);
+ m->block_seek = 0;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_media.h b/src/lib/ewl_media.h
index ac882bc..645afa4 100644
--- a/src/lib/ewl_media.h
+++ b/src/lib/ewl_media.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_MEDIA_H
#define EWL_MEDIA_H
@@ -48,44 +48,44 @@ typedef struct Ewl_Media Ewl_Media;
*/
struct Ewl_Media
{
- Ewl_Widget widget; /**< Inherit from Ewl_Widget */
- void *video; /**< Emotion does the actual work */
- Ewl_Media_Module_Type module; /**< Path to the module file */
- char *media; /**< Path to the media file */
- int block_seek; /**< Temporarily prevent seeking */
-
- double volume; /**< The volume setting */
- double position; /**< The position setting */
- unsigned char mute:1; /**< The mute value */
+ Ewl_Widget widget; /**< Inherit from Ewl_Widget */
+ void *video; /**< Emotion does the actual work */
+ Ewl_Media_Module_Type module; /**< Path to the module file */
+ char *media; /**< Path to the media file */
+ int block_seek; /**< Temporarily prevent seeking */
+
+ double volume; /**< The volume setting */
+ double position; /**< The position setting */
+ unsigned char mute:1; /**< The mute value */
};
-Ewl_Widget *ewl_media_new(void);
-int ewl_media_init(Ewl_Media *m);
+Ewl_Widget *ewl_media_new(void);
+int ewl_media_init(Ewl_Media *m);
-unsigned int ewl_media_is_available(void);
+unsigned int ewl_media_is_available(void);
-int ewl_media_module_set(Ewl_Media *m,
- Ewl_Media_Module_Type module);
-Ewl_Media_Module_Type ewl_media_module_get(Ewl_Media *m);
+int ewl_media_module_set(Ewl_Media *m,
+ Ewl_Media_Module_Type module);
+Ewl_Media_Module_Type ewl_media_module_get(Ewl_Media *m);
-void ewl_media_media_set(Ewl_Media *m, const char *media);
-const char *ewl_media_media_get(Ewl_Media *m);
+void ewl_media_media_set(Ewl_Media *m, const char *media);
+const char *ewl_media_media_get(Ewl_Media *m);
-int ewl_media_length_get(Ewl_Media *m);
-void ewl_media_length_time_get(Ewl_Media *m, int *h,
- int *min, double *s);
+int ewl_media_length_get(Ewl_Media *m);
+void ewl_media_length_time_get(Ewl_Media *m, int *h,
+ int *min, double *s);
-void ewl_media_play_set(Ewl_Media *m, int p);
-int ewl_media_seekable_get(Ewl_Media *m);
-double ewl_media_position_get(Ewl_Media *m);
-void ewl_media_position_time_get(Ewl_Media *m, int *h,
- int *min, double *s);
-void ewl_media_position_set(Ewl_Media *m, double p);
+void ewl_media_play_set(Ewl_Media *m, int p);
+int ewl_media_seekable_get(Ewl_Media *m);
+double ewl_media_position_get(Ewl_Media *m);
+void ewl_media_position_time_get(Ewl_Media *m, int *h,
+ int *min, double *s);
+void ewl_media_position_set(Ewl_Media *m, double p);
-int ewl_media_audio_mute_get(Ewl_Media *m);
-void ewl_media_audio_mute_set(Ewl_Media *m, int mute);
-double ewl_media_audio_volume_get(Ewl_Media *m);
-void ewl_media_audio_volume_set(Ewl_Media *m, double v);
+int ewl_media_audio_mute_get(Ewl_Media *m);
+void ewl_media_audio_mute_set(Ewl_Media *m, int mute);
+double ewl_media_audio_volume_get(Ewl_Media *m);
+void ewl_media_audio_volume_set(Ewl_Media *m, double v);
/*
* Internally used callbacks, override at your own risk.
diff --git a/src/lib/ewl_menu.c b/src/lib/ewl_menu.c
index dfc80ce..9d8588b 100644
--- a/src/lib/ewl_menu.c
+++ b/src/lib/ewl_menu.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_menu.h"
#include "ewl_context_menu.h"
@@ -13,20 +13,20 @@
Ewl_Widget *
ewl_menu_new(void)
{
- Ewl_Menu *menu;
+ Ewl_Menu *menu;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- menu = NEW(Ewl_Menu, 1);
- if (!menu)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ menu = NEW(Ewl_Menu, 1);
+ if (!menu)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_menu_init(menu)) {
- ewl_widget_destroy(EWL_WIDGET(menu));
- menu = NULL;
- }
+ if (!ewl_menu_init(menu)) {
+ ewl_widget_destroy(EWL_WIDGET(menu));
+ menu = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(menu), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(menu), DLEVEL_STABLE);
}
/**
@@ -37,47 +37,47 @@ ewl_menu_new(void)
int
ewl_menu_init(Ewl_Menu *menu)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(menu, FALSE);
-
- /*
- * Initialize the defaults of the inherited fields.
- */
- if (!ewl_menu_item_init(EWL_MENU_ITEM(menu)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- ewl_widget_appearance_set(EWL_WIDGET(menu), "menu_container");
- ewl_widget_inherit(EWL_WIDGET(menu), EWL_MENU_TYPE);
-
- /*
- * add the callbacks
- */
- ewl_callback_append(EWL_WIDGET(menu), EWL_CALLBACK_MOUSE_MOVE,
- ewl_menu_cb_mouse_move, NULL);
- ewl_callback_append(EWL_WIDGET(menu), EWL_CALLBACK_FOCUS_IN,
- ewl_menu_cb_expand, NULL);
- ewl_callback_append(EWL_WIDGET(menu), EWL_CALLBACK_CONFIGURE,
- ewl_menu_cb_configure, NULL);
- ewl_callback_prepend(EWL_WIDGET(menu), EWL_CALLBACK_DESTROY,
- ewl_menu_cb_destroy, NULL);
-
- /*
- * Create the popup menu portion of the widget.
- */
- menu->popup = ewl_context_menu_new();
- ewl_popup_follow_set(EWL_POPUP(menu->popup), EWL_WIDGET(menu));
- ewl_popup_type_set(EWL_POPUP(menu->popup),
- EWL_POPUP_TYPE_MENU_VERTICAL);
- ewl_widget_internal_set(menu->popup, TRUE);
- ewl_widget_appearance_set(EWL_WIDGET(menu->popup), EWL_MENU_TYPE);
-
- /* redirect the menu container to the popup menu */
- ewl_container_redirect_set(EWL_CONTAINER(menu),
- EWL_CONTAINER(menu->popup));
- ewl_callback_prepend(menu->popup, EWL_CALLBACK_DESTROY,
- ewl_menu_cb_popup_destroy, menu);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(menu, FALSE);
+
+ /*
+ * Initialize the defaults of the inherited fields.
+ */
+ if (!ewl_menu_item_init(EWL_MENU_ITEM(menu)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ ewl_widget_appearance_set(EWL_WIDGET(menu), "menu_container");
+ ewl_widget_inherit(EWL_WIDGET(menu), EWL_MENU_TYPE);
+
+ /*
+ * add the callbacks
+ */
+ ewl_callback_append(EWL_WIDGET(menu), EWL_CALLBACK_MOUSE_MOVE,
+ ewl_menu_cb_mouse_move, NULL);
+ ewl_callback_append(EWL_WIDGET(menu), EWL_CALLBACK_FOCUS_IN,
+ ewl_menu_cb_expand, NULL);
+ ewl_callback_append(EWL_WIDGET(menu), EWL_CALLBACK_CONFIGURE,
+ ewl_menu_cb_configure, NULL);
+ ewl_callback_prepend(EWL_WIDGET(menu), EWL_CALLBACK_DESTROY,
+ ewl_menu_cb_destroy, NULL);
+
+ /*
+ * Create the popup menu portion of the widget.
+ */
+ menu->popup = ewl_context_menu_new();
+ ewl_popup_follow_set(EWL_POPUP(menu->popup), EWL_WIDGET(menu));
+ ewl_popup_type_set(EWL_POPUP(menu->popup),
+ EWL_POPUP_TYPE_MENU_VERTICAL);
+ ewl_widget_internal_set(menu->popup, TRUE);
+ ewl_widget_appearance_set(EWL_WIDGET(menu->popup), EWL_MENU_TYPE);
+
+ /* redirect the menu container to the popup menu */
+ ewl_container_redirect_set(EWL_CONTAINER(menu),
+ EWL_CONTAINER(menu->popup));
+ ewl_callback_prepend(menu->popup, EWL_CALLBACK_DESTROY,
+ ewl_menu_cb_popup_destroy, menu);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -89,29 +89,29 @@ ewl_menu_init(Ewl_Menu *menu)
void
ewl_menu_from_info(Ewl_Menu *menu, Ewl_Menu_Info *info)
{
- int i;
+ int i;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(menu);
- DCHECK_PARAM_PTR(info);
- DCHECK_TYPE(menu, EWL_MENU_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(menu);
+ DCHECK_PARAM_PTR(info);
+ DCHECK_TYPE(menu, EWL_MENU_TYPE);
- for (i = 0; info[i].name != NULL; i++)
- {
- Ewl_Widget *item;
+ for (i = 0; info[i].name != NULL; i++)
+ {
+ Ewl_Widget *item;
- item = ewl_menu_item_new();
- ewl_button_label_set(EWL_BUTTON(item), info[i].name);
- ewl_button_image_set(EWL_BUTTON(item), info[i].img, NULL);
- ewl_container_child_append(EWL_CONTAINER(menu), item);
+ item = ewl_menu_item_new();
+ ewl_button_label_set(EWL_BUTTON(item), info[i].name);
+ ewl_button_image_set(EWL_BUTTON(item), info[i].img, NULL);
+ ewl_container_child_append(EWL_CONTAINER(menu), item);
- if (info[i].cb)
- ewl_callback_append(item, EWL_CALLBACK_CLICKED,
- info[i].cb, NULL);
- ewl_widget_show(item);
- }
+ if (info[i].cb)
+ ewl_callback_append(item, EWL_CALLBACK_CLICKED,
+ info[i].cb, NULL);
+ ewl_widget_show(item);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -122,13 +122,13 @@ ewl_menu_from_info(Ewl_Menu *menu, Ewl_Menu_Info *info)
void
ewl_menu_collapse(Ewl_Menu *menu)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(menu);
- DCHECK_TYPE(menu, EWL_MENU_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(menu);
+ DCHECK_TYPE(menu, EWL_MENU_TYPE);
- ewl_widget_hide(menu->popup);
+ ewl_widget_hide(menu->popup);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -141,28 +141,28 @@ ewl_menu_collapse(Ewl_Menu *menu)
*/
void
ewl_menu_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Menu *menu;
- Ewl_Box *parent;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_MENU_TYPE);
-
- menu = EWL_MENU(w);
- parent = EWL_BOX(menu->menubar_parent);
-
- if ((parent && (ewl_box_orientation_get(parent)
- == EWL_ORIENTATION_VERTICAL))
- || EWL_MENU_ITEM(menu)->inmenu)
- ewl_popup_type_set(EWL_POPUP(menu->popup),
- EWL_POPUP_TYPE_MENU_HORIZONTAL);
- else
- ewl_popup_type_set(EWL_POPUP(menu->popup),
- EWL_POPUP_TYPE_MENU_VERTICAL);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Menu *menu;
+ Ewl_Box *parent;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_MENU_TYPE);
+
+ menu = EWL_MENU(w);
+ parent = EWL_BOX(menu->menubar_parent);
+
+ if ((parent && (ewl_box_orientation_get(parent)
+ == EWL_ORIENTATION_VERTICAL))
+ || EWL_MENU_ITEM(menu)->inmenu)
+ ewl_popup_type_set(EWL_POPUP(menu->popup),
+ EWL_POPUP_TYPE_MENU_HORIZONTAL);
+ else
+ ewl_popup_type_set(EWL_POPUP(menu->popup),
+ EWL_POPUP_TYPE_MENU_VERTICAL);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -175,38 +175,38 @@ ewl_menu_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_menu_cb_mouse_move(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Menu *menu;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_MENU_TYPE);
-
- menu = EWL_MENU(w);
- if (menu->menubar_parent) {
- Ewl_Menu *sub, *hide_menu = NULL;
- Ewl_Container *bar;
-
- bar = EWL_CONTAINER(menu->menubar_parent);
- ewl_container_child_iterate_begin(bar);
- while ((sub = EWL_MENU(ewl_container_child_next(bar)))) {
- if ((sub != EWL_MENU(w))
- && EWL_MENU_IS(sub)
- && (sub->popup)
- && VISIBLE(sub->popup)) {
- hide_menu = sub;
- break;
- }
- }
-
- if (hide_menu) {
- ewl_widget_hide(hide_menu->popup);
- ewl_callback_call(w, EWL_CALLBACK_FOCUS_IN);
- }
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Menu *menu;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_MENU_TYPE);
+
+ menu = EWL_MENU(w);
+ if (menu->menubar_parent) {
+ Ewl_Menu *sub, *hide_menu = NULL;
+ Ewl_Container *bar;
+
+ bar = EWL_CONTAINER(menu->menubar_parent);
+ ewl_container_child_iterate_begin(bar);
+ while ((sub = EWL_MENU(ewl_container_child_next(bar)))) {
+ if ((sub != EWL_MENU(w))
+ && EWL_MENU_IS(sub)
+ && (sub->popup)
+ && VISIBLE(sub->popup)) {
+ hide_menu = sub;
+ break;
+ }
+ }
+
+ if (hide_menu) {
+ ewl_widget_hide(hide_menu->popup);
+ ewl_callback_call(w, EWL_CALLBACK_FOCUS_IN);
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -219,31 +219,31 @@ ewl_menu_cb_mouse_move(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_menu_cb_expand(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Menu *menu;
- Ewl_Menu_Item *item;
+ Ewl_Menu *menu;
+ Ewl_Menu_Item *item;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_MENU_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_MENU_TYPE);
- menu = EWL_MENU(w);
- item = EWL_MENU_ITEM(w);
+ menu = EWL_MENU(w);
+ item = EWL_MENU_ITEM(w);
- ewl_widget_show(menu->popup);
- ewl_window_raise(EWL_WINDOW(menu->popup));
+ ewl_widget_show(menu->popup);
+ ewl_window_raise(EWL_WINDOW(menu->popup));
- if (item->inmenu) {
- Ewl_Context_Menu *cm;
+ if (item->inmenu) {
+ Ewl_Context_Menu *cm;
- cm = EWL_CONTEXT_MENU(item->inmenu);
- cm->open_menu = EWL_WIDGET(menu);
- }
- else
- ewl_widget_focus_send(menu->popup);
+ cm = EWL_CONTEXT_MENU(item->inmenu);
+ cm->open_menu = EWL_WIDGET(menu);
+ }
+ else
+ ewl_widget_focus_send(menu->popup);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -256,22 +256,22 @@ ewl_menu_cb_expand(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_menu_cb_popup_destroy(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Menu *m;
+ Ewl_Menu *m;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_MENU_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_MENU_TYPE);
- /* We need to set the popup to NULL here in case the popup gets
- * freed before the menu does. This makes sure we don't segv in the
- * ewl_menu_cb_destroy function when we try to delete the callback
- * on the deleted popup widget from our dangling reference */
- m = data;
- if (m->popup) m->popup = NULL;
+ /* We need to set the popup to NULL here in case the popup gets
+ * freed before the menu does. This makes sure we don't segv in the
+ * ewl_menu_cb_destroy function when we try to delete the callback
+ * on the deleted popup widget from our dangling reference */
+ m = data;
+ if (m->popup) m->popup = NULL;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -285,43 +285,43 @@ ewl_menu_cb_popup_destroy(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
void
ewl_menu_cb_destroy(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
{
- Ewl_Menu *menu;
+ Ewl_Menu *menu;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_MENU_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_MENU_TYPE);
- menu = EWL_MENU(w);
- if (menu->popup) {
- ewl_callback_del(menu->popup, EWL_CALLBACK_DESTROY,
- ewl_menu_cb_popup_destroy);
- ewl_widget_destroy(menu->popup);
- menu->popup = NULL;
- }
+ menu = EWL_MENU(w);
+ if (menu->popup) {
+ ewl_callback_del(menu->popup, EWL_CALLBACK_DESTROY,
+ ewl_menu_cb_popup_destroy);
+ ewl_widget_destroy(menu->popup);
+ menu->popup = NULL;
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
int
ewl_menu_mouse_feed(Ewl_Menu *menu, int x, int y)
{
- int emb_x = 0, emb_y = 0, emb_w = 0, emb_h = 0;
+ int emb_x = 0, emb_y = 0, emb_w = 0, emb_h = 0;
- DCHECK_PARAM_PTR_RET(menu, FALSE);
- DCHECK_TYPE_RET(menu, EWL_MENU_TYPE, FALSE);
+ DCHECK_PARAM_PTR_RET(menu, FALSE);
+ DCHECK_TYPE_RET(menu, EWL_MENU_TYPE, FALSE);
- ewl_embed_window_position_get(EWL_EMBED(menu->popup), &emb_x, &emb_y);
- ewl_object_current_size_get(EWL_OBJECT(menu->popup), &emb_w, &emb_h);
+ ewl_embed_window_position_get(EWL_EMBED(menu->popup), &emb_x, &emb_y);
+ ewl_object_current_size_get(EWL_OBJECT(menu->popup), &emb_w, &emb_h);
- x -= emb_x;
- y -= emb_y;
+ x -= emb_x;
+ y -= emb_y;
- if ((x > 0) && (y > 0) && (x <= emb_w) && (y <= emb_h))
- {
- ewl_embed_mouse_move_feed(EWL_EMBED(menu->popup), x, y, 0);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
- }
+ if ((x > 0) && (y > 0) && (x <= emb_w) && (y <= emb_h))
+ {
+ ewl_embed_mouse_move_feed(EWL_EMBED(menu->popup), x, y, 0);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+ }
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_menu.h b/src/lib/ewl_menu.h
index 69a67f7..48dab4a 100644
--- a/src/lib/ewl_menu.h
+++ b/src/lib/ewl_menu.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_MENU_H
#define EWL_MENU_H
@@ -50,10 +50,10 @@ typedef struct Ewl_Menu Ewl_Menu;
*/
struct Ewl_Menu
{
- Ewl_Menu_Item item; /**< Inherit from Ewl_Menu_Base */
- Ewl_Widget *popup; /**< The popup holding the menu items */
+ Ewl_Menu_Item item; /**< Inherit from Ewl_Menu_Base */
+ Ewl_Widget *popup; /**< The popup holding the menu items */
- Ewl_Widget *menubar_parent; /**< Parent menu bar */
+ Ewl_Widget *menubar_parent; /**< Parent menu bar */
};
/**
@@ -66,17 +66,17 @@ typedef struct Ewl_Menu_Info Ewl_Menu_Info;
*/
struct Ewl_Menu_Info
{
- const char *name; /**< The name of the menu item */
- const char *img; /**< The menu item image */
- void (*cb)(Ewl_Widget *w, void *ev, void *data); /**< The menu item callback */
+ const char *name; /**< The name of the menu item */
+ const char *img; /**< The menu item image */
+ void (*cb)(Ewl_Widget *w, void *ev, void *data); /**< The menu item callback */
};
-Ewl_Widget *ewl_menu_new(void);
-int ewl_menu_init(Ewl_Menu *menu);
+Ewl_Widget *ewl_menu_new(void);
+int ewl_menu_init(Ewl_Menu *menu);
-void ewl_menu_from_info(Ewl_Menu *menu, Ewl_Menu_Info *info);
+void ewl_menu_from_info(Ewl_Menu *menu, Ewl_Menu_Info *info);
-void ewl_menu_collapse(Ewl_Menu *menu);
+void ewl_menu_collapse(Ewl_Menu *menu);
/*
* Internally used callbacks, override at your own risk.
diff --git a/src/lib/ewl_menu_item.c b/src/lib/ewl_menu_item.c
index f63ae31..7d5b7c8 100644
--- a/src/lib/ewl_menu_item.c
+++ b/src/lib/ewl_menu_item.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_menu_item.h"
#include "ewl_macros.h"
@@ -12,20 +12,20 @@
Ewl_Widget *
ewl_menu_item_new(void)
{
- Ewl_Menu_Item *item;
+ Ewl_Menu_Item *item;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- item = NEW(Ewl_Menu_Item, 1);
- if (!item)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ item = NEW(Ewl_Menu_Item, 1);
+ if (!item)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_menu_item_init(item)) {
- ewl_widget_destroy(EWL_WIDGET(item));
- item = NULL;
- }
+ if (!ewl_menu_item_init(item)) {
+ ewl_widget_destroy(EWL_WIDGET(item));
+ item = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(item), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(item), DLEVEL_STABLE);
}
/**
@@ -36,26 +36,26 @@ ewl_menu_item_new(void)
int
ewl_menu_item_init(Ewl_Menu_Item *item)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(item, FALSE);
-
- /*
- * Initialize the inherited container fields.
- */
- if (!ewl_button_init(EWL_BUTTON(item)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- ewl_button_fill_policy_set(EWL_BUTTON(item), EWL_FLAG_FILL_HFILL);
- ewl_button_alignment_set(EWL_BUTTON(item), EWL_FLAG_ALIGN_LEFT);
- ewl_button_label_set(EWL_BUTTON(item), "");
- ewl_button_image_size_set(EWL_BUTTON(item), 16, 16);
- ewl_widget_appearance_set(EWL_WIDGET(item), EWL_MENU_ITEM_TYPE);
- ewl_widget_inherit(EWL_WIDGET(item), EWL_MENU_ITEM_TYPE);
-
- ewl_object_fill_policy_set(EWL_OBJECT(item), EWL_FLAG_FILL_HFILL);
- ewl_object_fill_policy_set(EWL_OBJECT(EWL_BUTTON(item)->label_object),
- EWL_FLAG_FILL_HFILL);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(item, FALSE);
+
+ /*
+ * Initialize the inherited container fields.
+ */
+ if (!ewl_button_init(EWL_BUTTON(item)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ ewl_button_fill_policy_set(EWL_BUTTON(item), EWL_FLAG_FILL_HFILL);
+ ewl_button_alignment_set(EWL_BUTTON(item), EWL_FLAG_ALIGN_LEFT);
+ ewl_button_label_set(EWL_BUTTON(item), "");
+ ewl_button_image_size_set(EWL_BUTTON(item), 16, 16);
+ ewl_widget_appearance_set(EWL_WIDGET(item), EWL_MENU_ITEM_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(item), EWL_MENU_ITEM_TYPE);
+
+ ewl_object_fill_policy_set(EWL_OBJECT(item), EWL_FLAG_FILL_HFILL);
+ ewl_object_fill_policy_set(EWL_OBJECT(EWL_BUTTON(item)->label_object),
+ EWL_FLAG_FILL_HFILL);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_menu_item.h b/src/lib/ewl_menu_item.h
index cbea2d5..afa16f0 100644
--- a/src/lib/ewl_menu_item.h
+++ b/src/lib/ewl_menu_item.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_MENU_ITEM_H
#define EWL_MENU_ITEM_H
@@ -50,12 +50,12 @@ typedef struct Ewl_Menu_Item Ewl_Menu_Item;
*/
struct Ewl_Menu_Item
{
- Ewl_Button button; /**< Inherit from Ewl_Button */
- Ewl_Widget *inmenu; /**< Set if inside a menu */
+ Ewl_Button button; /**< Inherit from Ewl_Button */
+ Ewl_Widget *inmenu; /**< Set if inside a menu */
};
-Ewl_Widget *ewl_menu_item_new(void);
-int ewl_menu_item_init(Ewl_Menu_Item *menu);
+Ewl_Widget *ewl_menu_item_new(void);
+int ewl_menu_item_init(Ewl_Menu_Item *menu);
/**
* @}
diff --git a/src/lib/ewl_menubar.c b/src/lib/ewl_menubar.c
index 4fefcf7..863ce0d 100644
--- a/src/lib/ewl_menubar.c
+++ b/src/lib/ewl_menubar.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_menubar.h"
#include "ewl_menu.h"
@@ -13,20 +13,20 @@
Ewl_Widget *
ewl_menubar_new(void)
{
- Ewl_Menubar *mb = NULL;
+ Ewl_Menubar *mb = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- mb = NEW(Ewl_Menubar, 1);
- if (!mb)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ mb = NEW(Ewl_Menubar, 1);
+ if (!mb)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_menubar_init(mb)) {
- ewl_widget_destroy(EWL_WIDGET(mb));
- mb = NULL;
- }
+ if (!ewl_menubar_init(mb)) {
+ ewl_widget_destroy(EWL_WIDGET(mb));
+ mb = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(mb), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(mb), DLEVEL_STABLE);
}
/**
@@ -37,18 +37,18 @@ ewl_menubar_new(void)
Ewl_Widget *
ewl_hmenubar_new(void)
{
- Ewl_Widget *mb = NULL;
+ Ewl_Widget *mb = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- mb = ewl_menubar_new();
- if (!mb)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ mb = ewl_menubar_new();
+ if (!mb)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- ewl_menubar_orientation_set(EWL_MENUBAR(mb),
- EWL_ORIENTATION_HORIZONTAL);
+ ewl_menubar_orientation_set(EWL_MENUBAR(mb),
+ EWL_ORIENTATION_HORIZONTAL);
- DRETURN_PTR(mb, DLEVEL_STABLE);
+ DRETURN_PTR(mb, DLEVEL_STABLE);
}
/**
@@ -59,18 +59,18 @@ ewl_hmenubar_new(void)
Ewl_Widget *
ewl_vmenubar_new(void)
{
- Ewl_Widget *mb = NULL;
+ Ewl_Widget *mb = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- mb = ewl_menubar_new();
- if (!mb)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ mb = ewl_menubar_new();
+ if (!mb)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- ewl_menubar_orientation_set(EWL_MENUBAR(mb),
- EWL_ORIENTATION_VERTICAL);
+ ewl_menubar_orientation_set(EWL_MENUBAR(mb),
+ EWL_ORIENTATION_VERTICAL);
- DRETURN_PTR(mb, DLEVEL_STABLE);
+ DRETURN_PTR(mb, DLEVEL_STABLE);
}
/**
@@ -81,30 +81,30 @@ ewl_vmenubar_new(void)
int
ewl_menubar_init(Ewl_Menubar *mb)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(mb, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(mb, FALSE);
- if (!ewl_box_init(EWL_BOX(mb))) {
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
- ewl_widget_appearance_set(EWL_WIDGET(mb), EWL_MENUBAR_TYPE);
- ewl_widget_inherit(EWL_WIDGET(mb), EWL_MENUBAR_TYPE);
+ if (!ewl_box_init(EWL_BOX(mb))) {
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+ ewl_widget_appearance_set(EWL_WIDGET(mb), EWL_MENUBAR_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(mb), EWL_MENUBAR_TYPE);
- mb->inner_box = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(mb),
- EWL_WIDGET(mb->inner_box));
- ewl_widget_internal_set(EWL_WIDGET(mb->inner_box), TRUE);
- ewl_widget_show(EWL_WIDGET(mb->inner_box));
+ mb->inner_box = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(mb),
+ EWL_WIDGET(mb->inner_box));
+ ewl_widget_internal_set(EWL_WIDGET(mb->inner_box), TRUE);
+ ewl_widget_show(EWL_WIDGET(mb->inner_box));
- ewl_container_redirect_set(EWL_CONTAINER(mb),
- EWL_CONTAINER(mb->inner_box));
+ ewl_container_redirect_set(EWL_CONTAINER(mb),
+ EWL_CONTAINER(mb->inner_box));
- ewl_container_add_notify_set(EWL_CONTAINER(mb->inner_box),
- ewl_menubar_cb_child_add);
+ ewl_container_add_notify_set(EWL_CONTAINER(mb->inner_box),
+ ewl_menubar_cb_child_add);
- ewl_menubar_orientation_set(mb, EWL_ORIENTATION_HORIZONTAL);
+ ewl_menubar_orientation_set(mb, EWL_ORIENTATION_HORIZONTAL);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -116,27 +116,27 @@ ewl_menubar_init(Ewl_Menubar *mb)
void
ewl_menubar_from_info(Ewl_Menubar *mb, Ewl_Menubar_Info *info)
{
- int i = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(mb);
- DCHECK_PARAM_PTR(info);
- DCHECK_TYPE(mb, EWL_MENUBAR_TYPE);
-
- for (i = 0; info[i].name != NULL; i++)
- {
- Ewl_Widget *menu;
-
- menu = ewl_menu_new();
- ewl_button_label_set(EWL_BUTTON(menu), info[i].name);
- ewl_menu_from_info(EWL_MENU(menu), info[i].menu);
- ewl_container_child_append(EWL_CONTAINER(mb), menu);
- ewl_object_fill_policy_set(EWL_OBJECT(menu),
- EWL_FLAG_FILL_HSHRINK | EWL_FLAG_FILL_VFILL);
- ewl_widget_show(menu);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int i = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(mb);
+ DCHECK_PARAM_PTR(info);
+ DCHECK_TYPE(mb, EWL_MENUBAR_TYPE);
+
+ for (i = 0; info[i].name != NULL; i++)
+ {
+ Ewl_Widget *menu;
+
+ menu = ewl_menu_new();
+ ewl_button_label_set(EWL_BUTTON(menu), info[i].name);
+ ewl_menu_from_info(EWL_MENU(menu), info[i].menu);
+ ewl_container_child_append(EWL_CONTAINER(mb), menu);
+ ewl_object_fill_policy_set(EWL_OBJECT(menu),
+ EWL_FLAG_FILL_HSHRINK | EWL_FLAG_FILL_VFILL);
+ ewl_widget_show(menu);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -148,29 +148,29 @@ ewl_menubar_from_info(Ewl_Menubar *mb, Ewl_Menubar_Info *info)
void
ewl_menubar_orientation_set(Ewl_Menubar *mb, Ewl_Orientation o)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(mb);
- DCHECK_TYPE(mb, EWL_MENUBAR_TYPE);
-
- ewl_box_orientation_set(EWL_BOX(mb), o);
- if (o == EWL_ORIENTATION_HORIZONTAL) {
- ewl_object_fill_policy_set(EWL_OBJECT(mb),
- EWL_FLAG_FILL_HFILL);
- ewl_box_orientation_set(EWL_BOX(mb->inner_box),
- EWL_ORIENTATION_HORIZONTAL);
- ewl_object_fill_policy_set(EWL_OBJECT(mb->inner_box),
- EWL_FLAG_FILL_HFILL);
-
- } else if (o == EWL_ORIENTATION_VERTICAL) {
- ewl_object_fill_policy_set(EWL_OBJECT(mb),
- EWL_FLAG_FILL_VFILL);
- ewl_box_orientation_set(EWL_BOX(mb->inner_box),
- EWL_ORIENTATION_VERTICAL);
- ewl_object_fill_policy_set(EWL_OBJECT(mb->inner_box),
- EWL_FLAG_FILL_VFILL);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(mb);
+ DCHECK_TYPE(mb, EWL_MENUBAR_TYPE);
+
+ ewl_box_orientation_set(EWL_BOX(mb), o);
+ if (o == EWL_ORIENTATION_HORIZONTAL) {
+ ewl_object_fill_policy_set(EWL_OBJECT(mb),
+ EWL_FLAG_FILL_HFILL);
+ ewl_box_orientation_set(EWL_BOX(mb->inner_box),
+ EWL_ORIENTATION_HORIZONTAL);
+ ewl_object_fill_policy_set(EWL_OBJECT(mb->inner_box),
+ EWL_FLAG_FILL_HFILL);
+
+ } else if (o == EWL_ORIENTATION_VERTICAL) {
+ ewl_object_fill_policy_set(EWL_OBJECT(mb),
+ EWL_FLAG_FILL_VFILL);
+ ewl_box_orientation_set(EWL_BOX(mb->inner_box),
+ EWL_ORIENTATION_VERTICAL);
+ ewl_object_fill_policy_set(EWL_OBJECT(mb->inner_box),
+ EWL_FLAG_FILL_VFILL);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -181,11 +181,11 @@ ewl_menubar_orientation_set(Ewl_Menubar *mb, Ewl_Orientation o)
Ewl_Orientation
ewl_menubar_orientation_get(Ewl_Menubar *mb)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(mb, EWL_ORIENTATION_HORIZONTAL);
- DCHECK_TYPE_RET(mb, EWL_MENUBAR_TYPE, EWL_ORIENTATION_HORIZONTAL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(mb, EWL_ORIENTATION_HORIZONTAL);
+ DCHECK_TYPE_RET(mb, EWL_MENUBAR_TYPE, EWL_ORIENTATION_HORIZONTAL);
- DRETURN_INT(ewl_box_orientation_get(EWL_BOX(mb)), DLEVEL_STABLE);
+ DRETURN_INT(ewl_box_orientation_get(EWL_BOX(mb)), DLEVEL_STABLE);
}
@@ -199,16 +199,16 @@ ewl_menubar_orientation_get(Ewl_Menubar *mb)
void
ewl_menubar_cb_child_add(Ewl_Container *c, Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (EWL_MENU_IS(w))
- EWL_MENU(w)->menubar_parent = EWL_WIDGET(c);
+ if (EWL_MENU_IS(w))
+ EWL_MENU(w)->menubar_parent = EWL_WIDGET(c);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_menubar.h b/src/lib/ewl_menubar.h
index 8f017f7..7f3069f 100644
--- a/src/lib/ewl_menubar.h
+++ b/src/lib/ewl_menubar.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_MENUBAR_H
#define EWL_MENUBAR_H
@@ -51,8 +51,8 @@ typedef struct Ewl_Menubar Ewl_Menubar;
*/
struct Ewl_Menubar
{
- Ewl_Box outer_box; /**< Inherit from Ewl_Box */
- Ewl_Widget *inner_box; /**< The box to pack the widgets into */
+ Ewl_Box outer_box; /**< Inherit from Ewl_Box */
+ Ewl_Widget *inner_box; /**< The box to pack the widgets into */
};
/**
@@ -65,22 +65,22 @@ typedef struct Ewl_Menubar_Info Ewl_Menubar_Info;
*/
struct Ewl_Menubar_Info
{
- char *name; /**< The menu name */
- Ewl_Menu_Info *menu; /**< The menu items */
+ char *name; /**< The menu name */
+ Ewl_Menu_Info *menu; /**< The menu items */
};
-Ewl_Widget *ewl_menubar_new(void);
-Ewl_Widget *ewl_hmenubar_new(void);
-Ewl_Widget *ewl_vmenubar_new(void);
+Ewl_Widget *ewl_menubar_new(void);
+Ewl_Widget *ewl_hmenubar_new(void);
+Ewl_Widget *ewl_vmenubar_new(void);
-int ewl_menubar_init(Ewl_Menubar *mb);
+int ewl_menubar_init(Ewl_Menubar *mb);
-void ewl_menubar_from_info(Ewl_Menubar *mb, Ewl_Menubar_Info *info);
+void ewl_menubar_from_info(Ewl_Menubar *mb, Ewl_Menubar_Info *info);
-void ewl_menubar_orientation_set(Ewl_Menubar *mb, Ewl_Orientation o);
-Ewl_Orientation ewl_menubar_orientation_get(Ewl_Menubar *mb);
+void ewl_menubar_orientation_set(Ewl_Menubar *mb, Ewl_Orientation o);
+Ewl_Orientation ewl_menubar_orientation_get(Ewl_Menubar *mb);
-void ewl_menubar_cb_child_add(Ewl_Container *c, Ewl_Widget *w);
+void ewl_menubar_cb_child_add(Ewl_Container *c, Ewl_Widget *w);
/**
* @}
diff --git a/src/lib/ewl_misc.c b/src/lib/ewl_misc.c
index f73db96..baf7000 100644
--- a/src/lib/ewl_misc.c
+++ b/src/lib/ewl_misc.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include <locale.h>
#include "ewl_base.h"
#include "ewl_icon_theme.h"
@@ -54,8 +54,8 @@ typedef struct Ewl_Configure_Queue Ewl_Configure_Queue;
*/
struct Ewl_Configure_Queue
{
- int end;
- Ewl_Widget *buffer[EWL_CONFIGURE_QUEUE_SIZE];
+ int end;
+ Ewl_Widget *buffer[EWL_CONFIGURE_QUEUE_SIZE];
};
/*
@@ -91,9 +91,9 @@ static void ewl_configure_cancel_request(Ewl_Widget *w);
void
ewl_print_warning(void)
{
- fprintf(stderr, "\n***** Ewl Developer Warning ***** :\n"
- " To find where this is occurring set a breakpoint\n"
- " for the function ewl_print_warning.\n");
+ fprintf(stderr, "\n***** Ewl Developer Warning ***** :\n"
+ " To find where this is occurring set a breakpoint\n"
+ " for the function ewl_print_warning.\n");
}
/**
@@ -103,10 +103,10 @@ ewl_print_warning(void)
void
ewl_segv(void)
{
- if (ewl_config_cache.segv) {
- char *null = NULL;
- *null = '\0';
- }
+ if (ewl_config_cache.segv) {
+ char *null = NULL;
+ *null = '\0';
+ }
}
/**
@@ -117,21 +117,21 @@ void
ewl_backtrace(void)
{
#ifdef __GLIBC__
- void *array[128];
- size_t size;
- char **strings;
- size_t i;
+ void *array[128];
+ size_t size;
+ char **strings;
+ size_t i;
- if (!ewl_config_cache.backtrace)
- return;
+ if (!ewl_config_cache.backtrace)
+ return;
- fprintf(stderr, "\n***** Backtrace *****\n");
- size = backtrace(array, 128);
- strings = backtrace_symbols(array, size);
- for (i = 0; i < size; i++)
- fprintf(stderr, "%s\n", strings[i]);
+ fprintf(stderr, "\n***** Backtrace *****\n");
+ size = backtrace(array, 128);
+ strings = backtrace_symbols(array, size);
+ for (i = 0; i < size; i++)
+ fprintf(stderr, "%s\n", strings[i]);
- FREE(strings);
+ FREE(strings);
#endif
}
@@ -147,168 +147,168 @@ ewl_backtrace(void)
int
ewl_init(int *argc, char **argv)
{
- const char *locale;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- /* check if we are already initialized */
- if (++ewl_init_count > 1)
- DRETURN_INT(ewl_init_count, DLEVEL_STABLE);
-
- /* set the locale for string collation if it isn't already set */
- locale = setlocale(LC_COLLATE, NULL);
- if (strcmp(locale, "C") || strcmp(locale, "POSIX")) {
- setlocale(LC_COLLATE, "");
- }
-
- shutdown_queue = ecore_list_new();
- if (!shutdown_queue) {
- fprintf(stderr, "Could not create Ewl shutdown queue.\n");
- goto ERROR;
- }
-
- if (!evas_init()) {
- fprintf(stderr, "Could not initialize Evas.\n");
- goto ERROR;
- }
- ecore_list_prepend(shutdown_queue, evas_shutdown);
-
- if (!ecore_init()) {
- fprintf(stderr, "Could not initialize Ecore.\n");
- goto ERROR;
- }
- ecore_list_prepend(shutdown_queue, ecore_shutdown);
-
- if (!efreet_init()) {
- fprintf(stderr, "Could not initialize Efreet.\n");
- goto ERROR;
- }
- ecore_list_prepend(shutdown_queue, efreet_shutdown);
-
- if (!efreet_mime_init()) {
- fprintf(stderr, "Could not initialize Efreet_Mime.\n");
- goto ERROR;
- }
- ecore_list_prepend(shutdown_queue, efreet_mime_shutdown);
-
- if (!ecore_string_init()) {
- fprintf(stderr, "Could not initialize Ecore Strings.\n");
- goto ERROR;
- }
- ecore_list_prepend(shutdown_queue, ecore_string_shutdown);
-
- if (!edje_init()) {
- fprintf(stderr, "Could not initialize Edje.\n");
- goto ERROR;
- }
- ecore_list_prepend(shutdown_queue, edje_shutdown);
-
- reveal_list = ecore_list_new();
- obscure_list = ecore_list_new();
- configure_active = ecore_list_new();
- configure_available = ecore_list_new();
- realize_list = ecore_list_new();
- destroy_list = ecore_list_new();
- free_evas_list = ecore_list_new();
- free_evas_object_list = ecore_list_new();
- child_add_list = ecore_list_new();
- ewl_embed_list = ecore_list_new();
- ewl_window_list = ecore_list_new();
- shutdown_hooks = ecore_list_new();
- if ((!reveal_list) || (!obscure_list) || (!configure_active)
- || (!configure_available)
- || (!realize_list) || (!destroy_list)
- || (!free_evas_list) || (!free_evas_object_list)
- || (!child_add_list) || (!ewl_embed_list)
- || (!ewl_window_list) || (!shutdown_hooks)) {
- fprintf(stderr, "Unable to initialize internal configuration."
- " Out of memory?\n");
- goto ERROR;
- }
-
- /*
- * Cleanup the queue buffers when the management lists get freed.
- */
- ecore_list_free_cb_set(configure_active, free);
- ecore_list_free_cb_set(configure_available, free);
-
- if (!ewl_config_init()) {
- fprintf(stderr, "Could not initialize Ewl Config.\n");
- goto ERROR;
- }
- ecore_list_prepend(shutdown_queue, ewl_config_shutdown);
-
- if (!ewl_engines_init()) {
- fprintf(stderr, "Could not intialize Ewl Engines.\n");
- goto ERROR;
- }
- ecore_list_prepend(shutdown_queue, ewl_engines_shutdown);
-
- /* handle any command line options */
- ewl_init_parse_options(argc, argv);
-
- /* initialize this _after_ we've handled the command line options */
- ewl_config_cache_init();
-
- /* we create the engine we will be working with here so that it is
- * initialized before we start to use it. */
- if (!ewl_engine_new(ewl_config_string_get(ewl_config,
- EWL_CONFIG_ENGINE_NAME), argc, argv)) {
- fprintf(stderr, "Could not initialize Ewl Engine.\n");
- goto ERROR;
- }
-
- if (!ewl_callbacks_init()) {
- fprintf(stderr, "Could not initialize Ewl Callback system.\n");
- goto ERROR;
- }
- ecore_list_prepend(shutdown_queue, ewl_callbacks_shutdown);
-
- /* allocate the two window callbacks */
- EWL_CALLBACK_EXPOSE = ewl_callback_type_add();
- EWL_CALLBACK_DELETE_WINDOW = ewl_callback_type_add();
-
- if (!ewl_theme_init()) {
- fprintf(stderr, "Could not setup Ewl Theme system.\n");
- goto ERROR;
- }
- ecore_list_prepend(shutdown_queue, ewl_theme_shutdown);
-
- if (!ewl_icon_theme_init()) {
- fprintf(stderr, "Could not initialize Ewl Icon Theme system.\n");
- goto ERROR;
- }
- ecore_list_prepend(shutdown_queue, ewl_icon_theme_shutdown);
-
- if (!ewl_dnd_init()) {
- fprintf(stderr, "Could not initialize Ewl DND support.\n");
- goto ERROR;
- }
- ecore_list_prepend(shutdown_queue, ewl_dnd_shutdown);
-
- if (!ewl_io_manager_init()) {
- fprintf(stderr, "Could not initialize Ewl IO Manager.\n");
- goto ERROR;
- }
- ecore_list_prepend(shutdown_queue, ewl_io_manager_shutdown);
-
- if (!ewl_text_context_init()) {
- fprintf(stderr, "Could not initialize Ewl Text Context system.\n");
- goto ERROR;
- }
- ecore_list_prepend(shutdown_queue, ewl_text_context_shutdown);
-
- if (!(idle_enterer = ecore_idle_enterer_add(ewl_idle_render, NULL))) {
- fprintf(stderr, "Could not create Idle Enterer.\n");
- goto ERROR;
- }
-
- DRETURN_INT(ewl_init_count, DLEVEL_STABLE);
+ const char *locale;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ /* check if we are already initialized */
+ if (++ewl_init_count > 1)
+ DRETURN_INT(ewl_init_count, DLEVEL_STABLE);
+
+ /* set the locale for string collation if it isn't already set */
+ locale = setlocale(LC_COLLATE, NULL);
+ if (strcmp(locale, "C") || strcmp(locale, "POSIX")) {
+ setlocale(LC_COLLATE, "");
+ }
+
+ shutdown_queue = ecore_list_new();
+ if (!shutdown_queue) {
+ fprintf(stderr, "Could not create Ewl shutdown queue.\n");
+ goto ERROR;
+ }
+
+ if (!evas_init()) {
+ fprintf(stderr, "Could not initialize Evas.\n");
+ goto ERROR;
+ }
+ ecore_list_prepend(shutdown_queue, evas_shutdown);
+
+ if (!ecore_init()) {
+ fprintf(stderr, "Could not initialize Ecore.\n");
+ goto ERROR;
+ }
+ ecore_list_prepend(shutdown_queue, ecore_shutdown);
+
+ if (!efreet_init()) {
+ fprintf(stderr, "Could not initialize Efreet.\n");
+ goto ERROR;
+ }
+ ecore_list_prepend(shutdown_queue, efreet_shutdown);
+
+ if (!efreet_mime_init()) {
+ fprintf(stderr, "Could not initialize Efreet_Mime.\n");
+ goto ERROR;
+ }
+ ecore_list_prepend(shutdown_queue, efreet_mime_shutdown);
+
+ if (!ecore_string_init()) {
+ fprintf(stderr, "Could not initialize Ecore Strings.\n");
+ goto ERROR;
+ }
+ ecore_list_prepend(shutdown_queue, ecore_string_shutdown);
+
+ if (!edje_init()) {
+ fprintf(stderr, "Could not initialize Edje.\n");
+ goto ERROR;
+ }
+ ecore_list_prepend(shutdown_queue, edje_shutdown);
+
+ reveal_list = ecore_list_new();
+ obscure_list = ecore_list_new();
+ configure_active = ecore_list_new();
+ configure_available = ecore_list_new();
+ realize_list = ecore_list_new();
+ destroy_list = ecore_list_new();
+ free_evas_list = ecore_list_new();
+ free_evas_object_list = ecore_list_new();
+ child_add_list = ecore_list_new();
+ ewl_embed_list = ecore_list_new();
+ ewl_window_list = ecore_list_new();
+ shutdown_hooks = ecore_list_new();
+ if ((!reveal_list) || (!obscure_list) || (!configure_active)
+ || (!configure_available)
+ || (!realize_list) || (!destroy_list)
+ || (!free_evas_list) || (!free_evas_object_list)
+ || (!child_add_list) || (!ewl_embed_list)
+ || (!ewl_window_list) || (!shutdown_hooks)) {
+ fprintf(stderr, "Unable to initialize internal configuration."
+ " Out of memory?\n");
+ goto ERROR;
+ }
+
+ /*
+ * Cleanup the queue buffers when the management lists get freed.
+ */
+ ecore_list_free_cb_set(configure_active, free);
+ ecore_list_free_cb_set(configure_available, free);
+
+ if (!ewl_config_init()) {
+ fprintf(stderr, "Could not initialize Ewl Config.\n");
+ goto ERROR;
+ }
+ ecore_list_prepend(shutdown_queue, ewl_config_shutdown);
+
+ if (!ewl_engines_init()) {
+ fprintf(stderr, "Could not intialize Ewl Engines.\n");
+ goto ERROR;
+ }
+ ecore_list_prepend(shutdown_queue, ewl_engines_shutdown);
+
+ /* handle any command line options */
+ ewl_init_parse_options(argc, argv);
+
+ /* initialize this _after_ we've handled the command line options */
+ ewl_config_cache_init();
+
+ /* we create the engine we will be working with here so that it is
+ * initialized before we start to use it. */
+ if (!ewl_engine_new(ewl_config_string_get(ewl_config,
+ EWL_CONFIG_ENGINE_NAME), argc, argv)) {
+ fprintf(stderr, "Could not initialize Ewl Engine.\n");
+ goto ERROR;
+ }
+
+ if (!ewl_callbacks_init()) {
+ fprintf(stderr, "Could not initialize Ewl Callback system.\n");
+ goto ERROR;
+ }
+ ecore_list_prepend(shutdown_queue, ewl_callbacks_shutdown);
+
+ /* allocate the two window callbacks */
+ EWL_CALLBACK_EXPOSE = ewl_callback_type_add();
+ EWL_CALLBACK_DELETE_WINDOW = ewl_callback_type_add();
+
+ if (!ewl_theme_init()) {
+ fprintf(stderr, "Could not setup Ewl Theme system.\n");
+ goto ERROR;
+ }
+ ecore_list_prepend(shutdown_queue, ewl_theme_shutdown);
+
+ if (!ewl_icon_theme_init()) {
+ fprintf(stderr, "Could not initialize Ewl Icon Theme system.\n");
+ goto ERROR;
+ }
+ ecore_list_prepend(shutdown_queue, ewl_icon_theme_shutdown);
+
+ if (!ewl_dnd_init()) {
+ fprintf(stderr, "Could not initialize Ewl DND support.\n");
+ goto ERROR;
+ }
+ ecore_list_prepend(shutdown_queue, ewl_dnd_shutdown);
+
+ if (!ewl_io_manager_init()) {
+ fprintf(stderr, "Could not initialize Ewl IO Manager.\n");
+ goto ERROR;
+ }
+ ecore_list_prepend(shutdown_queue, ewl_io_manager_shutdown);
+
+ if (!ewl_text_context_init()) {
+ fprintf(stderr, "Could not initialize Ewl Text Context system.\n");
+ goto ERROR;
+ }
+ ecore_list_prepend(shutdown_queue, ewl_text_context_shutdown);
+
+ if (!(idle_enterer = ecore_idle_enterer_add(ewl_idle_render, NULL))) {
+ fprintf(stderr, "Could not create Idle Enterer.\n");
+ goto ERROR;
+ }
+
+ DRETURN_INT(ewl_init_count, DLEVEL_STABLE);
ERROR:
- ewl_shutdown();
+ ewl_shutdown();
- DRETURN_INT(ewl_init_count, DLEVEL_STABLE);
+ DRETURN_INT(ewl_init_count, DLEVEL_STABLE);
}
/**
@@ -320,59 +320,59 @@ ERROR:
int
ewl_shutdown(void)
{
- Ewl_Shutdown_Hook hook;
- void (*shutdown)(void);
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- if (--ewl_init_count)
- DRETURN_INT(ewl_init_count, DLEVEL_STABLE);
-
- while ((hook = ecore_list_first_remove(shutdown_hooks)))
- hook();
- IF_FREE_LIST(shutdown_hooks);
-
- /*
- * Destroy all existing widgets.
- */
- if (ewl_embed_list)
- {
- Ewl_Widget *emb;
-
- while ((emb = ecore_list_first_remove(ewl_embed_list)))
- ewl_widget_destroy(emb);
-
- while (ewl_garbage_collect_idler(NULL) > 0)
- ;
- IF_FREE_LIST(ewl_embed_list);
- }
-
- if (idle_enterer)
- {
- ecore_idle_enterer_del(idle_enterer);
- idle_enterer = NULL;
- }
-
- /*
- * Free internal accounting lists.
- */
- IF_FREE_LIST(ewl_window_list);
- IF_FREE_LIST(reveal_list);
- IF_FREE_LIST(obscure_list);
- IF_FREE_LIST(configure_active);
- IF_FREE_LIST(configure_available);
- IF_FREE_LIST(realize_list);
- IF_FREE_LIST(destroy_list);
- IF_FREE_LIST(free_evas_list);
- IF_FREE_LIST(free_evas_object_list);
- IF_FREE_LIST(child_add_list);
-
- /* shutdown all the subsystems */
- while ((shutdown = ecore_list_first_remove(shutdown_queue)))
- shutdown();
- IF_FREE_LIST(shutdown_queue);
-
- DRETURN_INT(ewl_init_count, DLEVEL_STABLE);
+ Ewl_Shutdown_Hook hook;
+ void (*shutdown)(void);
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ if (--ewl_init_count)
+ DRETURN_INT(ewl_init_count, DLEVEL_STABLE);
+
+ while ((hook = ecore_list_first_remove(shutdown_hooks)))
+ hook();
+ IF_FREE_LIST(shutdown_hooks);
+
+ /*
+ * Destroy all existing widgets.
+ */
+ if (ewl_embed_list)
+ {
+ Ewl_Widget *emb;
+
+ while ((emb = ecore_list_first_remove(ewl_embed_list)))
+ ewl_widget_destroy(emb);
+
+ while (ewl_garbage_collect_idler(NULL) > 0)
+ ;
+ IF_FREE_LIST(ewl_embed_list);
+ }
+
+ if (idle_enterer)
+ {
+ ecore_idle_enterer_del(idle_enterer);
+ idle_enterer = NULL;
+ }
+
+ /*
+ * Free internal accounting lists.
+ */
+ IF_FREE_LIST(ewl_window_list);
+ IF_FREE_LIST(reveal_list);
+ IF_FREE_LIST(obscure_list);
+ IF_FREE_LIST(configure_active);
+ IF_FREE_LIST(configure_available);
+ IF_FREE_LIST(realize_list);
+ IF_FREE_LIST(destroy_list);
+ IF_FREE_LIST(free_evas_list);
+ IF_FREE_LIST(free_evas_object_list);
+ IF_FREE_LIST(child_add_list);
+
+ /* shutdown all the subsystems */
+ while ((shutdown = ecore_list_first_remove(shutdown_queue)))
+ shutdown();
+ IF_FREE_LIST(shutdown_queue);
+
+ DRETURN_INT(ewl_init_count, DLEVEL_STABLE);
}
/**
@@ -385,12 +385,12 @@ ewl_shutdown(void)
void
ewl_main(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ecore_main_loop_begin();
- ewl_shutdown();
+ ecore_main_loop_begin();
+ ewl_shutdown();
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -432,94 +432,94 @@ ewl_main_iterate (void)
static int
ewl_idle_render(void *data __UNUSED__)
{
- Ewl_Widget *w;
- Ewl_Embed *emb;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- if (!ewl_embed_list) {
- DERROR("EWL has not been initialized. Exiting....\n");
- ewl_main_quit();
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
-
- if (ecore_list_empty_is(ewl_embed_list))
- DRETURN_INT(TRUE, DLEVEL_STABLE);
-
- /*
- * Freeze events on the evases to reduce overhead
- */
- ecore_list_first_goto(ewl_embed_list);
- while ((emb = ecore_list_next(ewl_embed_list)) != NULL)
- if (REALIZED(emb))
- ewl_embed_freeze(emb);
-
- /*
- * Clean out the unused widgets first, to avoid them being drawn or
- * unnecessary work done from configuration. Then display new widgets,
- * finally layout the widgets.
- */
- if (!ecore_list_empty_is(destroy_list) ||
- !ecore_list_empty_is(free_evas_list) ||
- !ecore_list_empty_is(free_evas_object_list))
- ewl_garbage_collect = ecore_idler_add(ewl_garbage_collect_idler,
- NULL);
-
- if (!ecore_list_empty_is(realize_list))
- ewl_realize_queue();
-
- while (!ecore_list_empty_is(configure_active)) {
- ewl_configure_queue_run();
-
- /*
- * Reclaim obscured objects at this point
- */
- while ((w = ecore_list_first_remove(obscure_list))) {
- /*
- * Ensure the widget is still obscured, then mark it
- * revealed so that the obscure will succeed (and mark
- * it obscured again.
- */
- if (REVEALED(w))
- ewl_widget_obscure(w);
- }
-
- /*
- * Allocate objects to revealed widgets.
- */
- while ((w = ecore_list_first_remove(reveal_list))) {
- /*
- * Follow the same logic as the obscure loop.
- */
- if (!REVEALED(w))
- ewl_widget_reveal(w);
- }
- }
-
- /*
- * Allow each embed to render itself, this requires thawing the evas.
- */
- ecore_list_first_goto(ewl_embed_list);
- while ((emb = ecore_list_next(ewl_embed_list)) != NULL) {
- ewl_embed_thaw(emb);
-
- if (REALIZED(emb)) {
- double render_time = 0;
-
- if (ewl_config_cache.evas_render) {
- printf("Entering render\n");
- render_time = ecore_time_get();
- }
-
- ewl_engine_canvas_render(emb);
-
- if (ewl_config_cache.evas_render)
- printf("Render time: %f seconds\n",
- ecore_time_get() - render_time);
- }
- }
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Widget *w;
+ Ewl_Embed *emb;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ if (!ewl_embed_list) {
+ DERROR("EWL has not been initialized. Exiting....\n");
+ ewl_main_quit();
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+
+ if (ecore_list_empty_is(ewl_embed_list))
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+
+ /*
+ * Freeze events on the evases to reduce overhead
+ */
+ ecore_list_first_goto(ewl_embed_list);
+ while ((emb = ecore_list_next(ewl_embed_list)) != NULL)
+ if (REALIZED(emb))
+ ewl_embed_freeze(emb);
+
+ /*
+ * Clean out the unused widgets first, to avoid them being drawn or
+ * unnecessary work done from configuration. Then display new widgets,
+ * finally layout the widgets.
+ */
+ if (!ecore_list_empty_is(destroy_list) ||
+ !ecore_list_empty_is(free_evas_list) ||
+ !ecore_list_empty_is(free_evas_object_list))
+ ewl_garbage_collect = ecore_idler_add(ewl_garbage_collect_idler,
+ NULL);
+
+ if (!ecore_list_empty_is(realize_list))
+ ewl_realize_queue();
+
+ while (!ecore_list_empty_is(configure_active)) {
+ ewl_configure_queue_run();
+
+ /*
+ * Reclaim obscured objects at this point
+ */
+ while ((w = ecore_list_first_remove(obscure_list))) {
+ /*
+ * Ensure the widget is still obscured, then mark it
+ * revealed so that the obscure will succeed (and mark
+ * it obscured again.
+ */
+ if (REVEALED(w))
+ ewl_widget_obscure(w);
+ }
+
+ /*
+ * Allocate objects to revealed widgets.
+ */
+ while ((w = ecore_list_first_remove(reveal_list))) {
+ /*
+ * Follow the same logic as the obscure loop.
+ */
+ if (!REVEALED(w))
+ ewl_widget_reveal(w);
+ }
+ }
+
+ /*
+ * Allow each embed to render itself, this requires thawing the evas.
+ */
+ ecore_list_first_goto(ewl_embed_list);
+ while ((emb = ecore_list_next(ewl_embed_list)) != NULL) {
+ ewl_embed_thaw(emb);
+
+ if (REALIZED(emb)) {
+ double render_time = 0;
+
+ if (ewl_config_cache.evas_render) {
+ printf("Entering render\n");
+ render_time = ecore_time_get();
+ }
+
+ ewl_engine_canvas_render(emb);
+
+ if (ewl_config_cache.evas_render)
+ printf("Render time: %f seconds\n",
+ ecore_time_get() - render_time);
+ }
+ }
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -532,11 +532,11 @@ ewl_idle_render(void *data __UNUSED__)
void
ewl_main_quit(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ecore_main_loop_quit();
+ ecore_main_loop_quit();
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/*
@@ -550,147 +550,147 @@ ewl_main_quit(void)
static void
ewl_init_parse_options(int *argc, char **argv)
{
- int i, matched = 0;
- Ecore_List *engines;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- if (!argc || !argv)
- DRETURN(DLEVEL_STABLE);
-
- engines = ewl_engine_names_get();
-
- i = 0;
- while (i < *argc) {
- if (!strcmp(argv[i], "--ewl-segv")) {
- ewl_config_int_set(ewl_config, EWL_CONFIG_DEBUG_SEGV,
- 1, EWL_STATE_TRANSIENT);
- matched++;
- }
- else if (!strcmp(argv[i], "--ewl-backtrace")) {
- ewl_config_int_set(ewl_config,
- EWL_CONFIG_DEBUG_BACKTRACE, 1,
- EWL_STATE_TRANSIENT);
- matched++;
- }
- else if (!strcmp(argv[i], "--ewl-theme")) {
- if (i + 1 < *argc) {
- ewl_config_string_set(ewl_config,
- EWL_CONFIG_THEME_NAME,
- argv[i + 1],
- EWL_STATE_TRANSIENT);
- matched++;
- }
- matched++;
- }
- else if (!strcmp(argv[i], "--ewl-print-theme-keys")) {
- ewl_config_int_set(ewl_config,
- EWL_CONFIG_THEME_PRINT_KEYS, 1,
- EWL_STATE_TRANSIENT);
- matched++;
- }
- else if (!strcmp(argv[i], "--ewl-print-theme-signals")) {
- ewl_config_int_set(ewl_config,
- EWL_CONFIG_THEME_PRINT_SIGNALS, 1,
- EWL_STATE_TRANSIENT);
- matched++;
- }
- else if (!strcmp(argv[i], "--ewl-print-gc-reap")) {
- ewl_config_int_set(ewl_config,
- EWL_CONFIG_DEBUG_GC_REAP, 1,
- EWL_STATE_TRANSIENT);
- matched++;
- }
- else if (!strcmp(argv[i], "--ewl-debug")) {
- if ((i + 1) < *argc) {
- ewl_config_int_set(ewl_config,
- EWL_CONFIG_DEBUG_LEVEL, atoi(argv[i + 1]),
- EWL_STATE_TRANSIENT);
- matched++;
- } else {
- ewl_config_int_set(ewl_config,
- EWL_CONFIG_DEBUG_LEVEL, 1,
- EWL_STATE_TRANSIENT);
- }
- ewl_config_int_set(ewl_config,
- EWL_CONFIG_DEBUG_ENABLE, 1,
- EWL_STATE_TRANSIENT);
- matched ++;
- }
- else if (!strcmp(argv[i], "--ewl-debug-paint")) {
- ewl_config_int_set(ewl_config,
- EWL_CONFIG_DEBUG_EVAS_RENDER, 1,
- EWL_STATE_TRANSIENT);
- matched ++;
- }
- else if (!strcmp(argv[i], "--ewl-help")) {
- ewl_print_help();
- matched ++;
-
- /* this has to exit. otherwise we end up returning
- * FALSE from ewl_init which triggers the app to
- * spit out an error */
- exit(0);
- }
- else if (!strncmp(argv[i], "--ewl-", 6)) {
- unsigned int len;
-
- len = strlen("--ewl-");
- if (strlen(argv[i]) > len)
- {
- char *eng;
- char *name;
-
- eng = strdup(argv[i] + len);
-
- while ((name = strchr(eng, '-')))
- *name = '_';
-
- ecore_list_first_goto(engines);
- while ((name = ecore_list_next(engines)))
- {
- if (!strcmp(eng, name))
- {
- ewl_config_string_set(ewl_config,
- EWL_CONFIG_ENGINE_NAME, name,
- EWL_STATE_TRANSIENT);
- matched ++;
-
- break;
- }
- }
-
- FREE(eng);
- }
- }
-
- if (matched > 0) {
- while (matched) {
- ewl_init_remove_option(argc, argv, i);
- matched--;
- }
- }
- else
- i++;
- }
- IF_FREE_LIST(engines);
-
- DRETURN(DLEVEL_STABLE);
+ int i, matched = 0;
+ Ecore_List *engines;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ if (!argc || !argv)
+ DRETURN(DLEVEL_STABLE);
+
+ engines = ewl_engine_names_get();
+
+ i = 0;
+ while (i < *argc) {
+ if (!strcmp(argv[i], "--ewl-segv")) {
+ ewl_config_int_set(ewl_config, EWL_CONFIG_DEBUG_SEGV,
+ 1, EWL_STATE_TRANSIENT);
+ matched++;
+ }
+ else if (!strcmp(argv[i], "--ewl-backtrace")) {
+ ewl_config_int_set(ewl_config,
+ EWL_CONFIG_DEBUG_BACKTRACE, 1,
+ EWL_STATE_TRANSIENT);
+ matched++;
+ }
+ else if (!strcmp(argv[i], "--ewl-theme")) {
+ if (i + 1 < *argc) {
+ ewl_config_string_set(ewl_config,
+ EWL_CONFIG_THEME_NAME,
+ argv[i + 1],
+ EWL_STATE_TRANSIENT);
+ matched++;
+ }
+ matched++;
+ }
+ else if (!strcmp(argv[i], "--ewl-print-theme-keys")) {
+ ewl_config_int_set(ewl_config,
+ EWL_CONFIG_THEME_PRINT_KEYS, 1,
+ EWL_STATE_TRANSIENT);
+ matched++;
+ }
+ else if (!strcmp(argv[i], "--ewl-print-theme-signals")) {
+ ewl_config_int_set(ewl_config,
+ EWL_CONFIG_THEME_PRINT_SIGNALS, 1,
+ EWL_STATE_TRANSIENT);
+ matched++;
+ }
+ else if (!strcmp(argv[i], "--ewl-print-gc-reap")) {
+ ewl_config_int_set(ewl_config,
+ EWL_CONFIG_DEBUG_GC_REAP, 1,
+ EWL_STATE_TRANSIENT);
+ matched++;
+ }
+ else if (!strcmp(argv[i], "--ewl-debug")) {
+ if ((i + 1) < *argc) {
+ ewl_config_int_set(ewl_config,
+ EWL_CONFIG_DEBUG_LEVEL, atoi(argv[i + 1]),
+ EWL_STATE_TRANSIENT);
+ matched++;
+ } else {
+ ewl_config_int_set(ewl_config,
+ EWL_CONFIG_DEBUG_LEVEL, 1,
+ EWL_STATE_TRANSIENT);
+ }
+ ewl_config_int_set(ewl_config,
+ EWL_CONFIG_DEBUG_ENABLE, 1,
+ EWL_STATE_TRANSIENT);
+ matched ++;
+ }
+ else if (!strcmp(argv[i], "--ewl-debug-paint")) {
+ ewl_config_int_set(ewl_config,
+ EWL_CONFIG_DEBUG_EVAS_RENDER, 1,
+ EWL_STATE_TRANSIENT);
+ matched ++;
+ }
+ else if (!strcmp(argv[i], "--ewl-help")) {
+ ewl_print_help();
+ matched ++;
+
+ /* this has to exit. otherwise we end up returning
+ * FALSE from ewl_init which triggers the app to
+ * spit out an error */
+ exit(0);
+ }
+ else if (!strncmp(argv[i], "--ewl-", 6)) {
+ unsigned int len;
+
+ len = strlen("--ewl-");
+ if (strlen(argv[i]) > len)
+ {
+ char *eng;
+ char *name;
+
+ eng = strdup(argv[i] + len);
+
+ while ((name = strchr(eng, '-')))
+ *name = '_';
+
+ ecore_list_first_goto(engines);
+ while ((name = ecore_list_next(engines)))
+ {
+ if (!strcmp(eng, name))
+ {
+ ewl_config_string_set(ewl_config,
+ EWL_CONFIG_ENGINE_NAME, name,
+ EWL_STATE_TRANSIENT);
+ matched ++;
+
+ break;
+ }
+ }
+
+ FREE(eng);
+ }
+ }
+
+ if (matched > 0) {
+ while (matched) {
+ ewl_init_remove_option(argc, argv, i);
+ matched--;
+ }
+ }
+ else
+ i++;
+ }
+ IF_FREE_LIST(engines);
+
+ DRETURN(DLEVEL_STABLE);
}
static void
ewl_init_remove_option(int *argc, char **argv, int i)
{
- int j;
+ int j;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- *argc = *argc - 1;
- for (j = i; j < *argc; j++)
- argv[j] = argv[j + 1];
- argv[j] = NULL;
+ *argc = *argc - 1;
+ for (j = i; j < *argc; j++)
+ argv[j] = argv[j + 1];
+ argv[j] = NULL;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -700,36 +700,36 @@ ewl_init_remove_option(int *argc, char **argv, int i)
void
ewl_print_help(void)
{
- Ecore_List *names;
- char *name;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- printf("EWL Help\n"
- "\t--ewl-backtrace Print a stack trace warnings occur.\n"
- "\t--ewl-debug <level> Set the debugging printf level.\n"
- "\t--ewl-debug-paint Enable repaint debugging.\n"
- "\t--ewl-help Print this help message.\n"
- "\t--ewl-print-gc-reap Print garbage collection stats.\n"
- "\t--ewl-print-theme-keys Print theme keys matched widgets.\n"
- "\t--ewl-print-theme-signals Print theme keys matched widgets.\n"
- "\t--ewl-segv Trigger crash when warning printed.\n"
- "\t--ewl-theme <theme> Set the theme to use for widgets.\n"
- " AVAILABLE ENGINES\n");
-
- names = ewl_engine_names_get();
- while ((name = ecore_list_first_remove(names)))
- {
- char *t;
- while ((t = strchr(name, '_')))
- *t = '-';
-
- printf("\t--ewl-%s\n", name);
- FREE(name);
- }
- IF_FREE_LIST(names);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ecore_List *names;
+ char *name;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ printf("EWL Help\n"
+ "\t--ewl-backtrace Print a stack trace warnings occur.\n"
+ "\t--ewl-debug <level> Set the debugging printf level.\n"
+ "\t--ewl-debug-paint Enable repaint debugging.\n"
+ "\t--ewl-help Print this help message.\n"
+ "\t--ewl-print-gc-reap Print garbage collection stats.\n"
+ "\t--ewl-print-theme-keys Print theme keys matched widgets.\n"
+ "\t--ewl-print-theme-signals Print theme keys matched widgets.\n"
+ "\t--ewl-segv Trigger crash when warning printed.\n"
+ "\t--ewl-theme <theme> Set the theme to use for widgets.\n"
+ " AVAILABLE ENGINES\n");
+
+ names = ewl_engine_names_get();
+ while ((name = ecore_list_first_remove(names)))
+ {
+ char *t;
+ while ((t = strchr(name, '_')))
+ *t = '-';
+
+ printf("\t--ewl-%s\n", name);
+ FREE(name);
+ }
+ IF_FREE_LIST(names);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -742,133 +742,133 @@ ewl_print_help(void)
void
ewl_configure_request(Ewl_Widget * w)
{
- Ewl_Object *o;
- Ewl_Embed *emb;
- Ewl_Widget *search;
- Ewl_Configure_Queue *queue_buffer;
-
- DENTER_FUNCTION(DLEVEL_TESTING);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- if (!VISIBLE(w))
- DRETURN(DLEVEL_STABLE);
-
- o = EWL_OBJECT(w);
-
- /*
- * Widget scheduled for destruction, configuration, or is being called
- * within a configure callback.
- */
- if (ewl_object_queued_has(o, (EWL_FLAG_QUEUED_SCHEDULED_DESTROY |
- EWL_FLAG_QUEUED_SCHEDULED_CONFIGURE |
- EWL_FLAG_QUEUED_PROCESS_CONFIGURE)))
- DRETURN(DLEVEL_STABLE);
-
- /*
- * Check for any parent scheduled for configuration, and look for the
- * top level widget in this branch.
- */
- search = w;
- while (search->parent) {
- search = search->parent;
- if (ewl_object_queued_has(EWL_OBJECT(search),
- EWL_FLAG_QUEUED_SCHEDULED_CONFIGURE))
- DRETURN(DLEVEL_TESTING);
- }
-
- /*
- * Verify top level widget is not queued for configure.
- */
- if (ewl_object_queued_has(EWL_OBJECT(search),
- EWL_FLAG_QUEUED_SCHEDULED_CONFIGURE))
- DRETURN(DLEVEL_TESTING);
-
- /*
- * Stop processing if this widget doesn't have a valid embed parent.
- */
- if (!ewl_object_toplevel_get(EWL_OBJECT(search)))
- DRETURN(DLEVEL_STABLE);
- emb = EWL_EMBED(search);
-
- /*
- * No parent of this widget is queued so add it to the queue. All
- * children widgets should have been removed by this point.
- */
- ewl_object_queued_add(EWL_OBJECT(w), EWL_FLAG_QUEUED_SCHEDULED_CONFIGURE);
-
- queue_buffer = ecore_list_last_goto(configure_active);
-
- /*
- * If the last buffer is full, it's not useful to us and we need a new
- * one.
- */
- if (queue_buffer) {
- if (queue_buffer->end >= EWL_CONFIGURE_QUEUE_SIZE)
- queue_buffer = NULL;
- }
-
- if (!queue_buffer) {
- /*
- * Attempt to use a previously allocated buffer first, fallback
- * to allocating one.
- */
- if (!ecore_list_empty_is(configure_available)) {
- queue_buffer = ecore_list_first_remove(configure_available);
- }
- else {
- queue_buffer = NEW(Ewl_Configure_Queue, 1);
- }
- ecore_list_append(configure_active, queue_buffer);
- }
-
- /*
- * Add the widget to the end of the queue.
- */
- if (queue_buffer)
- queue_buffer->buffer[queue_buffer->end++] = w;
-
- DLEAVE_FUNCTION(DLEVEL_TESTING);
+ Ewl_Object *o;
+ Ewl_Embed *emb;
+ Ewl_Widget *search;
+ Ewl_Configure_Queue *queue_buffer;
+
+ DENTER_FUNCTION(DLEVEL_TESTING);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ if (!VISIBLE(w))
+ DRETURN(DLEVEL_STABLE);
+
+ o = EWL_OBJECT(w);
+
+ /*
+ * Widget scheduled for destruction, configuration, or is being called
+ * within a configure callback.
+ */
+ if (ewl_object_queued_has(o, (EWL_FLAG_QUEUED_SCHEDULED_DESTROY |
+ EWL_FLAG_QUEUED_SCHEDULED_CONFIGURE |
+ EWL_FLAG_QUEUED_PROCESS_CONFIGURE)))
+ DRETURN(DLEVEL_STABLE);
+
+ /*
+ * Check for any parent scheduled for configuration, and look for the
+ * top level widget in this branch.
+ */
+ search = w;
+ while (search->parent) {
+ search = search->parent;
+ if (ewl_object_queued_has(EWL_OBJECT(search),
+ EWL_FLAG_QUEUED_SCHEDULED_CONFIGURE))
+ DRETURN(DLEVEL_TESTING);
+ }
+
+ /*
+ * Verify top level widget is not queued for configure.
+ */
+ if (ewl_object_queued_has(EWL_OBJECT(search),
+ EWL_FLAG_QUEUED_SCHEDULED_CONFIGURE))
+ DRETURN(DLEVEL_TESTING);
+
+ /*
+ * Stop processing if this widget doesn't have a valid embed parent.
+ */
+ if (!ewl_object_toplevel_get(EWL_OBJECT(search)))
+ DRETURN(DLEVEL_STABLE);
+ emb = EWL_EMBED(search);
+
+ /*
+ * No parent of this widget is queued so add it to the queue. All
+ * children widgets should have been removed by this point.
+ */
+ ewl_object_queued_add(EWL_OBJECT(w), EWL_FLAG_QUEUED_SCHEDULED_CONFIGURE);
+
+ queue_buffer = ecore_list_last_goto(configure_active);
+
+ /*
+ * If the last buffer is full, it's not useful to us and we need a new
+ * one.
+ */
+ if (queue_buffer) {
+ if (queue_buffer->end >= EWL_CONFIGURE_QUEUE_SIZE)
+ queue_buffer = NULL;
+ }
+
+ if (!queue_buffer) {
+ /*
+ * Attempt to use a previously allocated buffer first, fallback
+ * to allocating one.
+ */
+ if (!ecore_list_empty_is(configure_available)) {
+ queue_buffer = ecore_list_first_remove(configure_available);
+ }
+ else {
+ queue_buffer = NEW(Ewl_Configure_Queue, 1);
+ }
+ ecore_list_append(configure_active, queue_buffer);
+ }
+
+ /*
+ * Add the widget to the end of the queue.
+ */
+ if (queue_buffer)
+ queue_buffer->buffer[queue_buffer->end++] = w;
+
+ DLEAVE_FUNCTION(DLEVEL_TESTING);
}
static void
ewl_configure_queue_widget_run(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- if (ewl_object_toplevel_get(EWL_OBJECT(w))) {
- ewl_object_size_request(EWL_OBJECT(w),
- ewl_object_current_w_get(EWL_OBJECT(w)),
- ewl_object_current_h_get(EWL_OBJECT(w)));
- }
-
- /*
- * Remove the flag that the widget is scheduled for
- * configuration.
- */
- ewl_object_queued_remove(EWL_OBJECT(w), EWL_FLAG_QUEUED_SCHEDULED_CONFIGURE);
-
- /*
- * Items that are off screen should be queued to give up their
- * evas objects for reuse. Items returning from offscreen are
- * queued to receive new evas objects.
- */
- if (!ewl_widget_onscreen_is(w)) {
- if (REVEALED(w))
- ecore_list_prepend(obscure_list, w);
- }
- else {
- if (!REVEALED(w))
- ecore_list_prepend(reveal_list, w);
-
- ewl_object_queued_add(EWL_OBJECT(w), EWL_FLAG_QUEUED_PROCESS_CONFIGURE);
- if (REALIZED(w) && VISIBLE(w) && REVEALED(w))
- ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
- ewl_object_queued_remove(EWL_OBJECT(w),
- EWL_FLAG_QUEUED_PROCESS_CONFIGURE);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ if (ewl_object_toplevel_get(EWL_OBJECT(w))) {
+ ewl_object_size_request(EWL_OBJECT(w),
+ ewl_object_current_w_get(EWL_OBJECT(w)),
+ ewl_object_current_h_get(EWL_OBJECT(w)));
+ }
+
+ /*
+ * Remove the flag that the widget is scheduled for
+ * configuration.
+ */
+ ewl_object_queued_remove(EWL_OBJECT(w), EWL_FLAG_QUEUED_SCHEDULED_CONFIGURE);
+
+ /*
+ * Items that are off screen should be queued to give up their
+ * evas objects for reuse. Items returning from offscreen are
+ * queued to receive new evas objects.
+ */
+ if (!ewl_widget_onscreen_is(w)) {
+ if (REVEALED(w))
+ ecore_list_prepend(obscure_list, w);
+ }
+ else {
+ if (!REVEALED(w))
+ ecore_list_prepend(reveal_list, w);
+
+ ewl_object_queued_add(EWL_OBJECT(w), EWL_FLAG_QUEUED_PROCESS_CONFIGURE);
+ if (REALIZED(w) && VISIBLE(w) && REVEALED(w))
+ ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
+ ewl_object_queued_remove(EWL_OBJECT(w),
+ EWL_FLAG_QUEUED_PROCESS_CONFIGURE);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -879,30 +879,30 @@ ewl_configure_queue_widget_run(Ewl_Widget *w)
static void
ewl_configure_queue_run(void)
{
- Ewl_Configure_Queue *queue_buffer;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- /*
- * Configure any widgets that need it.
- */
- while ((queue_buffer = ecore_list_first_remove(configure_active))) {
- int i;
- for (i = 0; i < queue_buffer->end; i++) {
- Ewl_Widget *w;
-
- w = queue_buffer->buffer[i];
- ewl_configure_queue_widget_run(w);
- }
-
- /*
- * Add to the available list re-initialized.
- */
- queue_buffer->end = 0;
- ecore_list_prepend(configure_available, queue_buffer);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Configure_Queue *queue_buffer;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ /*
+ * Configure any widgets that need it.
+ */
+ while ((queue_buffer = ecore_list_first_remove(configure_active))) {
+ int i;
+ for (i = 0; i < queue_buffer->end; i++) {
+ Ewl_Widget *w;
+
+ w = queue_buffer->buffer[i];
+ ewl_configure_queue_widget_run(w);
+ }
+
+ /*
+ * Add to the available list re-initialized.
+ */
+ queue_buffer->end = 0;
+ ecore_list_prepend(configure_available, queue_buffer);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -916,29 +916,29 @@ ewl_configure_queue_run(void)
static void
ewl_configure_cancel_request(Ewl_Widget *w)
{
- Ewl_Configure_Queue *queue_buffer;
- DENTER_FUNCTION(DLEVEL_TESTING);
-
- ecore_list_first_goto(configure_active);
- while ((queue_buffer = ecore_list_next(configure_active))) {
- int i;
- for (i = 0; i < queue_buffer->end; i++) {
- Ewl_Widget *tmp;
-
- tmp = queue_buffer->buffer[i];
- if (tmp == w) {
- ewl_object_queued_remove(EWL_OBJECT(w),
- EWL_FLAG_QUEUED_SCHEDULED_CONFIGURE);
- if (i < queue_buffer->end - 1)
- memmove(queue_buffer->buffer + i,
- queue_buffer->buffer + i + 1,
- queue_buffer->end - i - 1);
- queue_buffer->end--;
- }
- }
- }
-
- DLEAVE_FUNCTION(DLEVEL_TESTING);
+ Ewl_Configure_Queue *queue_buffer;
+ DENTER_FUNCTION(DLEVEL_TESTING);
+
+ ecore_list_first_goto(configure_active);
+ while ((queue_buffer = ecore_list_next(configure_active))) {
+ int i;
+ for (i = 0; i < queue_buffer->end; i++) {
+ Ewl_Widget *tmp;
+
+ tmp = queue_buffer->buffer[i];
+ if (tmp == w) {
+ ewl_object_queued_remove(EWL_OBJECT(w),
+ EWL_FLAG_QUEUED_SCHEDULED_CONFIGURE);
+ if (i < queue_buffer->end - 1)
+ memmove(queue_buffer->buffer + i,
+ queue_buffer->buffer + i + 1,
+ queue_buffer->end - i - 1);
+ queue_buffer->end--;
+ }
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_TESTING);
}
/**
@@ -952,29 +952,29 @@ ewl_configure_cancel_request(Ewl_Widget *w)
void
ewl_realize_request(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (ewl_object_queued_has(EWL_OBJECT(w), EWL_FLAG_QUEUED_SCHEDULED_REVEAL))
- DRETURN(DLEVEL_STABLE);
+ if (ewl_object_queued_has(EWL_OBJECT(w), EWL_FLAG_QUEUED_SCHEDULED_REVEAL))
+ DRETURN(DLEVEL_STABLE);
- if (!ewl_object_flags_get(EWL_OBJECT(w), EWL_FLAG_PROPERTY_TOPLEVEL)) {
- Ewl_Object *o = EWL_OBJECT(w->parent);
- if (!o)
- DRETURN(DLEVEL_STABLE);
+ if (!ewl_object_flags_get(EWL_OBJECT(w), EWL_FLAG_PROPERTY_TOPLEVEL)) {
+ Ewl_Object *o = EWL_OBJECT(w->parent);
+ if (!o)
+ DRETURN(DLEVEL_STABLE);
- if (!ewl_object_queued_has(EWL_OBJECT(o),
- EWL_FLAG_QUEUED_PROCESS_REVEAL)) {
- if (!REALIZED(o))
- DRETURN(DLEVEL_STABLE);
- }
- }
+ if (!ewl_object_queued_has(EWL_OBJECT(o),
+ EWL_FLAG_QUEUED_PROCESS_REVEAL)) {
+ if (!REALIZED(o))
+ DRETURN(DLEVEL_STABLE);
+ }
+ }
- ewl_object_queued_add(EWL_OBJECT(w), EWL_FLAG_QUEUED_SCHEDULED_REVEAL);
- ecore_list_append(realize_list, w);
+ ewl_object_queued_add(EWL_OBJECT(w), EWL_FLAG_QUEUED_SCHEDULED_REVEAL);
+ ecore_list_append(realize_list, w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -988,19 +988,19 @@ ewl_realize_request(Ewl_Widget *w)
void
ewl_realize_cancel_request(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_TESTING);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- ecore_list_goto(realize_list, w);
- if (ecore_list_current(realize_list) == w)
- {
- ewl_object_queued_remove(EWL_OBJECT(w),
- EWL_FLAG_QUEUED_SCHEDULED_REVEAL);
- ecore_list_remove(realize_list);
- }
-
- DLEAVE_FUNCTION(DLEVEL_TESTING);
+ DENTER_FUNCTION(DLEVEL_TESTING);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ ecore_list_goto(realize_list, w);
+ if (ecore_list_current(realize_list) == w)
+ {
+ ewl_object_queued_remove(EWL_OBJECT(w),
+ EWL_FLAG_QUEUED_SCHEDULED_REVEAL);
+ ecore_list_remove(realize_list);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_TESTING);
}
/**
@@ -1011,56 +1011,56 @@ ewl_realize_cancel_request(Ewl_Widget *w)
static void
ewl_realize_queue(void)
{
- Ewl_Widget *w;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- /*
- * First realize any widgets that require it, this looping should
- * avoid deep recursion, and works from top to bottom since widgets
- * can't be placed on this list unless their parent has been realized
- * or they are a toplevel widget.
- */
- while ((w = ecore_list_first_remove(realize_list))) {
- if (VISIBLE(w) && !REALIZED(w)) {
- ewl_object_queued_add(EWL_OBJECT(w),
- EWL_FLAG_QUEUED_PROCESS_REVEAL);
- ewl_widget_realize(EWL_WIDGET(w));
- ewl_object_queued_remove(EWL_OBJECT(w),
- EWL_FLAG_QUEUED_PROCESS_REVEAL);
- ecore_list_prepend(child_add_list, w);
- }
- }
-
- /*
- * Work our way back up the chain of widgets to resize from bottom to
- * top.
- */
- while ((w = ecore_list_first_remove(child_add_list))) {
- /*
- * Check visibility in case the realize callback changed it.
- */
- if (VISIBLE(w))
- ewl_callback_call(w, EWL_CALLBACK_SHOW);
-
- /*
- * Give the top level widgets their initial preferred size.
- */
- if (ewl_object_flags_get(EWL_OBJECT(w),
- EWL_FLAG_PROPERTY_TOPLEVEL)) {
- ewl_object_size_request(EWL_OBJECT(w),
- ewl_object_current_w_get(EWL_OBJECT(w)),
- ewl_object_current_h_get(EWL_OBJECT(w)));
- }
-
- /*
- * Indicate widget no longer on the realize queue.
- */
- ewl_object_queued_remove(EWL_OBJECT(w),
- EWL_FLAG_QUEUED_SCHEDULED_REVEAL);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Widget *w;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ /*
+ * First realize any widgets that require it, this looping should
+ * avoid deep recursion, and works from top to bottom since widgets
+ * can't be placed on this list unless their parent has been realized
+ * or they are a toplevel widget.
+ */
+ while ((w = ecore_list_first_remove(realize_list))) {
+ if (VISIBLE(w) && !REALIZED(w)) {
+ ewl_object_queued_add(EWL_OBJECT(w),
+ EWL_FLAG_QUEUED_PROCESS_REVEAL);
+ ewl_widget_realize(EWL_WIDGET(w));
+ ewl_object_queued_remove(EWL_OBJECT(w),
+ EWL_FLAG_QUEUED_PROCESS_REVEAL);
+ ecore_list_prepend(child_add_list, w);
+ }
+ }
+
+ /*
+ * Work our way back up the chain of widgets to resize from bottom to
+ * top.
+ */
+ while ((w = ecore_list_first_remove(child_add_list))) {
+ /*
+ * Check visibility in case the realize callback changed it.
+ */
+ if (VISIBLE(w))
+ ewl_callback_call(w, EWL_CALLBACK_SHOW);
+
+ /*
+ * Give the top level widgets their initial preferred size.
+ */
+ if (ewl_object_flags_get(EWL_OBJECT(w),
+ EWL_FLAG_PROPERTY_TOPLEVEL)) {
+ ewl_object_size_request(EWL_OBJECT(w),
+ ewl_object_current_w_get(EWL_OBJECT(w)),
+ ewl_object_current_h_get(EWL_OBJECT(w)));
+ }
+
+ /*
+ * Indicate widget no longer on the realize queue.
+ */
+ ewl_object_queued_remove(EWL_OBJECT(w),
+ EWL_FLAG_QUEUED_SCHEDULED_REVEAL);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1075,29 +1075,29 @@ ewl_realize_queue(void)
void
ewl_destroy_request(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
- if (DESTROYED(w))
- DRETURN(DLEVEL_STABLE);
+ if (DESTROYED(w))
+ DRETURN(DLEVEL_STABLE);
- if (CONFIGURED(w))
- ewl_configure_cancel_request(w);
+ if (CONFIGURED(w))
+ ewl_configure_cancel_request(w);
- ewl_object_queued_add(EWL_OBJECT(w), EWL_FLAG_QUEUED_SCHEDULED_DESTROY);
+ ewl_object_queued_add(EWL_OBJECT(w), EWL_FLAG_QUEUED_SCHEDULED_DESTROY);
- /*
- * Must prepend to ensure children are freed before parents.
- */
- ecore_list_prepend(destroy_list, w);
+ /*
+ * Must prepend to ensure children are freed before parents.
+ */
+ ecore_list_prepend(destroy_list, w);
- /*
- * Schedule child widgets for destruction.
- */
- if (ewl_object_recursive_get(EWL_OBJECT(w)))
- ewl_container_destroy(EWL_CONTAINER(w));
+ /*
+ * Schedule child widgets for destruction.
+ */
+ if (ewl_object_recursive_get(EWL_OBJECT(w)))
+ ewl_container_destroy(EWL_CONTAINER(w));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1109,12 +1109,12 @@ ewl_destroy_request(Ewl_Widget *w)
void
ewl_canvas_destroy(void *evas)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(evas);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(evas);
- ecore_list_append(free_evas_list, evas);
+ ecore_list_append(free_evas_list, evas);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1126,12 +1126,12 @@ ewl_canvas_destroy(void *evas)
void
ewl_canvas_object_destroy(void *obj)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(obj);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(obj);
- ecore_list_append(free_evas_object_list, obj);
+ ecore_list_append(free_evas_object_list, obj);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
#define EWL_GC_LIMIT 300
@@ -1145,75 +1145,75 @@ ewl_canvas_object_destroy(void *obj)
static int
ewl_garbage_collect_idler(void *data __UNUSED__)
{
- Evas *evas;
- Ewl_Widget *w;
- Evas_Object *obj;
- int cleanup;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- cleanup = 0;
- if (ewl_config_cache.gc_reap) printf("---\n");
-
- while ((cleanup < EWL_GC_LIMIT) &&
- (w = ecore_list_first_remove(destroy_list))) {
- if (ewl_object_queued_has(EWL_OBJECT(w),
- EWL_FLAG_QUEUED_SCHEDULED_CONFIGURE))
- ewl_configure_cancel_request(w);
-
- ewl_callback_call(w, EWL_CALLBACK_DESTROY);
- ewl_callback_del_type(w, EWL_CALLBACK_DESTROY);
- ewl_widget_free(w);
- cleanup++;
- }
-
- if (ewl_config_cache.gc_reap)
- printf("Destroyed %d EWL objects\n", cleanup);
- cleanup = 0;
-
- while ((obj = ecore_list_first_remove(free_evas_object_list))) {
- evas_object_del(obj);
- cleanup++;
- }
-
- if (ewl_config_cache.gc_reap)
- printf("Destroyed %d Evas Objects\n", cleanup);
- cleanup = 0;
-
- /* make sure the widget and object lists are clear before trying to
- * remove the evas canvas */
- if ((ecore_list_count(free_evas_object_list) == 0)
- && (ecore_list_count(destroy_list) == 0)) {
- while ((evas = ecore_list_first_remove(free_evas_list))) {
- evas_free(evas);
- cleanup++;
- }
- }
-
- if (ewl_config_cache.gc_reap)
- printf("Destroyed %d Evas\n---\n", cleanup);
-
- /* We set the ewl_garbage_collect to NULL because when we return 0
- * (because destroy_list is empty) ecore will cleanup the idler
- * memory for us. */
- if (!ecore_list_count(destroy_list))
- ewl_garbage_collect = NULL;
-
- DRETURN_INT(ecore_list_count(destroy_list), DLEVEL_STABLE);
+ Evas *evas;
+ Ewl_Widget *w;
+ Evas_Object *obj;
+ int cleanup;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ cleanup = 0;
+ if (ewl_config_cache.gc_reap) printf("---\n");
+
+ while ((cleanup < EWL_GC_LIMIT) &&
+ (w = ecore_list_first_remove(destroy_list))) {
+ if (ewl_object_queued_has(EWL_OBJECT(w),
+ EWL_FLAG_QUEUED_SCHEDULED_CONFIGURE))
+ ewl_configure_cancel_request(w);
+
+ ewl_callback_call(w, EWL_CALLBACK_DESTROY);
+ ewl_callback_del_type(w, EWL_CALLBACK_DESTROY);
+ ewl_widget_free(w);
+ cleanup++;
+ }
+
+ if (ewl_config_cache.gc_reap)
+ printf("Destroyed %d EWL objects\n", cleanup);
+ cleanup = 0;
+
+ while ((obj = ecore_list_first_remove(free_evas_object_list))) {
+ evas_object_del(obj);
+ cleanup++;
+ }
+
+ if (ewl_config_cache.gc_reap)
+ printf("Destroyed %d Evas Objects\n", cleanup);
+ cleanup = 0;
+
+ /* make sure the widget and object lists are clear before trying to
+ * remove the evas canvas */
+ if ((ecore_list_count(free_evas_object_list) == 0)
+ && (ecore_list_count(destroy_list) == 0)) {
+ while ((evas = ecore_list_first_remove(free_evas_list))) {
+ evas_free(evas);
+ cleanup++;
+ }
+ }
+
+ if (ewl_config_cache.gc_reap)
+ printf("Destroyed %d Evas\n---\n", cleanup);
+
+ /* We set the ewl_garbage_collect to NULL because when we return 0
+ * (because destroy_list is empty) ecore will cleanup the idler
+ * memory for us. */
+ if (!ecore_list_count(destroy_list))
+ ewl_garbage_collect = NULL;
+
+ DRETURN_INT(ecore_list_count(destroy_list), DLEVEL_STABLE);
}
#ifdef DEBUG_MALLOCDEBUG
char *
strdup(const char *str)
{
- char *dst;
+ char *dst;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- dst = malloc(strlen(str) + 1);
- if (dst) strcpy(dst, str);
+ dst = malloc(strlen(str) + 1);
+ if (dst) strcpy(dst, str);
- DRETURN_PTR(dst, DLEVEL_STABLE);
+ DRETURN_PTR(dst, DLEVEL_STABLE);
}
#endif
@@ -1226,18 +1226,18 @@ strdup(const char *str)
void
ewl_debug_indent_print(int mod_dir)
{
- int indent;
- static int ewl_debug_indent_lvl = 0;
+ int indent;
+ static int ewl_debug_indent_lvl = 0;
- if (mod_dir < 0) ewl_debug_indent_lvl --;
+ if (mod_dir < 0) ewl_debug_indent_lvl --;
- if (ewl_debug_indent_lvl < 0)
- ewl_debug_indent_lvl = 0;
+ if (ewl_debug_indent_lvl < 0)
+ ewl_debug_indent_lvl = 0;
- for (indent = 0; indent < (ewl_debug_indent_lvl << 1) + 2; indent++)
- fputc(' ', stderr);
+ for (indent = 0; indent < (ewl_debug_indent_lvl << 1) + 2; indent++)
+ fputc(' ', stderr);
- if (mod_dir > 0) ewl_debug_indent_lvl ++;
+ if (mod_dir > 0) ewl_debug_indent_lvl ++;
}
/**
@@ -1249,12 +1249,12 @@ ewl_debug_indent_print(int mod_dir)
void
ewl_shutdown_add(Ewl_Shutdown_Hook hook)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(hook);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(hook);
- ecore_list_prepend(shutdown_hooks, hook);
+ ecore_list_prepend(shutdown_hooks, hook);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_misc.h b/src/lib/ewl_misc.h
index ddd402e..4cde683 100644
--- a/src/lib/ewl_misc.h
+++ b/src/lib/ewl_misc.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_MISC_H
#define EWL_MISC_H
@@ -16,20 +16,20 @@
*/
typedef void (*Ewl_Shutdown_Hook)(void);
-int ewl_init(int *argc, char **argv);
-void ewl_print_help(void);
-int ewl_shutdown(void);
-void ewl_main(void);
+int ewl_init(int *argc, char **argv);
+void ewl_print_help(void);
+int ewl_shutdown(void);
+void ewl_main(void);
void ewl_main_iterate(void);
-void ewl_main_quit(void);
-void ewl_configure_request(Ewl_Widget *w);
-void ewl_realize_request(Ewl_Widget *w);
-void ewl_realize_cancel_request(Ewl_Widget *w);
-void ewl_destroy_request(Ewl_Widget *w);
-void ewl_canvas_destroy(void *evas);
-void ewl_canvas_object_destroy(void *obj);
-void ewl_debug_indent_print(int mod_dir);
-void ewl_shutdown_add(Ewl_Shutdown_Hook hook);
+void ewl_main_quit(void);
+void ewl_configure_request(Ewl_Widget *w);
+void ewl_realize_request(Ewl_Widget *w);
+void ewl_realize_cancel_request(Ewl_Widget *w);
+void ewl_destroy_request(Ewl_Widget *w);
+void ewl_canvas_destroy(void *evas);
+void ewl_canvas_object_destroy(void *obj);
+void ewl_debug_indent_print(int mod_dir);
+void ewl_shutdown_add(Ewl_Shutdown_Hook hook);
/*
* Internal stuff
diff --git a/src/lib/ewl_model.c b/src/lib/ewl_model.c
index dc03cdb..a1f0b3a 100644
--- a/src/lib/ewl_model.c
+++ b/src/lib/ewl_model.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_model.h"
#include "ewl_macros.h"
@@ -12,18 +12,18 @@
Ewl_Model *
ewl_model_new(void)
{
- Ewl_Model *model;
+ Ewl_Model *model;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- model = NEW(Ewl_Model, 1);
- if (!ewl_model_init(model))
- {
- FREE(model);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ model = NEW(Ewl_Model, 1);
+ if (!ewl_model_init(model))
+ {
+ FREE(model);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(model, DLEVEL_STABLE);
+ DRETURN_PTR(model, DLEVEL_STABLE);
}
/**
@@ -34,18 +34,18 @@ ewl_model_new(void)
Ewl_Model *
ewl_model_ecore_list_instance(void)
{
- Ewl_Model *model;
+ Ewl_Model *model;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- model = ewl_model_new();
- if (model)
- {
- ewl_model_data_fetch_set(model, ewl_model_cb_ecore_list_fetch);
- ewl_model_data_count_set(model, ewl_model_cb_ecore_list_count);
- }
+ model = ewl_model_new();
+ if (model)
+ {
+ ewl_model_data_fetch_set(model, ewl_model_cb_ecore_list_fetch);
+ ewl_model_data_count_set(model, ewl_model_cb_ecore_list_count);
+ }
- DRETURN_PTR(model, DLEVEL_STABLE);
+ DRETURN_PTR(model, DLEVEL_STABLE);
}
/**
@@ -56,10 +56,10 @@ ewl_model_ecore_list_instance(void)
int
ewl_model_init(Ewl_Model *model)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(model, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(model, FALSE);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -71,12 +71,12 @@ ewl_model_init(Ewl_Model *model)
void
ewl_model_data_header_fetch_set(Ewl_Model *m, Ewl_Model_Data_Header_Fetch get)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(m);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(m);
- m->header = get;
+ m->header = get;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -87,10 +87,10 @@ ewl_model_data_header_fetch_set(Ewl_Model *m, Ewl_Model_Data_Header_Fetch get)
Ewl_Model_Data_Header_Fetch
ewl_model_data_header_fetch_get(const Ewl_Model *m)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(m, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(m, NULL);
- DRETURN_PTR(m->header, DLEVEL_STABLE);
+ DRETURN_PTR(m->header, DLEVEL_STABLE);
}
/**
@@ -102,12 +102,12 @@ ewl_model_data_header_fetch_get(const Ewl_Model *m)
void
ewl_model_data_fetch_set(Ewl_Model *m, Ewl_Model_Data_Fetch get)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(m);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(m);
- m->fetch = get;
+ m->fetch = get;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -118,10 +118,10 @@ ewl_model_data_fetch_set(Ewl_Model *m, Ewl_Model_Data_Fetch get)
Ewl_Model_Data_Fetch
ewl_model_data_fetch_get(const Ewl_Model *m)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(m, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(m, NULL);
- DRETURN_PTR(m->fetch, DLEVEL_STABLE);
+ DRETURN_PTR(m->fetch, DLEVEL_STABLE);
}
/**
@@ -133,12 +133,12 @@ ewl_model_data_fetch_get(const Ewl_Model *m)
void
ewl_model_column_sortable_set(Ewl_Model *m, Ewl_Model_Column_Sortable sortable)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(m);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(m);
- m->sortable = sortable;
+ m->sortable = sortable;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -149,10 +149,10 @@ ewl_model_column_sortable_set(Ewl_Model *m, Ewl_Model_Column_Sortable sortable)
Ewl_Model_Column_Sortable
ewl_model_column_sortable_get(const Ewl_Model *m)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(m, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(m, NULL);
- DRETURN_PTR(m->sortable, DLEVEL_STABLE);
+ DRETURN_PTR(m->sortable, DLEVEL_STABLE);
}
/**
@@ -164,12 +164,12 @@ ewl_model_column_sortable_get(const Ewl_Model *m)
void
ewl_model_data_sort_set(Ewl_Model *m, Ewl_Model_Data_Sort sort)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(m);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(m);
- m->sort = sort;
+ m->sort = sort;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -180,10 +180,10 @@ ewl_model_data_sort_set(Ewl_Model *m, Ewl_Model_Data_Sort sort)
Ewl_Model_Data_Sort
ewl_model_data_sort_get(const Ewl_Model *m)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(m, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(m, NULL);
- DRETURN_PTR(m->sort, DLEVEL_STABLE);
+ DRETURN_PTR(m->sort, DLEVEL_STABLE);
}
/**
@@ -195,12 +195,12 @@ ewl_model_data_sort_get(const Ewl_Model *m)
void
ewl_model_data_highlight_set(Ewl_Model *m, Ewl_Model_Data_Highlight highlight)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(m);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(m);
- m->highlight = highlight;
+ m->highlight = highlight;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -211,10 +211,10 @@ ewl_model_data_highlight_set(Ewl_Model *m, Ewl_Model_Data_Highlight highlight)
Ewl_Model_Data_Highlight
ewl_model_data_highlight_get(const Ewl_Model *m)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(m, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(m, NULL);
- DRETURN_PTR(m->highlight, DLEVEL_STABLE);
+ DRETURN_PTR(m->highlight, DLEVEL_STABLE);
}
/**
@@ -226,12 +226,12 @@ ewl_model_data_highlight_get(const Ewl_Model *m)
void
ewl_model_data_count_set(Ewl_Model *m, Ewl_Model_Data_Count count)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(m);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(m);
- m->count = count;
+ m->count = count;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -243,10 +243,10 @@ ewl_model_data_count_set(Ewl_Model *m, Ewl_Model_Data_Count count)
Ewl_Model_Data_Count
ewl_model_data_count_get(const Ewl_Model *m)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(m, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(m, NULL);
- DRETURN_PTR(m->count, DLEVEL_STABLE);
+ DRETURN_PTR(m->count, DLEVEL_STABLE);
}
/**
@@ -258,12 +258,12 @@ ewl_model_data_count_get(const Ewl_Model *m)
void
ewl_model_data_unref_set(Ewl_Model *m, Ewl_Model_Data_Unref unref)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(m);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(m);
- m->unref = unref;
+ m->unref = unref;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -275,10 +275,10 @@ ewl_model_data_unref_set(Ewl_Model *m, Ewl_Model_Data_Unref unref)
Ewl_Model_Data_Unref
ewl_model_data_unref_get(const Ewl_Model *m)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(m, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(m, NULL);
- DRETURN_PTR(m->unref, DLEVEL_STABLE);
+ DRETURN_PTR(m->unref, DLEVEL_STABLE);
}
/**
@@ -290,12 +290,12 @@ ewl_model_data_unref_get(const Ewl_Model *m)
void
ewl_model_data_expandable_set(Ewl_Model *m, Ewl_Model_Data_Expandable exp)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(m);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(m);
- m->expansion.is = exp;
+ m->expansion.is = exp;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -306,10 +306,10 @@ ewl_model_data_expandable_set(Ewl_Model *m, Ewl_Model_Data_Expandable exp)
Ewl_Model_Data_Expandable
ewl_model_data_expandable_get(const Ewl_Model *m)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(m, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(m, NULL);
- DRETURN_PTR(m->expansion.is, DLEVEL_STABLE);
+ DRETURN_PTR(m->expansion.is, DLEVEL_STABLE);
}
/**
@@ -320,14 +320,14 @@ ewl_model_data_expandable_get(const Ewl_Model *m)
*/
void
ewl_model_expansion_data_fetch_set(Ewl_Model *m,
- Ewl_Model_Expansion_Data_Fetch get)
+ Ewl_Model_Expansion_Data_Fetch get)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(m);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(m);
- m->expansion.data = get;
+ m->expansion.data = get;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -338,10 +338,10 @@ ewl_model_expansion_data_fetch_set(Ewl_Model *m,
Ewl_Model_Expansion_Data_Fetch
ewl_model_expansion_data_fetch_get(const Ewl_Model *m)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(m, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(m, NULL);
- DRETURN_PTR(m->expansion.data, DLEVEL_STABLE);
+ DRETURN_PTR(m->expansion.data, DLEVEL_STABLE);
}
/**
@@ -357,12 +357,12 @@ ewl_model_expansion_data_fetch_get(const Ewl_Model *m)
void
ewl_model_data_free_set(Ewl_Model *m, Ewl_Model_Data_Free data_free)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(m);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(m);
- m->data_free = data_free;
+ m->data_free = data_free;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -374,10 +374,10 @@ ewl_model_data_free_set(Ewl_Model *m, Ewl_Model_Data_Free data_free)
Ewl_Model_Data_Free
ewl_model_data_free_get(const Ewl_Model *m)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(m, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(m, NULL);
- DRETURN_PTR(m->data_free, DLEVEL_STABLE);
+ DRETURN_PTR(m->data_free, DLEVEL_STABLE);
}
/**
@@ -388,14 +388,14 @@ ewl_model_data_free_get(const Ewl_Model *m)
*/
void
ewl_model_expansion_model_fetch_set(Ewl_Model *m,
- Ewl_Model_Expansion_Model_Fetch f)
+ Ewl_Model_Expansion_Model_Fetch f)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(m);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(m);
- m->expansion.model = f;
+ m->expansion.model = f;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -406,10 +406,10 @@ ewl_model_expansion_model_fetch_set(Ewl_Model *m,
Ewl_Model_Expansion_Model_Fetch
ewl_model_expansion_model_fetch_get(const Ewl_Model *m)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(m, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(m, NULL);
- DRETURN_PTR(m->expansion.model, DLEVEL_STABLE);
+ DRETURN_PTR(m->expansion.model, DLEVEL_STABLE);
}
/**
@@ -421,17 +421,17 @@ ewl_model_expansion_model_fetch_get(const Ewl_Model *m)
*/
void *
ewl_model_cb_ecore_list_fetch(void *data, unsigned int row,
- unsigned int col __UNUSED__)
+ unsigned int col __UNUSED__)
{
- Ecore_List *list;
+ Ecore_List *list;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, NULL);
- list = data;
- ecore_list_index_goto(list, row);
+ list = data;
+ ecore_list_index_goto(list, row);
- DRETURN_PTR(ecore_list_current(list), DLEVEL_STABLE);
+ DRETURN_PTR(ecore_list_current(list), DLEVEL_STABLE);
}
/**
@@ -442,13 +442,13 @@ ewl_model_cb_ecore_list_fetch(void *data, unsigned int row,
unsigned int
ewl_model_cb_ecore_list_count(void *data)
{
- Ecore_List *list;
+ Ecore_List *list;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, 0);
- list = data;
+ list = data;
- DRETURN_INT(ecore_list_count(list), DLEVEL_STABLE);
+ DRETURN_INT(ecore_list_count(list), DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_model.h b/src/lib/ewl_model.h
index 7b1327f..6b342e0 100644
--- a/src/lib/ewl_model.h
+++ b/src/lib/ewl_model.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_MODEL_H
#define EWL_MODEL_H
@@ -26,7 +26,7 @@ typedef struct Ewl_Model Ewl_Model;
* A typedef to shorten the definition of the model_fetch callbacks.
*/
typedef void *(*Ewl_Model_Data_Fetch)(void *data, unsigned int row,
- unsigned int column);
+ unsigned int column);
/**
* @def EWL_MODEL_FREE(f)
@@ -84,7 +84,7 @@ typedef void *(*Ewl_Model_Data_Header_Fetch)(void *data, unsigned int col);
* callback
*/
typedef Ewl_Model *(*Ewl_Model_Expansion_Model_Fetch)(void *data,
- unsigned int row);
+ unsigned int row);
/**
* @def EWL_MODEL_DATA_SORT(f)
@@ -97,7 +97,7 @@ typedef Ewl_Model *(*Ewl_Model_Expansion_Model_Fetch)(void *data,
* A typedef to shorten the definition of the model_sort callbacks.
*/
typedef void (*Ewl_Model_Data_Sort)(void *data, unsigned int column,
- Ewl_Sort_Direction sort);
+ Ewl_Sort_Direction sort);
/**
* @def EWL_MODEL_DATA_COUNT(f)
@@ -156,78 +156,78 @@ typedef unsigned int (*Ewl_Model_Data_Highlight)(void *data, unsigned int row);
*/
struct Ewl_Model
{
- struct
- {
- Ewl_Model_Data_Expandable is; /**< Is the row expandable */
- Ewl_Model_Expansion_Data_Fetch data; /**< Get expansion data */
- Ewl_Model_Expansion_Model_Fetch model; /**< Get expansion model */
- } expansion;
-
- Ewl_Model_Column_Sortable sortable; /**< Is a column sortable */
-
- Ewl_Model_Data_Header_Fetch header; /**< Retrieve header data */
- Ewl_Model_Data_Fetch fetch; /**< Retrieve data for a cell */
- Ewl_Model_Data_Free data_free; /**< Free data passed to view */
- Ewl_Model_Data_Count count; /**< Count of data items */
- Ewl_Model_Data_Unref unref; /**< Unreference the data */
- Ewl_Model_Data_Sort sort; /**< Trigger sort on column */
- Ewl_Model_Data_Highlight highlight; /**< Highlight the cell */
+ struct
+ {
+ Ewl_Model_Data_Expandable is; /**< Is the row expandable */
+ Ewl_Model_Expansion_Data_Fetch data; /**< Get expansion data */
+ Ewl_Model_Expansion_Model_Fetch model; /**< Get expansion model */
+ } expansion;
+
+ Ewl_Model_Column_Sortable sortable; /**< Is a column sortable */
+
+ Ewl_Model_Data_Header_Fetch header; /**< Retrieve header data */
+ Ewl_Model_Data_Fetch fetch; /**< Retrieve data for a cell */
+ Ewl_Model_Data_Free data_free; /**< Free data passed to view */
+ Ewl_Model_Data_Count count; /**< Count of data items */
+ Ewl_Model_Data_Unref unref; /**< Unreference the data */
+ Ewl_Model_Data_Sort sort; /**< Trigger sort on column */
+ Ewl_Model_Data_Highlight highlight; /**< Highlight the cell */
};
-Ewl_Model *ewl_model_new(void);
-int ewl_model_init(Ewl_Model *model);
+Ewl_Model *ewl_model_new(void);
+int ewl_model_init(Ewl_Model *model);
-Ewl_Model *ewl_model_ecore_list_instance(void);
+Ewl_Model *ewl_model_ecore_list_instance(void);
-void ewl_model_data_fetch_set(Ewl_Model *m,
- Ewl_Model_Data_Fetch get);
-Ewl_Model_Data_Fetch ewl_model_data_fetch_get(const Ewl_Model *m);
+void ewl_model_data_fetch_set(Ewl_Model *m,
+ Ewl_Model_Data_Fetch get);
+Ewl_Model_Data_Fetch ewl_model_data_fetch_get(const Ewl_Model *m);
-void ewl_model_data_header_fetch_set(Ewl_Model *m,
- Ewl_Model_Data_Header_Fetch get);
+void ewl_model_data_header_fetch_set(Ewl_Model *m,
+ Ewl_Model_Data_Header_Fetch get);
Ewl_Model_Data_Header_Fetch ewl_model_data_header_fetch_get(const Ewl_Model *m);
-void ewl_model_data_free_set(Ewl_Model *m,
- Ewl_Model_Data_Free assign);
-Ewl_Model_Data_Free ewl_model_data_free_get(const Ewl_Model *m);
+void ewl_model_data_free_set(Ewl_Model *m,
+ Ewl_Model_Data_Free assign);
+Ewl_Model_Data_Free ewl_model_data_free_get(const Ewl_Model *m);
-void ewl_model_column_sortable_set(Ewl_Model *m,
- Ewl_Model_Column_Sortable sortable);
+void ewl_model_column_sortable_set(Ewl_Model *m,
+ Ewl_Model_Column_Sortable sortable);
Ewl_Model_Column_Sortable ewl_model_column_sortable_get(const Ewl_Model *m);
-void ewl_model_data_sort_set(Ewl_Model *m,
- Ewl_Model_Data_Sort sort);
-Ewl_Model_Data_Sort ewl_model_data_sort_get(const Ewl_Model *m);
+void ewl_model_data_sort_set(Ewl_Model *m,
+ Ewl_Model_Data_Sort sort);
+Ewl_Model_Data_Sort ewl_model_data_sort_get(const Ewl_Model *m);
-void ewl_model_data_highlight_set(Ewl_Model *m,
- Ewl_Model_Data_Highlight highlight);
+void ewl_model_data_highlight_set(Ewl_Model *m,
+ Ewl_Model_Data_Highlight highlight);
Ewl_Model_Data_Highlight ewl_model_data_highlight_get(const Ewl_Model *m);
-void ewl_model_data_count_set(Ewl_Model *m,
- Ewl_Model_Data_Count count);
-Ewl_Model_Data_Count ewl_model_data_count_get(const Ewl_Model *m);
+void ewl_model_data_count_set(Ewl_Model *m,
+ Ewl_Model_Data_Count count);
+Ewl_Model_Data_Count ewl_model_data_count_get(const Ewl_Model *m);
-void ewl_model_data_unref_set(Ewl_Model *m,
- Ewl_Model_Data_Unref unref);
-Ewl_Model_Data_Unref ewl_model_data_unref_get(const Ewl_Model *m);
+void ewl_model_data_unref_set(Ewl_Model *m,
+ Ewl_Model_Data_Unref unref);
+Ewl_Model_Data_Unref ewl_model_data_unref_get(const Ewl_Model *m);
-void ewl_model_data_expandable_set(Ewl_Model *m,
- Ewl_Model_Data_Expandable exp);
+void ewl_model_data_expandable_set(Ewl_Model *m,
+ Ewl_Model_Data_Expandable exp);
Ewl_Model_Data_Expandable ewl_model_data_expandable_get(const Ewl_Model *m);
-void ewl_model_expansion_data_fetch_set(Ewl_Model *m,
- Ewl_Model_Expansion_Data_Fetch get);
+void ewl_model_expansion_data_fetch_set(Ewl_Model *m,
+ Ewl_Model_Expansion_Data_Fetch get);
Ewl_Model_Expansion_Data_Fetch ewl_model_expansion_data_fetch_get(const Ewl_Model *m);
-void ewl_model_expansion_model_fetch_set(Ewl_Model *m,
- Ewl_Model_Expansion_Model_Fetch f);
+void ewl_model_expansion_model_fetch_set(Ewl_Model *m,
+ Ewl_Model_Expansion_Model_Fetch f);
Ewl_Model_Expansion_Model_Fetch ewl_model_expansion_model_fetch_get(const Ewl_Model *m);
/*
* Internal stuff.
*/
void *ewl_model_cb_ecore_list_fetch(void *data, unsigned int row,
- unsigned int col);
+ unsigned int col);
unsigned int ewl_model_cb_ecore_list_count(void *data);
/**
diff --git a/src/lib/ewl_mvc.c b/src/lib/ewl_mvc.c
index e4e7872..5a30221 100644
--- a/src/lib/ewl_mvc.c
+++ b/src/lib/ewl_mvc.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_mvc.h"
#include "ewl_private.h"
@@ -7,27 +7,27 @@
static void ewl_mvc_selected_clear_private(Ewl_MVC *mvc);
static unsigned int ewl_mvc_selected_goto(Ewl_MVC *mvc,
- unsigned int row, unsigned int column);
+ unsigned int row, unsigned int column);
static void ewl_mvc_selected_insert(Ewl_MVC *mvc, const Ewl_Model *model,
- void *data, Ewl_Selection *sel,
- unsigned int row, unsigned int column);
+ void *data, Ewl_Selection *sel,
+ unsigned int row, unsigned int column);
static void ewl_mvc_selected_range_split(Ewl_MVC *mvc,
- Ewl_Selection_Range *range,
- unsigned int row, unsigned int column);
+ Ewl_Selection_Range *range,
+ unsigned int row, unsigned int column);
static int ewl_mvc_selection_intersects(Ewl_Selection_Range *range,
- Ewl_Selection *sel);
+ Ewl_Selection *sel);
static int ewl_mvc_selection_contained(Ewl_Selection_Range *a,
- Ewl_Selection_Range *b);
+ Ewl_Selection_Range *b);
static int ewl_mvc_line_intersects(int astart, int aend, int bstart, int bend);
static void ewl_mvc_range_merge(Ecore_List *list, const Ewl_Model *model, void *data,
- Ewl_Selection_Range *range, Ewl_Selection_Range *cur);
+ Ewl_Selection_Range *range, Ewl_Selection_Range *cur);
static Ewl_Selection *ewl_mvc_selection_make(const Ewl_Model *model, void *data,
- unsigned int top, unsigned int left,
- unsigned int bottom, unsigned int right);
+ unsigned int top, unsigned int left,
+ unsigned int bottom, unsigned int right);
static void ewl_mvc_selected_change_notify(Ewl_MVC *mvc);
static void ewl_mvc_highlight_do(Ewl_MVC *mvc, Ewl_Container *c,
- Ewl_Selection *sel, Ewl_Widget *w);
+ Ewl_Selection *sel, Ewl_Widget *w);
static void ewl_mvc_cb_highlight_destroy(Ewl_Widget *w, void *ev, void *data);
static void ewl_mvc_cb_sel_free(void *data);
static void ewl_mvc_selection_free(Ewl_Selection *sel);
@@ -40,23 +40,23 @@ static void ewl_mvc_selection_free(Ewl_Selection *sel);
int
ewl_mvc_init(Ewl_MVC *mvc)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(mvc, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(mvc, FALSE);
- if (!ewl_box_init(EWL_BOX(mvc)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_box_init(EWL_BOX(mvc)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_inherit(EWL_WIDGET(mvc), EWL_MVC_TYPE);
- ewl_box_orientation_set(EWL_BOX(mvc), EWL_ORIENTATION_VERTICAL);
+ ewl_widget_inherit(EWL_WIDGET(mvc), EWL_MVC_TYPE);
+ ewl_box_orientation_set(EWL_BOX(mvc), EWL_ORIENTATION_VERTICAL);
- ewl_callback_append(EWL_WIDGET(mvc), EWL_CALLBACK_DESTROY,
- ewl_mvc_cb_destroy, NULL);
- ewl_callback_append(EWL_WIDGET(mvc), EWL_CALLBACK_DESTROY,
- ewl_mvc_cb_data_unref, NULL);
+ ewl_callback_append(EWL_WIDGET(mvc), EWL_CALLBACK_DESTROY,
+ ewl_mvc_cb_destroy, NULL);
+ ewl_callback_append(EWL_WIDGET(mvc), EWL_CALLBACK_DESTROY,
+ ewl_mvc_cb_data_unref, NULL);
- ewl_mvc_selection_mode_set(mvc, EWL_SELECTION_MODE_SINGLE);
+ ewl_mvc_selection_mode_set(mvc, EWL_SELECTION_MODE_SINGLE);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -68,21 +68,21 @@ ewl_mvc_init(Ewl_MVC *mvc)
void
ewl_mvc_view_set(Ewl_MVC *mvc, const Ewl_View *view)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(mvc);
- DCHECK_PARAM_PTR(view);
- DCHECK_TYPE(mvc, EWL_MVC_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(mvc);
+ DCHECK_PARAM_PTR(view);
+ DCHECK_TYPE(mvc, EWL_MVC_TYPE);
- if (mvc->view == view)
- DRETURN(DLEVEL_STABLE);
+ if (mvc->view == view)
+ DRETURN(DLEVEL_STABLE);
- mvc->view = view;
- if (mvc->cb.view_change)
- mvc->cb.view_change(mvc);
+ mvc->view = view;
+ if (mvc->cb.view_change)
+ mvc->cb.view_change(mvc);
- ewl_mvc_dirty_set(mvc, TRUE);
+ ewl_mvc_dirty_set(mvc, TRUE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -93,11 +93,11 @@ ewl_mvc_view_set(Ewl_MVC *mvc, const Ewl_View *view)
const Ewl_View *
ewl_mvc_view_get(Ewl_MVC *mvc)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(mvc, NULL);
- DCHECK_TYPE_RET(mvc, EWL_MVC_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(mvc, NULL);
+ DCHECK_TYPE_RET(mvc, EWL_MVC_TYPE, NULL);
- DRETURN_PTR(mvc->view, DLEVEL_STABLE);
+ DRETURN_PTR(mvc->view, DLEVEL_STABLE);
}
/**
@@ -110,13 +110,13 @@ ewl_mvc_view_get(Ewl_MVC *mvc)
void
ewl_mvc_view_change_cb_set(Ewl_MVC *mvc, void (*cb)(Ewl_MVC *mvc))
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(mvc);
- DCHECK_TYPE(mvc, EWL_MVC_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(mvc);
+ DCHECK_TYPE(mvc, EWL_MVC_TYPE);
- mvc->cb.view_change = cb;
+ mvc->cb.view_change = cb;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -128,18 +128,18 @@ ewl_mvc_view_change_cb_set(Ewl_MVC *mvc, void (*cb)(Ewl_MVC *mvc))
void
ewl_mvc_model_set(Ewl_MVC *mvc, const Ewl_Model *model)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(mvc);
- DCHECK_PARAM_PTR(model);
- DCHECK_TYPE(mvc, EWL_MVC_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(mvc);
+ DCHECK_PARAM_PTR(model);
+ DCHECK_TYPE(mvc, EWL_MVC_TYPE);
- if (mvc->model == model)
- DRETURN(DLEVEL_STABLE);
+ if (mvc->model == model)
+ DRETURN(DLEVEL_STABLE);
- mvc->model = model;
- ewl_mvc_dirty_set(mvc, TRUE);
+ mvc->model = model;
+ ewl_mvc_dirty_set(mvc, TRUE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -150,11 +150,11 @@ ewl_mvc_model_set(Ewl_MVC *mvc, const Ewl_Model *model)
const Ewl_Model *
ewl_mvc_model_get(Ewl_MVC *mvc)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(mvc, NULL);
- DCHECK_TYPE_RET(mvc, EWL_MVC_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(mvc, NULL);
+ DCHECK_TYPE_RET(mvc, EWL_MVC_TYPE, NULL);
- DRETURN_PTR(mvc->model, DLEVEL_STABLE);
+ DRETURN_PTR(mvc->model, DLEVEL_STABLE);
}
/**
@@ -166,17 +166,17 @@ ewl_mvc_model_get(Ewl_MVC *mvc)
void
ewl_mvc_data_set(Ewl_MVC *mvc, void *data)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(mvc);
- DCHECK_TYPE(mvc, EWL_MVC_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(mvc);
+ DCHECK_TYPE(mvc, EWL_MVC_TYPE);
- mvc->data = data;
+ mvc->data = data;
- /* new data, clear out the old selection list */
- ewl_mvc_selected_clear(mvc);
- ewl_mvc_dirty_set(mvc, TRUE);
+ /* new data, clear out the old selection list */
+ ewl_mvc_selected_clear(mvc);
+ ewl_mvc_dirty_set(mvc, TRUE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -187,11 +187,11 @@ ewl_mvc_data_set(Ewl_MVC *mvc, void *data)
void *
ewl_mvc_data_get(Ewl_MVC *mvc)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(mvc, NULL);
- DCHECK_TYPE_RET(mvc, EWL_MVC_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(mvc, NULL);
+ DCHECK_TYPE_RET(mvc, EWL_MVC_TYPE, NULL);
- DRETURN_PTR(mvc->data, DLEVEL_STABLE);
+ DRETURN_PTR(mvc->data, DLEVEL_STABLE);
}
/**
@@ -203,17 +203,17 @@ ewl_mvc_data_get(Ewl_MVC *mvc)
void
ewl_mvc_dirty_set(Ewl_MVC *mvc, unsigned int dirty)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(mvc);
- DCHECK_TYPE(mvc, EWL_MVC_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(mvc);
+ DCHECK_TYPE(mvc, EWL_MVC_TYPE);
- if (mvc->dirty == dirty)
- DRETURN(DLEVEL_STABLE);
+ if (mvc->dirty == dirty)
+ DRETURN(DLEVEL_STABLE);
- mvc->dirty = !!dirty;
- ewl_widget_configure(EWL_WIDGET(mvc));
+ mvc->dirty = !!dirty;
+ ewl_widget_configure(EWL_WIDGET(mvc));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -224,11 +224,11 @@ ewl_mvc_dirty_set(Ewl_MVC *mvc, unsigned int dirty)
unsigned int
ewl_mvc_dirty_get(Ewl_MVC *mvc)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(mvc, FALSE);
- DCHECK_TYPE_RET(mvc, EWL_MVC_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(mvc, FALSE);
+ DCHECK_TYPE_RET(mvc, EWL_MVC_TYPE, FALSE);
- DRETURN_INT(mvc->dirty, DLEVEL_STABLE);
+ DRETURN_INT(mvc->dirty, DLEVEL_STABLE);
}
/**
@@ -240,25 +240,25 @@ ewl_mvc_dirty_get(Ewl_MVC *mvc)
void
ewl_mvc_selection_mode_set(Ewl_MVC *mvc, Ewl_Selection_Mode mode)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(mvc);
- DCHECK_TYPE(mvc, EWL_MVC_TYPE);
-
- if (mvc->selection_mode == mode)
- DRETURN(DLEVEL_STABLE);
-
- mvc->selection_mode = mode;
- if (mode == EWL_SELECTION_MODE_NONE)
- {
- IF_FREE_LIST(mvc->selected);
- }
- else if (!mvc->selected)
- {
- mvc->selected = ecore_list_new();
- ecore_list_free_cb_set(mvc->selected, ewl_mvc_cb_sel_free);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(mvc);
+ DCHECK_TYPE(mvc, EWL_MVC_TYPE);
+
+ if (mvc->selection_mode == mode)
+ DRETURN(DLEVEL_STABLE);
+
+ mvc->selection_mode = mode;
+ if (mode == EWL_SELECTION_MODE_NONE)
+ {
+ IF_FREE_LIST(mvc->selected);
+ }
+ else if (!mvc->selected)
+ {
+ mvc->selected = ecore_list_new();
+ ecore_list_free_cb_set(mvc->selected, ewl_mvc_cb_sel_free);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -269,11 +269,11 @@ ewl_mvc_selection_mode_set(Ewl_MVC *mvc, Ewl_Selection_Mode mode)
Ewl_Selection_Mode
ewl_mvc_selection_mode_get(Ewl_MVC *mvc)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(mvc, EWL_SELECTION_MODE_NONE);
- DCHECK_TYPE_RET(mvc, EWL_MVC_TYPE, EWL_SELECTION_MODE_NONE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(mvc, EWL_SELECTION_MODE_NONE);
+ DCHECK_TYPE_RET(mvc, EWL_MVC_TYPE, EWL_SELECTION_MODE_NONE);
- DRETURN_INT(mvc->selection_mode, DLEVEL_STABLE);
+ DRETURN_INT(mvc->selection_mode, DLEVEL_STABLE);
}
/**
@@ -284,35 +284,35 @@ ewl_mvc_selection_mode_get(Ewl_MVC *mvc)
void
ewl_mvc_selected_clear(Ewl_MVC *mvc)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(mvc);
- DCHECK_TYPE(mvc, EWL_MVC_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(mvc);
+ DCHECK_TYPE(mvc, EWL_MVC_TYPE);
- if (mvc->selection_mode == EWL_SELECTION_MODE_NONE)
- DRETURN(DLEVEL_STABLE);
+ if (mvc->selection_mode == EWL_SELECTION_MODE_NONE)
+ DRETURN(DLEVEL_STABLE);
- ewl_mvc_selected_clear_private(mvc);
- ewl_mvc_selected_change_notify(mvc);
+ ewl_mvc_selected_clear_private(mvc);
+ ewl_mvc_selected_change_notify(mvc);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_mvc_selected_clear_private(Ewl_MVC *mvc)
{
- Ewl_Selection *sel;
+ Ewl_Selection *sel;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(mvc);
- DCHECK_TYPE(mvc, EWL_MVC_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(mvc);
+ DCHECK_TYPE(mvc, EWL_MVC_TYPE);
- if (mvc->selection_mode == EWL_SELECTION_MODE_NONE)
- DRETURN(DLEVEL_STABLE);
+ if (mvc->selection_mode == EWL_SELECTION_MODE_NONE)
+ DRETURN(DLEVEL_STABLE);
- while ((sel = ecore_list_first_remove(mvc->selected)))
- ewl_mvc_selection_free(sel);
+ while ((sel = ecore_list_first_remove(mvc->selected)))
+ ewl_mvc_selection_free(sel);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -325,37 +325,37 @@ ewl_mvc_selected_clear_private(Ewl_MVC *mvc)
void
ewl_mvc_selected_list_set(Ewl_MVC *mvc, Ecore_List *list)
{
- Ewl_Selection *sel;
- unsigned int count = 0;
+ Ewl_Selection *sel;
+ unsigned int count = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(mvc);
- DCHECK_TYPE(mvc, EWL_MVC_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(mvc);
+ DCHECK_TYPE(mvc, EWL_MVC_TYPE);
- if (mvc->selection_mode == EWL_SELECTION_MODE_NONE)
- DRETURN(DLEVEL_STABLE);
+ if (mvc->selection_mode == EWL_SELECTION_MODE_NONE)
+ DRETURN(DLEVEL_STABLE);
- count = ewl_mvc_selected_count_get(mvc);
- ewl_mvc_selected_clear_private(mvc);
+ count = ewl_mvc_selected_count_get(mvc);
+ ewl_mvc_selected_clear_private(mvc);
- if (!list || (ecore_list_count(list) == 0))
- {
- if (count > 0) ewl_mvc_selected_change_notify(mvc);
- DRETURN(DLEVEL_STABLE);
- }
+ if (!list || (ecore_list_count(list) == 0))
+ {
+ if (count > 0) ewl_mvc_selected_change_notify(mvc);
+ DRETURN(DLEVEL_STABLE);
+ }
- ewl_mvc_selected_insert(mvc, NULL, NULL,
- ecore_list_first_remove(list), 0, 0);
+ ewl_mvc_selected_insert(mvc, NULL, NULL,
+ ecore_list_first_remove(list), 0, 0);
- if (mvc->selection_mode == EWL_SELECTION_MODE_MULTI)
- {
- while ((sel = ecore_list_first_remove(list)))
- ewl_mvc_selected_insert(mvc, NULL, NULL, sel, 0, 0);
- }
+ if (mvc->selection_mode == EWL_SELECTION_MODE_MULTI)
+ {
+ while ((sel = ecore_list_first_remove(list)))
+ ewl_mvc_selected_insert(mvc, NULL, NULL, sel, 0, 0);
+ }
- ewl_mvc_selected_change_notify(mvc);
+ ewl_mvc_selected_change_notify(mvc);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -367,14 +367,14 @@ ewl_mvc_selected_list_set(Ewl_MVC *mvc, Ecore_List *list)
Ecore_List *
ewl_mvc_selected_list_get(Ewl_MVC *mvc)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(mvc, NULL);
- DCHECK_TYPE_RET(mvc, EWL_MVC_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(mvc, NULL);
+ DCHECK_TYPE_RET(mvc, EWL_MVC_TYPE, NULL);
- if (mvc->selection_mode == EWL_SELECTION_MODE_NONE)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ if (mvc->selection_mode == EWL_SELECTION_MODE_NONE)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- DRETURN_PTR(mvc->selected, DLEVEL_STABLE);
+ DRETURN_PTR(mvc->selected, DLEVEL_STABLE);
}
/**
@@ -391,50 +391,50 @@ ewl_mvc_selected_list_get(Ewl_MVC *mvc)
*/
void
ewl_mvc_selected_range_add(Ewl_MVC *mvc, const Ewl_Model *model, void *data,
- unsigned int srow, unsigned int scolumn,
- unsigned int erow, unsigned int ecolumn)
+ unsigned int srow, unsigned int scolumn,
+ unsigned int erow, unsigned int ecolumn)
{
- Ewl_Selection *sel;
- const Ewl_Model *mod;
- unsigned int tmp;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(mvc);
- DCHECK_TYPE(mvc, EWL_MVC_TYPE);
-
- if (mvc->selection_mode == EWL_SELECTION_MODE_NONE)
- DRETURN(DLEVEL_STABLE);
-
- if (model) mod = model;
- else mod = ewl_mvc_model_get(mvc);
-
- /* make sure the start comes before the end */
- if (erow < srow)
- {
- tmp = erow;
- erow = srow;
- srow = tmp;
- }
-
- if (ecolumn < scolumn)
- {
- tmp = ecolumn;
- ecolumn = scolumn;
- scolumn = tmp;
- }
-
- if (mvc->selection_mode == EWL_SELECTION_MODE_SINGLE)
- ewl_mvc_selected_insert(mvc, mod, data, NULL, srow, scolumn);
- else
- {
- sel = ewl_mvc_selection_range_new(mod, data, srow, scolumn,
- erow, ecolumn);
- ewl_mvc_selected_insert(mvc, NULL, NULL, sel, 0, 0);
- }
-
- ewl_mvc_selected_change_notify(mvc);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Selection *sel;
+ const Ewl_Model *mod;
+ unsigned int tmp;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(mvc);
+ DCHECK_TYPE(mvc, EWL_MVC_TYPE);
+
+ if (mvc->selection_mode == EWL_SELECTION_MODE_NONE)
+ DRETURN(DLEVEL_STABLE);
+
+ if (model) mod = model;
+ else mod = ewl_mvc_model_get(mvc);
+
+ /* make sure the start comes before the end */
+ if (erow < srow)
+ {
+ tmp = erow;
+ erow = srow;
+ srow = tmp;
+ }
+
+ if (ecolumn < scolumn)
+ {
+ tmp = ecolumn;
+ ecolumn = scolumn;
+ scolumn = tmp;
+ }
+
+ if (mvc->selection_mode == EWL_SELECTION_MODE_SINGLE)
+ ewl_mvc_selected_insert(mvc, mod, data, NULL, srow, scolumn);
+ else
+ {
+ sel = ewl_mvc_selection_range_new(mod, data, srow, scolumn,
+ erow, ecolumn);
+ ewl_mvc_selected_insert(mvc, NULL, NULL, sel, 0, 0);
+ }
+
+ ewl_mvc_selected_change_notify(mvc);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -449,19 +449,19 @@ ewl_mvc_selected_range_add(Ewl_MVC *mvc, const Ewl_Model *model, void *data,
*/
void
ewl_mvc_selected_set(Ewl_MVC *mvc, const Ewl_Model *model, void *data,
- unsigned int row, unsigned int column)
+ unsigned int row, unsigned int column)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(mvc);
- DCHECK_TYPE(mvc, EWL_MVC_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(mvc);
+ DCHECK_TYPE(mvc, EWL_MVC_TYPE);
- if (mvc->selection_mode == EWL_SELECTION_MODE_NONE)
- DRETURN(DLEVEL_STABLE);
+ if (mvc->selection_mode == EWL_SELECTION_MODE_NONE)
+ DRETURN(DLEVEL_STABLE);
- ewl_mvc_selected_clear_private(mvc);
- ewl_mvc_selected_add(mvc, model, data, row, column);
+ ewl_mvc_selected_clear_private(mvc);
+ ewl_mvc_selected_add(mvc, model, data, row, column);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -476,24 +476,24 @@ ewl_mvc_selected_set(Ewl_MVC *mvc, const Ewl_Model *model, void *data,
*/
void
ewl_mvc_selected_add(Ewl_MVC *mvc, const Ewl_Model *model, void *data,
- unsigned int row, unsigned int column)
+ unsigned int row, unsigned int column)
{
- const Ewl_Model *mod;
+ const Ewl_Model *mod;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(mvc);
- DCHECK_TYPE(mvc, EWL_MVC_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(mvc);
+ DCHECK_TYPE(mvc, EWL_MVC_TYPE);
- if (mvc->selection_mode == EWL_SELECTION_MODE_NONE)
- DRETURN(DLEVEL_STABLE);
+ if (mvc->selection_mode == EWL_SELECTION_MODE_NONE)
+ DRETURN(DLEVEL_STABLE);
- if (model) mod = model;
- else mod = ewl_mvc_model_get(mvc);
+ if (model) mod = model;
+ else mod = ewl_mvc_model_get(mvc);
- ewl_mvc_selected_insert(mvc, mod, data, NULL, row, column);
- ewl_mvc_selected_change_notify(mvc);
+ ewl_mvc_selected_insert(mvc, mod, data, NULL, row, column);
+ ewl_mvc_selected_change_notify(mvc);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -507,42 +507,42 @@ ewl_mvc_selected_add(Ewl_MVC *mvc, const Ewl_Model *model, void *data,
Ewl_Selection_Idx *
ewl_mvc_selected_get(Ewl_MVC *mvc)
{
- Ewl_Selection *sel;
- Ewl_Selection_Idx *ret;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(mvc, NULL);
- DCHECK_TYPE_RET(mvc, EWL_MVC_TYPE, NULL);
-
- if (mvc->selection_mode == EWL_SELECTION_MODE_NONE)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
-
- ecore_list_last_goto(mvc->selected);
- sel = ecore_list_current(mvc->selected);
- if (!sel) DRETURN_PTR(NULL, DLEVEL_STABLE);
-
- ret = NEW(Ewl_Selection_Idx, 1);
- ret->sel.type = EWL_SELECTION_TYPE_INDEX;
- ret->sel.model = sel->model;
- ret->sel.data = sel->data;
- if (sel->type == EWL_SELECTION_TYPE_INDEX)
- {
- Ewl_Selection_Idx *si;
-
- si = EWL_SELECTION_IDX(sel);
- ret->row = si->row;
- ret->column = si->column;
- }
- else
- {
- Ewl_Selection_Range *si;
-
- si = EWL_SELECTION_RANGE(sel);
- ret->row = si->start.row;
- ret->column = si->start.column;
- }
-
- DRETURN_PTR(ret, DLEVEL_STABLE);
+ Ewl_Selection *sel;
+ Ewl_Selection_Idx *ret;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(mvc, NULL);
+ DCHECK_TYPE_RET(mvc, EWL_MVC_TYPE, NULL);
+
+ if (mvc->selection_mode == EWL_SELECTION_MODE_NONE)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+
+ ecore_list_last_goto(mvc->selected);
+ sel = ecore_list_current(mvc->selected);
+ if (!sel) DRETURN_PTR(NULL, DLEVEL_STABLE);
+
+ ret = NEW(Ewl_Selection_Idx, 1);
+ ret->sel.type = EWL_SELECTION_TYPE_INDEX;
+ ret->sel.model = sel->model;
+ ret->sel.data = sel->data;
+ if (sel->type == EWL_SELECTION_TYPE_INDEX)
+ {
+ Ewl_Selection_Idx *si;
+
+ si = EWL_SELECTION_IDX(sel);
+ ret->row = si->row;
+ ret->column = si->column;
+ }
+ else
+ {
+ Ewl_Selection_Range *si;
+
+ si = EWL_SELECTION_RANGE(sel);
+ ret->row = si->start.row;
+ ret->column = si->start.column;
+ }
+
+ DRETURN_PTR(ret, DLEVEL_STABLE);
}
/**
@@ -555,34 +555,34 @@ ewl_mvc_selected_get(Ewl_MVC *mvc)
*/
void
ewl_mvc_selected_rm(Ewl_MVC *mvc, void *data __UNUSED__, unsigned int row,
- unsigned int column)
+ unsigned int column)
{
- Ewl_Selection *sel;
+ Ewl_Selection *sel;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(mvc);
- DCHECK_TYPE(mvc, EWL_MVC_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(mvc);
+ DCHECK_TYPE(mvc, EWL_MVC_TYPE);
- if (mvc->selection_mode == EWL_SELECTION_MODE_NONE)
- DRETURN(DLEVEL_STABLE);
+ if (mvc->selection_mode == EWL_SELECTION_MODE_NONE)
+ DRETURN(DLEVEL_STABLE);
- if (ewl_mvc_selected_goto(mvc, row, column))
- {
- sel = ecore_list_current(mvc->selected);
+ if (ewl_mvc_selected_goto(mvc, row, column))
+ {
+ sel = ecore_list_current(mvc->selected);
- if (sel->type == EWL_SELECTION_TYPE_INDEX)
- {
- sel = ecore_list_remove(mvc->selected);
- ewl_mvc_selection_free(sel);
- }
- else
- ewl_mvc_selected_range_split(mvc,
- EWL_SELECTION_RANGE(sel), row, column);
+ if (sel->type == EWL_SELECTION_TYPE_INDEX)
+ {
+ sel = ecore_list_remove(mvc->selected);
+ ewl_mvc_selection_free(sel);
+ }
+ else
+ ewl_mvc_selected_range_split(mvc,
+ EWL_SELECTION_RANGE(sel), row, column);
- ewl_mvc_selected_change_notify(mvc);
- }
+ ewl_mvc_selected_change_notify(mvc);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -595,43 +595,43 @@ ewl_mvc_selected_rm(Ewl_MVC *mvc, void *data __UNUSED__, unsigned int row,
unsigned int
ewl_mvc_selected_count_get(Ewl_MVC *mvc)
{
- unsigned int count = 0;
- Ewl_Selection *sel;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(mvc, 0);
- DCHECK_TYPE_RET(mvc, EWL_MVC_TYPE, 0);
-
- if (mvc->selection_mode == EWL_SELECTION_MODE_NONE)
- DRETURN_INT(0, DLEVEL_STABLE);
-
- /* make sure we only return 1 or 0 for the single select case */
- if (mvc->selection_mode == EWL_SELECTION_MODE_SINGLE)
- {
- if (ecore_list_count(mvc->selected))
- DRETURN_INT(1, DLEVEL_STABLE);
-
- DRETURN_INT(0, DLEVEL_STABLE);
- }
-
- ecore_list_first_goto(mvc->selected);
- while ((sel = ecore_list_next(mvc->selected)))
- {
- if (sel->type == EWL_SELECTION_TYPE_INDEX)
- count ++;
- else if (sel->type == EWL_SELECTION_TYPE_RANGE)
- {
- Ewl_Selection_Range *r;
- unsigned int rows = 0, columns = 0;
-
- r = EWL_SELECTION_RANGE(sel);
- rows = (r->end.row - r->start.row) + 1;
- columns = (r->end.column - r->start.column) + 1;
- count += (rows * columns);
- }
- }
-
- DRETURN_INT(count, DLEVEL_STABLE);
+ unsigned int count = 0;
+ Ewl_Selection *sel;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(mvc, 0);
+ DCHECK_TYPE_RET(mvc, EWL_MVC_TYPE, 0);
+
+ if (mvc->selection_mode == EWL_SELECTION_MODE_NONE)
+ DRETURN_INT(0, DLEVEL_STABLE);
+
+ /* make sure we only return 1 or 0 for the single select case */
+ if (mvc->selection_mode == EWL_SELECTION_MODE_SINGLE)
+ {
+ if (ecore_list_count(mvc->selected))
+ DRETURN_INT(1, DLEVEL_STABLE);
+
+ DRETURN_INT(0, DLEVEL_STABLE);
+ }
+
+ ecore_list_first_goto(mvc->selected);
+ while ((sel = ecore_list_next(mvc->selected)))
+ {
+ if (sel->type == EWL_SELECTION_TYPE_INDEX)
+ count ++;
+ else if (sel->type == EWL_SELECTION_TYPE_RANGE)
+ {
+ Ewl_Selection_Range *r;
+ unsigned int rows = 0, columns = 0;
+
+ r = EWL_SELECTION_RANGE(sel);
+ rows = (r->end.row - r->start.row) + 1;
+ columns = (r->end.column - r->start.column) + 1;
+ count += (rows * columns);
+ }
+ }
+
+ DRETURN_INT(count, DLEVEL_STABLE);
}
/* This will look through the list and see if the given row/column is in there.
@@ -642,38 +642,38 @@ ewl_mvc_selected_count_get(Ewl_MVC *mvc)
static unsigned int
ewl_mvc_selected_goto(Ewl_MVC *mvc, unsigned int row, unsigned int column)
{
- Ewl_Selection *sel;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(mvc, FALSE);
- DCHECK_TYPE_RET(mvc, EWL_MVC_TYPE, FALSE);
-
- ecore_list_first_goto(mvc->selected);
- while ((sel = ecore_list_current(mvc->selected)))
- {
- if (sel->type == EWL_SELECTION_TYPE_INDEX)
- {
- Ewl_Selection_Idx *idx;
- idx = EWL_SELECTION_IDX(sel);
- if ((idx->row == row) && (idx->column == column))
- DRETURN_INT(TRUE, DLEVEL_STABLE);
- }
- else
- {
- Ewl_Selection_Range *r;
-
- r = EWL_SELECTION_RANGE(sel);
-
- /* see if we match within the range */
- if ((r->start.row <= row) && (r->start.column <= column)
- && (r->end.row >= row)
- && (r->end.column >= column))
- DRETURN_INT(TRUE, DLEVEL_STABLE);
- }
- ecore_list_next(mvc->selected);
- }
-
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ Ewl_Selection *sel;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(mvc, FALSE);
+ DCHECK_TYPE_RET(mvc, EWL_MVC_TYPE, FALSE);
+
+ ecore_list_first_goto(mvc->selected);
+ while ((sel = ecore_list_current(mvc->selected)))
+ {
+ if (sel->type == EWL_SELECTION_TYPE_INDEX)
+ {
+ Ewl_Selection_Idx *idx;
+ idx = EWL_SELECTION_IDX(sel);
+ if ((idx->row == row) && (idx->column == column))
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+ }
+ else
+ {
+ Ewl_Selection_Range *r;
+
+ r = EWL_SELECTION_RANGE(sel);
+
+ /* see if we match within the range */
+ if ((r->start.row <= row) && (r->start.column <= column)
+ && (r->end.row >= row)
+ && (r->end.column >= column))
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+ }
+ ecore_list_next(mvc->selected);
+ }
+
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
}
/**
@@ -686,115 +686,115 @@ ewl_mvc_selected_goto(Ewl_MVC *mvc, unsigned int row, unsigned int column)
*/
unsigned int
ewl_mvc_selected_is(Ewl_MVC *mvc, void *data __UNUSED__, unsigned int row,
- unsigned int column)
+ unsigned int column)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(mvc, FALSE);
- DCHECK_TYPE_RET(mvc, EWL_MVC_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(mvc, FALSE);
+ DCHECK_TYPE_RET(mvc, EWL_MVC_TYPE, FALSE);
- if (mvc->selection_mode == EWL_SELECTION_MODE_NONE)
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (mvc->selection_mode == EWL_SELECTION_MODE_NONE)
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- DRETURN_INT(ewl_mvc_selected_goto(mvc, row, column), DLEVEL_STABLE);
+ DRETURN_INT(ewl_mvc_selected_goto(mvc, row, column), DLEVEL_STABLE);
}
static void
ewl_mvc_selected_insert(Ewl_MVC *mvc, const Ewl_Model *model, void *data,
- Ewl_Selection *sel, unsigned int row, unsigned int column)
+ Ewl_Selection *sel, unsigned int row, unsigned int column)
{
- Ewl_Selection_Range *range;
- Ewl_Selection *cur;
- Ecore_List *intersections;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(mvc);
-
- if (!sel)
- sel = EWL_SELECTION(ewl_mvc_selection_index_new(model,
- data, row, column));
-
- /* if this is an index and the index is already selected
- * then we're done. Otherwise, just insert the item into the list
- * and be done with it. */
- if (sel->type == EWL_SELECTION_TYPE_INDEX)
- {
- Ewl_Selection_Idx *idx;
-
- idx = EWL_SELECTION_IDX(sel);
- if (ewl_mvc_selected_goto(mvc, idx->row, idx->column))
- {
- ewl_mvc_selection_free(sel);
- DRETURN(DLEVEL_STABLE);
- }
-
- ecore_list_append(mvc->selected, sel);
- DRETURN(DLEVEL_STABLE);
- }
-
- /* We've got a range we're trying to insert from here onwards */
-
- /* we store the intersections away and handle them later as
- * we don't want to be fiddling the list while we walk it
- * (this process will add more items to the list that we
- * don't want to check again for intersections */
- intersections = ecore_list_new();
- ecore_list_free_cb_set(intersections, ECORE_FREE_CB(free));
-
- range = EWL_SELECTION_RANGE(sel);
- ecore_list_first_goto(mvc->selected);
- while ((cur = ecore_list_current(mvc->selected)))
- {
- /* ecore_list_remove updates the index by itself */
- if (ewl_mvc_selection_intersects(range, cur))
- {
- ecore_list_remove(mvc->selected);
-
- /* just free indexes as their covered by the
- * range and don't need to be re-inserted */
- if (cur->type == EWL_SELECTION_TYPE_INDEX)
- ewl_mvc_selection_free(cur);
- else
- ecore_list_append(intersections, cur);
-
- }
- else
- ecore_list_next(mvc->selected);
- }
-
- /* if we intersect nothing just add ourselves to the list
- * and be done with it */
- if (ecore_list_count(intersections) == 0)
- ecore_list_insert(mvc->selected, range);
- else
- {
- Ewl_Selection_Range *ptr;
-
- while ((ptr = ecore_list_first_remove(intersections)))
- {
- /* if range is contained inside current then
- * this can be the only intersection. we add
- * current to the list, destroy range and
- * are done
- *
- * We can't do this inside
- * ewl_mvc_range_merge() as we free range in
- * this case and keep ptr. This is backwards
- * to what's expected by _merge()
- */
- if (ewl_mvc_selection_contained(ptr, range))
- {
- ecore_list_append(mvc->selected, ptr);
- ewl_mvc_selection_free(EWL_SELECTION(range));
- range = NULL;
- break;
- }
- ewl_mvc_range_merge(mvc->selected, model, data, range, ptr);
- }
- if (range) ecore_list_append(mvc->selected, range);
- }
- ecore_list_destroy(intersections);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Selection_Range *range;
+ Ewl_Selection *cur;
+ Ecore_List *intersections;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(mvc);
+
+ if (!sel)
+ sel = EWL_SELECTION(ewl_mvc_selection_index_new(model,
+ data, row, column));
+
+ /* if this is an index and the index is already selected
+ * then we're done. Otherwise, just insert the item into the list
+ * and be done with it. */
+ if (sel->type == EWL_SELECTION_TYPE_INDEX)
+ {
+ Ewl_Selection_Idx *idx;
+
+ idx = EWL_SELECTION_IDX(sel);
+ if (ewl_mvc_selected_goto(mvc, idx->row, idx->column))
+ {
+ ewl_mvc_selection_free(sel);
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ ecore_list_append(mvc->selected, sel);
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ /* We've got a range we're trying to insert from here onwards */
+
+ /* we store the intersections away and handle them later as
+ * we don't want to be fiddling the list while we walk it
+ * (this process will add more items to the list that we
+ * don't want to check again for intersections */
+ intersections = ecore_list_new();
+ ecore_list_free_cb_set(intersections, ECORE_FREE_CB(free));
+
+ range = EWL_SELECTION_RANGE(sel);
+ ecore_list_first_goto(mvc->selected);
+ while ((cur = ecore_list_current(mvc->selected)))
+ {
+ /* ecore_list_remove updates the index by itself */
+ if (ewl_mvc_selection_intersects(range, cur))
+ {
+ ecore_list_remove(mvc->selected);
+
+ /* just free indexes as their covered by the
+ * range and don't need to be re-inserted */
+ if (cur->type == EWL_SELECTION_TYPE_INDEX)
+ ewl_mvc_selection_free(cur);
+ else
+ ecore_list_append(intersections, cur);
+
+ }
+ else
+ ecore_list_next(mvc->selected);
+ }
+
+ /* if we intersect nothing just add ourselves to the list
+ * and be done with it */
+ if (ecore_list_count(intersections) == 0)
+ ecore_list_insert(mvc->selected, range);
+ else
+ {
+ Ewl_Selection_Range *ptr;
+
+ while ((ptr = ecore_list_first_remove(intersections)))
+ {
+ /* if range is contained inside current then
+ * this can be the only intersection. we add
+ * current to the list, destroy range and
+ * are done
+ *
+ * We can't do this inside
+ * ewl_mvc_range_merge() as we free range in
+ * this case and keep ptr. This is backwards
+ * to what's expected by _merge()
+ */
+ if (ewl_mvc_selection_contained(ptr, range))
+ {
+ ecore_list_append(mvc->selected, ptr);
+ ewl_mvc_selection_free(EWL_SELECTION(range));
+ range = NULL;
+ break;
+ }
+ ewl_mvc_range_merge(mvc->selected, model, data, range, ptr);
+ }
+ if (range) ecore_list_append(mvc->selected, range);
+ }
+ ecore_list_destroy(intersections);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/* This will take range and cur and split cur up so there is no overlap
@@ -803,119 +803,119 @@ ewl_mvc_selected_insert(Ewl_MVC *mvc, const Ewl_Model *model, void *data,
* if it is no longer needed */
static void
ewl_mvc_range_merge(Ecore_List *list, const Ewl_Model *model, void *data,
- Ewl_Selection_Range *range, Ewl_Selection_Range *cur)
+ Ewl_Selection_Range *range, Ewl_Selection_Range *cur)
{
- Ewl_Selection *sel;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(list);
- DCHECK_PARAM_PTR(range);
- DCHECK_PARAM_PTR(cur);
-
- /* if the new pointer is totaly in range
- * then delete the original one and keep the
- * range */
- if (ewl_mvc_selection_contained(range, cur))
- {
- ewl_mvc_selection_free(EWL_SELECTION(cur));
- DRETURN(DLEVEL_STABLE);
- }
-
- /* see if this is a merge of the two along one of the sides */
- if (((range->start.row == cur->start.row)
- && (range->end.row == cur->end.row))
- || ((range->start.column == cur->start.column)
- && (range->end.column == cur->end.column)))
- {
- range->start.row = MIN(range->start.row, cur->start.row);
- range->start.column = MIN(range->start.column, cur->start.column);
- range->end.row = MAX(range->end.row, cur->end.row);
- range->end.column = MAX(range->end.column, cur->end.column);
-
- ewl_mvc_selection_free(EWL_SELECTION(cur));
- DRETURN(DLEVEL_STABLE);
- }
-
- /* not merged and not overlapped we're going to need to split @a cur
- * apart in order for this to mesh together
- *
- * We're going to split @a cur into, at most, 4 parts
- *
- * 1
- * - - - - - ------- - - - -
- * 2 | R | 4
- * | |
- * -------- - - - -
- * | 3
- *
- * |
- */
-
- /* find everything above (case 1) */
- if (cur->start.row < range->start.row)
- {
- sel = ewl_mvc_selection_make(model, data, cur->start.row,
- cur->start.column,
- range->start.row - 1,
- cur->end.column);
- ecore_list_append(list, sel);
- }
-
- /* find everything left (case 2) */
- if (cur->start.column < range->start.column)
- {
- sel = ewl_mvc_selection_make(model, data,
- MAX(range->start.row, cur->start.row),
- cur->start.column,
- cur->end.row,
- range->start.column - 1);
- ecore_list_append(list, sel);
- }
-
- /* find everything below (case 3) */
- if (cur->end.row > range->end.row)
- {
- sel = ewl_mvc_selection_make(model, data, range->end.row + 1,
- MAX(range->start.column, cur->start.column),
- cur->end.row,
- cur->end.column);
- ecore_list_append(list, sel);
- }
-
- /* find everything left (case 4) */
- if (cur->end.column > range->end.column)
- {
- sel = ewl_mvc_selection_make(model, data,
- MAX(range->start.row, cur->start.row),
- range->end.column + 1,
- MIN(range->end.row, cur->end.row),
- cur->end.column);
- ecore_list_append(list, sel);
- }
- ewl_mvc_selection_free(EWL_SELECTION(cur));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Selection *sel;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(list);
+ DCHECK_PARAM_PTR(range);
+ DCHECK_PARAM_PTR(cur);
+
+ /* if the new pointer is totaly in range
+ * then delete the original one and keep the
+ * range */
+ if (ewl_mvc_selection_contained(range, cur))
+ {
+ ewl_mvc_selection_free(EWL_SELECTION(cur));
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ /* see if this is a merge of the two along one of the sides */
+ if (((range->start.row == cur->start.row)
+ && (range->end.row == cur->end.row))
+ || ((range->start.column == cur->start.column)
+ && (range->end.column == cur->end.column)))
+ {
+ range->start.row = MIN(range->start.row, cur->start.row);
+ range->start.column = MIN(range->start.column, cur->start.column);
+ range->end.row = MAX(range->end.row, cur->end.row);
+ range->end.column = MAX(range->end.column, cur->end.column);
+
+ ewl_mvc_selection_free(EWL_SELECTION(cur));
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ /* not merged and not overlapped we're going to need to split @a cur
+ * apart in order for this to mesh together
+ *
+ * We're going to split @a cur into, at most, 4 parts
+ *
+ * 1
+ * - - - - - ------- - - - -
+ * 2 | R | 4
+ * | |
+ * -------- - - - -
+ * | 3
+ *
+ * |
+ */
+
+ /* find everything above (case 1) */
+ if (cur->start.row < range->start.row)
+ {
+ sel = ewl_mvc_selection_make(model, data, cur->start.row,
+ cur->start.column,
+ range->start.row - 1,
+ cur->end.column);
+ ecore_list_append(list, sel);
+ }
+
+ /* find everything left (case 2) */
+ if (cur->start.column < range->start.column)
+ {
+ sel = ewl_mvc_selection_make(model, data,
+ MAX(range->start.row, cur->start.row),
+ cur->start.column,
+ cur->end.row,
+ range->start.column - 1);
+ ecore_list_append(list, sel);
+ }
+
+ /* find everything below (case 3) */
+ if (cur->end.row > range->end.row)
+ {
+ sel = ewl_mvc_selection_make(model, data, range->end.row + 1,
+ MAX(range->start.column, cur->start.column),
+ cur->end.row,
+ cur->end.column);
+ ecore_list_append(list, sel);
+ }
+
+ /* find everything left (case 4) */
+ if (cur->end.column > range->end.column)
+ {
+ sel = ewl_mvc_selection_make(model, data,
+ MAX(range->start.row, cur->start.row),
+ range->end.column + 1,
+ MIN(range->end.row, cur->end.row),
+ cur->end.column);
+ ecore_list_append(list, sel);
+ }
+ ewl_mvc_selection_free(EWL_SELECTION(cur));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static Ewl_Selection *
ewl_mvc_selection_make(const Ewl_Model *model, void *data, unsigned int top,
- unsigned int left, unsigned int bottom,
- unsigned int right)
+ unsigned int left, unsigned int bottom,
+ unsigned int right)
{
- Ewl_Selection *sel;
+ Ewl_Selection *sel;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- if ((top != bottom) || (left != right))
- {
- sel = EWL_SELECTION(ewl_mvc_selection_range_new(model,
- data, top, left, bottom, right));
- }
- else
- sel = EWL_SELECTION(ewl_mvc_selection_index_new(model,
- data, top, left));
+ if ((top != bottom) || (left != right))
+ {
+ sel = EWL_SELECTION(ewl_mvc_selection_range_new(model,
+ data, top, left, bottom, right));
+ }
+ else
+ sel = EWL_SELECTION(ewl_mvc_selection_index_new(model,
+ data, top, left));
- DRETURN_PTR(sel, DLEVEL_STABLE);
+ DRETURN_PTR(sel, DLEVEL_STABLE);
}
/* This determins if there there is an intersection point between @a range
@@ -924,51 +924,51 @@ ewl_mvc_selection_make(const Ewl_Model *model, void *data, unsigned int top,
static int
ewl_mvc_selection_intersects(Ewl_Selection_Range *range, Ewl_Selection *sel)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(range, FALSE);
- DCHECK_PARAM_PTR_RET(sel, FALSE);
-
- if (sel->type == EWL_SELECTION_TYPE_INDEX)
- {
- Ewl_Selection_Idx *idx;
-
- idx = EWL_SELECTION_IDX(sel);
- if ((range->start.row <= idx->row) && (range->end.row >= idx->row)
- && (range->start.column <= idx->column)
- && (range->end.column >= idx->column))
- {
- DRETURN_INT(TRUE, DLEVEL_STABLE);
- }
- }
- else
- {
- Ewl_Selection_Range *cur;
- cur = EWL_SELECTION_RANGE(sel);
-
- /* is one range completely inside another */
- if ((ewl_mvc_selection_contained(range, cur))
- || (ewl_mvc_selection_contained(cur, range)))
- DRETURN_INT(TRUE, DLEVEL_STABLE);
-
- /* if the columns intersect and the rows intersect then the
- * boxes intersect */
- if (ewl_mvc_line_intersects(cur->start.row, cur->end.row,
- range->start.row, range->end.row)
- || ewl_mvc_line_intersects(range->start.row, range->end.row,
- cur->start.row, cur->end.row))
- {
- if (ewl_mvc_line_intersects(cur->start.column, cur->end.column,
- range->start.column, range->end.column)
- || ewl_mvc_line_intersects(range->start.column,
- range->end.column, cur->start.column,
- cur->end.column))
- {
- DRETURN_INT(TRUE, DLEVEL_STABLE);
- }
- }
- }
-
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(range, FALSE);
+ DCHECK_PARAM_PTR_RET(sel, FALSE);
+
+ if (sel->type == EWL_SELECTION_TYPE_INDEX)
+ {
+ Ewl_Selection_Idx *idx;
+
+ idx = EWL_SELECTION_IDX(sel);
+ if ((range->start.row <= idx->row) && (range->end.row >= idx->row)
+ && (range->start.column <= idx->column)
+ && (range->end.column >= idx->column))
+ {
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+ }
+ }
+ else
+ {
+ Ewl_Selection_Range *cur;
+ cur = EWL_SELECTION_RANGE(sel);
+
+ /* is one range completely inside another */
+ if ((ewl_mvc_selection_contained(range, cur))
+ || (ewl_mvc_selection_contained(cur, range)))
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+
+ /* if the columns intersect and the rows intersect then the
+ * boxes intersect */
+ if (ewl_mvc_line_intersects(cur->start.row, cur->end.row,
+ range->start.row, range->end.row)
+ || ewl_mvc_line_intersects(range->start.row, range->end.row,
+ cur->start.row, cur->end.row))
+ {
+ if (ewl_mvc_line_intersects(cur->start.column, cur->end.column,
+ range->start.column, range->end.column)
+ || ewl_mvc_line_intersects(range->start.column,
+ range->end.column, cur->start.column,
+ cur->end.column))
+ {
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+ }
+ }
+ }
+
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
}
/*
@@ -983,15 +983,15 @@ ewl_mvc_selection_intersects(Ewl_Selection_Range *range, Ewl_Selection *sel)
static int
ewl_mvc_line_intersects(int astart, int aend, int bstart, int bend)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- if ((((astart <= bstart) && (bstart <= aend))
- || ((astart <= bend) && (bend <= aend)))
- || (((bstart <= astart) && (astart <= bend))
- || ((bstart <= aend) && (aend <= bend))))
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ if ((((astart <= bstart) && (bstart <= aend))
+ || ((astart <= bend) && (bend <= aend)))
+ || (((bstart <= astart) && (astart <= bend))
+ || ((bstart <= aend) && (aend <= bend))))
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
}
/* checks if range @a b is contained completely within range @a a.
@@ -1000,21 +1000,21 @@ ewl_mvc_line_intersects(int astart, int aend, int bstart, int bend)
static int
ewl_mvc_selection_contained(Ewl_Selection_Range *a, Ewl_Selection_Range *b)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(a, FALSE);
- DCHECK_PARAM_PTR_RET(b, FALSE);
-
- if ((a->start.column <= b->start.column)
- && (b->start.column <= a->end.column)
- && (a->start.column <= b->end.column)
- && (b->end.column <= a->end.column)
- && (a->start.row <= b->start.row)
- && (b->start.row <= a->end.row)
- && (a->start.row <= b->end.row)
- && (b->end.row <= a->end.row))
- DRETURN_INT(TRUE, DLEVEL_STABLE);
-
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(a, FALSE);
+ DCHECK_PARAM_PTR_RET(b, FALSE);
+
+ if ((a->start.column <= b->start.column)
+ && (b->start.column <= a->end.column)
+ && (a->start.column <= b->end.column)
+ && (b->end.column <= a->end.column)
+ && (a->start.row <= b->start.row)
+ && (b->start.row <= a->end.row)
+ && (a->start.row <= b->end.row)
+ && (b->end.row <= a->end.row))
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
}
/* split the range into, at most, 4 ranges. This will be done similar to the
@@ -1032,62 +1032,62 @@ ewl_mvc_selection_contained(Ewl_Selection_Range *a, Ewl_Selection_Range *b)
*/
static void
ewl_mvc_selected_range_split(Ewl_MVC *mvc, Ewl_Selection_Range *range,
- unsigned int row, unsigned int column)
+ unsigned int row, unsigned int column)
{
- Ewl_Selection *sel;
- const Ewl_Model *model;
- void *data;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(mvc);
- DCHECK_PARAM_PTR(range);
- DCHECK_TYPE(mvc, EWL_MVC_TYPE);
-
- /* make life easier by removing the range */
- ecore_list_remove(mvc->selected);
- model = EWL_SELECTION(range)->model;
- data = EWL_SELECTION(range)->data;
-
- /* we have something above, case 1 */
- if (range->start.row < row)
- {
- sel = ewl_mvc_selection_make(model, data, range->start.row,
- range->start.column,
- row - 1,
- range->end.column);
- ecore_list_append(mvc->selected, sel);
- }
-
- /* something left, case 2 */
- if (range->start.column < column)
- {
- sel = ewl_mvc_selection_make(model, data, row,
- range->start.column,
- range->end.row,
- column - 1);
- ecore_list_append(mvc->selected, sel);
- }
-
- /* something below, case 3 */
- if (range->end.row > row)
- {
- sel = ewl_mvc_selection_make(model, data, row + 1, column,
- range->end.row,
- range->end.column);
- ecore_list_append(mvc->selected, sel);
- }
-
- /* something right, case 4 */
- if (range->end.column > row)
- {
- sel = ewl_mvc_selection_make(model, data, row, column + 1,
- row, range->end.column);
- ecore_list_append(mvc->selected, sel);
- }
-
- ewl_mvc_selection_free(EWL_SELECTION(range));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Selection *sel;
+ const Ewl_Model *model;
+ void *data;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(mvc);
+ DCHECK_PARAM_PTR(range);
+ DCHECK_TYPE(mvc, EWL_MVC_TYPE);
+
+ /* make life easier by removing the range */
+ ecore_list_remove(mvc->selected);
+ model = EWL_SELECTION(range)->model;
+ data = EWL_SELECTION(range)->data;
+
+ /* we have something above, case 1 */
+ if (range->start.row < row)
+ {
+ sel = ewl_mvc_selection_make(model, data, range->start.row,
+ range->start.column,
+ row - 1,
+ range->end.column);
+ ecore_list_append(mvc->selected, sel);
+ }
+
+ /* something left, case 2 */
+ if (range->start.column < column)
+ {
+ sel = ewl_mvc_selection_make(model, data, row,
+ range->start.column,
+ range->end.row,
+ column - 1);
+ ecore_list_append(mvc->selected, sel);
+ }
+
+ /* something below, case 3 */
+ if (range->end.row > row)
+ {
+ sel = ewl_mvc_selection_make(model, data, row + 1, column,
+ range->end.row,
+ range->end.column);
+ ecore_list_append(mvc->selected, sel);
+ }
+
+ /* something right, case 4 */
+ if (range->end.column > row)
+ {
+ sel = ewl_mvc_selection_make(model, data, row, column + 1,
+ row, range->end.column);
+ ecore_list_append(mvc->selected, sel);
+ }
+
+ ewl_mvc_selection_free(EWL_SELECTION(range));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1102,84 +1102,84 @@ ewl_mvc_selected_range_split(Ewl_MVC *mvc, Ewl_Selection_Range *range,
*/
void
ewl_mvc_handle_click(Ewl_MVC *mvc, const Ewl_Model *model, void *data,
- unsigned int row, unsigned int column)
+ unsigned int row, unsigned int column)
{
- unsigned int modifiers;
- int multi_select = FALSE;
- const Ewl_Model *mod;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(mvc);
- DCHECK_TYPE(mvc, EWL_MVC_TYPE);
-
- switch (ewl_mvc_selection_mode_get(mvc))
- {
- case EWL_SELECTION_MODE_NONE:
- DRETURN(DLEVEL_STABLE);
- case EWL_SELECTION_MODE_MULTI:
- multi_select = TRUE;
- break;
- default:
- break;
- }
-
- if (model) mod = model;
- else mod = ewl_mvc_model_get(mvc);
-
- modifiers = ewl_ev_modifiers_get();
- if (multi_select && (modifiers & EWL_KEY_MODIFIER_SHIFT))
- {
- /* is this the first click? */
- if (ewl_mvc_selected_count_get(mvc) > 0)
- {
- Ewl_Selection *sel;
- void *sdata;
- unsigned int srow, scolumn;
- const Ewl_Model *smod;
-
- /* A shift will add the current position into a
- * range with the last selected item. If the
- * last selected is a range, it will take the
- * start position */
- sel = ecore_list_last_goto(mvc->selected);
- if (sel->type == EWL_SELECTION_TYPE_INDEX)
- {
- Ewl_Selection_Idx *idx;
-
- idx = EWL_SELECTION_IDX(sel);
- smod = sel->model;
- sdata = sel->data;
- srow = idx->row;
- scolumn = idx->column;
- }
- else
- {
- Ewl_Selection_Range *idx;
-
- idx = EWL_SELECTION_RANGE(sel);
- smod = sel->model;
- sdata = sel->data;
- srow = idx->start.row;
- scolumn = idx->start.column;
- }
-
- ewl_mvc_selected_range_add(mvc, smod, data, srow, scolumn,
- row, column);
- }
- else
- ewl_mvc_selected_set(mvc, mod, data, row, column);
- }
- else if (multi_select && (modifiers & EWL_KEY_MODIFIER_CTRL))
- {
- if (ewl_mvc_selected_is(mvc, data, row, column))
- ewl_mvc_selected_rm(mvc, data, row, column);
- else
- ewl_mvc_selected_add(mvc, mod, data, row, column);
- }
- else
- ewl_mvc_selected_set(mvc, mod, data, row, column);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ unsigned int modifiers;
+ int multi_select = FALSE;
+ const Ewl_Model *mod;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(mvc);
+ DCHECK_TYPE(mvc, EWL_MVC_TYPE);
+
+ switch (ewl_mvc_selection_mode_get(mvc))
+ {
+ case EWL_SELECTION_MODE_NONE:
+ DRETURN(DLEVEL_STABLE);
+ case EWL_SELECTION_MODE_MULTI:
+ multi_select = TRUE;
+ break;
+ default:
+ break;
+ }
+
+ if (model) mod = model;
+ else mod = ewl_mvc_model_get(mvc);
+
+ modifiers = ewl_ev_modifiers_get();
+ if (multi_select && (modifiers & EWL_KEY_MODIFIER_SHIFT))
+ {
+ /* is this the first click? */
+ if (ewl_mvc_selected_count_get(mvc) > 0)
+ {
+ Ewl_Selection *sel;
+ void *sdata;
+ unsigned int srow, scolumn;
+ const Ewl_Model *smod;
+
+ /* A shift will add the current position into a
+ * range with the last selected item. If the
+ * last selected is a range, it will take the
+ * start position */
+ sel = ecore_list_last_goto(mvc->selected);
+ if (sel->type == EWL_SELECTION_TYPE_INDEX)
+ {
+ Ewl_Selection_Idx *idx;
+
+ idx = EWL_SELECTION_IDX(sel);
+ smod = sel->model;
+ sdata = sel->data;
+ srow = idx->row;
+ scolumn = idx->column;
+ }
+ else
+ {
+ Ewl_Selection_Range *idx;
+
+ idx = EWL_SELECTION_RANGE(sel);
+ smod = sel->model;
+ sdata = sel->data;
+ srow = idx->start.row;
+ scolumn = idx->start.column;
+ }
+
+ ewl_mvc_selected_range_add(mvc, smod, data, srow, scolumn,
+ row, column);
+ }
+ else
+ ewl_mvc_selected_set(mvc, mod, data, row, column);
+ }
+ else if (multi_select && (modifiers & EWL_KEY_MODIFIER_CTRL))
+ {
+ if (ewl_mvc_selected_is(mvc, data, row, column))
+ ewl_mvc_selected_rm(mvc, data, row, column);
+ else
+ ewl_mvc_selected_add(mvc, mod, data, row, column);
+ }
+ else
+ ewl_mvc_selected_set(mvc, mod, data, row, column);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1193,86 +1193,86 @@ ewl_mvc_handle_click(Ewl_MVC *mvc, const Ewl_Model *model, void *data,
*/
void
ewl_mvc_highlight(Ewl_MVC *mvc, Ewl_Container *c,
- Ewl_Widget *(*widget)(Ewl_MVC *mvc, void *data, unsigned int row,
- unsigned int column))
+ Ewl_Widget *(*widget)(Ewl_MVC *mvc, void *data, unsigned int row,
+ unsigned int column))
{
- Ewl_Selection *sel;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(mvc);
- DCHECK_PARAM_PTR(widget);
- DCHECK_TYPE(mvc, EWL_MVC_TYPE);
-
- if (!mvc->selected || !REALIZED(mvc))
- DRETURN(DLEVEL_STABLE);
-
- ecore_list_first_goto(mvc->selected);
- while ((sel = ecore_list_next(mvc->selected)))
- {
- Ewl_Widget *w;
-
- /* if it's already highlighted we can skip it */
- if (sel->highlight) continue;
-
- if (sel->type == EWL_SELECTION_TYPE_INDEX)
- {
- Ewl_Selection_Idx *idx;
-
- idx = EWL_SELECTION_IDX(sel);
- w = widget(mvc, sel->data, idx->row, idx->column);
- /* w can be NULL, for example when the selected
- * row or widget is hidden or collapsed */
- if (w)
- ewl_mvc_highlight_do(mvc, c, sel, w);
- }
- else
- {
- unsigned int i, k;
- Ewl_Selection_Range *idx;
-
- idx = EWL_SELECTION_RANGE(sel);
- for (i = idx->start.row; i <= idx->end.row; i++)
- {
- for (k = idx->start.column;
- k <= idx->end.column; k++)
- {
- w = widget(mvc, sel->data, i, k);
- if (!w) continue;
-
- ewl_mvc_highlight_do(mvc, c, sel, w);
- }
- }
- }
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Selection *sel;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(mvc);
+ DCHECK_PARAM_PTR(widget);
+ DCHECK_TYPE(mvc, EWL_MVC_TYPE);
+
+ if (!mvc->selected || !REALIZED(mvc))
+ DRETURN(DLEVEL_STABLE);
+
+ ecore_list_first_goto(mvc->selected);
+ while ((sel = ecore_list_next(mvc->selected)))
+ {
+ Ewl_Widget *w;
+
+ /* if it's already highlighted we can skip it */
+ if (sel->highlight) continue;
+
+ if (sel->type == EWL_SELECTION_TYPE_INDEX)
+ {
+ Ewl_Selection_Idx *idx;
+
+ idx = EWL_SELECTION_IDX(sel);
+ w = widget(mvc, sel->data, idx->row, idx->column);
+ /* w can be NULL, for example when the selected
+ * row or widget is hidden or collapsed */
+ if (w)
+ ewl_mvc_highlight_do(mvc, c, sel, w);
+ }
+ else
+ {
+ unsigned int i, k;
+ Ewl_Selection_Range *idx;
+
+ idx = EWL_SELECTION_RANGE(sel);
+ for (i = idx->start.row; i <= idx->end.row; i++)
+ {
+ for (k = idx->start.column;
+ k <= idx->end.column; k++)
+ {
+ w = widget(mvc, sel->data, i, k);
+ if (!w) continue;
+
+ ewl_mvc_highlight_do(mvc, c, sel, w);
+ }
+ }
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_mvc_highlight_do(Ewl_MVC *mvc __UNUSED__, Ewl_Container *c,
- Ewl_Selection *sel, Ewl_Widget *w)
+ Ewl_Selection *sel, Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(sel);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- ewl_widget_state_set(w, "selected", EWL_STATE_PERSISTENT);
- ewl_callback_prepend(w, EWL_CALLBACK_DESTROY,
- ewl_mvc_cb_highlight_destroy, sel);
-
- if (sel->type == EWL_SELECTION_TYPE_INDEX)
- sel->highlight = w;
- else
- {
- if (!sel->highlight)
- sel->highlight = ecore_list_new();
- ecore_list_append(sel->highlight, w);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(sel);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ ewl_widget_state_set(w, "selected", EWL_STATE_PERSISTENT);
+ ewl_callback_prepend(w, EWL_CALLBACK_DESTROY,
+ ewl_mvc_cb_highlight_destroy, sel);
+
+ if (sel->type == EWL_SELECTION_TYPE_INDEX)
+ sel->highlight = w;
+ else
+ {
+ if (!sel->highlight)
+ sel->highlight = ecore_list_new();
+ ecore_list_append(sel->highlight, w);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1285,15 +1285,15 @@ ewl_mvc_highlight_do(Ewl_MVC *mvc __UNUSED__, Ewl_Container *c,
void
ewl_mvc_selected_change_cb_set(Ewl_MVC *mvc, void (*cb)(Ewl_MVC *mvc))
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(mvc);
- DCHECK_TYPE(mvc, EWL_MVC_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(mvc);
+ DCHECK_TYPE(mvc, EWL_MVC_TYPE);
- mvc->cb.selected_change = cb;
- if (mvc->selected && (ecore_list_count(mvc->selected) > 0))
- cb(mvc);
+ mvc->cb.selected_change = cb;
+ if (mvc->selected && (ecore_list_count(mvc->selected) > 0))
+ cb(mvc);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1307,15 +1307,15 @@ ewl_mvc_selected_change_cb_set(Ewl_MVC *mvc, void (*cb)(Ewl_MVC *mvc))
void
ewl_mvc_cb_destroy(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
{
- Ewl_MVC *mvc;
+ Ewl_MVC *mvc;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
- mvc = EWL_MVC(w);
- IF_FREE_LIST(mvc->selected);
+ mvc = EWL_MVC(w);
+ IF_FREE_LIST(mvc->selected);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1329,110 +1329,110 @@ ewl_mvc_cb_destroy(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
void
ewl_mvc_cb_data_unref(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
{
- Ewl_MVC *mvc;
+ Ewl_MVC *mvc;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
- mvc = EWL_MVC(w);
+ mvc = EWL_MVC(w);
- /* unref the data, we don't need it anylonger */
- if (mvc->data && mvc->model && mvc->model->unref)
- {
- mvc->model->unref(mvc->data);
- mvc->data = NULL;
- }
+ /* unref the data, we don't need it anylonger */
+ if (mvc->data && mvc->model && mvc->model->unref)
+ {
+ mvc->model->unref(mvc->data);
+ mvc->data = NULL;
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_mvc_selected_change_notify(Ewl_MVC *mvc)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(mvc);
- DCHECK_TYPE(mvc, EWL_MVC_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(mvc);
+ DCHECK_TYPE(mvc, EWL_MVC_TYPE);
- /* notify any inheriting widgets */
- if (mvc->cb.selected_change)
- mvc->cb.selected_change(mvc);
+ /* notify any inheriting widgets */
+ if (mvc->cb.selected_change)
+ mvc->cb.selected_change(mvc);
- /* notify the app */
- ewl_callback_call(EWL_WIDGET(mvc), EWL_CALLBACK_VALUE_CHANGED);
+ /* notify the app */
+ ewl_callback_call(EWL_WIDGET(mvc), EWL_CALLBACK_VALUE_CHANGED);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_mvc_cb_sel_free(void *data)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
- ewl_mvc_selection_free(EWL_SELECTION(data));
- data = NULL;
+ ewl_mvc_selection_free(EWL_SELECTION(data));
+ data = NULL;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_mvc_selection_free(Ewl_Selection *sel)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sel);
-
- /* we remove the destroy callback on the highlight as it will try to
- * remove itself which causes the selection to get a NULL highlight
- * and causes highlights to hang around */
- if (sel->highlight)
- {
- if (sel->type == EWL_SELECTION_TYPE_INDEX)
- {
- ewl_callback_del(sel->highlight, EWL_CALLBACK_DESTROY,
- ewl_mvc_cb_highlight_destroy);
- ewl_widget_state_set(sel->highlight, "deselect",
- EWL_STATE_PERSISTENT);
- }
- else
- {
- Ewl_Widget *w;
-
- while ((w = ecore_list_first_remove(sel->highlight)))
- {
- ewl_callback_del(w, EWL_CALLBACK_DESTROY,
- ewl_mvc_cb_highlight_destroy);
- ewl_widget_state_set(w, "deselect",
- EWL_STATE_PERSISTENT);
- }
-
- IF_FREE_LIST(sel->highlight);
- }
- }
- FREE(sel);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sel);
+
+ /* we remove the destroy callback on the highlight as it will try to
+ * remove itself which causes the selection to get a NULL highlight
+ * and causes highlights to hang around */
+ if (sel->highlight)
+ {
+ if (sel->type == EWL_SELECTION_TYPE_INDEX)
+ {
+ ewl_callback_del(sel->highlight, EWL_CALLBACK_DESTROY,
+ ewl_mvc_cb_highlight_destroy);
+ ewl_widget_state_set(sel->highlight, "deselect",
+ EWL_STATE_PERSISTENT);
+ }
+ else
+ {
+ Ewl_Widget *w;
+
+ while ((w = ecore_list_first_remove(sel->highlight)))
+ {
+ ewl_callback_del(w, EWL_CALLBACK_DESTROY,
+ ewl_mvc_cb_highlight_destroy);
+ ewl_widget_state_set(w, "deselect",
+ EWL_STATE_PERSISTENT);
+ }
+
+ IF_FREE_LIST(sel->highlight);
+ }
+ }
+ FREE(sel);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_mvc_cb_highlight_destroy(Ewl_Widget *w, void *ev __UNUSED__, void *data)
{
- Ewl_Selection *sel;
+ Ewl_Selection *sel;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- sel = data;
- if (sel->type == EWL_SELECTION_TYPE_INDEX)
- sel->highlight = NULL;
- else
- {
- Ewl_Widget *cur;
+ sel = data;
+ if (sel->type == EWL_SELECTION_TYPE_INDEX)
+ sel->highlight = NULL;
+ else
+ {
+ Ewl_Widget *cur;
- ecore_list_goto(sel->highlight, w);
- cur = ecore_list_current(sel->highlight);
- if (cur == w) ecore_list_remove(sel->highlight);
- }
+ ecore_list_goto(sel->highlight, w);
+ cur = ecore_list_current(sel->highlight);
+ if (cur == w) ecore_list_remove(sel->highlight);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1445,20 +1445,20 @@ ewl_mvc_cb_highlight_destroy(Ewl_Widget *w, void *ev __UNUSED__, void *data)
*/
Ewl_Selection *
ewl_mvc_selection_index_new(const Ewl_Model *model, void *data, unsigned int row,
- unsigned int column)
+ unsigned int column)
{
- Ewl_Selection_Idx *sel;
+ Ewl_Selection_Idx *sel;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- sel = NEW(Ewl_Selection_Idx, 1);
- sel->sel.model = model;
- sel->sel.type = EWL_SELECTION_TYPE_INDEX;
- sel->sel.data = data;
- sel->row = row;
- sel->column = column;
+ sel = NEW(Ewl_Selection_Idx, 1);
+ sel->sel.model = model;
+ sel->sel.type = EWL_SELECTION_TYPE_INDEX;
+ sel->sel.data = data;
+ sel->row = row;
+ sel->column = column;
- DRETURN_PTR(sel, DLEVEL_STABLE);
+ DRETURN_PTR(sel, DLEVEL_STABLE);
}
/**
@@ -1473,22 +1473,22 @@ ewl_mvc_selection_index_new(const Ewl_Model *model, void *data, unsigned int row
*/
Ewl_Selection *
ewl_mvc_selection_range_new(const Ewl_Model *model, void *data, unsigned int srow,
- unsigned int scolumn, unsigned int erow,
- unsigned int ecolumn)
+ unsigned int scolumn, unsigned int erow,
+ unsigned int ecolumn)
{
- Ewl_Selection_Range *sel;
+ Ewl_Selection_Range *sel;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- sel = NEW(Ewl_Selection_Range, 1);
- sel->sel.model = model;
- sel->sel.type = EWL_SELECTION_TYPE_RANGE;
- sel->sel.data = data;
- sel->start.row = srow;
- sel->start.column = scolumn;
- sel->end.row = erow;
- sel->end.column = ecolumn;
+ sel = NEW(Ewl_Selection_Range, 1);
+ sel->sel.model = model;
+ sel->sel.type = EWL_SELECTION_TYPE_RANGE;
+ sel->sel.data = data;
+ sel->start.row = srow;
+ sel->start.column = scolumn;
+ sel->end.row = erow;
+ sel->end.column = ecolumn;
- DRETURN_PTR(sel, DLEVEL_STABLE);
+ DRETURN_PTR(sel, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_mvc.h b/src/lib/ewl_mvc.h
index d190a24..65327df 100644
--- a/src/lib/ewl_mvc.h
+++ b/src/lib/ewl_mvc.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_MVC_H
#define EWL_MVC_H
@@ -46,11 +46,11 @@ typedef struct Ewl_Selection Ewl_Selection;
*/
struct Ewl_Selection
{
- Ewl_Selection_Type type; /**< The type of selection */
- const Ewl_Model *model; /**< The model to work with this
- selection */
- void *highlight; /**< highlight widgets for the MVC */
- void *data; /**< Data containing the selection */
+ Ewl_Selection_Type type; /**< The type of selection */
+ const Ewl_Model *model; /**< The model to work with this
+ selection */
+ void *highlight; /**< highlight widgets for the MVC */
+ void *data; /**< Data containing the selection */
};
/**
@@ -69,10 +69,10 @@ typedef struct Ewl_Selection_Idx Ewl_Selection_Idx;
*/
struct Ewl_Selection_Idx
{
- Ewl_Selection sel; /**< Inherit from Ewl_Selection */
+ Ewl_Selection sel; /**< Inherit from Ewl_Selection */
- unsigned int row; /**< Index row */
- unsigned int column; /**< Index column */
+ unsigned int row; /**< Index row */
+ unsigned int column; /**< Index column */
};
/**
@@ -91,14 +91,14 @@ typedef struct Ewl_Selection_Range Ewl_Selection_Range;
*/
struct Ewl_Selection_Range
{
- Ewl_Selection sel; /**< Inherit from Ewl_Selection */
-
- struct
- {
- unsigned int row;/**< Index row */
- unsigned int column;/**< Index column */
- } start, /**< Start of range */
- end; /**< End of range */
+ Ewl_Selection sel; /**< Inherit from Ewl_Selection */
+
+ struct
+ {
+ unsigned int row;/**< Index row */
+ unsigned int column;/**< Index column */
+ } start, /**< Start of range */
+ end; /**< End of range */
};
/**
@@ -117,94 +117,94 @@ typedef struct Ewl_MVC Ewl_MVC;
*/
struct Ewl_MVC
{
- Ewl_Box box; /**< Inherit from Ewl_Box */
+ Ewl_Box box; /**< Inherit from Ewl_Box */
- void *data; /**< The mvc data */
- const Ewl_View *view; /**< The view for the mvc */
- const Ewl_Model *model; /**< The model for the mvc */
+ void *data; /**< The mvc data */
+ const Ewl_View *view; /**< The view for the mvc */
+ const Ewl_Model *model; /**< The model for the mvc */
- struct {
- void (*view_change)(Ewl_MVC *mvc); /**< View change callback */
- void (*selected_change)(Ewl_MVC *mvc); /**< Selected change callback */
- } cb; /**< Callbacks to the inheriting widgets */
+ struct {
+ void (*view_change)(Ewl_MVC *mvc); /**< View change callback */
+ void (*selected_change)(Ewl_MVC *mvc); /**< Selected change callback */
+ } cb; /**< Callbacks to the inheriting widgets */
- Ecore_List *selected; /**< The selected cells */
+ Ecore_List *selected; /**< The selected cells */
- Ewl_Selection_Mode selection_mode; /**< The widget selection mode*/
- unsigned char dirty:1; /**< Is the data dirty */
+ Ewl_Selection_Mode selection_mode; /**< The widget selection mode*/
+ unsigned char dirty:1; /**< Is the data dirty */
};
-int ewl_mvc_init(Ewl_MVC *mvc);
+int ewl_mvc_init(Ewl_MVC *mvc);
-void ewl_mvc_view_set(Ewl_MVC *mvc, const Ewl_View *view);
-const Ewl_View *ewl_mvc_view_get(Ewl_MVC *mvc);
+void ewl_mvc_view_set(Ewl_MVC *mvc, const Ewl_View *view);
+const Ewl_View *ewl_mvc_view_get(Ewl_MVC *mvc);
-void ewl_mvc_model_set(Ewl_MVC *mvc, const Ewl_Model *model);
-const Ewl_Model *ewl_mvc_model_get(Ewl_MVC *mvc);
+void ewl_mvc_model_set(Ewl_MVC *mvc, const Ewl_Model *model);
+const Ewl_Model *ewl_mvc_model_get(Ewl_MVC *mvc);
-void ewl_mvc_data_set(Ewl_MVC *mvc, void *data);
-void *ewl_mvc_data_get(Ewl_MVC *mvc);
+void ewl_mvc_data_set(Ewl_MVC *mvc, void *data);
+void *ewl_mvc_data_get(Ewl_MVC *mvc);
-void ewl_mvc_dirty_set(Ewl_MVC *mvc, unsigned int dirty);
-unsigned int ewl_mvc_dirty_get(Ewl_MVC *mvc);
+void ewl_mvc_dirty_set(Ewl_MVC *mvc, unsigned int dirty);
+unsigned int ewl_mvc_dirty_get(Ewl_MVC *mvc);
-void ewl_mvc_selection_mode_set(Ewl_MVC *mvc,
- Ewl_Selection_Mode mode);
+void ewl_mvc_selection_mode_set(Ewl_MVC *mvc,
+ Ewl_Selection_Mode mode);
Ewl_Selection_Mode ewl_mvc_selection_mode_get(Ewl_MVC *mvc);
-void ewl_mvc_selected_clear(Ewl_MVC *mvc);
-
-void ewl_mvc_selected_list_set(Ewl_MVC *mvc, Ecore_List *list);
-Ecore_List *ewl_mvc_selected_list_get(Ewl_MVC *mvc);
-
-void ewl_mvc_selected_range_add(Ewl_MVC *mvc,
- const Ewl_Model * model,
- void *data,
- unsigned int srow,
- unsigned int scolumn,
- unsigned int erow,
- unsigned int ecolumn);
-
-void ewl_mvc_selected_set(Ewl_MVC *mvc, const Ewl_Model *model,
- void *data, unsigned int row,
- unsigned int column);
-void ewl_mvc_selected_add(Ewl_MVC *mvc, const Ewl_Model *model,
- void *data, unsigned int row,
- unsigned int column);
+void ewl_mvc_selected_clear(Ewl_MVC *mvc);
+
+void ewl_mvc_selected_list_set(Ewl_MVC *mvc, Ecore_List *list);
+Ecore_List *ewl_mvc_selected_list_get(Ewl_MVC *mvc);
+
+void ewl_mvc_selected_range_add(Ewl_MVC *mvc,
+ const Ewl_Model * model,
+ void *data,
+ unsigned int srow,
+ unsigned int scolumn,
+ unsigned int erow,
+ unsigned int ecolumn);
+
+void ewl_mvc_selected_set(Ewl_MVC *mvc, const Ewl_Model *model,
+ void *data, unsigned int row,
+ unsigned int column);
+void ewl_mvc_selected_add(Ewl_MVC *mvc, const Ewl_Model *model,
+ void *data, unsigned int row,
+ unsigned int column);
Ewl_Selection_Idx *ewl_mvc_selected_get(Ewl_MVC *mvc);
-void ewl_mvc_selected_rm(Ewl_MVC *mvc, void *data, unsigned int row,
- unsigned int column);
-
-unsigned int ewl_mvc_selected_count_get(Ewl_MVC *mvc);
-unsigned int ewl_mvc_selected_is(Ewl_MVC *mvc, void *data, unsigned int row,
- unsigned int column);
-
-Ewl_Selection *ewl_mvc_selection_index_new(const Ewl_Model *model, void *data,
- unsigned int row,
- unsigned int column);
-Ewl_Selection *ewl_mvc_selection_range_new(const Ewl_Model *model, void *data,
- unsigned int srow,
- unsigned int scolumn,
- unsigned int erow,
- unsigned int ecolumn);
-
-void ewl_mvc_highlight(Ewl_MVC *mvc, Ewl_Container *c,
- Ewl_Widget *(*widget)(Ewl_MVC *mvc,
- void *data, unsigned int row,
- unsigned int column));
+void ewl_mvc_selected_rm(Ewl_MVC *mvc, void *data, unsigned int row,
+ unsigned int column);
+
+unsigned int ewl_mvc_selected_count_get(Ewl_MVC *mvc);
+unsigned int ewl_mvc_selected_is(Ewl_MVC *mvc, void *data, unsigned int row,
+ unsigned int column);
+
+Ewl_Selection *ewl_mvc_selection_index_new(const Ewl_Model *model, void *data,
+ unsigned int row,
+ unsigned int column);
+Ewl_Selection *ewl_mvc_selection_range_new(const Ewl_Model *model, void *data,
+ unsigned int srow,
+ unsigned int scolumn,
+ unsigned int erow,
+ unsigned int ecolumn);
+
+void ewl_mvc_highlight(Ewl_MVC *mvc, Ewl_Container *c,
+ Ewl_Widget *(*widget)(Ewl_MVC *mvc,
+ void *data, unsigned int row,
+ unsigned int column));
/*
* internal
*/
-void ewl_mvc_view_change_cb_set(Ewl_MVC *mvc, void (*cb)(Ewl_MVC *mvc));
-void ewl_mvc_selected_change_cb_set(Ewl_MVC *mvc, void (*cb)(Ewl_MVC *mvc));
+void ewl_mvc_view_change_cb_set(Ewl_MVC *mvc, void (*cb)(Ewl_MVC *mvc));
+void ewl_mvc_selected_change_cb_set(Ewl_MVC *mvc, void (*cb)(Ewl_MVC *mvc));
-void ewl_mvc_cb_destroy(Ewl_Widget *w, void *ev, void *data);
-void ewl_mvc_cb_data_unref(Ewl_Widget *w, void *ev, void *data);
+void ewl_mvc_cb_destroy(Ewl_Widget *w, void *ev, void *data);
+void ewl_mvc_cb_data_unref(Ewl_Widget *w, void *ev, void *data);
-void ewl_mvc_handle_click(Ewl_MVC *mvc, const Ewl_Model *model,
- void *data, unsigned int row,
- unsigned int column);
+void ewl_mvc_handle_click(Ewl_MVC *mvc, const Ewl_Model *model,
+ void *data, unsigned int row,
+ unsigned int column);
/**
* @}
diff --git a/src/lib/ewl_notebook.c b/src/lib/ewl_notebook.c
index 704b6fb..008c50a 100644
--- a/src/lib/ewl_notebook.c
+++ b/src/lib/ewl_notebook.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_notebook.h"
#include "ewl_label.h"
@@ -13,21 +13,21 @@
Ewl_Widget *
ewl_notebook_new(void)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- w = NEW(Ewl_Notebook, 1);
- if (!w)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ w = NEW(Ewl_Notebook, 1);
+ if (!w)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_notebook_init(EWL_NOTEBOOK(w)))
- {
- ewl_widget_destroy(w);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ewl_notebook_init(EWL_NOTEBOOK(w)))
+ {
+ ewl_widget_destroy(w);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
/**
@@ -38,50 +38,50 @@ ewl_notebook_new(void)
int
ewl_notebook_init(Ewl_Notebook *n)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(n, FALSE);
-
- if (!ewl_box_init(EWL_BOX(n)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- ewl_box_orientation_set(EWL_BOX(n), EWL_ORIENTATION_VERTICAL);
-
- ewl_widget_appearance_set(EWL_WIDGET(n), EWL_NOTEBOOK_TYPE);
- ewl_widget_inherit(EWL_WIDGET(n), EWL_NOTEBOOK_TYPE);
-
- n->tabbar_position = EWL_POSITION_TOP;
-
- n->body.tabbar = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(n), n->body.tabbar);
- ewl_object_fill_policy_set(EWL_OBJECT(n->body.tabbar),
- EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(n->body.tabbar),
- EWL_FLAG_ALIGN_CENTER);
- ewl_widget_internal_set(n->body.tabbar, TRUE);
- ewl_widget_appearance_set(n->body.tabbar, "top/tabbar");
- ewl_widget_show(n->body.tabbar);
-
- n->body.pages = ewl_vbox_new();
- ewl_object_fill_policy_set(EWL_OBJECT(n->body.pages),
- EWL_FLAG_FILL_ALL);
- ewl_container_child_append(EWL_CONTAINER(n), n->body.pages);
- ewl_widget_internal_set(n->body.pages, TRUE);
- ewl_widget_appearance_set(n->body.pages, "pages");
- ewl_widget_show(n->body.pages);
-
- ewl_container_redirect_set(EWL_CONTAINER(n),
- EWL_CONTAINER(n->body.pages));
-
- ewl_container_show_notify_set(EWL_CONTAINER(n->body.pages),
- ewl_notebook_cb_child_show);
- ewl_container_hide_notify_set(EWL_CONTAINER(n->body.pages),
- ewl_notebook_cb_child_hide);
- ewl_container_add_notify_set(EWL_CONTAINER(n->body.pages),
- ewl_notebook_cb_child_add);
- ewl_container_remove_notify_set(EWL_CONTAINER(n->body.pages),
- ewl_notebook_cb_child_remove);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(n, FALSE);
+
+ if (!ewl_box_init(EWL_BOX(n)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ ewl_box_orientation_set(EWL_BOX(n), EWL_ORIENTATION_VERTICAL);
+
+ ewl_widget_appearance_set(EWL_WIDGET(n), EWL_NOTEBOOK_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(n), EWL_NOTEBOOK_TYPE);
+
+ n->tabbar_position = EWL_POSITION_TOP;
+
+ n->body.tabbar = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(n), n->body.tabbar);
+ ewl_object_fill_policy_set(EWL_OBJECT(n->body.tabbar),
+ EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(n->body.tabbar),
+ EWL_FLAG_ALIGN_CENTER);
+ ewl_widget_internal_set(n->body.tabbar, TRUE);
+ ewl_widget_appearance_set(n->body.tabbar, "top/tabbar");
+ ewl_widget_show(n->body.tabbar);
+
+ n->body.pages = ewl_vbox_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(n->body.pages),
+ EWL_FLAG_FILL_ALL);
+ ewl_container_child_append(EWL_CONTAINER(n), n->body.pages);
+ ewl_widget_internal_set(n->body.pages, TRUE);
+ ewl_widget_appearance_set(n->body.pages, "pages");
+ ewl_widget_show(n->body.pages);
+
+ ewl_container_redirect_set(EWL_CONTAINER(n),
+ EWL_CONTAINER(n->body.pages));
+
+ ewl_container_show_notify_set(EWL_CONTAINER(n->body.pages),
+ ewl_notebook_cb_child_show);
+ ewl_container_hide_notify_set(EWL_CONTAINER(n->body.pages),
+ ewl_notebook_cb_child_hide);
+ ewl_container_add_notify_set(EWL_CONTAINER(n->body.pages),
+ ewl_notebook_cb_child_add);
+ ewl_container_remove_notify_set(EWL_CONTAINER(n->body.pages),
+ ewl_notebook_cb_child_remove);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -93,13 +93,13 @@ ewl_notebook_init(Ewl_Notebook *n)
void
ewl_notebook_tabbar_alignment_set(Ewl_Notebook *n, unsigned int align)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(n);
- DCHECK_TYPE(n, EWL_NOTEBOOK_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(n);
+ DCHECK_TYPE(n, EWL_NOTEBOOK_TYPE);
- ewl_object_alignment_set(EWL_OBJECT(n->body.tabbar), align);
+ ewl_object_alignment_set(EWL_OBJECT(n->body.tabbar), align);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -110,12 +110,12 @@ ewl_notebook_tabbar_alignment_set(Ewl_Notebook *n, unsigned int align)
unsigned int
ewl_notebook_tabbar_alignment_get(Ewl_Notebook *n)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(n, 0);
- DCHECK_TYPE_RET(n, EWL_NOTEBOOK_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(n, 0);
+ DCHECK_TYPE_RET(n, EWL_NOTEBOOK_TYPE, 0);
- DRETURN_INT(ewl_object_alignment_get(EWL_OBJECT(n->body.tabbar)),
- DLEVEL_STABLE);
+ DRETURN_INT(ewl_object_alignment_get(EWL_OBJECT(n->body.tabbar)),
+ DLEVEL_STABLE);
}
/**
@@ -127,82 +127,82 @@ ewl_notebook_tabbar_alignment_get(Ewl_Notebook *n)
void
ewl_notebook_tabbar_position_set(Ewl_Notebook *n, Ewl_Position pos)
{
- int t, pw, ph;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(n);
- DCHECK_TYPE(n, "notebook");
-
- if (n->tabbar_position == pos)
- DRETURN(DLEVEL_STABLE);
-
- n->tabbar_position = pos;
- switch(pos)
- {
- case EWL_POSITION_LEFT:
- case EWL_POSITION_RIGHT:
- ewl_box_orientation_set(EWL_BOX(n),
- EWL_ORIENTATION_HORIZONTAL);
- ewl_box_orientation_set(EWL_BOX(n->body.tabbar),
- EWL_ORIENTATION_VERTICAL);
-
- t = ewl_object_preferred_w_get(EWL_OBJECT(n->body.tabbar));
- ewl_object_preferred_size_get(EWL_OBJECT(n->body.pages),
- &pw, &ph);
-
- ewl_object_preferred_inner_size_set(EWL_OBJECT(n), t + pw, ph);
-
- break;
- case EWL_POSITION_TOP:
- case EWL_POSITION_BOTTOM:
- default:
- ewl_box_orientation_set(EWL_BOX(n),
- EWL_ORIENTATION_VERTICAL);
- ewl_box_orientation_set(EWL_BOX(n->body.tabbar),
- EWL_ORIENTATION_HORIZONTAL);
-
- t = ewl_object_preferred_h_get(EWL_OBJECT(n->body.tabbar));
- ewl_object_preferred_size_get(EWL_OBJECT(n->body.pages),
- &pw, &ph);
-
- ewl_object_preferred_inner_size_set(EWL_OBJECT(n), pw, ph + t);
-
- break;
- }
-
- switch (pos)
- {
- case EWL_POSITION_LEFT:
- ewl_widget_appearance_set(n->body.tabbar, "left/tabbar");
- break;
- case EWL_POSITION_RIGHT:
- ewl_widget_appearance_set(n->body.tabbar, "right/tabbar");
- break;
- case EWL_POSITION_TOP:
- ewl_widget_appearance_set(n->body.tabbar, "top/tabbar");
- break;
- case EWL_POSITION_BOTTOM:
- ewl_widget_appearance_set(n->body.tabbar, "bottom/tabbar");
- break;
- }
-
- ewl_container_child_remove(EWL_CONTAINER(n), n->body.tabbar);
-
- /* remove the redirect so we can stick the tabbar back in */
- ewl_container_redirect_set(EWL_CONTAINER(n), NULL);
-
- if ((n->tabbar_position == EWL_POSITION_RIGHT)
- || (n->tabbar_position == EWL_POSITION_BOTTOM))
- ewl_container_child_append(EWL_CONTAINER(n), n->body.tabbar);
-
- else if ((n->tabbar_position == EWL_POSITION_LEFT)
- || (n->tabbar_position == EWL_POSITION_TOP))
- ewl_container_child_prepend(EWL_CONTAINER(n), n->body.tabbar);
-
- ewl_container_redirect_set(EWL_CONTAINER(n),
- EWL_CONTAINER(n->body.pages));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int t, pw, ph;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(n);
+ DCHECK_TYPE(n, "notebook");
+
+ if (n->tabbar_position == pos)
+ DRETURN(DLEVEL_STABLE);
+
+ n->tabbar_position = pos;
+ switch(pos)
+ {
+ case EWL_POSITION_LEFT:
+ case EWL_POSITION_RIGHT:
+ ewl_box_orientation_set(EWL_BOX(n),
+ EWL_ORIENTATION_HORIZONTAL);
+ ewl_box_orientation_set(EWL_BOX(n->body.tabbar),
+ EWL_ORIENTATION_VERTICAL);
+
+ t = ewl_object_preferred_w_get(EWL_OBJECT(n->body.tabbar));
+ ewl_object_preferred_size_get(EWL_OBJECT(n->body.pages),
+ &pw, &ph);
+
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(n), t + pw, ph);
+
+ break;
+ case EWL_POSITION_TOP:
+ case EWL_POSITION_BOTTOM:
+ default:
+ ewl_box_orientation_set(EWL_BOX(n),
+ EWL_ORIENTATION_VERTICAL);
+ ewl_box_orientation_set(EWL_BOX(n->body.tabbar),
+ EWL_ORIENTATION_HORIZONTAL);
+
+ t = ewl_object_preferred_h_get(EWL_OBJECT(n->body.tabbar));
+ ewl_object_preferred_size_get(EWL_OBJECT(n->body.pages),
+ &pw, &ph);
+
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(n), pw, ph + t);
+
+ break;
+ }
+
+ switch (pos)
+ {
+ case EWL_POSITION_LEFT:
+ ewl_widget_appearance_set(n->body.tabbar, "left/tabbar");
+ break;
+ case EWL_POSITION_RIGHT:
+ ewl_widget_appearance_set(n->body.tabbar, "right/tabbar");
+ break;
+ case EWL_POSITION_TOP:
+ ewl_widget_appearance_set(n->body.tabbar, "top/tabbar");
+ break;
+ case EWL_POSITION_BOTTOM:
+ ewl_widget_appearance_set(n->body.tabbar, "bottom/tabbar");
+ break;
+ }
+
+ ewl_container_child_remove(EWL_CONTAINER(n), n->body.tabbar);
+
+ /* remove the redirect so we can stick the tabbar back in */
+ ewl_container_redirect_set(EWL_CONTAINER(n), NULL);
+
+ if ((n->tabbar_position == EWL_POSITION_RIGHT)
+ || (n->tabbar_position == EWL_POSITION_BOTTOM))
+ ewl_container_child_append(EWL_CONTAINER(n), n->body.tabbar);
+
+ else if ((n->tabbar_position == EWL_POSITION_LEFT)
+ || (n->tabbar_position == EWL_POSITION_TOP))
+ ewl_container_child_prepend(EWL_CONTAINER(n), n->body.tabbar);
+
+ ewl_container_redirect_set(EWL_CONTAINER(n),
+ EWL_CONTAINER(n->body.pages));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -213,11 +213,11 @@ ewl_notebook_tabbar_position_set(Ewl_Notebook *n, Ewl_Position pos)
Ewl_Position
ewl_notebook_tabbar_position_get(Ewl_Notebook *n)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(n, EWL_POSITION_TOP);
- DCHECK_TYPE_RET(n, EWL_NOTEBOOK_TYPE, EWL_POSITION_TOP);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(n, EWL_POSITION_TOP);
+ DCHECK_TYPE_RET(n, EWL_NOTEBOOK_TYPE, EWL_POSITION_TOP);
- DRETURN_INT(n->tabbar_position, DLEVEL_STABLE);
+ DRETURN_INT(n->tabbar_position, DLEVEL_STABLE);
}
/**
@@ -229,24 +229,24 @@ ewl_notebook_tabbar_position_get(Ewl_Notebook *n)
void
ewl_notebook_tabbar_visible_set(Ewl_Notebook *n, unsigned int visible)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(n);
- DCHECK_TYPE(n, EWL_NOTEBOOK_TYPE);
-
- if (visible)
- {
- ewl_widget_state_set(EWL_WIDGET(n->body.pages), "tabs",
- EWL_STATE_PERSISTENT);
- ewl_widget_show(n->body.tabbar);
- }
- else
- {
- ewl_widget_state_set(EWL_WIDGET(n->body.pages), "notabs",
- EWL_STATE_PERSISTENT);
- ewl_widget_hide(n->body.tabbar);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(n);
+ DCHECK_TYPE(n, EWL_NOTEBOOK_TYPE);
+
+ if (visible)
+ {
+ ewl_widget_state_set(EWL_WIDGET(n->body.pages), "tabs",
+ EWL_STATE_PERSISTENT);
+ ewl_widget_show(n->body.tabbar);
+ }
+ else
+ {
+ ewl_widget_state_set(EWL_WIDGET(n->body.pages), "notabs",
+ EWL_STATE_PERSISTENT);
+ ewl_widget_hide(n->body.tabbar);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -257,12 +257,12 @@ ewl_notebook_tabbar_visible_set(Ewl_Notebook *n, unsigned int visible)
unsigned int
ewl_notebook_tabbar_visible_get(Ewl_Notebook *n)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(n, FALSE);
- DCHECK_TYPE_RET(n, EWL_NOTEBOOK_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(n, FALSE);
+ DCHECK_TYPE_RET(n, EWL_NOTEBOOK_TYPE, FALSE);
- DRETURN_INT(((VISIBLE(n->body.tabbar)) ? TRUE : FALSE),
- DLEVEL_STABLE);
+ DRETURN_INT(((VISIBLE(n->body.tabbar)) ? TRUE : FALSE),
+ DLEVEL_STABLE);
}
/**
@@ -274,38 +274,38 @@ ewl_notebook_tabbar_visible_get(Ewl_Notebook *n)
void
ewl_notebook_visible_page_set(Ewl_Notebook *n, Ewl_Widget *page)
{
- Ewl_Widget *t;
+ Ewl_Widget *t;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(n);
- DCHECK_TYPE(n, EWL_NOTEBOOK_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(n);
+ DCHECK_TYPE(n, EWL_NOTEBOOK_TYPE);
- if (page == n->cur_page)
- DRETURN(DLEVEL_STABLE);
+ if (page == n->cur_page)
+ DRETURN(DLEVEL_STABLE);
- if (n->cur_page)
- {
- Ewl_Widget *w;
+ if (n->cur_page)
+ {
+ Ewl_Widget *w;
- t = ewl_attach_widget_association_get(n->cur_page);
- if (t) ewl_widget_state_set(t, "default", EWL_STATE_PERSISTENT);
+ t = ewl_attach_widget_association_get(n->cur_page);
+ if (t) ewl_widget_state_set(t, "default", EWL_STATE_PERSISTENT);
- /* make sure we set n->cur_page null first or the hide
- * callback won't let us hide */
- w = n->cur_page;
- n->cur_page = NULL;
- ewl_widget_hide(w);
- }
+ /* make sure we set n->cur_page null first or the hide
+ * callback won't let us hide */
+ w = n->cur_page;
+ n->cur_page = NULL;
+ ewl_widget_hide(w);
+ }
- n->cur_page = page;
- ewl_widget_show(n->cur_page);
+ n->cur_page = page;
+ ewl_widget_show(n->cur_page);
- t = ewl_attach_widget_association_get(n->cur_page);
- if (t) ewl_widget_state_set(t, "selected", EWL_STATE_PERSISTENT);
+ t = ewl_attach_widget_association_get(n->cur_page);
+ if (t) ewl_widget_state_set(t, "selected", EWL_STATE_PERSISTENT);
- ewl_callback_call(EWL_WIDGET(n), EWL_CALLBACK_VALUE_CHANGED);
+ ewl_callback_call(EWL_WIDGET(n), EWL_CALLBACK_VALUE_CHANGED);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -316,11 +316,11 @@ ewl_notebook_visible_page_set(Ewl_Notebook *n, Ewl_Widget *page)
Ewl_Widget *
ewl_notebook_visible_page_get(Ewl_Notebook *n)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(n, NULL);
- DCHECK_TYPE_RET(n, EWL_NOTEBOOK_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(n, NULL);
+ DCHECK_TYPE_RET(n, EWL_NOTEBOOK_TYPE, NULL);
- DRETURN_PTR(n->cur_page, DLEVEL_STABLE);
+ DRETURN_PTR(n->cur_page, DLEVEL_STABLE);
}
/**
@@ -332,26 +332,26 @@ ewl_notebook_visible_page_get(Ewl_Notebook *n)
*/
void
ewl_notebook_page_tab_text_set(Ewl_Notebook *n, Ewl_Widget *page,
- const char *text)
+ const char *text)
{
- Ewl_Widget *t = NULL;
+ Ewl_Widget *t = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(n);
- DCHECK_PARAM_PTR(page);
- DCHECK_TYPE(n, EWL_NOTEBOOK_TYPE);
- DCHECK_TYPE(page, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(n);
+ DCHECK_PARAM_PTR(page);
+ DCHECK_TYPE(n, EWL_NOTEBOOK_TYPE);
+ DCHECK_TYPE(page, EWL_WIDGET_TYPE);
- if (text)
- {
- t = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(t), text);
- ewl_widget_show(t);
- }
+ if (text)
+ {
+ t = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(t), text);
+ ewl_widget_show(t);
+ }
- ewl_notebook_page_tab_widget_set(n, page, t);
+ ewl_notebook_page_tab_widget_set(n, page, t);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -363,18 +363,18 @@ ewl_notebook_page_tab_text_set(Ewl_Notebook *n, Ewl_Widget *page,
const char *
ewl_notebook_page_tab_text_get(Ewl_Notebook *n, Ewl_Widget *page)
{
- Ewl_Widget *o;
+ Ewl_Widget *o;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(n, EWL_NOTEBOOK_TYPE);
- DCHECK_PARAM_PTR_RET(page, EWL_WIDGET_TYPE);
- DCHECK_TYPE_RET(n, EWL_NOTEBOOK_TYPE, NULL);
- DCHECK_TYPE_RET(page, EWL_WIDGET_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(n, EWL_NOTEBOOK_TYPE);
+ DCHECK_PARAM_PTR_RET(page, EWL_WIDGET_TYPE);
+ DCHECK_TYPE_RET(n, EWL_NOTEBOOK_TYPE, NULL);
+ DCHECK_TYPE_RET(page, EWL_WIDGET_TYPE, NULL);
- /* get the label widget */
- o = ewl_notebook_page_tab_widget_get(n, page);
+ /* get the label widget */
+ o = ewl_notebook_page_tab_widget_get(n, page);
- DRETURN_PTR((o ? ewl_label_text_get(EWL_LABEL(o)) : NULL), DLEVEL_STABLE);
+ DRETURN_PTR((o ? ewl_label_text_get(EWL_LABEL(o)) : NULL), DLEVEL_STABLE);
}
/**
@@ -386,47 +386,47 @@ ewl_notebook_page_tab_text_get(Ewl_Notebook *n, Ewl_Widget *page)
*/
void
ewl_notebook_page_tab_widget_set(Ewl_Notebook *n, Ewl_Widget *page,
- Ewl_Widget *tab)
+ Ewl_Widget *tab)
{
- Ewl_Widget *t;
+ Ewl_Widget *t;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(n);
- DCHECK_PARAM_PTR(page);
- DCHECK_TYPE(n, EWL_NOTEBOOK_TYPE);
- DCHECK_TYPE(page, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(n);
+ DCHECK_PARAM_PTR(page);
+ DCHECK_TYPE(n, EWL_NOTEBOOK_TYPE);
+ DCHECK_TYPE(page, EWL_WIDGET_TYPE);
- if (!tab)
- {
- tab = ewl_hbox_new();
- ewl_widget_show(tab);
- }
+ if (!tab)
+ {
+ tab = ewl_hbox_new();
+ ewl_widget_show(tab);
+ }
- t = ewl_attach_widget_association_get(page);
- if (!t)
- {
- int idx = 0;
+ t = ewl_attach_widget_association_get(page);
+ if (!t)
+ {
+ int idx = 0;
- t = ewl_hbox_new();
- ewl_widget_appearance_set(t, "tab");
- ewl_attach_widget_association_set(page, t);
- ewl_attach_widget_association_set(t, page);
- ewl_widget_show(t);
+ t = ewl_hbox_new();
+ ewl_widget_appearance_set(t, "tab");
+ ewl_attach_widget_association_set(page, t);
+ ewl_attach_widget_association_set(t, page);
+ ewl_widget_show(t);
- ewl_callback_append(t, EWL_CALLBACK_CLICKED,
- ewl_notebook_cb_tab_clicked, n);
+ ewl_callback_append(t, EWL_CALLBACK_CLICKED,
+ ewl_notebook_cb_tab_clicked, n);
- idx = ewl_container_child_index_get(EWL_CONTAINER(n), page);
- ewl_container_child_insert(EWL_CONTAINER(n->body.tabbar), t, idx);
- }
+ idx = ewl_container_child_index_get(EWL_CONTAINER(n), page);
+ ewl_container_child_insert(EWL_CONTAINER(n->body.tabbar), t, idx);
+ }
- /* if this is the current page set it's tab to selected */
- if (n->cur_page == page)
- ewl_widget_state_set(t, "selected", EWL_STATE_PERSISTENT);
+ /* if this is the current page set it's tab to selected */
+ if (n->cur_page == page)
+ ewl_widget_state_set(t, "selected", EWL_STATE_PERSISTENT);
- ewl_container_child_append(EWL_CONTAINER(t), tab);
+ ewl_container_child_append(EWL_CONTAINER(t), tab);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -438,24 +438,24 @@ ewl_notebook_page_tab_widget_set(Ewl_Notebook *n, Ewl_Widget *page,
Ewl_Widget *
ewl_notebook_page_tab_widget_get(Ewl_Notebook *n, Ewl_Widget *page)
{
- Ewl_Widget *t, *o;
+ Ewl_Widget *t, *o;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(n, NULL);
- DCHECK_PARAM_PTR_RET(page, NULL);
- DCHECK_TYPE_RET(n, EWL_NOTEBOOK_TYPE, NULL);
- DCHECK_TYPE_RET(page, EWL_WIDGET_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(n, NULL);
+ DCHECK_PARAM_PTR_RET(page, NULL);
+ DCHECK_TYPE_RET(n, EWL_NOTEBOOK_TYPE, NULL);
+ DCHECK_TYPE_RET(page, EWL_WIDGET_TYPE, NULL);
- t = ewl_attach_widget_association_get(page);
- if (!t)
- {
- DWARNING("We have a notebook page with no tab, bad, very bad.");
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ t = ewl_attach_widget_association_get(page);
+ if (!t)
+ {
+ DWARNING("We have a notebook page with no tab, bad, very bad.");
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- o = ewl_container_child_get(EWL_CONTAINER(n), 0);
+ o = ewl_container_child_get(EWL_CONTAINER(n), 0);
- DRETURN_PTR(o, DLEVEL_STABLE);
+ DRETURN_PTR(o, DLEVEL_STABLE);
}
/**
@@ -467,13 +467,13 @@ ewl_notebook_page_tab_widget_get(Ewl_Notebook *n, Ewl_Widget *page)
void
ewl_notebook_tabbar_homogeneous_set(Ewl_Notebook *n, unsigned int h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(n);
- DCHECK_TYPE(n, EWL_NOTEBOOK_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(n);
+ DCHECK_TYPE(n, EWL_NOTEBOOK_TYPE);
- ewl_box_homogeneous_set(EWL_BOX(n->body.tabbar), !!h);
+ ewl_box_homogeneous_set(EWL_BOX(n->body.tabbar), !!h);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -484,12 +484,12 @@ ewl_notebook_tabbar_homogeneous_set(Ewl_Notebook *n, unsigned int h)
unsigned int
ewl_notebook_tabbar_homogeneous_get(Ewl_Notebook *n)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(n, 0);
- DCHECK_TYPE_RET(n, EWL_NOTEBOOK_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(n, 0);
+ DCHECK_TYPE_RET(n, EWL_NOTEBOOK_TYPE, 0);
- DRETURN_INT(ewl_box_homogeneous_get(EWL_BOX(n->body.tabbar)),
- DLEVEL_STABLE);
+ DRETURN_INT(ewl_box_homogeneous_get(EWL_BOX(n->body.tabbar)),
+ DLEVEL_STABLE);
}
/**
@@ -502,24 +502,24 @@ ewl_notebook_tabbar_homogeneous_get(Ewl_Notebook *n)
void
ewl_notebook_cb_child_show(Ewl_Container *c, Ewl_Widget *w)
{
- Ewl_Notebook *n;
- int pw, ph;
+ Ewl_Notebook *n;
+ int pw, ph;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- n = EWL_NOTEBOOK(EWL_WIDGET(c)->parent);
+ n = EWL_NOTEBOOK(EWL_WIDGET(c)->parent);
- if (n->cur_page != w)
- ewl_widget_hide(w);
+ if (n->cur_page != w)
+ ewl_widget_hide(w);
- ewl_object_preferred_size_get(EWL_OBJECT(n->cur_page), &pw, &ph);
- ewl_object_preferred_inner_size_set(EWL_OBJECT(n->body.pages), pw, ph);
+ ewl_object_preferred_size_get(EWL_OBJECT(n->cur_page), &pw, &ph);
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(n->body.pages), pw, ph);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -532,20 +532,20 @@ ewl_notebook_cb_child_show(Ewl_Container *c, Ewl_Widget *w)
void
ewl_notebook_cb_child_hide(Ewl_Container *c, Ewl_Widget *w)
{
- Ewl_Notebook *n;
+ Ewl_Notebook *n;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- n = EWL_NOTEBOOK(EWL_WIDGET(c)->parent);
+ n = EWL_NOTEBOOK(EWL_WIDGET(c)->parent);
- if (n->cur_page == w)
- ewl_widget_show(w);
+ if (n->cur_page == w)
+ ewl_widget_show(w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -558,27 +558,27 @@ ewl_notebook_cb_child_hide(Ewl_Container *c, Ewl_Widget *w)
void
ewl_notebook_cb_child_add(Ewl_Container *c, Ewl_Widget *w)
{
- Ewl_Notebook *n;
+ Ewl_Notebook *n;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- n = EWL_NOTEBOOK(EWL_WIDGET(c)->parent);
+ n = EWL_NOTEBOOK(EWL_WIDGET(c)->parent);
- /* stick a null tab in there so that it at least shows up */
- ewl_notebook_page_tab_widget_set(n, w, NULL);
+ /* stick a null tab in there so that it at least shows up */
+ ewl_notebook_page_tab_widget_set(n, w, NULL);
- /* we have no current page, make it this one */
- if (!n->cur_page)
- {
- ewl_notebook_visible_page_set(n, w);
- ewl_widget_show(w);
- }
+ /* we have no current page, make it this one */
+ if (!n->cur_page)
+ {
+ ewl_notebook_visible_page_set(n, w);
+ ewl_widget_show(w);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -591,53 +591,53 @@ ewl_notebook_cb_child_add(Ewl_Container *c, Ewl_Widget *w)
*/
void
ewl_notebook_cb_child_remove(Ewl_Container *c, Ewl_Widget *w,
- int rem_idx __UNUSED__)
+ int rem_idx __UNUSED__)
{
- Ewl_Widget *t;
- Ewl_Notebook *n;
- int idx = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- n = EWL_NOTEBOOK(EWL_WIDGET(c)->parent);
-
- /* we still have a tab, delete it */
- t = ewl_attach_widget_association_get(w);
- if (t)
- {
- idx = ewl_container_child_index_get(
- EWL_CONTAINER(n->body.tabbar), t);
-
- ewl_widget_destroy(t);
- }
-
- /* change visible pages if needed */
- if (w == n->cur_page)
- {
- Ewl_Widget *page, *new_tab;
- int count;
-
- /* make sure we aren't off the end of the list */
- count = ewl_container_child_count_get(EWL_CONTAINER(n->body.tabbar));
- if (idx >= count) idx = count - 1;
-
- new_tab = ewl_container_child_get(
- EWL_CONTAINER(n->body.tabbar), idx);
-
- if (new_tab)
- {
- page = ewl_attach_widget_association_get(new_tab);
- if (page)
- ewl_notebook_visible_page_set(
- EWL_NOTEBOOK(n), page);
- }
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Widget *t;
+ Ewl_Notebook *n;
+ int idx = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ n = EWL_NOTEBOOK(EWL_WIDGET(c)->parent);
+
+ /* we still have a tab, delete it */
+ t = ewl_attach_widget_association_get(w);
+ if (t)
+ {
+ idx = ewl_container_child_index_get(
+ EWL_CONTAINER(n->body.tabbar), t);
+
+ ewl_widget_destroy(t);
+ }
+
+ /* change visible pages if needed */
+ if (w == n->cur_page)
+ {
+ Ewl_Widget *page, *new_tab;
+ int count;
+
+ /* make sure we aren't off the end of the list */
+ count = ewl_container_child_count_get(EWL_CONTAINER(n->body.tabbar));
+ if (idx >= count) idx = count - 1;
+
+ new_tab = ewl_container_child_get(
+ EWL_CONTAINER(n->body.tabbar), idx);
+
+ if (new_tab)
+ {
+ page = ewl_attach_widget_association_get(new_tab);
+ if (page)
+ ewl_notebook_visible_page_set(
+ EWL_NOTEBOOK(n), page);
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -651,19 +651,19 @@ ewl_notebook_cb_child_remove(Ewl_Container *c, Ewl_Widget *w,
void
ewl_notebook_cb_tab_clicked(Ewl_Widget *w, void *ev __UNUSED__, void *data)
{
- Ewl_Widget *page;
- Ewl_Notebook *n;
+ Ewl_Widget *page;
+ Ewl_Notebook *n;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- DCHECK_TYPE(data, EWL_NOTEBOOK_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DCHECK_TYPE(data, EWL_NOTEBOOK_TYPE);
- n = data;
- page = ewl_attach_widget_association_get(w);
- ewl_notebook_visible_page_set(n, page);
+ n = data;
+ page = ewl_attach_widget_association_get(w);
+ ewl_notebook_visible_page_set(n, page);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_notebook.h b/src/lib/ewl_notebook.h
index bc48c2f..31e2633 100644
--- a/src/lib/ewl_notebook.h
+++ b/src/lib/ewl_notebook.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_NOTEBOOK_H
#define EWL_NOTEBOOK_H
@@ -53,50 +53,50 @@ typedef struct Ewl_Notebook Ewl_Notebook;
*/
struct Ewl_Notebook
{
- Ewl_Box box; /**< Inherit from Ewl_Box */
+ Ewl_Box box; /**< Inherit from Ewl_Box */
- struct {
- Ewl_Widget *tabbar; /**< Holds the tabs */
- Ewl_Widget *pages; /**< Holds the notebook pages */
- } body; /**< The body of the notebook */
+ struct {
+ Ewl_Widget *tabbar; /**< Holds the tabs */
+ Ewl_Widget *pages; /**< Holds the notebook pages */
+ } body; /**< The body of the notebook */
- Ewl_Widget *cur_page; /**< The currently active page */
- Ewl_Position tabbar_position; /**< The position of the tabbar in the notebook */
+ Ewl_Widget *cur_page; /**< The currently active page */
+ Ewl_Position tabbar_position; /**< The position of the tabbar in the notebook */
};
-Ewl_Widget *ewl_notebook_new(void);
-int ewl_notebook_init(Ewl_Notebook *n);
-
-void ewl_notebook_tabbar_alignment_set(Ewl_Notebook *n,
- unsigned int align);
-unsigned int ewl_notebook_tabbar_alignment_get(Ewl_Notebook *n);
-
-void ewl_notebook_tabbar_position_set(Ewl_Notebook *n,
- Ewl_Position pos);
-Ewl_Position ewl_notebook_tabbar_position_get(Ewl_Notebook *n);
-
-void ewl_notebook_tabbar_visible_set(Ewl_Notebook *n,
- unsigned int visible);
-unsigned int ewl_notebook_tabbar_visible_get(Ewl_Notebook *n);
-void ewl_notebook_tabbar_homogeneous_set(Ewl_Notebook *n,
- unsigned int h);
-unsigned int ewl_notebook_tabbar_homogeneous_get(Ewl_Notebook *n);
-
-void ewl_notebook_visible_page_set(Ewl_Notebook *n,
- Ewl_Widget *page);
-Ewl_Widget *ewl_notebook_visible_page_get(Ewl_Notebook *n);
-
-void ewl_notebook_page_tab_text_set(Ewl_Notebook *n,
- Ewl_Widget *page,
- const char *text);
-const char *ewl_notebook_page_tab_text_get(Ewl_Notebook *n,
- Ewl_Widget *page);
-
-void ewl_notebook_page_tab_widget_set(Ewl_Notebook *n,
- Ewl_Widget *page,
- Ewl_Widget *tab);
-Ewl_Widget *ewl_notebook_page_tab_widget_get(Ewl_Notebook *n,
- Ewl_Widget *page);
+Ewl_Widget *ewl_notebook_new(void);
+int ewl_notebook_init(Ewl_Notebook *n);
+
+void ewl_notebook_tabbar_alignment_set(Ewl_Notebook *n,
+ unsigned int align);
+unsigned int ewl_notebook_tabbar_alignment_get(Ewl_Notebook *n);
+
+void ewl_notebook_tabbar_position_set(Ewl_Notebook *n,
+ Ewl_Position pos);
+Ewl_Position ewl_notebook_tabbar_position_get(Ewl_Notebook *n);
+
+void ewl_notebook_tabbar_visible_set(Ewl_Notebook *n,
+ unsigned int visible);
+unsigned int ewl_notebook_tabbar_visible_get(Ewl_Notebook *n);
+void ewl_notebook_tabbar_homogeneous_set(Ewl_Notebook *n,
+ unsigned int h);
+unsigned int ewl_notebook_tabbar_homogeneous_get(Ewl_Notebook *n);
+
+void ewl_notebook_visible_page_set(Ewl_Notebook *n,
+ Ewl_Widget *page);
+Ewl_Widget *ewl_notebook_visible_page_get(Ewl_Notebook *n);
+
+void ewl_notebook_page_tab_text_set(Ewl_Notebook *n,
+ Ewl_Widget *page,
+ const char *text);
+const char *ewl_notebook_page_tab_text_get(Ewl_Notebook *n,
+ Ewl_Widget *page);
+
+void ewl_notebook_page_tab_widget_set(Ewl_Notebook *n,
+ Ewl_Widget *page,
+ Ewl_Widget *tab);
+Ewl_Widget *ewl_notebook_page_tab_widget_get(Ewl_Notebook *n,
+ Ewl_Widget *page);
/*
* Internal stuff.
diff --git a/src/lib/ewl_object.c b/src/lib/ewl_object.c
index 9c5c754..1afbccc 100644
--- a/src/lib/ewl_object.c
+++ b/src/lib/ewl_object.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_private.h"
#include "ewl_macros.h"
@@ -18,27 +18,27 @@
int
ewl_object_init(Ewl_Object *o)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(o, FALSE);
-
- /*
- * Set the default minimum sizes.
- */
- ewl_object_minimum_size_set(o, EWL_OBJECT_MIN_SIZE,
- EWL_OBJECT_MIN_SIZE);
-
- /*
- * Set the default maximum sizes.
- */
- ewl_object_maximum_size_set(o, EWL_OBJECT_MAX_SIZE,
- EWL_OBJECT_MAX_SIZE);
-
- /*
- * Set the default fill policy and alignment for the object.
- */
- o->flags = EWL_FLAG_FILL_NORMAL;
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(o, FALSE);
+
+ /*
+ * Set the default minimum sizes.
+ */
+ ewl_object_minimum_size_set(o, EWL_OBJECT_MIN_SIZE,
+ EWL_OBJECT_MIN_SIZE);
+
+ /*
+ * Set the default maximum sizes.
+ */
+ ewl_object_maximum_size_set(o, EWL_OBJECT_MAX_SIZE,
+ EWL_OBJECT_MAX_SIZE);
+
+ /*
+ * Set the default fill policy and alignment for the object.
+ */
+ o->flags = EWL_FLAG_FILL_NORMAL;
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -56,15 +56,15 @@ ewl_object_init(Ewl_Object *o)
void
ewl_object_current_geometry_get(Ewl_Object *o, int *x, int *y, int *w, int *h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- if (x) *x = ewl_object_current_x_get(o);
- if (y) *y = ewl_object_current_y_get(o);
- if (w) *w = ewl_object_current_w_get(o);
- if (h) *h = ewl_object_current_h_get(o);
+ if (x) *x = ewl_object_current_x_get(o);
+ if (y) *y = ewl_object_current_y_get(o);
+ if (w) *w = ewl_object_current_w_get(o);
+ if (h) *h = ewl_object_current_h_get(o);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -80,13 +80,13 @@ ewl_object_current_geometry_get(Ewl_Object *o, int *x, int *y, int *w, int *h)
void
ewl_object_current_size_get(Ewl_Object *o, int *w, int *h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- if (w) *w = ewl_object_current_w_get(o);
- if (h) *h = ewl_object_current_h_get(o);
+ if (w) *w = ewl_object_current_w_get(o);
+ if (h) *h = ewl_object_current_h_get(o);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -97,11 +97,11 @@ ewl_object_current_size_get(Ewl_Object *o, int *w, int *h)
int
ewl_object_current_x_get(Ewl_Object *o)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(o, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(o, 0);
- DRETURN_INT(CURRENT_X(o) - PADDING_LEFT(o) - INSET_LEFT(o),
- DLEVEL_STABLE);
+ DRETURN_INT(CURRENT_X(o) - PADDING_LEFT(o) - INSET_LEFT(o),
+ DLEVEL_STABLE);
}
/**
@@ -112,11 +112,11 @@ ewl_object_current_x_get(Ewl_Object *o)
int
ewl_object_current_y_get(Ewl_Object *o)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(o, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(o, 0);
- DRETURN_INT(CURRENT_Y(o) - PADDING_TOP(o) - INSET_TOP(o),
- DLEVEL_STABLE);
+ DRETURN_INT(CURRENT_Y(o) - PADDING_TOP(o) - INSET_TOP(o),
+ DLEVEL_STABLE);
}
/**
@@ -127,26 +127,26 @@ ewl_object_current_y_get(Ewl_Object *o)
int
ewl_object_current_w_get(Ewl_Object *o)
{
- int w;
+ int w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(o, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(o, 0);
- w = CURRENT_W(o);
- if (w < MINIMUM_W(o))
- w = MINIMUM_W(o);
+ w = CURRENT_W(o);
+ if (w < MINIMUM_W(o))
+ w = MINIMUM_W(o);
- if (w < PREFERRED_W(o) && !(ewl_object_fill_policy_get(o) &
- EWL_FLAG_FILL_HSHRINK))
- w = PREFERRED_W(o);
+ if (w < PREFERRED_W(o) && !(ewl_object_fill_policy_get(o) &
+ EWL_FLAG_FILL_HSHRINK))
+ w = PREFERRED_W(o);
- if (w > MAXIMUM_W(o))
- w = MAXIMUM_W(o);
+ if (w > MAXIMUM_W(o))
+ w = MAXIMUM_W(o);
- if ((w + PADDING_HORIZONTAL(o) + INSET_HORIZONTAL(o)) > w)
- w += PADDING_HORIZONTAL(o) + INSET_HORIZONTAL(o);
+ if ((w + PADDING_HORIZONTAL(o) + INSET_HORIZONTAL(o)) > w)
+ w += PADDING_HORIZONTAL(o) + INSET_HORIZONTAL(o);
- DRETURN_INT(w, DLEVEL_STABLE);
+ DRETURN_INT(w, DLEVEL_STABLE);
}
/**
@@ -157,26 +157,26 @@ ewl_object_current_w_get(Ewl_Object *o)
int
ewl_object_current_h_get(Ewl_Object *o)
{
- int h;
+ int h;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(o, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(o, 0);
- h = CURRENT_H(o);
- if (h < MINIMUM_H(o))
- h = MINIMUM_H(o);
+ h = CURRENT_H(o);
+ if (h < MINIMUM_H(o))
+ h = MINIMUM_H(o);
- if (h < PREFERRED_H(o) && !(ewl_object_fill_policy_get(o) &
- EWL_FLAG_FILL_VSHRINK))
- h = PREFERRED_H(o);
+ if (h < PREFERRED_H(o) && !(ewl_object_fill_policy_get(o) &
+ EWL_FLAG_FILL_VSHRINK))
+ h = PREFERRED_H(o);
- if (h > MAXIMUM_H(o))
- h = MAXIMUM_H(o);
+ if (h > MAXIMUM_H(o))
+ h = MAXIMUM_H(o);
- if ((h + PADDING_VERTICAL(o) + INSET_VERTICAL(o)) > h)
- h += PADDING_VERTICAL(o) + INSET_VERTICAL(o);
+ if ((h + PADDING_VERTICAL(o) + INSET_VERTICAL(o)) > h)
+ h += PADDING_VERTICAL(o) + INSET_VERTICAL(o);
- DRETURN_INT(h, DLEVEL_STABLE);
+ DRETURN_INT(h, DLEVEL_STABLE);
}
/**
@@ -194,13 +194,13 @@ ewl_object_current_h_get(Ewl_Object *o)
void
ewl_object_preferred_inner_size_set(Ewl_Object *o, int w, int h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- ewl_object_preferred_inner_w_set(o, w);
- ewl_object_preferred_inner_h_set(o, h);
+ ewl_object_preferred_inner_w_set(o, w);
+ ewl_object_preferred_inner_h_set(o, h);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -215,37 +215,37 @@ ewl_object_preferred_inner_size_set(Ewl_Object *o, int w, int h)
void
ewl_object_preferred_inner_w_set(Ewl_Object *o, int w)
{
- int old_size;
- unsigned int resize, fill;
+ int old_size;
+ unsigned int resize, fill;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- /*
- * Store the previous size.
- */
- old_size = PREFERRED_W(o);
+ /*
+ * Store the previous size.
+ */
+ old_size = PREFERRED_W(o);
- o->preferred.w = w;
+ o->preferred.w = w;
- if (CURRENT_W(o) < PREFERRED_W(o))
- fill = EWL_FLAG_FILL_HSHRINK;
- else if (CURRENT_W(o) > PREFERRED_W(o))
- fill = EWL_FLAG_FILL_HFILL;
- else
- fill = 0;
+ if (CURRENT_W(o) < PREFERRED_W(o))
+ fill = EWL_FLAG_FILL_HSHRINK;
+ else if (CURRENT_W(o) > PREFERRED_W(o))
+ fill = EWL_FLAG_FILL_HFILL;
+ else
+ fill = 0;
- resize = ewl_object_fill_policy_get(EWL_OBJECT(o));
+ resize = ewl_object_fill_policy_get(EWL_OBJECT(o));
- /*
- * Now update the widgets parent of the change in size if necessary.
- */
- if (!(resize & fill))
- ewl_container_child_resize(EWL_WIDGET(o),
- PREFERRED_W(o) - old_size,
- EWL_ORIENTATION_HORIZONTAL);
+ /*
+ * Now update the widgets parent of the change in size if necessary.
+ */
+ if (!(resize & fill))
+ ewl_container_child_resize(EWL_WIDGET(o),
+ PREFERRED_W(o) - old_size,
+ EWL_ORIENTATION_HORIZONTAL);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -260,37 +260,37 @@ ewl_object_preferred_inner_w_set(Ewl_Object *o, int w)
void
ewl_object_preferred_inner_h_set(Ewl_Object *o, int h)
{
- int old_size;
- unsigned int resize, fill;
+ int old_size;
+ unsigned int resize, fill;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- /*
- * Store the previous size
- */
- old_size = PREFERRED_H(o);
+ /*
+ * Store the previous size
+ */
+ old_size = PREFERRED_H(o);
- o->preferred.h = h;
+ o->preferred.h = h;
- if (CURRENT_H(o) < PREFERRED_H(o))
- fill = EWL_FLAG_FILL_VSHRINK;
- else if (CURRENT_H(o) > PREFERRED_H(o))
- fill = EWL_FLAG_FILL_VFILL;
- else
- fill = 0;
+ if (CURRENT_H(o) < PREFERRED_H(o))
+ fill = EWL_FLAG_FILL_VSHRINK;
+ else if (CURRENT_H(o) > PREFERRED_H(o))
+ fill = EWL_FLAG_FILL_VFILL;
+ else
+ fill = 0;
- resize = ewl_object_fill_policy_get(EWL_OBJECT(o));
+ resize = ewl_object_fill_policy_get(EWL_OBJECT(o));
- /*
- * Now update the widgets parent of the change in size if necessary.
- */
- if (!(resize & fill))
- ewl_container_child_resize(EWL_WIDGET(o),
- PREFERRED_H(o) - old_size,
- EWL_ORIENTATION_VERTICAL);
+ /*
+ * Now update the widgets parent of the change in size if necessary.
+ */
+ if (!(resize & fill))
+ ewl_container_child_resize(EWL_WIDGET(o),
+ PREFERRED_H(o) - old_size,
+ EWL_ORIENTATION_VERTICAL);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -306,13 +306,13 @@ ewl_object_preferred_inner_h_set(Ewl_Object *o, int h)
void
ewl_object_preferred_size_get(Ewl_Object *o, int *w, int *h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- if (w) *w = ewl_object_preferred_w_get(o);
- if (h) *h = ewl_object_preferred_h_get(o);
+ if (w) *w = ewl_object_preferred_w_get(o);
+ if (h) *h = ewl_object_preferred_h_get(o);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -323,23 +323,23 @@ ewl_object_preferred_size_get(Ewl_Object *o, int *w, int *h)
int
ewl_object_preferred_w_get(Ewl_Object *o)
{
- int add, temp;
+ int add, temp;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(o, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(o, 0);
- add = INSET_HORIZONTAL(o) + PADDING_HORIZONTAL(o);
+ add = INSET_HORIZONTAL(o) + PADDING_HORIZONTAL(o);
- if (PREFERRED_W(o) < MINIMUM_W(o))
- temp = MINIMUM_W(o);
- else if (PREFERRED_W(o) > MAXIMUM_W(o))
- temp = MAXIMUM_W(o);
- else
- temp = PREFERRED_W(o);
+ if (PREFERRED_W(o) < MINIMUM_W(o))
+ temp = MINIMUM_W(o);
+ else if (PREFERRED_W(o) > MAXIMUM_W(o))
+ temp = MAXIMUM_W(o);
+ else
+ temp = PREFERRED_W(o);
- temp += add;
+ temp += add;
- DRETURN_INT(temp, DLEVEL_STABLE);
+ DRETURN_INT(temp, DLEVEL_STABLE);
}
/**
@@ -350,23 +350,23 @@ ewl_object_preferred_w_get(Ewl_Object *o)
int
ewl_object_preferred_h_get(Ewl_Object *o)
{
- int add, temp;
+ int add, temp;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(o, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(o, 0);
- add = INSET_VERTICAL(o) + PADDING_VERTICAL(o);
+ add = INSET_VERTICAL(o) + PADDING_VERTICAL(o);
- if (PREFERRED_H(o) < MINIMUM_H(o))
- temp = MINIMUM_H(o);
- else if (PREFERRED_H(o) > MAXIMUM_H(o))
- temp = MAXIMUM_H(o);
- else
- temp = PREFERRED_H(o);
+ if (PREFERRED_H(o) < MINIMUM_H(o))
+ temp = MINIMUM_H(o);
+ else if (PREFERRED_H(o) > MAXIMUM_H(o))
+ temp = MAXIMUM_H(o);
+ else
+ temp = PREFERRED_H(o);
- temp += add;
+ temp += add;
- DRETURN_INT(temp, DLEVEL_STABLE);
+ DRETURN_INT(temp, DLEVEL_STABLE);
}
/**
@@ -382,13 +382,13 @@ ewl_object_preferred_h_get(Ewl_Object *o)
void
ewl_object_preferred_inner_size_get(Ewl_Object *o, int *w, int *h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- if (w) *w = ewl_object_preferred_inner_w_get(o);
- if (h) *h = ewl_object_preferred_inner_h_get(o);
+ if (w) *w = ewl_object_preferred_inner_w_get(o);
+ if (h) *h = ewl_object_preferred_inner_h_get(o);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -399,14 +399,14 @@ ewl_object_preferred_inner_size_get(Ewl_Object *o, int *w, int *h)
int
ewl_object_preferred_inner_w_get(Ewl_Object *o)
{
- int temp;
+ int temp;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(o, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(o, 0);
- temp = PREFERRED_W(o);
+ temp = PREFERRED_W(o);
- DRETURN_INT(temp, DLEVEL_STABLE);
+ DRETURN_INT(temp, DLEVEL_STABLE);
}
/**
@@ -417,14 +417,14 @@ ewl_object_preferred_inner_w_get(Ewl_Object *o)
int
ewl_object_preferred_inner_h_get(Ewl_Object *o)
{
- int temp;
+ int temp;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(o, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(o, 0);
- temp = PREFERRED_H(o);
+ temp = PREFERRED_H(o);
- DRETURN_INT(temp, DLEVEL_STABLE);
+ DRETURN_INT(temp, DLEVEL_STABLE);
}
/**
@@ -442,16 +442,16 @@ ewl_object_preferred_inner_h_get(Ewl_Object *o)
void
ewl_object_geometry_request(Ewl_Object *o, int x, int y, int w, int h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- /*
- * Pass the parameters on to the appropriate object request functions.
- */
- ewl_object_position_request(o, x, y);
- ewl_object_size_request(o, w, h);
+ /*
+ * Pass the parameters on to the appropriate object request functions.
+ */
+ ewl_object_position_request(o, x, y);
+ ewl_object_size_request(o, w, h);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -467,13 +467,13 @@ ewl_object_geometry_request(Ewl_Object *o, int x, int y, int w, int h)
void
ewl_object_size_request(Ewl_Object *o, int w, int h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- ewl_object_w_request(o, w);
- ewl_object_h_request(o, h);
+ ewl_object_w_request(o, w);
+ ewl_object_h_request(o, h);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -489,13 +489,13 @@ ewl_object_size_request(Ewl_Object *o, int w, int h)
void
ewl_object_position_request(Ewl_Object *o, int x, int y)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- ewl_object_x_request(o, x);
- ewl_object_y_request(o, y);
+ ewl_object_x_request(o, x);
+ ewl_object_y_request(o, y);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -510,13 +510,13 @@ ewl_object_position_request(Ewl_Object *o, int x, int y)
void
ewl_object_x_request(Ewl_Object *o, int x)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- o->current.x = x + PADDING_LEFT(o) + INSET_LEFT(o);
- ewl_widget_configure(EWL_WIDGET(o));
+ o->current.x = x + PADDING_LEFT(o) + INSET_LEFT(o);
+ ewl_widget_configure(EWL_WIDGET(o));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -531,13 +531,13 @@ ewl_object_x_request(Ewl_Object *o, int x)
void
ewl_object_y_request(Ewl_Object *o, int y)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- o->current.y = y + PADDING_TOP(o) + INSET_TOP(o);
- ewl_widget_configure(EWL_WIDGET(o));
+ o->current.y = y + PADDING_TOP(o) + INSET_TOP(o);
+ ewl_widget_configure(EWL_WIDGET(o));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -551,33 +551,33 @@ ewl_object_y_request(Ewl_Object *o, int y)
void
ewl_object_w_request(Ewl_Object *o, int w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
-
- if (w > PADDING_HORIZONTAL(o) + INSET_HORIZONTAL(o))
- w -= PADDING_HORIZONTAL(o) + INSET_HORIZONTAL(o);
- else
- w = 0;
-
- /*
- * Bound the width by the preferred size first.
- */
- if ((w < o->preferred.w && !(o->flags & EWL_FLAG_FILL_HSHRINK))
- || (w > o->preferred.w && !(o->flags & EWL_FLAG_FILL_HFILL)))
- w = o->preferred.w;
-
- /*
- * Now bound it by the min's and max's to achieve the desired size.
- */
- if (w < MINIMUM_W(o))
- w = MINIMUM_W(o);
- else if (w > MAXIMUM_W(o))
- w = MAXIMUM_W(o);
-
- o->current.w = w;
- ewl_widget_configure(EWL_WIDGET(o));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
+
+ if (w > PADDING_HORIZONTAL(o) + INSET_HORIZONTAL(o))
+ w -= PADDING_HORIZONTAL(o) + INSET_HORIZONTAL(o);
+ else
+ w = 0;
+
+ /*
+ * Bound the width by the preferred size first.
+ */
+ if ((w < o->preferred.w && !(o->flags & EWL_FLAG_FILL_HSHRINK))
+ || (w > o->preferred.w && !(o->flags & EWL_FLAG_FILL_HFILL)))
+ w = o->preferred.w;
+
+ /*
+ * Now bound it by the min's and max's to achieve the desired size.
+ */
+ if (w < MINIMUM_W(o))
+ w = MINIMUM_W(o);
+ else if (w > MAXIMUM_W(o))
+ w = MAXIMUM_W(o);
+
+ o->current.w = w;
+ ewl_widget_configure(EWL_WIDGET(o));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -591,33 +591,33 @@ ewl_object_w_request(Ewl_Object *o, int w)
void
ewl_object_h_request(Ewl_Object *o, int h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
-
- if (h > PADDING_VERTICAL(o) + INSET_VERTICAL(o))
- h -= PADDING_VERTICAL(o) + INSET_VERTICAL(o);
- else
- h = 0;
-
- /*
- * Bound the width by the preferred size first.
- */
- if ((h < o->preferred.h && !(o->flags & EWL_FLAG_FILL_VSHRINK))
- || (h > o->preferred.h && !(o->flags & EWL_FLAG_FILL_VFILL)))
- h = o->preferred.h;
-
- /*
- * Now bound it by the min's and max's to achieve the desired size.
- */
- if (h < MINIMUM_H(o))
- h = MINIMUM_H(o);
- else if (h > MAXIMUM_H(o))
- h = MAXIMUM_H(o);
-
- o->current.h = h;
- ewl_widget_configure(EWL_WIDGET(o));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
+
+ if (h > PADDING_VERTICAL(o) + INSET_VERTICAL(o))
+ h -= PADDING_VERTICAL(o) + INSET_VERTICAL(o);
+ else
+ h = 0;
+
+ /*
+ * Bound the width by the preferred size first.
+ */
+ if ((h < o->preferred.h && !(o->flags & EWL_FLAG_FILL_VSHRINK))
+ || (h > o->preferred.h && !(o->flags & EWL_FLAG_FILL_VFILL)))
+ h = o->preferred.h;
+
+ /*
+ * Now bound it by the min's and max's to achieve the desired size.
+ */
+ if (h < MINIMUM_H(o))
+ h = MINIMUM_H(o);
+ else if (h > MAXIMUM_H(o))
+ h = MAXIMUM_H(o);
+
+ o->current.h = h;
+ ewl_widget_configure(EWL_WIDGET(o));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -634,13 +634,13 @@ ewl_object_h_request(Ewl_Object *o, int h)
void
ewl_object_minimum_size_set(Ewl_Object *o, int w, int h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- ewl_object_minimum_w_set(o, w);
- ewl_object_minimum_h_set(o, h);
+ ewl_object_minimum_w_set(o, w);
+ ewl_object_minimum_h_set(o, h);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -656,32 +656,32 @@ ewl_object_minimum_size_set(Ewl_Object *o, int w, int h)
void
ewl_object_minimum_w_set(Ewl_Object *o, int w)
{
- int old_size, new_size;
+ int old_size, new_size;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- if (w < EWL_OBJECT_MIN_SIZE)
- w = EWL_OBJECT_MIN_SIZE;
+ if (w < EWL_OBJECT_MIN_SIZE)
+ w = EWL_OBJECT_MIN_SIZE;
- if (w > EWL_OBJECT_MAX_SIZE)
- w = EWL_OBJECT_MAX_SIZE;
+ if (w > EWL_OBJECT_MAX_SIZE)
+ w = EWL_OBJECT_MAX_SIZE;
- old_size = MINIMUM_W(o);
- new_size = o->minimum.w = w;
+ old_size = MINIMUM_W(o);
+ new_size = o->minimum.w = w;
- if (MAXIMUM_W(o) < w)
- o->minimum.w = w;
+ if (MAXIMUM_W(o) < w)
+ o->minimum.w = w;
- if (PREFERRED_W(o) < MINIMUM_W(o))
- ewl_container_child_resize(EWL_WIDGET(o),
- MINIMUM_W(o) - PREFERRED_W(o),
- EWL_ORIENTATION_HORIZONTAL);
+ if (PREFERRED_W(o) < MINIMUM_W(o))
+ ewl_container_child_resize(EWL_WIDGET(o),
+ MINIMUM_W(o) - PREFERRED_W(o),
+ EWL_ORIENTATION_HORIZONTAL);
- if (CURRENT_W(o) < w)
- ewl_object_w_request(o, w);
+ if (CURRENT_W(o) < w)
+ ewl_object_w_request(o, w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -697,32 +697,32 @@ ewl_object_minimum_w_set(Ewl_Object *o, int w)
void
ewl_object_minimum_h_set(Ewl_Object *o, int h)
{
- int old_size, new_size;
+ int old_size, new_size;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- if (h < EWL_OBJECT_MIN_SIZE)
- h = EWL_OBJECT_MIN_SIZE;
+ if (h < EWL_OBJECT_MIN_SIZE)
+ h = EWL_OBJECT_MIN_SIZE;
- if (h > EWL_OBJECT_MAX_SIZE)
- h = EWL_OBJECT_MAX_SIZE;
+ if (h > EWL_OBJECT_MAX_SIZE)
+ h = EWL_OBJECT_MAX_SIZE;
- old_size = MINIMUM_H(o);
- new_size = o->minimum.h = h;
+ old_size = MINIMUM_H(o);
+ new_size = o->minimum.h = h;
- if (MAXIMUM_H(o) < h)
- o->minimum.h = h;
+ if (MAXIMUM_H(o) < h)
+ o->minimum.h = h;
- if (PREFERRED_H(o) < MINIMUM_H(o))
- ewl_container_child_resize(EWL_WIDGET(o),
- MINIMUM_H(o) - PREFERRED_H(o),
- EWL_ORIENTATION_VERTICAL);
+ if (PREFERRED_H(o) < MINIMUM_H(o))
+ ewl_container_child_resize(EWL_WIDGET(o),
+ MINIMUM_H(o) - PREFERRED_H(o),
+ EWL_ORIENTATION_VERTICAL);
- if (CURRENT_H(o) < h)
- ewl_object_h_request(o, h);
+ if (CURRENT_H(o) < h)
+ ewl_object_h_request(o, h);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -733,18 +733,18 @@ ewl_object_minimum_h_set(Ewl_Object *o, int h)
int
ewl_object_minimum_w_get(Ewl_Object *o)
{
- int val;
+ int val;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(o, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(o, 0);
- if (o->flags & EWL_FLAG_FILL_HSHRINK || MINIMUM_W(o) > PREFERRED_W(o))
- val = MINIMUM_W(o);
- else
- val = PREFERRED_W(o);
+ if (o->flags & EWL_FLAG_FILL_HSHRINK || MINIMUM_W(o) > PREFERRED_W(o))
+ val = MINIMUM_W(o);
+ else
+ val = PREFERRED_W(o);
- DRETURN_INT(val + PADDING_HORIZONTAL(o) + INSET_HORIZONTAL(o),
- DLEVEL_STABLE);
+ DRETURN_INT(val + PADDING_HORIZONTAL(o) + INSET_HORIZONTAL(o),
+ DLEVEL_STABLE);
}
/**
@@ -755,18 +755,18 @@ ewl_object_minimum_w_get(Ewl_Object *o)
int
ewl_object_minimum_h_get(Ewl_Object *o)
{
- int val;
+ int val;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(o, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(o, 0);
- if (o->flags & EWL_FLAG_FILL_VSHRINK || MINIMUM_H(o) > PREFERRED_H(o))
- val = MINIMUM_H(o);
- else
- val = PREFERRED_H(o);
+ if (o->flags & EWL_FLAG_FILL_VSHRINK || MINIMUM_H(o) > PREFERRED_H(o))
+ val = MINIMUM_H(o);
+ else
+ val = PREFERRED_H(o);
- DRETURN_INT(val + PADDING_VERTICAL(o) + INSET_VERTICAL(o),
- DLEVEL_STABLE);
+ DRETURN_INT(val + PADDING_VERTICAL(o) + INSET_VERTICAL(o),
+ DLEVEL_STABLE);
}
/**
@@ -782,13 +782,13 @@ ewl_object_minimum_h_get(Ewl_Object *o)
void
ewl_object_minimum_size_get(Ewl_Object *o, int *w, int *h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- if (w) *w = ewl_object_minimum_w_get(o);
- if (h) *h = ewl_object_minimum_h_get(o);
+ if (w) *w = ewl_object_minimum_w_get(o);
+ if (h) *h = ewl_object_minimum_h_get(o);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -805,13 +805,13 @@ ewl_object_minimum_size_get(Ewl_Object *o, int *w, int *h)
void
ewl_object_maximum_size_set(Ewl_Object *o, int w, int h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- ewl_object_maximum_w_set(o, w);
- ewl_object_maximum_h_set(o, h);
+ ewl_object_maximum_w_set(o, w);
+ ewl_object_maximum_h_set(o, h);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -827,27 +827,27 @@ ewl_object_maximum_size_set(Ewl_Object *o, int w, int h)
void
ewl_object_maximum_w_set(Ewl_Object *o, int w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- if (w < EWL_OBJECT_MIN_SIZE)
- w = EWL_OBJECT_MIN_SIZE;
+ if (w < EWL_OBJECT_MIN_SIZE)
+ w = EWL_OBJECT_MIN_SIZE;
- if (w > EWL_OBJECT_MAX_SIZE)
- w = EWL_OBJECT_MAX_SIZE;
+ if (w > EWL_OBJECT_MAX_SIZE)
+ w = EWL_OBJECT_MAX_SIZE;
- o->maximum.w = w;
+ o->maximum.w = w;
- if (MINIMUM_W(o) > w)
- o->maximum.w = w;
+ if (MINIMUM_W(o) > w)
+ o->maximum.w = w;
- if (PREFERRED_W(o) > MAXIMUM_W(o))
- ewl_object_preferred_inner_w_set(o, PREFERRED_W(o));
+ if (PREFERRED_W(o) > MAXIMUM_W(o))
+ ewl_object_preferred_inner_w_set(o, PREFERRED_W(o));
- if (CURRENT_W(o) > w)
- ewl_object_h_request(o, w);
+ if (CURRENT_W(o) > w)
+ ewl_object_h_request(o, w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -863,27 +863,27 @@ ewl_object_maximum_w_set(Ewl_Object *o, int w)
void
ewl_object_maximum_h_set(Ewl_Object *o, int h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- if (h < EWL_OBJECT_MIN_SIZE)
- h = EWL_OBJECT_MIN_SIZE;
+ if (h < EWL_OBJECT_MIN_SIZE)
+ h = EWL_OBJECT_MIN_SIZE;
- if (h > EWL_OBJECT_MAX_SIZE)
- h = EWL_OBJECT_MAX_SIZE;
+ if (h > EWL_OBJECT_MAX_SIZE)
+ h = EWL_OBJECT_MAX_SIZE;
- o->maximum.h = h;
+ o->maximum.h = h;
- if (MINIMUM_H(o) > h)
- o->minimum.h = h;
+ if (MINIMUM_H(o) > h)
+ o->minimum.h = h;
- if (PREFERRED_H(o) > MAXIMUM_H(o))
- ewl_object_preferred_inner_h_set(o, PREFERRED_H(o));
+ if (PREFERRED_H(o) > MAXIMUM_H(o))
+ ewl_object_preferred_inner_h_set(o, PREFERRED_H(o));
- if (CURRENT_H(o) > h)
- ewl_object_h_request(o, h);
+ if (CURRENT_H(o) > h)
+ ewl_object_h_request(o, h);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -894,20 +894,20 @@ ewl_object_maximum_h_set(Ewl_Object *o, int h)
int
ewl_object_maximum_w_get(Ewl_Object *o)
{
- int val;
+ int val;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(o, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(o, 0);
- if (o->flags & EWL_FLAG_FILL_HFILL)
- val = MAXIMUM_W(o);
- else
- val = PREFERRED_W(o);
+ if (o->flags & EWL_FLAG_FILL_HFILL)
+ val = MAXIMUM_W(o);
+ else
+ val = PREFERRED_W(o);
- if ((val + PADDING_HORIZONTAL(o) + INSET_HORIZONTAL(o)) > val)
- val += PADDING_HORIZONTAL(o) + INSET_HORIZONTAL(o);
+ if ((val + PADDING_HORIZONTAL(o) + INSET_HORIZONTAL(o)) > val)
+ val += PADDING_HORIZONTAL(o) + INSET_HORIZONTAL(o);
- DRETURN_INT(val, DLEVEL_STABLE);
+ DRETURN_INT(val, DLEVEL_STABLE);
}
/**
@@ -918,20 +918,20 @@ ewl_object_maximum_w_get(Ewl_Object *o)
int
ewl_object_maximum_h_get(Ewl_Object *o)
{
- int val;
+ int val;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(o, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(o, 0);
- if (o->flags & EWL_FLAG_FILL_VFILL)
- val = MAXIMUM_H(o);
- else
- val = PREFERRED_H(o);
+ if (o->flags & EWL_FLAG_FILL_VFILL)
+ val = MAXIMUM_H(o);
+ else
+ val = PREFERRED_H(o);
- if ((val + PADDING_VERTICAL(o) + INSET_VERTICAL(o)) > val)
- val += PADDING_VERTICAL(o) + INSET_VERTICAL(o);
+ if ((val + PADDING_VERTICAL(o) + INSET_VERTICAL(o)) > val)
+ val += PADDING_VERTICAL(o) + INSET_VERTICAL(o);
- DRETURN_INT(val, DLEVEL_STABLE);
+ DRETURN_INT(val, DLEVEL_STABLE);
}
/**
@@ -947,13 +947,13 @@ ewl_object_maximum_h_get(Ewl_Object *o)
void
ewl_object_maximum_size_get(Ewl_Object *o, int *w, int *h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- if (w) *w = ewl_object_maximum_w_get(o);
- if (h) *h = ewl_object_maximum_h_get(o);
+ if (w) *w = ewl_object_maximum_w_get(o);
+ if (h) *h = ewl_object_maximum_h_get(o);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -971,28 +971,28 @@ ewl_object_maximum_size_get(Ewl_Object *o, int *w, int *h)
void
ewl_object_padding_set(Ewl_Object *o, int l, int r, int t, int b)
{
- int dh, dv;
+ int dh, dv;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- dh = (l - o->pad.l) + (r - o->pad.r);
- dv = (t - o->pad.t) + (b - o->pad.t);
+ dh = (l - o->pad.l) + (r - o->pad.r);
+ dv = (t - o->pad.t) + (b - o->pad.t);
- o->pad.l = l;
- o->pad.r = r;
- o->pad.t = t;
- o->pad.b = b;
+ o->pad.l = l;
+ o->pad.r = r;
+ o->pad.t = t;
+ o->pad.b = b;
- /*
- * Now update the widgets parent of the change in size.
- */
- ewl_container_child_resize(EWL_WIDGET(o), dh,
- EWL_ORIENTATION_HORIZONTAL);
- ewl_container_child_resize(EWL_WIDGET(o), dv,
- EWL_ORIENTATION_VERTICAL);
+ /*
+ * Now update the widgets parent of the change in size.
+ */
+ ewl_container_child_resize(EWL_WIDGET(o), dh,
+ EWL_ORIENTATION_HORIZONTAL);
+ ewl_container_child_resize(EWL_WIDGET(o), dv,
+ EWL_ORIENTATION_VERTICAL);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1010,15 +1010,15 @@ ewl_object_padding_set(Ewl_Object *o, int l, int r, int t, int b)
void
ewl_object_padding_get(Ewl_Object *o, int *l, int *r, int *t, int *b)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- if (l) *l = o->pad.l;
- if (r) *r = o->pad.r;
- if (t) *t = o->pad.t;
- if (b) *b = o->pad.b;
+ if (l) *l = o->pad.l;
+ if (r) *r = o->pad.r;
+ if (t) *t = o->pad.t;
+ if (b) *b = o->pad.b;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1029,10 +1029,10 @@ ewl_object_padding_get(Ewl_Object *o, int *l, int *r, int *t, int *b)
int
ewl_object_padding_top_get(Ewl_Object *o)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(o, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(o, 0);
- DRETURN_INT(PADDING_TOP(o), DLEVEL_STABLE);
+ DRETURN_INT(PADDING_TOP(o), DLEVEL_STABLE);
}
/**
@@ -1043,10 +1043,10 @@ ewl_object_padding_top_get(Ewl_Object *o)
int
ewl_object_padding_bottom_get(Ewl_Object *o)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(o, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(o, 0);
- DRETURN_INT(PADDING_BOTTOM(o), DLEVEL_STABLE);
+ DRETURN_INT(PADDING_BOTTOM(o), DLEVEL_STABLE);
}
/**
@@ -1057,10 +1057,10 @@ ewl_object_padding_bottom_get(Ewl_Object *o)
int
ewl_object_padding_left_get(Ewl_Object *o)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(o, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(o, 0);
- DRETURN_INT(PADDING_LEFT(o), DLEVEL_STABLE);
+ DRETURN_INT(PADDING_LEFT(o), DLEVEL_STABLE);
}
/**
@@ -1071,10 +1071,10 @@ ewl_object_padding_left_get(Ewl_Object *o)
int
ewl_object_padding_right_get(Ewl_Object *o)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(o, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(o, 0);
- DRETURN_INT(PADDING_RIGHT(o), DLEVEL_STABLE);
+ DRETURN_INT(PADDING_RIGHT(o), DLEVEL_STABLE);
}
/**
@@ -1092,28 +1092,28 @@ ewl_object_padding_right_get(Ewl_Object *o)
void
ewl_object_insets_set(Ewl_Object *o, int l, int r, int t, int b)
{
- int dh, dv;
+ int dh, dv;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- dh = (l - o->insets.l) + (r - o->insets.r);
- dv = (t - o->insets.t) + (b - o->insets.t);
+ dh = (l - o->insets.l) + (r - o->insets.r);
+ dv = (t - o->insets.t) + (b - o->insets.t);
- o->insets.l = l;
- o->insets.r = r;
- o->insets.t = t;
- o->insets.b = b;
+ o->insets.l = l;
+ o->insets.r = r;
+ o->insets.t = t;
+ o->insets.b = b;
- /*
- * Now update the widgets parent of the change in size.
- */
- ewl_container_child_resize(EWL_WIDGET(o), dh,
- EWL_ORIENTATION_HORIZONTAL);
- ewl_container_child_resize(EWL_WIDGET(o), dv,
- EWL_ORIENTATION_VERTICAL);
+ /*
+ * Now update the widgets parent of the change in size.
+ */
+ ewl_container_child_resize(EWL_WIDGET(o), dh,
+ EWL_ORIENTATION_HORIZONTAL);
+ ewl_container_child_resize(EWL_WIDGET(o), dv,
+ EWL_ORIENTATION_VERTICAL);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1131,15 +1131,15 @@ ewl_object_insets_set(Ewl_Object *o, int l, int r, int t, int b)
void
ewl_object_insets_get(Ewl_Object *o, int *l, int *r, int *t, int *b)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- if (l) *l = o->insets.l;
- if (r) *r = o->insets.r;
- if (t) *t = o->insets.t;
- if (b) *b = o->insets.b;
+ if (l) *l = o->insets.l;
+ if (r) *r = o->insets.r;
+ if (t) *t = o->insets.t;
+ if (b) *b = o->insets.b;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1150,10 +1150,10 @@ ewl_object_insets_get(Ewl_Object *o, int *l, int *r, int *t, int *b)
int
ewl_object_insets_top_get(Ewl_Object *o)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(o, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(o, 0);
- DRETURN_INT(INSET_TOP(o), DLEVEL_STABLE);
+ DRETURN_INT(INSET_TOP(o), DLEVEL_STABLE);
}
/**
@@ -1164,10 +1164,10 @@ ewl_object_insets_top_get(Ewl_Object *o)
int
ewl_object_insets_bottom_get(Ewl_Object *o)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(o, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(o, 0);
- DRETURN_INT(INSET_BOTTOM(o), DLEVEL_STABLE);
+ DRETURN_INT(INSET_BOTTOM(o), DLEVEL_STABLE);
}
/**
@@ -1178,10 +1178,10 @@ ewl_object_insets_bottom_get(Ewl_Object *o)
int
ewl_object_insets_left_get(Ewl_Object *o)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(o, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(o, 0);
- DRETURN_INT(INSET_LEFT(o), DLEVEL_STABLE);
+ DRETURN_INT(INSET_LEFT(o), DLEVEL_STABLE);
}
/**
@@ -1192,10 +1192,10 @@ ewl_object_insets_left_get(Ewl_Object *o)
int
ewl_object_insets_right_get(Ewl_Object *o)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(o, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(o, 0);
- DRETURN_INT(INSET_RIGHT(o), DLEVEL_STABLE);
+ DRETURN_INT(INSET_RIGHT(o), DLEVEL_STABLE);
}
/**
@@ -1213,16 +1213,16 @@ ewl_object_insets_right_get(Ewl_Object *o)
void
ewl_object_alignment_set(Ewl_Object *o, unsigned int align)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- ewl_object_flags_remove(o, EWL_FLAGS_ALIGN_MASK, EWL_FLAGS_ALIGN_MASK);
- ewl_object_flags_add(o, align, EWL_FLAGS_ALIGN_MASK);
+ ewl_object_flags_remove(o, EWL_FLAGS_ALIGN_MASK, EWL_FLAGS_ALIGN_MASK);
+ ewl_object_flags_add(o, align, EWL_FLAGS_ALIGN_MASK);
- if (EWL_WIDGET(o)->parent)
- ewl_widget_configure(EWL_WIDGET(o)->parent);
+ if (EWL_WIDGET(o)->parent)
+ ewl_widget_configure(EWL_WIDGET(o)->parent);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1240,40 +1240,40 @@ ewl_object_alignment_set(Ewl_Object *o, unsigned int align)
void
ewl_object_place(Ewl_Object *o, int x, int y, int w, int h)
{
- int x_pos, y_pos;
- int w_accept, h_accept;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
-
- ewl_object_size_request(o, w, h);
-
- w_accept = ewl_object_current_w_get(o);
- h_accept = ewl_object_current_h_get(o);
-
- /*
- * Horizontal position
- */
- if (o->flags & EWL_FLAG_ALIGN_LEFT)
- x_pos = x;
- else if (o->flags & EWL_FLAG_ALIGN_RIGHT)
- x_pos = x + w - w_accept;
- else
- x_pos = x + ((w - w_accept) / 2);
-
- /*
- * Vertical position
- */
- if (o->flags & EWL_FLAG_ALIGN_TOP)
- y_pos = y;
- else if (o->flags & EWL_FLAG_ALIGN_BOTTOM)
- y_pos = y + h - h_accept;
- else
- y_pos = y + ((h - h_accept) / 2);
-
- ewl_object_position_request(o, x_pos, y_pos);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int x_pos, y_pos;
+ int w_accept, h_accept;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
+
+ ewl_object_size_request(o, w, h);
+
+ w_accept = ewl_object_current_w_get(o);
+ h_accept = ewl_object_current_h_get(o);
+
+ /*
+ * Horizontal position
+ */
+ if (o->flags & EWL_FLAG_ALIGN_LEFT)
+ x_pos = x;
+ else if (o->flags & EWL_FLAG_ALIGN_RIGHT)
+ x_pos = x + w - w_accept;
+ else
+ x_pos = x + ((w - w_accept) / 2);
+
+ /*
+ * Vertical position
+ */
+ if (o->flags & EWL_FLAG_ALIGN_TOP)
+ y_pos = y;
+ else if (o->flags & EWL_FLAG_ALIGN_BOTTOM)
+ y_pos = y + h - h_accept;
+ else
+ y_pos = y + ((h - h_accept) / 2);
+
+ ewl_object_position_request(o, x_pos, y_pos);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1293,22 +1293,22 @@ ewl_object_place(Ewl_Object *o, int x, int y, int w, int h)
void
ewl_object_fill_policy_set(Ewl_Object *o, unsigned int fill)
{
- unsigned int old_mask;
+ unsigned int old_mask;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- if ((o->flags & EWL_FLAGS_FILL_MASK) == fill)
- DRETURN(DLEVEL_STABLE);
+ if ((o->flags & EWL_FLAGS_FILL_MASK) == fill)
+ DRETURN(DLEVEL_STABLE);
- old_mask = o->flags;
- ewl_object_flags_remove(o, EWL_FLAGS_FILL_MASK, EWL_FLAGS_FILL_MASK);
- ewl_object_flags_add(o, fill, EWL_FLAGS_FILL_MASK);
+ old_mask = o->flags;
+ ewl_object_flags_remove(o, EWL_FLAGS_FILL_MASK, EWL_FLAGS_FILL_MASK);
+ ewl_object_flags_add(o, fill, EWL_FLAGS_FILL_MASK);
- if (EWL_WIDGET(o)->parent)
- ewl_widget_configure(EWL_WIDGET(o)->parent);
+ if (EWL_WIDGET(o)->parent)
+ ewl_widget_configure(EWL_WIDGET(o)->parent);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1321,12 +1321,12 @@ ewl_object_fill_policy_set(Ewl_Object *o, unsigned int fill)
void
ewl_object_flags_add(Ewl_Object *o, unsigned int flags, unsigned int mask)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- o->flags |= (flags & mask);
+ o->flags |= (flags & mask);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1339,12 +1339,12 @@ ewl_object_flags_add(Ewl_Object *o, unsigned int flags, unsigned int mask)
void
ewl_object_flags_remove(Ewl_Object *o, unsigned int flags, unsigned int mask)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
- o->flags &= ~(flags & mask);
+ o->flags &= ~(flags & mask);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1355,10 +1355,10 @@ ewl_object_flags_remove(Ewl_Object *o, unsigned int flags, unsigned int mask)
unsigned int
ewl_object_alignment_get(Ewl_Object *o)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(o, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(o, 0);
- DRETURN_INT(ewl_object_flags_get(o, EWL_FLAGS_ALIGN_MASK), DLEVEL_STABLE);
+ DRETURN_INT(ewl_object_flags_get(o, EWL_FLAGS_ALIGN_MASK), DLEVEL_STABLE);
}
/**
@@ -1369,9 +1369,9 @@ ewl_object_alignment_get(Ewl_Object *o)
unsigned int
ewl_object_fill_policy_get(Ewl_Object *o)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(o, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(o, 0);
- DRETURN_INT(ewl_object_flags_get(o, EWL_FLAGS_FILL_MASK), DLEVEL_STABLE);
+ DRETURN_INT(ewl_object_flags_get(o, EWL_FLAGS_FILL_MASK), DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_object.h b/src/lib/ewl_object.h
index 6e66957..9ccb059 100644
--- a/src/lib/ewl_object.h
+++ b/src/lib/ewl_object.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_OBJECT_H
#define EWL_OBJECT_H
@@ -64,117 +64,117 @@ typedef struct Ewl_Object Ewl_Object;
*/
struct Ewl_Object
{
- struct
- {
- int x, /**< Horizontal position */
- y; /**< Vertical position */
- int w, /**< Width */
- h; /**< Height */
- } current; /**< The current size and position of an object. */
-
- struct
- {
- int w, /**< Width */
- h; /**< Height */
- }
- preferred, /**< The optimal size of the object in ideal circumstances */
- maximum, /**< The guaranteed maximum size this object will receive. */
- minimum; /**< The guaranteed minimum size this object will receive. */
-
- struct
- {
- short l, /**< Left value */
- r, /**< Right value */
- t, /**< Top value */
- b; /**< Bottom value */
- } pad, /**< The space padded around the outside of the object. */
- insets; /**< The space inside where children should not be laid out. */
-
- unsigned int flags; /**< Bitmask indicating fill policy and alignment */
+ struct
+ {
+ int x, /**< Horizontal position */
+ y; /**< Vertical position */
+ int w, /**< Width */
+ h; /**< Height */
+ } current; /**< The current size and position of an object. */
+
+ struct
+ {
+ int w, /**< Width */
+ h; /**< Height */
+ }
+ preferred, /**< The optimal size of the object in ideal circumstances */
+ maximum, /**< The guaranteed maximum size this object will receive. */
+ minimum; /**< The guaranteed minimum size this object will receive. */
+
+ struct
+ {
+ short l, /**< Left value */
+ r, /**< Right value */
+ t, /**< Top value */
+ b; /**< Bottom value */
+ } pad, /**< The space padded around the outside of the object. */
+ insets; /**< The space inside where children should not be laid out. */
+
+ unsigned int flags; /**< Bitmask indicating fill policy and alignment */
};
-int ewl_object_init(Ewl_Object *o);
-void ewl_object_current_geometry_get(Ewl_Object *o, int *x, int *y,
- int *w, int *h);
-
-void ewl_object_current_size_get(Ewl_Object *o, int *w, int *h);
-int ewl_object_current_x_get(Ewl_Object *o);
-int ewl_object_current_y_get(Ewl_Object *o);
-int ewl_object_current_w_get(Ewl_Object *o);
-int ewl_object_current_h_get(Ewl_Object *o);
-
-void ewl_object_preferred_inner_size_set(Ewl_Object *o, int w, int h);
-void ewl_object_preferred_inner_size_get(Ewl_Object *o, int *w, int *h);
-void ewl_object_preferred_size_get(Ewl_Object *o, int *w, int *h);
-
-void ewl_object_preferred_inner_w_set(Ewl_Object *o, int w);
-int ewl_object_preferred_w_get(Ewl_Object *o);
-int ewl_object_preferred_inner_w_get(Ewl_Object *o);
-
-void ewl_object_preferred_inner_h_set(Ewl_Object *o, int h);
-int ewl_object_preferred_inner_h_get(Ewl_Object *o);
-int ewl_object_preferred_h_get(Ewl_Object *o);
-
-void ewl_object_geometry_request(Ewl_Object *o, int x, int y,
- int w, int h);
-void ewl_object_size_request(Ewl_Object *o, int w, int h);
-void ewl_object_position_request(Ewl_Object *o, int x, int y);
-void ewl_object_x_request(Ewl_Object *o, int x);
-void ewl_object_y_request(Ewl_Object *o, int y);
-void ewl_object_w_request(Ewl_Object *o, int w);
-void ewl_object_h_request(Ewl_Object *o, int h);
-
-void ewl_object_minimum_size_set(Ewl_Object *o, int w, int h);
-void ewl_object_minimum_w_set(Ewl_Object *o, int w);
-void ewl_object_minimum_h_set(Ewl_Object *o, int h);
-
-void ewl_object_minimum_size_get(Ewl_Object *o, int *w, int *h);
-int ewl_object_minimum_w_get(Ewl_Object *o);
-int ewl_object_minimum_h_get(Ewl_Object *o);
-
-void ewl_object_maximum_size_set(Ewl_Object *o, int w, int h);
-void ewl_object_maximum_w_set(Ewl_Object *o, int w);
-void ewl_object_maximum_h_set(Ewl_Object *o, int h);
-
-void ewl_object_maximum_size_get(Ewl_Object *o, int *w, int *h);
-int ewl_object_maximum_w_get(Ewl_Object *o);
-int ewl_object_maximum_h_get(Ewl_Object *o);
+int ewl_object_init(Ewl_Object *o);
+void ewl_object_current_geometry_get(Ewl_Object *o, int *x, int *y,
+ int *w, int *h);
+
+void ewl_object_current_size_get(Ewl_Object *o, int *w, int *h);
+int ewl_object_current_x_get(Ewl_Object *o);
+int ewl_object_current_y_get(Ewl_Object *o);
+int ewl_object_current_w_get(Ewl_Object *o);
+int ewl_object_current_h_get(Ewl_Object *o);
+
+void ewl_object_preferred_inner_size_set(Ewl_Object *o, int w, int h);
+void ewl_object_preferred_inner_size_get(Ewl_Object *o, int *w, int *h);
+void ewl_object_preferred_size_get(Ewl_Object *o, int *w, int *h);
+
+void ewl_object_preferred_inner_w_set(Ewl_Object *o, int w);
+int ewl_object_preferred_w_get(Ewl_Object *o);
+int ewl_object_preferred_inner_w_get(Ewl_Object *o);
+
+void ewl_object_preferred_inner_h_set(Ewl_Object *o, int h);
+int ewl_object_preferred_inner_h_get(Ewl_Object *o);
+int ewl_object_preferred_h_get(Ewl_Object *o);
+
+void ewl_object_geometry_request(Ewl_Object *o, int x, int y,
+ int w, int h);
+void ewl_object_size_request(Ewl_Object *o, int w, int h);
+void ewl_object_position_request(Ewl_Object *o, int x, int y);
+void ewl_object_x_request(Ewl_Object *o, int x);
+void ewl_object_y_request(Ewl_Object *o, int y);
+void ewl_object_w_request(Ewl_Object *o, int w);
+void ewl_object_h_request(Ewl_Object *o, int h);
+
+void ewl_object_minimum_size_set(Ewl_Object *o, int w, int h);
+void ewl_object_minimum_w_set(Ewl_Object *o, int w);
+void ewl_object_minimum_h_set(Ewl_Object *o, int h);
+
+void ewl_object_minimum_size_get(Ewl_Object *o, int *w, int *h);
+int ewl_object_minimum_w_get(Ewl_Object *o);
+int ewl_object_minimum_h_get(Ewl_Object *o);
+
+void ewl_object_maximum_size_set(Ewl_Object *o, int w, int h);
+void ewl_object_maximum_w_set(Ewl_Object *o, int w);
+void ewl_object_maximum_h_set(Ewl_Object *o, int h);
+
+void ewl_object_maximum_size_get(Ewl_Object *o, int *w, int *h);
+int ewl_object_maximum_w_get(Ewl_Object *o);
+int ewl_object_maximum_h_get(Ewl_Object *o);
unsigned int ewl_object_alignment_get(Ewl_Object *o);
-void ewl_object_alignment_set(Ewl_Object *o, unsigned int align);
-void ewl_object_place(Ewl_Object *o, int x, int y, int w, int h);
+void ewl_object_alignment_set(Ewl_Object *o, unsigned int align);
+void ewl_object_place(Ewl_Object *o, int x, int y, int w, int h);
unsigned int ewl_object_fill_policy_get(Ewl_Object *o);
-void ewl_object_fill_policy_set(Ewl_Object *o, unsigned int fill);
+void ewl_object_fill_policy_set(Ewl_Object *o, unsigned int fill);
/*
* Padding setting and retrieval functions.
*/
-void ewl_object_padding_set(Ewl_Object *o, int l, int r, int t,
- int b);
-void ewl_object_padding_get(Ewl_Object *o, int *l, int *r, int *t,
- int *b);
-int ewl_object_padding_top_get(Ewl_Object *o);
-int ewl_object_padding_bottom_get(Ewl_Object *o);
-int ewl_object_padding_left_get(Ewl_Object *o);
-int ewl_object_padding_right_get(Ewl_Object *o);
+void ewl_object_padding_set(Ewl_Object *o, int l, int r, int t,
+ int b);
+void ewl_object_padding_get(Ewl_Object *o, int *l, int *r, int *t,
+ int *b);
+int ewl_object_padding_top_get(Ewl_Object *o);
+int ewl_object_padding_bottom_get(Ewl_Object *o);
+int ewl_object_padding_left_get(Ewl_Object *o);
+int ewl_object_padding_right_get(Ewl_Object *o);
/*
* Inset setting and retrieval functions.
*/
-void ewl_object_insets_set(Ewl_Object *o, int l, int r, int t,
- int b);
-void ewl_object_insets_get(Ewl_Object *o, int *l, int *r, int *t,
- int *b);
-int ewl_object_insets_top_get(Ewl_Object *o);
-int ewl_object_insets_bottom_get(Ewl_Object *o);
-int ewl_object_insets_left_get(Ewl_Object *o);
-int ewl_object_insets_right_get(Ewl_Object *o);
+void ewl_object_insets_set(Ewl_Object *o, int l, int r, int t,
+ int b);
+void ewl_object_insets_get(Ewl_Object *o, int *l, int *r, int *t,
+ int *b);
+int ewl_object_insets_top_get(Ewl_Object *o);
+int ewl_object_insets_bottom_get(Ewl_Object *o);
+int ewl_object_insets_left_get(Ewl_Object *o);
+int ewl_object_insets_right_get(Ewl_Object *o);
-void ewl_object_flags_add(Ewl_Object *o, unsigned int flags,
- unsigned int mask);
-void ewl_object_flags_remove(Ewl_Object *o, unsigned int flags,
- unsigned int mask);
+void ewl_object_flags_add(Ewl_Object *o, unsigned int flags,
+ unsigned int mask);
+void ewl_object_flags_remove(Ewl_Object *o, unsigned int flags,
+ unsigned int mask);
/**
* @param o: the parameter to retrieve the current value of object flags
@@ -183,7 +183,7 @@ void ewl_object_flags_remove(Ewl_Object *o, unsigned int flags,
* @brief Retrieves the current setting of the object flags for @a o.
*/
#define ewl_object_flags_get(o, mask) \
- (EWL_OBJECT(o)->flags & mask)
+ (EWL_OBJECT(o)->flags & mask)
/**
* @param o: the object to check for a specified flags
@@ -193,7 +193,7 @@ void ewl_object_flags_remove(Ewl_Object *o, unsigned int flags,
* @brief Determines if an object has the requested @a flags set.
*/
#define ewl_object_flags_has(o, check_flags, mask) \
- (!!(EWL_OBJECT(o)->flags & ((check_flags) & mask)))
+ (!!(EWL_OBJECT(o)->flags & ((check_flags) & mask)))
/**
* @param o: the object to check for a specified flags
@@ -203,7 +203,7 @@ void ewl_object_flags_remove(Ewl_Object *o, unsigned int flags,
* @brief Determines if an object has all of the requested @a flags set.
*/
#define ewl_object_flags_has_all(o, check_flags, mask) \
- ((EWL_OBJECT(o)->flags & ((check_flags) & mask)) == ((check_flags) & mask))
+ ((EWL_OBJECT(o)->flags & ((check_flags) & mask)) == ((check_flags) & mask))
/**
* @def ewl_object_recursive_set(o)
@@ -213,10 +213,10 @@ void ewl_object_flags_remove(Ewl_Object *o, unsigned int flags,
* @brief Changes the recursive flag value to match @a val.
*/
#define ewl_object_recursive_set(o, val) \
- (val ? ewl_object_flags_add(o, EWL_FLAG_PROPERTY_RECURSIVE, \
- EWL_FLAGS_PROPERTY_MASK) : \
- ewl_object_flags_remove(o, EWL_FLAG_PROPERTY_RECURSIVE, \
- EWL_FLAGS_PROPERTY_MASK));
+ (val ? ewl_object_flags_add(o, EWL_FLAG_PROPERTY_RECURSIVE, \
+ EWL_FLAGS_PROPERTY_MASK) : \
+ ewl_object_flags_remove(o, EWL_FLAG_PROPERTY_RECURSIVE, \
+ EWL_FLAGS_PROPERTY_MASK));
/**
* @def ewl_object_recursive_get(o)
@@ -225,7 +225,7 @@ void ewl_object_flags_remove(Ewl_Object *o, unsigned int flags,
* @brief Retrieves the current setting of the recursive flag for @a o.
*/
#define ewl_object_recursive_get(o) \
- (ewl_object_flags_get(o, EWL_FLAG_PROPERTY_RECURSIVE))
+ (ewl_object_flags_get(o, EWL_FLAG_PROPERTY_RECURSIVE))
/**
* @def ewl_object_toplevel_set(o, val)
@@ -235,10 +235,10 @@ void ewl_object_flags_remove(Ewl_Object *o, unsigned int flags,
* @brief Changes the top level flag value to match @a val.
*/
#define ewl_object_toplevel_set(o, val) \
- (val ? ewl_object_flags_add(o, EWL_FLAG_PROPERTY_TOPLEVEL, \
- EWL_FLAGS_PROPERTY_MASK) : \
- ewl_object_flags_remove(o, EWL_FLAG_PROPERTY_TOPLEVEL, \
- EWL_FLAGS_PROPERTY_MASK));
+ (val ? ewl_object_flags_add(o, EWL_FLAG_PROPERTY_TOPLEVEL, \
+ EWL_FLAGS_PROPERTY_MASK) : \
+ ewl_object_flags_remove(o, EWL_FLAG_PROPERTY_TOPLEVEL, \
+ EWL_FLAGS_PROPERTY_MASK));
/**
* @def ewl_object_toplevel_get(o)
@@ -247,7 +247,7 @@ void ewl_object_flags_remove(Ewl_Object *o, unsigned int flags,
* @brief Retrieves the current setting of the top level flag for @a o.
*/
#define ewl_object_toplevel_get(o) \
- (ewl_object_flags_get(o, EWL_FLAG_PROPERTY_TOPLEVEL))
+ (ewl_object_flags_get(o, EWL_FLAG_PROPERTY_TOPLEVEL))
/**
* @def ewl_object_state_add(o, state)
@@ -256,7 +256,7 @@ void ewl_object_flags_remove(Ewl_Object *o, unsigned int flags,
* Adds the given state @a state to the object @a o
*/
#define ewl_object_state_add(o, state) \
- ewl_object_flags_add(o, state, EWL_FLAGS_STATE_MASK)
+ ewl_object_flags_add(o, state, EWL_FLAGS_STATE_MASK)
/**
* @def ewl_object_state_remove(o, state)
@@ -265,7 +265,7 @@ void ewl_object_flags_remove(Ewl_Object *o, unsigned int flags,
* Removes the given state from the given @a o object
*/
#define ewl_object_state_remove(o, state) \
- ewl_object_flags_remove(o, state, EWL_FLAGS_STATE_MASK)
+ ewl_object_flags_remove(o, state, EWL_FLAGS_STATE_MASK)
/**
* @def ewl_object_state_has(o, state)
@@ -274,7 +274,7 @@ void ewl_object_flags_remove(Ewl_Object *o, unsigned int flags,
* Checks if the given state @a state is set on the given object @a o
*/
#define ewl_object_state_has(o, state) \
- ewl_object_flags_has(o, state, EWL_FLAGS_STATE_MASK)
+ ewl_object_flags_has(o, state, EWL_FLAGS_STATE_MASK)
/**
* @def ewl_object_state_get(o, state)
@@ -283,7 +283,7 @@ void ewl_object_flags_remove(Ewl_Object *o, unsigned int flags,
* Retrives the given state @a state from the object @a o
*/
#define ewl_object_state_get(o, state) \
- ewl_object_flags_get(o, state, EWL_FLAGS_STATE_MASK)
+ ewl_object_flags_get(o, state, EWL_FLAGS_STATE_MASK)
/**
* @def ewl_object_queued_add(o, queued)
@@ -292,56 +292,56 @@ void ewl_object_flags_remove(Ewl_Object *o, unsigned int flags,
* Adds the given queue flag @a queued to the object @a o
*/
#define ewl_object_queued_add(o, queued) \
- ewl_object_flags_add(o, queued, EWL_FLAGS_QUEUED_MASK)
+ ewl_object_flags_add(o, queued, EWL_FLAGS_QUEUED_MASK)
/**
* @def ewl_object_queued_remove(o, queued)
* Remove the @a queued flag from the @a o object
*/
#define ewl_object_queued_remove(o, queued) \
- ewl_object_flags_remove(o, queued, EWL_FLAGS_QUEUED_MASK)
+ ewl_object_flags_remove(o, queued, EWL_FLAGS_QUEUED_MASK)
/**
* @def ewl_object_queued_has(o, queued)
* Determine if the @a o object has the @a queued flag set
*/
#define ewl_object_queued_has(o, queued) \
- ewl_object_flags_has(o, queued, EWL_FLAGS_QUEUED_MASK)
+ ewl_object_flags_has(o, queued, EWL_FLAGS_QUEUED_MASK)
/**
* @def ewl_object_queued_get(o, queued)
* Retrieve the value for the @a queued queue flag
*/
#define ewl_object_queued_get(o, queued) \
- ewl_object_flags_get(o, queued, EWL_FLAGS_QUEUED_MASK)
+ ewl_object_flags_get(o, queued, EWL_FLAGS_QUEUED_MASK)
/**
* @def ewl_object_visible_add(o, visible)
* Add the @a visible flag to the object @a o
*/
#define ewl_object_visible_add(o, visible) \
- ewl_object_flags_add(o, visible, EWL_FLAGS_VISIBLE_MASK)
+ ewl_object_flags_add(o, visible, EWL_FLAGS_VISIBLE_MASK)
/**
* @def ewl_object_visible_remove(o, visible)
* Remove the @a visible flag from the object @a o
*/
#define ewl_object_visible_remove(o, visible) \
- ewl_object_flags_remove(o, visible, EWL_FLAGS_VISIBLE_MASK)
+ ewl_object_flags_remove(o, visible, EWL_FLAGS_VISIBLE_MASK)
/**
* @def ewl_object_visible_has(o, visible)
* Check if the @a visible flag is set in the object @a o
*/
#define ewl_object_visible_has(o, visible) \
- ewl_object_flags_has(o, visible, EWL_FLAGS_VISIBLE_MASK)
+ ewl_object_flags_has(o, visible, EWL_FLAGS_VISIBLE_MASK)
/**
* @def ewl_object_visible_get(o, visible)
* Retrieves the @a visble flag from the object @a o
*/
#define ewl_object_visible_get(o, visible) \
- ewl_object_flags_get(o, visible, EWL_FLAGS_VISIBLE_MASK)
+ ewl_object_flags_get(o, visible, EWL_FLAGS_VISIBLE_MASK)
/**
* @def PADDING_TOP(o)
@@ -483,11 +483,11 @@ void ewl_object_flags_remove(Ewl_Object *o, unsigned int flags,
* A convenience method to set a custom size onto a widget
*/
#define ewl_object_custom_size_set(o, w, h) \
- { \
- ewl_object_minimum_size_set(o, w, h); \
- ewl_object_maximum_size_set(o, w, h); \
- ewl_object_fill_policy_set(o, EWL_FLAG_FILL_NONE); \
- }
+ { \
+ ewl_object_minimum_size_set(o, w, h); \
+ ewl_object_maximum_size_set(o, w, h); \
+ ewl_object_fill_policy_set(o, EWL_FLAG_FILL_NONE); \
+ }
/**
* @def ewl_object_custom_w_set(o, w)
@@ -496,12 +496,12 @@ void ewl_object_flags_remove(Ewl_Object *o, unsigned int flags,
* A convenience method to set a custom width onto a widget
*/
#define ewl_object_custom_w_set(o, w) \
- { \
- ewl_object_maximum_w_set(o, w); \
- ewl_object_minimum_w_set(o, w); \
- ewl_object_fill_policy_set(o, ewl_object_fill_policy_get(o) & \
- ~(EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_HSHRINK)); \
- }
+ { \
+ ewl_object_maximum_w_set(o, w); \
+ ewl_object_minimum_w_set(o, w); \
+ ewl_object_fill_policy_set(o, ewl_object_fill_policy_get(o) & \
+ ~(EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_HSHRINK)); \
+ }
/**
* @def ewl_object_custom_h_set(o, h)
@@ -510,12 +510,12 @@ void ewl_object_flags_remove(Ewl_Object *o, unsigned int flags,
* A convenience method to set a custom height onto a widget
*/
#define ewl_object_custom_h_set(o, h) \
- { \
- ewl_object_maximum_h_set(o, h); \
- ewl_object_minimum_h_set(o, h); \
- ewl_object_fill_policy_set(o, ewl_object_fill_policy_get(o) & \
- ~(EWL_FLAG_FILL_VFILL | EWL_FLAG_FILL_VSHRINK)); \
- }
+ { \
+ ewl_object_maximum_h_set(o, h); \
+ ewl_object_minimum_h_set(o, h); \
+ ewl_object_fill_policy_set(o, ewl_object_fill_policy_get(o) & \
+ ~(EWL_FLAG_FILL_VFILL | EWL_FLAG_FILL_VSHRINK)); \
+ }
/**
* @def RECURSIVE(o)
@@ -552,18 +552,18 @@ void ewl_object_flags_remove(Ewl_Object *o, unsigned int flags,
* Used to determine if a widget has been destroyed
*/
#define DESTROYED(o) (ewl_object_queued_has(EWL_OBJECT(o), \
- EWL_FLAG_QUEUED_SCHEDULED_DESTROY) \
- || ewl_object_queued_has(EWL_OBJECT(o), \
- EWL_FLAG_QUEUED_PROCESS_DESTROY))
+ EWL_FLAG_QUEUED_SCHEDULED_DESTROY) \
+ || ewl_object_queued_has(EWL_OBJECT(o), \
+ EWL_FLAG_QUEUED_PROCESS_DESTROY))
/**
* @def CONFIGURED(o)
* Used to determine if a widget is scheduled for configure
*/
#define CONFIGURED(o) (ewl_object_queued_has(EWL_OBJECT(o), \
- EWL_FLAG_QUEUED_SCHEDULED_CONFIGURE) \
- || ewl_object_queued_has(EWL_OBJECT(o), \
- EWL_FLAG_QUEUED_PROCESS_CONFIGURE))
+ EWL_FLAG_QUEUED_SCHEDULED_CONFIGURE) \
+ || ewl_object_queued_has(EWL_OBJECT(o), \
+ EWL_FLAG_QUEUED_PROCESS_CONFIGURE))
/**
* @def DISABLED(o)
@@ -578,7 +578,7 @@ void ewl_object_flags_remove(Ewl_Object *o, unsigned int flags,
* @brief Retrieves the current setting of the in tab list flag for @a o.
*/
#define ewl_object_in_tab_list_get(o) \
- (ewl_object_flags_get(o, EWL_FLAG_PROPERTY_IN_TAB_LIST))
+ (ewl_object_flags_get(o, EWL_FLAG_PROPERTY_IN_TAB_LIST))
/**
* @def ewl_object_in_tab_list_set(o, val)
@@ -588,10 +588,10 @@ void ewl_object_flags_remove(Ewl_Object *o, unsigned int flags,
* @brief Changes the tab list flag value to match @a val.
*/
#define ewl_object_in_tab_list_set(o, val) \
- (val ? ewl_object_flags_add(o, EWL_FLAG_PROPERTY_IN_TAB_LIST, \
- EWL_FLAGS_PROPERTY_MASK) : \
- ewl_object_flags_remove(o, EWL_FLAG_PROPERTY_IN_TAB_LIST, \
- EWL_FLAGS_PROPERTY_MASK));
+ (val ? ewl_object_flags_add(o, EWL_FLAG_PROPERTY_IN_TAB_LIST, \
+ EWL_FLAGS_PROPERTY_MASK) : \
+ ewl_object_flags_remove(o, EWL_FLAG_PROPERTY_IN_TAB_LIST, \
+ EWL_FLAGS_PROPERTY_MASK));
/**
* @}
diff --git a/src/lib/ewl_overlay.c b/src/lib/ewl_overlay.c
index 4fd7def..fb791b1 100644
--- a/src/lib/ewl_overlay.c
+++ b/src/lib/ewl_overlay.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_overlay.h"
#include "ewl_macros.h"
@@ -12,20 +12,20 @@
Ewl_Widget *
ewl_overlay_new(void)
{
- Ewl_Overlay *w;
+ Ewl_Overlay *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- w = NEW(Ewl_Overlay, 1);
- if (!w)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ w = NEW(Ewl_Overlay, 1);
+ if (!w)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_overlay_init(w)) {
- ewl_widget_destroy(EWL_WIDGET(w));
- w = NULL;
- }
+ if (!ewl_overlay_init(w)) {
+ ewl_widget_destroy(EWL_WIDGET(w));
+ w = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(w), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(w), DLEVEL_STABLE);
}
/**
@@ -38,33 +38,33 @@ ewl_overlay_new(void)
int
ewl_overlay_init(Ewl_Overlay *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, FALSE);
- /*
- * Initialize the fields of the inherited container class
- */
- if (!ewl_container_init(EWL_CONTAINER(w)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ /*
+ * Initialize the fields of the inherited container class
+ */
+ if (!ewl_container_init(EWL_CONTAINER(w)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_appearance_set(EWL_WIDGET(w), EWL_OVERLAY_TYPE);
- ewl_widget_inherit(EWL_WIDGET(w), EWL_OVERLAY_TYPE);
+ ewl_widget_appearance_set(EWL_WIDGET(w), EWL_OVERLAY_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(w), EWL_OVERLAY_TYPE);
- ewl_container_show_notify_set(EWL_CONTAINER(w),
- ewl_overlay_cb_child_show);
- ewl_container_resize_notify_set(EWL_CONTAINER(w),
- ewl_overlay_cb_child_resize);
+ ewl_container_show_notify_set(EWL_CONTAINER(w),
+ ewl_overlay_cb_child_show);
+ ewl_container_resize_notify_set(EWL_CONTAINER(w),
+ ewl_overlay_cb_child_resize);
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
- /*
- * Override the default configure callbacks since the overlay
- * has special needs for placement.
- */
- ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_CONFIGURE,
- ewl_overlay_cb_configure, NULL);
+ /*
+ * Override the default configure callbacks since the overlay
+ * has special needs for placement.
+ */
+ ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_CONFIGURE,
+ ewl_overlay_cb_configure, NULL);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -77,40 +77,40 @@ ewl_overlay_init(Ewl_Overlay *w)
*/
void
ewl_overlay_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Object *o;
- Ewl_Object *child;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_OVERLAY_TYPE);
-
- o = EWL_OBJECT(w);
-
- /*
- * Configure each of the child widgets.
- */
- ecore_dlist_first_goto(EWL_CONTAINER(w)->children);
- while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children))) {
- int width, height;
- /* ignore unmanaged widgets */
- if (UNMANAGED(child))
- continue;
- /*
- * Try to give the child the full size of the overlay from it's
- * base position. The object will constrict it based on the
- * fill policy. Don't add the TOP and LEFT insets since
- * they've already been accounted for.
- */
- width = CURRENT_W(w) + CURRENT_X(w);
- width -= ewl_object_current_x_get(child);
- height = CURRENT_H(w) + CURRENT_Y(w);
- height -= ewl_object_current_y_get(child);
- ewl_object_size_request(child, width, height);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Object *o;
+ Ewl_Object *child;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_OVERLAY_TYPE);
+
+ o = EWL_OBJECT(w);
+
+ /*
+ * Configure each of the child widgets.
+ */
+ ecore_dlist_first_goto(EWL_CONTAINER(w)->children);
+ while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children))) {
+ int width, height;
+ /* ignore unmanaged widgets */
+ if (UNMANAGED(child))
+ continue;
+ /*
+ * Try to give the child the full size of the overlay from it's
+ * base position. The object will constrict it based on the
+ * fill policy. Don't add the TOP and LEFT insets since
+ * they've already been accounted for.
+ */
+ width = CURRENT_W(w) + CURRENT_X(w);
+ width -= ewl_object_current_x_get(child);
+ height = CURRENT_H(w) + CURRENT_Y(w);
+ height -= ewl_object_current_y_get(child);
+ ewl_object_size_request(child, width, height);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -123,26 +123,26 @@ ewl_overlay_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
void
ewl_overlay_cb_child_show(Ewl_Container *o, Ewl_Widget *child)
{
- int size;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(o);
- DCHECK_PARAM_PTR(child);
- DCHECK_TYPE(o, EWL_OVERLAY_TYPE);
- DCHECK_TYPE(child, EWL_WIDGET_TYPE);
-
- size = ewl_object_current_x_get(EWL_OBJECT(child));
- size += ewl_object_preferred_w_get(EWL_OBJECT(child));
- size -= CURRENT_X(o);
- if (size > PREFERRED_W(o))
- ewl_object_preferred_inner_w_set(EWL_OBJECT(o), size);
-
- size = ewl_object_current_y_get(EWL_OBJECT(child)) +
- ewl_object_preferred_h_get(EWL_OBJECT(child)) - CURRENT_Y(o);
- if (size > PREFERRED_H(o))
- ewl_object_preferred_inner_h_set(EWL_OBJECT(o), size);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int size;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(o);
+ DCHECK_PARAM_PTR(child);
+ DCHECK_TYPE(o, EWL_OVERLAY_TYPE);
+ DCHECK_TYPE(child, EWL_WIDGET_TYPE);
+
+ size = ewl_object_current_x_get(EWL_OBJECT(child));
+ size += ewl_object_preferred_w_get(EWL_OBJECT(child));
+ size -= CURRENT_X(o);
+ if (size > PREFERRED_W(o))
+ ewl_object_preferred_inner_w_set(EWL_OBJECT(o), size);
+
+ size = ewl_object_current_y_get(EWL_OBJECT(child)) +
+ ewl_object_preferred_h_get(EWL_OBJECT(child)) - CURRENT_Y(o);
+ if (size > PREFERRED_H(o))
+ ewl_object_preferred_inner_h_set(EWL_OBJECT(o), size);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -156,59 +156,59 @@ ewl_overlay_cb_child_show(Ewl_Container *o, Ewl_Widget *child)
*/
void
ewl_overlay_cb_child_resize(Ewl_Container *c, Ewl_Widget *w,
- int size __UNUSED__, Ewl_Orientation o __UNUSED__)
+ int size __UNUSED__, Ewl_Orientation o __UNUSED__)
{
- int maxw = 0, maxh = 0;
- Ewl_Overlay *overlay;
- Ewl_Object *child;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_OVERLAY_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- child = EWL_OBJECT(w);
- overlay = EWL_OVERLAY(c);
-
- ecore_dlist_first_goto(EWL_CONTAINER(overlay)->children);
- while ((child = ecore_dlist_next(EWL_CONTAINER(overlay)->children))) {
- int cs;
-
- /*
- * FIXME: Do we really want to do this?
- * Move children within the bounds of the viewable area
- */
- if (ewl_object_current_x_get(child) < CURRENT_X(overlay))
- ewl_object_x_request(child, CURRENT_X(overlay));
- if (ewl_object_current_y_get(child) < CURRENT_Y(overlay))
- ewl_object_y_request(child, CURRENT_Y(overlay));
-
- cs = ewl_object_current_x_get(child) +
- ewl_object_preferred_w_get(child);
-
- /*
- * Check the width and x position vs. overlay width.
- */
- if (maxw < cs)
- maxw = cs;
-
- cs = ewl_object_current_y_get(child) +
- ewl_object_preferred_h_get(child);
-
- /*
- * Check the height and y position vs. overlay height.
- */
- if (maxh < cs)
- maxh = cs;
-
- }
-
- ewl_object_preferred_inner_size_set(EWL_OBJECT(overlay), maxw, maxh);
- ewl_object_size_request(EWL_OBJECT(c),
- ewl_object_current_w_get(EWL_OBJECT(c)),
- ewl_object_current_h_get(EWL_OBJECT(c)));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int maxw = 0, maxh = 0;
+ Ewl_Overlay *overlay;
+ Ewl_Object *child;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_OVERLAY_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ child = EWL_OBJECT(w);
+ overlay = EWL_OVERLAY(c);
+
+ ecore_dlist_first_goto(EWL_CONTAINER(overlay)->children);
+ while ((child = ecore_dlist_next(EWL_CONTAINER(overlay)->children))) {
+ int cs;
+
+ /*
+ * FIXME: Do we really want to do this?
+ * Move children within the bounds of the viewable area
+ */
+ if (ewl_object_current_x_get(child) < CURRENT_X(overlay))
+ ewl_object_x_request(child, CURRENT_X(overlay));
+ if (ewl_object_current_y_get(child) < CURRENT_Y(overlay))
+ ewl_object_y_request(child, CURRENT_Y(overlay));
+
+ cs = ewl_object_current_x_get(child) +
+ ewl_object_preferred_w_get(child);
+
+ /*
+ * Check the width and x position vs. overlay width.
+ */
+ if (maxw < cs)
+ maxw = cs;
+
+ cs = ewl_object_current_y_get(child) +
+ ewl_object_preferred_h_get(child);
+
+ /*
+ * Check the height and y position vs. overlay height.
+ */
+ if (maxh < cs)
+ maxh = cs;
+
+ }
+
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(overlay), maxw, maxh);
+ ewl_object_size_request(EWL_OBJECT(c),
+ ewl_object_current_w_get(EWL_OBJECT(c)),
+ ewl_object_current_h_get(EWL_OBJECT(c)));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_overlay.h b/src/lib/ewl_overlay.h
index ca8219c..d94d25c 100644
--- a/src/lib/ewl_overlay.h
+++ b/src/lib/ewl_overlay.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_OVERLAY_H
#define EWL_OVERLAY_H
@@ -50,11 +50,11 @@ typedef struct Ewl_Overlay Ewl_Overlay;
*/
struct Ewl_Overlay
{
- Ewl_Container container; /**< Inherits from the Ewl_Container class */
+ Ewl_Container container; /**< Inherits from the Ewl_Container class */
};
-Ewl_Widget *ewl_overlay_new(void);
-int ewl_overlay_init(Ewl_Overlay *win);
+Ewl_Widget *ewl_overlay_new(void);
+int ewl_overlay_init(Ewl_Overlay *win);
/*
* Internally used callbacks, override at your own risk.
@@ -63,7 +63,7 @@ void ewl_overlay_cb_configure(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_overlay_cb_child_show(Ewl_Container *emb, Ewl_Widget *child);
void ewl_overlay_cb_child_resize(Ewl_Container *c, Ewl_Widget *w, int size,
- Ewl_Orientation o);
+ Ewl_Orientation o);
/**
* @}
diff --git a/src/lib/ewl_paned.c b/src/lib/ewl_paned.c
index a6948e7..371780b 100644
--- a/src/lib/ewl_paned.c
+++ b/src/lib/ewl_paned.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_paned.h"
#include "ewl_macros.h"
@@ -12,10 +12,10 @@ typedef struct Ewl_Paned_Pane_Info Ewl_Paned_Pane_Info;
*/
struct Ewl_Paned_Pane_Info
{
- Ewl_Widget *pane;
- Ewl_Paned_Size_Info *info;
- int size;
- unsigned char fixed:1;
+ Ewl_Widget *pane;
+ Ewl_Paned_Size_Info *info;
+ int size;
+ unsigned char fixed:1;
};
typedef struct Ewl_Paned_Layout Ewl_Paned_Layout;
@@ -25,15 +25,15 @@ typedef struct Ewl_Paned_Layout Ewl_Paned_Layout;
*/
struct Ewl_Paned_Layout
{
- int (*minimum_size)(Ewl_Object *o);
- int (*current_size)(Ewl_Object *o);
- int (*preferred_size)(Ewl_Object *o);
- int (*current_position)(Ewl_Object *o);
-
- void (*variable_request)(Ewl_Object *o, int size);
- void (*stable_request)(Ewl_Object *o, int size);
- void (*position_request)(Ewl_Object *o, int pos);
- void (*stable_position_request)(Ewl_Object *o, int pos);
+ int (*minimum_size)(Ewl_Object *o);
+ int (*current_size)(Ewl_Object *o);
+ int (*preferred_size)(Ewl_Object *o);
+ int (*current_position)(Ewl_Object *o);
+
+ void (*variable_request)(Ewl_Object *o, int size);
+ void (*stable_request)(Ewl_Object *o, int size);
+ void (*position_request)(Ewl_Object *o, int pos);
+ void (*stable_position_request)(Ewl_Object *o, int pos);
};
static Ewl_Paned_Layout *horizontal_layout = NULL;
@@ -43,25 +43,25 @@ static Ewl_Paned_Layout *layout = NULL;
static void ewl_paned_cb_shutdown(void);
static void ewl_paned_grabber_cb_mouse_down(Ewl_Widget *w, void *ev,
- void *data);
+ void *data);
static void ewl_paned_grabber_cb_mouse_up(Ewl_Widget *w, void *ev,
- void *data);
+ void *data);
static void ewl_paned_grabber_cb_mouse_move(Ewl_Widget *w, void *ev,
- void *data);
+ void *data);
static void ewl_paned_grabbers_update(Ewl_Paned *p);
static void ewl_paned_layout_setup(void);
static int ewl_paned_pane_info_setup(Ewl_Paned *p, Ewl_Paned_Pane_Info *panes,
- Ewl_Paned_Layout *layout, int *resizable);
+ Ewl_Paned_Layout *layout, int *resizable);
static int ewl_paned_pane_info_collect(Ewl_Paned *p, Ewl_Paned_Pane_Info *panes,
- Ewl_Paned_Layout *layout, int *resizable, int grabber_size);
+ Ewl_Paned_Layout *layout, int *resizable, int grabber_size);
static void ewl_paned_pane_info_layout(Ewl_Paned *p, Ewl_Paned_Pane_Info *panes,
- int pane_num, Ewl_Paned_Layout *layout,
- int available, int resizable);
+ int pane_num, Ewl_Paned_Layout *layout,
+ int available, int resizable);
static int ewl_paned_widgets_place(Ewl_Paned *p, Ewl_Paned_Pane_Info *panes,
- int grabber_size);
+ int grabber_size);
static int ewl_paned_grapper_size_get(Ewl_Paned *p);
@@ -72,20 +72,20 @@ static int ewl_paned_grapper_size_get(Ewl_Paned *p);
Ewl_Widget *
ewl_paned_new(void)
{
- Ewl_Paned *pane;
+ Ewl_Paned *pane;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- pane = NEW(Ewl_Paned, 1);
- if (!pane)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ pane = NEW(Ewl_Paned, 1);
+ if (!pane)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_paned_init(pane))
- {
- ewl_widget_destroy(EWL_WIDGET(pane));
- pane = NULL;
- }
- DRETURN_PTR(pane, DLEVEL_STABLE);
+ if (!ewl_paned_init(pane))
+ {
+ ewl_widget_destroy(EWL_WIDGET(pane));
+ pane = NULL;
+ }
+ DRETURN_PTR(pane, DLEVEL_STABLE);
}
/**
@@ -94,9 +94,9 @@ ewl_paned_new(void)
Ewl_Widget *
ewl_hpaned_new(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- DRETURN_PTR(ewl_paned_new(), DLEVEL_STABLE);
+ DRETURN_PTR(ewl_paned_new(), DLEVEL_STABLE);
}
/**
@@ -106,16 +106,16 @@ ewl_hpaned_new(void)
Ewl_Widget *
ewl_vpaned_new(void)
{
- Ewl_Widget *pane;
+ Ewl_Widget *pane;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- pane = ewl_paned_new();
- if (pane)
- ewl_paned_orientation_set(EWL_PANED(pane),
- EWL_ORIENTATION_VERTICAL);
+ pane = ewl_paned_new();
+ if (pane)
+ ewl_paned_orientation_set(EWL_PANED(pane),
+ EWL_ORIENTATION_VERTICAL);
- DRETURN_PTR(pane, DLEVEL_STABLE);
+ DRETURN_PTR(pane, DLEVEL_STABLE);
}
/**
@@ -126,46 +126,46 @@ ewl_vpaned_new(void)
int
ewl_paned_init(Ewl_Paned *p)
{
- Ewl_Widget *w;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(p, FALSE);
-
- w = EWL_WIDGET(p);
-
- if (!ewl_container_init(EWL_CONTAINER(p)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- if (!horizontal_layout)
- ewl_paned_layout_setup();
-
- ewl_widget_appearance_set(w, EWL_PANED_TYPE);
- ewl_widget_inherit(w, EWL_PANED_TYPE);
-
- p->orientation = EWL_ORIENTATION_HORIZONTAL;
- ewl_container_add_notify_set(EWL_CONTAINER(p),
- ewl_paned_cb_child_add);
- ewl_container_remove_notify_set(EWL_CONTAINER(p),
- ewl_paned_cb_child_remove);
- ewl_container_show_notify_set(EWL_CONTAINER(p),
- ewl_paned_cb_child_show);
- ewl_container_resize_notify_set(EWL_CONTAINER(p),
- ewl_paned_cb_child_resize);
- ewl_container_hide_notify_set(EWL_CONTAINER(p),
- ewl_paned_cb_child_hide);
-
- ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
- ewl_paned_cb_configure, NULL);
- ewl_callback_append(w, EWL_CALLBACK_DESTROY,
- ewl_paned_cb_destroy, NULL);
-
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_FILL);
- ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_LEFT |
- EWL_FLAG_ALIGN_TOP);
- ewl_widget_focusable_set(w, FALSE);
- p->new_panes = TRUE;
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Widget *w;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(p, FALSE);
+
+ w = EWL_WIDGET(p);
+
+ if (!ewl_container_init(EWL_CONTAINER(p)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ if (!horizontal_layout)
+ ewl_paned_layout_setup();
+
+ ewl_widget_appearance_set(w, EWL_PANED_TYPE);
+ ewl_widget_inherit(w, EWL_PANED_TYPE);
+
+ p->orientation = EWL_ORIENTATION_HORIZONTAL;
+ ewl_container_add_notify_set(EWL_CONTAINER(p),
+ ewl_paned_cb_child_add);
+ ewl_container_remove_notify_set(EWL_CONTAINER(p),
+ ewl_paned_cb_child_remove);
+ ewl_container_show_notify_set(EWL_CONTAINER(p),
+ ewl_paned_cb_child_show);
+ ewl_container_resize_notify_set(EWL_CONTAINER(p),
+ ewl_paned_cb_child_resize);
+ ewl_container_hide_notify_set(EWL_CONTAINER(p),
+ ewl_paned_cb_child_hide);
+
+ ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
+ ewl_paned_cb_configure, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_DESTROY,
+ ewl_paned_cb_destroy, NULL);
+
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_FILL);
+ ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_LEFT |
+ EWL_FLAG_ALIGN_TOP);
+ ewl_widget_focusable_set(w, FALSE);
+ p->new_panes = TRUE;
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -176,28 +176,28 @@ ewl_paned_init(Ewl_Paned *p)
void
ewl_paned_orientation_set(Ewl_Paned *p, Ewl_Orientation o)
{
- Ewl_Widget *child;
+ Ewl_Widget *child;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_TYPE(p, EWL_PANED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_TYPE(p, EWL_PANED_TYPE);
- if (p->orientation == o)
- DRETURN(DLEVEL_STABLE);
+ if (p->orientation == o)
+ DRETURN(DLEVEL_STABLE);
- p->orientation = o;
+ p->orientation = o;
- /* loop over all the children and change the orientation of all
- * of the grabbers */
- ecore_dlist_first_goto(EWL_CONTAINER(p)->children);
- while ((child = ecore_dlist_next(EWL_CONTAINER(p)->children)))
- {
- if (EWL_PANED_GRABBER_IS(child))
- ewl_paned_grabber_paned_orientation_set(
- EWL_PANED_GRABBER(child), o);
- }
+ /* loop over all the children and change the orientation of all
+ * of the grabbers */
+ ecore_dlist_first_goto(EWL_CONTAINER(p)->children);
+ while ((child = ecore_dlist_next(EWL_CONTAINER(p)->children)))
+ {
+ if (EWL_PANED_GRABBER_IS(child))
+ ewl_paned_grabber_paned_orientation_set(
+ EWL_PANED_GRABBER(child), o);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -208,11 +208,11 @@ ewl_paned_orientation_set(Ewl_Paned *p, Ewl_Orientation o)
Ewl_Orientation
ewl_paned_orientation_get(Ewl_Paned *p)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(p, EWL_ORIENTATION_HORIZONTAL);
- DCHECK_TYPE_RET(p, EWL_PANED_TYPE, EWL_ORIENTATION_HORIZONTAL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(p, EWL_ORIENTATION_HORIZONTAL);
+ DCHECK_TYPE_RET(p, EWL_PANED_TYPE, EWL_ORIENTATION_HORIZONTAL);
- DRETURN_INT(p->orientation, DLEVEL_STABLE);
+ DRETURN_INT(p->orientation, DLEVEL_STABLE);
}
/**
@@ -225,17 +225,17 @@ ewl_paned_orientation_get(Ewl_Paned *p)
void
ewl_paned_initial_size_set(Ewl_Paned *p, Ewl_Widget *child, int size)
{
- Ewl_Paned_Size_Info *info;
+ Ewl_Paned_Size_Info *info;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_TYPE(p, EWL_PANED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_TYPE(p, EWL_PANED_TYPE);
- info = ewl_paned_size_info_add(p, child);
- info->initial_size = size;
- info->initial_size_has = TRUE;
+ info = ewl_paned_size_info_add(p, child);
+ info->initial_size = size;
+ info->initial_size_has = TRUE;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -248,17 +248,17 @@ ewl_paned_initial_size_set(Ewl_Paned *p, Ewl_Widget *child, int size)
int
ewl_paned_initial_size_get(Ewl_Paned *p, Ewl_Widget *child)
{
- Ewl_Paned_Size_Info *info;
+ Ewl_Paned_Size_Info *info;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(p, 0);
- DCHECK_TYPE_RET(p, EWL_PANED_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(p, 0);
+ DCHECK_TYPE_RET(p, EWL_PANED_TYPE, 0);
- info = ewl_paned_size_info_get(p, child);
- if (!info || !info->initial_size_has)
- DRETURN_INT(0, DLEVEL_STABLE);
+ info = ewl_paned_size_info_get(p, child);
+ if (!info || !info->initial_size_has)
+ DRETURN_INT(0, DLEVEL_STABLE);
- DRETURN_INT(info->initial_size, DLEVEL_STABLE);
+ DRETURN_INT(info->initial_size, DLEVEL_STABLE);
}
/**
@@ -271,16 +271,16 @@ ewl_paned_initial_size_get(Ewl_Paned *p, Ewl_Widget *child)
void
ewl_paned_fixed_size_set(Ewl_Paned *p, Ewl_Widget *child, unsigned int fixed)
{
- Ewl_Paned_Size_Info *info;
+ Ewl_Paned_Size_Info *info;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_TYPE(p, EWL_PANED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_TYPE(p, EWL_PANED_TYPE);
- info = ewl_paned_size_info_add(p, child);
- info->fixed = !!fixed;
+ info = ewl_paned_size_info_add(p, child);
+ info->fixed = !!fixed;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -292,17 +292,17 @@ ewl_paned_fixed_size_set(Ewl_Paned *p, Ewl_Widget *child, unsigned int fixed)
unsigned int
ewl_paned_fixed_size_get(Ewl_Paned *p, Ewl_Widget *child)
{
- Ewl_Paned_Size_Info *info;
+ Ewl_Paned_Size_Info *info;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(p, 0);
- DCHECK_TYPE_RET(p, EWL_PANED_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(p, 0);
+ DCHECK_TYPE_RET(p, EWL_PANED_TYPE, 0);
- info = ewl_paned_size_info_get(p, child);
- if (!info)
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ info = ewl_paned_size_info_get(p, child);
+ if (!info)
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- DRETURN_INT(info->fixed, DLEVEL_STABLE);
+ DRETURN_INT(info->fixed, DLEVEL_STABLE);
}
/**
@@ -315,30 +315,30 @@ ewl_paned_fixed_size_get(Ewl_Paned *p, Ewl_Widget *child)
void
ewl_paned_cb_child_add(Ewl_Container *c, Ewl_Widget *w)
{
- Ewl_Widget *o;
- int idx;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_PANED_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- /* if this is a grabber we can skipp it */
- if (EWL_PANED_GRABBER_IS(w))
- DRETURN(DLEVEL_STABLE);
-
- o = ewl_paned_grabber_new();
- ewl_paned_grabber_paned_orientation_set(EWL_PANED_GRABBER(o),
- ewl_paned_orientation_get(EWL_PANED(c)));
-
- /* insert the grabber at the same position as the pane so the
- * grabber ends up to the left of the pane in the children list */
- idx = ewl_container_child_index_get(c, w);
- ewl_container_child_insert(c, o, idx);
- ewl_paned_grabbers_update(EWL_PANED(c));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Widget *o;
+ int idx;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_PANED_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ /* if this is a grabber we can skipp it */
+ if (EWL_PANED_GRABBER_IS(w))
+ DRETURN(DLEVEL_STABLE);
+
+ o = ewl_paned_grabber_new();
+ ewl_paned_grabber_paned_orientation_set(EWL_PANED_GRABBER(o),
+ ewl_paned_orientation_get(EWL_PANED(c)));
+
+ /* insert the grabber at the same position as the pane so the
+ * grabber ends up to the left of the pane in the children list */
+ idx = ewl_container_child_index_get(c, w);
+ ewl_container_child_insert(c, o, idx);
+ ewl_paned_grabbers_update(EWL_PANED(c));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -352,32 +352,32 @@ ewl_paned_cb_child_add(Ewl_Container *c, Ewl_Widget *w)
void
ewl_paned_cb_child_remove(Ewl_Container *c, Ewl_Widget *w, int idx)
{
- Ewl_Paned *p;
- Ewl_Widget *o;
+ Ewl_Paned *p;
+ Ewl_Widget *o;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_PANED_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_PANED_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- p = EWL_PANED(c);
- /* skip grabbers */
- if (EWL_PANED_GRABBER_IS(w))
- DRETURN(DLEVEL_STABLE);
+ p = EWL_PANED(c);
+ /* skip grabbers */
+ if (EWL_PANED_GRABBER_IS(w))
+ DRETURN(DLEVEL_STABLE);
- /* our grabber is always to our left, since we were just removed
- * from idx that means it's at idx - 1 */
- o = ewl_container_child_internal_get(c, idx - 1);
- ewl_widget_destroy(o);
+ /* our grabber is always to our left, since we were just removed
+ * from idx that means it's at idx - 1 */
+ o = ewl_container_child_internal_get(c, idx - 1);
+ ewl_widget_destroy(o);
- if (p->last_pane == w)
- p->last_pane = NULL;
+ if (p->last_pane == w)
+ p->last_pane = NULL;
- ewl_paned_size_info_del(p, w);
- ewl_paned_grabbers_update(EWL_PANED(c));
+ ewl_paned_size_info_del(p, w);
+ ewl_paned_grabbers_update(EWL_PANED(c));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -390,45 +390,45 @@ ewl_paned_cb_child_remove(Ewl_Container *c, Ewl_Widget *w, int idx)
void
ewl_paned_cb_child_show(Ewl_Container *c, Ewl_Widget *w)
{
- int cw, ch, ww, wh;
- Ewl_Paned_Size_Info *info;
+ int cw, ch, ww, wh;
+ Ewl_Paned_Size_Info *info;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_PANED_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_PANED_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_object_preferred_size_get(EWL_OBJECT(w), &ww, &wh);
- ewl_object_preferred_inner_size_get(EWL_OBJECT(c), &cw, &ch);
+ ewl_object_preferred_size_get(EWL_OBJECT(w), &ww, &wh);
+ ewl_object_preferred_inner_size_get(EWL_OBJECT(c), &cw, &ch);
- EWL_PANED(c)->new_panes = TRUE;
+ EWL_PANED(c)->new_panes = TRUE;
- info = ewl_paned_size_info_get(EWL_PANED(c), w);
+ info = ewl_paned_size_info_get(EWL_PANED(c), w);
- if (EWL_ORIENTATION_HORIZONTAL == EWL_PANED(c)->orientation)
- {
- if (info && info->initial_size_has)
- cw += info->initial_size;
- else
- cw += ww;
+ if (EWL_ORIENTATION_HORIZONTAL == EWL_PANED(c)->orientation)
+ {
+ if (info && info->initial_size_has)
+ cw += info->initial_size;
+ else
+ cw += ww;
- if (wh > ch) ch = wh;
- }
- else
- {
- if (info && info->initial_size_has)
- ch += info->initial_size;
- else
- ch += wh;
+ if (wh > ch) ch = wh;
+ }
+ else
+ {
+ if (info && info->initial_size_has)
+ ch += info->initial_size;
+ else
+ ch += wh;
- if (ww > cw) cw = ww;
- }
+ if (ww > cw) cw = ww;
+ }
- ewl_object_preferred_inner_size_set(EWL_OBJECT(c), cw, ch);
- ewl_paned_grabbers_update(EWL_PANED(c));
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(c), cw, ch);
+ ewl_paned_grabbers_update(EWL_PANED(c));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -440,35 +440,35 @@ ewl_paned_cb_child_show(Ewl_Container *c, Ewl_Widget *w)
*/
void
ewl_paned_cb_child_resize(Ewl_Container *c, Ewl_Widget *w, int size,
- Ewl_Orientation o)
+ Ewl_Orientation o)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_PANED_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- if (o == EWL_PANED(c)->orientation)
- {
- Ewl_Paned_Size_Info *info;
-
- info = ewl_paned_size_info_get(EWL_PANED(c), w);
- if (!info || !info->initial_size_has)
- {
- if (o == EWL_ORIENTATION_HORIZONTAL)
- ewl_object_preferred_inner_w_set(
- EWL_OBJECT(c), PREFERRED_W(c)
- + size);
- else
- ewl_object_preferred_inner_h_set(
- EWL_OBJECT(c), PREFERRED_H(c)
- + size);
- }
- }
- else
- ewl_container_largest_prefer(c, o);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_PANED_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ if (o == EWL_PANED(c)->orientation)
+ {
+ Ewl_Paned_Size_Info *info;
+
+ info = ewl_paned_size_info_get(EWL_PANED(c), w);
+ if (!info || !info->initial_size_has)
+ {
+ if (o == EWL_ORIENTATION_HORIZONTAL)
+ ewl_object_preferred_inner_w_set(
+ EWL_OBJECT(c), PREFERRED_W(c)
+ + size);
+ else
+ ewl_object_preferred_inner_h_set(
+ EWL_OBJECT(c), PREFERRED_H(c)
+ + size);
+ }
+ }
+ else
+ ewl_container_largest_prefer(c, o);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -481,38 +481,38 @@ ewl_paned_cb_child_resize(Ewl_Container *c, Ewl_Widget *w, int size,
void
ewl_paned_cb_child_hide(Ewl_Container *c, Ewl_Widget *w)
{
- int cw, ch, ww, wh;
- Ewl_Paned_Size_Info *info;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_PANED_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- ewl_object_preferred_size_get(EWL_OBJECT(w), &ww, &wh);
- ewl_object_preferred_inner_size_get(EWL_OBJECT(c), &cw, &ch);
- info = ewl_paned_size_info_get(EWL_PANED(c), w);
-
- if (EWL_ORIENTATION_HORIZONTAL == EWL_PANED(c)->orientation)
- {
- if (info && info->initial_size_has)
- cw -= info->initial_size;
- else
- cw -= ww;
- }
- else
- {
- if (info && info->initial_size_has)
- ch -= info->initial_size;
- else
- ch -= wh;
- }
-
- ewl_object_preferred_inner_size_set(EWL_OBJECT(c), cw, ch);
- ewl_paned_grabbers_update(EWL_PANED(c));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int cw, ch, ww, wh;
+ Ewl_Paned_Size_Info *info;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_PANED_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ ewl_object_preferred_size_get(EWL_OBJECT(w), &ww, &wh);
+ ewl_object_preferred_inner_size_get(EWL_OBJECT(c), &cw, &ch);
+ info = ewl_paned_size_info_get(EWL_PANED(c), w);
+
+ if (EWL_ORIENTATION_HORIZONTAL == EWL_PANED(c)->orientation)
+ {
+ if (info && info->initial_size_has)
+ cw -= info->initial_size;
+ else
+ cw -= ww;
+ }
+ else
+ {
+ if (info && info->initial_size_has)
+ ch -= info->initial_size;
+ else
+ ch -= wh;
+ }
+
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(c), cw, ch);
+ ewl_paned_grabbers_update(EWL_PANED(c));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -530,63 +530,63 @@ ewl_paned_cb_child_hide(Ewl_Container *c, Ewl_Widget *w)
void
ewl_paned_arrange(Ewl_Paned *p, int pane_num)
{
- Ewl_Widget *w;
- Ewl_Container *c;
- Ewl_Paned_Pane_Info *panes;
- int available;
- int main_size, main_pos;
- int grabber_size, resizable = 0;
- int used_size;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_TYPE(p, EWL_PANED_TYPE);
-
- w = EWL_WIDGET(p);
- c = EWL_CONTAINER(p);
-
- if (ewl_paned_orientation_get(p) == EWL_ORIENTATION_HORIZONTAL)
- {
- layout = horizontal_layout;
- main_size = CURRENT_W(w);
- main_pos = CURRENT_X(w);
- }
- else
- {
- layout = vertical_layout;
- main_size = CURRENT_H(w);
- main_pos = CURRENT_Y(w);
- }
-
- /* we cannot place the panes if there aren't any */
- if (pane_num <= 0)
- DRETURN(DLEVEL_STABLE);
-
- /* setup the array holding the information about the panes */
- panes = alloca(sizeof(Ewl_Paned_Pane_Info) * pane_num);
-
- grabber_size = ewl_paned_grapper_size_get(p);
-
- /* if there are new widgets we place them first */
- if (p->new_panes)
- used_size = ewl_paned_pane_info_setup(p, panes, layout,
- &resizable);
- else
- used_size = ewl_paned_pane_info_collect(p, panes, layout,
- &resizable, grabber_size);
-
-
- available = main_size - grabber_size * (pane_num - 1) - used_size;
-
- ewl_paned_pane_info_layout(p, panes, pane_num, layout, available, resizable);
- /* now that all of the space is filled we can go and layout all of
- * the available widgets */
- used_size = ewl_paned_widgets_place(p, panes, grabber_size);
-
- p->last_size = used_size;
- p->last_pos = main_pos;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Widget *w;
+ Ewl_Container *c;
+ Ewl_Paned_Pane_Info *panes;
+ int available;
+ int main_size, main_pos;
+ int grabber_size, resizable = 0;
+ int used_size;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_TYPE(p, EWL_PANED_TYPE);
+
+ w = EWL_WIDGET(p);
+ c = EWL_CONTAINER(p);
+
+ if (ewl_paned_orientation_get(p) == EWL_ORIENTATION_HORIZONTAL)
+ {
+ layout = horizontal_layout;
+ main_size = CURRENT_W(w);
+ main_pos = CURRENT_X(w);
+ }
+ else
+ {
+ layout = vertical_layout;
+ main_size = CURRENT_H(w);
+ main_pos = CURRENT_Y(w);
+ }
+
+ /* we cannot place the panes if there aren't any */
+ if (pane_num <= 0)
+ DRETURN(DLEVEL_STABLE);
+
+ /* setup the array holding the information about the panes */
+ panes = alloca(sizeof(Ewl_Paned_Pane_Info) * pane_num);
+
+ grabber_size = ewl_paned_grapper_size_get(p);
+
+ /* if there are new widgets we place them first */
+ if (p->new_panes)
+ used_size = ewl_paned_pane_info_setup(p, panes, layout,
+ &resizable);
+ else
+ used_size = ewl_paned_pane_info_collect(p, panes, layout,
+ &resizable, grabber_size);
+
+
+ available = main_size - grabber_size * (pane_num - 1) - used_size;
+
+ ewl_paned_pane_info_layout(p, panes, pane_num, layout, available, resizable);
+ /* now that all of the space is filled we can go and layout all of
+ * the available widgets */
+ used_size = ewl_paned_widgets_place(p, panes, grabber_size);
+
+ p->last_size = used_size;
+ p->last_pos = main_pos;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -599,19 +599,19 @@ ewl_paned_arrange(Ewl_Paned *p, int pane_num)
*/
void
ewl_paned_cb_configure(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- int pane_num;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_PANED_TYPE);
+ int pane_num;
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_PANED_TYPE);
- /* we need to now the number of panes */
- pane_num = (ewl_container_child_count_visible_get(EWL_CONTAINER(w)) + 1)/2;
+ /* we need to now the number of panes */
+ pane_num = (ewl_container_child_count_visible_get(EWL_CONTAINER(w)) + 1)/2;
- ewl_paned_arrange(EWL_PANED(w), pane_num);
+ ewl_paned_arrange(EWL_PANED(w), pane_num);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -624,323 +624,323 @@ ewl_paned_cb_configure(Ewl_Widget *w, void *ev __UNUSED__,
*/
void
ewl_paned_cb_destroy(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Paned *p;
+ Ewl_Paned *p;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_PANED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_PANED_TYPE);
- p = EWL_PANED(w);
- IF_FREE(p->info);
+ p = EWL_PANED(w);
+ IF_FREE(p->info);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/* Look at all of the grabbers and show/hide them as needed */
static void
ewl_paned_grabbers_update(Ewl_Paned *p)
{
- Ewl_Widget *child, *g = NULL;
- Ewl_Container *c;
- int left = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_TYPE(p, EWL_PANED_TYPE);
-
- if (p->updating_grabbers)
- DRETURN(DLEVEL_STABLE);
-
- p->updating_grabbers = 1;
-
- c = EWL_CONTAINER(p);
- ecore_dlist_first_goto(c->children);
- while ((child = ecore_dlist_next(c->children)))
- {
- /* internal means grabber */
- if (EWL_PANED_GRABBER_IS(child))
- {
- /* if there is a widget to the left we store the
- * grabber */
- if (left) g = child;
- ewl_widget_hide(child);
- }
- else if (VISIBLE(child) && !UNMANAGED(child))
- {
- left = 1;
-
- /* if we have a grabber to the left of us we need to
- * show it as that means there is a widget to the
- * left of us */
- if (g)
- {
- ewl_widget_show(g);
- g = NULL;
- }
- }
- }
-
- p->updating_grabbers = 0;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Widget *child, *g = NULL;
+ Ewl_Container *c;
+ int left = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_TYPE(p, EWL_PANED_TYPE);
+
+ if (p->updating_grabbers)
+ DRETURN(DLEVEL_STABLE);
+
+ p->updating_grabbers = 1;
+
+ c = EWL_CONTAINER(p);
+ ecore_dlist_first_goto(c->children);
+ while ((child = ecore_dlist_next(c->children)))
+ {
+ /* internal means grabber */
+ if (EWL_PANED_GRABBER_IS(child))
+ {
+ /* if there is a widget to the left we store the
+ * grabber */
+ if (left) g = child;
+ ewl_widget_hide(child);
+ }
+ else if (VISIBLE(child) && !UNMANAGED(child))
+ {
+ left = 1;
+
+ /* if we have a grabber to the left of us we need to
+ * show it as that means there is a widget to the
+ * left of us */
+ if (g)
+ {
+ ewl_widget_show(g);
+ g = NULL;
+ }
+ }
+ }
+
+ p->updating_grabbers = 0;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static int
ewl_paned_pane_info_setup(Ewl_Paned *p, Ewl_Paned_Pane_Info *panes,
- Ewl_Paned_Layout *layout, int *resizable)
+ Ewl_Paned_Layout *layout, int *resizable)
{
- Ewl_Widget *child;
- Ewl_Container *c;
- int available = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(p, 0);
- DCHECK_TYPE_RET(p, EWL_PANED_TYPE, 0);
- DCHECK_PARAM_PTR_RET(layout, 0);
-
- c = EWL_CONTAINER(p);
-
- ecore_dlist_first_goto(c->children);
- while ((child = ecore_dlist_next(c->children)))
- {
- if (!VISIBLE(child) || EWL_PANED_GRABBER_IS(child)
- || UNMANAGED(child))
- continue;
-
- panes->info = ewl_paned_size_info_get(p, child);
- panes->pane = child;
-
- if (panes->info && panes->info->initial_size_has)
- {
- panes->size = panes->info->initial_size;
- panes->fixed = TRUE;
- }
- else
- {
- panes->size = layout->minimum_size(EWL_OBJECT(child));
- (*resizable)++;
- panes->fixed = FALSE;
- }
-
- available += panes->size;
- panes++;
- }
-
- p->new_panes = FALSE;
-
- DRETURN_INT(available, DLEVEL_STABLE);
+ Ewl_Widget *child;
+ Ewl_Container *c;
+ int available = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(p, 0);
+ DCHECK_TYPE_RET(p, EWL_PANED_TYPE, 0);
+ DCHECK_PARAM_PTR_RET(layout, 0);
+
+ c = EWL_CONTAINER(p);
+
+ ecore_dlist_first_goto(c->children);
+ while ((child = ecore_dlist_next(c->children)))
+ {
+ if (!VISIBLE(child) || EWL_PANED_GRABBER_IS(child)
+ || UNMANAGED(child))
+ continue;
+
+ panes->info = ewl_paned_size_info_get(p, child);
+ panes->pane = child;
+
+ if (panes->info && panes->info->initial_size_has)
+ {
+ panes->size = panes->info->initial_size;
+ panes->fixed = TRUE;
+ }
+ else
+ {
+ panes->size = layout->minimum_size(EWL_OBJECT(child));
+ (*resizable)++;
+ panes->fixed = FALSE;
+ }
+
+ available += panes->size;
+ panes++;
+ }
+
+ p->new_panes = FALSE;
+
+ DRETURN_INT(available, DLEVEL_STABLE);
}
static int
ewl_paned_pane_info_collect(Ewl_Paned *p, Ewl_Paned_Pane_Info *panes,
- Ewl_Paned_Layout *layout, int *resizable, int grabber_size)
+ Ewl_Paned_Layout *layout, int *resizable, int grabber_size)
{
- Ewl_Container *c;
- Ewl_Widget *child;
- int prev_pos;
- int i = 0;
- int available = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(p, 0);
- DCHECK_TYPE_RET(p, EWL_PANED_TYPE, 0);
-
- prev_pos = p->last_pos;
- c = EWL_CONTAINER(p);
-
- /* We haven't moved the widgets yet. Let us now get their
- * previous position so we can determine the size of the
- * space they had */
- ecore_dlist_first_goto(c->children);
- while ((child = ecore_dlist_next(c->children)))
- {
- int pos;
-
- if (!VISIBLE(child) || UNMANAGED(child))
- continue;
- if (!EWL_PANED_GRABBER_IS(child))
- {
- panes[i].pane = child;
- panes[i].info = ewl_paned_size_info_get(p, child);
- if (panes[i].info && panes[i].info->fixed)
- panes[i].fixed = TRUE;
- else
- {
- panes[i].fixed = FALSE;
- (*resizable)++;
- }
-
- continue;
- }
-
- pos = layout->current_position(EWL_OBJECT(child));
- panes[i].size = pos - prev_pos;
- available += panes[i].size;
- prev_pos = pos + grabber_size;
- i++;
- }
- /* only the last position is not set because we have no grabber
- * at the end */
- panes[i].size = p->last_size - (prev_pos - p->last_pos);
- available += panes[i].size;
-
- DRETURN_INT(available, DLEVEL_STABLE);
+ Ewl_Container *c;
+ Ewl_Widget *child;
+ int prev_pos;
+ int i = 0;
+ int available = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(p, 0);
+ DCHECK_TYPE_RET(p, EWL_PANED_TYPE, 0);
+
+ prev_pos = p->last_pos;
+ c = EWL_CONTAINER(p);
+
+ /* We haven't moved the widgets yet. Let us now get their
+ * previous position so we can determine the size of the
+ * space they had */
+ ecore_dlist_first_goto(c->children);
+ while ((child = ecore_dlist_next(c->children)))
+ {
+ int pos;
+
+ if (!VISIBLE(child) || UNMANAGED(child))
+ continue;
+ if (!EWL_PANED_GRABBER_IS(child))
+ {
+ panes[i].pane = child;
+ panes[i].info = ewl_paned_size_info_get(p, child);
+ if (panes[i].info && panes[i].info->fixed)
+ panes[i].fixed = TRUE;
+ else
+ {
+ panes[i].fixed = FALSE;
+ (*resizable)++;
+ }
+
+ continue;
+ }
+
+ pos = layout->current_position(EWL_OBJECT(child));
+ panes[i].size = pos - prev_pos;
+ available += panes[i].size;
+ prev_pos = pos + grabber_size;
+ i++;
+ }
+ /* only the last position is not set because we have no grabber
+ * at the end */
+ panes[i].size = p->last_size - (prev_pos - p->last_pos);
+ available += panes[i].size;
+
+ DRETURN_INT(available, DLEVEL_STABLE);
}
static void
ewl_paned_pane_info_layout(Ewl_Paned *p, Ewl_Paned_Pane_Info *panes,
- int pane_num, Ewl_Paned_Layout *layout,
- int available, int resizable)
+ int pane_num, Ewl_Paned_Layout *layout,
+ int available, int resizable)
{
- int cur_res = resizable;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_TYPE(p, EWL_PANED_TYPE);
-
- while (available != 0)
- {
- int give;
- int i;
-
- /* if we have no panes we don't need to calc their place,
- * or, if cur_res is as low as it will get avoid endless
- * loop
- */
- if ((cur_res < 1) || (cur_res == (resizable - pane_num)))
- DRETURN(DLEVEL_STABLE);
-
- /* give can also be negative, so see it as a can take or give */
- give = available / cur_res;
- /* reset the resizable pane_num now */
- cur_res = resizable;
- i = 0;
- /* to prevent rounding errors */
- if (give == 0) {
- give = (available > 0) ? 1 : -1;
- if (p->last_pane)
- {
- /* find the index to start with */
- while ((panes[i].pane) &&
- (panes[i].pane
- != p->last_pane))
- i++;
- /* on the next run we don't want to start
- * with this widget */
- p->last_pane = NULL;
- i++;
- if (i >= pane_num)
- i = 0;
- }
- }
-
- for (;i < pane_num; i++)
- {
- int min;
-
- if (panes[i].fixed)
- continue;
-
- min = layout->minimum_size(EWL_OBJECT(panes[i].pane));
-
- if (min > panes[i].size + give) {
- available -= panes[i].size - min;
- panes[i].size = min;
- cur_res--;
- }
- else {
- available -= give;
- panes[i].size += give;
- }
-
- /* if there is no space to distribute left
- * we can stop in resizing the panes */
- if (available == 0) {
- p->last_pane = panes[i].pane;
- break;
- }
- }
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int cur_res = resizable;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_TYPE(p, EWL_PANED_TYPE);
+
+ while (available != 0)
+ {
+ int give;
+ int i;
+
+ /* if we have no panes we don't need to calc their place,
+ * or, if cur_res is as low as it will get avoid endless
+ * loop
+ */
+ if ((cur_res < 1) || (cur_res == (resizable - pane_num)))
+ DRETURN(DLEVEL_STABLE);
+
+ /* give can also be negative, so see it as a can take or give */
+ give = available / cur_res;
+ /* reset the resizable pane_num now */
+ cur_res = resizable;
+ i = 0;
+ /* to prevent rounding errors */
+ if (give == 0) {
+ give = (available > 0) ? 1 : -1;
+ if (p->last_pane)
+ {
+ /* find the index to start with */
+ while ((panes[i].pane) &&
+ (panes[i].pane
+ != p->last_pane))
+ i++;
+ /* on the next run we don't want to start
+ * with this widget */
+ p->last_pane = NULL;
+ i++;
+ if (i >= pane_num)
+ i = 0;
+ }
+ }
+
+ for (;i < pane_num; i++)
+ {
+ int min;
+
+ if (panes[i].fixed)
+ continue;
+
+ min = layout->minimum_size(EWL_OBJECT(panes[i].pane));
+
+ if (min > panes[i].size + give) {
+ available -= panes[i].size - min;
+ panes[i].size = min;
+ cur_res--;
+ }
+ else {
+ available -= give;
+ panes[i].size += give;
+ }
+
+ /* if there is no space to distribute left
+ * we can stop in resizing the panes */
+ if (available == 0) {
+ p->last_pane = panes[i].pane;
+ break;
+ }
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static int
ewl_paned_widgets_place(Ewl_Paned *p, Ewl_Paned_Pane_Info *panes,
- int grabber_size)
+ int grabber_size)
{
- Ewl_Container *c;
- Ewl_Widget *child;
- int cur_pos, cur_size, first_pos;
- const int *x, *y, *w, *h;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(p, 0);
- DCHECK_TYPE_RET(p, EWL_PANED_TYPE, 0);
-
- c = EWL_CONTAINER(p);
-
- if (ewl_paned_orientation_get(p) == EWL_ORIENTATION_HORIZONTAL)
- {
- first_pos = cur_pos = CURRENT_X(p);
- x = &cur_pos;
- y = &CURRENT_Y(p);
- w = &cur_size;
- h = &CURRENT_H(p);
- }
- else
- {
- first_pos = cur_pos = CURRENT_Y(p);
- x = &CURRENT_X(p);
- y = &cur_pos;
- w = &CURRENT_W(p);
- h = &cur_size;
- }
-
- ecore_dlist_first_goto(c->children);
- while ((child = ecore_dlist_next(c->children)))
- {
- if (!VISIBLE(child) || UNMANAGED(child))
- continue;
-
- if (EWL_PANED_GRABBER_IS(child))
- cur_size = grabber_size;
- else
- cur_size = (panes++)->size;
-
- ewl_object_place(EWL_OBJECT(child), *x, *y, *w, *h);
-
- cur_pos += cur_size;
- }
-
- DRETURN_INT(cur_pos - first_pos, DLEVEL_STABLE);
+ Ewl_Container *c;
+ Ewl_Widget *child;
+ int cur_pos, cur_size, first_pos;
+ const int *x, *y, *w, *h;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(p, 0);
+ DCHECK_TYPE_RET(p, EWL_PANED_TYPE, 0);
+
+ c = EWL_CONTAINER(p);
+
+ if (ewl_paned_orientation_get(p) == EWL_ORIENTATION_HORIZONTAL)
+ {
+ first_pos = cur_pos = CURRENT_X(p);
+ x = &cur_pos;
+ y = &CURRENT_Y(p);
+ w = &cur_size;
+ h = &CURRENT_H(p);
+ }
+ else
+ {
+ first_pos = cur_pos = CURRENT_Y(p);
+ x = &CURRENT_X(p);
+ y = &cur_pos;
+ w = &CURRENT_W(p);
+ h = &cur_size;
+ }
+
+ ecore_dlist_first_goto(c->children);
+ while ((child = ecore_dlist_next(c->children)))
+ {
+ if (!VISIBLE(child) || UNMANAGED(child))
+ continue;
+
+ if (EWL_PANED_GRABBER_IS(child))
+ cur_size = grabber_size;
+ else
+ cur_size = (panes++)->size;
+
+ ewl_object_place(EWL_OBJECT(child), *x, *y, *w, *h);
+
+ cur_pos += cur_size;
+ }
+
+ DRETURN_INT(cur_pos - first_pos, DLEVEL_STABLE);
}
static int
ewl_paned_grapper_size_get(Ewl_Paned *p)
{
- Ewl_Container *c;
- Ewl_Widget *child;
-
- c = EWL_CONTAINER(p);
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(p, 0);
- DCHECK_TYPE_RET(p, EWL_PANED_TYPE, 0);
-
- ecore_list_first_goto(c->children);
- while ((child = ecore_list_next(c->children)))
- {
- if (!VISIBLE(child) || !EWL_PANED_GRABBER_IS(child))
- continue;
-
- DRETURN_INT(layout->current_size(EWL_OBJECT(child)),
- DLEVEL_STABLE);
- }
-
- DRETURN_INT(0, DLEVEL_STABLE);
+ Ewl_Container *c;
+ Ewl_Widget *child;
+
+ c = EWL_CONTAINER(p);
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(p, 0);
+ DCHECK_TYPE_RET(p, EWL_PANED_TYPE, 0);
+
+ ecore_list_first_goto(c->children);
+ while ((child = ecore_list_next(c->children)))
+ {
+ if (!VISIBLE(child) || !EWL_PANED_GRABBER_IS(child))
+ continue;
+
+ DRETURN_INT(layout->current_size(EWL_OBJECT(child)),
+ DLEVEL_STABLE);
+ }
+
+ DRETURN_INT(0, DLEVEL_STABLE);
}
@@ -950,88 +950,88 @@ ewl_paned_grapper_size_get(Ewl_Paned *p)
Ewl_Paned_Size_Info *
ewl_paned_size_info_add(Ewl_Paned *p, Ewl_Widget *w)
{
- Ewl_Paned_Size_Info *info;
- int i;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(p, NULL);
- DCHECK_TYPE_RET(p, EWL_PANED_TYPE, NULL);
-
-
- /* if we already have a info item for this widget we don't need
- * to create one */
- info = ewl_paned_size_info_get(p, w);
- if (info)
- DRETURN_PTR(info, DLEVEL_STABLE);
-
- /* ok we don't have found one first we have to resize our array */
- p->info = realloc(p->info, (p->info_size + 1)
- * sizeof(Ewl_Paned_Size_Info));
- /* now we need to find the position for the new info item */
- for (i = 0; i < p->info_size; i++)
- {
- if (p->info[i].child > w)
- break;
- }
- /* move the rest so we can insert it */
- memmove(p->info + i + 1, p->info + i,
- sizeof(Ewl_Paned_Size_Info) * (p->info_size - i));
- memset(p->info + i, 0, sizeof(Ewl_Paned_Size_Info));
- p->info[i].child = w;
- p->info_size++;
-
- DRETURN_PTR(p->info + i, DLEVEL_STABLE);
+ Ewl_Paned_Size_Info *info;
+ int i;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(p, NULL);
+ DCHECK_TYPE_RET(p, EWL_PANED_TYPE, NULL);
+
+
+ /* if we already have a info item for this widget we don't need
+ * to create one */
+ info = ewl_paned_size_info_get(p, w);
+ if (info)
+ DRETURN_PTR(info, DLEVEL_STABLE);
+
+ /* ok we don't have found one first we have to resize our array */
+ p->info = realloc(p->info, (p->info_size + 1)
+ * sizeof(Ewl_Paned_Size_Info));
+ /* now we need to find the position for the new info item */
+ for (i = 0; i < p->info_size; i++)
+ {
+ if (p->info[i].child > w)
+ break;
+ }
+ /* move the rest so we can insert it */
+ memmove(p->info + i + 1, p->info + i,
+ sizeof(Ewl_Paned_Size_Info) * (p->info_size - i));
+ memset(p->info + i, 0, sizeof(Ewl_Paned_Size_Info));
+ p->info[i].child = w;
+ p->info_size++;
+
+ DRETURN_PTR(p->info + i, DLEVEL_STABLE);
}
static int
ewl_paned_size_info_compare(const void *key1, const void *key2)
{
- const Ewl_Paned_Size_Info *info1, *info2;
+ const Ewl_Paned_Size_Info *info1, *info2;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- info1 = key1;
- info2 = key2;
+ info1 = key1;
+ info2 = key2;
- DRETURN_INT(ecore_direct_compare(info1->child, info2->child),
- DLEVEL_STABLE);
+ DRETURN_INT(ecore_direct_compare(info1->child, info2->child),
+ DLEVEL_STABLE);
}
Ewl_Paned_Size_Info *
ewl_paned_size_info_get(Ewl_Paned *p, Ewl_Widget *w)
{
- Ewl_Paned_Size_Info info;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(p, NULL);
- DCHECK_TYPE_RET(p, EWL_PANED_TYPE, NULL);
-
- memset(&info, 0, sizeof(Ewl_Paned_Size_Info));
- info.child = w;
-
- DRETURN_PTR(bsearch(&info, p->info, p->info_size,
- sizeof(Ewl_Paned_Size_Info),
- ewl_paned_size_info_compare), DLEVEL_STABLE);
+ Ewl_Paned_Size_Info info;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(p, NULL);
+ DCHECK_TYPE_RET(p, EWL_PANED_TYPE, NULL);
+
+ memset(&info, 0, sizeof(Ewl_Paned_Size_Info));
+ info.child = w;
+
+ DRETURN_PTR(bsearch(&info, p->info, p->info_size,
+ sizeof(Ewl_Paned_Size_Info),
+ ewl_paned_size_info_compare), DLEVEL_STABLE);
}
void
ewl_paned_size_info_del(Ewl_Paned *p, Ewl_Widget *w)
{
- Ewl_Paned_Size_Info *info;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_TYPE(p, EWL_PANED_TYPE);
-
- info = ewl_paned_size_info_get(p, w);
- if (!info)
- DRETURN(DLEVEL_STABLE);
-
- memmove(info, info + 1, (p->info_size - (info - p->info) - 1)
- * sizeof(Ewl_Paned_Size_Info));
- p->info = realloc(p->info, --p->info_size);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Paned_Size_Info *info;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_TYPE(p, EWL_PANED_TYPE);
+
+ info = ewl_paned_size_info_get(p, w);
+ if (!info)
+ DRETURN(DLEVEL_STABLE);
+
+ memmove(info, info + 1, (p->info_size - (info - p->info) - 1)
+ * sizeof(Ewl_Paned_Size_Info));
+ p->info = realloc(p->info, --p->info_size);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/*
@@ -1045,21 +1045,21 @@ ewl_paned_size_info_del(Ewl_Paned *p, Ewl_Widget *w)
Ewl_Widget *
ewl_paned_grabber_new(void)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- w = NEW(Ewl_Paned_Grabber, 1);
- if (!w)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ w = NEW(Ewl_Paned_Grabber, 1);
+ if (!w)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_paned_grabber_init(EWL_PANED_GRABBER(w)))
- {
- ewl_widget_destroy(w);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ewl_paned_grabber_init(EWL_PANED_GRABBER(w)))
+ {
+ ewl_widget_destroy(w);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
/**
@@ -1070,23 +1070,23 @@ ewl_paned_grabber_new(void)
int
ewl_paned_grabber_init(Ewl_Paned_Grabber *g)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(g, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(g, FALSE);
- if (!ewl_separator_init(EWL_SEPARATOR(g)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_separator_init(EWL_SEPARATOR(g)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_inherit(EWL_WIDGET(g), EWL_PANED_GRABBER_TYPE);
- ewl_paned_grabber_paned_orientation_set(g, EWL_ORIENTATION_VERTICAL);
+ ewl_widget_inherit(EWL_WIDGET(g), EWL_PANED_GRABBER_TYPE);
+ ewl_paned_grabber_paned_orientation_set(g, EWL_ORIENTATION_VERTICAL);
- ewl_callback_append(EWL_WIDGET(g), EWL_CALLBACK_MOUSE_DOWN,
- ewl_paned_grabber_cb_mouse_down, NULL);
- ewl_callback_append(EWL_WIDGET(g), EWL_CALLBACK_MOUSE_UP,
- ewl_paned_grabber_cb_mouse_up, NULL);
+ ewl_callback_append(EWL_WIDGET(g), EWL_CALLBACK_MOUSE_DOWN,
+ ewl_paned_grabber_cb_mouse_down, NULL);
+ ewl_callback_append(EWL_WIDGET(g), EWL_CALLBACK_MOUSE_UP,
+ ewl_paned_grabber_cb_mouse_up, NULL);
- ewl_widget_internal_set(EWL_WIDGET(g), TRUE);
+ ewl_widget_internal_set(EWL_WIDGET(g), TRUE);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -1098,28 +1098,28 @@ ewl_paned_grabber_init(Ewl_Paned_Grabber *g)
void
ewl_paned_grabber_paned_orientation_set(Ewl_Paned_Grabber *g, Ewl_Orientation o)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(g);
- DCHECK_TYPE(g, EWL_PANED_GRABBER_TYPE);
-
- if (o == EWL_ORIENTATION_HORIZONTAL)
- {
- ewl_separator_orientation_set(EWL_SEPARATOR(g),
- EWL_ORIENTATION_VERTICAL);
- ewl_widget_appearance_set(EWL_WIDGET(g), "grabber/vertical");
- ewl_paned_grabber_show_cursor_for(g,
- EWL_POSITION_LEFT | EWL_POSITION_RIGHT);
- }
- else
- {
- ewl_separator_orientation_set(EWL_SEPARATOR(g),
- EWL_ORIENTATION_HORIZONTAL);
- ewl_widget_appearance_set(EWL_WIDGET(g), "grabber/horizontal");
- ewl_paned_grabber_show_cursor_for(g,
- EWL_POSITION_TOP | EWL_POSITION_BOTTOM);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(g);
+ DCHECK_TYPE(g, EWL_PANED_GRABBER_TYPE);
+
+ if (o == EWL_ORIENTATION_HORIZONTAL)
+ {
+ ewl_separator_orientation_set(EWL_SEPARATOR(g),
+ EWL_ORIENTATION_VERTICAL);
+ ewl_widget_appearance_set(EWL_WIDGET(g), "grabber/vertical");
+ ewl_paned_grabber_show_cursor_for(g,
+ EWL_POSITION_LEFT | EWL_POSITION_RIGHT);
+ }
+ else
+ {
+ ewl_separator_orientation_set(EWL_SEPARATOR(g),
+ EWL_ORIENTATION_HORIZONTAL);
+ ewl_widget_appearance_set(EWL_WIDGET(g), "grabber/horizontal");
+ ewl_paned_grabber_show_cursor_for(g,
+ EWL_POSITION_TOP | EWL_POSITION_BOTTOM);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1130,13 +1130,13 @@ ewl_paned_grabber_paned_orientation_set(Ewl_Paned_Grabber *g, Ewl_Orientation o)
Ewl_Orientation
ewl_paned_grabber_orientation_get(Ewl_Paned_Grabber *g)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(g, EWL_ORIENTATION_HORIZONTAL);
- DCHECK_TYPE_RET(g, EWL_PANED_GRABBER_TYPE,
- EWL_ORIENTATION_HORIZONTAL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(g, EWL_ORIENTATION_HORIZONTAL);
+ DCHECK_TYPE_RET(g, EWL_PANED_GRABBER_TYPE,
+ EWL_ORIENTATION_HORIZONTAL);
- DRETURN_INT(ewl_separator_orientation_get(EWL_SEPARATOR(g)),
- DLEVEL_STABLE);
+ DRETURN_INT(ewl_separator_orientation_get(EWL_SEPARATOR(g)),
+ DLEVEL_STABLE);
}
/**
@@ -1151,289 +1151,289 @@ ewl_paned_grabber_orientation_get(Ewl_Paned_Grabber *g)
void
ewl_paned_grabber_show_cursor_for(Ewl_Paned_Grabber *g, unsigned int dir)
{
- int pos = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(g);
- DCHECK_TYPE(g, EWL_PANED_GRABBER_TYPE);
-
- if ((dir & EWL_POSITION_LEFT) && (dir & EWL_POSITION_RIGHT))
- pos = EWL_MOUSE_CURSOR_SB_H_DOUBLE_ARROW;
- else if ((dir & EWL_POSITION_TOP) && (dir & EWL_POSITION_BOTTOM))
- pos = EWL_MOUSE_CURSOR_SB_V_DOUBLE_ARROW;
- else if (dir & EWL_POSITION_LEFT)
- pos = EWL_MOUSE_CURSOR_SB_LEFT_ARROW;
- else if (dir & EWL_POSITION_RIGHT)
- pos = EWL_MOUSE_CURSOR_SB_RIGHT_ARROW;
- else if (dir & EWL_POSITION_TOP)
- pos = EWL_MOUSE_CURSOR_SB_UP_ARROW;
- else
- pos = EWL_MOUSE_CURSOR_SB_DOWN_ARROW;
-
- ewl_attach_mouse_cursor_set(EWL_WIDGET(g), pos);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int pos = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(g);
+ DCHECK_TYPE(g, EWL_PANED_GRABBER_TYPE);
+
+ if ((dir & EWL_POSITION_LEFT) && (dir & EWL_POSITION_RIGHT))
+ pos = EWL_MOUSE_CURSOR_SB_H_DOUBLE_ARROW;
+ else if ((dir & EWL_POSITION_TOP) && (dir & EWL_POSITION_BOTTOM))
+ pos = EWL_MOUSE_CURSOR_SB_V_DOUBLE_ARROW;
+ else if (dir & EWL_POSITION_LEFT)
+ pos = EWL_MOUSE_CURSOR_SB_LEFT_ARROW;
+ else if (dir & EWL_POSITION_RIGHT)
+ pos = EWL_MOUSE_CURSOR_SB_RIGHT_ARROW;
+ else if (dir & EWL_POSITION_TOP)
+ pos = EWL_MOUSE_CURSOR_SB_UP_ARROW;
+ else
+ pos = EWL_MOUSE_CURSOR_SB_DOWN_ARROW;
+
+ ewl_attach_mouse_cursor_set(EWL_WIDGET(g), pos);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_paned_grabber_cb_mouse_down(Ewl_Widget *w, void *ev,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Paned *p;
- Ewl_Event_Mouse *event;
- int ds;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- event = ev;
- p = EWL_PANED(w->parent);
-
- if (ewl_paned_orientation_get(p) == EWL_ORIENTATION_HORIZONTAL)
- ds = CURRENT_X(w) - event->x;
- else
- ds = CURRENT_Y(w) - event->y;
-
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE,
- ewl_paned_grabber_cb_mouse_move,
- (void *) ds);
- ewl_widget_state_set(w, "selected", EWL_STATE_PERSISTENT);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Paned *p;
+ Ewl_Event_Mouse *event;
+ int ds;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ event = ev;
+ p = EWL_PANED(w->parent);
+
+ if (ewl_paned_orientation_get(p) == EWL_ORIENTATION_HORIZONTAL)
+ ds = CURRENT_X(w) - event->x;
+ else
+ ds = CURRENT_Y(w) - event->y;
+
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE,
+ ewl_paned_grabber_cb_mouse_move,
+ (void *) ds);
+ ewl_widget_state_set(w, "selected", EWL_STATE_PERSISTENT);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_paned_grabber_cb_mouse_up(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_callback_del(w, EWL_CALLBACK_MOUSE_MOVE,
- ewl_paned_grabber_cb_mouse_move);
- ewl_widget_state_set(w, "default", EWL_STATE_PERSISTENT);
+ ewl_callback_del(w, EWL_CALLBACK_MOUSE_MOVE,
+ ewl_paned_grabber_cb_mouse_move);
+ ewl_widget_state_set(w, "default", EWL_STATE_PERSISTENT);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_paned_grabber_cb_mouse_move(Ewl_Widget *w, void *ev, void *data)
{
- Ewl_Event_Mouse *e;
- Ewl_Paned_Grabber *stop_grabber = NULL;
- Ewl_Widget *child;
- Ewl_Container *c;
- Ewl_Paned *p;
- Ewl_Widget *prev_pane = NULL, *next_pane = NULL;
-
- int paned_pos, paned_size;
- int prev_grabber_pos, next_grabber_pos;
- int grabber_pos, grabber_size;
- int mouse_pos, mouse_vec, mouse_offset;
- int grabber_pos_new;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(ev);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- e = ev;
- p = EWL_PANED(w->parent);
- c = EWL_CONTAINER(p);
- mouse_offset = (int) data;
-
- if (ewl_paned_orientation_get(p) == EWL_ORIENTATION_HORIZONTAL)
- {
- layout = horizontal_layout;
- mouse_pos = e->x;
- paned_pos = CURRENT_X(p);
- paned_size = CURRENT_W(p);
- }
- else
- {
- layout = vertical_layout;
- mouse_pos = e->y;
- paned_pos = CURRENT_Y(p);
- paned_size = CURRENT_H(p);
- }
-
- grabber_pos = layout->current_position(EWL_OBJECT(w));
- grabber_size = layout->current_size(EWL_OBJECT(w));
-
- /* this is the vector pointing from the left/top edge of the grabber
- * to the mouse position, so is it neagtive the grabber will
- * be moved to the left side and is it positiv to the right
- */
- mouse_vec = mouse_pos - grabber_pos + mouse_offset;
- if (mouse_vec == 0)
- DRETURN(DLEVEL_STABLE);
-
- /* find the previous grabber that is blocking us */
- ecore_dlist_goto(c->children, w);
-
- /* move past the selected grabber */
- ecore_dlist_previous(c->children);
- while ((child = ecore_dlist_previous(c->children)))
- {
- if (!VISIBLE(child) || UNMANAGED(child)) continue;
-
- if (EWL_PANED_GRABBER_IS(child))
- {
- stop_grabber = EWL_PANED_GRABBER(child);
- break;
- }
- else
- prev_pane = child;
- }
-
- /* if we didn't find a privous grabber set the paned position instead */
- if (stop_grabber)
- prev_grabber_pos =
- layout->current_position(EWL_OBJECT(stop_grabber))
- + grabber_size;
- else
- prev_grabber_pos = paned_pos;
-
- /* and now find the right/bottom pane */
- ecore_dlist_goto(c->children, w);
- stop_grabber = NULL;
-
- /* move past the selected grabber */
- ecore_dlist_next(c->children);
- while ((child = ecore_list_next(c->children)))
- {
- if (!VISIBLE(child) || UNMANAGED(child)) continue;
-
- if (EWL_PANED_GRABBER_IS(child)) {
- stop_grabber = EWL_PANED_GRABBER(child);
- break;
- }
- else
- next_pane = child;
- }
-
- /* if we didn't find a prevous grabber set the paned position instead */
- if (stop_grabber)
- next_grabber_pos =
- layout->current_position(EWL_OBJECT(stop_grabber));
- else
- next_grabber_pos = paned_pos + paned_size;
-
- /*
- * now we have collected enought data to place the grabber
- * and the panes on their new places
- */
- /* we don't want to shrink the panes more that it is allowed */
- if (mouse_vec < 0) {
- /* the left side get shrinked */
- int pane_min = layout->minimum_size(EWL_OBJECT(prev_pane));
- if (grabber_pos + mouse_vec - prev_grabber_pos < pane_min)
- grabber_pos_new = prev_grabber_pos + pane_min;
- else
- /* note that mouse_vec is here negative! */
- grabber_pos_new = grabber_pos + mouse_vec;
- }
- else {
- /* the right/bottom side get shrinked */
- int pane_min = layout->minimum_size(EWL_OBJECT(next_pane));
- if (next_grabber_pos - (grabber_pos + mouse_vec + grabber_size)
- < pane_min)
- grabber_pos_new =
- next_grabber_pos - pane_min - grabber_size;
- else
- grabber_pos_new = grabber_pos + mouse_vec;
- }
-
- /*
- * finally we can place the stuff
- */
- if (ewl_paned_orientation_get(p) == EWL_ORIENTATION_HORIZONTAL) {
- ewl_object_place(EWL_OBJECT(prev_pane), prev_grabber_pos,
- CURRENT_Y(p),
- grabber_pos_new - prev_grabber_pos,
- CURRENT_H(p));
- ewl_object_place(EWL_OBJECT(w), grabber_pos_new,
- CURRENT_Y(p),
- grabber_size,
- CURRENT_H(p));
- ewl_object_place(EWL_OBJECT(next_pane),
- grabber_pos_new + grabber_size,
- CURRENT_Y(p),
- next_grabber_pos - grabber_pos_new
- - grabber_size,
- CURRENT_H(p));
- }
- else {
- ewl_object_place(EWL_OBJECT(prev_pane),
- CURRENT_X(p),
- prev_grabber_pos,
- CURRENT_W(p),
- grabber_pos_new - prev_grabber_pos);
- ewl_object_place(EWL_OBJECT(w),
- CURRENT_X(p),
- grabber_pos_new,
- CURRENT_W(p),
- grabber_size);
- ewl_object_place(EWL_OBJECT(next_pane),
- CURRENT_X(p),
- grabber_pos_new + grabber_size,
- CURRENT_W(p),
- next_grabber_pos - grabber_pos_new
- - grabber_size);
- }
-
- /* send a value_changed callback to signal something moved */
- ewl_callback_call(EWL_WIDGET(p), EWL_CALLBACK_VALUE_CHANGED);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Event_Mouse *e;
+ Ewl_Paned_Grabber *stop_grabber = NULL;
+ Ewl_Widget *child;
+ Ewl_Container *c;
+ Ewl_Paned *p;
+ Ewl_Widget *prev_pane = NULL, *next_pane = NULL;
+
+ int paned_pos, paned_size;
+ int prev_grabber_pos, next_grabber_pos;
+ int grabber_pos, grabber_size;
+ int mouse_pos, mouse_vec, mouse_offset;
+ int grabber_pos_new;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(ev);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ e = ev;
+ p = EWL_PANED(w->parent);
+ c = EWL_CONTAINER(p);
+ mouse_offset = (int) data;
+
+ if (ewl_paned_orientation_get(p) == EWL_ORIENTATION_HORIZONTAL)
+ {
+ layout = horizontal_layout;
+ mouse_pos = e->x;
+ paned_pos = CURRENT_X(p);
+ paned_size = CURRENT_W(p);
+ }
+ else
+ {
+ layout = vertical_layout;
+ mouse_pos = e->y;
+ paned_pos = CURRENT_Y(p);
+ paned_size = CURRENT_H(p);
+ }
+
+ grabber_pos = layout->current_position(EWL_OBJECT(w));
+ grabber_size = layout->current_size(EWL_OBJECT(w));
+
+ /* this is the vector pointing from the left/top edge of the grabber
+ * to the mouse position, so is it neagtive the grabber will
+ * be moved to the left side and is it positiv to the right
+ */
+ mouse_vec = mouse_pos - grabber_pos + mouse_offset;
+ if (mouse_vec == 0)
+ DRETURN(DLEVEL_STABLE);
+
+ /* find the previous grabber that is blocking us */
+ ecore_dlist_goto(c->children, w);
+
+ /* move past the selected grabber */
+ ecore_dlist_previous(c->children);
+ while ((child = ecore_dlist_previous(c->children)))
+ {
+ if (!VISIBLE(child) || UNMANAGED(child)) continue;
+
+ if (EWL_PANED_GRABBER_IS(child))
+ {
+ stop_grabber = EWL_PANED_GRABBER(child);
+ break;
+ }
+ else
+ prev_pane = child;
+ }
+
+ /* if we didn't find a privous grabber set the paned position instead */
+ if (stop_grabber)
+ prev_grabber_pos =
+ layout->current_position(EWL_OBJECT(stop_grabber))
+ + grabber_size;
+ else
+ prev_grabber_pos = paned_pos;
+
+ /* and now find the right/bottom pane */
+ ecore_dlist_goto(c->children, w);
+ stop_grabber = NULL;
+
+ /* move past the selected grabber */
+ ecore_dlist_next(c->children);
+ while ((child = ecore_list_next(c->children)))
+ {
+ if (!VISIBLE(child) || UNMANAGED(child)) continue;
+
+ if (EWL_PANED_GRABBER_IS(child)) {
+ stop_grabber = EWL_PANED_GRABBER(child);
+ break;
+ }
+ else
+ next_pane = child;
+ }
+
+ /* if we didn't find a prevous grabber set the paned position instead */
+ if (stop_grabber)
+ next_grabber_pos =
+ layout->current_position(EWL_OBJECT(stop_grabber));
+ else
+ next_grabber_pos = paned_pos + paned_size;
+
+ /*
+ * now we have collected enought data to place the grabber
+ * and the panes on their new places
+ */
+ /* we don't want to shrink the panes more that it is allowed */
+ if (mouse_vec < 0) {
+ /* the left side get shrinked */
+ int pane_min = layout->minimum_size(EWL_OBJECT(prev_pane));
+ if (grabber_pos + mouse_vec - prev_grabber_pos < pane_min)
+ grabber_pos_new = prev_grabber_pos + pane_min;
+ else
+ /* note that mouse_vec is here negative! */
+ grabber_pos_new = grabber_pos + mouse_vec;
+ }
+ else {
+ /* the right/bottom side get shrinked */
+ int pane_min = layout->minimum_size(EWL_OBJECT(next_pane));
+ if (next_grabber_pos - (grabber_pos + mouse_vec + grabber_size)
+ < pane_min)
+ grabber_pos_new =
+ next_grabber_pos - pane_min - grabber_size;
+ else
+ grabber_pos_new = grabber_pos + mouse_vec;
+ }
+
+ /*
+ * finally we can place the stuff
+ */
+ if (ewl_paned_orientation_get(p) == EWL_ORIENTATION_HORIZONTAL) {
+ ewl_object_place(EWL_OBJECT(prev_pane), prev_grabber_pos,
+ CURRENT_Y(p),
+ grabber_pos_new - prev_grabber_pos,
+ CURRENT_H(p));
+ ewl_object_place(EWL_OBJECT(w), grabber_pos_new,
+ CURRENT_Y(p),
+ grabber_size,
+ CURRENT_H(p));
+ ewl_object_place(EWL_OBJECT(next_pane),
+ grabber_pos_new + grabber_size,
+ CURRENT_Y(p),
+ next_grabber_pos - grabber_pos_new
+ - grabber_size,
+ CURRENT_H(p));
+ }
+ else {
+ ewl_object_place(EWL_OBJECT(prev_pane),
+ CURRENT_X(p),
+ prev_grabber_pos,
+ CURRENT_W(p),
+ grabber_pos_new - prev_grabber_pos);
+ ewl_object_place(EWL_OBJECT(w),
+ CURRENT_X(p),
+ grabber_pos_new,
+ CURRENT_W(p),
+ grabber_size);
+ ewl_object_place(EWL_OBJECT(next_pane),
+ CURRENT_X(p),
+ grabber_pos_new + grabber_size,
+ CURRENT_W(p),
+ next_grabber_pos - grabber_pos_new
+ - grabber_size);
+ }
+
+ /* send a value_changed callback to signal something moved */
+ ewl_callback_call(EWL_WIDGET(p), EWL_CALLBACK_VALUE_CHANGED);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_paned_layout_setup(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- ewl_shutdown_add(ewl_paned_cb_shutdown);
-
- horizontal_layout = NEW(Ewl_Paned_Layout, 1);
- if (!horizontal_layout)
- DRETURN(DLEVEL_STABLE);
-
- horizontal_layout->minimum_size = ewl_object_minimum_w_get;
- horizontal_layout->current_size = ewl_object_current_w_get;
- horizontal_layout->preferred_size = ewl_object_preferred_w_get;
- horizontal_layout->current_position = ewl_object_current_x_get;
- horizontal_layout->variable_request = ewl_object_w_request;
- horizontal_layout->stable_request = ewl_object_h_request;
- horizontal_layout->position_request = ewl_object_x_request;
- horizontal_layout->stable_position_request = ewl_object_y_request;
-
- vertical_layout = NEW(Ewl_Paned_Layout, 1);
- if (!vertical_layout)
- DRETURN(DLEVEL_STABLE);
-
- vertical_layout->minimum_size = ewl_object_minimum_h_get;
- vertical_layout->current_size = ewl_object_current_h_get;
- vertical_layout->preferred_size = ewl_object_preferred_h_get;
- vertical_layout->current_position = ewl_object_current_y_get;
- vertical_layout->variable_request = ewl_object_h_request;
- vertical_layout->stable_request = ewl_object_w_request;
- vertical_layout->position_request = ewl_object_y_request;
- vertical_layout->stable_position_request = ewl_object_x_request;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ ewl_shutdown_add(ewl_paned_cb_shutdown);
+
+ horizontal_layout = NEW(Ewl_Paned_Layout, 1);
+ if (!horizontal_layout)
+ DRETURN(DLEVEL_STABLE);
+
+ horizontal_layout->minimum_size = ewl_object_minimum_w_get;
+ horizontal_layout->current_size = ewl_object_current_w_get;
+ horizontal_layout->preferred_size = ewl_object_preferred_w_get;
+ horizontal_layout->current_position = ewl_object_current_x_get;
+ horizontal_layout->variable_request = ewl_object_w_request;
+ horizontal_layout->stable_request = ewl_object_h_request;
+ horizontal_layout->position_request = ewl_object_x_request;
+ horizontal_layout->stable_position_request = ewl_object_y_request;
+
+ vertical_layout = NEW(Ewl_Paned_Layout, 1);
+ if (!vertical_layout)
+ DRETURN(DLEVEL_STABLE);
+
+ vertical_layout->minimum_size = ewl_object_minimum_h_get;
+ vertical_layout->current_size = ewl_object_current_h_get;
+ vertical_layout->preferred_size = ewl_object_preferred_h_get;
+ vertical_layout->current_position = ewl_object_current_y_get;
+ vertical_layout->variable_request = ewl_object_h_request;
+ vertical_layout->stable_request = ewl_object_w_request;
+ vertical_layout->position_request = ewl_object_y_request;
+ vertical_layout->stable_position_request = ewl_object_x_request;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_paned_cb_shutdown(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- IF_FREE(horizontal_layout);
- IF_FREE(vertical_layout);
+ IF_FREE(horizontal_layout);
+ IF_FREE(vertical_layout);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_paned.h b/src/lib/ewl_paned.h
index bc2d238..201a571 100644
--- a/src/lib/ewl_paned.h
+++ b/src/lib/ewl_paned.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_PANED_H
#define EWL_PANED_H
@@ -35,10 +35,10 @@ typedef struct Ewl_Paned_Size_Info Ewl_Paned_Size_Info;
*/
struct Ewl_Paned_Size_Info
{
- Ewl_Widget *child;
- int initial_size;
- unsigned char initial_size_has:1;
- unsigned char fixed:1;
+ Ewl_Widget *child;
+ int initial_size;
+ unsigned char initial_size_has:1;
+ unsigned char fixed:1;
};
/**
@@ -69,46 +69,46 @@ typedef struct Ewl_Paned Ewl_Paned;
*/
struct Ewl_Paned
{
- Ewl_Container container; /**< Inherit from Ewl_Container */
- Ewl_Orientation orientation; /**< The orientation of the paned */
-
- int last_pos; /**< the last position */
- int last_size; /**< the last size */
- Ewl_Widget *last_pane; /**< a pointer to the last resized pane */
- Ewl_Paned_Size_Info *info; /**< The extra infos for the children */
- int info_size; /**< The size of the info array */
- unsigned short updating_grabbers:1; /**< are we updating the grabbers */
- unsigned short new_panes:1; /**< are there new visible panes */
+ Ewl_Container container; /**< Inherit from Ewl_Container */
+ Ewl_Orientation orientation; /**< The orientation of the paned */
+
+ int last_pos; /**< the last position */
+ int last_size; /**< the last size */
+ Ewl_Widget *last_pane; /**< a pointer to the last resized pane */
+ Ewl_Paned_Size_Info *info; /**< The extra infos for the children */
+ int info_size; /**< The size of the info array */
+ unsigned short updating_grabbers:1; /**< are we updating the grabbers */
+ unsigned short new_panes:1; /**< are there new visible panes */
};
-Ewl_Widget *ewl_paned_new(void);
-Ewl_Widget *ewl_hpaned_new(void);
-Ewl_Widget *ewl_vpaned_new(void);
-int ewl_paned_init(Ewl_Paned *p);
+Ewl_Widget *ewl_paned_new(void);
+Ewl_Widget *ewl_hpaned_new(void);
+Ewl_Widget *ewl_vpaned_new(void);
+int ewl_paned_init(Ewl_Paned *p);
-void ewl_paned_orientation_set(Ewl_Paned *p, Ewl_Orientation o);
-Ewl_Orientation ewl_paned_orientation_get(Ewl_Paned *p);
-void ewl_paned_initial_size_set(Ewl_Paned *p, Ewl_Widget *child,
- int size);
-int ewl_paned_initial_size_get(Ewl_Paned *p, Ewl_Widget *child);
+void ewl_paned_orientation_set(Ewl_Paned *p, Ewl_Orientation o);
+Ewl_Orientation ewl_paned_orientation_get(Ewl_Paned *p);
+void ewl_paned_initial_size_set(Ewl_Paned *p, Ewl_Widget *child,
+ int size);
+int ewl_paned_initial_size_get(Ewl_Paned *p, Ewl_Widget *child);
-void ewl_paned_fixed_size_set(Ewl_Paned *p, Ewl_Widget *child,
- unsigned int fixed);
-unsigned int ewl_paned_fixed_size_get(Ewl_Paned *p, Ewl_Widget *child);
-void ewl_paned_arrange(Ewl_Paned *p, int pane_num);
+void ewl_paned_fixed_size_set(Ewl_Paned *p, Ewl_Widget *child,
+ unsigned int fixed);
+unsigned int ewl_paned_fixed_size_get(Ewl_Paned *p, Ewl_Widget *child);
+void ewl_paned_arrange(Ewl_Paned *p, int pane_num);
/*
* Internal functions. Override at your risk.
*/
-Ewl_Paned_Size_Info *ewl_paned_size_info_add(Ewl_Paned *p, Ewl_Widget *w);
-Ewl_Paned_Size_Info *ewl_paned_size_info_get(Ewl_Paned *p, Ewl_Widget *w);
-void ewl_paned_size_info_del(Ewl_Paned *p, Ewl_Widget *w);
+Ewl_Paned_Size_Info *ewl_paned_size_info_add(Ewl_Paned *p, Ewl_Widget *w);
+Ewl_Paned_Size_Info *ewl_paned_size_info_get(Ewl_Paned *p, Ewl_Widget *w);
+void ewl_paned_size_info_del(Ewl_Paned *p, Ewl_Widget *w);
void ewl_paned_cb_child_add(Ewl_Container *c, Ewl_Widget *w);
void ewl_paned_cb_child_remove(Ewl_Container *c, Ewl_Widget *w, int idx);
void ewl_paned_cb_child_show(Ewl_Container *c, Ewl_Widget *w);
void ewl_paned_cb_child_resize(Ewl_Container *c, Ewl_Widget *w, int size,
- Ewl_Orientation o);
+ Ewl_Orientation o);
void ewl_paned_cb_child_hide(Ewl_Container *c, Ewl_Widget *w);
void ewl_paned_cb_configure(Ewl_Widget *w, void *ev, void *data);
@@ -146,19 +146,19 @@ typedef struct Ewl_Paned_Grabber Ewl_Paned_Grabber;
*/
struct Ewl_Paned_Grabber
{
- Ewl_Separator separator; /**< Inherit from the separator */
- unsigned int placed:1; /**< Has the grabber been placed already? */
+ Ewl_Separator separator; /**< Inherit from the separator */
+ unsigned int placed:1; /**< Has the grabber been placed already? */
};
-Ewl_Widget *ewl_paned_grabber_new(void);
-int ewl_paned_grabber_init(Ewl_Paned_Grabber *g);
+Ewl_Widget *ewl_paned_grabber_new(void);
+int ewl_paned_grabber_init(Ewl_Paned_Grabber *g);
-void ewl_paned_grabber_paned_orientation_set(Ewl_Paned_Grabber *g,
- Ewl_Orientation o);
+void ewl_paned_grabber_paned_orientation_set(Ewl_Paned_Grabber *g,
+ Ewl_Orientation o);
Ewl_Orientation ewl_paned_grabber_orientation_get(Ewl_Paned_Grabber *g);
-void ewl_paned_grabber_show_cursor_for(Ewl_Paned_Grabber *g,
- unsigned int dir);
+void ewl_paned_grabber_show_cursor_for(Ewl_Paned_Grabber *g,
+ unsigned int dir);
/**
* @}
diff --git a/src/lib/ewl_popup.c b/src/lib/ewl_popup.c
index 606a783..4a72bd4 100644
--- a/src/lib/ewl_popup.c
+++ b/src/lib/ewl_popup.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_popup.h"
#include "ewl_macros.h"
@@ -19,20 +19,20 @@ static void ewl_popup_move_stop(Ewl_Popup *p);
Ewl_Widget *
ewl_popup_new(void)
{
- Ewl_Popup *p;
+ Ewl_Popup *p;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- p = NEW(Ewl_Popup, 1);
- if (!p)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ p = NEW(Ewl_Popup, 1);
+ if (!p)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_popup_init(p)) {
- ewl_widget_destroy(EWL_WIDGET(p));
- p = NULL;
- }
+ if (!ewl_popup_init(p)) {
+ ewl_widget_destroy(EWL_WIDGET(p));
+ p = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(p), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(p), DLEVEL_STABLE);
}
/**
@@ -46,37 +46,37 @@ ewl_popup_new(void)
int
ewl_popup_init(Ewl_Popup *p)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(p, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(p, FALSE);
- w = EWL_WIDGET(p);
- if (!ewl_window_init(EWL_WINDOW(w)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ w = EWL_WIDGET(p);
+ if (!ewl_window_init(EWL_WINDOW(w)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_inherit(w, EWL_POPUP_TYPE);
- ewl_widget_appearance_set(w, EWL_POPUP_TYPE);
- ewl_object_fill_policy_set(EWL_OBJECT(p), EWL_FLAG_FILL_NONE);
+ ewl_widget_inherit(w, EWL_POPUP_TYPE);
+ ewl_widget_appearance_set(w, EWL_POPUP_TYPE);
+ ewl_object_fill_policy_set(EWL_OBJECT(p), EWL_FLAG_FILL_NONE);
- ewl_window_override_set(EWL_WINDOW(p), TRUE);
+ ewl_window_override_set(EWL_WINDOW(p), TRUE);
- ewl_container_show_notify_set(EWL_CONTAINER(p),
- ewl_popup_cb_child_show);
- ewl_container_resize_notify_set(EWL_CONTAINER(p),
- ewl_popup_cb_child_resize);
+ ewl_container_show_notify_set(EWL_CONTAINER(p),
+ ewl_popup_cb_child_show);
+ ewl_container_resize_notify_set(EWL_CONTAINER(p),
+ ewl_popup_cb_child_resize);
- /*
- * add the callbacks
- */
- ewl_callback_append(w, EWL_CALLBACK_SHOW, ewl_popup_cb_show, NULL);
- ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, ewl_popup_cb_show, NULL);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE, ewl_popup_cb_mouse_move,
- NULL);
- ewl_callback_prepend(w, EWL_CALLBACK_DESTROY, ewl_popup_cb_destroy,
- NULL);
+ /*
+ * add the callbacks
+ */
+ ewl_callback_append(w, EWL_CALLBACK_SHOW, ewl_popup_cb_show, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, ewl_popup_cb_show, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE, ewl_popup_cb_mouse_move,
+ NULL);
+ ewl_callback_prepend(w, EWL_CALLBACK_DESTROY, ewl_popup_cb_destroy,
+ NULL);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -89,14 +89,14 @@ ewl_popup_init(Ewl_Popup *p)
void
ewl_popup_type_set(Ewl_Popup *p, Ewl_Popup_Type type)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_TYPE(p, EWL_POPUP_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_TYPE(p, EWL_POPUP_TYPE);
- p->type = type;
- /* XXX: Do we need a configure here? */
+ p->type = type;
+ /* XXX: Do we need a configure here? */
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -108,11 +108,11 @@ ewl_popup_type_set(Ewl_Popup *p, Ewl_Popup_Type type)
Ewl_Popup_Type
ewl_popup_type_get(Ewl_Popup *p)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(p, EWL_POPUP_TYPE_NONE);
- DCHECK_TYPE_RET(p, EWL_POPUP_TYPE, EWL_POPUP_TYPE_NONE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(p, EWL_POPUP_TYPE_NONE);
+ DCHECK_TYPE_RET(p, EWL_POPUP_TYPE, EWL_POPUP_TYPE_NONE);
- DRETURN_INT(p->type, DLEVEL_STABLE);
+ DRETURN_INT(p->type, DLEVEL_STABLE);
}
/**
@@ -124,31 +124,31 @@ ewl_popup_type_get(Ewl_Popup *p)
void
ewl_popup_follow_set(Ewl_Popup *p, Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_TYPE(p, EWL_POPUP_TYPE);
-
- if (p->follow == w)
- DRETURN(DLEVEL_STABLE);
-
- if (p->follow) {
- ewl_callback_del_with_data(p->follow, EWL_CALLBACK_DESTROY,
- ewl_popup_cb_follow_destroy, p);
- ewl_callback_del_with_data(p->follow, EWL_CALLBACK_CONFIGURE,
- ewl_popup_cb_follow_configure,
- p);
- }
-
- if (w) {
- ewl_callback_prepend(w, EWL_CALLBACK_DESTROY,
- ewl_popup_cb_follow_destroy, p);
- ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
- ewl_popup_cb_follow_configure, p);
- }
-
- p->follow = w;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_TYPE(p, EWL_POPUP_TYPE);
+
+ if (p->follow == w)
+ DRETURN(DLEVEL_STABLE);
+
+ if (p->follow) {
+ ewl_callback_del_with_data(p->follow, EWL_CALLBACK_DESTROY,
+ ewl_popup_cb_follow_destroy, p);
+ ewl_callback_del_with_data(p->follow, EWL_CALLBACK_CONFIGURE,
+ ewl_popup_cb_follow_configure,
+ p);
+ }
+
+ if (w) {
+ ewl_callback_prepend(w, EWL_CALLBACK_DESTROY,
+ ewl_popup_cb_follow_destroy, p);
+ ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
+ ewl_popup_cb_follow_configure, p);
+ }
+
+ p->follow = w;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -159,11 +159,11 @@ ewl_popup_follow_set(Ewl_Popup *p, Ewl_Widget *w)
Ewl_Widget *
ewl_popup_follow_get(Ewl_Popup *p)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(p, NULL);
- DCHECK_TYPE_RET(p, EWL_POPUP_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(p, NULL);
+ DCHECK_TYPE_RET(p, EWL_POPUP_TYPE, NULL);
- DRETURN_PTR(p->follow, DLEVEL_STABLE);
+ DRETURN_PTR(p->follow, DLEVEL_STABLE);
}
@@ -176,13 +176,13 @@ ewl_popup_follow_get(Ewl_Popup *p)
void
ewl_popup_fit_to_follow_set(Ewl_Popup *p, int fit)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_TYPE(p, EWL_POPUP_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_TYPE(p, EWL_POPUP_TYPE);
- p->fit_to_follow = !!fit;
+ p->fit_to_follow = !!fit;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -193,11 +193,11 @@ ewl_popup_fit_to_follow_set(Ewl_Popup *p, int fit)
int
ewl_popup_fit_to_follow_get(Ewl_Popup *p)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(p, EWL_POPUP_TYPE_NONE);
- DCHECK_TYPE_RET(p, EWL_POPUP_TYPE, EWL_POPUP_TYPE_NONE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(p, EWL_POPUP_TYPE_NONE);
+ DCHECK_TYPE_RET(p, EWL_POPUP_TYPE, EWL_POPUP_TYPE_NONE);
- DRETURN_INT(p->fit_to_follow, DLEVEL_STABLE);
+ DRETURN_INT(p->fit_to_follow, DLEVEL_STABLE);
}
/**
@@ -211,14 +211,14 @@ ewl_popup_fit_to_follow_get(Ewl_Popup *p)
void
ewl_popup_mouse_position_set(Ewl_Popup *p, int x, int y)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_TYPE(p, EWL_POPUP_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_TYPE(p, EWL_POPUP_TYPE);
- p->mouse.x = x;
- p->mouse.y = y;
+ p->mouse.x = x;
+ p->mouse.y = y;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -231,14 +231,14 @@ ewl_popup_mouse_position_set(Ewl_Popup *p, int x, int y)
void
ewl_popup_offset_set(Ewl_Popup *p, int x, int y)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_TYPE(p, EWL_POPUP_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_TYPE(p, EWL_POPUP_TYPE);
- p->offset.x = x;
- p->offset.y = y;
+ p->offset.x = x;
+ p->offset.y = y;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -251,47 +251,47 @@ ewl_popup_offset_set(Ewl_Popup *p, int x, int y)
*/
void
ewl_popup_cb_show(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_POPUP_TYPE);
-
- ewl_popup_size_check(EWL_POPUP(w));
- ewl_popup_position_check(EWL_POPUP(w));
-
- if (ewl_window_pointer_grab_get(EWL_WINDOW(w)))
- ewl_window_pointer_grab_set(EWL_WINDOW(w), TRUE);
-
- if (ewl_window_keyboard_grab_get(EWL_WINDOW(w)))
- ewl_window_keyboard_grab_set(EWL_WINDOW(w), TRUE);
-
- /* Popups should be flagged as transient for their parent windows */
- if (EWL_POPUP(w)->follow) {
- Ewl_Embed *emb;
- emb = ewl_embed_widget_find(EWL_POPUP(w)->follow);
- if (emb) {
- void *pwin = NULL;
- /*
- * If the followed window is transient, defer to that
- * window's parent
- */
- if (EWL_WINDOW_IS(emb)) {
- Ewl_Window *win = EWL_WINDOW(emb);
-
- if (win->flags & EWL_WINDOW_TRANSIENT)
- pwin = win->transient.ewl->window;
- else if (win->flags & EWL_WINDOW_TRANSIENT_FOREIGN)
- pwin = win->transient.foreign;
- }
-
- if (!pwin)
- pwin = emb->canvas_window;
- ewl_window_transient_for_foreign(EWL_WINDOW(w), pwin);
- }
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_POPUP_TYPE);
+
+ ewl_popup_size_check(EWL_POPUP(w));
+ ewl_popup_position_check(EWL_POPUP(w));
+
+ if (ewl_window_pointer_grab_get(EWL_WINDOW(w)))
+ ewl_window_pointer_grab_set(EWL_WINDOW(w), TRUE);
+
+ if (ewl_window_keyboard_grab_get(EWL_WINDOW(w)))
+ ewl_window_keyboard_grab_set(EWL_WINDOW(w), TRUE);
+
+ /* Popups should be flagged as transient for their parent windows */
+ if (EWL_POPUP(w)->follow) {
+ Ewl_Embed *emb;
+ emb = ewl_embed_widget_find(EWL_POPUP(w)->follow);
+ if (emb) {
+ void *pwin = NULL;
+ /*
+ * If the followed window is transient, defer to that
+ * window's parent
+ */
+ if (EWL_WINDOW_IS(emb)) {
+ Ewl_Window *win = EWL_WINDOW(emb);
+
+ if (win->flags & EWL_WINDOW_TRANSIENT)
+ pwin = win->transient.ewl->window;
+ else if (win->flags & EWL_WINDOW_TRANSIENT_FOREIGN)
+ pwin = win->transient.foreign;
+ }
+
+ if (!pwin)
+ pwin = emb->canvas_window;
+ ewl_window_transient_for_foreign(EWL_WINDOW(w), pwin);
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -304,25 +304,25 @@ ewl_popup_cb_show(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_popup_cb_mouse_move(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Popup *p;
- int dx, dy;
+ Ewl_Popup *p;
+ int dx, dy;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_POPUP_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_POPUP_TYPE);
- p = EWL_POPUP(w);
+ p = EWL_POPUP(w);
- /* do we need to move the window? */
- if (p->moving || !ewl_popup_move_direction_get(p, &dx, &dy))
- DRETURN(DLEVEL_STABLE);
+ /* do we need to move the window? */
+ if (p->moving || !ewl_popup_move_direction_get(p, &dx, &dy))
+ DRETURN(DLEVEL_STABLE);
- /* FIXME the time schouldn't be a hardcoded value */
- ecore_timer_add(0.02, ewl_popup_move_timer, p);
+ /* FIXME the time schouldn't be a hardcoded value */
+ ecore_timer_add(0.02, ewl_popup_move_timer, p);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -334,31 +334,31 @@ ewl_popup_cb_mouse_move(Ewl_Widget *w, void *ev_data __UNUSED__,
static int
ewl_popup_move_timer(void *data)
{
- Ewl_Popup *p;
- int dx, dy;
- int ex, ey, mx, my;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, ECORE_CALLBACK_CANCEL);
- DCHECK_TYPE_RET(data, EWL_POPUP_TYPE, ECORE_CALLBACK_CANCEL);
-
- p = EWL_POPUP(data);
-
- if (!ewl_popup_move_direction_get(p, &dx, &dy)) {
- ewl_popup_move_stop(p);
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
-
- /* FIXME the velocity should be configurable and not hardcoded */
- ewl_popup_move(p, dx * 10, dy * 10);
- /* since the window now gets moved we have to feed the mouse position
- * again, because the widgets under the mouse could now be
- * different */
- ewl_embed_last_mouse_position_get(&mx, &my);
- ewl_embed_window_position_get(EWL_EMBED(p), &ex, &ey);
- ewl_embed_mouse_move_feed(EWL_EMBED(p), mx - ex, my - ey, 0);
-
- DRETURN_INT(ECORE_CALLBACK_RENEW, DLEVEL_STABLE);
+ Ewl_Popup *p;
+ int dx, dy;
+ int ex, ey, mx, my;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, ECORE_CALLBACK_CANCEL);
+ DCHECK_TYPE_RET(data, EWL_POPUP_TYPE, ECORE_CALLBACK_CANCEL);
+
+ p = EWL_POPUP(data);
+
+ if (!ewl_popup_move_direction_get(p, &dx, &dy)) {
+ ewl_popup_move_stop(p);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+
+ /* FIXME the velocity should be configurable and not hardcoded */
+ ewl_popup_move(p, dx * 10, dy * 10);
+ /* since the window now gets moved we have to feed the mouse position
+ * again, because the widgets under the mouse could now be
+ * different */
+ ewl_embed_last_mouse_position_get(&mx, &my);
+ ewl_embed_window_position_get(EWL_EMBED(p), &ex, &ey);
+ ewl_embed_mouse_move_feed(EWL_EMBED(p), mx - ex, my - ey, 0);
+
+ DRETURN_INT(ECORE_CALLBACK_RENEW, DLEVEL_STABLE);
}
/**
@@ -372,42 +372,42 @@ ewl_popup_move_timer(void *data)
static unsigned int
ewl_popup_move_direction_get(Ewl_Popup *p, int *dx, int *dy)
{
- int dw = 0, dh = 0;
- int x, y, mx, my;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(p, FALSE);
- DCHECK_TYPE_RET(p, EWL_POPUP_TYPE, FALSE);
-
- ewl_embed_desktop_size_get(EWL_EMBED(p), &dw, &dh);
- ewl_embed_window_position_get(EWL_EMBED(p), &x, &y);
- ewl_embed_last_mouse_position_get(&mx, &my);
-
- /* this x and y values are the mouse position relative to the embed */
- x = mx - x;
- y = my - y;
-
- /* check if the mouse is inside of the popup */
- if (x < 0 || y < 0 || x > CURRENT_W(p) || y > CURRENT_H(p))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- /* and now determine the directions of the move */
- if (mx <= 0)
- *dx = 1;
- else if (mx >= dw - 1)
- *dx = -1;
- else
- *dx = 0;
-
- if (my <= 0)
- *dy = 1;
- else if (my >= dh - 1)
- *dy = -1;
- else
- *dy = 0;
-
- /* if both are 0 the window doesn't need to be moved */
- DRETURN_INT((*dx != 0 || *dy != 0), DLEVEL_STABLE);
+ int dw = 0, dh = 0;
+ int x, y, mx, my;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(p, FALSE);
+ DCHECK_TYPE_RET(p, EWL_POPUP_TYPE, FALSE);
+
+ ewl_embed_desktop_size_get(EWL_EMBED(p), &dw, &dh);
+ ewl_embed_window_position_get(EWL_EMBED(p), &x, &y);
+ ewl_embed_last_mouse_position_get(&mx, &my);
+
+ /* this x and y values are the mouse position relative to the embed */
+ x = mx - x;
+ y = my - y;
+
+ /* check if the mouse is inside of the popup */
+ if (x < 0 || y < 0 || x > CURRENT_W(p) || y > CURRENT_H(p))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ /* and now determine the directions of the move */
+ if (mx <= 0)
+ *dx = 1;
+ else if (mx >= dw - 1)
+ *dx = -1;
+ else
+ *dx = 0;
+
+ if (my <= 0)
+ *dy = 1;
+ else if (my >= dh - 1)
+ *dy = -1;
+ else
+ *dy = 0;
+
+ /* if both are 0 the window doesn't need to be moved */
+ DRETURN_INT((*dx != 0 || *dy != 0), DLEVEL_STABLE);
}
/**
@@ -421,29 +421,29 @@ ewl_popup_move_direction_get(Ewl_Popup *p, int *dx, int *dy)
static void
ewl_popup_move(Ewl_Popup *p, int dx, int dy)
{
- int x, y;
+ int x, y;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_TYPE(p, EWL_POPUP_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_TYPE(p, EWL_POPUP_TYPE);
- ewl_embed_window_position_get(EWL_EMBED(p), &x, &y);
- x += dx;
- y += dy;
+ ewl_embed_window_position_get(EWL_EMBED(p), &x, &y);
+ x += dx;
+ y += dy;
- p->moving = TRUE;
- /* move the follow, too, if it is a popup child */
- if (p->follow) {
- Ewl_Embed *e;
+ p->moving = TRUE;
+ /* move the follow, too, if it is a popup child */
+ if (p->follow) {
+ Ewl_Embed *e;
- e = ewl_embed_widget_find(EWL_WIDGET(p->follow));
- if (EWL_POPUP_IS(e))
- ewl_popup_move(EWL_POPUP(e), dx, dy);
- }
+ e = ewl_embed_widget_find(EWL_WIDGET(p->follow));
+ if (EWL_POPUP_IS(e))
+ ewl_popup_move(EWL_POPUP(e), dx, dy);
+ }
- ewl_window_move(EWL_WINDOW(p), x, y);
+ ewl_window_move(EWL_WINDOW(p), x, y);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -455,22 +455,22 @@ ewl_popup_move(Ewl_Popup *p, int dx, int dy)
static void
ewl_popup_move_stop(Ewl_Popup *p)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_TYPE(p, EWL_POPUP_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_TYPE(p, EWL_POPUP_TYPE);
- p->moving = FALSE;
+ p->moving = FALSE;
- /* stop moving the follow, too, if it is a popup child */
- if (p->follow) {
- Ewl_Embed *e;
+ /* stop moving the follow, too, if it is a popup child */
+ if (p->follow) {
+ Ewl_Embed *e;
- e = ewl_embed_widget_find(EWL_WIDGET(p->follow));
- if (EWL_POPUP_IS(e))
- ewl_popup_move_stop(EWL_POPUP(e));
- }
+ e = ewl_embed_widget_find(EWL_WIDGET(p->follow));
+ if (EWL_POPUP_IS(e))
+ ewl_popup_move_stop(EWL_POPUP(e));
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -483,20 +483,20 @@ ewl_popup_move_stop(Ewl_Popup *p)
*/
void
ewl_popup_cb_destroy(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Popup *p;
+ Ewl_Popup *p;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_POPUP_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_POPUP_TYPE);
- p = EWL_POPUP(w);
- if (p->follow)
- ewl_callback_del_with_data(p->follow, EWL_CALLBACK_DESTROY,
- ewl_popup_cb_follow_destroy, p);
+ p = EWL_POPUP(w);
+ if (p->follow)
+ ewl_callback_del_with_data(p->follow, EWL_CALLBACK_DESTROY,
+ ewl_popup_cb_follow_destroy, p);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -509,19 +509,19 @@ ewl_popup_cb_destroy(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_popup_cb_follow_configure(Ewl_Widget *w __UNUSED__,
- void *ev_data __UNUSED__, void *user_data)
+ void *ev_data __UNUSED__, void *user_data)
{
- Ewl_Popup *p;
+ Ewl_Popup *p;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(user_data);
- DCHECK_TYPE(user_data, EWL_POPUP_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(user_data);
+ DCHECK_TYPE(user_data, EWL_POPUP_TYPE);
- p = EWL_POPUP(user_data);
- ewl_popup_size_check(p);
- ewl_popup_position_check(p);
+ p = EWL_POPUP(user_data);
+ ewl_popup_size_check(p);
+ ewl_popup_position_check(p);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -534,21 +534,21 @@ ewl_popup_cb_follow_configure(Ewl_Widget *w __UNUSED__,
*/
void
ewl_popup_cb_follow_destroy(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__,
- void *user_data)
+ void *user_data)
{
- Ewl_Popup *p;
+ Ewl_Popup *p;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(user_data);
- DCHECK_TYPE(user_data, EWL_POPUP_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(user_data);
+ DCHECK_TYPE(user_data, EWL_POPUP_TYPE);
- p = EWL_POPUP(user_data);
- p->follow = NULL;
+ p = EWL_POPUP(user_data);
+ p->follow = NULL;
- if (p->type != EWL_POPUP_TYPE_NONE)
- ewl_widget_hide(EWL_WIDGET(p));
+ if (p->type != EWL_POPUP_TYPE_NONE)
+ ewl_widget_hide(EWL_WIDGET(p));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -561,14 +561,14 @@ ewl_popup_cb_follow_destroy(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__,
void
ewl_popup_cb_child_show(Ewl_Container *c, Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- ewl_cell_cb_child_show(c, w);
- ewl_popup_position_check(EWL_POPUP(c));
+ ewl_cell_cb_child_show(c, w);
+ ewl_popup_position_check(EWL_POPUP(c));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
* @internal
@@ -581,106 +581,106 @@ ewl_popup_cb_child_show(Ewl_Container *c, Ewl_Widget *w)
*/
void
ewl_popup_cb_child_resize(Ewl_Container *c, Ewl_Widget *w,
- int size, Ewl_Orientation o)
+ int size, Ewl_Orientation o)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_POPUP_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_POPUP_TYPE);
- ewl_cell_cb_child_resize(c, w, size, o);
- ewl_popup_position_check(EWL_POPUP(c));
+ ewl_cell_cb_child_resize(c, w, size, o);
+ ewl_popup_position_check(EWL_POPUP(c));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_popup_position_check(Ewl_Popup *p)
{
- int x = 0, y = 0;
- int desk_w = 0, desk_h = 0;
- int win_x = 0, win_y = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_TYPE(p, EWL_POPUP_TYPE);
-
- if (p->type == EWL_POPUP_TYPE_NONE || p->moving)
- DRETURN(DLEVEL_STABLE);
-
- if (p->follow) {
- Ewl_Embed *emb;
-
- emb = ewl_embed_widget_find(p->follow);
- ewl_embed_desktop_size_get(emb, &desk_w, &desk_h);
- ewl_embed_window_position_get(emb, &win_x, &win_y);
- }
- else
- ewl_embed_desktop_size_get(EWL_EMBED(p), &desk_w, &desk_h);
-
- if (p->type == EWL_POPUP_TYPE_MOUSE) {
- x = win_x + p->mouse.x;
- y = win_y + p->mouse.y;
-
- if (x + p->offset.x + CURRENT_W(p) > desk_w)
- x -= p->offset.x + CURRENT_W(p);
- else
- x += p->offset.x;
-
- if (y + p->offset.y + CURRENT_H(p) > desk_h)
- y -= p->offset.y + CURRENT_H(p);
- else
- y += p->offset.y;
- }
- else if (p->type == EWL_POPUP_TYPE_MENU_VERTICAL) {
-
- x = win_x + CURRENT_X(p->follow);
- y = win_y + CURRENT_Y(p->follow);
-
- if (x + CURRENT_W(p) > desk_w && x > desk_w / 2)
- x = desk_w - CURRENT_W(p);
-
- if (y + CURRENT_H(p->follow) + CURRENT_H(p) > desk_h
- && y > desk_h / 2)
- y -= CURRENT_H(p);
- else
- y += CURRENT_H(p->follow);
- }
- else if (p->type == EWL_POPUP_TYPE_MENU_HORIZONTAL) {
-
- x = win_x + CURRENT_X(p->follow);
- y = win_y + CURRENT_Y(p->follow);
-
- if (x + CURRENT_W(p->follow) + CURRENT_W(p) > desk_w
- && x > desk_w / 2)
- x -= CURRENT_W(p);
- else
- x += CURRENT_W(p->follow);
-
- if (y + CURRENT_H(p) > desk_h && y > desk_h / 2)
- y = desk_h - CURRENT_H(p);
- }
-
- ewl_window_move(EWL_WINDOW(p), x, y);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int x = 0, y = 0;
+ int desk_w = 0, desk_h = 0;
+ int win_x = 0, win_y = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_TYPE(p, EWL_POPUP_TYPE);
+
+ if (p->type == EWL_POPUP_TYPE_NONE || p->moving)
+ DRETURN(DLEVEL_STABLE);
+
+ if (p->follow) {
+ Ewl_Embed *emb;
+
+ emb = ewl_embed_widget_find(p->follow);
+ ewl_embed_desktop_size_get(emb, &desk_w, &desk_h);
+ ewl_embed_window_position_get(emb, &win_x, &win_y);
+ }
+ else
+ ewl_embed_desktop_size_get(EWL_EMBED(p), &desk_w, &desk_h);
+
+ if (p->type == EWL_POPUP_TYPE_MOUSE) {
+ x = win_x + p->mouse.x;
+ y = win_y + p->mouse.y;
+
+ if (x + p->offset.x + CURRENT_W(p) > desk_w)
+ x -= p->offset.x + CURRENT_W(p);
+ else
+ x += p->offset.x;
+
+ if (y + p->offset.y + CURRENT_H(p) > desk_h)
+ y -= p->offset.y + CURRENT_H(p);
+ else
+ y += p->offset.y;
+ }
+ else if (p->type == EWL_POPUP_TYPE_MENU_VERTICAL) {
+
+ x = win_x + CURRENT_X(p->follow);
+ y = win_y + CURRENT_Y(p->follow);
+
+ if (x + CURRENT_W(p) > desk_w && x > desk_w / 2)
+ x = desk_w - CURRENT_W(p);
+
+ if (y + CURRENT_H(p->follow) + CURRENT_H(p) > desk_h
+ && y > desk_h / 2)
+ y -= CURRENT_H(p);
+ else
+ y += CURRENT_H(p->follow);
+ }
+ else if (p->type == EWL_POPUP_TYPE_MENU_HORIZONTAL) {
+
+ x = win_x + CURRENT_X(p->follow);
+ y = win_y + CURRENT_Y(p->follow);
+
+ if (x + CURRENT_W(p->follow) + CURRENT_W(p) > desk_w
+ && x > desk_w / 2)
+ x -= CURRENT_W(p);
+ else
+ x += CURRENT_W(p->follow);
+
+ if (y + CURRENT_H(p) > desk_h && y > desk_h / 2)
+ y = desk_h - CURRENT_H(p);
+ }
+
+ ewl_window_move(EWL_WINDOW(p), x, y);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_popup_size_check(Ewl_Popup *p)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_TYPE(p, EWL_POPUP_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_TYPE(p, EWL_POPUP_TYPE);
- if (!p->follow || p->type == EWL_POPUP_TYPE_NONE || !p->fit_to_follow)
- DRETURN(DLEVEL_STABLE);
+ if (!p->follow || p->type == EWL_POPUP_TYPE_NONE || !p->fit_to_follow)
+ DRETURN(DLEVEL_STABLE);
- if (p->type == EWL_POPUP_TYPE_MENU_VERTICAL)
- ewl_object_w_request(EWL_OBJECT(p), CURRENT_W(p->follow));
+ if (p->type == EWL_POPUP_TYPE_MENU_VERTICAL)
+ ewl_object_w_request(EWL_OBJECT(p), CURRENT_W(p->follow));
- else if (p->type == EWL_POPUP_TYPE_MENU_HORIZONTAL)
- ewl_object_h_request(EWL_OBJECT(p), CURRENT_H(p->follow));
+ else if (p->type == EWL_POPUP_TYPE_MENU_HORIZONTAL)
+ ewl_object_h_request(EWL_OBJECT(p), CURRENT_H(p->follow));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_popup.h b/src/lib/ewl_popup.h
index 1c3eed3..be4b6ef 100644
--- a/src/lib/ewl_popup.h
+++ b/src/lib/ewl_popup.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_POPUP_H
#define EWL_POPUP_H
@@ -43,29 +43,29 @@ typedef struct Ewl_Popup Ewl_Popup;
*/
struct Ewl_Popup
{
- Ewl_Window window; /**< Inherit from Ewl_Window */
+ Ewl_Window window; /**< Inherit from Ewl_Window */
- Ewl_Popup_Type type; /**< The Popup type */
- Ewl_Widget *follow; /**< The object to follow */
- struct {
- int x; /**< The x position */
- int y; /**< The y position */
- } mouse, offset;
- int fit_to_follow:1; /**< if the popup fits the size to its follow*/
- int moving:1; /**< if the popup is currently moving */
+ Ewl_Popup_Type type; /**< The Popup type */
+ Ewl_Widget *follow; /**< The object to follow */
+ struct {
+ int x; /**< The x position */
+ int y; /**< The y position */
+ } mouse, offset;
+ int fit_to_follow:1; /**< if the popup fits the size to its follow*/
+ int moving:1; /**< if the popup is currently moving */
};
-Ewl_Widget *ewl_popup_new(void);
-int ewl_popup_init(Ewl_Popup *p);
-void ewl_popup_type_set(Ewl_Popup *p, Ewl_Popup_Type type);
+Ewl_Widget *ewl_popup_new(void);
+int ewl_popup_init(Ewl_Popup *p);
+void ewl_popup_type_set(Ewl_Popup *p, Ewl_Popup_Type type);
Ewl_Popup_Type ewl_popup_type_get(Ewl_Popup *p);
-void ewl_popup_follow_set(Ewl_Popup *p, Ewl_Widget *w);
-Ewl_Widget *ewl_popup_follow_get(Ewl_Popup *p);
-void ewl_popup_fit_to_follow_set(Ewl_Popup *p, int fit);
-int ewl_popup_fit_to_follow_get(Ewl_Popup *p);
+void ewl_popup_follow_set(Ewl_Popup *p, Ewl_Widget *w);
+Ewl_Widget *ewl_popup_follow_get(Ewl_Popup *p);
+void ewl_popup_fit_to_follow_set(Ewl_Popup *p, int fit);
+int ewl_popup_fit_to_follow_get(Ewl_Popup *p);
-void ewl_popup_mouse_position_set(Ewl_Popup *p, int x, int y);
-void ewl_popup_offset_set(Ewl_Popup *p, int x, int y);
+void ewl_popup_mouse_position_set(Ewl_Popup *p, int x, int y);
+void ewl_popup_offset_set(Ewl_Popup *p, int x, int y);
/*
* Internal, override at your own risk
@@ -74,11 +74,11 @@ void ewl_popup_cb_show(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_popup_cb_mouse_move(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_popup_cb_destroy(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_popup_cb_child_resize(Ewl_Container *c, Ewl_Widget *w, int size,
- Ewl_Orientation o);
+ Ewl_Orientation o);
void ewl_popup_cb_child_show(Ewl_Container *c, Ewl_Widget *w);
void ewl_popup_cb_follow_destroy(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_popup_cb_follow_configure(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
/**
* @}
diff --git a/src/lib/ewl_private.h b/src/lib/ewl_private.h
index 8632f32..0a63cd5 100644
--- a/src/lib/ewl_private.h
+++ b/src/lib/ewl_private.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef _EWL_PRIVATE_H
#define _EWL_PRIVATE_H
@@ -61,7 +61,7 @@ void *alloca (size_t);
#define EWL_CONFIG_THEME_COLOR_CLASSES_OVERRIDE "/ewl/theme/color/classes/override"
#define EWL_CONFIG_THEME_COLOR_CLASSES_COUNT "/ewl/theme/color/classes/count"
-extern Ewl_Config *ewl_config; /**< The system configuration data */
+extern Ewl_Config *ewl_config; /**< The system configuration data */
#endif
diff --git a/src/lib/ewl_progressbar.c b/src/lib/ewl_progressbar.c
index e43b130..f39decc 100644
--- a/src/lib/ewl_progressbar.c
+++ b/src/lib/ewl_progressbar.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_progressbar.h"
#include "ewl_label.h"
@@ -15,20 +15,20 @@ static void ewl_progressbar_child_handle(Ewl_Container *c);
Ewl_Widget *
ewl_progressbar_new(void)
{
- Ewl_Progressbar *p;
+ Ewl_Progressbar *p;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- p = NEW(Ewl_Progressbar, 1);
- if (!p)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ p = NEW(Ewl_Progressbar, 1);
+ if (!p)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_progressbar_init(p)) {
- ewl_widget_destroy(EWL_WIDGET(p));
- p = NULL;
- }
+ if (!ewl_progressbar_init(p)) {
+ ewl_widget_destroy(EWL_WIDGET(p));
+ p = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(p), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(p), DLEVEL_STABLE);
}
/**
@@ -39,53 +39,53 @@ ewl_progressbar_new(void)
int
ewl_progressbar_init(Ewl_Progressbar *p)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(p, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(p, FALSE);
- w = EWL_WIDGET(p);
+ w = EWL_WIDGET(p);
- if (!ewl_range_init(EWL_RANGE(w)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_range_init(EWL_RANGE(w)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_appearance_set(w, EWL_PROGRESSBAR_TYPE);
- ewl_widget_inherit(w, EWL_PROGRESSBAR_TYPE);
+ ewl_widget_appearance_set(w, EWL_PROGRESSBAR_TYPE);
+ ewl_widget_inherit(w, EWL_PROGRESSBAR_TYPE);
- ewl_container_show_notify_set(EWL_CONTAINER(w),
- ewl_progressbar_cb_child_show);
- ewl_container_resize_notify_set(EWL_CONTAINER(w),
- ewl_progressbar_cb_child_resize);
+ ewl_container_show_notify_set(EWL_CONTAINER(w),
+ ewl_progressbar_cb_child_show);
+ ewl_container_resize_notify_set(EWL_CONTAINER(w),
+ ewl_progressbar_cb_child_resize);
- p->bar = NEW(Ewl_Widget, 1);
- if (!p->bar)
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ p->bar = NEW(Ewl_Widget, 1);
+ if (!p->bar)
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- if (!ewl_widget_init(p->bar))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_widget_init(p->bar))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_appearance_set(p->bar, "progressbar_bar");
- ewl_container_child_append(EWL_CONTAINER(p), p->bar);
- ewl_widget_show(p->bar);
+ ewl_widget_appearance_set(p->bar, "progressbar_bar");
+ ewl_container_child_append(EWL_CONTAINER(p), p->bar);
+ ewl_widget_show(p->bar);
- p->label = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(p->label), NULL);
- ewl_widget_layer_priority_set(p->label, 1);
- ewl_object_alignment_set(EWL_OBJECT(p->label), EWL_FLAG_ALIGN_CENTER);
- ewl_container_child_append(EWL_CONTAINER(p), p->label);
- ewl_widget_show(p->label);
+ p->label = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(p->label), NULL);
+ ewl_widget_layer_priority_set(p->label, 1);
+ ewl_object_alignment_set(EWL_OBJECT(p->label), EWL_FLAG_ALIGN_CENTER);
+ ewl_container_child_append(EWL_CONTAINER(p), p->label);
+ ewl_widget_show(p->label);
- p->auto_label = TRUE;
+ p->auto_label = TRUE;
- ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
- ewl_progressbar_cb_configure, NULL);
- ewl_callback_append(w, EWL_CALLBACK_VALUE_CHANGED,
- ewl_progressbar_cb_value_changed, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
+ ewl_progressbar_cb_configure, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_VALUE_CHANGED,
+ ewl_progressbar_cb_value_changed, NULL);
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_HFILL |
- EWL_FLAG_FILL_VSHRINK);
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_HFILL |
+ EWL_FLAG_FILL_VSHRINK);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -97,16 +97,16 @@ ewl_progressbar_init(Ewl_Progressbar *p)
void
ewl_progressbar_label_set(Ewl_Progressbar *p, char *label)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_TYPE(p, EWL_PROGRESSBAR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_TYPE(p, EWL_PROGRESSBAR_TYPE);
- p->auto_label = FALSE;
+ p->auto_label = FALSE;
- if (label)
- ewl_label_text_set(EWL_LABEL(p->label), label);
+ if (label)
+ ewl_label_text_set(EWL_LABEL(p->label), label);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -118,22 +118,22 @@ ewl_progressbar_label_set(Ewl_Progressbar *p, char *label)
void
ewl_progressbar_custom_label_set(Ewl_Progressbar *p, char *format_string)
{
- Ewl_Range *r;
- char label[PATH_MAX];
+ Ewl_Range *r;
+ char label[PATH_MAX];
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_TYPE(p, EWL_PROGRESSBAR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_TYPE(p, EWL_PROGRESSBAR_TYPE);
- p->auto_label = FALSE;
- r = EWL_RANGE(p);
+ p->auto_label = FALSE;
+ r = EWL_RANGE(p);
- if (format_string) {
- snprintf (label, PATH_MAX, format_string, r->value, r->max_val);
- ewl_label_text_set(EWL_LABEL(p->label), label);
- }
+ if (format_string) {
+ snprintf (label, PATH_MAX, format_string, r->value, r->max_val);
+ ewl_label_text_set(EWL_LABEL(p->label), label);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -144,14 +144,14 @@ ewl_progressbar_custom_label_set(Ewl_Progressbar *p, char *format_string)
void
ewl_progressbar_label_hide(Ewl_Progressbar *p)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_TYPE(p, EWL_PROGRESSBAR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_TYPE(p, EWL_PROGRESSBAR_TYPE);
- p->auto_label = FALSE;
- ewl_label_text_set(EWL_LABEL(p->label), "");
+ p->auto_label = FALSE;
+ ewl_label_text_set(EWL_LABEL(p->label), "");
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -162,13 +162,13 @@ ewl_progressbar_label_hide(Ewl_Progressbar *p)
void
ewl_progressbar_label_show (Ewl_Progressbar *p)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_TYPE(p, EWL_PROGRESSBAR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_TYPE(p, EWL_PROGRESSBAR_TYPE);
- p->auto_label = TRUE;
+ p->auto_label = TRUE;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -183,36 +183,36 @@ ewl_progressbar_label_show (Ewl_Progressbar *p)
*/
void
ewl_progressbar_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Progressbar *p;
- Ewl_Range *r;
- int dx, dy;
- int dw;
+ Ewl_Progressbar *p;
+ Ewl_Range *r;
+ int dx, dy;
+ int dw;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_PROGRESSBAR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_PROGRESSBAR_TYPE);
- p = EWL_PROGRESSBAR(w);
- r = EWL_RANGE(p);
+ p = EWL_PROGRESSBAR(w);
+ r = EWL_RANGE(p);
- dx = CURRENT_X(p);
- dy = CURRENT_Y(p);
- dw = CURRENT_W(p);
+ dx = CURRENT_X(p);
+ dy = CURRENT_Y(p);
+ dw = CURRENT_W(p);
- dw = dw * (r->value - r->min_val) / (r->max_val - r->min_val);
+ dw = dw * (r->value - r->min_val) / (r->max_val - r->min_val);
- if (r->invert){
- dx += CURRENT_W(p) - dw;
- }
+ if (r->invert){
+ dx += CURRENT_W(p) - dw;
+ }
- ewl_object_geometry_request(EWL_OBJECT(p->bar), dx, CURRENT_Y(p),
- dw, CURRENT_H(p));
- ewl_object_place (EWL_OBJECT(p->label), CURRENT_X(p),CURRENT_Y(p),
- CURRENT_W(p), CURRENT_H(p));
+ ewl_object_geometry_request(EWL_OBJECT(p->bar), dx, CURRENT_Y(p),
+ dw, CURRENT_H(p));
+ ewl_object_place (EWL_OBJECT(p->label), CURRENT_X(p),CURRENT_Y(p),
+ CURRENT_W(p), CURRENT_H(p));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -225,58 +225,58 @@ ewl_progressbar_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_progressbar_cb_value_changed(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Progressbar *p;
- Ewl_Range *r;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_PROGRESSBAR_TYPE);
-
- p = EWL_PROGRESSBAR(w);
- r = EWL_RANGE(p);
-
- if (p->auto_label) {
- char c[10];
- /*
- * Do a precentage calculation as a default label.
- */
- snprintf (c, sizeof (c), "%.0lf%%", (r->value /
- (r->max_val - r->min_val)) * 100);
- ewl_label_text_set(EWL_LABEL(p->label), c);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Progressbar *p;
+ Ewl_Range *r;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_PROGRESSBAR_TYPE);
+
+ p = EWL_PROGRESSBAR(w);
+ r = EWL_RANGE(p);
+
+ if (p->auto_label) {
+ char c[10];
+ /*
+ * Do a precentage calculation as a default label.
+ */
+ snprintf (c, sizeof (c), "%.0lf%%", (r->value /
+ (r->max_val - r->min_val)) * 100);
+ ewl_label_text_set(EWL_LABEL(p->label), c);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_progressbar_child_handle(Ewl_Container *c)
{
- Ewl_Range *r;
- double value;
+ Ewl_Range *r;
+ double value;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_PROGRESSBAR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_PROGRESSBAR_TYPE);
- r = EWL_RANGE(c);
- value = r->step / (r->max_val - r->min_val);
+ r = EWL_RANGE(c);
+ value = r->step / (r->max_val - r->min_val);
- if (value < 0.01 || ewl_range_unknown_get(r)) {
- value = 0.01;
- ewl_widget_state_set(EWL_WIDGET(c), "range-unknown",
- EWL_STATE_PERSISTENT);
- }
+ if (value < 0.01 || ewl_range_unknown_get(r)) {
+ value = 0.01;
+ ewl_widget_state_set(EWL_WIDGET(c), "range-unknown",
+ EWL_STATE_PERSISTENT);
+ }
- ewl_object_preferred_inner_w_set (EWL_OBJECT(c),
- ewl_object_preferred_w_get(
- EWL_OBJECT(EWL_PROGRESSBAR(c)->bar)) / value);
+ ewl_object_preferred_inner_w_set (EWL_OBJECT(c),
+ ewl_object_preferred_w_get(
+ EWL_OBJECT(EWL_PROGRESSBAR(c)->bar)) / value);
- ewl_container_largest_prefer(EWL_CONTAINER(c),
- EWL_ORIENTATION_VERTICAL);
+ ewl_container_largest_prefer(EWL_CONTAINER(c),
+ EWL_ORIENTATION_VERTICAL);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -289,13 +289,13 @@ ewl_progressbar_child_handle(Ewl_Container *c)
void
ewl_progressbar_cb_child_show(Ewl_Container *c, Ewl_Widget *w __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_PROGRESSBAR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_PROGRESSBAR_TYPE);
- ewl_progressbar_child_handle(c);
+ ewl_progressbar_child_handle(c);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -309,16 +309,16 @@ ewl_progressbar_cb_child_show(Ewl_Container *c, Ewl_Widget *w __UNUSED__)
*/
void
ewl_progressbar_cb_child_resize(Ewl_Container *c, Ewl_Widget *w __UNUSED__,
- int size __UNUSED__,
- Ewl_Orientation o __UNUSED__)
+ int size __UNUSED__,
+ Ewl_Orientation o __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_PROGRESSBAR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_PROGRESSBAR_TYPE);
- ewl_progressbar_child_handle(c);
+ ewl_progressbar_child_handle(c);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_progressbar.h b/src/lib/ewl_progressbar.h
index 3d18624..25d7fdf 100644
--- a/src/lib/ewl_progressbar.h
+++ b/src/lib/ewl_progressbar.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_PROGRESSBAR_H
#define EWL_PROGRESSBAR_H
@@ -52,33 +52,33 @@ typedef struct Ewl_Progressbar Ewl_Progressbar;
*/
struct Ewl_Progressbar
{
- Ewl_Range range; /**< Inherit from Ewl_Range */
- Ewl_Widget *bar; /**< The moving bar on top */
- Ewl_Widget *label; /**< text label on the bar */
- int auto_label; /**< flag if user is setting label or not */
+ Ewl_Range range; /**< Inherit from Ewl_Range */
+ Ewl_Widget *bar; /**< The moving bar on top */
+ Ewl_Widget *label; /**< text label on the bar */
+ int auto_label; /**< flag if user is setting label or not */
};
-Ewl_Widget *ewl_progressbar_new(void);
-int ewl_progressbar_init(Ewl_Progressbar *p);
+Ewl_Widget *ewl_progressbar_new(void);
+int ewl_progressbar_init(Ewl_Progressbar *p);
-void ewl_progressbar_label_set(Ewl_Progressbar *p, char *label);
-void ewl_progressbar_custom_label_set(Ewl_Progressbar *p,
- char *format_string);
+void ewl_progressbar_label_set(Ewl_Progressbar *p, char *label);
+void ewl_progressbar_custom_label_set(Ewl_Progressbar *p,
+ char *format_string);
-void ewl_progressbar_label_show(Ewl_Progressbar *p);
-void ewl_progressbar_label_hide(Ewl_Progressbar *p);
+void ewl_progressbar_label_show(Ewl_Progressbar *p);
+void ewl_progressbar_label_hide(Ewl_Progressbar *p);
/*
* Internally used callbacks, override at your own risk.
*/
void ewl_progressbar_cb_configure(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
void ewl_progressbar_cb_value_changed(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
void ewl_progressbar_cb_child_show(Ewl_Container *c, Ewl_Widget *w);
void ewl_progressbar_cb_child_resize(Ewl_Container *c, Ewl_Widget *w, int size,
- Ewl_Orientation o);
+ Ewl_Orientation o);
/**
* @}
diff --git a/src/lib/ewl_radiobutton.c b/src/lib/ewl_radiobutton.c
index 27873be..2c7d658 100644
--- a/src/lib/ewl_radiobutton.c
+++ b/src/lib/ewl_radiobutton.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_radiobutton.h"
#include "ewl_macros.h"
@@ -12,20 +12,20 @@
Ewl_Widget *
ewl_radiobutton_new(void)
{
- Ewl_Radiobutton *b;
+ Ewl_Radiobutton *b;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- b = NEW(Ewl_Radiobutton, 1);
- if (!b)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ b = NEW(Ewl_Radiobutton, 1);
+ if (!b)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_radiobutton_init(b)) {
- ewl_widget_destroy(EWL_WIDGET(b));
- b = NULL;
- }
+ if (!ewl_radiobutton_init(b)) {
+ ewl_widget_destroy(EWL_WIDGET(b));
+ b = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(b), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(b), DLEVEL_STABLE);
}
/**
@@ -39,27 +39,27 @@ ewl_radiobutton_new(void)
int
ewl_radiobutton_init(Ewl_Radiobutton *rb)
{
- Ewl_Checkbutton *cb;
- Ewl_Widget *w;
+ Ewl_Checkbutton *cb;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(rb, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(rb, FALSE);
- cb = EWL_CHECKBUTTON(rb);
- w = EWL_WIDGET(rb);
+ cb = EWL_CHECKBUTTON(rb);
+ w = EWL_WIDGET(rb);
- if (!ewl_checkbutton_init(cb))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_checkbutton_init(cb))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_appearance_set(w, EWL_RADIOBUTTON_TYPE);
- ewl_widget_inherit(w, EWL_RADIOBUTTON_TYPE);
- ewl_widget_appearance_set(cb->check, "radio");
- ewl_callback_append(w, EWL_CALLBACK_CLICKED, ewl_radiobutton_cb_clicked,
- NULL);
- ewl_callback_prepend(w, EWL_CALLBACK_DESTROY, ewl_radiobutton_cb_destroy,
- NULL);
+ ewl_widget_appearance_set(w, EWL_RADIOBUTTON_TYPE);
+ ewl_widget_inherit(w, EWL_RADIOBUTTON_TYPE);
+ ewl_widget_appearance_set(cb->check, "radio");
+ ewl_callback_append(w, EWL_CALLBACK_CLICKED, ewl_radiobutton_cb_clicked,
+ NULL);
+ ewl_callback_prepend(w, EWL_CALLBACK_DESTROY, ewl_radiobutton_cb_destroy,
+ NULL);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/*
@@ -71,13 +71,13 @@ ewl_radiobutton_init(Ewl_Radiobutton *rb)
void
ewl_radiobutton_value_set(Ewl_Radiobutton *rb, void *value)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(rb);
- DCHECK_TYPE(rb, EWL_RADIOBUTTON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(rb);
+ DCHECK_TYPE(rb, EWL_RADIOBUTTON_TYPE);
- rb->value = value;
+ rb->value = value;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/*
@@ -88,11 +88,11 @@ ewl_radiobutton_value_set(Ewl_Radiobutton *rb, void *value)
void *
ewl_radiobutton_value_get(Ewl_Radiobutton *rb)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(rb, 0);
- DCHECK_TYPE_RET(rb, EWL_RADIOBUTTON_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(rb, 0);
+ DCHECK_TYPE_RET(rb, EWL_RADIOBUTTON_TYPE, 0);
- DRETURN_INT(rb->value, DLEVEL_STABLE);
+ DRETURN_INT(rb->value, DLEVEL_STABLE);
}
/**
@@ -107,29 +107,29 @@ ewl_radiobutton_value_get(Ewl_Radiobutton *rb)
void
ewl_radiobutton_chain_set(Ewl_Radiobutton *rb, Ewl_Radiobutton *crb)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(rb);
- DCHECK_PARAM_PTR(crb);
- DCHECK_TYPE(rb, EWL_RADIOBUTTON_TYPE);
- DCHECK_TYPE(crb, EWL_RADIOBUTTON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(rb);
+ DCHECK_PARAM_PTR(crb);
+ DCHECK_TYPE(rb, EWL_RADIOBUTTON_TYPE);
+ DCHECK_TYPE(crb, EWL_RADIOBUTTON_TYPE);
- /*
- * If a chain doesnt exist, create one
- */
- if (!crb->chain) {
- crb->chain = ecore_list_new();
+ /*
+ * If a chain doesnt exist, create one
+ */
+ if (!crb->chain) {
+ crb->chain = ecore_list_new();
- ecore_list_append(crb->chain, rb);
- ecore_list_append(crb->chain, crb);
- } else {
+ ecore_list_append(crb->chain, rb);
+ ecore_list_append(crb->chain, crb);
+ } else {
- if (!ecore_list_goto(crb->chain, rb))
- ecore_list_append(crb->chain, rb);
- }
+ if (!ecore_list_goto(crb->chain, rb))
+ ecore_list_append(crb->chain, rb);
+ }
- rb->chain = crb->chain;
+ rb->chain = crb->chain;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/*
@@ -140,30 +140,30 @@ ewl_radiobutton_chain_set(Ewl_Radiobutton *rb, Ewl_Radiobutton *crb)
Ewl_Radiobutton *
ewl_radiobutton_chain_selected_get(Ewl_Radiobutton *rb)
{
- Ewl_Checkbutton *c;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(rb, NULL);
- DCHECK_TYPE_RET(rb, EWL_RADIOBUTTON_TYPE, NULL);
-
- /* if there is no chain or the chain is empty we have to
- * treat it special */
- if (!rb->chain || ecore_list_empty_is(rb->chain)) {
- if (ewl_checkbutton_is_checked(EWL_CHECKBUTTON(rb))) {
- DRETURN_PTR(rb, DLEVEL_STABLE);
- }
- else {
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
- }
-
- ecore_list_first_goto(rb->chain);
- while ((c = ecore_list_next(rb->chain))) {
- if (ewl_checkbutton_is_checked(c))
- DRETURN_PTR(c, DLEVEL_STABLE);
- }
-
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ Ewl_Checkbutton *c;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(rb, NULL);
+ DCHECK_TYPE_RET(rb, EWL_RADIOBUTTON_TYPE, NULL);
+
+ /* if there is no chain or the chain is empty we have to
+ * treat it special */
+ if (!rb->chain || ecore_list_empty_is(rb->chain)) {
+ if (ewl_checkbutton_is_checked(EWL_CHECKBUTTON(rb))) {
+ DRETURN_PTR(rb, DLEVEL_STABLE);
+ }
+ else {
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
+ }
+
+ ecore_list_first_goto(rb->chain);
+ while ((c = ecore_list_next(rb->chain))) {
+ if (ewl_checkbutton_is_checked(c))
+ DRETURN_PTR(c, DLEVEL_STABLE);
+ }
+
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
}
/**
@@ -176,34 +176,34 @@ ewl_radiobutton_chain_selected_get(Ewl_Radiobutton *rb)
*/
void
ewl_radiobutton_cb_clicked(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Checkbutton *cb;
- Ewl_Radiobutton *rb;
- int oc;
+ Ewl_Checkbutton *cb;
+ Ewl_Radiobutton *rb;
+ int oc;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_RADIOBUTTON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_RADIOBUTTON_TYPE);
- cb = EWL_CHECKBUTTON(w);
- rb = EWL_RADIOBUTTON(w);
- oc = ewl_checkbutton_is_checked(cb);
+ cb = EWL_CHECKBUTTON(w);
+ rb = EWL_RADIOBUTTON(w);
+ oc = ewl_checkbutton_is_checked(cb);
- if (rb->chain && !ecore_list_empty_is(rb->chain)) {
- Ewl_Checkbutton *c;
+ if (rb->chain && !ecore_list_empty_is(rb->chain)) {
+ Ewl_Checkbutton *c;
- ecore_list_first_goto(rb->chain);
- while ((c = ecore_list_next(rb->chain))) {
- ewl_checkbutton_checked_set(c, 0);
- }
- }
- ewl_checkbutton_checked_set(cb, 1);
+ ecore_list_first_goto(rb->chain);
+ while ((c = ecore_list_next(rb->chain))) {
+ ewl_checkbutton_checked_set(c, 0);
+ }
+ }
+ ewl_checkbutton_checked_set(cb, 1);
- if (oc != ewl_checkbutton_is_checked(cb))
- ewl_callback_call(w, EWL_CALLBACK_VALUE_CHANGED);
+ if (oc != ewl_checkbutton_is_checked(cb))
+ ewl_callback_call(w, EWL_CALLBACK_VALUE_CHANGED);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -216,25 +216,25 @@ ewl_radiobutton_cb_clicked(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_radiobutton_cb_destroy(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Radiobutton *rb;
+ Ewl_Radiobutton *rb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_RADIOBUTTON_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_RADIOBUTTON_TYPE);
- rb = EWL_RADIOBUTTON(w);
+ rb = EWL_RADIOBUTTON(w);
- if (!rb->chain)
- DRETURN(DLEVEL_STABLE);
+ if (!rb->chain)
+ DRETURN(DLEVEL_STABLE);
- ecore_list_goto(rb->chain, w);
- ecore_list_remove(rb->chain);
+ ecore_list_goto(rb->chain, w);
+ ecore_list_remove(rb->chain);
- if (ecore_list_empty_is(rb->chain))
- IF_FREE_LIST(rb->chain);
+ if (ecore_list_empty_is(rb->chain))
+ IF_FREE_LIST(rb->chain);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_radiobutton.h b/src/lib/ewl_radiobutton.h
index c474b60..3f981a8 100644
--- a/src/lib/ewl_radiobutton.h
+++ b/src/lib/ewl_radiobutton.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_RADIOBUTTON_H
#define EWL_RADIOBUTTON_H
@@ -52,19 +52,19 @@ typedef struct Ewl_Radiobutton Ewl_Radiobutton;
*/
struct Ewl_Radiobutton
{
- Ewl_Checkbutton button; /**< Inherit from Ewl_Checkbutton */
- Ecore_List *chain; /**< List of members of the group */
- void *value; /**< the value of the radio button */
+ Ewl_Checkbutton button; /**< Inherit from Ewl_Checkbutton */
+ Ecore_List *chain; /**< List of members of the group */
+ void *value; /**< the value of the radio button */
};
-Ewl_Widget *ewl_radiobutton_new(void);
-int ewl_radiobutton_init(Ewl_Radiobutton *rb);
+Ewl_Widget *ewl_radiobutton_new(void);
+int ewl_radiobutton_init(Ewl_Radiobutton *rb);
-void ewl_radiobutton_value_set(Ewl_Radiobutton *rb, void *v);
-void *ewl_radiobutton_value_get(Ewl_Radiobutton *rb);
+void ewl_radiobutton_value_set(Ewl_Radiobutton *rb, void *v);
+void *ewl_radiobutton_value_get(Ewl_Radiobutton *rb);
-void ewl_radiobutton_chain_set(Ewl_Radiobutton *rb, Ewl_Radiobutton *crb);
-Ewl_Radiobutton *ewl_radiobutton_chain_selected_get(Ewl_Radiobutton *rb);
+void ewl_radiobutton_chain_set(Ewl_Radiobutton *rb, Ewl_Radiobutton *crb);
+Ewl_Radiobutton *ewl_radiobutton_chain_selected_get(Ewl_Radiobutton *rb);
/**
* @def ewl_radiobutton_checked_set(r, c)
@@ -72,7 +72,7 @@ Ewl_Radiobutton *ewl_radiobutton_chain_selected_get(Ewl_Radiobutton *rb);
* fields.
*/
#define ewl_radiobutton_checked_set(r, c) \
- ewl_checkbutton_checked_set(EWL_CHECKBUTTON(r), c)
+ ewl_checkbutton_checked_set(EWL_CHECKBUTTON(r), c)
/**
* @def ewl_radiobutton_is_checked(r)
@@ -80,7 +80,7 @@ Ewl_Radiobutton *ewl_radiobutton_chain_selected_get(Ewl_Radiobutton *rb);
* fields.
*/
#define ewl_radiobutton_is_checked(r) \
- ewl_checkbutton_is_checked(EWL_CHECKBUTTON(r))
+ ewl_checkbutton_is_checked(EWL_CHECKBUTTON(r))
/*
* Internally used callbacks, override at your own risk.
diff --git a/src/lib/ewl_range.c b/src/lib/ewl_range.c
index 445c304..58b732d 100644
--- a/src/lib/ewl_range.c
+++ b/src/lib/ewl_range.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_range.h"
#include "ewl_macros.h"
@@ -17,28 +17,28 @@
int
ewl_range_init(Ewl_Range *r)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(r, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(r, FALSE);
- w = EWL_WIDGET(r);
+ w = EWL_WIDGET(r);
- if (!ewl_container_init(EWL_CONTAINER(w)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_container_init(EWL_CONTAINER(w)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_inherit(w, EWL_RANGE_TYPE);
+ ewl_widget_inherit(w, EWL_RANGE_TYPE);
- /*
- * Set sane default values
- */
- r->value = 0.0;
- r->min_val = 0.0;
- r->max_val = 100.0;
- r->step = 10.0;
- r->invert = FALSE;
+ /*
+ * Set sane default values
+ */
+ r->value = 0.0;
+ r->min_val = 0.0;
+ r->max_val = 100.0;
+ r->step = 10.0;
+ r->invert = FALSE;
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -51,26 +51,26 @@ ewl_range_init(Ewl_Range *r)
void
ewl_range_value_set(Ewl_Range *r, double v)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(r);
- DCHECK_TYPE(r, EWL_RANGE_TYPE);
-
- if (r->value == v)
- DRETURN(DLEVEL_STABLE);
-
- if (!r->unknown_range) {
- if (v < r->min_val)
- r->value = r->min_val;
- else if (v > r->max_val)
- r->value = r->max_val;
- else
- r->value = v;
- }
-
- ewl_callback_call(EWL_WIDGET(r), EWL_CALLBACK_VALUE_CHANGED);
- ewl_widget_configure(EWL_WIDGET(r));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(r);
+ DCHECK_TYPE(r, EWL_RANGE_TYPE);
+
+ if (r->value == v)
+ DRETURN(DLEVEL_STABLE);
+
+ if (!r->unknown_range) {
+ if (v < r->min_val)
+ r->value = r->min_val;
+ else if (v > r->max_val)
+ r->value = r->max_val;
+ else
+ r->value = v;
+ }
+
+ ewl_callback_call(EWL_WIDGET(r), EWL_CALLBACK_VALUE_CHANGED);
+ ewl_widget_configure(EWL_WIDGET(r));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -82,11 +82,11 @@ ewl_range_value_set(Ewl_Range *r, double v)
double
ewl_range_value_get(Ewl_Range *r)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(r, 0.0);
- DCHECK_TYPE_RET(r, EWL_RANGE_TYPE, 0.0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(r, 0.0);
+ DCHECK_TYPE_RET(r, EWL_RANGE_TYPE, 0.0);
- DRETURN_FLOAT(r->value, DLEVEL_STABLE);
+ DRETURN_FLOAT(r->value, DLEVEL_STABLE);
}
/**
@@ -100,17 +100,17 @@ ewl_range_value_get(Ewl_Range *r)
void
ewl_range_minimum_value_set(Ewl_Range *r, double minv)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(r);
- DCHECK_TYPE(r, EWL_RANGE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(r);
+ DCHECK_TYPE(r, EWL_RANGE_TYPE);
- r->min_val = minv;
+ r->min_val = minv;
- /* update to the min value if needed */
- if (r->value < r->min_val)
- ewl_range_value_set(r, r->min_val);
+ /* update to the min value if needed */
+ if (r->value < r->min_val)
+ ewl_range_value_set(r, r->min_val);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -121,11 +121,11 @@ ewl_range_minimum_value_set(Ewl_Range *r, double minv)
double
ewl_range_minimum_value_get(Ewl_Range *r)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(r, 0.0);
- DCHECK_TYPE_RET(r, EWL_RANGE_TYPE, 0.0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(r, 0.0);
+ DCHECK_TYPE_RET(r, EWL_RANGE_TYPE, 0.0);
- DRETURN_FLOAT(r->min_val, DLEVEL_STABLE);
+ DRETURN_FLOAT(r->min_val, DLEVEL_STABLE);
}
/**
@@ -139,17 +139,17 @@ ewl_range_minimum_value_get(Ewl_Range *r)
void
ewl_range_maximum_value_set(Ewl_Range *r, double maxv)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(r);
- DCHECK_TYPE(r, EWL_RANGE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(r);
+ DCHECK_TYPE(r, EWL_RANGE_TYPE);
- r->max_val = maxv;
+ r->max_val = maxv;
- /* update to max value if needed */
- if (r->value > r->max_val)
- ewl_range_value_set(r, r->max_val);
+ /* update to max value if needed */
+ if (r->value > r->max_val)
+ ewl_range_value_set(r, r->max_val);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -160,11 +160,11 @@ ewl_range_maximum_value_set(Ewl_Range *r, double maxv)
double
ewl_range_maximum_value_get(Ewl_Range *r)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(r, 0.0);
- DCHECK_TYPE_RET(r, EWL_RANGE_TYPE, 0.0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(r, 0.0);
+ DCHECK_TYPE_RET(r, EWL_RANGE_TYPE, 0.0);
- DRETURN_FLOAT(r->max_val, DLEVEL_STABLE);
+ DRETURN_FLOAT(r->max_val, DLEVEL_STABLE);
}
/**
* @param r: the range to change step
@@ -178,16 +178,16 @@ ewl_range_maximum_value_get(Ewl_Range *r)
void
ewl_range_step_set(Ewl_Range *r, double step)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(r);
- DCHECK_TYPE(r, EWL_RANGE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(r);
+ DCHECK_TYPE(r, EWL_RANGE_TYPE);
- if (step > r->max_val - r->min_val)
- step = r->max_val - r->min_val;
+ if (step > r->max_val - r->min_val)
+ step = r->max_val - r->min_val;
- r->step = step;
+ r->step = step;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -198,12 +198,12 @@ ewl_range_step_set(Ewl_Range *r, double step)
double
ewl_range_step_get(Ewl_Range *r)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(r, 0.0);
- DCHECK_TYPE_RET(r, EWL_RANGE_TYPE, 0.0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(r, 0.0);
+ DCHECK_TYPE_RET(r, EWL_RANGE_TYPE, 0.0);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
- DRETURN_FLOAT(r->step, DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DRETURN_FLOAT(r->step, DLEVEL_STABLE);
}
/**
@@ -215,17 +215,17 @@ ewl_range_step_get(Ewl_Range *r)
void
ewl_range_invert_set(Ewl_Range *r, unsigned int invert)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(r);
- DCHECK_TYPE(r, EWL_RANGE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(r);
+ DCHECK_TYPE(r, EWL_RANGE_TYPE);
- if (r->invert != !!invert)
- {
- r->invert = !!invert;
- ewl_widget_configure(EWL_WIDGET(r));
- }
+ if (r->invert != !!invert)
+ {
+ r->invert = !!invert;
+ ewl_widget_configure(EWL_WIDGET(r));
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -236,11 +236,11 @@ ewl_range_invert_set(Ewl_Range *r, unsigned int invert)
unsigned int
ewl_range_invert_get(Ewl_Range *r)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(r, FALSE);
- DCHECK_TYPE_RET(r, EWL_RANGE_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(r, FALSE);
+ DCHECK_TYPE_RET(r, EWL_RANGE_TYPE, FALSE);
- DRETURN_INT(r->invert, DLEVEL_STABLE);
+ DRETURN_INT(r->invert, DLEVEL_STABLE);
}
/**
@@ -252,14 +252,14 @@ ewl_range_invert_get(Ewl_Range *r)
void
ewl_range_unknown_set(Ewl_Range *r, unsigned int unknown)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(r);
- DCHECK_TYPE(r, EWL_RANGE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(r);
+ DCHECK_TYPE(r, EWL_RANGE_TYPE);
- if (r->unknown_range != !!unknown) {
- r->unknown_range = !!unknown;
- ewl_widget_configure(EWL_WIDGET(r));
- }
+ if (r->unknown_range != !!unknown) {
+ r->unknown_range = !!unknown;
+ ewl_widget_configure(EWL_WIDGET(r));
+ }
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -290,13 +290,13 @@ ewl_range_unknown_get(Ewl_Range *r)
void
ewl_range_increase(Ewl_Range *r)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(r);
- DCHECK_TYPE(r, EWL_RANGE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(r);
+ DCHECK_TYPE(r, EWL_RANGE_TYPE);
- ewl_range_value_set(r, r->value + r->step);
+ ewl_range_value_set(r, r->value + r->step);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -309,11 +309,11 @@ ewl_range_increase(Ewl_Range *r)
void
ewl_range_decrease(Ewl_Range *r)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(r);
- DCHECK_TYPE(r, EWL_RANGE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(r);
+ DCHECK_TYPE(r, EWL_RANGE_TYPE);
- ewl_range_value_set(r, r->value - r->step);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ ewl_range_value_set(r, r->value - r->step);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_range.h b/src/lib/ewl_range.h
index 35f1a8c..62457f6 100644
--- a/src/lib/ewl_range.h
+++ b/src/lib/ewl_range.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_RANGE_H
#define EWL_RANGE_H
@@ -45,38 +45,38 @@ typedef struct Ewl_Range Ewl_Range;
*/
struct Ewl_Range
{
- Ewl_Container container; /**< Inherit from Ewl_Container */
-
- double value; /**< Currently chosen value */
- double min_val; /**< Minimal valide value */
- double max_val; /**< Maximal valide value */
- double step; /**< Size of increments in the range */
- unsigned int invert:1; /**< Invert the axis */
- unsigned int unknown_range:1; /**< Unknown range */
+ Ewl_Container container; /**< Inherit from Ewl_Container */
+
+ double value; /**< Currently chosen value */
+ double min_val; /**< Minimal valide value */
+ double max_val; /**< Maximal valide value */
+ double step; /**< Size of increments in the range */
+ unsigned int invert:1; /**< Invert the axis */
+ unsigned int unknown_range:1; /**< Unknown range */
};
-int ewl_range_init(Ewl_Range *r);
+int ewl_range_init(Ewl_Range *r);
-void ewl_range_value_set(Ewl_Range *r, double v);
-double ewl_range_value_get(Ewl_Range *r);
+void ewl_range_value_set(Ewl_Range *r, double v);
+double ewl_range_value_get(Ewl_Range *r);
-void ewl_range_minimum_value_set(Ewl_Range *r, double minv);
-double ewl_range_minimum_value_get(Ewl_Range *r);
+void ewl_range_minimum_value_set(Ewl_Range *r, double minv);
+double ewl_range_minimum_value_get(Ewl_Range *r);
-void ewl_range_maximum_value_set(Ewl_Range *r, double maxv);
-double ewl_range_maximum_value_get(Ewl_Range *r);
+void ewl_range_maximum_value_set(Ewl_Range *r, double maxv);
+double ewl_range_maximum_value_get(Ewl_Range *r);
-void ewl_range_step_set(Ewl_Range *r, double step);
-double ewl_range_step_get(Ewl_Range *r);
+void ewl_range_step_set(Ewl_Range *r, double step);
+double ewl_range_step_get(Ewl_Range *r);
-void ewl_range_unknown_set(Ewl_Range *r, unsigned int unknown);
-unsigned int ewl_range_unknown_get(Ewl_Range *r);
+void ewl_range_unknown_set(Ewl_Range *r, unsigned int unknown);
+unsigned int ewl_range_unknown_get(Ewl_Range *r);
-void ewl_range_invert_set(Ewl_Range *r, unsigned int invert);
-unsigned int ewl_range_invert_get(Ewl_Range *r);
+void ewl_range_invert_set(Ewl_Range *r, unsigned int invert);
+unsigned int ewl_range_invert_get(Ewl_Range *r);
-void ewl_range_decrease(Ewl_Range *r);
-void ewl_range_increase(Ewl_Range *r);
+void ewl_range_decrease(Ewl_Range *r);
+void ewl_range_increase(Ewl_Range *r);
/**
* @}
diff --git a/src/lib/ewl_row.c b/src/lib/ewl_row.c
index d2ec53b..1e1a568 100644
--- a/src/lib/ewl_row.c
+++ b/src/lib/ewl_row.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_row.h"
#include "ewl_macros.h"
@@ -14,20 +14,20 @@ static void ewl_row_cb_state_changed(Ewl_Widget *w, void *ev, void *data);
Ewl_Widget *
ewl_row_new(void)
{
- Ewl_Widget *row;
+ Ewl_Widget *row;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- row = NEW(Ewl_Row, 1);
- if (!row)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ row = NEW(Ewl_Row, 1);
+ if (!row)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_row_init(EWL_ROW(row))) {
- ewl_widget_destroy(row);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ewl_row_init(EWL_ROW(row))) {
+ ewl_widget_destroy(row);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(row, DLEVEL_STABLE);
+ DRETURN_PTR(row, DLEVEL_STABLE);
}
/**
@@ -40,30 +40,30 @@ ewl_row_new(void)
int
ewl_row_init(Ewl_Row *row)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(row, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(row, FALSE);
- if (!ewl_container_init(EWL_CONTAINER(row)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_container_init(EWL_CONTAINER(row)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_appearance_set(EWL_WIDGET(row), EWL_ROW_TYPE);
- ewl_widget_inherit(EWL_WIDGET(row), EWL_ROW_TYPE);
+ ewl_widget_appearance_set(EWL_WIDGET(row), EWL_ROW_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(row), EWL_ROW_TYPE);
- ewl_container_show_notify_set(EWL_CONTAINER(row), ewl_row_cb_child_show);
- ewl_container_hide_notify_set(EWL_CONTAINER(row), ewl_row_cb_child_hide);
- ewl_container_resize_notify_set(EWL_CONTAINER(row),
- ewl_row_cb_child_resize);
+ ewl_container_show_notify_set(EWL_CONTAINER(row), ewl_row_cb_child_show);
+ ewl_container_hide_notify_set(EWL_CONTAINER(row), ewl_row_cb_child_hide);
+ ewl_container_resize_notify_set(EWL_CONTAINER(row),
+ ewl_row_cb_child_resize);
- ewl_object_fill_policy_set(EWL_OBJECT(row), EWL_FLAG_FILL_HFILL);
+ ewl_object_fill_policy_set(EWL_OBJECT(row), EWL_FLAG_FILL_HFILL);
- ewl_callback_append(EWL_WIDGET(row), EWL_CALLBACK_CONFIGURE,
- ewl_row_cb_configure, NULL);
- ewl_callback_append(EWL_WIDGET(row), EWL_CALLBACK_STATE_CHANGED,
- ewl_row_cb_state_changed, NULL);
+ ewl_callback_append(EWL_WIDGET(row), EWL_CALLBACK_CONFIGURE,
+ ewl_row_cb_configure, NULL);
+ ewl_callback_append(EWL_WIDGET(row), EWL_CALLBACK_STATE_CHANGED,
+ ewl_row_cb_state_changed, NULL);
- ewl_widget_focusable_set(EWL_WIDGET(row), FALSE);
+ ewl_widget_focusable_set(EWL_WIDGET(row), FALSE);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -78,24 +78,24 @@ ewl_row_init(Ewl_Row *row)
void
ewl_row_header_set(Ewl_Row *row, Ewl_Container *header)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(row);
- DCHECK_TYPE(row, EWL_ROW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(row);
+ DCHECK_TYPE(row, EWL_ROW_TYPE);
- if (row->header == header)
- DRETURN(DLEVEL_STABLE);
+ if (row->header == header)
+ DRETURN(DLEVEL_STABLE);
- row->header = header;
- if (header) {
- ewl_object_fill_policy_set(EWL_OBJECT(row),
- EWL_FLAG_FILL_HFILL);
+ row->header = header;
+ if (header) {
+ ewl_object_fill_policy_set(EWL_OBJECT(row),
+ EWL_FLAG_FILL_HFILL);
- ewl_widget_configure(EWL_WIDGET(header));
- }
- else
- ewl_widget_configure(EWL_WIDGET(row));
+ ewl_widget_configure(EWL_WIDGET(header));
+ }
+ else
+ ewl_widget_configure(EWL_WIDGET(row));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -107,15 +107,15 @@ ewl_row_header_set(Ewl_Row *row, Ewl_Container *header)
Ewl_Widget *
ewl_row_column_get(Ewl_Row *row, short n)
{
- Ewl_Widget *found;
+ Ewl_Widget *found;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(row, NULL);
- DCHECK_TYPE_RET(row, EWL_ROW_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(row, NULL);
+ DCHECK_TYPE_RET(row, EWL_ROW_TYPE, NULL);
- found = ecore_dlist_index_goto(EWL_CONTAINER(row)->children, n + 1);
+ found = ecore_dlist_index_goto(EWL_CONTAINER(row)->children, n + 1);
- DRETURN_PTR(found, DLEVEL_STABLE);
+ DRETURN_PTR(found, DLEVEL_STABLE);
}
/**
@@ -128,126 +128,126 @@ ewl_row_column_get(Ewl_Row *row, short n)
*/
void
ewl_row_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Row *row;
- Ewl_Container *c;
- Ewl_Object *child;
- Ewl_Object *align;
- int x;
- int remains, nodes;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- row = EWL_ROW(w);
- c = EWL_CONTAINER(w);
-
- x = CURRENT_X(w);
- remains = CURRENT_W(w);
-
- nodes = 0;
- ewl_container_child_iterate_begin(c);
- while ((child = EWL_OBJECT(ewl_container_child_next(c)))) {
- if (VISIBLE(child))
- nodes++;
- }
-
- ewl_container_child_iterate_begin(c);
-
- /*
- * This should be the common case, a row bounded by a set of fields,
- * for forming a table.
- */
- if (row->header) {
- int width;
- Ewl_Container *hdr;
-
- hdr = row->header;
- ewl_container_child_iterate_begin(hdr);
-
- /*
- * Get the first child of the header.
- */
- align = EWL_OBJECT(ewl_container_child_next(hdr));
- if (align)
- x = MAX(ewl_object_current_x_get(align), CURRENT_X(w));
- else
- x = CURRENT_X(w);
-
- /*
- * Iterate over the children and position the header children.
- */
- ewl_container_child_iterate_begin(hdr);
- while ((child = EWL_OBJECT(ewl_container_child_next(c)))) {
- align = EWL_OBJECT(ewl_container_child_next(hdr));
- if (align && VISIBLE(align))
- width = ewl_object_current_x_get(align) +
- ewl_object_current_w_get(align) - x;
- else if (nodes)
- width = remains / nodes;
- else
- width = remains;
-
- /*
- * Request the necessary geometry then check what was
- * accepted to calculate remaining steps.
- */
- ewl_object_place(child, x, CURRENT_Y(w), width,
- CURRENT_H(w));
- width = ewl_object_current_w_get(child);
- x += width;
- remains -= width;
- nodes--;
- }
- }
- /*
- * In the uncommon case, we simply try to give out a fair amount of
- * space.
- */
- else {
- int tx = x;
- while ((child = EWL_OBJECT(ewl_container_child_next(c)))) {
- int portion;
-
- /*
- * Ask for the child to stay the current size for now.
- */
- portion = ewl_object_current_w_get(child);
- ewl_object_position_request(child, tx, CURRENT_Y(w));
- ewl_object_w_request(child, portion);
- ewl_object_h_request(child, CURRENT_H(w));
-
- remains -= portion;
- portion = ewl_object_current_w_get(child);
- tx = ewl_object_current_x_get(child) + portion;
- }
-
- /* Divvy up remaining space */
- if (remains) {
- tx = x;
- nodes = ecore_dlist_count(c->children);
- ecore_dlist_first_goto(c->children);
- while ((child = ecore_dlist_next(c->children))) {
- int portion;
- int width = ewl_object_current_w_get(child);
-
- if (nodes)
- portion = remains / nodes;
- else
- portion = remains;
- ewl_object_x_request(child, tx);
- ewl_object_w_request(child, portion + width);
- remains -= portion;
- portion = ewl_object_current_w_get(child);
- tx += portion;
- nodes--;
- }
- }
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Row *row;
+ Ewl_Container *c;
+ Ewl_Object *child;
+ Ewl_Object *align;
+ int x;
+ int remains, nodes;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ row = EWL_ROW(w);
+ c = EWL_CONTAINER(w);
+
+ x = CURRENT_X(w);
+ remains = CURRENT_W(w);
+
+ nodes = 0;
+ ewl_container_child_iterate_begin(c);
+ while ((child = EWL_OBJECT(ewl_container_child_next(c)))) {
+ if (VISIBLE(child))
+ nodes++;
+ }
+
+ ewl_container_child_iterate_begin(c);
+
+ /*
+ * This should be the common case, a row bounded by a set of fields,
+ * for forming a table.
+ */
+ if (row->header) {
+ int width;
+ Ewl_Container *hdr;
+
+ hdr = row->header;
+ ewl_container_child_iterate_begin(hdr);
+
+ /*
+ * Get the first child of the header.
+ */
+ align = EWL_OBJECT(ewl_container_child_next(hdr));
+ if (align)
+ x = MAX(ewl_object_current_x_get(align), CURRENT_X(w));
+ else
+ x = CURRENT_X(w);
+
+ /*
+ * Iterate over the children and position the header children.
+ */
+ ewl_container_child_iterate_begin(hdr);
+ while ((child = EWL_OBJECT(ewl_container_child_next(c)))) {
+ align = EWL_OBJECT(ewl_container_child_next(hdr));
+ if (align && VISIBLE(align))
+ width = ewl_object_current_x_get(align) +
+ ewl_object_current_w_get(align) - x;
+ else if (nodes)
+ width = remains / nodes;
+ else
+ width = remains;
+
+ /*
+ * Request the necessary geometry then check what was
+ * accepted to calculate remaining steps.
+ */
+ ewl_object_place(child, x, CURRENT_Y(w), width,
+ CURRENT_H(w));
+ width = ewl_object_current_w_get(child);
+ x += width;
+ remains -= width;
+ nodes--;
+ }
+ }
+ /*
+ * In the uncommon case, we simply try to give out a fair amount of
+ * space.
+ */
+ else {
+ int tx = x;
+ while ((child = EWL_OBJECT(ewl_container_child_next(c)))) {
+ int portion;
+
+ /*
+ * Ask for the child to stay the current size for now.
+ */
+ portion = ewl_object_current_w_get(child);
+ ewl_object_position_request(child, tx, CURRENT_Y(w));
+ ewl_object_w_request(child, portion);
+ ewl_object_h_request(child, CURRENT_H(w));
+
+ remains -= portion;
+ portion = ewl_object_current_w_get(child);
+ tx = ewl_object_current_x_get(child) + portion;
+ }
+
+ /* Divvy up remaining space */
+ if (remains) {
+ tx = x;
+ nodes = ecore_dlist_count(c->children);
+ ecore_dlist_first_goto(c->children);
+ while ((child = ecore_dlist_next(c->children))) {
+ int portion;
+ int width = ewl_object_current_w_get(child);
+
+ if (nodes)
+ portion = remains / nodes;
+ else
+ portion = remains;
+ ewl_object_x_request(child, tx);
+ ewl_object_w_request(child, portion + width);
+ remains -= portion;
+ portion = ewl_object_current_w_get(child);
+ tx += portion;
+ nodes--;
+ }
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -260,18 +260,18 @@ ewl_row_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_row_cb_header_configure(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__,
- void *user_data)
+ void *user_data)
{
- Ewl_Row *row;
+ Ewl_Row *row;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(user_data);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(user_data);
- row = EWL_ROW(user_data);
- /* ewl_object_preferred_inner_w_set(EWL_OBJECT(w), CURRENT_W(row->header)); */
- ewl_widget_configure(EWL_WIDGET(row));
+ row = EWL_ROW(user_data);
+ /* ewl_object_preferred_inner_w_set(EWL_OBJECT(w), CURRENT_W(row->header)); */
+ ewl_widget_configure(EWL_WIDGET(row));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -284,18 +284,18 @@ ewl_row_cb_header_configure(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__,
*/
void
ewl_row_cb_header_destroy(Ewl_Widget *w __UNUSED__,
- void *ev_data __UNUSED__, void *user_data)
+ void *ev_data __UNUSED__, void *user_data)
{
- Ewl_Row *row;
+ Ewl_Row *row;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(user_data);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(user_data);
- row = EWL_ROW(user_data);
- row->header = NULL;
- ewl_row_header_set(row, NULL);
+ row = EWL_ROW(user_data);
+ row->header = NULL;
+ ewl_row_header_set(row, NULL);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -308,20 +308,20 @@ ewl_row_cb_header_destroy(Ewl_Widget *w __UNUSED__,
void
ewl_row_cb_child_show(Ewl_Container *c, Ewl_Widget *w)
{
- Ewl_Row *row;
+ Ewl_Row *row;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- row = EWL_ROW(c);
- ewl_container_largest_prefer(c, EWL_ORIENTATION_VERTICAL);
- ewl_object_preferred_inner_w_set(EWL_OBJECT(c), PREFERRED_W(c) +
- ewl_object_preferred_w_get(EWL_OBJECT(w)));
+ row = EWL_ROW(c);
+ ewl_container_largest_prefer(c, EWL_ORIENTATION_VERTICAL);
+ ewl_object_preferred_inner_w_set(EWL_OBJECT(c), PREFERRED_W(c) +
+ ewl_object_preferred_w_get(EWL_OBJECT(w)));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -334,20 +334,20 @@ ewl_row_cb_child_show(Ewl_Container *c, Ewl_Widget *w)
void
ewl_row_cb_child_hide(Ewl_Container *c, Ewl_Widget *w)
{
- Ewl_Row *row;
+ Ewl_Row *row;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- row = EWL_ROW(c);
- ewl_container_largest_prefer(c, EWL_ORIENTATION_VERTICAL);
- ewl_object_preferred_inner_w_set(EWL_OBJECT(c), PREFERRED_W(c) -
- ewl_object_preferred_w_get(EWL_OBJECT(w)));
+ row = EWL_ROW(c);
+ ewl_container_largest_prefer(c, EWL_ORIENTATION_VERTICAL);
+ ewl_object_preferred_inner_w_set(EWL_OBJECT(c), PREFERRED_W(c) -
+ ewl_object_preferred_w_get(EWL_OBJECT(w)));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -361,22 +361,22 @@ ewl_row_cb_child_hide(Ewl_Container *c, Ewl_Widget *w)
*/
void
ewl_row_cb_child_resize(Ewl_Container *c, Ewl_Widget *w __UNUSED__,
- int size, Ewl_Orientation o)
+ int size, Ewl_Orientation o)
{
- Ewl_Row *row;
+ Ewl_Row *row;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- row = EWL_ROW(c);
- if (o == EWL_ORIENTATION_VERTICAL)
- ewl_container_largest_prefer(c, EWL_ORIENTATION_VERTICAL);
- else
- ewl_object_preferred_inner_w_set(EWL_OBJECT(c),
- PREFERRED_W(c) + size);
+ row = EWL_ROW(c);
+ if (o == EWL_ORIENTATION_VERTICAL)
+ ewl_container_largest_prefer(c, EWL_ORIENTATION_VERTICAL);
+ else
+ ewl_object_preferred_inner_w_set(EWL_OBJECT(c),
+ PREFERRED_W(c) + size);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -390,29 +390,29 @@ ewl_row_cb_child_resize(Ewl_Container *c, Ewl_Widget *w __UNUSED__,
static void
ewl_row_cb_state_changed(Ewl_Widget *w, void *ev, void *data __UNUSED__)
{
- Ewl_Widget *o;
- Ewl_Event_State_Change *e;
- const char *send_state;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(ev);
- DCHECK_TYPE(w, EWL_ROW_TYPE);
-
- e = EWL_EVENT_STATE_CHANGE(ev);
-
- /* Only want this for selected signals */
- if (!strcmp(e->state, "selected"))
- send_state = "parent,selected";
- else if (!strcmp(e->state, "deselect"))
- send_state = "parent,deselect";
- else
- DRETURN(DLEVEL_STABLE);
-
- ewl_container_child_iterate_begin(EWL_CONTAINER(w));
- while ((o = ewl_container_child_next(EWL_CONTAINER(w))))
- ewl_widget_state_set(o, send_state, e->flag);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Widget *o;
+ Ewl_Event_State_Change *e;
+ const char *send_state;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(ev);
+ DCHECK_TYPE(w, EWL_ROW_TYPE);
+
+ e = EWL_EVENT_STATE_CHANGE(ev);
+
+ /* Only want this for selected signals */
+ if (!strcmp(e->state, "selected"))
+ send_state = "parent,selected";
+ else if (!strcmp(e->state, "deselect"))
+ send_state = "parent,deselect";
+ else
+ DRETURN(DLEVEL_STABLE);
+
+ ewl_container_child_iterate_begin(EWL_CONTAINER(w));
+ while ((o = ewl_container_child_next(EWL_CONTAINER(w))))
+ ewl_widget_state_set(o, send_state, e->flag);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_row.h b/src/lib/ewl_row.h
index 134a8f5..a375147 100644
--- a/src/lib/ewl_row.h
+++ b/src/lib/ewl_row.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_ROW_H
#define EWL_ROW_H
@@ -48,29 +48,29 @@ typedef struct Ewl_Row Ewl_Row;
*/
struct Ewl_Row
{
- Ewl_Container container; /**< Inherit from Ewl_Container */
- Ewl_Container *header; /**< The header row */
+ Ewl_Container container; /**< Inherit from Ewl_Container */
+ Ewl_Container *header; /**< The header row */
};
-Ewl_Widget *ewl_row_new(void);
-int ewl_row_init(Ewl_Row *row);
+Ewl_Widget *ewl_row_new(void);
+int ewl_row_init(Ewl_Row *row);
-void ewl_row_header_set(Ewl_Row *row, Ewl_Container *header);
-Ewl_Widget *ewl_row_column_get(Ewl_Row *row, short n);
+void ewl_row_header_set(Ewl_Row *row, Ewl_Container *header);
+Ewl_Widget *ewl_row_column_get(Ewl_Row *row, short n);
/*
* Internally used callbacks, override at your own risk.
*/
void ewl_row_cb_configure(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_row_cb_header_configure(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
void ewl_row_cb_header_destroy(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
void ewl_row_cb_child_show(Ewl_Container *c, Ewl_Widget *w);
void ewl_row_cb_child_hide(Ewl_Container *c, Ewl_Widget *w);
void ewl_row_cb_child_resize(Ewl_Container *c, Ewl_Widget *w, int size,
- Ewl_Orientation o);
+ Ewl_Orientation o);
/**
* @}
diff --git a/src/lib/ewl_scrollbar.c b/src/lib/ewl_scrollbar.c
index b193076..ff18082 100644
--- a/src/lib/ewl_scrollbar.c
+++ b/src/lib/ewl_scrollbar.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include <math.h>
#include "ewl_base.h"
#include "ewl_scrollbar.h"
@@ -17,23 +17,23 @@ static int ewl_scrollbar_timer(void *data);
Ewl_Widget *
ewl_scrollbar_new(void)
{
- Ewl_Scrollbar *s;
+ Ewl_Scrollbar *s;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- s = NEW(Ewl_Scrollbar, 1);
- if (!s)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ s = NEW(Ewl_Scrollbar, 1);
+ if (!s)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- /*
- * Initialize the objects fields.
- */
- if (!ewl_scrollbar_init(s)) {
- ewl_widget_destroy(EWL_WIDGET(s));
- s = NULL;
- }
+ /*
+ * Initialize the objects fields.
+ */
+ if (!ewl_scrollbar_init(s)) {
+ ewl_widget_destroy(EWL_WIDGET(s));
+ s = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
}
/**
@@ -43,18 +43,18 @@ ewl_scrollbar_new(void)
Ewl_Widget *
ewl_hscrollbar_new(void)
{
- Ewl_Widget *s;
+ Ewl_Widget *s;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- s = ewl_scrollbar_new();
- if (!s)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ s = ewl_scrollbar_new();
+ if (!s)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- ewl_scrollbar_orientation_set(EWL_SCROLLBAR(s),
- EWL_ORIENTATION_HORIZONTAL);
+ ewl_scrollbar_orientation_set(EWL_SCROLLBAR(s),
+ EWL_ORIENTATION_HORIZONTAL);
- DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
}
/**
@@ -64,18 +64,18 @@ ewl_hscrollbar_new(void)
Ewl_Widget *
ewl_vscrollbar_new(void)
{
- Ewl_Widget *s;
+ Ewl_Widget *s;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- s = ewl_scrollbar_new();
- if (!s)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ s = ewl_scrollbar_new();
+ if (!s)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- ewl_scrollbar_orientation_set(EWL_SCROLLBAR(s),
- EWL_ORIENTATION_VERTICAL);
+ ewl_scrollbar_orientation_set(EWL_SCROLLBAR(s),
+ EWL_ORIENTATION_VERTICAL);
- DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
}
/**
@@ -86,138 +86,138 @@ ewl_vscrollbar_new(void)
int
ewl_scrollbar_init(Ewl_Scrollbar *s)
{
- Ewl_Widget *w;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, FALSE);
-
- w = EWL_WIDGET(s);
-
- if (!ewl_box_init(EWL_BOX(w)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- ewl_box_orientation_set(EWL_BOX(w), EWL_ORIENTATION_HORIZONTAL);
- ewl_widget_appearance_set(w, "hscrollbar");
- ewl_widget_inherit(w, EWL_SCROLLBAR_TYPE);
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_HFILL |
- EWL_FLAG_FILL_HSHRINK);
-
- /*
- * Create the basic widgets that are contained in the scrollbar.
- */
- s->decrement = ewl_button_new();
- ewl_widget_internal_set(s->decrement, TRUE);
- ewl_object_alignment_set(EWL_OBJECT(s->decrement),
- EWL_FLAG_ALIGN_CENTER);
- ewl_object_fill_policy_set(EWL_OBJECT(s->decrement),
- EWL_FLAG_FILL_NONE);
- ewl_widget_show(s->decrement);
-
- /*
- * Create the increment button.
- */
- s->increment = ewl_button_new();
- ewl_widget_internal_set(s->increment, TRUE);
- ewl_object_alignment_set(EWL_OBJECT(s->increment),
- EWL_FLAG_ALIGN_CENTER);
- ewl_object_fill_policy_set(EWL_OBJECT(s->increment),
- EWL_FLAG_FILL_NONE);
- ewl_widget_show(s->increment);
-
- /*
- * Setup the seeker portion
- */
- s->seeker = ewl_hseeker_new();
- ewl_widget_internal_set(s->seeker, TRUE);
- ewl_object_alignment_set(EWL_OBJECT(s->seeker), EWL_FLAG_ALIGN_CENTER);
- ewl_object_fill_policy_set(EWL_OBJECT(s->seeker),
- EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_HSHRINK);
- ewl_widget_show(s->seeker);
-
- /*
- * Attach callbacks to the buttons and seeker to handle the various
- * events.
- */
- ewl_callback_append(s->increment, EWL_CALLBACK_MOUSE_DOWN,
- ewl_scrollbar_cb_scroll_start, s);
- ewl_callback_append(s->increment, EWL_CALLBACK_MOUSE_UP,
- ewl_scrollbar_cb_scroll_stop, s);
- ewl_callback_append(s->decrement, EWL_CALLBACK_MOUSE_DOWN,
- ewl_scrollbar_cb_scroll_start, s);
- ewl_callback_append(s->decrement, EWL_CALLBACK_MOUSE_UP,
- ewl_scrollbar_cb_scroll_stop, s);
- ewl_callback_append(s->decrement, EWL_CALLBACK_DESTROY,
- ewl_scrollbar_cb_scroll_stop, s);
-
- /*
- * Set the default alignment for the buttons.
- */
- ewl_object_alignment_set(EWL_OBJECT(s->decrement),
- EWL_FLAG_ALIGN_CENTER);
- ewl_object_alignment_set(EWL_OBJECT(s->increment),
- EWL_FLAG_ALIGN_CENTER);
-
- /*
- * Set the default amount of space that the seeker should fill.
- */
- s->fill_percentage = 1.0;
-
- /*
- * Set the default for horizontal standard scrolling
- */
- s->invert = 1;
-
- /*
- * Append a value change callback to the seeker to catch when it
- * moves.
- */
- ewl_container_callback_notify(EWL_CONTAINER(s),
- EWL_CALLBACK_VALUE_CHANGED);
-
- /*
- * Define the maximum value that the seeker can reach, and the
- * default increments it takes to get there.
- */
- ewl_range_maximum_value_set(EWL_RANGE(s->seeker), 1.0);
- ewl_range_step_set(EWL_RANGE(s->seeker), 0.05);
-
- /*
- * Set the appearance strings for the parts of the scrollbar
- */
- ewl_widget_appearance_set(s->decrement, "decrement");
- ewl_widget_appearance_set(s->increment, "increment");
-
- if (s->buttons_alignment & EWL_FLAG_ALIGN_LEFT) {
- /*
- * Place in decrement, increment, seeker order.
- */
- ewl_container_child_append(EWL_CONTAINER(s), s->decrement);
- ewl_container_child_append(EWL_CONTAINER(s), s->increment);
- ewl_container_child_append(EWL_CONTAINER(s), s->seeker);
- }
- else if (s->buttons_alignment & EWL_FLAG_ALIGN_RIGHT) {
- /*
- * Place in seeker, decrement, increment order.
- */
- ewl_container_child_append(EWL_CONTAINER(s), s->seeker);
- ewl_container_child_append(EWL_CONTAINER(s), s->decrement);
- ewl_container_child_append(EWL_CONTAINER(s), s->increment);
- }
- else {
- /*
- * Place in decrement, seeker, increment order.
- */
- ewl_container_child_append(EWL_CONTAINER(s), s->decrement);
- ewl_container_child_append(EWL_CONTAINER(s), s->seeker);
- ewl_container_child_append(EWL_CONTAINER(s), s->increment);
- }
-
- /*
- * Set the default value to the beginning of the seeker.
- */
- ewl_range_value_set(EWL_RANGE(s->seeker), 0.0);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Widget *w;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, FALSE);
+
+ w = EWL_WIDGET(s);
+
+ if (!ewl_box_init(EWL_BOX(w)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ ewl_box_orientation_set(EWL_BOX(w), EWL_ORIENTATION_HORIZONTAL);
+ ewl_widget_appearance_set(w, "hscrollbar");
+ ewl_widget_inherit(w, EWL_SCROLLBAR_TYPE);
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_HFILL |
+ EWL_FLAG_FILL_HSHRINK);
+
+ /*
+ * Create the basic widgets that are contained in the scrollbar.
+ */
+ s->decrement = ewl_button_new();
+ ewl_widget_internal_set(s->decrement, TRUE);
+ ewl_object_alignment_set(EWL_OBJECT(s->decrement),
+ EWL_FLAG_ALIGN_CENTER);
+ ewl_object_fill_policy_set(EWL_OBJECT(s->decrement),
+ EWL_FLAG_FILL_NONE);
+ ewl_widget_show(s->decrement);
+
+ /*
+ * Create the increment button.
+ */
+ s->increment = ewl_button_new();
+ ewl_widget_internal_set(s->increment, TRUE);
+ ewl_object_alignment_set(EWL_OBJECT(s->increment),
+ EWL_FLAG_ALIGN_CENTER);
+ ewl_object_fill_policy_set(EWL_OBJECT(s->increment),
+ EWL_FLAG_FILL_NONE);
+ ewl_widget_show(s->increment);
+
+ /*
+ * Setup the seeker portion
+ */
+ s->seeker = ewl_hseeker_new();
+ ewl_widget_internal_set(s->seeker, TRUE);
+ ewl_object_alignment_set(EWL_OBJECT(s->seeker), EWL_FLAG_ALIGN_CENTER);
+ ewl_object_fill_policy_set(EWL_OBJECT(s->seeker),
+ EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_HSHRINK);
+ ewl_widget_show(s->seeker);
+
+ /*
+ * Attach callbacks to the buttons and seeker to handle the various
+ * events.
+ */
+ ewl_callback_append(s->increment, EWL_CALLBACK_MOUSE_DOWN,
+ ewl_scrollbar_cb_scroll_start, s);
+ ewl_callback_append(s->increment, EWL_CALLBACK_MOUSE_UP,
+ ewl_scrollbar_cb_scroll_stop, s);
+ ewl_callback_append(s->decrement, EWL_CALLBACK_MOUSE_DOWN,
+ ewl_scrollbar_cb_scroll_start, s);
+ ewl_callback_append(s->decrement, EWL_CALLBACK_MOUSE_UP,
+ ewl_scrollbar_cb_scroll_stop, s);
+ ewl_callback_append(s->decrement, EWL_CALLBACK_DESTROY,
+ ewl_scrollbar_cb_scroll_stop, s);
+
+ /*
+ * Set the default alignment for the buttons.
+ */
+ ewl_object_alignment_set(EWL_OBJECT(s->decrement),
+ EWL_FLAG_ALIGN_CENTER);
+ ewl_object_alignment_set(EWL_OBJECT(s->increment),
+ EWL_FLAG_ALIGN_CENTER);
+
+ /*
+ * Set the default amount of space that the seeker should fill.
+ */
+ s->fill_percentage = 1.0;
+
+ /*
+ * Set the default for horizontal standard scrolling
+ */
+ s->invert = 1;
+
+ /*
+ * Append a value change callback to the seeker to catch when it
+ * moves.
+ */
+ ewl_container_callback_notify(EWL_CONTAINER(s),
+ EWL_CALLBACK_VALUE_CHANGED);
+
+ /*
+ * Define the maximum value that the seeker can reach, and the
+ * default increments it takes to get there.
+ */
+ ewl_range_maximum_value_set(EWL_RANGE(s->seeker), 1.0);
+ ewl_range_step_set(EWL_RANGE(s->seeker), 0.05);
+
+ /*
+ * Set the appearance strings for the parts of the scrollbar
+ */
+ ewl_widget_appearance_set(s->decrement, "decrement");
+ ewl_widget_appearance_set(s->increment, "increment");
+
+ if (s->buttons_alignment & EWL_FLAG_ALIGN_LEFT) {
+ /*
+ * Place in decrement, increment, seeker order.
+ */
+ ewl_container_child_append(EWL_CONTAINER(s), s->decrement);
+ ewl_container_child_append(EWL_CONTAINER(s), s->increment);
+ ewl_container_child_append(EWL_CONTAINER(s), s->seeker);
+ }
+ else if (s->buttons_alignment & EWL_FLAG_ALIGN_RIGHT) {
+ /*
+ * Place in seeker, decrement, increment order.
+ */
+ ewl_container_child_append(EWL_CONTAINER(s), s->seeker);
+ ewl_container_child_append(EWL_CONTAINER(s), s->decrement);
+ ewl_container_child_append(EWL_CONTAINER(s), s->increment);
+ }
+ else {
+ /*
+ * Place in decrement, seeker, increment order.
+ */
+ ewl_container_child_append(EWL_CONTAINER(s), s->decrement);
+ ewl_container_child_append(EWL_CONTAINER(s), s->seeker);
+ ewl_container_child_append(EWL_CONTAINER(s), s->increment);
+ }
+
+ /*
+ * Set the default value to the beginning of the seeker.
+ */
+ ewl_range_value_set(EWL_RANGE(s->seeker), 0.0);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -229,117 +229,117 @@ ewl_scrollbar_init(Ewl_Scrollbar *s)
void
ewl_scrollbar_orientation_set(Ewl_Scrollbar *s, Ewl_Orientation o)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(s);
- DCHECK_TYPE(s, EWL_SCROLLBAR_TYPE);
-
- if (o == ewl_box_orientation_get(EWL_BOX(s)))
- DRETURN(DLEVEL_STABLE);
-
- ewl_box_orientation_set(EWL_BOX(s), o);
-
- /*
- * Swap scroll direction on orientation change
- */
- s->invert = -s->invert;
-
- if (o == EWL_ORIENTATION_HORIZONTAL) {
- ewl_widget_appearance_set(EWL_WIDGET(s), "hscrollbar");
- ewl_object_fill_policy_set(EWL_OBJECT(s),
- EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_HSHRINK);
- ewl_object_fill_policy_set(EWL_OBJECT(s->seeker),
- EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_HSHRINK);
- }
- else {
- ewl_widget_appearance_set(EWL_WIDGET(s), "vscrollbar");
- ewl_object_fill_policy_set(EWL_OBJECT(s),
- EWL_FLAG_FILL_VFILL | EWL_FLAG_FILL_VSHRINK);
- ewl_object_fill_policy_set(EWL_OBJECT(s->seeker),
- EWL_FLAG_FILL_VFILL | EWL_FLAG_FILL_VSHRINK);
- }
-
- /*
- * Set the alignment of the buttons to the seeker.
- */
- s->buttons_alignment = ewl_theme_data_int_get(EWL_WIDGET(s),
- "button_order");
-
- ewl_container_child_remove(EWL_CONTAINER(s), s->decrement);
- ewl_container_child_remove(EWL_CONTAINER(s), s->increment);
- ewl_container_child_remove(EWL_CONTAINER(s), s->seeker);
-
- ewl_seeker_orientation_set(EWL_SEEKER(s->seeker), o);
-
- /*
- * Setup a few orientation specific variables, such as appearance and
- * packing order.
- */
- if (o == EWL_ORIENTATION_HORIZONTAL) {
- if (s->buttons_alignment & EWL_FLAG_ALIGN_LEFT) {
- /*
- * Place in decrement, increment, seeker order.
- */
- ewl_container_child_append(EWL_CONTAINER(s),
- s->decrement);
- ewl_container_child_append(EWL_CONTAINER(s),
- s->increment);
- ewl_container_child_append(EWL_CONTAINER(s), s->seeker);
- }
- else if (s->buttons_alignment & EWL_FLAG_ALIGN_RIGHT) {
- /*
- * Place in seeker, decrement, increment order.
- */
- ewl_container_child_append(EWL_CONTAINER(s), s->seeker);
- ewl_container_child_append(EWL_CONTAINER(s),
- s->decrement);
- ewl_container_child_append(EWL_CONTAINER(s),
- s->increment);
- }
- else {
- /*
- * Place in decrement, seeker, increment order.
- */
- ewl_container_child_append(EWL_CONTAINER(s),
- s->decrement);
- ewl_container_child_append(EWL_CONTAINER(s), s->seeker);
- ewl_container_child_append(EWL_CONTAINER(s),
- s->increment);
- }
- }
- else {
- if (s->buttons_alignment & EWL_FLAG_ALIGN_TOP) {
- /*
- * Place in increment, decrement, seeker order.
- */
- ewl_container_child_append(EWL_CONTAINER(s),
- s->increment);
- ewl_container_child_append(EWL_CONTAINER(s),
- s->decrement);
- ewl_container_child_append(EWL_CONTAINER(s), s->seeker);
- }
- else if (s->buttons_alignment & EWL_FLAG_ALIGN_BOTTOM) {
- /*
- * Place in seeker, increment, decrement order.
- */
- ewl_container_child_append(EWL_CONTAINER(s), s->seeker);
- ewl_container_child_append(EWL_CONTAINER(s),
- s->increment);
- ewl_container_child_append(EWL_CONTAINER(s),
- s->decrement);
- }
- else {
- /*
- * Place in increment, seeker, decrement order.
- */
- ewl_container_child_append(EWL_CONTAINER(s),
- s->increment);
- ewl_container_child_append(EWL_CONTAINER(s), s->seeker);
- ewl_container_child_append(EWL_CONTAINER(s),
- s->decrement);
- }
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(s);
+ DCHECK_TYPE(s, EWL_SCROLLBAR_TYPE);
+
+ if (o == ewl_box_orientation_get(EWL_BOX(s)))
+ DRETURN(DLEVEL_STABLE);
+
+ ewl_box_orientation_set(EWL_BOX(s), o);
+
+ /*
+ * Swap scroll direction on orientation change
+ */
+ s->invert = -s->invert;
+
+ if (o == EWL_ORIENTATION_HORIZONTAL) {
+ ewl_widget_appearance_set(EWL_WIDGET(s), "hscrollbar");
+ ewl_object_fill_policy_set(EWL_OBJECT(s),
+ EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_HSHRINK);
+ ewl_object_fill_policy_set(EWL_OBJECT(s->seeker),
+ EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_HSHRINK);
+ }
+ else {
+ ewl_widget_appearance_set(EWL_WIDGET(s), "vscrollbar");
+ ewl_object_fill_policy_set(EWL_OBJECT(s),
+ EWL_FLAG_FILL_VFILL | EWL_FLAG_FILL_VSHRINK);
+ ewl_object_fill_policy_set(EWL_OBJECT(s->seeker),
+ EWL_FLAG_FILL_VFILL | EWL_FLAG_FILL_VSHRINK);
+ }
+
+ /*
+ * Set the alignment of the buttons to the seeker.
+ */
+ s->buttons_alignment = ewl_theme_data_int_get(EWL_WIDGET(s),
+ "button_order");
+
+ ewl_container_child_remove(EWL_CONTAINER(s), s->decrement);
+ ewl_container_child_remove(EWL_CONTAINER(s), s->increment);
+ ewl_container_child_remove(EWL_CONTAINER(s), s->seeker);
+
+ ewl_seeker_orientation_set(EWL_SEEKER(s->seeker), o);
+
+ /*
+ * Setup a few orientation specific variables, such as appearance and
+ * packing order.
+ */
+ if (o == EWL_ORIENTATION_HORIZONTAL) {
+ if (s->buttons_alignment & EWL_FLAG_ALIGN_LEFT) {
+ /*
+ * Place in decrement, increment, seeker order.
+ */
+ ewl_container_child_append(EWL_CONTAINER(s),
+ s->decrement);
+ ewl_container_child_append(EWL_CONTAINER(s),
+ s->increment);
+ ewl_container_child_append(EWL_CONTAINER(s), s->seeker);
+ }
+ else if (s->buttons_alignment & EWL_FLAG_ALIGN_RIGHT) {
+ /*
+ * Place in seeker, decrement, increment order.
+ */
+ ewl_container_child_append(EWL_CONTAINER(s), s->seeker);
+ ewl_container_child_append(EWL_CONTAINER(s),
+ s->decrement);
+ ewl_container_child_append(EWL_CONTAINER(s),
+ s->increment);
+ }
+ else {
+ /*
+ * Place in decrement, seeker, increment order.
+ */
+ ewl_container_child_append(EWL_CONTAINER(s),
+ s->decrement);
+ ewl_container_child_append(EWL_CONTAINER(s), s->seeker);
+ ewl_container_child_append(EWL_CONTAINER(s),
+ s->increment);
+ }
+ }
+ else {
+ if (s->buttons_alignment & EWL_FLAG_ALIGN_TOP) {
+ /*
+ * Place in increment, decrement, seeker order.
+ */
+ ewl_container_child_append(EWL_CONTAINER(s),
+ s->increment);
+ ewl_container_child_append(EWL_CONTAINER(s),
+ s->decrement);
+ ewl_container_child_append(EWL_CONTAINER(s), s->seeker);
+ }
+ else if (s->buttons_alignment & EWL_FLAG_ALIGN_BOTTOM) {
+ /*
+ * Place in seeker, increment, decrement order.
+ */
+ ewl_container_child_append(EWL_CONTAINER(s), s->seeker);
+ ewl_container_child_append(EWL_CONTAINER(s),
+ s->increment);
+ ewl_container_child_append(EWL_CONTAINER(s),
+ s->decrement);
+ }
+ else {
+ /*
+ * Place in increment, seeker, decrement order.
+ */
+ ewl_container_child_append(EWL_CONTAINER(s),
+ s->increment);
+ ewl_container_child_append(EWL_CONTAINER(s), s->seeker);
+ ewl_container_child_append(EWL_CONTAINER(s),
+ s->decrement);
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -350,11 +350,11 @@ ewl_scrollbar_orientation_set(Ewl_Scrollbar *s, Ewl_Orientation o)
Ewl_Orientation
ewl_scrollbar_orientation_get(Ewl_Scrollbar *s)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, EWL_ORIENTATION_HORIZONTAL);
- DCHECK_TYPE_RET(s, EWL_SCROLLBAR_TYPE, EWL_ORIENTATION_HORIZONTAL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, EWL_ORIENTATION_HORIZONTAL);
+ DCHECK_TYPE_RET(s, EWL_SCROLLBAR_TYPE, EWL_ORIENTATION_HORIZONTAL);
- DRETURN_INT(ewl_box_orientation_get(EWL_BOX(s)), DLEVEL_STABLE);
+ DRETURN_INT(ewl_box_orientation_get(EWL_BOX(s)), DLEVEL_STABLE);
}
/**
@@ -366,16 +366,16 @@ ewl_scrollbar_orientation_get(Ewl_Scrollbar *s)
void
ewl_scrollbar_inverse_scroll_set(Ewl_Scrollbar *s, char i)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(s);
- DCHECK_TYPE(s, EWL_SCROLLBAR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(s);
+ DCHECK_TYPE(s, EWL_SCROLLBAR_TYPE);
- if (i >= 0) i = 1;
- else i = -1;
+ if (i >= 0) i = 1;
+ else i = -1;
- s->direction = i;
+ s->direction = i;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -386,11 +386,11 @@ ewl_scrollbar_inverse_scroll_set(Ewl_Scrollbar *s, char i)
char
ewl_scrollbar_inverse_scroll_get(Ewl_Scrollbar *s)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, 1);
- DCHECK_TYPE_RET(s, EWL_SCROLLBAR_TYPE, 1);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, 1);
+ DCHECK_TYPE_RET(s, EWL_SCROLLBAR_TYPE, 1);
- DRETURN_INT(s->invert, DLEVEL_STABLE);
+ DRETURN_INT(s->invert, DLEVEL_STABLE);
}
/**
@@ -401,15 +401,15 @@ ewl_scrollbar_inverse_scroll_get(Ewl_Scrollbar *s)
double
ewl_scrollbar_value_get(Ewl_Scrollbar *s)
{
- double v;
+ double v;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, -1);
- DCHECK_TYPE_RET(s, EWL_SCROLLBAR_TYPE, -1);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, -1);
+ DCHECK_TYPE_RET(s, EWL_SCROLLBAR_TYPE, -1);
- v = ewl_range_value_get(EWL_RANGE(s->seeker));
+ v = ewl_range_value_get(EWL_RANGE(s->seeker));
- DRETURN_FLOAT(v, DLEVEL_STABLE);
+ DRETURN_FLOAT(v, DLEVEL_STABLE);
}
/**
@@ -423,13 +423,13 @@ ewl_scrollbar_value_get(Ewl_Scrollbar *s)
void
ewl_scrollbar_value_set(Ewl_Scrollbar *s, double v)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(s);
- DCHECK_TYPE(s, EWL_SCROLLBAR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(s);
+ DCHECK_TYPE(s, EWL_SCROLLBAR_TYPE);
- ewl_range_value_set(EWL_RANGE(s->seeker), v);
+ ewl_range_value_set(EWL_RANGE(s->seeker), v);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -440,11 +440,11 @@ ewl_scrollbar_value_set(Ewl_Scrollbar *s, double v)
double
ewl_scrollbar_step_get(Ewl_Scrollbar *s)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, 0);
- DCHECK_TYPE_RET(s, EWL_SCROLLBAR_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, 0);
+ DCHECK_TYPE_RET(s, EWL_SCROLLBAR_TYPE, 0);
- DRETURN_INT(ewl_range_step_get(EWL_RANGE(s->seeker)), DLEVEL_STABLE);
+ DRETURN_INT(ewl_range_step_get(EWL_RANGE(s->seeker)), DLEVEL_STABLE);
}
/**
@@ -458,13 +458,13 @@ ewl_scrollbar_step_get(Ewl_Scrollbar *s)
void
ewl_scrollbar_step_set(Ewl_Scrollbar *s, double v)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(s);
- DCHECK_TYPE(s, EWL_SCROLLBAR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(s);
+ DCHECK_TYPE(s, EWL_SCROLLBAR_TYPE);
- ewl_range_step_set(EWL_RANGE(s->seeker), v);
+ ewl_range_step_set(EWL_RANGE(s->seeker), v);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -477,34 +477,34 @@ ewl_scrollbar_step_set(Ewl_Scrollbar *s, double v)
*/
void
ewl_scrollbar_cb_scroll_start(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data)
+ void *user_data)
{
- Ewl_Scrollbar *s;
- Ewl_Orientation o;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(user_data);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- DCHECK_TYPE(user_data, EWL_SCROLLBAR_TYPE);
-
- s = EWL_SCROLLBAR(user_data);
- if (w == s->increment)
- s->direction = 1;
- else
- s->direction = -1;
-
- /*
- * Need to scroll in the opposite direction for the vertical
- * scrollbar.
- */
- o = ewl_box_orientation_get(EWL_BOX(s));
- s->direction = s->direction * s->invert;
-
- s->start_time = ecore_time_get();
- s->timer = ecore_timer_add(0.02, ewl_scrollbar_timer, s);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Scrollbar *s;
+ Ewl_Orientation o;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(user_data);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DCHECK_TYPE(user_data, EWL_SCROLLBAR_TYPE);
+
+ s = EWL_SCROLLBAR(user_data);
+ if (w == s->increment)
+ s->direction = 1;
+ else
+ s->direction = -1;
+
+ /*
+ * Need to scroll in the opposite direction for the vertical
+ * scrollbar.
+ */
+ o = ewl_box_orientation_get(EWL_BOX(s));
+ s->direction = s->direction * s->invert;
+
+ s->start_time = ecore_time_get();
+ s->timer = ecore_timer_add(0.02, ewl_scrollbar_timer, s);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -517,60 +517,60 @@ ewl_scrollbar_cb_scroll_start(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_scrollbar_cb_scroll_stop(Ewl_Widget *w __UNUSED__,
- void *ev_data __UNUSED__, void *user_data)
+ void *ev_data __UNUSED__, void *user_data)
{
- Ewl_Scrollbar *s;
+ Ewl_Scrollbar *s;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(user_data);
- DCHECK_TYPE(user_data, EWL_SCROLLBAR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(user_data);
+ DCHECK_TYPE(user_data, EWL_SCROLLBAR_TYPE);
- s = EWL_SCROLLBAR(user_data);
+ s = EWL_SCROLLBAR(user_data);
- if (s->timer)
- ecore_timer_del(s->timer);
+ if (s->timer)
+ ecore_timer_del(s->timer);
- s->timer = NULL;
- s->direction = 0;
- s->start_time = 0;
+ s->timer = NULL;
+ s->direction = 0;
+ s->start_time = 0;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static int
ewl_scrollbar_timer(void *data)
{
- Ewl_Scrollbar *s;
- double dt;
- double value;
- int velocity;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, ECORE_CALLBACK_CANCEL);
-
- s = EWL_SCROLLBAR(data);
-
- dt = ecore_time_get() - s->start_time;
- value = ewl_range_value_get(EWL_RANGE(s->seeker));
-
- /*
- * Check the theme for a velocity setting and bring it within normal
- * useable bounds.
- */
- velocity = ewl_theme_data_int_get(EWL_WIDGET(s), "velocity");
- if (velocity < 1)
- velocity = 1;
- else if (velocity > 10)
- velocity = 10;
-
- /*
- * Move the value of the seeker based on the direction of it's motion
- * and the velocity setting.
- */
- value += (double)(s->direction) * 10 * (1 - exp(-dt)) *
- ((double)(velocity) / 100.0);
-
- ewl_range_value_set(EWL_RANGE(s->seeker), value);
-
- DRETURN_INT(ECORE_CALLBACK_RENEW, DLEVEL_STABLE);
+ Ewl_Scrollbar *s;
+ double dt;
+ double value;
+ int velocity;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, ECORE_CALLBACK_CANCEL);
+
+ s = EWL_SCROLLBAR(data);
+
+ dt = ecore_time_get() - s->start_time;
+ value = ewl_range_value_get(EWL_RANGE(s->seeker));
+
+ /*
+ * Check the theme for a velocity setting and bring it within normal
+ * useable bounds.
+ */
+ velocity = ewl_theme_data_int_get(EWL_WIDGET(s), "velocity");
+ if (velocity < 1)
+ velocity = 1;
+ else if (velocity > 10)
+ velocity = 10;
+
+ /*
+ * Move the value of the seeker based on the direction of it's motion
+ * and the velocity setting.
+ */
+ value += (double)(s->direction) * 10 * (1 - exp(-dt)) *
+ ((double)(velocity) / 100.0);
+
+ ewl_range_value_set(EWL_RANGE(s->seeker), value);
+
+ DRETURN_INT(ECORE_CALLBACK_RENEW, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_scrollbar.h b/src/lib/ewl_scrollbar.h
index e220bdb..b59fafd 100644
--- a/src/lib/ewl_scrollbar.h
+++ b/src/lib/ewl_scrollbar.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_SCROLLBAR_H
#define EWL_SCROLLBAR_H
@@ -62,43 +62,43 @@ typedef struct Ewl_Scrollbar Ewl_Scrollbar;
*/
struct Ewl_Scrollbar
{
- Ewl_Box box; /**< Inherit from Ewl_Box */
-
- Ewl_Widget *seeker; /**< The internal Ewl_Seeker */
- Ewl_Widget *decrement; /**< The internal decrement button */
- Ewl_Widget *increment; /**< The internal increment button */
- unsigned int buttons_alignment; /**< The ordering of buttons */
-
- double fill_percentage; /**< Ratio of size for draggable */
- double start_time; /**< Time scrolling began */
- Ecore_Timer *timer; /**< Repeating timer for scrolling */
- signed char direction; /**< Direction for the scrollbar */
- signed char invert; /**< Invert the scrolling direction */
+ Ewl_Box box; /**< Inherit from Ewl_Box */
+
+ Ewl_Widget *seeker; /**< The internal Ewl_Seeker */
+ Ewl_Widget *decrement; /**< The internal decrement button */
+ Ewl_Widget *increment; /**< The internal increment button */
+ unsigned int buttons_alignment; /**< The ordering of buttons */
+
+ double fill_percentage; /**< Ratio of size for draggable */
+ double start_time; /**< Time scrolling began */
+ Ecore_Timer *timer; /**< Repeating timer for scrolling */
+ signed char direction; /**< Direction for the scrollbar */
+ signed char invert; /**< Invert the scrolling direction */
};
-Ewl_Widget *ewl_scrollbar_new(void);
-Ewl_Widget *ewl_hscrollbar_new(void);
-Ewl_Widget *ewl_vscrollbar_new(void);
-int ewl_scrollbar_init(Ewl_Scrollbar *s);
+Ewl_Widget *ewl_scrollbar_new(void);
+Ewl_Widget *ewl_hscrollbar_new(void);
+Ewl_Widget *ewl_vscrollbar_new(void);
+int ewl_scrollbar_init(Ewl_Scrollbar *s);
-void ewl_scrollbar_orientation_set(Ewl_Scrollbar *s,
- Ewl_Orientation orientation);
+void ewl_scrollbar_orientation_set(Ewl_Scrollbar *s,
+ Ewl_Orientation orientation);
Ewl_Orientation ewl_scrollbar_orientation_get(Ewl_Scrollbar *s);
-char ewl_scrollbar_inverse_scroll_get(Ewl_Scrollbar *s);
-void ewl_scrollbar_inverse_scroll_set(Ewl_Scrollbar *s, char v);
-double ewl_scrollbar_value_get(Ewl_Scrollbar *s);
-void ewl_scrollbar_value_set(Ewl_Scrollbar *s, double v);
+char ewl_scrollbar_inverse_scroll_get(Ewl_Scrollbar *s);
+void ewl_scrollbar_inverse_scroll_set(Ewl_Scrollbar *s, char v);
+double ewl_scrollbar_value_get(Ewl_Scrollbar *s);
+void ewl_scrollbar_value_set(Ewl_Scrollbar *s, double v);
-double ewl_scrollbar_step_get(Ewl_Scrollbar *s);
-void ewl_scrollbar_step_set(Ewl_Scrollbar *s, double v);
+double ewl_scrollbar_step_get(Ewl_Scrollbar *s);
+void ewl_scrollbar_step_set(Ewl_Scrollbar *s, double v);
/*
* Internally used callbacks, override at your own risk.
*/
void ewl_scrollbar_cb_scroll_start(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
void ewl_scrollbar_cb_scroll_stop(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
/**
* @}
diff --git a/src/lib/ewl_scrollpane.c b/src/lib/ewl_scrollpane.c
index dee7de6..1a4b023 100644
--- a/src/lib/ewl_scrollpane.c
+++ b/src/lib/ewl_scrollpane.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_overlay.h"
#include "ewl_scrollpane.h"
@@ -25,12 +25,12 @@ typedef struct Ewl_Scrollpane_Scroll_Info_Normal Ewl_Scrollpane_Scroll_Info_Norm
*/
struct Ewl_Scrollpane_Scroll_Info_Normal
{
- int x;
- int y;
- int xc;
- int yc;
- double vel_x;
- double vel_y;
+ int x;
+ int y;
+ int xc;
+ int yc;
+ double vel_x;
+ double vel_y;
};
typedef struct Ewl_Scrollpane_Scroll_Info_Embedded Ewl_Scrollpane_Scroll_Info_Embedded;
@@ -40,18 +40,18 @@ typedef struct Ewl_Scrollpane_Scroll_Info_Embedded Ewl_Scrollpane_Scroll_Info_Em
*/
struct Ewl_Scrollpane_Scroll_Info_Embedded
{
- int xs;
- int ys;
- double vel_x;
- double vel_y;
- double at;
-
- struct
- {
- int x;
- int y;
- double time;
- } back[HIST_NUM];
+ int xs;
+ int ys;
+ double vel_x;
+ double vel_y;
+ double at;
+
+ struct
+ {
+ int x;
+ int y;
+ double time;
+ } back[HIST_NUM];
};
/* Iphonish (embedded) scrolling functions */
@@ -60,7 +60,7 @@ static void ewl_scrollpane_cb_mouse_up_embedded(Ewl_Widget *w, void *ev, void *d
static void ewl_scrollpane_cb_mouse_move_embedded(Ewl_Widget *w, void *ev, void *data);
static int ewl_scrollpane_cb_scroll_timer_embedded(void *data);
static void ewl_scrollpane_cb_scroll(Ewl_Scrollpane *s, double x, double y,
- int *tx, int *ty);
+ int *tx, int *ty);
static void ewl_scrollpane_cb_destroy(Ewl_Widget *w, void *ev, void *data);
/**
@@ -70,20 +70,20 @@ static void ewl_scrollpane_cb_destroy(Ewl_Widget *w, void *ev, void *data);
Ewl_Widget *
ewl_scrollpane_new(void)
{
- Ewl_Scrollpane *s;
+ Ewl_Scrollpane *s;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- s = NEW(Ewl_Scrollpane, 1);
- if (!s)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ s = NEW(Ewl_Scrollpane, 1);
+ if (!s)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_scrollpane_init(s)) {
- ewl_widget_destroy(EWL_WIDGET(s));
- s = NULL;
- }
+ if (!ewl_scrollpane_init(s)) {
+ ewl_widget_destroy(EWL_WIDGET(s));
+ s = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
}
/**
@@ -96,106 +96,106 @@ ewl_scrollpane_new(void)
int
ewl_scrollpane_init(Ewl_Scrollpane *s)
{
- Ewl_Widget *w;
- const char *kst;
- Ewl_Kinetic_Scroll type;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, FALSE);
-
- w = EWL_WIDGET(s);
-
- if (!ewl_container_init(EWL_CONTAINER(s)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- ewl_widget_appearance_set(w, EWL_SCROLLPANE_TYPE);
- ewl_widget_inherit(w, EWL_SCROLLPANE_TYPE);
- ewl_widget_focusable_set(EWL_WIDGET(s), TRUE);
- ewl_object_fill_policy_set(EWL_OBJECT(s), EWL_FLAG_FILL_ALL);
-
- ewl_container_callback_notify(EWL_CONTAINER(s), EWL_CALLBACK_FOCUS_IN);
- ewl_container_callback_notify(EWL_CONTAINER(s), EWL_CALLBACK_FOCUS_OUT);
-
- /* Remove the default focus out callback and replace with our own */
- ewl_callback_del(w, EWL_CALLBACK_FOCUS_OUT, ewl_widget_cb_focus_out);
- ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT,
- ewl_container_cb_container_focus_out, NULL);
-
-
- s->hflag = EWL_SCROLLPANE_FLAG_AUTO_VISIBLE;
- s->vflag = EWL_SCROLLPANE_FLAG_AUTO_VISIBLE;
-
- s->overlay = ewl_overlay_new();
- ewl_object_fill_policy_set(EWL_OBJECT(s->overlay), EWL_FLAG_FILL_ALL);
- ewl_container_child_append(EWL_CONTAINER(s), s->overlay);
- ewl_widget_internal_set(s->overlay, TRUE);
- ewl_widget_show(s->overlay);
-
- /*
- * Create the container to hold the contents and it's configure
- * callback to position it's child.
- */
- s->box = ewl_vbox_new();
- ewl_object_fill_policy_set(EWL_OBJECT(s->box), EWL_FLAG_FILL_FILL);
- ewl_container_child_append(EWL_CONTAINER(s->overlay), s->box);
- ewl_widget_internal_set(s->box, TRUE);
- ewl_widget_show(s->box);
-
- /*
- * Create the scrollbars for the scrollpane.
- */
- s->hscrollbar = ewl_hscrollbar_new();
- ewl_container_child_append(EWL_CONTAINER(s), s->hscrollbar);
- ewl_widget_internal_set(s->hscrollbar, TRUE);
- ewl_widget_show(s->hscrollbar);
-
- s->vscrollbar = ewl_vscrollbar_new();
- ewl_widget_internal_set(s->vscrollbar, TRUE);
- ewl_container_child_append(EWL_CONTAINER(s), s->vscrollbar);
- ewl_widget_show(s->vscrollbar);
-
- /* after we added our internal widgets we can redirect the
- * scrollpane to the content box */
- ewl_container_redirect_set(EWL_CONTAINER(s), EWL_CONTAINER(s->box));
-
- /*
- * Append necessary callbacks for the scrollpane.
- */
- ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
- ewl_scrollpane_cb_configure, NULL);
- ewl_callback_append(w, EWL_CALLBACK_FOCUS_IN,
- ewl_scrollpane_cb_focus_jump, NULL);
-
- /*
- * We need to know whent he scrollbars have value changes in order to
- * know when to scroll.
- */
- ewl_callback_append(s->hscrollbar, EWL_CALLBACK_VALUE_CHANGED,
- ewl_scrollpane_cb_hscroll, s);
- ewl_callback_append(s->vscrollbar, EWL_CALLBACK_VALUE_CHANGED,
- ewl_scrollpane_cb_vscroll, s);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_WHEEL,
- ewl_scrollpane_cb_wheel_scroll, NULL);
-
- /*
- * Setup kinetic scrolling info here
- */
- s->kinfo = NULL;
-
- kst = ewl_theme_data_str_get(w, "/scrollpane/kscroll_type");
-
- if (kst && !strcmp(kst, "embedded"))
- type = EWL_KINETIC_SCROLL_EMBEDDED;
- else if (kst && !strcmp(kst, "normal"))
- type = EWL_KINETIC_SCROLL_NORMAL;
- else
- type = EWL_KINETIC_SCROLL_NONE;
-
- ewl_scrollpane_kinetic_scrolling_set(s, type);
- ewl_callback_append(w, EWL_CALLBACK_DESTROY,
- ewl_scrollpane_cb_destroy, NULL);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Widget *w;
+ const char *kst;
+ Ewl_Kinetic_Scroll type;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, FALSE);
+
+ w = EWL_WIDGET(s);
+
+ if (!ewl_container_init(EWL_CONTAINER(s)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ ewl_widget_appearance_set(w, EWL_SCROLLPANE_TYPE);
+ ewl_widget_inherit(w, EWL_SCROLLPANE_TYPE);
+ ewl_widget_focusable_set(EWL_WIDGET(s), TRUE);
+ ewl_object_fill_policy_set(EWL_OBJECT(s), EWL_FLAG_FILL_ALL);
+
+ ewl_container_callback_notify(EWL_CONTAINER(s), EWL_CALLBACK_FOCUS_IN);
+ ewl_container_callback_notify(EWL_CONTAINER(s), EWL_CALLBACK_FOCUS_OUT);
+
+ /* Remove the default focus out callback and replace with our own */
+ ewl_callback_del(w, EWL_CALLBACK_FOCUS_OUT, ewl_widget_cb_focus_out);
+ ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT,
+ ewl_container_cb_container_focus_out, NULL);
+
+
+ s->hflag = EWL_SCROLLPANE_FLAG_AUTO_VISIBLE;
+ s->vflag = EWL_SCROLLPANE_FLAG_AUTO_VISIBLE;
+
+ s->overlay = ewl_overlay_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(s->overlay), EWL_FLAG_FILL_ALL);
+ ewl_container_child_append(EWL_CONTAINER(s), s->overlay);
+ ewl_widget_internal_set(s->overlay, TRUE);
+ ewl_widget_show(s->overlay);
+
+ /*
+ * Create the container to hold the contents and it's configure
+ * callback to position it's child.
+ */
+ s->box = ewl_vbox_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(s->box), EWL_FLAG_FILL_FILL);
+ ewl_container_child_append(EWL_CONTAINER(s->overlay), s->box);
+ ewl_widget_internal_set(s->box, TRUE);
+ ewl_widget_show(s->box);
+
+ /*
+ * Create the scrollbars for the scrollpane.
+ */
+ s->hscrollbar = ewl_hscrollbar_new();
+ ewl_container_child_append(EWL_CONTAINER(s), s->hscrollbar);
+ ewl_widget_internal_set(s->hscrollbar, TRUE);
+ ewl_widget_show(s->hscrollbar);
+
+ s->vscrollbar = ewl_vscrollbar_new();
+ ewl_widget_internal_set(s->vscrollbar, TRUE);
+ ewl_container_child_append(EWL_CONTAINER(s), s->vscrollbar);
+ ewl_widget_show(s->vscrollbar);
+
+ /* after we added our internal widgets we can redirect the
+ * scrollpane to the content box */
+ ewl_container_redirect_set(EWL_CONTAINER(s), EWL_CONTAINER(s->box));
+
+ /*
+ * Append necessary callbacks for the scrollpane.
+ */
+ ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
+ ewl_scrollpane_cb_configure, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_FOCUS_IN,
+ ewl_scrollpane_cb_focus_jump, NULL);
+
+ /*
+ * We need to know whent he scrollbars have value changes in order to
+ * know when to scroll.
+ */
+ ewl_callback_append(s->hscrollbar, EWL_CALLBACK_VALUE_CHANGED,
+ ewl_scrollpane_cb_hscroll, s);
+ ewl_callback_append(s->vscrollbar, EWL_CALLBACK_VALUE_CHANGED,
+ ewl_scrollpane_cb_vscroll, s);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_WHEEL,
+ ewl_scrollpane_cb_wheel_scroll, NULL);
+
+ /*
+ * Setup kinetic scrolling info here
+ */
+ s->kinfo = NULL;
+
+ kst = ewl_theme_data_str_get(w, "/scrollpane/kscroll_type");
+
+ if (kst && !strcmp(kst, "embedded"))
+ type = EWL_KINETIC_SCROLL_EMBEDDED;
+ else if (kst && !strcmp(kst, "normal"))
+ type = EWL_KINETIC_SCROLL_NORMAL;
+ else
+ type = EWL_KINETIC_SCROLL_NONE;
+
+ ewl_scrollpane_kinetic_scrolling_set(s, type);
+ ewl_callback_append(w, EWL_CALLBACK_DESTROY,
+ ewl_scrollpane_cb_destroy, NULL);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -207,72 +207,72 @@ ewl_scrollpane_init(Ewl_Scrollpane *s)
void
ewl_scrollpane_kinetic_scrolling_set(Ewl_Scrollpane *s, Ewl_Kinetic_Scroll type)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(s);
- DCHECK_TYPE(s, EWL_SCROLLPANE_TYPE);
-
- /* If set to current value we have nothing to do */
- if ((s->type) && (type == s->type))
- DRETURN(DLEVEL_STABLE);
-
- /* Remove all present callbacks and free the kinfo */
- if ((s->type == EWL_KINETIC_SCROLL_NORMAL) && (s->kinfo))
- {
- ewl_callback_del(s->overlay, EWL_CALLBACK_MOUSE_DOWN,
- ewl_scrollpane_cb_mouse_down_normal);
- ewl_callback_del(s->overlay, EWL_CALLBACK_MOUSE_UP,
- ewl_scrollpane_cb_mouse_up_normal);
- ewl_callback_del(s->overlay, EWL_CALLBACK_MOUSE_MOVE,
- ewl_scrollpane_cb_mouse_move_normal);
- }
-
- else if ((s->type == EWL_KINETIC_SCROLL_EMBEDDED) && (s->kinfo))
- {
- ewl_callback_del(s->overlay, EWL_CALLBACK_MOUSE_DOWN,
- ewl_scrollpane_cb_mouse_down_embedded);
- ewl_callback_del(s->overlay, EWL_CALLBACK_MOUSE_UP,
- ewl_scrollpane_cb_mouse_up_embedded);
- ewl_callback_del(s->overlay, EWL_CALLBACK_MOUSE_MOVE,
- ewl_scrollpane_cb_mouse_move_embedded);
- }
- if (s->kinfo)
- {
- IF_FREE(s->kinfo->extra)
- }
- else
- {
- s->kinfo = NEW(Ewl_Scrollpane_Scroll_Info_Base, 1);
- s->kinfo->fps = 15;
- s->kinfo->vmax = 50.0;
- s->kinfo->vmin = 0.0;
- s->kinfo->dampen = 0.95;
- }
-
- if (type == EWL_KINETIC_SCROLL_NORMAL)
- {
- ewl_callback_append(s->overlay, EWL_CALLBACK_MOUSE_DOWN,
- ewl_scrollpane_cb_mouse_down_normal, s);
- ewl_callback_append(s->overlay, EWL_CALLBACK_MOUSE_UP,
- ewl_scrollpane_cb_mouse_up_normal, s);
- ewl_callback_append(s->overlay, EWL_CALLBACK_MOUSE_MOVE,
- ewl_scrollpane_cb_mouse_move_normal, s);
- s->kinfo->extra = NEW(Ewl_Scrollpane_Scroll_Info_Normal, 1);
- }
-
- else if (type == EWL_KINETIC_SCROLL_EMBEDDED)
- {
- ewl_callback_append(s->overlay, EWL_CALLBACK_MOUSE_DOWN,
- ewl_scrollpane_cb_mouse_down_embedded, s);
- ewl_callback_append(s->overlay, EWL_CALLBACK_MOUSE_UP,
- ewl_scrollpane_cb_mouse_up_embedded, s);
- ewl_callback_append(s->overlay, EWL_CALLBACK_MOUSE_MOVE,
- ewl_scrollpane_cb_mouse_move_embedded, s);
-
- s->kinfo->extra = NEW(Ewl_Scrollpane_Scroll_Info_Embedded, 1);
- }
-
- s->type = type;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(s);
+ DCHECK_TYPE(s, EWL_SCROLLPANE_TYPE);
+
+ /* If set to current value we have nothing to do */
+ if ((s->type) && (type == s->type))
+ DRETURN(DLEVEL_STABLE);
+
+ /* Remove all present callbacks and free the kinfo */
+ if ((s->type == EWL_KINETIC_SCROLL_NORMAL) && (s->kinfo))
+ {
+ ewl_callback_del(s->overlay, EWL_CALLBACK_MOUSE_DOWN,
+ ewl_scrollpane_cb_mouse_down_normal);
+ ewl_callback_del(s->overlay, EWL_CALLBACK_MOUSE_UP,
+ ewl_scrollpane_cb_mouse_up_normal);
+ ewl_callback_del(s->overlay, EWL_CALLBACK_MOUSE_MOVE,
+ ewl_scrollpane_cb_mouse_move_normal);
+ }
+
+ else if ((s->type == EWL_KINETIC_SCROLL_EMBEDDED) && (s->kinfo))
+ {
+ ewl_callback_del(s->overlay, EWL_CALLBACK_MOUSE_DOWN,
+ ewl_scrollpane_cb_mouse_down_embedded);
+ ewl_callback_del(s->overlay, EWL_CALLBACK_MOUSE_UP,
+ ewl_scrollpane_cb_mouse_up_embedded);
+ ewl_callback_del(s->overlay, EWL_CALLBACK_MOUSE_MOVE,
+ ewl_scrollpane_cb_mouse_move_embedded);
+ }
+ if (s->kinfo)
+ {
+ IF_FREE(s->kinfo->extra)
+ }
+ else
+ {
+ s->kinfo = NEW(Ewl_Scrollpane_Scroll_Info_Base, 1);
+ s->kinfo->fps = 15;
+ s->kinfo->vmax = 50.0;
+ s->kinfo->vmin = 0.0;
+ s->kinfo->dampen = 0.95;
+ }
+
+ if (type == EWL_KINETIC_SCROLL_NORMAL)
+ {
+ ewl_callback_append(s->overlay, EWL_CALLBACK_MOUSE_DOWN,
+ ewl_scrollpane_cb_mouse_down_normal, s);
+ ewl_callback_append(s->overlay, EWL_CALLBACK_MOUSE_UP,
+ ewl_scrollpane_cb_mouse_up_normal, s);
+ ewl_callback_append(s->overlay, EWL_CALLBACK_MOUSE_MOVE,
+ ewl_scrollpane_cb_mouse_move_normal, s);
+ s->kinfo->extra = NEW(Ewl_Scrollpane_Scroll_Info_Normal, 1);
+ }
+
+ else if (type == EWL_KINETIC_SCROLL_EMBEDDED)
+ {
+ ewl_callback_append(s->overlay, EWL_CALLBACK_MOUSE_DOWN,
+ ewl_scrollpane_cb_mouse_down_embedded, s);
+ ewl_callback_append(s->overlay, EWL_CALLBACK_MOUSE_UP,
+ ewl_scrollpane_cb_mouse_up_embedded, s);
+ ewl_callback_append(s->overlay, EWL_CALLBACK_MOUSE_MOVE,
+ ewl_scrollpane_cb_mouse_move_embedded, s);
+
+ s->kinfo->extra = NEW(Ewl_Scrollpane_Scroll_Info_Embedded, 1);
+ }
+
+ s->type = type;
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -283,11 +283,11 @@ ewl_scrollpane_kinetic_scrolling_set(Ewl_Scrollpane *s, Ewl_Kinetic_Scroll type)
Ewl_Kinetic_Scroll
ewl_scrollpane_kinetic_scrolling_get(Ewl_Scrollpane *s)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, EWL_KINETIC_SCROLL_NONE);
- DCHECK_TYPE_RET(s, EWL_SCROLLPANE_TYPE, EWL_KINETIC_SCROLL_NONE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, EWL_KINETIC_SCROLL_NONE);
+ DCHECK_TYPE_RET(s, EWL_SCROLLPANE_TYPE, EWL_KINETIC_SCROLL_NONE);
- DRETURN_INT(s->type, DLEVEL_STABLE);
+ DRETURN_INT(s->type, DLEVEL_STABLE);
}
/**
@@ -301,22 +301,22 @@ ewl_scrollpane_kinetic_scrolling_get(Ewl_Scrollpane *s)
void
ewl_scrollpane_hscrollbar_flag_set(Ewl_Scrollpane *s, Ewl_Scrollpane_Flags f)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(s);
- DCHECK_TYPE(s, EWL_SCROLLPANE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(s);
+ DCHECK_TYPE(s, EWL_SCROLLPANE_TYPE);
- s->hflag = f;
+ s->hflag = f;
- if (f & EWL_SCROLLPANE_FLAG_ALWAYS_HIDDEN) {
- unsigned int fill;
- fill = ewl_object_fill_policy_get(EWL_OBJECT(s->box));
- ewl_object_fill_policy_set(EWL_OBJECT(s->box),
- fill | EWL_FLAG_FILL_HSHRINK);
- }
+ if (f & EWL_SCROLLPANE_FLAG_ALWAYS_HIDDEN) {
+ unsigned int fill;
+ fill = ewl_object_fill_policy_get(EWL_OBJECT(s->box));
+ ewl_object_fill_policy_set(EWL_OBJECT(s->box),
+ fill | EWL_FLAG_FILL_HSHRINK);
+ }
- ewl_widget_configure(EWL_WIDGET(s));
+ ewl_widget_configure(EWL_WIDGET(s));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -330,22 +330,22 @@ ewl_scrollpane_hscrollbar_flag_set(Ewl_Scrollpane *s, Ewl_Scrollpane_Flags f)
void
ewl_scrollpane_vscrollbar_flag_set(Ewl_Scrollpane *s, Ewl_Scrollpane_Flags f)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(s);
- DCHECK_TYPE(s, EWL_SCROLLPANE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(s);
+ DCHECK_TYPE(s, EWL_SCROLLPANE_TYPE);
- s->vflag = f;
+ s->vflag = f;
- if (f & EWL_SCROLLPANE_FLAG_ALWAYS_HIDDEN) {
- unsigned int fill;
- fill = ewl_object_fill_policy_get(EWL_OBJECT(s->box));
- ewl_object_fill_policy_set(EWL_OBJECT(s->box),
- fill | EWL_FLAG_FILL_VSHRINK);
- }
+ if (f & EWL_SCROLLPANE_FLAG_ALWAYS_HIDDEN) {
+ unsigned int fill;
+ fill = ewl_object_fill_policy_get(EWL_OBJECT(s->box));
+ ewl_object_fill_policy_set(EWL_OBJECT(s->box),
+ fill | EWL_FLAG_FILL_VSHRINK);
+ }
- ewl_widget_configure(EWL_WIDGET(s));
+ ewl_widget_configure(EWL_WIDGET(s));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -356,11 +356,11 @@ ewl_scrollpane_vscrollbar_flag_set(Ewl_Scrollpane *s, Ewl_Scrollpane_Flags f)
Ewl_Scrollpane_Flags
ewl_scrollpane_hscrollbar_flag_get(Ewl_Scrollpane *s)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, 0);
- DCHECK_TYPE_RET(s, EWL_SCROLLPANE_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, 0);
+ DCHECK_TYPE_RET(s, EWL_SCROLLPANE_TYPE, 0);
- DRETURN_INT(s->hflag, DLEVEL_STABLE);
+ DRETURN_INT(s->hflag, DLEVEL_STABLE);
}
/**
@@ -371,11 +371,11 @@ ewl_scrollpane_hscrollbar_flag_get(Ewl_Scrollpane *s)
Ewl_Scrollpane_Flags
ewl_scrollpane_vscrollbar_flag_get(Ewl_Scrollpane *s)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, 0);
- DCHECK_TYPE_RET(s, EWL_SCROLLPANE_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, 0);
+ DCHECK_TYPE_RET(s, EWL_SCROLLPANE_TYPE, 0);
- DRETURN_INT(s->vflag, DLEVEL_STABLE);
+ DRETURN_INT(s->vflag, DLEVEL_STABLE);
}
/**
@@ -386,12 +386,12 @@ ewl_scrollpane_vscrollbar_flag_get(Ewl_Scrollpane *s)
double
ewl_scrollpane_hscrollbar_value_get(Ewl_Scrollpane *s)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, 0.0);
- DCHECK_TYPE_RET(s, EWL_SCROLLPANE_TYPE, 0.0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, 0.0);
+ DCHECK_TYPE_RET(s, EWL_SCROLLPANE_TYPE, 0.0);
- DRETURN_FLOAT(ewl_scrollbar_value_get(EWL_SCROLLBAR(s->hscrollbar)),
- DLEVEL_STABLE);
+ DRETURN_FLOAT(ewl_scrollbar_value_get(EWL_SCROLLBAR(s->hscrollbar)),
+ DLEVEL_STABLE);
}
/**
@@ -402,12 +402,12 @@ ewl_scrollpane_hscrollbar_value_get(Ewl_Scrollpane *s)
double
ewl_scrollpane_vscrollbar_value_get(Ewl_Scrollpane *s)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, 0.0);
- DCHECK_TYPE_RET(s, EWL_SCROLLPANE_TYPE, 0.0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, 0.0);
+ DCHECK_TYPE_RET(s, EWL_SCROLLPANE_TYPE, 0.0);
- DRETURN_FLOAT(ewl_scrollbar_value_get(EWL_SCROLLBAR(s->vscrollbar)),
- DLEVEL_STABLE);
+ DRETURN_FLOAT(ewl_scrollbar_value_get(EWL_SCROLLBAR(s->vscrollbar)),
+ DLEVEL_STABLE);
}
/**
@@ -419,13 +419,13 @@ ewl_scrollpane_vscrollbar_value_get(Ewl_Scrollpane *s)
void
ewl_scrollpane_hscrollbar_value_set(Ewl_Scrollpane *s, double val)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(s);
- DCHECK_TYPE(s, EWL_SCROLLPANE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(s);
+ DCHECK_TYPE(s, EWL_SCROLLPANE_TYPE);
- ewl_scrollbar_value_set(EWL_SCROLLBAR(s->hscrollbar), val);
+ ewl_scrollbar_value_set(EWL_SCROLLBAR(s->hscrollbar), val);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -437,47 +437,47 @@ ewl_scrollpane_hscrollbar_value_set(Ewl_Scrollpane *s, double val)
void
ewl_scrollpane_vscrollbar_value_set(Ewl_Scrollpane *s, double val)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(s);
- DCHECK_TYPE(s, EWL_SCROLLPANE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(s);
+ DCHECK_TYPE(s, EWL_SCROLLPANE_TYPE);
- ewl_scrollbar_value_set(EWL_SCROLLBAR(s->vscrollbar), val);
+ ewl_scrollbar_value_set(EWL_SCROLLBAR(s->vscrollbar), val);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
* @param s: the scrollpane to retrieve its vertical scrollbar stepping
* @return Returns the value of the stepping of the vertical scrollbar
- * in @a s on success.
+ * in @a s on success.
* @brief Retrives the value of the stepping of the vertical scrollbar in @a s.
*/
double
ewl_scrollpane_hscrollbar_step_get(Ewl_Scrollpane *s)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, 0.0);
- DCHECK_TYPE_RET(s, EWL_SCROLLPANE_TYPE, 0.0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, 0.0);
+ DCHECK_TYPE_RET(s, EWL_SCROLLPANE_TYPE, 0.0);
- DRETURN_FLOAT(ewl_scrollbar_step_get(EWL_SCROLLBAR(s->hscrollbar)),
- DLEVEL_STABLE);
+ DRETURN_FLOAT(ewl_scrollbar_step_get(EWL_SCROLLBAR(s->hscrollbar)),
+ DLEVEL_STABLE);
}
/**
* @param s: the scrollpane to retrieve its vertical scrollbar stepping
* @return Returns the value of the stepping of the vertical scrollbar
- * in @a s on success.
+ * in @a s on success.
* @brief Retrives the value of the stepping of the vertical scrollbar in @a s.
*/
double
ewl_scrollpane_vscrollbar_step_get(Ewl_Scrollpane *s)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, 0.0);
- DCHECK_TYPE_RET(s, EWL_SCROLLPANE_TYPE, 0.0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, 0.0);
+ DCHECK_TYPE_RET(s, EWL_SCROLLPANE_TYPE, 0.0);
- DRETURN_FLOAT(ewl_scrollbar_step_get(EWL_SCROLLBAR(s->vscrollbar)),
- DLEVEL_STABLE);
+ DRETURN_FLOAT(ewl_scrollbar_step_get(EWL_SCROLLBAR(s->vscrollbar)),
+ DLEVEL_STABLE);
}
/**
@@ -490,156 +490,156 @@ ewl_scrollpane_vscrollbar_step_get(Ewl_Scrollpane *s)
*/
void
ewl_scrollpane_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Scrollpane *s;
- int vs_width = 0, hs_height = 0;
- int b_width, b_height;
- int content_w, content_h;
- unsigned int old_fill, box_fill = EWL_FLAG_FILL_FILL;
- double hstep = 1.0, vstep = 1.0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- s = EWL_SCROLLPANE(w);
-
- /*
- * Get the space needed by the scrolbars.
- */
- vs_width = ewl_object_preferred_w_get(EWL_OBJECT(s->vscrollbar));
- hs_height = ewl_object_preferred_h_get(EWL_OBJECT(s->hscrollbar));
-
- /*
- * Determine the space used by the contents.
- */
- content_w = CURRENT_W(w);
- content_h = CURRENT_H(w);
-
- /*
- * FIXME: This is exposing box internals, should probably just make a
- * dumb box for the scrollpane.
- * Force the box to recalculate preferred size to work around children
- * with shrink fill policies.
- */
- ewl_container_largest_prefer(EWL_CONTAINER(s->box),
- EWL_ORIENTATION_HORIZONTAL);
- ewl_container_sum_prefer(EWL_CONTAINER(s->box),
- EWL_ORIENTATION_VERTICAL);
-
- /*
- * Get the preferred size of contents to scroll correctly.
- */
- b_width = ewl_object_preferred_w_get(EWL_OBJECT(s->box));
- b_height = ewl_object_preferred_h_get(EWL_OBJECT(s->box));
-
- /*
- * Calculate initial steps.
- */
- if (content_w < b_width)
- hstep = (double)content_w / (double)b_width;
- if (content_h < b_height)
- vstep = (double)content_h / (double)b_height;
-
- /*
- * Determine visibility of scrollbars based on the flags.
- */
- if (s->hflag == EWL_SCROLLPANE_FLAG_NONE ||
- (hstep < 1.0 &&
- s->hflag == EWL_SCROLLPANE_FLAG_AUTO_VISIBLE))
- ewl_widget_show(s->hscrollbar);
- else {
- box_fill |= EWL_FLAG_FILL_HSHRINK;
- ewl_widget_hide(s->hscrollbar);
- }
-
- if (s->vflag == EWL_SCROLLPANE_FLAG_NONE ||
- (vstep < 1.0 &&
- s->vflag == EWL_SCROLLPANE_FLAG_AUTO_VISIBLE))
- ewl_widget_show(s->vscrollbar);
- else {
- box_fill |= EWL_FLAG_FILL_VSHRINK;
- ewl_widget_hide(s->vscrollbar);
- }
-
- /*
- * Adjust the step and width dependant on scrollbar visibility.
- */
- if (VISIBLE(s->hscrollbar)) {
- content_h -= hs_height;
- if (content_h < b_height)
- vstep = (double)content_h / (double)b_height;
- }
-
- if (VISIBLE(s->vscrollbar)) {
- content_w -= vs_width;
- if (content_w < b_width)
- hstep = (double)content_w / (double)b_width;
- }
-
- /*
- * Ensure the step is not negative.
- */
- if (hstep == 1.0)
- b_width = content_w;
-
- if (vstep == 1.0)
- b_height = content_h;
-
- /*
- * Calcuate the offset for the box position
- */
- b_width = (int)(ewl_scrollbar_value_get(EWL_SCROLLBAR(s->hscrollbar)) *
- (double)(b_width - content_w));
- b_height = (int)(ewl_scrollbar_value_get(EWL_SCROLLBAR(s->vscrollbar)) *
- (double)(b_height - content_h));
-
- /*
- * Assign the step values to the scrollbars to adjust scale.
- */
- ewl_scrollbar_step_set(EWL_SCROLLBAR(s->hscrollbar), hstep);
- ewl_scrollbar_step_set(EWL_SCROLLBAR(s->vscrollbar), vstep);
-
- /*
- * Set the fill policy on the box based on scrollbars visible.
- */
- old_fill = ewl_object_fill_policy_get(EWL_OBJECT(s->box));
- ewl_object_fill_policy_set(EWL_OBJECT(s->box), box_fill);
-
- /*
- * Position the horizontal scrollbar.
- */
- ewl_object_geometry_request(EWL_OBJECT(s->hscrollbar),
- CURRENT_X(w), CURRENT_Y(w) + content_h,
- content_w, hs_height);
-
- /*
- * Position the vertical scrollbar.
- */
- ewl_object_geometry_request(EWL_OBJECT(s->vscrollbar),
- CURRENT_X(w) + content_w, CURRENT_Y(w),
- vs_width, content_h);
-
- /*
- * Now move the box into position. For the scrollpane to work we move
- * the box relative to the scroll value.
- */
- ewl_object_geometry_request(EWL_OBJECT(s->overlay),
- CURRENT_X(w), CURRENT_Y(w),
- content_w, content_h);
- ewl_object_geometry_request(EWL_OBJECT(s->box),
- CURRENT_X(w) - b_width,
- CURRENT_Y(w) - b_height,
- content_w + b_width,
- content_h + b_height);
-
- /*
- * Reset the default fill policy on the box to get updated sizes..
- */
- ewl_object_fill_policy_set(EWL_OBJECT(s->box), old_fill);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Scrollpane *s;
+ int vs_width = 0, hs_height = 0;
+ int b_width, b_height;
+ int content_w, content_h;
+ unsigned int old_fill, box_fill = EWL_FLAG_FILL_FILL;
+ double hstep = 1.0, vstep = 1.0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ s = EWL_SCROLLPANE(w);
+
+ /*
+ * Get the space needed by the scrolbars.
+ */
+ vs_width = ewl_object_preferred_w_get(EWL_OBJECT(s->vscrollbar));
+ hs_height = ewl_object_preferred_h_get(EWL_OBJECT(s->hscrollbar));
+
+ /*
+ * Determine the space used by the contents.
+ */
+ content_w = CURRENT_W(w);
+ content_h = CURRENT_H(w);
+
+ /*
+ * FIXME: This is exposing box internals, should probably just make a
+ * dumb box for the scrollpane.
+ * Force the box to recalculate preferred size to work around children
+ * with shrink fill policies.
+ */
+ ewl_container_largest_prefer(EWL_CONTAINER(s->box),
+ EWL_ORIENTATION_HORIZONTAL);
+ ewl_container_sum_prefer(EWL_CONTAINER(s->box),
+ EWL_ORIENTATION_VERTICAL);
+
+ /*
+ * Get the preferred size of contents to scroll correctly.
+ */
+ b_width = ewl_object_preferred_w_get(EWL_OBJECT(s->box));
+ b_height = ewl_object_preferred_h_get(EWL_OBJECT(s->box));
+
+ /*
+ * Calculate initial steps.
+ */
+ if (content_w < b_width)
+ hstep = (double)content_w / (double)b_width;
+ if (content_h < b_height)
+ vstep = (double)content_h / (double)b_height;
+
+ /*
+ * Determine visibility of scrollbars based on the flags.
+ */
+ if (s->hflag == EWL_SCROLLPANE_FLAG_NONE ||
+ (hstep < 1.0 &&
+ s->hflag == EWL_SCROLLPANE_FLAG_AUTO_VISIBLE))
+ ewl_widget_show(s->hscrollbar);
+ else {
+ box_fill |= EWL_FLAG_FILL_HSHRINK;
+ ewl_widget_hide(s->hscrollbar);
+ }
+
+ if (s->vflag == EWL_SCROLLPANE_FLAG_NONE ||
+ (vstep < 1.0 &&
+ s->vflag == EWL_SCROLLPANE_FLAG_AUTO_VISIBLE))
+ ewl_widget_show(s->vscrollbar);
+ else {
+ box_fill |= EWL_FLAG_FILL_VSHRINK;
+ ewl_widget_hide(s->vscrollbar);
+ }
+
+ /*
+ * Adjust the step and width dependant on scrollbar visibility.
+ */
+ if (VISIBLE(s->hscrollbar)) {
+ content_h -= hs_height;
+ if (content_h < b_height)
+ vstep = (double)content_h / (double)b_height;
+ }
+
+ if (VISIBLE(s->vscrollbar)) {
+ content_w -= vs_width;
+ if (content_w < b_width)
+ hstep = (double)content_w / (double)b_width;
+ }
+
+ /*
+ * Ensure the step is not negative.
+ */
+ if (hstep == 1.0)
+ b_width = content_w;
+
+ if (vstep == 1.0)
+ b_height = content_h;
+
+ /*
+ * Calcuate the offset for the box position
+ */
+ b_width = (int)(ewl_scrollbar_value_get(EWL_SCROLLBAR(s->hscrollbar)) *
+ (double)(b_width - content_w));
+ b_height = (int)(ewl_scrollbar_value_get(EWL_SCROLLBAR(s->vscrollbar)) *
+ (double)(b_height - content_h));
+
+ /*
+ * Assign the step values to the scrollbars to adjust scale.
+ */
+ ewl_scrollbar_step_set(EWL_SCROLLBAR(s->hscrollbar), hstep);
+ ewl_scrollbar_step_set(EWL_SCROLLBAR(s->vscrollbar), vstep);
+
+ /*
+ * Set the fill policy on the box based on scrollbars visible.
+ */
+ old_fill = ewl_object_fill_policy_get(EWL_OBJECT(s->box));
+ ewl_object_fill_policy_set(EWL_OBJECT(s->box), box_fill);
+
+ /*
+ * Position the horizontal scrollbar.
+ */
+ ewl_object_geometry_request(EWL_OBJECT(s->hscrollbar),
+ CURRENT_X(w), CURRENT_Y(w) + content_h,
+ content_w, hs_height);
+
+ /*
+ * Position the vertical scrollbar.
+ */
+ ewl_object_geometry_request(EWL_OBJECT(s->vscrollbar),
+ CURRENT_X(w) + content_w, CURRENT_Y(w),
+ vs_width, content_h);
+
+ /*
+ * Now move the box into position. For the scrollpane to work we move
+ * the box relative to the scroll value.
+ */
+ ewl_object_geometry_request(EWL_OBJECT(s->overlay),
+ CURRENT_X(w), CURRENT_Y(w),
+ content_w, content_h);
+ ewl_object_geometry_request(EWL_OBJECT(s->box),
+ CURRENT_X(w) - b_width,
+ CURRENT_Y(w) - b_height,
+ content_w + b_width,
+ content_h + b_height);
+
+ /*
+ * Reset the default fill policy on the box to get updated sizes..
+ */
+ ewl_object_fill_policy_set(EWL_OBJECT(s->box), old_fill);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -652,76 +652,76 @@ ewl_scrollpane_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_scrollpane_cb_focus_jump(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- int endcoord = 0;
- double value;
- int fx, fy, fw, fh;
- Ewl_Embed *emb;
- Ewl_Widget *focus;
- Ewl_Widget *bar = NULL;
- Ewl_Scrollpane *s = EWL_SCROLLPANE(w);
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_SCROLLPANE_TYPE);
-
- emb = ewl_embed_widget_find(w);
- if (!emb)
- DRETURN(DLEVEL_STABLE);
-
- /*
- * Get the focused widget and stop if its an internal one.
- */
- focus = ewl_embed_focused_widget_get(emb);
- if (!focus || !ewl_widget_parent_of(s->box, focus) ||
- ewl_widget_onscreen_is(focus))
- DRETURN(DLEVEL_STABLE);
-
- ewl_object_current_geometry_get(EWL_OBJECT(focus), &fx, &fy, &fw, &fh);
-
- /*
- * Adjust horizontally to show the focused widget
- */
- if (fx < CURRENT_X(s->overlay)) {
- bar = s->hscrollbar;
- endcoord = fx;
- }
- else if (fx + fw > CURRENT_X(s->overlay) + CURRENT_W(s->overlay)) {
- bar = s->hscrollbar;
- endcoord = fx + fw;
- }
-
- if (bar) {
- value = (double)endcoord /
- (double)(ewl_object_current_x_get(EWL_OBJECT(s->box)) +
- ewl_object_preferred_w_get(EWL_OBJECT(s->box)));
- ewl_scrollbar_value_set(EWL_SCROLLBAR(bar), value);
- }
-
- /*
- * Adjust vertically to show the focused widget
- */
- if (fy < CURRENT_Y(s->overlay)) {
- bar = s->vscrollbar;
- endcoord = fy;
- }
- else if (fy + fh > CURRENT_Y(s->overlay) + CURRENT_H(s->overlay)) {
- bar = s->vscrollbar;
- endcoord = fy + fh;
- }
-
- /*
- * Adjust the value of the scrollbar to jump to the position
- */
- if (bar) {
- value = (double)endcoord /
- (double)(ewl_object_current_y_get(EWL_OBJECT(s->box)) +
- ewl_object_preferred_h_get(EWL_OBJECT(s->box)));
- ewl_scrollbar_value_set(EWL_SCROLLBAR(bar), value);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int endcoord = 0;
+ double value;
+ int fx, fy, fw, fh;
+ Ewl_Embed *emb;
+ Ewl_Widget *focus;
+ Ewl_Widget *bar = NULL;
+ Ewl_Scrollpane *s = EWL_SCROLLPANE(w);
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_SCROLLPANE_TYPE);
+
+ emb = ewl_embed_widget_find(w);
+ if (!emb)
+ DRETURN(DLEVEL_STABLE);
+
+ /*
+ * Get the focused widget and stop if its an internal one.
+ */
+ focus = ewl_embed_focused_widget_get(emb);
+ if (!focus || !ewl_widget_parent_of(s->box, focus) ||
+ ewl_widget_onscreen_is(focus))
+ DRETURN(DLEVEL_STABLE);
+
+ ewl_object_current_geometry_get(EWL_OBJECT(focus), &fx, &fy, &fw, &fh);
+
+ /*
+ * Adjust horizontally to show the focused widget
+ */
+ if (fx < CURRENT_X(s->overlay)) {
+ bar = s->hscrollbar;
+ endcoord = fx;
+ }
+ else if (fx + fw > CURRENT_X(s->overlay) + CURRENT_W(s->overlay)) {
+ bar = s->hscrollbar;
+ endcoord = fx + fw;
+ }
+
+ if (bar) {
+ value = (double)endcoord /
+ (double)(ewl_object_current_x_get(EWL_OBJECT(s->box)) +
+ ewl_object_preferred_w_get(EWL_OBJECT(s->box)));
+ ewl_scrollbar_value_set(EWL_SCROLLBAR(bar), value);
+ }
+
+ /*
+ * Adjust vertically to show the focused widget
+ */
+ if (fy < CURRENT_Y(s->overlay)) {
+ bar = s->vscrollbar;
+ endcoord = fy;
+ }
+ else if (fy + fh > CURRENT_Y(s->overlay) + CURRENT_H(s->overlay)) {
+ bar = s->vscrollbar;
+ endcoord = fy + fh;
+ }
+
+ /*
+ * Adjust the value of the scrollbar to jump to the position
+ */
+ if (bar) {
+ value = (double)endcoord /
+ (double)(ewl_object_current_y_get(EWL_OBJECT(s->box)) +
+ ewl_object_preferred_h_get(EWL_OBJECT(s->box)));
+ ewl_scrollbar_value_set(EWL_SCROLLBAR(bar), value);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -735,15 +735,15 @@ ewl_scrollpane_cb_focus_jump(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_scrollpane_cb_hscroll(Ewl_Widget *w __UNUSED__,
- void *ev_data __UNUSED__, void *user_data)
+ void *ev_data __UNUSED__, void *user_data)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(user_data);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(user_data);
- ewl_callback_call(user_data, EWL_CALLBACK_VALUE_CHANGED);
- ewl_widget_configure(user_data);
+ ewl_callback_call(user_data, EWL_CALLBACK_VALUE_CHANGED);
+ ewl_widget_configure(user_data);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/*
@@ -759,15 +759,15 @@ ewl_scrollpane_cb_hscroll(Ewl_Widget *w __UNUSED__,
*/
void
ewl_scrollpane_cb_vscroll(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__,
- void *user_data)
+ void *user_data)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(user_data);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(user_data);
- ewl_callback_call(user_data, EWL_CALLBACK_VALUE_CHANGED);
- ewl_widget_configure(user_data);
+ ewl_callback_call(user_data, EWL_CALLBACK_VALUE_CHANGED);
+ ewl_widget_configure(user_data);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -780,22 +780,22 @@ ewl_scrollpane_cb_vscroll(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__,
*/
void
ewl_scrollpane_cb_wheel_scroll(Ewl_Widget *cb, void *ev_data,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Scrollpane *s;
- Ewl_Event_Mouse_Wheel *ev;
+ Ewl_Scrollpane *s;
+ Ewl_Event_Mouse_Wheel *ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cb);
- DCHECK_TYPE(cb, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cb);
+ DCHECK_TYPE(cb, EWL_WIDGET_TYPE);
- s = EWL_SCROLLPANE(cb);
- ev = ev_data;
- ewl_scrollpane_vscrollbar_value_set(s,
- ewl_scrollpane_vscrollbar_value_get(s) +
- ev->z * ewl_scrollpane_vscrollbar_step_get(s));
+ s = EWL_SCROLLPANE(cb);
+ ev = ev_data;
+ ewl_scrollpane_vscrollbar_value_set(s,
+ ewl_scrollpane_vscrollbar_value_get(s) +
+ ev->z * ewl_scrollpane_vscrollbar_step_get(s));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -809,25 +809,25 @@ ewl_scrollpane_cb_wheel_scroll(Ewl_Widget *cb, void *ev_data,
static void
ewl_scrollpane_cb_mouse_down_normal(Ewl_Widget *w, void *ev, void *data)
{
- Ewl_Scrollpane *s;
- Ewl_Event_Mouse *md;
- Ewl_Scrollpane_Scroll_Info_Normal *info;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(ev);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- s = EWL_SCROLLPANE(data);
- md = EWL_EVENT_MOUSE(ev);
- info = s->kinfo->extra;
- info->vel_x = 0.0;
- info->vel_y = 0.0;
- info->x = md->x;
- info->y = md->y;
- s->kinfo->clicked = !!TRUE;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Scrollpane *s;
+ Ewl_Event_Mouse *md;
+ Ewl_Scrollpane_Scroll_Info_Normal *info;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(ev);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ s = EWL_SCROLLPANE(data);
+ md = EWL_EVENT_MOUSE(ev);
+ info = s->kinfo->extra;
+ info->vel_x = 0.0;
+ info->vel_y = 0.0;
+ info->x = md->x;
+ info->y = md->y;
+ s->kinfo->clicked = !!TRUE;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -841,29 +841,29 @@ ewl_scrollpane_cb_mouse_down_normal(Ewl_Widget *w, void *ev, void *data)
static void
ewl_scrollpane_cb_mouse_down_embedded(Ewl_Widget *w, void *ev, void *data)
{
- Ewl_Scrollpane *s;
- Ewl_Event_Mouse *md;
- Ewl_Scrollpane_Scroll_Info_Embedded *info;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(ev);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- s = EWL_SCROLLPANE(data);
- md = EWL_EVENT_MOUSE(ev);
- info = s->kinfo->extra;
- s->kinfo->clicked = !!TRUE;
- s->kinfo->active = !!FALSE;
-
- memset(&(info->back[0]), 0, sizeof(info->back[0]) * HIST_NUM);
- info->back[0].x = md->x;
- info->back[0].y = md->y;
- info->back[0].time = ecore_time_get();
- info->xs = md->x;
- info->ys = md->y;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Scrollpane *s;
+ Ewl_Event_Mouse *md;
+ Ewl_Scrollpane_Scroll_Info_Embedded *info;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(ev);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ s = EWL_SCROLLPANE(data);
+ md = EWL_EVENT_MOUSE(ev);
+ info = s->kinfo->extra;
+ s->kinfo->clicked = !!TRUE;
+ s->kinfo->active = !!FALSE;
+
+ memset(&(info->back[0]), 0, sizeof(info->back[0]) * HIST_NUM);
+ info->back[0].x = md->x;
+ info->back[0].y = md->y;
+ info->back[0].time = ecore_time_get();
+ info->xs = md->x;
+ info->ys = md->y;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -877,46 +877,46 @@ ewl_scrollpane_cb_mouse_down_embedded(Ewl_Widget *w, void *ev, void *data)
static void
ewl_scrollpane_cb_mouse_move_normal(Ewl_Widget *w, void *ev, void *data)
{
- Ewl_Scrollpane *s;
- Ewl_Event_Mouse *mm;
- Ewl_Scrollpane_Scroll_Info_Normal *info;
- int cx, cy;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(ev);
- DCHECK_PARAM_PTR(data);
-
- s = EWL_SCROLLPANE(data);
- mm = EWL_EVENT_MOUSE(ev);
- info = s->kinfo->extra;
-
- if (!s->kinfo->clicked)
- DRETURN(DLEVEL_STABLE);
-
- if (!s->kinfo->active)
- {
- ecore_timer_add(1.0/s->kinfo->fps,
- ewl_scrollpane_cb_scroll_timer_normal, s);
- s->kinfo->active = !!TRUE;
- }
-
- info->xc = mm->x;
- info->yc = mm->y;
- cx = (info->xc - info->x);
- cy = (info->yc - info->y);
-
- /* v = (change in position / (width or height of scroll *
- * (range of velocities) + min))
- */
- info->vel_x = ((cx /
- (double)ewl_object_current_w_get(EWL_OBJECT(w))) *
- (s->kinfo->vmax - s->kinfo->vmin)) + s->kinfo->vmin;
-
- info->vel_y = ((cy /
- (double)ewl_object_current_h_get(EWL_OBJECT(w))) *
- (s->kinfo->vmax - s->kinfo->vmin)) + s->kinfo->vmin;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Scrollpane *s;
+ Ewl_Event_Mouse *mm;
+ Ewl_Scrollpane_Scroll_Info_Normal *info;
+ int cx, cy;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(ev);
+ DCHECK_PARAM_PTR(data);
+
+ s = EWL_SCROLLPANE(data);
+ mm = EWL_EVENT_MOUSE(ev);
+ info = s->kinfo->extra;
+
+ if (!s->kinfo->clicked)
+ DRETURN(DLEVEL_STABLE);
+
+ if (!s->kinfo->active)
+ {
+ ecore_timer_add(1.0/s->kinfo->fps,
+ ewl_scrollpane_cb_scroll_timer_normal, s);
+ s->kinfo->active = !!TRUE;
+ }
+
+ info->xc = mm->x;
+ info->yc = mm->y;
+ cx = (info->xc - info->x);
+ cy = (info->yc - info->y);
+
+ /* v = (change in position / (width or height of scroll *
+ * (range of velocities) + min))
+ */
+ info->vel_x = ((cx /
+ (double)ewl_object_current_w_get(EWL_OBJECT(w))) *
+ (s->kinfo->vmax - s->kinfo->vmin)) + s->kinfo->vmin;
+
+ info->vel_y = ((cy /
+ (double)ewl_object_current_h_get(EWL_OBJECT(w))) *
+ (s->kinfo->vmax - s->kinfo->vmin)) + s->kinfo->vmin;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -930,36 +930,36 @@ ewl_scrollpane_cb_mouse_move_normal(Ewl_Widget *w, void *ev, void *data)
static void
ewl_scrollpane_cb_mouse_move_embedded(Ewl_Widget *w, void *ev, void *data)
{
- Ewl_Scrollpane *s;
- Ewl_Event_Mouse *mm;
- Ewl_Scrollpane_Scroll_Info_Embedded *info;
- int x = 0, y = 0;
+ Ewl_Scrollpane *s;
+ Ewl_Event_Mouse *mm;
+ Ewl_Scrollpane_Scroll_Info_Embedded *info;
+ int x = 0, y = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(ev);
- DCHECK_PARAM_PTR(data);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(ev);
+ DCHECK_PARAM_PTR(data);
- s = EWL_SCROLLPANE(data);
- mm = EWL_EVENT_MOUSE(ev);
- info = s->kinfo->extra;
+ s = EWL_SCROLLPANE(data);
+ mm = EWL_EVENT_MOUSE(ev);
+ info = s->kinfo->extra;
- if (!s->kinfo->clicked)
- DRETURN(DLEVEL_STABLE);
+ if (!s->kinfo->clicked)
+ DRETURN(DLEVEL_STABLE);
- memmove(&(info->back[1]), &(info->back[0]), sizeof(info->back[0]) * (HIST_NUM - 1));
- info->back[0].x = mm->x;
- info->back[0].y = mm->y;
- info->back[0].time = ecore_time_get();
+ memmove(&(info->back[1]), &(info->back[0]), sizeof(info->back[0]) * (HIST_NUM - 1));
+ info->back[0].x = mm->x;
+ info->back[0].y = mm->y;
+ info->back[0].time = ecore_time_get();
- /* Move accordingly here */
- x = info->xs - mm->x;
- y = info->ys - mm->y;
+ /* Move accordingly here */
+ x = info->xs - mm->x;
+ y = info->ys - mm->y;
- ewl_scrollpane_cb_scroll(s, x, y, NULL, NULL);
- info->xs = mm->x;
- info->ys = mm->y;
+ ewl_scrollpane_cb_scroll(s, x, y, NULL, NULL);
+ info->xs = mm->x;
+ info->ys = mm->y;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -973,15 +973,15 @@ ewl_scrollpane_cb_mouse_move_embedded(Ewl_Widget *w, void *ev, void *data)
static void
ewl_scrollpane_cb_mouse_up_normal(Ewl_Widget *w, void *ev, void *data)
{
- Ewl_Scrollpane *s;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
+ Ewl_Scrollpane *s;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
- s = EWL_SCROLLPANE(data);
- s->kinfo->clicked = !!FALSE;
+ s = EWL_SCROLLPANE(data);
+ s->kinfo->clicked = !!FALSE;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -995,75 +995,75 @@ ewl_scrollpane_cb_mouse_up_normal(Ewl_Widget *w, void *ev, void *data)
static void
ewl_scrollpane_cb_mouse_up_embedded(Ewl_Widget *w, void *ev, void *data)
{
- Ewl_Scrollpane *s;
- Ewl_Event_Mouse *mm;
- Ewl_Scrollpane_Scroll_Info_Embedded *info;
- int ax, ay, dx, dy, i;
- double at, dt, t;
- int rx = 1, ry = 1;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
-
- s = EWL_SCROLLPANE(data);
- mm = EWL_EVENT_MOUSE(ev);
- s->kinfo->clicked = !!FALSE;
- s->kinfo->active = !!TRUE;
- info = s->kinfo->extra;
-
- t = ecore_time_get();
- ax = mm->x;
- ay = mm->y;
- at = 0.0;
-
- for (i = 0; i < HIST_NUM; i++)
- {
- dt = t - info->back[i].time;
- if (dt > 0.2) break;
- at = at + dt;
- ax = ax + info->back[i].x;
- ay = ay + info->back[i].y;
- }
-
- ax = (ax / (i + 1));
- ay = (ay / (i + 1));
- at = (at / (i + 1));
- at = at * 4.0;
- dx = mm->x - ax;
- dy = mm->y - ay;
-
- info->vel_x = (double)dx / at;
- info->vel_y = (double)dy / at;
-
- if (info->vel_y < 0)
- ry = -1;
- if (info->vel_x < 0)
- rx = -1;
-
- /* This should do something better */
- info->vel_x = sqrt(info->vel_x * rx);
- info->vel_y = sqrt(info->vel_y * ry);
-
- /* Set to minimum velocity if below */
- if (abs(info->vel_x) < s->kinfo->vmin)
- info->vel_x = s->kinfo->vmin;
- else if (abs(info->vel_x) > s->kinfo->vmax)
- info->vel_x = s->kinfo->vmax;
-
- /* Check upper velocity */
- if (abs(info->vel_y) < s->kinfo->vmin)
- info->vel_y = s->kinfo->vmin;
- else if (abs(info->vel_y) > s->kinfo->vmax)
- info->vel_y = s->kinfo->vmax;
-
- /* Return to proper direction */
- info->vel_x = info->vel_x * rx;
- info->vel_y = info->vel_y * ry;
-
- info->at = at;
- ecore_timer_add(1/s->kinfo->fps, ewl_scrollpane_cb_scroll_timer_embedded, s);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Scrollpane *s;
+ Ewl_Event_Mouse *mm;
+ Ewl_Scrollpane_Scroll_Info_Embedded *info;
+ int ax, ay, dx, dy, i;
+ double at, dt, t;
+ int rx = 1, ry = 1;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+
+ s = EWL_SCROLLPANE(data);
+ mm = EWL_EVENT_MOUSE(ev);
+ s->kinfo->clicked = !!FALSE;
+ s->kinfo->active = !!TRUE;
+ info = s->kinfo->extra;
+
+ t = ecore_time_get();
+ ax = mm->x;
+ ay = mm->y;
+ at = 0.0;
+
+ for (i = 0; i < HIST_NUM; i++)
+ {
+ dt = t - info->back[i].time;
+ if (dt > 0.2) break;
+ at = at + dt;
+ ax = ax + info->back[i].x;
+ ay = ay + info->back[i].y;
+ }
+
+ ax = (ax / (i + 1));
+ ay = (ay / (i + 1));
+ at = (at / (i + 1));
+ at = at * 4.0;
+ dx = mm->x - ax;
+ dy = mm->y - ay;
+
+ info->vel_x = (double)dx / at;
+ info->vel_y = (double)dy / at;
+
+ if (info->vel_y < 0)
+ ry = -1;
+ if (info->vel_x < 0)
+ rx = -1;
+
+ /* This should do something better */
+ info->vel_x = sqrt(info->vel_x * rx);
+ info->vel_y = sqrt(info->vel_y * ry);
+
+ /* Set to minimum velocity if below */
+ if (abs(info->vel_x) < s->kinfo->vmin)
+ info->vel_x = s->kinfo->vmin;
+ else if (abs(info->vel_x) > s->kinfo->vmax)
+ info->vel_x = s->kinfo->vmax;
+
+ /* Check upper velocity */
+ if (abs(info->vel_y) < s->kinfo->vmin)
+ info->vel_y = s->kinfo->vmin;
+ else if (abs(info->vel_y) > s->kinfo->vmax)
+ info->vel_y = s->kinfo->vmax;
+
+ /* Return to proper direction */
+ info->vel_x = info->vel_x * rx;
+ info->vel_y = info->vel_y * ry;
+
+ info->at = at;
+ ecore_timer_add(1/s->kinfo->fps, ewl_scrollpane_cb_scroll_timer_embedded, s);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1075,43 +1075,43 @@ ewl_scrollpane_cb_mouse_up_embedded(Ewl_Widget *w, void *ev, void *data)
static int
ewl_scrollpane_cb_scroll_timer_normal(void *data)
{
- Ewl_Scrollpane *s;
- Ewl_Scrollpane_Scroll_Info_Normal *info;
- double h, w;
- int tx = 0, ty = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, FALSE);
-
- s = EWL_SCROLLPANE(data);
- info = s->kinfo->extra;
-
- /* If the mouse is down, accelerate and check velocity */
- if (!s->kinfo->clicked)
- {
- info->vel_x *= s->kinfo->dampen;
- info->vel_y *= s->kinfo->dampen;
-
- h = info->vel_y * ((info->vel_y < 0) ? -1 : 1);
- w = info->vel_x * ((info->vel_x < 0) ? -1 : 1);
-
- if ((w < 0.5) && (h < 0.5))
- {
- s->kinfo->active = !!FALSE;
- DRETURN_INT(0, DLEVEL_STABLE);
- }
- }
-
- /* Actually scroll the pane */
- ewl_scrollpane_cb_scroll(s, info->vel_x, info->vel_y, &tx, &ty);
-
- /* If at the end of a scrollbar, set x/y to current */
- if (!tx)
- info->x = info->xc;
- if (!ty)
- info->y = info->yc;
-
- DRETURN_INT(1, DLEVEL_STABLE);
+ Ewl_Scrollpane *s;
+ Ewl_Scrollpane_Scroll_Info_Normal *info;
+ double h, w;
+ int tx = 0, ty = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, FALSE);
+
+ s = EWL_SCROLLPANE(data);
+ info = s->kinfo->extra;
+
+ /* If the mouse is down, accelerate and check velocity */
+ if (!s->kinfo->clicked)
+ {
+ info->vel_x *= s->kinfo->dampen;
+ info->vel_y *= s->kinfo->dampen;
+
+ h = info->vel_y * ((info->vel_y < 0) ? -1 : 1);
+ w = info->vel_x * ((info->vel_x < 0) ? -1 : 1);
+
+ if ((w < 0.5) && (h < 0.5))
+ {
+ s->kinfo->active = !!FALSE;
+ DRETURN_INT(0, DLEVEL_STABLE);
+ }
+ }
+
+ /* Actually scroll the pane */
+ ewl_scrollpane_cb_scroll(s, info->vel_x, info->vel_y, &tx, &ty);
+
+ /* If at the end of a scrollbar, set x/y to current */
+ if (!tx)
+ info->x = info->xc;
+ if (!ty)
+ info->y = info->yc;
+
+ DRETURN_INT(1, DLEVEL_STABLE);
}
/**
@@ -1123,42 +1123,42 @@ ewl_scrollpane_cb_scroll_timer_normal(void *data)
static int
ewl_scrollpane_cb_scroll_timer_embedded(void *data)
{
- Ewl_Scrollpane *s;
- Ewl_Scrollpane_Scroll_Info_Embedded *info;
- double h, w, t;
- int tx = 0, ty = 0;
+ Ewl_Scrollpane *s;
+ Ewl_Scrollpane_Scroll_Info_Embedded *info;
+ double h, w, t;
+ int tx = 0, ty = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, FALSE);
- s = EWL_SCROLLPANE(data);
- info = s->kinfo->extra;
+ s = EWL_SCROLLPANE(data);
+ info = s->kinfo->extra;
- if ((s->kinfo->clicked) || (!s->kinfo->active))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if ((s->kinfo->clicked) || (!s->kinfo->active))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- h = info->vel_y * ((info->vel_y < 0) ? -1 : 1);
- w = info->vel_x * ((info->vel_x < 0) ? -1 : 1);
+ h = info->vel_y * ((info->vel_y < 0) ? -1 : 1);
+ w = info->vel_x * ((info->vel_x < 0) ? -1 : 1);
- if ((w < 0.5) && (h < 0.5))
- {
- s->kinfo->active = !!FALSE;
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
+ if ((w < 0.5) && (h < 0.5))
+ {
+ s->kinfo->active = !!FALSE;
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
- t = 1.0 / (info->at * s->kinfo->fps);
- h = info->vel_y * -t;
- w = info->vel_x * -t;
-
- ewl_scrollpane_cb_scroll(s, w, h, &tx, &ty);
+ t = 1.0 / (info->at * s->kinfo->fps);
+ h = info->vel_y * -t;
+ w = info->vel_x * -t;
+
+ ewl_scrollpane_cb_scroll(s, w, h, &tx, &ty);
- if (!tx && !ty)
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!tx && !ty)
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- info->vel_x *= s->kinfo->dampen;
- info->vel_y *= s->kinfo->dampen;
+ info->vel_x *= s->kinfo->dampen;
+ info->vel_y *= s->kinfo->dampen;
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -1173,69 +1173,69 @@ ewl_scrollpane_cb_scroll_timer_embedded(void *data)
*/
static void
ewl_scrollpane_cb_scroll(Ewl_Scrollpane *s, double x, double y,
- int *tx, int *ty)
+ int *tx, int *ty)
{
- double w, h;
- Ewl_Scrollbar *ry, *rx;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(s);
- DCHECK_TYPE(s, EWL_SCROLLPANE_TYPE);
-
- ry = EWL_SCROLLBAR(s->vscrollbar);
- rx = EWL_SCROLLBAR(s->hscrollbar);
-
- if (!((ewl_scrollpane_vscrollbar_value_get(s) == 1.0) &&
- (y > 0)) &&
- !((ewl_scrollpane_vscrollbar_value_get(s) == 0.0) &&
- (y < 0)))
- {
- h = ewl_scrollpane_vscrollbar_value_get(s) +
- (y / (double)ewl_object_preferred_h_get(EWL_OBJECT(s->box)));
-
- /* If h is greater than possible setting, set to remainder */
- if (h > ewl_range_maximum_value_get(EWL_RANGE(ry->seeker)))
- {
- h = ewl_range_maximum_value_get(EWL_RANGE(ry->seeker));
- if (ty) *ty = FALSE;
- }
- else if (h < ewl_range_minimum_value_get(EWL_RANGE(ry->seeker)))
- {
- h = ewl_range_minimum_value_get(EWL_RANGE(ry->seeker));
- if (ty) *ty = FALSE;
- }
- else
- if (ty) *ty = TRUE;
-
- ewl_scrollpane_vscrollbar_value_set(s, h);
- }
-
- if (!((ewl_scrollpane_hscrollbar_value_get(s) == 1.0) &&
- (x > 0)) &&
- !((ewl_scrollpane_hscrollbar_value_get(s) == 0.0) &&
- (x < 0)))
- {
- w = ewl_scrollpane_hscrollbar_value_get(s) +
- (x / (double)ewl_object_preferred_w_get(EWL_OBJECT(s->box)));
-
- /* And again for the w */
- if (w > ewl_range_maximum_value_get(EWL_RANGE(rx->seeker)))
- {
- w = ewl_range_maximum_value_get(EWL_RANGE(rx->seeker));
- if (tx) *tx = FALSE;
- }
- else if (w < ewl_range_minimum_value_get(EWL_RANGE(rx->seeker)))
- {
- w = ewl_range_minimum_value_get(EWL_RANGE(rx->seeker));
- if (tx) *tx = FALSE;
- }
- else
- if (tx) *tx = TRUE;
-
- ewl_scrollpane_hscrollbar_value_set(s, w);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ double w, h;
+ Ewl_Scrollbar *ry, *rx;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(s);
+ DCHECK_TYPE(s, EWL_SCROLLPANE_TYPE);
+
+ ry = EWL_SCROLLBAR(s->vscrollbar);
+ rx = EWL_SCROLLBAR(s->hscrollbar);
+
+ if (!((ewl_scrollpane_vscrollbar_value_get(s) == 1.0) &&
+ (y > 0)) &&
+ !((ewl_scrollpane_vscrollbar_value_get(s) == 0.0) &&
+ (y < 0)))
+ {
+ h = ewl_scrollpane_vscrollbar_value_get(s) +
+ (y / (double)ewl_object_preferred_h_get(EWL_OBJECT(s->box)));
+
+ /* If h is greater than possible setting, set to remainder */
+ if (h > ewl_range_maximum_value_get(EWL_RANGE(ry->seeker)))
+ {
+ h = ewl_range_maximum_value_get(EWL_RANGE(ry->seeker));
+ if (ty) *ty = FALSE;
+ }
+ else if (h < ewl_range_minimum_value_get(EWL_RANGE(ry->seeker)))
+ {
+ h = ewl_range_minimum_value_get(EWL_RANGE(ry->seeker));
+ if (ty) *ty = FALSE;
+ }
+ else
+ if (ty) *ty = TRUE;
+
+ ewl_scrollpane_vscrollbar_value_set(s, h);
+ }
+
+ if (!((ewl_scrollpane_hscrollbar_value_get(s) == 1.0) &&
+ (x > 0)) &&
+ !((ewl_scrollpane_hscrollbar_value_get(s) == 0.0) &&
+ (x < 0)))
+ {
+ w = ewl_scrollpane_hscrollbar_value_get(s) +
+ (x / (double)ewl_object_preferred_w_get(EWL_OBJECT(s->box)));
+
+ /* And again for the w */
+ if (w > ewl_range_maximum_value_get(EWL_RANGE(rx->seeker)))
+ {
+ w = ewl_range_maximum_value_get(EWL_RANGE(rx->seeker));
+ if (tx) *tx = FALSE;
+ }
+ else if (w < ewl_range_minimum_value_get(EWL_RANGE(rx->seeker)))
+ {
+ w = ewl_range_minimum_value_get(EWL_RANGE(rx->seeker));
+ if (tx) *tx = FALSE;
+ }
+ else
+ if (tx) *tx = TRUE;
+
+ ewl_scrollpane_hscrollbar_value_set(s, w);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1247,13 +1247,13 @@ ewl_scrollpane_cb_scroll(Ewl_Scrollpane *s, double x, double y,
void
ewl_scrollpane_kinetic_max_velocity_set(Ewl_Scrollpane *s, double v)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(s);
- DCHECK_TYPE(s, EWL_SCROLLPANE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(s);
+ DCHECK_TYPE(s, EWL_SCROLLPANE_TYPE);
- s->kinfo->vmax = v;
+ s->kinfo->vmax = v;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1264,11 +1264,11 @@ ewl_scrollpane_kinetic_max_velocity_set(Ewl_Scrollpane *s, double v)
double
ewl_scrollpane_kinetic_max_velocity_get(Ewl_Scrollpane *s)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, -1);
- DCHECK_TYPE_RET(s, EWL_SCROLLPANE_TYPE, -1);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, -1);
+ DCHECK_TYPE_RET(s, EWL_SCROLLPANE_TYPE, -1);
- DRETURN_INT(s->kinfo->vmax, DLEVEL_STABLE);
+ DRETURN_INT(s->kinfo->vmax, DLEVEL_STABLE);
}
/**
@@ -1280,13 +1280,13 @@ ewl_scrollpane_kinetic_max_velocity_get(Ewl_Scrollpane *s)
void
ewl_scrollpane_kinetic_min_velocity_set(Ewl_Scrollpane *s, double v)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(s);
- DCHECK_TYPE(s, EWL_SCROLLPANE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(s);
+ DCHECK_TYPE(s, EWL_SCROLLPANE_TYPE);
- s->kinfo->vmin = v;
+ s->kinfo->vmin = v;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1297,11 +1297,11 @@ ewl_scrollpane_kinetic_min_velocity_set(Ewl_Scrollpane *s, double v)
double
ewl_scrollpane_kinetic_min_velocity_get(Ewl_Scrollpane *s)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, -1);
- DCHECK_TYPE_RET(s, EWL_SCROLLPANE_TYPE, -1);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, -1);
+ DCHECK_TYPE_RET(s, EWL_SCROLLPANE_TYPE, -1);
- DRETURN_INT(s->kinfo->vmin, DLEVEL_STABLE);
+ DRETURN_INT(s->kinfo->vmin, DLEVEL_STABLE);
}
/**
@@ -1313,13 +1313,13 @@ ewl_scrollpane_kinetic_min_velocity_get(Ewl_Scrollpane *s)
void
ewl_scrollpane_kinetic_dampen_set(Ewl_Scrollpane *s, double d)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(s);
- DCHECK_TYPE(s, EWL_SCROLLPANE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(s);
+ DCHECK_TYPE(s, EWL_SCROLLPANE_TYPE);
- s->kinfo->dampen = d;
+ s->kinfo->dampen = d;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1330,11 +1330,11 @@ ewl_scrollpane_kinetic_dampen_set(Ewl_Scrollpane *s, double d)
double
ewl_scrollpane_kinetic_dampen_get(Ewl_Scrollpane *s)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, -1);
- DCHECK_TYPE_RET(s, EWL_SCROLLPANE_TYPE, -1);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, -1);
+ DCHECK_TYPE_RET(s, EWL_SCROLLPANE_TYPE, -1);
- DRETURN_INT(s->kinfo->dampen, DLEVEL_STABLE);
+ DRETURN_INT(s->kinfo->dampen, DLEVEL_STABLE);
}
/**
@@ -1346,13 +1346,13 @@ ewl_scrollpane_kinetic_dampen_get(Ewl_Scrollpane *s)
void
ewl_scrollpane_kinetic_fps_set(Ewl_Scrollpane *s, int fps)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(s);
- DCHECK_TYPE(s, EWL_SCROLLPANE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(s);
+ DCHECK_TYPE(s, EWL_SCROLLPANE_TYPE);
- s->kinfo->fps = fps;
+ s->kinfo->fps = fps;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1363,11 +1363,11 @@ ewl_scrollpane_kinetic_fps_set(Ewl_Scrollpane *s, int fps)
int
ewl_scrollpane_kinetic_fps_get(Ewl_Scrollpane *s)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, -1);
- DCHECK_TYPE_RET(s, EWL_SCROLLPANE_TYPE, -1);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, -1);
+ DCHECK_TYPE_RET(s, EWL_SCROLLPANE_TYPE, -1);
- DRETURN_INT(s->kinfo->fps, DLEVEL_STABLE);
+ DRETURN_INT(s->kinfo->fps, DLEVEL_STABLE);
}
/**
@@ -1381,15 +1381,15 @@ ewl_scrollpane_kinetic_fps_get(Ewl_Scrollpane *s)
void
ewl_scrollpane_cb_destroy(Ewl_Widget *w, void *ev, void *data)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_SCROLLPANE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_SCROLLPANE_TYPE);
- if (EWL_SCROLLPANE(w)->kinfo)
- FREE(EWL_SCROLLPANE(w)->kinfo->extra);
- FREE(EWL_SCROLLPANE(w)->kinfo);
+ if (EWL_SCROLLPANE(w)->kinfo)
+ FREE(EWL_SCROLLPANE(w)->kinfo->extra);
+ FREE(EWL_SCROLLPANE(w)->kinfo);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_scrollpane.h b/src/lib/ewl_scrollpane.h
index 580eb84..a92023d 100644
--- a/src/lib/ewl_scrollpane.h
+++ b/src/lib/ewl_scrollpane.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_SCROLLPANE_H
#define EWL_SCROLLPANE_H
@@ -48,13 +48,13 @@ typedef struct Ewl_Scrollpane_Scroll_Info_Base Ewl_Scrollpane_Scroll_Info_Base;
*/
struct Ewl_Scrollpane_Scroll_Info_Base
{
- unsigned char clicked:1; /**< If the mouse is currently clicked or not */
- unsigned char active:1; /**< If the pane is currently moving */
- int fps; /**< Number of recalculations per second */
- double vmax; /**< Maximum speed in pixels */
- double vmin; /**< Minimum speed in pixels */
- double dampen; /**< Frictional variable */
- void *extra; /**< Additional information */
+ unsigned char clicked:1; /**< If the mouse is currently clicked or not */
+ unsigned char active:1; /**< If the pane is currently moving */
+ int fps; /**< Number of recalculations per second */
+ double vmax; /**< Maximum speed in pixels */
+ double vmin; /**< Minimum speed in pixels */
+ double dampen; /**< Frictional variable */
+ void *extra; /**< Additional information */
};
/**
@@ -75,60 +75,60 @@ typedef struct Ewl_Scrollpane Ewl_Scrollpane;
*/
struct Ewl_Scrollpane
{
- Ewl_Container container; /**< Inherit from Ewl_Container */
-
- Ewl_Widget *overlay; /**< Clips the enclosed widget */
- Ewl_Widget *box; /**< Lays out enclosed widget */
- Ewl_Widget *hscrollbar; /**< Horizontal scrollbar */
- Ewl_Widget *vscrollbar; /**< Vertical scrollbar */
- Ewl_Scrollpane_Flags hflag; /**< Flags for horizontal scrollbar */
- Ewl_Scrollpane_Flags vflag; /**< Flags for vertical scrollbar */
- Ewl_Scrollpane_Scroll_Info_Base *kinfo; /**< Kinetic scrolling info */
- Ewl_Kinetic_Scroll type; /**< If the scrollpane is to use kinetic scrolling */
+ Ewl_Container container; /**< Inherit from Ewl_Container */
+
+ Ewl_Widget *overlay; /**< Clips the enclosed widget */
+ Ewl_Widget *box; /**< Lays out enclosed widget */
+ Ewl_Widget *hscrollbar; /**< Horizontal scrollbar */
+ Ewl_Widget *vscrollbar; /**< Vertical scrollbar */
+ Ewl_Scrollpane_Flags hflag; /**< Flags for horizontal scrollbar */
+ Ewl_Scrollpane_Flags vflag; /**< Flags for vertical scrollbar */
+ Ewl_Scrollpane_Scroll_Info_Base *kinfo; /**< Kinetic scrolling info */
+ Ewl_Kinetic_Scroll type; /**< If the scrollpane is to use kinetic scrolling */
};
-Ewl_Widget *ewl_scrollpane_new(void);
-int ewl_scrollpane_init(Ewl_Scrollpane *s);
-void ewl_scrollpane_kinetic_scrolling_set(Ewl_Scrollpane *s,
- Ewl_Kinetic_Scroll type);
+Ewl_Widget *ewl_scrollpane_new(void);
+int ewl_scrollpane_init(Ewl_Scrollpane *s);
+void ewl_scrollpane_kinetic_scrolling_set(Ewl_Scrollpane *s,
+ Ewl_Kinetic_Scroll type);
Ewl_Kinetic_Scroll ewl_scrollpane_kinetic_scrolling_get(Ewl_Scrollpane *s);
-void ewl_scrollpane_kinetic_max_velocity_set(Ewl_Scrollpane *s, double v);
-double ewl_scrollpane_kinetic_max_velocity_get(Ewl_Scrollpane *s);
-void ewl_scrollpane_kinetic_min_velocity_set(Ewl_Scrollpane *s, double v);
-double ewl_scrollpane_kinetic_min_velocity_get(Ewl_Scrollpane *s);
-void ewl_scrollpane_kinetic_dampen_set(Ewl_Scrollpane *s, double d);
-double ewl_scrollpane_kinetic_dampen_get(Ewl_Scrollpane *s);
-void ewl_scrollpane_kinetic_fps_set(Ewl_Scrollpane *s, int fps);
-int ewl_scrollpane_kinetic_fps_get(Ewl_Scrollpane *s);
-
-void ewl_scrollpane_hscrollbar_flag_set(Ewl_Scrollpane *s,
- Ewl_Scrollpane_Flags f);
-void ewl_scrollpane_vscrollbar_flag_set(Ewl_Scrollpane *s,
- Ewl_Scrollpane_Flags f);
+void ewl_scrollpane_kinetic_max_velocity_set(Ewl_Scrollpane *s, double v);
+double ewl_scrollpane_kinetic_max_velocity_get(Ewl_Scrollpane *s);
+void ewl_scrollpane_kinetic_min_velocity_set(Ewl_Scrollpane *s, double v);
+double ewl_scrollpane_kinetic_min_velocity_get(Ewl_Scrollpane *s);
+void ewl_scrollpane_kinetic_dampen_set(Ewl_Scrollpane *s, double d);
+double ewl_scrollpane_kinetic_dampen_get(Ewl_Scrollpane *s);
+void ewl_scrollpane_kinetic_fps_set(Ewl_Scrollpane *s, int fps);
+int ewl_scrollpane_kinetic_fps_get(Ewl_Scrollpane *s);
+
+void ewl_scrollpane_hscrollbar_flag_set(Ewl_Scrollpane *s,
+ Ewl_Scrollpane_Flags f);
+void ewl_scrollpane_vscrollbar_flag_set(Ewl_Scrollpane *s,
+ Ewl_Scrollpane_Flags f);
Ewl_Scrollpane_Flags ewl_scrollpane_hscrollbar_flag_get(Ewl_Scrollpane *s);
Ewl_Scrollpane_Flags ewl_scrollpane_vscrollbar_flag_get(Ewl_Scrollpane *s);
-double ewl_scrollpane_hscrollbar_value_get(Ewl_Scrollpane *s);
-double ewl_scrollpane_vscrollbar_value_get(Ewl_Scrollpane *s);
+double ewl_scrollpane_hscrollbar_value_get(Ewl_Scrollpane *s);
+double ewl_scrollpane_vscrollbar_value_get(Ewl_Scrollpane *s);
-void ewl_scrollpane_hscrollbar_value_set(Ewl_Scrollpane *s, double val);
-void ewl_scrollpane_vscrollbar_value_set(Ewl_Scrollpane *s, double val);
+void ewl_scrollpane_hscrollbar_value_set(Ewl_Scrollpane *s, double val);
+void ewl_scrollpane_vscrollbar_value_set(Ewl_Scrollpane *s, double val);
-double ewl_scrollpane_hscrollbar_step_get(Ewl_Scrollpane *s);
-double ewl_scrollpane_vscrollbar_step_get(Ewl_Scrollpane *s);
+double ewl_scrollpane_hscrollbar_step_get(Ewl_Scrollpane *s);
+double ewl_scrollpane_vscrollbar_step_get(Ewl_Scrollpane *s);
/*
* Internally used callbacks, override at your own risk.
*/
void ewl_scrollpane_cb_configure(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
void ewl_scrollpane_cb_focus_jump(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
void ewl_scrollpane_cb_hscroll(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_scrollpane_cb_vscroll(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_scrollpane_cb_wheel_scroll(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
/**
* @}
diff --git a/src/lib/ewl_seeker.c b/src/lib/ewl_seeker.c
index 4aae41b..d0380b6 100644
--- a/src/lib/ewl_seeker.c
+++ b/src/lib/ewl_seeker.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_seeker.h"
#include "ewl_button.h"
@@ -16,20 +16,20 @@ static int ewl_seeker_timer(void *data);
Ewl_Widget *
ewl_seeker_new(void)
{
- Ewl_Seeker *s;
+ Ewl_Seeker *s;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- s = NEW(Ewl_Seeker, 1);
- if (!s)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ s = NEW(Ewl_Seeker, 1);
+ if (!s)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_seeker_init(s)) {
- ewl_widget_destroy(EWL_WIDGET(s));
- s = NULL;
- }
+ if (!ewl_seeker_init(s)) {
+ ewl_widget_destroy(EWL_WIDGET(s));
+ s = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
}
/**
@@ -39,17 +39,17 @@ ewl_seeker_new(void)
Ewl_Widget *
ewl_hseeker_new(void)
{
- Ewl_Widget *s;
+ Ewl_Widget *s;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- s = ewl_seeker_new();
- if (!s)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ s = ewl_seeker_new();
+ if (!s)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- ewl_seeker_orientation_set(EWL_SEEKER(s), EWL_ORIENTATION_HORIZONTAL);
+ ewl_seeker_orientation_set(EWL_SEEKER(s), EWL_ORIENTATION_HORIZONTAL);
- DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
}
/**
@@ -59,17 +59,17 @@ ewl_hseeker_new(void)
Ewl_Widget *
ewl_vseeker_new(void)
{
- Ewl_Widget *s;
+ Ewl_Widget *s;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- s = ewl_seeker_new();
- if (!s)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ s = ewl_seeker_new();
+ if (!s)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- ewl_seeker_orientation_set(EWL_SEEKER(s), EWL_ORIENTATION_VERTICAL);
+ ewl_seeker_orientation_set(EWL_SEEKER(s), EWL_ORIENTATION_VERTICAL);
- DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
}
/**
@@ -83,77 +83,77 @@ ewl_vseeker_new(void)
int
ewl_seeker_init(Ewl_Seeker *s)
{
- Ewl_Widget *w;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, FALSE);
-
- w = EWL_WIDGET(s);
-
- if (!ewl_range_init(EWL_RANGE(w)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- /*
- * Initialize the widget fields and set default orientation and type
- */
- ewl_widget_appearance_set(w, "hseeker");
- ewl_widget_inherit(w, EWL_SEEKER_TYPE);
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_HFILL |
- EWL_FLAG_FILL_HSHRINK);
-
- ewl_container_show_notify_set(EWL_CONTAINER(w),
- ewl_seeker_cb_child_show);
-
- /*
- * Create and add the button portion of the seeker
- */
- s->button = ewl_button_new();
- ewl_widget_internal_set(s->button, TRUE);
- ewl_container_child_append(EWL_CONTAINER(s), s->button);
- ewl_widget_show(s->button);
- ewl_widget_appearance_set(s->button, "hbutton");
-
- /*
- * Set the starting orientation
- */
- s->orientation = EWL_ORIENTATION_HORIZONTAL;
-
- /*
- * Add necessary configuration callbacks
- */
- ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, ewl_seeker_cb_configure,
- NULL);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_DOWN,
- ewl_seeker_cb_mouse_down, NULL);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_UP,
- ewl_seeker_cb_mouse_up, NULL);
- ewl_callback_prepend(w, EWL_CALLBACK_DESTROY,
- ewl_seeker_cb_mouse_up, NULL);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE,
- ewl_seeker_cb_mouse_move, NULL);
- ewl_callback_append(w, EWL_CALLBACK_KEY_DOWN,
- ewl_seeker_cb_key_down, NULL);
- ewl_callback_append(w, EWL_CALLBACK_FOCUS_IN,
- ewl_container_cb_widget_focus_in, NULL);
- ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT,
- ewl_container_cb_widget_focus_out, NULL);
-
- /*
- * Append a callback for catching mouse movements on the button and
- * add the button to the seeker
- */
- ewl_callback_append(s->button, EWL_CALLBACK_MOUSE_DOWN,
- ewl_seeker_cb_button_mouse_down, NULL);
- ewl_callback_append(s->button, EWL_CALLBACK_MOUSE_UP,
- ewl_seeker_cb_button_mouse_up, NULL);
-
- /*
- * We want to catch mouse movement events from the button.
- */
- ewl_container_callback_notify(EWL_CONTAINER(s),
- EWL_CALLBACK_MOUSE_MOVE);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Widget *w;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, FALSE);
+
+ w = EWL_WIDGET(s);
+
+ if (!ewl_range_init(EWL_RANGE(w)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ /*
+ * Initialize the widget fields and set default orientation and type
+ */
+ ewl_widget_appearance_set(w, "hseeker");
+ ewl_widget_inherit(w, EWL_SEEKER_TYPE);
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_HFILL |
+ EWL_FLAG_FILL_HSHRINK);
+
+ ewl_container_show_notify_set(EWL_CONTAINER(w),
+ ewl_seeker_cb_child_show);
+
+ /*
+ * Create and add the button portion of the seeker
+ */
+ s->button = ewl_button_new();
+ ewl_widget_internal_set(s->button, TRUE);
+ ewl_container_child_append(EWL_CONTAINER(s), s->button);
+ ewl_widget_show(s->button);
+ ewl_widget_appearance_set(s->button, "hbutton");
+
+ /*
+ * Set the starting orientation
+ */
+ s->orientation = EWL_ORIENTATION_HORIZONTAL;
+
+ /*
+ * Add necessary configuration callbacks
+ */
+ ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, ewl_seeker_cb_configure,
+ NULL);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_DOWN,
+ ewl_seeker_cb_mouse_down, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_UP,
+ ewl_seeker_cb_mouse_up, NULL);
+ ewl_callback_prepend(w, EWL_CALLBACK_DESTROY,
+ ewl_seeker_cb_mouse_up, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE,
+ ewl_seeker_cb_mouse_move, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_KEY_DOWN,
+ ewl_seeker_cb_key_down, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_FOCUS_IN,
+ ewl_container_cb_widget_focus_in, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT,
+ ewl_container_cb_widget_focus_out, NULL);
+
+ /*
+ * Append a callback for catching mouse movements on the button and
+ * add the button to the seeker
+ */
+ ewl_callback_append(s->button, EWL_CALLBACK_MOUSE_DOWN,
+ ewl_seeker_cb_button_mouse_down, NULL);
+ ewl_callback_append(s->button, EWL_CALLBACK_MOUSE_UP,
+ ewl_seeker_cb_button_mouse_up, NULL);
+
+ /*
+ * We want to catch mouse movement events from the button.
+ */
+ ewl_container_callback_notify(EWL_CONTAINER(s),
+ EWL_CALLBACK_MOUSE_MOVE);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -165,28 +165,28 @@ ewl_seeker_init(Ewl_Seeker *s)
void
ewl_seeker_orientation_set(Ewl_Seeker *s, Ewl_Orientation o)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(s);
- DCHECK_TYPE(s, EWL_SEEKER_TYPE);
-
- if (o == s->orientation)
- DRETURN(DLEVEL_STABLE);
-
- s->orientation = o;
- if (o == EWL_ORIENTATION_HORIZONTAL) {
- ewl_widget_appearance_set(EWL_WIDGET(s), "hseeker");
- ewl_widget_appearance_set(s->button, "hbutton");
- ewl_object_fill_policy_set(EWL_OBJECT(s), EWL_FLAG_FILL_HFILL |
- EWL_FLAG_FILL_HSHRINK);
- }
- else {
- ewl_widget_appearance_set(EWL_WIDGET(s), "vseeker");
- ewl_widget_appearance_set(s->button, "vbutton");
- ewl_object_fill_policy_set(EWL_OBJECT(s), EWL_FLAG_FILL_VFILL |
- EWL_FLAG_FILL_VSHRINK);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(s);
+ DCHECK_TYPE(s, EWL_SEEKER_TYPE);
+
+ if (o == s->orientation)
+ DRETURN(DLEVEL_STABLE);
+
+ s->orientation = o;
+ if (o == EWL_ORIENTATION_HORIZONTAL) {
+ ewl_widget_appearance_set(EWL_WIDGET(s), "hseeker");
+ ewl_widget_appearance_set(s->button, "hbutton");
+ ewl_object_fill_policy_set(EWL_OBJECT(s), EWL_FLAG_FILL_HFILL |
+ EWL_FLAG_FILL_HSHRINK);
+ }
+ else {
+ ewl_widget_appearance_set(EWL_WIDGET(s), "vseeker");
+ ewl_widget_appearance_set(s->button, "vbutton");
+ ewl_object_fill_policy_set(EWL_OBJECT(s), EWL_FLAG_FILL_VFILL |
+ EWL_FLAG_FILL_VSHRINK);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -197,11 +197,11 @@ ewl_seeker_orientation_set(Ewl_Seeker *s, Ewl_Orientation o)
Ewl_Orientation
ewl_seeker_orientation_get(Ewl_Seeker *s)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, EWL_ORIENTATION_HORIZONTAL);
- DCHECK_TYPE_RET(s, EWL_SEEKER_TYPE, EWL_ORIENTATION_HORIZONTAL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, EWL_ORIENTATION_HORIZONTAL);
+ DCHECK_TYPE_RET(s, EWL_SEEKER_TYPE, EWL_ORIENTATION_HORIZONTAL);
- DRETURN_INT(s->orientation, DLEVEL_STABLE);
+ DRETURN_INT(s->orientation, DLEVEL_STABLE);
}
/**
@@ -217,24 +217,24 @@ ewl_seeker_orientation_get(Ewl_Seeker *s)
void
ewl_seeker_autohide_set(Ewl_Seeker *s, int v)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(s);
- DCHECK_TYPE(s, EWL_SEEKER_TYPE);
-
- if (s->autohide == v || s->autohide == -v)
- DRETURN(DLEVEL_STABLE);
-
- if (!v) {
- s->autohide = v;
- if (REALIZED(s))
- ewl_widget_show(EWL_WIDGET(s));
- }
- else if (s->autohide < 0)
- s->autohide = -v;
- else
- s->autohide = v;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(s);
+ DCHECK_TYPE(s, EWL_SEEKER_TYPE);
+
+ if (s->autohide == v || s->autohide == -v)
+ DRETURN(DLEVEL_STABLE);
+
+ if (!v) {
+ s->autohide = v;
+ if (REALIZED(s))
+ ewl_widget_show(EWL_WIDGET(s));
+ }
+ else if (s->autohide < 0)
+ s->autohide = -v;
+ else
+ s->autohide = v;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -245,11 +245,11 @@ ewl_seeker_autohide_set(Ewl_Seeker *s, int v)
int
ewl_seeker_autohide_get(Ewl_Seeker *s)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, 0);
- DCHECK_TYPE_RET(s, EWL_SEEKER_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, 0);
+ DCHECK_TYPE_RET(s, EWL_SEEKER_TYPE, 0);
- DRETURN_INT(abs(s->autohide), DLEVEL_STABLE);
+ DRETURN_INT(abs(s->autohide), DLEVEL_STABLE);
}
/**
@@ -264,73 +264,73 @@ ewl_seeker_autohide_get(Ewl_Seeker *s)
*/
void
ewl_seeker_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Seeker *s;
- Ewl_Range *r;
- double s1, s2;
- double range;
- int dx, dy;
- int dw, dh;
- int nw, nh;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_SEEKER_TYPE);
-
- s = EWL_SEEKER(w);
- r = EWL_RANGE(w);
-
- if (!s->button)
- DRETURN(DLEVEL_STABLE);
-
- dx = CURRENT_X(s);
- dy = CURRENT_Y(s);
- dw = CURRENT_W(s);
- dh = CURRENT_H(s);
-
- range = r->max_val - r->min_val;
- /*
- * First determine the size based on the number of steps to span from
- * min to max values. Then reduce the total scale to keep the button on
- * the seeker, then position the button.
- */
- s1 = r->step / range;
- if (s->autohide && s1 >= 1.0) {
- ewl_widget_hide(w);
- s->autohide = -abs(s->autohide);
- }
-
- if (r->invert)
- s2 = (r->max_val - r->value) / range;
- else
- s2 = (r->value - r->min_val) / range;
-
- if (s->orientation == EWL_ORIENTATION_VERTICAL) {
- dh *= s1;
- }
- else {
- dw *= s1;
- }
-
- ewl_object_size_request(EWL_OBJECT(s->button), dw, dh);
-
- /*
- * Get the resulting geometry to reposition the button appropriately.
- */
- nw = ewl_object_current_w_get(EWL_OBJECT(s->button));
- nh = ewl_object_current_h_get(EWL_OBJECT(s->button));
-
- if (s->orientation == EWL_ORIENTATION_VERTICAL) {
- dy += (CURRENT_H(s) - nh) * s2;
- }
- else {
- dx += (CURRENT_W(s) - nw) * s2;
- }
-
- ewl_object_place(EWL_OBJECT(s->button), dx, dy, nw, nh);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Seeker *s;
+ Ewl_Range *r;
+ double s1, s2;
+ double range;
+ int dx, dy;
+ int dw, dh;
+ int nw, nh;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_SEEKER_TYPE);
+
+ s = EWL_SEEKER(w);
+ r = EWL_RANGE(w);
+
+ if (!s->button)
+ DRETURN(DLEVEL_STABLE);
+
+ dx = CURRENT_X(s);
+ dy = CURRENT_Y(s);
+ dw = CURRENT_W(s);
+ dh = CURRENT_H(s);
+
+ range = r->max_val - r->min_val;
+ /*
+ * First determine the size based on the number of steps to span from
+ * min to max values. Then reduce the total scale to keep the button on
+ * the seeker, then position the button.
+ */
+ s1 = r->step / range;
+ if (s->autohide && s1 >= 1.0) {
+ ewl_widget_hide(w);
+ s->autohide = -abs(s->autohide);
+ }
+
+ if (r->invert)
+ s2 = (r->max_val - r->value) / range;
+ else
+ s2 = (r->value - r->min_val) / range;
+
+ if (s->orientation == EWL_ORIENTATION_VERTICAL) {
+ dh *= s1;
+ }
+ else {
+ dw *= s1;
+ }
+
+ ewl_object_size_request(EWL_OBJECT(s->button), dw, dh);
+
+ /*
+ * Get the resulting geometry to reposition the button appropriately.
+ */
+ nw = ewl_object_current_w_get(EWL_OBJECT(s->button));
+ nh = ewl_object_current_h_get(EWL_OBJECT(s->button));
+
+ if (s->orientation == EWL_ORIENTATION_VERTICAL) {
+ dy += (CURRENT_H(s) - nh) * s2;
+ }
+ else {
+ dx += (CURRENT_W(s) - nw) * s2;
+ }
+
+ ewl_object_place(EWL_OBJECT(s->button), dx, dy, nw, nh);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -343,29 +343,29 @@ ewl_seeker_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_seeker_cb_button_mouse_down(Ewl_Widget *w, void *ev_data,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Event_Mouse *ev;
- Ewl_Seeker *s;
- int xx, yy, ww, hh;
+ Ewl_Event_Mouse *ev;
+ Ewl_Seeker *s;
+ int xx, yy, ww, hh;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(ev_data);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- DCHECK_TYPE(w->parent, EWL_SEEKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(ev_data);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DCHECK_TYPE(w->parent, EWL_SEEKER_TYPE);
- ev = ev_data;
- s = EWL_SEEKER(w->parent);
+ ev = ev_data;
+ s = EWL_SEEKER(w->parent);
- ewl_object_current_geometry_get(EWL_OBJECT(w), &xx, &yy, &ww, &hh);
+ ewl_object_current_geometry_get(EWL_OBJECT(w), &xx, &yy, &ww, &hh);
- if (s->orientation == EWL_ORIENTATION_HORIZONTAL)
- s->dragstart = ev->x - (xx + ((ww + 1) / 2));
- else
- s->dragstart = ev->y - (yy + ((hh + 1) / 2));
+ if (s->orientation == EWL_ORIENTATION_HORIZONTAL)
+ s->dragstart = ev->x - (xx + ((ww + 1) / 2));
+ else
+ s->dragstart = ev->y - (yy + ((hh + 1) / 2));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -378,16 +378,16 @@ ewl_seeker_cb_button_mouse_down(Ewl_Widget *w, void *ev_data,
*/
void
ewl_seeker_cb_button_mouse_up(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- DCHECK_TYPE(w->parent, EWL_SEEKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DCHECK_TYPE(w->parent, EWL_SEEKER_TYPE);
- EWL_SEEKER(w->parent)->dragstart = 0;
+ EWL_SEEKER(w->parent)->dragstart = 0;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -400,52 +400,52 @@ ewl_seeker_cb_button_mouse_up(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_seeker_cb_mouse_move(Ewl_Widget *w, void *ev_data,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Event_Mouse *ev;
- Ewl_Seeker *s;
- Ewl_Range *r;
- double scale;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(ev_data);
- DCHECK_TYPE(w, EWL_SEEKER_TYPE);
-
- s = EWL_SEEKER(w);
- r = EWL_RANGE(w);
-
- if (r->step == r->max_val - r->min_val)
- DRETURN(DLEVEL_STABLE);
-
- ev = ev_data;
-
- /*
- * If the button is pressed, then continue to calculate it's value.
- */
- if (!ewl_object_state_has(EWL_OBJECT(s->button), EWL_FLAG_STATE_PRESSED)) {
-
- if (s->orientation == EWL_ORIENTATION_HORIZONTAL) {
- if (ewl_object_state_has(EWL_OBJECT(s),
- EWL_FLAG_STATE_PRESSED)) {
- s->dragstart = ev->x;
- }
- }
- else {
- if (ewl_object_state_has(EWL_OBJECT(s),
- EWL_FLAG_STATE_PRESSED)) {
- s->dragstart = ev->y;
- }
- }
- DRETURN(DLEVEL_STABLE);
- }
-
- scale = ewl_seeker_mouse_value_map(s, ev->x, ev->y);
-
- ewl_range_value_set(r, scale);
-
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Event_Mouse *ev;
+ Ewl_Seeker *s;
+ Ewl_Range *r;
+ double scale;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(ev_data);
+ DCHECK_TYPE(w, EWL_SEEKER_TYPE);
+
+ s = EWL_SEEKER(w);
+ r = EWL_RANGE(w);
+
+ if (r->step == r->max_val - r->min_val)
+ DRETURN(DLEVEL_STABLE);
+
+ ev = ev_data;
+
+ /*
+ * If the button is pressed, then continue to calculate it's value.
+ */
+ if (!ewl_object_state_has(EWL_OBJECT(s->button), EWL_FLAG_STATE_PRESSED)) {
+
+ if (s->orientation == EWL_ORIENTATION_HORIZONTAL) {
+ if (ewl_object_state_has(EWL_OBJECT(s),
+ EWL_FLAG_STATE_PRESSED)) {
+ s->dragstart = ev->x;
+ }
+ }
+ else {
+ if (ewl_object_state_has(EWL_OBJECT(s),
+ EWL_FLAG_STATE_PRESSED)) {
+ s->dragstart = ev->y;
+ }
+ }
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ scale = ewl_seeker_mouse_value_map(s, ev->x, ev->y);
+
+ ewl_range_value_set(r, scale);
+
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -458,62 +458,62 @@ ewl_seeker_cb_mouse_move(Ewl_Widget *w, void *ev_data,
*/
void
ewl_seeker_cb_mouse_down(Ewl_Widget *w, void *ev_data,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Seeker *s;
- Ewl_Range *r;
- Ewl_Event_Mouse *ev;
- double value, step = 0;
- int xx, yy, ww, hh;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(ev_data);
- DCHECK_TYPE(w, EWL_SEEKER_TYPE);
-
- ev = ev_data;
- s = EWL_SEEKER(w);
- r = EWL_RANGE(w);
-
- if (ewl_object_state_has(EWL_OBJECT(s->button), EWL_FLAG_STATE_PRESSED))
- DRETURN(DLEVEL_STABLE);
-
- ewl_object_current_geometry_get(EWL_OBJECT(s->button),
- &xx, &yy, &ww, &hh);
-
- value = r->value;
-
- /*
- * Increment or decrement the value based on the position of the click
- * relative to the button and the orientation of the seeker.
- */
- if (s->orientation == EWL_ORIENTATION_HORIZONTAL) {
- s->dragstart = ev->x;
- if (ev->x < xx) {
- step = -r->step;
- }
- else if (ev->x > xx + ww) {
- step = r->step;
- }
- }
- else {
- s->dragstart = ev->y;
- if (ev->y < yy)
- step = -r->step;
- else if (ev->y > yy + hh)
- step = r->step;
- }
-
- if (r->invert)
- step = -step;
- value += step;
-
- ewl_range_value_set(r, value);
-
- s->start_time = ecore_time_get();
- s->timer = ecore_timer_add(0.5, ewl_seeker_timer, s);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Seeker *s;
+ Ewl_Range *r;
+ Ewl_Event_Mouse *ev;
+ double value, step = 0;
+ int xx, yy, ww, hh;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(ev_data);
+ DCHECK_TYPE(w, EWL_SEEKER_TYPE);
+
+ ev = ev_data;
+ s = EWL_SEEKER(w);
+ r = EWL_RANGE(w);
+
+ if (ewl_object_state_has(EWL_OBJECT(s->button), EWL_FLAG_STATE_PRESSED))
+ DRETURN(DLEVEL_STABLE);
+
+ ewl_object_current_geometry_get(EWL_OBJECT(s->button),
+ &xx, &yy, &ww, &hh);
+
+ value = r->value;
+
+ /*
+ * Increment or decrement the value based on the position of the click
+ * relative to the button and the orientation of the seeker.
+ */
+ if (s->orientation == EWL_ORIENTATION_HORIZONTAL) {
+ s->dragstart = ev->x;
+ if (ev->x < xx) {
+ step = -r->step;
+ }
+ else if (ev->x > xx + ww) {
+ step = r->step;
+ }
+ }
+ else {
+ s->dragstart = ev->y;
+ if (ev->y < yy)
+ step = -r->step;
+ else if (ev->y > yy + hh)
+ step = r->step;
+ }
+
+ if (r->invert)
+ step = -step;
+ value += step;
+
+ ewl_range_value_set(r, value);
+
+ s->start_time = ecore_time_get();
+ s->timer = ecore_timer_add(0.5, ewl_seeker_timer, s);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -526,22 +526,22 @@ ewl_seeker_cb_mouse_down(Ewl_Widget *w, void *ev_data,
*/
void
ewl_seeker_cb_mouse_up(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Seeker *s = EWL_SEEKER(w);
+ Ewl_Seeker *s = EWL_SEEKER(w);
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_SEEKER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_SEEKER_TYPE);
- if (s->timer)
- ecore_timer_del(s->timer);
+ if (s->timer)
+ ecore_timer_del(s->timer);
- s->timer = NULL;
- s->start_time = 0;
- s->dragstart = 0;
+ s->timer = NULL;
+ s->start_time = 0;
+ s->dragstart = 0;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -554,52 +554,52 @@ ewl_seeker_cb_mouse_up(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_seeker_cb_key_down(Ewl_Widget *w, void *ev_data,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Range *r;
- Ewl_Event_Key *ev;
- double start, end;
-
- void (*increase)(Ewl_Range *r);
- void (*decrease)(Ewl_Range *r);
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(ev_data);
- DCHECK_TYPE(w, EWL_SEEKER_TYPE);
-
- ev = ev_data;
- r = EWL_RANGE(w);
-
- if (!r->invert) {
- increase = ewl_range_increase;
- decrease = ewl_range_decrease;
- start = r->min_val;
- end = r->max_val;
- }
- else {
- increase = ewl_range_decrease;
- decrease = ewl_range_increase;
- start = r->max_val;
- end = r->min_val;
- }
-
- if (!strcmp(ev->keyname, "Home"))
- ewl_range_value_set(r, start);
- else if (!strcmp(ev->keyname, "End"))
- ewl_range_value_set(r, end);
- else if (!strcmp(ev->keyname, "Left")
- || !strcmp(ev->keyname, "KP_Left")
- || !strcmp(ev->keyname, "Up")
- || !strcmp(ev->keyname, "KP_Up"))
- decrease(r);
- else if (!strcmp(ev->keyname, "Right")
- || !strcmp(ev->keyname, "KP_Right")
- || !strcmp(ev->keyname, "Down")
- || !strcmp(ev->keyname, "KP_Down"))
- increase(r);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Range *r;
+ Ewl_Event_Key *ev;
+ double start, end;
+
+ void (*increase)(Ewl_Range *r);
+ void (*decrease)(Ewl_Range *r);
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(ev_data);
+ DCHECK_TYPE(w, EWL_SEEKER_TYPE);
+
+ ev = ev_data;
+ r = EWL_RANGE(w);
+
+ if (!r->invert) {
+ increase = ewl_range_increase;
+ decrease = ewl_range_decrease;
+ start = r->min_val;
+ end = r->max_val;
+ }
+ else {
+ increase = ewl_range_decrease;
+ decrease = ewl_range_increase;
+ start = r->max_val;
+ end = r->min_val;
+ }
+
+ if (!strcmp(ev->keyname, "Home"))
+ ewl_range_value_set(r, start);
+ else if (!strcmp(ev->keyname, "End"))
+ ewl_range_value_set(r, end);
+ else if (!strcmp(ev->keyname, "Left")
+ || !strcmp(ev->keyname, "KP_Left")
+ || !strcmp(ev->keyname, "Up")
+ || !strcmp(ev->keyname, "KP_Up"))
+ decrease(r);
+ else if (!strcmp(ev->keyname, "Right")
+ || !strcmp(ev->keyname, "KP_Right")
+ || !strcmp(ev->keyname, "Down")
+ || !strcmp(ev->keyname, "KP_Down"))
+ increase(r);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -612,136 +612,136 @@ ewl_seeker_cb_key_down(Ewl_Widget *w, void *ev_data,
void
ewl_seeker_cb_child_show(Ewl_Container *p, Ewl_Widget *w)
{
- int pw, ph;
- Ewl_Range *r;
+ int pw, ph;
+ Ewl_Range *r;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(p, EWL_SEEKER_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(p, EWL_SEEKER_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- r = EWL_RANGE(p);
+ r = EWL_RANGE(p);
- pw = ewl_object_preferred_w_get(EWL_OBJECT(w));
- ph = ewl_object_preferred_h_get(EWL_OBJECT(w));
+ pw = ewl_object_preferred_w_get(EWL_OBJECT(w));
+ ph = ewl_object_preferred_h_get(EWL_OBJECT(w));
- if (EWL_SEEKER(r)->orientation == EWL_ORIENTATION_HORIZONTAL)
- pw *= (r->max_val - r->min_val) / r->step;
- else
- ph *= (r->max_val - r->min_val) / r->step;
+ if (EWL_SEEKER(r)->orientation == EWL_ORIENTATION_HORIZONTAL)
+ pw *= (r->max_val - r->min_val) / r->step;
+ else
+ ph *= (r->max_val - r->min_val) / r->step;
- ewl_object_preferred_inner_size_set(EWL_OBJECT(p), pw, ph);
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(p), pw, ph);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static double
ewl_seeker_mouse_value_map(Ewl_Seeker *s, int mx, int my)
{
- Ewl_Range *r;
- int m;
- int dc, dg;
- int adjust;
- double scale;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, 0.0);
- DCHECK_TYPE_RET(s, EWL_SEEKER_TYPE, 0.0);
-
- r = EWL_RANGE(s);
-
- if (s->orientation == EWL_ORIENTATION_HORIZONTAL) {
- m = mx;
-
- dc = CURRENT_X(s);
- dg = CURRENT_W(s);
-
- adjust = ewl_object_current_w_get(EWL_OBJECT(s->button));
- }
- else {
- m = my;
- dc = CURRENT_Y(s);
- dg = CURRENT_H(s);
-
- adjust = ewl_object_current_h_get(EWL_OBJECT(s->button));
- }
-
- /*
- * Adjust mouse position based on drag starting point.
- */
- m -= s->dragstart;
-
- /*
- * Adjust the scale to align on the center of the drag bar.
- */
- dg -= adjust;
- adjust /= 2;
- dc += adjust;
-
- /*
- * Bounds checking on the value.
- */
- if (m < dc)
- m = dc;
- else if (m > dc + dg)
- m = dc + dg;
-
- /*
- * Calculate the new value based on the range, sizes and new position.
- */
- scale = (r->max_val - r->min_val) * (double)(m - dc) / (double)dg;
-
- if (!r->invert)
- scale = r->min_val + scale;
- else
- scale = r->max_val - scale;
-
- DRETURN_FLOAT(scale, DLEVEL_STABLE);
+ Ewl_Range *r;
+ int m;
+ int dc, dg;
+ int adjust;
+ double scale;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, 0.0);
+ DCHECK_TYPE_RET(s, EWL_SEEKER_TYPE, 0.0);
+
+ r = EWL_RANGE(s);
+
+ if (s->orientation == EWL_ORIENTATION_HORIZONTAL) {
+ m = mx;
+
+ dc = CURRENT_X(s);
+ dg = CURRENT_W(s);
+
+ adjust = ewl_object_current_w_get(EWL_OBJECT(s->button));
+ }
+ else {
+ m = my;
+ dc = CURRENT_Y(s);
+ dg = CURRENT_H(s);
+
+ adjust = ewl_object_current_h_get(EWL_OBJECT(s->button));
+ }
+
+ /*
+ * Adjust mouse position based on drag starting point.
+ */
+ m -= s->dragstart;
+
+ /*
+ * Adjust the scale to align on the center of the drag bar.
+ */
+ dg -= adjust;
+ adjust /= 2;
+ dc += adjust;
+
+ /*
+ * Bounds checking on the value.
+ */
+ if (m < dc)
+ m = dc;
+ else if (m > dc + dg)
+ m = dc + dg;
+
+ /*
+ * Calculate the new value based on the range, sizes and new position.
+ */
+ scale = (r->max_val - r->min_val) * (double)(m - dc) / (double)dg;
+
+ if (!r->invert)
+ scale = r->min_val + scale;
+ else
+ scale = r->max_val - scale;
+
+ DRETURN_FLOAT(scale, DLEVEL_STABLE);
}
static int
ewl_seeker_timer(void *data)
{
- Ewl_Seeker *s;
- double value, posval, step;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, ECORE_CALLBACK_CANCEL);
- DCHECK_TYPE_RET(data, EWL_SEEKER_TYPE, ECORE_CALLBACK_CANCEL);
-
- s = EWL_SEEKER(data);
- value = ewl_range_value_get(EWL_RANGE(s));
- step = ewl_range_step_get(EWL_RANGE(s));
-
- /*
- * Find the value based on mouse position
- */
- posval = ewl_seeker_mouse_value_map(s, s->dragstart * 2,
- s->dragstart * 2);
-
- /*
- * Limit the value to the intersection with the mouse.
- */
- if (posval > value) {
- if (value + step > posval) {
- value = posval;
- }
- else {
- value += step;
- }
- }
- else {
- if (value - step < posval) {
- value = posval;
- }
- else {
- value -= step;
- }
- }
-
- ewl_range_value_set(EWL_RANGE(s), value);
-
- DRETURN_INT(ECORE_CALLBACK_RENEW, DLEVEL_STABLE);
+ Ewl_Seeker *s;
+ double value, posval, step;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, ECORE_CALLBACK_CANCEL);
+ DCHECK_TYPE_RET(data, EWL_SEEKER_TYPE, ECORE_CALLBACK_CANCEL);
+
+ s = EWL_SEEKER(data);
+ value = ewl_range_value_get(EWL_RANGE(s));
+ step = ewl_range_step_get(EWL_RANGE(s));
+
+ /*
+ * Find the value based on mouse position
+ */
+ posval = ewl_seeker_mouse_value_map(s, s->dragstart * 2,
+ s->dragstart * 2);
+
+ /*
+ * Limit the value to the intersection with the mouse.
+ */
+ if (posval > value) {
+ if (value + step > posval) {
+ value = posval;
+ }
+ else {
+ value += step;
+ }
+ }
+ else {
+ if (value - step < posval) {
+ value = posval;
+ }
+ else {
+ value -= step;
+ }
+ }
+
+ ewl_range_value_set(EWL_RANGE(s), value);
+
+ DRETURN_INT(ECORE_CALLBACK_RENEW, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_seeker.h b/src/lib/ewl_seeker.h
index e8c29cb..8cd2bd9 100644
--- a/src/lib/ewl_seeker.h
+++ b/src/lib/ewl_seeker.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_SEEKER_H
#define EWL_SEEKER_H
@@ -53,34 +53,34 @@ typedef struct Ewl_Seeker Ewl_Seeker;
*/
struct Ewl_Seeker
{
- Ewl_Range range; /**< Inherit from Ewl_Range */
- Ewl_Orientation orientation; /**< Indicates layout direction */
- Ewl_Widget *button; /**< Draggable widget for selecting value */
- int dragstart; /**< The coordinate where the drag starts */
- int autohide; /**< Indicator to hide when not scrollable */
- Ecore_Timer *timer; /**< Timer for scroll repeating */
- double start_time; /**< Time the timer was started */
+ Ewl_Range range; /**< Inherit from Ewl_Range */
+ Ewl_Orientation orientation; /**< Indicates layout direction */
+ Ewl_Widget *button; /**< Draggable widget for selecting value */
+ int dragstart; /**< The coordinate where the drag starts */
+ int autohide; /**< Indicator to hide when not scrollable */
+ Ecore_Timer *timer; /**< Timer for scroll repeating */
+ double start_time; /**< Time the timer was started */
};
-Ewl_Widget *ewl_seeker_new(void);
-Ewl_Widget *ewl_hseeker_new(void);
-Ewl_Widget *ewl_vseeker_new(void);
-int ewl_seeker_init(Ewl_Seeker *s);
+Ewl_Widget *ewl_seeker_new(void);
+Ewl_Widget *ewl_hseeker_new(void);
+Ewl_Widget *ewl_vseeker_new(void);
+int ewl_seeker_init(Ewl_Seeker *s);
-void ewl_seeker_orientation_set(Ewl_Seeker *s, Ewl_Orientation o);
+void ewl_seeker_orientation_set(Ewl_Seeker *s, Ewl_Orientation o);
Ewl_Orientation ewl_seeker_orientation_get(Ewl_Seeker *s);
-void ewl_seeker_autohide_set(Ewl_Seeker *s, int v);
-int ewl_seeker_autohide_get(Ewl_Seeker *s);
+void ewl_seeker_autohide_set(Ewl_Seeker *s, int v);
+int ewl_seeker_autohide_get(Ewl_Seeker *s);
/*
* Internally used callbacks, override at your own risk.
*/
void ewl_seeker_cb_configure(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_seeker_cb_button_mouse_down(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
void ewl_seeker_cb_button_mouse_up(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
void ewl_seeker_cb_mouse_move(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_seeker_cb_mouse_down(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_seeker_cb_mouse_up(Ewl_Widget *w, void *ev_data, void *user_data);
diff --git a/src/lib/ewl_separator.c b/src/lib/ewl_separator.c
index 6c8fac9..03de5b1 100644
--- a/src/lib/ewl_separator.c
+++ b/src/lib/ewl_separator.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_separator.h"
#include "ewl_macros.h"
@@ -12,20 +12,20 @@
Ewl_Widget *
ewl_separator_new(void)
{
- Ewl_Separator *s;
+ Ewl_Separator *s;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- s = NEW(Ewl_Separator, 1);
- if (!s)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ s = NEW(Ewl_Separator, 1);
+ if (!s)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_separator_init(s)) {
- ewl_widget_destroy(EWL_WIDGET(s));
- s = NULL;
- }
+ if (!ewl_separator_init(s)) {
+ ewl_widget_destroy(EWL_WIDGET(s));
+ s = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
}
/**
@@ -35,16 +35,16 @@ ewl_separator_new(void)
Ewl_Widget *
ewl_hseparator_new(void)
{
- Ewl_Widget *s;
+ Ewl_Widget *s;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- s = ewl_separator_new();
- if (s)
- ewl_separator_orientation_set(EWL_SEPARATOR(s),
- EWL_ORIENTATION_HORIZONTAL);
+ s = ewl_separator_new();
+ if (s)
+ ewl_separator_orientation_set(EWL_SEPARATOR(s),
+ EWL_ORIENTATION_HORIZONTAL);
- DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
}
/**
@@ -54,16 +54,16 @@ ewl_hseparator_new(void)
Ewl_Widget *
ewl_vseparator_new(void)
{
- Ewl_Widget *s;
+ Ewl_Widget *s;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- s = ewl_separator_new();
- if (s)
- ewl_separator_orientation_set(EWL_SEPARATOR(s),
- EWL_ORIENTATION_VERTICAL);
+ s = ewl_separator_new();
+ if (s)
+ ewl_separator_orientation_set(EWL_SEPARATOR(s),
+ EWL_ORIENTATION_VERTICAL);
- DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
}
/**
@@ -77,27 +77,27 @@ ewl_vseparator_new(void)
int
ewl_separator_init(Ewl_Separator *s)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, FALSE);
- w = EWL_WIDGET(s);
- if (!ewl_widget_init(w))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ w = EWL_WIDGET(s);
+ if (!ewl_widget_init(w))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_inherit(w, EWL_SEPARATOR_TYPE);
- ewl_widget_appearance_set(EWL_WIDGET(s), "hseparator");
- ewl_object_fill_policy_set(EWL_OBJECT(s), EWL_FLAG_FILL_HFILL |
- EWL_FLAG_FILL_SHRINK);
+ ewl_widget_inherit(w, EWL_SEPARATOR_TYPE);
+ ewl_widget_appearance_set(EWL_WIDGET(s), "hseparator");
+ ewl_object_fill_policy_set(EWL_OBJECT(s), EWL_FLAG_FILL_HFILL |
+ EWL_FLAG_FILL_SHRINK);
- ewl_object_alignment_set(EWL_OBJECT(s), EWL_FLAG_ALIGN_LEFT);
+ ewl_object_alignment_set(EWL_OBJECT(s), EWL_FLAG_ALIGN_LEFT);
- s->orientation = EWL_ORIENTATION_HORIZONTAL;
+ s->orientation = EWL_ORIENTATION_HORIZONTAL;
- ewl_widget_focusable_set(w, FALSE);
+ ewl_widget_focusable_set(w, FALSE);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -109,31 +109,31 @@ ewl_separator_init(Ewl_Separator *s)
void
ewl_separator_orientation_set(Ewl_Separator *s, Ewl_Orientation o)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(s);
- DCHECK_TYPE(s, EWL_SEPARATOR_TYPE);
-
- if (s->orientation == o)
- DRETURN(DLEVEL_STABLE);
-
- s->orientation = o;
-
- if (o == EWL_ORIENTATION_HORIZONTAL) {
- ewl_widget_appearance_set(EWL_WIDGET(s), "hseparator");
- ewl_object_fill_policy_set(EWL_OBJECT(s),
- EWL_FLAG_FILL_HFILL |
- EWL_FLAG_FILL_HSHRINK);
- }
- else {
- ewl_widget_appearance_set(EWL_WIDGET(s), "vseparator");
- ewl_object_fill_policy_set(EWL_OBJECT(s),
- EWL_FLAG_FILL_VFILL |
- EWL_FLAG_FILL_VSHRINK);
- }
-
- ewl_widget_configure(EWL_WIDGET(s));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(s);
+ DCHECK_TYPE(s, EWL_SEPARATOR_TYPE);
+
+ if (s->orientation == o)
+ DRETURN(DLEVEL_STABLE);
+
+ s->orientation = o;
+
+ if (o == EWL_ORIENTATION_HORIZONTAL) {
+ ewl_widget_appearance_set(EWL_WIDGET(s), "hseparator");
+ ewl_object_fill_policy_set(EWL_OBJECT(s),
+ EWL_FLAG_FILL_HFILL |
+ EWL_FLAG_FILL_HSHRINK);
+ }
+ else {
+ ewl_widget_appearance_set(EWL_WIDGET(s), "vseparator");
+ ewl_object_fill_policy_set(EWL_OBJECT(s),
+ EWL_FLAG_FILL_VFILL |
+ EWL_FLAG_FILL_VSHRINK);
+ }
+
+ ewl_widget_configure(EWL_WIDGET(s));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -144,10 +144,10 @@ ewl_separator_orientation_set(Ewl_Separator *s, Ewl_Orientation o)
Ewl_Orientation
ewl_separator_orientation_get(Ewl_Separator *s)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, EWL_ORIENTATION_HORIZONTAL);
- DCHECK_TYPE_RET(s, EWL_SEPARATOR_TYPE, EWL_ORIENTATION_HORIZONTAL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, EWL_ORIENTATION_HORIZONTAL);
+ DCHECK_TYPE_RET(s, EWL_SEPARATOR_TYPE, EWL_ORIENTATION_HORIZONTAL);
- DRETURN_INT(s->orientation, DLEVEL_STABLE);
+ DRETURN_INT(s->orientation, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_separator.h b/src/lib/ewl_separator.h
index 34ecad9..11744f0 100644
--- a/src/lib/ewl_separator.h
+++ b/src/lib/ewl_separator.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_SEPARATOR_H
#define EWL_SEPARATOR_H
@@ -52,15 +52,15 @@ typedef struct Ewl_Separator Ewl_Separator;
*/
struct Ewl_Separator
{
- Ewl_Widget widget; /**< Inherit from Ewl_Widget */
- Ewl_Orientation orientation; /**< Sets drawing horizontal or vertical */
+ Ewl_Widget widget; /**< Inherit from Ewl_Widget */
+ Ewl_Orientation orientation; /**< Sets drawing horizontal or vertical */
};
-Ewl_Widget *ewl_separator_new(void);
-Ewl_Widget *ewl_hseparator_new(void);
-Ewl_Widget *ewl_vseparator_new(void);
-int ewl_separator_init(Ewl_Separator *s);
-void ewl_separator_orientation_set(Ewl_Separator *s, Ewl_Orientation o);
+Ewl_Widget *ewl_separator_new(void);
+Ewl_Widget *ewl_hseparator_new(void);
+Ewl_Widget *ewl_vseparator_new(void);
+int ewl_separator_init(Ewl_Separator *s);
+void ewl_separator_orientation_set(Ewl_Separator *s, Ewl_Orientation o);
Ewl_Orientation ewl_separator_orientation_get(Ewl_Separator *s);
/**
diff --git a/src/lib/ewl_shadow.c b/src/lib/ewl_shadow.c
index d6b8c54..5e35447 100644
--- a/src/lib/ewl_shadow.c
+++ b/src/lib/ewl_shadow.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_shadow.h"
#include "ewl_macros.h"
@@ -12,21 +12,21 @@
Ewl_Widget *
ewl_shadow_new(void)
{
- Ewl_Shadow *s;
+ Ewl_Shadow *s;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- s = NEW(Ewl_Shadow, 1);
- if (!s)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ s = NEW(Ewl_Shadow, 1);
+ if (!s)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_shadow_init(s))
- {
- ewl_widget_destroy(EWL_WIDGET(s));
- s = NULL;
- }
+ if (!ewl_shadow_init(s))
+ {
+ ewl_widget_destroy(EWL_WIDGET(s));
+ s = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
}
/**
@@ -37,18 +37,18 @@ ewl_shadow_new(void)
int
ewl_shadow_init(Ewl_Shadow *s)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, FALSE);
- if (!ewl_box_init(EWL_BOX(s)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_box_init(EWL_BOX(s)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_box_orientation_set(EWL_BOX(s), EWL_ORIENTATION_VERTICAL);
- ewl_object_fill_policy_set(EWL_OBJECT(s), EWL_FLAG_FILL_SHRINK);
+ ewl_box_orientation_set(EWL_BOX(s), EWL_ORIENTATION_VERTICAL);
+ ewl_object_fill_policy_set(EWL_OBJECT(s), EWL_FLAG_FILL_SHRINK);
- ewl_widget_appearance_set(EWL_WIDGET(s), EWL_SHADOW_TYPE);
- ewl_widget_inherit(EWL_WIDGET(s), EWL_SHADOW_TYPE);
+ ewl_widget_appearance_set(EWL_WIDGET(s), EWL_SHADOW_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(s), EWL_SHADOW_TYPE);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_shadow.h b/src/lib/ewl_shadow.h
index bb992e1..5415fc8 100644
--- a/src/lib/ewl_shadow.h
+++ b/src/lib/ewl_shadow.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_SHADOW_H
#define EWL_SHADOW_H
@@ -51,11 +51,11 @@ typedef struct Ewl_Shadow Ewl_Shadow;
*/
struct Ewl_Shadow
{
- Ewl_Box box; /**< Inherit from Ewl_Box */
+ Ewl_Box box; /**< Inherit from Ewl_Box */
};
-Ewl_Widget *ewl_shadow_new(void);
-int ewl_shadow_init(Ewl_Shadow *s);
+Ewl_Widget *ewl_shadow_new(void);
+int ewl_shadow_init(Ewl_Shadow *s);
/**
* @}
diff --git a/src/lib/ewl_spacer.c b/src/lib/ewl_spacer.c
index cac8bb5..aa38e20 100644
--- a/src/lib/ewl_spacer.c
+++ b/src/lib/ewl_spacer.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_spacer.h"
#include "ewl_macros.h"
@@ -12,20 +12,20 @@
Ewl_Widget *
ewl_spacer_new(void)
{
- Ewl_Spacer *s;
+ Ewl_Spacer *s;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- s = NEW(Ewl_Spacer, 1);
- if (!s)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ s = NEW(Ewl_Spacer, 1);
+ if (!s)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_spacer_init(s)) {
- ewl_widget_destroy(EWL_WIDGET(s));
- s = NULL;
- }
+ if (!ewl_spacer_init(s)) {
+ ewl_widget_destroy(EWL_WIDGET(s));
+ s = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
}
/**
@@ -38,14 +38,14 @@ ewl_spacer_new(void)
int
ewl_spacer_init(Ewl_Spacer *s)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, FALSE);
- ewl_widget_init(EWL_WIDGET(s));
- ewl_widget_appearance_set(EWL_WIDGET(s), EWL_SPACER_TYPE);
- ewl_widget_inherit(EWL_WIDGET(s), EWL_SPACER_TYPE);
- ewl_widget_focusable_set(EWL_WIDGET(s), FALSE);
+ ewl_widget_init(EWL_WIDGET(s));
+ ewl_widget_appearance_set(EWL_WIDGET(s), EWL_SPACER_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(s), EWL_SPACER_TYPE);
+ ewl_widget_focusable_set(EWL_WIDGET(s), FALSE);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_spacer.h b/src/lib/ewl_spacer.h
index 0ebdd71..0059708 100644
--- a/src/lib/ewl_spacer.h
+++ b/src/lib/ewl_spacer.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_SPACER_H
#define EWL_SPACER_H
@@ -42,7 +42,7 @@ typedef struct Ewl_Spacer Ewl_Spacer;
*/
struct Ewl_Spacer
{
- Ewl_Widget widget; /**< Inherit from Ewl_Widget */
+ Ewl_Widget widget; /**< Inherit from Ewl_Widget */
};
/**
@@ -51,8 +51,8 @@ struct Ewl_Spacer
*/
#define EWL_SPACER(spacer) ((Ewl_Spacer *) spacer)
-Ewl_Widget *ewl_spacer_new(void);
-int ewl_spacer_init(Ewl_Spacer *s);
+Ewl_Widget *ewl_spacer_new(void);
+int ewl_spacer_init(Ewl_Spacer *s);
/**
* @}
diff --git a/src/lib/ewl_spectrum.c b/src/lib/ewl_spectrum.c
index 929d809..78f4f53 100644
--- a/src/lib/ewl_spectrum.c
+++ b/src/lib/ewl_spectrum.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_spectrum.h"
#include "ewl_image.h"
@@ -15,28 +15,28 @@ static void ewl_spectrum_draw(Ewl_Spectrum *sp);
static void ewl_spectrum_cross_hairs_draw(Ewl_Spectrum *sp);
static void ewl_spectrum_mouse_process(Ewl_Spectrum *sp, int x, int y);
static void ewl_spectrum_hsv_to_rgb(double h, double s, double v,
- unsigned int *r, unsigned int *g,
- unsigned int *b);
+ unsigned int *r, unsigned int *g,
+ unsigned int *b);
static void ewl_spectrum_rgb_to_hsv(unsigned int r, unsigned int g, unsigned int b,
- double *h, double *s, double *v);
+ double *h, double *s, double *v);
static void ewl_spectrum_color_coord_map(Ewl_Spectrum *sp, int x, int y,
- int w, int h, unsigned int *r,
- unsigned int *g, unsigned int *b);
+ int w, int h, unsigned int *r,
+ unsigned int *g, unsigned int *b);
static void ewl_spectrum_color_coord_xy_get(Ewl_Spectrum *sp, int *x, int *y,
- int w, int h, unsigned int r,
- unsigned int g, unsigned int b);
+ int w, int h, unsigned int r,
+ unsigned int g, unsigned int b);
static void ewl_spectrum_color_coord_map_vertical(Ewl_Spectrum *sp, int y,
- int img_h, unsigned int *r,
- unsigned int *g, unsigned int *b);
+ int img_h, unsigned int *r,
+ unsigned int *g, unsigned int *b);
static void ewl_spectrum_color_coord_map_square(Ewl_Spectrum *sp, int x,
- int y, int img_w, int img_h, unsigned int *r,
- unsigned int *g, unsigned int *b);
+ int y, int img_w, int img_h, unsigned int *r,
+ unsigned int *g, unsigned int *b);
static void ewl_spectrum_color_coord_vertical_y_get(Ewl_Spectrum *sp,
- int *y, int img_h,
- unsigned int r, unsigned int g, unsigned int b);
+ int *y, int img_h,
+ unsigned int r, unsigned int g, unsigned int b);
static void ewl_spectrum_color_coord_square_xy_get(Ewl_Spectrum *sp,
- int *x, int *y, int img_w, int img_h,
- unsigned int r, unsigned int g, unsigned int b);
+ int *x, int *y, int img_w, int img_h,
+ unsigned int r, unsigned int g, unsigned int b);
/**
* @return Returns a new Ewl_Spectrum widget or NULL on failure
@@ -45,23 +45,23 @@ static void ewl_spectrum_color_coord_square_xy_get(Ewl_Spectrum *sp,
Ewl_Widget *
ewl_spectrum_new(void)
{
- Ewl_Widget *sp;
+ Ewl_Widget *sp;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- sp = NEW(Ewl_Spectrum, 1);
- if (!sp)
- {
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ sp = NEW(Ewl_Spectrum, 1);
+ if (!sp)
+ {
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- if (!ewl_spectrum_init(EWL_SPECTRUM(sp)))
- {
- ewl_widget_destroy(sp);
- sp = NULL;
- }
+ if (!ewl_spectrum_init(EWL_SPECTRUM(sp)))
+ {
+ ewl_widget_destroy(sp);
+ sp = NULL;
+ }
- DRETURN_PTR(sp, DLEVEL_STABLE);
+ DRETURN_PTR(sp, DLEVEL_STABLE);
}
/**
@@ -72,57 +72,57 @@ ewl_spectrum_new(void)
int
ewl_spectrum_init(Ewl_Spectrum *sp)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(sp, FALSE);
-
- if (!ewl_container_init(EWL_CONTAINER(sp)))
- {
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
-
- ewl_widget_appearance_set(EWL_WIDGET(sp), EWL_SPECTRUM_TYPE);
- ewl_widget_inherit(EWL_WIDGET(sp), EWL_SPECTRUM_TYPE);
- ewl_object_fill_policy_set(EWL_OBJECT(sp), EWL_FLAG_FILL_FILL);
- ewl_container_callback_intercept(EWL_CONTAINER(sp),
- EWL_CALLBACK_MOUSE_MOVE);
- ewl_container_callback_intercept(EWL_CONTAINER(sp),
- EWL_CALLBACK_MOUSE_DOWN);
- ewl_container_callback_intercept(EWL_CONTAINER(sp),
- EWL_CALLBACK_MOUSE_UP);
-
- ewl_callback_append(EWL_WIDGET(sp), EWL_CALLBACK_MOUSE_DOWN,
- ewl_spectrum_cb_mouse_down, NULL);
- ewl_callback_append(EWL_WIDGET(sp), EWL_CALLBACK_MOUSE_UP,
- ewl_spectrum_cb_mouse_up, NULL);
-
- sp->type = EWL_SPECTRUM_TYPE_SQUARE;
-
- /* create the canvas */
- sp->canvas = ewl_image_new();
- ewl_container_child_append(EWL_CONTAINER(sp), sp->canvas);
- ewl_object_fill_policy_set(EWL_OBJECT(sp->canvas), EWL_FLAG_FILL_FILL);
- ewl_widget_internal_set(sp->canvas, TRUE);
- ewl_callback_append(EWL_WIDGET(sp->canvas), EWL_CALLBACK_REVEAL,
- ewl_spectrum_canvas_cb_reveal, sp);
- ewl_widget_show(sp->canvas);
-
- /* create the cross hairs to draw on the spectrum */
- sp->cross_hairs.horizontal = ewl_hseparator_new();
- ewl_container_child_append(EWL_CONTAINER(sp), sp->cross_hairs.horizontal);
- ewl_widget_internal_set(sp->cross_hairs.horizontal, TRUE);
- ewl_widget_layer_priority_set(sp->cross_hairs.horizontal, 1);
-
- sp->cross_hairs.vertical = ewl_vseparator_new();
- ewl_container_child_append(EWL_CONTAINER(sp), sp->cross_hairs.vertical);
- ewl_widget_internal_set(sp->cross_hairs.vertical, TRUE);
- ewl_widget_layer_priority_set(sp->cross_hairs.vertical, 1);
-
- ewl_callback_append(EWL_WIDGET(sp), EWL_CALLBACK_CONFIGURE,
- ewl_spectrum_cb_configure, NULL);
-
- ewl_spectrum_rgb_set(sp, 255, 255, 255);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(sp, FALSE);
+
+ if (!ewl_container_init(EWL_CONTAINER(sp)))
+ {
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+
+ ewl_widget_appearance_set(EWL_WIDGET(sp), EWL_SPECTRUM_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(sp), EWL_SPECTRUM_TYPE);
+ ewl_object_fill_policy_set(EWL_OBJECT(sp), EWL_FLAG_FILL_FILL);
+ ewl_container_callback_intercept(EWL_CONTAINER(sp),
+ EWL_CALLBACK_MOUSE_MOVE);
+ ewl_container_callback_intercept(EWL_CONTAINER(sp),
+ EWL_CALLBACK_MOUSE_DOWN);
+ ewl_container_callback_intercept(EWL_CONTAINER(sp),
+ EWL_CALLBACK_MOUSE_UP);
+
+ ewl_callback_append(EWL_WIDGET(sp), EWL_CALLBACK_MOUSE_DOWN,
+ ewl_spectrum_cb_mouse_down, NULL);
+ ewl_callback_append(EWL_WIDGET(sp), EWL_CALLBACK_MOUSE_UP,
+ ewl_spectrum_cb_mouse_up, NULL);
+
+ sp->type = EWL_SPECTRUM_TYPE_SQUARE;
+
+ /* create the canvas */
+ sp->canvas = ewl_image_new();
+ ewl_container_child_append(EWL_CONTAINER(sp), sp->canvas);
+ ewl_object_fill_policy_set(EWL_OBJECT(sp->canvas), EWL_FLAG_FILL_FILL);
+ ewl_widget_internal_set(sp->canvas, TRUE);
+ ewl_callback_append(EWL_WIDGET(sp->canvas), EWL_CALLBACK_REVEAL,
+ ewl_spectrum_canvas_cb_reveal, sp);
+ ewl_widget_show(sp->canvas);
+
+ /* create the cross hairs to draw on the spectrum */
+ sp->cross_hairs.horizontal = ewl_hseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(sp), sp->cross_hairs.horizontal);
+ ewl_widget_internal_set(sp->cross_hairs.horizontal, TRUE);
+ ewl_widget_layer_priority_set(sp->cross_hairs.horizontal, 1);
+
+ sp->cross_hairs.vertical = ewl_vseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(sp), sp->cross_hairs.vertical);
+ ewl_widget_internal_set(sp->cross_hairs.vertical, TRUE);
+ ewl_widget_layer_priority_set(sp->cross_hairs.vertical, 1);
+
+ ewl_callback_append(EWL_WIDGET(sp), EWL_CALLBACK_CONFIGURE,
+ ewl_spectrum_cb_configure, NULL);
+
+ ewl_spectrum_rgb_set(sp, 255, 255, 255);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -134,14 +134,14 @@ ewl_spectrum_init(Ewl_Spectrum *sp)
void
ewl_spectrum_type_set(Ewl_Spectrum *sp, Ewl_Spectrum_Type type)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sp);
- DCHECK_TYPE(sp, EWL_SPECTRUM_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sp);
+ DCHECK_TYPE(sp, EWL_SPECTRUM_TYPE);
- sp->type = type;
- ewl_widget_configure(EWL_WIDGET(sp));
+ sp->type = type;
+ ewl_widget_configure(EWL_WIDGET(sp));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -152,11 +152,11 @@ ewl_spectrum_type_set(Ewl_Spectrum *sp, Ewl_Spectrum_Type type)
Ewl_Spectrum_Type
ewl_spectrum_type_get(Ewl_Spectrum *sp)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(sp, EWL_SPECTRUM_TYPE_SQUARE);
- DCHECK_TYPE_RET(sp, EWL_SPECTRUM_TYPE, EWL_SPECTRUM_TYPE_SQUARE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(sp, EWL_SPECTRUM_TYPE_SQUARE);
+ DCHECK_TYPE_RET(sp, EWL_SPECTRUM_TYPE, EWL_SPECTRUM_TYPE_SQUARE);
- DRETURN_INT(sp->type, DLEVEL_STABLE);
+ DRETURN_INT(sp->type, DLEVEL_STABLE);
}
/**
@@ -168,15 +168,15 @@ ewl_spectrum_type_get(Ewl_Spectrum *sp)
void
ewl_spectrum_mode_set(Ewl_Spectrum *sp, Ewl_Color_Mode mode)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sp);
- DCHECK_TYPE(sp, EWL_SPECTRUM_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sp);
+ DCHECK_TYPE(sp, EWL_SPECTRUM_TYPE);
- sp->mode = mode;
- sp->dirty = TRUE;
- ewl_widget_configure(EWL_WIDGET(sp));
+ sp->mode = mode;
+ sp->dirty = TRUE;
+ ewl_widget_configure(EWL_WIDGET(sp));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -187,11 +187,11 @@ ewl_spectrum_mode_set(Ewl_Spectrum *sp, Ewl_Color_Mode mode)
Ewl_Color_Mode
ewl_spectrum_mode_get(Ewl_Spectrum *sp)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(sp, EWL_COLOR_MODE_HSV_HUE);
- DCHECK_TYPE_RET(sp, EWL_SPECTRUM_TYPE, EWL_COLOR_MODE_HSV_HUE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(sp, EWL_COLOR_MODE_HSV_HUE);
+ DCHECK_TYPE_RET(sp, EWL_SPECTRUM_TYPE, EWL_COLOR_MODE_HSV_HUE);
- DRETURN_INT(sp->mode, DLEVEL_STABLE);
+ DRETURN_INT(sp->mode, DLEVEL_STABLE);
}
/**
@@ -204,25 +204,25 @@ ewl_spectrum_mode_get(Ewl_Spectrum *sp)
*/
void
ewl_spectrum_rgb_set(Ewl_Spectrum *sp, unsigned int r,
- unsigned int g, unsigned int b)
+ unsigned int g, unsigned int b)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sp);
- DCHECK_TYPE(sp, EWL_SPECTRUM_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sp);
+ DCHECK_TYPE(sp, EWL_SPECTRUM_TYPE);
- sp->rgb.r = r;
- sp->rgb.g = g;
- sp->rgb.b = b;
+ sp->rgb.r = r;
+ sp->rgb.g = g;
+ sp->rgb.b = b;
- if (sp->rgb.r > 255) sp->rgb.r = 255;
- if (sp->rgb.g > 255) sp->rgb.g = 255;
- if (sp->rgb.b > 255) sp->rgb.b = 255;
+ if (sp->rgb.r > 255) sp->rgb.r = 255;
+ if (sp->rgb.g > 255) sp->rgb.g = 255;
+ if (sp->rgb.b > 255) sp->rgb.b = 255;
- ewl_spectrum_hsv_from_rgb(sp);
- sp->dirty = TRUE;
- ewl_widget_configure(EWL_WIDGET(sp));
+ ewl_spectrum_hsv_from_rgb(sp);
+ sp->dirty = TRUE;
+ ewl_widget_configure(EWL_WIDGET(sp));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -235,17 +235,17 @@ ewl_spectrum_rgb_set(Ewl_Spectrum *sp, unsigned int r,
*/
void
ewl_spectrum_rgb_get(Ewl_Spectrum *sp, unsigned int *r,
- unsigned int *g, unsigned int *b)
+ unsigned int *g, unsigned int *b)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sp);
- DCHECK_TYPE(sp, EWL_SPECTRUM_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sp);
+ DCHECK_TYPE(sp, EWL_SPECTRUM_TYPE);
- if (r) *r = sp->rgb.r;
- if (g) *g = sp->rgb.g;
- if (b) *b = sp->rgb.b;
+ if (r) *r = sp->rgb.r;
+ if (g) *g = sp->rgb.g;
+ if (b) *b = sp->rgb.b;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -259,28 +259,28 @@ ewl_spectrum_rgb_get(Ewl_Spectrum *sp, unsigned int *r,
void
ewl_spectrum_hsv_set(Ewl_Spectrum *sp, double h, double s, double v)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sp);
- DCHECK_TYPE(sp, EWL_SPECTRUM_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sp);
+ DCHECK_TYPE(sp, EWL_SPECTRUM_TYPE);
- sp->hsv.h = h;
- sp->hsv.s = s;
- sp->hsv.v = v;
+ sp->hsv.h = h;
+ sp->hsv.s = s;
+ sp->hsv.v = v;
- if (sp->hsv.h > 360) sp->hsv.h = 360.0;
- if (sp->hsv.h <= 0) sp->hsv.h = 360.0;
+ if (sp->hsv.h > 360) sp->hsv.h = 360.0;
+ if (sp->hsv.h <= 0) sp->hsv.h = 360.0;
- if (sp->hsv.s > 1.0) sp->hsv.s = 1.0;
- if (sp->hsv.s < 0.0) sp->hsv.s = 0.0;
+ if (sp->hsv.s > 1.0) sp->hsv.s = 1.0;
+ if (sp->hsv.s < 0.0) sp->hsv.s = 0.0;
- if (sp->hsv.v > 1.0) sp->hsv.v = 1.0;
- if (sp->hsv.v < 0.0) sp->hsv.v = 0.0;
+ if (sp->hsv.v > 1.0) sp->hsv.v = 1.0;
+ if (sp->hsv.v < 0.0) sp->hsv.v = 0.0;
- ewl_spectrum_rgb_from_hsv(sp);
- sp->dirty = TRUE;
- ewl_widget_configure(EWL_WIDGET(sp));
+ ewl_spectrum_rgb_from_hsv(sp);
+ sp->dirty = TRUE;
+ ewl_widget_configure(EWL_WIDGET(sp));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -294,15 +294,15 @@ ewl_spectrum_hsv_set(Ewl_Spectrum *sp, double h, double s, double v)
void
ewl_spectrum_hsv_get(Ewl_Spectrum *sp, double *h, double *s, double *v)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sp);
- DCHECK_TYPE(sp, EWL_SPECTRUM_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sp);
+ DCHECK_TYPE(sp, EWL_SPECTRUM_TYPE);
- if (h) *h = sp->hsv.h;
- if (s) *s = sp->hsv.s;
- if (v) *v = sp->hsv.v;
+ if (h) *h = sp->hsv.h;
+ if (s) *s = sp->hsv.s;
+ if (v) *v = sp->hsv.v;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -315,35 +315,35 @@ ewl_spectrum_hsv_get(Ewl_Spectrum *sp, double *h, double *s, double *v)
*/
void
ewl_spectrum_cb_configure(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Spectrum *sp;
+ Ewl_Spectrum *sp;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_SPECTRUM_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_SPECTRUM_TYPE);
- sp = EWL_SPECTRUM(w);
- if (!REALIZED(sp))
- {
- DRETURN(DLEVEL_STABLE);
- }
+ sp = EWL_SPECTRUM(w);
+ if (!REALIZED(sp))
+ {
+ DRETURN(DLEVEL_STABLE);
+ }
- ewl_object_position_request(EWL_OBJECT(sp->canvas),
- CURRENT_X(sp), CURRENT_Y(sp));
- ewl_object_size_request(EWL_OBJECT(sp->canvas),
- CURRENT_W(sp), CURRENT_H(sp));
+ ewl_object_position_request(EWL_OBJECT(sp->canvas),
+ CURRENT_X(sp), CURRENT_Y(sp));
+ ewl_object_size_request(EWL_OBJECT(sp->canvas),
+ CURRENT_W(sp), CURRENT_H(sp));
- ewl_spectrum_draw(sp);
- ewl_spectrum_cross_hairs_draw(sp);
+ ewl_spectrum_draw(sp);
+ ewl_spectrum_cross_hairs_draw(sp);
- /*
- * FIXME: The dirty flag is unused right now, some debugging work is
- * needed to get this to fix the initial color
- * sp->dirty = FALSE;
- */
+ /*
+ * FIXME: The dirty flag is unused right now, some debugging work is
+ * needed to get this to fix the initial color
+ * sp->dirty = FALSE;
+ */
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -357,22 +357,22 @@ ewl_spectrum_cb_configure(Ewl_Widget *w, void *ev __UNUSED__,
void
ewl_spectrum_cb_mouse_down(Ewl_Widget *w, void *ev, void *data __UNUSED__)
{
- Ewl_Spectrum *sp;
- Ewl_Event_Mouse *e;
+ Ewl_Spectrum *sp;
+ Ewl_Event_Mouse *e;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_SPECTRUM_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_SPECTRUM_TYPE);
- sp = EWL_SPECTRUM(w);
- e = ev;
+ sp = EWL_SPECTRUM(w);
+ e = ev;
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE,
- ewl_spectrum_cb_mouse_move, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE,
+ ewl_spectrum_cb_mouse_move, NULL);
- ewl_spectrum_mouse_process(sp, e->x, e->y);
+ ewl_spectrum_mouse_process(sp, e->x, e->y);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -386,19 +386,19 @@ ewl_spectrum_cb_mouse_down(Ewl_Widget *w, void *ev, void *data __UNUSED__)
void
ewl_spectrum_cb_mouse_move(Ewl_Widget *w, void *ev, void *data __UNUSED__)
{
- Ewl_Spectrum *sp;
- Ewl_Event_Mouse *e;
+ Ewl_Spectrum *sp;
+ Ewl_Event_Mouse *e;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_SPECTRUM_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_SPECTRUM_TYPE);
- sp = EWL_SPECTRUM(w);
- e = ev;
+ sp = EWL_SPECTRUM(w);
+ e = ev;
- ewl_spectrum_mouse_process(sp, e->x, e->y);
+ ewl_spectrum_mouse_process(sp, e->x, e->y);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -411,19 +411,19 @@ ewl_spectrum_cb_mouse_move(Ewl_Widget *w, void *ev, void *data __UNUSED__)
*/
void
ewl_spectrum_cb_mouse_up(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Spectrum *sp;
+ Ewl_Spectrum *sp;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_SPECTRUM_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_SPECTRUM_TYPE);
- sp = EWL_SPECTRUM(w);
- ewl_callback_del(w, EWL_CALLBACK_MOUSE_MOVE,
- ewl_spectrum_cb_mouse_move);
+ sp = EWL_SPECTRUM(w);
+ ewl_callback_del(w, EWL_CALLBACK_MOUSE_MOVE,
+ ewl_spectrum_cb_mouse_move);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -436,543 +436,543 @@ ewl_spectrum_cb_mouse_up(Ewl_Widget *w, void *ev __UNUSED__,
*/
void
ewl_spectrum_canvas_cb_reveal(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Spectrum *sp;
+ Ewl_Spectrum *sp;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_SPECTRUM_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_SPECTRUM_TYPE);
- sp = EWL_SPECTRUM(data);
- sp->dirty = TRUE;
- ewl_widget_configure(EWL_WIDGET(sp));
+ sp = EWL_SPECTRUM(data);
+ sp->dirty = TRUE;
+ ewl_widget_configure(EWL_WIDGET(sp));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_spectrum_mouse_process(Ewl_Spectrum *sp, int x, int y)
{
- Evas_Coord img_w, img_h;
- unsigned int r, g, b;
+ Evas_Coord img_w, img_h;
+ unsigned int r, g, b;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sp);
- DCHECK_TYPE(sp, EWL_SPECTRUM_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sp);
+ DCHECK_TYPE(sp, EWL_SPECTRUM_TYPE);
- x -= CURRENT_X(sp->canvas);
- y -= CURRENT_Y(sp->canvas);
+ x -= CURRENT_X(sp->canvas);
+ y -= CURRENT_Y(sp->canvas);
- if (x < 0)
- x = 0;
- if (y < 0)
- y = 0;
- if (x > CURRENT_W(sp->canvas))
- x = CURRENT_W(sp->canvas);
- if (y > CURRENT_H(sp->canvas))
- y = CURRENT_H(sp->canvas);
+ if (x < 0)
+ x = 0;
+ if (y < 0)
+ y = 0;
+ if (x > CURRENT_W(sp->canvas))
+ x = CURRENT_W(sp->canvas);
+ if (y > CURRENT_H(sp->canvas))
+ y = CURRENT_H(sp->canvas);
- evas_object_image_size_get(EWL_IMAGE(sp->canvas)->image, &img_w, &img_h);
- ewl_spectrum_color_coord_map(sp, x, y, img_w, img_h, &r, &g, &b);
- ewl_spectrum_rgb_set(sp, r, g, b);
+ evas_object_image_size_get(EWL_IMAGE(sp->canvas)->image, &img_w, &img_h);
+ ewl_spectrum_color_coord_map(sp, x, y, img_w, img_h, &r, &g, &b);
+ ewl_spectrum_rgb_set(sp, r, g, b);
- ewl_callback_call(EWL_WIDGET(sp), EWL_CALLBACK_VALUE_CHANGED);
+ ewl_callback_call(EWL_WIDGET(sp), EWL_CALLBACK_VALUE_CHANGED);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_spectrum_hsv_from_rgb(Ewl_Spectrum *sp)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sp);
- DCHECK_TYPE(sp, EWL_SPECTRUM_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sp);
+ DCHECK_TYPE(sp, EWL_SPECTRUM_TYPE);
- ewl_spectrum_rgb_to_hsv(sp->rgb.r, sp->rgb.g, sp->rgb.b,
- &(sp->hsv.h), &(sp->hsv.s), &(sp->hsv.v));
+ ewl_spectrum_rgb_to_hsv(sp->rgb.r, sp->rgb.g, sp->rgb.b,
+ &(sp->hsv.h), &(sp->hsv.s), &(sp->hsv.v));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_spectrum_rgb_from_hsv(Ewl_Spectrum *sp)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sp);
- DCHECK_TYPE(sp, EWL_SPECTRUM_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sp);
+ DCHECK_TYPE(sp, EWL_SPECTRUM_TYPE);
- ewl_spectrum_hsv_to_rgb(sp->hsv.h, sp->hsv.s, sp->hsv.v,
- &(sp->rgb.r), &(sp->rgb.g), &(sp->rgb.b));
+ ewl_spectrum_hsv_to_rgb(sp->hsv.h, sp->hsv.s, sp->hsv.v,
+ &(sp->rgb.r), &(sp->rgb.g), &(sp->rgb.b));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_spectrum_hsv_to_rgb(double h, double s, double v,
- unsigned int *r, unsigned int *g, unsigned int *b)
+ unsigned int *r, unsigned int *g, unsigned int *b)
{
- unsigned int r_tmp = 0, g_tmp = 0, b_tmp = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- if (s == 0)
- {
- unsigned int i;
-
- i = v * 255.0;
- r_tmp = i;
- g_tmp = i;
- b_tmp = i;
- }
- else
- {
- double h_tmp, v_tmp, p, q, t, vs, vsf;
- int i;
-
- if (h == 360.0) h = 0.0;
-
- h_tmp = h / 60.0;
- i = h_tmp;
-
- vs = v * s;
- vsf = vs * (h_tmp - i);
-
- p = 255.0 * (v - vs);
- q = 255.0 * (v - vsf);
- t = 255.0 * (v - vs + vsf);
-
- v_tmp = v * 255.0;
-
- switch(i)
- {
- case 0:
- r_tmp = v_tmp;
- g_tmp = t;
- b_tmp = p;
- break;
-
- case 1:
- r_tmp = q;
- g_tmp = v_tmp;
- b_tmp = p;
- break;
-
- case 2:
- r_tmp = p;
- g_tmp = v_tmp;
- b_tmp = t;
- break;
-
- case 3:
- r_tmp = p;
- g_tmp = q;
- b_tmp = v_tmp;
- break;
-
- case 4:
- r_tmp = t;
- g_tmp = p;
- b_tmp = v_tmp;
- break;
-
- case 5:
- r_tmp = v_tmp;
- g_tmp = p;
- b_tmp = q;
- break;
- }
- }
-
- if (r) *r = r_tmp;
- if (g) *g = g_tmp;
- if (b) *b = b_tmp;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ unsigned int r_tmp = 0, g_tmp = 0, b_tmp = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ if (s == 0)
+ {
+ unsigned int i;
+
+ i = v * 255.0;
+ r_tmp = i;
+ g_tmp = i;
+ b_tmp = i;
+ }
+ else
+ {
+ double h_tmp, v_tmp, p, q, t, vs, vsf;
+ int i;
+
+ if (h == 360.0) h = 0.0;
+
+ h_tmp = h / 60.0;
+ i = h_tmp;
+
+ vs = v * s;
+ vsf = vs * (h_tmp - i);
+
+ p = 255.0 * (v - vs);
+ q = 255.0 * (v - vsf);
+ t = 255.0 * (v - vs + vsf);
+
+ v_tmp = v * 255.0;
+
+ switch(i)
+ {
+ case 0:
+ r_tmp = v_tmp;
+ g_tmp = t;
+ b_tmp = p;
+ break;
+
+ case 1:
+ r_tmp = q;
+ g_tmp = v_tmp;
+ b_tmp = p;
+ break;
+
+ case 2:
+ r_tmp = p;
+ g_tmp = v_tmp;
+ b_tmp = t;
+ break;
+
+ case 3:
+ r_tmp = p;
+ g_tmp = q;
+ b_tmp = v_tmp;
+ break;
+
+ case 4:
+ r_tmp = t;
+ g_tmp = p;
+ b_tmp = v_tmp;
+ break;
+
+ case 5:
+ r_tmp = v_tmp;
+ g_tmp = p;
+ b_tmp = q;
+ break;
+ }
+ }
+
+ if (r) *r = r_tmp;
+ if (g) *g = g_tmp;
+ if (b) *b = b_tmp;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_spectrum_rgb_to_hsv(unsigned int r, unsigned int g, unsigned int b,
- double *h, double *s, double *v)
+ double *h, double *s, double *v)
{
- unsigned int min, max;
- double tmp_h, tmp_s, tmp_v;
+ unsigned int min, max;
+ double tmp_h, tmp_s, tmp_v;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- min = MIN(r, MIN(g, b));
- max = MAX(r, MAX(g, b));
+ min = MIN(r, MIN(g, b));
+ max = MAX(r, MAX(g, b));
- tmp_v = max / 255.0;
- tmp_s = (max != 0) ? ((max - min) / (float)max) : 0.0;
- tmp_h = 0.0;
+ tmp_v = max / 255.0;
+ tmp_s = (max != 0) ? ((max - min) / (float)max) : 0.0;
+ tmp_h = 0.0;
- if (tmp_s != 0.0)
- {
- unsigned int delta;
+ if (tmp_s != 0.0)
+ {
+ unsigned int delta;
- delta = max - min;
- if ((unsigned int)r == max)
- tmp_h = (g - b) / (float)delta;
- else if ((unsigned int)g == max)
- tmp_h = 2.0 + ((b - r) / (float)delta);
- else if ((unsigned int)b == max)
- tmp_h = 4.0 + ((r - g) / (float)delta);
+ delta = max - min;
+ if ((unsigned int)r == max)
+ tmp_h = (g - b) / (float)delta;
+ else if ((unsigned int)g == max)
+ tmp_h = 2.0 + ((b - r) / (float)delta);
+ else if ((unsigned int)b == max)
+ tmp_h = 4.0 + ((r - g) / (float)delta);
- tmp_h *= 60.0;
- if (tmp_h < 0.0) tmp_h += 360.0;
- }
+ tmp_h *= 60.0;
+ if (tmp_h < 0.0) tmp_h += 360.0;
+ }
- if (h) *h = tmp_h;
- if (s) *s = tmp_s;
- if (v) *v = tmp_v;
+ if (h) *h = tmp_h;
+ if (s) *s = tmp_s;
+ if (v) *v = tmp_v;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_spectrum_draw(Ewl_Spectrum *sp)
{
- Evas_Object *img;
- Evas_Coord img_w, img_h;
- int *data;
- int i, k;
- unsigned int r, g, b, a;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sp);
- DCHECK_TYPE(sp, EWL_SPECTRUM_TYPE);
-
- if (!sp->dirty)
- DRETURN(DLEVEL_STABLE);
-
- img = EWL_IMAGE(sp->canvas)->image;
- evas_object_image_size_set(img, CURRENT_W(sp), CURRENT_H(sp));
- evas_object_image_size_get(img, &img_w, &img_h);
-
- data = evas_object_image_data_get(img, 1);
- if (!data)
- {
- DRETURN(DLEVEL_STABLE);
- }
-
- a = 255 << 24;
- for (i = 0; i < img_h; i++)
- {
- for (k = 0; k < img_w; k++)
- {
- ewl_spectrum_color_coord_map(sp, k, i, img_w, img_h, &r, &g, &b);
- data[(i * img_w) + k] = a | (r << 16) | (g << 8) | b;
- }
- }
-
- evas_object_image_data_set(img, data);
- evas_object_image_data_update_add(img, 0, 0, img_w, img_h);
- ewl_widget_configure(sp->canvas);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Evas_Object *img;
+ Evas_Coord img_w, img_h;
+ int *data;
+ int i, k;
+ unsigned int r, g, b, a;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sp);
+ DCHECK_TYPE(sp, EWL_SPECTRUM_TYPE);
+
+ if (!sp->dirty)
+ DRETURN(DLEVEL_STABLE);
+
+ img = EWL_IMAGE(sp->canvas)->image;
+ evas_object_image_size_set(img, CURRENT_W(sp), CURRENT_H(sp));
+ evas_object_image_size_get(img, &img_w, &img_h);
+
+ data = evas_object_image_data_get(img, 1);
+ if (!data)
+ {
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ a = 255 << 24;
+ for (i = 0; i < img_h; i++)
+ {
+ for (k = 0; k < img_w; k++)
+ {
+ ewl_spectrum_color_coord_map(sp, k, i, img_w, img_h, &r, &g, &b);
+ data[(i * img_w) + k] = a | (r << 16) | (g << 8) | b;
+ }
+ }
+
+ evas_object_image_data_set(img, data);
+ evas_object_image_data_update_add(img, 0, 0, img_w, img_h);
+ ewl_widget_configure(sp->canvas);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_spectrum_cross_hairs_draw(Ewl_Spectrum *sp)
{
- int x, y;
- Evas_Coord img_w, img_h;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sp);
- DCHECK_TYPE(sp, EWL_SPECTRUM_TYPE);
-
- /* get the coords */
- evas_object_image_size_get(EWL_IMAGE(sp->canvas)->image, &img_w, &img_h);
- ewl_spectrum_color_coord_xy_get(sp, &x, &y, img_w, img_h,
- sp->rgb.r, sp->rgb.g, sp->rgb.b);
- x += CURRENT_X(sp->canvas);
- y += CURRENT_Y(sp->canvas);
- /* place the horizontal cross hair */
- y -= CURRENT_H(sp->cross_hairs.horizontal) / 2;
- ewl_object_position_request(EWL_OBJECT(sp->cross_hairs.horizontal),
- CURRENT_X(sp), y);
- ewl_object_w_request(EWL_OBJECT(sp->cross_hairs.horizontal),
- CURRENT_W(sp));
-
- if (!VISIBLE(sp->cross_hairs.horizontal))
- ewl_widget_show(sp->cross_hairs.horizontal);
-
- /* place the vertical cross hair if needed */
- if (sp->type == EWL_SPECTRUM_TYPE_SQUARE)
- {
- x -= CURRENT_W(sp->cross_hairs.vertical) / 2;
- ewl_object_position_request(EWL_OBJECT(sp->cross_hairs.vertical),
- x, CURRENT_Y(sp));
- ewl_object_h_request(EWL_OBJECT(sp->cross_hairs.vertical),
- CURRENT_H(sp));
-
- if (!VISIBLE(sp->cross_hairs.vertical))
- ewl_widget_show(sp->cross_hairs.vertical);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int x, y;
+ Evas_Coord img_w, img_h;
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sp);
+ DCHECK_TYPE(sp, EWL_SPECTRUM_TYPE);
+
+ /* get the coords */
+ evas_object_image_size_get(EWL_IMAGE(sp->canvas)->image, &img_w, &img_h);
+ ewl_spectrum_color_coord_xy_get(sp, &x, &y, img_w, img_h,
+ sp->rgb.r, sp->rgb.g, sp->rgb.b);
+ x += CURRENT_X(sp->canvas);
+ y += CURRENT_Y(sp->canvas);
+ /* place the horizontal cross hair */
+ y -= CURRENT_H(sp->cross_hairs.horizontal) / 2;
+ ewl_object_position_request(EWL_OBJECT(sp->cross_hairs.horizontal),
+ CURRENT_X(sp), y);
+ ewl_object_w_request(EWL_OBJECT(sp->cross_hairs.horizontal),
+ CURRENT_W(sp));
+
+ if (!VISIBLE(sp->cross_hairs.horizontal))
+ ewl_widget_show(sp->cross_hairs.horizontal);
+
+ /* place the vertical cross hair if needed */
+ if (sp->type == EWL_SPECTRUM_TYPE_SQUARE)
+ {
+ x -= CURRENT_W(sp->cross_hairs.vertical) / 2;
+ ewl_object_position_request(EWL_OBJECT(sp->cross_hairs.vertical),
+ x, CURRENT_Y(sp));
+ ewl_object_h_request(EWL_OBJECT(sp->cross_hairs.vertical),
+ CURRENT_H(sp));
+
+ if (!VISIBLE(sp->cross_hairs.vertical))
+ ewl_widget_show(sp->cross_hairs.vertical);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_spectrum_color_coord_map(Ewl_Spectrum *sp, int x, int y, int img_w, int img_h,
- unsigned int *r, unsigned int *g, unsigned int *b)
+ unsigned int *r, unsigned int *g, unsigned int *b)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sp);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sp);
- if (sp->type == EWL_SPECTRUM_TYPE_VERTICAL)
- ewl_spectrum_color_coord_map_vertical(sp, y, img_h, r, g, b);
- else
- ewl_spectrum_color_coord_map_square(sp, x, y, img_w,
- img_h, r, g, b);
+ if (sp->type == EWL_SPECTRUM_TYPE_VERTICAL)
+ ewl_spectrum_color_coord_map_vertical(sp, y, img_h, r, g, b);
+ else
+ ewl_spectrum_color_coord_map_square(sp, x, y, img_w,
+ img_h, r, g, b);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void ewl_spectrum_color_coord_xy_get(Ewl_Spectrum *sp, int *x, int *y,
- int w, int h, unsigned int r,
- unsigned int g, unsigned int b)
+ int w, int h, unsigned int r,
+ unsigned int g, unsigned int b)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sp);
-
- if (sp->type == EWL_SPECTRUM_TYPE_VERTICAL) {
- ewl_spectrum_color_coord_vertical_y_get(sp, y, h, r, g, b);
- if (x) *x = 0;
- }
- else
- ewl_spectrum_color_coord_square_xy_get(sp, x, y, w,
- h, r, g, b);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sp);
+
+ if (sp->type == EWL_SPECTRUM_TYPE_VERTICAL) {
+ ewl_spectrum_color_coord_vertical_y_get(sp, y, h, r, g, b);
+ if (x) *x = 0;
+ }
+ else
+ ewl_spectrum_color_coord_square_xy_get(sp, x, y, w,
+ h, r, g, b);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_spectrum_color_coord_map_vertical(Ewl_Spectrum *sp, int y, int img_h,
- unsigned int *r, unsigned int *g, unsigned int *b)
+ unsigned int *r, unsigned int *g, unsigned int *b)
{
- unsigned int r_tmp, g_tmp, b_tmp;
- double h, s, v;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sp);
-
- r_tmp = 0;
- g_tmp = 0;
- b_tmp = 0;
-
- h = 360.0;
- s = 0.0;
- v = 1.0;
- switch (sp->mode)
- {
- case EWL_COLOR_MODE_RGB_RED:
- r_tmp = 255 - ((255 * y) / img_h);
- break;
-
- case EWL_COLOR_MODE_RGB_GREEN:
- g_tmp = 255 - ((255 * y) / img_h);
- break;
- case EWL_COLOR_MODE_RGB_BLUE:
- b_tmp = 255 - ((255 * y) / img_h);
- break;
-
- case EWL_COLOR_MODE_HSV_HUE:
- h = (360.0 * y) / (double)img_h;
- s = 1.0;
- ewl_spectrum_hsv_to_rgb(h, s, v, &r_tmp, &g_tmp, &b_tmp);
- break;
-
- case EWL_COLOR_MODE_HSV_SATURATION:
- s = 1.0 - (y / (double)img_h);
- ewl_spectrum_hsv_to_rgb(h, s, v, &r_tmp, &g_tmp, &b_tmp);
- break;
-
- case EWL_COLOR_MODE_HSV_VALUE:
- v = 1.0 - (y / (double)img_h);
- ewl_spectrum_hsv_to_rgb(h, s, v, &r_tmp, &g_tmp, &b_tmp);
- break;
-
- default:
- break;
- }
-
- if (r) *r = r_tmp;
- if (g) *g = g_tmp;
- if (b) *b = b_tmp;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ unsigned int r_tmp, g_tmp, b_tmp;
+ double h, s, v;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sp);
+
+ r_tmp = 0;
+ g_tmp = 0;
+ b_tmp = 0;
+
+ h = 360.0;
+ s = 0.0;
+ v = 1.0;
+ switch (sp->mode)
+ {
+ case EWL_COLOR_MODE_RGB_RED:
+ r_tmp = 255 - ((255 * y) / img_h);
+ break;
+
+ case EWL_COLOR_MODE_RGB_GREEN:
+ g_tmp = 255 - ((255 * y) / img_h);
+ break;
+ case EWL_COLOR_MODE_RGB_BLUE:
+ b_tmp = 255 - ((255 * y) / img_h);
+ break;
+
+ case EWL_COLOR_MODE_HSV_HUE:
+ h = (360.0 * y) / (double)img_h;
+ s = 1.0;
+ ewl_spectrum_hsv_to_rgb(h, s, v, &r_tmp, &g_tmp, &b_tmp);
+ break;
+
+ case EWL_COLOR_MODE_HSV_SATURATION:
+ s = 1.0 - (y / (double)img_h);
+ ewl_spectrum_hsv_to_rgb(h, s, v, &r_tmp, &g_tmp, &b_tmp);
+ break;
+
+ case EWL_COLOR_MODE_HSV_VALUE:
+ v = 1.0 - (y / (double)img_h);
+ ewl_spectrum_hsv_to_rgb(h, s, v, &r_tmp, &g_tmp, &b_tmp);
+ break;
+
+ default:
+ break;
+ }
+
+ if (r) *r = r_tmp;
+ if (g) *g = g_tmp;
+ if (b) *b = b_tmp;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_spectrum_color_coord_map_square(Ewl_Spectrum *sp, int x, int y, int img_w, int img_h,
- unsigned int *r, unsigned int *g, unsigned int *b)
+ unsigned int *r, unsigned int *g, unsigned int *b)
{
- unsigned int r_tmp, g_tmp, b_tmp;
- double h, s, v;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sp);
-
- switch (sp->mode)
- {
- case EWL_COLOR_MODE_RGB_RED:
- r_tmp = sp->rgb.r;
- g_tmp = (1.0 - (y / (double)img_h)) * 255.0;
- b_tmp = (1.0 - (x / (double)img_w)) * 255.0;
- break;
-
- case EWL_COLOR_MODE_RGB_GREEN:
- r_tmp = (1.0 - (y / (double)img_h)) * 255.0;
- g_tmp = sp->rgb.g;
- b_tmp = (1.0 - (x / (double)img_w)) * 255.0;
- break;
-
- case EWL_COLOR_MODE_RGB_BLUE:
- r_tmp = (1.0 - (y / (double)img_h)) * 255.0;
- g_tmp = (1.0 - (x / (double)img_w)) * 255.0;
- b_tmp = sp->rgb.b;
- break;
-
- case EWL_COLOR_MODE_HSV_HUE:
- h = sp->hsv.h;
- s = 1.0 - (y / (double)img_h);
- v = 1.0 - (x / (double)img_w);
- ewl_spectrum_hsv_to_rgb(h, s, v, &r_tmp, &g_tmp, &b_tmp);
- break;
-
- case EWL_COLOR_MODE_HSV_SATURATION:
- h = (x / (double)img_w) * 360.0;
- s = sp->hsv.s;
- v = 1.0 - (y / (double)img_h);
- ewl_spectrum_hsv_to_rgb(h, s, v, &r_tmp, &g_tmp, &b_tmp);
- break;
-
- case EWL_COLOR_MODE_HSV_VALUE:
- h = (x / (double)img_w) * 360.0;
- s = 1.0 - (y / (double)img_h);
- v = sp->hsv.v;
- ewl_spectrum_hsv_to_rgb(h, s, v, &r_tmp, &g_tmp, &b_tmp);
- break;
-
- default:
- break;
- }
-
- if (r) *r = r_tmp;
- if (g) *g = g_tmp;
- if (b) *b = b_tmp;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ unsigned int r_tmp, g_tmp, b_tmp;
+ double h, s, v;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sp);
+
+ switch (sp->mode)
+ {
+ case EWL_COLOR_MODE_RGB_RED:
+ r_tmp = sp->rgb.r;
+ g_tmp = (1.0 - (y / (double)img_h)) * 255.0;
+ b_tmp = (1.0 - (x / (double)img_w)) * 255.0;
+ break;
+
+ case EWL_COLOR_MODE_RGB_GREEN:
+ r_tmp = (1.0 - (y / (double)img_h)) * 255.0;
+ g_tmp = sp->rgb.g;
+ b_tmp = (1.0 - (x / (double)img_w)) * 255.0;
+ break;
+
+ case EWL_COLOR_MODE_RGB_BLUE:
+ r_tmp = (1.0 - (y / (double)img_h)) * 255.0;
+ g_tmp = (1.0 - (x / (double)img_w)) * 255.0;
+ b_tmp = sp->rgb.b;
+ break;
+
+ case EWL_COLOR_MODE_HSV_HUE:
+ h = sp->hsv.h;
+ s = 1.0 - (y / (double)img_h);
+ v = 1.0 - (x / (double)img_w);
+ ewl_spectrum_hsv_to_rgb(h, s, v, &r_tmp, &g_tmp, &b_tmp);
+ break;
+
+ case EWL_COLOR_MODE_HSV_SATURATION:
+ h = (x / (double)img_w) * 360.0;
+ s = sp->hsv.s;
+ v = 1.0 - (y / (double)img_h);
+ ewl_spectrum_hsv_to_rgb(h, s, v, &r_tmp, &g_tmp, &b_tmp);
+ break;
+
+ case EWL_COLOR_MODE_HSV_VALUE:
+ h = (x / (double)img_w) * 360.0;
+ s = 1.0 - (y / (double)img_h);
+ v = sp->hsv.v;
+ ewl_spectrum_hsv_to_rgb(h, s, v, &r_tmp, &g_tmp, &b_tmp);
+ break;
+
+ default:
+ break;
+ }
+
+ if (r) *r = r_tmp;
+ if (g) *g = g_tmp;
+ if (b) *b = b_tmp;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_spectrum_color_coord_vertical_y_get(Ewl_Spectrum *sp, int *y, int img_h,
- unsigned int r, unsigned int g, unsigned int b)
+ unsigned int r, unsigned int g, unsigned int b)
{
- int tmp_y;
- double h, s, v;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sp);
-
- tmp_y = 0;
- switch (sp->mode)
- {
- case EWL_COLOR_MODE_RGB_RED:
- tmp_y = ((255 - r) * img_h) / 255;
- break;
-
- case EWL_COLOR_MODE_RGB_GREEN:
- tmp_y = ((255 - g) * img_h) / 255;
- break;
- case EWL_COLOR_MODE_RGB_BLUE:
- tmp_y = ((255 - b) * img_h) / 255;
- break;
-
- case EWL_COLOR_MODE_HSV_HUE:
- ewl_spectrum_rgb_to_hsv(r, b, g, &h, &s, &v);
- tmp_y = (int) (((360.0 - h) * img_h) / 360.0);
- break;
-
- case EWL_COLOR_MODE_HSV_SATURATION:
- ewl_spectrum_rgb_to_hsv(r, b, g, &h, &s, &v);
- tmp_y = (int) ((1.0 - s) * img_h);
- break;
-
- case EWL_COLOR_MODE_HSV_VALUE:
- ewl_spectrum_rgb_to_hsv(r, b, g, &h, &s, &v);
- tmp_y = (int) ((1.0 - v) * img_h);
- break;
-
- default:
- break;
- }
-
- if (y) *y = tmp_y;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int tmp_y;
+ double h, s, v;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sp);
+
+ tmp_y = 0;
+ switch (sp->mode)
+ {
+ case EWL_COLOR_MODE_RGB_RED:
+ tmp_y = ((255 - r) * img_h) / 255;
+ break;
+
+ case EWL_COLOR_MODE_RGB_GREEN:
+ tmp_y = ((255 - g) * img_h) / 255;
+ break;
+ case EWL_COLOR_MODE_RGB_BLUE:
+ tmp_y = ((255 - b) * img_h) / 255;
+ break;
+
+ case EWL_COLOR_MODE_HSV_HUE:
+ ewl_spectrum_rgb_to_hsv(r, b, g, &h, &s, &v);
+ tmp_y = (int) (((360.0 - h) * img_h) / 360.0);
+ break;
+
+ case EWL_COLOR_MODE_HSV_SATURATION:
+ ewl_spectrum_rgb_to_hsv(r, b, g, &h, &s, &v);
+ tmp_y = (int) ((1.0 - s) * img_h);
+ break;
+
+ case EWL_COLOR_MODE_HSV_VALUE:
+ ewl_spectrum_rgb_to_hsv(r, b, g, &h, &s, &v);
+ tmp_y = (int) ((1.0 - v) * img_h);
+ break;
+
+ default:
+ break;
+ }
+
+ if (y) *y = tmp_y;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_spectrum_color_coord_square_xy_get(Ewl_Spectrum *sp, int *x, int *y, int img_w, int img_h,
- unsigned int r, unsigned int g, unsigned int b)
+ unsigned int r, unsigned int g, unsigned int b)
{
- int tmp_x, tmp_y;
- double h, s, v;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sp);
-
- tmp_x = 0;
- tmp_y = 0;
-
- switch (sp->mode)
- {
- case EWL_COLOR_MODE_RGB_RED:
- tmp_x = (int) ((1.0 - b / 255.0) * img_w);
- tmp_y = (int) ((1.0 - g / 255.0) * img_h);
- break;
-
- case EWL_COLOR_MODE_RGB_GREEN:
- tmp_x = (int) ((1.0 - b / 255.0) * img_w);
- tmp_y = (int) ((1.0 - r / 255.0) * img_h);
- break;
-
- case EWL_COLOR_MODE_RGB_BLUE:
- tmp_x = (int) ((1.0 - g / 255.0) * img_w);
- tmp_y = (int) ((1.0 - r / 255.0) * img_h);
- break;
-
- case EWL_COLOR_MODE_HSV_HUE:
- ewl_spectrum_rgb_to_hsv(r, b, g, &h, &s, &v);
- tmp_x = (int) ((1.0 - v) * img_w);
- tmp_y = (int) ((1.0 - s) * img_h);
- break;
-
- case EWL_COLOR_MODE_HSV_SATURATION:
- ewl_spectrum_rgb_to_hsv(r, b, g, &h, &s, &v);
- tmp_x = (int) ((1.0 - (h / 360.0)) * img_w);
- tmp_y = (int) ((1.0 - v) * img_h);
- break;
-
- case EWL_COLOR_MODE_HSV_VALUE:
- ewl_spectrum_rgb_to_hsv(r, b, g, &h, &s, &v);
- tmp_x = (int) ((1.0 - (h / 360.0)) * img_w);
- tmp_y = (int) ((1.0 - s) * img_h);
- break;
-
- default:
- break;
- }
-
- if (x) *x = tmp_x;
- if (y) *y = tmp_y;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ int tmp_x, tmp_y;
+ double h, s, v;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sp);
+
+ tmp_x = 0;
+ tmp_y = 0;
+
+ switch (sp->mode)
+ {
+ case EWL_COLOR_MODE_RGB_RED:
+ tmp_x = (int) ((1.0 - b / 255.0) * img_w);
+ tmp_y = (int) ((1.0 - g / 255.0) * img_h);
+ break;
+
+ case EWL_COLOR_MODE_RGB_GREEN:
+ tmp_x = (int) ((1.0 - b / 255.0) * img_w);
+ tmp_y = (int) ((1.0 - r / 255.0) * img_h);
+ break;
+
+ case EWL_COLOR_MODE_RGB_BLUE:
+ tmp_x = (int) ((1.0 - g / 255.0) * img_w);
+ tmp_y = (int) ((1.0 - r / 255.0) * img_h);
+ break;
+
+ case EWL_COLOR_MODE_HSV_HUE:
+ ewl_spectrum_rgb_to_hsv(r, b, g, &h, &s, &v);
+ tmp_x = (int) ((1.0 - v) * img_w);
+ tmp_y = (int) ((1.0 - s) * img_h);
+ break;
+
+ case EWL_COLOR_MODE_HSV_SATURATION:
+ ewl_spectrum_rgb_to_hsv(r, b, g, &h, &s, &v);
+ tmp_x = (int) ((1.0 - (h / 360.0)) * img_w);
+ tmp_y = (int) ((1.0 - v) * img_h);
+ break;
+
+ case EWL_COLOR_MODE_HSV_VALUE:
+ ewl_spectrum_rgb_to_hsv(r, b, g, &h, &s, &v);
+ tmp_x = (int) ((1.0 - (h / 360.0)) * img_w);
+ tmp_y = (int) ((1.0 - s) * img_h);
+ break;
+
+ default:
+ break;
+ }
+
+ if (x) *x = tmp_x;
+ if (y) *y = tmp_y;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_spectrum.h b/src/lib/ewl_spectrum.h
index 0dad88b..d46b133 100644
--- a/src/lib/ewl_spectrum.h
+++ b/src/lib/ewl_spectrum.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_SPECTRUM_H
#define EWL_SPECTRUM_H
@@ -42,50 +42,50 @@ typedef struct Ewl_Spectrum Ewl_Spectrum;
*/
struct Ewl_Spectrum
{
- Ewl_Container container; /**< Inherit from Ewl_Container */
- Ewl_Widget *canvas; /**< The canvas to draw on */
-
- struct
- {
- Ewl_Widget *vertical; /**< Vertical portion of the crosshairs */
- Ewl_Widget *horizontal; /**< Horizontal portion of the crosshairs */
- } cross_hairs; /**< Selection crosshairs */
-
- struct {
- unsigned int r;
- unsigned int g;
- unsigned int b;
- } rgb; /**< Current RBG colour of the spectrum */
-
- struct {
- double h; /**< The current hue */
- double s; /**< The current saturation */
- double v; /**< The current value */
- } hsv; /**< The HSV setting of the specturm */
-
- Ewl_Color_Mode mode; /**< The mode of the spectrum */
- Ewl_Spectrum_Type type; /**< The type of the spectrum */
- unsigned int dirty:1; /**< The flag to queue redraw */
+ Ewl_Container container; /**< Inherit from Ewl_Container */
+ Ewl_Widget *canvas; /**< The canvas to draw on */
+
+ struct
+ {
+ Ewl_Widget *vertical; /**< Vertical portion of the crosshairs */
+ Ewl_Widget *horizontal; /**< Horizontal portion of the crosshairs */
+ } cross_hairs; /**< Selection crosshairs */
+
+ struct {
+ unsigned int r;
+ unsigned int g;
+ unsigned int b;
+ } rgb; /**< Current RBG colour of the spectrum */
+
+ struct {
+ double h; /**< The current hue */
+ double s; /**< The current saturation */
+ double v; /**< The current value */
+ } hsv; /**< The HSV setting of the specturm */
+
+ Ewl_Color_Mode mode; /**< The mode of the spectrum */
+ Ewl_Spectrum_Type type; /**< The type of the spectrum */
+ unsigned int dirty:1; /**< The flag to queue redraw */
};
-Ewl_Widget *ewl_spectrum_new(void);
-int ewl_spectrum_init(Ewl_Spectrum *sp);
+Ewl_Widget *ewl_spectrum_new(void);
+int ewl_spectrum_init(Ewl_Spectrum *sp);
-void ewl_spectrum_type_set(Ewl_Spectrum *sp, Ewl_Spectrum_Type type);
+void ewl_spectrum_type_set(Ewl_Spectrum *sp, Ewl_Spectrum_Type type);
Ewl_Spectrum_Type ewl_spectrum_type_get(Ewl_Spectrum *sp);
-void ewl_spectrum_mode_set(Ewl_Spectrum *sp, Ewl_Color_Mode mode);
-Ewl_Color_Mode ewl_spectrum_mode_get(Ewl_Spectrum *sp);
+void ewl_spectrum_mode_set(Ewl_Spectrum *sp, Ewl_Color_Mode mode);
+Ewl_Color_Mode ewl_spectrum_mode_get(Ewl_Spectrum *sp);
-void ewl_spectrum_rgb_set(Ewl_Spectrum *sp, unsigned int r,
- unsigned int g, unsigned int b);
-void ewl_spectrum_rgb_get(Ewl_Spectrum *sp, unsigned int *r,
- unsigned int *g, unsigned int *b);
+void ewl_spectrum_rgb_set(Ewl_Spectrum *sp, unsigned int r,
+ unsigned int g, unsigned int b);
+void ewl_spectrum_rgb_get(Ewl_Spectrum *sp, unsigned int *r,
+ unsigned int *g, unsigned int *b);
-void ewl_spectrum_hsv_set(Ewl_Spectrum *sp, double h,
- double s, double v);
-void ewl_spectrum_hsv_get(Ewl_Spectrum *sp, double *h,
- double *s, double *v);
+void ewl_spectrum_hsv_set(Ewl_Spectrum *sp, double h,
+ double s, double v);
+void ewl_spectrum_hsv_get(Ewl_Spectrum *sp, double *h,
+ double *s, double *v);
/*
* Internally used callbacks, override at your own risk.
diff --git a/src/lib/ewl_spinner.c b/src/lib/ewl_spinner.c
index 6dfbd38..f98a6ba 100644
--- a/src/lib/ewl_spinner.c
+++ b/src/lib/ewl_spinner.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_spinner.h"
#include "ewl_box.h"
@@ -18,20 +18,20 @@ static void ewl_spinner_child_handle(Ewl_Spinner *s);
Ewl_Widget *
ewl_spinner_new(void)
{
- Ewl_Spinner *s = NULL;
+ Ewl_Spinner *s = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- s = NEW(Ewl_Spinner, 1);
- if (!s)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ s = NEW(Ewl_Spinner, 1);
+ if (!s)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_spinner_init(s)) {
- ewl_widget_destroy(EWL_WIDGET(s));
- s = NULL;
- }
+ if (!ewl_spinner_init(s)) {
+ ewl_widget_destroy(EWL_WIDGET(s));
+ s = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
}
/**
@@ -44,103 +44,103 @@ ewl_spinner_new(void)
int
ewl_spinner_init(Ewl_Spinner *s)
{
- Ewl_Widget *w;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, FALSE);
-
- w = EWL_WIDGET(s);
-
- if (!ewl_range_init(EWL_RANGE(w)))
- {
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
-
- ewl_widget_appearance_set(w, EWL_SPINNER_TYPE);
- ewl_widget_inherit(w, EWL_SPINNER_TYPE);
-
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_HSHRINK |
- EWL_FLAG_FILL_HFILL);
-
- ewl_callback_append(w, EWL_CALLBACK_REALIZE,
- ewl_spinner_cb_realize, NULL);
- ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
- ewl_spinner_cb_configure, NULL);
- ewl_callback_append(w, EWL_CALLBACK_VALUE_CHANGED,
- ewl_spinner_cb_value_changed, NULL);
- ewl_callback_prepend(w, EWL_CALLBACK_DESTROY,
- ewl_spinner_cb_destroy, NULL);
- ewl_callback_append(w, EWL_CALLBACK_FOCUS_IN,
- ewl_container_cb_widget_focus_in, NULL);
- ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT,
- ewl_container_cb_widget_focus_out, NULL);
- ewl_container_show_notify_set(EWL_CONTAINER(w),
- ewl_spinner_cb_child_show);
- ewl_container_resize_notify_set(EWL_CONTAINER(w),
- ewl_spinner_cb_child_resize);
-
- s->entry = ewl_entry_new();
- ewl_text_text_set(EWL_TEXT(s->entry), "0");
- ewl_container_child_append(EWL_CONTAINER(s), s->entry);
- ewl_object_fill_policy_set(EWL_OBJECT(s->entry), EWL_FLAG_FILL_HFILL |
- EWL_FLAG_FILL_HSHRINK);
- ewl_object_alignment_set(EWL_OBJECT(s->entry), EWL_FLAG_ALIGN_LEFT);
-
- ewl_widget_internal_set(EWL_WIDGET(s->entry), TRUE);
- ewl_callback_del(s->entry, EWL_CALLBACK_KEY_DOWN,
- ewl_entry_cb_key_down);
-
- ewl_callback_append(EWL_WIDGET(s), EWL_CALLBACK_KEY_DOWN,
- ewl_spinner_cb_key_down, NULL);
- ewl_callback_append(EWL_WIDGET(s), EWL_CALLBACK_FOCUS_OUT,
- ewl_spinner_cb_focus_out, NULL);
- ewl_callback_append(EWL_WIDGET(s), EWL_CALLBACK_MOUSE_WHEEL,
- ewl_spinner_cb_wheel, NULL);
-
- ewl_widget_show(s->entry);
-
- s->vbox = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(s), s->vbox);
- ewl_widget_appearance_set(s->vbox, "controls");
- ewl_widget_internal_set(s->vbox, TRUE);
- ewl_object_fill_policy_set(EWL_OBJECT(s->vbox), EWL_FLAG_FILL_NONE);
- ewl_widget_show(s->vbox);
-
- s->increment = ewl_button_new();
- ewl_container_child_append(EWL_CONTAINER(s->vbox), s->increment);
- ewl_object_alignment_set(EWL_OBJECT(s->increment),
- EWL_FLAG_ALIGN_CENTER);
- ewl_widget_appearance_set(s->increment, "increment");
- ewl_object_fill_policy_set(EWL_OBJECT(s->increment),
- EWL_FLAG_FILL_NONE);
- ewl_widget_internal_set(s->increment, TRUE);
- ewl_callback_append(s->increment, EWL_CALLBACK_MOUSE_DOWN,
- ewl_spinner_cb_increase_value, w);
- ewl_callback_append(s->increment, EWL_CALLBACK_MOUSE_UP,
- ewl_spinner_cb_value_stop, w);
- ewl_callback_append(s->increment, EWL_CALLBACK_KEY_DOWN,
- ewl_spinner_cb_key_down, s);
- ewl_widget_show(s->increment);
-
- s->decrement = ewl_button_new();
- ewl_container_child_append(EWL_CONTAINER(s->vbox), s->decrement);
- ewl_object_alignment_set(EWL_OBJECT(s->decrement),
- EWL_FLAG_ALIGN_CENTER);
- ewl_widget_appearance_set(s->decrement, "decrement");
- ewl_object_fill_policy_set(EWL_OBJECT(s->decrement),
- EWL_FLAG_FILL_NONE);
- ewl_widget_internal_set(s->decrement, TRUE);
- ewl_callback_append(s->decrement, EWL_CALLBACK_MOUSE_DOWN,
- ewl_spinner_cb_decrease_value, w);
- ewl_callback_append(s->decrement, EWL_CALLBACK_MOUSE_UP,
- ewl_spinner_cb_value_stop, w);
- ewl_callback_append(s->decrement, EWL_CALLBACK_KEY_DOWN,
- ewl_spinner_cb_key_down, s);
- ewl_widget_show(s->decrement);
-
- s->digits = 2;
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Widget *w;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, FALSE);
+
+ w = EWL_WIDGET(s);
+
+ if (!ewl_range_init(EWL_RANGE(w)))
+ {
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+
+ ewl_widget_appearance_set(w, EWL_SPINNER_TYPE);
+ ewl_widget_inherit(w, EWL_SPINNER_TYPE);
+
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_HSHRINK |
+ EWL_FLAG_FILL_HFILL);
+
+ ewl_callback_append(w, EWL_CALLBACK_REALIZE,
+ ewl_spinner_cb_realize, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
+ ewl_spinner_cb_configure, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_VALUE_CHANGED,
+ ewl_spinner_cb_value_changed, NULL);
+ ewl_callback_prepend(w, EWL_CALLBACK_DESTROY,
+ ewl_spinner_cb_destroy, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_FOCUS_IN,
+ ewl_container_cb_widget_focus_in, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT,
+ ewl_container_cb_widget_focus_out, NULL);
+ ewl_container_show_notify_set(EWL_CONTAINER(w),
+ ewl_spinner_cb_child_show);
+ ewl_container_resize_notify_set(EWL_CONTAINER(w),
+ ewl_spinner_cb_child_resize);
+
+ s->entry = ewl_entry_new();
+ ewl_text_text_set(EWL_TEXT(s->entry), "0");
+ ewl_container_child_append(EWL_CONTAINER(s), s->entry);
+ ewl_object_fill_policy_set(EWL_OBJECT(s->entry), EWL_FLAG_FILL_HFILL |
+ EWL_FLAG_FILL_HSHRINK);
+ ewl_object_alignment_set(EWL_OBJECT(s->entry), EWL_FLAG_ALIGN_LEFT);
+
+ ewl_widget_internal_set(EWL_WIDGET(s->entry), TRUE);
+ ewl_callback_del(s->entry, EWL_CALLBACK_KEY_DOWN,
+ ewl_entry_cb_key_down);
+
+ ewl_callback_append(EWL_WIDGET(s), EWL_CALLBACK_KEY_DOWN,
+ ewl_spinner_cb_key_down, NULL);
+ ewl_callback_append(EWL_WIDGET(s), EWL_CALLBACK_FOCUS_OUT,
+ ewl_spinner_cb_focus_out, NULL);
+ ewl_callback_append(EWL_WIDGET(s), EWL_CALLBACK_MOUSE_WHEEL,
+ ewl_spinner_cb_wheel, NULL);
+
+ ewl_widget_show(s->entry);
+
+ s->vbox = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(s), s->vbox);
+ ewl_widget_appearance_set(s->vbox, "controls");
+ ewl_widget_internal_set(s->vbox, TRUE);
+ ewl_object_fill_policy_set(EWL_OBJECT(s->vbox), EWL_FLAG_FILL_NONE);
+ ewl_widget_show(s->vbox);
+
+ s->increment = ewl_button_new();
+ ewl_container_child_append(EWL_CONTAINER(s->vbox), s->increment);
+ ewl_object_alignment_set(EWL_OBJECT(s->increment),
+ EWL_FLAG_ALIGN_CENTER);
+ ewl_widget_appearance_set(s->increment, "increment");
+ ewl_object_fill_policy_set(EWL_OBJECT(s->increment),
+ EWL_FLAG_FILL_NONE);
+ ewl_widget_internal_set(s->increment, TRUE);
+ ewl_callback_append(s->increment, EWL_CALLBACK_MOUSE_DOWN,
+ ewl_spinner_cb_increase_value, w);
+ ewl_callback_append(s->increment, EWL_CALLBACK_MOUSE_UP,
+ ewl_spinner_cb_value_stop, w);
+ ewl_callback_append(s->increment, EWL_CALLBACK_KEY_DOWN,
+ ewl_spinner_cb_key_down, s);
+ ewl_widget_show(s->increment);
+
+ s->decrement = ewl_button_new();
+ ewl_container_child_append(EWL_CONTAINER(s->vbox), s->decrement);
+ ewl_object_alignment_set(EWL_OBJECT(s->decrement),
+ EWL_FLAG_ALIGN_CENTER);
+ ewl_widget_appearance_set(s->decrement, "decrement");
+ ewl_object_fill_policy_set(EWL_OBJECT(s->decrement),
+ EWL_FLAG_FILL_NONE);
+ ewl_widget_internal_set(s->decrement, TRUE);
+ ewl_callback_append(s->decrement, EWL_CALLBACK_MOUSE_DOWN,
+ ewl_spinner_cb_decrease_value, w);
+ ewl_callback_append(s->decrement, EWL_CALLBACK_MOUSE_UP,
+ ewl_spinner_cb_value_stop, w);
+ ewl_callback_append(s->decrement, EWL_CALLBACK_KEY_DOWN,
+ ewl_spinner_cb_key_down, s);
+ ewl_widget_show(s->decrement);
+
+ s->digits = 2;
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -154,14 +154,14 @@ ewl_spinner_init(Ewl_Spinner *s)
void
ewl_spinner_digits_set(Ewl_Spinner *s, unsigned char digits)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(s);
- DCHECK_TYPE(s, EWL_SPINNER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(s);
+ DCHECK_TYPE(s, EWL_SPINNER_TYPE);
- s->digits = digits;
- ewl_spinner_entry_update(s);
+ s->digits = digits;
+ ewl_spinner_entry_update(s);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -172,11 +172,11 @@ ewl_spinner_digits_set(Ewl_Spinner *s, unsigned char digits)
unsigned char
ewl_spinner_digits_get(Ewl_Spinner *s)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, 0);
- DCHECK_TYPE_RET(s, EWL_SPINNER_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, 0);
+ DCHECK_TYPE_RET(s, EWL_SPINNER_TYPE, 0);
- DRETURN_INT(s->digits, DLEVEL_STABLE);
+ DRETURN_INT(s->digits, DLEVEL_STABLE);
}
/**
@@ -189,18 +189,18 @@ ewl_spinner_digits_get(Ewl_Spinner *s)
*/
void
ewl_spinner_cb_realize(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Spinner *s;
+ Ewl_Spinner *s;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- s = EWL_SPINNER(w);
- ewl_spinner_entry_update(s);
+ s = EWL_SPINNER(w);
+ ewl_spinner_entry_update(s);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -213,18 +213,18 @@ ewl_spinner_cb_realize(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_spinner_cb_value_changed(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Spinner *s;
+ Ewl_Spinner *s;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- s = EWL_SPINNER(w);
- ewl_spinner_entry_update(s);
+ s = EWL_SPINNER(w);
+ ewl_spinner_entry_update(s);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -237,29 +237,29 @@ ewl_spinner_cb_value_changed(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_spinner_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Spinner *s;
- int cx, cy, cw, ch;
- int pvw; /* the preferred w of the vbox */
+ Ewl_Spinner *s;
+ int cx, cy, cw, ch;
+ int pvw; /* the preferred w of the vbox */
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- s = EWL_SPINNER(w);
+ s = EWL_SPINNER(w);
- cx = CURRENT_X(w);
- cy = CURRENT_Y(w);
- cw = CURRENT_W(w);
- ch = CURRENT_H(w);
+ cx = CURRENT_X(w);
+ cy = CURRENT_Y(w);
+ cw = CURRENT_W(w);
+ ch = CURRENT_H(w);
- pvw = ewl_object_preferred_w_get(EWL_OBJECT(s->vbox));
+ pvw = ewl_object_preferred_w_get(EWL_OBJECT(s->vbox));
- ewl_object_place(EWL_OBJECT(s->vbox), cx + cw - pvw, cy, pvw, ch);
- ewl_object_place(EWL_OBJECT(s->entry), cx, cy, cw - pvw, ch);
+ ewl_object_place(EWL_OBJECT(s->vbox), cx + cw - pvw, cy, pvw, ch);
+ ewl_object_place(EWL_OBJECT(s->entry), cx, cy, cw - pvw, ch);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -272,56 +272,56 @@ ewl_spinner_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_spinner_cb_key_down(Ewl_Widget *w, void *ev_data,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Entry *e;
- Ewl_Spinner *s;
- Ewl_Event_Key *ev;
+ Ewl_Entry *e;
+ Ewl_Spinner *s;
+ Ewl_Event_Key *ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(ev_data);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(ev_data);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- s = EWL_SPINNER(w);
- e = EWL_ENTRY(s->entry);
+ s = EWL_SPINNER(w);
+ e = EWL_ENTRY(s->entry);
- ev = ev_data;
+ ev = ev_data;
- if (!strcmp(ev->keyname, "Up"))
- ewl_spinner_cb_increase_value(w, NULL, s);
+ if (!strcmp(ev->keyname, "Up"))
+ ewl_spinner_cb_increase_value(w, NULL, s);
- else if (!strcmp(ev->keyname, "Down"))
- ewl_spinner_cb_decrease_value(w, NULL, s);
+ else if (!strcmp(ev->keyname, "Down"))
+ ewl_spinner_cb_decrease_value(w, NULL, s);
- else if (!strcmp(ev->keyname, "Left"))
- ewl_entry_cursor_move_left(e);
+ else if (!strcmp(ev->keyname, "Left"))
+ ewl_entry_cursor_move_left(e);
- else if (!strcmp(ev->keyname, "Right"))
- ewl_entry_cursor_move_right(e);
+ else if (!strcmp(ev->keyname, "Right"))
+ ewl_entry_cursor_move_right(e);
/*
- else if (!strcmp(ev->keyname, "Home"))
- ewl_entry_cursor_home_move(e);
+ else if (!strcmp(ev->keyname, "Home"))
+ ewl_entry_cursor_home_move(e);
- else if (!strcmp(ev->keyname, "End"))
- ewl_entry_cursor_end_move(e);
+ else if (!strcmp(ev->keyname, "End"))
+ ewl_entry_cursor_end_move(e);
*/
- else if (!strcmp(ev->keyname, "BackSpace"))
- ewl_entry_delete_left(e);
-
- else if (!strcmp(ev->keyname, "Delete"))
- ewl_entry_delete_right(e);
-
- else if (ev->keyname && (isdigit(ev->keyname[0]) ||
- ev->keyname[0] == '.' ||
- ev->keyname[0] == '-'))
- {
- ewl_entry_selection_clear(e);
- ewl_text_text_insert(EWL_TEXT(e), ev->keyname,
- ewl_text_cursor_position_get(EWL_TEXT(e)));
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ else if (!strcmp(ev->keyname, "BackSpace"))
+ ewl_entry_delete_left(e);
+
+ else if (!strcmp(ev->keyname, "Delete"))
+ ewl_entry_delete_right(e);
+
+ else if (ev->keyname && (isdigit(ev->keyname[0]) ||
+ ev->keyname[0] == '.' ||
+ ev->keyname[0] == '-'))
+ {
+ ewl_entry_selection_clear(e);
+ ewl_text_text_insert(EWL_TEXT(e), ev->keyname,
+ ewl_text_cursor_position_get(EWL_TEXT(e)));
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -334,27 +334,27 @@ ewl_spinner_cb_key_down(Ewl_Widget *w, void *ev_data,
*/
void
ewl_spinner_cb_focus_out(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Spinner *s;
- char *str;
- float val;
+ Ewl_Spinner *s;
+ char *str;
+ float val;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- s = EWL_SPINNER(w);
- str = ewl_text_text_get(EWL_TEXT(s->entry));
+ s = EWL_SPINNER(w);
+ str = ewl_text_text_get(EWL_TEXT(s->entry));
- if (str && strlen(str)) {
- val = atof(str);
- ewl_range_value_set(EWL_RANGE(s), (double) (val));
+ if (str && strlen(str)) {
+ val = atof(str);
+ ewl_range_value_set(EWL_RANGE(s), (double) (val));
- } else if (str)
- FREE(str);
+ } else if (str)
+ FREE(str);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -367,43 +367,43 @@ ewl_spinner_cb_focus_out(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_spinner_cb_wheel(Ewl_Widget *w, void *ev_data,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Range *r;
- Ewl_Event_Mouse_Wheel *wheel;
+ Ewl_Range *r;
+ Ewl_Event_Mouse_Wheel *wheel;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(ev_data);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(ev_data);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- r = EWL_RANGE(w);
- wheel = (Ewl_Event_Mouse_Wheel *)ev_data;
+ r = EWL_RANGE(w);
+ wheel = (Ewl_Event_Mouse_Wheel *)ev_data;
- ewl_range_value_set(r, r->value - (wheel->z * r->step));
+ ewl_range_value_set(r, r->value - (wheel->z * r->step));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_spinner_entry_update(Ewl_Spinner *s)
{
- Ewl_Range *r;
- char format[64];
- char str[64];
+ Ewl_Range *r;
+ char format[64];
+ char str[64];
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(s);
- DCHECK_TYPE(s, EWL_SPINNER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(s);
+ DCHECK_TYPE(s, EWL_SPINNER_TYPE);
- r = EWL_RANGE(s);
+ r = EWL_RANGE(s);
- snprintf(format, 64, "%%.%df", s->digits);
- snprintf(str, 64, format, r->value);
+ snprintf(format, 64, "%%.%df", s->digits);
+ snprintf(str, 64, format, r->value);
- ewl_text_text_set(EWL_TEXT(s->entry), str);
+ ewl_text_text_set(EWL_TEXT(s->entry), str);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -416,32 +416,32 @@ ewl_spinner_entry_update(Ewl_Spinner *s)
*/
void
ewl_spinner_cb_increase_value(Ewl_Widget *w __UNUSED__, void *ev_data,
- void *user_data)
+ void *user_data)
{
- Ewl_Spinner *s;
- Ewl_Range *r;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(user_data);
- DCHECK_TYPE(user_data, EWL_SPINNER_TYPE);
-
- s = EWL_SPINNER(user_data);
- r = EWL_RANGE(s);
- ewl_spinner_cb_focus_out(EWL_WIDGET(s), NULL, NULL);
-
- if (!r->invert)
- ewl_range_increase(r);
- else
- ewl_range_decrease(r);
-
- if (ev_data) {
- s->direction = (!r->invert) ? 1 : -1;
- s->start_time = ecore_time_get();
- s->last_value = 0.0;
- s->timer = ecore_timer_add(0.02, ewl_spinner_timer, s);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Spinner *s;
+ Ewl_Range *r;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(user_data);
+ DCHECK_TYPE(user_data, EWL_SPINNER_TYPE);
+
+ s = EWL_SPINNER(user_data);
+ r = EWL_RANGE(s);
+ ewl_spinner_cb_focus_out(EWL_WIDGET(s), NULL, NULL);
+
+ if (!r->invert)
+ ewl_range_increase(r);
+ else
+ ewl_range_decrease(r);
+
+ if (ev_data) {
+ s->direction = (!r->invert) ? 1 : -1;
+ s->start_time = ecore_time_get();
+ s->last_value = 0.0;
+ s->timer = ecore_timer_add(0.02, ewl_spinner_timer, s);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -454,24 +454,24 @@ ewl_spinner_cb_increase_value(Ewl_Widget *w __UNUSED__, void *ev_data,
*/
void
ewl_spinner_cb_value_stop(Ewl_Widget *w __UNUSED__,
- void *ev_data __UNUSED__, void *user_data)
+ void *ev_data __UNUSED__, void *user_data)
{
- Ewl_Spinner *s;
+ Ewl_Spinner *s;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(user_data);
- DCHECK_TYPE(user_data, EWL_SPINNER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(user_data);
+ DCHECK_TYPE(user_data, EWL_SPINNER_TYPE);
- s = user_data;
- if (s->timer) {
- ecore_timer_del(s->timer);
+ s = user_data;
+ if (s->timer) {
+ ecore_timer_del(s->timer);
- s->timer = NULL;
- s->direction = 0;
- s->start_time = 0;
- }
+ s->timer = NULL;
+ s->direction = 0;
+ s->start_time = 0;
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -484,33 +484,33 @@ ewl_spinner_cb_value_stop(Ewl_Widget *w __UNUSED__,
*/
void
ewl_spinner_cb_decrease_value(Ewl_Widget *w __UNUSED__, void *ev_data,
- void *user_data)
+ void *user_data)
{
- Ewl_Spinner *s;
- Ewl_Range *r;
+ Ewl_Spinner *s;
+ Ewl_Range *r;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(user_data);
- DCHECK_TYPE(user_data, EWL_SPINNER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(user_data);
+ DCHECK_TYPE(user_data, EWL_SPINNER_TYPE);
- s = EWL_SPINNER(user_data);
- r = EWL_RANGE(s);
+ s = EWL_SPINNER(user_data);
+ r = EWL_RANGE(s);
- ewl_spinner_cb_focus_out(EWL_WIDGET(s), NULL, NULL);
+ ewl_spinner_cb_focus_out(EWL_WIDGET(s), NULL, NULL);
- if (!r->invert)
- ewl_range_decrease(r);
- else
- ewl_range_increase(r);
+ if (!r->invert)
+ ewl_range_decrease(r);
+ else
+ ewl_range_increase(r);
- if (ev_data) {
- s->direction = (!r->invert) ? -1 : 1;
- s->start_time = ecore_time_get();
- s->last_value = 0.0;
- s->timer = ecore_timer_add(0.02, ewl_spinner_timer, s);
- }
+ if (ev_data) {
+ s->direction = (!r->invert) ? -1 : 1;
+ s->start_time = ecore_time_get();
+ s->last_value = 0.0;
+ s->timer = ecore_timer_add(0.02, ewl_spinner_timer, s);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -523,89 +523,89 @@ ewl_spinner_cb_decrease_value(Ewl_Widget *w __UNUSED__, void *ev_data,
*/
void
ewl_spinner_cb_destroy(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Spinner *s;
+ Ewl_Spinner *s;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_SPINNER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_SPINNER_TYPE);
- s = EWL_SPINNER(w);
- if (s->timer) {
- ecore_timer_del(s->timer);
- s->timer = NULL;
- }
+ s = EWL_SPINNER(w);
+ if (s->timer) {
+ ecore_timer_del(s->timer);
+ s->timer = NULL;
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static int
ewl_spinner_timer(void *data)
{
- Ewl_Spinner *s;
- Ewl_Range *r;
- double dt, dv;
- double step;
- int velocity;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, ECORE_CALLBACK_CANCEL);
-
- s = EWL_SPINNER(data);
- r = EWL_RANGE(s);
-
- dt = ecore_time_get() - s->start_time;
- step = 0;
-
- /*
- * Check the theme for a velocity setting and bring it within normal
- * useable bounds.
- */
- velocity = ewl_theme_data_int_get(EWL_WIDGET(s), "velocity");
- if (velocity < 1)
- velocity = 1;
- else if (velocity > 10)
- velocity = 10;
-
- /*
- * Move the value of the spinner based on the direction of it's motion
- * and the velocity setting.
- */
- dv = velocity * s->direction * 10.0 * r->step * dt*dt;
-
- while (r->step < abs(dv - s->last_value - step)) {
- if (s->direction == 1)
- step += r->step;
- else
- step -= r->step;
- }
-
- ewl_range_value_set(r, r->value + step);
- s->last_value += step;
-
- DRETURN_INT(ECORE_CALLBACK_RENEW, DLEVEL_STABLE);
+ Ewl_Spinner *s;
+ Ewl_Range *r;
+ double dt, dv;
+ double step;
+ int velocity;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, ECORE_CALLBACK_CANCEL);
+
+ s = EWL_SPINNER(data);
+ r = EWL_RANGE(s);
+
+ dt = ecore_time_get() - s->start_time;
+ step = 0;
+
+ /*
+ * Check the theme for a velocity setting and bring it within normal
+ * useable bounds.
+ */
+ velocity = ewl_theme_data_int_get(EWL_WIDGET(s), "velocity");
+ if (velocity < 1)
+ velocity = 1;
+ else if (velocity > 10)
+ velocity = 10;
+
+ /*
+ * Move the value of the spinner based on the direction of it's motion
+ * and the velocity setting.
+ */
+ dv = velocity * s->direction * 10.0 * r->step * dt*dt;
+
+ while (r->step < abs(dv - s->last_value - step)) {
+ if (s->direction == 1)
+ step += r->step;
+ else
+ step -= r->step;
+ }
+
+ ewl_range_value_set(r, r->value + step);
+ s->last_value += step;
+
+ DRETURN_INT(ECORE_CALLBACK_RENEW, DLEVEL_STABLE);
}
static void
ewl_spinner_child_handle(Ewl_Spinner *s)
{
- int pvw, pvh, pew, peh;
+ int pvw, pvh, pew, peh;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(s);
- DCHECK_TYPE(s, EWL_SPINNER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(s);
+ DCHECK_TYPE(s, EWL_SPINNER_TYPE);
- pvw = ewl_object_preferred_w_get(EWL_OBJECT(s->vbox));
- pvh = ewl_object_preferred_h_get(EWL_OBJECT(s->vbox));
+ pvw = ewl_object_preferred_w_get(EWL_OBJECT(s->vbox));
+ pvh = ewl_object_preferred_h_get(EWL_OBJECT(s->vbox));
- pew = ewl_object_preferred_w_get(EWL_OBJECT(s->entry));
- peh = ewl_object_preferred_h_get(EWL_OBJECT(s->entry));
+ pew = ewl_object_preferred_w_get(EWL_OBJECT(s->entry));
+ peh = ewl_object_preferred_h_get(EWL_OBJECT(s->entry));
- ewl_object_preferred_inner_size_set(EWL_OBJECT(s), pvw + pew,
- MAX(peh, pvh));
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(s), pvw + pew,
+ MAX(peh, pvh));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -618,13 +618,13 @@ ewl_spinner_child_handle(Ewl_Spinner *s)
void
ewl_spinner_cb_child_show(Ewl_Container *c, Ewl_Widget *w __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_SPINNER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_SPINNER_TYPE);
- ewl_spinner_child_handle(EWL_SPINNER(c));
+ ewl_spinner_child_handle(EWL_SPINNER(c));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -638,15 +638,15 @@ ewl_spinner_cb_child_show(Ewl_Container *c, Ewl_Widget *w __UNUSED__)
*/
void
ewl_spinner_cb_child_resize(Ewl_Container *c, Ewl_Widget *w __UNUSED__,
- int size __UNUSED__,
- Ewl_Orientation o __UNUSED__)
+ int size __UNUSED__,
+ Ewl_Orientation o __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_SPINNER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_SPINNER_TYPE);
- ewl_spinner_child_handle(EWL_SPINNER(c));
+ ewl_spinner_child_handle(EWL_SPINNER(c));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_spinner.h b/src/lib/ewl_spinner.h
index 922c73d..7b8e1c4 100644
--- a/src/lib/ewl_spinner.h
+++ b/src/lib/ewl_spinner.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_SPINNER_H
#define EWL_SPINNER_H
@@ -51,49 +51,49 @@ typedef struct Ewl_Spinner Ewl_Spinner;
*/
struct Ewl_Spinner
{
- Ewl_Range range; /**< Inherit from Ewl_Range */
- unsigned char digits; /**< Number of digits displayed after decimal */
- Ewl_Widget *entry; /**< The Ewl_Entry displaying value */
- Ewl_Widget *vbox; /**< Ewl_Box to hold the buttons */
- Ewl_Widget *increment; /**< Ewl_Button to add value */
- Ewl_Widget *decrement; /**< Ewl_Button to subtract value */
- double start_time; /**< Time the spinner was pressed */
- double last_value; /**< The last value while spinning */
- int direction; /**< Indicate increasing/decreasing value */
- Ecore_Timer *timer; /**< Timer for tracking mouse button held down */
+ Ewl_Range range; /**< Inherit from Ewl_Range */
+ unsigned char digits; /**< Number of digits displayed after decimal */
+ Ewl_Widget *entry; /**< The Ewl_Entry displaying value */
+ Ewl_Widget *vbox; /**< Ewl_Box to hold the buttons */
+ Ewl_Widget *increment; /**< Ewl_Button to add value */
+ Ewl_Widget *decrement; /**< Ewl_Button to subtract value */
+ double start_time; /**< Time the spinner was pressed */
+ double last_value; /**< The last value while spinning */
+ int direction; /**< Indicate increasing/decreasing value */
+ Ecore_Timer *timer; /**< Timer for tracking mouse button held down */
};
-Ewl_Widget *ewl_spinner_new(void);
-int ewl_spinner_init(Ewl_Spinner *s);
+Ewl_Widget *ewl_spinner_new(void);
+int ewl_spinner_init(Ewl_Spinner *s);
-void ewl_spinner_digits_set(Ewl_Spinner *s, unsigned char digits);
-unsigned char ewl_spinner_digits_get(Ewl_Spinner *s);
+void ewl_spinner_digits_set(Ewl_Spinner *s, unsigned char digits);
+unsigned char ewl_spinner_digits_get(Ewl_Spinner *s);
/*
* Internally used callbacks, override at your own risk.
*/
void ewl_spinner_cb_realize(Ewl_Widget *widget, void *ev_data,
- void *user_data);
+ void *user_data);
void ewl_spinner_cb_value_changed(Ewl_Widget *widget, void *ev_data,
- void *user_data);
+ void *user_data);
void ewl_spinner_cb_configure(Ewl_Widget *widget, void *ev_data,
- void *user_data);
+ void *user_data);
void ewl_spinner_cb_key_down(Ewl_Widget *widget, void *ev_data,
- void *user_data);
+ void *user_data);
void ewl_spinner_cb_focus_out(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
void ewl_spinner_cb_wheel(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
void ewl_spinner_cb_increase_value(Ewl_Widget *widget, void *ev_data,
- void *user_data);
+ void *user_data);
void ewl_spinner_cb_decrease_value(Ewl_Widget *widget, void *ev_data,
- void *user_data);
+ void *user_data);
void ewl_spinner_cb_value_stop(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_spinner_cb_destroy(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_spinner_cb_child_show(Ewl_Container *c, Ewl_Widget *w);
void ewl_spinner_cb_child_resize(Ewl_Container *c, Ewl_Widget *w, int size,
- Ewl_Orientation o);
+ Ewl_Orientation o);
/**
* @}
*/
diff --git a/src/lib/ewl_statusbar.c b/src/lib/ewl_statusbar.c
index 9d9eb28..642a942 100644
--- a/src/lib/ewl_statusbar.c
+++ b/src/lib/ewl_statusbar.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_statusbar.h"
#include "ewl_label.h"
@@ -13,20 +13,20 @@
Ewl_Widget *
ewl_statusbar_new(void)
{
- Ewl_Statusbar *sb = NULL;
+ Ewl_Statusbar *sb = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- sb = NEW(Ewl_Statusbar, 1);
- if (!sb)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ sb = NEW(Ewl_Statusbar, 1);
+ if (!sb)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_statusbar_init(sb)) {
- ewl_widget_destroy(EWL_WIDGET(sb));
- sb = NULL;
- }
+ if (!ewl_statusbar_init(sb)) {
+ ewl_widget_destroy(EWL_WIDGET(sb));
+ sb = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(sb), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(sb), DLEVEL_STABLE);
}
/**
@@ -37,52 +37,52 @@ ewl_statusbar_new(void)
int
ewl_statusbar_init(Ewl_Statusbar *sb)
{
- Ewl_Widget *w = NULL;
+ Ewl_Widget *w = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(sb, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(sb, FALSE);
- w = EWL_WIDGET(sb);
+ w = EWL_WIDGET(sb);
- if (!ewl_box_init(EWL_BOX(sb))) {
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
+ if (!ewl_box_init(EWL_BOX(sb))) {
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
- ewl_object_fill_policy_set(EWL_OBJECT(w),
- EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
+ ewl_object_fill_policy_set(EWL_OBJECT(w),
+ EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
- ewl_box_orientation_set(EWL_BOX(sb), EWL_ORIENTATION_HORIZONTAL);
- ewl_widget_appearance_set(w, EWL_STATUSBAR_TYPE);
- ewl_widget_inherit(w, EWL_STATUSBAR_TYPE);
+ ewl_box_orientation_set(EWL_BOX(sb), EWL_ORIENTATION_HORIZONTAL);
+ ewl_widget_appearance_set(w, EWL_STATUSBAR_TYPE);
+ ewl_widget_inherit(w, EWL_STATUSBAR_TYPE);
- sb->left = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(sb), sb->left);
- ewl_widget_internal_set(EWL_WIDGET(sb->left), TRUE);
- ewl_object_fill_policy_set(EWL_OBJECT(sb->left), EWL_FLAG_FILL_SHRINK);
- ewl_widget_show(sb->left);
+ sb->left = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(sb), sb->left);
+ ewl_widget_internal_set(EWL_WIDGET(sb->left), TRUE);
+ ewl_object_fill_policy_set(EWL_OBJECT(sb->left), EWL_FLAG_FILL_SHRINK);
+ ewl_widget_show(sb->left);
- sb->status = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(sb), sb->status);
- ewl_widget_internal_set(EWL_WIDGET(sb->status), TRUE);
- ewl_object_alignment_set(EWL_OBJECT(sb->status), EWL_FLAG_ALIGN_LEFT);
- ewl_widget_show(sb->status);
+ sb->status = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(sb), sb->status);
+ ewl_widget_internal_set(EWL_WIDGET(sb->status), TRUE);
+ ewl_object_alignment_set(EWL_OBJECT(sb->status), EWL_FLAG_ALIGN_LEFT);
+ ewl_widget_show(sb->status);
- sb->right = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(sb), sb->right);
- ewl_widget_internal_set(EWL_WIDGET(sb->right), TRUE);
- ewl_object_fill_policy_set(EWL_OBJECT(sb->right), EWL_FLAG_FILL_SHRINK);
- ewl_object_alignment_set(EWL_OBJECT(sb->right), EWL_FLAG_ALIGN_RIGHT);
- ewl_widget_show(sb->right);
+ sb->right = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(sb), sb->right);
+ ewl_widget_internal_set(EWL_WIDGET(sb->right), TRUE);
+ ewl_object_fill_policy_set(EWL_OBJECT(sb->right), EWL_FLAG_FILL_SHRINK);
+ ewl_object_alignment_set(EWL_OBJECT(sb->right), EWL_FLAG_ALIGN_RIGHT);
+ ewl_widget_show(sb->right);
- ewl_container_redirect_set(EWL_CONTAINER(sb),
- EWL_CONTAINER(sb->right));
+ ewl_container_redirect_set(EWL_CONTAINER(sb),
+ EWL_CONTAINER(sb->right));
- sb->stack = ecore_list_new();
+ sb->stack = ecore_list_new();
- ewl_callback_append(EWL_WIDGET(sb), EWL_CALLBACK_DESTROY,
- ewl_statusbar_cb_destroy, NULL);
+ ewl_callback_append(EWL_WIDGET(sb), EWL_CALLBACK_DESTROY,
+ ewl_statusbar_cb_destroy, NULL);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -93,14 +93,14 @@ ewl_statusbar_init(Ewl_Statusbar *sb)
void
ewl_statusbar_left_hide(Ewl_Statusbar *sb)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sb);
- DCHECK_TYPE(sb, EWL_STATUSBAR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sb);
+ DCHECK_TYPE(sb, EWL_STATUSBAR_TYPE);
- ewl_container_child_remove(EWL_CONTAINER(sb), sb->left);
- ewl_widget_hide(sb->left);
+ ewl_container_child_remove(EWL_CONTAINER(sb), sb->left);
+ ewl_widget_hide(sb->left);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -111,14 +111,14 @@ ewl_statusbar_left_hide(Ewl_Statusbar *sb)
void
ewl_statusbar_left_show(Ewl_Statusbar *sb)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sb);
- DCHECK_TYPE(sb, EWL_STATUSBAR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sb);
+ DCHECK_TYPE(sb, EWL_STATUSBAR_TYPE);
- ewl_container_child_prepend(EWL_CONTAINER(sb), sb->left);
- ewl_widget_show(sb->left);
+ ewl_container_child_prepend(EWL_CONTAINER(sb), sb->left);
+ ewl_widget_show(sb->left);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -129,14 +129,14 @@ ewl_statusbar_left_show(Ewl_Statusbar *sb)
void
ewl_statusbar_right_hide(Ewl_Statusbar *sb)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sb);
- DCHECK_TYPE(sb, EWL_STATUSBAR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sb);
+ DCHECK_TYPE(sb, EWL_STATUSBAR_TYPE);
- ewl_container_child_remove(EWL_CONTAINER(sb), sb->right);
- ewl_widget_hide(sb->right);
+ ewl_container_child_remove(EWL_CONTAINER(sb), sb->right);
+ ewl_widget_hide(sb->right);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -147,14 +147,14 @@ ewl_statusbar_right_hide(Ewl_Statusbar *sb)
void
ewl_statusbar_right_show(Ewl_Statusbar *sb)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sb);
- DCHECK_TYPE(sb, EWL_STATUSBAR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sb);
+ DCHECK_TYPE(sb, EWL_STATUSBAR_TYPE);
- ewl_container_child_append(EWL_CONTAINER(sb), sb->right);
- ewl_widget_show(sb->right);
+ ewl_container_child_append(EWL_CONTAINER(sb), sb->right);
+ ewl_widget_show(sb->right);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -167,16 +167,16 @@ ewl_statusbar_right_show(Ewl_Statusbar *sb)
void
ewl_statusbar_active_set(Ewl_Statusbar *sb, Ewl_Position pos)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sb);
- DCHECK_TYPE(sb, EWL_STATUSBAR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sb);
+ DCHECK_TYPE(sb, EWL_STATUSBAR_TYPE);
- if ((pos == EWL_POSITION_LEFT) || (pos == EWL_POSITION_TOP))
- ewl_container_redirect_set(EWL_CONTAINER(sb), EWL_CONTAINER(sb->left));
- else
- ewl_container_redirect_set(EWL_CONTAINER(sb), EWL_CONTAINER(sb->right));
+ if ((pos == EWL_POSITION_LEFT) || (pos == EWL_POSITION_TOP))
+ ewl_container_redirect_set(EWL_CONTAINER(sb), EWL_CONTAINER(sb->left));
+ else
+ ewl_container_redirect_set(EWL_CONTAINER(sb), EWL_CONTAINER(sb->right));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -189,15 +189,15 @@ ewl_statusbar_active_set(Ewl_Statusbar *sb, Ewl_Position pos)
void
ewl_statusbar_left_append(Ewl_Statusbar *sb, Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sb);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(sb, EWL_STATUSBAR_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sb);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(sb, EWL_STATUSBAR_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_container_child_append(EWL_CONTAINER(sb->left), w);
+ ewl_container_child_append(EWL_CONTAINER(sb->left), w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -210,15 +210,15 @@ ewl_statusbar_left_append(Ewl_Statusbar *sb, Ewl_Widget *w)
void
ewl_statusbar_left_prepend(Ewl_Statusbar *sb, Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sb);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(sb, EWL_STATUSBAR_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sb);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(sb, EWL_STATUSBAR_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_container_child_prepend(EWL_CONTAINER(sb->left), w);
+ ewl_container_child_prepend(EWL_CONTAINER(sb->left), w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -231,15 +231,15 @@ ewl_statusbar_left_prepend(Ewl_Statusbar *sb, Ewl_Widget *w)
void
ewl_statusbar_right_append(Ewl_Statusbar *sb, Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sb);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(sb, EWL_STATUSBAR_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sb);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(sb, EWL_STATUSBAR_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_container_child_append(EWL_CONTAINER(sb->right), w);
+ ewl_container_child_append(EWL_CONTAINER(sb->right), w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -252,15 +252,15 @@ ewl_statusbar_right_append(Ewl_Statusbar *sb, Ewl_Widget *w)
void
ewl_statusbar_right_prepend(Ewl_Statusbar *sb, Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sb);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(sb, EWL_STATUSBAR_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sb);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(sb, EWL_STATUSBAR_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_container_child_prepend(EWL_CONTAINER(sb->right), w);
+ ewl_container_child_prepend(EWL_CONTAINER(sb->right), w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -272,24 +272,24 @@ ewl_statusbar_right_prepend(Ewl_Statusbar *sb, Ewl_Widget *w)
void
ewl_statusbar_push(Ewl_Statusbar *sb, char *txt)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sb);
- DCHECK_PARAM_PTR(txt);
- DCHECK_TYPE(sb, EWL_STATUSBAR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sb);
+ DCHECK_PARAM_PTR(txt);
+ DCHECK_TYPE(sb, EWL_STATUSBAR_TYPE);
- if (sb->current) {
- ewl_widget_hide(sb->current);
- // ewl_container_child_remove(EWL_CONTAINER(sb->status), sb->current);
- }
+ if (sb->current) {
+ ewl_widget_hide(sb->current);
+ // ewl_container_child_remove(EWL_CONTAINER(sb->status), sb->current);
+ }
- sb->current = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(sb->current), txt);
- ewl_container_child_append(EWL_CONTAINER(sb->status), sb->current);
- ewl_widget_show(sb->current);
+ sb->current = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(sb->current), txt);
+ ewl_container_child_append(EWL_CONTAINER(sb->status), sb->current);
+ ewl_widget_show(sb->current);
- ecore_list_prepend(sb->stack, sb->current);
+ ecore_list_prepend(sb->stack, sb->current);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -301,40 +301,40 @@ ewl_statusbar_push(Ewl_Statusbar *sb, char *txt)
void
ewl_statusbar_pop(Ewl_Statusbar *sb)
{
- Ewl_Widget *current;
+ Ewl_Widget *current;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(sb);
- DCHECK_TYPE(sb, EWL_STATUSBAR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(sb);
+ DCHECK_TYPE(sb, EWL_STATUSBAR_TYPE);
- current = ecore_list_first_remove(sb->stack);
- if (current)
- ewl_widget_destroy(current);
+ current = ecore_list_first_remove(sb->stack);
+ if (current)
+ ewl_widget_destroy(current);
- current = ecore_list_first_goto(sb->stack);
- if (current)
- ewl_widget_show(current);
+ current = ecore_list_first_goto(sb->stack);
+ if (current)
+ ewl_widget_show(current);
- sb->current = current;
+ sb->current = current;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
void
ewl_statusbar_cb_destroy(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Statusbar *sb;
+ Ewl_Statusbar *sb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_STATUSBAR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_STATUSBAR_TYPE);
- sb = EWL_STATUSBAR(w);
+ sb = EWL_STATUSBAR(w);
- IF_FREE_LIST(sb->stack);
+ IF_FREE_LIST(sb->stack);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_statusbar.h b/src/lib/ewl_statusbar.h
index 2f2384d..806c0b3 100644
--- a/src/lib/ewl_statusbar.h
+++ b/src/lib/ewl_statusbar.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_STATUSBAR_H
#define EWL_STATUSBAR_H
@@ -50,30 +50,30 @@ typedef struct Ewl_Statusbar Ewl_Statusbar;
*/
struct Ewl_Statusbar
{
- Ewl_Box outer_box; /**< Inherit from Ewl_Box */
- Ewl_Widget *left; /**< The left container **/
- Ewl_Widget *status; /**< The status container */
- Ewl_Widget *right; /**< The right container */
- Ecore_List *stack; /**< The stack of status' */
- Ewl_Widget *current; /**< The currently displayed status */
+ Ewl_Box outer_box; /**< Inherit from Ewl_Box */
+ Ewl_Widget *left; /**< The left container **/
+ Ewl_Widget *status; /**< The status container */
+ Ewl_Widget *right; /**< The right container */
+ Ecore_List *stack; /**< The stack of status' */
+ Ewl_Widget *current; /**< The currently displayed status */
};
-Ewl_Widget *ewl_statusbar_new(void);
-int ewl_statusbar_init(Ewl_Statusbar *sb);
+Ewl_Widget *ewl_statusbar_new(void);
+int ewl_statusbar_init(Ewl_Statusbar *sb);
-void ewl_statusbar_left_hide(Ewl_Statusbar *sb);
-void ewl_statusbar_left_show(Ewl_Statusbar *sb);
-void ewl_statusbar_right_hide(Ewl_Statusbar *sb);
-void ewl_statusbar_right_show(Ewl_Statusbar *sb);
+void ewl_statusbar_left_hide(Ewl_Statusbar *sb);
+void ewl_statusbar_left_show(Ewl_Statusbar *sb);
+void ewl_statusbar_right_hide(Ewl_Statusbar *sb);
+void ewl_statusbar_right_show(Ewl_Statusbar *sb);
-void ewl_statusbar_active_set(Ewl_Statusbar *sb, Ewl_Position pos);
-void ewl_statusbar_left_append(Ewl_Statusbar *sb, Ewl_Widget *w);
-void ewl_statusbar_left_prepend(Ewl_Statusbar *sb, Ewl_Widget *w);
-void ewl_statusbar_right_append(Ewl_Statusbar *sb, Ewl_Widget *w);
-void ewl_statusbar_right_prepend(Ewl_Statusbar *sb, Ewl_Widget *w);
+void ewl_statusbar_active_set(Ewl_Statusbar *sb, Ewl_Position pos);
+void ewl_statusbar_left_append(Ewl_Statusbar *sb, Ewl_Widget *w);
+void ewl_statusbar_left_prepend(Ewl_Statusbar *sb, Ewl_Widget *w);
+void ewl_statusbar_right_append(Ewl_Statusbar *sb, Ewl_Widget *w);
+void ewl_statusbar_right_prepend(Ewl_Statusbar *sb, Ewl_Widget *w);
-void ewl_statusbar_push(Ewl_Statusbar *sb, char *txt);
-void ewl_statusbar_pop(Ewl_Statusbar *sb);
+void ewl_statusbar_push(Ewl_Statusbar *sb, char *txt);
+void ewl_statusbar_pop(Ewl_Statusbar *sb);
/*
* Internal functions
diff --git a/src/lib/ewl_stock.c b/src/lib/ewl_stock.c
index 31e6b9d..3e377f6 100644
--- a/src/lib/ewl_stock.c
+++ b/src/lib/ewl_stock.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_stock.h"
#include "ewl_icon_theme.h"
@@ -12,27 +12,27 @@
*/
struct
{
- const char * const label;
- const char * const image_key;
- const char * const tooltip;
+ const char * const label;
+ const char * const image_key;
+ const char * const tooltip;
} ewl_stock_items[] = {
- {"Apply", EWL_ICON_DIALOG_APPLY, "Apply"},
- {/*Arrow*/"Down", EWL_ICON_GO_DOWN, "Down"},
- {/*Arrow*/"Left", EWL_ICON_GO_PREVIOUS, "Previous"},
- {/*Arrow*/"Right", EWL_ICON_GO_NEXT, "Next"},
- {/*Arrow*/"Up", EWL_ICON_GO_UP, "Up"},
- {"Cancel", EWL_ICON_DIALOG_CANCEL, "Cancel"},
- {"FF", EWL_ICON_MEDIA_SEEK_FORWARD, "Fast Forward"},
- {"Home", EWL_ICON_GO_HOME, "Home"},
- {"Ok", EWL_ICON_DIALOG_OK, "OK"},
- {"Open", EWL_ICON_DOCUMENT_OPEN, "Open"},
- {"Pause", EWL_ICON_MEDIA_PLAYBACK_PAUSE, "Pause"},
- {"Play", EWL_ICON_MEDIA_PLAYBACK_START, "Play"},
- {"Quit", EWL_ICON_SYSTEM_LOG_OUT, "Quit"},
- {"Rewind", EWL_ICON_MEDIA_SEEK_BACKWARD, "Rewind"},
- {"Save", EWL_ICON_DOCUMENT_SAVE, "Save"},
- {"Stop", EWL_ICON_MEDIA_PLAYBACK_STOP, "Stop"}
- };
+ {"Apply", EWL_ICON_DIALOG_APPLY, "Apply"},
+ {/*Arrow*/"Down", EWL_ICON_GO_DOWN, "Down"},
+ {/*Arrow*/"Left", EWL_ICON_GO_PREVIOUS, "Previous"},
+ {/*Arrow*/"Right", EWL_ICON_GO_NEXT, "Next"},
+ {/*Arrow*/"Up", EWL_ICON_GO_UP, "Up"},
+ {"Cancel", EWL_ICON_DIALOG_CANCEL, "Cancel"},
+ {"FF", EWL_ICON_MEDIA_SEEK_FORWARD, "Fast Forward"},
+ {"Home", EWL_ICON_GO_HOME, "Home"},
+ {"Ok", EWL_ICON_DIALOG_OK, "OK"},
+ {"Open", EWL_ICON_DOCUMENT_OPEN, "Open"},
+ {"Pause", EWL_ICON_MEDIA_PLAYBACK_PAUSE, "Pause"},
+ {"Play", EWL_ICON_MEDIA_PLAYBACK_START, "Play"},
+ {"Quit", EWL_ICON_SYSTEM_LOG_OUT, "Quit"},
+ {"Rewind", EWL_ICON_MEDIA_SEEK_BACKWARD, "Rewind"},
+ {"Save", EWL_ICON_DOCUMENT_SAVE, "Save"},
+ {"Stop", EWL_ICON_MEDIA_PLAYBACK_STOP, "Stop"}
+ };
/**
* @param s: the stock widget to initialize
@@ -45,15 +45,15 @@ struct
int
ewl_stock_init(Ewl_Stock *s)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, FALSE);
- if (!ewl_box_init(EWL_BOX(s)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_box_init(EWL_BOX(s)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_inherit(EWL_WIDGET(s), EWL_STOCK_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(s), EWL_STOCK_TYPE);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -66,14 +66,14 @@ ewl_stock_init(Ewl_Stock *s)
void
ewl_stock_functions_set(Ewl_Stock *s, const Ewl_Stock_Funcs * const funcs)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(s);
- DCHECK_PARAM_PTR(funcs);
- DCHECK_TYPE(s, EWL_STOCK_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(s);
+ DCHECK_PARAM_PTR(funcs);
+ DCHECK_TYPE(s, EWL_STOCK_TYPE);
- s->stock_funcs = funcs;
+ s->stock_funcs = funcs;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -85,47 +85,47 @@ ewl_stock_functions_set(Ewl_Stock *s, const Ewl_Stock_Funcs * const funcs)
void
ewl_stock_type_set(Ewl_Stock *s, Ewl_Stock_Type stock)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(s);
- DCHECK_TYPE(s, EWL_STOCK_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(s);
+ DCHECK_TYPE(s, EWL_STOCK_TYPE);
- if (stock == s->stock_type)
- DRETURN(DLEVEL_STABLE);
+ if (stock == s->stock_type)
+ DRETURN(DLEVEL_STABLE);
- s->stock_type = stock;
+ s->stock_type = stock;
- /* we're done if it's none */
- if (s->stock_type == EWL_STOCK_NONE)
- DRETURN(DLEVEL_STABLE);
+ /* we're done if it's none */
+ if (s->stock_type == EWL_STOCK_NONE)
+ DRETURN(DLEVEL_STABLE);
- /* Can't do anything without the stock funcs */
- if (!s->stock_funcs)
- DRETURN(DLEVEL_STABLE);
+ /* Can't do anything without the stock funcs */
+ if (!s->stock_funcs)
+ DRETURN(DLEVEL_STABLE);
- /* set the label */
- if (s->stock_funcs->label_set)
- s->stock_funcs->label_set(s,
- ewl_stock_items[s->stock_type].label);
+ /* set the label */
+ if (s->stock_funcs->label_set)
+ s->stock_funcs->label_set(s,
+ ewl_stock_items[s->stock_type].label);
- /* set the image */
- if (s->stock_funcs->image_set) {
- const char *data;
+ /* set the image */
+ if (s->stock_funcs->image_set) {
+ const char *data;
- /* check for an image key */
- data = ewl_icon_theme_icon_path_get(
- ewl_stock_items[s->stock_type].image_key,
- EWL_ICON_SIZE_MEDIUM);
+ /* check for an image key */
+ data = ewl_icon_theme_icon_path_get(
+ ewl_stock_items[s->stock_type].image_key,
+ EWL_ICON_SIZE_MEDIUM);
- s->stock_funcs->image_set(s, data,
- ewl_stock_items[s->stock_type].image_key);
- }
+ s->stock_funcs->image_set(s, data,
+ ewl_stock_items[s->stock_type].image_key);
+ }
- /* set the tooltip */
- if (s->stock_funcs->tooltip_set)
- s->stock_funcs->tooltip_set(s,
- ewl_stock_items[s->stock_type].tooltip);
+ /* set the tooltip */
+ if (s->stock_funcs->tooltip_set)
+ s->stock_funcs->tooltip_set(s,
+ ewl_stock_items[s->stock_type].tooltip);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -136,11 +136,11 @@ ewl_stock_type_set(Ewl_Stock *s, Ewl_Stock_Type stock)
Ewl_Stock_Type
ewl_stock_type_get(Ewl_Stock *s)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(s, EWL_STOCK_NONE);
- DCHECK_TYPE_RET(s, EWL_STOCK_TYPE, EWL_STOCK_NONE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(s, EWL_STOCK_NONE);
+ DCHECK_TYPE_RET(s, EWL_STOCK_TYPE, EWL_STOCK_NONE);
- DRETURN_INT(s->stock_type, DLEVEL_STABLE);
+ DRETURN_INT(s->stock_type, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_stock.h b/src/lib/ewl_stock.h
index 8580a5c..9e4edae 100644
--- a/src/lib/ewl_stock.h
+++ b/src/lib/ewl_stock.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_STOCK_H
#define EWL_STOCK_H
@@ -86,9 +86,9 @@ typedef void (*Ewl_Stock_Tooltip_Set)(Ewl_Stock *s, const char *tip);
*/
struct Ewl_Stock
{
- Ewl_Box box; /**< Inherit from the box for adding widgets */
- Ewl_Stock_Type stock_type; /**< The stock type of the stock */
- const Ewl_Stock_Funcs *stock_funcs; /**< The stock functions */
+ Ewl_Box box; /**< Inherit from the box for adding widgets */
+ Ewl_Stock_Type stock_type; /**< The stock type of the stock */
+ const Ewl_Stock_Funcs *stock_funcs; /**< The stock functions */
};
/**
@@ -97,18 +97,18 @@ struct Ewl_Stock
*/
struct Ewl_Stock_Funcs
{
- Ewl_Stock_Label_Set label_set; /**< The label set function */
- Ewl_Stock_Image_Set image_set; /**< The image set function */
- Ewl_Stock_Tooltip_Set tooltip_set; /**< The tooltip set function */
+ Ewl_Stock_Label_Set label_set; /**< The label set function */
+ Ewl_Stock_Image_Set image_set; /**< The image set function */
+ Ewl_Stock_Tooltip_Set tooltip_set; /**< The tooltip set function */
};
-int ewl_stock_init(Ewl_Stock *s);
+int ewl_stock_init(Ewl_Stock *s);
-void ewl_stock_functions_set(Ewl_Stock *s, const Ewl_Stock_Funcs * const funcs);
+void ewl_stock_functions_set(Ewl_Stock *s, const Ewl_Stock_Funcs * const funcs);
-void ewl_stock_type_set(Ewl_Stock *s, Ewl_Stock_Type stock);
-Ewl_Stock_Type ewl_stock_type_get(Ewl_Stock *s);
+void ewl_stock_type_set(Ewl_Stock *s, Ewl_Stock_Type stock);
+Ewl_Stock_Type ewl_stock_type_get(Ewl_Stock *s);
/**
* @}
diff --git a/src/lib/ewl_table.c b/src/lib/ewl_table.c
index 63c6fbf..53b583c 100644
--- a/src/lib/ewl_table.c
+++ b/src/lib/ewl_table.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_table.h"
#include "ewl_button.h"
@@ -17,20 +17,20 @@
Ewl_Widget *
ewl_table_new(int cols, int rows, char **col_headers)
{
- Ewl_Table *t;
+ Ewl_Table *t;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- t = NEW(Ewl_Table, 1);
- if (!t)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ t = NEW(Ewl_Table, 1);
+ if (!t)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_table_init(t, cols, rows, col_headers)) {
- ewl_widget_destroy(EWL_WIDGET(t));
- t = NULL;
- }
+ if (!ewl_table_init(t, cols, rows, col_headers)) {
+ ewl_widget_destroy(EWL_WIDGET(t));
+ t = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(t), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(t), DLEVEL_STABLE);
}
/**
@@ -47,76 +47,76 @@ ewl_table_new(int cols, int rows, char **col_headers)
int
ewl_table_init(Ewl_Table *t, int cols, int rows, char **col_headers)
{
- Ewl_Widget *button;
- Ewl_Cell *cell;
- int i;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, FALSE);
-
- /*
- * Iniitialize the tables inherited fields
- */
- if (!ewl_container_init(EWL_CONTAINER(t))) {
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
- ewl_widget_appearance_set(EWL_WIDGET(t), EWL_TABLE_TYPE);
- ewl_widget_inherit(EWL_WIDGET(t), EWL_TABLE_TYPE);
- ewl_object_fill_policy_set(EWL_OBJECT(t), EWL_FLAG_FILL_FILL);
-
- ewl_container_show_notify_set(EWL_CONTAINER(t), ewl_table_cb_child_show);
-
- /*
- * Create a new grid
- */
- t->grid = (Ewl_Grid *)ewl_grid_new();
- if (col_headers)
- ewl_grid_dimensions_set(t->grid, cols, rows + 1);
- else
- ewl_grid_dimensions_set(t->grid, cols, rows);
- ewl_container_child_append(EWL_CONTAINER(t), EWL_WIDGET(t->grid));
- ewl_widget_show(EWL_WIDGET(t->grid));
-
- /*
- * Add the column headers to the grid
- */
- if (col_headers != NULL) {
-
- for (i = 1; i <= cols; i++) {
- cell = (Ewl_Cell *) ewl_cell_new();
- button = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button), col_headers[i - 1]);
- ewl_widget_disable(button);
- ewl_container_child_append(EWL_CONTAINER(cell), button);
- ewl_object_fill_policy_set(EWL_OBJECT(cell),
- EWL_FLAG_FILL_VSHRINK | EWL_FLAG_FILL_HFILL);
- ewl_container_child_append(EWL_CONTAINER(t->grid),
- EWL_WIDGET(cell));
- ewl_grid_child_position_set(t->grid, EWL_WIDGET(cell),
- i, i, 1, 1);
- ewl_widget_show(EWL_WIDGET(button));
- ewl_widget_show(EWL_WIDGET(cell));
- }
-
- t->col_headers = col_headers;
- }
-
- t->row_select = 0;
-
- t->selected.start_r = -1;
- t->selected.start_c = -1;
- t->selected.end_r = -1;
- t->selected.end_c = -1;
- t->homogeneous_h = FALSE;
- t->homogeneous_v = FALSE;
-
- /*
- * Append callbacks
- */
- ewl_callback_append(EWL_WIDGET(t), EWL_CALLBACK_CONFIGURE,
- ewl_table_cb_configure, NULL);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ Ewl_Widget *button;
+ Ewl_Cell *cell;
+ int i;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, FALSE);
+
+ /*
+ * Iniitialize the tables inherited fields
+ */
+ if (!ewl_container_init(EWL_CONTAINER(t))) {
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+ ewl_widget_appearance_set(EWL_WIDGET(t), EWL_TABLE_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(t), EWL_TABLE_TYPE);
+ ewl_object_fill_policy_set(EWL_OBJECT(t), EWL_FLAG_FILL_FILL);
+
+ ewl_container_show_notify_set(EWL_CONTAINER(t), ewl_table_cb_child_show);
+
+ /*
+ * Create a new grid
+ */
+ t->grid = (Ewl_Grid *)ewl_grid_new();
+ if (col_headers)
+ ewl_grid_dimensions_set(t->grid, cols, rows + 1);
+ else
+ ewl_grid_dimensions_set(t->grid, cols, rows);
+ ewl_container_child_append(EWL_CONTAINER(t), EWL_WIDGET(t->grid));
+ ewl_widget_show(EWL_WIDGET(t->grid));
+
+ /*
+ * Add the column headers to the grid
+ */
+ if (col_headers != NULL) {
+
+ for (i = 1; i <= cols; i++) {
+ cell = (Ewl_Cell *) ewl_cell_new();
+ button = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button), col_headers[i - 1]);
+ ewl_widget_disable(button);
+ ewl_container_child_append(EWL_CONTAINER(cell), button);
+ ewl_object_fill_policy_set(EWL_OBJECT(cell),
+ EWL_FLAG_FILL_VSHRINK | EWL_FLAG_FILL_HFILL);
+ ewl_container_child_append(EWL_CONTAINER(t->grid),
+ EWL_WIDGET(cell));
+ ewl_grid_child_position_set(t->grid, EWL_WIDGET(cell),
+ i, i, 1, 1);
+ ewl_widget_show(EWL_WIDGET(button));
+ ewl_widget_show(EWL_WIDGET(cell));
+ }
+
+ t->col_headers = col_headers;
+ }
+
+ t->row_select = 0;
+
+ t->selected.start_r = -1;
+ t->selected.start_c = -1;
+ t->selected.end_r = -1;
+ t->selected.end_c = -1;
+ t->homogeneous_h = FALSE;
+ t->homogeneous_v = FALSE;
+
+ /*
+ * Append callbacks
+ */
+ ewl_callback_append(EWL_WIDGET(t), EWL_CALLBACK_CONFIGURE,
+ ewl_table_cb_configure, NULL);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -131,34 +131,34 @@ ewl_table_init(Ewl_Table *t, int cols, int rows, char **col_headers)
*/
void
ewl_table_add(Ewl_Table *table, Ewl_Widget *w,
- int start_col, int end_col, int start_row, int end_row)
+ int start_col, int end_col, int start_row, int end_row)
{
- Ewl_Cell *cell;
+ Ewl_Cell *cell;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(table);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(table, EWL_TABLE_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(table);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(table, EWL_TABLE_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- cell = (Ewl_Cell *)ewl_cell_new ();
- ewl_container_child_append(EWL_CONTAINER (cell), w);
+ cell = (Ewl_Cell *)ewl_cell_new ();
+ ewl_container_child_append(EWL_CONTAINER (cell), w);
- ewl_container_child_append(EWL_CONTAINER(table->grid),
- EWL_WIDGET(cell));
- if (table->col_headers)
- ewl_grid_child_position_set(table->grid, EWL_WIDGET(cell),
- start_col, end_col, start_row + 1, end_row + 1);
- else
- ewl_grid_child_position_set(table->grid, EWL_WIDGET(cell),
- start_col, end_col, start_row, end_row);
+ ewl_container_child_append(EWL_CONTAINER(table->grid),
+ EWL_WIDGET(cell));
+ if (table->col_headers)
+ ewl_grid_child_position_set(table->grid, EWL_WIDGET(cell),
+ start_col, end_col, start_row + 1, end_row + 1);
+ else
+ ewl_grid_child_position_set(table->grid, EWL_WIDGET(cell),
+ start_col, end_col, start_row, end_row);
- ewl_callback_prepend(EWL_WIDGET(cell), EWL_CALLBACK_MOUSE_UP,
- ewl_table_cb_child_select, table);
+ ewl_callback_prepend(EWL_WIDGET(cell), EWL_CALLBACK_MOUSE_UP,
+ ewl_table_cb_child_select, table);
- ewl_widget_show(EWL_WIDGET(cell));
+ ewl_widget_show(EWL_WIDGET(cell));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -173,47 +173,47 @@ ewl_table_add(Ewl_Table *table, Ewl_Widget *w,
*/
void
ewl_table_col_row_get(Ewl_Table *t, Ewl_Cell *cell,
- int *start_col, int *end_col, int *start_row,
- int *end_row)
+ int *start_col, int *end_col, int *start_row,
+ int *end_row)
{
- /*---------------------------------
- * DEVELOPER NOTE:
- * This method is supposed to search the grid for the specified
- * widget and store it's column/row specs in the col/row
- * parameters and I think that is in fact what it does now. It
- * is not tested.
- *---------------------------------*/
-
- Ewl_Widget *child;
- Ewl_Grid_Child *g_child;
- Ecore_List *children;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_PARAM_PTR(cell);
- DCHECK_TYPE(t, EWL_TABLE_TYPE);
- DCHECK_TYPE(cell, EWL_CELL_TYPE);
-
- children = EWL_CONTAINER(t->grid)->children;
-
- ecore_dlist_first_goto(children);
- while ((child = ecore_dlist_next(children)) != NULL)
- {
- if (child == EWL_WIDGET(cell)) {
- g_child = (Ewl_Grid_Child *) ewl_widget_data_get(child,
- (void *) t->grid);
-
- if (start_col) *start_col = g_child->start_col;
- if (end_col) *end_col = g_child->end_col;
- if (start_row) *start_row = g_child->start_row;
- if (end_row) *end_row = g_child->end_row;
-
- break;
- }
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ /*---------------------------------
+ * DEVELOPER NOTE:
+ * This method is supposed to search the grid for the specified
+ * widget and store it's column/row specs in the col/row
+ * parameters and I think that is in fact what it does now. It
+ * is not tested.
+ *---------------------------------*/
+
+ Ewl_Widget *child;
+ Ewl_Grid_Child *g_child;
+ Ecore_List *children;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_PARAM_PTR(cell);
+ DCHECK_TYPE(t, EWL_TABLE_TYPE);
+ DCHECK_TYPE(cell, EWL_CELL_TYPE);
+
+ children = EWL_CONTAINER(t->grid)->children;
+
+ ecore_dlist_first_goto(children);
+ while ((child = ecore_dlist_next(children)) != NULL)
+ {
+ if (child == EWL_WIDGET(cell)) {
+ g_child = (Ewl_Grid_Child *) ewl_widget_data_get(child,
+ (void *) t->grid);
+
+ if (start_col) *start_col = g_child->start_col;
+ if (end_col) *end_col = g_child->end_col;
+ if (start_row) *start_row = g_child->start_row;
+ if (end_row) *end_row = g_child->end_row;
+
+ break;
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -227,41 +227,41 @@ ewl_table_col_row_get(Ewl_Table *t, Ewl_Cell *cell,
*/
Ecore_List *
ewl_table_find(Ewl_Table *t, int start_col, int end_col,
- int start_row, int end_row)
+ int start_row, int end_row)
{
- /*---------------------------------
- * DEVELOPER NOTE:
- * This is supposed to search for any widgets that can be found
- * inside an area bounded by the col/row parameters and return a
- * list of all those widgets
- *
- * And now it does so (UNTESTED)
- *---------------------------------*/
-
- Ewl_Grid_Child *gc;
- Ewl_Widget *child;
- Ecore_List *children;
- Ecore_List *list;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, NULL);
- DCHECK_TYPE_RET(t, EWL_TABLE_TYPE, NULL);
-
- list = ecore_list_new();
- children = EWL_CONTAINER(t->grid)->children;
-
- ecore_dlist_first_goto(children);
- while ((child = ecore_dlist_next(children)) != NULL) {
- gc = (Ewl_Grid_Child *) ewl_widget_data_get(child,
- (void *) t->grid);
-
- if (start_col >= gc->start_col && end_col <= gc->end_col &&
- start_row >= gc->start_row && end_row <= gc->end_row) {
- ecore_list_append(list, child);
- }
- }
-
- DRETURN_PTR(list, DLEVEL_STABLE);
+ /*---------------------------------
+ * DEVELOPER NOTE:
+ * This is supposed to search for any widgets that can be found
+ * inside an area bounded by the col/row parameters and return a
+ * list of all those widgets
+ *
+ * And now it does so (UNTESTED)
+ *---------------------------------*/
+
+ Ewl_Grid_Child *gc;
+ Ewl_Widget *child;
+ Ecore_List *children;
+ Ecore_List *list;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, NULL);
+ DCHECK_TYPE_RET(t, EWL_TABLE_TYPE, NULL);
+
+ list = ecore_list_new();
+ children = EWL_CONTAINER(t->grid)->children;
+
+ ecore_dlist_first_goto(children);
+ while ((child = ecore_dlist_next(children)) != NULL) {
+ gc = (Ewl_Grid_Child *) ewl_widget_data_get(child,
+ (void *) t->grid);
+
+ if (start_col >= gc->start_col && end_col <= gc->end_col &&
+ start_row >= gc->start_row && end_row <= gc->end_row) {
+ ecore_list_append(list, child);
+ }
+ }
+
+ DRETURN_PTR(list, DLEVEL_STABLE);
}
/**
@@ -274,14 +274,14 @@ ewl_table_find(Ewl_Table *t, int start_col, int end_col,
void
ewl_table_column_w_set(Ewl_Table *table, int col, int width)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(table);
- DCHECK_TYPE(table, EWL_TABLE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(table);
+ DCHECK_TYPE(table, EWL_TABLE_TYPE);
- ewl_grid_column_fixed_w_set(table->grid, col, width);
- ewl_widget_configure(EWL_WIDGET(table));
+ ewl_grid_column_fixed_w_set(table->grid, col, width);
+ ewl_widget_configure(EWL_WIDGET(table));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -294,13 +294,13 @@ ewl_table_column_w_set(Ewl_Table *table, int col, int width)
void
ewl_table_column_w_get(Ewl_Table *table, int col, int *width)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(table);
- DCHECK_TYPE(table, EWL_TABLE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(table);
+ DCHECK_TYPE(table, EWL_TABLE_TYPE);
- if (width) *width = ewl_grid_column_fixed_w_get(table->grid, col);
+ if (width) *width = ewl_grid_column_fixed_w_get(table->grid, col);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -313,15 +313,15 @@ ewl_table_column_w_get(Ewl_Table *table, int col, int *width)
void
ewl_table_row_h_set(Ewl_Table *table, int row, int height)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(table);
- DCHECK_TYPE(table, EWL_TABLE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(table);
+ DCHECK_TYPE(table, EWL_TABLE_TYPE);
- ewl_grid_row_fixed_h_set(table->grid, row, height);
+ ewl_grid_row_fixed_h_set(table->grid, row, height);
- ewl_widget_configure(EWL_WIDGET(table));
+ ewl_widget_configure(EWL_WIDGET(table));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -334,13 +334,13 @@ ewl_table_row_h_set(Ewl_Table *table, int row, int height)
void
ewl_table_row_h_get(Ewl_Table *table, int row, int *height)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(table);
- DCHECK_TYPE(table, EWL_TABLE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(table);
+ DCHECK_TYPE(table, EWL_TABLE_TYPE);
- if (height) *height = ewl_grid_row_fixed_h_get(table->grid, row);
+ if (height) *height = ewl_grid_row_fixed_h_get(table->grid, row);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -354,42 +354,42 @@ ewl_table_row_h_get(Ewl_Table *table, int row, int *height)
void
ewl_table_reset(Ewl_Table *t, int cols, int rows, char **col_headers)
{
- Ewl_Widget *button;
- Ewl_Cell *cell;
- int i;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TABLE_TYPE);
-
- ewl_container_reset(EWL_CONTAINER(t->grid));
- if (col_headers != NULL)
- ewl_grid_dimensions_set(EWL_GRID(t->grid), cols, rows+1);
- else
- ewl_grid_dimensions_set(EWL_GRID(t->grid), cols, rows);
-
- if (col_headers != NULL) {
-
- for (i = 1; i <= cols; i++) {
- cell = (Ewl_Cell *) ewl_cell_new();
- button = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button), col_headers[i - 1]);
- ewl_widget_disable(button);
- ewl_container_child_append(EWL_CONTAINER(cell), button);
- ewl_container_child_append(EWL_CONTAINER(t->grid),
- EWL_WIDGET(cell));
- ewl_grid_child_position_set(t->grid, EWL_WIDGET(cell),
- i, i, 1, 1);
- ewl_widget_show(button);
- ewl_widget_show(EWL_WIDGET(cell));
- }
-
- t->col_headers = col_headers;
- }
-
- ewl_widget_configure(EWL_WIDGET(t));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Widget *button;
+ Ewl_Cell *cell;
+ int i;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TABLE_TYPE);
+
+ ewl_container_reset(EWL_CONTAINER(t->grid));
+ if (col_headers != NULL)
+ ewl_grid_dimensions_set(EWL_GRID(t->grid), cols, rows+1);
+ else
+ ewl_grid_dimensions_set(EWL_GRID(t->grid), cols, rows);
+
+ if (col_headers != NULL) {
+
+ for (i = 1; i <= cols; i++) {
+ cell = (Ewl_Cell *) ewl_cell_new();
+ button = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button), col_headers[i - 1]);
+ ewl_widget_disable(button);
+ ewl_container_child_append(EWL_CONTAINER(cell), button);
+ ewl_container_child_append(EWL_CONTAINER(t->grid),
+ EWL_WIDGET(cell));
+ ewl_grid_child_position_set(t->grid, EWL_WIDGET(cell),
+ i, i, 1, 1);
+ ewl_widget_show(button);
+ ewl_widget_show(EWL_WIDGET(cell));
+ }
+
+ t->col_headers = col_headers;
+ }
+
+ ewl_widget_configure(EWL_WIDGET(t));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -400,34 +400,34 @@ ewl_table_reset(Ewl_Table *t, int cols, int rows, char **col_headers)
char *
ewl_table_selected_get(Ewl_Table *t)
{
- Ewl_Text *tw;
- Ewl_Widget *child;
- Ecore_List *children;
- Ewl_Grid_Child *gc;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, strdup(""));
- DCHECK_TYPE_RET(t, EWL_TABLE_TYPE, strdup(""));
-
- children = EWL_CONTAINER(t->grid)->children;
- ecore_dlist_first_goto(children);
- while ((child = ecore_dlist_next(children)) != NULL) {
- gc = (Ewl_Grid_Child *) ewl_widget_data_get(child,
- (void *) t->grid);
-
- if (t->selected.start_c == gc->start_col &&
- t->selected.start_r == gc->start_row &&
- t->selected.end_c == gc->end_col &&
- t->selected.end_r == gc->end_row) {
-
- tw = (Ewl_Text *) ecore_dlist_first_goto(
- EWL_CONTAINER(child)->children);
-
- DRETURN_PTR(ewl_text_text_get(tw), DLEVEL_STABLE);
- }
- }
-
- DRETURN_PTR(strdup(""), DLEVEL_STABLE);
+ Ewl_Text *tw;
+ Ewl_Widget *child;
+ Ecore_List *children;
+ Ewl_Grid_Child *gc;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, strdup(""));
+ DCHECK_TYPE_RET(t, EWL_TABLE_TYPE, strdup(""));
+
+ children = EWL_CONTAINER(t->grid)->children;
+ ecore_dlist_first_goto(children);
+ while ((child = ecore_dlist_next(children)) != NULL) {
+ gc = (Ewl_Grid_Child *) ewl_widget_data_get(child,
+ (void *) t->grid);
+
+ if (t->selected.start_c == gc->start_col &&
+ t->selected.start_r == gc->start_row &&
+ t->selected.end_c == gc->end_col &&
+ t->selected.end_r == gc->end_row) {
+
+ tw = (Ewl_Text *) ecore_dlist_first_goto(
+ EWL_CONTAINER(child)->children);
+
+ DRETURN_PTR(ewl_text_text_get(tw), DLEVEL_STABLE);
+ }
+ }
+
+ DRETURN_PTR(strdup(""), DLEVEL_STABLE);
}
/**
@@ -440,26 +440,26 @@ ewl_table_selected_get(Ewl_Table *t)
*/
void
ewl_table_cb_child_select(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data)
+ void *user_data)
{
- Ewl_Table *t;
- Ewl_Grid_Child *gc;
+ Ewl_Table *t;
+ Ewl_Grid_Child *gc;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(user_data);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- DCHECK_TYPE(user_data, EWL_TABLE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(user_data);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DCHECK_TYPE(user_data, EWL_TABLE_TYPE);
- t = EWL_TABLE(user_data);
- gc = (Ewl_Grid_Child *) ewl_widget_data_get(w, (void *) t->grid);
+ t = EWL_TABLE(user_data);
+ gc = (Ewl_Grid_Child *) ewl_widget_data_get(w, (void *) t->grid);
- t->selected.start_r = gc->start_row;
- t->selected.start_c = gc->start_col;
- t->selected.end_r = gc->end_row;
- t->selected.end_c = gc->end_col;
+ t->selected.start_r = gc->start_row;
+ t->selected.start_c = gc->start_col;
+ t->selected.end_r = gc->end_row;
+ t->selected.end_c = gc->end_col;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -472,31 +472,31 @@ ewl_table_cb_child_select(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_table_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- /*---------------------------------
- * DEVELOPER NOTE:
- * Right now all this method does is making sure the grid take
- * up the space it can. (i.e. the same space as the table
- * itself). That's it's only purpose I can think of now.
- *---------------------------------*/
+ /*---------------------------------
+ * DEVELOPER NOTE:
+ * Right now all this method does is making sure the grid take
+ * up the space it can. (i.e. the same space as the table
+ * itself). That's it's only purpose I can think of now.
+ *---------------------------------*/
- Ewl_Table *table;
+ Ewl_Table *table;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_TABLE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_TABLE_TYPE);
- table = EWL_TABLE(w);
+ table = EWL_TABLE(w);
- ewl_object_geometry_request(EWL_OBJECT(table->grid),
- CURRENT_X(w), CURRENT_Y(w),
- CURRENT_W(w) - INSET_LEFT(w) +
- INSET_RIGHT(w),
- CURRENT_H(w) - INSET_TOP(w) +
- INSET_BOTTOM(w));
+ ewl_object_geometry_request(EWL_OBJECT(table->grid),
+ CURRENT_X(w), CURRENT_Y(w),
+ CURRENT_W(w) - INSET_LEFT(w) +
+ INSET_RIGHT(w),
+ CURRENT_H(w) - INSET_TOP(w) +
+ INSET_BOTTOM(w));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -509,19 +509,19 @@ ewl_table_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
void
ewl_table_cb_child_show(Ewl_Container *p, Ewl_Widget *c __UNUSED__)
{
- Ewl_Table *table;
- int width_g, height_g;
+ Ewl_Table *table;
+ int width_g, height_g;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(p);
- DCHECK_TYPE(p, EWL_CONTAINER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(p);
+ DCHECK_TYPE(p, EWL_CONTAINER_TYPE);
- table = EWL_TABLE (p);
- ewl_object_preferred_inner_size_get (EWL_OBJECT (table->grid),
- &width_g, &height_g);
- ewl_object_preferred_inner_size_set (EWL_OBJECT (table), width_g, height_g);
+ table = EWL_TABLE (p);
+ ewl_object_preferred_inner_size_get (EWL_OBJECT (table->grid),
+ &width_g, &height_g);
+ ewl_object_preferred_inner_size_set (EWL_OBJECT (table), width_g, height_g);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -536,16 +536,16 @@ ewl_table_cb_child_show(Ewl_Container *p, Ewl_Widget *c __UNUSED__)
void
ewl_table_homogeneous_set(Ewl_Table *table, unsigned int h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(table);
- DCHECK_TYPE(table, EWL_TABLE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(table);
+ DCHECK_TYPE(table, EWL_TABLE_TYPE);
- if (table->homogeneous_h != h)
- ewl_table_hhomogeneous_set(table, h);
- if (table->homogeneous_v != h)
- ewl_table_vhomogeneous_set(table, h);
+ if (table->homogeneous_h != h)
+ ewl_table_hhomogeneous_set(table, h);
+ if (table->homogeneous_v != h)
+ ewl_table_vhomogeneous_set(table, h);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -561,17 +561,17 @@ ewl_table_homogeneous_set(Ewl_Table *table, unsigned int h)
void
ewl_table_hhomogeneous_set(Ewl_Table *table, unsigned int h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(table);
- DCHECK_TYPE(table, EWL_TABLE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(table);
+ DCHECK_TYPE(table, EWL_TABLE_TYPE);
- if (table->homogeneous_h != h)
- {
- table->homogeneous_h = h;
- ewl_grid_hhomogeneous_set (EWL_GRID (table->grid), h );
- }
+ if (table->homogeneous_h != h)
+ {
+ table->homogeneous_h = h;
+ ewl_grid_hhomogeneous_set (EWL_GRID (table->grid), h );
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -587,17 +587,17 @@ ewl_table_hhomogeneous_set(Ewl_Table *table, unsigned int h)
void
ewl_table_vhomogeneous_set(Ewl_Table *table, unsigned int h)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(table);
- DCHECK_TYPE(table, EWL_TABLE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(table);
+ DCHECK_TYPE(table, EWL_TABLE_TYPE);
- if (table->homogeneous_v != h)
- {
- table->homogeneous_v = h;
- ewl_grid_vhomogeneous_set (EWL_GRID (table->grid), h );
- }
+ if (table->homogeneous_v != h)
+ {
+ table->homogeneous_v = h;
+ ewl_grid_vhomogeneous_set (EWL_GRID (table->grid), h );
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -608,11 +608,11 @@ ewl_table_vhomogeneous_set(Ewl_Table *table, unsigned int h)
unsigned int
ewl_table_hhomogeneous_get(Ewl_Table *table)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(table, 0);
- DCHECK_TYPE_RET(table, EWL_TABLE_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(table, 0);
+ DCHECK_TYPE_RET(table, EWL_TABLE_TYPE, 0);
- DRETURN_INT(table->homogeneous_h, DLEVEL_STABLE);
+ DRETURN_INT(table->homogeneous_h, DLEVEL_STABLE);
}
/**
@@ -623,10 +623,10 @@ ewl_table_hhomogeneous_get(Ewl_Table *table)
unsigned int
ewl_table_vhomogeneous_get(Ewl_Table *table)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(table, 0);
- DCHECK_TYPE_RET(table, EWL_TABLE_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(table, 0);
+ DCHECK_TYPE_RET(table, EWL_TABLE_TYPE, 0);
- DRETURN_INT(table->homogeneous_v, DLEVEL_STABLE);
+ DRETURN_INT(table->homogeneous_v, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_table.h b/src/lib/ewl_table.h
index 236135e..3f9789b 100644
--- a/src/lib/ewl_table.h
+++ b/src/lib/ewl_table.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_TABLE_H
#define EWL_TABLE_H
@@ -52,50 +52,50 @@ typedef struct Ewl_Table Ewl_Table;
*/
struct Ewl_Table
{
- Ewl_Container container; /**< Inherit from Ewl_Container */
- Ewl_Grid *grid; /**< Table uses a grid based layout */
+ Ewl_Container container; /**< Inherit from Ewl_Container */
+ Ewl_Grid *grid; /**< Table uses a grid based layout */
- char **col_headers; /**< The column headers */
- int row_select; /**< boolean: select entire rows */
+ char **col_headers; /**< The column headers */
+ int row_select; /**< boolean: select entire rows */
- unsigned int homogeneous_h; /**< Horizontal homogeneous flag */
- unsigned int homogeneous_v; /**< Vertical homogeneous flag */
+ unsigned int homogeneous_h; /**< Horizontal homogeneous flag */
+ unsigned int homogeneous_v; /**< Vertical homogeneous flag */
- struct {
- int start_r; /**< Selection start row */
- int start_c; /**< Selection start column */
- int end_r; /**< Selection end row */
- int end_c; /**< Selection end column */
- } selected; /**< Currently selected rows */
+ struct {
+ int start_r; /**< Selection start row */
+ int start_c; /**< Selection start column */
+ int end_r; /**< Selection end row */
+ int end_c; /**< Selection end column */
+ } selected; /**< Currently selected rows */
};
-Ewl_Widget *ewl_table_new(int cols, int rows, char **col_headers);
-int ewl_table_init(Ewl_Table *t, int cols, int rows,
- char **col_headers);
+Ewl_Widget *ewl_table_new(int cols, int rows, char **col_headers);
+int ewl_table_init(Ewl_Table *t, int cols, int rows,
+ char **col_headers);
-void ewl_table_add(Ewl_Table *table, Ewl_Widget *w, int start_col,
- int end_col, int start_row, int end_row);
-void ewl_table_reset(Ewl_Table *t, int cols, int rows,
- char **c_headers);
+void ewl_table_add(Ewl_Table *table, Ewl_Widget *w, int start_col,
+ int end_col, int start_row, int end_row);
+void ewl_table_reset(Ewl_Table *t, int cols, int rows,
+ char **c_headers);
-void ewl_table_column_w_set(Ewl_Table *table, int col, int width);
-void ewl_table_row_h_set(Ewl_Table *table, int row, int height);
+void ewl_table_column_w_set(Ewl_Table *table, int col, int width);
+void ewl_table_row_h_set(Ewl_Table *table, int row, int height);
-void ewl_table_column_w_get(Ewl_Table *table, int col, int *width);
-void ewl_table_row_h_get(Ewl_Table *table, int row, int *height);
+void ewl_table_column_w_get(Ewl_Table *table, int col, int *width);
+void ewl_table_row_h_get(Ewl_Table *table, int row, int *height);
-void ewl_table_col_row_get(Ewl_Table *table, Ewl_Cell *cell,
- int *start_col, int *end_col,
- int *start_row, int *end_row);
+void ewl_table_col_row_get(Ewl_Table *table, Ewl_Cell *cell,
+ int *start_col, int *end_col,
+ int *start_row, int *end_row);
-Ecore_List *ewl_table_find(Ewl_Table *table, int start_col,
- int end_col, int start_row, int emd_row);
+Ecore_List *ewl_table_find(Ewl_Table *table, int start_col,
+ int end_col, int start_row, int emd_row);
-char *ewl_table_selected_get(Ewl_Table *table);
-void ewl_table_homogeneous_set(Ewl_Table *table, unsigned int h);
-void ewl_table_hhomogeneous_set(Ewl_Table *table, unsigned int h);
-void ewl_table_vhomogeneous_set(Ewl_Table *table, unsigned int h);
+char *ewl_table_selected_get(Ewl_Table *table);
+void ewl_table_homogeneous_set(Ewl_Table *table, unsigned int h);
+void ewl_table_hhomogeneous_set(Ewl_Table *table, unsigned int h);
+void ewl_table_vhomogeneous_set(Ewl_Table *table, unsigned int h);
unsigned int ewl_table_hhomogeneous_get(Ewl_Table *table);
unsigned int ewl_table_vhomogeneous_get(Ewl_Table *table);
diff --git a/src/lib/ewl_text.c b/src/lib/ewl_text.c
index 7ea779a..213789e 100644
--- a/src/lib/ewl_text.c
+++ b/src/lib/ewl_text.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_text.h"
#include "ewl_text_context.h"
@@ -17,43 +17,43 @@ static Ewl_Text_Context *ewl_text_default_context = NULL;
static const char ewl_text_trailing_bytes[32] =
{
- 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1,
- 1,1,1,1, 1,1,1,1, 2,2,2,2, 3,3,4,6
+ 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1,
+ 1,1,1,1, 1,1,1,1, 2,2,2,2, 3,3,4,6
};
/* returns length of the next utf-8 sequence */
#define EWL_TEXT_CHAR_BYTE_LEN(s) \
- (ewl_text_trailing_bytes[((unsigned char)((s)[0])) >> 3])
+ (ewl_text_trailing_bytes[((unsigned char)((s)[0])) >> 3])
static void ewl_text_current_fmt_set(Ewl_Text *t, unsigned int context_mask,
- Ewl_Text_Context *change);
+ Ewl_Text_Context *change);
static void ewl_text_text_insert_private(Ewl_Text *t, const char *txt,
- unsigned int char_idx, unsigned int *char_len,
- unsigned int *byte_len);
+ unsigned int char_idx, unsigned int *char_len,
+ unsigned int *byte_len);
static int ewl_text_char_utf8_is(const char *c);
static void ewl_text_size(Ewl_Text *t);
static void ewl_text_display(Ewl_Text *t);
static void ewl_text_cb_format(Ewl_Text_Fmt_Node *node, Ewl_Text *t,
- unsigned int byte_idx);
+ unsigned int byte_idx);
static void ewl_text_plaintext_parse(Evas_Object *tb, char *txt);
static Evas_Textblock_Cursor *ewl_text_textblock_cursor_position(Ewl_Text *t,
- unsigned int char_idx);
+ unsigned int char_idx);
static unsigned int ewl_text_textblock_cursor_to_index(
- Evas_Textblock_Cursor *cursor);
+ Evas_Textblock_Cursor *cursor);
static void ewl_text_triggers_remove(Ewl_Text *t);
static void ewl_text_triggers_shift(Ewl_Text *t, unsigned int char_pos,
- unsigned int char_len, unsigned int del);
+ unsigned int char_len, unsigned int del);
static void ewl_text_trigger_position(Ewl_Text *t, Ewl_Text_Trigger *trig);
static void ewl_text_trigger_add(Ewl_Text *t, Ewl_Text_Trigger *trigger);
static Ewl_Widget *ewl_text_selection_new(Ewl_Text *t);
static void ewl_text_selection_select_to(Ewl_Text_Trigger *s,
- unsigned int char_idx);
+ unsigned int char_idx);
static void ewl_text_theme_color_get(Ewl_Text *t, Ewl_Color_Set *color, char *name);
static Ewl_Text_Context *ewl_text_context_default_create(Ewl_Text *t);
@@ -72,20 +72,20 @@ static unsigned int ewl_text_char_to_drawn_byte(Ewl_Text *t, unsigned int char_
Ewl_Widget *
ewl_text_new(void)
{
- Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ Ewl_Widget *w;
+ DENTER_FUNCTION(DLEVEL_STABLE);
- w = NEW(Ewl_Text, 1);
- if (!w)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ w = NEW(Ewl_Text, 1);
+ if (!w)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_text_init(EWL_TEXT(w)))
- {
- ewl_widget_destroy(w);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ewl_text_init(EWL_TEXT(w)))
+ {
+ ewl_widget_destroy(w);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
/**
@@ -96,50 +96,50 @@ ewl_text_new(void)
int
ewl_text_init(Ewl_Text *t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, FALSE);
-
- if (!ewl_container_init(EWL_CONTAINER(t)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- ewl_widget_appearance_set(EWL_WIDGET(t), EWL_TEXT_TYPE);
- ewl_widget_inherit(EWL_WIDGET(t), EWL_TEXT_TYPE);
-
- ewl_object_fill_policy_set(EWL_OBJECT(t), EWL_FLAG_FILL_HFILL
- | EWL_FLAG_FILL_VFILL);
-
- t->formatting.nodes = ewl_text_fmt_new(t);
- if (!t->formatting.nodes)
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- t->formatting.tx = ewl_text_context_default_create(t);
- ewl_text_context_acquire(t->formatting.tx);
-
- ewl_callback_append(EWL_WIDGET(t), EWL_CALLBACK_CONFIGURE,
- ewl_text_cb_configure, NULL);
- ewl_callback_append(EWL_WIDGET(t), EWL_CALLBACK_REVEAL,
- ewl_text_cb_reveal, NULL);
- ewl_callback_append(EWL_WIDGET(t), EWL_CALLBACK_OBSCURE,
- ewl_text_cb_obscure, NULL);
- ewl_callback_append(EWL_WIDGET(t), EWL_CALLBACK_SHOW,
- ewl_text_cb_show, NULL);
- ewl_callback_append(EWL_WIDGET(t), EWL_CALLBACK_HIDE,
- ewl_text_cb_hide, NULL);
- ewl_callback_prepend(EWL_WIDGET(t), EWL_CALLBACK_DESTROY,
- ewl_text_cb_destroy, NULL);
-
- ewl_container_add_notify_set(EWL_CONTAINER(t),
- ewl_text_cb_child_add);
- ewl_container_remove_notify_set(EWL_CONTAINER(t),
- ewl_text_cb_child_remove);
-
- t->dirty = TRUE;
-
- /* text consumes tabs by default */
-// ewl_widget_ignore_focus_change_set(EWL_WIDGET(t), TRUE);
- ewl_widget_focusable_set(EWL_WIDGET(t), FALSE);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, FALSE);
+
+ if (!ewl_container_init(EWL_CONTAINER(t)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ ewl_widget_appearance_set(EWL_WIDGET(t), EWL_TEXT_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(t), EWL_TEXT_TYPE);
+
+ ewl_object_fill_policy_set(EWL_OBJECT(t), EWL_FLAG_FILL_HFILL
+ | EWL_FLAG_FILL_VFILL);
+
+ t->formatting.nodes = ewl_text_fmt_new(t);
+ if (!t->formatting.nodes)
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ t->formatting.tx = ewl_text_context_default_create(t);
+ ewl_text_context_acquire(t->formatting.tx);
+
+ ewl_callback_append(EWL_WIDGET(t), EWL_CALLBACK_CONFIGURE,
+ ewl_text_cb_configure, NULL);
+ ewl_callback_append(EWL_WIDGET(t), EWL_CALLBACK_REVEAL,
+ ewl_text_cb_reveal, NULL);
+ ewl_callback_append(EWL_WIDGET(t), EWL_CALLBACK_OBSCURE,
+ ewl_text_cb_obscure, NULL);
+ ewl_callback_append(EWL_WIDGET(t), EWL_CALLBACK_SHOW,
+ ewl_text_cb_show, NULL);
+ ewl_callback_append(EWL_WIDGET(t), EWL_CALLBACK_HIDE,
+ ewl_text_cb_hide, NULL);
+ ewl_callback_prepend(EWL_WIDGET(t), EWL_CALLBACK_DESTROY,
+ ewl_text_cb_destroy, NULL);
+
+ ewl_container_add_notify_set(EWL_CONTAINER(t),
+ ewl_text_cb_child_add);
+ ewl_container_remove_notify_set(EWL_CONTAINER(t),
+ ewl_text_cb_child_remove);
+
+ t->dirty = TRUE;
+
+ /* text consumes tabs by default */
+// ewl_widget_ignore_focus_change_set(EWL_WIDGET(t), TRUE);
+ ewl_widget_focusable_set(EWL_WIDGET(t), FALSE);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -150,11 +150,11 @@ ewl_text_init(Ewl_Text *t)
unsigned int
ewl_text_length_get(Ewl_Text *t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, 0);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, 0);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, 0);
- DRETURN_INT(t->length.chars, DLEVEL_STABLE);
+ DRETURN_INT(t->length.chars, DLEVEL_STABLE);
}
/**
@@ -171,25 +171,25 @@ ewl_text_length_get(Ewl_Text *t)
void
ewl_text_length_maximum_set(Ewl_Text *t, unsigned int char_num)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- if (t->length.max_chars == char_num)
- DRETURN(DLEVEL_STABLE);
+ if (t->length.max_chars == char_num)
+ DRETURN(DLEVEL_STABLE);
- t->length.max_chars = char_num;
- if ((char_num > 0) && (char_num < t->length.max_chars))
- {
- unsigned int tmp_pos;
+ t->length.max_chars = char_num;
+ if ((char_num > 0) && (char_num < t->length.max_chars))
+ {
+ unsigned int tmp_pos;
- tmp_pos = ewl_text_cursor_position_get(t);
- ewl_text_cursor_position_set(t, char_num);
- ewl_text_text_delete(t, ewl_text_length_get(t) - char_num);
- ewl_text_cursor_position_set(t, MIN(char_num, tmp_pos));
- }
+ tmp_pos = ewl_text_cursor_position_get(t);
+ ewl_text_cursor_position_set(t, char_num);
+ ewl_text_text_delete(t, ewl_text_length_get(t) - char_num);
+ ewl_text_cursor_position_set(t, MIN(char_num, tmp_pos));
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -201,11 +201,11 @@ ewl_text_length_maximum_set(Ewl_Text *t, unsigned int char_num)
unsigned int
ewl_text_length_maximum_get(Ewl_Text *t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, 0);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, 0);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, 0);
- DRETURN_INT(t->length.max_chars, DLEVEL_STABLE);
+ DRETURN_INT(t->length.max_chars, DLEVEL_STABLE);
}
/**
@@ -218,14 +218,14 @@ ewl_text_length_maximum_get(Ewl_Text *t)
void
ewl_text_offsets_get(Ewl_Text *t, int *x, int *y)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- if (x) *x = t->offset.x;
- if (y) *y = t->offset.y;
+ if (x) *x = t->offset.x;
+ if (y) *y = t->offset.y;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -238,16 +238,16 @@ ewl_text_offsets_get(Ewl_Text *t, int *x, int *y)
void
ewl_text_offsets_set(Ewl_Text *t, int x, int y)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- t->offset.x = x;
- t->offset.y = y;
+ t->offset.x = x;
+ t->offset.y = y;
- ewl_widget_configure(EWL_WIDGET(t));
+ ewl_widget_configure(EWL_WIDGET(t));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -261,54 +261,54 @@ ewl_text_offsets_set(Ewl_Text *t, int x, int y)
*/
void
ewl_text_index_geometry_map(Ewl_Text *t, unsigned int char_idx,
- int *x, int *y,
- int *w, int *h)
+ int *x, int *y,
+ int *w, int *h)
{
- Evas_Coord tx = 0, ty = 0, tw = 0, th = 0;
- Evas_Textblock_Cursor *cursor;
- int shifting = 0;
- unsigned int byte_idx = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
-
- /* can't do this if we don't have an evas object */
- if ((!REALIZED(t)) || (!t->textblock) || (!t->text))
- {
- if (x) *x = 0;
- if (y) *y = 0;
- if (w) *w = 1;
- if (h) *h = ewl_theme_data_int_get(EWL_WIDGET(t), "font_size");
-
- DRETURN(DLEVEL_STABLE);
- }
-
- /* force a display of the text */
- if (t->dirty) ewl_text_display(t);
-
- if (char_idx >= t->length.chars)
- {
- char_idx --;
- shifting = 1;
- }
-
- byte_idx = ewl_text_char_to_drawn_byte(t, char_idx);
-
- cursor = ewl_text_textblock_cursor_position(t, byte_idx);
- evas_textblock_cursor_char_geometry_get(cursor, &tx, &ty, &tw, &th);
- evas_textblock_cursor_free(cursor);
-
- if (x) *x = (int)(tx + CURRENT_X(t));
- if (y) *y = (int)(ty + CURRENT_Y(t));
- if (w) *w = (int)tw;
- if (h) *h = (int)th;
-
- /* if we didn't count the last item, move us over to the other side
- * of it */
- if (shifting) *x += *w;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Evas_Coord tx = 0, ty = 0, tw = 0, th = 0;
+ Evas_Textblock_Cursor *cursor;
+ int shifting = 0;
+ unsigned int byte_idx = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
+
+ /* can't do this if we don't have an evas object */
+ if ((!REALIZED(t)) || (!t->textblock) || (!t->text))
+ {
+ if (x) *x = 0;
+ if (y) *y = 0;
+ if (w) *w = 1;
+ if (h) *h = ewl_theme_data_int_get(EWL_WIDGET(t), "font_size");
+
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ /* force a display of the text */
+ if (t->dirty) ewl_text_display(t);
+
+ if (char_idx >= t->length.chars)
+ {
+ char_idx --;
+ shifting = 1;
+ }
+
+ byte_idx = ewl_text_char_to_drawn_byte(t, char_idx);
+
+ cursor = ewl_text_textblock_cursor_position(t, byte_idx);
+ evas_textblock_cursor_char_geometry_get(cursor, &tx, &ty, &tw, &th);
+ evas_textblock_cursor_free(cursor);
+
+ if (x) *x = (int)(tx + CURRENT_X(t));
+ if (y) *y = (int)(ty + CURRENT_Y(t));
+ if (w) *w = (int)tw;
+ if (h) *h = (int)th;
+
+ /* if we didn't count the last item, move us over to the other side
+ * of it */
+ if (shifting) *x += *w;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -321,75 +321,75 @@ ewl_text_index_geometry_map(Ewl_Text *t, unsigned int char_idx,
unsigned int
ewl_text_coord_index_map(Ewl_Text *t, int x, int y)
{
- Evas_Textblock_Cursor *cursor;
- unsigned int byte_idx = 0, char_idx = 0, ctmp = 0;
- Evas_Coord tx, ty, cx = 0, cy, cw, ch;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, 0);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, 0);
-
- if ((!REALIZED(t)) || (!t->textblock) || (!t->text))
- DRETURN_INT(0, DLEVEL_STABLE);
-
- /* force a display of the text */
- if (t->dirty) ewl_text_display(t);
-
- tx = (Evas_Coord)(x - CURRENT_X(t));
- ty = (Evas_Coord)(y - CURRENT_Y(t));
-
- cursor = evas_object_textblock_cursor_new(t->textblock);
-
- /* see if we have the mouse over a char */
- if (!evas_textblock_cursor_char_coord_set(cursor, tx, ty))
- {
- int line;
-
- /* if not, see if the mouse is by a line */
- line = evas_textblock_cursor_line_coord_set(cursor, ty);
- if (line >= 0)
- {
- /* if so, get the line geometry and determine start
- * or end of line */
- evas_textblock_cursor_line_geometry_get(cursor,
- &cx, &cy, &cw, &ch);
- if (x < (cx + (cw / 2)))
- evas_textblock_cursor_line_first(cursor);
- else
- {
- const char *txt;
- evas_textblock_cursor_line_last(cursor);
-
- /* we want to be past the last char so we
- * need to increment this by 1 to begin */
- txt = evas_textblock_cursor_node_format_get(cursor);
-
- /* Increment if we're on the last line */
- if (!txt || (strcmp(txt, "\n")))
- char_idx++;
- }
- }
- else
- {
- evas_textblock_cursor_line_set(cursor, 0);
- evas_textblock_cursor_line_first(cursor);
- }
- }
- else
- {
- evas_textblock_cursor_char_geometry_get(cursor,
- &cx, &cy, &cw, &ch);
- if (tx > (cx + ((cw + 1) >> 1)))
- char_idx++;
- }
-
- byte_idx = ewl_text_textblock_cursor_to_index(cursor);
- ctmp = ewl_text_drawn_byte_to_char(t, byte_idx);
- evas_textblock_cursor_free(cursor);
-
- char_idx += ctmp;
-
- DRETURN_INT(char_idx, DLEVEL_STABLE);
+ Evas_Textblock_Cursor *cursor;
+ unsigned int byte_idx = 0, char_idx = 0, ctmp = 0;
+ Evas_Coord tx, ty, cx = 0, cy, cw, ch;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, 0);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, 0);
+
+ if ((!REALIZED(t)) || (!t->textblock) || (!t->text))
+ DRETURN_INT(0, DLEVEL_STABLE);
+
+ /* force a display of the text */
+ if (t->dirty) ewl_text_display(t);
+
+ tx = (Evas_Coord)(x - CURRENT_X(t));
+ ty = (Evas_Coord)(y - CURRENT_Y(t));
+
+ cursor = evas_object_textblock_cursor_new(t->textblock);
+
+ /* see if we have the mouse over a char */
+ if (!evas_textblock_cursor_char_coord_set(cursor, tx, ty))
+ {
+ int line;
+
+ /* if not, see if the mouse is by a line */
+ line = evas_textblock_cursor_line_coord_set(cursor, ty);
+ if (line >= 0)
+ {
+ /* if so, get the line geometry and determine start
+ * or end of line */
+ evas_textblock_cursor_line_geometry_get(cursor,
+ &cx, &cy, &cw, &ch);
+ if (x < (cx + (cw / 2)))
+ evas_textblock_cursor_line_first(cursor);
+ else
+ {
+ const char *txt;
+ evas_textblock_cursor_line_last(cursor);
+
+ /* we want to be past the last char so we
+ * need to increment this by 1 to begin */
+ txt = evas_textblock_cursor_node_format_get(cursor);
+
+ /* Increment if we're on the last line */
+ if (!txt || (strcmp(txt, "\n")))
+ char_idx++;
+ }
+ }
+ else
+ {
+ evas_textblock_cursor_line_set(cursor, 0);
+ evas_textblock_cursor_line_first(cursor);
+ }
+ }
+ else
+ {
+ evas_textblock_cursor_char_geometry_get(cursor,
+ &cx, &cy, &cw, &ch);
+ if (tx > (cx + ((cw + 1) >> 1)))
+ char_idx++;
+ }
+
+ byte_idx = ewl_text_textblock_cursor_to_index(cursor);
+ ctmp = ewl_text_drawn_byte_to_char(t, byte_idx);
+ evas_textblock_cursor_free(cursor);
+
+ char_idx += ctmp;
+
+ DRETURN_INT(char_idx, DLEVEL_STABLE);
}
/**
@@ -400,11 +400,11 @@ ewl_text_coord_index_map(Ewl_Text *t, int x, int y)
char *
ewl_text_text_get(Ewl_Text *t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, NULL);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, NULL);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, NULL);
- DRETURN_PTR(((t->text) ? strdup(t->text) : NULL), DLEVEL_STABLE);
+ DRETURN_PTR(((t->text) ? strdup(t->text) : NULL), DLEVEL_STABLE);
}
/**
@@ -415,24 +415,24 @@ ewl_text_text_get(Ewl_Text *t)
void
ewl_text_clear(Ewl_Text *t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- if (t->length.chars > 0)
- {
- ewl_text_cursor_position_set(t, 0);
- ewl_text_text_delete(t, t->length.chars);
- }
- t->dirty = TRUE;
+ if (t->length.chars > 0)
+ {
+ ewl_text_cursor_position_set(t, 0);
+ ewl_text_text_delete(t, t->length.chars);
+ }
+ t->dirty = TRUE;
- if (t->formatting.tx)
- ewl_text_context_release(t->formatting.tx);
+ if (t->formatting.tx)
+ ewl_text_context_release(t->formatting.tx);
- t->formatting.tx = ewl_text_context_default_create(t);
- ewl_text_fmt_clear(t->formatting.nodes);
+ t->formatting.tx = ewl_text_context_default_create(t);
+ ewl_text_fmt_clear(t->formatting.nodes);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -444,14 +444,14 @@ ewl_text_clear(Ewl_Text *t)
void
ewl_text_text_set(Ewl_Text *t, const char *text)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- ewl_text_clear(t);
- ewl_text_text_append(t, text);
+ ewl_text_clear(t);
+ ewl_text_text_append(t, text);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -463,39 +463,39 @@ ewl_text_text_set(Ewl_Text *t, const char *text)
void
ewl_text_text_prepend(Ewl_Text *t, const char *text)
{
- unsigned int char_len = 0, byte_len = 0;
+ unsigned int char_len = 0, byte_len = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
- /* don't do anything if there is no text */
- if ((!text) || (!text[0]))
- DRETURN(DLEVEL_STABLE);
+ /* don't do anything if there is no text */
+ if ((!text) || (!text[0]))
+ DRETURN(DLEVEL_STABLE);
- /* don't insert text if we already reached the maximum */
- if (t->length.max_chars && t->length.chars >= t->length.max_chars)
- DRETURN(DLEVEL_STABLE);
+ /* don't insert text if we already reached the maximum */
+ if (t->length.max_chars && t->length.chars >= t->length.max_chars)
+ DRETURN(DLEVEL_STABLE);
- ewl_text_text_insert_private(t, text, 0, &char_len, &byte_len);
- ewl_text_fmt_node_prepend(t->formatting.nodes,
- t->formatting.tx,
- char_len, byte_len);
+ ewl_text_text_insert_private(t, text, 0, &char_len, &byte_len);
+ ewl_text_fmt_node_prepend(t->formatting.nodes,
+ t->formatting.tx,
+ char_len, byte_len);
- if (t->formatting.tx)
- {
- /* we release this here as the cursor_position_set may not
- * actually remove it if the cursor dosen't move */
- ewl_text_context_release(t->formatting.tx);
- t->formatting.tx = NULL;
- }
+ if (t->formatting.tx)
+ {
+ /* we release this here as the cursor_position_set may not
+ * actually remove it if the cursor dosen't move */
+ ewl_text_context_release(t->formatting.tx);
+ t->formatting.tx = NULL;
+ }
- ewl_text_cursor_position_set(t, char_len);
- t->dirty = TRUE;
+ ewl_text_cursor_position_set(t, char_len);
+ t->dirty = TRUE;
- if (text) ewl_text_triggers_shift(t, 0, char_len, FALSE);
- ewl_widget_configure(EWL_WIDGET(t));
+ if (text) ewl_text_triggers_shift(t, 0, char_len, FALSE);
+ ewl_widget_configure(EWL_WIDGET(t));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -507,38 +507,38 @@ ewl_text_text_prepend(Ewl_Text *t, const char *text)
void
ewl_text_text_append(Ewl_Text *t, const char *text)
{
- unsigned int char_len = 0, byte_len = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
-
- /* don't do anything if there is no text */
- if ((!text) || (!text[0]))
- DRETURN(DLEVEL_STABLE);
-
- /* don't insert text if we already reached the maximum */
- if (t->length.max_chars && t->length.chars >= t->length.max_chars)
- DRETURN(DLEVEL_STABLE);
-
- ewl_text_text_insert_private(t, text, t->length.chars, &char_len, &byte_len);
- ewl_text_fmt_node_append(t->formatting.nodes,
- t->formatting.tx,
- char_len, byte_len);
-
- if (t->formatting.tx)
- {
- /* we free this here as the cursor_position_set may not
- * actually remove it if the cursor dosen't move */
- ewl_text_context_release(t->formatting.tx);
- t->formatting.tx = NULL;
- }
-
- ewl_text_cursor_position_set(t, t->length.chars);
- t->dirty = TRUE;
- ewl_widget_configure(EWL_WIDGET(t));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ unsigned int char_len = 0, byte_len = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
+
+ /* don't do anything if there is no text */
+ if ((!text) || (!text[0]))
+ DRETURN(DLEVEL_STABLE);
+
+ /* don't insert text if we already reached the maximum */
+ if (t->length.max_chars && t->length.chars >= t->length.max_chars)
+ DRETURN(DLEVEL_STABLE);
+
+ ewl_text_text_insert_private(t, text, t->length.chars, &char_len, &byte_len);
+ ewl_text_fmt_node_append(t->formatting.nodes,
+ t->formatting.tx,
+ char_len, byte_len);
+
+ if (t->formatting.tx)
+ {
+ /* we free this here as the cursor_position_set may not
+ * actually remove it if the cursor dosen't move */
+ ewl_text_context_release(t->formatting.tx);
+ t->formatting.tx = NULL;
+ }
+
+ ewl_text_cursor_position_set(t, t->length.chars);
+ t->dirty = TRUE;
+ ewl_widget_configure(EWL_WIDGET(t));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -551,128 +551,128 @@ ewl_text_text_append(Ewl_Text *t, const char *text)
void
ewl_text_text_insert(Ewl_Text *t, const char *text, unsigned int char_idx)
{
- Ewl_Text_Context *tx;
- unsigned int char_len = 0, byte_len = 0;
+ Ewl_Text_Context *tx;
+ unsigned int char_len = 0, byte_len = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- /* don't do anything if there is no text */
- if ((!text) || (!text[0]))
- DRETURN(DLEVEL_STABLE);
+ /* don't do anything if there is no text */
+ if ((!text) || (!text[0]))
+ DRETURN(DLEVEL_STABLE);
- /* don't insert text if we already reached the maximum */
- if (t->length.max_chars && t->length.chars >= t->length.max_chars)
- DRETURN(DLEVEL_STABLE);
+ /* don't insert text if we already reached the maximum */
+ if (t->length.max_chars && t->length.chars >= t->length.max_chars)
+ DRETURN(DLEVEL_STABLE);
- /* Limit the index to be within safe boundaries */
- if (char_idx > t->length.chars + 1)
- char_idx = t->length.chars + 1;
+ /* Limit the index to be within safe boundaries */
+ if (char_idx > t->length.chars + 1)
+ char_idx = t->length.chars + 1;
- /* make sure we set the position _before_ inserting the text else
- * it'll fuck up the cursor_position_set call when inserting into
- * and empty node list */
- tx = t->formatting.tx;
- t->formatting.tx = NULL;
- ewl_text_cursor_position_set(t, char_idx);
+ /* make sure we set the position _before_ inserting the text else
+ * it'll fuck up the cursor_position_set call when inserting into
+ * and empty node list */
+ tx = t->formatting.tx;
+ t->formatting.tx = NULL;
+ ewl_text_cursor_position_set(t, char_idx);
- ewl_text_text_insert_private(t, text, char_idx, &char_len, &byte_len);
- ewl_text_fmt_node_insert(t->formatting.nodes, char_idx, tx,
- char_len, byte_len);
+ ewl_text_text_insert_private(t, text, char_idx, &char_len, &byte_len);
+ ewl_text_fmt_node_insert(t->formatting.nodes, char_idx, tx,
+ char_len, byte_len);
- if (tx) ewl_text_context_release(tx);
- ewl_text_cursor_position_set(t, char_idx + char_len);
- t->dirty = TRUE;
+ if (tx) ewl_text_context_release(tx);
+ ewl_text_cursor_position_set(t, char_idx + char_len);
+ t->dirty = TRUE;
- if (text) ewl_text_triggers_shift(t, char_idx, char_len, FALSE);
- ewl_widget_configure(EWL_WIDGET(t));
+ if (text) ewl_text_triggers_shift(t, char_idx, char_len, FALSE);
+ ewl_widget_configure(EWL_WIDGET(t));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_text_text_insert_private(Ewl_Text *t, const char *txt,
- unsigned int char_idx, unsigned int *char_len,
- unsigned int *byte_len)
+ unsigned int char_idx, unsigned int *char_len,
+ unsigned int *byte_len)
{
- unsigned int new_byte_len, clen = 0, blen = 0, bidx = 0;
- unsigned int max_chars;
- char *tmp, *ptr;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
-
- /* nothign to do if no text */
- if (!txt) DRETURN(DLEVEL_STABLE);
-
- /* count the number of chars in the text */
- tmp = (char *)txt;
- max_chars = (t->length.max_chars) ? t->length.max_chars : UINT_MAX;
- while ((*tmp) && ((clen + t->length.chars) < max_chars))
- {
- if (ewl_text_char_utf8_is(tmp))
- tmp = ewl_text_text_next_char(tmp, NULL);
- else
- tmp++;
-
- clen++;
- }
- blen = tmp - txt;
-
- new_byte_len = t->length.bytes + blen;
- if ((new_byte_len + 1) >= t->total_size)
- {
- int extend;
-
- /*
- * Determine the size in blocks of EWL_TEXT_EXTEND_VAL
- */
- extend = ((new_byte_len + 1) / EWL_TEXT_EXTEND_VAL);
- extend = (extend + 1) * EWL_TEXT_EXTEND_VAL;
-
- t->text = realloc(t->text, extend * sizeof(char));
- t->total_size = extend;
- }
-
- ewl_text_fmt_char_to_byte(t->formatting.nodes, char_idx,
- 0, &bidx, NULL);
-
- if (char_idx < t->length.chars)
- memmove(t->text + bidx + blen, t->text + bidx,
- t->length.bytes - bidx);
-
- /* copy the text over, replace invalid UTF-8 chars */
- tmp = (char *)txt;
- ptr = t->text + bidx;
- while (*tmp && (tmp - txt) < (int)blen)
- {
- if (ewl_text_char_utf8_is(tmp))
- {
- char *s;
-
- s = tmp;
- tmp = ewl_text_text_next_char(tmp, NULL);
- for ( ; s != tmp; s++, ptr++)
- *ptr = *s;
- }
- else
- {
- *ptr = '?';
- tmp++;
- }
- }
-
- /* update the text information */
- t->length.chars += clen;
- t->length.bytes += blen;
- t->text[t->length.bytes] = '\0';
-
- if (char_len) *char_len = clen;
- if (byte_len) *byte_len = blen;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ unsigned int new_byte_len, clen = 0, blen = 0, bidx = 0;
+ unsigned int max_chars;
+ char *tmp, *ptr;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
+
+ /* nothign to do if no text */
+ if (!txt) DRETURN(DLEVEL_STABLE);
+
+ /* count the number of chars in the text */
+ tmp = (char *)txt;
+ max_chars = (t->length.max_chars) ? t->length.max_chars : UINT_MAX;
+ while ((*tmp) && ((clen + t->length.chars) < max_chars))
+ {
+ if (ewl_text_char_utf8_is(tmp))
+ tmp = ewl_text_text_next_char(tmp, NULL);
+ else
+ tmp++;
+
+ clen++;
+ }
+ blen = tmp - txt;
+
+ new_byte_len = t->length.bytes + blen;
+ if ((new_byte_len + 1) >= t->total_size)
+ {
+ int extend;
+
+ /*
+ * Determine the size in blocks of EWL_TEXT_EXTEND_VAL
+ */
+ extend = ((new_byte_len + 1) / EWL_TEXT_EXTEND_VAL);
+ extend = (extend + 1) * EWL_TEXT_EXTEND_VAL;
+
+ t->text = realloc(t->text, extend * sizeof(char));
+ t->total_size = extend;
+ }
+
+ ewl_text_fmt_char_to_byte(t->formatting.nodes, char_idx,
+ 0, &bidx, NULL);
+
+ if (char_idx < t->length.chars)
+ memmove(t->text + bidx + blen, t->text + bidx,
+ t->length.bytes - bidx);
+
+ /* copy the text over, replace invalid UTF-8 chars */
+ tmp = (char *)txt;
+ ptr = t->text + bidx;
+ while (*tmp && (tmp - txt) < (int)blen)
+ {
+ if (ewl_text_char_utf8_is(tmp))
+ {
+ char *s;
+
+ s = tmp;
+ tmp = ewl_text_text_next_char(tmp, NULL);
+ for ( ; s != tmp; s++, ptr++)
+ *ptr = *s;
+ }
+ else
+ {
+ *ptr = '?';
+ tmp++;
+ }
+ }
+
+ /* update the text information */
+ t->length.chars += clen;
+ t->length.bytes += blen;
+ t->text[t->length.bytes] = '\0';
+
+ if (char_len) *char_len = clen;
+ if (byte_len) *byte_len = blen;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -685,66 +685,66 @@ ewl_text_text_insert_private(Ewl_Text *t, const char *txt,
void
ewl_text_text_delete(Ewl_Text *t, unsigned int char_len)
{
- unsigned int byte_idx = 0, byte_len = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
-
- if ((!t->text) || (char_len == 0) ||
- (t->cursor_position >= t->length.chars))
- DRETURN(DLEVEL_STABLE);
-
- /* don't try to delete more then we have after the current cursor
- * position */
- if ((t->length.chars - t->cursor_position) < char_len)
- char_len = t->length.chars - t->cursor_position;
-
- ewl_text_fmt_char_to_byte(t->formatting.nodes,
- t->cursor_position, char_len,
- &byte_idx, &byte_len);
-
- t->length.chars -= char_len;
- if (t->length.chars > 0)
- {
- t->length.bytes -= byte_len;
- memmove(t->text + byte_idx,
- t->text + byte_idx + byte_len,
- t->length.bytes - byte_idx);
-
- t->text[t->length.bytes] = '\0';
-
- ewl_text_triggers_shift(t, t->cursor_position, char_len, TRUE);
- }
- else
- {
- IF_FREE(t->text);
- t->length.bytes = 0;
- t->length.chars = 0;
- t->total_size = 0;
- t->cursor_position = 0;
- ewl_text_triggers_remove(t);
-
- /* cleanup the selection */
- if (t->selection)
- ewl_widget_destroy(EWL_WIDGET(t->selection));
-
- t->selection = NULL;
- }
-
- ewl_text_fmt_node_delete(t->formatting.nodes,
- t->cursor_position, char_len);
- t->dirty = TRUE;
-
- if (ewl_text_fmt_node_count_get(t->formatting.nodes) == 0)
- t->formatting.tx = ewl_text_context_default_create(t);
-
- if (t->cursor_position > t->length.chars)
- ewl_text_cursor_position_set(t, t->length.chars);
-
- ewl_widget_configure(EWL_WIDGET(t));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ unsigned int byte_idx = 0, byte_len = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
+
+ if ((!t->text) || (char_len == 0) ||
+ (t->cursor_position >= t->length.chars))
+ DRETURN(DLEVEL_STABLE);
+
+ /* don't try to delete more then we have after the current cursor
+ * position */
+ if ((t->length.chars - t->cursor_position) < char_len)
+ char_len = t->length.chars - t->cursor_position;
+
+ ewl_text_fmt_char_to_byte(t->formatting.nodes,
+ t->cursor_position, char_len,
+ &byte_idx, &byte_len);
+
+ t->length.chars -= char_len;
+ if (t->length.chars > 0)
+ {
+ t->length.bytes -= byte_len;
+ memmove(t->text + byte_idx,
+ t->text + byte_idx + byte_len,
+ t->length.bytes - byte_idx);
+
+ t->text[t->length.bytes] = '\0';
+
+ ewl_text_triggers_shift(t, t->cursor_position, char_len, TRUE);
+ }
+ else
+ {
+ IF_FREE(t->text);
+ t->length.bytes = 0;
+ t->length.chars = 0;
+ t->total_size = 0;
+ t->cursor_position = 0;
+ ewl_text_triggers_remove(t);
+
+ /* cleanup the selection */
+ if (t->selection)
+ ewl_widget_destroy(EWL_WIDGET(t->selection));
+
+ t->selection = NULL;
+ }
+
+ ewl_text_fmt_node_delete(t->formatting.nodes,
+ t->cursor_position, char_len);
+ t->dirty = TRUE;
+
+ if (ewl_text_fmt_node_count_get(t->formatting.nodes) == 0)
+ t->formatting.tx = ewl_text_context_default_create(t);
+
+ if (t->cursor_position > t->length.chars)
+ ewl_text_cursor_position_set(t, t->length.chars);
+
+ ewl_widget_configure(EWL_WIDGET(t));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -761,33 +761,33 @@ ewl_text_text_delete(Ewl_Text *t, unsigned int char_len)
void
ewl_text_obscure_set(Ewl_Text *t, const char *o)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
-
- /* free the old character */
- IF_FREE(t->obscure);
-
- if (!o)
- {
- t->obscure = NULL;
- }
- else if (ewl_text_char_utf8_is(o))
- {
- size_t len;
-
- len = EWL_TEXT_CHAR_BYTE_LEN(o);
- t->obscure = NEW(char, len + 1);
- memcpy(t->obscure, o, len);
- t->obscure[len] = 0;
- }
- else
- t->obscure = strdup("*");
-
- t->dirty = TRUE;
- ewl_widget_configure(EWL_WIDGET(t));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
+
+ /* free the old character */
+ IF_FREE(t->obscure);
+
+ if (!o)
+ {
+ t->obscure = NULL;
+ }
+ else if (ewl_text_char_utf8_is(o))
+ {
+ size_t len;
+
+ len = EWL_TEXT_CHAR_BYTE_LEN(o);
+ t->obscure = NEW(char, len + 1);
+ memcpy(t->obscure, o, len);
+ t->obscure[len] = 0;
+ }
+ else
+ t->obscure = strdup("*");
+
+ t->dirty = TRUE;
+ ewl_widget_configure(EWL_WIDGET(t));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -800,11 +800,11 @@ ewl_text_obscure_set(Ewl_Text *t, const char *o)
const char *
ewl_text_obscure_get(Ewl_Text *t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, 0);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, 0);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, 0);
- DRETURN_INT(t->obscure, DLEVEL_STABLE);
+ DRETURN_INT(t->obscure, DLEVEL_STABLE);
}
/**
@@ -816,31 +816,31 @@ ewl_text_obscure_get(Ewl_Text *t)
void
ewl_text_selectable_set(Ewl_Text *t, unsigned int selectable)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
-
- if (t->selectable == selectable)
- DRETURN(DLEVEL_STABLE);
-
- t->selectable = selectable;
-
- if (t->selectable)
- {
- ewl_callback_append(EWL_WIDGET(t), EWL_CALLBACK_MOUSE_DOWN,
- ewl_text_cb_mouse_down, NULL);
- ewl_callback_append(EWL_WIDGET(t), EWL_CALLBACK_MOUSE_UP,
- ewl_text_cb_mouse_up, NULL);
- }
- else
- {
- ewl_callback_del(EWL_WIDGET(t), EWL_CALLBACK_MOUSE_DOWN,
- ewl_text_cb_mouse_down);
- ewl_callback_del(EWL_WIDGET(t), EWL_CALLBACK_MOUSE_UP,
- ewl_text_cb_mouse_up);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
+
+ if (t->selectable == selectable)
+ DRETURN(DLEVEL_STABLE);
+
+ t->selectable = selectable;
+
+ if (t->selectable)
+ {
+ ewl_callback_append(EWL_WIDGET(t), EWL_CALLBACK_MOUSE_DOWN,
+ ewl_text_cb_mouse_down, NULL);
+ ewl_callback_append(EWL_WIDGET(t), EWL_CALLBACK_MOUSE_UP,
+ ewl_text_cb_mouse_up, NULL);
+ }
+ else
+ {
+ ewl_callback_del(EWL_WIDGET(t), EWL_CALLBACK_MOUSE_DOWN,
+ ewl_text_cb_mouse_down);
+ ewl_callback_del(EWL_WIDGET(t), EWL_CALLBACK_MOUSE_UP,
+ ewl_text_cb_mouse_up);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -851,11 +851,11 @@ ewl_text_selectable_set(Ewl_Text *t, unsigned int selectable)
unsigned int
ewl_text_selectable_get(Ewl_Text *t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, 0);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, 0);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, 0);
- DRETURN_INT(t->selectable, DLEVEL_STABLE);
+ DRETURN_INT(t->selectable, DLEVEL_STABLE);
}
/**
@@ -866,31 +866,31 @@ ewl_text_selectable_get(Ewl_Text *t)
char *
ewl_text_selection_text_get(Ewl_Text *t)
{
- char *ret = NULL;
- Ewl_Text_Trigger *sel;
- unsigned int byte_pos = 0;
- unsigned int byte_len = 0;
+ char *ret = NULL;
+ Ewl_Text_Trigger *sel;
+ unsigned int byte_pos = 0;
+ unsigned int byte_len = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, NULL);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, NULL);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, NULL);
- sel = EWL_TEXT_TRIGGER(t->selection);
- if ((!sel) || (sel->char_len == 0))
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ sel = EWL_TEXT_TRIGGER(t->selection);
+ if ((!sel) || (sel->char_len == 0))
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- ewl_text_fmt_char_to_byte(t->formatting.nodes,
- sel->char_pos,
- sel->char_len,
- &byte_pos, &byte_len);
+ ewl_text_fmt_char_to_byte(t->formatting.nodes,
+ sel->char_pos,
+ sel->char_len,
+ &byte_pos, &byte_len);
- ret = malloc(sizeof(char) * (byte_len + 1));
- if (!ret) DRETURN_PTR(NULL, DLEVEL_STABLE);
+ ret = malloc(sizeof(char) * (byte_len + 1));
+ if (!ret) DRETURN_PTR(NULL, DLEVEL_STABLE);
- memcpy(ret, t->text + byte_pos, byte_len);
- ret[byte_len] = '\0';
+ memcpy(ret, t->text + byte_pos, byte_len);
+ ret[byte_len] = '\0';
- DRETURN_PTR(ret, DLEVEL_STABLE);
+ DRETURN_PTR(ret, DLEVEL_STABLE);
}
/**
@@ -902,17 +902,17 @@ ewl_text_selection_text_get(Ewl_Text *t)
Ewl_Widget *
ewl_text_selection_get(Ewl_Text *t)
{
- Ewl_Text_Trigger *sel;
+ Ewl_Text_Trigger *sel;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, NULL);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, NULL);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, NULL);
- sel = EWL_TEXT_TRIGGER(t->selection);
- if (sel && ewl_text_trigger_length_get(sel) > 0)
- DRETURN_PTR(sel, DLEVEL_STABLE);
+ sel = EWL_TEXT_TRIGGER(t->selection);
+ if (sel && ewl_text_trigger_length_get(sel) > 0)
+ DRETURN_PTR(sel, DLEVEL_STABLE);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
}
/**
@@ -923,14 +923,14 @@ ewl_text_selection_get(Ewl_Text *t)
unsigned int
ewl_text_has_selection(Ewl_Text *t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, FALSE);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, FALSE);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, FALSE);
- if (ewl_text_selection_get(t))
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ if (ewl_text_selection_get(t))
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
}
/**
@@ -943,32 +943,32 @@ ewl_text_has_selection(Ewl_Text *t)
void
ewl_text_select(Ewl_Text *t, unsigned int char_idx, unsigned int char_len)
{
- Ewl_Text_Trigger *s;
+ Ewl_Text_Trigger *s;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- if (t->length.chars == 0)
- DRETURN(DLEVEL_STABLE);
+ if (t->length.chars == 0)
+ DRETURN(DLEVEL_STABLE);
- if (char_idx > t->length.chars)
- char_idx = t->length.chars;
+ if (char_idx > t->length.chars)
+ char_idx = t->length.chars;
- if (char_idx + char_len > t->length.chars)
- char_len = t->length.chars - char_idx;
+ if (char_idx + char_len > t->length.chars)
+ char_len = t->length.chars - char_idx;
- /* if we haven't already have an selection create one */
- if (!t->selection)
- t->selection = ewl_text_selection_new(t);
+ /* if we haven't already have an selection create one */
+ if (!t->selection)
+ t->selection = ewl_text_selection_new(t);
- s = EWL_TEXT_TRIGGER(t->selection);
- ewl_text_trigger_start_pos_set(s, char_idx);
- ewl_text_trigger_length_set(s, char_len);
+ s = EWL_TEXT_TRIGGER(t->selection);
+ ewl_text_trigger_start_pos_set(s, char_idx);
+ ewl_text_trigger_length_set(s, char_len);
- ewl_text_trigger_position(t, s);
+ ewl_text_trigger_position(t, s);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -979,13 +979,13 @@ ewl_text_select(Ewl_Text *t, unsigned int char_idx, unsigned int char_len)
void
ewl_text_all_select(Ewl_Text *t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- ewl_text_select(t, 0, t->length.chars);
+ ewl_text_select(t, 0, t->length.chars);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -997,29 +997,29 @@ ewl_text_all_select(Ewl_Text *t)
void
ewl_text_cursor_position_set(Ewl_Text *t, unsigned int char_pos)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- /* make sure we aren't more then the next char past the
- * end of the text */
- if (char_pos > t->length.chars) char_pos = t->length.chars;
+ /* make sure we aren't more then the next char past the
+ * end of the text */
+ if (char_pos > t->length.chars) char_pos = t->length.chars;
- /* it's the same position, do nothing */
- if (char_pos == t->cursor_position)
- DRETURN(DLEVEL_STABLE);
+ /* it's the same position, do nothing */
+ if (char_pos == t->cursor_position)
+ DRETURN(DLEVEL_STABLE);
- /* clean the current context if it exists */
- if (t->formatting.tx)
- {
- ewl_text_context_release(t->formatting.tx);
- t->formatting.tx = NULL;
- }
- t->cursor_position = char_pos;
+ /* clean the current context if it exists */
+ if (t->formatting.tx)
+ {
+ ewl_text_context_release(t->formatting.tx);
+ t->formatting.tx = NULL;
+ }
+ t->cursor_position = char_pos;
- ewl_text_fmt_goto(t->formatting.nodes, char_pos);
+ ewl_text_fmt_goto(t->formatting.nodes, char_pos);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1030,11 +1030,11 @@ ewl_text_cursor_position_set(Ewl_Text *t, unsigned int char_pos)
unsigned int
ewl_text_cursor_position_get(Ewl_Text *t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, 0);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, 0);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, 0);
- DRETURN_INT(t->cursor_position, DLEVEL_STABLE);
+ DRETURN_INT(t->cursor_position, DLEVEL_STABLE);
}
/**
@@ -1045,45 +1045,45 @@ ewl_text_cursor_position_get(Ewl_Text *t)
unsigned int
ewl_text_cursor_position_line_up_get(Ewl_Text *t)
{
- Evas_Textblock_Cursor *cursor;
- unsigned int cur_char_idx = 0, byte_idx = 0;
- Evas_Coord cx, cw;
- Evas_Coord lx, ly, lw, lh;
- int line;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, t->cursor_position);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, t->cursor_position);
-
- cur_char_idx = ewl_text_cursor_position_get(t);
- byte_idx = ewl_text_char_to_drawn_byte(t, cur_char_idx);
-
- cursor = ewl_text_textblock_cursor_position(t, byte_idx);
- line = evas_textblock_cursor_char_geometry_get(cursor, &cx, NULL,
- &cw, NULL);
- line --;
-
- if (evas_object_textblock_line_number_geometry_get(t->textblock,
- line, &lx, &ly, &lw, &lh))
- {
- if (!evas_textblock_cursor_char_coord_set(cursor,
- cx + (cw / 2), ly))
- {
- if (evas_textblock_cursor_line_set(cursor, line))
- {
- if ((cx + (cw / 2)) >= (lx + lw))
- evas_textblock_cursor_line_last(cursor);
- else
- evas_textblock_cursor_line_first(cursor);
- }
- }
-
- }
-
- byte_idx = ewl_text_textblock_cursor_to_index(cursor);
- cur_char_idx = ewl_text_drawn_byte_to_char(t, byte_idx);
-
- DRETURN_INT(cur_char_idx, DLEVEL_STABLE);
+ Evas_Textblock_Cursor *cursor;
+ unsigned int cur_char_idx = 0, byte_idx = 0;
+ Evas_Coord cx, cw;
+ Evas_Coord lx, ly, lw, lh;
+ int line;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, t->cursor_position);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, t->cursor_position);
+
+ cur_char_idx = ewl_text_cursor_position_get(t);
+ byte_idx = ewl_text_char_to_drawn_byte(t, cur_char_idx);
+
+ cursor = ewl_text_textblock_cursor_position(t, byte_idx);
+ line = evas_textblock_cursor_char_geometry_get(cursor, &cx, NULL,
+ &cw, NULL);
+ line --;
+
+ if (evas_object_textblock_line_number_geometry_get(t->textblock,
+ line, &lx, &ly, &lw, &lh))
+ {
+ if (!evas_textblock_cursor_char_coord_set(cursor,
+ cx + (cw / 2), ly))
+ {
+ if (evas_textblock_cursor_line_set(cursor, line))
+ {
+ if ((cx + (cw / 2)) >= (lx + lw))
+ evas_textblock_cursor_line_last(cursor);
+ else
+ evas_textblock_cursor_line_first(cursor);
+ }
+ }
+
+ }
+
+ byte_idx = ewl_text_textblock_cursor_to_index(cursor);
+ cur_char_idx = ewl_text_drawn_byte_to_char(t, byte_idx);
+
+ DRETURN_INT(cur_char_idx, DLEVEL_STABLE);
}
/**
@@ -1094,48 +1094,48 @@ ewl_text_cursor_position_line_up_get(Ewl_Text *t)
unsigned int
ewl_text_cursor_position_line_down_get(Ewl_Text *t)
{
- Evas_Textblock_Cursor *cursor;
- unsigned int cur_char_idx = 0, byte_idx = 0;
- Evas_Coord cx, cw;
- Evas_Coord lx, ly, lw, lh;
- int line;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, t->cursor_position);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, t->cursor_position);
-
- cur_char_idx = ewl_text_cursor_position_get(t);
- ewl_text_fmt_char_to_byte(t->formatting.nodes, cur_char_idx,
- 0, &byte_idx, NULL);
-
- cursor = ewl_text_textblock_cursor_position(t, byte_idx);
- line = evas_textblock_cursor_char_geometry_get(cursor, &cx, NULL,
- &cw, NULL);
- line ++;
-
- if (evas_object_textblock_line_number_geometry_get(t->textblock,
- line, &lx, &ly, &lw, &lh))
- {
- if (!evas_textblock_cursor_char_coord_set(cursor,
- cx + (cw / 2), ly))
- {
- if (evas_textblock_cursor_line_set(cursor, line))
- {
- if ((cx + (cw / 2)) >= (lx + lw))
- evas_textblock_cursor_line_last(cursor);
- else
- evas_textblock_cursor_line_first(cursor);
- }
- }
-
- }
-
- byte_idx = ewl_text_textblock_cursor_to_index(cursor);
- cur_char_idx = 0;
- ewl_text_fmt_byte_to_char(t->formatting.nodes, byte_idx,
- 0, &cur_char_idx, NULL);
-
- DRETURN_INT(cur_char_idx, DLEVEL_STABLE);
+ Evas_Textblock_Cursor *cursor;
+ unsigned int cur_char_idx = 0, byte_idx = 0;
+ Evas_Coord cx, cw;
+ Evas_Coord lx, ly, lw, lh;
+ int line;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, t->cursor_position);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, t->cursor_position);
+
+ cur_char_idx = ewl_text_cursor_position_get(t);
+ ewl_text_fmt_char_to_byte(t->formatting.nodes, cur_char_idx,
+ 0, &byte_idx, NULL);
+
+ cursor = ewl_text_textblock_cursor_position(t, byte_idx);
+ line = evas_textblock_cursor_char_geometry_get(cursor, &cx, NULL,
+ &cw, NULL);
+ line ++;
+
+ if (evas_object_textblock_line_number_geometry_get(t->textblock,
+ line, &lx, &ly, &lw, &lh))
+ {
+ if (!evas_textblock_cursor_char_coord_set(cursor,
+ cx + (cw / 2), ly))
+ {
+ if (evas_textblock_cursor_line_set(cursor, line))
+ {
+ if ((cx + (cw / 2)) >= (lx + lw))
+ evas_textblock_cursor_line_last(cursor);
+ else
+ evas_textblock_cursor_line_first(cursor);
+ }
+ }
+
+ }
+
+ byte_idx = ewl_text_textblock_cursor_to_index(cursor);
+ cur_char_idx = 0;
+ ewl_text_fmt_byte_to_char(t->formatting.nodes, byte_idx,
+ 0, &cur_char_idx, NULL);
+
+ DRETURN_INT(cur_char_idx, DLEVEL_STABLE);
}
/**
@@ -1147,13 +1147,13 @@ ewl_text_cursor_position_line_down_get(Ewl_Text *t)
void
ewl_text_font_set(Ewl_Text *t, const char *font)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- ewl_text_font_source_set(t, NULL, font);
+ ewl_text_font_source_set(t, NULL, font);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1167,13 +1167,13 @@ ewl_text_font_set(Ewl_Text *t, const char *font)
void
ewl_text_font_apply(Ewl_Text *t, const char *font, unsigned int char_len)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- ewl_text_font_source_apply(t, NULL, font, char_len);
+ ewl_text_font_source_apply(t, NULL, font, char_len);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1185,29 +1185,29 @@ ewl_text_font_apply(Ewl_Text *t, const char *font, unsigned int char_len)
char *
ewl_text_font_get(Ewl_Text *t, unsigned int char_idx)
{
- Ewl_Text_Fmt_Node *fmt;
- char *font = NULL;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, NULL);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, NULL);
-
- fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
- if (fmt && fmt->tx)
- {
- if (fmt->tx->font)
- font = strdup(fmt->tx->font);
- }
- else
- {
- Ewl_Text_Context *tx;
-
- tx = ewl_text_context_default_create(t);
- if (tx->font) font = strdup(tx->font);
- ewl_text_context_release(tx);
- }
-
- DRETURN_PTR(font, DLEVEL_STABLE);
+ Ewl_Text_Fmt_Node *fmt;
+ char *font = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, NULL);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, NULL);
+
+ fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
+ if (fmt && fmt->tx)
+ {
+ if (fmt->tx->font)
+ font = strdup(fmt->tx->font);
+ }
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ if (tx->font) font = strdup(tx->font);
+ ewl_text_context_release(tx);
+ }
+
+ DRETURN_PTR(font, DLEVEL_STABLE);
}
/**
@@ -1220,25 +1220,25 @@ ewl_text_font_get(Ewl_Text *t, unsigned int char_idx)
void
ewl_text_font_source_set(Ewl_Text *t, const char *source, const char *font)
{
- Ewl_Text_Context *change;
+ Ewl_Text_Context *change;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- change = ewl_text_context_new();
- if (source) change->font_source = ecore_string_instance(source);
+ change = ewl_text_context_new();
+ if (source) change->font_source = ecore_string_instance(source);
- /* null font will go back to the theme default */
- if (!font) font = ewl_theme_data_str_get(EWL_WIDGET(t), "font");
+ /* null font will go back to the theme default */
+ if (!font) font = ewl_theme_data_str_get(EWL_WIDGET(t), "font");
- /* Duplicate a local copy of the font */
- if (font) change->font = ecore_string_instance(font);
+ /* Duplicate a local copy of the font */
+ if (font) change->font = ecore_string_instance(font);
- ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_FONT, change);
- ewl_text_context_release(change);
+ ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_FONT, change);
+ ewl_text_context_release(change);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1252,36 +1252,36 @@ ewl_text_font_source_set(Ewl_Text *t, const char *source, const char *font)
*/
void
ewl_text_font_source_apply(Ewl_Text *t, const char *source, const char *font,
- unsigned int char_len)
+ unsigned int char_len)
{
- Ewl_Text_Context *tx;
+ Ewl_Text_Context *tx;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- /* if length is 0 we have nothing to do */
- if (char_len == 0)
- DRETURN(DLEVEL_STABLE);
+ /* if length is 0 we have nothing to do */
+ if (char_len == 0)
+ DRETURN(DLEVEL_STABLE);
- tx = ewl_text_context_new();
+ tx = ewl_text_context_new();
- if (source) tx->font_source = ecore_string_instance(source);
+ if (source) tx->font_source = ecore_string_instance(source);
- /* null font will go back to the theme default */
- if (!font) font = ewl_theme_data_str_get(EWL_WIDGET(t), "font");
+ /* null font will go back to the theme default */
+ if (!font) font = ewl_theme_data_str_get(EWL_WIDGET(t), "font");
- /* Duplicate a local copy of the font */
- if (font) tx->font = ecore_string_instance(font);
+ /* Duplicate a local copy of the font */
+ if (font) tx->font = ecore_string_instance(font);
- ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_FONT, tx,
- t->cursor_position, char_len);
- ewl_text_context_release(tx);
- t->dirty = TRUE;
+ ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_FONT, tx,
+ t->cursor_position, char_len);
+ ewl_text_context_release(tx);
+ t->dirty = TRUE;
- ewl_widget_configure(EWL_WIDGET(t));
+ ewl_widget_configure(EWL_WIDGET(t));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1293,29 +1293,29 @@ ewl_text_font_source_apply(Ewl_Text *t, const char *source, const char *font,
char *
ewl_text_font_source_get(Ewl_Text *t, unsigned int char_idx)
{
- Ewl_Text_Fmt_Node *fmt;
- char *source = NULL;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, NULL);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, NULL);
-
- fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
- if (fmt && fmt->tx)
- {
- if (fmt->tx->font_source)
- source = strdup(fmt->tx->font_source);
- }
- else
- {
- Ewl_Text_Context *tx;
-
- tx = ewl_text_context_default_create(t);
- if (tx->font_source) source = strdup(tx->font_source);
- ewl_text_context_release(tx);
- }
-
- DRETURN_PTR(source, DLEVEL_STABLE);
+ Ewl_Text_Fmt_Node *fmt;
+ char *source = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, NULL);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, NULL);
+
+ fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
+ if (fmt && fmt->tx)
+ {
+ if (fmt->tx->font_source)
+ source = strdup(fmt->tx->font_source);
+ }
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ if (tx->font_source) source = strdup(tx->font_source);
+ ewl_text_context_release(tx);
+ }
+
+ DRETURN_PTR(source, DLEVEL_STABLE);
}
/**
@@ -1327,19 +1327,19 @@ ewl_text_font_source_get(Ewl_Text *t, unsigned int char_idx)
void
ewl_text_font_size_set(Ewl_Text *t, unsigned int size)
{
- Ewl_Text_Context *change;
+ Ewl_Text_Context *change;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- change = ewl_text_context_new();
- change->size = size;
+ change = ewl_text_context_new();
+ change->size = size;
- ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_SIZE, change);
- ewl_text_context_release(change);
+ ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_SIZE, change);
+ ewl_text_context_release(change);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1353,25 +1353,25 @@ ewl_text_font_size_set(Ewl_Text *t, unsigned int size)
void
ewl_text_font_size_apply(Ewl_Text *t, unsigned int size, unsigned int char_len)
{
- Ewl_Text_Context *tx;
+ Ewl_Text_Context *tx;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- if (char_len == 0)
- DRETURN(DLEVEL_STABLE);
+ if (char_len == 0)
+ DRETURN(DLEVEL_STABLE);
- tx = ewl_text_context_new();
- tx->size = size;
- ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_SIZE, tx,
- t->cursor_position, char_len);
- ewl_text_context_release(tx);
- t->dirty = TRUE;
+ tx = ewl_text_context_new();
+ tx->size = size;
+ ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_SIZE, tx,
+ t->cursor_position, char_len);
+ ewl_text_context_release(tx);
+ t->dirty = TRUE;
- ewl_widget_configure(EWL_WIDGET(t));
+ ewl_widget_configure(EWL_WIDGET(t));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1383,28 +1383,28 @@ ewl_text_font_size_apply(Ewl_Text *t, unsigned int size, unsigned int char_len)
unsigned int
ewl_text_font_size_get(Ewl_Text *t, unsigned int char_idx)
{
- Ewl_Text_Fmt_Node *fmt;
- int size = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, 0);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, 0);
-
- fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
- if (fmt && fmt->tx)
- {
- size = fmt->tx->size;
- }
- else
- {
- Ewl_Text_Context *tx;
-
- tx = ewl_text_context_default_create(t);
- size = tx->size;
- ewl_text_context_release(tx);
- }
-
- DRETURN_INT(size, DLEVEL_STABLE);
+ Ewl_Text_Fmt_Node *fmt;
+ int size = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, 0);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, 0);
+
+ fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
+ if (fmt && fmt->tx)
+ {
+ size = fmt->tx->size;
+ }
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ size = tx->size;
+ ewl_text_context_release(tx);
+ }
+
+ DRETURN_INT(size, DLEVEL_STABLE);
}
/**
@@ -1418,24 +1418,24 @@ ewl_text_font_size_get(Ewl_Text *t, unsigned int char_idx)
*/
void
ewl_text_color_set(Ewl_Text *t, unsigned int r, unsigned int g,
- unsigned int b, unsigned int a)
+ unsigned int b, unsigned int a)
{
- Ewl_Text_Context *change;
+ Ewl_Text_Context *change;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- change = ewl_text_context_new();
- change->color.r = r;
- change->color.g = g;
- change->color.b = b;
- change->color.a = a;
+ change = ewl_text_context_new();
+ change->color.r = r;
+ change->color.g = g;
+ change->color.b = b;
+ change->color.a = a;
- ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_COLOR, change);
- ewl_text_context_release(change);
+ ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_COLOR, change);
+ ewl_text_context_release(change);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1451,32 +1451,32 @@ ewl_text_color_set(Ewl_Text *t, unsigned int r, unsigned int g,
*/
void
ewl_text_color_apply(Ewl_Text *t, unsigned int r, unsigned int g,
- unsigned int b, unsigned int a,
- unsigned int char_len)
+ unsigned int b, unsigned int a,
+ unsigned int char_len)
{
- Ewl_Text_Context *tx;
+ Ewl_Text_Context *tx;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- if (char_len == 0)
- DRETURN(DLEVEL_STABLE);
+ if (char_len == 0)
+ DRETURN(DLEVEL_STABLE);
- tx = ewl_text_context_new();
- tx->color.r = r;
- tx->color.g = g;
- tx->color.b = b;
- tx->color.a = a;
+ tx = ewl_text_context_new();
+ tx->color.r = r;
+ tx->color.g = g;
+ tx->color.b = b;
+ tx->color.a = a;
- ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_COLOR, tx,
- t->cursor_position, char_len);
- ewl_text_context_release(tx);
- t->dirty = TRUE;
+ ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_COLOR, tx,
+ t->cursor_position, char_len);
+ ewl_text_context_release(tx);
+ t->dirty = TRUE;
- ewl_widget_configure(EWL_WIDGET(t));
+ ewl_widget_configure(EWL_WIDGET(t));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1491,36 +1491,36 @@ ewl_text_color_apply(Ewl_Text *t, unsigned int r, unsigned int g,
*/
void
ewl_text_color_get(Ewl_Text *t, unsigned int *r, unsigned int *g,
- unsigned int *b, unsigned int *a,
- unsigned int char_idx)
+ unsigned int *b, unsigned int *a,
+ unsigned int char_idx)
{
- Ewl_Text_Fmt_Node *fmt;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
-
- fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
- if (fmt && fmt->tx)
- {
- if (r) *r = fmt->tx->color.r;
- if (g) *g = fmt->tx->color.g;
- if (b) *b = fmt->tx->color.b;
- if (a) *a = fmt->tx->color.a;
- }
- else
- {
- Ewl_Text_Context *tx;
-
- tx = ewl_text_context_default_create(t);
- if (r) *r = tx->color.r;
- if (g) *g = tx->color.g;
- if (b) *b = tx->color.b;
- if (a) *a = tx->color.a;
- ewl_text_context_release(tx);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Text_Fmt_Node *fmt;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
+
+ fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
+ if (fmt && fmt->tx)
+ {
+ if (r) *r = fmt->tx->color.r;
+ if (g) *g = fmt->tx->color.g;
+ if (b) *b = fmt->tx->color.b;
+ if (a) *a = fmt->tx->color.a;
+ }
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ if (r) *r = tx->color.r;
+ if (g) *g = tx->color.g;
+ if (b) *b = tx->color.b;
+ if (a) *a = tx->color.a;
+ ewl_text_context_release(tx);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1532,19 +1532,19 @@ ewl_text_color_get(Ewl_Text *t, unsigned int *r, unsigned int *g,
void
ewl_text_align_set(Ewl_Text *t, unsigned int align)
{
- Ewl_Text_Context *change;
+ Ewl_Text_Context *change;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- change = ewl_text_context_new();
- change->align = align;
+ change = ewl_text_context_new();
+ change->align = align;
- ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_ALIGN, change);
- ewl_text_context_release(change);
+ ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_ALIGN, change);
+ ewl_text_context_release(change);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1558,25 +1558,25 @@ ewl_text_align_set(Ewl_Text *t, unsigned int align)
void
ewl_text_align_apply(Ewl_Text *t, unsigned int align, unsigned int char_len)
{
- Ewl_Text_Context *tx;
+ Ewl_Text_Context *tx;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- if (char_len == 0)
- DRETURN(DLEVEL_STABLE);
+ if (char_len == 0)
+ DRETURN(DLEVEL_STABLE);
- tx = ewl_text_context_new();
- tx->align = align;
- ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_ALIGN, tx,
- t->cursor_position, char_len);
- ewl_text_context_release(tx);
- t->dirty = TRUE;
+ tx = ewl_text_context_new();
+ tx->align = align;
+ ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_ALIGN, tx,
+ t->cursor_position, char_len);
+ ewl_text_context_release(tx);
+ t->dirty = TRUE;
- ewl_widget_configure(EWL_WIDGET(t));
+ ewl_widget_configure(EWL_WIDGET(t));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1588,28 +1588,28 @@ ewl_text_align_apply(Ewl_Text *t, unsigned int align, unsigned int char_len)
unsigned int
ewl_text_align_get(Ewl_Text *t, unsigned int char_idx)
{
- Ewl_Text_Fmt_Node *fmt;
- int align = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, 0);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, 0);
-
- fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
- if (fmt && fmt->tx)
- {
- align = fmt->tx->align;
- }
- else
- {
- Ewl_Text_Context *tx;
-
- tx = ewl_text_context_default_create(t);
- align = tx->align;
- ewl_text_context_release(tx);
- }
-
- DRETURN_INT(align, DLEVEL_STABLE);
+ Ewl_Text_Fmt_Node *fmt;
+ int align = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, 0);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, 0);
+
+ fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
+ if (fmt && fmt->tx)
+ {
+ align = fmt->tx->align;
+ }
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ align = tx->align;
+ ewl_text_context_release(tx);
+ }
+
+ DRETURN_INT(align, DLEVEL_STABLE);
}
/**
@@ -1621,19 +1621,19 @@ ewl_text_align_get(Ewl_Text *t, unsigned int char_idx)
void
ewl_text_styles_set(Ewl_Text *t, unsigned int styles)
{
- Ewl_Text_Context *change;
+ Ewl_Text_Context *change;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- change = ewl_text_context_new();
- change->styles = styles;
+ change = ewl_text_context_new();
+ change->styles = styles;
- ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_STYLES, change);
- ewl_text_context_release(change);
+ ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_STYLES, change);
+ ewl_text_context_release(change);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1647,25 +1647,25 @@ ewl_text_styles_set(Ewl_Text *t, unsigned int styles)
void
ewl_text_styles_apply(Ewl_Text *t, unsigned int styles, unsigned int char_len)
{
- Ewl_Text_Context *tx;
+ Ewl_Text_Context *tx;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- if (char_len == 0)
- DRETURN(DLEVEL_STABLE);
+ if (char_len == 0)
+ DRETURN(DLEVEL_STABLE);
- tx = ewl_text_context_new();
- tx->styles = styles;
- ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_STYLES, tx,
- t->cursor_position, char_len);
- ewl_text_context_release(tx);
- t->dirty = TRUE;
+ tx = ewl_text_context_new();
+ tx->styles = styles;
+ ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_STYLES, tx,
+ t->cursor_position, char_len);
+ ewl_text_context_release(tx);
+ t->dirty = TRUE;
- ewl_widget_configure(EWL_WIDGET(t));
+ ewl_widget_configure(EWL_WIDGET(t));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1679,22 +1679,22 @@ ewl_text_styles_apply(Ewl_Text *t, unsigned int styles, unsigned int char_len)
void
ewl_text_style_add(Ewl_Text *t, Ewl_Text_Style style, unsigned int char_len)
{
- Ewl_Text_Fmt_Node *fmt;
- unsigned int styles;
+ Ewl_Text_Fmt_Node *fmt;
+ unsigned int styles;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- fmt = ewl_text_fmt_get(t->formatting.nodes, t->cursor_position);
- if (!fmt || !fmt->tx) DRETURN(DLEVEL_STABLE);
+ fmt = ewl_text_fmt_get(t->formatting.nodes, t->cursor_position);
+ if (!fmt || !fmt->tx) DRETURN(DLEVEL_STABLE);
- styles = fmt->tx->styles;
- styles |= style;
+ styles = fmt->tx->styles;
+ styles |= style;
- ewl_text_styles_apply(t, styles, char_len);
+ ewl_text_styles_apply(t, styles, char_len);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1708,22 +1708,22 @@ ewl_text_style_add(Ewl_Text *t, Ewl_Text_Style style, unsigned int char_len)
void
ewl_text_style_del(Ewl_Text *t, Ewl_Text_Style style, unsigned int char_len)
{
- Ewl_Text_Fmt_Node *fmt;
- unsigned int styles;
+ Ewl_Text_Fmt_Node *fmt;
+ unsigned int styles;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- fmt = ewl_text_fmt_get(t->formatting.nodes, t->cursor_position);
- if (!fmt || !fmt->tx) DRETURN(DLEVEL_STABLE);
+ fmt = ewl_text_fmt_get(t->formatting.nodes, t->cursor_position);
+ if (!fmt || !fmt->tx) DRETURN(DLEVEL_STABLE);
- styles = fmt->tx->styles;
- styles &= ~style;
+ styles = fmt->tx->styles;
+ styles &= ~style;
- ewl_text_styles_apply(t, styles, char_len);
+ ewl_text_styles_apply(t, styles, char_len);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1737,22 +1737,22 @@ ewl_text_style_del(Ewl_Text *t, Ewl_Text_Style style, unsigned int char_len)
void
ewl_text_style_invert(Ewl_Text *t, Ewl_Text_Style style, unsigned int char_len)
{
- Ewl_Text_Fmt_Node *fmt;
- unsigned int styles;
+ Ewl_Text_Fmt_Node *fmt;
+ unsigned int styles;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- fmt = ewl_text_fmt_get(t->formatting.nodes, t->cursor_position);
- if (!fmt || !fmt->tx) DRETURN(DLEVEL_STABLE);
+ fmt = ewl_text_fmt_get(t->formatting.nodes, t->cursor_position);
+ if (!fmt || !fmt->tx) DRETURN(DLEVEL_STABLE);
- styles = fmt->tx->styles;
- styles ^= style;
+ styles = fmt->tx->styles;
+ styles ^= style;
- ewl_text_styles_apply(t, styles, char_len);
+ ewl_text_styles_apply(t, styles, char_len);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1765,17 +1765,17 @@ ewl_text_style_invert(Ewl_Text *t, Ewl_Text_Style style, unsigned int char_len)
unsigned int
ewl_text_style_has(Ewl_Text *t, Ewl_Text_Style style, unsigned int char_idx)
{
- Ewl_Text_Fmt_Node *fmt;
+ Ewl_Text_Fmt_Node *fmt;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, FALSE);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, FALSE);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, FALSE);
- fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
- if (!fmt || !fmt->tx)
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
+ if (!fmt || !fmt->tx)
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- DRETURN_INT((fmt->tx->styles & style), DLEVEL_STABLE);
+ DRETURN_INT((fmt->tx->styles & style), DLEVEL_STABLE);
}
/**
@@ -1787,28 +1787,28 @@ ewl_text_style_has(Ewl_Text *t, Ewl_Text_Style style, unsigned int char_idx)
unsigned int
ewl_text_styles_get(Ewl_Text *t, unsigned int char_idx)
{
- Ewl_Text_Fmt_Node *fmt;
- int styles = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, 0);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, 0);
-
- fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
- if (fmt && fmt->tx)
- {
- styles = fmt->tx->styles;
- }
- else
- {
- Ewl_Text_Context *tx;
-
- tx = ewl_text_context_default_create(t);
- styles = tx->styles;
- ewl_text_context_release(tx);
- }
-
- DRETURN_INT(styles, DLEVEL_STABLE);
+ Ewl_Text_Fmt_Node *fmt;
+ int styles = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, 0);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, 0);
+
+ fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
+ if (fmt && fmt->tx)
+ {
+ styles = fmt->tx->styles;
+ }
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ styles = tx->styles;
+ ewl_text_context_release(tx);
+ }
+
+ DRETURN_INT(styles, DLEVEL_STABLE);
}
/**
@@ -1820,27 +1820,27 @@ ewl_text_styles_get(Ewl_Text *t, unsigned int char_idx)
void
ewl_text_wrap_set(Ewl_Text *t, Ewl_Text_Wrap wrap)
{
- Ewl_Text_Context *change;
+ Ewl_Text_Context *change;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- change = ewl_text_context_new();
- change->wrap = wrap;
+ change = ewl_text_context_new();
+ change->wrap = wrap;
- if (wrap == EWL_TEXT_WRAP_NONE)
- ewl_object_fill_policy_set(EWL_OBJECT(t), EWL_FLAG_FILL_HFILL
- | EWL_FLAG_FILL_VFILL);
- else
- ewl_object_fill_policy_set(EWL_OBJECT(t), EWL_FLAG_FILL_HSHRINK
- | EWL_FLAG_FILL_HFILL
- | EWL_FLAG_FILL_VFILL);
+ if (wrap == EWL_TEXT_WRAP_NONE)
+ ewl_object_fill_policy_set(EWL_OBJECT(t), EWL_FLAG_FILL_HFILL
+ | EWL_FLAG_FILL_VFILL);
+ else
+ ewl_object_fill_policy_set(EWL_OBJECT(t), EWL_FLAG_FILL_HSHRINK
+ | EWL_FLAG_FILL_HFILL
+ | EWL_FLAG_FILL_VFILL);
- ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_WRAP, change);
- ewl_text_context_release(change);
+ ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_WRAP, change);
+ ewl_text_context_release(change);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1854,25 +1854,25 @@ ewl_text_wrap_set(Ewl_Text *t, Ewl_Text_Wrap wrap)
void
ewl_text_wrap_apply(Ewl_Text *t, Ewl_Text_Wrap wrap, unsigned int char_len)
{
- Ewl_Text_Context *tx;
+ Ewl_Text_Context *tx;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- if (char_len == 0)
- DRETURN(DLEVEL_STABLE);
+ if (char_len == 0)
+ DRETURN(DLEVEL_STABLE);
- tx = ewl_text_context_new();
- tx->wrap = wrap;
- ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_WRAP, tx,
- t->cursor_position, char_len);
- ewl_text_context_release(tx);
- t->dirty = TRUE;
+ tx = ewl_text_context_new();
+ tx->wrap = wrap;
+ ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_WRAP, tx,
+ t->cursor_position, char_len);
+ ewl_text_context_release(tx);
+ t->dirty = TRUE;
- ewl_widget_configure(EWL_WIDGET(t));
+ ewl_widget_configure(EWL_WIDGET(t));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1884,28 +1884,28 @@ ewl_text_wrap_apply(Ewl_Text *t, Ewl_Text_Wrap wrap, unsigned int char_len)
Ewl_Text_Wrap
ewl_text_wrap_get(Ewl_Text *t, unsigned int char_idx)
{
- Ewl_Text_Fmt_Node *fmt;
- int wrap = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, 0);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, 0);
-
- fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
- if (fmt && fmt->tx)
- {
- wrap = fmt->tx->wrap;
- }
- else
- {
- Ewl_Text_Context *tx;
-
- tx = ewl_text_context_default_create(t);
- wrap = tx->wrap;
- ewl_text_context_release(tx);
- }
-
- DRETURN_INT(wrap, DLEVEL_STABLE);
+ Ewl_Text_Fmt_Node *fmt;
+ int wrap = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, 0);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, 0);
+
+ fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
+ if (fmt && fmt->tx)
+ {
+ wrap = fmt->tx->wrap;
+ }
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ wrap = tx->wrap;
+ ewl_text_context_release(tx);
+ }
+
+ DRETURN_INT(wrap, DLEVEL_STABLE);
}
/**
@@ -1919,24 +1919,24 @@ ewl_text_wrap_get(Ewl_Text *t, unsigned int char_idx)
*/
void
ewl_text_bg_color_set(Ewl_Text *t, unsigned int r, unsigned int g,
- unsigned int b, unsigned int a)
+ unsigned int b, unsigned int a)
{
- Ewl_Text_Context *change;
+ Ewl_Text_Context *change;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- change = ewl_text_context_new();
- change->style_colors.bg.r = r;
- change->style_colors.bg.g = g;
- change->style_colors.bg.b = b;
- change->style_colors.bg.a = a;
+ change = ewl_text_context_new();
+ change->style_colors.bg.r = r;
+ change->style_colors.bg.g = g;
+ change->style_colors.bg.b = b;
+ change->style_colors.bg.a = a;
- ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_BG_COLOR, change);
- ewl_text_context_release(change);
+ ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_BG_COLOR, change);
+ ewl_text_context_release(change);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1952,32 +1952,32 @@ ewl_text_bg_color_set(Ewl_Text *t, unsigned int r, unsigned int g,
*/
void
ewl_text_bg_color_apply(Ewl_Text *t, unsigned int r, unsigned int g,
- unsigned int b, unsigned int a,
- unsigned int char_len)
+ unsigned int b, unsigned int a,
+ unsigned int char_len)
{
- Ewl_Text_Context *tx;
+ Ewl_Text_Context *tx;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- if (char_len == 0)
- DRETURN(DLEVEL_STABLE);
+ if (char_len == 0)
+ DRETURN(DLEVEL_STABLE);
- tx = ewl_text_context_new();
- tx->style_colors.bg.r = r;
- tx->style_colors.bg.g = g;
- tx->style_colors.bg.b = b;
- tx->style_colors.bg.a = a;
+ tx = ewl_text_context_new();
+ tx->style_colors.bg.r = r;
+ tx->style_colors.bg.g = g;
+ tx->style_colors.bg.b = b;
+ tx->style_colors.bg.a = a;
- ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_BG_COLOR,
- tx, t->cursor_position, char_len);
- ewl_text_context_release(tx);
- t->dirty = TRUE;
+ ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_BG_COLOR,
+ tx, t->cursor_position, char_len);
+ ewl_text_context_release(tx);
+ t->dirty = TRUE;
- ewl_widget_configure(EWL_WIDGET(t));
+ ewl_widget_configure(EWL_WIDGET(t));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1992,36 +1992,36 @@ ewl_text_bg_color_apply(Ewl_Text *t, unsigned int r, unsigned int g,
*/
void
ewl_text_bg_color_get(Ewl_Text *t, unsigned int *r, unsigned int *g,
- unsigned int *b, unsigned int *a,
- unsigned int char_idx)
+ unsigned int *b, unsigned int *a,
+ unsigned int char_idx)
{
- Ewl_Text_Fmt_Node *fmt;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
-
- fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
- if (fmt && fmt->tx)
- {
- if (r) *r = fmt->tx->style_colors.bg.r;
- if (g) *g = fmt->tx->style_colors.bg.g;
- if (b) *b = fmt->tx->style_colors.bg.b;
- if (a) *a = fmt->tx->style_colors.bg.a;
- }
- else
- {
- Ewl_Text_Context *tx;
-
- tx = ewl_text_context_default_create(t);
- if (r) *r = tx->style_colors.bg.r;
- if (g) *g = tx->style_colors.bg.g;
- if (b) *b = tx->style_colors.bg.b;
- if (a) *a = tx->style_colors.bg.a;
- ewl_text_context_release(tx);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Text_Fmt_Node *fmt;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
+
+ fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
+ if (fmt && fmt->tx)
+ {
+ if (r) *r = fmt->tx->style_colors.bg.r;
+ if (g) *g = fmt->tx->style_colors.bg.g;
+ if (b) *b = fmt->tx->style_colors.bg.b;
+ if (a) *a = fmt->tx->style_colors.bg.a;
+ }
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ if (r) *r = tx->style_colors.bg.r;
+ if (g) *g = tx->style_colors.bg.g;
+ if (b) *b = tx->style_colors.bg.b;
+ if (a) *a = tx->style_colors.bg.a;
+ ewl_text_context_release(tx);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2035,24 +2035,24 @@ ewl_text_bg_color_get(Ewl_Text *t, unsigned int *r, unsigned int *g,
*/
void
ewl_text_glow_color_set(Ewl_Text *t, unsigned int r, unsigned int g,
- unsigned int b, unsigned int a)
+ unsigned int b, unsigned int a)
{
- Ewl_Text_Context *change;
+ Ewl_Text_Context *change;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- change = ewl_text_context_new();
- change->style_colors.glow.r = r;
- change->style_colors.glow.g = g;
- change->style_colors.glow.b = b;
- change->style_colors.glow.a = a;
+ change = ewl_text_context_new();
+ change->style_colors.glow.r = r;
+ change->style_colors.glow.g = g;
+ change->style_colors.glow.b = b;
+ change->style_colors.glow.a = a;
- ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_GLOW_COLOR, change);
- ewl_text_context_release(change);
+ ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_GLOW_COLOR, change);
+ ewl_text_context_release(change);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2068,32 +2068,32 @@ ewl_text_glow_color_set(Ewl_Text *t, unsigned int r, unsigned int g,
*/
void
ewl_text_glow_color_apply(Ewl_Text *t, unsigned int r, unsigned int g,
- unsigned int b, unsigned int a,
- unsigned int char_len)
+ unsigned int b, unsigned int a,
+ unsigned int char_len)
{
- Ewl_Text_Context *tx;
+ Ewl_Text_Context *tx;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- if (char_len == 0)
- DRETURN(DLEVEL_STABLE);
+ if (char_len == 0)
+ DRETURN(DLEVEL_STABLE);
- tx = ewl_text_context_new();
- tx->style_colors.glow.r = r;
- tx->style_colors.glow.g = g;
- tx->style_colors.glow.b = b;
- tx->style_colors.glow.a = a;
+ tx = ewl_text_context_new();
+ tx->style_colors.glow.r = r;
+ tx->style_colors.glow.g = g;
+ tx->style_colors.glow.b = b;
+ tx->style_colors.glow.a = a;
- ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_GLOW_COLOR, tx,
- t->cursor_position, char_len);
- ewl_text_context_release(tx);
- t->dirty = TRUE;
+ ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_GLOW_COLOR, tx,
+ t->cursor_position, char_len);
+ ewl_text_context_release(tx);
+ t->dirty = TRUE;
- ewl_widget_configure(EWL_WIDGET(t));
+ ewl_widget_configure(EWL_WIDGET(t));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2108,36 +2108,36 @@ ewl_text_glow_color_apply(Ewl_Text *t, unsigned int r, unsigned int g,
*/
void
ewl_text_glow_color_get(Ewl_Text *t, unsigned int *r, unsigned int *g,
- unsigned int *b, unsigned int *a,
- unsigned int char_idx)
+ unsigned int *b, unsigned int *a,
+ unsigned int char_idx)
{
- Ewl_Text_Fmt_Node *fmt;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
-
- fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
- if (fmt && fmt->tx)
- {
- if (r) *r = fmt->tx->style_colors.glow.r;
- if (g) *g = fmt->tx->style_colors.glow.g;
- if (b) *b = fmt->tx->style_colors.glow.b;
- if (a) *a = fmt->tx->style_colors.glow.a;
- }
- else
- {
- Ewl_Text_Context *tx;
-
- tx = ewl_text_context_default_create(t);
- if (r) *r = tx->style_colors.glow.r;
- if (g) *g = tx->style_colors.glow.g;
- if (b) *b = tx->style_colors.glow.b;
- if (a) *a = tx->style_colors.glow.a;
- ewl_text_context_release(tx);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Text_Fmt_Node *fmt;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
+
+ fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
+ if (fmt && fmt->tx)
+ {
+ if (r) *r = fmt->tx->style_colors.glow.r;
+ if (g) *g = fmt->tx->style_colors.glow.g;
+ if (b) *b = fmt->tx->style_colors.glow.b;
+ if (a) *a = fmt->tx->style_colors.glow.a;
+ }
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ if (r) *r = tx->style_colors.glow.r;
+ if (g) *g = tx->style_colors.glow.g;
+ if (b) *b = tx->style_colors.glow.b;
+ if (a) *a = tx->style_colors.glow.a;
+ ewl_text_context_release(tx);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2151,24 +2151,24 @@ ewl_text_glow_color_get(Ewl_Text *t, unsigned int *r, unsigned int *g,
*/
void
ewl_text_outline_color_set(Ewl_Text *t, unsigned int r, unsigned int g,
- unsigned int b, unsigned int a)
+ unsigned int b, unsigned int a)
{
- Ewl_Text_Context *change;
+ Ewl_Text_Context *change;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- change = ewl_text_context_new();
- change->style_colors.outline.r = r;
- change->style_colors.outline.g = g;
- change->style_colors.outline.b = b;
- change->style_colors.outline.a = a;
+ change = ewl_text_context_new();
+ change->style_colors.outline.r = r;
+ change->style_colors.outline.g = g;
+ change->style_colors.outline.b = b;
+ change->style_colors.outline.a = a;
- ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_OUTLINE_COLOR, change);
- ewl_text_context_release(change);
+ ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_OUTLINE_COLOR, change);
+ ewl_text_context_release(change);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2184,32 +2184,32 @@ ewl_text_outline_color_set(Ewl_Text *t, unsigned int r, unsigned int g,
*/
void
ewl_text_outline_color_apply(Ewl_Text *t, unsigned int r, unsigned int g,
- unsigned int b, unsigned int a,
- unsigned int char_len)
+ unsigned int b, unsigned int a,
+ unsigned int char_len)
{
- Ewl_Text_Context *tx;
+ Ewl_Text_Context *tx;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- if (char_len == 0)
- DRETURN(DLEVEL_STABLE);
+ if (char_len == 0)
+ DRETURN(DLEVEL_STABLE);
- tx = ewl_text_context_new();
- tx->style_colors.outline.r = r;
- tx->style_colors.outline.g = g;
- tx->style_colors.outline.b = b;
- tx->style_colors.outline.a = a;
+ tx = ewl_text_context_new();
+ tx->style_colors.outline.r = r;
+ tx->style_colors.outline.g = g;
+ tx->style_colors.outline.b = b;
+ tx->style_colors.outline.a = a;
- ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_OUTLINE_COLOR,
- tx, t->cursor_position, char_len);
- ewl_text_context_release(tx);
- t->dirty = TRUE;
+ ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_OUTLINE_COLOR,
+ tx, t->cursor_position, char_len);
+ ewl_text_context_release(tx);
+ t->dirty = TRUE;
- ewl_widget_configure(EWL_WIDGET(t));
+ ewl_widget_configure(EWL_WIDGET(t));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2224,36 +2224,36 @@ ewl_text_outline_color_apply(Ewl_Text *t, unsigned int r, unsigned int g,
*/
void
ewl_text_outline_color_get(Ewl_Text *t, unsigned int *r, unsigned int *g,
- unsigned int *b, unsigned int *a,
- unsigned int char_idx)
+ unsigned int *b, unsigned int *a,
+ unsigned int char_idx)
{
- Ewl_Text_Fmt_Node *fmt;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
-
- fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
- if (fmt && fmt->tx)
- {
- if (r) *r = fmt->tx->style_colors.outline.r;
- if (g) *g = fmt->tx->style_colors.outline.g;
- if (b) *b = fmt->tx->style_colors.outline.b;
- if (a) *a = fmt->tx->style_colors.outline.a;
- }
- else
- {
- Ewl_Text_Context *tx;
-
- tx = ewl_text_context_default_create(t);
- if (r) *r = tx->style_colors.outline.r;
- if (g) *g = tx->style_colors.outline.g;
- if (b) *b = tx->style_colors.outline.b;
- if (a) *a = tx->style_colors.outline.a;
- ewl_text_context_release(tx);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Text_Fmt_Node *fmt;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
+
+ fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
+ if (fmt && fmt->tx)
+ {
+ if (r) *r = fmt->tx->style_colors.outline.r;
+ if (g) *g = fmt->tx->style_colors.outline.g;
+ if (b) *b = fmt->tx->style_colors.outline.b;
+ if (a) *a = fmt->tx->style_colors.outline.a;
+ }
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ if (r) *r = tx->style_colors.outline.r;
+ if (g) *g = tx->style_colors.outline.g;
+ if (b) *b = tx->style_colors.outline.b;
+ if (a) *a = tx->style_colors.outline.a;
+ ewl_text_context_release(tx);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2267,24 +2267,24 @@ ewl_text_outline_color_get(Ewl_Text *t, unsigned int *r, unsigned int *g,
*/
void
ewl_text_shadow_color_set(Ewl_Text *t, unsigned int r, unsigned int g,
- unsigned int b, unsigned int a)
+ unsigned int b, unsigned int a)
{
- Ewl_Text_Context *change;
+ Ewl_Text_Context *change;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- change = ewl_text_context_new();
- change->style_colors.shadow.r = r;
- change->style_colors.shadow.g = g;
- change->style_colors.shadow.b = b;
- change->style_colors.shadow.a = a;
+ change = ewl_text_context_new();
+ change->style_colors.shadow.r = r;
+ change->style_colors.shadow.g = g;
+ change->style_colors.shadow.b = b;
+ change->style_colors.shadow.a = a;
- ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_SHADOW_COLOR, change);
- ewl_text_context_release(change);
+ ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_SHADOW_COLOR, change);
+ ewl_text_context_release(change);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2300,32 +2300,32 @@ ewl_text_shadow_color_set(Ewl_Text *t, unsigned int r, unsigned int g,
*/
void
ewl_text_shadow_color_apply(Ewl_Text *t, unsigned int r, unsigned int g,
- unsigned int b, unsigned int a,
- unsigned int char_len)
+ unsigned int b, unsigned int a,
+ unsigned int char_len)
{
- Ewl_Text_Context *tx;
+ Ewl_Text_Context *tx;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- if (char_len == 0)
- DRETURN(DLEVEL_STABLE);
+ if (char_len == 0)
+ DRETURN(DLEVEL_STABLE);
- tx = ewl_text_context_new();
- tx->style_colors.shadow.r = r;
- tx->style_colors.shadow.g = g;
- tx->style_colors.shadow.b = b;
- tx->style_colors.shadow.a = a;
+ tx = ewl_text_context_new();
+ tx->style_colors.shadow.r = r;
+ tx->style_colors.shadow.g = g;
+ tx->style_colors.shadow.b = b;
+ tx->style_colors.shadow.a = a;
- ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_SHADOW_COLOR,
- tx, t->cursor_position, char_len);
- ewl_text_context_release(tx);
- t->dirty = TRUE;
+ ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_SHADOW_COLOR,
+ tx, t->cursor_position, char_len);
+ ewl_text_context_release(tx);
+ t->dirty = TRUE;
- ewl_widget_configure(EWL_WIDGET(t));
+ ewl_widget_configure(EWL_WIDGET(t));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2340,36 +2340,36 @@ ewl_text_shadow_color_apply(Ewl_Text *t, unsigned int r, unsigned int g,
*/
void
ewl_text_shadow_color_get(Ewl_Text *t, unsigned int *r, unsigned int *g,
- unsigned int *b, unsigned int *a,
- unsigned int char_idx)
+ unsigned int *b, unsigned int *a,
+ unsigned int char_idx)
{
- Ewl_Text_Fmt_Node *fmt;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
-
- fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
- if (fmt && fmt->tx)
- {
- if (r) *r = fmt->tx->style_colors.shadow.r;
- if (g) *g = fmt->tx->style_colors.shadow.g;
- if (b) *b = fmt->tx->style_colors.shadow.b;
- if (a) *a = fmt->tx->style_colors.shadow.a;
- }
- else
- {
- Ewl_Text_Context *tx;
-
- tx = ewl_text_context_default_create(t);
- if (r) *r = tx->style_colors.shadow.r;
- if (g) *g = tx->style_colors.shadow.g;
- if (b) *b = tx->style_colors.shadow.b;
- if (a) *a = tx->style_colors.shadow.a;
- ewl_text_context_release(tx);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Text_Fmt_Node *fmt;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
+
+ fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
+ if (fmt && fmt->tx)
+ {
+ if (r) *r = fmt->tx->style_colors.shadow.r;
+ if (g) *g = fmt->tx->style_colors.shadow.g;
+ if (b) *b = fmt->tx->style_colors.shadow.b;
+ if (a) *a = fmt->tx->style_colors.shadow.a;
+ }
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ if (r) *r = tx->style_colors.shadow.r;
+ if (g) *g = tx->style_colors.shadow.g;
+ if (b) *b = tx->style_colors.shadow.b;
+ if (a) *a = tx->style_colors.shadow.a;
+ ewl_text_context_release(tx);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2383,24 +2383,24 @@ ewl_text_shadow_color_get(Ewl_Text *t, unsigned int *r, unsigned int *g,
*/
void
ewl_text_strikethrough_color_set(Ewl_Text *t, unsigned int r, unsigned int g,
- unsigned int b, unsigned int a)
+ unsigned int b, unsigned int a)
{
- Ewl_Text_Context *change;
+ Ewl_Text_Context *change;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- change = ewl_text_context_new();
- change->style_colors.strikethrough.r = r;
- change->style_colors.strikethrough.g = g;
- change->style_colors.strikethrough.b = b;
- change->style_colors.strikethrough.a = a;
+ change = ewl_text_context_new();
+ change->style_colors.strikethrough.r = r;
+ change->style_colors.strikethrough.g = g;
+ change->style_colors.strikethrough.b = b;
+ change->style_colors.strikethrough.a = a;
- ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_STRIKETHROUGH_COLOR, change);
- ewl_text_context_release(change);
+ ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_STRIKETHROUGH_COLOR, change);
+ ewl_text_context_release(change);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2416,32 +2416,32 @@ ewl_text_strikethrough_color_set(Ewl_Text *t, unsigned int r, unsigned int g,
*/
void
ewl_text_strikethrough_color_apply(Ewl_Text *t, unsigned int r, unsigned int g,
- unsigned int b, unsigned int a,
- unsigned int char_len)
+ unsigned int b, unsigned int a,
+ unsigned int char_len)
{
- Ewl_Text_Context *tx;
+ Ewl_Text_Context *tx;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- if (char_len == 0)
- DRETURN(DLEVEL_STABLE);
+ if (char_len == 0)
+ DRETURN(DLEVEL_STABLE);
- tx = ewl_text_context_new();
- tx->style_colors.strikethrough.r = r;
- tx->style_colors.strikethrough.g = g;
- tx->style_colors.strikethrough.b = b;
- tx->style_colors.strikethrough.a = a;
+ tx = ewl_text_context_new();
+ tx->style_colors.strikethrough.r = r;
+ tx->style_colors.strikethrough.g = g;
+ tx->style_colors.strikethrough.b = b;
+ tx->style_colors.strikethrough.a = a;
- ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_STRIKETHROUGH_COLOR,
- tx, t->cursor_position, char_len);
- ewl_text_context_release(tx);
- t->dirty = TRUE;
+ ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_STRIKETHROUGH_COLOR,
+ tx, t->cursor_position, char_len);
+ ewl_text_context_release(tx);
+ t->dirty = TRUE;
- ewl_widget_configure(EWL_WIDGET(t));
+ ewl_widget_configure(EWL_WIDGET(t));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2456,36 +2456,36 @@ ewl_text_strikethrough_color_apply(Ewl_Text *t, unsigned int r, unsigned int g,
*/
void
ewl_text_strikethrough_color_get(Ewl_Text *t, unsigned int *r, unsigned int *g,
- unsigned int *b, unsigned int *a,
- unsigned int char_idx)
+ unsigned int *b, unsigned int *a,
+ unsigned int char_idx)
{
- Ewl_Text_Fmt_Node *fmt;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
-
- fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
- if (fmt && fmt->tx)
- {
- if (r) *r = fmt->tx->style_colors.strikethrough.r;
- if (g) *g = fmt->tx->style_colors.strikethrough.g;
- if (b) *b = fmt->tx->style_colors.strikethrough.b;
- if (a) *a = fmt->tx->style_colors.strikethrough.a;
- }
- else
- {
- Ewl_Text_Context *tx;
-
- tx = ewl_text_context_default_create(t);
- if (r) *r = tx->style_colors.strikethrough.r;
- if (g) *g = tx->style_colors.strikethrough.g;
- if (b) *b = tx->style_colors.strikethrough.b;
- if (a) *a = tx->style_colors.strikethrough.a;
- ewl_text_context_release(tx);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Text_Fmt_Node *fmt;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
+
+ fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
+ if (fmt && fmt->tx)
+ {
+ if (r) *r = fmt->tx->style_colors.strikethrough.r;
+ if (g) *g = fmt->tx->style_colors.strikethrough.g;
+ if (b) *b = fmt->tx->style_colors.strikethrough.b;
+ if (a) *a = fmt->tx->style_colors.strikethrough.a;
+ }
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ if (r) *r = tx->style_colors.strikethrough.r;
+ if (g) *g = tx->style_colors.strikethrough.g;
+ if (b) *b = tx->style_colors.strikethrough.b;
+ if (a) *a = tx->style_colors.strikethrough.a;
+ ewl_text_context_release(tx);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2499,24 +2499,24 @@ ewl_text_strikethrough_color_get(Ewl_Text *t, unsigned int *r, unsigned int *g,
*/
void
ewl_text_underline_color_set(Ewl_Text *t, unsigned int r, unsigned int g,
- unsigned int b, unsigned int a)
+ unsigned int b, unsigned int a)
{
- Ewl_Text_Context *change;
+ Ewl_Text_Context *change;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- change = ewl_text_context_new();
- change->style_colors.underline.r = r;
- change->style_colors.underline.g = g;
- change->style_colors.underline.b = b;
- change->style_colors.underline.a = a;
+ change = ewl_text_context_new();
+ change->style_colors.underline.r = r;
+ change->style_colors.underline.g = g;
+ change->style_colors.underline.b = b;
+ change->style_colors.underline.a = a;
- ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_UNDERLINE_COLOR, change);
- ewl_text_context_release(change);
+ ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_UNDERLINE_COLOR, change);
+ ewl_text_context_release(change);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2532,32 +2532,32 @@ ewl_text_underline_color_set(Ewl_Text *t, unsigned int r, unsigned int g,
*/
void
ewl_text_underline_color_apply(Ewl_Text *t, unsigned int r, unsigned int g,
- unsigned int b, unsigned int a,
- unsigned int char_len)
+ unsigned int b, unsigned int a,
+ unsigned int char_len)
{
- Ewl_Text_Context *tx;
+ Ewl_Text_Context *tx;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- if (char_len == 0)
- DRETURN(DLEVEL_STABLE);
+ if (char_len == 0)
+ DRETURN(DLEVEL_STABLE);
- tx = ewl_text_context_new();
- tx->style_colors.underline.r = r;
- tx->style_colors.underline.g = g;
- tx->style_colors.underline.b = b;
- tx->style_colors.underline.a = a;
+ tx = ewl_text_context_new();
+ tx->style_colors.underline.r = r;
+ tx->style_colors.underline.g = g;
+ tx->style_colors.underline.b = b;
+ tx->style_colors.underline.a = a;
- ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_UNDERLINE_COLOR,
- tx, t->cursor_position, char_len);
- ewl_text_context_release(tx);
- t->dirty = TRUE;
+ ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_UNDERLINE_COLOR,
+ tx, t->cursor_position, char_len);
+ ewl_text_context_release(tx);
+ t->dirty = TRUE;
- ewl_widget_configure(EWL_WIDGET(t));
+ ewl_widget_configure(EWL_WIDGET(t));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2572,36 +2572,36 @@ ewl_text_underline_color_apply(Ewl_Text *t, unsigned int r, unsigned int g,
*/
void
ewl_text_underline_color_get(Ewl_Text *t, unsigned int *r, unsigned int *g,
- unsigned int *b, unsigned int *a,
- unsigned int char_idx)
+ unsigned int *b, unsigned int *a,
+ unsigned int char_idx)
{
- Ewl_Text_Fmt_Node *fmt;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
-
- fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
- if (fmt && fmt->tx)
- {
- if (r) *r = fmt->tx->style_colors.outline.r;
- if (g) *g = fmt->tx->style_colors.outline.g;
- if (b) *b = fmt->tx->style_colors.outline.b;
- if (a) *a = fmt->tx->style_colors.outline.a;
- }
- else
- {
- Ewl_Text_Context *tx;
-
- tx = ewl_text_context_default_create(t);
- if (r) *r = tx->style_colors.outline.r;
- if (g) *g = tx->style_colors.outline.g;
- if (b) *b = tx->style_colors.outline.b;
- if (a) *a = tx->style_colors.outline.a;
- ewl_text_context_release(tx);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Text_Fmt_Node *fmt;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
+
+ fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
+ if (fmt && fmt->tx)
+ {
+ if (r) *r = fmt->tx->style_colors.outline.r;
+ if (g) *g = fmt->tx->style_colors.outline.g;
+ if (b) *b = fmt->tx->style_colors.outline.b;
+ if (a) *a = fmt->tx->style_colors.outline.a;
+ }
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ if (r) *r = tx->style_colors.outline.r;
+ if (g) *g = tx->style_colors.outline.g;
+ if (b) *b = tx->style_colors.outline.b;
+ if (a) *a = tx->style_colors.outline.a;
+ ewl_text_context_release(tx);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2615,24 +2615,24 @@ ewl_text_underline_color_get(Ewl_Text *t, unsigned int *r, unsigned int *g,
*/
void
ewl_text_double_underline_color_set(Ewl_Text *t, unsigned int r, unsigned int g,
- unsigned int b, unsigned int a)
+ unsigned int b, unsigned int a)
{
- Ewl_Text_Context *change;
+ Ewl_Text_Context *change;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- change = ewl_text_context_new();
- change->style_colors.double_underline.r = r;
- change->style_colors.double_underline.g = g;
- change->style_colors.double_underline.b = b;
- change->style_colors.double_underline.a = a;
+ change = ewl_text_context_new();
+ change->style_colors.double_underline.r = r;
+ change->style_colors.double_underline.g = g;
+ change->style_colors.double_underline.b = b;
+ change->style_colors.double_underline.a = a;
- ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_DOUBLE_UNDERLINE_COLOR, change);
- ewl_text_context_release(change);
+ ewl_text_current_fmt_set(t, EWL_TEXT_CONTEXT_MASK_DOUBLE_UNDERLINE_COLOR, change);
+ ewl_text_context_release(change);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2648,32 +2648,32 @@ ewl_text_double_underline_color_set(Ewl_Text *t, unsigned int r, unsigned int g,
*/
void
ewl_text_double_underline_color_apply(Ewl_Text *t, unsigned int r, unsigned int g,
- unsigned int b, unsigned int a,
- unsigned int char_len)
+ unsigned int b, unsigned int a,
+ unsigned int char_len)
{
- Ewl_Text_Context *tx;
+ Ewl_Text_Context *tx;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- if (char_len == 0)
- DRETURN(DLEVEL_STABLE);
+ if (char_len == 0)
+ DRETURN(DLEVEL_STABLE);
- tx = ewl_text_context_new();
- tx->style_colors.double_underline.r = r;
- tx->style_colors.double_underline.g = g;
- tx->style_colors.double_underline.b = b;
- tx->style_colors.double_underline.a = a;
+ tx = ewl_text_context_new();
+ tx->style_colors.double_underline.r = r;
+ tx->style_colors.double_underline.g = g;
+ tx->style_colors.double_underline.b = b;
+ tx->style_colors.double_underline.a = a;
- ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_DOUBLE_UNDERLINE_COLOR,
- tx, t->cursor_position, char_len);
- ewl_text_context_release(tx);
- t->dirty = TRUE;
+ ewl_text_fmt_apply(t->formatting.nodes, EWL_TEXT_CONTEXT_MASK_DOUBLE_UNDERLINE_COLOR,
+ tx, t->cursor_position, char_len);
+ ewl_text_context_release(tx);
+ t->dirty = TRUE;
- ewl_widget_configure(EWL_WIDGET(t));
+ ewl_widget_configure(EWL_WIDGET(t));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2688,62 +2688,62 @@ ewl_text_double_underline_color_apply(Ewl_Text *t, unsigned int r, unsigned int
*/
void
ewl_text_double_underline_color_get(Ewl_Text *t, unsigned int *r, unsigned int *g,
- unsigned int *b, unsigned int *a,
- unsigned int char_idx)
+ unsigned int *b, unsigned int *a,
+ unsigned int char_idx)
{
- Ewl_Text_Fmt_Node *fmt;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
-
- fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
- if (fmt && fmt->tx)
- {
- if (r) *r = fmt->tx->style_colors.double_underline.r;
- if (g) *g = fmt->tx->style_colors.double_underline.g;
- if (b) *b = fmt->tx->style_colors.double_underline.b;
- if (a) *a = fmt->tx->style_colors.double_underline.a;
- }
- else
- {
- Ewl_Text_Context *tx;
-
- tx = ewl_text_context_default_create(t);
- if (r) *r = tx->style_colors.double_underline.r;
- if (g) *g = tx->style_colors.double_underline.g;
- if (b) *b = tx->style_colors.double_underline.b;
- if (a) *a = tx->style_colors.double_underline.a;
- ewl_text_context_release(tx);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Text_Fmt_Node *fmt;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
+
+ fmt = ewl_text_fmt_get(t->formatting.nodes, char_idx);
+ if (fmt && fmt->tx)
+ {
+ if (r) *r = fmt->tx->style_colors.double_underline.r;
+ if (g) *g = fmt->tx->style_colors.double_underline.g;
+ if (b) *b = fmt->tx->style_colors.double_underline.b;
+ if (a) *a = fmt->tx->style_colors.double_underline.a;
+ }
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ if (r) *r = tx->style_colors.double_underline.r;
+ if (g) *g = tx->style_colors.double_underline.g;
+ if (b) *b = tx->style_colors.double_underline.b;
+ if (a) *a = tx->style_colors.double_underline.a;
+ ewl_text_context_release(tx);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_text_theme_color_get(Ewl_Text *t, Ewl_Color_Set *color, char *name)
{
- char buf[128];
- int pos;
+ char buf[128];
+ int pos;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- pos = strlen(name) + 1;
- snprintf(buf, sizeof(buf), "%s/r", name);
- color->r = ewl_theme_data_int_get(EWL_WIDGET(t), buf);
+ pos = strlen(name) + 1;
+ snprintf(buf, sizeof(buf), "%s/r", name);
+ color->r = ewl_theme_data_int_get(EWL_WIDGET(t), buf);
- buf[pos] = 'g';
- color->g = ewl_theme_data_int_get(EWL_WIDGET(t), buf);
+ buf[pos] = 'g';
+ color->g = ewl_theme_data_int_get(EWL_WIDGET(t), buf);
- buf[pos] = 'b';
- color->b = ewl_theme_data_int_get(EWL_WIDGET(t), buf);
+ buf[pos] = 'b';
+ color->b = ewl_theme_data_int_get(EWL_WIDGET(t), buf);
- buf[pos] = 'a';
- color->a = ewl_theme_data_int_get(EWL_WIDGET(t), buf);
+ buf[pos] = 'a';
+ color->a = ewl_theme_data_int_get(EWL_WIDGET(t), buf);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/*
@@ -2754,104 +2754,104 @@ ewl_text_theme_color_get(Ewl_Text *t, Ewl_Color_Set *color, char *name)
static Ewl_Text_Context *
ewl_text_context_default_create(Ewl_Text *t)
{
- const char *font;
- Ewl_Text_Context *tx = NULL, *tmp;
- int i;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, NULL);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, NULL);
-
- if (ewl_text_default_context)
- {
- ewl_text_context_acquire(ewl_text_default_context);
- DRETURN_PTR(ewl_text_default_context, DLEVEL_STABLE);
- }
-
- tmp = ewl_text_context_new();
-
- /* handle default values */
- font = ewl_theme_data_str_get(EWL_WIDGET(t), "font");
- if (font) tmp->font = ecore_string_instance(font);
- tmp->font_source = NULL;
- tmp->size = ewl_theme_data_int_get(EWL_WIDGET(t), "font_size");
-
- ewl_text_theme_color_get(t, &(tmp->color), "color");
- i = ewl_theme_data_int_get(EWL_WIDGET(t), "underline");
- if (i)
- {
- tmp->styles |= EWL_TEXT_STYLE_UNDERLINE;
- ewl_text_theme_color_get(t, &(tmp->style_colors.underline),
- "underline/color");
- }
-
- i = ewl_theme_data_int_get(EWL_WIDGET(t), "double_underline");
- if (i)
- {
- tmp->styles |= EWL_TEXT_STYLE_DOUBLE_UNDERLINE;
- ewl_text_theme_color_get(t, &(tmp->style_colors.double_underline),
- "double_underline/color");
- }
-
- i = ewl_theme_data_int_get(EWL_WIDGET(t), "strikethrough");
- if (i)
- {
- tmp->styles |= EWL_TEXT_STYLE_STRIKETHROUGH;
- ewl_text_theme_color_get(t, &(tmp->style_colors.strikethrough),
- "strikethrough/color");
- }
-
- i = ewl_theme_data_int_get(EWL_WIDGET(t), "shadow");
- if (i)
- {
- tmp->styles |= EWL_TEXT_STYLE_SHADOW;
- ewl_text_theme_color_get(t, &(tmp->style_colors.shadow),
- "shadow/color");
- }
-
- i = ewl_theme_data_int_get(EWL_WIDGET(t), "soft_shadow");
- if (i)
- {
- tmp->styles |= EWL_TEXT_STYLE_SOFT_SHADOW;
- ewl_text_theme_color_get(t, &(tmp->style_colors.shadow),
- "shadow/color");
- }
-
- i = ewl_theme_data_int_get(EWL_WIDGET(t), "far_shadow");
- if (i)
- {
- tmp->styles |= EWL_TEXT_STYLE_FAR_SHADOW;
- ewl_text_theme_color_get(t, &(tmp->style_colors.shadow),
- "shadow/color");
- }
-
- i = ewl_theme_data_int_get(EWL_WIDGET(t), "outline");
- if (i)
- {
- tmp->styles |= EWL_TEXT_STYLE_OUTLINE;
- ewl_text_theme_color_get(t, &(tmp->style_colors.outline),
- "outline/color");
- }
-
- i = ewl_theme_data_int_get(EWL_WIDGET(t), "glow");
- if (i)
- {
- tmp->styles |= EWL_TEXT_STYLE_GLOW;
- ewl_text_theme_color_get(t, &(tmp->style_colors.glow),
- "glow/color");
- }
-
- /* XXX grab the alignment and wrap data from the theme here */
- tmp->align = EWL_FLAG_ALIGN_LEFT;
-
- tx = ewl_text_context_find(tmp, EWL_TEXT_CONTEXT_MASK_NONE, NULL);
- ewl_text_context_release(tmp);
-
- /* setup the default context and acquire a ref on it so
- * it won't go away */
- ewl_text_default_context = tx;
-
- DRETURN_PTR(tx, DLEVEL_STABLE);
+ const char *font;
+ Ewl_Text_Context *tx = NULL, *tmp;
+ int i;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, NULL);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, NULL);
+
+ if (ewl_text_default_context)
+ {
+ ewl_text_context_acquire(ewl_text_default_context);
+ DRETURN_PTR(ewl_text_default_context, DLEVEL_STABLE);
+ }
+
+ tmp = ewl_text_context_new();
+
+ /* handle default values */
+ font = ewl_theme_data_str_get(EWL_WIDGET(t), "font");
+ if (font) tmp->font = ecore_string_instance(font);
+ tmp->font_source = NULL;
+ tmp->size = ewl_theme_data_int_get(EWL_WIDGET(t), "font_size");
+
+ ewl_text_theme_color_get(t, &(tmp->color), "color");
+ i = ewl_theme_data_int_get(EWL_WIDGET(t), "underline");
+ if (i)
+ {
+ tmp->styles |= EWL_TEXT_STYLE_UNDERLINE;
+ ewl_text_theme_color_get(t, &(tmp->style_colors.underline),
+ "underline/color");
+ }
+
+ i = ewl_theme_data_int_get(EWL_WIDGET(t), "double_underline");
+ if (i)
+ {
+ tmp->styles |= EWL_TEXT_STYLE_DOUBLE_UNDERLINE;
+ ewl_text_theme_color_get(t, &(tmp->style_colors.double_underline),
+ "double_underline/color");
+ }
+
+ i = ewl_theme_data_int_get(EWL_WIDGET(t), "strikethrough");
+ if (i)
+ {
+ tmp->styles |= EWL_TEXT_STYLE_STRIKETHROUGH;
+ ewl_text_theme_color_get(t, &(tmp->style_colors.strikethrough),
+ "strikethrough/color");
+ }
+
+ i = ewl_theme_data_int_get(EWL_WIDGET(t), "shadow");
+ if (i)
+ {
+ tmp->styles |= EWL_TEXT_STYLE_SHADOW;
+ ewl_text_theme_color_get(t, &(tmp->style_colors.shadow),
+ "shadow/color");
+ }
+
+ i = ewl_theme_data_int_get(EWL_WIDGET(t), "soft_shadow");
+ if (i)
+ {
+ tmp->styles |= EWL_TEXT_STYLE_SOFT_SHADOW;
+ ewl_text_theme_color_get(t, &(tmp->style_colors.shadow),
+ "shadow/color");
+ }
+
+ i = ewl_theme_data_int_get(EWL_WIDGET(t), "far_shadow");
+ if (i)
+ {
+ tmp->styles |= EWL_TEXT_STYLE_FAR_SHADOW;
+ ewl_text_theme_color_get(t, &(tmp->style_colors.shadow),
+ "shadow/color");
+ }
+
+ i = ewl_theme_data_int_get(EWL_WIDGET(t), "outline");
+ if (i)
+ {
+ tmp->styles |= EWL_TEXT_STYLE_OUTLINE;
+ ewl_text_theme_color_get(t, &(tmp->style_colors.outline),
+ "outline/color");
+ }
+
+ i = ewl_theme_data_int_get(EWL_WIDGET(t), "glow");
+ if (i)
+ {
+ tmp->styles |= EWL_TEXT_STYLE_GLOW;
+ ewl_text_theme_color_get(t, &(tmp->style_colors.glow),
+ "glow/color");
+ }
+
+ /* XXX grab the alignment and wrap data from the theme here */
+ tmp->align = EWL_FLAG_ALIGN_LEFT;
+
+ tx = ewl_text_context_find(tmp, EWL_TEXT_CONTEXT_MASK_NONE, NULL);
+ ewl_text_context_release(tmp);
+
+ /* setup the default context and acquire a ref on it so
+ * it won't go away */
+ ewl_text_default_context = tx;
+
+ DRETURN_PTR(tx, DLEVEL_STABLE);
}
/*
@@ -2861,50 +2861,50 @@ ewl_text_context_default_create(Ewl_Text *t)
static int
ewl_text_char_utf8_is(const char *c)
{
- unsigned const char *t;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(c, FALSE);
-
- t = (unsigned const char *)c;
- if (!t) DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- /* check for ascii chars first */
- if (t[0] < 0x80) DRETURN_INT(TRUE, DLEVEL_STABLE);
-
- switch (EWL_TEXT_CHAR_BYTE_LEN(t))
- {
- case 2: /* 2 byte */
- if ((t[1] & 0xc0) != 0x80)
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- break;
-
- case 3: /* 3 byte */
- if (((t[1] & 0xc0) != 0x80)
- || ((t[2] & 0xc0) != 0x80))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- break;
-
- case 4: /* 4 byte */
- if (((t[1] & 0xc0) != 0x80)
- || ((t[2] & 0xc0) != 0x80)
- || ((t[3] & 0xc0) != 0x80))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- break;
-
- default:
- /* this is actually:
- * case 1:
- * We already checked if it is a 7-bit ASCII character,
- * so anything else with the length of 1 byte is not
- * a valid utf8 character
- * case 5: case 6:
- * Although a character sequences of the length 5 or 6
- * is possible it is not a legal utf8 character */
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ unsigned const char *t;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(c, FALSE);
+
+ t = (unsigned const char *)c;
+ if (!t) DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ /* check for ascii chars first */
+ if (t[0] < 0x80) DRETURN_INT(TRUE, DLEVEL_STABLE);
+
+ switch (EWL_TEXT_CHAR_BYTE_LEN(t))
+ {
+ case 2: /* 2 byte */
+ if ((t[1] & 0xc0) != 0x80)
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ break;
+
+ case 3: /* 3 byte */
+ if (((t[1] & 0xc0) != 0x80)
+ || ((t[2] & 0xc0) != 0x80))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ break;
+
+ case 4: /* 4 byte */
+ if (((t[1] & 0xc0) != 0x80)
+ || ((t[2] & 0xc0) != 0x80)
+ || ((t[3] & 0xc0) != 0x80))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ break;
+
+ default:
+ /* this is actually:
+ * case 1:
+ * We already checked if it is a 7-bit ASCII character,
+ * so anything else with the length of 1 byte is not
+ * a valid utf8 character
+ * case 5: case 6:
+ * Although a character sequences of the length 5 or 6
+ * is possible it is not a legal utf8 character */
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/*
@@ -2916,186 +2916,186 @@ ewl_text_char_utf8_is(const char *c)
char *
ewl_text_text_next_char(const char *text, unsigned int *idx)
{
- int len;
+ int len;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(text, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(text, NULL);
- len = EWL_TEXT_CHAR_BYTE_LEN(text);
- if (idx) *idx = len;
+ len = EWL_TEXT_CHAR_BYTE_LEN(text);
+ if (idx) *idx = len;
- DRETURN_PTR(text + len, DLEVEL_STABLE);
+ DRETURN_PTR(text + len, DLEVEL_STABLE);
}
static void
ewl_text_size(Ewl_Text *t)
{
- int xx, yy, ww, hh;
+ int xx, yy, ww, hh;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- xx = CURRENT_X(t);
- yy = CURRENT_Y(t);
- hh = CURRENT_H(t);
- ww = CURRENT_W(t);
+ xx = CURRENT_X(t);
+ yy = CURRENT_Y(t);
+ hh = CURRENT_H(t);
+ ww = CURRENT_W(t);
- evas_object_move(t->textblock, xx + t->offset.x, yy + t->offset.y);
- evas_object_resize(t->textblock, ww - t->offset.x, hh - t->offset.y);
+ evas_object_move(t->textblock, xx + t->offset.x, yy + t->offset.y);
+ evas_object_resize(t->textblock, ww - t->offset.x, hh - t->offset.y);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_text_display(Ewl_Text *t)
{
- Evas_Coord w = 0, h = 0;
- Evas_Textblock_Cursor *cursor;
+ Evas_Coord w = 0, h = 0;
+ Evas_Textblock_Cursor *cursor;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- ewl_text_size(t);
+ ewl_text_size(t);
- evas_object_textblock_clear(t->textblock);
+ evas_object_textblock_clear(t->textblock);
- cursor = (Evas_Textblock_Cursor *)
- evas_object_textblock_cursor_get(t->textblock);
- evas_textblock_cursor_text_append(cursor, "");
+ cursor = (Evas_Textblock_Cursor *)
+ evas_object_textblock_cursor_get(t->textblock);
+ evas_textblock_cursor_text_append(cursor, "");
- if (t->length.chars > 0)
- {
- Ewl_Text_Context *cur_tx;
- unsigned int cur_pos;
+ if (t->length.chars > 0)
+ {
+ Ewl_Text_Context *cur_tx;
+ unsigned int cur_pos;
- /* save these so we can restore the list state */
- cur_pos = ewl_text_cursor_position_get(t);
- cur_tx = t->formatting.tx;
- if (cur_tx) ewl_text_context_acquire(cur_tx);
+ /* save these so we can restore the list state */
+ cur_pos = ewl_text_cursor_position_get(t);
+ cur_tx = t->formatting.tx;
+ if (cur_tx) ewl_text_context_acquire(cur_tx);
- ewl_text_fmt_walk(t->formatting.nodes, ewl_text_cb_format);
+ ewl_text_fmt_walk(t->formatting.nodes, ewl_text_cb_format);
- ewl_text_cursor_position_set(t, cur_pos);
- t->formatting.tx = cur_tx;
- }
- evas_object_textblock_size_formatted_get(t->textblock, &w, &h);
+ ewl_text_cursor_position_set(t, cur_pos);
+ t->formatting.tx = cur_tx;
+ }
+ evas_object_textblock_size_formatted_get(t->textblock, &w, &h);
- /* Fallback, just in case we hit a corner case */
- if (!h) h = 1;
- if (!w) w = 1;
+ /* Fallback, just in case we hit a corner case */
+ if (!h) h = 1;
+ if (!w) w = 1;
- ewl_object_preferred_inner_size_set(EWL_OBJECT(t), (int)w, (int)h);
- t->dirty = FALSE;
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(t), (int)w, (int)h);
+ t->dirty = FALSE;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_text_cb_format(Ewl_Text_Fmt_Node *node, Ewl_Text *t, unsigned int byte_idx)
{
- Evas_Textblock_Cursor *cursor;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(node);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
-
- ewl_text_context_format_string_create(node->tx);
-
- /* Don't free this as it's suppost to be const ... */
- cursor = (Evas_Textblock_Cursor *)
- evas_object_textblock_cursor_get(t->textblock);
-
- /* only need to append if we aren't default */
- if (node->tx != ewl_text_default_context)
- evas_textblock_cursor_format_append(cursor, node->tx->format);
-
- if (!t->obscure)
- {
- char *ptr, tmp;
- ptr = t->text + byte_idx;
- tmp = *(ptr + node->byte_len);
- if (strlen(ptr) < node->byte_len)
- DWARNING("Byte length of node %u overruns actual"
- " text %d", node->byte_len, (int)strlen(ptr));
-
- *(ptr + node->byte_len) = '\0';
-
- ewl_text_plaintext_parse(t->textblock, ptr);
- *(ptr + node->byte_len) = tmp;
- }
- else
- {
- char *otxt, *ptr;
- size_t len;
- int i;
-
- len = strlen(t->obscure);
- otxt = alloca(len * node->char_len + 1);
- ptr = otxt;
- for (i = 0; i < node->char_len; i++)
- {
- memcpy(ptr, t->obscure, len);
- ptr += len;
- }
- *ptr = '\0';
- ewl_text_plaintext_parse(t->textblock, otxt);
- }
-
- evas_textblock_cursor_format_append(cursor, "-");
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Evas_Textblock_Cursor *cursor;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(node);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
+
+ ewl_text_context_format_string_create(node->tx);
+
+ /* Don't free this as it's suppost to be const ... */
+ cursor = (Evas_Textblock_Cursor *)
+ evas_object_textblock_cursor_get(t->textblock);
+
+ /* only need to append if we aren't default */
+ if (node->tx != ewl_text_default_context)
+ evas_textblock_cursor_format_append(cursor, node->tx->format);
+
+ if (!t->obscure)
+ {
+ char *ptr, tmp;
+ ptr = t->text + byte_idx;
+ tmp = *(ptr + node->byte_len);
+ if (strlen(ptr) < node->byte_len)
+ DWARNING("Byte length of node %u overruns actual"
+ " text %d", node->byte_len, (int)strlen(ptr));
+
+ *(ptr + node->byte_len) = '\0';
+
+ ewl_text_plaintext_parse(t->textblock, ptr);
+ *(ptr + node->byte_len) = tmp;
+ }
+ else
+ {
+ char *otxt, *ptr;
+ size_t len;
+ int i;
+
+ len = strlen(t->obscure);
+ otxt = alloca(len * node->char_len + 1);
+ ptr = otxt;
+ for (i = 0; i < node->char_len; i++)
+ {
+ memcpy(ptr, t->obscure, len);
+ ptr += len;
+ }
+ *ptr = '\0';
+ ewl_text_plaintext_parse(t->textblock, otxt);
+ }
+
+ evas_textblock_cursor_format_append(cursor, "-");
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_text_plaintext_parse(Evas_Object *tb, char *txt)
{
- Evas_Textblock_Cursor *cursor;
- char *tmp;
- unsigned int idx;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(tb);
-
- if (!txt) DRETURN(DLEVEL_STABLE);
-
- /* we don't free this cursor as it is actually const
- * Evas_Textblock_Cursor * and i'm casting it... */
- cursor = (Evas_Textblock_Cursor *)evas_object_textblock_cursor_get(tb);
- for (tmp = txt; *tmp; tmp = ewl_text_text_next_char(tmp, &idx))
- {
- if (*tmp == '\n')
- {
- *tmp = '\0';
- if (*txt) evas_textblock_cursor_text_append(cursor, txt);
- evas_textblock_cursor_format_append(cursor, "\n");
- *tmp = '\n';
-
- txt = ewl_text_text_next_char(tmp, &idx);
- }
- else if (*tmp == '\r' && *(tmp + 1) == '\n')
- {
- *tmp = '\0';
- if (*txt) evas_textblock_cursor_text_append(cursor, txt);
- evas_textblock_cursor_format_append(cursor, "\n");
- *tmp = '\r';
- tmp = ewl_text_text_next_char(tmp, &idx);
- txt = ewl_text_text_next_char(tmp, &idx);
- }
- else if (*tmp == '\t')
- {
- *tmp = '\0';
- if (*txt) evas_textblock_cursor_text_append(cursor, txt);
- evas_textblock_cursor_format_append(cursor, "\t");
- *tmp = '\t';
- txt = ewl_text_text_next_char(tmp, &idx);
- }
- }
- if (*txt) evas_textblock_cursor_text_append(cursor, txt);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Evas_Textblock_Cursor *cursor;
+ char *tmp;
+ unsigned int idx;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(tb);
+
+ if (!txt) DRETURN(DLEVEL_STABLE);
+
+ /* we don't free this cursor as it is actually const
+ * Evas_Textblock_Cursor * and i'm casting it... */
+ cursor = (Evas_Textblock_Cursor *)evas_object_textblock_cursor_get(tb);
+ for (tmp = txt; *tmp; tmp = ewl_text_text_next_char(tmp, &idx))
+ {
+ if (*tmp == '\n')
+ {
+ *tmp = '\0';
+ if (*txt) evas_textblock_cursor_text_append(cursor, txt);
+ evas_textblock_cursor_format_append(cursor, "\n");
+ *tmp = '\n';
+
+ txt = ewl_text_text_next_char(tmp, &idx);
+ }
+ else if (*tmp == '\r' && *(tmp + 1) == '\n')
+ {
+ *tmp = '\0';
+ if (*txt) evas_textblock_cursor_text_append(cursor, txt);
+ evas_textblock_cursor_format_append(cursor, "\n");
+ *tmp = '\r';
+ tmp = ewl_text_text_next_char(tmp, &idx);
+ txt = ewl_text_text_next_char(tmp, &idx);
+ }
+ else if (*tmp == '\t')
+ {
+ *tmp = '\0';
+ if (*txt) evas_textblock_cursor_text_append(cursor, txt);
+ evas_textblock_cursor_format_append(cursor, "\t");
+ *tmp = '\t';
+ txt = ewl_text_text_next_char(tmp, &idx);
+ }
+ }
+ if (*txt) evas_textblock_cursor_text_append(cursor, txt);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/* This will give you a cursor into the textblock setup for your given
@@ -3104,103 +3104,103 @@ ewl_text_plaintext_parse(Evas_Object *tb, char *txt)
static Evas_Textblock_Cursor *
ewl_text_textblock_cursor_position(Ewl_Text *t, unsigned int byte_idx)
{
- Evas_Textblock_Cursor *cursor;
- unsigned int cur_byte_idx = 0;
- const char *txt;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, NULL);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, NULL);
-
- /* place the cursor at the first node in the textblock */
- cursor = evas_object_textblock_cursor_new(t->textblock);
- evas_textblock_cursor_node_first(cursor);
- while (TRUE)
- {
- txt = evas_textblock_cursor_node_format_get(cursor);
-
- /* if we have text this is a formatting node, need to see if
- * this is a \n or \t as they are special */
- if (txt)
- {
- /* do we have a \n or \t node? */
- if ((!strcmp(txt, "\n")) || (!strcmp(txt, "\t")))
- {
- /* will this push us past the end? */
- if ((cur_byte_idx + 1) > byte_idx)
- {
- evas_textblock_cursor_pos_set(cursor,
- byte_idx - cur_byte_idx);
- break;
- }
- else cur_byte_idx++;
- }
- }
- else
- {
- int pos;
-
- /* this is a text node, so check the length of the
- * text against our current position and the idx we
- * are looking for */
- pos = evas_textblock_cursor_node_text_length_get(cursor);
-
- /* if this would move us past our index, find the
- * difference between our desired index and the
- * current index and set that */
- if ((cur_byte_idx + pos) > byte_idx)
- {
- evas_textblock_cursor_pos_set(cursor,
- byte_idx - cur_byte_idx);
- break;
- }
- cur_byte_idx += pos;
- }
-
- /* if we fail to goto the next node, just assume we're at
- * the end of the text and jump the cursor there */
- if (!evas_textblock_cursor_node_next(cursor))
- {
- evas_textblock_cursor_node_last(cursor);
- evas_textblock_cursor_char_last(cursor);
- break;
- }
-
- /* This shouldn't happen, we've moved past our index. Just
- * checking so the loop isn't (hopefully) infinite */
- if (cur_byte_idx > byte_idx)
- {
- DWARNING("This shouldn't happen, breaking loop.");
- break;
- }
- }
-
- DRETURN_PTR(cursor, DLEVEL_STABLE);
+ Evas_Textblock_Cursor *cursor;
+ unsigned int cur_byte_idx = 0;
+ const char *txt;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, NULL);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, NULL);
+
+ /* place the cursor at the first node in the textblock */
+ cursor = evas_object_textblock_cursor_new(t->textblock);
+ evas_textblock_cursor_node_first(cursor);
+ while (TRUE)
+ {
+ txt = evas_textblock_cursor_node_format_get(cursor);
+
+ /* if we have text this is a formatting node, need to see if
+ * this is a \n or \t as they are special */
+ if (txt)
+ {
+ /* do we have a \n or \t node? */
+ if ((!strcmp(txt, "\n")) || (!strcmp(txt, "\t")))
+ {
+ /* will this push us past the end? */
+ if ((cur_byte_idx + 1) > byte_idx)
+ {
+ evas_textblock_cursor_pos_set(cursor,
+ byte_idx - cur_byte_idx);
+ break;
+ }
+ else cur_byte_idx++;
+ }
+ }
+ else
+ {
+ int pos;
+
+ /* this is a text node, so check the length of the
+ * text against our current position and the idx we
+ * are looking for */
+ pos = evas_textblock_cursor_node_text_length_get(cursor);
+
+ /* if this would move us past our index, find the
+ * difference between our desired index and the
+ * current index and set that */
+ if ((cur_byte_idx + pos) > byte_idx)
+ {
+ evas_textblock_cursor_pos_set(cursor,
+ byte_idx - cur_byte_idx);
+ break;
+ }
+ cur_byte_idx += pos;
+ }
+
+ /* if we fail to goto the next node, just assume we're at
+ * the end of the text and jump the cursor there */
+ if (!evas_textblock_cursor_node_next(cursor))
+ {
+ evas_textblock_cursor_node_last(cursor);
+ evas_textblock_cursor_char_last(cursor);
+ break;
+ }
+
+ /* This shouldn't happen, we've moved past our index. Just
+ * checking so the loop isn't (hopefully) infinite */
+ if (cur_byte_idx > byte_idx)
+ {
+ DWARNING("This shouldn't happen, breaking loop.");
+ break;
+ }
+ }
+
+ DRETURN_PTR(cursor, DLEVEL_STABLE);
}
static unsigned int
ewl_text_textblock_cursor_to_index(Evas_Textblock_Cursor *cursor)
{
- unsigned int char_idx = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cursor, 0);
-
- /* this gives the index inside the _node_ the cursor points to, we
- * then need to add the length of all the nodes before it plus any
- * formatting nodes that are \n or \t */
- char_idx = evas_textblock_cursor_pos_get(cursor);
- while (evas_textblock_cursor_node_prev(cursor))
- {
- const char *txt;
-
- txt = evas_textblock_cursor_node_format_get(cursor);
- if (!txt) char_idx += evas_textblock_cursor_node_text_length_get(cursor);
- else if (!strcmp(txt, "\n")) char_idx ++;
- else if (!strcmp(txt, "\t")) char_idx ++;
- }
-
- DRETURN_INT(char_idx, DLEVEL_STABLE);
+ unsigned int char_idx = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cursor, 0);
+
+ /* this gives the index inside the _node_ the cursor points to, we
+ * then need to add the length of all the nodes before it plus any
+ * formatting nodes that are \n or \t */
+ char_idx = evas_textblock_cursor_pos_get(cursor);
+ while (evas_textblock_cursor_node_prev(cursor))
+ {
+ const char *txt;
+
+ txt = evas_textblock_cursor_node_format_get(cursor);
+ if (!txt) char_idx += evas_textblock_cursor_node_text_length_get(cursor);
+ else if (!strcmp(txt, "\n")) char_idx ++;
+ else if (!strcmp(txt, "\t")) char_idx ++;
+ }
+
+ DRETURN_INT(char_idx, DLEVEL_STABLE);
}
/**
@@ -3213,32 +3213,32 @@ ewl_text_textblock_cursor_to_index(Evas_Textblock_Cursor *cursor)
*/
void
ewl_text_cb_configure(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Text *t;
+ Ewl_Text *t;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_TEXT_TYPE);
- /* don't do anything if we're obscured */
- if (!REVEALED(w)) DRETURN(DLEVEL_STABLE);
+ /* don't do anything if we're obscured */
+ if (!REVEALED(w)) DRETURN(DLEVEL_STABLE);
- t = EWL_TEXT(w);
- if (t->textblock)
- {
- ewl_text_size(t);
- if (t->dirty) ewl_text_display(t);
+ t = EWL_TEXT(w);
+ if (t->textblock)
+ {
+ ewl_text_size(t);
+ if (t->dirty) ewl_text_display(t);
- ewl_text_triggers_place(t);
+ ewl_text_triggers_place(t);
- /* re-configure the selection to make sure it resizes
- * if needed */
- if (t->selection)
- ewl_widget_configure(EWL_WIDGET(t->selection));
- }
+ /* re-configure the selection to make sure it resizes
+ * if needed */
+ if (t->selection)
+ ewl_widget_configure(EWL_WIDGET(t->selection));
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -3252,71 +3252,71 @@ ewl_text_cb_configure(Ewl_Widget *w, void *ev __UNUSED__,
void
ewl_text_cb_reveal(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
{
- Ewl_Text *t;
- Ewl_Embed *emb;
- Ewl_Text_Context *ctx;
- Evas_Textblock_Style *st;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_TEXT_TYPE);
-
- t = EWL_TEXT(w);
- if (t->textblock)
- {
- DWARNING("We have a textblock when we shoudn't.");
- DRETURN(DLEVEL_STABLE);
- }
-
- /* find the embed so we know the evas */
- emb = ewl_embed_widget_find(w);
- if (!emb) DRETURN(DLEVEL_STABLE);
-
- /* create the textblock */
- t->textblock = ewl_embed_object_request(emb, "textblock");
- if (!t->textblock)
- t->textblock = evas_object_textblock_add(emb->canvas);
-
- if (t->textblock)
- {
- char *fmt2;
- int len;
-
- ctx = ewl_text_context_default_create(t);
- ewl_text_context_format_string_create(ctx);
-
- len = strlen(ctx->format) + 12; /* 12 == DEFAULT='' + \n + \0 */
- fmt2 = NEW(char, len);
- snprintf(fmt2, len, "DEFAULT='%s'\n", ctx->format);
-
- st = evas_textblock_style_new();
- evas_textblock_style_set(st, fmt2);
- evas_object_textblock_style_set(t->textblock, st);
- evas_textblock_style_free(st);
-
- ewl_text_context_release(ctx);
- FREE(fmt2);
-
- if (EWL_CONTAINER(w)->clip_box)
- {
- evas_object_clip_set(t->textblock,
- EWL_CONTAINER(w)->clip_box);
- evas_object_show(EWL_CONTAINER(w)->clip_box);
- }
- else
- DWARNING("Text does not have a clip box!");
-
- evas_object_pass_events_set(t->textblock, 1);
- evas_object_smart_member_add(t->textblock, w->smart_object);
- if (w->fx_clip_box) evas_object_raise(t->textblock);
-
- ewl_text_display(t);
- evas_object_show(t->textblock);
- }
-
- ewl_text_triggers_place(t);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Text *t;
+ Ewl_Embed *emb;
+ Ewl_Text_Context *ctx;
+ Evas_Textblock_Style *st;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_TEXT_TYPE);
+
+ t = EWL_TEXT(w);
+ if (t->textblock)
+ {
+ DWARNING("We have a textblock when we shoudn't.");
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ /* find the embed so we know the evas */
+ emb = ewl_embed_widget_find(w);
+ if (!emb) DRETURN(DLEVEL_STABLE);
+
+ /* create the textblock */
+ t->textblock = ewl_embed_object_request(emb, "textblock");
+ if (!t->textblock)
+ t->textblock = evas_object_textblock_add(emb->canvas);
+
+ if (t->textblock)
+ {
+ char *fmt2;
+ int len;
+
+ ctx = ewl_text_context_default_create(t);
+ ewl_text_context_format_string_create(ctx);
+
+ len = strlen(ctx->format) + 12; /* 12 == DEFAULT='' + \n + \0 */
+ fmt2 = NEW(char, len);
+ snprintf(fmt2, len, "DEFAULT='%s'\n", ctx->format);
+
+ st = evas_textblock_style_new();
+ evas_textblock_style_set(st, fmt2);
+ evas_object_textblock_style_set(t->textblock, st);
+ evas_textblock_style_free(st);
+
+ ewl_text_context_release(ctx);
+ FREE(fmt2);
+
+ if (EWL_CONTAINER(w)->clip_box)
+ {
+ evas_object_clip_set(t->textblock,
+ EWL_CONTAINER(w)->clip_box);
+ evas_object_show(EWL_CONTAINER(w)->clip_box);
+ }
+ else
+ DWARNING("Text does not have a clip box!");
+
+ evas_object_pass_events_set(t->textblock, 1);
+ evas_object_smart_member_add(t->textblock, w->smart_object);
+ if (w->fx_clip_box) evas_object_raise(t->textblock);
+
+ ewl_text_display(t);
+ evas_object_show(t->textblock);
+ }
+
+ ewl_text_triggers_place(t);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -3329,29 +3329,29 @@ ewl_text_cb_reveal(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
*/
void
ewl_text_cb_obscure(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Text *t;
+ Ewl_Text *t;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_TEXT_TYPE);
- t = EWL_TEXT(w);
+ t = EWL_TEXT(w);
- if (t->textblock)
- {
- Ewl_Embed *emb;
+ if (t->textblock)
+ {
+ Ewl_Embed *emb;
- emb = ewl_embed_widget_find(w);
- evas_object_textblock_clear(t->textblock);
- ewl_embed_object_cache(emb, t->textblock);
- t->textblock = NULL;
- }
+ emb = ewl_embed_widget_find(w);
+ evas_object_textblock_clear(t->textblock);
+ ewl_embed_object_cache(emb, t->textblock);
+ t->textblock = NULL;
+ }
- ewl_text_triggers_unrealize(t);
+ ewl_text_triggers_unrealize(t);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -3365,20 +3365,20 @@ ewl_text_cb_obscure(Ewl_Widget *w, void *ev __UNUSED__,
void
ewl_text_cb_show(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
{
- Ewl_Text *t;
+ Ewl_Text *t;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_TEXT_TYPE);
- t = EWL_TEXT(w);
- if (t->textblock)
- {
- evas_object_show(t->textblock);
- ewl_text_triggers_show(t);
- }
+ t = EWL_TEXT(w);
+ if (t->textblock)
+ {
+ evas_object_show(t->textblock);
+ ewl_text_triggers_show(t);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -3392,17 +3392,17 @@ ewl_text_cb_show(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
void
ewl_text_cb_hide(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
{
- Ewl_Text *t;
+ Ewl_Text *t;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_TEXT_TYPE);
- t = EWL_TEXT(w);
- if (t->textblock) evas_object_hide(t->textblock);
- ewl_text_triggers_hide(t);
+ t = EWL_TEXT(w);
+ if (t->textblock) evas_object_hide(t->textblock);
+ ewl_text_triggers_hide(t);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -3416,28 +3416,28 @@ ewl_text_cb_hide(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
void
ewl_text_cb_destroy(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
{
- Ewl_Text *t;
+ Ewl_Text *t;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_TEXT_TYPE);
- t = EWL_TEXT(w);
+ t = EWL_TEXT(w);
- IF_FREE(t->obscure);
- /* Note, we don't explictly destroy the triggers or the selection
- * because they will be cleared, because they are children of the
- * text widget itself */
- IF_FREE_LIST(t->triggers);
- t->selection = NULL;
+ IF_FREE(t->obscure);
+ /* Note, we don't explictly destroy the triggers or the selection
+ * because they will be cleared, because they are children of the
+ * text widget itself */
+ IF_FREE_LIST(t->triggers);
+ t->selection = NULL;
- ewl_text_fmt_destroy(t->formatting.nodes);
- t->formatting.nodes = NULL;
- t->formatting.tx = NULL;
+ ewl_text_fmt_destroy(t->formatting.nodes);
+ t->formatting.nodes = NULL;
+ t->formatting.tx = NULL;
- IF_FREE(t->text);
+ IF_FREE(t->text);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -3451,47 +3451,47 @@ ewl_text_cb_destroy(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
void
ewl_text_cb_mouse_down(Ewl_Widget *w, void *ev, void *data __UNUSED__)
{
- Ewl_Text *t;
- Ewl_Text_Trigger *sel;
- Ewl_Event_Mouse *event;
- unsigned int char_idx = 0;
- unsigned int modifiers;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_TEXT_TYPE);
-
- event = ev;
- t = EWL_TEXT(w);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE,
- ewl_text_cb_mouse_move, NULL);
-
- if (!t->selection)
- t->selection = ewl_text_selection_new(t);
-
- sel = EWL_TEXT_TRIGGER(t->selection);
-
- char_idx = ewl_text_coord_index_map(EWL_TEXT(w), event->x, event->y);
- modifiers = ewl_ev_modifiers_get();
- if (modifiers & EWL_KEY_MODIFIER_SHIFT)
- {
- ewl_text_selection_select_to(EWL_TEXT_TRIGGER(t->selection),
- char_idx);
- }
- else
- {
- ewl_widget_hide(t->selection);
- ewl_text_trigger_areas_cleanup(sel);
- ewl_widget_show(t->selection);
-
- ewl_text_trigger_start_pos_set(sel, char_idx);
- ewl_text_trigger_base_set(sel, char_idx);
- ewl_text_trigger_length_set(sel, 0);
- }
- t->in_select = TRUE;
- ewl_text_trigger_position(t, sel);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Text *t;
+ Ewl_Text_Trigger *sel;
+ Ewl_Event_Mouse *event;
+ unsigned int char_idx = 0;
+ unsigned int modifiers;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_TEXT_TYPE);
+
+ event = ev;
+ t = EWL_TEXT(w);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE,
+ ewl_text_cb_mouse_move, NULL);
+
+ if (!t->selection)
+ t->selection = ewl_text_selection_new(t);
+
+ sel = EWL_TEXT_TRIGGER(t->selection);
+
+ char_idx = ewl_text_coord_index_map(EWL_TEXT(w), event->x, event->y);
+ modifiers = ewl_ev_modifiers_get();
+ if (modifiers & EWL_KEY_MODIFIER_SHIFT)
+ {
+ ewl_text_selection_select_to(EWL_TEXT_TRIGGER(t->selection),
+ char_idx);
+ }
+ else
+ {
+ ewl_widget_hide(t->selection);
+ ewl_text_trigger_areas_cleanup(sel);
+ ewl_widget_show(t->selection);
+
+ ewl_text_trigger_start_pos_set(sel, char_idx);
+ ewl_text_trigger_base_set(sel, char_idx);
+ ewl_text_trigger_length_set(sel, 0);
+ }
+ t->in_select = TRUE;
+ ewl_text_trigger_position(t, sel);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -3505,34 +3505,34 @@ ewl_text_cb_mouse_down(Ewl_Widget *w, void *ev, void *data __UNUSED__)
void
ewl_text_cb_mouse_up(Ewl_Widget *w, void *ev, void *data __UNUSED__)
{
- Ewl_Text *t;
- Ewl_Event_Mouse *event;
- unsigned int modifiers;
+ Ewl_Text *t;
+ Ewl_Event_Mouse *event;
+ unsigned int modifiers;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_TEXT_TYPE);
- event = ev;
- t = EWL_TEXT(w);
+ event = ev;
+ t = EWL_TEXT(w);
- if (!t->in_select) DRETURN(DLEVEL_STABLE);
+ if (!t->in_select) DRETURN(DLEVEL_STABLE);
- t->in_select = FALSE;
- ewl_callback_del(w, EWL_CALLBACK_MOUSE_MOVE, ewl_text_cb_mouse_move);
+ t->in_select = FALSE;
+ ewl_callback_del(w, EWL_CALLBACK_MOUSE_MOVE, ewl_text_cb_mouse_move);
- modifiers = ewl_ev_modifiers_get();
- if (modifiers & EWL_KEY_MODIFIER_SHIFT)
- {
- unsigned int char_idx = 0;
+ modifiers = ewl_ev_modifiers_get();
+ if (modifiers & EWL_KEY_MODIFIER_SHIFT)
+ {
+ unsigned int char_idx = 0;
- char_idx = ewl_text_coord_index_map(EWL_TEXT(w), event->x, event->y);
- ewl_text_selection_select_to(EWL_TEXT_TRIGGER(t->selection),
- char_idx);
- }
- ewl_text_trigger_position(t, EWL_TEXT_TRIGGER(t->selection));
+ char_idx = ewl_text_coord_index_map(EWL_TEXT(w), event->x, event->y);
+ ewl_text_selection_select_to(EWL_TEXT_TRIGGER(t->selection),
+ char_idx);
+ }
+ ewl_text_trigger_position(t, EWL_TEXT_TRIGGER(t->selection));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -3546,87 +3546,87 @@ ewl_text_cb_mouse_up(Ewl_Widget *w, void *ev, void *data __UNUSED__)
void
ewl_text_cb_mouse_move(Ewl_Widget *w, void *ev, void *data __UNUSED__)
{
- Ewl_Text *t;
- Ewl_Event_Mouse *event;
+ Ewl_Text *t;
+ Ewl_Event_Mouse *event;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_TEXT_TYPE);
- event = ev;
- t = EWL_TEXT(w);
+ event = ev;
+ t = EWL_TEXT(w);
- if (t->in_select)
- {
- unsigned int char_idx = 0;
+ if (t->in_select)
+ {
+ unsigned int char_idx = 0;
- char_idx = ewl_text_coord_index_map(EWL_TEXT(w), event->x, event->y);
- ewl_text_selection_select_to(EWL_TEXT_TRIGGER(t->selection), char_idx);
- ewl_text_trigger_position(t, EWL_TEXT_TRIGGER(t->selection));
- }
+ char_idx = ewl_text_coord_index_map(EWL_TEXT(w), event->x, event->y);
+ ewl_text_selection_select_to(EWL_TEXT_TRIGGER(t->selection), char_idx);
+ ewl_text_trigger_position(t, EWL_TEXT_TRIGGER(t->selection));
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/* create the selection */
static Ewl_Widget *
ewl_text_selection_new(Ewl_Text *t)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, NULL);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, NULL);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, NULL);
- w = ewl_text_trigger_new(EWL_TEXT_TRIGGER_TYPE_SELECTION);
- ewl_container_child_append(EWL_CONTAINER(t), w);
- ewl_widget_internal_set(w, TRUE);
+ w = ewl_text_trigger_new(EWL_TEXT_TRIGGER_TYPE_SELECTION);
+ ewl_container_child_append(EWL_CONTAINER(t), w);
+ ewl_widget_internal_set(w, TRUE);
- ewl_text_trigger_start_pos_set(EWL_TEXT_TRIGGER(w), 0);
- ewl_text_trigger_length_set(EWL_TEXT_TRIGGER(w), 0);
+ ewl_text_trigger_start_pos_set(EWL_TEXT_TRIGGER(w), 0);
+ ewl_text_trigger_length_set(EWL_TEXT_TRIGGER(w), 0);
- ewl_widget_show(w);
+ ewl_widget_show(w);
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
static void
ewl_text_selection_select_to(Ewl_Text_Trigger *s, unsigned int char_idx)
{
- unsigned int start_pos;
- unsigned int base;
- char *txt;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(s);
- DCHECK_TYPE(s, EWL_TEXT_TRIGGER_TYPE);
-
- base = ewl_text_trigger_base_get(s);
- start_pos = ewl_text_trigger_start_pos_get(s);
-
- if (char_idx < base)
- {
- ewl_text_trigger_start_pos_set(s, char_idx);
- ewl_text_trigger_length_set(s, base - char_idx);
- }
- else
- {
- ewl_text_trigger_start_pos_set(s, base);
- ewl_text_trigger_length_set(s, char_idx - base);
- }
-
- /* set the clipboard text */
- txt = ewl_text_selection_text_get(EWL_TEXT(s->text_parent));
- if (txt)
- {
- Ewl_Embed *emb;
-
- emb = ewl_embed_widget_find(EWL_WIDGET(s->text_parent));
- ewl_embed_selection_text_set(emb, txt);
- FREE(txt);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ unsigned int start_pos;
+ unsigned int base;
+ char *txt;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(s);
+ DCHECK_TYPE(s, EWL_TEXT_TRIGGER_TYPE);
+
+ base = ewl_text_trigger_base_get(s);
+ start_pos = ewl_text_trigger_start_pos_get(s);
+
+ if (char_idx < base)
+ {
+ ewl_text_trigger_start_pos_set(s, char_idx);
+ ewl_text_trigger_length_set(s, base - char_idx);
+ }
+ else
+ {
+ ewl_text_trigger_start_pos_set(s, base);
+ ewl_text_trigger_length_set(s, char_idx - base);
+ }
+
+ /* set the clipboard text */
+ txt = ewl_text_selection_text_get(EWL_TEXT(s->text_parent));
+ if (txt)
+ {
+ Ewl_Embed *emb;
+
+ emb = ewl_embed_widget_find(EWL_WIDGET(s->text_parent));
+ ewl_embed_selection_text_set(emb, txt);
+ FREE(txt);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -3639,17 +3639,17 @@ ewl_text_selection_select_to(Ewl_Text_Trigger *s, unsigned int char_idx)
void
ewl_text_cb_child_add(Ewl_Container *c, Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_TEXT_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_TEXT_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- /* if this is a trigger then add it as such */
- if (EWL_TEXT_TRIGGER_IS(w))
- ewl_text_trigger_add(EWL_TEXT(c), EWL_TEXT_TRIGGER(w));
+ /* if this is a trigger then add it as such */
+ if (EWL_TEXT_TRIGGER_IS(w))
+ ewl_text_trigger_add(EWL_TEXT(c), EWL_TEXT_TRIGGER(w));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -3663,235 +3663,235 @@ ewl_text_cb_child_add(Ewl_Container *c, Ewl_Widget *w)
void
ewl_text_cb_child_remove(Ewl_Container *c, Ewl_Widget *w, int idx __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_TEXT_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- /* if it is a trigger, we need to treat it special */
- if (EWL_TEXT_TRIGGER_IS(w))
- {
- Ewl_Text_Trigger *trigger;
-
- trigger = EWL_TEXT_TRIGGER(w);
- ewl_text_trigger_areas_cleanup(trigger);
- trigger->text_parent = NULL;
-
- if (trigger->type == EWL_TEXT_TRIGGER_TYPE_TRIGGER)
- {
- ecore_list_goto(EWL_TEXT(c)->triggers, trigger);
- ecore_list_remove(EWL_TEXT(c)->triggers);
- }
- else
- {
- /* for debug */
- if (EWL_TEXT(c)->selection != w)
- DWARNING("We are removing a selection, that"
- "isn't our own. WTF is happening?");
-
- EWL_TEXT(c)->selection = NULL;
- }
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_TEXT_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ /* if it is a trigger, we need to treat it special */
+ if (EWL_TEXT_TRIGGER_IS(w))
+ {
+ Ewl_Text_Trigger *trigger;
+
+ trigger = EWL_TEXT_TRIGGER(w);
+ ewl_text_trigger_areas_cleanup(trigger);
+ trigger->text_parent = NULL;
+
+ if (trigger->type == EWL_TEXT_TRIGGER_TYPE_TRIGGER)
+ {
+ ecore_list_goto(EWL_TEXT(c)->triggers, trigger);
+ ecore_list_remove(EWL_TEXT(c)->triggers);
+ }
+ else
+ {
+ /* for debug */
+ if (EWL_TEXT(c)->selection != w)
+ DWARNING("We are removing a selection, that"
+ "isn't our own. WTF is happening?");
+
+ EWL_TEXT(c)->selection = NULL;
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_text_current_fmt_set(Ewl_Text *t, unsigned int context_mask,
- Ewl_Text_Context *change)
+ Ewl_Text_Context *change)
{
- Ewl_Text_Context *old = NULL, *new;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_PARAM_PTR(change);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
-
- /* if we've already made some formatting changes before setting the
- * text make sure we use the current context. Else, use the current
- * nodes context. */
- if (t->formatting.tx)
- {
- old = t->formatting.tx;
- }
- else
- {
- Ewl_Text_Fmt_Node *fmt;
-
- fmt = ewl_text_fmt_get_current(t->formatting.nodes);
- if (fmt)
- {
- old = fmt->tx;
-
- /* grab on to this so releasing later doesn't screw
- * things up */
- ewl_text_context_acquire(old);
- }
- else old = ewl_text_context_default_create(t);
- }
-
- new = ewl_text_context_find(old, context_mask, change);
- if (old) ewl_text_context_release(old);
-
- t->formatting.tx = new;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Text_Context *old = NULL, *new;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_PARAM_PTR(change);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
+
+ /* if we've already made some formatting changes before setting the
+ * text make sure we use the current context. Else, use the current
+ * nodes context. */
+ if (t->formatting.tx)
+ {
+ old = t->formatting.tx;
+ }
+ else
+ {
+ Ewl_Text_Fmt_Node *fmt;
+
+ fmt = ewl_text_fmt_get_current(t->formatting.nodes);
+ if (fmt)
+ {
+ old = fmt->tx;
+
+ /* grab on to this so releasing later doesn't screw
+ * things up */
+ ewl_text_context_acquire(old);
+ }
+ else old = ewl_text_context_default_create(t);
+ }
+
+ new = ewl_text_context_find(old, context_mask, change);
+ if (old) ewl_text_context_release(old);
+
+ t->formatting.tx = new;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_text_trigger_position(Ewl_Text *t, Ewl_Text_Trigger *trig)
{
- Evas_Textblock_Cursor *cur1, *cur2;
- Evas_List *rects;
- unsigned int byte_idx = 0, byte_len = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_PARAM_PTR(trig);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
- DCHECK_TYPE(trig, EWL_TEXT_TRIGGER_TYPE);
-
- if (trig->char_len == 0)
- DRETURN(DLEVEL_STABLE);
-
- ewl_text_trigger_areas_cleanup(trig);
- ewl_text_fmt_char_to_byte(t->formatting.nodes,
- trig->char_pos, trig->char_len - 1,
- &byte_idx, &byte_len);
-
- cur1 = ewl_text_textblock_cursor_position(t, byte_idx);
- cur2 = ewl_text_textblock_cursor_position(t, byte_idx + byte_len);
-
- /* get all the rectangles and create areas with them */
- rects = evas_textblock_cursor_range_geometry_get(cur1, cur2);
- while (rects)
- {
- Evas_Textblock_Rectangle *tr;
-
- tr = rects->data;
- ewl_text_trigger_area_add(t, trig, tr->x + CURRENT_X(t),
- tr->y + CURRENT_Y(t),
- tr->w, tr->h);
-
- FREE(tr);
- rects = evas_list_remove_list(rects, rects);
- }
- evas_textblock_cursor_free(cur1);
- evas_textblock_cursor_free(cur2);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Evas_Textblock_Cursor *cur1, *cur2;
+ Evas_List *rects;
+ unsigned int byte_idx = 0, byte_len = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_PARAM_PTR(trig);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DCHECK_TYPE(trig, EWL_TEXT_TRIGGER_TYPE);
+
+ if (trig->char_len == 0)
+ DRETURN(DLEVEL_STABLE);
+
+ ewl_text_trigger_areas_cleanup(trig);
+ ewl_text_fmt_char_to_byte(t->formatting.nodes,
+ trig->char_pos, trig->char_len - 1,
+ &byte_idx, &byte_len);
+
+ cur1 = ewl_text_textblock_cursor_position(t, byte_idx);
+ cur2 = ewl_text_textblock_cursor_position(t, byte_idx + byte_len);
+
+ /* get all the rectangles and create areas with them */
+ rects = evas_textblock_cursor_range_geometry_get(cur1, cur2);
+ while (rects)
+ {
+ Evas_Textblock_Rectangle *tr;
+
+ tr = rects->data;
+ ewl_text_trigger_area_add(t, trig, tr->x + CURRENT_X(t),
+ tr->y + CURRENT_Y(t),
+ tr->w, tr->h);
+
+ FREE(tr);
+ rects = evas_list_remove_list(rects, rects);
+ }
+ evas_textblock_cursor_free(cur1);
+ evas_textblock_cursor_free(cur2);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_text_triggers_remove(Ewl_Text *t)
{
- Ewl_Text_Trigger *trig;
+ Ewl_Text_Trigger *trig;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- if (!t->triggers)
- DRETURN(DLEVEL_STABLE);
+ if (!t->triggers)
+ DRETURN(DLEVEL_STABLE);
- while ((trig = ecore_list_first_remove(t->triggers)))
- ewl_widget_destroy(EWL_WIDGET(trig));
+ while ((trig = ecore_list_first_remove(t->triggers)))
+ ewl_widget_destroy(EWL_WIDGET(trig));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/* if we move the text (insertion, deleteion, etc) we need to shift the
* position of the current cursors so they appear in the correct positions */
static void
ewl_text_triggers_shift(Ewl_Text *t, unsigned int char_pos,
- unsigned int char_len,
- unsigned int del)
+ unsigned int char_len,
+ unsigned int del)
{
- Ewl_Text_Trigger *cur;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
-
- if (!t->triggers)
- DRETURN(DLEVEL_STABLE);
-
- ecore_list_first_goto(t->triggers);
- while ((cur = ecore_list_next(t->triggers)))
- {
- /* check if the change is after the trigger */
- if (char_pos >= (cur->char_pos + cur->char_len))
- continue;
-
- /* change is completely before the trigger */
- if ((char_pos + char_len) < cur->char_pos)
- {
- if (del) cur->char_pos -= char_len;
- else cur->char_pos += char_len;
- continue;
- }
-
- if (del)
- {
- /* delete the entire trigger? */
- if ((char_pos <= cur->char_pos) &&
- ((char_pos + char_len) >=
- (cur->char_pos + cur->char_len)))
- {
- int index;
-
- index = ecore_list_index(t->triggers);
- if (index == 0)
- {
- DWARNING("Is this possible?");
- }
- else
- {
- index --;
-
- /* remove the node before the
- * current one as _next will put us
- * on the next node */
- ecore_list_index_goto(t->triggers, index);
- ecore_list_remove(t->triggers);
- ecore_list_index_goto(t->triggers, index);
- }
- continue;
- }
-
- /* delete part of the start of the trigger */
- if (char_pos <= cur->char_pos)
- {
- cur->char_len -= ((char_pos + char_len) - cur->char_pos);
- continue;
- }
-
- /* delete from the center of the trigger */
- if ((char_pos >= cur->char_pos) &&
- ((char_pos + char_len) <=
- (cur->char_pos + cur->char_len)))
- {
- cur->char_len -= char_len;
- continue;
- }
-
- /* must be deleted from the end of the trigger then */
- cur->char_len = char_pos - cur->char_pos;
- }
- else
- {
- /* we are inserting, just see if we are before */
- if (char_pos < cur->char_pos)
- {
- cur->char_pos += char_len;
- continue;
- }
- cur->char_len += char_len;
- }
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Text_Trigger *cur;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
+
+ if (!t->triggers)
+ DRETURN(DLEVEL_STABLE);
+
+ ecore_list_first_goto(t->triggers);
+ while ((cur = ecore_list_next(t->triggers)))
+ {
+ /* check if the change is after the trigger */
+ if (char_pos >= (cur->char_pos + cur->char_len))
+ continue;
+
+ /* change is completely before the trigger */
+ if ((char_pos + char_len) < cur->char_pos)
+ {
+ if (del) cur->char_pos -= char_len;
+ else cur->char_pos += char_len;
+ continue;
+ }
+
+ if (del)
+ {
+ /* delete the entire trigger? */
+ if ((char_pos <= cur->char_pos) &&
+ ((char_pos + char_len) >=
+ (cur->char_pos + cur->char_len)))
+ {
+ int index;
+
+ index = ecore_list_index(t->triggers);
+ if (index == 0)
+ {
+ DWARNING("Is this possible?");
+ }
+ else
+ {
+ index --;
+
+ /* remove the node before the
+ * current one as _next will put us
+ * on the next node */
+ ecore_list_index_goto(t->triggers, index);
+ ecore_list_remove(t->triggers);
+ ecore_list_index_goto(t->triggers, index);
+ }
+ continue;
+ }
+
+ /* delete part of the start of the trigger */
+ if (char_pos <= cur->char_pos)
+ {
+ cur->char_len -= ((char_pos + char_len) - cur->char_pos);
+ continue;
+ }
+
+ /* delete from the center of the trigger */
+ if ((char_pos >= cur->char_pos) &&
+ ((char_pos + char_len) <=
+ (cur->char_pos + cur->char_len)))
+ {
+ cur->char_len -= char_len;
+ continue;
+ }
+
+ /* must be deleted from the end of the trigger then */
+ cur->char_len = char_pos - cur->char_pos;
+ }
+ else
+ {
+ /* we are inserting, just see if we are before */
+ if (char_pos < cur->char_pos)
+ {
+ cur->char_pos += char_len;
+ continue;
+ }
+ cur->char_len += char_len;
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -3903,23 +3903,23 @@ ewl_text_triggers_shift(Ewl_Text *t, unsigned int char_pos,
static void
ewl_text_triggers_place(Ewl_Text *t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- if (t->triggers)
- {
- Ewl_Text_Trigger *cur;
+ if (t->triggers)
+ {
+ Ewl_Text_Trigger *cur;
- ecore_list_first_goto(t->triggers);
- while ((cur = ecore_list_next(t->triggers)))
- ewl_text_trigger_position(t, cur);
- }
+ ecore_list_first_goto(t->triggers);
+ while ((cur = ecore_list_next(t->triggers)))
+ ewl_text_trigger_position(t, cur);
+ }
- if (t->selection)
- ewl_text_trigger_position(t, EWL_TEXT_TRIGGER(t->selection));
+ if (t->selection)
+ ewl_text_trigger_position(t, EWL_TEXT_TRIGGER(t->selection));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -3931,22 +3931,22 @@ ewl_text_triggers_place(Ewl_Text *t)
static void
ewl_text_triggers_unrealize(Ewl_Text *t)
{
- Ewl_Text_Trigger *cur;
+ Ewl_Text_Trigger *cur;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- if (t->triggers)
- {
- ecore_list_first_goto(t->triggers);
- while ((cur = ecore_list_next(t->triggers)))
- ewl_widget_unrealize(EWL_WIDGET(cur));
- }
+ if (t->triggers)
+ {
+ ecore_list_first_goto(t->triggers);
+ while ((cur = ecore_list_next(t->triggers)))
+ ewl_widget_unrealize(EWL_WIDGET(cur));
+ }
- if (t->selection) ewl_widget_unrealize(t->selection);
+ if (t->selection) ewl_widget_unrealize(t->selection);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -3958,22 +3958,22 @@ ewl_text_triggers_unrealize(Ewl_Text *t)
static void
ewl_text_triggers_show(Ewl_Text *t)
{
- Ewl_Text_Trigger *cur;
+ Ewl_Text_Trigger *cur;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- if (t->triggers)
- {
- ecore_list_first_goto(t->triggers);
- while ((cur = ecore_list_next(t->triggers)))
- ewl_widget_show(EWL_WIDGET(cur));
- }
+ if (t->triggers)
+ {
+ ecore_list_first_goto(t->triggers);
+ while ((cur = ecore_list_next(t->triggers)))
+ ewl_widget_show(EWL_WIDGET(cur));
+ }
- if (t->selection) ewl_widget_show(t->selection);
+ if (t->selection) ewl_widget_show(t->selection);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -3985,134 +3985,134 @@ ewl_text_triggers_show(Ewl_Text *t)
static void
ewl_text_triggers_hide(Ewl_Text *t)
{
- Ewl_Text_Trigger *cur;
+ Ewl_Text_Trigger *cur;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
- /* hide the triggers */
- if (t->triggers)
- {
- ecore_list_first_goto(t->triggers);
- while ((cur = ecore_list_next(t->triggers)))
- ewl_widget_hide(EWL_WIDGET(cur));
- }
+ /* hide the triggers */
+ if (t->triggers)
+ {
+ ecore_list_first_goto(t->triggers);
+ while ((cur = ecore_list_next(t->triggers)))
+ ewl_widget_hide(EWL_WIDGET(cur));
+ }
- /* hide the selection */
- if (t->selection) ewl_widget_hide(t->selection);
+ /* hide the selection */
+ if (t->selection) ewl_widget_hide(t->selection);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_text_trigger_add(Ewl_Text *t, Ewl_Text_Trigger *trigger)
{
- Ewl_Text_Trigger *cur = NULL;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_PARAM_PTR(trigger);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
- DCHECK_TYPE(trigger, EWL_TEXT_TRIGGER_TYPE);
-
- /* this code there is for both triggers and selections */
- trigger->text_parent = t;
-
- /* the rest will be for real triggers only */
- if (trigger->type == EWL_TEXT_TRIGGER_TYPE_SELECTION)
- DRETURN(DLEVEL_STABLE);
-
- /* create the trigger list if needed */
- if (!t->triggers)
- t->triggers = ecore_list_new();
-
- /* if we have no length, we start past the end of the text, or we
- * extend past the end of the text then return an error */
- if ((trigger->char_len == 0)
- || ((trigger->char_pos + trigger->char_len) > t->length.chars))
- DRETURN(DLEVEL_STABLE);
-
-
- /* check now for overlapping */
- ecore_list_first_goto(t->triggers);
- while ((cur = ecore_list_next(t->triggers)))
- {
- if (trigger->char_pos < cur->char_pos)
- {
- if ((trigger->char_pos + trigger->char_len) < cur->char_pos)
- break;
-
- DWARNING("Overlapping triggers are not allowed.");
- DRETURN(DLEVEL_STABLE);
- }
-
- if ((trigger->char_pos > (cur->char_pos + cur->char_len)))
- continue;
-
- if ((trigger->char_pos >= cur->char_pos)
- && (trigger->char_pos <= (cur->char_pos + cur->char_len)))
- {
- DWARNING("Overlapping triggers are not allowed.");
- DRETURN(DLEVEL_STABLE);
- }
- }
-
- if (cur)
- {
- /* we need to set our position to the one before the one we
- * are on because the _next call in the while will have
- * advanced us to the next node, but we want to insert
- * at the one before that */
- ecore_list_index_goto(t->triggers, ecore_list_index(t->triggers) - 1);
- ecore_list_insert(t->triggers, trigger);
- }
- else
- ecore_list_append(t->triggers, trigger);
-
- DRETURN(DLEVEL_STABLE);
+ Ewl_Text_Trigger *cur = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_PARAM_PTR(trigger);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DCHECK_TYPE(trigger, EWL_TEXT_TRIGGER_TYPE);
+
+ /* this code there is for both triggers and selections */
+ trigger->text_parent = t;
+
+ /* the rest will be for real triggers only */
+ if (trigger->type == EWL_TEXT_TRIGGER_TYPE_SELECTION)
+ DRETURN(DLEVEL_STABLE);
+
+ /* create the trigger list if needed */
+ if (!t->triggers)
+ t->triggers = ecore_list_new();
+
+ /* if we have no length, we start past the end of the text, or we
+ * extend past the end of the text then return an error */
+ if ((trigger->char_len == 0)
+ || ((trigger->char_pos + trigger->char_len) > t->length.chars))
+ DRETURN(DLEVEL_STABLE);
+
+
+ /* check now for overlapping */
+ ecore_list_first_goto(t->triggers);
+ while ((cur = ecore_list_next(t->triggers)))
+ {
+ if (trigger->char_pos < cur->char_pos)
+ {
+ if ((trigger->char_pos + trigger->char_len) < cur->char_pos)
+ break;
+
+ DWARNING("Overlapping triggers are not allowed.");
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ if ((trigger->char_pos > (cur->char_pos + cur->char_len)))
+ continue;
+
+ if ((trigger->char_pos >= cur->char_pos)
+ && (trigger->char_pos <= (cur->char_pos + cur->char_len)))
+ {
+ DWARNING("Overlapping triggers are not allowed.");
+ DRETURN(DLEVEL_STABLE);
+ }
+ }
+
+ if (cur)
+ {
+ /* we need to set our position to the one before the one we
+ * are on because the _next call in the while will have
+ * advanced us to the next node, but we want to insert
+ * at the one before that */
+ ecore_list_index_goto(t->triggers, ecore_list_index(t->triggers) - 1);
+ ecore_list_insert(t->triggers, trigger);
+ }
+ else
+ ecore_list_append(t->triggers, trigger);
+
+ DRETURN(DLEVEL_STABLE);
}
static unsigned int
ewl_text_drawn_byte_to_char(Ewl_Text *t, unsigned int byte_idx)
{
- unsigned int char_idx = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, 0);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, 0);
-
- if (!t->obscure)
- ewl_text_fmt_byte_to_char(t->formatting.nodes, byte_idx,
- 0, &char_idx, NULL);
- else
- {
- size_t len = strlen(t->obscure);
-
- if (len != 0)
- char_idx = byte_idx / len;
- else
- char_idx = ewl_text_length_get(t);
- }
-
- DRETURN_INT(char_idx, DLEVEL_STABLE);
+ unsigned int char_idx = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, 0);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, 0);
+
+ if (!t->obscure)
+ ewl_text_fmt_byte_to_char(t->formatting.nodes, byte_idx,
+ 0, &char_idx, NULL);
+ else
+ {
+ size_t len = strlen(t->obscure);
+
+ if (len != 0)
+ char_idx = byte_idx / len;
+ else
+ char_idx = ewl_text_length_get(t);
+ }
+
+ DRETURN_INT(char_idx, DLEVEL_STABLE);
}
static unsigned int
ewl_text_char_to_drawn_byte(Ewl_Text *t, unsigned int char_idx)
{
- unsigned int byte_idx = 0;
+ unsigned int byte_idx = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, 0);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, 0);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, 0);
- if (!t->obscure)
- ewl_text_fmt_char_to_byte(t->formatting.nodes, char_idx,
- 0, &byte_idx, NULL);
- else
- byte_idx = char_idx * strlen(t->obscure);
+ if (!t->obscure)
+ ewl_text_fmt_char_to_byte(t->formatting.nodes, char_idx,
+ 0, &byte_idx, NULL);
+ else
+ byte_idx = char_idx * strlen(t->obscure);
- DRETURN_INT(byte_idx, DLEVEL_STABLE);
+ DRETURN_INT(byte_idx, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_text.h b/src/lib/ewl_text.h
index 5d6d93e..e00fe5b 100644
--- a/src/lib/ewl_text.h
+++ b/src/lib/ewl_text.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_TEXT_H
#define EWL_TEXT_H
@@ -67,229 +67,229 @@ typedef struct Ewl_Text Ewl_Text;
*/
struct Ewl_Text
{
- Ewl_Container container; /**< Inherit from Ewl_Container */
- void *textblock; /**< The Evas_Object_Textblock */
-
- char *text; /**< The text itself */
- char *obscure; /**< The utf8 character to be displayed
- instead of the real text */
- struct
- {
- unsigned int chars; /**< Number of characters in the text */
- unsigned int bytes; /**< Number of bytes in the text */
- unsigned int max_chars; /**< Maximal number of characters in the text */
- } length; /**< Different text lengths */
-
- unsigned int total_size; /**< The total size we've alloc'd for text */
- unsigned int cursor_position; /**< The cursor position */
-
- struct
- {
- void *nodes; /**< The formatting nodes */
- void *tx; /**< The current formatting context */
- } formatting; /**< Holds the formatting information */
-
- Ecore_List *triggers; /**< The list of triggers */
- Ecore_List *areas_cache; /**< unused areas */
- Ewl_Widget *selection; /**< The current selection */
-
- struct
- {
- int x; /**< X offset for layout */
- int y; /**< Y offset for layout */
- } offset; /**< Layout offset values */
-
- unsigned char delete_count; /**< Number of deletes */
- unsigned char in_select; /**< Are we in select mode? */
-
- unsigned char selectable; /**< Is the text selectable? */
- unsigned char dirty; /**< Does the text need layout? */
+ Ewl_Container container; /**< Inherit from Ewl_Container */
+ void *textblock; /**< The Evas_Object_Textblock */
+
+ char *text; /**< The text itself */
+ char *obscure; /**< The utf8 character to be displayed
+ instead of the real text */
+ struct
+ {
+ unsigned int chars; /**< Number of characters in the text */
+ unsigned int bytes; /**< Number of bytes in the text */
+ unsigned int max_chars; /**< Maximal number of characters in the text */
+ } length; /**< Different text lengths */
+
+ unsigned int total_size; /**< The total size we've alloc'd for text */
+ unsigned int cursor_position; /**< The cursor position */
+
+ struct
+ {
+ void *nodes; /**< The formatting nodes */
+ void *tx; /**< The current formatting context */
+ } formatting; /**< Holds the formatting information */
+
+ Ecore_List *triggers; /**< The list of triggers */
+ Ecore_List *areas_cache; /**< unused areas */
+ Ewl_Widget *selection; /**< The current selection */
+
+ struct
+ {
+ int x; /**< X offset for layout */
+ int y; /**< Y offset for layout */
+ } offset; /**< Layout offset values */
+
+ unsigned char delete_count; /**< Number of deletes */
+ unsigned char in_select; /**< Are we in select mode? */
+
+ unsigned char selectable; /**< Is the text selectable? */
+ unsigned char dirty; /**< Does the text need layout? */
};
-Ewl_Widget *ewl_text_new(void);
-int ewl_text_init(Ewl_Text *t);
-
-unsigned int ewl_text_length_get(Ewl_Text *t);
-void ewl_text_length_maximum_set(Ewl_Text *t,
- unsigned int char_num);
-unsigned int ewl_text_length_maximum_get(Ewl_Text *t);
-
-void ewl_text_offsets_set(Ewl_Text *t, int x, int y);
-void ewl_text_offsets_get(Ewl_Text *t, int *x, int *y);
-
-void ewl_text_index_geometry_map(Ewl_Text *t,
- unsigned int char_idx,
- int *x, int *y,
- int *w, int *h);
-unsigned int ewl_text_coord_index_map(Ewl_Text *t, int x, int y);
-
-char *ewl_text_text_get(Ewl_Text *t);
-void ewl_text_text_set(Ewl_Text *t, const char *text);
-void ewl_text_clear(Ewl_Text *t);
-
-void ewl_text_text_prepend(Ewl_Text *t, const char *text);
-void ewl_text_text_append(Ewl_Text *t, const char *text);
-void ewl_text_text_insert(Ewl_Text *t, const char *text,
- unsigned int char_idx);
-void ewl_text_text_delete(Ewl_Text *t, unsigned int length);
-
-void ewl_text_obscure_set(Ewl_Text *t, const char *utf8_character);
-
-void ewl_text_selectable_set(Ewl_Text *t, unsigned int selectable);
-unsigned int ewl_text_selectable_get(Ewl_Text *t);
-
-char *ewl_text_selection_text_get(Ewl_Text *t);
-unsigned int ewl_text_has_selection(Ewl_Text *t);
-Ewl_Widget *ewl_text_selection_get(Ewl_Text *t);
-void ewl_text_select(Ewl_Text *t, unsigned int char_idx,
- unsigned int char_len);
-void ewl_text_all_select(Ewl_Text *t);
-
-void ewl_text_cursor_position_set(Ewl_Text *t,
- unsigned int char_pos);
-unsigned int ewl_text_cursor_position_get(Ewl_Text *t);
-
-unsigned int ewl_text_cursor_position_line_up_get(Ewl_Text *t);
-unsigned int ewl_text_cursor_position_line_down_get(Ewl_Text *t);
-
-void ewl_text_font_set(Ewl_Text *t, const char *font);
-void ewl_text_font_apply(Ewl_Text *t, const char *font,
- unsigned int char_len);
-char *ewl_text_font_get(Ewl_Text *t, unsigned int char_idx);
-
-void ewl_text_font_source_set(Ewl_Text *t, const char *source,
- const char *font);
-void ewl_text_font_source_apply(Ewl_Text *t, const char *source,
- const char *font,
- unsigned int char_len);
-char *ewl_text_font_source_get(Ewl_Text *t, unsigned int char_idx);
-
-void ewl_text_font_size_set(Ewl_Text *t, unsigned int size);
-void ewl_text_font_size_apply(Ewl_Text *t, unsigned int size,
- unsigned int char_len);
-unsigned int ewl_text_font_size_get(Ewl_Text *t, unsigned int char_idx);
-
-void ewl_text_color_set(Ewl_Text *t,
- unsigned int r, unsigned int g,
- unsigned int b, unsigned int a);
-void ewl_text_color_apply(Ewl_Text *t,
- unsigned int r, unsigned int g,
- unsigned int b, unsigned int a,
- unsigned int char_len);
-void ewl_text_color_get(Ewl_Text *t,
- unsigned int *r, unsigned int *g,
- unsigned int *b, unsigned int *a,
- unsigned int char_idx);
-
-void ewl_text_align_set(Ewl_Text *t, unsigned int align);
-void ewl_text_align_apply(Ewl_Text *t, unsigned int align,
- unsigned int char_len);
-unsigned int ewl_text_align_get(Ewl_Text *t, unsigned int char_idx);
-
-void ewl_text_styles_set(Ewl_Text *t, unsigned int styles);
-void ewl_text_styles_apply(Ewl_Text *t, unsigned int styles,
- unsigned int char_len);
-unsigned int ewl_text_styles_get(Ewl_Text *t, unsigned int char_idx);
-
-void ewl_text_style_add(Ewl_Text *t, Ewl_Text_Style sytle,
- unsigned int char_len);
-void ewl_text_style_del(Ewl_Text *t, Ewl_Text_Style style,
- unsigned int char_len);
-void ewl_text_style_invert(Ewl_Text *t, Ewl_Text_Style style,
- unsigned int char_len);
-unsigned int ewl_text_style_has(Ewl_Text *t, Ewl_Text_Style style,
- unsigned int char_idx);
-
-void ewl_text_wrap_set(Ewl_Text *t, Ewl_Text_Wrap wrap);
-void ewl_text_wrap_apply(Ewl_Text *t, Ewl_Text_Wrap wrap,
- unsigned int char_len);
-Ewl_Text_Wrap ewl_text_wrap_get(Ewl_Text *t, unsigned int char_idx);
-
-void ewl_text_bg_color_set(Ewl_Text *t,
- unsigned int r, unsigned int g,
- unsigned int b, unsigned int a);
-void ewl_text_bg_color_apply(Ewl_Text *t,
- unsigned int r, unsigned int g,
- unsigned int b, unsigned int a,
- unsigned int char_len);
-void ewl_text_bg_color_get(Ewl_Text *t,
- unsigned int *r, unsigned int *g,
- unsigned int *b, unsigned int *a,
- unsigned int char_idx);
-
-void ewl_text_glow_color_set(Ewl_Text *t,
- unsigned int r, unsigned int g,
- unsigned int b, unsigned int a);
-void ewl_text_glow_color_apply(Ewl_Text *t,
- unsigned int r, unsigned int g,
- unsigned int b, unsigned int a,
- unsigned int char_len);
-void ewl_text_glow_color_get(Ewl_Text *t,
- unsigned int *r, unsigned int *g,
- unsigned int *b, unsigned int *a,
- unsigned int char_idx);
-
-void ewl_text_outline_color_set(Ewl_Text *t,
- unsigned int r, unsigned int g,
- unsigned int b, unsigned int a);
-void ewl_text_outline_color_apply(Ewl_Text *t,
- unsigned int r, unsigned int g,
- unsigned int b, unsigned int a,
- unsigned int char_len);
-void ewl_text_outline_color_get(Ewl_Text *t,
- unsigned int *r, unsigned int *g,
- unsigned int *b, unsigned int *a,
- unsigned int char_idx);
-
-void ewl_text_shadow_color_set(Ewl_Text *t,
- unsigned int r, unsigned int g,
- unsigned int b, unsigned int a);
-void ewl_text_shadow_color_apply(Ewl_Text *t,
- unsigned int r, unsigned int g,
- unsigned int b, unsigned int a,
- unsigned int char_len);
-void ewl_text_shadow_color_get(Ewl_Text *t,
- unsigned int *r, unsigned int *g,
- unsigned int *b, unsigned int *a,
- unsigned int char_idx);
-
-void ewl_text_strikethrough_color_set(Ewl_Text *t,
- unsigned int r, unsigned int g,
- unsigned int b, unsigned int a);
-void ewl_text_strikethrough_color_apply(Ewl_Text *t,
- unsigned int r, unsigned int g,
- unsigned int b, unsigned int a,
- unsigned int char_len);
-void ewl_text_strikethrough_color_get(Ewl_Text *t,
- unsigned int *r, unsigned int *g,
- unsigned int *b, unsigned int *a,
- unsigned int char_idx);
-
-void ewl_text_underline_color_set(Ewl_Text *t,
- unsigned int r, unsigned int g,
- unsigned int b, unsigned int a);
-void ewl_text_underline_color_apply(Ewl_Text *t,
- unsigned int r, unsigned int g,
- unsigned int b, unsigned int a,
- unsigned int char_len);
-void ewl_text_underline_color_get(Ewl_Text *t,
- unsigned int *r, unsigned int *g,
- unsigned int *b, unsigned int *a,
- unsigned int char_idx);
-
-void ewl_text_double_underline_color_set(Ewl_Text *t,
- unsigned int r, unsigned int g,
- unsigned int b, unsigned int a);
-void ewl_text_double_underline_color_apply(Ewl_Text *t,
- unsigned int r, unsigned int g,
- unsigned int b, unsigned int a,
- unsigned int char_len);
-void ewl_text_double_underline_color_get(Ewl_Text *t,
- unsigned int *r, unsigned int *g,
- unsigned int *b, unsigned int *a,
- unsigned int char_idx);
-
-char *ewl_text_text_next_char(const char *text, unsigned int *idx);
+Ewl_Widget *ewl_text_new(void);
+int ewl_text_init(Ewl_Text *t);
+
+unsigned int ewl_text_length_get(Ewl_Text *t);
+void ewl_text_length_maximum_set(Ewl_Text *t,
+ unsigned int char_num);
+unsigned int ewl_text_length_maximum_get(Ewl_Text *t);
+
+void ewl_text_offsets_set(Ewl_Text *t, int x, int y);
+void ewl_text_offsets_get(Ewl_Text *t, int *x, int *y);
+
+void ewl_text_index_geometry_map(Ewl_Text *t,
+ unsigned int char_idx,
+ int *x, int *y,
+ int *w, int *h);
+unsigned int ewl_text_coord_index_map(Ewl_Text *t, int x, int y);
+
+char *ewl_text_text_get(Ewl_Text *t);
+void ewl_text_text_set(Ewl_Text *t, const char *text);
+void ewl_text_clear(Ewl_Text *t);
+
+void ewl_text_text_prepend(Ewl_Text *t, const char *text);
+void ewl_text_text_append(Ewl_Text *t, const char *text);
+void ewl_text_text_insert(Ewl_Text *t, const char *text,
+ unsigned int char_idx);
+void ewl_text_text_delete(Ewl_Text *t, unsigned int length);
+
+void ewl_text_obscure_set(Ewl_Text *t, const char *utf8_character);
+
+void ewl_text_selectable_set(Ewl_Text *t, unsigned int selectable);
+unsigned int ewl_text_selectable_get(Ewl_Text *t);
+
+char *ewl_text_selection_text_get(Ewl_Text *t);
+unsigned int ewl_text_has_selection(Ewl_Text *t);
+Ewl_Widget *ewl_text_selection_get(Ewl_Text *t);
+void ewl_text_select(Ewl_Text *t, unsigned int char_idx,
+ unsigned int char_len);
+void ewl_text_all_select(Ewl_Text *t);
+
+void ewl_text_cursor_position_set(Ewl_Text *t,
+ unsigned int char_pos);
+unsigned int ewl_text_cursor_position_get(Ewl_Text *t);
+
+unsigned int ewl_text_cursor_position_line_up_get(Ewl_Text *t);
+unsigned int ewl_text_cursor_position_line_down_get(Ewl_Text *t);
+
+void ewl_text_font_set(Ewl_Text *t, const char *font);
+void ewl_text_font_apply(Ewl_Text *t, const char *font,
+ unsigned int char_len);
+char *ewl_text_font_get(Ewl_Text *t, unsigned int char_idx);
+
+void ewl_text_font_source_set(Ewl_Text *t, const char *source,
+ const char *font);
+void ewl_text_font_source_apply(Ewl_Text *t, const char *source,
+ const char *font,
+ unsigned int char_len);
+char *ewl_text_font_source_get(Ewl_Text *t, unsigned int char_idx);
+
+void ewl_text_font_size_set(Ewl_Text *t, unsigned int size);
+void ewl_text_font_size_apply(Ewl_Text *t, unsigned int size,
+ unsigned int char_len);
+unsigned int ewl_text_font_size_get(Ewl_Text *t, unsigned int char_idx);
+
+void ewl_text_color_set(Ewl_Text *t,
+ unsigned int r, unsigned int g,
+ unsigned int b, unsigned int a);
+void ewl_text_color_apply(Ewl_Text *t,
+ unsigned int r, unsigned int g,
+ unsigned int b, unsigned int a,
+ unsigned int char_len);
+void ewl_text_color_get(Ewl_Text *t,
+ unsigned int *r, unsigned int *g,
+ unsigned int *b, unsigned int *a,
+ unsigned int char_idx);
+
+void ewl_text_align_set(Ewl_Text *t, unsigned int align);
+void ewl_text_align_apply(Ewl_Text *t, unsigned int align,
+ unsigned int char_len);
+unsigned int ewl_text_align_get(Ewl_Text *t, unsigned int char_idx);
+
+void ewl_text_styles_set(Ewl_Text *t, unsigned int styles);
+void ewl_text_styles_apply(Ewl_Text *t, unsigned int styles,
+ unsigned int char_len);
+unsigned int ewl_text_styles_get(Ewl_Text *t, unsigned int char_idx);
+
+void ewl_text_style_add(Ewl_Text *t, Ewl_Text_Style sytle,
+ unsigned int char_len);
+void ewl_text_style_del(Ewl_Text *t, Ewl_Text_Style style,
+ unsigned int char_len);
+void ewl_text_style_invert(Ewl_Text *t, Ewl_Text_Style style,
+ unsigned int char_len);
+unsigned int ewl_text_style_has(Ewl_Text *t, Ewl_Text_Style style,
+ unsigned int char_idx);
+
+void ewl_text_wrap_set(Ewl_Text *t, Ewl_Text_Wrap wrap);
+void ewl_text_wrap_apply(Ewl_Text *t, Ewl_Text_Wrap wrap,
+ unsigned int char_len);
+Ewl_Text_Wrap ewl_text_wrap_get(Ewl_Text *t, unsigned int char_idx);
+
+void ewl_text_bg_color_set(Ewl_Text *t,
+ unsigned int r, unsigned int g,
+ unsigned int b, unsigned int a);
+void ewl_text_bg_color_apply(Ewl_Text *t,
+ unsigned int r, unsigned int g,
+ unsigned int b, unsigned int a,
+ unsigned int char_len);
+void ewl_text_bg_color_get(Ewl_Text *t,
+ unsigned int *r, unsigned int *g,
+ unsigned int *b, unsigned int *a,
+ unsigned int char_idx);
+
+void ewl_text_glow_color_set(Ewl_Text *t,
+ unsigned int r, unsigned int g,
+ unsigned int b, unsigned int a);
+void ewl_text_glow_color_apply(Ewl_Text *t,
+ unsigned int r, unsigned int g,
+ unsigned int b, unsigned int a,
+ unsigned int char_len);
+void ewl_text_glow_color_get(Ewl_Text *t,
+ unsigned int *r, unsigned int *g,
+ unsigned int *b, unsigned int *a,
+ unsigned int char_idx);
+
+void ewl_text_outline_color_set(Ewl_Text *t,
+ unsigned int r, unsigned int g,
+ unsigned int b, unsigned int a);
+void ewl_text_outline_color_apply(Ewl_Text *t,
+ unsigned int r, unsigned int g,
+ unsigned int b, unsigned int a,
+ unsigned int char_len);
+void ewl_text_outline_color_get(Ewl_Text *t,
+ unsigned int *r, unsigned int *g,
+ unsigned int *b, unsigned int *a,
+ unsigned int char_idx);
+
+void ewl_text_shadow_color_set(Ewl_Text *t,
+ unsigned int r, unsigned int g,
+ unsigned int b, unsigned int a);
+void ewl_text_shadow_color_apply(Ewl_Text *t,
+ unsigned int r, unsigned int g,
+ unsigned int b, unsigned int a,
+ unsigned int char_len);
+void ewl_text_shadow_color_get(Ewl_Text *t,
+ unsigned int *r, unsigned int *g,
+ unsigned int *b, unsigned int *a,
+ unsigned int char_idx);
+
+void ewl_text_strikethrough_color_set(Ewl_Text *t,
+ unsigned int r, unsigned int g,
+ unsigned int b, unsigned int a);
+void ewl_text_strikethrough_color_apply(Ewl_Text *t,
+ unsigned int r, unsigned int g,
+ unsigned int b, unsigned int a,
+ unsigned int char_len);
+void ewl_text_strikethrough_color_get(Ewl_Text *t,
+ unsigned int *r, unsigned int *g,
+ unsigned int *b, unsigned int *a,
+ unsigned int char_idx);
+
+void ewl_text_underline_color_set(Ewl_Text *t,
+ unsigned int r, unsigned int g,
+ unsigned int b, unsigned int a);
+void ewl_text_underline_color_apply(Ewl_Text *t,
+ unsigned int r, unsigned int g,
+ unsigned int b, unsigned int a,
+ unsigned int char_len);
+void ewl_text_underline_color_get(Ewl_Text *t,
+ unsigned int *r, unsigned int *g,
+ unsigned int *b, unsigned int *a,
+ unsigned int char_idx);
+
+void ewl_text_double_underline_color_set(Ewl_Text *t,
+ unsigned int r, unsigned int g,
+ unsigned int b, unsigned int a);
+void ewl_text_double_underline_color_apply(Ewl_Text *t,
+ unsigned int r, unsigned int g,
+ unsigned int b, unsigned int a,
+ unsigned int char_len);
+void ewl_text_double_underline_color_get(Ewl_Text *t,
+ unsigned int *r, unsigned int *g,
+ unsigned int *b, unsigned int *a,
+ unsigned int char_idx);
+
+char *ewl_text_text_next_char(const char *text, unsigned int *idx);
/*
* Internal stuff
diff --git a/src/lib/ewl_text_context.c b/src/lib/ewl_text_context.c
index 775aca5..2de4209 100644
--- a/src/lib/ewl_text_context.c
+++ b/src/lib/ewl_text_context.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_text_context.h"
#include "ewl_private.h"
@@ -30,17 +30,17 @@ static char *ewl_text_context_color_string_get(Ewl_Color_Set *colour);
int
ewl_text_context_init(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- if (!context_hash)
- {
- context_hash = ecore_hash_new(ewl_text_context_hash_key,
- ewl_text_context_hash_cmp);
- ecore_hash_free_value_cb_set(context_hash,
- ewl_text_context_cb_free);
- }
+ if (!context_hash)
+ {
+ context_hash = ecore_hash_new(ewl_text_context_hash_key,
+ ewl_text_context_hash_cmp);
+ ecore_hash_free_value_cb_set(context_hash,
+ ewl_text_context_cb_free);
+ }
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -51,11 +51,11 @@ ewl_text_context_init(void)
void
ewl_text_context_shutdown(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- IF_FREE_HASH(context_hash);
+ IF_FREE_HASH(context_hash);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -66,14 +66,14 @@ ewl_text_context_shutdown(void)
Ewl_Text_Context *
ewl_text_context_new(void)
{
- Ewl_Text_Context *tx;
+ Ewl_Text_Context *tx;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- tx = NEW(Ewl_Text_Context, 1);
- tx->ref_count = 1;
+ tx = NEW(Ewl_Text_Context, 1);
+ tx->ref_count = 1;
- DRETURN_PTR(tx, DLEVEL_STABLE);;
+ DRETURN_PTR(tx, DLEVEL_STABLE);;
}
/**
@@ -86,94 +86,94 @@ ewl_text_context_new(void)
*/
Ewl_Text_Context *
ewl_text_context_find(Ewl_Text_Context *tx, unsigned int context_mask,
- Ewl_Text_Context *tx_change)
+ Ewl_Text_Context *tx_change)
{
- Ewl_Text_Context tmp_tx;
- Ewl_Text_Context *new_tx;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(tx, NULL);
-
- /* only need the tx_change if we have a context mask */
- if (context_mask > 0)
- DCHECK_PARAM_PTR_RET(tx_change, NULL);
-
- memcpy(&tmp_tx, tx, sizeof(Ewl_Text_Context));
- ewl_text_context_merge(&tmp_tx, context_mask, tx_change);
- new_tx = ecore_hash_get(context_hash, &tmp_tx);
- if (!new_tx)
- {
- if ((new_tx = ewl_text_context_dup(tx)))
- {
- if (context_mask & EWL_TEXT_CONTEXT_MASK_FONT)
- {
- IF_RELEASE(new_tx->font);
- new_tx->font = ecore_string_instance(
- tx_change->font);
-
- IF_RELEASE(new_tx->font_source);
- if (tx_change->font_source)
- new_tx->font_source = ecore_string_instance(tx_change->font_source);
- }
-
- if (context_mask & EWL_TEXT_CONTEXT_MASK_SIZE)
- new_tx->size = tx_change->size;
-
- if (context_mask & EWL_TEXT_CONTEXT_MASK_STYLES)
- new_tx->styles = tx_change->styles;
-
- if (context_mask & EWL_TEXT_CONTEXT_MASK_ALIGN)
- new_tx->align = tx_change->align;
-
- if (context_mask & EWL_TEXT_CONTEXT_MASK_WRAP)
- new_tx->wrap = tx_change->wrap;
-
- if (context_mask & EWL_TEXT_CONTEXT_MASK_COLOR)
- memcpy(&(new_tx->color), &(tx_change->color),
- sizeof(Ewl_Color_Set));
-
- if (context_mask & EWL_TEXT_CONTEXT_MASK_BG_COLOR)
- memcpy(&(new_tx->style_colors.bg),
- &(tx_change->style_colors.bg),
- sizeof(Ewl_Color_Set));
-
- if (context_mask & EWL_TEXT_CONTEXT_MASK_GLOW_COLOR)
- memcpy(&(new_tx->style_colors.glow),
- &(tx_change->style_colors.glow),
- sizeof(Ewl_Color_Set));
-
- if (context_mask & EWL_TEXT_CONTEXT_MASK_OUTLINE_COLOR)
- memcpy(&(new_tx->style_colors.outline),
- &(tx_change->style_colors.outline),
- sizeof(Ewl_Color_Set));
-
- if (context_mask & EWL_TEXT_CONTEXT_MASK_SHADOW_COLOR)
- memcpy(&(new_tx->style_colors.shadow),
- &(tx_change->style_colors.shadow),
- sizeof(Ewl_Color_Set));
-
- if (context_mask & EWL_TEXT_CONTEXT_MASK_STRIKETHROUGH_COLOR)
- memcpy(&(new_tx->style_colors.strikethrough),
- &(tx_change->style_colors.strikethrough),
- sizeof(Ewl_Color_Set));
-
- if (context_mask & EWL_TEXT_CONTEXT_MASK_UNDERLINE_COLOR)
- memcpy(&(new_tx->style_colors.underline),
- &(tx_change->style_colors.underline),
- sizeof(Ewl_Color_Set));
-
- if (context_mask & EWL_TEXT_CONTEXT_MASK_DOUBLE_UNDERLINE_COLOR)
- memcpy(&(new_tx->style_colors.double_underline),
- &(tx_change->style_colors.double_underline),
- sizeof(Ewl_Color_Set));
-
- IF_RELEASE(new_tx->format);
- ecore_hash_set(context_hash, new_tx, new_tx);
- }
- }
- if (new_tx) ewl_text_context_acquire(new_tx);
-
- DRETURN_PTR(new_tx, DLEVEL_STABLE);
+ Ewl_Text_Context tmp_tx;
+ Ewl_Text_Context *new_tx;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(tx, NULL);
+
+ /* only need the tx_change if we have a context mask */
+ if (context_mask > 0)
+ DCHECK_PARAM_PTR_RET(tx_change, NULL);
+
+ memcpy(&tmp_tx, tx, sizeof(Ewl_Text_Context));
+ ewl_text_context_merge(&tmp_tx, context_mask, tx_change);
+ new_tx = ecore_hash_get(context_hash, &tmp_tx);
+ if (!new_tx)
+ {
+ if ((new_tx = ewl_text_context_dup(tx)))
+ {
+ if (context_mask & EWL_TEXT_CONTEXT_MASK_FONT)
+ {
+ IF_RELEASE(new_tx->font);
+ new_tx->font = ecore_string_instance(
+ tx_change->font);
+
+ IF_RELEASE(new_tx->font_source);
+ if (tx_change->font_source)
+ new_tx->font_source = ecore_string_instance(tx_change->font_source);
+ }
+
+ if (context_mask & EWL_TEXT_CONTEXT_MASK_SIZE)
+ new_tx->size = tx_change->size;
+
+ if (context_mask & EWL_TEXT_CONTEXT_MASK_STYLES)
+ new_tx->styles = tx_change->styles;
+
+ if (context_mask & EWL_TEXT_CONTEXT_MASK_ALIGN)
+ new_tx->align = tx_change->align;
+
+ if (context_mask & EWL_TEXT_CONTEXT_MASK_WRAP)
+ new_tx->wrap = tx_change->wrap;
+
+ if (context_mask & EWL_TEXT_CONTEXT_MASK_COLOR)
+ memcpy(&(new_tx->color), &(tx_change->color),
+ sizeof(Ewl_Color_Set));
+
+ if (context_mask & EWL_TEXT_CONTEXT_MASK_BG_COLOR)
+ memcpy(&(new_tx->style_colors.bg),
+ &(tx_change->style_colors.bg),
+ sizeof(Ewl_Color_Set));
+
+ if (context_mask & EWL_TEXT_CONTEXT_MASK_GLOW_COLOR)
+ memcpy(&(new_tx->style_colors.glow),
+ &(tx_change->style_colors.glow),
+ sizeof(Ewl_Color_Set));
+
+ if (context_mask & EWL_TEXT_CONTEXT_MASK_OUTLINE_COLOR)
+ memcpy(&(new_tx->style_colors.outline),
+ &(tx_change->style_colors.outline),
+ sizeof(Ewl_Color_Set));
+
+ if (context_mask & EWL_TEXT_CONTEXT_MASK_SHADOW_COLOR)
+ memcpy(&(new_tx->style_colors.shadow),
+ &(tx_change->style_colors.shadow),
+ sizeof(Ewl_Color_Set));
+
+ if (context_mask & EWL_TEXT_CONTEXT_MASK_STRIKETHROUGH_COLOR)
+ memcpy(&(new_tx->style_colors.strikethrough),
+ &(tx_change->style_colors.strikethrough),
+ sizeof(Ewl_Color_Set));
+
+ if (context_mask & EWL_TEXT_CONTEXT_MASK_UNDERLINE_COLOR)
+ memcpy(&(new_tx->style_colors.underline),
+ &(tx_change->style_colors.underline),
+ sizeof(Ewl_Color_Set));
+
+ if (context_mask & EWL_TEXT_CONTEXT_MASK_DOUBLE_UNDERLINE_COLOR)
+ memcpy(&(new_tx->style_colors.double_underline),
+ &(tx_change->style_colors.double_underline),
+ sizeof(Ewl_Color_Set));
+
+ IF_RELEASE(new_tx->format);
+ ecore_hash_set(context_hash, new_tx, new_tx);
+ }
+ }
+ if (new_tx) ewl_text_context_acquire(new_tx);
+
+ DRETURN_PTR(new_tx, DLEVEL_STABLE);
}
/**
@@ -185,12 +185,12 @@ ewl_text_context_find(Ewl_Text_Context *tx, unsigned int context_mask,
void
ewl_text_context_acquire(Ewl_Text_Context *tx)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(tx);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(tx);
- tx->ref_count ++;
+ tx->ref_count ++;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -204,20 +204,20 @@ ewl_text_context_acquire(Ewl_Text_Context *tx)
int
ewl_text_context_release(Ewl_Text_Context *tx)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(tx, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(tx, 0);
- tx->ref_count --;
- if (tx->ref_count > 0) DRETURN_INT(tx->ref_count, DLEVEL_STABLE);
+ tx->ref_count --;
+ if (tx->ref_count > 0) DRETURN_INT(tx->ref_count, DLEVEL_STABLE);
- ecore_hash_remove(context_hash, tx);
+ ecore_hash_remove(context_hash, tx);
- IF_RELEASE(tx->font);
- IF_RELEASE(tx->font_source);
- IF_RELEASE(tx->format);
- FREE(tx);
+ IF_RELEASE(tx->font);
+ IF_RELEASE(tx->font_source);
+ IF_RELEASE(tx->format);
+ FREE(tx);
- DRETURN_INT(0, DLEVEL_STABLE);
+ DRETURN_INT(0, DLEVEL_STABLE);
}
/**
@@ -230,33 +230,33 @@ ewl_text_context_release(Ewl_Text_Context *tx)
void
ewl_text_context_print(Ewl_Text_Context *tx, const char *indent)
{
- const char *t, *s;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(tx);
-
- if (!tx->font) t = "";
- else t = tx->font;
-
- if (!tx->font_source) s = "";
- else s = tx->font_source;
-
- printf("%sfont: %s (source: %s)\n"
- "%ssize %d\n"
- "%sstyle %d\n"
- "%salign %d\n"
- "%swrap %d\n"
- "%sred %d\n"
- "%sgreen %d\n"
- "%sblue %d\n"
- "%salpha %d",
- indent, t, s, indent, tx->size, indent,
- tx->styles, indent, tx->align,
- indent, tx->wrap, indent, tx->color.r,
- indent, tx->color.g, indent, tx->color.b,
- indent, tx->color.a);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ const char *t, *s;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(tx);
+
+ if (!tx->font) t = "";
+ else t = tx->font;
+
+ if (!tx->font_source) s = "";
+ else s = tx->font_source;
+
+ printf("%sfont: %s (source: %s)\n"
+ "%ssize %d\n"
+ "%sstyle %d\n"
+ "%salign %d\n"
+ "%swrap %d\n"
+ "%sred %d\n"
+ "%sgreen %d\n"
+ "%sblue %d\n"
+ "%salpha %d",
+ indent, t, s, indent, tx->size, indent,
+ tx->styles, indent, tx->align,
+ indent, tx->wrap, indent, tx->color.r,
+ indent, tx->color.g, indent, tx->color.b,
+ indent, tx->color.a);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -270,396 +270,396 @@ ewl_text_context_print(Ewl_Text_Context *tx, const char *indent)
void
ewl_text_context_format_string_create(Ewl_Text_Context *ctx)
{
- char *t;
- int pos = 0, i;
- struct
- {
- const char *key;
- char *val;
- int free;
- } fmt[128];
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(ctx);
-
- /* only do this once if possible */
- if (ctx->format)
- DRETURN(DLEVEL_STABLE);
-
- /* create the style string */
- if (ctx->styles != EWL_TEXT_STYLE_NONE)
- {
- if ((ctx->styles & EWL_TEXT_STYLE_UNDERLINE) ||
- (ctx->styles & EWL_TEXT_STYLE_DOUBLE_UNDERLINE))
- {
- t = ((ctx->styles & EWL_TEXT_STYLE_UNDERLINE) ? "single" : "double");
-
- fmt[pos].key = "underline_color";
- fmt[pos].val = ewl_text_context_color_string_get(
- &(ctx->style_colors.underline));
- fmt[pos++].free = TRUE;
-
- if (ctx->styles & EWL_TEXT_STYLE_DOUBLE_UNDERLINE)
- {
- fmt[pos].key = "underline2_color";
- fmt[pos].val = ewl_text_context_color_string_get(
- &(ctx->style_colors.double_underline));
- fmt[pos++].free = TRUE;
- }
- }
- else t = "off";
-
- fmt[pos].key = "underline";
- fmt[pos].val = t;
- fmt[pos++].free = FALSE;
-
- if (ctx->styles & EWL_TEXT_STYLE_STRIKETHROUGH)
- {
- t = "on";
-
- fmt[pos].key = "strikethrough_color";
- fmt[pos].val = ewl_text_context_color_string_get(
- &(ctx->style_colors.strikethrough));
- fmt[pos++].free = TRUE;
- }
- else t = "off";
-
- fmt[pos].key = "strikethrough";
- fmt[pos].val = t;
- fmt[pos++].free = FALSE;
-
- if ((ctx->styles & EWL_TEXT_STYLE_SHADOW)
- || (ctx->styles & EWL_TEXT_STYLE_SOFT_SHADOW)
- || (ctx->styles & EWL_TEXT_STYLE_FAR_SHADOW)
- || (ctx->styles & EWL_TEXT_STYLE_OUTLINE)
- || (ctx->styles & EWL_TEXT_STYLE_GLOW))
- {
- fmt[pos].key = "shadow_color";
- fmt[pos].val = ewl_text_context_color_string_get(
- &(ctx->style_colors.shadow));
- fmt[pos++].free = TRUE;
-
- if (ctx->styles & EWL_TEXT_STYLE_GLOW)
- {
- t = "glow";
-
- fmt[pos].key = "glow_color";
- fmt[pos].val = ewl_text_context_color_string_get(
- &(ctx->style_colors.glow));
- fmt[pos++].free = TRUE;
- }
- else if (ctx->styles & EWL_TEXT_STYLE_OUTLINE)
- {
- if (ctx->styles & EWL_TEXT_STYLE_SHADOW)
- t = "outline_shadow";
- else if (ctx->styles & EWL_TEXT_STYLE_SOFT_SHADOW)
- t = "outline_soft_shadow";
- else t = "outline";
-
- fmt[pos].key = "outline_color";
- fmt[pos].val = ewl_text_context_color_string_get(
- &(ctx->style_colors.outline));
- fmt[pos++].free = TRUE;
- }
- else if (ctx->styles & EWL_TEXT_STYLE_SHADOW)
- t = "shadow";
-
- else if (ctx->styles & EWL_TEXT_STYLE_FAR_SHADOW)
- {
- if (ctx->styles & EWL_TEXT_STYLE_SOFT_SHADOW)
- t = "far_soft_shadow";
- else t = "far_shadow";
- }
- else if (ctx->styles & EWL_TEXT_STYLE_SOFT_SHADOW)
- t = "soft_shadow";
- }
- else t = "off";
-
- fmt[pos].key = "style";
- fmt[pos].val = t;
- fmt[pos++].free = FALSE;
- }
- else
- {
- fmt[pos].key = "underline";
- fmt[pos].val = "off";
- fmt[pos++].free = FALSE;
-
- fmt[pos].key = "strikethrough";
- fmt[pos].val = "off";
- fmt[pos++].free = FALSE;
-
- fmt[pos].key = "style";
- fmt[pos].val = "off";
- fmt[pos++].free = FALSE;
- }
-
- /* create the alignment string */
- if (ctx->align == EWL_FLAG_ALIGN_CENTER) t = "center";
- else if (ctx->align == EWL_FLAG_ALIGN_RIGHT) t = "right";
- else t = "left";
-
- fmt[pos].key = "align";
- fmt[pos].val = t;
- fmt[pos++].free = FALSE;
-
- if (ctx->wrap == EWL_TEXT_WRAP_WORD) t = "word";
- else if (ctx->wrap == EWL_TEXT_WRAP_CHAR) t = "char";
- else t = "off";
-
- fmt[pos].key = "wrap";
- fmt[pos].val = t;
- fmt[pos++].free = FALSE;
-
-
- fmt[pos].key = "font_source";
- if (ctx->font_source)
- {
- fmt[pos].val = (char *)ctx->font_source;
- fmt[pos++].free = FALSE;
-
- t = strdup(ctx->font);
- }
- else
- {
- fmt[pos].val = (char *)ewl_theme_path_get();
- fmt[pos++].free = FALSE;
-
- t = NEW(char, 128);
- snprintf(t, 128, "fonts/%s", ctx->font);
- }
-
- fmt[pos].key = "font";
- fmt[pos].val = t;
- fmt[pos++].free = TRUE;
-
- t = NEW(char, 5);
- snprintf(t, 5, "%d", ctx->size);
- fmt[pos].key = "font_size";
- fmt[pos].val = t;
- fmt[pos++].free = TRUE;
-
- fmt[pos].key = "backing_color";
- fmt[pos].val = ewl_text_context_color_string_get(&(ctx->style_colors.bg));
- fmt[pos++].free = TRUE;
-
- fmt[pos].key = "color";
- fmt[pos].val = ewl_text_context_color_string_get(&(ctx->color));
- fmt[pos++].free = TRUE;
-
- /* create the formatting string */
- {
- char format[2048];
-
- format[0] = '\0';
- ecore_strlcat(format, "+", sizeof(format));
-
- for (i = 0; i < pos; i ++)
- {
- ecore_strlcat(format, fmt[i].key, sizeof(format));
- ecore_strlcat(format, "=", sizeof(format));
- ecore_strlcat(format, fmt[i].val, sizeof(format));
- ecore_strlcat(format, " ", sizeof(format));
-
- if (fmt[i].free) FREE(fmt[i].val);
- }
-
- ctx->format = ecore_string_instance(format);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ char *t;
+ int pos = 0, i;
+ struct
+ {
+ const char *key;
+ char *val;
+ int free;
+ } fmt[128];
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(ctx);
+
+ /* only do this once if possible */
+ if (ctx->format)
+ DRETURN(DLEVEL_STABLE);
+
+ /* create the style string */
+ if (ctx->styles != EWL_TEXT_STYLE_NONE)
+ {
+ if ((ctx->styles & EWL_TEXT_STYLE_UNDERLINE) ||
+ (ctx->styles & EWL_TEXT_STYLE_DOUBLE_UNDERLINE))
+ {
+ t = ((ctx->styles & EWL_TEXT_STYLE_UNDERLINE) ? "single" : "double");
+
+ fmt[pos].key = "underline_color";
+ fmt[pos].val = ewl_text_context_color_string_get(
+ &(ctx->style_colors.underline));
+ fmt[pos++].free = TRUE;
+
+ if (ctx->styles & EWL_TEXT_STYLE_DOUBLE_UNDERLINE)
+ {
+ fmt[pos].key = "underline2_color";
+ fmt[pos].val = ewl_text_context_color_string_get(
+ &(ctx->style_colors.double_underline));
+ fmt[pos++].free = TRUE;
+ }
+ }
+ else t = "off";
+
+ fmt[pos].key = "underline";
+ fmt[pos].val = t;
+ fmt[pos++].free = FALSE;
+
+ if (ctx->styles & EWL_TEXT_STYLE_STRIKETHROUGH)
+ {
+ t = "on";
+
+ fmt[pos].key = "strikethrough_color";
+ fmt[pos].val = ewl_text_context_color_string_get(
+ &(ctx->style_colors.strikethrough));
+ fmt[pos++].free = TRUE;
+ }
+ else t = "off";
+
+ fmt[pos].key = "strikethrough";
+ fmt[pos].val = t;
+ fmt[pos++].free = FALSE;
+
+ if ((ctx->styles & EWL_TEXT_STYLE_SHADOW)
+ || (ctx->styles & EWL_TEXT_STYLE_SOFT_SHADOW)
+ || (ctx->styles & EWL_TEXT_STYLE_FAR_SHADOW)
+ || (ctx->styles & EWL_TEXT_STYLE_OUTLINE)
+ || (ctx->styles & EWL_TEXT_STYLE_GLOW))
+ {
+ fmt[pos].key = "shadow_color";
+ fmt[pos].val = ewl_text_context_color_string_get(
+ &(ctx->style_colors.shadow));
+ fmt[pos++].free = TRUE;
+
+ if (ctx->styles & EWL_TEXT_STYLE_GLOW)
+ {
+ t = "glow";
+
+ fmt[pos].key = "glow_color";
+ fmt[pos].val = ewl_text_context_color_string_get(
+ &(ctx->style_colors.glow));
+ fmt[pos++].free = TRUE;
+ }
+ else if (ctx->styles & EWL_TEXT_STYLE_OUTLINE)
+ {
+ if (ctx->styles & EWL_TEXT_STYLE_SHADOW)
+ t = "outline_shadow";
+ else if (ctx->styles & EWL_TEXT_STYLE_SOFT_SHADOW)
+ t = "outline_soft_shadow";
+ else t = "outline";
+
+ fmt[pos].key = "outline_color";
+ fmt[pos].val = ewl_text_context_color_string_get(
+ &(ctx->style_colors.outline));
+ fmt[pos++].free = TRUE;
+ }
+ else if (ctx->styles & EWL_TEXT_STYLE_SHADOW)
+ t = "shadow";
+
+ else if (ctx->styles & EWL_TEXT_STYLE_FAR_SHADOW)
+ {
+ if (ctx->styles & EWL_TEXT_STYLE_SOFT_SHADOW)
+ t = "far_soft_shadow";
+ else t = "far_shadow";
+ }
+ else if (ctx->styles & EWL_TEXT_STYLE_SOFT_SHADOW)
+ t = "soft_shadow";
+ }
+ else t = "off";
+
+ fmt[pos].key = "style";
+ fmt[pos].val = t;
+ fmt[pos++].free = FALSE;
+ }
+ else
+ {
+ fmt[pos].key = "underline";
+ fmt[pos].val = "off";
+ fmt[pos++].free = FALSE;
+
+ fmt[pos].key = "strikethrough";
+ fmt[pos].val = "off";
+ fmt[pos++].free = FALSE;
+
+ fmt[pos].key = "style";
+ fmt[pos].val = "off";
+ fmt[pos++].free = FALSE;
+ }
+
+ /* create the alignment string */
+ if (ctx->align == EWL_FLAG_ALIGN_CENTER) t = "center";
+ else if (ctx->align == EWL_FLAG_ALIGN_RIGHT) t = "right";
+ else t = "left";
+
+ fmt[pos].key = "align";
+ fmt[pos].val = t;
+ fmt[pos++].free = FALSE;
+
+ if (ctx->wrap == EWL_TEXT_WRAP_WORD) t = "word";
+ else if (ctx->wrap == EWL_TEXT_WRAP_CHAR) t = "char";
+ else t = "off";
+
+ fmt[pos].key = "wrap";
+ fmt[pos].val = t;
+ fmt[pos++].free = FALSE;
+
+
+ fmt[pos].key = "font_source";
+ if (ctx->font_source)
+ {
+ fmt[pos].val = (char *)ctx->font_source;
+ fmt[pos++].free = FALSE;
+
+ t = strdup(ctx->font);
+ }
+ else
+ {
+ fmt[pos].val = (char *)ewl_theme_path_get();
+ fmt[pos++].free = FALSE;
+
+ t = NEW(char, 128);
+ snprintf(t, 128, "fonts/%s", ctx->font);
+ }
+
+ fmt[pos].key = "font";
+ fmt[pos].val = t;
+ fmt[pos++].free = TRUE;
+
+ t = NEW(char, 5);
+ snprintf(t, 5, "%d", ctx->size);
+ fmt[pos].key = "font_size";
+ fmt[pos].val = t;
+ fmt[pos++].free = TRUE;
+
+ fmt[pos].key = "backing_color";
+ fmt[pos].val = ewl_text_context_color_string_get(&(ctx->style_colors.bg));
+ fmt[pos++].free = TRUE;
+
+ fmt[pos].key = "color";
+ fmt[pos].val = ewl_text_context_color_string_get(&(ctx->color));
+ fmt[pos++].free = TRUE;
+
+ /* create the formatting string */
+ {
+ char format[2048];
+
+ format[0] = '\0';
+ ecore_strlcat(format, "+", sizeof(format));
+
+ for (i = 0; i < pos; i ++)
+ {
+ ecore_strlcat(format, fmt[i].key, sizeof(format));
+ ecore_strlcat(format, "=", sizeof(format));
+ ecore_strlcat(format, fmt[i].val, sizeof(format));
+ ecore_strlcat(format, " ", sizeof(format));
+
+ if (fmt[i].free) FREE(fmt[i].val);
+ }
+
+ ctx->format = ecore_string_instance(format);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static Ewl_Text_Context *
ewl_text_context_dup(Ewl_Text_Context *old)
{
- Ewl_Text_Context *tx;
+ Ewl_Text_Context *tx;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(old, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(old, NULL);
- tx = ewl_text_context_new();
- memcpy(tx, old, sizeof(Ewl_Text_Context));
+ tx = ewl_text_context_new();
+ memcpy(tx, old, sizeof(Ewl_Text_Context));
- /* make sure we get our own pointer to the font so it dosen't get
- * free'd behind our back */
- tx->font = ((old->font) ? ecore_string_instance(old->font) : NULL);
- tx->ref_count = 1;
+ /* make sure we get our own pointer to the font so it dosen't get
+ * free'd behind our back */
+ tx->font = ((old->font) ? ecore_string_instance(old->font) : NULL);
+ tx->ref_count = 1;
- tx->format = ((old->format) ? ecore_string_instance((char *)old->format) : NULL);
+ tx->format = ((old->format) ? ecore_string_instance((char *)old->format) : NULL);
- DRETURN_PTR(tx, DLEVEL_STABLE);
+ DRETURN_PTR(tx, DLEVEL_STABLE);
}
static unsigned int
ewl_text_context_hash_key(const void *ctx)
{
- unsigned int key;
- const Ewl_Text_Context *tx = ctx;
+ unsigned int key;
+ const Ewl_Text_Context *tx = ctx;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- key = 0;
- if (tx->font)
- key ^= ecore_str_hash(tx->font);
- if (tx->font_source)
- key ^= ecore_str_hash(tx->font_source);
- key ^= (tx->size << 5);
- key ^= (tx->styles << 7);
+ key = 0;
+ if (tx->font)
+ key ^= ecore_str_hash(tx->font);
+ if (tx->font_source)
+ key ^= ecore_str_hash(tx->font_source);
+ key ^= (tx->size << 5);
+ key ^= (tx->styles << 7);
#define COLOR_HASH(c) (c.r << 24 | c.g << 16 | c.b << 8 | c.a)
- key ^= COLOR_HASH(tx->color);
- key ^= (COLOR_HASH(tx->style_colors.bg) << 1);
- key ^= (COLOR_HASH(tx->style_colors.glow) >> 1);
- key ^= (COLOR_HASH(tx->style_colors.outline) << 3);
- key ^= (COLOR_HASH(tx->style_colors.shadow) >> 3);
- key ^= (COLOR_HASH(tx->style_colors.strikethrough) << 5);
- key ^= (COLOR_HASH(tx->style_colors.underline) >> 5);
- key ^= (COLOR_HASH(tx->style_colors.double_underline) << 7);
-
- DRETURN_INT(key, DLEVEL_STABLE);
+ key ^= COLOR_HASH(tx->color);
+ key ^= (COLOR_HASH(tx->style_colors.bg) << 1);
+ key ^= (COLOR_HASH(tx->style_colors.glow) >> 1);
+ key ^= (COLOR_HASH(tx->style_colors.outline) << 3);
+ key ^= (COLOR_HASH(tx->style_colors.shadow) >> 3);
+ key ^= (COLOR_HASH(tx->style_colors.strikethrough) << 5);
+ key ^= (COLOR_HASH(tx->style_colors.underline) >> 5);
+ key ^= (COLOR_HASH(tx->style_colors.double_underline) << 7);
+
+ DRETURN_INT(key, DLEVEL_STABLE);
}
static int
ewl_text_context_hash_cmp(const void *ctx1, const void *ctx2)
{
- const Ewl_Text_Context *tx1 = ctx1;
- const Ewl_Text_Context *tx2 = ctx2;
+ const Ewl_Text_Context *tx1 = ctx1;
+ const Ewl_Text_Context *tx2 = ctx2;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
#define KEY_BUILD(c) (c.r | c.g | c.b | c.a)
#define KEY_COMPARE(k1, k2) if (k1 > k2) goto CTX1_LARGER; else if (k2 > k1) goto CTX2_LARGER;
- KEY_COMPARE(ecore_str_compare(tx1->font, tx2->font), 0);
- KEY_COMPARE(tx1->size, tx2->size);
- KEY_COMPARE(tx1->styles, tx2->styles);
- KEY_COMPARE(KEY_BUILD(tx1->color), KEY_BUILD(tx2->color));
- KEY_COMPARE(KEY_BUILD(tx1->style_colors.bg),
- KEY_BUILD(tx2->style_colors.bg));
- KEY_COMPARE(KEY_BUILD(tx1->style_colors.outline),
- KEY_BUILD(tx2->style_colors.outline));
- KEY_COMPARE(KEY_BUILD(tx1->style_colors.shadow),
- KEY_BUILD(tx2->style_colors.shadow));
- KEY_COMPARE(KEY_BUILD(tx1->style_colors.strikethrough),
- KEY_BUILD(tx2->style_colors.strikethrough));
- KEY_COMPARE(KEY_BUILD(tx1->style_colors.underline),
- KEY_BUILD(tx2->style_colors.underline));
- KEY_COMPARE(KEY_BUILD(tx1->style_colors.double_underline),
- KEY_BUILD(tx2->style_colors.double_underline));
-
- DRETURN_INT(0, DLEVEL_STABLE);
+ KEY_COMPARE(ecore_str_compare(tx1->font, tx2->font), 0);
+ KEY_COMPARE(tx1->size, tx2->size);
+ KEY_COMPARE(tx1->styles, tx2->styles);
+ KEY_COMPARE(KEY_BUILD(tx1->color), KEY_BUILD(tx2->color));
+ KEY_COMPARE(KEY_BUILD(tx1->style_colors.bg),
+ KEY_BUILD(tx2->style_colors.bg));
+ KEY_COMPARE(KEY_BUILD(tx1->style_colors.outline),
+ KEY_BUILD(tx2->style_colors.outline));
+ KEY_COMPARE(KEY_BUILD(tx1->style_colors.shadow),
+ KEY_BUILD(tx2->style_colors.shadow));
+ KEY_COMPARE(KEY_BUILD(tx1->style_colors.strikethrough),
+ KEY_BUILD(tx2->style_colors.strikethrough));
+ KEY_COMPARE(KEY_BUILD(tx1->style_colors.underline),
+ KEY_BUILD(tx2->style_colors.underline));
+ KEY_COMPARE(KEY_BUILD(tx1->style_colors.double_underline),
+ KEY_BUILD(tx2->style_colors.double_underline));
+
+ DRETURN_INT(0, DLEVEL_STABLE);
CTX1_LARGER:
- DRETURN_INT(-1, DLEVEL_STABLE);
+ DRETURN_INT(-1, DLEVEL_STABLE);
CTX2_LARGER:
- DRETURN_INT(1, DLEVEL_STABLE);
+ DRETURN_INT(1, DLEVEL_STABLE);
}
static void
ewl_text_context_merge(Ewl_Text_Context *tx, unsigned int context_mask,
- Ewl_Text_Context *tx_change)
+ Ewl_Text_Context *tx_change)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(tx);
-
- if (context_mask & EWL_TEXT_CONTEXT_MASK_FONT) {
- IF_RELEASE(tx->font);
- IF_RELEASE(tx->font_source);
- tx->font = ecore_string_instance(tx_change->font);
- tx->font = ecore_string_instance(tx_change->font);
- }
- tx->size = ((context_mask & EWL_TEXT_CONTEXT_MASK_SIZE) ? tx_change->size : tx->size);
- tx->styles = ((context_mask & EWL_TEXT_CONTEXT_MASK_STYLES) ? tx_change->styles : tx->styles),
- tx->align = ((context_mask & EWL_TEXT_CONTEXT_MASK_ALIGN) ? tx_change->align : tx->align);
- tx->wrap = ((context_mask & EWL_TEXT_CONTEXT_MASK_WRAP) ? tx_change->wrap : tx->wrap);
- tx->color.r = ((context_mask & EWL_TEXT_CONTEXT_MASK_COLOR) ? tx_change->color.r : tx->color.r);
- tx->color.g = ((context_mask & EWL_TEXT_CONTEXT_MASK_COLOR) ? tx_change->color.g : tx->color.g);
- tx->color.b = ((context_mask & EWL_TEXT_CONTEXT_MASK_COLOR) ? tx_change->color.b : tx->color.b);
- tx->color.a = ((context_mask & EWL_TEXT_CONTEXT_MASK_COLOR) ? tx_change->color.a : tx->color.a);
- tx->style_colors.bg.r = ((context_mask & EWL_TEXT_CONTEXT_MASK_BG_COLOR) ?
- tx_change->style_colors.bg.r : tx->style_colors.bg.r);
- tx->style_colors.bg.g = ((context_mask & EWL_TEXT_CONTEXT_MASK_BG_COLOR) ?
- tx_change->style_colors.bg.g : tx->style_colors.bg.g);
- tx->style_colors.bg.b = ((context_mask & EWL_TEXT_CONTEXT_MASK_BG_COLOR) ?
- tx_change->style_colors.bg.b : tx->style_colors.bg.b);
- tx->style_colors.bg.a = ((context_mask & EWL_TEXT_CONTEXT_MASK_BG_COLOR) ?
- tx_change->style_colors.bg.a : tx->style_colors.bg.a);
- tx->style_colors.glow.r = ((context_mask & EWL_TEXT_CONTEXT_MASK_GLOW_COLOR) ?
- tx_change->style_colors.glow.r : tx->style_colors.glow.r);
- tx->style_colors.glow.g = ((context_mask & EWL_TEXT_CONTEXT_MASK_GLOW_COLOR) ?
- tx_change->style_colors.glow.g : tx->style_colors.glow.g);
- tx->style_colors.glow.b = ((context_mask & EWL_TEXT_CONTEXT_MASK_GLOW_COLOR) ?
- tx_change->style_colors.glow.b : tx->style_colors.glow.b);
- tx->style_colors.glow.a = ((context_mask & EWL_TEXT_CONTEXT_MASK_GLOW_COLOR) ?
- tx_change->style_colors.glow.a : tx->style_colors.glow.a);
- tx->style_colors.outline.r = ((context_mask & EWL_TEXT_CONTEXT_MASK_OUTLINE_COLOR) ?
- tx_change->style_colors.outline.r : tx->style_colors.outline.r);
- tx->style_colors.outline.g = ((context_mask & EWL_TEXT_CONTEXT_MASK_OUTLINE_COLOR) ?
- tx_change->style_colors.outline.g : tx->style_colors.outline.g);
- tx->style_colors.outline.b = ((context_mask & EWL_TEXT_CONTEXT_MASK_OUTLINE_COLOR) ?
- tx_change->style_colors.outline.b : tx->style_colors.outline.b);
- tx->style_colors.outline.a = ((context_mask & EWL_TEXT_CONTEXT_MASK_OUTLINE_COLOR) ?
- tx_change->style_colors.outline.a : tx->style_colors.outline.a);
- tx->style_colors.shadow.r = ((context_mask & EWL_TEXT_CONTEXT_MASK_SHADOW_COLOR) ?
- tx_change->style_colors.shadow.r : tx->style_colors.shadow.r);
- tx->style_colors.shadow.g = ((context_mask & EWL_TEXT_CONTEXT_MASK_SHADOW_COLOR) ?
- tx_change->style_colors.shadow.g : tx->style_colors.shadow.g);
- tx->style_colors.shadow.b = ((context_mask & EWL_TEXT_CONTEXT_MASK_SHADOW_COLOR) ?
- tx_change->style_colors.shadow.b : tx->style_colors.shadow.b);
- tx->style_colors.shadow.a = ((context_mask & EWL_TEXT_CONTEXT_MASK_SHADOW_COLOR) ?
- tx_change->style_colors.shadow.a : tx->style_colors.shadow.a);
- tx->style_colors.strikethrough.r = ((context_mask & EWL_TEXT_CONTEXT_MASK_STRIKETHROUGH_COLOR) ?
- tx_change->style_colors.strikethrough.r : tx->style_colors.strikethrough.r);
- tx->style_colors.strikethrough.g = ((context_mask & EWL_TEXT_CONTEXT_MASK_STRIKETHROUGH_COLOR) ?
- tx_change->style_colors.strikethrough.g : tx->style_colors.strikethrough.g);
- tx->style_colors.strikethrough.b = ((context_mask & EWL_TEXT_CONTEXT_MASK_STRIKETHROUGH_COLOR) ?
- tx_change->style_colors.strikethrough.b : tx->style_colors.strikethrough.b);
- tx->style_colors.strikethrough.a = ((context_mask & EWL_TEXT_CONTEXT_MASK_STRIKETHROUGH_COLOR) ?
- tx_change->style_colors.strikethrough.a : tx->style_colors.strikethrough.a);
- tx->style_colors.underline.r = ((context_mask & EWL_TEXT_CONTEXT_MASK_UNDERLINE_COLOR) ?
- tx_change->style_colors.underline.r : tx->style_colors.underline.r),
- tx->style_colors.underline.g = ((context_mask & EWL_TEXT_CONTEXT_MASK_UNDERLINE_COLOR) ?
- tx_change->style_colors.underline.g : tx->style_colors.underline.g),
- tx->style_colors.underline.b = ((context_mask & EWL_TEXT_CONTEXT_MASK_UNDERLINE_COLOR) ?
- tx_change->style_colors.underline.b : tx->style_colors.underline.b),
- tx->style_colors.underline.a = ((context_mask & EWL_TEXT_CONTEXT_MASK_UNDERLINE_COLOR) ?
- tx_change->style_colors.underline.a : tx->style_colors.underline.a),
- tx->style_colors.double_underline.r = ((context_mask & EWL_TEXT_CONTEXT_MASK_DOUBLE_UNDERLINE_COLOR) ?
- tx_change->style_colors.double_underline.r : tx->style_colors.double_underline.r),
- tx->style_colors.double_underline.g = ((context_mask & EWL_TEXT_CONTEXT_MASK_DOUBLE_UNDERLINE_COLOR) ?
- tx_change->style_colors.double_underline.g : tx->style_colors.double_underline.g),
- tx->style_colors.double_underline.b = ((context_mask & EWL_TEXT_CONTEXT_MASK_DOUBLE_UNDERLINE_COLOR) ?
- tx_change->style_colors.double_underline.b : tx->style_colors.double_underline.b),
- tx->style_colors.double_underline.a = ((context_mask & EWL_TEXT_CONTEXT_MASK_DOUBLE_UNDERLINE_COLOR) ?
- tx_change->style_colors.double_underline.a : tx->style_colors.double_underline.a);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(tx);
+
+ if (context_mask & EWL_TEXT_CONTEXT_MASK_FONT) {
+ IF_RELEASE(tx->font);
+ IF_RELEASE(tx->font_source);
+ tx->font = ecore_string_instance(tx_change->font);
+ tx->font = ecore_string_instance(tx_change->font);
+ }
+ tx->size = ((context_mask & EWL_TEXT_CONTEXT_MASK_SIZE) ? tx_change->size : tx->size);
+ tx->styles = ((context_mask & EWL_TEXT_CONTEXT_MASK_STYLES) ? tx_change->styles : tx->styles),
+ tx->align = ((context_mask & EWL_TEXT_CONTEXT_MASK_ALIGN) ? tx_change->align : tx->align);
+ tx->wrap = ((context_mask & EWL_TEXT_CONTEXT_MASK_WRAP) ? tx_change->wrap : tx->wrap);
+ tx->color.r = ((context_mask & EWL_TEXT_CONTEXT_MASK_COLOR) ? tx_change->color.r : tx->color.r);
+ tx->color.g = ((context_mask & EWL_TEXT_CONTEXT_MASK_COLOR) ? tx_change->color.g : tx->color.g);
+ tx->color.b = ((context_mask & EWL_TEXT_CONTEXT_MASK_COLOR) ? tx_change->color.b : tx->color.b);
+ tx->color.a = ((context_mask & EWL_TEXT_CONTEXT_MASK_COLOR) ? tx_change->color.a : tx->color.a);
+ tx->style_colors.bg.r = ((context_mask & EWL_TEXT_CONTEXT_MASK_BG_COLOR) ?
+ tx_change->style_colors.bg.r : tx->style_colors.bg.r);
+ tx->style_colors.bg.g = ((context_mask & EWL_TEXT_CONTEXT_MASK_BG_COLOR) ?
+ tx_change->style_colors.bg.g : tx->style_colors.bg.g);
+ tx->style_colors.bg.b = ((context_mask & EWL_TEXT_CONTEXT_MASK_BG_COLOR) ?
+ tx_change->style_colors.bg.b : tx->style_colors.bg.b);
+ tx->style_colors.bg.a = ((context_mask & EWL_TEXT_CONTEXT_MASK_BG_COLOR) ?
+ tx_change->style_colors.bg.a : tx->style_colors.bg.a);
+ tx->style_colors.glow.r = ((context_mask & EWL_TEXT_CONTEXT_MASK_GLOW_COLOR) ?
+ tx_change->style_colors.glow.r : tx->style_colors.glow.r);
+ tx->style_colors.glow.g = ((context_mask & EWL_TEXT_CONTEXT_MASK_GLOW_COLOR) ?
+ tx_change->style_colors.glow.g : tx->style_colors.glow.g);
+ tx->style_colors.glow.b = ((context_mask & EWL_TEXT_CONTEXT_MASK_GLOW_COLOR) ?
+ tx_change->style_colors.glow.b : tx->style_colors.glow.b);
+ tx->style_colors.glow.a = ((context_mask & EWL_TEXT_CONTEXT_MASK_GLOW_COLOR) ?
+ tx_change->style_colors.glow.a : tx->style_colors.glow.a);
+ tx->style_colors.outline.r = ((context_mask & EWL_TEXT_CONTEXT_MASK_OUTLINE_COLOR) ?
+ tx_change->style_colors.outline.r : tx->style_colors.outline.r);
+ tx->style_colors.outline.g = ((context_mask & EWL_TEXT_CONTEXT_MASK_OUTLINE_COLOR) ?
+ tx_change->style_colors.outline.g : tx->style_colors.outline.g);
+ tx->style_colors.outline.b = ((context_mask & EWL_TEXT_CONTEXT_MASK_OUTLINE_COLOR) ?
+ tx_change->style_colors.outline.b : tx->style_colors.outline.b);
+ tx->style_colors.outline.a = ((context_mask & EWL_TEXT_CONTEXT_MASK_OUTLINE_COLOR) ?
+ tx_change->style_colors.outline.a : tx->style_colors.outline.a);
+ tx->style_colors.shadow.r = ((context_mask & EWL_TEXT_CONTEXT_MASK_SHADOW_COLOR) ?
+ tx_change->style_colors.shadow.r : tx->style_colors.shadow.r);
+ tx->style_colors.shadow.g = ((context_mask & EWL_TEXT_CONTEXT_MASK_SHADOW_COLOR) ?
+ tx_change->style_colors.shadow.g : tx->style_colors.shadow.g);
+ tx->style_colors.shadow.b = ((context_mask & EWL_TEXT_CONTEXT_MASK_SHADOW_COLOR) ?
+ tx_change->style_colors.shadow.b : tx->style_colors.shadow.b);
+ tx->style_colors.shadow.a = ((context_mask & EWL_TEXT_CONTEXT_MASK_SHADOW_COLOR) ?
+ tx_change->style_colors.shadow.a : tx->style_colors.shadow.a);
+ tx->style_colors.strikethrough.r = ((context_mask & EWL_TEXT_CONTEXT_MASK_STRIKETHROUGH_COLOR) ?
+ tx_change->style_colors.strikethrough.r : tx->style_colors.strikethrough.r);
+ tx->style_colors.strikethrough.g = ((context_mask & EWL_TEXT_CONTEXT_MASK_STRIKETHROUGH_COLOR) ?
+ tx_change->style_colors.strikethrough.g : tx->style_colors.strikethrough.g);
+ tx->style_colors.strikethrough.b = ((context_mask & EWL_TEXT_CONTEXT_MASK_STRIKETHROUGH_COLOR) ?
+ tx_change->style_colors.strikethrough.b : tx->style_colors.strikethrough.b);
+ tx->style_colors.strikethrough.a = ((context_mask & EWL_TEXT_CONTEXT_MASK_STRIKETHROUGH_COLOR) ?
+ tx_change->style_colors.strikethrough.a : tx->style_colors.strikethrough.a);
+ tx->style_colors.underline.r = ((context_mask & EWL_TEXT_CONTEXT_MASK_UNDERLINE_COLOR) ?
+ tx_change->style_colors.underline.r : tx->style_colors.underline.r),
+ tx->style_colors.underline.g = ((context_mask & EWL_TEXT_CONTEXT_MASK_UNDERLINE_COLOR) ?
+ tx_change->style_colors.underline.g : tx->style_colors.underline.g),
+ tx->style_colors.underline.b = ((context_mask & EWL_TEXT_CONTEXT_MASK_UNDERLINE_COLOR) ?
+ tx_change->style_colors.underline.b : tx->style_colors.underline.b),
+ tx->style_colors.underline.a = ((context_mask & EWL_TEXT_CONTEXT_MASK_UNDERLINE_COLOR) ?
+ tx_change->style_colors.underline.a : tx->style_colors.underline.a),
+ tx->style_colors.double_underline.r = ((context_mask & EWL_TEXT_CONTEXT_MASK_DOUBLE_UNDERLINE_COLOR) ?
+ tx_change->style_colors.double_underline.r : tx->style_colors.double_underline.r),
+ tx->style_colors.double_underline.g = ((context_mask & EWL_TEXT_CONTEXT_MASK_DOUBLE_UNDERLINE_COLOR) ?
+ tx_change->style_colors.double_underline.g : tx->style_colors.double_underline.g),
+ tx->style_colors.double_underline.b = ((context_mask & EWL_TEXT_CONTEXT_MASK_DOUBLE_UNDERLINE_COLOR) ?
+ tx_change->style_colors.double_underline.b : tx->style_colors.double_underline.b),
+ tx->style_colors.double_underline.a = ((context_mask & EWL_TEXT_CONTEXT_MASK_DOUBLE_UNDERLINE_COLOR) ?
+ tx_change->style_colors.double_underline.a : tx->style_colors.double_underline.a);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_text_context_cb_free(void *data)
{
- Ewl_Text_Context *tx;
+ Ewl_Text_Context *tx;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
- tx = data;
- while (ewl_text_context_release(tx) > 0)
- ;
+ tx = data;
+ while (ewl_text_context_release(tx) > 0)
+ ;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static char *
ewl_text_context_color_string_get(Ewl_Color_Set *colour)
{
- char buf[10];
+ char buf[10];
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- snprintf(buf, sizeof(buf), "#%02x%02x%02x%02x", colour->r, colour->g, colour->b, colour->a);
+ snprintf(buf, sizeof(buf), "#%02x%02x%02x%02x", colour->r, colour->g, colour->b, colour->a);
- DRETURN_PTR(strdup(buf), DLEVEL_STABLE);
+ DRETURN_PTR(strdup(buf), DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_text_context.h b/src/lib/ewl_text_context.h
index e31b8c3..e4af213 100644
--- a/src/lib/ewl_text_context.h
+++ b/src/lib/ewl_text_context.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_TEXT_CONTEXT_H
#define EWL_TEXT_CONTEXT_H
@@ -19,42 +19,42 @@ typedef struct Ewl_Text_Context Ewl_Text_Context;
*/
struct Ewl_Text_Context
{
- const char *font; /**< Font name */
- const char *font_source; /**< The font source */
- unsigned int styles; /**< Styles set in this node */
- unsigned int align; /**< Text alignment */
- Ewl_Text_Wrap wrap; /**< Text wrap setting */
- char size; /**< Font size */
- Ewl_Color_Set color; /**< Font colour */
+ const char *font; /**< Font name */
+ const char *font_source; /**< The font source */
+ unsigned int styles; /**< Styles set in this node */
+ unsigned int align; /**< Text alignment */
+ Ewl_Text_Wrap wrap; /**< Text wrap setting */
+ char size; /**< Font size */
+ Ewl_Color_Set color; /**< Font colour */
- struct
- {
- Ewl_Color_Set bg; /**< Background colour */
- Ewl_Color_Set glow; /**< Glow colour */
- Ewl_Color_Set outline; /**< Outline colour */
- Ewl_Color_Set shadow; /**< Shadow colour */
- Ewl_Color_Set strikethrough; /**< Strikethrough colour */
- Ewl_Color_Set underline; /**< Underline colour */
- Ewl_Color_Set double_underline; /**< Double underline colour */
- } style_colors; /**< Colour information */
+ struct
+ {
+ Ewl_Color_Set bg; /**< Background colour */
+ Ewl_Color_Set glow; /**< Glow colour */
+ Ewl_Color_Set outline; /**< Outline colour */
+ Ewl_Color_Set shadow; /**< Shadow colour */
+ Ewl_Color_Set strikethrough; /**< Strikethrough colour */
+ Ewl_Color_Set underline; /**< Underline colour */
+ Ewl_Color_Set double_underline; /**< Double underline colour */
+ } style_colors; /**< Colour information */
- unsigned int ref_count; /**< Number of references to this context */
- const char *format; /**< This context's format string */
+ unsigned int ref_count; /**< Number of references to this context */
+ const char *format; /**< This context's format string */
};
-int ewl_text_context_init(void);
-void ewl_text_context_shutdown(void);
+int ewl_text_context_init(void);
+void ewl_text_context_shutdown(void);
Ewl_Text_Context *ewl_text_context_new(void);
Ewl_Text_Context *ewl_text_context_find(Ewl_Text_Context *tx,
unsigned int context_mask, Ewl_Text_Context *tx_change);
-void ewl_text_context_acquire(Ewl_Text_Context *tx);
-int ewl_text_context_release(Ewl_Text_Context *tx);
+void ewl_text_context_acquire(Ewl_Text_Context *tx);
+int ewl_text_context_release(Ewl_Text_Context *tx);
-void ewl_text_context_print(Ewl_Text_Context *tx, const char *indent);
-void ewl_text_context_format_string_create(Ewl_Text_Context *ctx);
+void ewl_text_context_print(Ewl_Text_Context *tx, const char *indent);
+void ewl_text_context_format_string_create(Ewl_Text_Context *ctx);
/**
* @}
diff --git a/src/lib/ewl_text_fmt.c b/src/lib/ewl_text_fmt.c
index 8442481..33888cf 100644
--- a/src/lib/ewl_text_fmt.c
+++ b/src/lib/ewl_text_fmt.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_text_fmt.h"
#include "ewl_private.h"
#include "ewl_macros.h"
@@ -15,25 +15,25 @@ static void ewl_text_fmt_node_free(void *node);
Ewl_Text_Fmt *
ewl_text_fmt_new(Ewl_Text *t)
{
- Ewl_Text_Fmt *fmt;
+ Ewl_Text_Fmt *fmt;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, NULL);
- fmt = NEW(Ewl_Text_Fmt, 1);
- if (!fmt) DRETURN_PTR(NULL, DLEVEL_STABLE);
+ fmt = NEW(Ewl_Text_Fmt, 1);
+ if (!fmt) DRETURN_PTR(NULL, DLEVEL_STABLE);
- fmt->nodes = ecore_dlist_new();
- if (!fmt->nodes)
- {
- ewl_text_fmt_destroy(fmt);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
- ecore_dlist_free_cb_set(fmt->nodes, ewl_text_fmt_node_free);
+ fmt->nodes = ecore_dlist_new();
+ if (!fmt->nodes)
+ {
+ ewl_text_fmt_destroy(fmt);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
+ ecore_dlist_free_cb_set(fmt->nodes, ewl_text_fmt_node_free);
- fmt->text = t;
+ fmt->text = t;
- DRETURN_PTR(fmt, DLEVEL_STABLE);
+ DRETURN_PTR(fmt, DLEVEL_STABLE);
}
/**
@@ -44,13 +44,13 @@ ewl_text_fmt_new(Ewl_Text *t)
void
ewl_text_fmt_destroy(Ewl_Text_Fmt *fmt)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fmt);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fmt);
- if (fmt->nodes) ecore_dlist_destroy(fmt->nodes);
- FREE(fmt);
+ if (fmt->nodes) ecore_dlist_destroy(fmt->nodes);
+ FREE(fmt);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -61,24 +61,24 @@ ewl_text_fmt_destroy(Ewl_Text_Fmt *fmt)
void
ewl_text_fmt_clear(Ewl_Text_Fmt *fmt)
{
- Ewl_Text_Fmt_Node *node;
+ Ewl_Text_Fmt_Node *node;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fmt);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fmt);
- while ((node = ecore_dlist_first_remove(fmt->nodes)))
- {
- if (node->tx) ewl_text_context_release(node->tx);
- FREE(node);
- }
+ while ((node = ecore_dlist_first_remove(fmt->nodes)))
+ {
+ if (node->tx) ewl_text_context_release(node->tx);
+ FREE(node);
+ }
- fmt->current_node.char_idx = 0;
- fmt->current_node.byte_idx = 0;
+ fmt->current_node.char_idx = 0;
+ fmt->current_node.byte_idx = 0;
- fmt->length.char_len = 0;
- fmt->length.byte_len = 0;
+ fmt->length.char_len = 0;
+ fmt->length.byte_len = 0;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -91,34 +91,34 @@ ewl_text_fmt_clear(Ewl_Text_Fmt *fmt)
*/
void
ewl_text_fmt_node_prepend(Ewl_Text_Fmt *fmt, Ewl_Text_Context *tx,
- unsigned int char_len, unsigned int byte_len)
+ unsigned int char_len, unsigned int byte_len)
{
- Ewl_Text_Fmt_Node *node = NULL;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fmt);
-
- fmt->length.char_len += char_len;
- fmt->length.byte_len += byte_len;
-
- if (tx)
- {
- node = ewl_text_fmt_node_new(tx, char_len, byte_len);
- ecore_dlist_prepend(fmt->nodes, node);
- }
- else
- {
- node = ewl_text_fmt_get_first(fmt);
- node->char_len += char_len;
- node->byte_len += byte_len;
- }
-
- /* we prepended so we need to add the nodes lengths to the current
- * format position length so we're still in the right spot */
- fmt->current_node.char_idx += char_len;
- fmt->current_node.byte_idx += byte_len;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Text_Fmt_Node *node = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fmt);
+
+ fmt->length.char_len += char_len;
+ fmt->length.byte_len += byte_len;
+
+ if (tx)
+ {
+ node = ewl_text_fmt_node_new(tx, char_len, byte_len);
+ ecore_dlist_prepend(fmt->nodes, node);
+ }
+ else
+ {
+ node = ewl_text_fmt_get_first(fmt);
+ node->char_len += char_len;
+ node->byte_len += byte_len;
+ }
+
+ /* we prepended so we need to add the nodes lengths to the current
+ * format position length so we're still in the right spot */
+ fmt->current_node.char_idx += char_len;
+ fmt->current_node.byte_idx += byte_len;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -131,39 +131,39 @@ ewl_text_fmt_node_prepend(Ewl_Text_Fmt *fmt, Ewl_Text_Context *tx,
*/
void
ewl_text_fmt_node_append(Ewl_Text_Fmt *fmt, Ewl_Text_Context *tx,
- unsigned int char_len, unsigned int byte_len)
+ unsigned int char_len, unsigned int byte_len)
{
- Ewl_Text_Fmt_Node *node;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fmt);
-
- node = ewl_text_fmt_get_last(fmt);
- if (tx && (!node || (node->char_len > 0)))
- {
- node = ewl_text_fmt_node_new(tx, char_len, byte_len);
- ecore_dlist_append(fmt->nodes, node);
- }
- else
- {
- /* if we've got a new context to use and our current
- * formatting node has no text in it replace its context
- * with the new one */
- if (tx && (node->char_len == 0))
- {
- ewl_text_context_release(node->tx);
- node->tx = tx;
- ewl_text_context_acquire(node->tx);
- }
-
- node->char_len += char_len;
- node->byte_len += byte_len;
- }
-
- fmt->length.char_len += char_len;
- fmt->length.byte_len += byte_len;
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Text_Fmt_Node *node;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fmt);
+
+ node = ewl_text_fmt_get_last(fmt);
+ if (tx && (!node || (node->char_len > 0)))
+ {
+ node = ewl_text_fmt_node_new(tx, char_len, byte_len);
+ ecore_dlist_append(fmt->nodes, node);
+ }
+ else
+ {
+ /* if we've got a new context to use and our current
+ * formatting node has no text in it replace its context
+ * with the new one */
+ if (tx && (node->char_len == 0))
+ {
+ ewl_text_context_release(node->tx);
+ node->tx = tx;
+ ewl_text_context_acquire(node->tx);
+ }
+
+ node->char_len += char_len;
+ node->byte_len += byte_len;
+ }
+
+ fmt->length.char_len += char_len;
+ fmt->length.byte_len += byte_len;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -177,90 +177,90 @@ ewl_text_fmt_node_append(Ewl_Text_Fmt *fmt, Ewl_Text_Context *tx,
*/
void
ewl_text_fmt_node_insert(Ewl_Text_Fmt *fmt, unsigned int idx,
- Ewl_Text_Context *tx, unsigned int char_len,
- unsigned int byte_len)
+ Ewl_Text_Context *tx, unsigned int char_len,
+ unsigned int byte_len)
{
- Ewl_Text_Fmt_Node *node = NULL, *cur_node, *left = NULL;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fmt);
-
- fmt->length.char_len += char_len;
- fmt->length.byte_len += byte_len;
-
- if (!tx)
- {
- node = ewl_text_fmt_get_current(fmt);
- node->char_len += char_len;
- node->byte_len += byte_len;
-
- DRETURN(DLEVEL_STABLE);
- }
-
- node = ewl_text_fmt_node_new(tx, char_len, byte_len);
- cur_node = ecore_dlist_current(fmt->nodes);
-
- /* insert at the current location */
- if (fmt->current_node.char_idx == idx)
- ecore_dlist_insert(fmt->nodes, node);
-
- /* insert at the end of the current node */
- else if ((fmt->current_node.char_idx + cur_node->char_len) == idx)
- {
- ecore_dlist_next(fmt->nodes);
- if (ecore_dlist_current(fmt->nodes))
- {
- ecore_dlist_insert(fmt->nodes, node);
-
- /* update our index as we're currently on the next node */
- fmt->current_node.char_idx += cur_node->char_len;
- fmt->current_node.byte_idx += cur_node->byte_len;
- }
- else
- {
- ecore_dlist_append(fmt->nodes, node);
- ecore_dlist_last_goto(fmt->nodes);
-
- /* we haven't incremented the sizes yet so we're at
- * the end of the last set of nodes */
- fmt->current_node.char_idx = fmt->length.char_len;
- fmt->current_node.byte_idx = fmt->length.byte_len;
- }
- }
- else
- {
- /* insert into the middle of the current node */
- left = ewl_text_fmt_node_new(node->tx,
- idx - fmt->current_node.char_idx, 0);
- ewl_text_fmt_char_to_byte(fmt, idx,
- idx - fmt->current_node.char_idx,
- NULL, &(left->byte_len));
-
- cur_node->char_len -= left->char_len;
- cur_node->byte_len -= left->byte_len;
-
- /* insert inserts to the right, so move past the current node so we
- * can insert the two new ones. If we have a node to the left we
- * insert the left node then the new node so the new one is in the
- * middle. If there is no node to the left we insert the new node
- * then the left node. */
- ecore_dlist_next(fmt->nodes);
- if (ecore_dlist_current(fmt->nodes))
- {
- ecore_dlist_insert(fmt->nodes, left);
- ecore_dlist_insert(fmt->nodes, node);
- }
- else
- {
- ecore_dlist_append(fmt->nodes, node);
- ecore_dlist_last_goto(fmt->nodes);
- ecore_dlist_append(fmt->nodes, left);
- }
- fmt->current_node.char_idx += cur_node->char_len;
- fmt->current_node.byte_idx += cur_node->byte_len;
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Text_Fmt_Node *node = NULL, *cur_node, *left = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fmt);
+
+ fmt->length.char_len += char_len;
+ fmt->length.byte_len += byte_len;
+
+ if (!tx)
+ {
+ node = ewl_text_fmt_get_current(fmt);
+ node->char_len += char_len;
+ node->byte_len += byte_len;
+
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ node = ewl_text_fmt_node_new(tx, char_len, byte_len);
+ cur_node = ecore_dlist_current(fmt->nodes);
+
+ /* insert at the current location */
+ if (fmt->current_node.char_idx == idx)
+ ecore_dlist_insert(fmt->nodes, node);
+
+ /* insert at the end of the current node */
+ else if ((fmt->current_node.char_idx + cur_node->char_len) == idx)
+ {
+ ecore_dlist_next(fmt->nodes);
+ if (ecore_dlist_current(fmt->nodes))
+ {
+ ecore_dlist_insert(fmt->nodes, node);
+
+ /* update our index as we're currently on the next node */
+ fmt->current_node.char_idx += cur_node->char_len;
+ fmt->current_node.byte_idx += cur_node->byte_len;
+ }
+ else
+ {
+ ecore_dlist_append(fmt->nodes, node);
+ ecore_dlist_last_goto(fmt->nodes);
+
+ /* we haven't incremented the sizes yet so we're at
+ * the end of the last set of nodes */
+ fmt->current_node.char_idx = fmt->length.char_len;
+ fmt->current_node.byte_idx = fmt->length.byte_len;
+ }
+ }
+ else
+ {
+ /* insert into the middle of the current node */
+ left = ewl_text_fmt_node_new(node->tx,
+ idx - fmt->current_node.char_idx, 0);
+ ewl_text_fmt_char_to_byte(fmt, idx,
+ idx - fmt->current_node.char_idx,
+ NULL, &(left->byte_len));
+
+ cur_node->char_len -= left->char_len;
+ cur_node->byte_len -= left->byte_len;
+
+ /* insert inserts to the right, so move past the current node so we
+ * can insert the two new ones. If we have a node to the left we
+ * insert the left node then the new node so the new one is in the
+ * middle. If there is no node to the left we insert the new node
+ * then the left node. */
+ ecore_dlist_next(fmt->nodes);
+ if (ecore_dlist_current(fmt->nodes))
+ {
+ ecore_dlist_insert(fmt->nodes, left);
+ ecore_dlist_insert(fmt->nodes, node);
+ }
+ else
+ {
+ ecore_dlist_append(fmt->nodes, node);
+ ecore_dlist_last_goto(fmt->nodes);
+ ecore_dlist_append(fmt->nodes, left);
+ }
+ fmt->current_node.char_idx += cur_node->char_len;
+ fmt->current_node.byte_idx += cur_node->byte_len;
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -272,75 +272,75 @@ ewl_text_fmt_node_insert(Ewl_Text_Fmt *fmt, unsigned int idx,
*/
void
ewl_text_fmt_node_delete(Ewl_Text_Fmt *fmt, unsigned int idx,
- unsigned int char_len)
+ unsigned int char_len)
{
- Ewl_Text_Fmt_Node *node;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fmt);
-
- if (idx < fmt->current_node.char_idx)
- {
- DWARNING("The current position (%u) is higher than the to "
- "be to remove position (%u)\n",
- fmt->current_node.char_idx, idx);
- }
- /* adjust the char length, we'll adjust the byte length later */
- fmt->length.char_len -= char_len;
-
- node = ecore_dlist_current(fmt->nodes);
- while (char_len > 0)
- {
- unsigned int available;
-
- /* how much space is available in this node to be removed */
- available = node->char_len - (idx - fmt->current_node.char_idx);
- if (available > char_len) available = char_len;
-
- node->char_len -= available;
- if (node->char_len > 0)
- {
- unsigned int byte_len = 0;
-
- /* Note: we already removed the related text part
- * so it is save to use the new shorter text here */
- ewl_text_fmt_char_to_byte(fmt,
- fmt->current_node.char_idx,
- node->char_len,
- NULL, &byte_len);
-
- /* deduct the byte count */
- fmt->length.byte_len -= node->byte_len - byte_len;
- node->byte_len = byte_len;
-
- fmt->current_node.char_idx += node->char_len;
- fmt->current_node.byte_idx += node->byte_len;
- ecore_dlist_next(fmt->nodes);
- node = ecore_dlist_current(fmt->nodes);
- }
- else
- {
- /* we still need to adjust the global byte count */
- fmt->length.byte_len -= node->byte_len;
-
- ecore_dlist_remove(fmt->nodes);
- ewl_text_fmt_node_free(node);
- node = ecore_dlist_current(fmt->nodes);
- }
- char_len -= available;
- }
-
- /* make sure we've still got a current node. if not reset to the
- * first node in the list */
- node = ecore_dlist_current(fmt->nodes);
- if (!node)
- {
- ecore_dlist_first_goto(fmt->nodes);
- fmt->current_node.char_idx = 0;
- fmt->current_node.byte_idx = 0;
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Text_Fmt_Node *node;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fmt);
+
+ if (idx < fmt->current_node.char_idx)
+ {
+ DWARNING("The current position (%u) is higher than the to "
+ "be to remove position (%u)\n",
+ fmt->current_node.char_idx, idx);
+ }
+ /* adjust the char length, we'll adjust the byte length later */
+ fmt->length.char_len -= char_len;
+
+ node = ecore_dlist_current(fmt->nodes);
+ while (char_len > 0)
+ {
+ unsigned int available;
+
+ /* how much space is available in this node to be removed */
+ available = node->char_len - (idx - fmt->current_node.char_idx);
+ if (available > char_len) available = char_len;
+
+ node->char_len -= available;
+ if (node->char_len > 0)
+ {
+ unsigned int byte_len = 0;
+
+ /* Note: we already removed the related text part
+ * so it is save to use the new shorter text here */
+ ewl_text_fmt_char_to_byte(fmt,
+ fmt->current_node.char_idx,
+ node->char_len,
+ NULL, &byte_len);
+
+ /* deduct the byte count */
+ fmt->length.byte_len -= node->byte_len - byte_len;
+ node->byte_len = byte_len;
+
+ fmt->current_node.char_idx += node->char_len;
+ fmt->current_node.byte_idx += node->byte_len;
+ ecore_dlist_next(fmt->nodes);
+ node = ecore_dlist_current(fmt->nodes);
+ }
+ else
+ {
+ /* we still need to adjust the global byte count */
+ fmt->length.byte_len -= node->byte_len;
+
+ ecore_dlist_remove(fmt->nodes);
+ ewl_text_fmt_node_free(node);
+ node = ecore_dlist_current(fmt->nodes);
+ }
+ char_len -= available;
+ }
+
+ /* make sure we've still got a current node. if not reset to the
+ * first node in the list */
+ node = ecore_dlist_current(fmt->nodes);
+ if (!node)
+ {
+ ecore_dlist_first_goto(fmt->nodes);
+ fmt->current_node.char_idx = 0;
+ fmt->current_node.byte_idx = 0;
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -351,10 +351,10 @@ ewl_text_fmt_node_delete(Ewl_Text_Fmt *fmt, unsigned int idx,
unsigned int
ewl_text_fmt_node_count_get(Ewl_Text_Fmt *fmt)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fmt, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fmt, 0);
- DRETURN_INT(ecore_dlist_count(fmt->nodes), DLEVEL_STABLE);
+ DRETURN_INT(ecore_dlist_count(fmt->nodes), DLEVEL_STABLE);
}
/**
@@ -365,10 +365,10 @@ ewl_text_fmt_node_count_get(Ewl_Text_Fmt *fmt)
Ewl_Text_Fmt_Node *
ewl_text_fmt_get_last(Ewl_Text_Fmt *fmt)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fmt, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fmt, NULL);
- DRETURN_PTR(ecore_dlist_last_goto(fmt->nodes),DLEVEL_STABLE);
+ DRETURN_PTR(ecore_dlist_last_goto(fmt->nodes),DLEVEL_STABLE);
}
/**
@@ -379,10 +379,10 @@ ewl_text_fmt_get_last(Ewl_Text_Fmt *fmt)
Ewl_Text_Fmt_Node *
ewl_text_fmt_get_first(Ewl_Text_Fmt *fmt)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fmt, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fmt, NULL);
- DRETURN_PTR(ecore_dlist_first_goto(fmt->nodes), DLEVEL_STABLE);
+ DRETURN_PTR(ecore_dlist_first_goto(fmt->nodes), DLEVEL_STABLE);
}
/**
@@ -393,10 +393,10 @@ ewl_text_fmt_get_first(Ewl_Text_Fmt *fmt)
Ewl_Text_Fmt_Node *
ewl_text_fmt_get_current(Ewl_Text_Fmt *fmt)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fmt, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fmt, NULL);
- DRETURN_PTR(ecore_dlist_current(fmt->nodes), DLEVEL_STABLE);
+ DRETURN_PTR(ecore_dlist_current(fmt->nodes), DLEVEL_STABLE);
}
/**
@@ -408,24 +408,24 @@ ewl_text_fmt_get_current(Ewl_Text_Fmt *fmt)
Ewl_Text_Fmt_Node *
ewl_text_fmt_get(Ewl_Text_Fmt *fmt, unsigned int idx)
{
- Ewl_Text_Fmt_Node *node, *current_node;
- unsigned int cur_byte, cur_char;
+ Ewl_Text_Fmt_Node *node, *current_node;
+ unsigned int cur_byte, cur_char;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(fmt, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(fmt, NULL);
- cur_char = fmt->current_node.char_idx;
- cur_byte = fmt->current_node.byte_idx;
- current_node = ecore_dlist_current(fmt->nodes);
+ cur_char = fmt->current_node.char_idx;
+ cur_byte = fmt->current_node.byte_idx;
+ current_node = ecore_dlist_current(fmt->nodes);
- ewl_text_fmt_goto(fmt, idx);
- node = ecore_dlist_current(fmt->nodes);
+ ewl_text_fmt_goto(fmt, idx);
+ node = ecore_dlist_current(fmt->nodes);
- ecore_dlist_goto(fmt->nodes, current_node);
- fmt->current_node.char_idx = cur_char;
- fmt->current_node.byte_idx = cur_byte;
+ ecore_dlist_goto(fmt->nodes, current_node);
+ fmt->current_node.char_idx = cur_char;
+ fmt->current_node.byte_idx = cur_byte;
- DRETURN_PTR(node, DLEVEL_STABLE);
+ DRETURN_PTR(node, DLEVEL_STABLE);
}
/**
@@ -437,120 +437,120 @@ ewl_text_fmt_get(Ewl_Text_Fmt *fmt, unsigned int idx)
void
ewl_text_fmt_goto(Ewl_Text_Fmt *fmt, unsigned int idx)
{
- Ewl_Text_Fmt_Node *node;
+ Ewl_Text_Fmt_Node *node;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fmt);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fmt);
- if (fmt->length.char_len != EWL_TEXT(fmt->text)->length.chars)
- {
- DWARNING("The character length of the fmt (%u) is not"
- " equal to the length of the text (%u)\n",
- fmt->length.char_len,
- EWL_TEXT(fmt->text)->length.chars);
- }
+ if (fmt->length.char_len != EWL_TEXT(fmt->text)->length.chars)
+ {
+ DWARNING("The character length of the fmt (%u) is not"
+ " equal to the length of the text (%u)\n",
+ fmt->length.char_len,
+ EWL_TEXT(fmt->text)->length.chars);
+ }
- if (idx >= fmt->length.char_len)
- {
- node = ecore_dlist_last_goto(fmt->nodes);
+ if (idx >= fmt->length.char_len)
+ {
+ node = ecore_dlist_last_goto(fmt->nodes);
- fmt->current_node.char_idx =
- fmt->length.char_len - node->char_len;
- fmt->current_node.byte_idx =
- fmt->length.byte_len - node->byte_len;
+ fmt->current_node.char_idx =
+ fmt->length.char_len - node->char_len;
+ fmt->current_node.byte_idx =
+ fmt->length.byte_len - node->byte_len;
- DRETURN(DLEVEL_STABLE);
- }
+ DRETURN(DLEVEL_STABLE);
+ }
- node = ecore_dlist_first_goto(fmt->nodes);
- fmt->current_node.char_idx = 0;
- fmt->current_node.byte_idx = 0;
+ node = ecore_dlist_first_goto(fmt->nodes);
+ fmt->current_node.char_idx = 0;
+ fmt->current_node.byte_idx = 0;
- while ((fmt->current_node.char_idx + node->char_len) <= idx)
- {
- fmt->current_node.char_idx += node->char_len;
- fmt->current_node.byte_idx += node->byte_len;
+ while ((fmt->current_node.char_idx + node->char_len) <= idx)
+ {
+ fmt->current_node.char_idx += node->char_len;
+ fmt->current_node.byte_idx += node->byte_len;
- ecore_dlist_next(fmt->nodes);
- node = ecore_dlist_current(fmt->nodes);
- }
+ ecore_dlist_next(fmt->nodes);
+ node = ecore_dlist_current(fmt->nodes);
+ }
#if 0
- /* set to start of text */
- if (idx == 0)
- {
- fmt->current_node.char_idx = 0;
- fmt->current_node.byte_idx = 0;
- ecore_dlist_first_goto(fmt->nodes);
- }
-
- /* set to end of text */
- else if (idx >= fmt->length.char_len)
- {
- node = ecore_dlist_last_goto(fmt->nodes);
-
- fmt->current_node.char_idx =
- fmt->length.char_len - node->char_len;
- fmt->current_node.byte_idx =
- fmt->length.byte_len - node->byte_len;
- }
-
- /* set to after our current position
- * walk forward until we cover the given position */
- else if (fmt->current_node.char_idx < idx)
- {
- node = ecore_dlist_current(fmt->nodes);
- while ((node->char_len + fmt->current_node.char_idx) < idx)
- {
- fmt->current_node.char_idx += node->char_len;
- fmt->current_node.byte_idx += node->byte_len;
-
- ecore_dlist_next(fmt->nodes);
- if (!(node = ecore_dlist_current(fmt->nodes)))
- {
- DWARNING("Incorrectly walked off list.\n");
- node = ecore_dlist_last_goto(fmt->nodes);
- fmt->current_node.char_idx =
- fmt->length.char_len - node->char_len;
- fmt->current_node.byte_idx =
- fmt->length.byte_len - node->byte_len;
- break;
- }
- }
- }
-
- /* set before our position
- * walk back until we're less then the given position */
- else
- {
- while (fmt->current_node.char_idx > idx)
- {
- ecore_dlist_previous(fmt->nodes);
- if (!(node = ecore_dlist_current(fmt->nodes)))
- {
- DWARNING("Incorrectly walked off list.\n");
- node = ecore_dlist_first_goto(fmt->nodes);
- fmt->current_node.char_idx = 0;
- fmt->current_node.byte_idx = 0;
- break;
- }
-
- fmt->current_node.char_idx -= node->char_len;
- fmt->current_node.byte_idx -= node->byte_len;
- }
- }
-
- if (!(node = ecore_dlist_current(fmt->nodes)))
- {
- DWARNING("Unable to place cursor at %d", idx);
-
- ecore_dlist_first_goto(fmt->nodes);
- fmt->current_node.char_idx = 0;
- fmt->current_node.byte_idx = 0;
- }
+ /* set to start of text */
+ if (idx == 0)
+ {
+ fmt->current_node.char_idx = 0;
+ fmt->current_node.byte_idx = 0;
+ ecore_dlist_first_goto(fmt->nodes);
+ }
+
+ /* set to end of text */
+ else if (idx >= fmt->length.char_len)
+ {
+ node = ecore_dlist_last_goto(fmt->nodes);
+
+ fmt->current_node.char_idx =
+ fmt->length.char_len - node->char_len;
+ fmt->current_node.byte_idx =
+ fmt->length.byte_len - node->byte_len;
+ }
+
+ /* set to after our current position
+ * walk forward until we cover the given position */
+ else if (fmt->current_node.char_idx < idx)
+ {
+ node = ecore_dlist_current(fmt->nodes);
+ while ((node->char_len + fmt->current_node.char_idx) < idx)
+ {
+ fmt->current_node.char_idx += node->char_len;
+ fmt->current_node.byte_idx += node->byte_len;
+
+ ecore_dlist_next(fmt->nodes);
+ if (!(node = ecore_dlist_current(fmt->nodes)))
+ {
+ DWARNING("Incorrectly walked off list.\n");
+ node = ecore_dlist_last_goto(fmt->nodes);
+ fmt->current_node.char_idx =
+ fmt->length.char_len - node->char_len;
+ fmt->current_node.byte_idx =
+ fmt->length.byte_len - node->byte_len;
+ break;
+ }
+ }
+ }
+
+ /* set before our position
+ * walk back until we're less then the given position */
+ else
+ {
+ while (fmt->current_node.char_idx > idx)
+ {
+ ecore_dlist_previous(fmt->nodes);
+ if (!(node = ecore_dlist_current(fmt->nodes)))
+ {
+ DWARNING("Incorrectly walked off list.\n");
+ node = ecore_dlist_first_goto(fmt->nodes);
+ fmt->current_node.char_idx = 0;
+ fmt->current_node.byte_idx = 0;
+ break;
+ }
+
+ fmt->current_node.char_idx -= node->char_len;
+ fmt->current_node.byte_idx -= node->byte_len;
+ }
+ }
+
+ if (!(node = ecore_dlist_current(fmt->nodes)))
+ {
+ DWARNING("Unable to place cursor at %d", idx);
+
+ ecore_dlist_first_goto(fmt->nodes);
+ fmt->current_node.char_idx = 0;
+ fmt->current_node.byte_idx = 0;
+ }
#endif
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -561,24 +561,24 @@ ewl_text_fmt_goto(Ewl_Text_Fmt *fmt, unsigned int idx)
void
ewl_text_fmt_dump(Ewl_Text_Fmt *fmt)
{
- Ewl_Text_Fmt_Node *node, *cur_node;
+ Ewl_Text_Fmt_Node *node, *cur_node;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fmt);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fmt);
- cur_node = ecore_dlist_current(fmt->nodes);
- ecore_dlist_first_goto(fmt->nodes);
+ cur_node = ecore_dlist_current(fmt->nodes);
+ ecore_dlist_first_goto(fmt->nodes);
- while ((node = ecore_dlist_next(fmt->nodes)))
- {
- printf("%d chars, %d bytes\n", node->char_len, node->byte_len);
- ewl_text_context_print(node->tx, " ");
- printf("\n\n");
- }
+ while ((node = ecore_dlist_next(fmt->nodes)))
+ {
+ printf("%d chars, %d bytes\n", node->char_len, node->byte_len);
+ ewl_text_context_print(node->tx, " ");
+ printf("\n\n");
+ }
- ecore_dlist_goto(fmt->nodes, cur_node);
+ ecore_dlist_goto(fmt->nodes, cur_node);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -595,107 +595,107 @@ ewl_text_fmt_dump(Ewl_Text_Fmt *fmt)
* started */
void
ewl_text_fmt_char_to_byte(Ewl_Text_Fmt *fmt,
- unsigned int char_idx, unsigned int char_len,
- unsigned int *byte_idx, unsigned int *byte_len)
+ unsigned int char_idx, unsigned int char_len,
+ unsigned int *byte_idx, unsigned int *byte_len)
{
- Ewl_Text *t;
- Ewl_Text_Fmt_Node *current_node, *node = NULL;
- unsigned int cur_char_idx = 0, bidx = 0;
- void *(*move)(Ecore_DList *list);
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fmt);
-
- t = fmt->text;
- current_node = ecore_dlist_current(fmt->nodes);
- cur_char_idx = fmt->current_node.char_idx;
- bidx = fmt->current_node.byte_idx;
-
- /* first step is to find the actual node that this text represents */
- if (fmt->current_node.char_idx < char_idx)
- {
- /* walk forward until we cover the given position */
- node = ecore_dlist_current(fmt->nodes);
- while ((node->char_len + cur_char_idx) < char_idx)
- {
- cur_char_idx += node->char_len;
- bidx += node->byte_len;
-
- ecore_dlist_next(fmt->nodes);
- node = ecore_dlist_current(fmt->nodes);
- if (!node) break;
- }
- move = ecore_dlist_previous;
-
- if (!node)
- {
- node = ecore_dlist_last_goto(fmt->nodes);
- fmt->current_node.char_idx = fmt->length.char_len - node->char_len;
- fmt->current_node.byte_idx = fmt->length.byte_len - node->byte_len;
- }
- }
- else
- {
- /* walk back until we're less then the given position */
- while (cur_char_idx > char_idx)
- {
- ecore_dlist_previous(fmt->nodes);
- node = ecore_dlist_current(fmt->nodes);
- if (!node) break;
-
- cur_char_idx -= node->char_len;
- bidx -= node->byte_len;
- }
- move = ecore_dlist_next;
-
- if (!node)
- {
- node = ecore_dlist_first_goto(fmt->nodes);
- fmt->current_node.char_idx = 0;
- fmt->current_node.byte_idx = 0;
- }
- }
-
- /* we still need to count within this node */
- while (cur_char_idx < char_idx)
- {
- unsigned int bytes;
-
- ewl_text_text_next_char(t->text + bidx, &bytes);
- bidx += bytes;
- cur_char_idx ++;
- }
-
- if (byte_len)
- {
- if (char_len == 0) *byte_len = 0;
- else
- {
- char *txt;
-
- txt = t->text + bidx;
- cur_char_idx = 0;
- while (cur_char_idx < char_len)
- {
- unsigned int bytes;
-
- txt = ewl_text_text_next_char(txt, &bytes);
- *byte_len += bytes;
- cur_char_idx ++;
- }
- }
- }
-
- if (byte_idx) *byte_idx = bidx;
-
- node = ecore_dlist_current(fmt->nodes);
- while (node != current_node)
- {
- move(fmt->nodes);
- node = ecore_dlist_current(fmt->nodes);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Text *t;
+ Ewl_Text_Fmt_Node *current_node, *node = NULL;
+ unsigned int cur_char_idx = 0, bidx = 0;
+ void *(*move)(Ecore_DList *list);
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fmt);
+
+ t = fmt->text;
+ current_node = ecore_dlist_current(fmt->nodes);
+ cur_char_idx = fmt->current_node.char_idx;
+ bidx = fmt->current_node.byte_idx;
+
+ /* first step is to find the actual node that this text represents */
+ if (fmt->current_node.char_idx < char_idx)
+ {
+ /* walk forward until we cover the given position */
+ node = ecore_dlist_current(fmt->nodes);
+ while ((node->char_len + cur_char_idx) < char_idx)
+ {
+ cur_char_idx += node->char_len;
+ bidx += node->byte_len;
+
+ ecore_dlist_next(fmt->nodes);
+ node = ecore_dlist_current(fmt->nodes);
+ if (!node) break;
+ }
+ move = ecore_dlist_previous;
+
+ if (!node)
+ {
+ node = ecore_dlist_last_goto(fmt->nodes);
+ fmt->current_node.char_idx = fmt->length.char_len - node->char_len;
+ fmt->current_node.byte_idx = fmt->length.byte_len - node->byte_len;
+ }
+ }
+ else
+ {
+ /* walk back until we're less then the given position */
+ while (cur_char_idx > char_idx)
+ {
+ ecore_dlist_previous(fmt->nodes);
+ node = ecore_dlist_current(fmt->nodes);
+ if (!node) break;
+
+ cur_char_idx -= node->char_len;
+ bidx -= node->byte_len;
+ }
+ move = ecore_dlist_next;
+
+ if (!node)
+ {
+ node = ecore_dlist_first_goto(fmt->nodes);
+ fmt->current_node.char_idx = 0;
+ fmt->current_node.byte_idx = 0;
+ }
+ }
+
+ /* we still need to count within this node */
+ while (cur_char_idx < char_idx)
+ {
+ unsigned int bytes;
+
+ ewl_text_text_next_char(t->text + bidx, &bytes);
+ bidx += bytes;
+ cur_char_idx ++;
+ }
+
+ if (byte_len)
+ {
+ if (char_len == 0) *byte_len = 0;
+ else
+ {
+ char *txt;
+
+ txt = t->text + bidx;
+ cur_char_idx = 0;
+ while (cur_char_idx < char_len)
+ {
+ unsigned int bytes;
+
+ txt = ewl_text_text_next_char(txt, &bytes);
+ *byte_len += bytes;
+ cur_char_idx ++;
+ }
+ }
+ }
+
+ if (byte_idx) *byte_idx = bidx;
+
+ node = ecore_dlist_current(fmt->nodes);
+ while (node != current_node)
+ {
+ move(fmt->nodes);
+ node = ecore_dlist_current(fmt->nodes);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -710,107 +710,107 @@ ewl_text_fmt_char_to_byte(Ewl_Text_Fmt *fmt,
*/
void
ewl_text_fmt_byte_to_char(Ewl_Text_Fmt *fmt,
- unsigned int byte_idx, unsigned int byte_len,
- unsigned int *char_idx, unsigned int *char_len)
+ unsigned int byte_idx, unsigned int byte_len,
+ unsigned int *char_idx, unsigned int *char_len)
{
- Ewl_Text *t;
- Ewl_Text_Fmt_Node *current_node, *node = NULL;
- unsigned int byte_count = 0, cidx = 0;
- void *(*move)(Ecore_DList *list);
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fmt);
-
- t = fmt->text;
- current_node = ecore_dlist_current(fmt->nodes);
- if (fmt->current_node.byte_idx < byte_idx)
- {
- byte_count = fmt->current_node.byte_idx;
- cidx = fmt->current_node.char_idx;
-
- /* walk forward until we cover the given position */
- node = ecore_dlist_current(fmt->nodes);
- while ((node->byte_len + byte_count) < byte_idx)
- {
- byte_count += node->byte_len;
- cidx += node->char_len;
-
- ecore_dlist_next(fmt->nodes);
- node = ecore_dlist_current(fmt->nodes);
- if (!node) break;
- }
-
- if (!node)
- {
- node = ecore_dlist_last_goto(fmt->nodes);
- fmt->current_node.char_idx = fmt->length.char_len - node->char_len;
- fmt->current_node.byte_idx = fmt->length.byte_len - node->byte_len;
- }
- move = ecore_dlist_previous;
- }
- else
- {
- /* walk back until we're less then the given position */
- node = ecore_dlist_current(fmt->nodes);
- while (byte_count > byte_idx)
- {
- ecore_dlist_previous(fmt->nodes);
- node = ecore_dlist_current(fmt->nodes);
- if (!node) break;
-
- byte_count -= node->byte_len;
- cidx -= node->char_len;
- }
-
- if (!node)
- {
- ecore_dlist_first_goto(fmt->nodes);
- fmt->current_node.char_idx = 0;
- fmt->current_node.byte_idx = 0;
- }
- move = ecore_dlist_next;
- }
-
- /* we still need to count within this node */
- while (byte_count < byte_idx)
- {
- unsigned int bytes;
-
- ewl_text_text_next_char(t->text + byte_count, &bytes);
- byte_count += bytes;
- cidx ++;
- }
-
- if (char_len)
- {
- if (byte_len == 0) *char_len = 0;
- else
- {
- char *txt;
-
- txt = t->text + byte_idx;
- byte_count = 0;
- while (byte_count < byte_len)
- {
- unsigned int bytes;
-
- txt = ewl_text_text_next_char(txt, &bytes);
- byte_count += bytes;
- (*char_len) ++;
- }
- }
- }
-
- if (char_idx) *char_idx = cidx;
-
- node = ecore_dlist_current(fmt->nodes);
- while (node != current_node)
- {
- move(fmt->nodes);
- node = ecore_dlist_current(fmt->nodes);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Text *t;
+ Ewl_Text_Fmt_Node *current_node, *node = NULL;
+ unsigned int byte_count = 0, cidx = 0;
+ void *(*move)(Ecore_DList *list);
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fmt);
+
+ t = fmt->text;
+ current_node = ecore_dlist_current(fmt->nodes);
+ if (fmt->current_node.byte_idx < byte_idx)
+ {
+ byte_count = fmt->current_node.byte_idx;
+ cidx = fmt->current_node.char_idx;
+
+ /* walk forward until we cover the given position */
+ node = ecore_dlist_current(fmt->nodes);
+ while ((node->byte_len + byte_count) < byte_idx)
+ {
+ byte_count += node->byte_len;
+ cidx += node->char_len;
+
+ ecore_dlist_next(fmt->nodes);
+ node = ecore_dlist_current(fmt->nodes);
+ if (!node) break;
+ }
+
+ if (!node)
+ {
+ node = ecore_dlist_last_goto(fmt->nodes);
+ fmt->current_node.char_idx = fmt->length.char_len - node->char_len;
+ fmt->current_node.byte_idx = fmt->length.byte_len - node->byte_len;
+ }
+ move = ecore_dlist_previous;
+ }
+ else
+ {
+ /* walk back until we're less then the given position */
+ node = ecore_dlist_current(fmt->nodes);
+ while (byte_count > byte_idx)
+ {
+ ecore_dlist_previous(fmt->nodes);
+ node = ecore_dlist_current(fmt->nodes);
+ if (!node) break;
+
+ byte_count -= node->byte_len;
+ cidx -= node->char_len;
+ }
+
+ if (!node)
+ {
+ ecore_dlist_first_goto(fmt->nodes);
+ fmt->current_node.char_idx = 0;
+ fmt->current_node.byte_idx = 0;
+ }
+ move = ecore_dlist_next;
+ }
+
+ /* we still need to count within this node */
+ while (byte_count < byte_idx)
+ {
+ unsigned int bytes;
+
+ ewl_text_text_next_char(t->text + byte_count, &bytes);
+ byte_count += bytes;
+ cidx ++;
+ }
+
+ if (char_len)
+ {
+ if (byte_len == 0) *char_len = 0;
+ else
+ {
+ char *txt;
+
+ txt = t->text + byte_idx;
+ byte_count = 0;
+ while (byte_count < byte_len)
+ {
+ unsigned int bytes;
+
+ txt = ewl_text_text_next_char(txt, &bytes);
+ byte_count += bytes;
+ (*char_len) ++;
+ }
+ }
+ }
+
+ if (char_idx) *char_idx = cidx;
+
+ node = ecore_dlist_current(fmt->nodes);
+ while (node != current_node)
+ {
+ move(fmt->nodes);
+ node = ecore_dlist_current(fmt->nodes);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -821,25 +821,25 @@ ewl_text_fmt_byte_to_char(Ewl_Text_Fmt *fmt,
*/
void
ewl_text_fmt_walk(Ewl_Text_Fmt *fmt,
- void (*cb)(Ewl_Text_Fmt_Node *, Ewl_Text *, unsigned int byte_idx))
+ void (*cb)(Ewl_Text_Fmt_Node *, Ewl_Text *, unsigned int byte_idx))
{
- Ewl_Text_Fmt_Node *current_node, *node;
- unsigned int byte_idx = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(fmt);
- DCHECK_PARAM_PTR(cb);
-
- current_node = ecore_dlist_current(fmt->nodes);
- ecore_dlist_first_goto(fmt->nodes);
- while ((node = ecore_dlist_next(fmt->nodes)))
- {
- cb(node, fmt->text, byte_idx);
- byte_idx += node->byte_len;
- }
- ecore_dlist_goto(fmt->nodes, current_node);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Text_Fmt_Node *current_node, *node;
+ unsigned int byte_idx = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(fmt);
+ DCHECK_PARAM_PTR(cb);
+
+ current_node = ecore_dlist_current(fmt->nodes);
+ ecore_dlist_first_goto(fmt->nodes);
+ while ((node = ecore_dlist_next(fmt->nodes)))
+ {
+ cb(node, fmt->text, byte_idx);
+ byte_idx += node->byte_len;
+ }
+ ecore_dlist_goto(fmt->nodes, current_node);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -854,161 +854,161 @@ ewl_text_fmt_walk(Ewl_Text_Fmt *fmt,
*/
void
ewl_text_fmt_apply(Ewl_Text_Fmt *fmt, unsigned int context_mask,
- Ewl_Text_Context *change, unsigned int char_idx,
- unsigned int char_len)
+ Ewl_Text_Context *change, unsigned int char_idx,
+ unsigned int char_len)
{
- Ewl_Text *t;
- unsigned int cursor_idx;
- Ewl_Text_Fmt_Node *node;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(change);
-
- if ((char_len == 0) || (context_mask == EWL_TEXT_CONTEXT_MASK_NONE))
- DRETURN(DLEVEL_STABLE);
-
- cursor_idx = char_idx;
-
- /* make sure we're where we think we are */
- ewl_text_fmt_goto(fmt, cursor_idx);
-
- t = fmt->text;
- node = ecore_dlist_current(fmt->nodes);
- while (char_len > 0)
- {
- /* we've walked off the end of the list */
- if (!node) break;
-
- /* covers entire node */
- if ((char_idx == fmt->current_node.char_idx)
- && (node->char_len <= char_len))
- {
- Ewl_Text_Context *new_tx;
-
- new_tx = ewl_text_context_find(node->tx,
- context_mask, change);
- ewl_text_context_release(node->tx);
- node->tx = new_tx;
-
- char_idx += node->char_len;
- char_len -= node->char_len;
- ecore_dlist_next(fmt->nodes);
-
- fmt->current_node.char_idx += node->char_len;
- fmt->current_node.byte_idx += node->byte_len;
- }
-
- /* start is the same, node is longer then needed */
- else if (char_idx == fmt->current_node.char_idx)
- {
- unsigned int blen = 0;
- Ewl_Text_Fmt_Node *new;
-
- ewl_text_fmt_char_to_byte(fmt,
- char_idx, char_len, NULL, &blen);
-
- new = ewl_text_fmt_node_new(
- ewl_text_context_find(node->tx,
- context_mask, change),
- char_len, blen);
-
- node->char_len -= new->char_len;
- node->byte_len -= new->byte_len;
-
- ecore_dlist_insert(fmt->nodes, new);
- ecore_dlist_next(fmt->nodes);
-
- fmt->current_node.char_idx += new->char_len;
- fmt->current_node.byte_idx += new->byte_len;
-
- char_idx += new->char_len;
- char_len -= new->char_len;
- }
-
- /* starts are different, need to set context on end of node */
- else
- {
- Ewl_Text_Fmt_Node *new;
- unsigned int blen = 0, right_skip;
-
- if (char_idx < fmt->current_node.char_idx)
- {
- DWARNING("Cursor index less than formatting node index");
- right_skip = 0;
- }
- else
- right_skip = char_idx - fmt->current_node.char_idx;
- ewl_text_fmt_char_to_byte(fmt, fmt->current_node.char_idx,
- right_skip, NULL, &blen);
-
- new = ewl_text_fmt_node_new(node->tx, right_skip, blen);
-
- ecore_dlist_insert(fmt->nodes, new);
- ecore_dlist_next(fmt->nodes);
- if (!ecore_dlist_current(fmt->nodes))
- ecore_dlist_last_goto(fmt->nodes);
-
- fmt->current_node.char_idx += new->char_len;
- fmt->current_node.byte_idx += new->byte_len;
-
- /* update node to be the new formatting piece */
- node->tx = ewl_text_context_find(node->tx,
- context_mask, change);
- node->char_len -= new->char_len;
- node->byte_len -= new->byte_len;
-
- /* the rest of the node is covered */
- if (node->char_len <= char_len)
- {
- char_len -= node->char_len;
- char_idx += node->char_len;
-
- ecore_dlist_next(fmt->nodes);
- fmt->current_node.char_idx += node->char_len;
- fmt->current_node.byte_idx += node->byte_len;
- }
-
- /* we need to split the node */
- else
- {
- Ewl_Text_Context *tx;
- unsigned int blen = 0;
-
- tx = new->tx;
- ewl_text_fmt_char_to_byte(fmt,
- char_idx, char_len,
- NULL, &blen);
-
- /* we create a new node which will be our
- * formatting and reset node to be original
- * formatting */
- new = ewl_text_fmt_node_new(node->tx,
- char_len, blen);
-
- ecore_dlist_insert(fmt->nodes, new);
- ecore_dlist_next(fmt->nodes);
- if (!ecore_dlist_current(fmt->nodes))
- ecore_dlist_last_goto(fmt->nodes);
-
- fmt->current_node.char_idx += new->char_len;
- fmt->current_node.byte_idx += new->byte_len;
-
- node->tx = tx;
- node->char_len -= new->char_len;
- node->byte_len -= new->byte_len;
-
- char_len -= new->char_len;
- char_idx += new->char_len;
- }
- }
- node = ecore_dlist_current(fmt->nodes);
- }
-
- /* Reset to the original cursor index */
- if (!node) node = ecore_dlist_last_goto(fmt->nodes);
- ewl_text_fmt_goto(fmt, cursor_idx);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Text *t;
+ unsigned int cursor_idx;
+ Ewl_Text_Fmt_Node *node;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(change);
+
+ if ((char_len == 0) || (context_mask == EWL_TEXT_CONTEXT_MASK_NONE))
+ DRETURN(DLEVEL_STABLE);
+
+ cursor_idx = char_idx;
+
+ /* make sure we're where we think we are */
+ ewl_text_fmt_goto(fmt, cursor_idx);
+
+ t = fmt->text;
+ node = ecore_dlist_current(fmt->nodes);
+ while (char_len > 0)
+ {
+ /* we've walked off the end of the list */
+ if (!node) break;
+
+ /* covers entire node */
+ if ((char_idx == fmt->current_node.char_idx)
+ && (node->char_len <= char_len))
+ {
+ Ewl_Text_Context *new_tx;
+
+ new_tx = ewl_text_context_find(node->tx,
+ context_mask, change);
+ ewl_text_context_release(node->tx);
+ node->tx = new_tx;
+
+ char_idx += node->char_len;
+ char_len -= node->char_len;
+ ecore_dlist_next(fmt->nodes);
+
+ fmt->current_node.char_idx += node->char_len;
+ fmt->current_node.byte_idx += node->byte_len;
+ }
+
+ /* start is the same, node is longer then needed */
+ else if (char_idx == fmt->current_node.char_idx)
+ {
+ unsigned int blen = 0;
+ Ewl_Text_Fmt_Node *new;
+
+ ewl_text_fmt_char_to_byte(fmt,
+ char_idx, char_len, NULL, &blen);
+
+ new = ewl_text_fmt_node_new(
+ ewl_text_context_find(node->tx,
+ context_mask, change),
+ char_len, blen);
+
+ node->char_len -= new->char_len;
+ node->byte_len -= new->byte_len;
+
+ ecore_dlist_insert(fmt->nodes, new);
+ ecore_dlist_next(fmt->nodes);
+
+ fmt->current_node.char_idx += new->char_len;
+ fmt->current_node.byte_idx += new->byte_len;
+
+ char_idx += new->char_len;
+ char_len -= new->char_len;
+ }
+
+ /* starts are different, need to set context on end of node */
+ else
+ {
+ Ewl_Text_Fmt_Node *new;
+ unsigned int blen = 0, right_skip;
+
+ if (char_idx < fmt->current_node.char_idx)
+ {
+ DWARNING("Cursor index less than formatting node index");
+ right_skip = 0;
+ }
+ else
+ right_skip = char_idx - fmt->current_node.char_idx;
+ ewl_text_fmt_char_to_byte(fmt, fmt->current_node.char_idx,
+ right_skip, NULL, &blen);
+
+ new = ewl_text_fmt_node_new(node->tx, right_skip, blen);
+
+ ecore_dlist_insert(fmt->nodes, new);
+ ecore_dlist_next(fmt->nodes);
+ if (!ecore_dlist_current(fmt->nodes))
+ ecore_dlist_last_goto(fmt->nodes);
+
+ fmt->current_node.char_idx += new->char_len;
+ fmt->current_node.byte_idx += new->byte_len;
+
+ /* update node to be the new formatting piece */
+ node->tx = ewl_text_context_find(node->tx,
+ context_mask, change);
+ node->char_len -= new->char_len;
+ node->byte_len -= new->byte_len;
+
+ /* the rest of the node is covered */
+ if (node->char_len <= char_len)
+ {
+ char_len -= node->char_len;
+ char_idx += node->char_len;
+
+ ecore_dlist_next(fmt->nodes);
+ fmt->current_node.char_idx += node->char_len;
+ fmt->current_node.byte_idx += node->byte_len;
+ }
+
+ /* we need to split the node */
+ else
+ {
+ Ewl_Text_Context *tx;
+ unsigned int blen = 0;
+
+ tx = new->tx;
+ ewl_text_fmt_char_to_byte(fmt,
+ char_idx, char_len,
+ NULL, &blen);
+
+ /* we create a new node which will be our
+ * formatting and reset node to be original
+ * formatting */
+ new = ewl_text_fmt_node_new(node->tx,
+ char_len, blen);
+
+ ecore_dlist_insert(fmt->nodes, new);
+ ecore_dlist_next(fmt->nodes);
+ if (!ecore_dlist_current(fmt->nodes))
+ ecore_dlist_last_goto(fmt->nodes);
+
+ fmt->current_node.char_idx += new->char_len;
+ fmt->current_node.byte_idx += new->byte_len;
+
+ node->tx = tx;
+ node->char_len -= new->char_len;
+ node->byte_len -= new->byte_len;
+
+ char_len -= new->char_len;
+ char_idx += new->char_len;
+ }
+ }
+ node = ecore_dlist_current(fmt->nodes);
+ }
+
+ /* Reset to the original cursor index */
+ if (!node) node = ecore_dlist_last_goto(fmt->nodes);
+ ewl_text_fmt_goto(fmt, cursor_idx);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/*
@@ -1024,37 +1024,37 @@ ewl_text_fmt_apply(Ewl_Text_Fmt *fmt, unsigned int context_mask,
*/
Ewl_Text_Fmt_Node *
ewl_text_fmt_node_new(Ewl_Text_Context *tx, unsigned int char_len,
- unsigned int byte_len)
+ unsigned int byte_len)
{
- Ewl_Text_Fmt_Node *node;
+ Ewl_Text_Fmt_Node *node;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- node = NEW(Ewl_Text_Fmt_Node, 1);
- if (!node) DRETURN_PTR(NULL, DLEVEL_STABLE);
+ node = NEW(Ewl_Text_Fmt_Node, 1);
+ if (!node) DRETURN_PTR(NULL, DLEVEL_STABLE);
- node->tx = tx;
- ewl_text_context_acquire(node->tx);
- node->char_len = char_len;
- node->byte_len = byte_len;
+ node->tx = tx;
+ ewl_text_context_acquire(node->tx);
+ node->char_len = char_len;
+ node->byte_len = byte_len;
- DRETURN_PTR(node, DLEVEL_STABLE);
+ DRETURN_PTR(node, DLEVEL_STABLE);
}
static void
ewl_text_fmt_node_free(void *node)
{
- Ewl_Text_Fmt_Node *n;
+ Ewl_Text_Fmt_Node *n;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(node);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(node);
- n = node;
- if (n->tx) ewl_text_context_release(n->tx);
- n->tx = NULL;
+ n = node;
+ if (n->tx) ewl_text_context_release(n->tx);
+ n->tx = NULL;
- FREE(node);
+ FREE(node);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_text_fmt.h b/src/lib/ewl_text_fmt.h
index 471be92..6a05edc 100644
--- a/src/lib/ewl_text_fmt.h
+++ b/src/lib/ewl_text_fmt.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_TEXT_FMT_H
#define EWL_TEXT_FMT_H
@@ -24,9 +24,9 @@ typedef struct Ewl_Text_Fmt_Node Ewl_Text_Fmt_Node;
*/
struct Ewl_Text_Fmt_Node
{
- Ewl_Text_Context *tx; /**< Nodes formatting context */
- unsigned int char_len; /**< Node character length */
- unsigned int byte_len; /**< Node byte length */
+ Ewl_Text_Context *tx; /**< Nodes formatting context */
+ unsigned int char_len; /**< Node character length */
+ unsigned int byte_len; /**< Node byte length */
};
/**
@@ -39,73 +39,73 @@ typedef struct Ewl_Text_Fmt Ewl_Text_Fmt;
*/
struct Ewl_Text_Fmt
{
- Ecore_DList *nodes; /**< List of formatting nodes */
- void *text; /**< Parent Ewl_Text pointer */
-
- struct
- {
- unsigned int char_idx; /**< Character index of the current node pointer */
- unsigned int byte_idx; /**< Byte index of the current node pointer */
- } current_node; /**< Current node information */
-
- struct
- {
- unsigned int char_len; /**< Text character length */
- unsigned int byte_len; /**< Text byte length */
- } length; /**< Length information for this formatting list */
+ Ecore_DList *nodes; /**< List of formatting nodes */
+ void *text; /**< Parent Ewl_Text pointer */
+
+ struct
+ {
+ unsigned int char_idx; /**< Character index of the current node pointer */
+ unsigned int byte_idx; /**< Byte index of the current node pointer */
+ } current_node; /**< Current node information */
+
+ struct
+ {
+ unsigned int char_len; /**< Text character length */
+ unsigned int byte_len; /**< Text byte length */
+ } length; /**< Length information for this formatting list */
};
-Ewl_Text_Fmt *ewl_text_fmt_new(Ewl_Text *t);
-void ewl_text_fmt_destroy(Ewl_Text_Fmt *fmt);
-void ewl_text_fmt_clear(Ewl_Text_Fmt *fmt);
-
-void ewl_text_fmt_node_prepend(Ewl_Text_Fmt *fmt,
- Ewl_Text_Context *tx,
- unsigned int char_len,
- unsigned int byte_len);
-void ewl_text_fmt_node_append(Ewl_Text_Fmt *fmt,
- Ewl_Text_Context *tx,
- unsigned int char_len,
- unsigned int byte_len);
-void ewl_text_fmt_node_insert(Ewl_Text_Fmt *fmt,
- unsigned int char_idx,
- Ewl_Text_Context *tx,
- unsigned int char_len,
- unsigned int byte_len);
-void ewl_text_fmt_node_delete(Ewl_Text_Fmt *fmt,
- unsigned int idx,
- unsigned int char_len);
-unsigned int ewl_text_fmt_node_count_get(Ewl_Text_Fmt *fmt);
+Ewl_Text_Fmt *ewl_text_fmt_new(Ewl_Text *t);
+void ewl_text_fmt_destroy(Ewl_Text_Fmt *fmt);
+void ewl_text_fmt_clear(Ewl_Text_Fmt *fmt);
+
+void ewl_text_fmt_node_prepend(Ewl_Text_Fmt *fmt,
+ Ewl_Text_Context *tx,
+ unsigned int char_len,
+ unsigned int byte_len);
+void ewl_text_fmt_node_append(Ewl_Text_Fmt *fmt,
+ Ewl_Text_Context *tx,
+ unsigned int char_len,
+ unsigned int byte_len);
+void ewl_text_fmt_node_insert(Ewl_Text_Fmt *fmt,
+ unsigned int char_idx,
+ Ewl_Text_Context *tx,
+ unsigned int char_len,
+ unsigned int byte_len);
+void ewl_text_fmt_node_delete(Ewl_Text_Fmt *fmt,
+ unsigned int idx,
+ unsigned int char_len);
+unsigned int ewl_text_fmt_node_count_get(Ewl_Text_Fmt *fmt);
Ewl_Text_Fmt_Node *ewl_text_fmt_get(Ewl_Text_Fmt *fmt, unsigned int char_idx);
Ewl_Text_Fmt_Node *ewl_text_fmt_get_last(Ewl_Text_Fmt *fmt);
Ewl_Text_Fmt_Node *ewl_text_fmt_get_first(Ewl_Text_Fmt *fmt);
Ewl_Text_Fmt_Node *ewl_text_fmt_get_current(Ewl_Text_Fmt *fmt);
-void ewl_text_fmt_goto(Ewl_Text_Fmt *fmt, unsigned int idx);
+void ewl_text_fmt_goto(Ewl_Text_Fmt *fmt, unsigned int idx);
-void ewl_text_fmt_apply(Ewl_Text_Fmt *fmt, unsigned int context_mask,
- Ewl_Text_Context *change,
- unsigned int char_idx,
- unsigned int char_len);
+void ewl_text_fmt_apply(Ewl_Text_Fmt *fmt, unsigned int context_mask,
+ Ewl_Text_Context *change,
+ unsigned int char_idx,
+ unsigned int char_len);
-void ewl_text_fmt_char_to_byte(Ewl_Text_Fmt *fmt,
- unsigned int char_idx, unsigned int char_len,
- unsigned int *byte_idx, unsigned int *byte_len);
-void ewl_text_fmt_byte_to_char(Ewl_Text_Fmt *fmt,
- unsigned int byte_idx, unsigned int byte_len,
- unsigned int *char_idx, unsigned int *char_len);
+void ewl_text_fmt_char_to_byte(Ewl_Text_Fmt *fmt,
+ unsigned int char_idx, unsigned int char_len,
+ unsigned int *byte_idx, unsigned int *byte_len);
+void ewl_text_fmt_byte_to_char(Ewl_Text_Fmt *fmt,
+ unsigned int byte_idx, unsigned int byte_len,
+ unsigned int *char_idx, unsigned int *char_len);
-void ewl_text_fmt_walk(Ewl_Text_Fmt *fmt,
- void (*cb)(Ewl_Text_Fmt_Node *, Ewl_Text *,
- unsigned int byte_idx));
+void ewl_text_fmt_walk(Ewl_Text_Fmt *fmt,
+ void (*cb)(Ewl_Text_Fmt_Node *, Ewl_Text *,
+ unsigned int byte_idx));
-void ewl_text_fmt_dump(Ewl_Text_Fmt *fmt);
+void ewl_text_fmt_dump(Ewl_Text_Fmt *fmt);
Ewl_Text_Fmt_Node *ewl_text_fmt_node_new(Ewl_Text_Context *tx,
- unsigned int char_len,
- unsigned int byte_len);
+ unsigned int char_len,
+ unsigned int byte_len);
/**
* @}
*/
diff --git a/src/lib/ewl_text_trigger.c b/src/lib/ewl_text_trigger.c
index 3e1b30e..d6cff74 100644
--- a/src/lib/ewl_text_trigger.c
+++ b/src/lib/ewl_text_trigger.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_text.h"
#include "ewl_text_trigger.h"
@@ -35,8 +35,8 @@ typedef struct Ewl_Text_Trigger_Area Ewl_Text_Trigger_Area;
*/
struct Ewl_Text_Trigger_Area
{
- Ewl_Widget widget; /**< Inherits from Ewl_Widget */
- Ewl_Text_Trigger *trigger; /**< The parent trigger */
+ Ewl_Widget widget; /**< Inherits from Ewl_Widget */
+ Ewl_Text_Trigger *trigger; /**< The parent trigger */
};
static Ewl_Widget *ewl_text_trigger_area_new();
@@ -44,15 +44,15 @@ static int ewl_text_trigger_area_init(Ewl_Text_Trigger_Area *area);
static Ewl_Widget *ewl_text_trigger_area_cached_get(Ewl_Text *t);
static void ewl_text_trigger_area_cache(Ewl_Text *t, Ewl_Text_Trigger_Area *a);
static void ewl_text_trigger_area_type_set(Ewl_Text_Trigger_Area *area,
- Ewl_Text_Trigger_Type type);
+ Ewl_Text_Trigger_Type type);
static void ewl_text_trigger_area_cb_mouse_in(Ewl_Widget *w, void *ev,
- void *data);
+ void *data);
static void ewl_text_trigger_area_cb_mouse_out(Ewl_Widget *w, void *ev,
- void *data);
+ void *data);
static void ewl_text_trigger_area_cb_mouse_up(Ewl_Widget *w, void *ev,
- void *data);
+ void *data);
static void ewl_text_trigger_area_cb_mouse_down(Ewl_Widget *w, void *ev,
- void *data);
+ void *data);
/**
* @param type: The type of trigger to create
@@ -62,21 +62,21 @@ static void ewl_text_trigger_area_cb_mouse_down(Ewl_Widget *w, void *ev,
Ewl_Widget *
ewl_text_trigger_new(Ewl_Text_Trigger_Type type)
{
- Ewl_Text_Trigger *trigger;
+ Ewl_Text_Trigger *trigger;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- trigger = NEW(Ewl_Text_Trigger, 1);
- if (!trigger)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ trigger = NEW(Ewl_Text_Trigger, 1);
+ if (!trigger)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_text_trigger_init(trigger, type))
- {
- ewl_widget_destroy(EWL_WIDGET(trigger));
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ewl_text_trigger_init(trigger, type))
+ {
+ ewl_widget_destroy(EWL_WIDGET(trigger));
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(trigger, DLEVEL_STABLE);
+ DRETURN_PTR(trigger, DLEVEL_STABLE);
}
/**
@@ -88,42 +88,42 @@ ewl_text_trigger_new(Ewl_Text_Trigger_Type type)
int
ewl_text_trigger_init(Ewl_Text_Trigger *trigger, Ewl_Text_Trigger_Type type)
{
- const char *type_str;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(trigger, FALSE);
-
- if (type == EWL_TEXT_TRIGGER_TYPE_TRIGGER)
- type_str = EWL_TEXT_TRIGGER_TYPE;
- else if (type == EWL_TEXT_TRIGGER_TYPE_SELECTION)
- type_str = EWL_TEXT_SELECTION_TYPE;
- else
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- if (!ewl_widget_init(EWL_WIDGET(trigger)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- ewl_widget_appearance_set(EWL_WIDGET(trigger), type_str);
- ewl_widget_inherit(EWL_WIDGET(trigger), EWL_TEXT_TRIGGER_TYPE);
-
- ewl_callback_prepend(EWL_WIDGET(trigger), EWL_CALLBACK_DESTROY,
- ewl_text_trigger_cb_destroy, NULL);
- ewl_callback_append(EWL_WIDGET(trigger), EWL_CALLBACK_CONFIGURE,
- ewl_text_trigger_cb_configure, NULL);
- ewl_callback_append(EWL_WIDGET(trigger), EWL_CALLBACK_SHOW,
- ewl_text_trigger_cb_show, NULL);
- ewl_callback_append(EWL_WIDGET(trigger), EWL_CALLBACK_HIDE,
- ewl_text_trigger_cb_hide, NULL);
- ewl_callback_append(EWL_WIDGET(trigger), EWL_CALLBACK_UNREALIZE,
- ewl_text_trigger_cb_unrealize, NULL);
-
- trigger->areas = ecore_list_new();
- trigger->type = type;
-
- ewl_widget_focusable_set(EWL_WIDGET(trigger), FALSE);
- ewl_widget_internal_set(EWL_WIDGET(trigger), TRUE);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ const char *type_str;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(trigger, FALSE);
+
+ if (type == EWL_TEXT_TRIGGER_TYPE_TRIGGER)
+ type_str = EWL_TEXT_TRIGGER_TYPE;
+ else if (type == EWL_TEXT_TRIGGER_TYPE_SELECTION)
+ type_str = EWL_TEXT_SELECTION_TYPE;
+ else
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ if (!ewl_widget_init(EWL_WIDGET(trigger)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ ewl_widget_appearance_set(EWL_WIDGET(trigger), type_str);
+ ewl_widget_inherit(EWL_WIDGET(trigger), EWL_TEXT_TRIGGER_TYPE);
+
+ ewl_callback_prepend(EWL_WIDGET(trigger), EWL_CALLBACK_DESTROY,
+ ewl_text_trigger_cb_destroy, NULL);
+ ewl_callback_append(EWL_WIDGET(trigger), EWL_CALLBACK_CONFIGURE,
+ ewl_text_trigger_cb_configure, NULL);
+ ewl_callback_append(EWL_WIDGET(trigger), EWL_CALLBACK_SHOW,
+ ewl_text_trigger_cb_show, NULL);
+ ewl_callback_append(EWL_WIDGET(trigger), EWL_CALLBACK_HIDE,
+ ewl_text_trigger_cb_hide, NULL);
+ ewl_callback_append(EWL_WIDGET(trigger), EWL_CALLBACK_UNREALIZE,
+ ewl_text_trigger_cb_unrealize, NULL);
+
+ trigger->areas = ecore_list_new();
+ trigger->type = type;
+
+ ewl_widget_focusable_set(EWL_WIDGET(trigger), FALSE);
+ ewl_widget_internal_set(EWL_WIDGET(trigger), TRUE);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -136,21 +136,21 @@ ewl_text_trigger_init(Ewl_Text_Trigger *trigger, Ewl_Text_Trigger_Type type)
*/
void
ewl_text_trigger_cb_destroy(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Text_Trigger *t;
+ Ewl_Text_Trigger *t;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_TEXT_TRIGGER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_TEXT_TRIGGER_TYPE);
- t = EWL_TEXT_TRIGGER(w);
+ t = EWL_TEXT_TRIGGER(w);
- /* note we don't clean up the the list of areas, because it is
- * up to the text widget to remove them on the child remove callback */
- IF_FREE_LIST(t->areas);
+ /* note we don't clean up the the list of areas, because it is
+ * up to the text widget to remove them on the child remove callback */
+ IF_FREE_LIST(t->areas);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -161,11 +161,11 @@ ewl_text_trigger_cb_destroy(Ewl_Widget *w, void *ev_data __UNUSED__,
Ewl_Text_Trigger_Type
ewl_text_trigger_type_get(Ewl_Text_Trigger *t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, EWL_TEXT_TRIGGER_TYPE_NONE);
- DCHECK_TYPE_RET(t, EWL_TEXT_TRIGGER_TYPE, EWL_TEXT_TRIGGER_TYPE_NONE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, EWL_TEXT_TRIGGER_TYPE_NONE);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TRIGGER_TYPE, EWL_TEXT_TRIGGER_TYPE_NONE);
- DRETURN_INT(t->type, DLEVEL_STABLE);
+ DRETURN_INT(t->type, DLEVEL_STABLE);
}
/**
@@ -177,13 +177,13 @@ ewl_text_trigger_type_get(Ewl_Text_Trigger *t)
void
ewl_text_trigger_start_pos_set(Ewl_Text_Trigger *t, unsigned int char_pos)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TRIGGER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TRIGGER_TYPE);
- t->char_pos = char_pos;
+ t->char_pos = char_pos;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -194,11 +194,11 @@ ewl_text_trigger_start_pos_set(Ewl_Text_Trigger *t, unsigned int char_pos)
unsigned int
ewl_text_trigger_start_pos_get(Ewl_Text_Trigger *t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, 0);
- DCHECK_TYPE_RET(t, EWL_TEXT_TRIGGER_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, 0);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TRIGGER_TYPE, 0);
- DRETURN_INT(t->char_pos, DLEVEL_STABLE);
+ DRETURN_INT(t->char_pos, DLEVEL_STABLE);
}
/**
@@ -210,17 +210,17 @@ ewl_text_trigger_start_pos_get(Ewl_Text_Trigger *t)
void
ewl_text_trigger_length_set(Ewl_Text_Trigger *t, unsigned int char_len)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TRIGGER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TRIGGER_TYPE);
- t->char_len = char_len;
+ t->char_len = char_len;
- /* if the length is set to 0 remove the areas */
- if (char_len == 0)
- ewl_text_trigger_areas_cleanup(t);
+ /* if the length is set to 0 remove the areas */
+ if (char_len == 0)
+ ewl_text_trigger_areas_cleanup(t);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -231,11 +231,11 @@ ewl_text_trigger_length_set(Ewl_Text_Trigger *t, unsigned int char_len)
unsigned int
ewl_text_trigger_length_get(Ewl_Text_Trigger *t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, 0);
- DCHECK_TYPE_RET(t, EWL_TEXT_TRIGGER_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, 0);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TRIGGER_TYPE, 0);
- DRETURN_INT(t->char_len, DLEVEL_STABLE);
+ DRETURN_INT(t->char_len, DLEVEL_STABLE);
}
/**
@@ -247,13 +247,13 @@ ewl_text_trigger_length_get(Ewl_Text_Trigger *t)
void
ewl_text_trigger_base_set(Ewl_Text_Trigger *t, unsigned int char_pos)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TEXT_TRIGGER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TEXT_TRIGGER_TYPE);
- t->char_base = char_pos;
+ t->char_base = char_pos;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -264,11 +264,11 @@ ewl_text_trigger_base_set(Ewl_Text_Trigger *t, unsigned int char_pos)
unsigned int
ewl_text_trigger_base_get(Ewl_Text_Trigger *t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, 0);
- DCHECK_TYPE_RET(t, EWL_TEXT_TRIGGER_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, 0);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TRIGGER_TYPE, 0);
- DRETURN_INT(t->char_base, DLEVEL_STABLE);
+ DRETURN_INT(t->char_base, DLEVEL_STABLE);
}
/**
@@ -283,27 +283,27 @@ ewl_text_trigger_base_get(Ewl_Text_Trigger *t)
*/
void
ewl_text_trigger_area_add(Ewl_Text *t, Ewl_Text_Trigger *cur,
- int x, int y, int w, int h)
+ int x, int y, int w, int h)
{
- Ewl_Widget *area;
+ Ewl_Widget *area;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_PARAM_PTR(cur);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
- DCHECK_TYPE(cur, EWL_TEXT_TRIGGER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_PARAM_PTR(cur);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DCHECK_TYPE(cur, EWL_TEXT_TRIGGER_TYPE);
- area = ewl_text_trigger_area_cached_get(t);
- ewl_text_trigger_area_type_set(EWL_TEXT_TRIGGER_AREA(area), cur->type);
- ewl_object_geometry_request(EWL_OBJECT(area), x, y, w, h);
- EWL_TEXT_TRIGGER_AREA(area)->trigger = cur;
+ area = ewl_text_trigger_area_cached_get(t);
+ ewl_text_trigger_area_type_set(EWL_TEXT_TRIGGER_AREA(area), cur->type);
+ ewl_object_geometry_request(EWL_OBJECT(area), x, y, w, h);
+ EWL_TEXT_TRIGGER_AREA(area)->trigger = cur;
- ewl_widget_show(area);
+ ewl_widget_show(area);
- if (!cur->areas) cur->areas = ecore_list_new();
- ecore_list_append(cur->areas, area);
+ if (!cur->areas) cur->areas = ecore_list_new();
+ ecore_list_append(cur->areas, area);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -314,20 +314,20 @@ ewl_text_trigger_area_add(Ewl_Text *t, Ewl_Text_Trigger *cur,
void
ewl_text_trigger_areas_cleanup(Ewl_Text_Trigger *trig)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(trig);
- DCHECK_TYPE(trig, EWL_TEXT_TRIGGER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(trig);
+ DCHECK_TYPE(trig, EWL_TEXT_TRIGGER_TYPE);
- /* cleanup any old areas */
- if (trig->areas)
- {
- Ewl_Text_Trigger_Area *area;
+ /* cleanup any old areas */
+ if (trig->areas)
+ {
+ Ewl_Text_Trigger_Area *area;
- while ((area = ecore_list_first_remove(trig->areas)))
- ewl_text_trigger_area_cache(trig->text_parent, area);
- }
+ while ((area = ecore_list_first_remove(trig->areas)))
+ ewl_text_trigger_area_cache(trig->text_parent, area);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -339,24 +339,24 @@ ewl_text_trigger_areas_cleanup(Ewl_Text_Trigger *trig)
*/
void
ewl_text_trigger_cb_configure(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Text_Trigger *trig;
- Ewl_Text_Trigger_Area *area;
+ Ewl_Text_Trigger *trig;
+ Ewl_Text_Trigger_Area *area;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_TEXT_TRIGGER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_TEXT_TRIGGER_TYPE);
- trig = EWL_TEXT_TRIGGER(w);
+ trig = EWL_TEXT_TRIGGER(w);
- if (!trig->areas) DRETURN(DLEVEL_STABLE);
+ if (!trig->areas) DRETURN(DLEVEL_STABLE);
- ecore_list_first_goto(trig->areas);
- while ((area = ecore_list_next(trig->areas)))
- ewl_widget_configure(EWL_WIDGET(area));
+ ecore_list_first_goto(trig->areas);
+ while ((area = ecore_list_next(trig->areas)))
+ ewl_widget_configure(EWL_WIDGET(area));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -368,23 +368,23 @@ ewl_text_trigger_cb_configure(Ewl_Widget *w, void *ev __UNUSED__,
*/
void
ewl_text_trigger_cb_hide(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *area;
- Ewl_Text_Trigger *trig;
+ Ewl_Widget *area;
+ Ewl_Text_Trigger *trig;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_TEXT_TRIGGER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_TEXT_TRIGGER_TYPE);
- trig = EWL_TEXT_TRIGGER(w);
- if (!trig->areas) DRETURN(DLEVEL_STABLE);;
+ trig = EWL_TEXT_TRIGGER(w);
+ if (!trig->areas) DRETURN(DLEVEL_STABLE);;
- ecore_list_first_goto(trig->areas);
- while ((area = ecore_list_next(trig->areas)))
- ewl_widget_hide(area);
+ ecore_list_first_goto(trig->areas);
+ while ((area = ecore_list_next(trig->areas)))
+ ewl_widget_hide(area);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -396,23 +396,23 @@ ewl_text_trigger_cb_hide(Ewl_Widget *w, void *ev __UNUSED__,
*/
void
ewl_text_trigger_cb_show(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *area;
- Ewl_Text_Trigger *trig;
+ Ewl_Widget *area;
+ Ewl_Text_Trigger *trig;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_TEXT_TRIGGER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_TEXT_TRIGGER_TYPE);
- trig = EWL_TEXT_TRIGGER(w);
- if (!trig->areas) DRETURN(DLEVEL_STABLE);
+ trig = EWL_TEXT_TRIGGER(w);
+ if (!trig->areas) DRETURN(DLEVEL_STABLE);
- ecore_list_first_goto(trig->areas);
- while ((area = ecore_list_next(trig->areas)))
- ewl_widget_show(area);
+ ecore_list_first_goto(trig->areas);
+ while ((area = ecore_list_next(trig->areas)))
+ ewl_widget_show(area);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -424,15 +424,15 @@ ewl_text_trigger_cb_show(Ewl_Widget *w, void *ev __UNUSED__,
*/
void
ewl_text_trigger_cb_unrealize(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_TEXT_TRIGGER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_TEXT_TRIGGER_TYPE);
- ewl_text_trigger_areas_cleanup(EWL_TEXT_TRIGGER(w));
+ ewl_text_trigger_areas_cleanup(EWL_TEXT_TRIGGER(w));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/*
@@ -448,21 +448,21 @@ ewl_text_trigger_cb_unrealize(Ewl_Widget *w, void *ev __UNUSED__,
static Ewl_Widget *
ewl_text_trigger_area_new(void)
{
- Ewl_Text_Trigger_Area *area;
+ Ewl_Text_Trigger_Area *area;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- area = NEW(Ewl_Text_Trigger_Area, 1);
- if (!area)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ area = NEW(Ewl_Text_Trigger_Area, 1);
+ if (!area)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_text_trigger_area_init(area))
- {
- ewl_widget_destroy(EWL_WIDGET(area));
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ewl_text_trigger_area_init(area))
+ {
+ ewl_widget_destroy(EWL_WIDGET(area));
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(area, DLEVEL_STABLE);
+ DRETURN_PTR(area, DLEVEL_STABLE);
}
/**
@@ -474,30 +474,30 @@ ewl_text_trigger_area_new(void)
static int
ewl_text_trigger_area_init(Ewl_Text_Trigger_Area *area)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(area, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(area, FALSE);
- w = EWL_WIDGET(area);
+ w = EWL_WIDGET(area);
- if (!ewl_widget_init(w))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_widget_init(w))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_inherit(w, EWL_TEXT_TRIGGER_AREA_TYPE);
+ ewl_widget_inherit(w, EWL_TEXT_TRIGGER_AREA_TYPE);
- ewl_widget_focusable_set(w, FALSE);
- ewl_widget_internal_set(w, TRUE);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_IN,
- ewl_text_trigger_area_cb_mouse_in, NULL);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_OUT,
- ewl_text_trigger_area_cb_mouse_out, NULL);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_DOWN,
- ewl_text_trigger_area_cb_mouse_down, NULL);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_UP,
- ewl_text_trigger_area_cb_mouse_up, NULL);
+ ewl_widget_focusable_set(w, FALSE);
+ ewl_widget_internal_set(w, TRUE);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_IN,
+ ewl_text_trigger_area_cb_mouse_in, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_OUT,
+ ewl_text_trigger_area_cb_mouse_out, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_DOWN,
+ ewl_text_trigger_area_cb_mouse_down, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_UP,
+ ewl_text_trigger_area_cb_mouse_up, NULL);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -509,22 +509,22 @@ ewl_text_trigger_area_init(Ewl_Text_Trigger_Area *area)
*/
static void
ewl_text_trigger_area_type_set(Ewl_Text_Trigger_Area *area,
- Ewl_Text_Trigger_Type type)
+ Ewl_Text_Trigger_Type type)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(area);
- DCHECK_TYPE(area, EWL_TEXT_TRIGGER_AREA_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(area);
+ DCHECK_TYPE(area, EWL_TEXT_TRIGGER_AREA_TYPE);
- ewl_widget_appearance_set(EWL_WIDGET(area),
- ((type == EWL_TEXT_TRIGGER_TYPE_SELECTION) ?
- "selection_area" : "trigger_area"));
+ ewl_widget_appearance_set(EWL_WIDGET(area),
+ ((type == EWL_TEXT_TRIGGER_TYPE_SELECTION) ?
+ "selection_area" : "trigger_area"));
- if (type == EWL_TEXT_TRIGGER_TYPE_TRIGGER)
- ewl_widget_color_set(EWL_WIDGET(area), 0, 0, 0, 0);
- else
- ewl_widget_color_set(EWL_WIDGET(area), 255, 255, 255, 255);
+ if (type == EWL_TEXT_TRIGGER_TYPE_TRIGGER)
+ ewl_widget_color_set(EWL_WIDGET(area), 0, 0, 0, 0);
+ else
+ ewl_widget_color_set(EWL_WIDGET(area), 255, 255, 255, 255);
- DRETURN(DLEVEL_STABLE);
+ DRETURN(DLEVEL_STABLE);
}
/**
@@ -535,43 +535,43 @@ ewl_text_trigger_area_type_set(Ewl_Text_Trigger_Area *area,
static Ewl_Widget *
ewl_text_trigger_area_cached_get(Ewl_Text *t)
{
- Ewl_Widget *area;
+ Ewl_Widget *area;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, NULL);
- DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, NULL);
+ DCHECK_TYPE_RET(t, EWL_TEXT_TYPE, NULL);
- if (t->areas_cache && !ecore_list_empty_is(t->areas_cache))
- area = ecore_list_first_remove(t->areas_cache);
- else {
- area = ewl_text_trigger_area_new();
- ewl_container_child_append(EWL_CONTAINER(t), area);
- }
+ if (t->areas_cache && !ecore_list_empty_is(t->areas_cache))
+ area = ecore_list_first_remove(t->areas_cache);
+ else {
+ area = ewl_text_trigger_area_new();
+ ewl_container_child_append(EWL_CONTAINER(t), area);
+ }
- DRETURN_PTR(area, DLEVEL_STABLE);
+ DRETURN_PTR(area, DLEVEL_STABLE);
}
static void
ewl_text_trigger_area_cache(Ewl_Text *t, Ewl_Text_Trigger_Area *area)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_PARAM_PTR(area);
- DCHECK_TYPE(t, EWL_TEXT_TYPE);
- DCHECK_TYPE(area, EWL_TEXT_TRIGGER_AREA_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_PARAM_PTR(area);
+ DCHECK_TYPE(t, EWL_TEXT_TYPE);
+ DCHECK_TYPE(area, EWL_TEXT_TRIGGER_AREA_TYPE);
- area->trigger = NULL;
- ewl_widget_hide(EWL_WIDGET(area));
+ area->trigger = NULL;
+ ewl_widget_hide(EWL_WIDGET(area));
- if (DESTROYED(t) || DESTROYED(area))
- DRETURN(DLEVEL_STABLE);
+ if (DESTROYED(t) || DESTROYED(area))
+ DRETURN(DLEVEL_STABLE);
- if (!t->areas_cache)
- t->areas_cache = ecore_list_new();
+ if (!t->areas_cache)
+ t->areas_cache = ecore_list_new();
- ecore_list_append(t->areas_cache, area);
+ ecore_list_append(t->areas_cache, area);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -584,20 +584,20 @@ ewl_text_trigger_area_cache(Ewl_Text *t, Ewl_Text_Trigger_Area *area)
*/
void
ewl_text_trigger_area_cb_mouse_in(Ewl_Widget *w, void *ev,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Text_Trigger_Area *a;
+ Ewl_Text_Trigger_Area *a;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_TEXT_TRIGGER_AREA_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_TEXT_TRIGGER_AREA_TYPE);
- a = EWL_TEXT_TRIGGER_AREA(w);
- if (a->trigger)
- ewl_callback_call_with_event_data(EWL_WIDGET(a->trigger),
- EWL_CALLBACK_MOUSE_IN, ev);
+ a = EWL_TEXT_TRIGGER_AREA(w);
+ if (a->trigger)
+ ewl_callback_call_with_event_data(EWL_WIDGET(a->trigger),
+ EWL_CALLBACK_MOUSE_IN, ev);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -610,20 +610,20 @@ ewl_text_trigger_area_cb_mouse_in(Ewl_Widget *w, void *ev,
*/
void
ewl_text_trigger_area_cb_mouse_out(Ewl_Widget *w, void *ev,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Text_Trigger_Area *a;
+ Ewl_Text_Trigger_Area *a;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_TEXT_TRIGGER_AREA_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_TEXT_TRIGGER_AREA_TYPE);
- a = EWL_TEXT_TRIGGER_AREA(w);
- if (a->trigger)
- ewl_callback_call_with_event_data(EWL_WIDGET(a->trigger),
- EWL_CALLBACK_MOUSE_OUT, ev);
+ a = EWL_TEXT_TRIGGER_AREA(w);
+ if (a->trigger)
+ ewl_callback_call_with_event_data(EWL_WIDGET(a->trigger),
+ EWL_CALLBACK_MOUSE_OUT, ev);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -636,20 +636,20 @@ ewl_text_trigger_area_cb_mouse_out(Ewl_Widget *w, void *ev,
*/
void
ewl_text_trigger_area_cb_mouse_up(Ewl_Widget *w, void *ev,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Text_Trigger_Area *a;
+ Ewl_Text_Trigger_Area *a;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_TEXT_TRIGGER_AREA_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_TEXT_TRIGGER_AREA_TYPE);
- a = EWL_TEXT_TRIGGER_AREA(w);
- if (a->trigger)
- ewl_callback_call_with_event_data(EWL_WIDGET(a->trigger),
- EWL_CALLBACK_MOUSE_UP, ev);
+ a = EWL_TEXT_TRIGGER_AREA(w);
+ if (a->trigger)
+ ewl_callback_call_with_event_data(EWL_WIDGET(a->trigger),
+ EWL_CALLBACK_MOUSE_UP, ev);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -662,19 +662,19 @@ ewl_text_trigger_area_cb_mouse_up(Ewl_Widget *w, void *ev,
*/
void
ewl_text_trigger_area_cb_mouse_down(Ewl_Widget *w, void *ev,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Text_Trigger_Area *a;
+ Ewl_Text_Trigger_Area *a;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_TEXT_TRIGGER_AREA_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_TEXT_TRIGGER_AREA_TYPE);
- a = EWL_TEXT_TRIGGER_AREA(w);
- if (a->trigger)
- ewl_callback_call_with_event_data(EWL_WIDGET(a->trigger),
- EWL_CALLBACK_MOUSE_DOWN, ev);
+ a = EWL_TEXT_TRIGGER_AREA(w);
+ if (a->trigger)
+ ewl_callback_call_with_event_data(EWL_WIDGET(a->trigger),
+ EWL_CALLBACK_MOUSE_DOWN, ev);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_text_trigger.h b/src/lib/ewl_text_trigger.h
index 9b1eacd..5cad130 100644
--- a/src/lib/ewl_text_trigger.h
+++ b/src/lib/ewl_text_trigger.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_TEXT_TRIGGER_H
#define EWL_TEXT_TRIGGER_H
@@ -38,15 +38,15 @@ typedef struct Ewl_Text_Trigger Ewl_Text_Trigger;
*/
struct Ewl_Text_Trigger
{
- Ewl_Widget widget; /**< Inherit from widget */
- Ewl_Text_Trigger_Type type; /**< Trigger type */
+ Ewl_Widget widget; /**< Inherit from widget */
+ Ewl_Text_Trigger_Type type; /**< Trigger type */
- unsigned int char_pos; /**< Trigger start position */
- unsigned int char_len; /**< Trigger length */
- unsigned int char_base; /**< Used for the selection. Start position */
+ unsigned int char_pos; /**< Trigger start position */
+ unsigned int char_len; /**< Trigger length */
+ unsigned int char_base; /**< Used for the selection. Start position */
- Ewl_Text *text_parent; /**< The parent text area */
- Ecore_List *areas; /**< The list of objects for the trigger */
+ Ewl_Text *text_parent; /**< The parent text area */
+ Ecore_List *areas; /**< The list of objects for the trigger */
};
/**
@@ -55,27 +55,27 @@ struct Ewl_Text_Trigger
*/
#define EWL_TEXT_TRIGGER(trigger) ((Ewl_Text_Trigger *) trigger)
-Ewl_Widget *ewl_text_trigger_new(Ewl_Text_Trigger_Type type);
-int ewl_text_trigger_init(Ewl_Text_Trigger *trigger,
- Ewl_Text_Trigger_Type type);
+Ewl_Widget *ewl_text_trigger_new(Ewl_Text_Trigger_Type type);
+int ewl_text_trigger_init(Ewl_Text_Trigger *trigger,
+ Ewl_Text_Trigger_Type type);
Ewl_Text_Trigger_Type ewl_text_trigger_type_get(Ewl_Text_Trigger *t);
-void ewl_text_trigger_start_pos_set(Ewl_Text_Trigger *t,
- unsigned int char_pos);
-unsigned int ewl_text_trigger_start_pos_get(Ewl_Text_Trigger *t);
+void ewl_text_trigger_start_pos_set(Ewl_Text_Trigger *t,
+ unsigned int char_pos);
+unsigned int ewl_text_trigger_start_pos_get(Ewl_Text_Trigger *t);
-void ewl_text_trigger_base_set(Ewl_Text_Trigger *t,
- unsigned int char_pos);
-unsigned int ewl_text_trigger_base_get(Ewl_Text_Trigger *t);
+void ewl_text_trigger_base_set(Ewl_Text_Trigger *t,
+ unsigned int char_pos);
+unsigned int ewl_text_trigger_base_get(Ewl_Text_Trigger *t);
-void ewl_text_trigger_length_set(Ewl_Text_Trigger *t,
- unsigned int char_len);
-unsigned int ewl_text_trigger_length_get(Ewl_Text_Trigger *t);
+void ewl_text_trigger_length_set(Ewl_Text_Trigger *t,
+ unsigned int char_len);
+unsigned int ewl_text_trigger_length_get(Ewl_Text_Trigger *t);
-void ewl_text_trigger_area_add(Ewl_Text *t, Ewl_Text_Trigger *cur,
- int x, int y, int w, int h);
-void ewl_text_trigger_areas_cleanup(Ewl_Text_Trigger *trig);
+void ewl_text_trigger_area_add(Ewl_Text *t, Ewl_Text_Trigger *cur,
+ int x, int y, int w, int h);
+void ewl_text_trigger_areas_cleanup(Ewl_Text_Trigger *trig);
/*
* Internal stuff
diff --git a/src/lib/ewl_theme.c b/src/lib/ewl_theme.c
index 96795d9..d6dbdff 100644
--- a/src/lib/ewl_theme.c
+++ b/src/lib/ewl_theme.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_macros.h"
#include "ewl_private.h"
@@ -30,22 +30,22 @@ static void ewl_theme_data_free(void *data);
int
ewl_theme_init(void)
{
- const char *theme;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- theme = ewl_config_string_get(ewl_config, EWL_CONFIG_THEME_NAME);
- if (!ewl_theme_theme_set(theme))
- {
- if ((!strcmp(theme, DEFAULT_THEME)) ||
- (!ewl_theme_theme_set(DEFAULT_THEME)))
- {
- DWARNING("No usable theme found, exiting.");
- DRETURN_INT(FALSE, DLEVEL_STABLE);
- }
- }
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ const char *theme;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ theme = ewl_config_string_get(ewl_config, EWL_CONFIG_THEME_NAME);
+ if (!ewl_theme_theme_set(theme))
+ {
+ if ((!strcmp(theme, DEFAULT_THEME)) ||
+ (!ewl_theme_theme_set(DEFAULT_THEME)))
+ {
+ DWARNING("No usable theme found, exiting.");
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+ }
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -56,14 +56,14 @@ ewl_theme_init(void)
void
ewl_theme_shutdown(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- IF_FREE_LIST(ewl_theme_font_paths);
- IF_FREE_HASH(ewl_theme_def_data);
+ IF_FREE_LIST(ewl_theme_font_paths);
+ IF_FREE_HASH(ewl_theme_def_data);
- FREE(ewl_theme_path);
+ FREE(ewl_theme_path);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -76,48 +76,48 @@ ewl_theme_shutdown(void)
int
ewl_theme_theme_set(const char *theme_name)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(theme_name, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(theme_name, FALSE);
- /* Allocate and clear the default theme */
- IF_FREE_HASH(ewl_theme_def_data);
+ /* Allocate and clear the default theme */
+ IF_FREE_HASH(ewl_theme_def_data);
- ewl_theme_def_data = ecore_hash_new(ecore_str_hash, ecore_str_compare);
- if (!ewl_theme_def_data)
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ ewl_theme_def_data = ecore_hash_new(ecore_str_hash, ecore_str_compare);
+ if (!ewl_theme_def_data)
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ecore_hash_free_key_cb_set(ewl_theme_def_data, ewl_theme_data_free);
- ecore_hash_free_value_cb_set(ewl_theme_def_data, ewl_theme_data_free);
+ ecore_hash_free_key_cb_set(ewl_theme_def_data, ewl_theme_data_free);
+ ecore_hash_free_value_cb_set(ewl_theme_def_data, ewl_theme_data_free);
- /* clean up the font path list */
- if (ewl_theme_font_paths)
- ecore_list_clear(ewl_theme_font_paths);
+ /* clean up the font path list */
+ if (ewl_theme_font_paths)
+ ecore_list_clear(ewl_theme_font_paths);
- /* get the new theme path and setup the font path */
- IF_FREE(ewl_theme_path);
- ewl_theme_path = ewl_theme_path_find(theme_name);
- if (!ewl_theme_path) DRETURN_INT(FALSE, DLEVEL_STABLE);
+ /* get the new theme path and setup the font path */
+ IF_FREE(ewl_theme_path);
+ ewl_theme_path = ewl_theme_path_find(theme_name);
+ if (!ewl_theme_path) DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_theme_font_path_init();
+ ewl_theme_font_path_init();
- /* Hide all embeds. If the embed was previously shown we re-show it
- * again. This should cause everything to reset it's theme values to the
- * new values */
- ecore_list_first_goto(ewl_embed_list);
- while ((w = ecore_list_next(ewl_embed_list)))
- {
- int vis;
+ /* Hide all embeds. If the embed was previously shown we re-show it
+ * again. This should cause everything to reset it's theme values to the
+ * new values */
+ ecore_list_first_goto(ewl_embed_list);
+ while ((w = ecore_list_next(ewl_embed_list)))
+ {
+ int vis;
- vis = REALIZED(w);
+ vis = REALIZED(w);
- ewl_widget_hide(w);
- ewl_widget_unrealize(w);
- if (vis) ewl_widget_realize(w);
- }
+ ewl_widget_hide(w);
+ ewl_widget_unrealize(w);
+ if (vis) ewl_widget_realize(w);
+ }
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -131,13 +131,13 @@ ewl_theme_theme_set(const char *theme_name)
int
ewl_theme_widget_init(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, FALSE);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, FALSE);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, FALSE);
- w->theme = NULL;
+ w->theme = NULL;
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -151,20 +151,20 @@ ewl_theme_widget_init(Ewl_Widget *w)
void
ewl_theme_widget_shutdown(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- /*
- * We only want to destroy the hash if its not ewl_theme_def_data
- * We destroy ewl_theme_def_data from else where..
- */
- if (w->theme && w->theme != ewl_theme_def_data)
- IF_FREE_HASH(w->theme);
+ /*
+ * We only want to destroy the hash if its not ewl_theme_def_data
+ * We destroy ewl_theme_def_data from else where..
+ */
+ if (w->theme && w->theme != ewl_theme_def_data)
+ IF_FREE_HASH(w->theme);
- w->theme = NULL;
+ w->theme = NULL;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -174,9 +174,9 @@ ewl_theme_widget_shutdown(Ewl_Widget *w)
const char *
ewl_theme_path_get(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- DRETURN_PTR(ewl_theme_path, DLEVEL_STABLE);
+ DRETURN_PTR(ewl_theme_path, DLEVEL_STABLE);
}
/**
@@ -186,9 +186,9 @@ ewl_theme_path_get(void)
Ecore_List *
ewl_theme_font_path_get(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- DRETURN_PTR(ewl_theme_font_paths, DLEVEL_STABLE);
+ DRETURN_PTR(ewl_theme_font_paths, DLEVEL_STABLE);
}
/**
@@ -202,16 +202,16 @@ ewl_theme_font_path_get(void)
void
ewl_theme_font_path_add(char *path)
{
- char *temp;
+ char *temp;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(path);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(path);
- temp = strdup(path);
- ecore_list_append(ewl_theme_font_paths, temp);
- ewl_embed_font_path_add(temp);
+ temp = strdup(path);
+ ecore_list_append(ewl_theme_font_paths, temp);
+ ewl_embed_font_path_add(temp);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -223,91 +223,91 @@ ewl_theme_font_path_add(char *path)
char *
ewl_theme_image_get(Ewl_Widget *w, char *k)
{
- const char *data;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, NULL);
- DCHECK_PARAM_PTR_RET(k, NULL);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
-
- data = ewl_theme_data_str_get(w, k);
- if (!data)
- {
- if (!ewl_theme_path)
- {
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
- else
- data = ewl_theme_path;
- }
-
- /*
- * Convert a relative path to an absolute path
- */
+ const char *data;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, NULL);
+ DCHECK_PARAM_PTR_RET(k, NULL);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
+
+ data = ewl_theme_data_str_get(w, k);
+ if (!data)
+ {
+ if (!ewl_theme_path)
+ {
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
+ else
+ data = ewl_theme_path;
+ }
+
+ /*
+ * Convert a relative path to an absolute path
+ */
#ifndef _WIN32
- if (*data != '/') {
+ if (*data != '/') {
#else
- if (*(data + 1) != ':') {
+ if (*(data + 1) != ':') {
#endif /* _WIN32 */
- char path[PATH_MAX];
+ char path[PATH_MAX];
- snprintf(path, PATH_MAX, "%s/%s", ewl_theme_path, data);
- data = strdup(path);
- }
- else
- data = strdup(data);
+ snprintf(path, PATH_MAX, "%s/%s", ewl_theme_path, data);
+ data = strdup(path);
+ }
+ else
+ data = strdup(data);
- DRETURN_PTR(data, DLEVEL_STABLE);
+ DRETURN_PTR(data, DLEVEL_STABLE);
}
static void
ewl_theme_lookup_cache(Ecore_Hash *cache, const char *k, const char *v)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cache);
- DCHECK_PARAM_PTR(k);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(cache);
+ DCHECK_PARAM_PTR(k);
- /*
- * The v value should already be a string instance at this point so we
- * can set the value directly whether its a match or no match.
- */
- ecore_hash_set(cache, (void *)ecore_string_instance(k), (void *)v);
+ /*
+ * The v value should already be a string instance at this point so we
+ * can set the value directly whether its a match or no match.
+ */
+ ecore_hash_set(cache, (void *)ecore_string_instance(k), (void *)v);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static const char *
ewl_theme_lookup_key(Ecore_Hash *cache, const char *path, const char *k)
{
- const char *ret;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(cache, NULL);
- DCHECK_PARAM_PTR_RET(k, NULL);
-
- ret = ecore_hash_get(cache, k);
- if (!ret) {
- char *tmp = NULL;
-
- /*
- * Resort to looking in the edje.
- */
- if (path)
- tmp = edje_file_data_get(path, k);
-
- /*
- * Get a string instance for the value so we can treat the
- * return type consistently and not leak memory.
- */
- if (tmp) {
- ret = ecore_string_instance(tmp);
- FREE(tmp);
- }
- }
- else
- ret = ecore_string_instance(ret);
-
- DRETURN_PTR(ret, DLEVEL_STABLE);
+ const char *ret;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(cache, NULL);
+ DCHECK_PARAM_PTR_RET(k, NULL);
+
+ ret = ecore_hash_get(cache, k);
+ if (!ret) {
+ char *tmp = NULL;
+
+ /*
+ * Resort to looking in the edje.
+ */
+ if (path)
+ tmp = edje_file_data_get(path, k);
+
+ /*
+ * Get a string instance for the value so we can treat the
+ * return type consistently and not leak memory.
+ */
+ if (tmp) {
+ ret = ecore_string_instance(tmp);
+ FREE(tmp);
+ }
+ }
+ else
+ ret = ecore_string_instance(ret);
+
+ DRETURN_PTR(ret, DLEVEL_STABLE);
}
/**
@@ -318,13 +318,13 @@ ewl_theme_lookup_key(Ecore_Hash *cache, const char *path, const char *k)
void
ewl_theme_data_reset(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- IF_FREE_HASH(w->theme);
+ IF_FREE_HASH(w->theme);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -336,110 +336,110 @@ ewl_theme_data_reset(Ewl_Widget *w)
const char *
ewl_theme_data_str_get(Ewl_Widget *w, char *k)
{
- Ecore_Hash *cache = NULL;
- const char *ret = NULL;
- char *temp = NULL;
- char key[PATH_MAX];
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(k, NULL);
-
- /*
- * Use the widget's appearance string to build a relative theme key.
- */
- if (w) {
- int len;
- char *tmp;
-
- len = ewl_widget_appearance_path_size_get(w);
- tmp = alloca(len);
- if (tmp) {
- int used;
-
- used = ewl_widget_appearance_path_copy(w, tmp, len);
- if (used == (len - 1)) {
- used = ecore_strlcpy(key, tmp, PATH_MAX);
- if (used < PATH_MAX) {
- *(key + used) = '/';
- used++;
- }
-
- ecore_strlcpy(key + used, k, PATH_MAX - used);
- }
- }
- else {
- len += strlen(k) + 1;
- ecore_strlcpy(key, k, len);
- }
-
- } else
- snprintf(key, PATH_MAX, "%s", k);
-
- if (ewl_config_cache.print_keys)
- printf("%s\n", key);
-
- /*
- * Loop up the widget heirarchy looking for this key.
- */
- temp = key;
- while (w && temp && !ret) {
-
- /*
- * Find a widget with theme data.
- */
- while (w && !w->theme)
- w = w->parent;
-
- if (w && w->theme)
- ret = ewl_theme_lookup_key(w->theme, w->theme_path, temp);
-
- if (ret) {
- cache = w->theme;
- break;
- }
-
- temp++;
- temp = strchr(temp, '/');
- if (!temp && w && w->parent) {
- temp = key;
- w = w->parent;
- }
- }
-
- /*
- * No key found in widgets, look in the default theme and edje.
- */
- if (!ret) {
- temp = key;
- while (temp && !ret) {
- ret = ewl_theme_lookup_key(ewl_theme_def_data,
- ewl_theme_path, temp);
- if (ret) {
- cache = ewl_theme_def_data;
- break;
- }
-
- temp++;
- temp = strchr(temp, '/');
- }
-
- }
-
- if (!cache)
- cache = ewl_theme_def_data;
-
- /*
- * Mark all keys matched and unmatched in the cache.
- */
- ewl_theme_lookup_cache(cache, key, ret);
-
- /*
- * Fixup unmatched keys in the cache.
- */
- if (ret == EWL_THEME_KEY_NOMATCH)
- ret = NULL;
-
- DRETURN_PTR(ret, DLEVEL_STABLE);
+ Ecore_Hash *cache = NULL;
+ const char *ret = NULL;
+ char *temp = NULL;
+ char key[PATH_MAX];
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(k, NULL);
+
+ /*
+ * Use the widget's appearance string to build a relative theme key.
+ */
+ if (w) {
+ int len;
+ char *tmp;
+
+ len = ewl_widget_appearance_path_size_get(w);
+ tmp = alloca(len);
+ if (tmp) {
+ int used;
+
+ used = ewl_widget_appearance_path_copy(w, tmp, len);
+ if (used == (len - 1)) {
+ used = ecore_strlcpy(key, tmp, PATH_MAX);
+ if (used < PATH_MAX) {
+ *(key + used) = '/';
+ used++;
+ }
+
+ ecore_strlcpy(key + used, k, PATH_MAX - used);
+ }
+ }
+ else {
+ len += strlen(k) + 1;
+ ecore_strlcpy(key, k, len);
+ }
+
+ } else
+ snprintf(key, PATH_MAX, "%s", k);
+
+ if (ewl_config_cache.print_keys)
+ printf("%s\n", key);
+
+ /*
+ * Loop up the widget heirarchy looking for this key.
+ */
+ temp = key;
+ while (w && temp && !ret) {
+
+ /*
+ * Find a widget with theme data.
+ */
+ while (w && !w->theme)
+ w = w->parent;
+
+ if (w && w->theme)
+ ret = ewl_theme_lookup_key(w->theme, w->theme_path, temp);
+
+ if (ret) {
+ cache = w->theme;
+ break;
+ }
+
+ temp++;
+ temp = strchr(temp, '/');
+ if (!temp && w && w->parent) {
+ temp = key;
+ w = w->parent;
+ }
+ }
+
+ /*
+ * No key found in widgets, look in the default theme and edje.
+ */
+ if (!ret) {
+ temp = key;
+ while (temp && !ret) {
+ ret = ewl_theme_lookup_key(ewl_theme_def_data,
+ ewl_theme_path, temp);
+ if (ret) {
+ cache = ewl_theme_def_data;
+ break;
+ }
+
+ temp++;
+ temp = strchr(temp, '/');
+ }
+
+ }
+
+ if (!cache)
+ cache = ewl_theme_def_data;
+
+ /*
+ * Mark all keys matched and unmatched in the cache.
+ */
+ ewl_theme_lookup_cache(cache, key, ret);
+
+ /*
+ * Fixup unmatched keys in the cache.
+ */
+ if (ret == EWL_THEME_KEY_NOMATCH)
+ ret = NULL;
+
+ DRETURN_PTR(ret, DLEVEL_STABLE);
}
/**
@@ -451,16 +451,16 @@ ewl_theme_data_str_get(Ewl_Widget *w, char *k)
int
ewl_theme_data_int_get(Ewl_Widget *w, char *k)
{
- const char *temp;
- int ret = 0;
+ const char *temp;
+ int ret = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(k, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(k, FALSE);
- temp = ewl_theme_data_str_get(w, k);
- if (temp) ret = atoi(temp);
+ temp = ewl_theme_data_str_get(w, k);
+ if (temp) ret = atoi(temp);
- DRETURN_INT(ret, DLEVEL_STABLE);
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
/**
@@ -476,30 +476,30 @@ ewl_theme_data_int_get(Ewl_Widget *w, char *k)
void
ewl_theme_data_str_set(Ewl_Widget *w, char *k, char *v)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(k);
-
- if (!w->theme || w->theme == ewl_theme_def_data) {
- w->theme = ecore_hash_new(ecore_str_hash, ecore_str_compare);
-
- ecore_hash_free_key_cb_set(w->theme, ewl_theme_data_free);
- ecore_hash_free_value_cb_set(w->theme, ewl_theme_data_free);
- }
-
- if (v && v != EWL_THEME_KEY_NOMATCH)
- ecore_hash_set(w->theme, (void *)ecore_string_instance(k),
- (void *)ecore_string_instance(v));
- else
- ecore_hash_set(w->theme, (void *)ecore_string_instance(k),
- EWL_THEME_KEY_NOMATCH);
-
- if (REALIZED(w)) {
- ewl_widget_unrealize(w);
- ewl_widget_realize(w);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(k);
+
+ if (!w->theme || w->theme == ewl_theme_def_data) {
+ w->theme = ecore_hash_new(ecore_str_hash, ecore_str_compare);
+
+ ecore_hash_free_key_cb_set(w->theme, ewl_theme_data_free);
+ ecore_hash_free_value_cb_set(w->theme, ewl_theme_data_free);
+ }
+
+ if (v && v != EWL_THEME_KEY_NOMATCH)
+ ecore_hash_set(w->theme, (void *)ecore_string_instance(k),
+ (void *)ecore_string_instance(v));
+ else
+ ecore_hash_set(w->theme, (void *)ecore_string_instance(k),
+ EWL_THEME_KEY_NOMATCH);
+
+ if (REALIZED(w)) {
+ ewl_widget_unrealize(w);
+ ewl_widget_realize(w);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -515,16 +515,16 @@ ewl_theme_data_str_set(Ewl_Widget *w, char *k, char *v)
void
ewl_theme_data_int_set(Ewl_Widget *w, char *k, int v)
{
- char value[16];
+ char value[16];
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(k);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(k);
- snprintf(value, 16, "%d", v);
- ewl_theme_data_str_set(w, k, value);
+ snprintf(value, 16, "%d", v);
+ ewl_theme_data_str_set(w, k, value);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/*
@@ -534,67 +534,67 @@ ewl_theme_data_int_set(Ewl_Widget *w, char *k, int v)
static char *
ewl_theme_path_find(const char *name)
{
- struct stat st;
- char *theme_found_path = NULL;
- char theme_tmp_path[PATH_MAX];
- char *home;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(name, NULL);
-
- /*
- * Get the users home directory. This environment variable should
- * always be set.
- */
- home = getenv("HOME");
- if (!home) {
- DERROR("Environment variable HOME not defined\n"
- "Try export HOME=/home/user in a bash like environemnt or\n"
- "setenv HOME=/home/user in a csh like environment.\n");
- }
-
- /*
- * Build a path to the theme if it is the users home dir and use it if
- * available.
- */
- if (home) {
- snprintf(theme_tmp_path, PATH_MAX, "%s/.ewl/themes/%s.edj",
- home, name);
- if (((stat(theme_tmp_path, &st)) == 0) && S_ISREG(st.st_mode))
- theme_found_path = strdup(theme_tmp_path);
- }
-
- /*
- * No user theme, so we try the system-wide theme.
- */
- if (!theme_found_path) {
- snprintf(theme_tmp_path, PATH_MAX, PACKAGE_DATA_DIR
- "/ewl/themes/%s.edj", name);
- if (((stat(theme_tmp_path, &st)) == 0) && S_ISREG(st.st_mode))
- theme_found_path = strdup(theme_tmp_path);
- }
-
- /*
- * see if they gave a full path to the theme
- */
- if (!theme_found_path) {
- if (name[0] != '/') {
- char *cwd;
-
- cwd = getenv("PWD");
- if (cwd != NULL)
- snprintf(theme_tmp_path, PATH_MAX, "%s/%s", cwd, name);
- else
- snprintf(theme_tmp_path, PATH_MAX, "%s", name);
-
- } else
- snprintf(theme_tmp_path, PATH_MAX, "%s", name);
-
- if (((stat(theme_tmp_path, &st)) == 0) && S_ISREG(st.st_mode))
- theme_found_path = strdup(theme_tmp_path);
- }
-
- DRETURN_PTR(theme_found_path, DLEVEL_STABLE);
+ struct stat st;
+ char *theme_found_path = NULL;
+ char theme_tmp_path[PATH_MAX];
+ char *home;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(name, NULL);
+
+ /*
+ * Get the users home directory. This environment variable should
+ * always be set.
+ */
+ home = getenv("HOME");
+ if (!home) {
+ DERROR("Environment variable HOME not defined\n"
+ "Try export HOME=/home/user in a bash like environemnt or\n"
+ "setenv HOME=/home/user in a csh like environment.\n");
+ }
+
+ /*
+ * Build a path to the theme if it is the users home dir and use it if
+ * available.
+ */
+ if (home) {
+ snprintf(theme_tmp_path, PATH_MAX, "%s/.ewl/themes/%s.edj",
+ home, name);
+ if (((stat(theme_tmp_path, &st)) == 0) && S_ISREG(st.st_mode))
+ theme_found_path = strdup(theme_tmp_path);
+ }
+
+ /*
+ * No user theme, so we try the system-wide theme.
+ */
+ if (!theme_found_path) {
+ snprintf(theme_tmp_path, PATH_MAX, PACKAGE_DATA_DIR
+ "/ewl/themes/%s.edj", name);
+ if (((stat(theme_tmp_path, &st)) == 0) && S_ISREG(st.st_mode))
+ theme_found_path = strdup(theme_tmp_path);
+ }
+
+ /*
+ * see if they gave a full path to the theme
+ */
+ if (!theme_found_path) {
+ if (name[0] != '/') {
+ char *cwd;
+
+ cwd = getenv("PWD");
+ if (cwd != NULL)
+ snprintf(theme_tmp_path, PATH_MAX, "%s/%s", cwd, name);
+ else
+ snprintf(theme_tmp_path, PATH_MAX, "%s", name);
+
+ } else
+ snprintf(theme_tmp_path, PATH_MAX, "%s", name);
+
+ if (((stat(theme_tmp_path, &st)) == 0) && S_ISREG(st.st_mode))
+ theme_found_path = strdup(theme_tmp_path);
+ }
+
+ DRETURN_PTR(theme_found_path, DLEVEL_STABLE);
}
/*
@@ -604,42 +604,42 @@ ewl_theme_path_find(const char *name)
static void
ewl_theme_font_path_init(void)
{
- const char *font_path;
- char key[PATH_MAX];
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- /*
- * Setup the default font paths
- */
- ewl_theme_font_paths = ecore_list_new();
- if (!ewl_theme_font_paths)
- DRETURN(DLEVEL_STABLE);
- ecore_list_free_cb_set(ewl_theme_font_paths, free);
-
- font_path = ewl_theme_data_str_get(NULL, "/theme/font_path");
- if (!font_path)
- DRETURN(DLEVEL_STABLE);
-
- if (*font_path == '/')
- ecore_list_append(ewl_theme_font_paths, strdup(font_path));
- else {
- int len;
- char *tmp;
-
- len = strlen(ewl_theme_path);
- tmp = ewl_theme_path + len - 4;
-
- if (strcmp(tmp, ".edj"))
- snprintf(key, PATH_MAX, "%s/%s",
- ewl_theme_path, font_path);
- else
- snprintf(key, PATH_MAX, "%s", ewl_theme_path);
-
- ecore_list_append(ewl_theme_font_paths, strdup(key));
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ const char *font_path;
+ char key[PATH_MAX];
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ /*
+ * Setup the default font paths
+ */
+ ewl_theme_font_paths = ecore_list_new();
+ if (!ewl_theme_font_paths)
+ DRETURN(DLEVEL_STABLE);
+ ecore_list_free_cb_set(ewl_theme_font_paths, free);
+
+ font_path = ewl_theme_data_str_get(NULL, "/theme/font_path");
+ if (!font_path)
+ DRETURN(DLEVEL_STABLE);
+
+ if (*font_path == '/')
+ ecore_list_append(ewl_theme_font_paths, strdup(font_path));
+ else {
+ int len;
+ char *tmp;
+
+ len = strlen(ewl_theme_path);
+ tmp = ewl_theme_path + len - 4;
+
+ if (strcmp(tmp, ".edj"))
+ snprintf(key, PATH_MAX, "%s/%s",
+ ewl_theme_path, font_path);
+ else
+ snprintf(key, PATH_MAX, "%s", ewl_theme_path);
+
+ ecore_list_append(ewl_theme_font_paths, strdup(key));
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/*
@@ -648,13 +648,13 @@ ewl_theme_font_path_init(void)
static void
ewl_theme_data_free(void *data)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- if (!data || data == (void *)EWL_THEME_KEY_NOMATCH)
- DRETURN(DLEVEL_STABLE);
+ if (!data || data == (void *)EWL_THEME_KEY_NOMATCH)
+ DRETURN(DLEVEL_STABLE);
- IF_RELEASE(data);
+ IF_RELEASE(data);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_theme.h b/src/lib/ewl_theme.h
index f432c07..3daa6f5 100644
--- a/src/lib/ewl_theme.h
+++ b/src/lib/ewl_theme.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_THEME_H
#define EWL_THEME_H
@@ -10,27 +10,27 @@
* @{
*/
-int ewl_theme_init(void);
-void ewl_theme_shutdown(void);
+int ewl_theme_init(void);
+void ewl_theme_shutdown(void);
-int ewl_theme_widget_init(Ewl_Widget *w);
-void ewl_theme_widget_shutdown(Ewl_Widget *w);
+int ewl_theme_widget_init(Ewl_Widget *w);
+void ewl_theme_widget_shutdown(Ewl_Widget *w);
-const char *ewl_theme_path_get(void);
-int ewl_theme_theme_set(const char *theme);
+const char *ewl_theme_path_get(void);
+int ewl_theme_theme_set(const char *theme);
-Ecore_List *ewl_theme_font_path_get(void);
-void ewl_theme_font_path_add(char *path);
+Ecore_List *ewl_theme_font_path_get(void);
+void ewl_theme_font_path_add(char *path);
-char *ewl_theme_image_get(Ewl_Widget *w, char *k);
+char *ewl_theme_image_get(Ewl_Widget *w, char *k);
-void ewl_theme_data_reset(Ewl_Widget *w);
+void ewl_theme_data_reset(Ewl_Widget *w);
-const char *ewl_theme_data_str_get(Ewl_Widget *w, char *k);
-void ewl_theme_data_str_set(Ewl_Widget *w, char *k, char *v);
+const char *ewl_theme_data_str_get(Ewl_Widget *w, char *k);
+void ewl_theme_data_str_set(Ewl_Widget *w, char *k, char *v);
-int ewl_theme_data_int_get(Ewl_Widget *w, char *k);
-void ewl_theme_data_int_set(Ewl_Widget *w, char *k, int v);
+int ewl_theme_data_int_get(Ewl_Widget *w, char *k);
+void ewl_theme_data_int_set(Ewl_Widget *w, char *k, int v);
/**
* @internal
diff --git a/src/lib/ewl_toolbar.c b/src/lib/ewl_toolbar.c
index 34b3715..faf4aa3 100644
--- a/src/lib/ewl_toolbar.c
+++ b/src/lib/ewl_toolbar.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_toolbar.h"
#include "ewl_icon.h"
@@ -13,20 +13,20 @@
Ewl_Widget *
ewl_toolbar_new(void)
{
- Ewl_Toolbar *t;
+ Ewl_Toolbar *t;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- t = NEW(Ewl_Toolbar, 1);
- if (!t)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ t = NEW(Ewl_Toolbar, 1);
+ if (!t)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_toolbar_init(t)) {
- ewl_widget_destroy(EWL_WIDGET(t));
- t = NULL;
- }
+ if (!ewl_toolbar_init(t)) {
+ ewl_widget_destroy(EWL_WIDGET(t));
+ t = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(t), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(t), DLEVEL_STABLE);
}
/**
@@ -36,9 +36,9 @@ ewl_toolbar_new(void)
Ewl_Widget *
ewl_htoolbar_new(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- DRETURN_PTR(ewl_toolbar_new(), DLEVEL_STABLE);
+ DRETURN_PTR(ewl_toolbar_new(), DLEVEL_STABLE);
}
/**
@@ -48,16 +48,16 @@ ewl_htoolbar_new(void)
Ewl_Widget *
ewl_vtoolbar_new(void)
{
- Ewl_Widget *t;
+ Ewl_Widget *t;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- t = ewl_toolbar_new();
- if (t)
- ewl_toolbar_orientation_set(EWL_TOOLBAR(t),
- EWL_ORIENTATION_VERTICAL);
+ t = ewl_toolbar_new();
+ if (t)
+ ewl_toolbar_orientation_set(EWL_TOOLBAR(t),
+ EWL_ORIENTATION_VERTICAL);
- DRETURN_PTR(t, DLEVEL_STABLE);
+ DRETURN_PTR(t, DLEVEL_STABLE);
}
/**
@@ -71,28 +71,28 @@ ewl_vtoolbar_new(void)
int
ewl_toolbar_init(Ewl_Toolbar *t)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, FALSE);
- w = EWL_WIDGET(t);
- if (!ewl_menubar_init(EWL_MENUBAR(t)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ w = EWL_WIDGET(t);
+ if (!ewl_menubar_init(EWL_MENUBAR(t)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_inherit(w, EWL_TOOLBAR_TYPE);
- ewl_widget_appearance_set(w, "htoolbar");
+ ewl_widget_inherit(w, EWL_TOOLBAR_TYPE);
+ ewl_widget_appearance_set(w, "htoolbar");
- ewl_object_fill_policy_set(EWL_OBJECT(t), EWL_FLAG_FILL_HFILL |
- EWL_FLAG_FILL_SHRINK);
- ewl_object_alignment_set(EWL_OBJECT(t), EWL_FLAG_ALIGN_LEFT |
- EWL_FLAG_ALIGN_TOP);
+ ewl_object_fill_policy_set(EWL_OBJECT(t), EWL_FLAG_FILL_HFILL |
+ EWL_FLAG_FILL_SHRINK);
+ ewl_object_alignment_set(EWL_OBJECT(t), EWL_FLAG_ALIGN_LEFT |
+ EWL_FLAG_ALIGN_TOP);
- ewl_container_add_notify_set(EWL_CONTAINER(EWL_MENUBAR(t)->inner_box),
- ewl_toolbar_cb_child_add);
- t->hidden = EWL_ICON_PART_NONE;
+ ewl_container_add_notify_set(EWL_CONTAINER(EWL_MENUBAR(t)->inner_box),
+ ewl_toolbar_cb_child_add);
+ t->hidden = EWL_ICON_PART_NONE;
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -104,19 +104,19 @@ ewl_toolbar_init(Ewl_Toolbar *t)
void
ewl_toolbar_orientation_set(Ewl_Toolbar *t, Ewl_Orientation o)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TOOLBAR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TOOLBAR_TYPE);
- ewl_menubar_orientation_set(EWL_MENUBAR(t), o);
- if (o == EWL_ORIENTATION_HORIZONTAL)
- ewl_widget_appearance_set(EWL_WIDGET(t), "htoolbar");
- else
- ewl_widget_appearance_set(EWL_WIDGET(t), "vtoolbar");
+ ewl_menubar_orientation_set(EWL_MENUBAR(t), o);
+ if (o == EWL_ORIENTATION_HORIZONTAL)
+ ewl_widget_appearance_set(EWL_WIDGET(t), "htoolbar");
+ else
+ ewl_widget_appearance_set(EWL_WIDGET(t), "vtoolbar");
- ewl_widget_configure(EWL_WIDGET(t));
+ ewl_widget_configure(EWL_WIDGET(t));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -127,11 +127,11 @@ ewl_toolbar_orientation_set(Ewl_Toolbar *t, Ewl_Orientation o)
Ewl_Orientation
ewl_toolbar_orientation_get(Ewl_Toolbar *t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(t, EWL_ORIENTATION_HORIZONTAL);
- DCHECK_TYPE_RET(t, EWL_TOOLBAR_TYPE, EWL_ORIENTATION_HORIZONTAL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(t, EWL_ORIENTATION_HORIZONTAL);
+ DCHECK_TYPE_RET(t, EWL_TOOLBAR_TYPE, EWL_ORIENTATION_HORIZONTAL);
- DRETURN_INT(ewl_menubar_orientation_get(EWL_MENUBAR(t)), DLEVEL_STABLE);
+ DRETURN_INT(ewl_menubar_orientation_get(EWL_MENUBAR(t)), DLEVEL_STABLE);
}
/**
@@ -143,24 +143,24 @@ ewl_toolbar_orientation_get(Ewl_Toolbar *t)
void
ewl_toolbar_icon_part_hide(Ewl_Toolbar *t, Ewl_Icon_Part part)
{
- Ewl_Widget *child;
+ Ewl_Widget *child;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(t, EWL_TOOLBAR_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(t, EWL_TOOLBAR_TYPE);
- if (t->hidden == part)
- DRETURN(DLEVEL_STABLE);
+ if (t->hidden == part)
+ DRETURN(DLEVEL_STABLE);
- t->hidden = part;
+ t->hidden = part;
- ewl_container_child_iterate_begin(EWL_CONTAINER(t));
- while ((child = ewl_container_child_next(EWL_CONTAINER(t)))) {
- if (EWL_ICON_IS(child))
- ewl_icon_part_hide(EWL_ICON(child), part);
- }
+ ewl_container_child_iterate_begin(EWL_CONTAINER(t));
+ while ((child = ewl_container_child_next(EWL_CONTAINER(t)))) {
+ if (EWL_ICON_IS(child))
+ ewl_icon_part_hide(EWL_ICON(child), part);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -173,20 +173,20 @@ ewl_toolbar_icon_part_hide(Ewl_Toolbar *t, Ewl_Icon_Part part)
void
ewl_toolbar_cb_child_add(Ewl_Container *c, Ewl_Widget *w)
{
- Ewl_Toolbar *t;
+ Ewl_Toolbar *t;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_menubar_cb_child_add(c, w);
- t = EWL_TOOLBAR(EWL_WIDGET(c)->parent);
+ ewl_menubar_cb_child_add(c, w);
+ t = EWL_TOOLBAR(EWL_WIDGET(c)->parent);
- if (EWL_ICON_IS(w))
- ewl_icon_part_hide(EWL_ICON(w), t->hidden);
+ if (EWL_ICON_IS(w))
+ ewl_icon_part_hide(EWL_ICON(w), t->hidden);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_toolbar.h b/src/lib/ewl_toolbar.h
index 5da6b50..0ce37f7 100644
--- a/src/lib/ewl_toolbar.h
+++ b/src/lib/ewl_toolbar.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_TOOLBAR_H
#define EWL_TOOLBAR_H
@@ -44,8 +44,8 @@ typedef struct Ewl_Toolbar Ewl_Toolbar;
*/
struct Ewl_Toolbar
{
- Ewl_Menubar menubar; /**< Inherit from Ewl_Menubar */
- Ewl_Icon_Part hidden; /**< which part of icons should be hidden */
+ Ewl_Menubar menubar; /**< Inherit from Ewl_Menubar */
+ Ewl_Icon_Part hidden; /**< which part of icons should be hidden */
};
Ewl_Widget *ewl_htoolbar_new(void);
Ewl_Widget *ewl_vtoolbar_new(void);
diff --git a/src/lib/ewl_tree.c b/src/lib/ewl_tree.c
index 28915b7..235db3e 100644
--- a/src/lib/ewl_tree.c
+++ b/src/lib/ewl_tree.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_tree.h"
#include "ewl_button.h"
@@ -22,20 +22,20 @@ typedef struct Ewl_Tree_Expansions_List Ewl_Tree_Expansions_List;
*/
struct Ewl_Tree_Expansions_List
{
- Ewl_Container *c;
- unsigned int *expanded;
- unsigned int size;
+ Ewl_Container *c;
+ unsigned int *expanded;
+ unsigned int size;
};
static void ewl_tree_build_tree(Ewl_Tree *tree);
static void ewl_tree_build_tree_rows(Ewl_Tree *tree,
- const Ewl_Model *model, const Ewl_View *view,
- void *data, int colour, Ewl_Container *parent,
- int hidden);
+ const Ewl_Model *model, const Ewl_View *view,
+ void *data, int colour, Ewl_Container *parent,
+ int hidden);
static void ewl_tree_headers_build(Ewl_Tree *tree, const Ewl_Model *model,
- void *mvc_data);
+ void *mvc_data);
static void ewl_tree_cb_header_changed(Ewl_Widget *w, void *ev,
- void *data);
+ void *data);
static void ewl_tree_cb_row_clicked(Ewl_Widget *w, void *ev, void *data);
static void ewl_tree_cb_row_highlight(Ewl_Widget *w, void *ev, void *data);
@@ -43,7 +43,7 @@ static void ewl_tree_cb_row_unhighlight(Ewl_Widget *w, void *ev, void *data);
static void ewl_tree_cb_cell_clicked(Ewl_Widget *w, void *ev, void *data);
static void ewl_tree_cb_selected_change(Ewl_MVC *mvc);
static Ewl_Widget *ewl_tree_widget_at(Ewl_MVC *mvc, void *data,
- unsigned int row, unsigned int column);
+ unsigned int row, unsigned int column);
static void ewl_tree_expansions_hash_create(Ewl_Tree *tree);
@@ -58,21 +58,21 @@ Ewl_Scrollpane *ewl_tree_kinetic_scrollpane_get(Ewl_Tree *tree);
Ewl_Widget *
ewl_tree_new(void)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- w = NEW(Ewl_Tree, 1);
- if (!w)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ w = NEW(Ewl_Tree, 1);
+ if (!w)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_tree_init(EWL_TREE(w)))
- {
- ewl_widget_destroy(w);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ if (!ewl_tree_init(EWL_TREE(w)))
+ {
+ ewl_widget_destroy(w);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
/**
@@ -85,47 +85,47 @@ ewl_tree_new(void)
int
ewl_tree_init(Ewl_Tree *tree)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(tree, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(tree, FALSE);
- if (!ewl_mvc_init(EWL_MVC(tree)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_mvc_init(EWL_MVC(tree)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_appearance_set(EWL_WIDGET(tree), EWL_TREE_TYPE);
- ewl_widget_inherit(EWL_WIDGET(tree), EWL_TREE_TYPE);
+ ewl_widget_appearance_set(EWL_WIDGET(tree), EWL_TREE_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(tree), EWL_TREE_TYPE);
- ewl_mvc_selected_change_cb_set(EWL_MVC(tree),
- ewl_tree_cb_selected_change);
+ ewl_mvc_selected_change_cb_set(EWL_MVC(tree),
+ ewl_tree_cb_selected_change);
- ewl_object_fill_policy_set(EWL_OBJECT(tree), EWL_FLAG_FILL_ALL);
+ ewl_object_fill_policy_set(EWL_OBJECT(tree), EWL_FLAG_FILL_ALL);
- tree->type = EWL_TREE_SELECTION_TYPE_CELL;
+ tree->type = EWL_TREE_SELECTION_TYPE_CELL;
- tree->header = ewl_hpaned_new();
- ewl_container_child_append(EWL_CONTAINER(tree), tree->header);
- ewl_widget_appearance_set(EWL_WIDGET(tree->header), "tree_header");
- ewl_object_fill_policy_set(EWL_OBJECT(tree->header),
- EWL_FLAG_FILL_HFILL);
- ewl_callback_append(tree->header, EWL_CALLBACK_VALUE_CHANGED,
- ewl_tree_cb_header_changed, tree);
- ewl_widget_show(tree->header);
+ tree->header = ewl_hpaned_new();
+ ewl_container_child_append(EWL_CONTAINER(tree), tree->header);
+ ewl_widget_appearance_set(EWL_WIDGET(tree->header), "tree_header");
+ ewl_object_fill_policy_set(EWL_OBJECT(tree->header),
+ EWL_FLAG_FILL_HFILL);
+ ewl_callback_append(tree->header, EWL_CALLBACK_VALUE_CHANGED,
+ ewl_tree_cb_header_changed, tree);
+ ewl_widget_show(tree->header);
- /* set the default row view */
- ewl_tree_content_view_set(tree, ewl_tree_view_scrolled_get());
+ /* set the default row view */
+ ewl_tree_content_view_set(tree, ewl_tree_view_scrolled_get());
- ewl_tree_column_count_set(tree, 1);
- ewl_tree_headers_visible_set(tree, TRUE);
- ewl_tree_fixed_rows_set(tree, FALSE);
- ewl_tree_alternate_row_colors_set(tree, TRUE);
+ ewl_tree_column_count_set(tree, 1);
+ ewl_tree_headers_visible_set(tree, TRUE);
+ ewl_tree_fixed_rows_set(tree, FALSE);
+ ewl_tree_alternate_row_colors_set(tree, TRUE);
- ewl_callback_append(EWL_WIDGET(tree), EWL_CALLBACK_CONFIGURE,
- ewl_tree_cb_configure, NULL);
- ewl_callback_prepend(EWL_WIDGET(tree), EWL_CALLBACK_DESTROY,
- ewl_tree_cb_destroy, NULL);
+ ewl_callback_append(EWL_WIDGET(tree), EWL_CALLBACK_CONFIGURE,
+ ewl_tree_cb_configure, NULL);
+ ewl_callback_prepend(EWL_WIDGET(tree), EWL_CALLBACK_DESTROY,
+ ewl_tree_cb_destroy, NULL);
- ewl_widget_focusable_set(EWL_WIDGET(tree), FALSE);
+ ewl_widget_focusable_set(EWL_WIDGET(tree), FALSE);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -137,23 +137,23 @@ ewl_tree_init(Ewl_Tree *tree)
void
ewl_tree_headers_visible_set(Ewl_Tree *tree, unsigned char visible)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(tree);
- DCHECK_TYPE(tree, EWL_TREE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(tree);
+ DCHECK_TYPE(tree, EWL_TREE_TYPE);
- if (tree->headers_visible == !!visible)
- DRETURN(DLEVEL_STABLE);
+ if (tree->headers_visible == !!visible)
+ DRETURN(DLEVEL_STABLE);
- tree->headers_visible = !!visible;
+ tree->headers_visible = !!visible;
- if (!tree->headers_visible)
- ewl_widget_hide(tree->header);
- else
- ewl_widget_show(tree->header);
+ if (!tree->headers_visible)
+ ewl_widget_hide(tree->header);
+ else
+ ewl_widget_show(tree->header);
- ewl_mvc_dirty_set(EWL_MVC(tree), TRUE);
+ ewl_mvc_dirty_set(EWL_MVC(tree), TRUE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -164,11 +164,11 @@ ewl_tree_headers_visible_set(Ewl_Tree *tree, unsigned char visible)
unsigned int
ewl_tree_headers_visible_get(Ewl_Tree *tree)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(tree, FALSE);
- DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(tree, FALSE);
+ DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, FALSE);
- DRETURN_INT(tree->headers_visible, DLEVEL_STABLE);
+ DRETURN_INT(tree->headers_visible, DLEVEL_STABLE);
}
/**
@@ -180,17 +180,17 @@ ewl_tree_headers_visible_get(Ewl_Tree *tree)
void
ewl_tree_alternate_row_colors_set(Ewl_Tree *tree, unsigned char alternate)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(tree);
- DCHECK_TYPE(tree, EWL_TREE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(tree);
+ DCHECK_TYPE(tree, EWL_TREE_TYPE);
- if (tree->row_color_alternate == !!alternate)
- DRETURN(DLEVEL_STABLE);
+ if (tree->row_color_alternate == !!alternate)
+ DRETURN(DLEVEL_STABLE);
- tree->row_color_alternate = !!alternate;
- ewl_mvc_dirty_set(EWL_MVC(tree), TRUE);
+ tree->row_color_alternate = !!alternate;
+ ewl_mvc_dirty_set(EWL_MVC(tree), TRUE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -201,11 +201,11 @@ ewl_tree_alternate_row_colors_set(Ewl_Tree *tree, unsigned char alternate)
unsigned int
ewl_tree_alternate_row_colors_get(Ewl_Tree *tree)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(tree, FALSE);
- DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(tree, FALSE);
+ DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, FALSE);
- DRETURN_INT(tree->row_color_alternate, DLEVEL_STABLE);
+ DRETURN_INT(tree->row_color_alternate, DLEVEL_STABLE);
}
/**
@@ -217,28 +217,28 @@ ewl_tree_alternate_row_colors_get(Ewl_Tree *tree)
void
ewl_tree_column_count_set(Ewl_Tree *tree, unsigned int count)
{
- int i;
+ int i;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(tree);
- DCHECK_TYPE(tree, EWL_TREE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(tree);
+ DCHECK_TYPE(tree, EWL_TREE_TYPE);
- if (tree->columns == count)
- DRETURN(DLEVEL_STABLE);
-
- tree->columns = count;
- ewl_container_reset(EWL_CONTAINER(tree->header));
+ if (tree->columns == count)
+ DRETURN(DLEVEL_STABLE);
+
+ tree->columns = count;
+ ewl_container_reset(EWL_CONTAINER(tree->header));
- for (i = 0; i < tree->columns; i++) {
- Ewl_Widget *h;
+ for (i = 0; i < tree->columns; i++) {
+ Ewl_Widget *h;
- h = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(tree->header), h);
- ewl_widget_appearance_set(h, "header");
- ewl_widget_show(h);
- }
+ h = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(tree->header), h);
+ ewl_widget_appearance_set(h, "header");
+ ewl_widget_show(h);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -250,23 +250,23 @@ ewl_tree_column_count_set(Ewl_Tree *tree, unsigned int count)
void
ewl_tree_column_fixed_size_set(Ewl_Tree *tree, unsigned int col, unsigned int fixed)
{
- Ewl_Widget *box;
+ Ewl_Widget *box;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(tree);
- DCHECK_TYPE(tree, EWL_TREE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(tree);
+ DCHECK_TYPE(tree, EWL_TREE_TYPE);
- if (col >= tree->columns)
- {
- DWARNING("parameter col is out of bounds (%i >= %i)",
- col, tree->columns);
- DRETURN(DLEVEL_STABLE);
- }
+ if (col >= tree->columns)
+ {
+ DWARNING("parameter col is out of bounds (%i >= %i)",
+ col, tree->columns);
+ DRETURN(DLEVEL_STABLE);
+ }
- box = ewl_container_child_get(EWL_CONTAINER(tree->header), col);
- ewl_paned_fixed_size_set(EWL_PANED(tree->header), box, fixed);
+ box = ewl_container_child_get(EWL_CONTAINER(tree->header), col);
+ ewl_paned_fixed_size_set(EWL_PANED(tree->header), box, fixed);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -277,24 +277,24 @@ ewl_tree_column_fixed_size_set(Ewl_Tree *tree, unsigned int col, unsigned int fi
unsigned int
ewl_tree_column_fixed_size_get(Ewl_Tree *tree, unsigned int col)
{
- unsigned int ret = 0;
- Ewl_Widget *box;
+ unsigned int ret = 0;
+ Ewl_Widget *box;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(tree, 0);
- DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(tree, 0);
+ DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, 0);
- if (col >= tree->columns)
- {
- DWARNING("parameter col is out of bounds (%i >= %i)",
- col, tree->columns);
- DRETURN_INT(ret, DLEVEL_STABLE);
- }
+ if (col >= tree->columns)
+ {
+ DWARNING("parameter col is out of bounds (%i >= %i)",
+ col, tree->columns);
+ DRETURN_INT(ret, DLEVEL_STABLE);
+ }
- box = ewl_container_child_get(EWL_CONTAINER(tree->header), col);
- ret = ewl_paned_fixed_size_get(EWL_PANED(tree->header), box);
+ box = ewl_container_child_get(EWL_CONTAINER(tree->header), col);
+ ret = ewl_paned_fixed_size_get(EWL_PANED(tree->header), box);
- DRETURN_INT(ret, DLEVEL_STABLE);
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
/**
@@ -306,23 +306,23 @@ ewl_tree_column_fixed_size_get(Ewl_Tree *tree, unsigned int col)
void
ewl_tree_column_initial_size_set(Ewl_Tree *tree, unsigned int col, int size)
{
- Ewl_Widget *box;
+ Ewl_Widget *box;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(tree);
- DCHECK_TYPE(tree, EWL_TREE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(tree);
+ DCHECK_TYPE(tree, EWL_TREE_TYPE);
- if (col >= tree->columns)
- {
- DWARNING("parameter col is out of bounds (%i >= %i)",
- col, tree->columns);
- DRETURN(DLEVEL_STABLE);
- }
+ if (col >= tree->columns)
+ {
+ DWARNING("parameter col is out of bounds (%i >= %i)",
+ col, tree->columns);
+ DRETURN(DLEVEL_STABLE);
+ }
- box = ewl_container_child_get(EWL_CONTAINER(tree->header), col);
- ewl_paned_initial_size_set(EWL_PANED(tree->header), box, size);
+ box = ewl_container_child_get(EWL_CONTAINER(tree->header), col);
+ ewl_paned_initial_size_set(EWL_PANED(tree->header), box, size);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -333,24 +333,24 @@ ewl_tree_column_initial_size_set(Ewl_Tree *tree, unsigned int col, int size)
int
ewl_tree_column_initial_size_get(Ewl_Tree *tree, unsigned int col)
{
- int ret = 0;
- Ewl_Widget *box;
+ int ret = 0;
+ Ewl_Widget *box;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(tree, 0);
- DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(tree, 0);
+ DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, 0);
- if (col >= tree->columns)
- {
- DWARNING("parameter col is out of bounds (%i >= %i)",
- col, tree->columns);
- DRETURN_INT(ret, DLEVEL_STABLE);
- }
+ if (col >= tree->columns)
+ {
+ DWARNING("parameter col is out of bounds (%i >= %i)",
+ col, tree->columns);
+ DRETURN_INT(ret, DLEVEL_STABLE);
+ }
- box = ewl_container_child_get(EWL_CONTAINER(tree->header), col);
- ret = ewl_paned_initial_size_get(EWL_PANED(tree->header), box);
+ box = ewl_container_child_get(EWL_CONTAINER(tree->header), col);
+ ret = ewl_paned_initial_size_get(EWL_PANED(tree->header), box);
- DRETURN_INT(ret, DLEVEL_STABLE);
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
/**
@@ -361,11 +361,11 @@ ewl_tree_column_initial_size_get(Ewl_Tree *tree, unsigned int col)
unsigned int
ewl_tree_column_count_get(Ewl_Tree *tree)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(tree, 0);
- DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(tree, 0);
+ DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, 0);
- DRETURN_INT(tree->columns, DLEVEL_STABLE);
+ DRETURN_INT(tree->columns, DLEVEL_STABLE);
}
/**
@@ -377,27 +377,27 @@ ewl_tree_column_count_get(Ewl_Tree *tree)
void
ewl_tree_content_view_set(Ewl_Tree *tree, const Ewl_View *view)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(tree);
- DCHECK_PARAM_PTR(view);
- DCHECK_TYPE(tree, EWL_TREE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(tree);
+ DCHECK_PARAM_PTR(view);
+ DCHECK_TYPE(tree, EWL_TREE_TYPE);
- if (tree->content_view == view)
- DRETURN(DLEVEL_STABLE);
+ if (tree->content_view == view)
+ DRETURN(DLEVEL_STABLE);
- tree->content_view = view;
+ tree->content_view = view;
- /* destroy the old view, create a new one and redisplay the tree */
- if (tree->rows) ewl_widget_destroy(tree->rows);
+ /* destroy the old view, create a new one and redisplay the tree */
+ if (tree->rows) ewl_widget_destroy(tree->rows);
- tree->rows = view->fetch(NULL, 0, 0);
- ewl_tree_view_tree_set(EWL_TREE_VIEW(tree->rows), tree);
- ewl_container_child_append(EWL_CONTAINER(tree), tree->rows);
- ewl_widget_show(tree->rows);
+ tree->rows = view->fetch(NULL, 0, 0);
+ ewl_tree_view_tree_set(EWL_TREE_VIEW(tree->rows), tree);
+ ewl_container_child_append(EWL_CONTAINER(tree), tree->rows);
+ ewl_widget_show(tree->rows);
- ewl_mvc_dirty_set(EWL_MVC(tree), TRUE);
+ ewl_mvc_dirty_set(EWL_MVC(tree), TRUE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -408,11 +408,11 @@ ewl_tree_content_view_set(Ewl_Tree *tree, const Ewl_View *view)
Ewl_View *
ewl_tree_content_view_get(Ewl_Tree *tree)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(tree, NULL);
- DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(tree, NULL);
+ DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, NULL);
- DRETURN_PTR(tree->content_view, DLEVEL_STABLE);
+ DRETURN_PTR(tree->content_view, DLEVEL_STABLE);
}
/**
@@ -423,12 +423,12 @@ ewl_tree_content_view_get(Ewl_Tree *tree)
Ewl_Tree_Selection_Type
ewl_tree_selection_type_get(Ewl_Tree *tree)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(tree, EWL_TREE_SELECTION_TYPE_CELL);
- DCHECK_TYPE_RET(tree, EWL_TREE_TYPE,
- EWL_TREE_SELECTION_TYPE_CELL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(tree, EWL_TREE_SELECTION_TYPE_CELL);
+ DCHECK_TYPE_RET(tree, EWL_TREE_TYPE,
+ EWL_TREE_SELECTION_TYPE_CELL);
- DRETURN_INT(tree->type, DLEVEL_STABLE);
+ DRETURN_INT(tree->type, DLEVEL_STABLE);
}
/**
@@ -440,20 +440,20 @@ ewl_tree_selection_type_get(Ewl_Tree *tree)
void
ewl_tree_selection_type_set(Ewl_Tree *tree, Ewl_Tree_Selection_Type type)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(tree);
- DCHECK_TYPE(tree, EWL_TREE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(tree);
+ DCHECK_TYPE(tree, EWL_TREE_TYPE);
- if (tree->type == type)
- DRETURN(DLEVEL_STABLE);
+ if (tree->type == type)
+ DRETURN(DLEVEL_STABLE);
- tree->type = type;
+ tree->type = type;
- /* if we switched types then the current set of selections isn't
- * valid anymore so we clear them out */
- ewl_mvc_selected_clear(EWL_MVC(tree));
+ /* if we switched types then the current set of selections isn't
+ * valid anymore so we clear them out */
+ ewl_mvc_selected_clear(EWL_MVC(tree));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -465,17 +465,17 @@ ewl_tree_selection_type_set(Ewl_Tree *tree, Ewl_Tree_Selection_Type type)
void
ewl_tree_fixed_rows_set(Ewl_Tree *tree, unsigned int fixed)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(tree);
- DCHECK_TYPE(tree, EWL_TREE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(tree);
+ DCHECK_TYPE(tree, EWL_TREE_TYPE);
- if (tree->fixed == !!fixed)
- DRETURN(DLEVEL_STABLE);
+ if (tree->fixed == !!fixed)
+ DRETURN(DLEVEL_STABLE);
- tree->fixed = !!fixed;
- ewl_mvc_dirty_set(EWL_MVC(tree), TRUE);
+ tree->fixed = !!fixed;
+ ewl_mvc_dirty_set(EWL_MVC(tree), TRUE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -486,11 +486,11 @@ ewl_tree_fixed_rows_set(Ewl_Tree *tree, unsigned int fixed)
unsigned int
ewl_tree_fixed_rows_get(Ewl_Tree *tree)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(tree, FALSE);
- DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(tree, FALSE);
+ DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, FALSE);
- DRETURN_INT(tree->fixed, DLEVEL_STABLE);
+ DRETURN_INT(tree->fixed, DLEVEL_STABLE);
}
/**
@@ -501,11 +501,11 @@ ewl_tree_fixed_rows_get(Ewl_Tree *tree)
Ewl_Widget *
ewl_tree_content_widget_get(Ewl_Tree *tree)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(tree, NULL);
- DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(tree, NULL);
+ DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, NULL);
- DRETURN_PTR(tree->rows, DLEVEL_STABLE);
+ DRETURN_PTR(tree->rows, DLEVEL_STABLE);
}
/**
@@ -519,36 +519,36 @@ ewl_tree_content_widget_get(Ewl_Tree *tree)
void
ewl_tree_row_expand(Ewl_Tree *tree, void *data, unsigned int row)
{
- Ewl_Tree_Expansions_List *exp;
- Ewl_Widget *node;
+ Ewl_Tree_Expansions_List *exp;
+ Ewl_Widget *node;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(tree);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(tree, EWL_TREE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(tree);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(tree, EWL_TREE_TYPE);
- /* nothing to do if already expanded */
- if (ewl_tree_row_expanded_is(tree, data, row)) DRETURN(DLEVEL_STABLE);
+ /* nothing to do if already expanded */
+ if (ewl_tree_row_expanded_is(tree, data, row)) DRETURN(DLEVEL_STABLE);
- if (!tree->expansions)
- ewl_tree_expansions_hash_create(tree);
+ if (!tree->expansions)
+ ewl_tree_expansions_hash_create(tree);
- exp = ecore_hash_get(tree->expansions, data);
- if (!exp)
- {
- DWARNING("We did not find a expansion list. This should not"
- " happen, ever.");
- DRETURN(DLEVEL_STABLE);
- }
+ exp = ecore_hash_get(tree->expansions, data);
+ if (!exp)
+ {
+ DWARNING("We did not find a expansion list. This should not"
+ " happen, ever.");
+ DRETURN(DLEVEL_STABLE);
+ }
- exp->expanded = realloc(exp->expanded,
- (++exp->size) * sizeof(unsigned int));
- exp->expanded[exp->size - 1] = row;
+ exp->expanded = realloc(exp->expanded,
+ (++exp->size) * sizeof(unsigned int));
+ exp->expanded[exp->size - 1] = row;
- node = ewl_container_child_get(exp->c, row);
- ewl_tree_node_expand(EWL_TREE_NODE(node));
+ node = ewl_container_child_get(exp->c, row);
+ ewl_tree_node_expand(EWL_TREE_NODE(node));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -562,41 +562,41 @@ ewl_tree_row_expand(Ewl_Tree *tree, void *data, unsigned int row)
void
ewl_tree_row_collapse(Ewl_Tree *tree, void *data, unsigned int row)
{
- Ewl_Tree_Expansions_List *exp;
- Ewl_Widget *node;
- unsigned int i;
+ Ewl_Tree_Expansions_List *exp;
+ Ewl_Widget *node;
+ unsigned int i;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(tree);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(tree, EWL_TREE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(tree);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(tree, EWL_TREE_TYPE);
- /* if this tree has no expansions we're done */
- if (!tree->expansions) DRETURN(DLEVEL_STABLE);
+ /* if this tree has no expansions we're done */
+ if (!tree->expansions) DRETURN(DLEVEL_STABLE);
- exp = ecore_hash_get(tree->expansions, data);
+ exp = ecore_hash_get(tree->expansions, data);
- /* if no expansion points for this data we're done */
- if (!exp) DRETURN(DLEVEL_STABLE);
+ /* if no expansion points for this data we're done */
+ if (!exp) DRETURN(DLEVEL_STABLE);
- /* nothing to do if the row isn't expanded */
- if (!ewl_tree_row_expanded_is(tree, data, row)) DRETURN(DLEVEL_STABLE);
+ /* nothing to do if the row isn't expanded */
+ if (!ewl_tree_row_expanded_is(tree, data, row)) DRETURN(DLEVEL_STABLE);
- /* we found the item so we can remove it */
- for (i = 0; exp->expanded[i] != row; i++)
- ;
+ /* we found the item so we can remove it */
+ for (i = 0; exp->expanded[i] != row; i++)
+ ;
- memmove(exp->expanded + i, exp->expanded + i + 1,
- sizeof(unsigned int) * (exp->size - i - 1));
- exp->size--;
- exp->expanded = realloc(exp->expanded,
- sizeof(unsigned int) * exp->size);
+ memmove(exp->expanded + i, exp->expanded + i + 1,
+ sizeof(unsigned int) * (exp->size - i - 1));
+ exp->size--;
+ exp->expanded = realloc(exp->expanded,
+ sizeof(unsigned int) * exp->size);
- node = ewl_container_child_get(exp->c, row);
- ewl_tree_node_collapse(EWL_TREE_NODE(node));
+ node = ewl_container_child_get(exp->c, row);
+ ewl_tree_node_collapse(EWL_TREE_NODE(node));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -609,27 +609,27 @@ ewl_tree_row_collapse(Ewl_Tree *tree, void *data, unsigned int row)
unsigned int
ewl_tree_row_expanded_is(Ewl_Tree *tree, void *data, unsigned int row)
{
- Ewl_Tree_Expansions_List *exp;
- unsigned int i;
+ Ewl_Tree_Expansions_List *exp;
+ unsigned int i;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(tree, FALSE);
- DCHECK_PARAM_PTR_RET(data, FALSE);
- DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(tree, FALSE);
+ DCHECK_PARAM_PTR_RET(data, FALSE);
+ DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, FALSE);
- /* no expansions in the tree */
- if (!tree->expansions) DRETURN_INT(FALSE, DLEVEL_STABLE);
+ /* no expansions in the tree */
+ if (!tree->expansions) DRETURN_INT(FALSE, DLEVEL_STABLE);
- exp = ecore_hash_get(tree->expansions, data);
+ exp = ecore_hash_get(tree->expansions, data);
- /* no expansions in this data we're done */
- if (!exp) DRETURN_INT(FALSE, DLEVEL_STABLE);
+ /* no expansions in this data we're done */
+ if (!exp) DRETURN_INT(FALSE, DLEVEL_STABLE);
- /* search for this row in the expansions */
- for (i = 0; i < exp->size && exp->expanded[i] != row; i++)
- ;
+ /* search for this row in the expansions */
+ for (i = 0; i < exp->size && exp->expanded[i] != row; i++)
+ ;
- DRETURN_INT(exp->expanded && exp->expanded[i] == row, DLEVEL_STABLE);
+ DRETURN_INT(exp->expanded && exp->expanded[i] == row, DLEVEL_STABLE);
}
/**
@@ -643,16 +643,16 @@ ewl_tree_row_expanded_is(Ewl_Tree *tree, void *data, unsigned int row)
void
ewl_tree_cb_destroy(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
{
- Ewl_Tree *t;
+ Ewl_Tree *t;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_TREE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_TREE_TYPE);
- t = EWL_TREE(w);
- IF_FREE_HASH(t->expansions);
+ t = EWL_TREE(w);
+ IF_FREE_HASH(t->expansions);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -665,34 +665,34 @@ ewl_tree_cb_destroy(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
*/
void
ewl_tree_cb_configure(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Tree *tree;
+ Ewl_Tree *tree;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_TREE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_TREE_TYPE);
- tree = EWL_TREE(w);
+ tree = EWL_TREE(w);
- if (!tree->headers_visible)
- {
- /* Since the header is invisible we need to tell it its
- * position and its size to arrange correctly */
- ewl_object_x_request(EWL_OBJECT(tree->header), CURRENT_X(w));
- ewl_object_w_request(EWL_OBJECT(tree->header), CURRENT_W(w));
- ewl_paned_arrange(EWL_PANED(tree->header), tree->columns);
- }
+ if (!tree->headers_visible)
+ {
+ /* Since the header is invisible we need to tell it its
+ * position and its size to arrange correctly */
+ ewl_object_x_request(EWL_OBJECT(tree->header), CURRENT_X(w));
+ ewl_object_w_request(EWL_OBJECT(tree->header), CURRENT_W(w));
+ ewl_paned_arrange(EWL_PANED(tree->header), tree->columns);
+ }
- /* if the tree isn't dirty we're done */
- if (!ewl_mvc_dirty_get(EWL_MVC(tree)))
- DRETURN(DLEVEL_STABLE);
+ /* if the tree isn't dirty we're done */
+ if (!ewl_mvc_dirty_get(EWL_MVC(tree)))
+ DRETURN(DLEVEL_STABLE);
- ewl_tree_build_tree(tree);
- ewl_tree_cb_selected_change(EWL_MVC(tree));
- ewl_mvc_dirty_set(EWL_MVC(tree), FALSE);
+ ewl_tree_build_tree(tree);
+ ewl_tree_cb_selected_change(EWL_MVC(tree));
+ ewl_mvc_dirty_set(EWL_MVC(tree), FALSE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -706,496 +706,496 @@ ewl_tree_cb_configure(Ewl_Widget *w, void *ev __UNUSED__,
void
ewl_tree_cb_column_sort(Ewl_Widget *w, void *ev __UNUSED__, void *data)
{
- Ewl_Tree *tree;
- const Ewl_Model *model;
+ Ewl_Tree *tree;
+ const Ewl_Model *model;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- /* XXX This is kind of a nasty way to get the tree ... */
- tree = EWL_TREE(w->parent->parent);
- model = ewl_mvc_model_get(EWL_MVC(tree));
+ /* XXX This is kind of a nasty way to get the tree ... */
+ tree = EWL_TREE(w->parent->parent);
+ model = ewl_mvc_model_get(EWL_MVC(tree));
- /* sanity check */
- if (!model || !model->sort)
- {
- DWARNING("In ewl_tree_cb_column_sort without a sort cb.");
- DRETURN(DLEVEL_STABLE);
- }
+ /* sanity check */
+ if (!model || !model->sort)
+ {
+ DWARNING("In ewl_tree_cb_column_sort without a sort cb.");
+ DRETURN(DLEVEL_STABLE);
+ }
- /* update our sort information and call the sort function, skipping
- * over SORT_NONE */
- tree->sort.column = (unsigned int)data;
- tree->sort.direction = ((tree->sort.direction + 1) % EWL_SORT_DIRECTION_MAX);
- if (!tree->sort.direction) tree->sort.direction ++;
+ /* update our sort information and call the sort function, skipping
+ * over SORT_NONE */
+ tree->sort.column = (unsigned int)data;
+ tree->sort.direction = ((tree->sort.direction + 1) % EWL_SORT_DIRECTION_MAX);
+ if (!tree->sort.direction) tree->sort.direction ++;
- model->sort(ewl_mvc_data_get(EWL_MVC(tree)), tree->sort.column,
- tree->sort.direction);
- ewl_mvc_dirty_set(EWL_MVC(tree), TRUE);
+ model->sort(ewl_mvc_data_get(EWL_MVC(tree)), tree->sort.column,
+ tree->sort.direction);
+ ewl_mvc_dirty_set(EWL_MVC(tree), TRUE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_tree_header_build(Ewl_Tree *tree, Ewl_Container *box,
- const Ewl_Model *model, const Ewl_View *view,
- void *mvc_data, unsigned int column)
-{
- Ewl_Widget *c;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(tree);
- DCHECK_PARAM_PTR(model);
- DCHECK_PARAM_PTR(view);
- DCHECK_PARAM_PTR(box);
- DCHECK_TYPE(tree, EWL_TREE_TYPE);
- DCHECK_TYPE(box, EWL_CONTAINER_TYPE);
-
- if (!tree->headers_visible) DRETURN(DLEVEL_STABLE);
-
- if (!view->header_fetch)
- {
- DWARNING("Missing header_fetch callback.");
- DRETURN(DLEVEL_STABLE);
- }
-
- if (model->header)
- c = view->header_fetch(model->header(mvc_data, column),
- column);
- else
- c = view->header_fetch(NULL, column);
-
- /* XXX is this really a good idea to override the user's flags ? */
- ewl_object_fill_policy_set(EWL_OBJECT(c),
- EWL_FLAG_FILL_HSHRINK | EWL_FLAG_FILL_HFILL);
- ewl_container_child_append(box, c);
- ewl_widget_show(c);
-
- /* display the sort arrow if needed */
- if (model->sortable && model->sortable(mvc_data, column))
- {
- const char *state_str;
-
- ewl_callback_append(EWL_WIDGET(box), EWL_CALLBACK_CLICKED,
- ewl_tree_cb_column_sort,
- (unsigned int *)column);
-
- c = ewl_button_new();
- ewl_container_child_append(box, c);
-
- if ((column == tree->sort.column)
- && (tree->sort.direction == EWL_SORT_DIRECTION_ASCENDING))
- state_str = "ascending";
- else if ((column == tree->sort.column)
- && (tree->sort.direction == EWL_SORT_DIRECTION_DESCENDING))
- state_str = "descending";
- else
- state_str = "default";
-
- ewl_widget_state_set(c, state_str, EWL_STATE_PERSISTENT);
- ewl_object_fill_policy_set(EWL_OBJECT(c), EWL_FLAG_FILL_SHRINK);
- ewl_object_alignment_set(EWL_OBJECT(c), EWL_FLAG_ALIGN_RIGHT);
- ewl_widget_show(c);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ const Ewl_Model *model, const Ewl_View *view,
+ void *mvc_data, unsigned int column)
+{
+ Ewl_Widget *c;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(tree);
+ DCHECK_PARAM_PTR(model);
+ DCHECK_PARAM_PTR(view);
+ DCHECK_PARAM_PTR(box);
+ DCHECK_TYPE(tree, EWL_TREE_TYPE);
+ DCHECK_TYPE(box, EWL_CONTAINER_TYPE);
+
+ if (!tree->headers_visible) DRETURN(DLEVEL_STABLE);
+
+ if (!view->header_fetch)
+ {
+ DWARNING("Missing header_fetch callback.");
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ if (model->header)
+ c = view->header_fetch(model->header(mvc_data, column),
+ column);
+ else
+ c = view->header_fetch(NULL, column);
+
+ /* XXX is this really a good idea to override the user's flags ? */
+ ewl_object_fill_policy_set(EWL_OBJECT(c),
+ EWL_FLAG_FILL_HSHRINK | EWL_FLAG_FILL_HFILL);
+ ewl_container_child_append(box, c);
+ ewl_widget_show(c);
+
+ /* display the sort arrow if needed */
+ if (model->sortable && model->sortable(mvc_data, column))
+ {
+ const char *state_str;
+
+ ewl_callback_append(EWL_WIDGET(box), EWL_CALLBACK_CLICKED,
+ ewl_tree_cb_column_sort,
+ (unsigned int *)column);
+
+ c = ewl_button_new();
+ ewl_container_child_append(box, c);
+
+ if ((column == tree->sort.column)
+ && (tree->sort.direction == EWL_SORT_DIRECTION_ASCENDING))
+ state_str = "ascending";
+ else if ((column == tree->sort.column)
+ && (tree->sort.direction == EWL_SORT_DIRECTION_DESCENDING))
+ state_str = "descending";
+ else
+ state_str = "default";
+
+ ewl_widget_state_set(c, state_str, EWL_STATE_PERSISTENT);
+ ewl_object_fill_policy_set(EWL_OBJECT(c), EWL_FLAG_FILL_SHRINK);
+ ewl_object_alignment_set(EWL_OBJECT(c), EWL_FLAG_ALIGN_RIGHT);
+ ewl_widget_show(c);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_tree_column_build(Ewl_Row *row, const Ewl_Model *model,
- const Ewl_View *view,
- void *mvc_data, unsigned int r,
- unsigned int c, Ewl_Widget *node)
-{
- Ewl_Widget *cell;
- Ewl_Widget *child;
- void *val;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(row);
- DCHECK_PARAM_PTR(model);
- DCHECK_PARAM_PTR(view);
- DCHECK_TYPE(row, EWL_ROW_TYPE);
-
- cell = ewl_cell_new();
- ewl_cell_state_change_cb_add(EWL_CELL(cell));
- ewl_object_fill_policy_set(EWL_OBJECT(cell), EWL_FLAG_FILL_ALL);
- ewl_container_child_append(EWL_CONTAINER(row), cell);
- ewl_callback_append(cell, EWL_CALLBACK_CLICKED,
- ewl_tree_cb_cell_clicked, node);
- ewl_widget_show(cell);
-
- val = model->fetch(mvc_data, r, c);
- if (!val)
- {
- child = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(child), " ");
- }
- else
- child = view->fetch(val, r, c);
-
- ewl_container_child_append(EWL_CONTAINER(cell), child);
- ewl_widget_show(child);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ const Ewl_View *view,
+ void *mvc_data, unsigned int r,
+ unsigned int c, Ewl_Widget *node)
+{
+ Ewl_Widget *cell;
+ Ewl_Widget *child;
+ void *val;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(row);
+ DCHECK_PARAM_PTR(model);
+ DCHECK_PARAM_PTR(view);
+ DCHECK_TYPE(row, EWL_ROW_TYPE);
+
+ cell = ewl_cell_new();
+ ewl_cell_state_change_cb_add(EWL_CELL(cell));
+ ewl_object_fill_policy_set(EWL_OBJECT(cell), EWL_FLAG_FILL_ALL);
+ ewl_container_child_append(EWL_CONTAINER(row), cell);
+ ewl_callback_append(cell, EWL_CALLBACK_CLICKED,
+ ewl_tree_cb_cell_clicked, node);
+ ewl_widget_show(cell);
+
+ val = model->fetch(mvc_data, r, c);
+ if (!val)
+ {
+ child = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(child), " ");
+ }
+ else
+ child = view->fetch(val, r, c);
+
+ ewl_container_child_append(EWL_CONTAINER(cell), child);
+ ewl_widget_show(child);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_tree_build_tree(Ewl_Tree *tree)
{
- void *mvc_data;
- const Ewl_Model *model;
+ void *mvc_data;
+ const Ewl_Model *model;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(tree);
- DCHECK_TYPE(tree, EWL_TREE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(tree);
+ DCHECK_TYPE(tree, EWL_TREE_TYPE);
- mvc_data = ewl_mvc_data_get(EWL_MVC(tree));
- model = ewl_mvc_model_get(EWL_MVC(tree));
- if (!model) DRETURN(DLEVEL_STABLE);
+ mvc_data = ewl_mvc_data_get(EWL_MVC(tree));
+ model = ewl_mvc_model_get(EWL_MVC(tree));
+ if (!model) DRETURN(DLEVEL_STABLE);
- /* setup the headers */
- ewl_tree_headers_build(tree, model, mvc_data);
+ /* setup the headers */
+ ewl_tree_headers_build(tree, model, mvc_data);
- /* setup the content */
- ewl_container_reset(EWL_CONTAINER(tree->rows));
- ewl_tree_build_tree_rows(tree, model,
- ewl_mvc_view_get(EWL_MVC(tree)), mvc_data,
- 0, EWL_CONTAINER(tree->rows), FALSE);
+ /* setup the content */
+ ewl_container_reset(EWL_CONTAINER(tree->rows));
+ ewl_tree_build_tree_rows(tree, model,
+ ewl_mvc_view_get(EWL_MVC(tree)), mvc_data,
+ 0, EWL_CONTAINER(tree->rows), FALSE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_tree_headers_build(Ewl_Tree *tree, const Ewl_Model *model, void *mvc_data)
{
- Ewl_Container *header;
- unsigned int i;
+ Ewl_Container *header;
+ unsigned int i;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(tree);
- DCHECK_TYPE(tree, EWL_TREE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(tree);
+ DCHECK_TYPE(tree, EWL_TREE_TYPE);
- header = EWL_CONTAINER(tree->header);
+ header = EWL_CONTAINER(tree->header);
- ewl_container_child_iterate_begin(header);
- for (i = 0; i < tree->columns; i++)
- {
- Ewl_Widget *h = ewl_container_child_next(header);
+ ewl_container_child_iterate_begin(header);
+ for (i = 0; i < tree->columns; i++)
+ {
+ Ewl_Widget *h = ewl_container_child_next(header);
- ewl_container_reset(EWL_CONTAINER(h));
- /* remove it here since the column may be not sortable
- * anymore */
- ewl_callback_del(h, EWL_CALLBACK_CLICKED,
- ewl_tree_cb_column_sort);
- ewl_tree_header_build(tree, EWL_CONTAINER(h), model,
- ewl_mvc_view_get(EWL_MVC(tree)),
- mvc_data, i);
- }
+ ewl_container_reset(EWL_CONTAINER(h));
+ /* remove it here since the column may be not sortable
+ * anymore */
+ ewl_callback_del(h, EWL_CALLBACK_CLICKED,
+ ewl_tree_cb_column_sort);
+ ewl_tree_header_build(tree, EWL_CONTAINER(h), model,
+ ewl_mvc_view_get(EWL_MVC(tree)),
+ mvc_data, i);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_tree_build_tree_rows(Ewl_Tree *tree, const Ewl_Model *model,
- const Ewl_View *view, void *data, int colour,
- Ewl_Container *parent, int hidden)
-{
- unsigned int i = 0, row_count = 0;
- unsigned int column;
-
- DCHECK_PARAM_PTR(tree);
- DCHECK_TYPE(tree, EWL_TREE_TYPE);
- DCHECK_PARAM_PTR(parent);
- DCHECK_TYPE(parent, EWL_CONTAINER_TYPE);
-
- row_count = model->count(data);
- if (row_count == 0) DRETURN(DLEVEL_STABLE);
-
- while (TRUE)
- {
- Ewl_Widget *row, *node;
-
- node = ewl_tree_node_new();
- EWL_TREE_NODE(node)->tree = EWL_WIDGET(tree);
- EWL_TREE_NODE(node)->row_num = i;
- ewl_mvc_model_set(EWL_MVC(node), model);
- ewl_mvc_data_set(EWL_MVC(node), data);
- ewl_mvc_view_set(EWL_MVC(node), view);
-
- ewl_container_child_append(parent, node);
- if (!hidden) ewl_widget_show(node);
-
- row = ewl_row_new();
- ewl_row_header_set(EWL_ROW(row), EWL_CONTAINER(tree->header));
- ewl_tree_node_row_set(EWL_TREE_NODE(node), EWL_ROW(row));
- ewl_container_child_append(EWL_CONTAINER(node), row);
- ewl_callback_append(row, EWL_CALLBACK_CLICKED,
- ewl_tree_cb_row_clicked, node);
- ewl_widget_show(row);
-
- if (!model->highlight || model->highlight(data, i))
- {
- ewl_callback_append(row, EWL_CALLBACK_MOUSE_IN,
- ewl_tree_cb_row_highlight, NULL);
- ewl_callback_append(row, EWL_CALLBACK_MOUSE_OUT,
- ewl_tree_cb_row_unhighlight, NULL);
- }
-
- if (tree->row_color_alternate)
- {
- if (colour)
- ewl_widget_state_set(row, "odd",
- EWL_STATE_PERSISTENT);
- else
- ewl_widget_state_set(row, "even",
- EWL_STATE_PERSISTENT);
- }
-
- colour = (colour + 1) % 2;
-
- /* do the current branch */
- for (column = 0; column < tree->columns; column++)
- ewl_tree_column_build(EWL_ROW(row), model, view,
- data, i, column, node);
-
- /* check if this is an expansion point */
- if (model->expansion.is && model->expansion.is(data, i))
- {
- int hidden = TRUE;
-
- if (!model->expansion.data)
- {
- DWARNING("In ewl_tree_build_tree_rows, "
- "model expandable but without "
- "expansion_data_fetch cb.");
- DRETURN(DLEVEL_STABLE);
- }
-
- ewl_tree_node_expandable_set(EWL_TREE_NODE(node), TRUE);
-
- if (model->expansion.data &&
- ewl_tree_row_expanded_is(tree, data, i))
- {
- ewl_tree_node_expand(EWL_TREE_NODE(node));
- hidden = FALSE;
- }
- }
- else
- ewl_tree_node_expandable_set(EWL_TREE_NODE(node), FALSE);
-
- i++;
-
- /*
- * Finished the rows at this level? Jump back up a level.
- */
- if (i >= row_count) break;
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ const Ewl_View *view, void *data, int colour,
+ Ewl_Container *parent, int hidden)
+{
+ unsigned int i = 0, row_count = 0;
+ unsigned int column;
+
+ DCHECK_PARAM_PTR(tree);
+ DCHECK_TYPE(tree, EWL_TREE_TYPE);
+ DCHECK_PARAM_PTR(parent);
+ DCHECK_TYPE(parent, EWL_CONTAINER_TYPE);
+
+ row_count = model->count(data);
+ if (row_count == 0) DRETURN(DLEVEL_STABLE);
+
+ while (TRUE)
+ {
+ Ewl_Widget *row, *node;
+
+ node = ewl_tree_node_new();
+ EWL_TREE_NODE(node)->tree = EWL_WIDGET(tree);
+ EWL_TREE_NODE(node)->row_num = i;
+ ewl_mvc_model_set(EWL_MVC(node), model);
+ ewl_mvc_data_set(EWL_MVC(node), data);
+ ewl_mvc_view_set(EWL_MVC(node), view);
+
+ ewl_container_child_append(parent, node);
+ if (!hidden) ewl_widget_show(node);
+
+ row = ewl_row_new();
+ ewl_row_header_set(EWL_ROW(row), EWL_CONTAINER(tree->header));
+ ewl_tree_node_row_set(EWL_TREE_NODE(node), EWL_ROW(row));
+ ewl_container_child_append(EWL_CONTAINER(node), row);
+ ewl_callback_append(row, EWL_CALLBACK_CLICKED,
+ ewl_tree_cb_row_clicked, node);
+ ewl_widget_show(row);
+
+ if (!model->highlight || model->highlight(data, i))
+ {
+ ewl_callback_append(row, EWL_CALLBACK_MOUSE_IN,
+ ewl_tree_cb_row_highlight, NULL);
+ ewl_callback_append(row, EWL_CALLBACK_MOUSE_OUT,
+ ewl_tree_cb_row_unhighlight, NULL);
+ }
+
+ if (tree->row_color_alternate)
+ {
+ if (colour)
+ ewl_widget_state_set(row, "odd",
+ EWL_STATE_PERSISTENT);
+ else
+ ewl_widget_state_set(row, "even",
+ EWL_STATE_PERSISTENT);
+ }
+
+ colour = (colour + 1) % 2;
+
+ /* do the current branch */
+ for (column = 0; column < tree->columns; column++)
+ ewl_tree_column_build(EWL_ROW(row), model, view,
+ data, i, column, node);
+
+ /* check if this is an expansion point */
+ if (model->expansion.is && model->expansion.is(data, i))
+ {
+ int hidden = TRUE;
+
+ if (!model->expansion.data)
+ {
+ DWARNING("In ewl_tree_build_tree_rows, "
+ "model expandable but without "
+ "expansion_data_fetch cb.");
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ ewl_tree_node_expandable_set(EWL_TREE_NODE(node), TRUE);
+
+ if (model->expansion.data &&
+ ewl_tree_row_expanded_is(tree, data, i))
+ {
+ ewl_tree_node_expand(EWL_TREE_NODE(node));
+ hidden = FALSE;
+ }
+ }
+ else
+ ewl_tree_node_expandable_set(EWL_TREE_NODE(node), FALSE);
+
+ i++;
+
+ /*
+ * Finished the rows at this level? Jump back up a level.
+ */
+ if (i >= row_count) break;
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_tree_cb_header_changed(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Tree *tree;
+ Ewl_Tree *tree;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_TREE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_TREE_TYPE);
- tree = data;
- ewl_widget_configure(EWL_WIDGET(tree->rows));
+ tree = data;
+ ewl_widget_configure(EWL_WIDGET(tree->rows));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_tree_cb_row_clicked(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Tree *tree;
- Ewl_Tree_Node *node;
+ Ewl_Tree *tree;
+ Ewl_Tree_Node *node;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_TREE_NODE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_TREE_NODE_TYPE);
- node = data;
- tree = EWL_TREE(node->tree);
- if (tree->type != EWL_TREE_SELECTION_TYPE_ROW)
- DRETURN(DLEVEL_STABLE);
+ node = data;
+ tree = EWL_TREE(node->tree);
+ if (tree->type != EWL_TREE_SELECTION_TYPE_ROW)
+ DRETURN(DLEVEL_STABLE);
- ewl_mvc_handle_click(EWL_MVC(tree), ewl_mvc_model_get(EWL_MVC(node)),
- ewl_mvc_data_get(EWL_MVC(node)),
- node->row_num, 0);
+ ewl_mvc_handle_click(EWL_MVC(tree), ewl_mvc_model_get(EWL_MVC(node)),
+ ewl_mvc_data_get(EWL_MVC(node)),
+ node->row_num, 0);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_tree_cb_row_highlight(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_ROW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_ROW_TYPE);
- ewl_widget_state_set(w, "highlight,on", EWL_STATE_TRANSIENT);
+ ewl_widget_state_set(w, "highlight,on", EWL_STATE_TRANSIENT);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_tree_cb_row_unhighlight(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_ROW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_ROW_TYPE);
- ewl_widget_state_set(w, "highlight,off", EWL_STATE_TRANSIENT);
+ ewl_widget_state_set(w, "highlight,off", EWL_STATE_TRANSIENT);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_tree_cb_cell_clicked(Ewl_Widget *w, void *ev __UNUSED__, void *data)
{
- Ewl_Row *row;
- Ewl_Tree *tree;
- Ewl_Tree_Node *node;
- int column;
+ Ewl_Row *row;
+ Ewl_Tree *tree;
+ Ewl_Tree_Node *node;
+ int column;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- DCHECK_TYPE(data, EWL_TREE_NODE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DCHECK_TYPE(data, EWL_TREE_NODE_TYPE);
- row = EWL_ROW(w->parent);
- node = EWL_TREE_NODE(data);
- tree = EWL_TREE(node->tree);
- if (tree->type != EWL_TREE_SELECTION_TYPE_CELL)
- DRETURN(DLEVEL_STABLE);
+ row = EWL_ROW(w->parent);
+ node = EWL_TREE_NODE(data);
+ tree = EWL_TREE(node->tree);
+ if (tree->type != EWL_TREE_SELECTION_TYPE_CELL)
+ DRETURN(DLEVEL_STABLE);
- column = ewl_container_child_index_get(EWL_CONTAINER(row), w);
- if (column < 0) DRETURN(DLEVEL_STABLE);
+ column = ewl_container_child_index_get(EWL_CONTAINER(row), w);
+ if (column < 0) DRETURN(DLEVEL_STABLE);
- ewl_mvc_handle_click(EWL_MVC(node->tree),
- ewl_mvc_model_get(EWL_MVC(node)),
- ewl_mvc_data_get(EWL_MVC(node)),
- node->row_num, column);
+ ewl_mvc_handle_click(EWL_MVC(node->tree),
+ ewl_mvc_model_get(EWL_MVC(node)),
+ ewl_mvc_data_get(EWL_MVC(node)),
+ node->row_num, column);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_tree_cb_selected_change(Ewl_MVC *mvc)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(mvc);
- DCHECK_TYPE(mvc, EWL_MVC_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(mvc);
+ DCHECK_TYPE(mvc, EWL_MVC_TYPE);
- ewl_mvc_highlight(mvc, EWL_CONTAINER(EWL_TREE(mvc)->rows),
- ewl_tree_widget_at);
+ ewl_mvc_highlight(mvc, EWL_CONTAINER(EWL_TREE(mvc)->rows),
+ ewl_tree_widget_at);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static Ewl_Widget *
ewl_tree_widget_at(Ewl_MVC *mvc, void *data, unsigned int row,
- unsigned int column)
+ unsigned int column)
{
- Ewl_Widget *r, *w;
- Ewl_Container *c;
- Ewl_Tree *tree;
+ Ewl_Widget *r, *w;
+ Ewl_Container *c;
+ Ewl_Tree *tree;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(mvc, NULL);
- DCHECK_PARAM_PTR_RET(data, NULL);
- DCHECK_TYPE_RET(mvc, EWL_TREE_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(mvc, NULL);
+ DCHECK_PARAM_PTR_RET(data, NULL);
+ DCHECK_TYPE_RET(mvc, EWL_TREE_TYPE, NULL);
- tree = EWL_TREE(mvc);
+ tree = EWL_TREE(mvc);
- /* get the container that holds the wished row */
- if (ewl_mvc_data_get(mvc) == data)
- c = EWL_CONTAINER(tree->rows);
- else
- {
- Ewl_Tree_Expansions_List *exp;
+ /* get the container that holds the wished row */
+ if (ewl_mvc_data_get(mvc) == data)
+ c = EWL_CONTAINER(tree->rows);
+ else
+ {
+ Ewl_Tree_Expansions_List *exp;
- exp = ecore_hash_get(tree->expansions, data);
- if (!exp)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ exp = ecore_hash_get(tree->expansions, data);
+ if (!exp)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- c = exp->c;
- }
+ c = exp->c;
+ }
- /* find the row in the container */
- r = ewl_container_child_get(c, row);
- r = EWL_WIDGET(EWL_TREE_NODE(r)->row);
+ /* find the row in the container */
+ r = ewl_container_child_get(c, row);
+ r = EWL_WIDGET(EWL_TREE_NODE(r)->row);
- if (tree->type == EWL_TREE_SELECTION_TYPE_ROW)
- w = r;
- else
- {
- /* infact our row is a node so we have to get the row
- * to search for the right container */
- w = ewl_container_child_get(EWL_CONTAINER(r), column);
- }
+ if (tree->type == EWL_TREE_SELECTION_TYPE_ROW)
+ w = r;
+ else
+ {
+ /* infact our row is a node so we have to get the row
+ * to search for the right container */
+ w = ewl_container_child_get(EWL_CONTAINER(r), column);
+ }
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
static void
ewl_tree_expansions_hash_create(Ewl_Tree *tree)
{
- Ewl_Tree_Expansions_List *exp;
+ Ewl_Tree_Expansions_List *exp;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(tree);
- DCHECK_TYPE(tree, EWL_TREE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(tree);
+ DCHECK_TYPE(tree, EWL_TREE_TYPE);
- if (tree->expansions)
- DRETURN(DLEVEL_STABLE);
+ if (tree->expansions)
+ DRETURN(DLEVEL_STABLE);
- tree->expansions = ecore_hash_new(NULL, NULL);
- ecore_hash_free_value_cb_set(tree->expansions,
- ECORE_FREE_CB(ewl_tree_expansions_list_destroy));
+ tree->expansions = ecore_hash_new(NULL, NULL);
+ ecore_hash_free_value_cb_set(tree->expansions,
+ ECORE_FREE_CB(ewl_tree_expansions_list_destroy));
- exp = ewl_tree_expansions_list_new();
- exp->c = EWL_CONTAINER(tree->rows);
- ecore_hash_set(tree->expansions, ewl_mvc_data_get(EWL_MVC(tree)), exp);
+ exp = ewl_tree_expansions_list_new();
+ exp->c = EWL_CONTAINER(tree->rows);
+ ecore_hash_set(tree->expansions, ewl_mvc_data_get(EWL_MVC(tree)), exp);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static Ewl_Tree_Expansions_List *
ewl_tree_expansions_list_new(void)
{
- Ewl_Tree_Expansions_List *el;
+ Ewl_Tree_Expansions_List *el;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- el = NEW(Ewl_Tree_Expansions_List, 1);
- if (!el)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ el = NEW(Ewl_Tree_Expansions_List, 1);
+ if (!el)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- DRETURN_PTR(el, DLEVEL_STABLE);
+ DRETURN_PTR(el, DLEVEL_STABLE);
}
static void
ewl_tree_expansions_list_destroy(Ewl_Tree_Expansions_List *el)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(el);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(el);
- IF_FREE(el->expanded);
- FREE(el);
+ IF_FREE(el->expanded);
+ FREE(el);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/*
@@ -1204,489 +1204,489 @@ ewl_tree_expansions_list_destroy(Ewl_Tree_Expansions_List *el)
Ewl_Widget *
ewl_tree_node_new(void)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- w = NEW(Ewl_Tree_Node, 1);
- if (!w)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ w = NEW(Ewl_Tree_Node, 1);
+ if (!w)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_tree_node_init(EWL_TREE_NODE(w)))
- {
- ewl_widget_destroy(w);
- w = NULL;
- }
+ if (!ewl_tree_node_init(EWL_TREE_NODE(w)))
+ {
+ ewl_widget_destroy(w);
+ w = NULL;
+ }
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
int
ewl_tree_node_init(Ewl_Tree_Node *node)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(node, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(node, FALSE);
- if (!ewl_mvc_init(EWL_MVC(node)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_mvc_init(EWL_MVC(node)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_appearance_set(EWL_WIDGET(node), EWL_TREE_NODE_TYPE);
- ewl_widget_inherit(EWL_WIDGET(node), EWL_TREE_NODE_TYPE);
+ ewl_widget_appearance_set(EWL_WIDGET(node), EWL_TREE_NODE_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(node), EWL_TREE_NODE_TYPE);
- ewl_container_show_notify_set(EWL_CONTAINER(node),
- ewl_tree_cb_node_child_show);
- ewl_container_hide_notify_set(EWL_CONTAINER(node),
- ewl_tree_cb_node_child_hide);
- ewl_container_resize_notify_set(EWL_CONTAINER(node),
- ewl_tree_cb_node_resize);
- ewl_container_add_notify_set(EWL_CONTAINER(node),
- ewl_tree_cb_node_child_add);
- ewl_container_remove_notify_set(EWL_CONTAINER(node),
- ewl_tree_cb_node_child_del);
+ ewl_container_show_notify_set(EWL_CONTAINER(node),
+ ewl_tree_cb_node_child_show);
+ ewl_container_hide_notify_set(EWL_CONTAINER(node),
+ ewl_tree_cb_node_child_hide);
+ ewl_container_resize_notify_set(EWL_CONTAINER(node),
+ ewl_tree_cb_node_resize);
+ ewl_container_add_notify_set(EWL_CONTAINER(node),
+ ewl_tree_cb_node_child_add);
+ ewl_container_remove_notify_set(EWL_CONTAINER(node),
+ ewl_tree_cb_node_child_del);
- /* we don't want the mvc to unref our data since the data is owned
- * by the tree or the parent node */
- ewl_callback_del(EWL_WIDGET(node), EWL_CALLBACK_DESTROY,
- ewl_mvc_cb_data_unref);
+ /* we don't want the mvc to unref our data since the data is owned
+ * by the tree or the parent node */
+ ewl_callback_del(EWL_WIDGET(node), EWL_CALLBACK_DESTROY,
+ ewl_mvc_cb_data_unref);
- ewl_object_fill_policy_set(EWL_OBJECT(node),
- EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_HSHRINK);
+ ewl_object_fill_policy_set(EWL_OBJECT(node),
+ EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_HSHRINK);
- ewl_callback_del(EWL_WIDGET(node), EWL_CALLBACK_CONFIGURE,
- ewl_box_cb_configure);
- ewl_callback_append(EWL_WIDGET(node), EWL_CALLBACK_CONFIGURE,
- ewl_tree_cb_node_configure, NULL);
+ ewl_callback_del(EWL_WIDGET(node), EWL_CALLBACK_CONFIGURE,
+ ewl_box_cb_configure);
+ ewl_callback_append(EWL_WIDGET(node), EWL_CALLBACK_CONFIGURE,
+ ewl_tree_cb_node_configure, NULL);
- node->expanded = EWL_TREE_NODE_COLLAPSED;
- ewl_widget_focusable_set(EWL_WIDGET(node), FALSE);
+ node->expanded = EWL_TREE_NODE_COLLAPSED;
+ ewl_widget_focusable_set(EWL_WIDGET(node), FALSE);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
void
ewl_tree_node_expandable_set(Ewl_Tree_Node *node, unsigned int expandable)
{
- const Ewl_Model *model;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(node);
-
- model = ewl_mvc_model_get(EWL_MVC(node));
- /* we only create the handle if it doesn't exist and the model has
- * a function to query for expandability */
- if (!node->handle && model->expansion.is)
- {
- node->handle = ewl_expansion_new();
- ewl_container_child_prepend(EWL_CONTAINER(node), node->handle);
- ewl_widget_internal_set(EWL_WIDGET(node->handle), TRUE);
- ewl_widget_show(node->handle);
- }
-
- if (!node->handle)
- DRETURN(DLEVEL_STABLE);
-
- if (expandable)
- {
- ewl_callback_append(node->handle, EWL_CALLBACK_VALUE_CHANGED,
- ewl_tree_cb_node_toggle, node);
- ewl_callback_append(EWL_WIDGET(node), EWL_CALLBACK_DESTROY,
- ewl_tree_cb_node_data_unref, NULL);
- ewl_widget_enable(node->handle);
- ewl_expansion_expandable_set(EWL_EXPANSION(node->handle), TRUE);
- }
- else
- {
- ewl_callback_del(node->handle, EWL_CALLBACK_VALUE_CHANGED,
- ewl_tree_cb_node_toggle);
- ewl_callback_del(EWL_WIDGET(node), EWL_CALLBACK_DESTROY,
- ewl_tree_cb_node_data_unref);
- ewl_widget_disable(node->handle);
- ewl_expansion_expandable_set(EWL_EXPANSION(node->handle), FALSE);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ const Ewl_Model *model;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(node);
+
+ model = ewl_mvc_model_get(EWL_MVC(node));
+ /* we only create the handle if it doesn't exist and the model has
+ * a function to query for expandability */
+ if (!node->handle && model->expansion.is)
+ {
+ node->handle = ewl_expansion_new();
+ ewl_container_child_prepend(EWL_CONTAINER(node), node->handle);
+ ewl_widget_internal_set(EWL_WIDGET(node->handle), TRUE);
+ ewl_widget_show(node->handle);
+ }
+
+ if (!node->handle)
+ DRETURN(DLEVEL_STABLE);
+
+ if (expandable)
+ {
+ ewl_callback_append(node->handle, EWL_CALLBACK_VALUE_CHANGED,
+ ewl_tree_cb_node_toggle, node);
+ ewl_callback_append(EWL_WIDGET(node), EWL_CALLBACK_DESTROY,
+ ewl_tree_cb_node_data_unref, NULL);
+ ewl_widget_enable(node->handle);
+ ewl_expansion_expandable_set(EWL_EXPANSION(node->handle), TRUE);
+ }
+ else
+ {
+ ewl_callback_del(node->handle, EWL_CALLBACK_VALUE_CHANGED,
+ ewl_tree_cb_node_toggle);
+ ewl_callback_del(EWL_WIDGET(node), EWL_CALLBACK_DESTROY,
+ ewl_tree_cb_node_data_unref);
+ ewl_widget_disable(node->handle);
+ ewl_expansion_expandable_set(EWL_EXPANSION(node->handle), FALSE);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
unsigned int
ewl_tree_node_expandable_get(Ewl_Tree_Node *node)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(node, FALSE);
- DCHECK_TYPE_RET(node, EWL_TREE_NODE_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(node, FALSE);
+ DCHECK_TYPE_RET(node, EWL_TREE_NODE_TYPE, FALSE);
- DRETURN_INT((node->handle) &&
- ewl_expansion_is_expandable(EWL_EXPANSION(node->handle)), DLEVEL_STABLE);
+ DRETURN_INT((node->handle) &&
+ ewl_expansion_is_expandable(EWL_EXPANSION(node->handle)), DLEVEL_STABLE);
}
void
ewl_tree_node_expand(Ewl_Tree_Node *node)
{
- Ewl_Widget *child;
- Ecore_List *tmp;
- const Ewl_Model *model;
- void *data;
+ Ewl_Widget *child;
+ Ecore_List *tmp;
+ const Ewl_Model *model;
+ void *data;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(node);
- DCHECK_TYPE(node, EWL_TREE_NODE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(node);
+ DCHECK_TYPE(node, EWL_TREE_NODE_TYPE);
- if (node->expanded == EWL_TREE_NODE_EXPANDED)
- DRETURN(DLEVEL_STABLE);
+ if (node->expanded == EWL_TREE_NODE_EXPANDED)
+ DRETURN(DLEVEL_STABLE);
- /*
- * Queue the parent tree for configure, this handles the issue of
- * redrawing the alternating colors on expand and doing it early
- * avoids duplicate or long list walks for queueing child widgets.
- */
- ewl_widget_configure(node->tree);
+ /*
+ * Queue the parent tree for configure, this handles the issue of
+ * redrawing the alternating colors on expand and doing it early
+ * avoids duplicate or long list walks for queueing child widgets.
+ */
+ ewl_widget_configure(node->tree);
- /* This is needed as in the child_show cb we will case a list walk.
- * We need this till the lists get iterators */
- tmp = ecore_list_new();
+ /* This is needed as in the child_show cb we will case a list walk.
+ * We need this till the lists get iterators */
+ tmp = ecore_list_new();
- ecore_dlist_first_goto(EWL_CONTAINER(node)->children);
- while ((child = ecore_dlist_next(EWL_CONTAINER(node)->children)))
- {
- if ((child != node->handle) && (child != EWL_WIDGET(node->row))
- && !UNMANAGED(child))
- ecore_list_append(tmp, child);
- }
+ ecore_dlist_first_goto(EWL_CONTAINER(node)->children);
+ while ((child = ecore_dlist_next(EWL_CONTAINER(node)->children)))
+ {
+ if ((child != node->handle) && (child != EWL_WIDGET(node->row))
+ && !UNMANAGED(child))
+ ecore_list_append(tmp, child);
+ }
- while ((child = ecore_list_first_remove(tmp)))
- ewl_widget_show(child);
+ while ((child = ecore_list_first_remove(tmp)))
+ ewl_widget_show(child);
- IF_FREE_LIST(tmp);
+ IF_FREE_LIST(tmp);
- model = ewl_mvc_model_get(EWL_MVC(node));
- data = ewl_mvc_data_get(EWL_MVC(node));
- if (model->expansion.data && !node->built_children)
- {
- const Ewl_View *view, *tmp_view = NULL;
- const Ewl_Model *tmp_model;
+ model = ewl_mvc_model_get(EWL_MVC(node));
+ data = ewl_mvc_data_get(EWL_MVC(node));
+ if (model->expansion.data && !node->built_children)
+ {
+ const Ewl_View *view, *tmp_view = NULL;
+ const Ewl_Model *tmp_model;
- if (!node->expansion.data)
- {
- Ewl_Tree_Expansions_List *exp;
+ if (!node->expansion.data)
+ {
+ Ewl_Tree_Expansions_List *exp;
- node->expansion.data =
- model->expansion.data(data, node->row_num);
+ node->expansion.data =
+ model->expansion.data(data, node->row_num);
- /* Put the node into the expansions hash */
- exp = ewl_tree_expansions_list_new();
- exp->c = EWL_CONTAINER(node);
- ecore_hash_set(EWL_TREE(node->tree)->expansions,
- node->expansion.data, exp);
- }
+ /* Put the node into the expansions hash */
+ exp = ewl_tree_expansions_list_new();
+ exp->c = EWL_CONTAINER(node);
+ ecore_hash_set(EWL_TREE(node->tree)->expansions,
+ node->expansion.data, exp);
+ }
- if (!node->expansion.model && model->expansion.model)
- node->expansion.model =
- model->expansion.model(data, node->row_num);
+ if (!node->expansion.model && model->expansion.model)
+ node->expansion.model =
+ model->expansion.model(data, node->row_num);
- /* We only save the model reference here to unref it on destroy.
- * We don't need to save the parent model to unref */
- if (!node->expansion.model) tmp_model = model;
- else tmp_model = node->expansion.model;
+ /* We only save the model reference here to unref it on destroy.
+ * We don't need to save the parent model to unref */
+ if (!node->expansion.model) tmp_model = model;
+ else tmp_model = node->expansion.model;
- view = ewl_mvc_view_get(EWL_MVC(node));
- if (view->expansion)
- tmp_view = view->expansion(data, node->row_num);
+ view = ewl_mvc_view_get(EWL_MVC(node));
+ if (view->expansion)
+ tmp_view = view->expansion(data, node->row_num);
- if (!tmp_view) tmp_view = view;
+ if (!tmp_view) tmp_view = view;
- ewl_tree_build_tree_rows(EWL_TREE(node->tree), tmp_model,
- tmp_view, node->expansion.data,
- 0, EWL_CONTAINER(node), FALSE);
- node->built_children = TRUE;
- }
+ ewl_tree_build_tree_rows(EWL_TREE(node->tree), tmp_model,
+ tmp_view, node->expansion.data,
+ 0, EWL_CONTAINER(node), FALSE);
+ node->built_children = TRUE;
+ }
- node->expanded = EWL_TREE_NODE_EXPANDED;
- ewl_check_checked_set(EWL_CHECK(node->handle), TRUE);
+ node->expanded = EWL_TREE_NODE_EXPANDED;
+ ewl_check_checked_set(EWL_CHECK(node->handle), TRUE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
void
ewl_tree_node_collapse(Ewl_Tree_Node *node)
{
- Ewl_Widget *child;
- Ecore_List *tmp;
+ Ewl_Widget *child;
+ Ecore_List *tmp;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- if (node->expanded == EWL_TREE_NODE_COLLAPSED)
- DRETURN(DLEVEL_STABLE);
+ if (node->expanded == EWL_TREE_NODE_COLLAPSED)
+ DRETURN(DLEVEL_STABLE);
- /*
- * Queue the parent tree for configure, this handles the issue of
- * redrawing the alternating colors on expand and doing it early
- * avoids duplicate or long list walks for queueing child widgets.
- */
- ewl_widget_configure(node->tree);
+ /*
+ * Queue the parent tree for configure, this handles the issue of
+ * redrawing the alternating colors on expand and doing it early
+ * avoids duplicate or long list walks for queueing child widgets.
+ */
+ ewl_widget_configure(node->tree);
- /* This is needed becase in our child_hide callback we will cause a
- * list iteration. Until we get iterators we need this */
- tmp = ecore_list_new();
+ /* This is needed becase in our child_hide callback we will cause a
+ * list iteration. Until we get iterators we need this */
+ tmp = ecore_list_new();
- ecore_dlist_first_goto(EWL_CONTAINER(node)->children);
- while ((child = ecore_dlist_next(EWL_CONTAINER(node)->children)))
- {
- if ((child != node->handle) && (child != EWL_WIDGET(node->row))
- && !UNMANAGED(child))
- ecore_list_append(tmp, child);
- }
+ ecore_dlist_first_goto(EWL_CONTAINER(node)->children);
+ while ((child = ecore_dlist_next(EWL_CONTAINER(node)->children)))
+ {
+ if ((child != node->handle) && (child != EWL_WIDGET(node->row))
+ && !UNMANAGED(child))
+ ecore_list_append(tmp, child);
+ }
- while ((child = ecore_list_first_remove(tmp)))
- ewl_widget_hide(child);
+ while ((child = ecore_list_first_remove(tmp)))
+ ewl_widget_hide(child);
- IF_FREE_LIST(tmp);
+ IF_FREE_LIST(tmp);
- node->expanded = EWL_TREE_NODE_COLLAPSED;
- ewl_check_checked_set(EWL_CHECK(node->handle), FALSE);
+ node->expanded = EWL_TREE_NODE_COLLAPSED;
+ ewl_check_checked_set(EWL_CHECK(node->handle), FALSE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
unsigned int
ewl_tree_node_expanded_is(Ewl_Tree_Node *node)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(node, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(node, FALSE);
- DRETURN_INT((node->expanded == EWL_TREE_NODE_EXPANDED), DLEVEL_STABLE);
+ DRETURN_INT((node->expanded == EWL_TREE_NODE_EXPANDED), DLEVEL_STABLE);
}
void
ewl_tree_node_row_set(Ewl_Tree_Node *node, Ewl_Row *row)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(node);
- DCHECK_PARAM_PTR(row);
- DCHECK_TYPE(node, EWL_TREE_NODE_TYPE);
- DCHECK_TYPE(row, EWL_ROW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(node);
+ DCHECK_PARAM_PTR(row);
+ DCHECK_TYPE(node, EWL_TREE_NODE_TYPE);
+ DCHECK_TYPE(row, EWL_ROW_TYPE);
- node->row = row;
- ewl_widget_internal_set(EWL_WIDGET(row), TRUE);
+ node->row = row;
+ ewl_widget_internal_set(EWL_WIDGET(row), TRUE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
void
ewl_tree_cb_node_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
-{
- Ewl_Tree_Node *node;
- Ewl_Container *c;
- Ewl_Object *child;
- int x, y, hw = 0;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_TREE_NODE_TYPE);
-
- node = EWL_TREE_NODE(w);
- if (!node->tree) DRETURN(DLEVEL_STABLE);
-
- c = EWL_CONTAINER(w);
- if (!c->children) DRETURN(DLEVEL_STABLE);
-
- x = CURRENT_X(w);
- y = CURRENT_Y(w);
-
- if (node->handle)
- {
- ewl_object_geometry_request(EWL_OBJECT(node->handle),
- CURRENT_X(w), CURRENT_Y(w), CURRENT_W(w),
- CURRENT_H(w));
- hw = ewl_object_current_w_get(EWL_OBJECT(node->handle));
- x += hw;
- }
-
- /*
- * All subsequent children are lower nodes and rows.
- */
- ecore_dlist_first_goto(c->children);
- while ((child = ecore_dlist_next(c->children)))
- {
- if (VISIBLE(child) && EWL_WIDGET(child) != node->handle
- && !UNMANAGED(child))
- {
- ewl_object_geometry_request(child, x, y, CURRENT_W(w) - hw,
- ewl_object_preferred_h_get(child));
- y += ewl_object_current_h_get(child);
- }
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ void *user_data __UNUSED__)
+{
+ Ewl_Tree_Node *node;
+ Ewl_Container *c;
+ Ewl_Object *child;
+ int x, y, hw = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_TREE_NODE_TYPE);
+
+ node = EWL_TREE_NODE(w);
+ if (!node->tree) DRETURN(DLEVEL_STABLE);
+
+ c = EWL_CONTAINER(w);
+ if (!c->children) DRETURN(DLEVEL_STABLE);
+
+ x = CURRENT_X(w);
+ y = CURRENT_Y(w);
+
+ if (node->handle)
+ {
+ ewl_object_geometry_request(EWL_OBJECT(node->handle),
+ CURRENT_X(w), CURRENT_Y(w), CURRENT_W(w),
+ CURRENT_H(w));
+ hw = ewl_object_current_w_get(EWL_OBJECT(node->handle));
+ x += hw;
+ }
+
+ /*
+ * All subsequent children are lower nodes and rows.
+ */
+ ecore_dlist_first_goto(c->children);
+ while ((child = ecore_dlist_next(c->children)))
+ {
+ if (VISIBLE(child) && EWL_WIDGET(child) != node->handle
+ && !UNMANAGED(child))
+ {
+ ewl_object_geometry_request(child, x, y, CURRENT_W(w) - hw,
+ ewl_object_preferred_h_get(child));
+ y += ewl_object_current_h_get(child);
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
void
ewl_tree_cb_node_data_unref(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Tree_Node *node;
- const Ewl_Model *model;
+ Ewl_Tree_Node *node;
+ const Ewl_Model *model;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_TREE_NODE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_TREE_NODE_TYPE);
- node = EWL_TREE_NODE(w);
+ node = EWL_TREE_NODE(w);
- if (!node->expansion.data)
- DRETURN(DLEVEL_STABLE);
+ if (!node->expansion.data)
+ DRETURN(DLEVEL_STABLE);
- if (node->expansion.model)
- model = node->expansion.model;
- else
- model = ewl_mvc_model_get(EWL_MVC(w));
+ if (node->expansion.model)
+ model = node->expansion.model;
+ else
+ model = ewl_mvc_model_get(EWL_MVC(w));
- if (model->unref)
- model->unref(node->expansion.data);
+ if (model->unref)
+ model->unref(node->expansion.data);
- node->expansion.data = NULL;
+ node->expansion.data = NULL;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
void
ewl_tree_cb_node_toggle(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Tree_Node *node;
- void *parent_data;
+ Ewl_Tree_Node *node;
+ void *parent_data;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(data);
- DCHECK_TYPE(data, EWL_TREE_NODE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(data);
+ DCHECK_TYPE(data, EWL_TREE_NODE_TYPE);
- node = EWL_TREE_NODE(data);
- parent_data = ewl_mvc_data_get(EWL_MVC(node));
+ node = EWL_TREE_NODE(data);
+ parent_data = ewl_mvc_data_get(EWL_MVC(node));
- if (!ewl_tree_node_expandable_get(node))
- DRETURN(DLEVEL_STABLE);
+ if (!ewl_tree_node_expandable_get(node))
+ DRETURN(DLEVEL_STABLE);
- if (ewl_tree_node_expanded_is(node))
- ewl_tree_row_collapse(EWL_TREE(node->tree), parent_data,
- node->row_num);
- else
- ewl_tree_row_expand(EWL_TREE(node->tree), parent_data,
- node->row_num);
+ if (ewl_tree_node_expanded_is(node))
+ ewl_tree_row_collapse(EWL_TREE(node->tree), parent_data,
+ node->row_num);
+ else
+ ewl_tree_row_expand(EWL_TREE(node->tree), parent_data,
+ node->row_num);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
void
ewl_tree_cb_node_child_show(Ewl_Container *c, Ewl_Widget *w __UNUSED__)
{
- Ewl_Tree_Node *node;
+ Ewl_Tree_Node *node;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_TREE_NODE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_TREE_NODE_TYPE);
- node = EWL_TREE_NODE(c);
- if (node->handle && node->expanded) {
- ewl_container_sum_prefer(c, EWL_ORIENTATION_VERTICAL);
- if (REALIZED(node->handle) && VISIBLE(node->handle))
- ewl_object_preferred_inner_h_set(EWL_OBJECT(c),
- PREFERRED_H(c) -
- ewl_object_preferred_h_get(EWL_OBJECT(node->handle)));
- }
- else
- ewl_object_preferred_inner_h_set(EWL_OBJECT(c),
- ewl_object_preferred_h_get(EWL_OBJECT(node->row)));
+ node = EWL_TREE_NODE(c);
+ if (node->handle && node->expanded) {
+ ewl_container_sum_prefer(c, EWL_ORIENTATION_VERTICAL);
+ if (REALIZED(node->handle) && VISIBLE(node->handle))
+ ewl_object_preferred_inner_h_set(EWL_OBJECT(c),
+ PREFERRED_H(c) -
+ ewl_object_preferred_h_get(EWL_OBJECT(node->handle)));
+ }
+ else
+ ewl_object_preferred_inner_h_set(EWL_OBJECT(c),
+ ewl_object_preferred_h_get(EWL_OBJECT(node->row)));
- ewl_container_largest_prefer(c, EWL_ORIENTATION_HORIZONTAL);
- if (node->handle && REALIZED(node->handle) && VISIBLE(node->handle))
- ewl_object_preferred_inner_w_set(EWL_OBJECT(c), PREFERRED_W(c) +
- ewl_object_preferred_w_get(EWL_OBJECT(node->handle)));
+ ewl_container_largest_prefer(c, EWL_ORIENTATION_HORIZONTAL);
+ if (node->handle && REALIZED(node->handle) && VISIBLE(node->handle))
+ ewl_object_preferred_inner_w_set(EWL_OBJECT(c), PREFERRED_W(c) +
+ ewl_object_preferred_w_get(EWL_OBJECT(node->handle)));
- if (!node->expanded && node->handle)
- ewl_widget_hide(node->handle);
+ if (!node->expanded && node->handle)
+ ewl_widget_hide(node->handle);
- ewl_widget_configure(node->tree);
+ ewl_widget_configure(node->tree);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
void
ewl_tree_cb_node_child_hide(Ewl_Container *c, Ewl_Widget *w)
{
- int width;
- Ewl_Tree_Node *node;
+ int width;
+ Ewl_Tree_Node *node;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_TREE_NODE_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_TREE_NODE_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- node = EWL_TREE_NODE(c);
- if (w == node->handle)
- DRETURN(DLEVEL_STABLE);
+ node = EWL_TREE_NODE(c);
+ if (w == node->handle)
+ DRETURN(DLEVEL_STABLE);
- if (ecore_dlist_count(c->children) < 3)
- {
- if (node->handle && VISIBLE(node->handle))
- ewl_widget_hide(node->handle);
- }
+ if (ecore_dlist_count(c->children) < 3)
+ {
+ if (node->handle && VISIBLE(node->handle))
+ ewl_widget_hide(node->handle);
+ }
- ewl_object_preferred_inner_h_set(EWL_OBJECT(c),
- PREFERRED_H(c) - ewl_object_preferred_h_get(EWL_OBJECT(w)));
+ ewl_object_preferred_inner_h_set(EWL_OBJECT(c),
+ PREFERRED_H(c) - ewl_object_preferred_h_get(EWL_OBJECT(w)));
- width = ewl_object_preferred_w_get(EWL_OBJECT(w));
- if (PREFERRED_W(c) >= width)
- ewl_container_largest_prefer(c, EWL_ORIENTATION_HORIZONTAL);
+ width = ewl_object_preferred_w_get(EWL_OBJECT(w));
+ if (PREFERRED_W(c) >= width)
+ ewl_container_largest_prefer(c, EWL_ORIENTATION_HORIZONTAL);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
void
ewl_tree_cb_node_resize(Ewl_Container *c, Ewl_Widget *w, int size __UNUSED__,
- Ewl_Orientation o __UNUSED__)
+ Ewl_Orientation o __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_tree_cb_node_child_show(c, w);
+ ewl_tree_cb_node_child_show(c, w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
void
ewl_tree_cb_node_child_add(Ewl_Container *c, Ewl_Widget *w __UNUSED__)
{
- Ewl_Tree_Node *node;
+ Ewl_Tree_Node *node;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_TREE_NODE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_TREE_NODE_TYPE);
- node = EWL_TREE_NODE(c);
+ node = EWL_TREE_NODE(c);
- if (ecore_dlist_count(c->children) > 2)
- {
- /* XXX what do we do if !node->handle? */
- if (node->handle && HIDDEN(node->handle))
- ewl_widget_show(node->handle);
- }
- else if (node->handle && VISIBLE(node->handle))
- ewl_widget_hide(node->handle);
+ if (ecore_dlist_count(c->children) > 2)
+ {
+ /* XXX what do we do if !node->handle? */
+ if (node->handle && HIDDEN(node->handle))
+ ewl_widget_show(node->handle);
+ }
+ else if (node->handle && VISIBLE(node->handle))
+ ewl_widget_hide(node->handle);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
void
ewl_tree_cb_node_child_del(Ewl_Container *c, Ewl_Widget *w, int idx __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(c);
- DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(c);
+ DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
- ewl_tree_cb_node_child_add(c, w);
+ ewl_tree_cb_node_child_add(c, w);
}
/**
@@ -1698,20 +1698,20 @@ ewl_tree_cb_node_child_del(Ewl_Container *c, Ewl_Widget *w, int idx __UNUSED__)
void
ewl_tree_kinetic_scrolling_set(Ewl_Tree *tree, Ewl_Kinetic_Scroll type)
{
- Ewl_Scrollpane *scroll;
+ Ewl_Scrollpane *scroll;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(tree);
- DCHECK_TYPE(tree, EWL_TREE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(tree);
+ DCHECK_TYPE(tree, EWL_TREE_TYPE);
- if (!type)
- DRETURN(DLEVEL_STABLE);
+ if (!type)
+ DRETURN(DLEVEL_STABLE);
- scroll = ewl_tree_kinetic_scrollpane_get(tree);
- if (scroll)
- ewl_scrollpane_kinetic_scrolling_set(EWL_SCROLLPANE(scroll), type);
+ scroll = ewl_tree_kinetic_scrollpane_get(tree);
+ if (scroll)
+ ewl_scrollpane_kinetic_scrolling_set(EWL_SCROLLPANE(scroll), type);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1722,18 +1722,18 @@ ewl_tree_kinetic_scrolling_set(Ewl_Tree *tree, Ewl_Kinetic_Scroll type)
Ewl_Kinetic_Scroll
ewl_tree_kinetic_scrolling_get(Ewl_Tree *tree)
{
- Ewl_Scrollpane *scroll;
- Ewl_Kinetic_Scroll type = EWL_KINETIC_SCROLL_NONE;
+ Ewl_Scrollpane *scroll;
+ Ewl_Kinetic_Scroll type = EWL_KINETIC_SCROLL_NONE;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(tree, EWL_KINETIC_SCROLL_NONE);
- DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, EWL_KINETIC_SCROLL_NONE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(tree, EWL_KINETIC_SCROLL_NONE);
+ DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, EWL_KINETIC_SCROLL_NONE);
- scroll = ewl_tree_kinetic_scrollpane_get(tree);
- if (scroll)
- type = ewl_scrollpane_kinetic_scrolling_get(scroll);
+ scroll = ewl_tree_kinetic_scrollpane_get(tree);
+ if (scroll)
+ type = ewl_scrollpane_kinetic_scrolling_get(scroll);
- DRETURN_INT(type, DLEVEL_STABLE);
+ DRETURN_INT(type, DLEVEL_STABLE);
}
/**
@@ -1745,17 +1745,17 @@ ewl_tree_kinetic_scrolling_get(Ewl_Tree *tree)
void
ewl_tree_kinetic_max_velocity_set(Ewl_Tree *tree, double v)
{
- Ewl_Scrollpane *scroll;
+ Ewl_Scrollpane *scroll;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(tree);
- DCHECK_TYPE(tree, EWL_TREE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(tree);
+ DCHECK_TYPE(tree, EWL_TREE_TYPE);
- scroll = ewl_tree_kinetic_scrollpane_get(tree);
- if (scroll)
- ewl_scrollpane_kinetic_max_velocity_set(scroll, v);
+ scroll = ewl_tree_kinetic_scrollpane_get(tree);
+ if (scroll)
+ ewl_scrollpane_kinetic_max_velocity_set(scroll, v);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1766,18 +1766,18 @@ ewl_tree_kinetic_max_velocity_set(Ewl_Tree *tree, double v)
double
ewl_tree_kinetic_max_velocity_get(Ewl_Tree *tree)
{
- Ewl_Scrollpane *scroll;
- double ret = -1.0;
+ Ewl_Scrollpane *scroll;
+ double ret = -1.0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(tree, -1);
- DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, -1);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(tree, -1);
+ DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, -1);
- scroll = ewl_tree_kinetic_scrollpane_get(tree);
- if (scroll)
- ret = ewl_scrollpane_kinetic_max_velocity_get(scroll);
+ scroll = ewl_tree_kinetic_scrollpane_get(tree);
+ if (scroll)
+ ret = ewl_scrollpane_kinetic_max_velocity_get(scroll);
- DRETURN_INT(ret, DLEVEL_STABLE);
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
/**
@@ -1789,17 +1789,17 @@ ewl_tree_kinetic_max_velocity_get(Ewl_Tree *tree)
void
ewl_tree_kinetic_min_velocity_set(Ewl_Tree *tree, double v)
{
- Ewl_Scrollpane *scroll;
+ Ewl_Scrollpane *scroll;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(tree);
- DCHECK_TYPE(tree, EWL_TREE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(tree);
+ DCHECK_TYPE(tree, EWL_TREE_TYPE);
- scroll = ewl_tree_kinetic_scrollpane_get(tree);
- if (scroll)
- ewl_scrollpane_kinetic_min_velocity_set(scroll, v);
+ scroll = ewl_tree_kinetic_scrollpane_get(tree);
+ if (scroll)
+ ewl_scrollpane_kinetic_min_velocity_set(scroll, v);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1810,18 +1810,18 @@ ewl_tree_kinetic_min_velocity_set(Ewl_Tree *tree, double v)
double
ewl_tree_kinetic_min_velocity_get(Ewl_Tree *tree)
{
- Ewl_Scrollpane *scroll;
- double ret = -1.0;
+ Ewl_Scrollpane *scroll;
+ double ret = -1.0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(tree, -1);
- DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, -1);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(tree, -1);
+ DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, -1);
- scroll = ewl_tree_kinetic_scrollpane_get(tree);
- if (scroll)
- ret = ewl_scrollpane_kinetic_min_velocity_get(scroll);
+ scroll = ewl_tree_kinetic_scrollpane_get(tree);
+ if (scroll)
+ ret = ewl_scrollpane_kinetic_min_velocity_get(scroll);
- DRETURN_INT(ret, DLEVEL_STABLE);
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
/**
@@ -1833,17 +1833,17 @@ ewl_tree_kinetic_min_velocity_get(Ewl_Tree *tree)
void
ewl_tree_kinetic_dampen_set(Ewl_Tree *tree, double d)
{
- Ewl_Scrollpane *scroll;
+ Ewl_Scrollpane *scroll;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(tree);
- DCHECK_TYPE(tree, EWL_TREE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(tree);
+ DCHECK_TYPE(tree, EWL_TREE_TYPE);
- scroll = ewl_tree_kinetic_scrollpane_get(tree);
- if (scroll)
- ewl_scrollpane_kinetic_dampen_set(scroll, d);
+ scroll = ewl_tree_kinetic_scrollpane_get(tree);
+ if (scroll)
+ ewl_scrollpane_kinetic_dampen_set(scroll, d);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1854,18 +1854,18 @@ ewl_tree_kinetic_dampen_set(Ewl_Tree *tree, double d)
double
ewl_tree_kinetic_dampen_get(Ewl_Tree *tree)
{
- Ewl_Scrollpane *scroll;
- double ret = -1.0;
+ Ewl_Scrollpane *scroll;
+ double ret = -1.0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(tree, -1);
- DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, -1);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(tree, -1);
+ DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, -1);
- scroll = ewl_tree_kinetic_scrollpane_get(tree);
- if (scroll)
- ret = ewl_scrollpane_kinetic_dampen_get(scroll);
+ scroll = ewl_tree_kinetic_scrollpane_get(tree);
+ if (scroll)
+ ret = ewl_scrollpane_kinetic_dampen_get(scroll);
- DRETURN_INT(ret, DLEVEL_STABLE);
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
/**
@@ -1877,17 +1877,17 @@ ewl_tree_kinetic_dampen_get(Ewl_Tree *tree)
void
ewl_tree_kinetic_fps_set(Ewl_Tree *tree, int fps)
{
- Ewl_Scrollpane *scroll;
+ Ewl_Scrollpane *scroll;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(tree);
- DCHECK_TYPE(tree, EWL_TREE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(tree);
+ DCHECK_TYPE(tree, EWL_TREE_TYPE);
- scroll = ewl_tree_kinetic_scrollpane_get(tree);
- if (scroll)
- ewl_scrollpane_kinetic_fps_set(scroll, fps);
+ scroll = ewl_tree_kinetic_scrollpane_get(tree);
+ if (scroll)
+ ewl_scrollpane_kinetic_fps_set(scroll, fps);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1898,18 +1898,18 @@ ewl_tree_kinetic_fps_set(Ewl_Tree *tree, int fps)
int
ewl_tree_kinetic_fps_get(Ewl_Tree *tree)
{
- Ewl_Scrollpane *scroll;
- int ret = -1;
+ Ewl_Scrollpane *scroll;
+ int ret = -1;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(tree, -1);
- DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, -1);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(tree, -1);
+ DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, -1);
- scroll = ewl_tree_kinetic_scrollpane_get(tree);
- if (scroll)
- ret = ewl_scrollpane_kinetic_fps_get(scroll);
+ scroll = ewl_tree_kinetic_scrollpane_get(tree);
+ if (scroll)
+ ret = ewl_scrollpane_kinetic_fps_get(scroll);
- DRETURN_INT(ret, DLEVEL_STABLE);
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
/**
@@ -1921,29 +1921,29 @@ ewl_tree_kinetic_fps_get(Ewl_Tree *tree)
Ewl_Scrollpane *
ewl_tree_kinetic_scrollpane_get(Ewl_Tree *tree)
{
- Ewl_Widget *s;
- Ewl_Container *scroll, *temp;
+ Ewl_Widget *s;
+ Ewl_Container *scroll, *temp;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(tree, NULL);
- DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(tree, NULL);
+ DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, NULL);
- s = ewl_tree_content_widget_get(tree);
- scroll = ewl_container_redirect_get(EWL_CONTAINER(s));
+ s = ewl_tree_content_widget_get(tree);
+ scroll = ewl_container_redirect_get(EWL_CONTAINER(s));
- while (!ewl_widget_type_is(EWL_WIDGET(scroll), EWL_SCROLLPANE_TYPE))
- {
- temp = scroll;
- scroll = ewl_container_redirect_get(temp);
+ while (!ewl_widget_type_is(EWL_WIDGET(scroll), EWL_SCROLLPANE_TYPE))
+ {
+ temp = scroll;
+ scroll = ewl_container_redirect_get(temp);
- if (!scroll)
- {
- DWARNING("No scrollpane to use for kinetic scrolling");
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
- }
+ if (!scroll)
+ {
+ DWARNING("No scrollpane to use for kinetic scrolling");
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
+ }
- DRETURN_PTR(EWL_SCROLLPANE(scroll), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_SCROLLPANE(scroll), DLEVEL_STABLE);
}
-
+
diff --git a/src/lib/ewl_tree.h b/src/lib/ewl_tree.h
index c16a98b..96a2416 100644
--- a/src/lib/ewl_tree.h
+++ b/src/lib/ewl_tree.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_TREE_H
#define EWL_TREE_H
@@ -96,88 +96,88 @@ typedef struct Ewl_Tree Ewl_Tree;
*/
struct Ewl_Tree
{
- Ewl_MVC mvc; /**< Inherit from ewl_mvc. */
+ Ewl_MVC mvc; /**< Inherit from ewl_mvc. */
- const Ewl_View *content_view; /**< View for the content widget */
+ const Ewl_View *content_view; /**< View for the content widget */
- Ewl_Widget *header; /**< The tree header */
- Ewl_Widget *rows; /**< The rows of the tree */
+ Ewl_Widget *header; /**< The tree header */
+ Ewl_Widget *rows; /**< The rows of the tree */
- unsigned int *rowcache; /**< Cache of row sizes */
+ unsigned int *rowcache; /**< Cache of row sizes */
- Ewl_Tree_Selection_Type type; /**< The selection type of the tree */
+ Ewl_Tree_Selection_Type type; /**< The selection type of the tree */
- Ecore_Hash *expansions; /**< Hash of expanded rows */
+ Ecore_Hash *expansions; /**< Hash of expanded rows */
- struct
- {
- unsigned int column; /**< The sort column */
- Ewl_Sort_Direction direction; /**< Sort direction */
- } sort; /**< The sort information */
+ struct
+ {
+ unsigned int column; /**< The sort column */
+ Ewl_Sort_Direction direction; /**< Sort direction */
+ } sort; /**< The sort information */
- unsigned int columns; /**< Number of columns in the tree */
- unsigned char fixed:1; /**< Rows are fixed height */
- unsigned char headers_visible:1; /**< Are the headers visible? */
- unsigned char row_color_alternate:1; /**< Are the rows alternating? */
+ unsigned int columns; /**< Number of columns in the tree */
+ unsigned char fixed:1; /**< Rows are fixed height */
+ unsigned char headers_visible:1; /**< Are the headers visible? */
+ unsigned char row_color_alternate:1; /**< Are the rows alternating? */
};
/*
* Tree view/controller manipulation
*/
-Ewl_Widget *ewl_tree_new(void);
-int ewl_tree_init(Ewl_Tree *tree);
-
-void ewl_tree_column_count_set(Ewl_Tree *tree,
- unsigned int count);
-unsigned int ewl_tree_column_count_get(Ewl_Tree *tree);
-void ewl_tree_column_fixed_size_set(Ewl_Tree *tree,
- unsigned int col, unsigned int fixed);
-unsigned int ewl_tree_column_fixed_size_get(Ewl_Tree *tree,
- unsigned int col);
-void ewl_tree_column_initial_size_set(Ewl_Tree *tree,
- unsigned int col, int size);
-int ewl_tree_column_initial_size_get(Ewl_Tree *tree,
- unsigned int col);
-
-void ewl_tree_headers_visible_set(Ewl_Tree *tree,
- unsigned char visible);
-unsigned int ewl_tree_headers_visible_get(Ewl_Tree *tree);
-
-void ewl_tree_content_view_set(Ewl_Tree *tree, const Ewl_View *view);
-Ewl_View *ewl_tree_content_view_get(Ewl_Tree *tree);
+Ewl_Widget *ewl_tree_new(void);
+int ewl_tree_init(Ewl_Tree *tree);
+
+void ewl_tree_column_count_set(Ewl_Tree *tree,
+ unsigned int count);
+unsigned int ewl_tree_column_count_get(Ewl_Tree *tree);
+void ewl_tree_column_fixed_size_set(Ewl_Tree *tree,
+ unsigned int col, unsigned int fixed);
+unsigned int ewl_tree_column_fixed_size_get(Ewl_Tree *tree,
+ unsigned int col);
+void ewl_tree_column_initial_size_set(Ewl_Tree *tree,
+ unsigned int col, int size);
+int ewl_tree_column_initial_size_get(Ewl_Tree *tree,
+ unsigned int col);
+
+void ewl_tree_headers_visible_set(Ewl_Tree *tree,
+ unsigned char visible);
+unsigned int ewl_tree_headers_visible_get(Ewl_Tree *tree);
+
+void ewl_tree_content_view_set(Ewl_Tree *tree, const Ewl_View *view);
+Ewl_View *ewl_tree_content_view_get(Ewl_Tree *tree);
Ewl_Tree_Selection_Type ewl_tree_selection_type_get(Ewl_Tree *tree);
-void ewl_tree_selection_type_set(Ewl_Tree *tree,
- Ewl_Tree_Selection_Type type);
+void ewl_tree_selection_type_set(Ewl_Tree *tree,
+ Ewl_Tree_Selection_Type type);
-void ewl_tree_fixed_rows_set(Ewl_Tree *tree, unsigned int fixed);
-unsigned int ewl_tree_fixed_rows_get(Ewl_Tree *tree);
+void ewl_tree_fixed_rows_set(Ewl_Tree *tree, unsigned int fixed);
+unsigned int ewl_tree_fixed_rows_get(Ewl_Tree *tree);
-void ewl_tree_alternate_row_colors_set(Ewl_Tree *tree,
- unsigned char alternate);
-unsigned int ewl_tree_alternate_row_colors_get(Ewl_Tree *tree);
+void ewl_tree_alternate_row_colors_set(Ewl_Tree *tree,
+ unsigned char alternate);
+unsigned int ewl_tree_alternate_row_colors_get(Ewl_Tree *tree);
-Ewl_Widget *ewl_tree_content_widget_get(Ewl_Tree *tree);
+Ewl_Widget *ewl_tree_content_widget_get(Ewl_Tree *tree);
-void ewl_tree_row_expand(Ewl_Tree *tree, void *data,
- unsigned int row);
-void ewl_tree_row_collapse(Ewl_Tree *tree, void *data,
- unsigned int row);
+void ewl_tree_row_expand(Ewl_Tree *tree, void *data,
+ unsigned int row);
+void ewl_tree_row_collapse(Ewl_Tree *tree, void *data,
+ unsigned int row);
-unsigned int ewl_tree_row_expanded_is(Ewl_Tree *tree, void *data,
- unsigned int row);
+unsigned int ewl_tree_row_expanded_is(Ewl_Tree *tree, void *data,
+ unsigned int row);
-void ewl_tree_kinetic_scrolling_set(Ewl_Tree *tree,
- Ewl_Kinetic_Scroll type);
+void ewl_tree_kinetic_scrolling_set(Ewl_Tree *tree,
+ Ewl_Kinetic_Scroll type);
Ewl_Kinetic_Scroll ewl_tree_kinetic_scrolling_get(Ewl_Tree *tree);
-void ewl_tree_kinetic_max_velocity_set(Ewl_Tree *tree, double v);
-double ewl_tree_kinetic_max_velocity_get(Ewl_Tree *tree);
-void ewl_tree_kinetic_min_velocity_set(Ewl_Tree *tree, double v);
-double ewl_tree_kinetic_min_velocity_get(Ewl_Tree *tree);
-void ewl_tree_kinetic_dampen_set(Ewl_Tree *tree, double d);
-double ewl_tree_kinetic_dampen_get(Ewl_Tree *tree);
-void ewl_tree_kinetic_fps_set(Ewl_Tree *tree, int fps);
-int ewl_tree_kinetic_fps_get(Ewl_Tree *tree);
+void ewl_tree_kinetic_max_velocity_set(Ewl_Tree *tree, double v);
+double ewl_tree_kinetic_max_velocity_get(Ewl_Tree *tree);
+void ewl_tree_kinetic_min_velocity_set(Ewl_Tree *tree, double v);
+double ewl_tree_kinetic_min_velocity_get(Ewl_Tree *tree);
+void ewl_tree_kinetic_dampen_set(Ewl_Tree *tree, double d);
+double ewl_tree_kinetic_dampen_get(Ewl_Tree *tree);
+void ewl_tree_kinetic_fps_set(Ewl_Tree *tree, int fps);
+int ewl_tree_kinetic_fps_get(Ewl_Tree *tree);
/*
* Internal stuff.
@@ -210,36 +210,36 @@ typedef struct Ewl_Tree_Node Ewl_Tree_Node;
*/
struct Ewl_Tree_Node
{
- Ewl_MVC mvc;
+ Ewl_MVC mvc;
- Ewl_Widget *tree; /**< The parent tree */
- Ewl_Widget *handle; /**< the expansion handle */
- Ewl_Row *row; /**< The row this node is for */
+ Ewl_Widget *tree; /**< The parent tree */
+ Ewl_Widget *handle; /**< the expansion handle */
+ Ewl_Row *row; /**< The row this node is for */
- struct
- {
- const Ewl_Model *model; /**< The model of the expansion */
- void *data; /**< The data of the expansion */
- } expansion;
+ struct
+ {
+ const Ewl_Model *model; /**< The model of the expansion */
+ void *data; /**< The data of the expansion */
+ } expansion;
- unsigned int row_num; /**< The row number of this row */
- Ewl_Tree_Node_Flags expanded;
+ unsigned int row_num; /**< The row number of this row */
+ Ewl_Tree_Node_Flags expanded;
- unsigned char built_children:1; /**< Have we generated child nodes */
+ unsigned char built_children:1; /**< Have we generated child nodes */
};
-Ewl_Widget *ewl_tree_node_new(void);
-int ewl_tree_node_init(Ewl_Tree_Node *node);
+Ewl_Widget *ewl_tree_node_new(void);
+int ewl_tree_node_init(Ewl_Tree_Node *node);
-void ewl_tree_node_expandable_set(Ewl_Tree_Node *node,
- unsigned int expandable);
-unsigned int ewl_tree_node_expandable_get(Ewl_Tree_Node *node);
+void ewl_tree_node_expandable_set(Ewl_Tree_Node *node,
+ unsigned int expandable);
+unsigned int ewl_tree_node_expandable_get(Ewl_Tree_Node *node);
-void ewl_tree_node_expand(Ewl_Tree_Node *node);
-void ewl_tree_node_collapse(Ewl_Tree_Node *node);
+void ewl_tree_node_expand(Ewl_Tree_Node *node);
+void ewl_tree_node_collapse(Ewl_Tree_Node *node);
-unsigned int ewl_tree_node_expanded_is(Ewl_Tree_Node *node);
-void ewl_tree_node_row_set(Ewl_Tree_Node *node, Ewl_Row *row);
+unsigned int ewl_tree_node_expanded_is(Ewl_Tree_Node *node);
+void ewl_tree_node_row_set(Ewl_Tree_Node *node, Ewl_Row *row);
/*
* Internally used callbacks, override at your own risk.
diff --git a/src/lib/ewl_tree_view.c b/src/lib/ewl_tree_view.c
index ca131b3..728aae4 100644
--- a/src/lib/ewl_tree_view.c
+++ b/src/lib/ewl_tree_view.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_tree_view.h"
#include "ewl_macros.h"
@@ -13,13 +13,13 @@
int
ewl_tree_view_init(Ewl_Tree_View *v)
{
- if (!ewl_box_init(EWL_BOX(v)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_box_init(EWL_BOX(v)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_inherit(EWL_WIDGET(v), EWL_TREE_VIEW_TYPE);
- ewl_box_orientation_set(EWL_BOX(v), EWL_ORIENTATION_VERTICAL);
+ ewl_widget_inherit(EWL_WIDGET(v), EWL_TREE_VIEW_TYPE);
+ ewl_box_orientation_set(EWL_BOX(v), EWL_ORIENTATION_VERTICAL);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -31,15 +31,15 @@ ewl_tree_view_init(Ewl_Tree_View *v)
void
ewl_tree_view_tree_set(Ewl_Tree_View *v, Ewl_Tree *t)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(v);
- DCHECK_PARAM_PTR(t);
- DCHECK_TYPE(v, EWL_TREE_VIEW_TYPE);
- DCHECK_TYPE(t, EWL_TREE_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(v);
+ DCHECK_PARAM_PTR(t);
+ DCHECK_TYPE(v, EWL_TREE_VIEW_TYPE);
+ DCHECK_TYPE(t, EWL_TREE_TYPE);
- v->parent = t;
+ v->parent = t;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -50,10 +50,10 @@ ewl_tree_view_tree_set(Ewl_Tree_View *v, Ewl_Tree *t)
Ewl_Tree *
ewl_tree_view_tree_get(Ewl_Tree_View *v)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(v, NULL);
- DCHECK_TYPE_RET(v, EWL_TREE_VIEW_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(v, NULL);
+ DCHECK_TYPE_RET(v, EWL_TREE_VIEW_TYPE, NULL);
- DRETURN_PTR(v->parent, DLEVEL_STABLE);
+ DRETURN_PTR(v->parent, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_tree_view.h b/src/lib/ewl_tree_view.h
index 771f969..1bcf9f7 100644
--- a/src/lib/ewl_tree_view.h
+++ b/src/lib/ewl_tree_view.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_TREE_VIEW_H
#define EWL_TREE_VIEW_H
@@ -46,8 +46,8 @@ typedef struct Ewl_Tree_View Ewl_Tree_View;
*/
struct Ewl_Tree_View
{
- Ewl_Box box; /**< Inherit from Ewl_Box */
- Ewl_Tree *parent; /**< The tree parent */
+ Ewl_Box box; /**< Inherit from Ewl_Box */
+ Ewl_Tree *parent; /**< The tree parent */
};
int ewl_tree_view_init(Ewl_Tree_View *v);
diff --git a/src/lib/ewl_tree_view_freebox.c b/src/lib/ewl_tree_view_freebox.c
index a672f75..1238cc4 100644
--- a/src/lib/ewl_tree_view_freebox.c
+++ b/src/lib/ewl_tree_view_freebox.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_tree_view_freebox.h"
#include "ewl_freebox.h"
@@ -9,8 +9,8 @@
static Ewl_View *ewl_tree_view_freebox_view = NULL;
static Ewl_Widget *ewl_tree_view_freebox_cb_widget_fetch(void *data,
- unsigned int col,
- unsigned int row);
+ unsigned int col,
+ unsigned int row);
/**
* @return Returns the view for this widget
@@ -19,31 +19,31 @@ static Ewl_Widget *ewl_tree_view_freebox_cb_widget_fetch(void *data,
const Ewl_View *
ewl_tree_view_freebox_get(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- if (!ewl_tree_view_freebox_view)
- {
- ewl_tree_view_freebox_view = ewl_view_new();
- ewl_view_widget_fetch_set(ewl_tree_view_freebox_view,
- ewl_tree_view_freebox_cb_widget_fetch);
- }
+ if (!ewl_tree_view_freebox_view)
+ {
+ ewl_tree_view_freebox_view = ewl_view_new();
+ ewl_view_widget_fetch_set(ewl_tree_view_freebox_view,
+ ewl_tree_view_freebox_cb_widget_fetch);
+ }
- DRETURN_PTR(ewl_tree_view_freebox_view, DLEVEL_STABLE);
+ DRETURN_PTR(ewl_tree_view_freebox_view, DLEVEL_STABLE);
}
static Ewl_Widget *
ewl_tree_view_freebox_cb_widget_fetch(void *data __UNUSED__,
- unsigned int col __UNUSED__,
- unsigned int row __UNUSED__)
+ unsigned int col __UNUSED__,
+ unsigned int row __UNUSED__)
{
- Ewl_Widget *tree;
+ Ewl_Widget *tree;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- tree = ewl_tree_view_freebox_new();
- ewl_widget_show(tree);
+ tree = ewl_tree_view_freebox_new();
+ ewl_widget_show(tree);
- DRETURN_PTR(tree, DLEVEL_STABLE);
+ DRETURN_PTR(tree, DLEVEL_STABLE);
}
/**
@@ -53,21 +53,21 @@ ewl_tree_view_freebox_cb_widget_fetch(void *data __UNUSED__,
Ewl_Widget *
ewl_tree_view_freebox_new(void)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- w = NEW(Ewl_Tree_View_Freebox, 1);
- if (!w)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ w = NEW(Ewl_Tree_View_Freebox, 1);
+ if (!w)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_tree_view_freebox_init(EWL_TREE_VIEW_FREEBOX(w)))
- {
- ewl_widget_destroy(w);
- w = NULL;
- }
+ if (!ewl_tree_view_freebox_init(EWL_TREE_VIEW_FREEBOX(w)))
+ {
+ ewl_widget_destroy(w);
+ w = NULL;
+ }
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
/**
@@ -78,31 +78,31 @@ ewl_tree_view_freebox_new(void)
int
ewl_tree_view_freebox_init(Ewl_Tree_View_Freebox *tv)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(tv, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(tv, FALSE);
- if (!ewl_tree_view_init(EWL_TREE_VIEW(tv)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_tree_view_init(EWL_TREE_VIEW(tv)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_box_orientation_set(EWL_BOX(tv), EWL_ORIENTATION_VERTICAL);
- ewl_widget_inherit(EWL_WIDGET(tv), EWL_TREE_VIEW_FREEBOX_TYPE);
+ ewl_box_orientation_set(EWL_BOX(tv), EWL_ORIENTATION_VERTICAL);
+ ewl_widget_inherit(EWL_WIDGET(tv), EWL_TREE_VIEW_FREEBOX_TYPE);
- tv->scroll = ewl_scrollpane_new();
- ewl_container_child_append(EWL_CONTAINER(tv), tv->scroll);
- ewl_widget_inherit(EWL_WIDGET(tv), EWL_TREE_VIEW_FREEBOX_TYPE);
- ewl_widget_show(tv->scroll);
+ tv->scroll = ewl_scrollpane_new();
+ ewl_container_child_append(EWL_CONTAINER(tv), tv->scroll);
+ ewl_widget_inherit(EWL_WIDGET(tv), EWL_TREE_VIEW_FREEBOX_TYPE);
+ ewl_widget_show(tv->scroll);
- tv->fbox = ewl_vfreebox_new();
- ewl_freebox_layout_type_set(EWL_FREEBOX(tv->fbox),
- EWL_FREEBOX_LAYOUT_AUTO);
- ewl_container_child_append(EWL_CONTAINER(tv->scroll), tv->fbox);
- ewl_widget_show(tv->fbox);
+ tv->fbox = ewl_vfreebox_new();
+ ewl_freebox_layout_type_set(EWL_FREEBOX(tv->fbox),
+ EWL_FREEBOX_LAYOUT_AUTO);
+ ewl_container_child_append(EWL_CONTAINER(tv->scroll), tv->fbox);
+ ewl_widget_show(tv->fbox);
- ewl_container_redirect_set(EWL_CONTAINER(tv),
- EWL_CONTAINER(tv->fbox));
+ ewl_container_redirect_set(EWL_CONTAINER(tv),
+ EWL_CONTAINER(tv->fbox));
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_tree_view_freebox.h b/src/lib/ewl_tree_view_freebox.h
index 76e549b..1078ae2 100644
--- a/src/lib/ewl_tree_view_freebox.h
+++ b/src/lib/ewl_tree_view_freebox.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_TREE_VIEW_FREEBOX_H
#define EWL_TREE_VIEW_FREEBOX_H
@@ -40,14 +40,14 @@ typedef struct Ewl_Tree_View_Freebox Ewl_Tree_View_Freebox;
*/
struct Ewl_Tree_View_Freebox
{
- Ewl_Tree_View view; /**< Inherit from Ewl_Tree_View */
- Ewl_Widget *fbox; /**< The freebox region */
- Ewl_Widget *scroll; /**< The scroll region */
+ Ewl_Tree_View view; /**< Inherit from Ewl_Tree_View */
+ Ewl_Widget *fbox; /**< The freebox region */
+ Ewl_Widget *scroll; /**< The scroll region */
};
-const Ewl_View *ewl_tree_view_freebox_get(void);
-Ewl_Widget *ewl_tree_view_freebox_new(void);
-int ewl_tree_view_freebox_init(Ewl_Tree_View_Freebox *tv);
+const Ewl_View *ewl_tree_view_freebox_get(void);
+Ewl_Widget *ewl_tree_view_freebox_new(void);
+int ewl_tree_view_freebox_init(Ewl_Tree_View_Freebox *tv);
/**
* @}
diff --git a/src/lib/ewl_tree_view_plain.c b/src/lib/ewl_tree_view_plain.c
index 971a1b3..be4cbcc 100644
--- a/src/lib/ewl_tree_view_plain.c
+++ b/src/lib/ewl_tree_view_plain.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_tree_view_plain.h"
#include "ewl_macros.h"
@@ -6,8 +6,8 @@
#include "ewl_debug.h"
static Ewl_Widget *ewl_tree_view_plain_cb_widget_fetch(void *data,
- unsigned int row,
- unsigned int col);
+ unsigned int row,
+ unsigned int col);
static Ewl_View *ewl_tree_view_plain_view = NULL;
@@ -18,31 +18,31 @@ static Ewl_View *ewl_tree_view_plain_view = NULL;
const Ewl_View *
ewl_tree_view_plain_get(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- if (!ewl_tree_view_plain_view)
- {
- ewl_tree_view_plain_view = ewl_view_new();
- ewl_view_widget_fetch_set(ewl_tree_view_plain_view,
- ewl_tree_view_plain_cb_widget_fetch);
- }
+ if (!ewl_tree_view_plain_view)
+ {
+ ewl_tree_view_plain_view = ewl_view_new();
+ ewl_view_widget_fetch_set(ewl_tree_view_plain_view,
+ ewl_tree_view_plain_cb_widget_fetch);
+ }
- DRETURN_PTR(ewl_tree_view_plain_view, DLEVEL_STABLE);
+ DRETURN_PTR(ewl_tree_view_plain_view, DLEVEL_STABLE);
}
static Ewl_Widget *
ewl_tree_view_plain_cb_widget_fetch(void *data __UNUSED__,
- unsigned int row __UNUSED__,
- unsigned int col __UNUSED__)
+ unsigned int row __UNUSED__,
+ unsigned int col __UNUSED__)
{
- Ewl_Widget *plain;
+ Ewl_Widget *plain;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- plain = ewl_tree_view_plain_new();
- ewl_widget_show(plain);
+ plain = ewl_tree_view_plain_new();
+ ewl_widget_show(plain);
- DRETURN_PTR(plain, DLEVEL_STABLE);
+ DRETURN_PTR(plain, DLEVEL_STABLE);
}
/**
@@ -52,21 +52,21 @@ ewl_tree_view_plain_cb_widget_fetch(void *data __UNUSED__,
Ewl_Widget *
ewl_tree_view_plain_new(void)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- w = NEW(Ewl_Tree_View_Plain, 1);
- if (!w)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ w = NEW(Ewl_Tree_View_Plain, 1);
+ if (!w)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_tree_view_plain_init(EWL_TREE_VIEW_PLAIN(w)))
- {
- ewl_widget_destroy(w);
- w = NULL;
- }
+ if (!ewl_tree_view_plain_init(EWL_TREE_VIEW_PLAIN(w)))
+ {
+ ewl_widget_destroy(w);
+ w = NULL;
+ }
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
/**
@@ -77,14 +77,14 @@ ewl_tree_view_plain_new(void)
int
ewl_tree_view_plain_init(Ewl_Tree_View_Plain *tv)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(tv, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(tv, FALSE);
- if (!ewl_tree_view_init(EWL_TREE_VIEW(tv)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_tree_view_init(EWL_TREE_VIEW(tv)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_inherit(EWL_WIDGET(tv), EWL_TREE_VIEW_PLAIN_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(tv), EWL_TREE_VIEW_PLAIN_TYPE);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_tree_view_plain.h b/src/lib/ewl_tree_view_plain.h
index d5303e9..c1a6e1f 100644
--- a/src/lib/ewl_tree_view_plain.h
+++ b/src/lib/ewl_tree_view_plain.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_TREE_VIEW_PLAIN_H
#define EWL_TREE_VIEW_PLAIN_H
@@ -44,13 +44,13 @@ typedef struct Ewl_Tree_View_Plain Ewl_Tree_View_Plain;
*/
struct Ewl_Tree_View_Plain
{
- Ewl_Tree_View view; /**< Inherit from Ewl_Tree_View */
+ Ewl_Tree_View view; /**< Inherit from Ewl_Tree_View */
};
-const Ewl_View *ewl_tree_view_plain_get(void);
+const Ewl_View *ewl_tree_view_plain_get(void);
-Ewl_Widget *ewl_tree_view_plain_new(void);
-int ewl_tree_view_plain_init(Ewl_Tree_View_Plain *tv);
+Ewl_Widget *ewl_tree_view_plain_new(void);
+int ewl_tree_view_plain_init(Ewl_Tree_View_Plain *tv);
/**
* @}
diff --git a/src/lib/ewl_tree_view_scrolled.c b/src/lib/ewl_tree_view_scrolled.c
index 92d69d3..f31f3b5 100644
--- a/src/lib/ewl_tree_view_scrolled.c
+++ b/src/lib/ewl_tree_view_scrolled.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_tree_view_scrolled.h"
#include "ewl_scrollpane.h"
@@ -9,7 +9,7 @@
static Ewl_View *ewl_tree_view_scrolled_view = NULL;
static Ewl_Widget * ewl_tree_view_cb_widget_fetch(void *data, unsigned int col,
- unsigned int row);
+ unsigned int row);
/**
* @return Returns the view for this widget
@@ -18,31 +18,31 @@ static Ewl_Widget * ewl_tree_view_cb_widget_fetch(void *data, unsigned int col,
const Ewl_View *
ewl_tree_view_scrolled_get(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- if (!ewl_tree_view_scrolled_view)
- {
- ewl_tree_view_scrolled_view = ewl_view_new();
- ewl_view_widget_fetch_set(ewl_tree_view_scrolled_view,
- ewl_tree_view_cb_widget_fetch);
- }
+ if (!ewl_tree_view_scrolled_view)
+ {
+ ewl_tree_view_scrolled_view = ewl_view_new();
+ ewl_view_widget_fetch_set(ewl_tree_view_scrolled_view,
+ ewl_tree_view_cb_widget_fetch);
+ }
- DRETURN_PTR(ewl_tree_view_scrolled_view, DLEVEL_STABLE);
+ DRETURN_PTR(ewl_tree_view_scrolled_view, DLEVEL_STABLE);
}
static Ewl_Widget *
ewl_tree_view_cb_widget_fetch(void *data __UNUSED__,
- unsigned int col __UNUSED__,
- unsigned int row __UNUSED__)
+ unsigned int col __UNUSED__,
+ unsigned int row __UNUSED__)
{
- Ewl_Widget *tree;
+ Ewl_Widget *tree;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- tree = ewl_tree_view_scrolled_new();
- ewl_widget_show(tree);
+ tree = ewl_tree_view_scrolled_new();
+ ewl_widget_show(tree);
- DRETURN_PTR(tree, DLEVEL_STABLE);
+ DRETURN_PTR(tree, DLEVEL_STABLE);
}
/**
@@ -52,21 +52,21 @@ ewl_tree_view_cb_widget_fetch(void *data __UNUSED__,
Ewl_Widget *
ewl_tree_view_scrolled_new(void)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- w = NEW(Ewl_Tree_View_Scrolled, 1);
- if (!w)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ w = NEW(Ewl_Tree_View_Scrolled, 1);
+ if (!w)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_tree_view_scrolled_init(EWL_TREE_VIEW_SCROLLED(w)))
- {
- ewl_widget_destroy(w);
- w = NULL;
- }
+ if (!ewl_tree_view_scrolled_init(EWL_TREE_VIEW_SCROLLED(w)))
+ {
+ ewl_widget_destroy(w);
+ w = NULL;
+ }
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
/**
@@ -77,25 +77,25 @@ ewl_tree_view_scrolled_new(void)
int
ewl_tree_view_scrolled_init(Ewl_Tree_View_Scrolled *tv)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(tv, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(tv, FALSE);
- if (!ewl_tree_view_init(EWL_TREE_VIEW(tv)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!ewl_tree_view_init(EWL_TREE_VIEW(tv)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_box_orientation_set(EWL_BOX(tv), EWL_ORIENTATION_VERTICAL);
- ewl_widget_inherit(EWL_WIDGET(tv), EWL_TREE_VIEW_SCROLLED_TYPE);
+ ewl_box_orientation_set(EWL_BOX(tv), EWL_ORIENTATION_VERTICAL);
+ ewl_widget_inherit(EWL_WIDGET(tv), EWL_TREE_VIEW_SCROLLED_TYPE);
- tv->scroll = ewl_scrollpane_new();
- ewl_container_child_append(EWL_CONTAINER(tv), tv->scroll);
- ewl_widget_show(tv->scroll);
+ tv->scroll = ewl_scrollpane_new();
+ ewl_container_child_append(EWL_CONTAINER(tv), tv->scroll);
+ ewl_widget_show(tv->scroll);
- tv->scroll_header = FALSE;
- tv->scroll_visible = TRUE;
+ tv->scroll_header = FALSE;
+ tv->scroll_visible = TRUE;
- ewl_container_redirect_set(EWL_CONTAINER(tv), EWL_CONTAINER(tv->scroll));
+ ewl_container_redirect_set(EWL_CONTAINER(tv), EWL_CONTAINER(tv->scroll));
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -106,34 +106,34 @@ ewl_tree_view_scrolled_init(Ewl_Tree_View_Scrolled *tv)
*/
void
ewl_tree_view_scrolled_scroll_headers_set(Ewl_Tree_View *view,
- unsigned int scroll)
+ unsigned int scroll)
{
- Ewl_Tree_View_Scrolled *vs;
+ Ewl_Tree_View_Scrolled *vs;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(view);
- DCHECK_TYPE(view, EWL_TREE_VIEW_SCROLLED_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(view);
+ DCHECK_TYPE(view, EWL_TREE_VIEW_SCROLLED_TYPE);
- if (!view->parent)
- {
- DWARNING("Need parent tree before setting headers scrolled.");
- DRETURN(DLEVEL_STABLE);
- }
+ if (!view->parent)
+ {
+ DWARNING("Need parent tree before setting headers scrolled.");
+ DRETURN(DLEVEL_STABLE);
+ }
- vs = EWL_TREE_VIEW_SCROLLED(view);
+ vs = EWL_TREE_VIEW_SCROLLED(view);
- if (vs->scroll_header == scroll)
- DRETURN(DLEVEL_STABLE);
+ if (vs->scroll_header == scroll)
+ DRETURN(DLEVEL_STABLE);
- vs->scroll_header = scroll;
- if (vs->scroll_header)
- ewl_container_child_prepend(EWL_CONTAINER(vs),
- view->parent->header);
- else
- ewl_container_child_prepend(EWL_CONTAINER(view->parent),
- view->parent->header);
+ vs->scroll_header = scroll;
+ if (vs->scroll_header)
+ ewl_container_child_prepend(EWL_CONTAINER(vs),
+ view->parent->header);
+ else
+ ewl_container_child_prepend(EWL_CONTAINER(view->parent),
+ view->parent->header);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -144,14 +144,14 @@ ewl_tree_view_scrolled_scroll_headers_set(Ewl_Tree_View *view,
unsigned int
ewl_tree_view_scrolled_scroll_headers_get(Ewl_Tree_View *view)
{
- Ewl_Tree_View_Scrolled *vs;
+ Ewl_Tree_View_Scrolled *vs;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(view, FALSE);
- DCHECK_TYPE_RET(view, EWL_TREE_VIEW_SCROLLED_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(view, FALSE);
+ DCHECK_TYPE_RET(view, EWL_TREE_VIEW_SCROLLED_TYPE, FALSE);
- vs = EWL_TREE_VIEW_SCROLLED(view);
+ vs = EWL_TREE_VIEW_SCROLLED(view);
- DRETURN_INT(vs->scroll_header, DLEVEL_STABLE);
+ DRETURN_INT(vs->scroll_header, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_tree_view_scrolled.h b/src/lib/ewl_tree_view_scrolled.h
index c0b7103..90946de 100644
--- a/src/lib/ewl_tree_view_scrolled.h
+++ b/src/lib/ewl_tree_view_scrolled.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_TREE_VIEW_SCROLLED_H
#define EWL_TREE_VIEW_SCROLLED_H
@@ -44,21 +44,21 @@ typedef struct Ewl_Tree_View_Scrolled Ewl_Tree_View_Scrolled;
*/
struct Ewl_Tree_View_Scrolled
{
- Ewl_Box box; /**< Inherit from Ewl_Box */
- Ewl_Widget *scroll; /**< The scroll region */
+ Ewl_Box box; /**< Inherit from Ewl_Box */
+ Ewl_Widget *scroll; /**< The scroll region */
- unsigned char scroll_header:1; /**< Do we scroll headers */
- unsigned char scroll_visible:1; /**< Do we we show the headers */
+ unsigned char scroll_header:1; /**< Do we scroll headers */
+ unsigned char scroll_visible:1; /**< Do we we show the headers */
};
-const Ewl_View *ewl_tree_view_scrolled_get(void);
+const Ewl_View *ewl_tree_view_scrolled_get(void);
-Ewl_Widget *ewl_tree_view_scrolled_new(void);
-int ewl_tree_view_scrolled_init(Ewl_Tree_View_Scrolled *tv);
+Ewl_Widget *ewl_tree_view_scrolled_new(void);
+int ewl_tree_view_scrolled_init(Ewl_Tree_View_Scrolled *tv);
-void ewl_tree_view_scrolled_scroll_headers_set(Ewl_Tree_View *view,
- unsigned int scroll);
-unsigned int ewl_tree_view_scrolled_scroll_headers_get(Ewl_Tree_View *view);
+void ewl_tree_view_scrolled_scroll_headers_set(Ewl_Tree_View *view,
+ unsigned int scroll);
+unsigned int ewl_tree_view_scrolled_scroll_headers_get(Ewl_Tree_View *view);
/**
* @}
diff --git a/src/lib/ewl_view.c b/src/lib/ewl_view.c
index c0da355..e3bfda9 100644
--- a/src/lib/ewl_view.c
+++ b/src/lib/ewl_view.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_view.h"
#include "ewl_macros.h"
@@ -12,18 +12,18 @@
Ewl_View *
ewl_view_new(void)
{
- Ewl_View *view;
+ Ewl_View *view;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- view = NEW(Ewl_View, 1);
- if (!ewl_view_init(view))
- {
- FREE(view);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ view = NEW(Ewl_View, 1);
+ if (!ewl_view_init(view))
+ {
+ FREE(view);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- DRETURN_PTR(view, DLEVEL_STABLE);
+ DRETURN_PTR(view, DLEVEL_STABLE);
}
/**
@@ -34,21 +34,21 @@ ewl_view_new(void)
Ewl_View *
ewl_view_clone(const Ewl_View *src)
{
- Ewl_View *view;
+ Ewl_View *view;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- view = NEW(Ewl_View, 1);
- if (!ewl_view_init(view))
- {
- FREE(view);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
- }
+ view = NEW(Ewl_View, 1);
+ if (!ewl_view_init(view))
+ {
+ FREE(view);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+ }
- memcpy(view, src, sizeof(Ewl_View));
- /* FIXME: Reset reference count once we add that feature */
+ memcpy(view, src, sizeof(Ewl_View));
+ /* FIXME: Reset reference count once we add that feature */
- DRETURN_PTR(view, DLEVEL_STABLE);
+ DRETURN_PTR(view, DLEVEL_STABLE);
}
/**
@@ -59,10 +59,10 @@ ewl_view_clone(const Ewl_View *src)
int
ewl_view_init(Ewl_View *view)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(view, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(view, FALSE);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -74,12 +74,12 @@ ewl_view_init(Ewl_View *view)
void
ewl_view_widget_fetch_set(Ewl_View *v, Ewl_View_Widget_Fetch fetch)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(v);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(v);
- v->fetch = fetch;
+ v->fetch = fetch;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -91,10 +91,10 @@ ewl_view_widget_fetch_set(Ewl_View *v, Ewl_View_Widget_Fetch fetch)
Ewl_View_Widget_Fetch
ewl_view_widget_fetch_get(const Ewl_View *v)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(v, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(v, NULL);
- DRETURN_PTR(v->fetch, DLEVEL_STABLE);
+ DRETURN_PTR(v->fetch, DLEVEL_STABLE);
}
/**
@@ -106,12 +106,12 @@ ewl_view_widget_fetch_get(const Ewl_View *v)
void
ewl_view_header_fetch_set(Ewl_View *v, Ewl_View_Header_Fetch f)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(v);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(v);
- v->header_fetch = f;
+ v->header_fetch = f;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -123,10 +123,10 @@ ewl_view_header_fetch_set(Ewl_View *v, Ewl_View_Header_Fetch f)
Ewl_View_Header_Fetch
ewl_view_header_fetch_get(const Ewl_View *v)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(v, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(v, NULL);
- DRETURN_PTR(v->header_fetch, DLEVEL_STABLE);
+ DRETURN_PTR(v->header_fetch, DLEVEL_STABLE);
}
/**
@@ -138,12 +138,12 @@ ewl_view_header_fetch_get(const Ewl_View *v)
void
ewl_view_expansion_view_fetch_set(Ewl_View *v, Ewl_View_Expansion_View_Fetch f)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(v);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(v);
- v->expansion = f;
+ v->expansion = f;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -155,9 +155,9 @@ ewl_view_expansion_view_fetch_set(Ewl_View *v, Ewl_View_Expansion_View_Fetch f)
Ewl_View_Expansion_View_Fetch
ewl_view_expansion_view_fetch_get(const Ewl_View *v)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(v, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(v, NULL);
- DRETURN_PTR(v->expansion, DLEVEL_STABLE);
+ DRETURN_PTR(v->expansion, DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_view.h b/src/lib/ewl_view.h
index a89172b..8e3edda 100644
--- a/src/lib/ewl_view.h
+++ b/src/lib/ewl_view.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_VIEW_H
#define EWL_VIEW_H
@@ -21,7 +21,7 @@
* A typedef to shorten the definition of the view_widget_fetch callbacks.
*/
typedef Ewl_Widget *(*Ewl_View_Widget_Fetch)(void *data, unsigned int row,
- unsigned int col);
+ unsigned int col);
/**
* @def EWL_VIEW_HEADER_GET(f)
@@ -56,33 +56,33 @@ typedef struct Ewl_View Ewl_View;
* callbacks.
*/
typedef Ewl_View *(*Ewl_View_Expansion_View_Fetch)(void *data,
- unsigned int row);
+ unsigned int row);
/**
* @brief The view function pointers
*/
struct Ewl_View
{
- Ewl_View_Widget_Fetch fetch; /**< Get a new widget for display */
- Ewl_View_Header_Fetch header_fetch; /**< Get the header for the given column */
- Ewl_View_Expansion_View_Fetch expansion; /**< Get a view for displaying expansion data */
+ Ewl_View_Widget_Fetch fetch; /**< Get a new widget for display */
+ Ewl_View_Header_Fetch header_fetch; /**< Get the header for the given column */
+ Ewl_View_Expansion_View_Fetch expansion; /**< Get a view for displaying expansion data */
};
-Ewl_View *ewl_view_new(void);
-int ewl_view_init(Ewl_View *view);
-Ewl_View *ewl_view_clone(const Ewl_View *src);
+Ewl_View *ewl_view_new(void);
+int ewl_view_init(Ewl_View *view);
+Ewl_View *ewl_view_clone(const Ewl_View *src);
-void ewl_view_widget_fetch_set(Ewl_View *view,
- Ewl_View_Widget_Fetch construct);
-Ewl_View_Widget_Fetch ewl_view_widget_fetch_get(const Ewl_View *view);
+void ewl_view_widget_fetch_set(Ewl_View *view,
+ Ewl_View_Widget_Fetch construct);
+Ewl_View_Widget_Fetch ewl_view_widget_fetch_get(const Ewl_View *view);
-void ewl_view_header_fetch_set(Ewl_View *v,
- Ewl_View_Header_Fetch f);
-Ewl_View_Header_Fetch ewl_view_header_fetch_get(const Ewl_View *v);
+void ewl_view_header_fetch_set(Ewl_View *v,
+ Ewl_View_Header_Fetch f);
+Ewl_View_Header_Fetch ewl_view_header_fetch_get(const Ewl_View *v);
-void ewl_view_expansion_view_fetch_set(Ewl_View *v,
- Ewl_View_Expansion_View_Fetch f);
-Ewl_View_Expansion_View_Fetch ewl_view_expansion_view_fetch_get(const Ewl_View *v);
+void ewl_view_expansion_view_fetch_set(Ewl_View *v,
+ Ewl_View_Expansion_View_Fetch f);
+Ewl_View_Expansion_View_Fetch ewl_view_expansion_view_fetch_get(const Ewl_View *v);
/**
* @}
diff --git a/src/lib/ewl_widget.c b/src/lib/ewl_widget.c
index c9664a1..5db6a47 100644
--- a/src/lib/ewl_widget.c
+++ b/src/lib/ewl_widget.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_private.h"
#include "ewl_macros.h"
@@ -12,11 +12,11 @@ static Ecore_Hash *ewl_widget_data_table = NULL;
static Evas_Smart *widget_smart = NULL;
static void ewl_widget_theme_padding_get(Ewl_Widget *w, int *l, int *r,
- int *t, int *b);
+ int *t, int *b);
static void ewl_widget_theme_insets_get(Ewl_Widget *w, int *l, int *r,
- int *t, int *b);
+ int *t, int *b);
static void ewl_widget_appearance_part_text_apply(Ewl_Widget *w,
- const char *part, const char *text);
+ const char *part, const char *text);
static void ewl_widget_layer_stack_add(Ewl_Widget *w);
static void ewl_widget_layer_update(Ewl_Widget *w);
static Evas_Object *ewl_widget_layer_neighbor_find_above(Ewl_Widget *w);
@@ -34,20 +34,20 @@ static void ewl_widget_name_table_shutdown(void);
Ewl_Widget *
ewl_widget_new(void)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- w = NEW(Ewl_Widget, 1);
- if (!w)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ w = NEW(Ewl_Widget, 1);
+ if (!w)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_widget_init(w)) {
- FREE(w);
- w = NULL;
- }
+ if (!ewl_widget_init(w)) {
+ FREE(w);
+ w = NULL;
+ }
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
/**
@@ -61,64 +61,64 @@ ewl_widget_new(void)
int
ewl_widget_init(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, FALSE);
-
- ewl_widget_inherit(w, EWL_WIDGET_TYPE);
-
- /*
- * Set size fields on the object
- */
- if (!ewl_object_init(EWL_OBJECT(w)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- /*
- * Set up the necessary theme structures
- */
- if (!ewl_theme_widget_init(w))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- ewl_object_state_remove(EWL_OBJECT(w), EWL_FLAGS_STATE_MASK);
-
- /*
- * Add the common callbacks that all widgets must perform
- */
- ewl_callback_append(w, EWL_CALLBACK_SHOW, ewl_widget_cb_show, NULL);
- ewl_callback_append(w, EWL_CALLBACK_HIDE, ewl_widget_cb_hide, NULL);
- ewl_callback_append(w, EWL_CALLBACK_REVEAL, ewl_widget_cb_reveal, NULL);
- ewl_callback_append(w, EWL_CALLBACK_OBSCURE, ewl_widget_cb_obscure,
- NULL);
- ewl_callback_append(w, EWL_CALLBACK_REALIZE, ewl_widget_cb_realize,
- NULL);
- ewl_callback_append(w, EWL_CALLBACK_UNREALIZE, ewl_widget_cb_unrealize,
- NULL);
- ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, ewl_widget_cb_configure,
- NULL);
- ewl_callback_append(w, EWL_CALLBACK_REPARENT, ewl_widget_cb_reparent,
- NULL);
- ewl_callback_append(w, EWL_CALLBACK_WIDGET_ENABLE, ewl_widget_cb_enable,
- NULL);
- ewl_callback_append(w, EWL_CALLBACK_WIDGET_DISABLE,
- ewl_widget_cb_disable, NULL);
- ewl_callback_append(w, EWL_CALLBACK_FOCUS_IN, ewl_widget_cb_focus_in,
- NULL);
- ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT, ewl_widget_cb_focus_out,
- NULL);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_IN, ewl_widget_cb_mouse_in,
- NULL);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_OUT, ewl_widget_cb_mouse_out,
- NULL);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_DOWN,
- ewl_widget_cb_mouse_down, NULL);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_UP, ewl_widget_cb_mouse_up,
- NULL);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE,
- ewl_widget_cb_mouse_move, NULL);
-
- /* widgets can take focus by default */
- ewl_widget_focusable_set(w, TRUE);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, FALSE);
+
+ ewl_widget_inherit(w, EWL_WIDGET_TYPE);
+
+ /*
+ * Set size fields on the object
+ */
+ if (!ewl_object_init(EWL_OBJECT(w)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ /*
+ * Set up the necessary theme structures
+ */
+ if (!ewl_theme_widget_init(w))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ ewl_object_state_remove(EWL_OBJECT(w), EWL_FLAGS_STATE_MASK);
+
+ /*
+ * Add the common callbacks that all widgets must perform
+ */
+ ewl_callback_append(w, EWL_CALLBACK_SHOW, ewl_widget_cb_show, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_HIDE, ewl_widget_cb_hide, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_REVEAL, ewl_widget_cb_reveal, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_OBSCURE, ewl_widget_cb_obscure,
+ NULL);
+ ewl_callback_append(w, EWL_CALLBACK_REALIZE, ewl_widget_cb_realize,
+ NULL);
+ ewl_callback_append(w, EWL_CALLBACK_UNREALIZE, ewl_widget_cb_unrealize,
+ NULL);
+ ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, ewl_widget_cb_configure,
+ NULL);
+ ewl_callback_append(w, EWL_CALLBACK_REPARENT, ewl_widget_cb_reparent,
+ NULL);
+ ewl_callback_append(w, EWL_CALLBACK_WIDGET_ENABLE, ewl_widget_cb_enable,
+ NULL);
+ ewl_callback_append(w, EWL_CALLBACK_WIDGET_DISABLE,
+ ewl_widget_cb_disable, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_FOCUS_IN, ewl_widget_cb_focus_in,
+ NULL);
+ ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT, ewl_widget_cb_focus_out,
+ NULL);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_IN, ewl_widget_cb_mouse_in,
+ NULL);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_OUT, ewl_widget_cb_mouse_out,
+ NULL);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_DOWN,
+ ewl_widget_cb_mouse_down, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_UP, ewl_widget_cb_mouse_up,
+ NULL);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE,
+ ewl_widget_cb_mouse_move, NULL);
+
+ /* widgets can take focus by default */
+ ewl_widget_focusable_set(w, TRUE);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -130,28 +130,28 @@ ewl_widget_init(Ewl_Widget *w)
void
ewl_widget_name_set(Ewl_Widget *w, const char *name)
{
- char *t;
+ char *t;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (!ewl_widget_name_table)
- {
- ewl_widget_name_table = ecore_hash_new(ecore_str_hash,
- ecore_str_compare);
- ecore_hash_free_key_cb_set(ewl_widget_name_table,
- ECORE_FREE_CB(free));
- ewl_shutdown_add(ewl_widget_name_table_shutdown);
- }
+ if (!ewl_widget_name_table)
+ {
+ ewl_widget_name_table = ecore_hash_new(ecore_str_hash,
+ ecore_str_compare);
+ ecore_hash_free_key_cb_set(ewl_widget_name_table,
+ ECORE_FREE_CB(free));
+ ewl_shutdown_add(ewl_widget_name_table_shutdown);
+ }
- t = (name ? strdup(name) : NULL);
- ewl_attach_name_set(w, t);
+ t = (name ? strdup(name) : NULL);
+ ewl_attach_name_set(w, t);
- if (ewl_widget_name_table)
- ecore_hash_set(ewl_widget_name_table, t, w);
+ if (ewl_widget_name_table)
+ ecore_hash_set(ewl_widget_name_table, t, w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -162,11 +162,11 @@ ewl_widget_name_set(Ewl_Widget *w, const char *name)
const char *
ewl_widget_name_get(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, NULL);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, NULL);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
- DRETURN_PTR(ewl_attach_name_get(w), DLEVEL_STABLE);
+ DRETURN_PTR(ewl_attach_name_get(w), DLEVEL_STABLE);
}
/**
@@ -177,16 +177,16 @@ ewl_widget_name_get(Ewl_Widget *w)
Ewl_Widget *
ewl_widget_name_find(const char *name)
{
- Ewl_Widget *match = NULL;
+ Ewl_Widget *match = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(name, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(name, NULL);
- if (ewl_widget_name_table)
- match = EWL_WIDGET(ecore_hash_get(ewl_widget_name_table,
- (void *)name));
+ if (ewl_widget_name_table)
+ match = EWL_WIDGET(ecore_hash_get(ewl_widget_name_table,
+ (void *)name));
- DRETURN_PTR(match, DLEVEL_STABLE);
+ DRETURN_PTR(match, DLEVEL_STABLE);
}
/**
@@ -199,40 +199,40 @@ ewl_widget_name_find(const char *name)
void
ewl_widget_realize(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (REALIZED(w))
- DRETURN(DLEVEL_STABLE);
+ if (REALIZED(w))
+ DRETURN(DLEVEL_STABLE);
- if (ewl_object_queued_has(EWL_OBJECT(w), EWL_FLAG_QUEUED_SCHEDULED_REVEAL)
- && !ewl_object_queued_has(EWL_OBJECT(w),
- EWL_FLAG_QUEUED_PROCESS_REVEAL))
- ewl_realize_cancel_request(w);
+ if (ewl_object_queued_has(EWL_OBJECT(w), EWL_FLAG_QUEUED_SCHEDULED_REVEAL)
+ && !ewl_object_queued_has(EWL_OBJECT(w),
+ EWL_FLAG_QUEUED_PROCESS_REVEAL))
+ ewl_realize_cancel_request(w);
- /*
- * The parent's realize function will get us here again.
- */
- if (w->parent && !REALIZED(w->parent))
- ewl_widget_realize(w->parent);
+ /*
+ * The parent's realize function will get us here again.
+ */
+ if (w->parent && !REALIZED(w->parent))
+ ewl_widget_realize(w->parent);
- /*
- * The parent should be realized at this point, and we can handle
- * realizing ourselves.
- */
- if (w->parent || ewl_object_toplevel_get(EWL_OBJECT(w))) {
- ewl_object_queued_add(EWL_OBJECT(w), EWL_FLAG_QUEUED_PROCESS_REVEAL);
- ewl_callback_call(w, EWL_CALLBACK_REALIZE);
- ewl_object_queued_remove(EWL_OBJECT(w),
- EWL_FLAG_QUEUED_PROCESS_REVEAL);
+ /*
+ * The parent should be realized at this point, and we can handle
+ * realizing ourselves.
+ */
+ if (w->parent || ewl_object_toplevel_get(EWL_OBJECT(w))) {
+ ewl_object_queued_add(EWL_OBJECT(w), EWL_FLAG_QUEUED_PROCESS_REVEAL);
+ ewl_callback_call(w, EWL_CALLBACK_REALIZE);
+ ewl_object_queued_remove(EWL_OBJECT(w),
+ EWL_FLAG_QUEUED_PROCESS_REVEAL);
- ewl_object_visible_add(EWL_OBJECT(w),
- EWL_FLAG_VISIBLE_REALIZED);
- ewl_widget_obscure(w);
- }
+ ewl_object_visible_add(EWL_OBJECT(w),
+ EWL_FLAG_VISIBLE_REALIZED);
+ ewl_widget_obscure(w);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -245,22 +245,22 @@ ewl_widget_realize(Ewl_Widget *w)
void
ewl_widget_unrealize(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (ewl_object_queued_has(EWL_OBJECT(w), EWL_FLAG_QUEUED_SCHEDULED_REVEAL))
- ewl_realize_cancel_request(w);
+ if (ewl_object_queued_has(EWL_OBJECT(w), EWL_FLAG_QUEUED_SCHEDULED_REVEAL))
+ ewl_realize_cancel_request(w);
- if (!REALIZED(w))
- DRETURN(DLEVEL_STABLE);
+ if (!REALIZED(w))
+ DRETURN(DLEVEL_STABLE);
- ewl_widget_obscure(w);
+ ewl_widget_obscure(w);
- ewl_callback_call(w, EWL_CALLBACK_UNREALIZE);
- ewl_object_visible_remove(EWL_OBJECT(w), EWL_FLAG_VISIBLE_REALIZED);
+ ewl_callback_call(w, EWL_CALLBACK_UNREALIZE);
+ ewl_object_visible_remove(EWL_OBJECT(w), EWL_FLAG_VISIBLE_REALIZED);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -271,30 +271,30 @@ ewl_widget_unrealize(Ewl_Widget *w)
void
ewl_widget_reveal(Ewl_Widget *w)
{
- Ewl_Embed *emb;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- /*
- * Already revealed widgets can be skipped, as can unrealized widgets,
- * unless the are already queued for reveal, ie. in the realize process.
- */
- if (REVEALED(w) || (!REALIZED(w) && !ewl_object_queued_has(
- EWL_OBJECT(w),
- EWL_FLAG_QUEUED_PROCESS_REVEAL)))
- DRETURN(DLEVEL_STABLE);
+ /*
+ * Already revealed widgets can be skipped, as can unrealized widgets,
+ * unless the are already queued for reveal, ie. in the realize process.
+ */
+ if (REVEALED(w) || (!REALIZED(w) && !ewl_object_queued_has(
+ EWL_OBJECT(w),
+ EWL_FLAG_QUEUED_PROCESS_REVEAL)))
+ DRETURN(DLEVEL_STABLE);
- ewl_object_visible_add(EWL_OBJECT(w), EWL_FLAG_VISIBLE_REVEALED);
+ ewl_object_visible_add(EWL_OBJECT(w), EWL_FLAG_VISIBLE_REVEALED);
- emb = ewl_embed_widget_find(w);
- if (emb && emb->canvas)
- ewl_callback_call(w, EWL_CALLBACK_REVEAL);
+ emb = ewl_embed_widget_find(w);
+ if (emb && emb->canvas)
+ ewl_callback_call(w, EWL_CALLBACK_REVEAL);
- ewl_widget_configure(w);
+ ewl_widget_configure(w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -304,19 +304,19 @@ ewl_widget_reveal(Ewl_Widget *w)
*/
void ewl_widget_obscure(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
- if (!REVEALED(w))
- DRETURN(DLEVEL_STABLE);
+ if (!REVEALED(w))
+ DRETURN(DLEVEL_STABLE);
- ewl_object_visible_remove(EWL_OBJECT(w), EWL_FLAG_VISIBLE_REVEALED);
+ ewl_object_visible_remove(EWL_OBJECT(w), EWL_FLAG_VISIBLE_REVEALED);
- if (REALIZED(w) || ewl_object_queued_has(EWL_OBJECT(w),
- EWL_FLAG_QUEUED_SCHEDULED_REVEAL))
- ewl_callback_call(w, EWL_CALLBACK_OBSCURE);
+ if (REALIZED(w) || ewl_object_queued_has(EWL_OBJECT(w),
+ EWL_FLAG_QUEUED_SCHEDULED_REVEAL))
+ ewl_callback_call(w, EWL_CALLBACK_OBSCURE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -331,30 +331,30 @@ void ewl_widget_obscure(Ewl_Widget *w)
void
ewl_widget_show(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- /*
- * Nothing to do if already visible.
- */
- if (VISIBLE(w))
- DRETURN(DLEVEL_STABLE);
+ /*
+ * Nothing to do if already visible.
+ */
+ if (VISIBLE(w))
+ DRETURN(DLEVEL_STABLE);
- /*
- * Flag that this is a visible widget
- */
- ewl_object_visible_add(EWL_OBJECT(w), EWL_FLAG_VISIBLE_SHOWN);
+ /*
+ * Flag that this is a visible widget
+ */
+ ewl_object_visible_add(EWL_OBJECT(w), EWL_FLAG_VISIBLE_SHOWN);
- /*
- * If realized, go about our business, otherwise queue for realize.
- */
- if (REALIZED(w))
- ewl_callback_call(w, EWL_CALLBACK_SHOW);
- else
- ewl_realize_request(w);
+ /*
+ * If realized, go about our business, otherwise queue for realize.
+ */
+ if (REALIZED(w))
+ ewl_callback_call(w, EWL_CALLBACK_SHOW);
+ else
+ ewl_realize_request(w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -368,30 +368,30 @@ ewl_widget_show(Ewl_Widget *w)
void
ewl_widget_hide(Ewl_Widget *w)
{
- Ewl_Embed *emb;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (ewl_object_queued_has(EWL_OBJECT(w), EWL_FLAG_QUEUED_SCHEDULED_REVEAL))
- ewl_realize_cancel_request(w);
+ if (ewl_object_queued_has(EWL_OBJECT(w), EWL_FLAG_QUEUED_SCHEDULED_REVEAL))
+ ewl_realize_cancel_request(w);
- /*
- * Already hidden? Then no work to be done.
- */
- if (HIDDEN(w))
- DRETURN(DLEVEL_STABLE);
+ /*
+ * Already hidden? Then no work to be done.
+ */
+ if (HIDDEN(w))
+ DRETURN(DLEVEL_STABLE);
- emb = ewl_embed_widget_find(w);
- if (emb) ewl_embed_info_widgets_cleanup(emb, w);
+ emb = ewl_embed_widget_find(w);
+ if (emb) ewl_embed_info_widgets_cleanup(emb, w);
- ewl_object_visible_remove(EWL_OBJECT(w), EWL_FLAG_VISIBLE_SHOWN);
+ ewl_object_visible_remove(EWL_OBJECT(w), EWL_FLAG_VISIBLE_SHOWN);
- if (REALIZED(w))
- ewl_callback_call(w, EWL_CALLBACK_HIDE);
+ if (REALIZED(w))
+ ewl_callback_call(w, EWL_CALLBACK_HIDE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -405,49 +405,49 @@ ewl_widget_hide(Ewl_Widget *w)
void
ewl_widget_destroy(Ewl_Widget *w)
{
- int i;
- Ewl_Embed *emb;
+ int i;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (DESTROYED(w))
- DRETURN(DLEVEL_STABLE);
+ if (DESTROYED(w))
+ DRETURN(DLEVEL_STABLE);
- emb = ewl_embed_widget_find(w);
- if (emb) ewl_embed_info_widgets_cleanup(emb, w);
+ emb = ewl_embed_widget_find(w);
+ if (emb) ewl_embed_info_widgets_cleanup(emb, w);
- /*
- * Request prior to hiding so we can skip resizing for child widgets
- * being hidden.
- */
- ewl_destroy_request(w);
+ /*
+ * Request prior to hiding so we can skip resizing for child widgets
+ * being hidden.
+ */
+ ewl_destroy_request(w);
- ewl_widget_hide(w);
- ewl_widget_unrealize(w);
+ ewl_widget_hide(w);
+ ewl_widget_unrealize(w);
- /*
- * remove ourselves from any containers
- */
- ewl_widget_parent_set(w, NULL);
+ /*
+ * remove ourselves from any containers
+ */
+ ewl_widget_parent_set(w, NULL);
- /*
- * Clear out the callbacks, this is a bit tricky because we don't want
- * to continue using this widget after the callbacks have been
- * deleted. Clear all callbacks except for the destroy callbacks.
- * This preserves the list of the destroy type so we don't get a segfault.
- *
- * We delete these now so that we can't possibly get any callbacks before the
- * idler kicks in
- */
- for (i = 0; i < (EWL_CALLBACK_MAX + 1); i++)
- {
- if (i == EWL_CALLBACK_DESTROY) continue;
- ewl_callback_del_type(w, i);
- }
+ /*
+ * Clear out the callbacks, this is a bit tricky because we don't want
+ * to continue using this widget after the callbacks have been
+ * deleted. Clear all callbacks except for the destroy callbacks.
+ * This preserves the list of the destroy type so we don't get a segfault.
+ *
+ * We delete these now so that we can't possibly get any callbacks before the
+ * idler kicks in
+ */
+ for (i = 0; i < (EWL_CALLBACK_MAX + 1); i++)
+ {
+ if (i == EWL_CALLBACK_DESTROY) continue;
+ ewl_callback_del_type(w, i);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -461,16 +461,16 @@ ewl_widget_destroy(Ewl_Widget *w)
void
ewl_widget_configure(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if ((!VISIBLE(w)) || (w->parent && !REVEALED(w->parent)))
- DRETURN(DLEVEL_STABLE);
+ if ((!VISIBLE(w)) || (w->parent && !REVEALED(w->parent)))
+ DRETURN(DLEVEL_STABLE);
- ewl_configure_request(w);
+ ewl_configure_request(w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -484,13 +484,13 @@ ewl_widget_configure(Ewl_Widget *w)
void
ewl_widget_reparent(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_callback_call_with_event_data(w, EWL_CALLBACK_REPARENT, w->parent);
+ ewl_callback_call_with_event_data(w, EWL_CALLBACK_REPARENT, w->parent);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -506,25 +506,25 @@ ewl_widget_reparent(Ewl_Widget *w)
void
ewl_widget_data_set(Ewl_Widget *w, void *k, void *v)
{
- Ecore_Hash *w_data;
+ Ecore_Hash *w_data;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(k);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(k);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (!ewl_widget_data_table)
- ewl_widget_data_table = ecore_hash_new(NULL, NULL);
+ if (!ewl_widget_data_table)
+ ewl_widget_data_table = ecore_hash_new(NULL, NULL);
- w_data = ecore_hash_get(ewl_widget_data_table, w);
- if (!w_data) {
- w_data = ecore_hash_new(NULL, NULL);
- ecore_hash_set(ewl_widget_data_table, w, w_data);
- }
+ w_data = ecore_hash_get(ewl_widget_data_table, w);
+ if (!w_data) {
+ w_data = ecore_hash_new(NULL, NULL);
+ ecore_hash_set(ewl_widget_data_table, w, w_data);
+ }
- ecore_hash_set(w_data, k, v);
+ ecore_hash_set(w_data, k, v);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -541,34 +541,34 @@ ewl_widget_data_set(Ewl_Widget *w, void *k, void *v)
void *
ewl_widget_data_del(Ewl_Widget *w, void *k)
{
- void *data;
- Ecore_Hash *w_data;
+ void *data;
+ Ecore_Hash *w_data;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, NULL);
- DCHECK_PARAM_PTR_RET(k, NULL);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, NULL);
+ DCHECK_PARAM_PTR_RET(k, NULL);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
- /* none of the widgets have data attached */
- if (!ewl_widget_data_table)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ /* none of the widgets have data attached */
+ if (!ewl_widget_data_table)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- w_data = ecore_hash_get(ewl_widget_data_table, w);
+ w_data = ecore_hash_get(ewl_widget_data_table, w);
- /* our widget has no data attached */
- if (!w_data) DRETURN_PTR(NULL, DLEVEL_STABLE);
+ /* our widget has no data attached */
+ if (!w_data) DRETURN_PTR(NULL, DLEVEL_STABLE);
- data = ecore_hash_remove(w_data, k);
+ data = ecore_hash_remove(w_data, k);
- if (ecore_hash_count(w_data) == 0) {
- ecore_hash_remove(ewl_widget_data_table, w);
- IF_FREE_HASH(w_data);
+ if (ecore_hash_count(w_data) == 0) {
+ ecore_hash_remove(ewl_widget_data_table, w);
+ IF_FREE_HASH(w_data);
- if (ecore_hash_count(ewl_widget_data_table) == 0)
- IF_FREE_HASH(ewl_widget_data_table);
- }
+ if (ecore_hash_count(ewl_widget_data_table) == 0)
+ IF_FREE_HASH(ewl_widget_data_table);
+ }
- DRETURN_PTR(data, DLEVEL_STABLE);
+ DRETURN_PTR(data, DLEVEL_STABLE);
}
/**
@@ -582,22 +582,22 @@ ewl_widget_data_del(Ewl_Widget *w, void *k)
void *
ewl_widget_data_get(Ewl_Widget *w, void *k)
{
- void *data = NULL;
- Ecore_Hash *w_data;
+ void *data = NULL;
+ Ecore_Hash *w_data;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, NULL);
- DCHECK_PARAM_PTR_RET(k, NULL);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, NULL);
+ DCHECK_PARAM_PTR_RET(k, NULL);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
- /* no widgets have data */
- if (!ewl_widget_data_table)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ /* no widgets have data */
+ if (!ewl_widget_data_table)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- w_data = ecore_hash_get(ewl_widget_data_table, w);
- if (w_data) data = ecore_hash_get(w_data, k);
+ w_data = ecore_hash_get(ewl_widget_data_table, w);
+ if (w_data) data = ecore_hash_get(w_data, k);
- DRETURN_PTR(data, DLEVEL_STABLE);
+ DRETURN_PTR(data, DLEVEL_STABLE);
}
/**
@@ -612,33 +612,33 @@ ewl_widget_data_get(Ewl_Widget *w, void *k)
void
ewl_widget_appearance_set(Ewl_Widget *w, const char *appearance)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(appearance);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(appearance);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- /* make sure we have something to do */
- if (w->appearance && !strcmp(appearance, w->appearance))
- DRETURN(DLEVEL_STABLE);
+ /* make sure we have something to do */
+ if (w->appearance && !strcmp(appearance, w->appearance))
+ DRETURN(DLEVEL_STABLE);
- /*
- * The base appearance is used for determining the theme key of the
- * widget. Intentionally lose a reference to the ecore string to keep a
- * reference cached for later re-use.
- */
- w->appearance = ecore_string_instance(appearance);
- if (!w->appearance)
- DRETURN(DLEVEL_STABLE);
+ /*
+ * The base appearance is used for determining the theme key of the
+ * widget. Intentionally lose a reference to the ecore string to keep a
+ * reference cached for later re-use.
+ */
+ w->appearance = ecore_string_instance(appearance);
+ if (!w->appearance)
+ DRETURN(DLEVEL_STABLE);
- /*
- * Recreate the visible components of the widget if necessary.
- */
- if (REALIZED(w)) {
- ewl_widget_unrealize(w);
- ewl_widget_realize(w);
- }
+ /*
+ * Recreate the visible components of the widget if necessary.
+ */
+ if (REALIZED(w)) {
+ ewl_widget_unrealize(w);
+ ewl_widget_realize(w);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -650,11 +650,11 @@ ewl_widget_appearance_set(Ewl_Widget *w, const char *appearance)
char *
ewl_widget_appearance_get(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, NULL);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, NULL);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
- DRETURN_PTR((w->appearance ? strdup(w->appearance) : NULL), DLEVEL_STABLE);
+ DRETURN_PTR((w->appearance ? strdup(w->appearance) : NULL), DLEVEL_STABLE);
}
/**
@@ -668,23 +668,23 @@ ewl_widget_appearance_get(Ewl_Widget *w)
int
ewl_widget_appearance_path_size_get(Ewl_Widget *w)
{
- int size;
+ int size;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, 0);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, 0);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, 0);
- /*
- * Allocate enough for the appearance plus a leading "/"
- */
- size = 0;
- while (w) {
- size += (w->appearance ? strlen(w->appearance) : 0) + 1;
- w = w->parent;
- }
- size++;
+ /*
+ * Allocate enough for the appearance plus a leading "/"
+ */
+ size = 0;
+ while (w) {
+ size += (w->appearance ? strlen(w->appearance) : 0) + 1;
+ w = w->parent;
+ }
+ size++;
- DRETURN_INT(size, DLEVEL_STABLE);
+ DRETURN_INT(size, DLEVEL_STABLE);
}
/**
@@ -699,23 +699,23 @@ ewl_widget_appearance_path_size_get(Ewl_Widget *w)
int
ewl_widget_appearance_path_copy(Ewl_Widget *w, char *buf, int size)
{
- int len, used;
+ int len, used;
- used = 0;
- len = (w->appearance ? strlen(w->appearance) : 0);
+ used = 0;
+ len = (w->appearance ? strlen(w->appearance) : 0);
- if (w->parent) {
- used += ewl_widget_appearance_path_copy(w->parent, buf,
- size - len);
- }
+ if (w->parent) {
+ used += ewl_widget_appearance_path_copy(w->parent, buf,
+ size - len);
+ }
- *(buf + used) = '/';
- used++;
- used += ecore_strlcpy(buf + used,
- (w->appearance ? w->appearance : ""),
- size - used);
+ *(buf + used) = '/';
+ used++;
+ used += ecore_strlcpy(buf + used,
+ (w->appearance ? w->appearance : ""),
+ size - used);
- DRETURN_INT(used, DLEVEL_STABLE);
+ DRETURN_INT(used, DLEVEL_STABLE);
}
/**
@@ -727,18 +727,18 @@ ewl_widget_appearance_path_copy(Ewl_Widget *w, char *buf, int size)
char *
ewl_widget_appearance_path_get(Ewl_Widget *w)
{
- char *ret = NULL;
- int len = 0;
+ char *ret = NULL;
+ int len = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, NULL);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, NULL);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
- len = ewl_widget_appearance_path_size_get(w);
- ret = NEW(char *, len);
- ewl_widget_appearance_path_copy(w, ret, len);
+ len = ewl_widget_appearance_path_size_get(w);
+ ret = NEW(char *, len);
+ ewl_widget_appearance_path_copy(w, ret, len);
- DRETURN_PTR(ret, DLEVEL_STABLE);
+ DRETURN_PTR(ret, DLEVEL_STABLE);
}
/**
@@ -754,34 +754,34 @@ ewl_widget_appearance_path_get(Ewl_Widget *w)
void
ewl_widget_state_set(Ewl_Widget *w, const char *state, Ewl_State_Type flag)
{
- Ewl_Event_State_Change ev;
+ Ewl_Event_State_Change ev;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(state);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(state);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- /*
- * Intentionally lose a reference to the ecore string to keep a
- * reference cached for later re-use.
- */
- if (flag == EWL_STATE_PERSISTENT)
- w->theme_state = ecore_string_instance((char *)state);
+ /*
+ * Intentionally lose a reference to the ecore string to keep a
+ * reference cached for later re-use.
+ */
+ if (flag == EWL_STATE_PERSISTENT)
+ w->theme_state = ecore_string_instance((char *)state);
- if (w->theme_object) {
- if (ewl_config_cache.print_signals)
- printf("Emitting: %s to %p (%s)\n", state, w,
- w->appearance);
+ if (w->theme_object) {
+ if (ewl_config_cache.print_signals)
+ printf("Emitting: %s to %p (%s)\n", state, w,
+ w->appearance);
- edje_object_signal_emit(w->theme_object, state, "EWL");
- }
+ edje_object_signal_emit(w->theme_object, state, "EWL");
+ }
- ev.state = state;
- ev.flag = flag;
+ ev.state = state;
+ ev.flag = flag;
- ewl_callback_call_with_event_data(w, EWL_CALLBACK_STATE_CHANGED, &ev);
+ ewl_callback_call_with_event_data(w, EWL_CALLBACK_STATE_CHANGED, &ev);
- DRETURN(DLEVEL_STABLE);
+ DRETURN(DLEVEL_STABLE);
}
/**
@@ -796,56 +796,56 @@ ewl_widget_state_set(Ewl_Widget *w, const char *state, Ewl_State_Type flag)
void
ewl_widget_parent_set(Ewl_Widget *w, Ewl_Widget *p)
{
- Ewl_Widget *tmp;
- Ewl_Container *op;
- Ewl_Embed *emb;
+ Ewl_Widget *tmp;
+ Ewl_Container *op;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- /* check if our new parent is the same as our old parent */
- op = EWL_CONTAINER(w->parent);
- if (op == EWL_CONTAINER(p))
- DRETURN(DLEVEL_STABLE);
+ /* check if our new parent is the same as our old parent */
+ op = EWL_CONTAINER(w->parent);
+ if (op == EWL_CONTAINER(p))
+ DRETURN(DLEVEL_STABLE);
- /* if no parent, obsure the widget */
- if (!p) ewl_widget_obscure(w);
+ /* if no parent, obsure the widget */
+ if (!p) ewl_widget_obscure(w);
- emb = ewl_embed_widget_find(w);
- if (emb) ewl_embed_info_widgets_cleanup(emb, w);
+ emb = ewl_embed_widget_find(w);
+ if (emb) ewl_embed_info_widgets_cleanup(emb, w);
- /*
- * Verify this will not result in recursively nested widgets.
- */
- tmp = p;
- while (tmp) {
- if (tmp == w) {
- DWARNING("ERROR: Recursivly nested widgets.");
- DRETURN(DLEVEL_STABLE);
- }
- tmp = tmp->parent;
- }
+ /*
+ * Verify this will not result in recursively nested widgets.
+ */
+ tmp = p;
+ while (tmp) {
+ if (tmp == w) {
+ DWARNING("ERROR: Recursivly nested widgets.");
+ DRETURN(DLEVEL_STABLE);
+ }
+ tmp = tmp->parent;
+ }
- /* set the parent to NULL before doing the child remove */
- w->parent = NULL;
+ /* set the parent to NULL before doing the child remove */
+ w->parent = NULL;
- /*
- * A widget cannot be the child of multiple widgets, so remove it
- * from a previous parent before adding to this parent.
- */
- if (op) ewl_container_child_remove(op, w);
+ /*
+ * A widget cannot be the child of multiple widgets, so remove it
+ * from a previous parent before adding to this parent.
+ */
+ if (op) ewl_container_child_remove(op, w);
- /*
- * Set this to the new parent here as child_remove will try to call
- * us again if our parent isn't NULL with a NULL parent. This makes
- * sure the parent is set when the remove is done.
- */
- w->parent = p;
+ /*
+ * Set this to the new parent here as child_remove will try to call
+ * us again if our parent isn't NULL with a NULL parent. This makes
+ * sure the parent is set when the remove is done.
+ */
+ w->parent = p;
- ewl_callback_call_with_event_data(w, EWL_CALLBACK_REPARENT, p);
+ ewl_callback_call_with_event_data(w, EWL_CALLBACK_REPARENT, p);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -856,11 +856,11 @@ ewl_widget_parent_set(Ewl_Widget *w, Ewl_Widget *p)
Ewl_Widget *
ewl_widget_parent_get(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, NULL);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, NULL);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
- DRETURN_PTR(w->parent, DLEVEL_STABLE);
+ DRETURN_PTR(w->parent, DLEVEL_STABLE);
}
/**
@@ -875,31 +875,31 @@ ewl_widget_parent_get(Ewl_Widget *w)
static void
ewl_widget_appearance_part_text_apply(Ewl_Widget *w, const char *part, const char *text)
{
- Evas_Coord nw, nh;
+ Evas_Coord nw, nh;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (!w->theme_object)
- DRETURN(DLEVEL_STABLE);
+ if (!w->theme_object)
+ DRETURN(DLEVEL_STABLE);
- /*
- * Fill in the default part to use when the key is NULL.
- */
- if (!part || !*part)
- part = ewl_theme_data_str_get(w, "textpart");
+ /*
+ * Fill in the default part to use when the key is NULL.
+ */
+ if (!part || !*part)
+ part = ewl_theme_data_str_get(w, "textpart");
- /*
- * Set the text to empty if text is NULL. Edje defaults to using the
- * default value specified in the theme.
- */
- edje_object_part_text_set(w->theme_object, part, (text ? text : ""));
- edje_object_size_min_calc(w->theme_object, &nw, &nh);
+ /*
+ * Set the text to empty if text is NULL. Edje defaults to using the
+ * default value specified in the theme.
+ */
+ edje_object_part_text_set(w->theme_object, part, (text ? text : ""));
+ edje_object_size_min_calc(w->theme_object, &nw, &nh);
- ewl_object_preferred_inner_size_set(EWL_OBJECT(w), (int)nw, (int)nh);
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(w), (int)nw, (int)nh);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -918,82 +918,82 @@ ewl_widget_appearance_part_text_apply(Ewl_Widget *w, const char *part, const cha
void
ewl_widget_appearance_part_text_set(Ewl_Widget *w, const char *part, const char *text)
{
- unsigned int i;
- Ewl_Pair *match = NULL;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- if (part && !*part)
- part = NULL;
-
- /*
- * Check for an existing instance of the part key.
- */
- if (w->theme_text.list) {
- if (w->theme_text.direct) {
- match = EWL_PAIR(w->theme_text.list);
- if (part != match->key ||
- (part && strcmp(part, match->key)))
- match = NULL;
- }
- else {
- for (i = 0; i < w->theme_text.len; i++) {
- Ewl_Pair *current = w->theme_text.list[i];
- if (part == current->key ||
- (part && !strcmp(current->key, part))) {
- match = current;
- break;
- }
- }
- }
- }
-
- /*
- * Part key exists and the value is the same as the current value.
- */
- if (match) {
- if (text && match->value && !strcmp(text, match->value))
- DRETURN(DLEVEL_STABLE);
-
- IF_FREE(match->value);
- }
- else {
- match = NEW(Ewl_Pair, 1);
- if (!match) DRETURN(DLEVEL_STABLE);
-
- if (part) match->key = ecore_string_instance(part);
- else match->key = NULL;
- w->theme_text.len++;
-
- if (!w->theme_text.list) {
- w->theme_text.direct = 1;
- w->theme_text.list = (Ewl_Pair **)match;
- }
- else {
- if (w->theme_text.direct) {
- Ewl_Pair *old = EWL_PAIR(w->theme_text.list);
- w->theme_text.list = NEW(Ewl_Pair *, 2);
- w->theme_text.list[0] = old;
- }
- else {
- w->theme_text.list = realloc(w->theme_text.list,
- sizeof(Ewl_Pair) *
- w->theme_text.len);
- }
- w->theme_text.list[w->theme_text.len - 1] = match;
- }
- }
-
- /*
- * What should be the default if you enter NULL? A blank string?
- * Revert to the text specified in the Edje? Use blank for now.
- */
- match->value = (text ? strdup(text) : NULL);
- ewl_widget_appearance_part_text_apply(w, match->key, match->value);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ unsigned int i;
+ Ewl_Pair *match = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ if (part && !*part)
+ part = NULL;
+
+ /*
+ * Check for an existing instance of the part key.
+ */
+ if (w->theme_text.list) {
+ if (w->theme_text.direct) {
+ match = EWL_PAIR(w->theme_text.list);
+ if (part != match->key ||
+ (part && strcmp(part, match->key)))
+ match = NULL;
+ }
+ else {
+ for (i = 0; i < w->theme_text.len; i++) {
+ Ewl_Pair *current = w->theme_text.list[i];
+ if (part == current->key ||
+ (part && !strcmp(current->key, part))) {
+ match = current;
+ break;
+ }
+ }
+ }
+ }
+
+ /*
+ * Part key exists and the value is the same as the current value.
+ */
+ if (match) {
+ if (text && match->value && !strcmp(text, match->value))
+ DRETURN(DLEVEL_STABLE);
+
+ IF_FREE(match->value);
+ }
+ else {
+ match = NEW(Ewl_Pair, 1);
+ if (!match) DRETURN(DLEVEL_STABLE);
+
+ if (part) match->key = ecore_string_instance(part);
+ else match->key = NULL;
+ w->theme_text.len++;
+
+ if (!w->theme_text.list) {
+ w->theme_text.direct = 1;
+ w->theme_text.list = (Ewl_Pair **)match;
+ }
+ else {
+ if (w->theme_text.direct) {
+ Ewl_Pair *old = EWL_PAIR(w->theme_text.list);
+ w->theme_text.list = NEW(Ewl_Pair *, 2);
+ w->theme_text.list[0] = old;
+ }
+ else {
+ w->theme_text.list = realloc(w->theme_text.list,
+ sizeof(Ewl_Pair) *
+ w->theme_text.len);
+ }
+ w->theme_text.list[w->theme_text.len - 1] = match;
+ }
+ }
+
+ /*
+ * What should be the default if you enter NULL? A blank string?
+ * Revert to the text specified in the Edje? Use blank for now.
+ */
+ match->value = (text ? strdup(text) : NULL);
+ ewl_widget_appearance_part_text_apply(w, match->key, match->value);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1012,38 +1012,38 @@ ewl_widget_appearance_part_text_set(Ewl_Widget *w, const char *part, const char
const char *
ewl_widget_appearance_part_text_get(Ewl_Widget *w, const char *part)
{
- unsigned int i;
- Ewl_Pair *match = NULL;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, NULL);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
-
- /*
- * Check for an existing instance of the part key.
- */
- if (w->theme_text.list) {
- if (w->theme_text.direct) {
- match = EWL_PAIR(w->theme_text.list);
- if (part != match->key &&
- (part && match->key &&
- strcmp(part, match->key)))
- match = NULL;
- }
- else {
- for (i = 0; i < w->theme_text.len; i++) {
- Ewl_Pair *current = w->theme_text.list[i];
- if (part == match->key ||
- (part && match->key &&
- !strcmp(part, match->key))) {
- match = current;
- break;
- }
- }
- }
- }
-
- DRETURN_PTR((match ? match->value : NULL), DLEVEL_STABLE);
+ unsigned int i;
+ Ewl_Pair *match = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, NULL);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
+
+ /*
+ * Check for an existing instance of the part key.
+ */
+ if (w->theme_text.list) {
+ if (w->theme_text.direct) {
+ match = EWL_PAIR(w->theme_text.list);
+ if (part != match->key &&
+ (part && match->key &&
+ strcmp(part, match->key)))
+ match = NULL;
+ }
+ else {
+ for (i = 0; i < w->theme_text.len; i++) {
+ Ewl_Pair *current = w->theme_text.list[i];
+ if (part == match->key ||
+ (part && match->key &&
+ !strcmp(part, match->key))) {
+ match = current;
+ break;
+ }
+ }
+ }
+ }
+
+ DRETURN_PTR((match ? match->value : NULL), DLEVEL_STABLE);
}
/**
@@ -1061,13 +1061,13 @@ ewl_widget_appearance_part_text_get(Ewl_Widget *w, const char *part)
void
ewl_widget_appearance_text_set(Ewl_Widget *w, const char *text)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_widget_appearance_part_text_set(w, NULL, text);
+ ewl_widget_appearance_part_text_set(w, NULL, text);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1081,17 +1081,17 @@ ewl_widget_appearance_text_set(Ewl_Widget *w, const char *text)
const char *
ewl_widget_appearance_text_get(Ewl_Widget *w)
{
- const char *part, *match = NULL;
+ const char *part, *match = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, NULL);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, NULL);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
- part = ewl_theme_data_str_get(w, "textpart");
- if (part) match = ewl_widget_appearance_part_text_get(w, part);
- if (!match) match = ewl_widget_appearance_part_text_get(w, NULL);
+ part = ewl_theme_data_str_get(w, "textpart");
+ if (part) match = ewl_widget_appearance_part_text_get(w, part);
+ if (!match) match = ewl_widget_appearance_part_text_get(w, NULL);
- DRETURN_PTR(match, DLEVEL_STABLE);
+ DRETURN_PTR(match, DLEVEL_STABLE);
}
/**
@@ -1104,17 +1104,17 @@ ewl_widget_appearance_text_get(Ewl_Widget *w)
void
ewl_widget_enable(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (DISABLED(w)) {
- ewl_object_state_remove(EWL_OBJECT(w), EWL_FLAGS_STATE_MASK);
- ewl_object_state_add(EWL_OBJECT(w), EWL_FLAG_STATE_NORMAL);
- ewl_callback_call(w, EWL_CALLBACK_WIDGET_ENABLE);
- }
+ if (DISABLED(w)) {
+ ewl_object_state_remove(EWL_OBJECT(w), EWL_FLAGS_STATE_MASK);
+ ewl_object_state_add(EWL_OBJECT(w), EWL_FLAG_STATE_NORMAL);
+ ewl_callback_call(w, EWL_CALLBACK_WIDGET_ENABLE);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1127,17 +1127,17 @@ ewl_widget_enable(Ewl_Widget *w)
void
ewl_widget_disable(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (!DISABLED(w)) {
- ewl_object_state_remove(EWL_OBJECT(w), EWL_FLAGS_STATE_MASK);
- ewl_object_state_add(EWL_OBJECT(w), EWL_FLAG_STATE_DISABLED);
- ewl_callback_call(w, EWL_CALLBACK_WIDGET_DISABLE);
- }
+ if (!DISABLED(w)) {
+ ewl_object_state_remove(EWL_OBJECT(w), EWL_FLAGS_STATE_MASK);
+ ewl_object_state_add(EWL_OBJECT(w), EWL_FLAG_STATE_DISABLED);
+ ewl_callback_call(w, EWL_CALLBACK_WIDGET_DISABLE);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1152,14 +1152,14 @@ ewl_widget_disable(Ewl_Widget *w)
void
ewl_widget_layer_priority_set(Ewl_Widget *w, int layer)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- w->layer = layer;
- if (REALIZED(w)) ewl_widget_layer_update(w);
+ w->layer = layer;
+ if (REALIZED(w)) ewl_widget_layer_update(w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1170,11 +1170,11 @@ ewl_widget_layer_priority_set(Ewl_Widget *w, int layer)
int
ewl_widget_layer_priority_get(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, 0);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, 0);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, 0);
- DRETURN_INT(w->layer, DLEVEL_STABLE);
+ DRETURN_INT(w->layer, DLEVEL_STABLE);
}
/**
@@ -1188,21 +1188,21 @@ ewl_widget_layer_priority_get(Ewl_Widget *w)
void
ewl_widget_layer_top_set(Ewl_Widget *w, int top)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (w->toplayered == top)
- DRETURN(DLEVEL_STABLE);
+ if (w->toplayered == top)
+ DRETURN(DLEVEL_STABLE);
- w->toplayered = top;
+ w->toplayered = top;
- if (REALIZED(w)) {
- ewl_widget_layer_stack_add(w);
- ewl_widget_layer_update(w);
- }
+ if (REALIZED(w)) {
+ ewl_widget_layer_stack_add(w);
+ ewl_widget_layer_update(w);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1214,11 +1214,11 @@ ewl_widget_layer_top_set(Ewl_Widget *w, int top)
int
ewl_widget_layer_top_get(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, FALSE);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, 0);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, FALSE);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, 0);
- DRETURN_INT(w->toplayered, DLEVEL_STABLE);
+ DRETURN_INT(w->toplayered, DLEVEL_STABLE);
}
/**
@@ -1232,16 +1232,16 @@ ewl_widget_layer_top_get(Ewl_Widget *w)
void
ewl_widget_tab_order_append(Ewl_Widget *w)
{
- Ewl_Embed *emb;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- emb = ewl_embed_widget_find(w);
- if (emb) ewl_embed_tab_order_append(emb, w);
+ emb = ewl_embed_widget_find(w);
+ if (emb) ewl_embed_tab_order_append(emb, w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1255,16 +1255,16 @@ ewl_widget_tab_order_append(Ewl_Widget *w)
void
ewl_widget_tab_order_prepend(Ewl_Widget *w)
{
- Ewl_Embed *emb;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- emb = ewl_embed_widget_find(w);
- if (emb) ewl_embed_tab_order_prepend(emb, w);
+ emb = ewl_embed_widget_find(w);
+ if (emb) ewl_embed_tab_order_prepend(emb, w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1279,16 +1279,16 @@ ewl_widget_tab_order_prepend(Ewl_Widget *w)
void
ewl_widget_tab_order_insert(Ewl_Widget *w, unsigned int idx)
{
- Ewl_Embed *emb;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- emb = ewl_embed_widget_find(w);
- if (emb) ewl_embed_tab_order_insert(emb, w, idx);
+ emb = ewl_embed_widget_find(w);
+ if (emb) ewl_embed_tab_order_insert(emb, w, idx);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1300,18 +1300,18 @@ ewl_widget_tab_order_insert(Ewl_Widget *w, unsigned int idx)
void
ewl_widget_tab_order_insert_before(Ewl_Widget *w, Ewl_Widget *before)
{
- Ewl_Embed *emb;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(before);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- DCHECK_TYPE(before, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(before);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DCHECK_TYPE(before, EWL_WIDGET_TYPE);
- emb = ewl_embed_widget_find(w);
- if (emb) ewl_embed_tab_order_insert_before(emb, w, before);
+ emb = ewl_embed_widget_find(w);
+ if (emb) ewl_embed_tab_order_insert_before(emb, w, before);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1324,18 +1324,18 @@ ewl_widget_tab_order_insert_before(Ewl_Widget *w, Ewl_Widget *before)
void
ewl_widget_tab_order_insert_after(Ewl_Widget *w, Ewl_Widget *after)
{
- Ewl_Embed *emb;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(after);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- DCHECK_TYPE(after, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(after);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DCHECK_TYPE(after, EWL_WIDGET_TYPE);
- emb = ewl_embed_widget_find(w);
- if (emb) ewl_embed_tab_order_insert_after(emb, w, after);
+ emb = ewl_embed_widget_find(w);
+ if (emb) ewl_embed_tab_order_insert_after(emb, w, after);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1346,16 +1346,16 @@ ewl_widget_tab_order_insert_after(Ewl_Widget *w, Ewl_Widget *after)
void
ewl_widget_tab_order_remove(Ewl_Widget *w)
{
- Ewl_Embed *emb;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- emb = ewl_embed_widget_find(w);
- if (emb) ewl_embed_tab_order_remove(emb, w);
+ emb = ewl_embed_widget_find(w);
+ if (emb) ewl_embed_tab_order_remove(emb, w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1367,20 +1367,20 @@ ewl_widget_tab_order_remove(Ewl_Widget *w)
void
ewl_widget_ignore_focus_change_set(Ewl_Widget *w, unsigned int val)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (val)
- ewl_object_flags_add(EWL_OBJECT(w),
- EWL_FLAG_PROPERTY_BLOCK_TAB_FOCUS,
- EWL_FLAGS_PROPERTY_MASK);
- else
- ewl_object_flags_remove(EWL_OBJECT(w),
- EWL_FLAG_PROPERTY_BLOCK_TAB_FOCUS,
- EWL_FLAGS_PROPERTY_MASK);
+ if (val)
+ ewl_object_flags_add(EWL_OBJECT(w),
+ EWL_FLAG_PROPERTY_BLOCK_TAB_FOCUS,
+ EWL_FLAGS_PROPERTY_MASK);
+ else
+ ewl_object_flags_remove(EWL_OBJECT(w),
+ EWL_FLAG_PROPERTY_BLOCK_TAB_FOCUS,
+ EWL_FLAGS_PROPERTY_MASK);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1391,16 +1391,16 @@ ewl_widget_ignore_focus_change_set(Ewl_Widget *w, unsigned int val)
unsigned int
ewl_widget_ignore_focus_change_get(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, FALSE);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, FALSE);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, FALSE);
- if (ewl_object_flags_has(EWL_OBJECT(w),
- EWL_FLAG_PROPERTY_BLOCK_TAB_FOCUS,
- EWL_FLAGS_PROPERTY_MASK))
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ if (ewl_object_flags_has(EWL_OBJECT(w),
+ EWL_FLAG_PROPERTY_BLOCK_TAB_FOCUS,
+ EWL_FLAGS_PROPERTY_MASK))
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
}
/**
@@ -1412,20 +1412,20 @@ ewl_widget_ignore_focus_change_get(Ewl_Widget *w)
void
ewl_widget_focusable_set(Ewl_Widget *w, unsigned int val)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (val)
- ewl_object_flags_add(EWL_OBJECT(w),
- EWL_FLAG_PROPERTY_FOCUSABLE,
- EWL_FLAGS_PROPERTY_MASK);
- else
- ewl_object_flags_remove(EWL_OBJECT(w),
- EWL_FLAG_PROPERTY_FOCUSABLE,
- EWL_FLAGS_PROPERTY_MASK);
+ if (val)
+ ewl_object_flags_add(EWL_OBJECT(w),
+ EWL_FLAG_PROPERTY_FOCUSABLE,
+ EWL_FLAGS_PROPERTY_MASK);
+ else
+ ewl_object_flags_remove(EWL_OBJECT(w),
+ EWL_FLAG_PROPERTY_FOCUSABLE,
+ EWL_FLAGS_PROPERTY_MASK);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1436,16 +1436,16 @@ ewl_widget_focusable_set(Ewl_Widget *w, unsigned int val)
unsigned int
ewl_widget_focusable_get(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, FALSE);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, FALSE);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, FALSE);
- if (ewl_object_flags_has(EWL_OBJECT(w),
- EWL_FLAG_PROPERTY_FOCUSABLE,
- EWL_FLAGS_PROPERTY_MASK))
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ if (ewl_object_flags_has(EWL_OBJECT(w),
+ EWL_FLAG_PROPERTY_FOCUSABLE,
+ EWL_FLAGS_PROPERTY_MASK))
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
}
/**
@@ -1456,23 +1456,23 @@ ewl_widget_focusable_get(Ewl_Widget *w)
void
ewl_widget_tree_print(Ewl_Widget *w)
{
- int j, i = 0;
+ int j, i = 0;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- while (w) {
- for (j = 0; j < i; j++)
- printf("\t");
+ while (w) {
+ for (j = 0; j < i; j++)
+ printf("\t");
- ewl_widget_print(w);
+ ewl_widget_print(w);
- w = w->parent;
- i++;
- }
+ w = w->parent;
+ i++;
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1483,22 +1483,22 @@ ewl_widget_tree_print(Ewl_Widget *w)
void
ewl_widget_print(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- printf("%p:%s geometry (%d, %d) %d x %d\n\t%s, %s, %s, %s\n",
- w, w->appearance,
- ewl_object_current_x_get(EWL_OBJECT(w)),
- ewl_object_current_y_get(EWL_OBJECT(w)),
- ewl_object_current_w_get(EWL_OBJECT(w)),
- ewl_object_current_h_get(EWL_OBJECT(w)),
- (VISIBLE(w) ? "visible" : "not visible"),
- (REALIZED(w) ? "realized" : "not realized"),
- (DESTROYED(w) ? "destroyed" : "not destroyed"),
- (DISABLED(w) ? "disabled" : "enabled"));
+ printf("%p:%s geometry (%d, %d) %d x %d\n\t%s, %s, %s, %s\n",
+ w, w->appearance,
+ ewl_object_current_x_get(EWL_OBJECT(w)),
+ ewl_object_current_y_get(EWL_OBJECT(w)),
+ ewl_object_current_w_get(EWL_OBJECT(w)),
+ ewl_object_current_h_get(EWL_OBJECT(w)),
+ (VISIBLE(w) ? "visible" : "not visible"),
+ (REALIZED(w) ? "realized" : "not realized"),
+ (DESTROYED(w) ? "destroyed" : "not destroyed"),
+ (DISABLED(w) ? "disabled" : "enabled"));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1509,76 +1509,76 @@ ewl_widget_print(Ewl_Widget *w)
void
ewl_widget_print_verbose(Ewl_Widget *w)
{
- unsigned int flags;
+ unsigned int flags;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- flags = ewl_object_fill_policy_get(EWL_OBJECT(w));
+ flags = ewl_object_fill_policy_get(EWL_OBJECT(w));
- ewl_widget_print(w);
- printf("\tPreferred size: %dx%d",
- ewl_object_preferred_w_get(EWL_OBJECT(w)),
- ewl_object_preferred_h_get(EWL_OBJECT(w)));
- printf("\tMinimum size: %dx%d",
- ewl_object_minimum_w_get(EWL_OBJECT(w)),
- ewl_object_minimum_h_get(EWL_OBJECT(w)));
- printf("\tMaximum size: %dx%d\n",
- ewl_object_maximum_w_get(EWL_OBJECT(w)),
- ewl_object_maximum_h_get(EWL_OBJECT(w)));
- printf("\tInsets: %d, %d, %d, %d\n",
- ewl_object_insets_left_get(EWL_OBJECT(w)),
- ewl_object_insets_right_get(EWL_OBJECT(w)),
- ewl_object_insets_top_get(EWL_OBJECT(w)),
- ewl_object_insets_bottom_get(EWL_OBJECT(w)));
- printf("\tPadding: %d, %d, %d, %d\n",
- ewl_object_padding_left_get(EWL_OBJECT(w)),
- ewl_object_padding_right_get(EWL_OBJECT(w)),
- ewl_object_padding_top_get(EWL_OBJECT(w)),
- ewl_object_padding_bottom_get(EWL_OBJECT(w)));
- printf("\tFill policy:");
+ ewl_widget_print(w);
+ printf("\tPreferred size: %dx%d",
+ ewl_object_preferred_w_get(EWL_OBJECT(w)),
+ ewl_object_preferred_h_get(EWL_OBJECT(w)));
+ printf("\tMinimum size: %dx%d",
+ ewl_object_minimum_w_get(EWL_OBJECT(w)),
+ ewl_object_minimum_h_get(EWL_OBJECT(w)));
+ printf("\tMaximum size: %dx%d\n",
+ ewl_object_maximum_w_get(EWL_OBJECT(w)),
+ ewl_object_maximum_h_get(EWL_OBJECT(w)));
+ printf("\tInsets: %d, %d, %d, %d\n",
+ ewl_object_insets_left_get(EWL_OBJECT(w)),
+ ewl_object_insets_right_get(EWL_OBJECT(w)),
+ ewl_object_insets_top_get(EWL_OBJECT(w)),
+ ewl_object_insets_bottom_get(EWL_OBJECT(w)));
+ printf("\tPadding: %d, %d, %d, %d\n",
+ ewl_object_padding_left_get(EWL_OBJECT(w)),
+ ewl_object_padding_right_get(EWL_OBJECT(w)),
+ ewl_object_padding_top_get(EWL_OBJECT(w)),
+ ewl_object_padding_bottom_get(EWL_OBJECT(w)));
+ printf("\tFill policy:");
- if (!flags)
- printf(" NONE");
+ if (!flags)
+ printf(" NONE");
- else {
- if (flags & EWL_FLAG_FILL_HSHRINK)
- printf(" HSHRINK");
+ else {
+ if (flags & EWL_FLAG_FILL_HSHRINK)
+ printf(" HSHRINK");
- if (flags & EWL_FLAG_FILL_HFILL)
- printf(" HFILL");
+ if (flags & EWL_FLAG_FILL_HFILL)
+ printf(" HFILL");
- if (flags & EWL_FLAG_FILL_VSHRINK)
- printf(" VSHRINK");
+ if (flags & EWL_FLAG_FILL_VSHRINK)
+ printf(" VSHRINK");
- if (flags & EWL_FLAG_FILL_VFILL)
- printf(" VFILL");
- }
- printf("\n");
+ if (flags & EWL_FLAG_FILL_VFILL)
+ printf(" VFILL");
+ }
+ printf("\n");
- flags = ewl_object_alignment_get(EWL_OBJECT(w));
+ flags = ewl_object_alignment_get(EWL_OBJECT(w));
- printf("\tAlignment:");
- if (!flags)
- printf(" CENTER");
+ printf("\tAlignment:");
+ if (!flags)
+ printf(" CENTER");
- else {
- if (flags & EWL_FLAG_ALIGN_LEFT)
- printf(" LEFT");
+ else {
+ if (flags & EWL_FLAG_ALIGN_LEFT)
+ printf(" LEFT");
- if (flags & EWL_FLAG_ALIGN_RIGHT)
- printf(" RIGHT");
+ if (flags & EWL_FLAG_ALIGN_RIGHT)
+ printf(" RIGHT");
- if (flags & EWL_FLAG_ALIGN_TOP)
- printf(" TOP");
+ if (flags & EWL_FLAG_ALIGN_TOP)
+ printf(" TOP");
- if (flags & EWL_FLAG_ALIGN_BOTTOM)
- printf(" BOTTOM");
- }
- printf("\n");
+ if (flags & EWL_FLAG_ALIGN_BOTTOM)
+ printf(" BOTTOM");
+ }
+ printf("\n");
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1596,19 +1596,19 @@ ewl_widget_print_verbose(Ewl_Widget *w)
void
ewl_widget_internal_set(Ewl_Widget *w, unsigned int val)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (val)
- ewl_object_flags_add(EWL_OBJECT(w), EWL_FLAG_PROPERTY_INTERNAL,
- EWL_FLAGS_PROPERTY_MASK);
- else
- ewl_object_flags_remove(EWL_OBJECT(w),
- EWL_FLAG_PROPERTY_INTERNAL,
- EWL_FLAGS_PROPERTY_MASK);
+ if (val)
+ ewl_object_flags_add(EWL_OBJECT(w), EWL_FLAG_PROPERTY_INTERNAL,
+ EWL_FLAGS_PROPERTY_MASK);
+ else
+ ewl_object_flags_remove(EWL_OBJECT(w),
+ EWL_FLAG_PROPERTY_INTERNAL,
+ EWL_FLAGS_PROPERTY_MASK);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1630,18 +1630,18 @@ ewl_widget_internal_set(Ewl_Widget *w, unsigned int val)
void
ewl_widget_unmanaged_set(Ewl_Widget *w, unsigned int val)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (w->parent) {
- DWARNING("It is not possible to change the unmanage state "
- "of a widget that has already a parent!\n");
- DRETURN(DLEVEL_STABLE);
- }
- w->unmanaged = !!val;
+ if (w->parent) {
+ DWARNING("It is not possible to change the unmanage state "
+ "of a widget that has already a parent!\n");
+ DRETURN(DLEVEL_STABLE);
+ }
+ w->unmanaged = !!val;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1653,56 +1653,56 @@ ewl_widget_unmanaged_set(Ewl_Widget *w, unsigned int val)
void
ewl_widget_inherit(Ewl_Widget *widget, const char *inherit)
{
- size_t len;
- char *tmp = NULL;
- const char *tmp2 = NULL;
+ size_t len;
+ char *tmp = NULL;
+ const char *tmp2 = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(widget);
- DCHECK_PARAM_PTR(inherit);
- /* can't check the inheritence here as we don't know if the widget
- * has any inheritence yet (ewl_widget_init() calls this function to
- * set the inheritence) */
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(widget);
+ DCHECK_PARAM_PTR(inherit);
+ /* can't check the inheritence here as we don't know if the widget
+ * has any inheritence yet (ewl_widget_init() calls this function to
+ * set the inheritence) */
- len = strlen(inherit) + 3;
+ len = strlen(inherit) + 3;
- tmp2 = widget->inheritance;
- if (tmp2) len += strlen(tmp2);
+ tmp2 = widget->inheritance;
+ if (tmp2) len += strlen(tmp2);
- tmp = alloca(sizeof(char) * len);
- if (tmp) {
- size_t used = 0;
+ tmp = alloca(sizeof(char) * len);
+ if (tmp) {
+ size_t used = 0;
- /* Copy the existing inherited types */
- if (tmp2) used = ecore_strlcpy(tmp, tmp2, len);
+ /* Copy the existing inherited types */
+ if (tmp2) used = ecore_strlcpy(tmp, tmp2, len);
- /* Insert the leading colon */
- if (used < len - 1) {
- *(tmp + used) = ':';
- used++;
- }
+ /* Insert the leading colon */
+ if (used < len - 1) {
+ *(tmp + used) = ':';
+ used++;
+ }
- /* Copy newly inherited type */
- if (used < len)
- used += ecore_strlcpy(tmp + used, inherit, len - used);
+ /* Copy newly inherited type */
+ if (used < len)
+ used += ecore_strlcpy(tmp + used, inherit, len - used);
- /* Insert trailing colon */
- if (used < len - 1) {
- *(tmp + used) = ':';
- used++;
- }
+ /* Insert trailing colon */
+ if (used < len - 1) {
+ *(tmp + used) = ':';
+ used++;
+ }
- /* Terminate the string */
- *(tmp + used) = '\0';
- }
+ /* Terminate the string */
+ *(tmp + used) = '\0';
+ }
- /*
- * Intentionally lose a reference to the ecore string to keep a
- * reference cached for later re-use.
- */
- widget->inheritance = ecore_string_instance(tmp);
+ /*
+ * Intentionally lose a reference to the ecore string to keep a
+ * reference cached for later re-use.
+ */
+ widget->inheritance = ecore_string_instance(tmp);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1714,47 +1714,47 @@ ewl_widget_inherit(Ewl_Widget *widget, const char *inherit)
unsigned int
ewl_widget_type_is(Ewl_Widget *widget, const char *type)
{
- int found = FALSE;
+ int found = FALSE;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(widget, FALSE);
- DCHECK_PARAM_PTR_RET(type, FALSE);
- /* we don't check the type of the widget in here or we'll get into
- * an infinate loop ... */
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(widget, FALSE);
+ DCHECK_PARAM_PTR_RET(type, FALSE);
+ /* we don't check the type of the widget in here or we'll get into
+ * an infinate loop ... */
- if (widget->inheritance)
- {
- char *match, *end;
+ if (widget->inheritance)
+ {
+ char *match, *end;
- match = (char *)widget->inheritance;
- end = match + 1;
+ match = (char *)widget->inheritance;
+ end = match + 1;
- while (*end != '\0')
- {
- int count = 0;
+ while (*end != '\0')
+ {
+ int count = 0;
- /* while the type still matches the current part of
- * the string */
- while ((*end != ':') && (*(type + count) == *end))
- {
- count ++;
- end ++;
- }
+ /* while the type still matches the current part of
+ * the string */
+ while ((*end != ':') && (*(type + count) == *end))
+ {
+ count ++;
+ end ++;
+ }
- /* if we ended with the : then this is a match */
- if ((*end == ':') && (*(type + count) == '\0'))
- {
- found = TRUE;
- break;
- }
+ /* if we ended with the : then this is a match */
+ if ((*end == ':') && (*(type + count) == '\0'))
+ {
+ found = TRUE;
+ break;
+ }
- /* move to the next set of :s and then move past it */
- while ((*end != '\0') && (*end != ':')) end ++;
- if ((*end == ':') && (*(++end) == ':')) end++;
- }
- }
+ /* move to the next set of :s and then move past it */
+ while ((*end != '\0') && (*end != ':')) end ++;
+ if ((*end == ':') && (*(++end) == ':')) end++;
+ }
+ }
- DRETURN_INT(found, DLEVEL_STABLE);
+ DRETURN_INT(found, DLEVEL_STABLE);
}
/**
@@ -1766,15 +1766,15 @@ ewl_widget_type_is(Ewl_Widget *widget, const char *type)
unsigned int
ewl_widget_internal_is(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, FALSE);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, FALSE);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, FALSE);
- if (ewl_object_flags_has(EWL_OBJECT(w), EWL_FLAG_PROPERTY_INTERNAL,
- EWL_FLAGS_PROPERTY_MASK))
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ if (ewl_object_flags_has(EWL_OBJECT(w), EWL_FLAG_PROPERTY_INTERNAL,
+ EWL_FLAGS_PROPERTY_MASK))
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
}
/**
@@ -1786,11 +1786,11 @@ ewl_widget_internal_is(Ewl_Widget *w)
unsigned int
ewl_widget_unmanaged_is(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, FALSE);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, FALSE);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, FALSE);
- DRETURN_INT(UNMANAGED(w), DLEVEL_STABLE);
+ DRETURN_INT(UNMANAGED(w), DLEVEL_STABLE);
}
/**
@@ -1801,90 +1801,90 @@ ewl_widget_unmanaged_is(Ewl_Widget *w)
unsigned int
ewl_widget_onscreen_is(Ewl_Widget *w)
{
- int onscreen = FALSE;
- Ewl_Embed *emb;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, 0);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, 0);
-
- /*
- * Until an embed is present, the widget is off screen by default.
- */
- emb = ewl_embed_widget_find(w);
- if (emb) onscreen = TRUE;
-
- /*
- * We don't need to configure if it's outside the viewable space in
- * it's parent widget. This does not recurse upwards to determine
- * ancestor clipped areas, but does obscure items that are outside the
- * top level container.
- */
- if (w->parent) {
- int x = 0, y = 0;
- int width = 0, height = 0;
- Ewl_Widget *p = w->parent;
-
- /*
- * Check if widget is right of the visible area.
- */
- x = ewl_object_current_x_get(EWL_OBJECT(w));
- if (x > (CURRENT_X(p) + CURRENT_W(p)))
- onscreen = FALSE;
-
- if (onscreen) {
- if (x > (CURRENT_X(emb) + CURRENT_W(emb)))
- onscreen = FALSE;
- }
-
- /*
- * Check if widget is below the visible area.
- */
- if (onscreen) {
- y = ewl_object_current_y_get(EWL_OBJECT(w));
- if (y > (CURRENT_Y(p) + CURRENT_H(p)))
- onscreen = FALSE;
- }
-
- if (onscreen) {
- if (y > (CURRENT_Y(emb) + CURRENT_H(emb)))
- onscreen = FALSE;
- }
-
- /*
- * Check if widget is left of visible area.
- */
- if (onscreen) {
- width = ewl_object_current_w_get(EWL_OBJECT(w));
- if ((x + width) < CURRENT_X(p))
- onscreen = FALSE;
- }
-
- if (onscreen) {
- if ((x + width) < CURRENT_X(emb))
- onscreen = FALSE;
- }
-
- /*
- * Check if widget is above visible area.
- */
- if (onscreen) {
- height = ewl_object_current_h_get(EWL_OBJECT(w));
- if ((y + height) < CURRENT_Y(p))
- onscreen = FALSE;
- }
-
- if (onscreen) {
- if ((y + height) < CURRENT_Y(emb))
- onscreen = FALSE;
- }
- }
-
- if (onscreen == TRUE && w->parent) {
- if ((ewl_widget_onscreen_is(w->parent) == FALSE)) onscreen = FALSE;
- }
-
- DRETURN_INT(onscreen, DLEVEL_STABLE);
+ int onscreen = FALSE;
+ Ewl_Embed *emb;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, 0);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, 0);
+
+ /*
+ * Until an embed is present, the widget is off screen by default.
+ */
+ emb = ewl_embed_widget_find(w);
+ if (emb) onscreen = TRUE;
+
+ /*
+ * We don't need to configure if it's outside the viewable space in
+ * it's parent widget. This does not recurse upwards to determine
+ * ancestor clipped areas, but does obscure items that are outside the
+ * top level container.
+ */
+ if (w->parent) {
+ int x = 0, y = 0;
+ int width = 0, height = 0;
+ Ewl_Widget *p = w->parent;
+
+ /*
+ * Check if widget is right of the visible area.
+ */
+ x = ewl_object_current_x_get(EWL_OBJECT(w));
+ if (x > (CURRENT_X(p) + CURRENT_W(p)))
+ onscreen = FALSE;
+
+ if (onscreen) {
+ if (x > (CURRENT_X(emb) + CURRENT_W(emb)))
+ onscreen = FALSE;
+ }
+
+ /*
+ * Check if widget is below the visible area.
+ */
+ if (onscreen) {
+ y = ewl_object_current_y_get(EWL_OBJECT(w));
+ if (y > (CURRENT_Y(p) + CURRENT_H(p)))
+ onscreen = FALSE;
+ }
+
+ if (onscreen) {
+ if (y > (CURRENT_Y(emb) + CURRENT_H(emb)))
+ onscreen = FALSE;
+ }
+
+ /*
+ * Check if widget is left of visible area.
+ */
+ if (onscreen) {
+ width = ewl_object_current_w_get(EWL_OBJECT(w));
+ if ((x + width) < CURRENT_X(p))
+ onscreen = FALSE;
+ }
+
+ if (onscreen) {
+ if ((x + width) < CURRENT_X(emb))
+ onscreen = FALSE;
+ }
+
+ /*
+ * Check if widget is above visible area.
+ */
+ if (onscreen) {
+ height = ewl_object_current_h_get(EWL_OBJECT(w));
+ if ((y + height) < CURRENT_Y(p))
+ onscreen = FALSE;
+ }
+
+ if (onscreen) {
+ if ((y + height) < CURRENT_Y(emb))
+ onscreen = FALSE;
+ }
+ }
+
+ if (onscreen == TRUE && w->parent) {
+ if ((ewl_widget_onscreen_is(w->parent) == FALSE)) onscreen = FALSE;
+ }
+
+ DRETURN_INT(onscreen, DLEVEL_STABLE);
}
/**
@@ -1896,38 +1896,38 @@ ewl_widget_onscreen_is(Ewl_Widget *w)
void
ewl_widget_clipped_set(Ewl_Widget *w, unsigned int val)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (val)
- ewl_object_flags_remove(EWL_OBJECT(w), EWL_FLAG_VISIBLE_NOCLIP,
- EWL_FLAGS_VISIBLE_MASK);
- else
- ewl_object_flags_add(EWL_OBJECT(w), EWL_FLAG_VISIBLE_NOCLIP,
- EWL_FLAGS_VISIBLE_MASK);
+ if (val)
+ ewl_object_flags_remove(EWL_OBJECT(w), EWL_FLAG_VISIBLE_NOCLIP,
+ EWL_FLAGS_VISIBLE_MASK);
+ else
+ ewl_object_flags_add(EWL_OBJECT(w), EWL_FLAG_VISIBLE_NOCLIP,
+ EWL_FLAGS_VISIBLE_MASK);
- if (!REALIZED(w) || (val && w->fx_clip_box) ||
- (!val && !w->fx_clip_box))
- DRETURN(DLEVEL_STABLE);
+ if (!REALIZED(w) || (val && w->fx_clip_box) ||
+ (!val && !w->fx_clip_box))
+ DRETURN(DLEVEL_STABLE);
- if (val) {
- Ewl_Embed *emb;
+ if (val) {
+ Ewl_Embed *emb;
- emb = ewl_embed_widget_find(w);
- if (!emb || !emb->canvas)
- DRETURN(DLEVEL_STABLE);
+ emb = ewl_embed_widget_find(w);
+ if (!emb || !emb->canvas)
+ DRETURN(DLEVEL_STABLE);
- w->fx_clip_box = evas_object_rectangle_add(emb->canvas);
- evas_object_pass_events_set(w->fx_clip_box, TRUE);
- ewl_widget_configure(w);
- }
- else {
- ewl_canvas_object_destroy(w->fx_clip_box);
- w->fx_clip_box = NULL;
- }
+ w->fx_clip_box = evas_object_rectangle_add(emb->canvas);
+ evas_object_pass_events_set(w->fx_clip_box, TRUE);
+ ewl_widget_configure(w);
+ }
+ else {
+ ewl_canvas_object_destroy(w->fx_clip_box);
+ w->fx_clip_box = NULL;
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1938,15 +1938,15 @@ ewl_widget_clipped_set(Ewl_Widget *w, unsigned int val)
unsigned int
ewl_widget_clipped_is(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, FALSE);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, FALSE);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, FALSE);
- if (ewl_object_flags_has(EWL_OBJECT(w), EWL_FLAG_VISIBLE_NOCLIP,
- EWL_FLAGS_VISIBLE_MASK))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (ewl_object_flags_has(EWL_OBJECT(w), EWL_FLAG_VISIBLE_NOCLIP,
+ EWL_FLAGS_VISIBLE_MASK))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -1958,21 +1958,21 @@ ewl_widget_clipped_is(Ewl_Widget *w)
int
ewl_widget_parent_of(Ewl_Widget *c, Ewl_Widget *w)
{
- Ewl_Widget *parent;
+ Ewl_Widget *parent;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(c, FALSE);
- DCHECK_TYPE_RET(c, EWL_WIDGET_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(c, FALSE);
+ DCHECK_TYPE_RET(c, EWL_WIDGET_TYPE, FALSE);
- if (!w) DRETURN_INT(FALSE, DLEVEL_STABLE);
+ if (!w) DRETURN_INT(FALSE, DLEVEL_STABLE);
- parent = w;
- while ((parent = parent->parent)) {
- if (parent == c)
- DRETURN_INT(TRUE, DLEVEL_STABLE);
- }
+ parent = w;
+ while ((parent = parent->parent)) {
+ if (parent == c)
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+ }
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
}
/**
@@ -1983,19 +1983,19 @@ ewl_widget_parent_of(Ewl_Widget *c, Ewl_Widget *w)
void
ewl_widget_focus_send(Ewl_Widget *w)
{
- Ewl_Embed *emb;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- emb = ewl_embed_widget_find(w);
- if (!emb) DRETURN(DLEVEL_STABLE);
+ emb = ewl_embed_widget_find(w);
+ if (!emb) DRETURN(DLEVEL_STABLE);
- ewl_embed_active_set(emb, TRUE);
- ewl_embed_focused_widget_set(emb, w);
+ ewl_embed_active_set(emb, TRUE);
+ ewl_embed_focused_widget_set(emb, w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2005,15 +2005,15 @@ ewl_widget_focus_send(Ewl_Widget *w)
Ewl_Widget *
ewl_widget_focused_get(void)
{
- Ewl_Embed *emb;
- Ewl_Widget *w = NULL;
+ Ewl_Embed *emb;
+ Ewl_Widget *w = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- emb = ewl_embed_active_embed_get();
- if (emb) w = ewl_embed_focused_widget_get(emb);
+ emb = ewl_embed_active_embed_get();
+ if (emb) w = ewl_embed_focused_widget_get(emb);
- DRETURN_PTR(w, DLEVEL_STABLE);
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
/**
@@ -2027,25 +2027,25 @@ ewl_widget_focused_get(void)
*/
void
ewl_widget_color_set(Ewl_Widget *w, unsigned int r, unsigned int g,
- unsigned int b, unsigned int a)
+ unsigned int b, unsigned int a)
{
- Ewl_Color_Set *color;
+ Ewl_Color_Set *color;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- color = NEW(Ewl_Color_Set, 1);
- color->r = r;
- color->g = g;
- color->b = b;
- color->a = a;
- ewl_attach_color_set(w, color);
+ color = NEW(Ewl_Color_Set, 1);
+ color->r = r;
+ color->g = g;
+ color->b = b;
+ color->a = a;
+ ewl_attach_color_set(w, color);
- if (w->fx_clip_box)
- evas_object_color_set(w->fx_clip_box, r, g, b, a);
+ if (w->fx_clip_box)
+ evas_object_color_set(w->fx_clip_box, r, g, b, a);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2059,176 +2059,176 @@ ewl_widget_color_set(Ewl_Widget *w, unsigned int r, unsigned int g,
*/
void
ewl_widget_color_get(Ewl_Widget *w, unsigned int *r, unsigned int *g,
- unsigned int *b, unsigned int *a)
+ unsigned int *b, unsigned int *a)
{
- Ewl_Color_Set *color;
+ Ewl_Color_Set *color;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- color = ewl_attach_color_get(w);
- if (!color) DRETURN(DLEVEL_STABLE);
+ color = ewl_attach_color_get(w);
+ if (!color) DRETURN(DLEVEL_STABLE);
- if (r) *r = color->r;
- if (g) *g = color->g;
- if (b) *b = color->b;
- if (a) *a = color->a;
+ if (r) *r = color->r;
+ if (g) *g = color->g;
+ if (b) *b = color->b;
+ if (a) *a = color->a;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_widget_layer_stack_add(Ewl_Widget *w)
{
- Evas_Object *smart_parent;
+ Evas_Object *smart_parent;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (w->parent && !REVEALED(w->parent))
- DRETURN(DLEVEL_STABLE);
+ if (w->parent && !REVEALED(w->parent))
+ DRETURN(DLEVEL_STABLE);
- if (w->parent && !w->toplayered)
- smart_parent = w->parent->smart_object;
- else {
- Ewl_Embed *emb;
+ if (w->parent && !w->toplayered)
+ smart_parent = w->parent->smart_object;
+ else {
+ Ewl_Embed *emb;
- emb = ewl_embed_widget_find(w);
- smart_parent = emb->smart;
- }
+ emb = ewl_embed_widget_find(w);
+ smart_parent = emb->smart;
+ }
- evas_object_smart_member_add(w->smart_object, smart_parent);
+ evas_object_smart_member_add(w->smart_object, smart_parent);
- if (w->theme_object)
- evas_object_smart_member_add(w->theme_object, w->smart_object);
+ if (w->theme_object)
+ evas_object_smart_member_add(w->theme_object, w->smart_object);
- if (w->fx_clip_box)
- evas_object_smart_member_add(w->fx_clip_box, w->smart_object);
+ if (w->fx_clip_box)
+ evas_object_smart_member_add(w->fx_clip_box, w->smart_object);
- if (w->theme_object && w->fx_clip_box)
- evas_object_stack_below(w->theme_object, w->fx_clip_box);
+ if (w->theme_object && w->fx_clip_box)
+ evas_object_stack_below(w->theme_object, w->fx_clip_box);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_widget_layer_update(Ewl_Widget *w)
{
- Ewl_Widget *p;
- int layer;
+ Ewl_Widget *p;
+ int layer;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (!(p = w->parent))
- DRETURN(DLEVEL_STABLE);
+ if (!(p = w->parent))
+ DRETURN(DLEVEL_STABLE);
- /* check first if the widget should be on the top */
- if (w->toplayered)
- {
- evas_object_raise(w->smart_object);
- DRETURN(DLEVEL_STABLE);
- }
+ /* check first if the widget should be on the top */
+ if (w->toplayered)
+ {
+ evas_object_raise(w->smart_object);
+ DRETURN(DLEVEL_STABLE);
+ }
- layer = ewl_widget_layer_priority_get(w);
- if (layer == 0)
- evas_object_stack_above(w->smart_object, p->fx_clip_box);
+ layer = ewl_widget_layer_priority_get(w);
+ if (layer == 0)
+ evas_object_stack_above(w->smart_object, p->fx_clip_box);
- else if (layer > 0) {
- Evas_Object *above;
+ else if (layer > 0) {
+ Evas_Object *above;
- if (!(above = ewl_widget_layer_neighbor_find_above(w)))
- {
- DWARNING("No object to stack above.");
- DRETURN(DLEVEL_STABLE);
- }
- evas_object_stack_above(w->smart_object, above);
- }
- else {
- Evas_Object *below;
+ if (!(above = ewl_widget_layer_neighbor_find_above(w)))
+ {
+ DWARNING("No object to stack above.");
+ DRETURN(DLEVEL_STABLE);
+ }
+ evas_object_stack_above(w->smart_object, above);
+ }
+ else {
+ Evas_Object *below;
- if (!(below = ewl_widget_layer_neighbor_find_below(w)))
- {
- DWARNING("No object to stack below.");
- DRETURN(DLEVEL_STABLE);
- }
- evas_object_stack_below(w->smart_object, below);
- }
+ if (!(below = ewl_widget_layer_neighbor_find_below(w)))
+ {
+ DWARNING("No object to stack below.");
+ DRETURN(DLEVEL_STABLE);
+ }
+ evas_object_stack_below(w->smart_object, below);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static Evas_Object *
ewl_widget_layer_neighbor_find_above(Ewl_Widget *w)
{
- Evas_Object *o, *ol;
+ Evas_Object *o, *ol;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, NULL);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, NULL);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
- if (!w->parent)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ if (!w->parent)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- o = ol = w->parent->fx_clip_box;
+ o = ol = w->parent->fx_clip_box;
- while ((o = evas_object_above_get(o)))
- {
- Ewl_Widget *found;
+ while ((o = evas_object_above_get(o)))
+ {
+ Ewl_Widget *found;
- found = evas_object_data_get(o, "EWL");
- /*
- * Perhaps it is a cached object so no reason to stop iterating
- */
- if (found) {
- /* ignore the widget itself */
- if (w == found) continue;
- if (ewl_widget_layer_priority_get(w) <=
- ewl_widget_layer_priority_get(found))
- break;
- ol = o;
- }
- }
+ found = evas_object_data_get(o, "EWL");
+ /*
+ * Perhaps it is a cached object so no reason to stop iterating
+ */
+ if (found) {
+ /* ignore the widget itself */
+ if (w == found) continue;
+ if (ewl_widget_layer_priority_get(w) <=
+ ewl_widget_layer_priority_get(found))
+ break;
+ ol = o;
+ }
+ }
- DRETURN_PTR(ol, DLEVEL_STABLE);
+ DRETURN_PTR(ol, DLEVEL_STABLE);
}
static Evas_Object *
ewl_widget_layer_neighbor_find_below(Ewl_Widget *w)
{
- Evas_Object *o, *ol;
+ Evas_Object *o, *ol;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, NULL);
- DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, NULL);
+ DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
- if (!w->parent)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ if (!w->parent)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- o = ol = w->parent->fx_clip_box;
+ o = ol = w->parent->fx_clip_box;
- while ((o = evas_object_below_get(o)))
- {
- Ewl_Widget *found;
+ while ((o = evas_object_below_get(o)))
+ {
+ Ewl_Widget *found;
- found = evas_object_data_get(o, "EWL");
- /*
- * Perhaps it is a cached object so no reason to stop iterating
- */
- if (found) {
- /* ignore the widget itself */
- if (w == found) continue;
- if (ewl_widget_layer_priority_get(w) >=
- ewl_widget_layer_priority_get(found))
- break;
- ol = o;
- }
- }
+ found = evas_object_data_get(o, "EWL");
+ /*
+ * Perhaps it is a cached object so no reason to stop iterating
+ */
+ if (found) {
+ /* ignore the widget itself */
+ if (w == found) continue;
+ if (ewl_widget_layer_priority_get(w) >=
+ ewl_widget_layer_priority_get(found))
+ break;
+ ol = o;
+ }
+ }
- DRETURN_PTR(ol, DLEVEL_STABLE);
+ DRETURN_PTR(ol, DLEVEL_STABLE);
}
/**
@@ -2240,59 +2240,59 @@ ewl_widget_layer_neighbor_find_below(Ewl_Widget *w)
void
ewl_widget_free(Ewl_Widget *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- /*
- * cleanup the attachment lists
- */
- if (w->attach)
- {
- ewl_attach_list_del(w->attach, EWL_ATTACH_TYPE_TOOLTIP);
- ewl_attach_list_del(w->attach, EWL_ATTACH_TYPE_COLOR);
- ewl_attach_list_del(w->attach, EWL_ATTACH_TYPE_NAME);
- }
-
- /*
- * Free up appearance related information
- */
- ewl_theme_widget_shutdown(w);
-
- IF_RELEASE(w->appearance);
- IF_RELEASE(w->inheritance)
- IF_RELEASE(w->theme_state);
-
- if (w->theme_text.list) {
- if (w->theme_text.direct) {
- Ewl_Pair *pair = EWL_PAIR(w->theme_text.list);
- IF_RELEASE(pair->key);
- FREE(EWL_PAIR(w->theme_text.list)->value);
- }
- else {
- unsigned int i;
- for (i = 0; i < w->theme_text.len; i++) {
- Ewl_Pair *pair = EWL_PAIR(w->theme_text.list[i]);
- IF_RELEASE(pair->key);
- FREE(w->theme_text.list[i]->value);
- FREE(w->theme_text.list[i]);
- }
- }
-
- FREE(w->theme_text.list);
- w->theme_text.len = 0;
- }
-
- if (ewl_widget_data_table) {
- Ecore_Hash *w_data;
-
- w_data = ecore_hash_remove(ewl_widget_data_table, w);
- IF_FREE_HASH(w_data);
- }
-
- FREE(w);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ /*
+ * cleanup the attachment lists
+ */
+ if (w->attach)
+ {
+ ewl_attach_list_del(w->attach, EWL_ATTACH_TYPE_TOOLTIP);
+ ewl_attach_list_del(w->attach, EWL_ATTACH_TYPE_COLOR);
+ ewl_attach_list_del(w->attach, EWL_ATTACH_TYPE_NAME);
+ }
+
+ /*
+ * Free up appearance related information
+ */
+ ewl_theme_widget_shutdown(w);
+
+ IF_RELEASE(w->appearance);
+ IF_RELEASE(w->inheritance)
+ IF_RELEASE(w->theme_state);
+
+ if (w->theme_text.list) {
+ if (w->theme_text.direct) {
+ Ewl_Pair *pair = EWL_PAIR(w->theme_text.list);
+ IF_RELEASE(pair->key);
+ FREE(EWL_PAIR(w->theme_text.list)->value);
+ }
+ else {
+ unsigned int i;
+ for (i = 0; i < w->theme_text.len; i++) {
+ Ewl_Pair *pair = EWL_PAIR(w->theme_text.list[i]);
+ IF_RELEASE(pair->key);
+ FREE(w->theme_text.list[i]->value);
+ FREE(w->theme_text.list[i]);
+ }
+ }
+
+ FREE(w->theme_text.list);
+ w->theme_text.len = 0;
+ }
+
+ if (ewl_widget_data_table) {
+ Ecore_Hash *w_data;
+
+ w_data = ecore_hash_remove(ewl_widget_data_table, w);
+ IF_FREE_HASH(w_data);
+ }
+
+ FREE(w);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2305,24 +2305,24 @@ ewl_widget_free(Ewl_Widget *w)
*/
void
ewl_widget_cb_show(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Container *pc;
+ Ewl_Container *pc;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (w->smart_object) evas_object_show(w->smart_object);
- if (w->fx_clip_box) evas_object_show(w->fx_clip_box);
- if (w->theme_object) evas_object_show(w->theme_object);
+ if (w->smart_object) evas_object_show(w->smart_object);
+ if (w->fx_clip_box) evas_object_show(w->fx_clip_box);
+ if (w->theme_object) evas_object_show(w->theme_object);
- pc = EWL_CONTAINER(w->parent);
- if (pc) ewl_container_child_show_call(pc, w);
+ pc = EWL_CONTAINER(w->parent);
+ if (pc) ewl_container_child_show_call(pc, w);
- ewl_widget_tab_order_prepend(w);
+ ewl_widget_tab_order_prepend(w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2335,27 +2335,27 @@ ewl_widget_cb_show(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_widget_cb_hide(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Container *pc;
- Ewl_Embed *emb;
+ Ewl_Container *pc;
+ Ewl_Embed *emb;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_widget_obscure(w);
+ ewl_widget_obscure(w);
- /*
- * Notify parent of hidden state.
- */
- pc = EWL_CONTAINER(w->parent);
- if (pc) ewl_container_child_hide_call(pc, w);
+ /*
+ * Notify parent of hidden state.
+ */
+ pc = EWL_CONTAINER(w->parent);
+ if (pc) ewl_container_child_hide_call(pc, w);
- emb = ewl_embed_widget_find(w);
- if (emb) ewl_embed_info_widgets_cleanup(emb, w);
+ emb = ewl_embed_widget_find(w);
+ if (emb) ewl_embed_info_widgets_cleanup(emb, w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2368,161 +2368,161 @@ ewl_widget_cb_hide(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_widget_cb_reveal(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
-{
- Ewl_Embed *emb;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
-
- emb = ewl_embed_widget_find(w);
- if (!emb || !emb->canvas)
- DRETURN(DLEVEL_STABLE);
-
- /*
- * Increment the dnd awareness counter on the embed.
- */
- if (ewl_object_flags_has(EWL_OBJECT(w), EWL_FLAG_PROPERTY_DND_TARGET,
- EWL_FLAGS_PROPERTY_MASK))
- ewl_embed_dnd_aware_set(emb);
-
- /*
- * Smart Object allocation
- */
- if (!w->smart_object) {
- /*
- * Attempt to load a cached object first, fallback to adding a
- * new one.
- */
- w->smart_object = ewl_embed_object_request(emb, "Ewl Widget Smart Object");
- if (!w->smart_object) {
- if (!widget_smart) {
- static const Evas_Smart_Class sc = {
- "Ewl Widget Smart Object",
- EVAS_SMART_CLASS_VERSION,
- NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL
- };
- widget_smart = evas_smart_class_new(&sc);
- }
- w->smart_object = evas_object_smart_add(emb->canvas, widget_smart);
- }
- evas_object_data_set(w->smart_object, "EWL", w);
- }
-
- /*
- * No object allocated yet for this widget
- */
- if (!w->theme_object && w->theme_path && w->theme_group) {
- /*
- * Attempt to load a cached object first, fallback to adding a
- * new one.
- */
- w->theme_object = ewl_embed_object_request(emb, "edje");
- if (!w->theme_object)
- w->theme_object = edje_object_add(emb->canvas);
-
- /*
- * Attempt to load the theme object
- */
- evas_object_repeat_events_set(w->theme_object, 1);
- if (!edje_object_file_set(w->theme_object, w->theme_path, w->theme_group))
- DWARNING("Error setting edje object %s, %s.",
- w->theme_path, w->theme_group);
-
- /*
- * If the file failed to load, destroy the unnecessary evas
- * object.
- */
- if (edje_object_load_error_get(w->theme_object)) {
- evas_object_del(w->theme_object);
- w->theme_object = NULL;
- }
-
- /*
- * Set the state of the theme object
- */
- if (w->theme_state)
- ewl_widget_state_set(w, (char *)w->theme_state,
- EWL_STATE_PERSISTENT);
-
- if (DISABLED(w))
- ewl_widget_state_set(w, "disabled",
- EWL_STATE_PERSISTENT);
-
- /*
- * Apply any text overrides
- */
- if (w->theme_object && w->theme_text.list) {
- const char *key;
- char *value;
-
- if (w->theme_text.direct) {
- key = EWL_PAIR(w->theme_text.list)->key;
- value = EWL_PAIR(w->theme_text.list)->value;
- ewl_widget_appearance_part_text_apply(w, key, value);
- }
- else {
- unsigned int i;
- for (i = 0; i < w->theme_text.len; i++) {
- key = w->theme_text.list[i]->key;
- value = w->theme_text.list[i]->value;
- ewl_widget_appearance_part_text_apply(w, key, value);
- }
- }
- }
- }
-
- /*
- * Create clip box if necessary
- */
- if (!w->fx_clip_box && !ewl_object_flags_get(EWL_OBJECT(w),
- EWL_FLAG_VISIBLE_NOCLIP)) {
- w->fx_clip_box = ewl_embed_object_request(emb, "rectangle");
- if (!w->fx_clip_box)
- w->fx_clip_box = evas_object_rectangle_add(emb->canvas);
-
- evas_object_pass_events_set(w->fx_clip_box, TRUE);
- }
-
- if (w->theme_object && w->fx_clip_box)
- evas_object_clip_set(w->theme_object, w->fx_clip_box);
-
- /*
- * Setup the appropriate clippings.
- */
- if (w->parent && EWL_CONTAINER(w->parent)->clip_box && w->fx_clip_box) {
- evas_object_clip_set(w->fx_clip_box,
- EWL_CONTAINER(w->parent)->clip_box);
- evas_object_show(EWL_CONTAINER(w->parent)->clip_box);
- }
-
- /*
- * Set the layer of the clip box and theme object
- */
- ewl_widget_layer_stack_add(w);
-
- if (w->parent && REVEALED(w->parent))
- ewl_widget_layer_update(w);
-
- if (w->fx_clip_box) {
- Ewl_Color_Set *color;
-
- color = ewl_attach_color_get(w);
- if (color)
- evas_object_color_set(w->fx_clip_box, color->r,
- color->g, color->b, color->a);
- }
-
- /*
- * Show the theme and clip box if widget is visible
- */
- if (VISIBLE(w)) {
- if (w->fx_clip_box) evas_object_show(w->fx_clip_box);
- if (w->theme_object) evas_object_show(w->theme_object);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ void *user_data __UNUSED__)
+{
+ Ewl_Embed *emb;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+
+ emb = ewl_embed_widget_find(w);
+ if (!emb || !emb->canvas)
+ DRETURN(DLEVEL_STABLE);
+
+ /*
+ * Increment the dnd awareness counter on the embed.
+ */
+ if (ewl_object_flags_has(EWL_OBJECT(w), EWL_FLAG_PROPERTY_DND_TARGET,
+ EWL_FLAGS_PROPERTY_MASK))
+ ewl_embed_dnd_aware_set(emb);
+
+ /*
+ * Smart Object allocation
+ */
+ if (!w->smart_object) {
+ /*
+ * Attempt to load a cached object first, fallback to adding a
+ * new one.
+ */
+ w->smart_object = ewl_embed_object_request(emb, "Ewl Widget Smart Object");
+ if (!w->smart_object) {
+ if (!widget_smart) {
+ static const Evas_Smart_Class sc = {
+ "Ewl Widget Smart Object",
+ EVAS_SMART_CLASS_VERSION,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL
+ };
+ widget_smart = evas_smart_class_new(&sc);
+ }
+ w->smart_object = evas_object_smart_add(emb->canvas, widget_smart);
+ }
+ evas_object_data_set(w->smart_object, "EWL", w);
+ }
+
+ /*
+ * No object allocated yet for this widget
+ */
+ if (!w->theme_object && w->theme_path && w->theme_group) {
+ /*
+ * Attempt to load a cached object first, fallback to adding a
+ * new one.
+ */
+ w->theme_object = ewl_embed_object_request(emb, "edje");
+ if (!w->theme_object)
+ w->theme_object = edje_object_add(emb->canvas);
+
+ /*
+ * Attempt to load the theme object
+ */
+ evas_object_repeat_events_set(w->theme_object, 1);
+ if (!edje_object_file_set(w->theme_object, w->theme_path, w->theme_group))
+ DWARNING("Error setting edje object %s, %s.",
+ w->theme_path, w->theme_group);
+
+ /*
+ * If the file failed to load, destroy the unnecessary evas
+ * object.
+ */
+ if (edje_object_load_error_get(w->theme_object)) {
+ evas_object_del(w->theme_object);
+ w->theme_object = NULL;
+ }
+
+ /*
+ * Set the state of the theme object
+ */
+ if (w->theme_state)
+ ewl_widget_state_set(w, (char *)w->theme_state,
+ EWL_STATE_PERSISTENT);
+
+ if (DISABLED(w))
+ ewl_widget_state_set(w, "disabled",
+ EWL_STATE_PERSISTENT);
+
+ /*
+ * Apply any text overrides
+ */
+ if (w->theme_object && w->theme_text.list) {
+ const char *key;
+ char *value;
+
+ if (w->theme_text.direct) {
+ key = EWL_PAIR(w->theme_text.list)->key;
+ value = EWL_PAIR(w->theme_text.list)->value;
+ ewl_widget_appearance_part_text_apply(w, key, value);
+ }
+ else {
+ unsigned int i;
+ for (i = 0; i < w->theme_text.len; i++) {
+ key = w->theme_text.list[i]->key;
+ value = w->theme_text.list[i]->value;
+ ewl_widget_appearance_part_text_apply(w, key, value);
+ }
+ }
+ }
+ }
+
+ /*
+ * Create clip box if necessary
+ */
+ if (!w->fx_clip_box && !ewl_object_flags_get(EWL_OBJECT(w),
+ EWL_FLAG_VISIBLE_NOCLIP)) {
+ w->fx_clip_box = ewl_embed_object_request(emb, "rectangle");
+ if (!w->fx_clip_box)
+ w->fx_clip_box = evas_object_rectangle_add(emb->canvas);
+
+ evas_object_pass_events_set(w->fx_clip_box, TRUE);
+ }
+
+ if (w->theme_object && w->fx_clip_box)
+ evas_object_clip_set(w->theme_object, w->fx_clip_box);
+
+ /*
+ * Setup the appropriate clippings.
+ */
+ if (w->parent && EWL_CONTAINER(w->parent)->clip_box && w->fx_clip_box) {
+ evas_object_clip_set(w->fx_clip_box,
+ EWL_CONTAINER(w->parent)->clip_box);
+ evas_object_show(EWL_CONTAINER(w->parent)->clip_box);
+ }
+
+ /*
+ * Set the layer of the clip box and theme object
+ */
+ ewl_widget_layer_stack_add(w);
+
+ if (w->parent && REVEALED(w->parent))
+ ewl_widget_layer_update(w);
+
+ if (w->fx_clip_box) {
+ Ewl_Color_Set *color;
+
+ color = ewl_attach_color_get(w);
+ if (color)
+ evas_object_color_set(w->fx_clip_box, color->r,
+ color->g, color->b, color->a);
+ }
+
+ /*
+ * Show the theme and clip box if widget is visible
+ */
+ if (VISIBLE(w)) {
+ if (w->fx_clip_box) evas_object_show(w->fx_clip_box);
+ if (w->theme_object) evas_object_show(w->theme_object);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2535,60 +2535,60 @@ ewl_widget_cb_reveal(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_widget_cb_obscure(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
-{
- Ewl_Embed *emb;
- Ewl_Container *pc;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
-
- emb = ewl_embed_widget_find(w);
- if (!emb) DRETURN(DLEVEL_STABLE);
-
- pc = EWL_CONTAINER(w->parent);
-
- /*
- * Decrement the dnd awareness counter on the embed.
- */
- if (ewl_object_flags_has(EWL_OBJECT(w), EWL_FLAG_PROPERTY_DND_TARGET,
- EWL_FLAGS_PROPERTY_MASK))
- ewl_embed_dnd_aware_remove(emb);
-
- /*
- * Remove all properties on the edje and hand it back to the embed for
- * caching.
- */
- if (w->theme_object) {
- ewl_embed_object_cache(emb, w->theme_object);
- w->theme_object = NULL;
- }
-
- /*
- * Repeat the process for the clip rect, but also hide the parent clip
- * box if there are no visible children. If we don't hide it, there
- * will be a white rectangle displayed.
- */
- if (w->fx_clip_box) {
- ewl_embed_object_cache(emb, w->fx_clip_box);
- w->fx_clip_box = NULL;
- }
-
- if (w->smart_object) {
- evas_object_data_del(w->smart_object, "EWL");
- ewl_embed_object_cache(emb, w->smart_object);
- w->smart_object = NULL;
- }
-
- /*
- * This has to happen last to be sure we've removed all clipped parts
- */
- if (pc && pc->clip_box) {
- if (!evas_object_clipees_get(pc->clip_box))
- evas_object_hide(pc->clip_box);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ void *user_data __UNUSED__)
+{
+ Ewl_Embed *emb;
+ Ewl_Container *pc;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+
+ emb = ewl_embed_widget_find(w);
+ if (!emb) DRETURN(DLEVEL_STABLE);
+
+ pc = EWL_CONTAINER(w->parent);
+
+ /*
+ * Decrement the dnd awareness counter on the embed.
+ */
+ if (ewl_object_flags_has(EWL_OBJECT(w), EWL_FLAG_PROPERTY_DND_TARGET,
+ EWL_FLAGS_PROPERTY_MASK))
+ ewl_embed_dnd_aware_remove(emb);
+
+ /*
+ * Remove all properties on the edje and hand it back to the embed for
+ * caching.
+ */
+ if (w->theme_object) {
+ ewl_embed_object_cache(emb, w->theme_object);
+ w->theme_object = NULL;
+ }
+
+ /*
+ * Repeat the process for the clip rect, but also hide the parent clip
+ * box if there are no visible children. If we don't hide it, there
+ * will be a white rectangle displayed.
+ */
+ if (w->fx_clip_box) {
+ ewl_embed_object_cache(emb, w->fx_clip_box);
+ w->fx_clip_box = NULL;
+ }
+
+ if (w->smart_object) {
+ evas_object_data_del(w->smart_object, "EWL");
+ ewl_embed_object_cache(emb, w->smart_object);
+ w->smart_object = NULL;
+ }
+
+ /*
+ * This has to happen last to be sure we've removed all clipped parts
+ */
+ if (pc && pc->clip_box) {
+ if (!evas_object_clipees_get(pc->clip_box))
+ evas_object_hide(pc->clip_box);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2601,140 +2601,140 @@ ewl_widget_cb_obscure(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_widget_cb_realize(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
-{
- int l = 0, r = 0, t = 0, b = 0;
- int i_l = 0, i_r = 0, i_t = 0, i_b = 0;
- int p_l = 0, p_r = 0, p_t = 0, p_b = 0;
- char *i = NULL;
- const char *group = NULL;
- Evas_Coord width, height;
- Ewl_Embed *emb = NULL;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- emb = ewl_embed_widget_find(w);
-
- /*
- * Retrieve the path to the theme file that will be loaded
- * return if no file to be loaded.
- */
- i = ewl_theme_image_get(w, "file");
- if (i) {
- const char *t;
-
- t = w->theme_path;
- w->theme_path = ecore_string_instance(i);
-
- /* free this after, if it's the same string we dont' want to
- * release all references on it */
- IF_RELEASE(t);
-
- } else {
- IF_RELEASE(w->theme_path);
- }
-
- /*
- * Defer group loading until the theme is loaded.
- */
- group = ewl_theme_data_str_get(w, "group");
- if (group) {
- const char *t;
-
- t = w->theme_group;
- w->theme_group = ecore_string_instance(group);
-
- /* free this after, if it's the same string we dont' want to
- * release all references on it */
- IF_RELEASE(t);
-
- } else {
- IF_RELEASE(w->theme_group);
- }
-
- IF_FREE(i);
-
- /*
- * Reveal is done in this part of the callback to avoid duplicate code
- * for creating the evas objects. Must be done in the callback so that
- * prepended callbacks in the embed can create the evas, windows,
- * etc.
- */
- ewl_widget_reveal(w);
-
- /*
- * Set up the theme object on the widgets evas
- */
- if (w->theme_object) {
- ewl_widget_theme_insets_get(w, &i_l, &i_r, &i_t, &i_b);
- ewl_widget_theme_padding_get(w, &p_l, &p_r, &p_t, &p_b);
-
- ewl_object_insets_get(EWL_OBJECT(w), &l, &r, &t, &b);
-
- /*
- * Use previously set insets and padding if available.
- */
- if (l) i_l = l;
- if (r) i_r = r;
- if (t) i_t = t;
- if (b) i_b = b;
-
- ewl_object_padding_get(EWL_OBJECT(w), &l, &r, &t, &b);
-
- if (l) p_l = l;
- if (r) p_r = r;
- if (t) p_t = t;
- if (b) p_b = b;
-
- /*
- * Assign the relevant insets and padding.
- */
- ewl_object_insets_set(EWL_OBJECT(w), i_l, i_r, i_t, i_b);
- ewl_object_padding_set(EWL_OBJECT(w), p_l, p_r, p_t, p_b);
-
- i_l = CURRENT_X(w);
- i_t = CURRENT_Y(w);
- ewl_object_x_request(EWL_OBJECT(w), i_l);
- ewl_object_y_request(EWL_OBJECT(w), i_t);
-
- /*
- * Propagate minimum sizes from the bit theme to the widget.
- */
- edje_object_size_min_get(w->theme_object, &width, &height);
- i_l = (int)(width);
- i_t = (int)(height);
-
- if (i_l > 0 && MINIMUM_W(w) == EWL_OBJECT_MIN_SIZE
- && i_l > EWL_OBJECT_MIN_SIZE
- && i_l <= EWL_OBJECT_MAX_SIZE)
- ewl_object_minimum_w_set(EWL_OBJECT(w), i_l);
-
- if (i_t > 0 && MINIMUM_H(w) == EWL_OBJECT_MIN_SIZE
- && i_t > EWL_OBJECT_MIN_SIZE
- && i_t <= EWL_OBJECT_MAX_SIZE)
- ewl_object_minimum_h_set(EWL_OBJECT(w), i_t);
-
- /*
- * Propagate maximum sizes from the bit theme to the widget.
- */
- edje_object_size_max_get(w->theme_object, &width, &height);
- i_l = (int)(width);
- i_t = (int)(height);
-
- if (i_l > 0 && MAXIMUM_W(w) == EWL_OBJECT_MAX_SIZE
- && i_l >= EWL_OBJECT_MIN_SIZE
- && i_l < EWL_OBJECT_MAX_SIZE)
- ewl_object_maximum_w_set(EWL_OBJECT(w), i_l);
-
- if (i_t > 0 && MAXIMUM_H(w) == EWL_OBJECT_MAX_SIZE
- && i_t >= EWL_OBJECT_MIN_SIZE
- && i_t < EWL_OBJECT_MAX_SIZE)
- ewl_object_maximum_h_set(EWL_OBJECT(w), i_t);
- }
-
- DRETURN(DLEVEL_STABLE);
+ void *user_data __UNUSED__)
+{
+ int l = 0, r = 0, t = 0, b = 0;
+ int i_l = 0, i_r = 0, i_t = 0, i_b = 0;
+ int p_l = 0, p_r = 0, p_t = 0, p_b = 0;
+ char *i = NULL;
+ const char *group = NULL;
+ Evas_Coord width, height;
+ Ewl_Embed *emb = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ emb = ewl_embed_widget_find(w);
+
+ /*
+ * Retrieve the path to the theme file that will be loaded
+ * return if no file to be loaded.
+ */
+ i = ewl_theme_image_get(w, "file");
+ if (i) {
+ const char *t;
+
+ t = w->theme_path;
+ w->theme_path = ecore_string_instance(i);
+
+ /* free this after, if it's the same string we dont' want to
+ * release all references on it */
+ IF_RELEASE(t);
+
+ } else {
+ IF_RELEASE(w->theme_path);
+ }
+
+ /*
+ * Defer group loading until the theme is loaded.
+ */
+ group = ewl_theme_data_str_get(w, "group");
+ if (group) {
+ const char *t;
+
+ t = w->theme_group;
+ w->theme_group = ecore_string_instance(group);
+
+ /* free this after, if it's the same string we dont' want to
+ * release all references on it */
+ IF_RELEASE(t);
+
+ } else {
+ IF_RELEASE(w->theme_group);
+ }
+
+ IF_FREE(i);
+
+ /*
+ * Reveal is done in this part of the callback to avoid duplicate code
+ * for creating the evas objects. Must be done in the callback so that
+ * prepended callbacks in the embed can create the evas, windows,
+ * etc.
+ */
+ ewl_widget_reveal(w);
+
+ /*
+ * Set up the theme object on the widgets evas
+ */
+ if (w->theme_object) {
+ ewl_widget_theme_insets_get(w, &i_l, &i_r, &i_t, &i_b);
+ ewl_widget_theme_padding_get(w, &p_l, &p_r, &p_t, &p_b);
+
+ ewl_object_insets_get(EWL_OBJECT(w), &l, &r, &t, &b);
+
+ /*
+ * Use previously set insets and padding if available.
+ */
+ if (l) i_l = l;
+ if (r) i_r = r;
+ if (t) i_t = t;
+ if (b) i_b = b;
+
+ ewl_object_padding_get(EWL_OBJECT(w), &l, &r, &t, &b);
+
+ if (l) p_l = l;
+ if (r) p_r = r;
+ if (t) p_t = t;
+ if (b) p_b = b;
+
+ /*
+ * Assign the relevant insets and padding.
+ */
+ ewl_object_insets_set(EWL_OBJECT(w), i_l, i_r, i_t, i_b);
+ ewl_object_padding_set(EWL_OBJECT(w), p_l, p_r, p_t, p_b);
+
+ i_l = CURRENT_X(w);
+ i_t = CURRENT_Y(w);
+ ewl_object_x_request(EWL_OBJECT(w), i_l);
+ ewl_object_y_request(EWL_OBJECT(w), i_t);
+
+ /*
+ * Propagate minimum sizes from the bit theme to the widget.
+ */
+ edje_object_size_min_get(w->theme_object, &width, &height);
+ i_l = (int)(width);
+ i_t = (int)(height);
+
+ if (i_l > 0 && MINIMUM_W(w) == EWL_OBJECT_MIN_SIZE
+ && i_l > EWL_OBJECT_MIN_SIZE
+ && i_l <= EWL_OBJECT_MAX_SIZE)
+ ewl_object_minimum_w_set(EWL_OBJECT(w), i_l);
+
+ if (i_t > 0 && MINIMUM_H(w) == EWL_OBJECT_MIN_SIZE
+ && i_t > EWL_OBJECT_MIN_SIZE
+ && i_t <= EWL_OBJECT_MAX_SIZE)
+ ewl_object_minimum_h_set(EWL_OBJECT(w), i_t);
+
+ /*
+ * Propagate maximum sizes from the bit theme to the widget.
+ */
+ edje_object_size_max_get(w->theme_object, &width, &height);
+ i_l = (int)(width);
+ i_t = (int)(height);
+
+ if (i_l > 0 && MAXIMUM_W(w) == EWL_OBJECT_MAX_SIZE
+ && i_l >= EWL_OBJECT_MIN_SIZE
+ && i_l < EWL_OBJECT_MAX_SIZE)
+ ewl_object_maximum_w_set(EWL_OBJECT(w), i_l);
+
+ if (i_t > 0 && MAXIMUM_H(w) == EWL_OBJECT_MAX_SIZE
+ && i_t >= EWL_OBJECT_MIN_SIZE
+ && i_t < EWL_OBJECT_MAX_SIZE)
+ ewl_object_maximum_h_set(EWL_OBJECT(w), i_t);
+ }
+
+ DRETURN(DLEVEL_STABLE);
}
/**
@@ -2747,47 +2747,47 @@ ewl_widget_cb_realize(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_widget_cb_unrealize(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (w->theme_object) {
- int i_l, i_r, i_t, i_b;
- int p_l, p_r, p_t, p_b;
- int l, r, t, b;
+ if (w->theme_object) {
+ int i_l, i_r, i_t, i_b;
+ int p_l, p_r, p_t, p_b;
+ int l, r, t, b;
- ewl_widget_theme_insets_get(w, &l, &r, &t, &b);
+ ewl_widget_theme_insets_get(w, &l, &r, &t, &b);
- ewl_object_insets_get(EWL_OBJECT(w), &i_l, &i_r, &i_t, &i_b);
- ewl_object_padding_get(EWL_OBJECT(w), &p_l, &p_r, &p_t, &p_b);
+ ewl_object_insets_get(EWL_OBJECT(w), &i_l, &i_r, &i_t, &i_b);
+ ewl_object_padding_get(EWL_OBJECT(w), &p_l, &p_r, &p_t, &p_b);
- /*
- * If the inset/padding values have been changed in code we
- * want to leave the code set values. Otherwise, if the
- * widget is using the theme set values, we reset to the
- * default of 0 for padding/insets
- */
- if (l == i_l) i_l = 0;
- if (r == i_r) i_r = 0;
- if (t == i_t) i_t = 0;
- if (b == i_b) i_b = 0;
+ /*
+ * If the inset/padding values have been changed in code we
+ * want to leave the code set values. Otherwise, if the
+ * widget is using the theme set values, we reset to the
+ * default of 0 for padding/insets
+ */
+ if (l == i_l) i_l = 0;
+ if (r == i_r) i_r = 0;
+ if (t == i_t) i_t = 0;
+ if (b == i_b) i_b = 0;
- ewl_widget_theme_padding_get(w, &l, &r, &t, &b);
- if (l == p_l) p_l = 0;
- if (r == p_r) p_r = 0;
- if (t == p_t) p_t = 0;
- if (b == p_b) p_b = 0;
+ ewl_widget_theme_padding_get(w, &l, &r, &t, &b);
+ if (l == p_l) p_l = 0;
+ if (r == p_r) p_r = 0;
+ if (t == p_t) p_t = 0;
+ if (b == p_b) p_b = 0;
- /*
- * Assign the relevant insets and padding.
- */
- ewl_object_insets_set(EWL_OBJECT(w), i_l, i_r, i_t, i_b);
- ewl_object_padding_set(EWL_OBJECT(w), p_l, p_r, p_t, p_b);
- }
+ /*
+ * Assign the relevant insets and padding.
+ */
+ ewl_object_insets_set(EWL_OBJECT(w), i_l, i_r, i_t, i_b);
+ ewl_object_padding_set(EWL_OBJECT(w), p_l, p_r, p_t, p_b);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2800,37 +2800,37 @@ ewl_widget_cb_unrealize(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_widget_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
-{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- /*
- * Adjust the clip box to display the widget.
- */
- if (w->fx_clip_box) {
- evas_object_move(w->fx_clip_box,
- CURRENT_X(w) - INSET_LEFT(w),
- CURRENT_Y(w) - INSET_TOP(w));
- evas_object_resize(w->fx_clip_box,
- CURRENT_W(w) + INSET_LEFT(w) + INSET_RIGHT(w),
- CURRENT_H(w) + INSET_TOP(w) + INSET_BOTTOM(w));
- }
-
- /*
- * Move the base theme object to the correct size and position
- */
- if (w->theme_object) {
- evas_object_move(w->theme_object,
- CURRENT_X(w) - INSET_LEFT(w),
- CURRENT_Y(w) - INSET_TOP(w));
- evas_object_resize(w->theme_object,
- CURRENT_W(w) + INSET_LEFT(w) + INSET_RIGHT(w),
- CURRENT_H(w) + INSET_TOP(w) + INSET_BOTTOM(w));
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ void *user_data __UNUSED__)
+{
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+ /*
+ * Adjust the clip box to display the widget.
+ */
+ if (w->fx_clip_box) {
+ evas_object_move(w->fx_clip_box,
+ CURRENT_X(w) - INSET_LEFT(w),
+ CURRENT_Y(w) - INSET_TOP(w));
+ evas_object_resize(w->fx_clip_box,
+ CURRENT_W(w) + INSET_LEFT(w) + INSET_RIGHT(w),
+ CURRENT_H(w) + INSET_TOP(w) + INSET_BOTTOM(w));
+ }
+
+ /*
+ * Move the base theme object to the correct size and position
+ */
+ if (w->theme_object) {
+ evas_object_move(w->theme_object,
+ CURRENT_X(w) - INSET_LEFT(w),
+ CURRENT_Y(w) - INSET_TOP(w));
+ evas_object_resize(w->theme_object,
+ CURRENT_W(w) + INSET_LEFT(w) + INSET_RIGHT(w),
+ CURRENT_H(w) + INSET_TOP(w) + INSET_BOTTOM(w));
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2843,22 +2843,22 @@ ewl_widget_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_widget_cb_reparent(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Container *pc;
+ Ewl_Container *pc;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- pc = EWL_CONTAINER(w->parent);
- if (REALIZED(w))
- ewl_widget_unrealize(w);
+ pc = EWL_CONTAINER(w->parent);
+ if (REALIZED(w))
+ ewl_widget_unrealize(w);
- if (pc && REALIZED(pc) && VISIBLE(w) && !REALIZED(w))
- ewl_realize_request(w);
+ if (pc && REALIZED(pc) && VISIBLE(w) && !REALIZED(w))
+ ewl_realize_request(w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -2872,15 +2872,15 @@ ewl_widget_cb_reparent(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_widget_cb_enable(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_widget_state_set(w, "enabled", EWL_STATE_PERSISTENT);
+ ewl_widget_state_set(w, "enabled", EWL_STATE_PERSISTENT);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2893,15 +2893,15 @@ ewl_widget_cb_enable(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_widget_cb_disable(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_widget_state_set(w, "disabled", EWL_STATE_PERSISTENT);
+ ewl_widget_state_set(w, "disabled", EWL_STATE_PERSISTENT);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2914,18 +2914,18 @@ ewl_widget_cb_disable(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_widget_cb_focus_in(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (DISABLED(w))
- DRETURN(DLEVEL_STABLE);
+ if (DISABLED(w))
+ DRETURN(DLEVEL_STABLE);
- ewl_widget_state_set(w, "focus,in", EWL_STATE_TRANSIENT);
+ ewl_widget_state_set(w, "focus,in", EWL_STATE_TRANSIENT);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2938,18 +2938,18 @@ ewl_widget_cb_focus_in(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_widget_cb_focus_out(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (DISABLED(w))
- DRETURN(DLEVEL_STABLE);
+ if (DISABLED(w))
+ DRETURN(DLEVEL_STABLE);
- ewl_widget_state_set(w, "focus,out", EWL_STATE_TRANSIENT);
+ ewl_widget_state_set(w, "focus,out", EWL_STATE_TRANSIENT);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2962,18 +2962,18 @@ ewl_widget_cb_focus_out(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_widget_cb_mouse_in(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (DISABLED(w))
- DRETURN(DLEVEL_STABLE);
+ if (DISABLED(w))
+ DRETURN(DLEVEL_STABLE);
- ewl_widget_state_set(w, "mouse,in", EWL_STATE_TRANSIENT);
+ ewl_widget_state_set(w, "mouse,in", EWL_STATE_TRANSIENT);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -2986,18 +2986,18 @@ ewl_widget_cb_mouse_in(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_widget_cb_mouse_out(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (DISABLED(w))
- DRETURN(DLEVEL_STABLE);
+ if (DISABLED(w))
+ DRETURN(DLEVEL_STABLE);
- ewl_widget_state_set(w, "mouse,out", EWL_STATE_TRANSIENT);
+ ewl_widget_state_set(w, "mouse,out", EWL_STATE_TRANSIENT);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -3010,22 +3010,22 @@ ewl_widget_cb_mouse_out(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_widget_cb_mouse_down(Ewl_Widget *w, void *ev_data,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Event_Mouse_Down *e = ev_data;
- char state[14];
+ Ewl_Event_Mouse_Down *e = ev_data;
+ char state[14];
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (DISABLED(w))
- DRETURN(DLEVEL_STABLE);
+ if (DISABLED(w))
+ DRETURN(DLEVEL_STABLE);
- snprintf(state, sizeof(state), "mouse,down,%i", e->button);
- ewl_widget_state_set(w, state, EWL_STATE_TRANSIENT);
+ snprintf(state, sizeof(state), "mouse,down,%i", e->button);
+ ewl_widget_state_set(w, state, EWL_STATE_TRANSIENT);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -3038,44 +3038,44 @@ ewl_widget_cb_mouse_down(Ewl_Widget *w, void *ev_data,
*/
void
ewl_widget_cb_mouse_up(Ewl_Widget *w, void *ev_data,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Event_Mouse_Up *e = ev_data;
- char state[14];
+ Ewl_Event_Mouse_Up *e = ev_data;
+ char state[14];
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- if (DISABLED(w))
- DRETURN(DLEVEL_STABLE);
+ if (DISABLED(w))
+ DRETURN(DLEVEL_STABLE);
- if (ewl_object_state_has(EWL_OBJECT(w), EWL_FLAG_STATE_DND)) {
- ewl_object_state_remove(EWL_OBJECT(w), EWL_FLAG_STATE_DND);
- ewl_dnd_drag_drop(w);
- }
+ if (ewl_object_state_has(EWL_OBJECT(w), EWL_FLAG_STATE_DND)) {
+ ewl_object_state_remove(EWL_OBJECT(w), EWL_FLAG_STATE_DND);
+ ewl_dnd_drag_drop(w);
+ }
- snprintf(state, sizeof(state), "mouse,up,%i", e->button);
- ewl_widget_state_set(w, state, EWL_STATE_TRANSIENT);
+ snprintf(state, sizeof(state), "mouse,up,%i", e->button);
+ ewl_widget_state_set(w, state, EWL_STATE_TRANSIENT);
- if (ewl_object_state_has(EWL_OBJECT(w), EWL_FLAG_STATE_MOUSE_IN)) {
- int x, y;
+ if (ewl_object_state_has(EWL_OBJECT(w), EWL_FLAG_STATE_MOUSE_IN)) {
+ int x, y;
- ewl_widget_state_set(w, "mouse,in", EWL_STATE_TRANSIENT);
- x = e->base.x - (CURRENT_X(w) - INSET_LEFT(w));
- y = e->base.y - (CURRENT_Y(w) - INSET_TOP(w));
- if ((x > 0) && (x < CURRENT_W(w) + INSET_HORIZONTAL(w)) &&
- (y > 0) && (y < CURRENT_H(w) + INSET_VERTICAL(w))) {
- ewl_callback_call_with_event_data(w,
- EWL_CALLBACK_CLICKED, ev_data);
- }
- else
- ewl_embed_mouse_move_feed(ewl_embed_widget_find(w),
- e->base.x, e->base.y, e->base.modifiers);
- } else
- ewl_widget_state_set(w, "mouse,out", EWL_STATE_TRANSIENT);
+ ewl_widget_state_set(w, "mouse,in", EWL_STATE_TRANSIENT);
+ x = e->base.x - (CURRENT_X(w) - INSET_LEFT(w));
+ y = e->base.y - (CURRENT_Y(w) - INSET_TOP(w));
+ if ((x > 0) && (x < CURRENT_W(w) + INSET_HORIZONTAL(w)) &&
+ (y > 0) && (y < CURRENT_H(w) + INSET_VERTICAL(w))) {
+ ewl_callback_call_with_event_data(w,
+ EWL_CALLBACK_CLICKED, ev_data);
+ }
+ else
+ ewl_embed_mouse_move_feed(ewl_embed_widget_find(w),
+ e->base.x, e->base.y, e->base.modifiers);
+ } else
+ ewl_widget_state_set(w, "mouse,out", EWL_STATE_TRANSIENT);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -3088,126 +3088,126 @@ ewl_widget_cb_mouse_up(Ewl_Widget *w, void *ev_data,
*/
void
ewl_widget_cb_mouse_move(Ewl_Widget *w, void *ev_data,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Embed *embed;
- Ewl_Object *o;
- Ewl_Event_Mouse *ev = ev_data;
+ Ewl_Embed *embed;
+ Ewl_Object *o;
+ Ewl_Event_Mouse *ev = ev_data;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- o = EWL_OBJECT(w);
+ o = EWL_OBJECT(w);
- ewl_widget_state_set(w, "mouse,move", EWL_STATE_TRANSIENT);
- if (ewl_object_state_has(o, EWL_FLAG_STATE_PRESSED) &&
- ewl_object_flags_has(o, EWL_FLAG_PROPERTY_DND_SOURCE,
- EWL_FLAGS_PROPERTY_MASK)) {
+ ewl_widget_state_set(w, "mouse,move", EWL_STATE_TRANSIENT);
+ if (ewl_object_state_has(o, EWL_FLAG_STATE_PRESSED) &&
+ ewl_object_flags_has(o, EWL_FLAG_PROPERTY_DND_SOURCE,
+ EWL_FLAGS_PROPERTY_MASK)) {
- embed = ewl_embed_widget_find(w);
- if (!ewl_object_state_has(o, EWL_FLAG_STATE_DND)) {
- ewl_object_state_add(o, EWL_FLAG_STATE_DND);
- embed->last.drag_widget = w;
- ewl_dnd_drag_start(w);
- }
+ embed = ewl_embed_widget_find(w);
+ if (!ewl_object_state_has(o, EWL_FLAG_STATE_DND)) {
+ ewl_object_state_add(o, EWL_FLAG_STATE_DND);
+ embed->last.drag_widget = w;
+ ewl_dnd_drag_start(w);
+ }
- if (ev && (ev->x > CURRENT_X(embed) &&
- ev->y > CURRENT_Y(embed) &&
- ev->x < CURRENT_X(embed) + CURRENT_W(embed) &&
- ev->y < CURRENT_Y(embed) + CURRENT_H(embed))) {
- ewl_embed_dnd_position_feed(EWL_EMBED(embed),
- ev->x, ev->y,
- NULL, NULL,
- NULL, NULL);
- }
- }
+ if (ev && (ev->x > CURRENT_X(embed) &&
+ ev->y > CURRENT_Y(embed) &&
+ ev->x < CURRENT_X(embed) + CURRENT_W(embed) &&
+ ev->y < CURRENT_Y(embed) + CURRENT_H(embed))) {
+ ewl_embed_dnd_position_feed(EWL_EMBED(embed),
+ ev->x, ev->y,
+ NULL, NULL,
+ NULL, NULL);
+ }
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_widget_theme_padding_get(Ewl_Widget *w, int *l, int *r, int *t, int *b)
{
- const char *key;
+ const char *key;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- /*
- * Read in the padding values from the edje file
- */
- key = edje_object_data_get(w->theme_object, "pad");
- if (key) {
- int val = atoi(key);
+ /*
+ * Read in the padding values from the edje file
+ */
+ key = edje_object_data_get(w->theme_object, "pad");
+ if (key) {
+ int val = atoi(key);
- if (l) *l = val;
- if (r) *r = val;
- if (t) *t = val;
- if (b) *b = val;
- }
+ if (l) *l = val;
+ if (r) *r = val;
+ if (t) *t = val;
+ if (b) *b = val;
+ }
- key = edje_object_data_get(w->theme_object, "pad/left");
- if (key && l) *l = atoi(key);
+ key = edje_object_data_get(w->theme_object, "pad/left");
+ if (key && l) *l = atoi(key);
- key = edje_object_data_get(w->theme_object, "pad/right");
- if (key && r) *r = atoi(key);
+ key = edje_object_data_get(w->theme_object, "pad/right");
+ if (key && r) *r = atoi(key);
- key = edje_object_data_get(w->theme_object, "pad/top");
- if (key && t) *t = atoi(key);
+ key = edje_object_data_get(w->theme_object, "pad/top");
+ if (key && t) *t = atoi(key);
- key = edje_object_data_get(w->theme_object, "pad/bottom");
- if (key && b) *b = atoi(key);
+ key = edje_object_data_get(w->theme_object, "pad/bottom");
+ if (key && b) *b = atoi(key);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_widget_theme_insets_get(Ewl_Widget *w, int *l, int *r, int *t, int *b)
{
- const char *key;
+ const char *key;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- /*
- * Read in the inset values from the edje file
- */
- key = edje_object_data_get(w->theme_object, "inset");
- if (key) {
- int val = atoi(key);
+ /*
+ * Read in the inset values from the edje file
+ */
+ key = edje_object_data_get(w->theme_object, "inset");
+ if (key) {
+ int val = atoi(key);
- if (l) *l = val;
- if (r) *r = val;
- if (t) *t = val;
- if (b) *b = val;
- }
+ if (l) *l = val;
+ if (r) *r = val;
+ if (t) *t = val;
+ if (b) *b = val;
+ }
- key = edje_object_data_get(w->theme_object, "inset/left");
- if (key && l) *l = atoi(key);
+ key = edje_object_data_get(w->theme_object, "inset/left");
+ if (key && l) *l = atoi(key);
- key = edje_object_data_get(w->theme_object, "inset/right");
- if (key && r) *r = atoi(key);
+ key = edje_object_data_get(w->theme_object, "inset/right");
+ if (key && r) *r = atoi(key);
- key = edje_object_data_get(w->theme_object, "inset/top");
- if (key && t) *t = atoi(key);
+ key = edje_object_data_get(w->theme_object, "inset/top");
+ if (key && t) *t = atoi(key);
- key = edje_object_data_get(w->theme_object, "inset/bottom");
- if (key && b) *b = atoi(key);
+ key = edje_object_data_get(w->theme_object, "inset/bottom");
+ if (key && b) *b = atoi(key);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_widget_name_table_shutdown(void)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- IF_FREE_HASH(ewl_widget_name_table);
+ IF_FREE_HASH(ewl_widget_name_table);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_widget.h b/src/lib/ewl_widget.h
index 688a45e..e95c570 100644
--- a/src/lib/ewl_widget.h
+++ b/src/lib/ewl_widget.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_WIDGET_H
#define EWL_WIDGET_H
@@ -41,9 +41,9 @@ typedef struct Ewl_Attach_List Ewl_Attach_List;
*/
struct Ewl_Attach_List
{
- void **list; /**< The attachment list */
- unsigned int direct:1; /**< Is this a direct pointer to an attached item */
- unsigned int len:31; /**< Number of things in the attachment list */
+ void **list; /**< The attachment list */
+ unsigned int direct:1; /**< Is this a direct pointer to an attached item */
+ unsigned int len:31; /**< Number of things in the attachment list */
};
/**
@@ -62,8 +62,8 @@ typedef struct Ewl_Pair Ewl_Pair;
*/
struct Ewl_Pair
{
- const char *key; /**< The key */
- char *value; /**< The value */
+ const char *key; /**< The key */
+ char *value; /**< The value */
};
/**
@@ -76,9 +76,9 @@ typedef struct Ewl_Pair_List Ewl_Pair_List;
*/
struct Ewl_Pair_List
{
- Ewl_Pair **list; /**< The key/value list */
- unsigned int direct:1; /**< Does this list point directly to a pair */
- unsigned int len:31; /**< Length of the list */
+ Ewl_Pair **list; /**< The key/value list */
+ unsigned int direct:1; /**< Does this list point directly to a pair */
+ unsigned int len:31; /**< Length of the list */
};
/**
@@ -91,10 +91,10 @@ typedef struct Ewl_Callback_Chain Ewl_Callback_Chain;
*/
struct Ewl_Callback_Chain
{
- void **list; /**< The callback list */
- unsigned char mask; /**< The callback mask */
- unsigned char len; /**< Length of the list */
- unsigned char index; /**< Current list index */
+ void **list; /**< The callback list */
+ unsigned char mask; /**< The callback mask */
+ unsigned char len; /**< Length of the list */
+ unsigned char index; /**< Current list index */
};
/**
@@ -107,10 +107,10 @@ typedef struct Ewl_Color_Set Ewl_Color_Set;
*/
struct Ewl_Color_Set
{
- unsigned char r, /**< The red value */
- g, /**< The green value */
- b, /**< The blue value */
- a; /**< The alpha value */
+ unsigned char r, /**< The red value */
+ g, /**< The green value */
+ b, /**< The blue value */
+ a; /**< The alpha value */
};
/**
@@ -136,121 +136,121 @@ typedef struct Ewl_Widget Ewl_Widget;
*/
struct Ewl_Widget
{
- Ewl_Object object; /**< Inherit the base Object class */
- Ewl_Widget *parent; /**< The parent widget, actually a container */
-
- Ewl_Callback_Chain callbacks[EWL_CALLBACK_MAX + 1];
- /**< Callback chain array */
- Ewl_Attach_List *attach; /**< List of attachments on the widget */
-
- void *smart_object; /**< Smart Object for the layer stuff */
- void *fx_clip_box; /**< Clipping rectangle of widget */
-
- void *theme_object; /**< Appearance shown on canvas */
- const char *theme_path; /**< Path to the file for loading */
- const char *theme_group; /**< Group in theme to use */
- const char *theme_state; /**< State of the appearance */
- const char *appearance; /**< Key to lookup appearance in theme */
- const char *inheritance; /**< Inheritance of path widget */
- int layer; /**< the layer relative to the parent */
-
- Ecore_Hash *theme; /**< Overriding theme settings */
- Ewl_Pair_List theme_text; /**< Overriding text in theme */
-
- unsigned char toplayered:1; /**< Indicates if the widget should
- be on the top of the layer stack */
- unsigned char unmanaged:1;
+ Ewl_Object object; /**< Inherit the base Object class */
+ Ewl_Widget *parent; /**< The parent widget, actually a container */
+
+ Ewl_Callback_Chain callbacks[EWL_CALLBACK_MAX + 1];
+ /**< Callback chain array */
+ Ewl_Attach_List *attach; /**< List of attachments on the widget */
+
+ void *smart_object; /**< Smart Object for the layer stuff */
+ void *fx_clip_box; /**< Clipping rectangle of widget */
+
+ void *theme_object; /**< Appearance shown on canvas */
+ const char *theme_path; /**< Path to the file for loading */
+ const char *theme_group; /**< Group in theme to use */
+ const char *theme_state; /**< State of the appearance */
+ const char *appearance; /**< Key to lookup appearance in theme */
+ const char *inheritance; /**< Inheritance of path widget */
+ int layer; /**< the layer relative to the parent */
+
+ Ecore_Hash *theme; /**< Overriding theme settings */
+ Ewl_Pair_List theme_text; /**< Overriding text in theme */
+
+ unsigned char toplayered:1; /**< Indicates if the widget should
+ be on the top of the layer stack */
+ unsigned char unmanaged:1;
};
-Ewl_Widget *ewl_widget_new(void);
-int ewl_widget_init(Ewl_Widget *w);
-void ewl_widget_free(Ewl_Widget *w);
-
-void ewl_widget_name_set(Ewl_Widget *w, const char *name);
-const char *ewl_widget_name_get(Ewl_Widget *w);
-Ewl_Widget *ewl_widget_name_find(const char *name);
-
-void ewl_widget_reparent(Ewl_Widget *widget);
-void ewl_widget_realize(Ewl_Widget *widget);
-void ewl_widget_unrealize(Ewl_Widget *w);
-void ewl_widget_reveal(Ewl_Widget *w);
-void ewl_widget_obscure(Ewl_Widget *w);
-void ewl_widget_show(Ewl_Widget *widget);
-void ewl_widget_hide(Ewl_Widget *widget);
-void ewl_widget_destroy(Ewl_Widget *widget);
-void ewl_widget_configure(Ewl_Widget *widget);
-
-void ewl_widget_data_set(Ewl_Widget *w, void *k, void *v);
-void *ewl_widget_data_del(Ewl_Widget *w, void *k);
-void *ewl_widget_data_get(Ewl_Widget *w, void *k);
-
-void ewl_widget_state_set(Ewl_Widget *w, const char *state,
- Ewl_State_Type flag);
-
-void ewl_widget_appearance_set(Ewl_Widget *w, const char *appearance);
-char *ewl_widget_appearance_get(Ewl_Widget *w);
-char *ewl_widget_appearance_path_get(Ewl_Widget *w);
-int ewl_widget_appearance_path_size_get(Ewl_Widget *w);
-int ewl_widget_appearance_path_copy(Ewl_Widget *w, char *buf,
- int size);
-void ewl_widget_appearance_part_text_set(Ewl_Widget *w, const char *part,
- const char *text);
-const char *ewl_widget_appearance_part_text_get(Ewl_Widget *w, const char *part);
-void ewl_widget_appearance_text_set(Ewl_Widget *w, const char *text);
-const char *ewl_widget_appearance_text_get(Ewl_Widget *w);
-
-void ewl_widget_inherit(Ewl_Widget *widget, const char *type);
-
-unsigned int ewl_widget_type_is(Ewl_Widget *widget, const char *type);
-unsigned int ewl_widget_onscreen_is(Ewl_Widget *widget);
-
-void ewl_widget_parent_set(Ewl_Widget *w, Ewl_Widget *p);
-Ewl_Widget *ewl_widget_parent_get(Ewl_Widget *w);
-
-void ewl_widget_enable(Ewl_Widget *w);
-void ewl_widget_disable(Ewl_Widget *w);
-
-void ewl_widget_print(Ewl_Widget *w);
-void ewl_widget_print_verbose(Ewl_Widget *w);
-void ewl_widget_tree_print(Ewl_Widget *w);
-
-void ewl_widget_layer_top_set(Ewl_Widget *w, int top);
-int ewl_widget_layer_top_get(Ewl_Widget *w);
-void ewl_widget_layer_priority_set(Ewl_Widget *w, int layer);
-int ewl_widget_layer_priority_get(Ewl_Widget *w);
-
-void ewl_widget_internal_set(Ewl_Widget *w, unsigned int val);
+Ewl_Widget *ewl_widget_new(void);
+int ewl_widget_init(Ewl_Widget *w);
+void ewl_widget_free(Ewl_Widget *w);
+
+void ewl_widget_name_set(Ewl_Widget *w, const char *name);
+const char *ewl_widget_name_get(Ewl_Widget *w);
+Ewl_Widget *ewl_widget_name_find(const char *name);
+
+void ewl_widget_reparent(Ewl_Widget *widget);
+void ewl_widget_realize(Ewl_Widget *widget);
+void ewl_widget_unrealize(Ewl_Widget *w);
+void ewl_widget_reveal(Ewl_Widget *w);
+void ewl_widget_obscure(Ewl_Widget *w);
+void ewl_widget_show(Ewl_Widget *widget);
+void ewl_widget_hide(Ewl_Widget *widget);
+void ewl_widget_destroy(Ewl_Widget *widget);
+void ewl_widget_configure(Ewl_Widget *widget);
+
+void ewl_widget_data_set(Ewl_Widget *w, void *k, void *v);
+void *ewl_widget_data_del(Ewl_Widget *w, void *k);
+void *ewl_widget_data_get(Ewl_Widget *w, void *k);
+
+void ewl_widget_state_set(Ewl_Widget *w, const char *state,
+ Ewl_State_Type flag);
+
+void ewl_widget_appearance_set(Ewl_Widget *w, const char *appearance);
+char *ewl_widget_appearance_get(Ewl_Widget *w);
+char *ewl_widget_appearance_path_get(Ewl_Widget *w);
+int ewl_widget_appearance_path_size_get(Ewl_Widget *w);
+int ewl_widget_appearance_path_copy(Ewl_Widget *w, char *buf,
+ int size);
+void ewl_widget_appearance_part_text_set(Ewl_Widget *w, const char *part,
+ const char *text);
+const char *ewl_widget_appearance_part_text_get(Ewl_Widget *w, const char *part);
+void ewl_widget_appearance_text_set(Ewl_Widget *w, const char *text);
+const char *ewl_widget_appearance_text_get(Ewl_Widget *w);
+
+void ewl_widget_inherit(Ewl_Widget *widget, const char *type);
+
+unsigned int ewl_widget_type_is(Ewl_Widget *widget, const char *type);
+unsigned int ewl_widget_onscreen_is(Ewl_Widget *widget);
+
+void ewl_widget_parent_set(Ewl_Widget *w, Ewl_Widget *p);
+Ewl_Widget *ewl_widget_parent_get(Ewl_Widget *w);
+
+void ewl_widget_enable(Ewl_Widget *w);
+void ewl_widget_disable(Ewl_Widget *w);
+
+void ewl_widget_print(Ewl_Widget *w);
+void ewl_widget_print_verbose(Ewl_Widget *w);
+void ewl_widget_tree_print(Ewl_Widget *w);
+
+void ewl_widget_layer_top_set(Ewl_Widget *w, int top);
+int ewl_widget_layer_top_get(Ewl_Widget *w);
+void ewl_widget_layer_priority_set(Ewl_Widget *w, int layer);
+int ewl_widget_layer_priority_get(Ewl_Widget *w);
+
+void ewl_widget_internal_set(Ewl_Widget *w, unsigned int val);
unsigned int ewl_widget_internal_is(Ewl_Widget *w);
-void ewl_widget_unmanaged_set(Ewl_Widget *w, unsigned int val);
+void ewl_widget_unmanaged_set(Ewl_Widget *w, unsigned int val);
unsigned int ewl_widget_unmanaged_is(Ewl_Widget *w);
-void ewl_widget_clipped_set(Ewl_Widget *w, unsigned int val);
+void ewl_widget_clipped_set(Ewl_Widget *w, unsigned int val);
unsigned int ewl_widget_clipped_is(Ewl_Widget *w);
-void ewl_widget_focus_send(Ewl_Widget *w);
-Ewl_Widget *ewl_widget_focused_get(void);
+void ewl_widget_focus_send(Ewl_Widget *w);
+Ewl_Widget *ewl_widget_focused_get(void);
-void ewl_widget_tab_order_append(Ewl_Widget *w);
-void ewl_widget_tab_order_prepend(Ewl_Widget *w);
-void ewl_widget_tab_order_insert(Ewl_Widget *w, unsigned int idx);
-void ewl_widget_tab_order_insert_before(Ewl_Widget *w, Ewl_Widget *before);
-void ewl_widget_tab_order_insert_after(Ewl_Widget *w, Ewl_Widget *after);
-void ewl_widget_tab_order_remove(Ewl_Widget *w);
+void ewl_widget_tab_order_append(Ewl_Widget *w);
+void ewl_widget_tab_order_prepend(Ewl_Widget *w);
+void ewl_widget_tab_order_insert(Ewl_Widget *w, unsigned int idx);
+void ewl_widget_tab_order_insert_before(Ewl_Widget *w, Ewl_Widget *before);
+void ewl_widget_tab_order_insert_after(Ewl_Widget *w, Ewl_Widget *after);
+void ewl_widget_tab_order_remove(Ewl_Widget *w);
-void ewl_widget_focusable_set(Ewl_Widget *w, unsigned int val);
-unsigned int ewl_widget_focusable_get(Ewl_Widget *w);
+void ewl_widget_focusable_set(Ewl_Widget *w, unsigned int val);
+unsigned int ewl_widget_focusable_get(Ewl_Widget *w);
-void ewl_widget_ignore_focus_change_set(Ewl_Widget *w, unsigned int val);
-unsigned int ewl_widget_ignore_focus_change_get(Ewl_Widget *w);
+void ewl_widget_ignore_focus_change_set(Ewl_Widget *w, unsigned int val);
+unsigned int ewl_widget_ignore_focus_change_get(Ewl_Widget *w);
-void ewl_widget_color_set(Ewl_Widget *w, unsigned int r, unsigned int g,
- unsigned int b, unsigned int a);
-void ewl_widget_color_get(Ewl_Widget *w, unsigned int *r, unsigned int *g,
- unsigned int *b, unsigned int *a);
+void ewl_widget_color_set(Ewl_Widget *w, unsigned int r, unsigned int g,
+ unsigned int b, unsigned int a);
+void ewl_widget_color_get(Ewl_Widget *w, unsigned int *r, unsigned int *g,
+ unsigned int *b, unsigned int *a);
-int ewl_widget_parent_of(Ewl_Widget *c, Ewl_Widget *w);
+int ewl_widget_parent_of(Ewl_Widget *c, Ewl_Widget *w);
#define UNMANAGED(w) (((const Ewl_Widget *)(w))->unmanaged)
diff --git a/src/lib/ewl_window.c b/src/lib/ewl_window.c
index 3bb2653..8facae8 100644
--- a/src/lib/ewl_window.c
+++ b/src/lib/ewl_window.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_private.h"
#include "ewl_macros.h"
@@ -15,20 +15,20 @@ unsigned int EWL_CALLBACK_DELETE_WINDOW = 0;
Ewl_Widget *
ewl_window_new(void)
{
- Ewl_Window *w;
+ Ewl_Window *w;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- w = NEW(Ewl_Window, 1);
- if (!w)
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ w = NEW(Ewl_Window, 1);
+ if (!w)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_window_init(w)) {
- ewl_widget_destroy(EWL_WIDGET(w));
- w = NULL;
- }
+ if (!ewl_window_init(w)) {
+ ewl_widget_destroy(EWL_WIDGET(w));
+ w = NULL;
+ }
- DRETURN_PTR(EWL_WIDGET(w), DLEVEL_STABLE);
+ DRETURN_PTR(EWL_WIDGET(w), DLEVEL_STABLE);
}
/**
@@ -41,43 +41,43 @@ ewl_window_new(void)
int
ewl_window_init(Ewl_Window *w)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(w, FALSE);
-
- /*
- * Initialize the fields of the inherited container class
- */
- if (!ewl_embed_init(EWL_EMBED(w)))
- DRETURN_INT(FALSE, DLEVEL_STABLE);
-
- ewl_widget_appearance_set(EWL_WIDGET(w), EWL_WINDOW_TYPE);
- ewl_widget_inherit(EWL_WIDGET(w), EWL_WINDOW_TYPE);
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_FILL);
-
- ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_REALIZE,
- ewl_window_cb_realize, NULL);
- ewl_callback_append(EWL_WIDGET(w), EWL_CALLBACK_REALIZE,
- ewl_window_cb_postrealize, NULL);
- ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_UNREALIZE,
- ewl_window_cb_unrealize, NULL);
- ewl_callback_append(EWL_WIDGET(w), EWL_CALLBACK_SHOW,
- ewl_window_cb_show, NULL);
- ewl_callback_append(EWL_WIDGET(w), EWL_CALLBACK_EXPOSE,
- ewl_window_cb_expose, NULL);
- ewl_callback_append(EWL_WIDGET(w), EWL_CALLBACK_HIDE,
- ewl_window_cb_hide, NULL);
- ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_DESTROY,
- ewl_window_cb_destroy, NULL);
- /*
- * Override the default configure callbacks since the window
- * has special needs for placement.
- */
- ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_CONFIGURE,
- ewl_window_cb_configure, NULL);
-
- ecore_list_append(ewl_window_list, w);
-
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(w, FALSE);
+
+ /*
+ * Initialize the fields of the inherited container class
+ */
+ if (!ewl_embed_init(EWL_EMBED(w)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ ewl_widget_appearance_set(EWL_WIDGET(w), EWL_WINDOW_TYPE);
+ ewl_widget_inherit(EWL_WIDGET(w), EWL_WINDOW_TYPE);
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_FILL);
+
+ ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_REALIZE,
+ ewl_window_cb_realize, NULL);
+ ewl_callback_append(EWL_WIDGET(w), EWL_CALLBACK_REALIZE,
+ ewl_window_cb_postrealize, NULL);
+ ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_UNREALIZE,
+ ewl_window_cb_unrealize, NULL);
+ ewl_callback_append(EWL_WIDGET(w), EWL_CALLBACK_SHOW,
+ ewl_window_cb_show, NULL);
+ ewl_callback_append(EWL_WIDGET(w), EWL_CALLBACK_EXPOSE,
+ ewl_window_cb_expose, NULL);
+ ewl_callback_append(EWL_WIDGET(w), EWL_CALLBACK_HIDE,
+ ewl_window_cb_hide, NULL);
+ ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_DESTROY,
+ ewl_window_cb_destroy, NULL);
+ /*
+ * Override the default configure callbacks since the window
+ * has special needs for placement.
+ */
+ ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_CONFIGURE,
+ ewl_window_cb_configure, NULL);
+
+ ecore_list_append(ewl_window_list, w);
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -88,17 +88,17 @@ ewl_window_init(Ewl_Window *w)
Ewl_Window *
ewl_window_window_find(void *window)
{
- Ewl_Window *retwin;
+ Ewl_Window *retwin;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(window, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(window, NULL);
- ecore_list_first_goto(ewl_window_list);
- while ((retwin = ecore_list_next(ewl_window_list)))
- if (retwin->window == window)
- DRETURN_PTR(retwin, DLEVEL_STABLE);
+ ecore_list_first_goto(ewl_window_list);
+ while ((retwin = ecore_list_next(ewl_window_list)))
+ if (retwin->window == window)
+ DRETURN_PTR(retwin, DLEVEL_STABLE);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
}
/**
@@ -113,18 +113,18 @@ ewl_window_window_find(void *window)
void
ewl_window_title_set(Ewl_Window *win, const char *title)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if ((!title) || (!win->title) || (strcmp(win->title, title))) {
- IF_FREE(win->title);
- win->title = ((title && *title) ? strdup(title) : NULL);
- }
+ if ((!title) || (!win->title) || (strcmp(win->title, title))) {
+ IF_FREE(win->title);
+ win->title = ((title && *title) ? strdup(title) : NULL);
+ }
- ewl_engine_window_title_set(win);
+ ewl_engine_window_title_set(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -138,11 +138,11 @@ ewl_window_title_set(Ewl_Window *win, const char *title)
const char *
ewl_window_title_get(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(win, NULL);
- DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(win, NULL);
+ DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, NULL);
- DRETURN_PTR(win->title, DLEVEL_STABLE);
+ DRETURN_PTR(win->title, DLEVEL_STABLE);
}
/**
@@ -157,18 +157,18 @@ ewl_window_title_get(Ewl_Window *win)
void
ewl_window_name_set(Ewl_Window *win, const char *name)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if ((!name) || (!win->name) || (strcmp(win->name, name))) {
- IF_FREE(win->name);
- win->name = ((name && *name) ? strdup(name) : NULL);
- }
+ if ((!name) || (!win->name) || (strcmp(win->name, name))) {
+ IF_FREE(win->name);
+ win->name = ((name && *name) ? strdup(name) : NULL);
+ }
- ewl_engine_window_name_class_set(win);
+ ewl_engine_window_name_class_set(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -182,11 +182,11 @@ ewl_window_name_set(Ewl_Window *win, const char *name)
const char *
ewl_window_name_get(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(win, NULL);
- DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(win, NULL);
+ DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, NULL);
- DRETURN_PTR(win->name, DLEVEL_STABLE);
+ DRETURN_PTR(win->name, DLEVEL_STABLE);
}
/**
@@ -201,21 +201,21 @@ ewl_window_name_get(Ewl_Window *win)
void
ewl_window_class_set(Ewl_Window *win, const char *classname)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if ((!classname) || (!win->classname)
- || (strcmp(win->classname, classname)))
- {
- IF_FREE(win->classname);
- win->classname = ((classname && *classname) ?
- strdup(classname) : NULL);
- }
+ if ((!classname) || (!win->classname)
+ || (strcmp(win->classname, classname)))
+ {
+ IF_FREE(win->classname);
+ win->classname = ((classname && *classname) ?
+ strdup(classname) : NULL);
+ }
- ewl_engine_window_name_class_set(win);
+ ewl_engine_window_name_class_set(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -229,11 +229,11 @@ ewl_window_class_set(Ewl_Window *win, const char *classname)
const char *
ewl_window_class_get(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(win, NULL);
- DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(win, NULL);
+ DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, NULL);
- DRETURN_PTR(win->classname, DLEVEL_STABLE);
+ DRETURN_PTR(win->classname, DLEVEL_STABLE);
}
/**
@@ -247,24 +247,24 @@ ewl_window_class_get(Ewl_Window *win)
void
ewl_window_borderless_set(Ewl_Window *win, unsigned int border)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- border = !!border;
+ border = !!border;
- /* do nothing if already set */
- if (border == ewl_window_borderless_get(win))
- DRETURN(DLEVEL_STABLE);
+ /* do nothing if already set */
+ if (border == ewl_window_borderless_get(win))
+ DRETURN(DLEVEL_STABLE);
- if (border) win->flags |= EWL_WINDOW_BORDERLESS;
- else win->flags &= ~EWL_WINDOW_BORDERLESS;
+ if (border) win->flags |= EWL_WINDOW_BORDERLESS;
+ else win->flags &= ~EWL_WINDOW_BORDERLESS;
- ewl_engine_window_borderless_set(win);
- ewl_widget_unrealize(EWL_WIDGET(win));
- ewl_widget_realize(EWL_WIDGET(win));
+ ewl_engine_window_borderless_set(win);
+ ewl_widget_unrealize(EWL_WIDGET(win));
+ ewl_widget_realize(EWL_WIDGET(win));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -275,11 +275,11 @@ ewl_window_borderless_set(Ewl_Window *win, unsigned int border)
unsigned int
ewl_window_borderless_get(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(win, FALSE);
- DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(win, FALSE);
+ DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
- DRETURN_INT(!!(win->flags & EWL_WINDOW_BORDERLESS), DLEVEL_STABLE);
+ DRETURN_INT(!!(win->flags & EWL_WINDOW_BORDERLESS), DLEVEL_STABLE);
}
/**
@@ -293,22 +293,22 @@ ewl_window_borderless_get(Ewl_Window *win)
void
ewl_window_dialog_set(Ewl_Window *win, int dialog)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- /* do nothing if already set */
- if (dialog == ewl_window_dialog_get(win))
- DRETURN(DLEVEL_STABLE);
+ /* do nothing if already set */
+ if (dialog == ewl_window_dialog_get(win))
+ DRETURN(DLEVEL_STABLE);
- if (dialog)
- win->flags |= EWL_WINDOW_DIALOG;
- else
- win->flags &= ~EWL_WINDOW_DIALOG;
+ if (dialog)
+ win->flags |= EWL_WINDOW_DIALOG;
+ else
+ win->flags &= ~EWL_WINDOW_DIALOG;
- ewl_engine_window_dialog_set(win);
+ ewl_engine_window_dialog_set(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -319,11 +319,11 @@ ewl_window_dialog_set(Ewl_Window *win, int dialog)
int
ewl_window_dialog_get(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(win, FALSE);
- DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(win, FALSE);
+ DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
- DRETURN_INT((!!(win->flags & EWL_WINDOW_DIALOG)), DLEVEL_STABLE);
+ DRETURN_INT((!!(win->flags & EWL_WINDOW_DIALOG)), DLEVEL_STABLE);
}
@@ -336,22 +336,22 @@ ewl_window_dialog_get(Ewl_Window *win)
void
ewl_window_fullscreen_set(Ewl_Window *win, unsigned int fullscreen)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- /* do nothing if already set */
- if (fullscreen == ewl_window_fullscreen_get(win))
- DRETURN(DLEVEL_STABLE);
+ /* do nothing if already set */
+ if (fullscreen == ewl_window_fullscreen_get(win))
+ DRETURN(DLEVEL_STABLE);
- if (fullscreen)
- win->flags |= EWL_WINDOW_FULLSCREEN;
- else
- win->flags &= ~EWL_WINDOW_FULLSCREEN;
+ if (fullscreen)
+ win->flags |= EWL_WINDOW_FULLSCREEN;
+ else
+ win->flags &= ~EWL_WINDOW_FULLSCREEN;
- ewl_engine_window_states_set(win);
+ ewl_engine_window_states_set(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -362,11 +362,11 @@ ewl_window_fullscreen_set(Ewl_Window *win, unsigned int fullscreen)
unsigned int
ewl_window_fullscreen_get(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(win, FALSE);
- DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(win, FALSE);
+ DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
- DRETURN_INT((!!(win->flags & EWL_WINDOW_FULLSCREEN)), DLEVEL_STABLE);
+ DRETURN_INT((!!(win->flags & EWL_WINDOW_FULLSCREEN)), DLEVEL_STABLE);
}
/**
@@ -378,38 +378,38 @@ ewl_window_fullscreen_get(Ewl_Window *win)
void
ewl_window_skip_taskbar_set(Ewl_Window *win, unsigned int skip)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- /* do nothing if already set */
- if (skip == ewl_window_skip_taskbar_get(win))
- DRETURN(DLEVEL_STABLE);
+ /* do nothing if already set */
+ if (skip == ewl_window_skip_taskbar_get(win))
+ DRETURN(DLEVEL_STABLE);
- if (skip)
- win->flags |= EWL_WINDOW_SKIP_TASKBAR;
- else
- win->flags &= ~EWL_WINDOW_SKIP_TASKBAR;
+ if (skip)
+ win->flags |= EWL_WINDOW_SKIP_TASKBAR;
+ else
+ win->flags &= ~EWL_WINDOW_SKIP_TASKBAR;
- ewl_engine_window_states_set(win);
+ ewl_engine_window_states_set(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
* @param win: The window to work with
* @return Returns TRUE if the window is to be skipped for the taskbar,
- * FALSE otherwise
+ * FALSE otherwise
* @brief Retrieve the skip taskbar setting for the window
*/
unsigned int
ewl_window_skip_taskbar_get(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(win, FALSE);
- DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(win, FALSE);
+ DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
- DRETURN_INT((!!(win->flags & EWL_WINDOW_SKIP_TASKBAR)), DLEVEL_STABLE);
+ DRETURN_INT((!!(win->flags & EWL_WINDOW_SKIP_TASKBAR)), DLEVEL_STABLE);
}
/**
@@ -421,38 +421,38 @@ ewl_window_skip_taskbar_get(Ewl_Window *win)
void
ewl_window_skip_pager_set(Ewl_Window *win, unsigned int skip)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- /* do nothing if already set */
- if (skip == ewl_window_skip_pager_get(win))
- DRETURN(DLEVEL_STABLE);
+ /* do nothing if already set */
+ if (skip == ewl_window_skip_pager_get(win))
+ DRETURN(DLEVEL_STABLE);
- if (skip)
- win->flags |= EWL_WINDOW_SKIP_PAGER;
- else
- win->flags &= ~EWL_WINDOW_SKIP_PAGER;
+ if (skip)
+ win->flags |= EWL_WINDOW_SKIP_PAGER;
+ else
+ win->flags &= ~EWL_WINDOW_SKIP_PAGER;
- ewl_engine_window_states_set(win);
+ ewl_engine_window_states_set(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
* @param win: The window to work with
* @return Returns TRUE if the window is to be skipped for the pager,
- * FALSE otherwise
+ * FALSE otherwise
* @brief Retrieve the skip pager setting for the window
*/
unsigned int
ewl_window_skip_pager_get(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(win, FALSE);
- DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(win, FALSE);
+ DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
- DRETURN_INT((!!(win->flags & EWL_WINDOW_SKIP_PAGER)), DLEVEL_STABLE);
+ DRETURN_INT((!!(win->flags & EWL_WINDOW_SKIP_PAGER)), DLEVEL_STABLE);
}
/**
@@ -468,16 +468,16 @@ ewl_window_skip_pager_get(Ewl_Window *win)
void
ewl_window_move(Ewl_Window *win, int x, int y)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- EWL_EMBED(win)->x = x;
- EWL_EMBED(win)->y = y;
+ EWL_EMBED(win)->x = x;
+ EWL_EMBED(win)->y = y;
- ewl_engine_window_move(win);
+ ewl_engine_window_move(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -490,13 +490,13 @@ ewl_window_move(Ewl_Window *win, int x, int y)
void
ewl_window_raise(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ewl_engine_window_raise(win);
+ ewl_engine_window_raise(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -509,13 +509,13 @@ ewl_window_raise(Ewl_Window *win)
void
ewl_window_lower(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- ewl_engine_window_lower(win);
+ ewl_engine_window_lower(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -532,14 +532,14 @@ ewl_window_lower(Ewl_Window *win)
void
ewl_window_attention_demand(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- win->flags |= EWL_WINDOW_DEMANDS_ATTENTION;
- ewl_engine_window_states_set(win);
+ win->flags |= EWL_WINDOW_DEMANDS_ATTENTION;
+ ewl_engine_window_states_set(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -557,18 +557,18 @@ ewl_window_attention_demand(Ewl_Window *win)
void
ewl_window_urgent_set(Ewl_Window *win, unsigned int urgent)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (urgent)
- win->flags |= EWL_WINDOW_URGENT;
- else
- win->flags &= ~EWL_WINDOW_URGENT;
+ if (urgent)
+ win->flags |= EWL_WINDOW_URGENT;
+ else
+ win->flags &= ~EWL_WINDOW_URGENT;
- ewl_engine_window_hints_set(win);
+ ewl_engine_window_hints_set(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -579,11 +579,11 @@ ewl_window_urgent_set(Ewl_Window *win, unsigned int urgent)
unsigned int
ewl_window_urgent_get(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(win, FALSE);
- DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(win, FALSE);
+ DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
- DRETURN_INT(!!(win->flags & EWL_WINDOW_URGENT), DLEVEL_STABLE);
+ DRETURN_INT(!!(win->flags & EWL_WINDOW_URGENT), DLEVEL_STABLE);
}
/**
@@ -595,37 +595,37 @@ ewl_window_urgent_get(Ewl_Window *win)
void
ewl_window_transient_for(Ewl_Window *win, Ewl_Window *forwin)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- DCHECK_TYPE(forwin, EWL_WINDOW_TYPE);
-
- win->transient.ewl = forwin;
- win->flags &= ~EWL_WINDOW_TRANSIENT_FOREIGN;
-
- /* if there is no forwin remove the transient for state
- * and update the window, if it already exists */
- if (!forwin) {
- win->flags &= ~EWL_WINDOW_TRANSIENT;
- if (win->window)
- ewl_engine_window_transient_for(win);
-
- DRETURN(DLEVEL_STABLE);
- }
-
- win->flags |= EWL_WINDOW_TRANSIENT;
-
- if (win->window) {
- if (forwin->window)
- ewl_engine_window_transient_for(win);
- else
- ewl_callback_append(EWL_WIDGET(forwin),
- EWL_CALLBACK_REALIZE,
- ewl_window_cb_realize_parent,
- win);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DCHECK_TYPE(forwin, EWL_WINDOW_TYPE);
+
+ win->transient.ewl = forwin;
+ win->flags &= ~EWL_WINDOW_TRANSIENT_FOREIGN;
+
+ /* if there is no forwin remove the transient for state
+ * and update the window, if it already exists */
+ if (!forwin) {
+ win->flags &= ~EWL_WINDOW_TRANSIENT;
+ if (win->window)
+ ewl_engine_window_transient_for(win);
+
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ win->flags |= EWL_WINDOW_TRANSIENT;
+
+ if (win->window) {
+ if (forwin->window)
+ ewl_engine_window_transient_for(win);
+ else
+ ewl_callback_append(EWL_WIDGET(forwin),
+ EWL_CALLBACK_REALIZE,
+ ewl_window_cb_realize_parent,
+ win);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -637,18 +637,18 @@ ewl_window_transient_for(Ewl_Window *win, Ewl_Window *forwin)
void
ewl_window_transient_for_foreign(Ewl_Window *win, Ewl_Embed_Window *forwin)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- win->transient.foreign = forwin;
- win->flags |= EWL_WINDOW_TRANSIENT_FOREIGN;
- win->flags &= ~EWL_WINDOW_TRANSIENT;
+ win->transient.foreign = forwin;
+ win->flags |= EWL_WINDOW_TRANSIENT_FOREIGN;
+ win->flags &= ~EWL_WINDOW_TRANSIENT;
- if (win->window)
- ewl_engine_window_transient_for(win);
+ if (win->window)
+ ewl_engine_window_transient_for(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -660,41 +660,41 @@ ewl_window_transient_for_foreign(Ewl_Window *win, Ewl_Embed_Window *forwin)
void
ewl_window_leader_set(Ewl_Window *win, Ewl_Window *leader)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- DCHECK_TYPE(leader, EWL_WINDOW_TYPE);
-
- win->leader.ewl = leader;
- win->flags &= ~EWL_WINDOW_LEADER_FOREIGN;
-
- /* if there is no leader remove the leader for state
- * and update the window, if it already exists */
- if (!leader) {
- win->flags &= ~EWL_WINDOW_LEADER;
- if (win->window) {
- ewl_engine_window_leader_set(win);
- ewl_engine_window_hints_set(win);
- }
-
- DRETURN(DLEVEL_STABLE);
- }
-
- win->flags |= EWL_WINDOW_LEADER;
-
- if (win->window) {
- if (leader->window) {
- ewl_engine_window_leader_set(win);
- ewl_engine_window_hints_set(win);
- }
- else
- ewl_callback_append(EWL_WIDGET(leader),
- EWL_CALLBACK_REALIZE,
- ewl_window_cb_realize_parent,
- win);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DCHECK_TYPE(leader, EWL_WINDOW_TYPE);
+
+ win->leader.ewl = leader;
+ win->flags &= ~EWL_WINDOW_LEADER_FOREIGN;
+
+ /* if there is no leader remove the leader for state
+ * and update the window, if it already exists */
+ if (!leader) {
+ win->flags &= ~EWL_WINDOW_LEADER;
+ if (win->window) {
+ ewl_engine_window_leader_set(win);
+ ewl_engine_window_hints_set(win);
+ }
+
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ win->flags |= EWL_WINDOW_LEADER;
+
+ if (win->window) {
+ if (leader->window) {
+ ewl_engine_window_leader_set(win);
+ ewl_engine_window_hints_set(win);
+ }
+ else
+ ewl_callback_append(EWL_WIDGET(leader),
+ EWL_CALLBACK_REALIZE,
+ ewl_window_cb_realize_parent,
+ win);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -706,26 +706,26 @@ ewl_window_leader_set(Ewl_Window *win, Ewl_Window *leader)
void
ewl_window_leader_foreign_set(Ewl_Window *win, Ewl_Embed_Window *leader)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
-
- win->leader.foreign = leader;
- win->flags &= ~EWL_WINDOW_LEADER;
-
- /* if there is no leader remove the leader for state
- * and update the window, if it already exists */
- if (!leader)
- win->flags &= ~EWL_WINDOW_LEADER_FOREIGN;
- else
- win->flags |= EWL_WINDOW_LEADER_FOREIGN;
-
- if (win->window) {
- ewl_engine_window_leader_set(win);
- ewl_engine_window_hints_set(win);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+
+ win->leader.foreign = leader;
+ win->flags &= ~EWL_WINDOW_LEADER;
+
+ /* if there is no leader remove the leader for state
+ * and update the window, if it already exists */
+ if (!leader)
+ win->flags &= ~EWL_WINDOW_LEADER_FOREIGN;
+ else
+ win->flags |= EWL_WINDOW_LEADER_FOREIGN;
+
+ if (win->window) {
+ ewl_engine_window_leader_set(win);
+ ewl_engine_window_hints_set(win);
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -739,14 +739,14 @@ ewl_window_leader_foreign_set(Ewl_Window *win, Ewl_Embed_Window *leader)
Ewl_Window *
ewl_window_leader_get(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(win, NULL);
- DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(win, NULL);
+ DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, NULL);
- if (win->flags & EWL_WINDOW_LEADER)
- DRETURN_PTR(win->leader.ewl, DLEVEL_STABLE);
+ if (win->flags & EWL_WINDOW_LEADER)
+ DRETURN_PTR(win->leader.ewl, DLEVEL_STABLE);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
}
/**
@@ -760,14 +760,14 @@ ewl_window_leader_get(Ewl_Window *win)
Ewl_Embed_Window *
ewl_window_leader_foreign_get(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(win, NULL);
- DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(win, NULL);
+ DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, NULL);
- if (win->flags & EWL_WINDOW_LEADER_FOREIGN)
- DRETURN_PTR(win->leader.foreign, DLEVEL_STABLE);
+ if (win->flags & EWL_WINDOW_LEADER_FOREIGN)
+ DRETURN_PTR(win->leader.foreign, DLEVEL_STABLE);
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
}
/**
@@ -778,11 +778,11 @@ ewl_window_leader_foreign_get(Ewl_Window *win)
int
ewl_window_modal_get(Ewl_Window *win)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(win, FALSE);
- DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(win, FALSE);
+ DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
- DRETURN_INT(!!(win->flags & EWL_WINDOW_MODAL), DLEVEL_STABLE);
+ DRETURN_INT(!!(win->flags & EWL_WINDOW_MODAL), DLEVEL_STABLE);
}
/**
@@ -794,18 +794,18 @@ ewl_window_modal_get(Ewl_Window *win)
void
ewl_window_modal_set(Ewl_Window *win, int modal)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (modal)
- win->flags |= EWL_WINDOW_MODAL;
- else
- win->flags &= ~EWL_WINDOW_MODAL;
+ if (modal)
+ win->flags |= EWL_WINDOW_MODAL;
+ else
+ win->flags &= ~EWL_WINDOW_MODAL;
- ewl_engine_window_states_set(win);
+ ewl_engine_window_states_set(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -817,18 +817,18 @@ ewl_window_modal_set(Ewl_Window *win, int modal)
void
ewl_window_keyboard_grab_set(Ewl_Window *win, int grab)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (grab)
- win->flags |= EWL_WINDOW_GRAB_KEYBOARD;
- else
- win->flags &= ~EWL_WINDOW_GRAB_KEYBOARD;
+ if (grab)
+ win->flags |= EWL_WINDOW_GRAB_KEYBOARD;
+ else
+ win->flags &= ~EWL_WINDOW_GRAB_KEYBOARD;
- ewl_engine_keyboard_grab(win);
+ ewl_engine_keyboard_grab(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -839,18 +839,18 @@ ewl_window_keyboard_grab_set(Ewl_Window *win, int grab)
int
ewl_window_keyboard_grab_get(Ewl_Window *win)
{
- int grab;
+ int grab;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(win, FALSE);
- DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(win, FALSE);
+ DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
- if (win->flags & EWL_WINDOW_GRAB_KEYBOARD)
- grab = TRUE;
- else
- grab = FALSE;
+ if (win->flags & EWL_WINDOW_GRAB_KEYBOARD)
+ grab = TRUE;
+ else
+ grab = FALSE;
- DRETURN_INT(grab, DLEVEL_STABLE);
+ DRETURN_INT(grab, DLEVEL_STABLE);
}
/**
@@ -862,18 +862,18 @@ ewl_window_keyboard_grab_get(Ewl_Window *win)
void
ewl_window_pointer_grab_set(Ewl_Window *win, int grab)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (grab)
- win->flags |= EWL_WINDOW_GRAB_POINTER;
- else
- win->flags &= ~EWL_WINDOW_GRAB_POINTER;
+ if (grab)
+ win->flags |= EWL_WINDOW_GRAB_POINTER;
+ else
+ win->flags &= ~EWL_WINDOW_GRAB_POINTER;
- ewl_engine_pointer_grab(win);
+ ewl_engine_pointer_grab(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -884,18 +884,18 @@ ewl_window_pointer_grab_set(Ewl_Window *win, int grab)
int
ewl_window_pointer_grab_get(Ewl_Window *win)
{
- int grab;
+ int grab;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(win, FALSE);
- DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(win, FALSE);
+ DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
- if (win->flags & EWL_WINDOW_GRAB_POINTER)
- grab = TRUE;
- else
- grab = FALSE;
+ if (win->flags & EWL_WINDOW_GRAB_POINTER)
+ grab = TRUE;
+ else
+ grab = FALSE;
- DRETURN_INT(grab, DLEVEL_STABLE);
+ DRETURN_INT(grab, DLEVEL_STABLE);
}
/**
@@ -907,18 +907,18 @@ ewl_window_pointer_grab_get(Ewl_Window *win)
void
ewl_window_override_set(Ewl_Window *win, int override)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(win);
- DCHECK_TYPE(win, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(win);
+ DCHECK_TYPE(win, EWL_WINDOW_TYPE);
- if (override)
- win->flags |= EWL_WINDOW_OVERRIDE;
- else
- win->flags &= ~EWL_WINDOW_OVERRIDE;
+ if (override)
+ win->flags |= EWL_WINDOW_OVERRIDE;
+ else
+ win->flags &= ~EWL_WINDOW_OVERRIDE;
- /* FIXME: Should probably unrealize and re-realize here. */
+ /* FIXME: Should probably unrealize and re-realize here. */
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -929,18 +929,18 @@ ewl_window_override_set(Ewl_Window *win, int override)
int
ewl_window_override_get(Ewl_Window *win)
{
- int override;
+ int override;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(win, FALSE);
- DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(win, FALSE);
+ DCHECK_TYPE_RET(win, EWL_WINDOW_TYPE, FALSE);
- if (win->flags & EWL_WINDOW_OVERRIDE)
- override = TRUE;
- else
- override = FALSE;
+ if (win->flags & EWL_WINDOW_OVERRIDE)
+ override = TRUE;
+ else
+ override = FALSE;
- DRETURN_INT(override, DLEVEL_STABLE);
+ DRETURN_INT(override, DLEVEL_STABLE);
}
/**
@@ -953,41 +953,41 @@ ewl_window_override_get(Ewl_Window *win)
*/
void
ewl_window_cb_realize(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Window *window;
- int width, height;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WINDOW_TYPE);
-
- window = EWL_WINDOW(w);
-
- ewl_engine_window_new(window);
- ewl_engine_window_name_class_set(window);
- ewl_engine_window_title_set(window);
- ewl_engine_window_borderless_set(window);
- ewl_engine_window_dialog_set(window);
- ewl_engine_window_states_set(window);
- ewl_engine_window_hints_set(window);
- ewl_engine_window_leader_set(window);
-
- width = ewl_object_maximum_w_get(EWL_OBJECT(window));
- height = ewl_object_maximum_h_get(EWL_OBJECT(window));
- if ((width == EWL_OBJECT_MAX_SIZE) && (width == height))
- {
- ewl_engine_window_geometry_get(window, TRUE, &width, &height);
- if (width > 1 && height > 1)
- ewl_object_maximum_size_set(EWL_OBJECT(window), width,
- height);
- }
- ewl_engine_embed_dnd_aware_set(EWL_EMBED(window));
-
- ewl_engine_canvas_setup(window, ewl_config_int_get(ewl_config,
- EWL_CONFIG_DEBUG_EVAS_RENDER));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Window *window;
+ int width, height;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WINDOW_TYPE);
+
+ window = EWL_WINDOW(w);
+
+ ewl_engine_window_new(window);
+ ewl_engine_window_name_class_set(window);
+ ewl_engine_window_title_set(window);
+ ewl_engine_window_borderless_set(window);
+ ewl_engine_window_dialog_set(window);
+ ewl_engine_window_states_set(window);
+ ewl_engine_window_hints_set(window);
+ ewl_engine_window_leader_set(window);
+
+ width = ewl_object_maximum_w_get(EWL_OBJECT(window));
+ height = ewl_object_maximum_h_get(EWL_OBJECT(window));
+ if ((width == EWL_OBJECT_MAX_SIZE) && (width == height))
+ {
+ ewl_engine_window_geometry_get(window, TRUE, &width, &height);
+ if (width > 1 && height > 1)
+ ewl_object_maximum_size_set(EWL_OBJECT(window), width,
+ height);
+ }
+ ewl_engine_embed_dnd_aware_set(EWL_EMBED(window));
+
+ ewl_engine_canvas_setup(window, ewl_config_int_get(ewl_config,
+ EWL_CONFIG_DEBUG_EVAS_RENDER));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1000,20 +1000,20 @@ ewl_window_cb_realize(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_window_cb_postrealize(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WINDOW_TYPE);
-
- if (EWL_WINDOW(w)->flags & EWL_WINDOW_TRANSIENT)
- ewl_window_transient_for(EWL_WINDOW(w),
- EWL_WINDOW(w)->transient.ewl);
- else if (EWL_WINDOW(w)->flags & EWL_WINDOW_TRANSIENT_FOREIGN)
- ewl_window_transient_for_foreign(EWL_WINDOW(w),
- EWL_WINDOW(w)->transient.foreign);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WINDOW_TYPE);
+
+ if (EWL_WINDOW(w)->flags & EWL_WINDOW_TRANSIENT)
+ ewl_window_transient_for(EWL_WINDOW(w),
+ EWL_WINDOW(w)->transient.ewl);
+ else if (EWL_WINDOW(w)->flags & EWL_WINDOW_TRANSIENT_FOREIGN)
+ ewl_window_transient_for_foreign(EWL_WINDOW(w),
+ EWL_WINDOW(w)->transient.foreign);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1026,36 +1026,36 @@ ewl_window_cb_postrealize(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_window_cb_realize_parent(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data)
+ void *user_data)
{
- Ewl_Window *win;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(user_data);
- DCHECK_TYPE(w, EWL_WINDOW_TYPE);
- DCHECK_TYPE(user_data, EWL_WINDOW_TYPE);
-
- win = EWL_WINDOW(user_data);
- /*
- * Is the window transient for the realized window.
- */
- if (EWL_WIDGET(win->transient.ewl) == w)
- ewl_window_transient_for(win, EWL_WINDOW(w));
-
- /*
- * Is the window a client of the realized leader window.
- */
- if (EWL_WIDGET(win->leader.ewl) == w)
- ewl_window_leader_set(win, EWL_WINDOW(w));
-
- /*
- * Both windows realized so no need to keep the callback.
- */
- ewl_callback_del(EWL_WIDGET(win), EWL_CALLBACK_REALIZE,
- ewl_window_cb_realize_parent);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Window *win;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(user_data);
+ DCHECK_TYPE(w, EWL_WINDOW_TYPE);
+ DCHECK_TYPE(user_data, EWL_WINDOW_TYPE);
+
+ win = EWL_WINDOW(user_data);
+ /*
+ * Is the window transient for the realized window.
+ */
+ if (EWL_WIDGET(win->transient.ewl) == w)
+ ewl_window_transient_for(win, EWL_WINDOW(w));
+
+ /*
+ * Is the window a client of the realized leader window.
+ */
+ if (EWL_WIDGET(win->leader.ewl) == w)
+ ewl_window_leader_set(win, EWL_WINDOW(w));
+
+ /*
+ * Both windows realized so no need to keep the callback.
+ */
+ ewl_callback_del(EWL_WIDGET(win), EWL_CALLBACK_REALIZE,
+ ewl_window_cb_realize_parent);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1068,29 +1068,29 @@ ewl_window_cb_realize_parent(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_window_cb_unrealize(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Window *win;
- Ewl_Embed *embed;
+ Ewl_Window *win;
+ Ewl_Embed *embed;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WINDOW_TYPE);
- embed = EWL_EMBED(w);
- win = EWL_WINDOW(w);
+ embed = EWL_EMBED(w);
+ win = EWL_WINDOW(w);
- ewl_embed_cache_cleanup(embed);
- ewl_canvas_destroy(embed->canvas);
- embed->canvas = NULL;
+ ewl_embed_cache_cleanup(embed);
+ ewl_canvas_destroy(embed->canvas);
+ embed->canvas = NULL;
- if (REALIZED(w))
- {
- ewl_engine_window_hide(win);
- ewl_engine_window_destroy(win);
- }
+ if (REALIZED(w))
+ {
+ ewl_engine_window_hide(win);
+ ewl_engine_window_destroy(win);
+ }
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1103,34 +1103,34 @@ ewl_window_cb_unrealize(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_window_cb_show(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Window *win;
+ Ewl_Window *win;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WINDOW_TYPE);
- win = EWL_WINDOW(w);
- if (!win->window)
- DRETURN(DLEVEL_STABLE);
+ win = EWL_WINDOW(w);
+ if (!win->window)
+ DRETURN(DLEVEL_STABLE);
- ewl_engine_window_borderless_set(win);
+ ewl_engine_window_borderless_set(win);
- /*
- * Now give the windows the appropriate size
- */
- if (win->flags & EWL_WINDOW_USER_CONFIGURE)
- win->flags &= ~EWL_WINDOW_USER_CONFIGURE;
- else
- ewl_engine_window_resize(win);
+ /*
+ * Now give the windows the appropriate size
+ */
+ if (win->flags & EWL_WINDOW_USER_CONFIGURE)
+ win->flags &= ~EWL_WINDOW_USER_CONFIGURE;
+ else
+ ewl_engine_window_resize(win);
- ewl_engine_window_show(win);
+ ewl_engine_window_show(win);
- if (win->flags & EWL_WINDOW_OVERRIDE)
- ewl_widget_configure(w);
+ if (win->flags & EWL_WINDOW_OVERRIDE)
+ ewl_widget_configure(w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1143,20 +1143,20 @@ ewl_window_cb_show(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_window_cb_expose(Ewl_Widget *w, void *ev __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Window *win;
+ Ewl_Window *win;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WINDOW_TYPE);
- win = EWL_WINDOW(w);
+ win = EWL_WINDOW(w);
- ewl_engine_keyboard_grab(win);
- ewl_engine_pointer_grab(win);
+ ewl_engine_keyboard_grab(win);
+ ewl_engine_pointer_grab(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1169,24 +1169,24 @@ ewl_window_cb_expose(Ewl_Widget *w, void *ev __UNUSED__,
*/
void
ewl_window_cb_hide(Ewl_Widget *widget, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Window *win;
+ Ewl_Window *win;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(widget);
- DCHECK_TYPE(widget, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(widget);
+ DCHECK_TYPE(widget, EWL_WINDOW_TYPE);
- win = EWL_WINDOW(widget);
+ win = EWL_WINDOW(widget);
- ewl_engine_window_hide(win);
- if (win->flags & EWL_WINDOW_GRAB_KEYBOARD)
- ewl_engine_keyboard_ungrab(win);
+ ewl_engine_window_hide(win);
+ if (win->flags & EWL_WINDOW_GRAB_KEYBOARD)
+ ewl_engine_keyboard_ungrab(win);
- if (win->flags & EWL_WINDOW_GRAB_POINTER)
- ewl_engine_pointer_ungrab(win);
+ if (win->flags & EWL_WINDOW_GRAB_POINTER)
+ ewl_engine_pointer_ungrab(win);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1199,24 +1199,24 @@ ewl_window_cb_hide(Ewl_Widget *widget, void *ev_data __UNUSED__,
*/
void
ewl_window_cb_destroy(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Window *win;
+ Ewl_Window *win;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WINDOW_TYPE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WINDOW_TYPE);
- win = EWL_WINDOW(w);
+ win = EWL_WINDOW(w);
- IF_FREE(win->title);
- IF_FREE(win->name);
- IF_FREE(win->classname);
+ IF_FREE(win->title);
+ IF_FREE(win->name);
+ IF_FREE(win->classname);
- if ((win = ecore_list_goto(ewl_window_list, win)))
- ecore_list_remove(ewl_window_list);
+ if ((win = ecore_list_goto(ewl_window_list, win)))
+ ecore_list_remove(ewl_window_list);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
@@ -1229,42 +1229,42 @@ ewl_window_cb_destroy(Ewl_Widget *w, void *ev_data __UNUSED__,
*/
void
ewl_window_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- Ewl_Window *win;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WINDOW_TYPE);
-
- win = EWL_WINDOW(w);
-
- if (!win->window)
- DRETURN(DLEVEL_STABLE);
-
- /*
- * Now give the windows the appropriate size and adjust the evas as
- * well.
- */
- if (win->flags & EWL_WINDOW_USER_CONFIGURE)
- win->flags &= ~EWL_WINDOW_USER_CONFIGURE;
- else
- ewl_engine_window_resize(win);
-
- ewl_engine_canvas_output_set(EWL_EMBED(win),
- ewl_object_current_x_get(EWL_OBJECT(win)),
- ewl_object_current_y_get(EWL_OBJECT(win)),
- ewl_object_current_w_get(EWL_OBJECT(win)),
- ewl_object_current_h_get(EWL_OBJECT(win)));
-
- /*
- * Adjust the minimum and maximum window bounds to match the widget.
- * Do this after the resize to prevent early mapping, and the object
- * keeps the bounds respected.
- */
- ewl_engine_window_min_max_size_set(win);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ Ewl_Window *win;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+ DCHECK_TYPE(w, EWL_WINDOW_TYPE);
+
+ win = EWL_WINDOW(w);
+
+ if (!win->window)
+ DRETURN(DLEVEL_STABLE);
+
+ /*
+ * Now give the windows the appropriate size and adjust the evas as
+ * well.
+ */
+ if (win->flags & EWL_WINDOW_USER_CONFIGURE)
+ win->flags &= ~EWL_WINDOW_USER_CONFIGURE;
+ else
+ ewl_engine_window_resize(win);
+
+ ewl_engine_canvas_output_set(EWL_EMBED(win),
+ ewl_object_current_x_get(EWL_OBJECT(win)),
+ ewl_object_current_y_get(EWL_OBJECT(win)),
+ ewl_object_current_w_get(EWL_OBJECT(win)),
+ ewl_object_current_h_get(EWL_OBJECT(win)));
+
+ /*
+ * Adjust the minimum and maximum window bounds to match the widget.
+ * Do this after the resize to prevent early mapping, and the object
+ * keeps the bounds respected.
+ */
+ ewl_engine_window_min_max_size_set(win);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
diff --git a/src/lib/ewl_window.h b/src/lib/ewl_window.h
index 7a56050..870ad70 100644
--- a/src/lib/ewl_window.h
+++ b/src/lib/ewl_window.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_WINDOW_H
#define EWL_WINDOW_H
@@ -50,73 +50,73 @@ typedef struct Ewl_Window Ewl_Window;
*/
struct Ewl_Window
{
- Ewl_Embed embed; /**< Inherits from the Ewl_Embed class */
+ Ewl_Embed embed; /**< Inherits from the Ewl_Embed class */
- void *window; /**< Provides a window for drawing */
- union {
- Ewl_Window *ewl;
- Ewl_Embed_Window *foreign;
- } transient; /**< Window to be transient for */
- union {
- Ewl_Window *ewl;
- Ewl_Embed_Window *foreign;
- } leader; /**< the leader of the window group */
+ void *window; /**< Provides a window for drawing */
+ union {
+ Ewl_Window *ewl;
+ Ewl_Embed_Window *foreign;
+ } transient; /**< Window to be transient for */
+ union {
+ Ewl_Window *ewl;
+ Ewl_Embed_Window *foreign;
+ } leader; /**< the leader of the window group */
- char *title; /**< The current title on the provided window */
- char *name; /**< Current name on the provided window */
- char *classname; /**< Current class on the provided window */
+ char *title; /**< The current title on the provided window */
+ char *name; /**< Current name on the provided window */
+ char *classname; /**< Current class on the provided window */
- Ewl_Window_Flags flags; /**< Flags indicating window properties */
- Ewl_Window_Flags old_flags; /**< Flags used on our last state set call */
+ Ewl_Window_Flags flags; /**< Flags indicating window properties */
+ Ewl_Window_Flags old_flags; /**< Flags used on our last state set call */
};
extern unsigned int EWL_CALLBACK_EXPOSE; /**< Triggered when the window needs redrawing */
extern unsigned int EWL_CALLBACK_DELETE_WINDOW; /**< The window is being closed */
-Ewl_Widget *ewl_window_new(void);
-int ewl_window_init(Ewl_Window *win);
-Ewl_Window *ewl_window_window_find(void *window);
-void ewl_window_title_set(Ewl_Window *win, const char *title);
-const char *ewl_window_title_get(Ewl_Window *win);
-void ewl_window_name_set(Ewl_Window *win, const char *name);
-const char *ewl_window_name_get(Ewl_Window *win);
-void ewl_window_class_set(Ewl_Window *win, const char *classname);
-const char *ewl_window_class_get(Ewl_Window *win);
-void ewl_window_borderless_set(Ewl_Window *win, unsigned int border);
-unsigned int ewl_window_borderless_get(Ewl_Window *win);
-void ewl_window_dialog_set(Ewl_Window *win, int dialog);
-int ewl_window_dialog_get(Ewl_Window *win);
-void ewl_window_fullscreen_set(Ewl_Window *win,
- unsigned int fullscreen);
-unsigned int ewl_window_fullscreen_get(Ewl_Window *win);
-void ewl_window_skip_taskbar_set(Ewl_Window *win,
- unsigned int skip);
-unsigned int ewl_window_skip_taskbar_get(Ewl_Window *win);
-void ewl_window_skip_pager_set(Ewl_Window *win,
- unsigned int skip);
-unsigned int ewl_window_skip_pager_get(Ewl_Window *win);
-void ewl_window_attention_demand(Ewl_Window *win);
-void ewl_window_urgent_set(Ewl_Window *win, unsigned int urgent);
-unsigned int ewl_window_urgent_get(Ewl_Window *win);
-void ewl_window_move(Ewl_Window *win, int x, int y);
-void ewl_window_raise(Ewl_Window *win);
-void ewl_window_lower(Ewl_Window *win);
-void ewl_window_transient_for(Ewl_Window *win, Ewl_Window *forwin);
-void ewl_window_transient_for_foreign(Ewl_Window *win,
- Ewl_Embed_Window *forwin);
-void ewl_window_leader_set(Ewl_Window *win, Ewl_Window *leader);
-void ewl_window_leader_foreign_set(Ewl_Window *win,
- Ewl_Embed_Window *leader);
-Ewl_Window *ewl_window_leader_get(Ewl_Window *win);
+Ewl_Widget *ewl_window_new(void);
+int ewl_window_init(Ewl_Window *win);
+Ewl_Window *ewl_window_window_find(void *window);
+void ewl_window_title_set(Ewl_Window *win, const char *title);
+const char *ewl_window_title_get(Ewl_Window *win);
+void ewl_window_name_set(Ewl_Window *win, const char *name);
+const char *ewl_window_name_get(Ewl_Window *win);
+void ewl_window_class_set(Ewl_Window *win, const char *classname);
+const char *ewl_window_class_get(Ewl_Window *win);
+void ewl_window_borderless_set(Ewl_Window *win, unsigned int border);
+unsigned int ewl_window_borderless_get(Ewl_Window *win);
+void ewl_window_dialog_set(Ewl_Window *win, int dialog);
+int ewl_window_dialog_get(Ewl_Window *win);
+void ewl_window_fullscreen_set(Ewl_Window *win,
+ unsigned int fullscreen);
+unsigned int ewl_window_fullscreen_get(Ewl_Window *win);
+void ewl_window_skip_taskbar_set(Ewl_Window *win,
+ unsigned int skip);
+unsigned int ewl_window_skip_taskbar_get(Ewl_Window *win);
+void ewl_window_skip_pager_set(Ewl_Window *win,
+ unsigned int skip);
+unsigned int ewl_window_skip_pager_get(Ewl_Window *win);
+void ewl_window_attention_demand(Ewl_Window *win);
+void ewl_window_urgent_set(Ewl_Window *win, unsigned int urgent);
+unsigned int ewl_window_urgent_get(Ewl_Window *win);
+void ewl_window_move(Ewl_Window *win, int x, int y);
+void ewl_window_raise(Ewl_Window *win);
+void ewl_window_lower(Ewl_Window *win);
+void ewl_window_transient_for(Ewl_Window *win, Ewl_Window *forwin);
+void ewl_window_transient_for_foreign(Ewl_Window *win,
+ Ewl_Embed_Window *forwin);
+void ewl_window_leader_set(Ewl_Window *win, Ewl_Window *leader);
+void ewl_window_leader_foreign_set(Ewl_Window *win,
+ Ewl_Embed_Window *leader);
+Ewl_Window *ewl_window_leader_get(Ewl_Window *win);
Ewl_Embed_Window *ewl_window_leader_foreign_get(Ewl_Window *win);
-int ewl_window_modal_get(Ewl_Window *win);
-void ewl_window_modal_set(Ewl_Window *win, int modal);
-void ewl_window_keyboard_grab_set(Ewl_Window *win, int grab);
-int ewl_window_keyboard_grab_get(Ewl_Window *win);
-void ewl_window_pointer_grab_set(Ewl_Window *win, int grab);
-int ewl_window_pointer_grab_get(Ewl_Window *win);
-void ewl_window_override_set(Ewl_Window *win, int override);
-int ewl_window_override_get(Ewl_Window *win);
+int ewl_window_modal_get(Ewl_Window *win);
+void ewl_window_modal_set(Ewl_Window *win, int modal);
+void ewl_window_keyboard_grab_set(Ewl_Window *win, int grab);
+int ewl_window_keyboard_grab_get(Ewl_Window *win);
+void ewl_window_pointer_grab_set(Ewl_Window *win, int grab);
+int ewl_window_pointer_grab_get(Ewl_Window *win);
+void ewl_window_override_set(Ewl_Window *win, int override);
+int ewl_window_override_get(Ewl_Window *win);
/*
* Internally used callbacks, override at your own risk.
@@ -124,7 +124,7 @@ int ewl_window_override_get(Ewl_Window *win);
void ewl_window_cb_realize(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_window_cb_postrealize(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_window_cb_realize_parent(Ewl_Widget *w, void *ev_data,
- void *user_data);
+ void *user_data);
void ewl_window_cb_unrealize(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_window_cb_show(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_window_cb_expose(Ewl_Widget *w, void *ev, void *user_data);
diff --git a/src/plugins/ewl_io_manager_image_plugin.c b/src/plugins/ewl_io_manager_image_plugin.c
index 8b0ee19..2612ada 100644
--- a/src/plugins/ewl_io_manager_image_plugin.c
+++ b/src/plugins/ewl_io_manager_image_plugin.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_image.h"
#include "ewl_private.h"
@@ -10,57 +10,57 @@
Ewl_Widget *
ewl_io_manager_plugin_uri_read(const char *uri)
{
- Ewl_Widget *ret = NULL;
+ Ewl_Widget *ret = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(uri, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(uri, NULL);
- ret = ewl_image_new();
- ewl_image_file_path_set(EWL_IMAGE(ret), uri);
+ ret = ewl_image_new();
+ ewl_image_file_path_set(EWL_IMAGE(ret), uri);
- DRETURN_PTR(ret, DLEVEL_STABLE);
+ DRETURN_PTR(ret, DLEVEL_STABLE);
}
Ewl_Widget *
ewl_io_manager_plugin_string_read(const char *string __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- /* XXX not sure if we want to provide this? ... */
+ /* XXX not sure if we want to provide this? ... */
- DRETURN_PTR(NULL, DLEVEL_STABLE);
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
}
int
ewl_io_manager_plugin_uri_write(Ewl_Widget *data, const char *uri)
{
- Ewl_Image *img;
- int ret = FALSE;
+ Ewl_Image *img;
+ int ret = FALSE;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, FALSE);
- DCHECK_PARAM_PTR_RET(uri, FALSE);
- DCHECK_TYPE_RET(data, EWL_IMAGE_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, FALSE);
+ DCHECK_PARAM_PTR_RET(uri, FALSE);
+ DCHECK_TYPE_RET(data, EWL_IMAGE_TYPE, FALSE);
- img = EWL_IMAGE(data);
- if (!img->image)
- DRETURN_INT(ret, DLEVEL_STABLE);
+ img = EWL_IMAGE(data);
+ if (!img->image)
+ DRETURN_INT(ret, DLEVEL_STABLE);
- ret = evas_object_image_save(img->image, uri, NULL, NULL);
+ ret = evas_object_image_save(img->image, uri, NULL, NULL);
- DRETURN_INT(ret, DLEVEL_STABLE);
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
int
ewl_io_manager_plugin_string_write(Ewl_Widget *data,
- const char **string __UNUSED__)
+ const char **string __UNUSED__)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, FALSE);
- DCHECK_TYPE_RET(data, EWL_IMAGE_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, FALSE);
+ DCHECK_TYPE_RET(data, EWL_IMAGE_TYPE, FALSE);
- /* XXX not sure if we want to provide this ? ... */
+ /* XXX not sure if we want to provide this ? ... */
- DRETURN_INT(FALSE, DLEVEL_STABLE);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
}
diff --git a/src/plugins/ewl_io_manager_text_c_plugin.c b/src/plugins/ewl_io_manager_text_c_plugin.c
index e53c6a8..57714d2 100644
--- a/src/plugins/ewl_io_manager_text_c_plugin.c
+++ b/src/plugins/ewl_io_manager_text_c_plugin.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_text.h"
#include "ewl_private.h"
@@ -11,292 +11,292 @@ static void text_set(Ewl_Text *t, char *text);
enum text_mode
{
- COMMAND,
- C_COMMENT,
- CPP_COMMENT,
- STRING,
- NUMBER,
- PREPROCESSOR,
- REST
+ COMMAND,
+ C_COMMENT,
+ CPP_COMMENT,
+ STRING,
+ NUMBER,
+ PREPROCESSOR,
+ REST
};
static Ecore_Hash *key1 = NULL;
static Ecore_Hash *key2 = NULL;
static char *keywords2[] = {
- "auto",
- "char",
- "const",
- "double",
- "enum",
- "extern",
- "float",
- "int",
- "long",
- "register",
- "short",
- "signed",
- "static",
- "struct",
- "typedef",
- "union",
- "unsigned",
- "void",
- "volatile",
- NULL
+ "auto",
+ "char",
+ "const",
+ "double",
+ "enum",
+ "extern",
+ "float",
+ "int",
+ "long",
+ "register",
+ "short",
+ "signed",
+ "static",
+ "struct",
+ "typedef",
+ "union",
+ "unsigned",
+ "void",
+ "volatile",
+ NULL
};
static char *keywords1[] = {
- "break",
- "case",
- "continue",
- "default",
- "do",
- "else",
- "for",
- "goto",
- "if",
- "return",
- "sizeof",
- "switch",
- "while",
- NULL
+ "break",
+ "case",
+ "continue",
+ "default",
+ "do",
+ "else",
+ "for",
+ "goto",
+ "if",
+ "return",
+ "sizeof",
+ "switch",
+ "while",
+ NULL
};
static void
setup_hash()
{
- int i;
+ int i;
- key1 = ecore_hash_new(ecore_str_hash, ecore_str_compare);
- key2 = ecore_hash_new(ecore_str_hash, ecore_str_compare);
+ key1 = ecore_hash_new(ecore_str_hash, ecore_str_compare);
+ key2 = ecore_hash_new(ecore_str_hash, ecore_str_compare);
- for (i = 0; keywords1[i] != NULL; i++)
- ecore_hash_set(key1, keywords1[i], keywords1[i]);
+ for (i = 0; keywords1[i] != NULL; i++)
+ ecore_hash_set(key1, keywords1[i], keywords1[i]);
- for (i = 0; keywords2[i] != NULL; i++)
- ecore_hash_set(key2, keywords2[i], keywords2[i]);
+ for (i = 0; keywords2[i] != NULL; i++)
+ ecore_hash_set(key2, keywords2[i], keywords2[i]);
}
Ewl_Widget *
ewl_io_manager_plugin_uri_read(const char *uri)
{
- Ewl_Widget *ret = NULL;
- FILE *file;
+ Ewl_Widget *ret = NULL;
+ FILE *file;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(uri, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(uri, NULL);
- if (!key1)
- setup_hash();
+ if (!key1)
+ setup_hash();
- file = fopen(uri, "r");
- if (file)
- {
- struct stat buf;
- char *str;
+ file = fopen(uri, "r");
+ if (file)
+ {
+ struct stat buf;
+ char *str;
- ret = ewl_text_new();
- ewl_text_font_set(EWL_TEXT(ret), "ewl/monospace");
+ ret = ewl_text_new();
+ ewl_text_font_set(EWL_TEXT(ret), "ewl/monospace");
- stat(uri, &buf);
- str = malloc(sizeof(char) * (buf.st_size + 1));
- fread(str, buf.st_size, 1, file);
- str[buf.st_size] = '\0';
- fclose(file);
+ stat(uri, &buf);
+ str = malloc(sizeof(char) * (buf.st_size + 1));
+ fread(str, buf.st_size, 1, file);
+ str[buf.st_size] = '\0';
+ fclose(file);
- text_set(EWL_TEXT(ret), str);
- FREE(str);
- }
+ text_set(EWL_TEXT(ret), str);
+ FREE(str);
+ }
- DRETURN_PTR(ret, DLEVEL_STABLE);
+ DRETURN_PTR(ret, DLEVEL_STABLE);
}
Ewl_Widget *
ewl_io_manager_plugin_string_read(const char *string)
{
- Ewl_Widget *ret = NULL;
- char *txt;
+ Ewl_Widget *ret = NULL;
+ char *txt;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- if (!key1)
- setup_hash();
+ if (!key1)
+ setup_hash();
- ret = ewl_text_new();
- ewl_text_font_set(EWL_TEXT(ret), "ewl/monospace");
- txt = strdup(string);
- text_set(EWL_TEXT(ret), txt);
- free(txt);
+ ret = ewl_text_new();
+ ewl_text_font_set(EWL_TEXT(ret), "ewl/monospace");
+ txt = strdup(string);
+ text_set(EWL_TEXT(ret), txt);
+ free(txt);
- DRETURN_PTR(ret, DLEVEL_STABLE);
+ DRETURN_PTR(ret, DLEVEL_STABLE);
}
int
ewl_io_manager_plugin_uri_write(Ewl_Widget *data, const char *uri)
{
- FILE *file;
- int ret = FALSE;
+ FILE *file;
+ int ret = FALSE;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, FALSE);
- DCHECK_PARAM_PTR_RET(uri, FALSE);
- DCHECK_TYPE_RET(data, EWL_TEXT_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, FALSE);
+ DCHECK_PARAM_PTR_RET(uri, FALSE);
+ DCHECK_TYPE_RET(data, EWL_TEXT_TYPE, FALSE);
- file = fopen(uri, "w");
- if (file)
- {
- char *txt;
+ file = fopen(uri, "w");
+ if (file)
+ {
+ char *txt;
- txt = ewl_text_text_get(EWL_TEXT(data));
- fwrite(txt, sizeof(char), strlen(txt), file);
+ txt = ewl_text_text_get(EWL_TEXT(data));
+ fwrite(txt, sizeof(char), strlen(txt), file);
- FREE(txt);
- fclose(file);
+ FREE(txt);
+ fclose(file);
- ret = TRUE;
- }
+ ret = TRUE;
+ }
- DRETURN_INT(ret, DLEVEL_STABLE);
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
int
ewl_io_manager_plugin_string_write(Ewl_Widget *data, const char **string)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, FALSE);
- DCHECK_TYPE_RET(data, EWL_TEXT_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, FALSE);
+ DCHECK_TYPE_RET(data, EWL_TEXT_TYPE, FALSE);
- *string = ewl_text_text_get(EWL_TEXT(data));
+ *string = ewl_text_text_get(EWL_TEXT(data));
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static int
string_is_keyword(Ecore_Hash *keys, const char *string)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(string, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(string, FALSE);
- DRETURN_INT(((ecore_hash_get(keys, string) != NULL) ? TRUE : FALSE),
- DLEVEL_STABLE);
+ DRETURN_INT(((ecore_hash_get(keys, string) != NULL) ? TRUE : FALSE),
+ DLEVEL_STABLE);
}
static void
text_set(Ewl_Text *t, char *text)
{
- char *tx1, *tx2;
-
- tx1 = tx2 = text;
- while (*tx1)
- {
- int mode;
- char remc = '\0';
-
- /* decide what case we are dealing with */
- if (isalpha(*tx1) || (*tx1 == '_'))
- mode = COMMAND;
-
- else if ((*tx1 == '/') && (*(tx1 + 1) == '*'))
- mode = C_COMMENT;
-
- else if ((*tx1 == '/') && (*(tx1 + 1) == '/'))
- mode = CPP_COMMENT;
-
- else if (*tx1 == '#')
- mode = PREPROCESSOR;
-
- else if (isdigit(*tx1))
- mode = NUMBER;
-
- else if (*tx1 == '\"' && !( tx1 != text && *(tx1 - 1) == '\\'))
- mode = STRING;
-
- else
- mode = REST;
-
- /*
- * finde the end of the mode
- */
- tx2++;
- switch (mode)
- {
- case NUMBER:
- case COMMAND:
- while(isalnum(*tx2) || (*tx2 == '_'))
- tx2++;
- break;
-
- case C_COMMENT:
- while((*tx2 != '\0') &&
- (!((*tx2 == '*')
- && (*(tx2 + 1) == '/'))))
- tx2++;
-
- /* skip over the * and / characters */
- if (*tx2) tx2 += 2;
- break;
-
- case PREPROCESSOR:
- case CPP_COMMENT:
- while((*tx2 != '\0') && (*tx2 != '\n'))
- tx2++;
- break;
-
- case STRING:
- while((*tx2 != '\0')
- && !((*tx2 == '\"')
- && (*(tx2 - 1) != '\\')))
- tx2++;
-
- if (*tx2) tx2++;
- break;
-
- case REST:
- while(!isalnum(*tx2) && (*tx2 != '\0')
- && (*tx2 != '#')
- && (*tx2 != '/')
- && (*tx2 != '\"'))
- tx2++;
- break;
-
- default:
- break;
- }
-
- /* append the text */
- remc = *tx2;
- *tx2 = '\0';
-
- if (mode == COMMAND && ((tx2 - tx1) < 8) &&
- string_is_keyword(key1, tx1))
- ewl_text_color_set(t, 68, 144, 169, 255);
-
- else if ((mode == COMMAND) && ((tx2 - tx1) < 8) &&
- string_is_keyword(key2, tx1))
- ewl_text_color_set(t, 26, 117, 3, 255);
-
- else if (mode == STRING)
- ewl_text_color_set(t, 217, 0, 0, 255);
-
- else if ((mode == C_COMMENT) || (mode == CPP_COMMENT))
- ewl_text_color_set(t, 106, 15, 159, 255);
-
- else if (mode == PREPROCESSOR)
- ewl_text_color_set(t, 153, 85, 29, 255);
-
- else if (mode == NUMBER)
- ewl_text_color_set(t, 255, 114, 0, 255);
-
- else
- ewl_text_color_set(t, 0, 0, 0, 255);
-
- ewl_text_text_append(t, tx1);
-
- *tx2 = remc;
- tx1 = tx2;
- }
+ char *tx1, *tx2;
+
+ tx1 = tx2 = text;
+ while (*tx1)
+ {
+ int mode;
+ char remc = '\0';
+
+ /* decide what case we are dealing with */
+ if (isalpha(*tx1) || (*tx1 == '_'))
+ mode = COMMAND;
+
+ else if ((*tx1 == '/') && (*(tx1 + 1) == '*'))
+ mode = C_COMMENT;
+
+ else if ((*tx1 == '/') && (*(tx1 + 1) == '/'))
+ mode = CPP_COMMENT;
+
+ else if (*tx1 == '#')
+ mode = PREPROCESSOR;
+
+ else if (isdigit(*tx1))
+ mode = NUMBER;
+
+ else if (*tx1 == '\"' && !( tx1 != text && *(tx1 - 1) == '\\'))
+ mode = STRING;
+
+ else
+ mode = REST;
+
+ /*
+ * finde the end of the mode
+ */
+ tx2++;
+ switch (mode)
+ {
+ case NUMBER:
+ case COMMAND:
+ while(isalnum(*tx2) || (*tx2 == '_'))
+ tx2++;
+ break;
+
+ case C_COMMENT:
+ while((*tx2 != '\0') &&
+ (!((*tx2 == '*')
+ && (*(tx2 + 1) == '/'))))
+ tx2++;
+
+ /* skip over the * and / characters */
+ if (*tx2) tx2 += 2;
+ break;
+
+ case PREPROCESSOR:
+ case CPP_COMMENT:
+ while((*tx2 != '\0') && (*tx2 != '\n'))
+ tx2++;
+ break;
+
+ case STRING:
+ while((*tx2 != '\0')
+ && !((*tx2 == '\"')
+ && (*(tx2 - 1) != '\\')))
+ tx2++;
+
+ if (*tx2) tx2++;
+ break;
+
+ case REST:
+ while(!isalnum(*tx2) && (*tx2 != '\0')
+ && (*tx2 != '#')
+ && (*tx2 != '/')
+ && (*tx2 != '\"'))
+ tx2++;
+ break;
+
+ default:
+ break;
+ }
+
+ /* append the text */
+ remc = *tx2;
+ *tx2 = '\0';
+
+ if (mode == COMMAND && ((tx2 - tx1) < 8) &&
+ string_is_keyword(key1, tx1))
+ ewl_text_color_set(t, 68, 144, 169, 255);
+
+ else if ((mode == COMMAND) && ((tx2 - tx1) < 8) &&
+ string_is_keyword(key2, tx1))
+ ewl_text_color_set(t, 26, 117, 3, 255);
+
+ else if (mode == STRING)
+ ewl_text_color_set(t, 217, 0, 0, 255);
+
+ else if ((mode == C_COMMENT) || (mode == CPP_COMMENT))
+ ewl_text_color_set(t, 106, 15, 159, 255);
+
+ else if (mode == PREPROCESSOR)
+ ewl_text_color_set(t, 153, 85, 29, 255);
+
+ else if (mode == NUMBER)
+ ewl_text_color_set(t, 255, 114, 0, 255);
+
+ else
+ ewl_text_color_set(t, 0, 0, 0, 255);
+
+ ewl_text_text_append(t, tx1);
+
+ *tx2 = remc;
+ tx1 = tx2;
+ }
}
diff --git a/src/plugins/ewl_io_manager_text_plugin.c b/src/plugins/ewl_io_manager_text_plugin.c
index aa74387..f7622d1 100644
--- a/src/plugins/ewl_io_manager_text_plugin.c
+++ b/src/plugins/ewl_io_manager_text_plugin.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_text.h"
#include "ewl_private.h"
@@ -8,83 +8,83 @@
Ewl_Widget *
ewl_io_manager_plugin_uri_read(const char *uri)
{
- Ewl_Widget *ret = NULL;
- FILE *file;
+ Ewl_Widget *ret = NULL;
+ FILE *file;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(uri, NULL);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(uri, NULL);
- file = fopen(uri, "r");
- if (file)
- {
- struct stat buf;
- char *str;
+ file = fopen(uri, "r");
+ if (file)
+ {
+ struct stat buf;
+ char *str;
- ret = ewl_text_new();
+ ret = ewl_text_new();
- stat(uri, &buf);
- str = malloc(sizeof(char) * (buf.st_size + 1));
- fread(str, buf.st_size, 1, file);
- str[buf.st_size] = '\0';
- fclose(file);
+ stat(uri, &buf);
+ str = malloc(sizeof(char) * (buf.st_size + 1));
+ fread(str, buf.st_size, 1, file);
+ str[buf.st_size] = '\0';
+ fclose(file);
- ewl_text_text_set(EWL_TEXT(ret), str);
- FREE(str);
- }
+ ewl_text_text_set(EWL_TEXT(ret), str);
+ FREE(str);
+ }
- DRETURN_PTR(ret, DLEVEL_STABLE);
+ DRETURN_PTR(ret, DLEVEL_STABLE);
}
Ewl_Widget *
ewl_io_manager_plugin_string_read(const char *string)
{
- Ewl_Widget *ret = NULL;
+ Ewl_Widget *ret = NULL;
- DENTER_FUNCTION(DLEVEL_STABLE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- ret = ewl_text_new();
- ewl_text_text_set(EWL_TEXT(ret), string);
+ ret = ewl_text_new();
+ ewl_text_text_set(EWL_TEXT(ret), string);
- DRETURN_PTR(ret, DLEVEL_STABLE);
+ DRETURN_PTR(ret, DLEVEL_STABLE);
}
int
ewl_io_manager_plugin_uri_write(Ewl_Widget *data, const char *uri)
{
- FILE *file;
- int ret = FALSE;
+ FILE *file;
+ int ret = FALSE;
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, FALSE);
- DCHECK_PARAM_PTR_RET(uri, FALSE);
- DCHECK_TYPE_RET(data, EWL_TEXT_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, FALSE);
+ DCHECK_PARAM_PTR_RET(uri, FALSE);
+ DCHECK_TYPE_RET(data, EWL_TEXT_TYPE, FALSE);
- file = fopen(uri, "w");
- if (file)
- {
- char *txt;
+ file = fopen(uri, "w");
+ if (file)
+ {
+ char *txt;
- txt = ewl_text_text_get(EWL_TEXT(data));
- fwrite(txt, sizeof(char), strlen(txt), file);
+ txt = ewl_text_text_get(EWL_TEXT(data));
+ fwrite(txt, sizeof(char), strlen(txt), file);
- FREE(txt);
- fclose(file);
+ FREE(txt);
+ fclose(file);
- ret = TRUE;
- }
+ ret = TRUE;
+ }
- DRETURN_INT(ret, DLEVEL_STABLE);
+ DRETURN_INT(ret, DLEVEL_STABLE);
}
int
ewl_io_manager_plugin_string_write(Ewl_Widget *data, const char **string)
{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR_RET(data, FALSE);
- DCHECK_TYPE_RET(data, EWL_TEXT_TYPE, FALSE);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET(data, FALSE);
+ DCHECK_TYPE_RET(data, EWL_TEXT_TYPE, FALSE);
- *string = ewl_text_text_get(EWL_TEXT(data));
+ *string = ewl_text_text_get(EWL_TEXT(data));
- DRETURN_INT(TRUE, DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
diff --git a/tools/ewl_config/ewl_config.c b/tools/ewl_config/ewl_config.c
index e8345cb..fef4b9b 100644
--- a/tools/ewl_config/ewl_config.c
+++ b/tools/ewl_config/ewl_config.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include <Ewl.h>
#include "ewl_private.h"
#include "ewl_debug.h"
@@ -45,769 +45,769 @@ int ec_themes_get(DIR *rep, Ecore_List *list, const char *v);
typedef struct Ec_Gui_Menu Ec_Gui_Menu;
struct Ec_Gui_Menu
{
- char *name;
- Ewl_Menu_Info *info;
+ char *name;
+ Ewl_Menu_Info *info;
};
int
main(int argc, char ** argv)
{
- int ret = 1, i, did_something = 0, save_system = 0;
-
- if (!ewl_init(&argc, argv))
- {
- fprintf(stderr, "Unable to init ewl.\n");
- goto EXIT;
- }
-
- for (i = 1; i < argc; i++)
- {
- if ((!strncmp(argv[i], "-s", 2))
- || (!strncmp(argv[i], "-set", 4)))
- {
- if (++i < argc)
- {
- char *t, *key, *val;
-
- t = strdup(argv[i]);
- key = t;
- val = strchr(t, '=');
-
- if (!val)
- {
- usage();
- goto EWL_SHUTDOWN;
- }
-
- *val = '\0';
- val++;
-
- ewl_config_string_set(ewl_config, key, val,
- EWL_STATE_PERSISTENT);
- free(t);
-
- did_something = 1;
- }
- else
- {
- usage();
- goto EWL_SHUTDOWN;
- }
- }
- else if ((!strncmp(argv[i], "-g", 2))
- || (!strncmp(argv[i], "-get", 4)))
- {
- if (++i < argc)
- {
- const char *val;
-
- val = ewl_config_string_get(ewl_config, argv[i]);
- printf("%s = %s\n", argv[i], val);
-
- did_something = 1;
- }
- else
- {
- usage();
- goto EWL_SHUTDOWN;
- }
- }
- else if (!strncmp(argv[i], "-r", 2))
- {
- if (!ewl_config_can_save_system(ewl_config))
- {
- fprintf(stderr, "Insufficient permission to save "
- "system configuration.\n");
- goto EWL_SHUTDOWN;
- }
- save_system = 1;
- }
- else if ((!strncmp(argv[i], "-h", 2))
- || (!strncasecmp(argv[i], "--help", 6)))
- {
- usage();
- ret = 0;
- goto EWL_SHUTDOWN;
- }
- }
-
- if (did_something)
- {
- if (save_system)
- ewl_config_system_save(ewl_config);
- else
- ewl_config_user_save(ewl_config);
- }
- else
- {
- ec_main_win(save_system);
- ewl_main();
- }
-
- ret = 0;
+ int ret = 1, i, did_something = 0, save_system = 0;
+
+ if (!ewl_init(&argc, argv))
+ {
+ fprintf(stderr, "Unable to init ewl.\n");
+ goto EXIT;
+ }
+
+ for (i = 1; i < argc; i++)
+ {
+ if ((!strncmp(argv[i], "-s", 2))
+ || (!strncmp(argv[i], "-set", 4)))
+ {
+ if (++i < argc)
+ {
+ char *t, *key, *val;
+
+ t = strdup(argv[i]);
+ key = t;
+ val = strchr(t, '=');
+
+ if (!val)
+ {
+ usage();
+ goto EWL_SHUTDOWN;
+ }
+
+ *val = '\0';
+ val++;
+
+ ewl_config_string_set(ewl_config, key, val,
+ EWL_STATE_PERSISTENT);
+ free(t);
+
+ did_something = 1;
+ }
+ else
+ {
+ usage();
+ goto EWL_SHUTDOWN;
+ }
+ }
+ else if ((!strncmp(argv[i], "-g", 2))
+ || (!strncmp(argv[i], "-get", 4)))
+ {
+ if (++i < argc)
+ {
+ const char *val;
+
+ val = ewl_config_string_get(ewl_config, argv[i]);
+ printf("%s = %s\n", argv[i], val);
+
+ did_something = 1;
+ }
+ else
+ {
+ usage();
+ goto EWL_SHUTDOWN;
+ }
+ }
+ else if (!strncmp(argv[i], "-r", 2))
+ {
+ if (!ewl_config_can_save_system(ewl_config))
+ {
+ fprintf(stderr, "Insufficient permission to save "
+ "system configuration.\n");
+ goto EWL_SHUTDOWN;
+ }
+ save_system = 1;
+ }
+ else if ((!strncmp(argv[i], "-h", 2))
+ || (!strncasecmp(argv[i], "--help", 6)))
+ {
+ usage();
+ ret = 0;
+ goto EWL_SHUTDOWN;
+ }
+ }
+
+ if (did_something)
+ {
+ if (save_system)
+ ewl_config_system_save(ewl_config);
+ else
+ ewl_config_user_save(ewl_config);
+ }
+ else
+ {
+ ec_main_win(save_system);
+ ewl_main();
+ }
+
+ ret = 0;
EWL_SHUTDOWN:
- ewl_shutdown();
+ ewl_shutdown();
EXIT:
- return ret;
+ return ret;
}
static void
usage(void)
{
- printf("\n"
- "ewl_config [OPTIONS] [-set key=value] [-get key]\n"
- " OPTIONS\n"
- " -r \t - Save the system configuration file\n"
- " -h|--help \t - Print help information\n"
- "\n");
+ printf("\n"
+ "ewl_config [OPTIONS] [-set key=value] [-get key]\n"
+ " OPTIONS\n"
+ " -r \t - Save the system configuration file\n"
+ " -h|--help \t - Print help information\n"
+ "\n");
}
static void
ec_main_win(int save_system)
{
- Ewl_Widget *box, *o2, *o;
-
- o = ewl_window_new();
- ewl_window_title_set(EWL_WINDOW(o), "EWL Configuration");
- ewl_window_class_set(EWL_WINDOW(o), "ewl_config");
- ewl_window_name_set(EWL_WINDOW(o), "ewl_config");
- ewl_object_size_request(EWL_OBJECT(o), 450, 250);
- ewl_widget_name_set(o, EC_WIN_MAIN);
- ewl_callback_append(o, EWL_CALLBACK_DELETE_WINDOW,
- ec_cb_delete_window, NULL);
- ewl_widget_show(o);
-
- box = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(o), box);
- ewl_widget_show(box);
-
- o = ewl_hmenubar_new();
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ec_menubar_setup(EWL_MENUBAR(o));
- ewl_object_fill_policy_set(EWL_OBJECT(o),
- EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
- ewl_widget_show(o);
-
- o = ewl_notebook_new();
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_notebook_tabbar_alignment_set(EWL_NOTEBOOK(o), EWL_FLAG_ALIGN_LEFT);
- ewl_widget_show(o);
-
- ec_theme_page_setup(EWL_NOTEBOOK(o));
- ec_engine_page_setup(EWL_NOTEBOOK(o));
- ec_debug_page_setup(EWL_NOTEBOOK(o));
-
- o2 = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(box), o2);
- ewl_object_fill_policy_set(EWL_OBJECT(o2), EWL_FLAG_FILL_HFILL);
- ewl_widget_show(o2);
-
- o = ewl_button_new();
- ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_APPLY);
- ewl_container_child_append(EWL_CONTAINER(o2), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED, ec_cb_apply, NULL);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_VFILL);
- ewl_widget_show(o);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Revert");
- ewl_button_image_set(EWL_BUTTON(o),
- ewl_icon_theme_icon_path_get(EWL_ICON_DIALOG_CANCEL,
- EWL_ICON_SIZE_MEDIUM),
- EWL_ICON_DIALOG_CANCEL);
- ewl_container_child_append(EWL_CONTAINER(o2), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED, ec_cb_revert, NULL);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_VFILL);
- ewl_widget_show(o);
-
- o = ewl_button_new();
- ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_QUIT);
- ewl_container_child_append(EWL_CONTAINER(o2), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED, ec_cb_delete_window, NULL);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_VFILL);
- ewl_widget_show(o);
-
- o = ewl_spacer_new();
- ewl_container_child_append(EWL_CONTAINER(o2), o);
- ewl_widget_show(o);
-
- o = ewl_checkbutton_new();
- ewl_container_child_append(EWL_CONTAINER(o2), o);
- ewl_checkbutton_checked_set(EWL_CHECKBUTTON(o), save_system);
- ewl_checkbutton_label_position_set(EWL_CHECKBUTTON(o), EWL_POSITION_RIGHT);
- ewl_button_label_set(EWL_BUTTON(o), "Save as system configuration");
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_CENTER);
- ewl_widget_name_set(o, EC_SAVE_SYSTEM);
- ewl_widget_show(o);
-
- if (!ewl_config_can_save_system(ewl_config))
- ewl_widget_disable(o);
+ Ewl_Widget *box, *o2, *o;
+
+ o = ewl_window_new();
+ ewl_window_title_set(EWL_WINDOW(o), "EWL Configuration");
+ ewl_window_class_set(EWL_WINDOW(o), "ewl_config");
+ ewl_window_name_set(EWL_WINDOW(o), "ewl_config");
+ ewl_object_size_request(EWL_OBJECT(o), 450, 250);
+ ewl_widget_name_set(o, EC_WIN_MAIN);
+ ewl_callback_append(o, EWL_CALLBACK_DELETE_WINDOW,
+ ec_cb_delete_window, NULL);
+ ewl_widget_show(o);
+
+ box = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(o), box);
+ ewl_widget_show(box);
+
+ o = ewl_hmenubar_new();
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ec_menubar_setup(EWL_MENUBAR(o));
+ ewl_object_fill_policy_set(EWL_OBJECT(o),
+ EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
+ ewl_widget_show(o);
+
+ o = ewl_notebook_new();
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_notebook_tabbar_alignment_set(EWL_NOTEBOOK(o), EWL_FLAG_ALIGN_LEFT);
+ ewl_widget_show(o);
+
+ ec_theme_page_setup(EWL_NOTEBOOK(o));
+ ec_engine_page_setup(EWL_NOTEBOOK(o));
+ ec_debug_page_setup(EWL_NOTEBOOK(o));
+
+ o2 = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(box), o2);
+ ewl_object_fill_policy_set(EWL_OBJECT(o2), EWL_FLAG_FILL_HFILL);
+ ewl_widget_show(o2);
+
+ o = ewl_button_new();
+ ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_APPLY);
+ ewl_container_child_append(EWL_CONTAINER(o2), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED, ec_cb_apply, NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_VFILL);
+ ewl_widget_show(o);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Revert");
+ ewl_button_image_set(EWL_BUTTON(o),
+ ewl_icon_theme_icon_path_get(EWL_ICON_DIALOG_CANCEL,
+ EWL_ICON_SIZE_MEDIUM),
+ EWL_ICON_DIALOG_CANCEL);
+ ewl_container_child_append(EWL_CONTAINER(o2), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED, ec_cb_revert, NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_VFILL);
+ ewl_widget_show(o);
+
+ o = ewl_button_new();
+ ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_QUIT);
+ ewl_container_child_append(EWL_CONTAINER(o2), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED, ec_cb_delete_window, NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_VFILL);
+ ewl_widget_show(o);
+
+ o = ewl_spacer_new();
+ ewl_container_child_append(EWL_CONTAINER(o2), o);
+ ewl_widget_show(o);
+
+ o = ewl_checkbutton_new();
+ ewl_container_child_append(EWL_CONTAINER(o2), o);
+ ewl_checkbutton_checked_set(EWL_CHECKBUTTON(o), save_system);
+ ewl_checkbutton_label_position_set(EWL_CHECKBUTTON(o), EWL_POSITION_RIGHT);
+ ewl_button_label_set(EWL_BUTTON(o), "Save as system configuration");
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_CENTER);
+ ewl_widget_name_set(o, EC_SAVE_SYSTEM);
+ ewl_widget_show(o);
+
+ if (!ewl_config_can_save_system(ewl_config))
+ ewl_widget_disable(o);
}
static void
ec_cb_delete_window(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- ewl_main_quit();
+ ewl_main_quit();
}
#define EC_ICON(icon) ewl_icon_theme_icon_path_get(EWL_ICON_ ## icon, EWL_ICON_SIZE_SMALL)
static void
ec_menubar_setup(Ewl_Menubar *m)
{
- Ewl_Widget *menu, *o;
- int i;
-
- Ewl_Menu_Info file_menu[] = {
- {"Save", EC_ICON(DOCUMENT_SAVE), ec_cb_apply},
- {"Revert", EC_ICON(DOCUMENT_REVERT), ec_cb_revert},
- {"Quit", EC_ICON(APPLICATION_EXIT), ec_cb_delete_window},
- {NULL, NULL, NULL}
- };
-
- Ewl_Menu_Info help_menu[] = {
- {"About", EC_ICON(HELP_ABOUT), ec_cb_about},
- {NULL, NULL, NULL}
- };
-
- Ec_Gui_Menu menus[] = {
- {"File", file_menu},
- {"Help", help_menu},
- {NULL, NULL}
- };
-
- for (i = 0; menus[i].name != NULL; i++)
- {
- /* pack in a spacer before the help text */
- if (menus[i + 1].name == NULL)
- {
- o = ewl_spacer_new();
- ewl_container_child_append(EWL_CONTAINER(m), o);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_FILL);
- ewl_widget_show(o);
- }
-
- menu = ewl_menu_new();
- ewl_button_label_set(EWL_BUTTON(menu), menus[i].name);
- ewl_container_child_append(EWL_CONTAINER(m), menu);
- ewl_object_fill_policy_set(EWL_OBJECT(menu),
- EWL_FLAG_FILL_HSHRINK | EWL_FLAG_FILL_VFILL);
- ewl_menu_from_info(EWL_MENU(menu), menus[i].info);
- ewl_widget_show(menu);
- }
+ Ewl_Widget *menu, *o;
+ int i;
+
+ Ewl_Menu_Info file_menu[] = {
+ {"Save", EC_ICON(DOCUMENT_SAVE), ec_cb_apply},
+ {"Revert", EC_ICON(DOCUMENT_REVERT), ec_cb_revert},
+ {"Quit", EC_ICON(APPLICATION_EXIT), ec_cb_delete_window},
+ {NULL, NULL, NULL}
+ };
+
+ Ewl_Menu_Info help_menu[] = {
+ {"About", EC_ICON(HELP_ABOUT), ec_cb_about},
+ {NULL, NULL, NULL}
+ };
+
+ Ec_Gui_Menu menus[] = {
+ {"File", file_menu},
+ {"Help", help_menu},
+ {NULL, NULL}
+ };
+
+ for (i = 0; menus[i].name != NULL; i++)
+ {
+ /* pack in a spacer before the help text */
+ if (menus[i + 1].name == NULL)
+ {
+ o = ewl_spacer_new();
+ ewl_container_child_append(EWL_CONTAINER(m), o);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_FILL);
+ ewl_widget_show(o);
+ }
+
+ menu = ewl_menu_new();
+ ewl_button_label_set(EWL_BUTTON(menu), menus[i].name);
+ ewl_container_child_append(EWL_CONTAINER(m), menu);
+ ewl_object_fill_policy_set(EWL_OBJECT(menu),
+ EWL_FLAG_FILL_HSHRINK | EWL_FLAG_FILL_VFILL);
+ ewl_menu_from_info(EWL_MENU(menu), menus[i].info);
+ ewl_widget_show(menu);
+ }
}
static void
ec_theme_page_setup(Ewl_Notebook *n)
{
- Ewl_Widget *box, *o, *o2, *o3;
- DIR *rep;
- Ecore_List *list;
- const char *v;
- int val;
- int sel = -1;
- char *home_dir, path[PATH_MAX];
-
- box = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(n), box);
- ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(n), box, "Theme");
- ewl_widget_show(box);
-
- o2 = ewl_border_new();
- ewl_border_label_set(EWL_BORDER(o2), "EWL Theme");
- ewl_container_child_append(EWL_CONTAINER(box), o2);
- ewl_widget_show(o2);
-
- o3 = ewl_scrollpane_new();
- ewl_container_child_append(EWL_CONTAINER(o2), o3);
- ewl_widget_show(o3);
-
- o = ewl_list_new();
- list = ecore_list_new();
- ewl_widget_name_set(o, EC_EWL_THEME);
- ewl_container_child_append(EWL_CONTAINER(o3), o);
- ewl_mvc_model_set(EWL_MVC(o), ewl_model_ecore_list_instance());
- ewl_mvc_view_set(EWL_MVC(o), ewl_label_view_get());
- ewl_mvc_data_set(EWL_MVC(o), list);
- ewl_widget_show(o);
-
- v = ewl_config_string_get(ewl_config, EWL_CONFIG_THEME_NAME);
- rep = opendir(PACKAGE_DATA_DIR "/ewl/themes");
- if (rep)
- {
- int ret;
-
- ret = ec_themes_get(rep, list, v);
- if (ret >= 0)
- sel = ret;
- }
- closedir(rep);
-
- home_dir = getenv("HOME");
- snprintf(path, PATH_MAX, "%s/%s", home_dir, ".ewl/themes");
- rep = opendir(path);
- if (rep)
- {
- int ret;
-
- ret = ec_themes_get(rep, list, v);
- if (ret >= 0)
- sel = ret;
- }
- closedir(rep);
-
- if (sel >= 0)
- ewl_mvc_selected_set(EWL_MVC(o), NULL, list, sel, 0);
- ewl_mvc_dirty_set(EWL_MVC(o), TRUE);
-
- o2 = ewl_border_new();
- ewl_border_label_set(EWL_BORDER(o2), "Icon Theme");
- ewl_container_child_append(EWL_CONTAINER(box), o2);
- ewl_widget_show(o2);
-
- box = ewl_grid_new();
- ewl_grid_dimensions_set(EWL_GRID(box), 2, 2);
- ewl_grid_column_preferred_w_use(EWL_GRID(box), 0);
- ewl_container_child_append(EWL_CONTAINER(o2), box);
- ewl_widget_show(box);
-
- o = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(o), "Theme name");
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_widget_show(o);
-
- o = ewl_entry_new();
- ewl_widget_name_set(o, EC_ICON_THEME);
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_text_text_set(EWL_TEXT(o),
- ewl_config_string_get(ewl_config, EWL_CONFIG_THEME_ICON_THEME));
- ewl_widget_show(o);
-
- o = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(o), "Icon Size");
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_widget_show(o);
-
- val = ewl_config_int_get(ewl_config, EWL_CONFIG_THEME_ICON_SIZE);
-
- o = ewl_spinner_new();
- ewl_range_minimum_value_set(EWL_RANGE(o), 8.0);
- ewl_range_maximum_value_set(EWL_RANGE(o), 192.0);
- ewl_range_step_set(EWL_RANGE(o), 1.0);
- ewl_range_value_set(EWL_RANGE(o), val);
- ewl_spinner_digits_set(EWL_SPINNER(o), 0);
- ewl_widget_name_set(o, EC_ICON_SIZE);
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_widget_show(o);
+ Ewl_Widget *box, *o, *o2, *o3;
+ DIR *rep;
+ Ecore_List *list;
+ const char *v;
+ int val;
+ int sel = -1;
+ char *home_dir, path[PATH_MAX];
+
+ box = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(n), box);
+ ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(n), box, "Theme");
+ ewl_widget_show(box);
+
+ o2 = ewl_border_new();
+ ewl_border_label_set(EWL_BORDER(o2), "EWL Theme");
+ ewl_container_child_append(EWL_CONTAINER(box), o2);
+ ewl_widget_show(o2);
+
+ o3 = ewl_scrollpane_new();
+ ewl_container_child_append(EWL_CONTAINER(o2), o3);
+ ewl_widget_show(o3);
+
+ o = ewl_list_new();
+ list = ecore_list_new();
+ ewl_widget_name_set(o, EC_EWL_THEME);
+ ewl_container_child_append(EWL_CONTAINER(o3), o);
+ ewl_mvc_model_set(EWL_MVC(o), ewl_model_ecore_list_instance());
+ ewl_mvc_view_set(EWL_MVC(o), ewl_label_view_get());
+ ewl_mvc_data_set(EWL_MVC(o), list);
+ ewl_widget_show(o);
+
+ v = ewl_config_string_get(ewl_config, EWL_CONFIG_THEME_NAME);
+ rep = opendir(PACKAGE_DATA_DIR "/ewl/themes");
+ if (rep)
+ {
+ int ret;
+
+ ret = ec_themes_get(rep, list, v);
+ if (ret >= 0)
+ sel = ret;
+ }
+ closedir(rep);
+
+ home_dir = getenv("HOME");
+ snprintf(path, PATH_MAX, "%s/%s", home_dir, ".ewl/themes");
+ rep = opendir(path);
+ if (rep)
+ {
+ int ret;
+
+ ret = ec_themes_get(rep, list, v);
+ if (ret >= 0)
+ sel = ret;
+ }
+ closedir(rep);
+
+ if (sel >= 0)
+ ewl_mvc_selected_set(EWL_MVC(o), NULL, list, sel, 0);
+ ewl_mvc_dirty_set(EWL_MVC(o), TRUE);
+
+ o2 = ewl_border_new();
+ ewl_border_label_set(EWL_BORDER(o2), "Icon Theme");
+ ewl_container_child_append(EWL_CONTAINER(box), o2);
+ ewl_widget_show(o2);
+
+ box = ewl_grid_new();
+ ewl_grid_dimensions_set(EWL_GRID(box), 2, 2);
+ ewl_grid_column_preferred_w_use(EWL_GRID(box), 0);
+ ewl_container_child_append(EWL_CONTAINER(o2), box);
+ ewl_widget_show(box);
+
+ o = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(o), "Theme name");
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_widget_show(o);
+
+ o = ewl_entry_new();
+ ewl_widget_name_set(o, EC_ICON_THEME);
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_text_text_set(EWL_TEXT(o),
+ ewl_config_string_get(ewl_config, EWL_CONFIG_THEME_ICON_THEME));
+ ewl_widget_show(o);
+
+ o = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(o), "Icon Size");
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_widget_show(o);
+
+ val = ewl_config_int_get(ewl_config, EWL_CONFIG_THEME_ICON_SIZE);
+
+ o = ewl_spinner_new();
+ ewl_range_minimum_value_set(EWL_RANGE(o), 8.0);
+ ewl_range_maximum_value_set(EWL_RANGE(o), 192.0);
+ ewl_range_step_set(EWL_RANGE(o), 1.0);
+ ewl_range_value_set(EWL_RANGE(o), val);
+ ewl_spinner_digits_set(EWL_SPINNER(o), 0);
+ ewl_widget_name_set(o, EC_ICON_SIZE);
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_widget_show(o);
}
static void
ec_engine_page_setup(Ewl_Notebook *n)
{
- Ewl_Widget *box, *o, *o2;
-
- box = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(n), box);
- ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(n), box, "Engine");
- ewl_widget_show(box);
-
- o2 = ewl_grid_new();
- ewl_grid_column_preferred_w_use(EWL_GRID(o2), 0);
- ewl_container_child_append(EWL_CONTAINER(box), o2);
- ewl_object_fill_policy_set(EWL_OBJECT(o2), EWL_FLAG_FILL_HFILL);
- ewl_widget_show(o2);
-
- o = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(o), "Engine name");
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
- ewl_container_child_append(EWL_CONTAINER(o2), o);
- ewl_widget_show(o);
-
- o = ewl_entry_new();
- ewl_widget_name_set(o, EC_ENGINE_NAME);
- ewl_text_text_set(EWL_TEXT(o),
- ewl_config_string_get(ewl_config, EWL_CONFIG_ENGINE_NAME));
- ewl_container_child_append(EWL_CONTAINER(o2), o);
- ewl_widget_show(o);
-
- o = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(o), "Evas font cache size");
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
- ewl_container_child_append(EWL_CONTAINER(o2), o);
- ewl_widget_show(o);
-
- o = ewl_entry_new();
- ewl_widget_name_set(o, EC_EVAS_FONT_CACHE);
- ewl_text_text_set(EWL_TEXT(o),
- ewl_config_string_get(ewl_config, EWL_CONFIG_CACHE_EVAS_FONT));
- ewl_container_child_append(EWL_CONTAINER(o2), o);
- ewl_widget_show(o);
-
- o = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(o), "Evas image cache size");
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
- ewl_container_child_append(EWL_CONTAINER(o2), o);
- ewl_widget_show(o);
-
- o = ewl_entry_new();
- ewl_widget_name_set(o, EC_EVAS_IMAGE_CACHE);
- ewl_text_text_set(EWL_TEXT(o),
- ewl_config_string_get(ewl_config, EWL_CONFIG_CACHE_EVAS_IMAGE));
- ewl_container_child_append(EWL_CONTAINER(o2), o);
- ewl_widget_show(o);
+ Ewl_Widget *box, *o, *o2;
+
+ box = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(n), box);
+ ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(n), box, "Engine");
+ ewl_widget_show(box);
+
+ o2 = ewl_grid_new();
+ ewl_grid_column_preferred_w_use(EWL_GRID(o2), 0);
+ ewl_container_child_append(EWL_CONTAINER(box), o2);
+ ewl_object_fill_policy_set(EWL_OBJECT(o2), EWL_FLAG_FILL_HFILL);
+ ewl_widget_show(o2);
+
+ o = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(o), "Engine name");
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
+ ewl_container_child_append(EWL_CONTAINER(o2), o);
+ ewl_widget_show(o);
+
+ o = ewl_entry_new();
+ ewl_widget_name_set(o, EC_ENGINE_NAME);
+ ewl_text_text_set(EWL_TEXT(o),
+ ewl_config_string_get(ewl_config, EWL_CONFIG_ENGINE_NAME));
+ ewl_container_child_append(EWL_CONTAINER(o2), o);
+ ewl_widget_show(o);
+
+ o = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(o), "Evas font cache size");
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
+ ewl_container_child_append(EWL_CONTAINER(o2), o);
+ ewl_widget_show(o);
+
+ o = ewl_entry_new();
+ ewl_widget_name_set(o, EC_EVAS_FONT_CACHE);
+ ewl_text_text_set(EWL_TEXT(o),
+ ewl_config_string_get(ewl_config, EWL_CONFIG_CACHE_EVAS_FONT));
+ ewl_container_child_append(EWL_CONTAINER(o2), o);
+ ewl_widget_show(o);
+
+ o = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(o), "Evas image cache size");
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
+ ewl_container_child_append(EWL_CONTAINER(o2), o);
+ ewl_widget_show(o);
+
+ o = ewl_entry_new();
+ ewl_widget_name_set(o, EC_EVAS_IMAGE_CACHE);
+ ewl_text_text_set(EWL_TEXT(o),
+ ewl_config_string_get(ewl_config, EWL_CONFIG_CACHE_EVAS_IMAGE));
+ ewl_container_child_append(EWL_CONTAINER(o2), o);
+ ewl_widget_show(o);
}
static void
ec_debug_page_setup(Ewl_Notebook *n)
{
- Ewl_Widget *box, *o2;
- int i;
-
- struct
- {
- char *label;
- char *key;
- char *name;
- int spinner;
- } buttons[] = {
- {"Enabled", EWL_CONFIG_DEBUG_ENABLE, EC_DEBUG_ENABLE, 0},
- {"Level", EWL_CONFIG_DEBUG_LEVEL, EC_DEBUG_LEVEL, 1},
- {"Segv", EWL_CONFIG_DEBUG_SEGV, EC_DEBUG_SEGV, 0},
- {"Backtrace", EWL_CONFIG_DEBUG_BACKTRACE, EC_DEBUG_BACKTRACE, 0},
- {"Evas rendering", EWL_CONFIG_DEBUG_EVAS_RENDER, EC_DEBUG_EVAS_RENDER, 0},
- {"Garbage Collection", EWL_CONFIG_DEBUG_GC_REAP, EC_DEBUG_GARBAGE, 0},
- {"Print theme keys", EWL_CONFIG_THEME_PRINT_KEYS, EC_THEME_KEYS, 0},
- {"Print theme signals", EWL_CONFIG_THEME_PRINT_SIGNALS, EC_THEME_SIGNALS, 0},
- {NULL, NULL, NULL, 0}
- };
-
- box = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(n), box);
- ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(n), box, "Debug");
- ewl_widget_show(box);
-
- o2 = ewl_grid_new();
- ewl_grid_vhomogeneous_set(EWL_GRID(o2), TRUE);
- ewl_container_child_append(EWL_CONTAINER(box), o2);
- ewl_object_fill_policy_set(EWL_OBJECT(o2), EWL_FLAG_FILL_HSHRINK |
- EWL_FLAG_FILL_HFILL);
- ewl_widget_show(o2);
-
- for (i = 0; buttons[i].label != NULL; i++)
- {
- Ewl_Widget *o;
-
- if (buttons[i].spinner)
- {
- Ewl_Widget *s;
-
- o = ewl_hbox_new();
- ewl_widget_show(o);
-
- s = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(s), buttons[i].label);
- ewl_container_child_append(EWL_CONTAINER(o), s);
- ewl_widget_show(s);
-
- s = ewl_spinner_new();
- ewl_widget_name_set(s, buttons[i].name);
- ewl_spinner_digits_set(EWL_SPINNER(s), 0);
- ewl_range_minimum_value_set(EWL_RANGE(s), 0);
- ewl_range_maximum_value_set(EWL_RANGE(s), 100);
- ewl_range_step_set(EWL_RANGE(s), 1);
- ewl_range_value_set(EWL_RANGE(s),
- ewl_config_int_get(ewl_config, buttons[i].key));
- ewl_container_child_append(EWL_CONTAINER(o), s);
- ewl_widget_show(s);
- }
- else
- {
- o = ewl_checkbutton_new();
- ewl_widget_name_set(o, buttons[i].name);
- ewl_object_alignment_set(EWL_OBJECT(o),
- EWL_FLAG_ALIGN_LEFT);
- ewl_button_label_set(EWL_BUTTON(o), buttons[i].label);
- ewl_checkbutton_checked_set(EWL_CHECKBUTTON(o),
- ewl_config_int_get(ewl_config, buttons[i].key));
- ewl_widget_show(o);
- }
- ewl_container_child_append(EWL_CONTAINER(o2), o);
- }
+ Ewl_Widget *box, *o2;
+ int i;
+
+ struct
+ {
+ char *label;
+ char *key;
+ char *name;
+ int spinner;
+ } buttons[] = {
+ {"Enabled", EWL_CONFIG_DEBUG_ENABLE, EC_DEBUG_ENABLE, 0},
+ {"Level", EWL_CONFIG_DEBUG_LEVEL, EC_DEBUG_LEVEL, 1},
+ {"Segv", EWL_CONFIG_DEBUG_SEGV, EC_DEBUG_SEGV, 0},
+ {"Backtrace", EWL_CONFIG_DEBUG_BACKTRACE, EC_DEBUG_BACKTRACE, 0},
+ {"Evas rendering", EWL_CONFIG_DEBUG_EVAS_RENDER, EC_DEBUG_EVAS_RENDER, 0},
+ {"Garbage Collection", EWL_CONFIG_DEBUG_GC_REAP, EC_DEBUG_GARBAGE, 0},
+ {"Print theme keys", EWL_CONFIG_THEME_PRINT_KEYS, EC_THEME_KEYS, 0},
+ {"Print theme signals", EWL_CONFIG_THEME_PRINT_SIGNALS, EC_THEME_SIGNALS, 0},
+ {NULL, NULL, NULL, 0}
+ };
+
+ box = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(n), box);
+ ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(n), box, "Debug");
+ ewl_widget_show(box);
+
+ o2 = ewl_grid_new();
+ ewl_grid_vhomogeneous_set(EWL_GRID(o2), TRUE);
+ ewl_container_child_append(EWL_CONTAINER(box), o2);
+ ewl_object_fill_policy_set(EWL_OBJECT(o2), EWL_FLAG_FILL_HSHRINK |
+ EWL_FLAG_FILL_HFILL);
+ ewl_widget_show(o2);
+
+ for (i = 0; buttons[i].label != NULL; i++)
+ {
+ Ewl_Widget *o;
+
+ if (buttons[i].spinner)
+ {
+ Ewl_Widget *s;
+
+ o = ewl_hbox_new();
+ ewl_widget_show(o);
+
+ s = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(s), buttons[i].label);
+ ewl_container_child_append(EWL_CONTAINER(o), s);
+ ewl_widget_show(s);
+
+ s = ewl_spinner_new();
+ ewl_widget_name_set(s, buttons[i].name);
+ ewl_spinner_digits_set(EWL_SPINNER(s), 0);
+ ewl_range_minimum_value_set(EWL_RANGE(s), 0);
+ ewl_range_maximum_value_set(EWL_RANGE(s), 100);
+ ewl_range_step_set(EWL_RANGE(s), 1);
+ ewl_range_value_set(EWL_RANGE(s),
+ ewl_config_int_get(ewl_config, buttons[i].key));
+ ewl_container_child_append(EWL_CONTAINER(o), s);
+ ewl_widget_show(s);
+ }
+ else
+ {
+ o = ewl_checkbutton_new();
+ ewl_widget_name_set(o, buttons[i].name);
+ ewl_object_alignment_set(EWL_OBJECT(o),
+ EWL_FLAG_ALIGN_LEFT);
+ ewl_button_label_set(EWL_BUTTON(o), buttons[i].label);
+ ewl_checkbutton_checked_set(EWL_CHECKBUTTON(o),
+ ewl_config_int_get(ewl_config, buttons[i].key));
+ ewl_widget_show(o);
+ }
+ ewl_container_child_append(EWL_CONTAINER(o2), o);
+ }
}
static void
ec_cb_about(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *about, *o;
-
- about = ewl_widget_name_find(EC_WIN_ABOUT);
- if (about)
- {
- ewl_widget_show(about);
- return;
- }
-
- about = ewl_dialog_new();
- ewl_window_title_set(EWL_WINDOW(about), "About EWL Configuration");
- ewl_window_name_set(EWL_WINDOW(about), "about ewl_config");
- ewl_window_class_set(EWL_WINDOW(about), "ewl_config");
- ewl_widget_name_set(about, EC_WIN_ABOUT);
- ewl_window_transient_for(EWL_WINDOW(about),
- EWL_WINDOW(ewl_widget_name_find(EC_WIN_MAIN)));
- ewl_callback_append(about, EWL_CALLBACK_DELETE_WINDOW,
- ec_cb_win_hide, about);
- ewl_widget_show(about);
- ewl_dialog_active_area_set(EWL_DIALOG(about), EWL_POSITION_TOP);
-
- o = ewl_text_new();
- ewl_container_child_append(EWL_CONTAINER(about), o);
- ewl_widget_show(o);
-
- ewl_text_wrap_set(EWL_TEXT(o), EWL_TEXT_WRAP_WORD);
-
- ewl_text_font_size_set(EWL_TEXT(o), 25);
- ewl_text_font_set(EWL_TEXT(o), "ewl/default/bold");
- ewl_text_align_set(EWL_TEXT(o), EWL_FLAG_ALIGN_CENTER);
- ewl_text_styles_set(EWL_TEXT(o), EWL_TEXT_STYLE_SOFT_SHADOW);
- ewl_text_text_set(EWL_TEXT(o), "EWL Config\n");
-
- ewl_text_font_size_set(EWL_TEXT(o), 10);
- ewl_text_font_set(EWL_TEXT(o), "ewl/default");
- ewl_text_align_set(EWL_TEXT(o), EWL_FLAG_ALIGN_LEFT);
- ewl_text_styles_set(EWL_TEXT(o), EWL_TEXT_STYLE_NONE);
- ewl_text_text_append(EWL_TEXT(o), "\n");
- ewl_text_text_append(EWL_TEXT(o), "Configure your EWL install.\n");
- ewl_text_text_append(EWL_TEXT(o), "\n");
-
- ewl_dialog_active_area_set(EWL_DIALOG(about), EWL_POSITION_BOTTOM);
-
- o = ewl_button_new();
- ewl_container_child_append(EWL_CONTAINER(about), o);
- ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_OK);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED, ec_cb_win_hide, about);
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_CENTER);
- ewl_widget_show(o);
+ Ewl_Widget *about, *o;
+
+ about = ewl_widget_name_find(EC_WIN_ABOUT);
+ if (about)
+ {
+ ewl_widget_show(about);
+ return;
+ }
+
+ about = ewl_dialog_new();
+ ewl_window_title_set(EWL_WINDOW(about), "About EWL Configuration");
+ ewl_window_name_set(EWL_WINDOW(about), "about ewl_config");
+ ewl_window_class_set(EWL_WINDOW(about), "ewl_config");
+ ewl_widget_name_set(about, EC_WIN_ABOUT);
+ ewl_window_transient_for(EWL_WINDOW(about),
+ EWL_WINDOW(ewl_widget_name_find(EC_WIN_MAIN)));
+ ewl_callback_append(about, EWL_CALLBACK_DELETE_WINDOW,
+ ec_cb_win_hide, about);
+ ewl_widget_show(about);
+ ewl_dialog_active_area_set(EWL_DIALOG(about), EWL_POSITION_TOP);
+
+ o = ewl_text_new();
+ ewl_container_child_append(EWL_CONTAINER(about), o);
+ ewl_widget_show(o);
+
+ ewl_text_wrap_set(EWL_TEXT(o), EWL_TEXT_WRAP_WORD);
+
+ ewl_text_font_size_set(EWL_TEXT(o), 25);
+ ewl_text_font_set(EWL_TEXT(o), "ewl/default/bold");
+ ewl_text_align_set(EWL_TEXT(o), EWL_FLAG_ALIGN_CENTER);
+ ewl_text_styles_set(EWL_TEXT(o), EWL_TEXT_STYLE_SOFT_SHADOW);
+ ewl_text_text_set(EWL_TEXT(o), "EWL Config\n");
+
+ ewl_text_font_size_set(EWL_TEXT(o), 10);
+ ewl_text_font_set(EWL_TEXT(o), "ewl/default");
+ ewl_text_align_set(EWL_TEXT(o), EWL_FLAG_ALIGN_LEFT);
+ ewl_text_styles_set(EWL_TEXT(o), EWL_TEXT_STYLE_NONE);
+ ewl_text_text_append(EWL_TEXT(o), "\n");
+ ewl_text_text_append(EWL_TEXT(o), "Configure your EWL install.\n");
+ ewl_text_text_append(EWL_TEXT(o), "\n");
+
+ ewl_dialog_active_area_set(EWL_DIALOG(about), EWL_POSITION_BOTTOM);
+
+ o = ewl_button_new();
+ ewl_container_child_append(EWL_CONTAINER(about), o);
+ ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_OK);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED, ec_cb_win_hide, about);
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_CENTER);
+ ewl_widget_show(o);
}
static void
ec_cb_win_hide(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, void *data)
{
- ewl_widget_hide(EWL_WIDGET(data));
+ ewl_widget_hide(EWL_WIDGET(data));
}
static void
ec_cb_revert(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *o;
- Ecore_List *list;
- int val, sel = 0;
- const char *v, *lval;
-
- struct
- {
- char *name;
- char *key;
- } checks[] = {
- {EC_DEBUG_ENABLE, EWL_CONFIG_DEBUG_ENABLE},
- {EC_DEBUG_SEGV, EWL_CONFIG_DEBUG_SEGV},
- {EC_DEBUG_BACKTRACE, EWL_CONFIG_DEBUG_BACKTRACE},
- {EC_DEBUG_EVAS_RENDER, EWL_CONFIG_DEBUG_EVAS_RENDER},
- {EC_DEBUG_GARBAGE, EWL_CONFIG_DEBUG_GC_REAP},
- {EC_THEME_KEYS, EWL_CONFIG_THEME_PRINT_KEYS},
- {EC_THEME_SIGNALS, EWL_CONFIG_THEME_PRINT_SIGNALS},
- {NULL, NULL}
- };
-
- struct
- {
- char *name;
- char *key;
- } strings[] = {
- {EC_ICON_THEME, EWL_CONFIG_THEME_ICON_THEME},
- {EC_ENGINE_NAME, EWL_CONFIG_ENGINE_NAME},
- {EC_EVAS_IMAGE_CACHE, EWL_CONFIG_CACHE_EVAS_IMAGE},
- {EC_EVAS_FONT_CACHE, EWL_CONFIG_CACHE_EVAS_FONT},
- {NULL, NULL}
- };
-
- o = ewl_widget_name_find(EC_EWL_THEME);
- list = ewl_mvc_data_get(EWL_MVC(o));
- v = ewl_config_string_get(ewl_config, EWL_CONFIG_THEME_NAME);
-
- ecore_list_first_goto(list);
- while ((lval = ecore_list_next(list)))
- {
- if (!strcmp(v, lval))
- break;
- sel++;
- }
- ewl_mvc_selected_set(EWL_MVC(o), NULL, list, sel, 0);
-
- o = ewl_widget_name_find(EC_ICON_SIZE);
- val = ewl_config_int_get(ewl_config, EWL_CONFIG_THEME_ICON_SIZE);
- ewl_range_value_set(EWL_RANGE(o), val);
-
- for (sel = 0; strings[sel].name != NULL; sel++)
- {
- o = ewl_widget_name_find(strings[sel].name);
- ewl_text_text_set(EWL_TEXT(o),
- ewl_config_string_get(ewl_config, strings[sel].key));
- }
-
- o = ewl_widget_name_find(EC_DEBUG_LEVEL);
- ewl_range_value_set(EWL_RANGE(o),
- ewl_config_int_get(ewl_config, EWL_CONFIG_DEBUG_LEVEL));
-
- for (sel = 0; checks[sel].name != NULL; sel++)
- {
- o = ewl_widget_name_find(checks[sel].name);
- ewl_checkbutton_checked_set(EWL_CHECKBUTTON(o),
- ewl_config_int_get(ewl_config, checks[sel].key));
- }
+ Ewl_Widget *o;
+ Ecore_List *list;
+ int val, sel = 0;
+ const char *v, *lval;
+
+ struct
+ {
+ char *name;
+ char *key;
+ } checks[] = {
+ {EC_DEBUG_ENABLE, EWL_CONFIG_DEBUG_ENABLE},
+ {EC_DEBUG_SEGV, EWL_CONFIG_DEBUG_SEGV},
+ {EC_DEBUG_BACKTRACE, EWL_CONFIG_DEBUG_BACKTRACE},
+ {EC_DEBUG_EVAS_RENDER, EWL_CONFIG_DEBUG_EVAS_RENDER},
+ {EC_DEBUG_GARBAGE, EWL_CONFIG_DEBUG_GC_REAP},
+ {EC_THEME_KEYS, EWL_CONFIG_THEME_PRINT_KEYS},
+ {EC_THEME_SIGNALS, EWL_CONFIG_THEME_PRINT_SIGNALS},
+ {NULL, NULL}
+ };
+
+ struct
+ {
+ char *name;
+ char *key;
+ } strings[] = {
+ {EC_ICON_THEME, EWL_CONFIG_THEME_ICON_THEME},
+ {EC_ENGINE_NAME, EWL_CONFIG_ENGINE_NAME},
+ {EC_EVAS_IMAGE_CACHE, EWL_CONFIG_CACHE_EVAS_IMAGE},
+ {EC_EVAS_FONT_CACHE, EWL_CONFIG_CACHE_EVAS_FONT},
+ {NULL, NULL}
+ };
+
+ o = ewl_widget_name_find(EC_EWL_THEME);
+ list = ewl_mvc_data_get(EWL_MVC(o));
+ v = ewl_config_string_get(ewl_config, EWL_CONFIG_THEME_NAME);
+
+ ecore_list_first_goto(list);
+ while ((lval = ecore_list_next(list)))
+ {
+ if (!strcmp(v, lval))
+ break;
+ sel++;
+ }
+ ewl_mvc_selected_set(EWL_MVC(o), NULL, list, sel, 0);
+
+ o = ewl_widget_name_find(EC_ICON_SIZE);
+ val = ewl_config_int_get(ewl_config, EWL_CONFIG_THEME_ICON_SIZE);
+ ewl_range_value_set(EWL_RANGE(o), val);
+
+ for (sel = 0; strings[sel].name != NULL; sel++)
+ {
+ o = ewl_widget_name_find(strings[sel].name);
+ ewl_text_text_set(EWL_TEXT(o),
+ ewl_config_string_get(ewl_config, strings[sel].key));
+ }
+
+ o = ewl_widget_name_find(EC_DEBUG_LEVEL);
+ ewl_range_value_set(EWL_RANGE(o),
+ ewl_config_int_get(ewl_config, EWL_CONFIG_DEBUG_LEVEL));
+
+ for (sel = 0; checks[sel].name != NULL; sel++)
+ {
+ o = ewl_widget_name_find(checks[sel].name);
+ ewl_checkbutton_checked_set(EWL_CHECKBUTTON(o),
+ ewl_config_int_get(ewl_config, checks[sel].key));
+ }
}
static void
ec_cb_apply(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *o;
- Ecore_List *list;
- int val, i;
- const char *v;
- Ewl_Selection_Idx *idx;
-
- struct
- {
- char *name;
- char *key;
- } checks[] = {
- {EC_DEBUG_ENABLE, EWL_CONFIG_DEBUG_ENABLE},
- {EC_DEBUG_SEGV, EWL_CONFIG_DEBUG_SEGV},
- {EC_DEBUG_BACKTRACE, EWL_CONFIG_DEBUG_BACKTRACE},
- {EC_DEBUG_EVAS_RENDER, EWL_CONFIG_DEBUG_EVAS_RENDER},
- {EC_DEBUG_GARBAGE, EWL_CONFIG_DEBUG_GC_REAP},
- {EC_THEME_KEYS, EWL_CONFIG_THEME_PRINT_KEYS},
- {EC_THEME_SIGNALS, EWL_CONFIG_THEME_PRINT_SIGNALS},
- {NULL, NULL}
- };
-
- struct
- {
- char *name;
- char *key;
- } strings[] = {
- {EC_ICON_THEME, EWL_CONFIG_THEME_ICON_THEME},
- {EC_ENGINE_NAME, EWL_CONFIG_ENGINE_NAME},
- {EC_EVAS_IMAGE_CACHE, EWL_CONFIG_CACHE_EVAS_IMAGE},
- {EC_EVAS_FONT_CACHE, EWL_CONFIG_CACHE_EVAS_FONT},
- {NULL, NULL}
- };
-
- for (i = 0; checks[i].name != NULL; i++)
- {
- o = ewl_widget_name_find(checks[i].name);
- if (ewl_checkbutton_is_checked(EWL_CHECKBUTTON(o)) !=
- ewl_config_int_get(ewl_config, checks[i].key))
- ewl_config_int_set(ewl_config, checks[i].key,
- ewl_checkbutton_is_checked(EWL_CHECKBUTTON(o)),
- EWL_STATE_PERSISTENT);
- }
-
- for (i = 0; strings[i].name != NULL; i++)
- {
- char *new;
-
- o = ewl_widget_name_find(strings[i].name);
- new = ewl_text_text_get(EWL_TEXT(o));
- if (strcmp(new, ewl_config_string_get(ewl_config,
- strings[i].key)))
- {
- ewl_config_string_set(ewl_config,
- strings[i].key, new,
- EWL_STATE_PERSISTENT);
- }
- }
-
- o = ewl_widget_name_find(EC_DEBUG_LEVEL);
- if (ewl_range_value_get(EWL_RANGE(o)) !=
- ewl_config_int_get(ewl_config, EWL_CONFIG_DEBUG_LEVEL))
- {
- ewl_config_int_set(ewl_config, EWL_CONFIG_DEBUG_LEVEL,
- ewl_range_value_get(EWL_RANGE(o)),
- EWL_STATE_PERSISTENT);
- }
-
- o = ewl_widget_name_find(EC_ICON_SIZE);
- val = ewl_range_value_get(EWL_RANGE(o));
- if (val != ewl_config_int_get(ewl_config, EWL_CONFIG_THEME_ICON_SIZE))
- {
- ewl_config_int_set(ewl_config,
- EWL_CONFIG_THEME_ICON_SIZE, val,
- EWL_STATE_PERSISTENT);
- }
-
- o = ewl_widget_name_find(EC_EWL_THEME);
- list = ewl_mvc_data_get(EWL_MVC(o));
- idx = ewl_mvc_selected_get(EWL_MVC(o));
- if (idx)
- {
- ecore_list_index_goto(list, idx->row);
- v = ecore_list_current(list);
-
- if (strcmp(v, ewl_config_string_get(ewl_config,
- EWL_CONFIG_THEME_NAME)))
- {
- ewl_config_string_set(ewl_config,
- EWL_CONFIG_THEME_NAME, v,
- EWL_STATE_PERSISTENT);
- }
- }
-
- o = ewl_widget_name_find(EC_SAVE_SYSTEM);
- if (ewl_checkbutton_is_checked(EWL_CHECKBUTTON(o)))
- {
- if (!ewl_config_can_save_system(ewl_config))
- fprintf(stderr, "Cannot save system config.\n");
- else
- ewl_config_system_save(ewl_config);
- }
- else
- ewl_config_user_save(ewl_config);
+ Ewl_Widget *o;
+ Ecore_List *list;
+ int val, i;
+ const char *v;
+ Ewl_Selection_Idx *idx;
+
+ struct
+ {
+ char *name;
+ char *key;
+ } checks[] = {
+ {EC_DEBUG_ENABLE, EWL_CONFIG_DEBUG_ENABLE},
+ {EC_DEBUG_SEGV, EWL_CONFIG_DEBUG_SEGV},
+ {EC_DEBUG_BACKTRACE, EWL_CONFIG_DEBUG_BACKTRACE},
+ {EC_DEBUG_EVAS_RENDER, EWL_CONFIG_DEBUG_EVAS_RENDER},
+ {EC_DEBUG_GARBAGE, EWL_CONFIG_DEBUG_GC_REAP},
+ {EC_THEME_KEYS, EWL_CONFIG_THEME_PRINT_KEYS},
+ {EC_THEME_SIGNALS, EWL_CONFIG_THEME_PRINT_SIGNALS},
+ {NULL, NULL}
+ };
+
+ struct
+ {
+ char *name;
+ char *key;
+ } strings[] = {
+ {EC_ICON_THEME, EWL_CONFIG_THEME_ICON_THEME},
+ {EC_ENGINE_NAME, EWL_CONFIG_ENGINE_NAME},
+ {EC_EVAS_IMAGE_CACHE, EWL_CONFIG_CACHE_EVAS_IMAGE},
+ {EC_EVAS_FONT_CACHE, EWL_CONFIG_CACHE_EVAS_FONT},
+ {NULL, NULL}
+ };
+
+ for (i = 0; checks[i].name != NULL; i++)
+ {
+ o = ewl_widget_name_find(checks[i].name);
+ if (ewl_checkbutton_is_checked(EWL_CHECKBUTTON(o)) !=
+ ewl_config_int_get(ewl_config, checks[i].key))
+ ewl_config_int_set(ewl_config, checks[i].key,
+ ewl_checkbutton_is_checked(EWL_CHECKBUTTON(o)),
+ EWL_STATE_PERSISTENT);
+ }
+
+ for (i = 0; strings[i].name != NULL; i++)
+ {
+ char *new;
+
+ o = ewl_widget_name_find(strings[i].name);
+ new = ewl_text_text_get(EWL_TEXT(o));
+ if (strcmp(new, ewl_config_string_get(ewl_config,
+ strings[i].key)))
+ {
+ ewl_config_string_set(ewl_config,
+ strings[i].key, new,
+ EWL_STATE_PERSISTENT);
+ }
+ }
+
+ o = ewl_widget_name_find(EC_DEBUG_LEVEL);
+ if (ewl_range_value_get(EWL_RANGE(o)) !=
+ ewl_config_int_get(ewl_config, EWL_CONFIG_DEBUG_LEVEL))
+ {
+ ewl_config_int_set(ewl_config, EWL_CONFIG_DEBUG_LEVEL,
+ ewl_range_value_get(EWL_RANGE(o)),
+ EWL_STATE_PERSISTENT);
+ }
+
+ o = ewl_widget_name_find(EC_ICON_SIZE);
+ val = ewl_range_value_get(EWL_RANGE(o));
+ if (val != ewl_config_int_get(ewl_config, EWL_CONFIG_THEME_ICON_SIZE))
+ {
+ ewl_config_int_set(ewl_config,
+ EWL_CONFIG_THEME_ICON_SIZE, val,
+ EWL_STATE_PERSISTENT);
+ }
+
+ o = ewl_widget_name_find(EC_EWL_THEME);
+ list = ewl_mvc_data_get(EWL_MVC(o));
+ idx = ewl_mvc_selected_get(EWL_MVC(o));
+ if (idx)
+ {
+ ecore_list_index_goto(list, idx->row);
+ v = ecore_list_current(list);
+
+ if (strcmp(v, ewl_config_string_get(ewl_config,
+ EWL_CONFIG_THEME_NAME)))
+ {
+ ewl_config_string_set(ewl_config,
+ EWL_CONFIG_THEME_NAME, v,
+ EWL_STATE_PERSISTENT);
+ }
+ }
+
+ o = ewl_widget_name_find(EC_SAVE_SYSTEM);
+ if (ewl_checkbutton_is_checked(EWL_CHECKBUTTON(o)))
+ {
+ if (!ewl_config_can_save_system(ewl_config))
+ fprintf(stderr, "Cannot save system config.\n");
+ else
+ ewl_config_system_save(ewl_config);
+ }
+ else
+ ewl_config_user_save(ewl_config);
}
int
ec_themes_get(DIR *rep, Ecore_List *list, const char *v)
{
- struct dirent *file;
- int z = -1;
+ struct dirent *file;
+ int z = -1;
- while ((file = readdir(rep)))
- {
- int len;
+ while ((file = readdir(rep)))
+ {
+ int len;
- len = strlen(file->d_name);
+ len = strlen(file->d_name);
- if ((len >= 4) &&
- (!strcmp(file->d_name + len - 4, ".edj")))
- {
- char *t;
+ if ((len >= 4) &&
+ (!strcmp(file->d_name + len - 4, ".edj")))
+ {
+ char *t;
- t = strdup(file->d_name);
- *(t + len - 4) = '\0';
+ t = strdup(file->d_name);
+ *(t + len - 4) = '\0';
- ecore_list_append(list, t);
+ ecore_list_append(list, t);
- if (!strcmp(t, v))
- z = ecore_list_count(list) - 1;
- }
- }
+ if (!strcmp(t, v))
+ z = ecore_list_count(list) - 1;
+ }
+ }
- return z;
+ return z;
}
diff --git a/tools/ewl_edb_ed/ewl_edb_ed.c b/tools/ewl_edb_ed/ewl_edb_ed.c
index e486642..7d764e2 100644
--- a/tools/ewl_edb_ed/ewl_edb_ed.c
+++ b/tools/ewl_edb_ed/ewl_edb_ed.c
@@ -4,11 +4,11 @@
static E_DB_File *db_file = NULL;
typedef enum {
- EWL_EDB_TYPE_NONE,
- EWL_EDB_TYPE_INT,
- EWL_EDB_TYPE_STR,
- EWL_EDB_TYPE_FLOAT,
- EWL_EDB_TYPE_DATA
+ EWL_EDB_TYPE_NONE,
+ EWL_EDB_TYPE_INT,
+ EWL_EDB_TYPE_STR,
+ EWL_EDB_TYPE_FLOAT,
+ EWL_EDB_TYPE_DATA
} Ewl_Edb_Type;
static Ewl_Edb_Type current_type = EWL_EDB_TYPE_NONE;
@@ -47,7 +47,7 @@ int main(int argc, char ** argv) {
ewl_container_child_append(EWL_CONTAINER(win), box);
ewl_widget_show(box);
- /* box to hold menu */
+ /* box to hold menu */
menu_box = ewl_hbox_new();
ewl_container_child_append(EWL_CONTAINER(box), menu_box);
ewl_object_fill_policy_set(EWL_OBJECT(menu_box),
@@ -58,76 +58,76 @@ int main(int argc, char ** argv) {
ewl_container_child_append(EWL_CONTAINER(box), hbox);
ewl_widget_show(hbox);
- /* create the tree */
- {
- char * headers [] = {
- "type", "key", "value"
- };
- tree = ewl_tree_new(3);
- ewl_container_child_append(EWL_CONTAINER(hbox), tree);
- ewl_object_padding_set(EWL_OBJECT(tree), 2, 0, 0, 0);
- ewl_tree_headers_set(EWL_TREE(tree), headers);
- ewl_widget_show(tree);
- }
-
- box2 = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(hbox), box2);
- ewl_widget_show(box2);
+ /* create the tree */
+ {
+ char * headers [] = {
+ "type", "key", "value"
+ };
+ tree = ewl_tree_new(3);
+ ewl_container_child_append(EWL_CONTAINER(hbox), tree);
+ ewl_object_padding_set(EWL_OBJECT(tree), 2, 0, 0, 0);
+ ewl_tree_headers_set(EWL_TREE(tree), headers);
+ ewl_widget_show(tree);
+ }
+
+ box2 = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(hbox), box2);
+ ewl_widget_show(box2);
/* create the combo box */
combo = ewl_combo_new("data type");
ewl_container_child_append(EWL_CONTAINER(box2), combo);
- ewl_object_padding_set(EWL_OBJECT(combo), 5, 0, 0, 0);
+ ewl_object_padding_set(EWL_OBJECT(combo), 5, 0, 0, 0);
ewl_widget_show(combo);
{
o = ewl_menu_item_new(NULL, "int");
ewl_container_child_append(EWL_CONTAINER(combo), o);
- ewl_callback_append(o, EWL_CALLBACK_SELECT, type_sel_cb, (int *)EWL_EDB_TYPE_INT);
+ ewl_callback_append(o, EWL_CALLBACK_SELECT, type_sel_cb, (int *)EWL_EDB_TYPE_INT);
ewl_widget_show(o);
o = ewl_menu_item_new(NULL, "str");
ewl_container_child_append(EWL_CONTAINER(combo), o);
- ewl_callback_append(o, EWL_CALLBACK_SELECT, type_sel_cb, (int *)EWL_EDB_TYPE_STR);
+ ewl_callback_append(o, EWL_CALLBACK_SELECT, type_sel_cb, (int *)EWL_EDB_TYPE_STR);
ewl_widget_show(o);
o = ewl_menu_item_new(NULL, "float");
ewl_container_child_append(EWL_CONTAINER(combo), o);
- ewl_callback_append(o, EWL_CALLBACK_SELECT, type_sel_cb, (int *)EWL_EDB_TYPE_FLOAT);
+ ewl_callback_append(o, EWL_CALLBACK_SELECT, type_sel_cb, (int *)EWL_EDB_TYPE_FLOAT);
ewl_widget_show(o);
o = ewl_menu_item_new(NULL, "data");
ewl_container_child_append(EWL_CONTAINER(combo), o);
- ewl_callback_append(o, EWL_CALLBACK_SELECT, type_sel_cb, (int *)EWL_EDB_TYPE_DATA);
+ ewl_callback_append(o, EWL_CALLBACK_SELECT, type_sel_cb, (int *)EWL_EDB_TYPE_DATA);
ewl_widget_show(o);
}
/* value entry box */
val_box = ewl_entry_new("");
ewl_container_child_append(EWL_CONTAINER(box2), val_box);
- ewl_object_alignment_set(EWL_OBJECT(val_box), EWL_FLAG_ALIGN_CENTER);
+ ewl_object_alignment_set(EWL_OBJECT(val_box), EWL_FLAG_ALIGN_CENTER);
ewl_widget_show(val_box);
- /* add/delete buttons on right */
- {
- Ewl_Widget *add_del_box = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(box2), add_del_box);
- ewl_widget_show(add_del_box);
-
- o = ewl_button_new("add");
- ewl_container_child_append(EWL_CONTAINER(add_del_box), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED, add_cb, NULL);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
- ewl_object_padding_set(EWL_OBJECT(o), 5, 5, 2, 2);
- ewl_widget_show(o);
-
- o = ewl_button_new("delete");
- ewl_container_child_append(EWL_CONTAINER(add_del_box), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED, delete_cb, NULL);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
- ewl_object_padding_set(EWL_OBJECT(o), 0, 5, 2, 2);
- ewl_widget_show(o);
- }
+ /* add/delete buttons on right */
+ {
+ Ewl_Widget *add_del_box = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(box2), add_del_box);
+ ewl_widget_show(add_del_box);
+
+ o = ewl_button_new("add");
+ ewl_container_child_append(EWL_CONTAINER(add_del_box), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED, add_cb, NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
+ ewl_object_padding_set(EWL_OBJECT(o), 5, 5, 2, 2);
+ ewl_widget_show(o);
+
+ o = ewl_button_new("delete");
+ ewl_container_child_append(EWL_CONTAINER(add_del_box), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED, delete_cb, NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
+ ewl_object_padding_set(EWL_OBJECT(o), 0, 5, 2, 2);
+ ewl_widget_show(o);
+ }
/* create the menu */
{
@@ -141,12 +141,12 @@ int main(int argc, char ** argv) {
o = ewl_menu_item_new(NULL, "open");
ewl_container_child_append(EWL_CONTAINER(file), o);
- ewl_callback_append(o, EWL_CALLBACK_SELECT, open_cb, NULL);
+ ewl_callback_append(o, EWL_CALLBACK_SELECT, open_cb, NULL);
ewl_widget_show(o);
o = ewl_menu_item_new(NULL, "save");
ewl_container_child_append(EWL_CONTAINER(file), o);
- ewl_callback_append(o, EWL_CALLBACK_SELECT, save_cb, NULL);
+ ewl_callback_append(o, EWL_CALLBACK_SELECT, save_cb, NULL);
ewl_widget_show(o);
o = ewl_menu_item_new(NULL, "quit");
@@ -160,34 +160,34 @@ int main(int argc, char ** argv) {
ewl_container_child_append(EWL_CONTAINER(box), key_name_box);
ewl_widget_show(key_name_box);
- o = ewl_hseparator_new();
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_widget_show(o);
-
- /* save /quit buttons on bottom */
- box2 = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(box), box2);
- ewl_object_fill_policy_set(EWL_OBJECT(box2),
- EWL_FLAG_FILL_VSHRINK | EWL_FLAG_FILL_HFILL);
- ewl_object_alignment_set(EWL_OBJECT(box2), EWL_FLAG_ALIGN_RIGHT);
- ewl_widget_show(box2);
-
- o = ewl_button_stock_new(EWL_STOCK_SAVE);
- ewl_container_child_append(EWL_CONTAINER(box2), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED, save_cb, NULL);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
- ewl_object_padding_set(EWL_OBJECT(o), 5, 5, 2, 2);
- ewl_widget_show(o);
-
- o = ewl_button_stock_new(EWL_STOCK_QUIT);
- ewl_container_child_append(EWL_CONTAINER(box2), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED, win_del_cb, NULL);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
- ewl_object_padding_set(EWL_OBJECT(o), 0, 5, 2, 2);
- ewl_widget_show(o);
-
- if (argc > 1)
- open_file_cb(NULL, argv[1], NULL);
+ o = ewl_hseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_widget_show(o);
+
+ /* save /quit buttons on bottom */
+ box2 = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(box), box2);
+ ewl_object_fill_policy_set(EWL_OBJECT(box2),
+ EWL_FLAG_FILL_VSHRINK | EWL_FLAG_FILL_HFILL);
+ ewl_object_alignment_set(EWL_OBJECT(box2), EWL_FLAG_ALIGN_RIGHT);
+ ewl_widget_show(box2);
+
+ o = ewl_button_stock_new(EWL_STOCK_SAVE);
+ ewl_container_child_append(EWL_CONTAINER(box2), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED, save_cb, NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
+ ewl_object_padding_set(EWL_OBJECT(o), 5, 5, 2, 2);
+ ewl_widget_show(o);
+
+ o = ewl_button_stock_new(EWL_STOCK_QUIT);
+ ewl_container_child_append(EWL_CONTAINER(box2), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED, win_del_cb, NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
+ ewl_object_padding_set(EWL_OBJECT(o), 0, 5, 2, 2);
+ ewl_widget_show(o);
+
+ if (argc > 1)
+ open_file_cb(NULL, argv[1], NULL);
ewl_main();
return 1;
@@ -203,198 +203,198 @@ void win_del_cb(Ewl_Widget *w, void *event, void *data) {
}
void open_file_cb(Ewl_Widget *w, void *event, void *data) {
- Ewl_Widget *fd_win = (Ewl_Widget *)data;
- char *file = (char *)event;
- char **key_list = NULL;
- int num_ret = 0;
+ Ewl_Widget *fd_win = (Ewl_Widget *)data;
+ char *file = (char *)event;
+ char **key_list = NULL;
+ int num_ret = 0;
- fd_win_del_cb(NULL, NULL, fd_win);
- if (file == NULL)
- return;
+ fd_win_del_cb(NULL, NULL, fd_win);
+ if (file == NULL)
+ return;
- db_file = e_db_open(file);
+ db_file = e_db_open(file);
- if (db_file == NULL) {
- printf("Unable to open file %s\n", file);
- return;
- }
+ if (db_file == NULL) {
+ printf("Unable to open file %s\n", file);
+ return;
+ }
- key_list = e_db_dump_key_list(file, &num_ret);
- {
- int i = 0;
+ key_list = e_db_dump_key_list(file, &num_ret);
+ {
+ int i = 0;
- for(i = 0; i < num_ret; i++) {
- if (key_list[i] != NULL) {
- Ewl_Widget * widgets[3];
- char *type = e_db_type_get(db_file, key_list[i]);
- char val[512];
+ for(i = 0; i < num_ret; i++) {
+ if (key_list[i] != NULL) {
+ Ewl_Widget * widgets[3];
+ char *type = e_db_type_get(db_file, key_list[i]);
+ char val[512];
- if (!strcmp(type, "str")) {
- snprintf(val, sizeof(val), "%s", e_db_str_get(db_file, key_list[i]));
+ if (!strcmp(type, "str")) {
+ snprintf(val, sizeof(val), "%s", e_db_str_get(db_file, key_list[i]));
- } else if (!strcmp(type, "float")) {
- float f = 0.0;
- e_db_float_get(db_file, key_list[i], &f);
- snprintf(val, sizeof(val), "%.2f", f);
+ } else if (!strcmp(type, "float")) {
+ float f = 0.0;
+ e_db_float_get(db_file, key_list[i], &f);
+ snprintf(val, sizeof(val), "%.2f", f);
- } else if (!strcmp(type, "data")) {
- snprintf(val, sizeof(val), "Data not shown");
+ } else if (!strcmp(type, "data")) {
+ snprintf(val, sizeof(val), "Data not shown");
- } else if (!strcmp(type, "int")) {
- int integer = 0;
- e_db_int_get(db_file, key_list[i], &integer);
- snprintf(val, sizeof(val), "%d", integer);
- }
+ } else if (!strcmp(type, "int")) {
+ int integer = 0;
+ e_db_int_get(db_file, key_list[i], &integer);
+ snprintf(val, sizeof(val), "%d", integer);
+ }
- widgets[0] = ewl_text_new(type);
- ewl_widget_show(widgets[0]);
+ widgets[0] = ewl_text_new(type);
+ ewl_widget_show(widgets[0]);
- widgets[1] = ewl_text_new(key_list[i]);
- ewl_widget_show(widgets[1]);
+ widgets[1] = ewl_text_new(key_list[i]);
+ ewl_widget_show(widgets[1]);
- widgets[2] = ewl_text_new(val);
- ewl_widget_show(widgets[2]);
+ widgets[2] = ewl_text_new(val);
+ ewl_widget_show(widgets[2]);
- ewl_tree_row_add(EWL_TREE(tree), NULL, widgets);
- free(key_list[i]);
- }
- }
- }
+ ewl_tree_row_add(EWL_TREE(tree), NULL, widgets);
+ free(key_list[i]);
+ }
+ }
+ }
- free(key_list);
+ free(key_list);
- return;
- w = NULL;
- data = NULL;
+ return;
+ w = NULL;
+ data = NULL;
}
void fd_win_del_cb(Ewl_Widget *w, void *event, void *data) {
- Ewl_Widget *fd_win = (Ewl_Widget *)data;
- ewl_widget_hide(fd_win);
- ewl_widget_destroy(fd_win);
-
- return;
- w = NULL;
- event = NULL;
- data = NULL;
+ Ewl_Widget *fd_win = (Ewl_Widget *)data;
+ ewl_widget_hide(fd_win);
+ ewl_widget_destroy(fd_win);
+
+ return;
+ w = NULL;
+ event = NULL;
+ data = NULL;
}
void open_cb(Ewl_Widget *w, void *event, void *data) {
- Ewl_Widget *fd_win = NULL, *fd = NULL;
-
- fd_win = ewl_window_new();
- ewl_window_title_set(EWL_WINDOW(fd_win), "EWL EDB ed open");
- ewl_window_class_set(EWL_WINDOW(fd_win), "EWL_EDB_ed_open");
- ewl_window_name_set(EWL_WINDOW(fd_win), "EWL_EDB_ed_open");
- ewl_callback_append(fd_win, EWL_CALLBACK_DELETE_WINDOW, fd_win_del_cb, fd_win);
- ewl_widget_show(fd_win);
-
- fd = ewl_filedialog_new(EWL_FILEDIALOG_TYPE_OPEN);
- ewl_container_child_append(EWL_CONTAINER(fd_win), fd);
- ewl_callback_append(fd, EWL_CALLBACK_VALUE_CHANGED, open_file_cb, fd_win);
- ewl_widget_show(fd);
-
- return;
- w = NULL;
- event = NULL;
- data = NULL;
+ Ewl_Widget *fd_win = NULL, *fd = NULL;
+
+ fd_win = ewl_window_new();
+ ewl_window_title_set(EWL_WINDOW(fd_win), "EWL EDB ed open");
+ ewl_window_class_set(EWL_WINDOW(fd_win), "EWL_EDB_ed_open");
+ ewl_window_name_set(EWL_WINDOW(fd_win), "EWL_EDB_ed_open");
+ ewl_callback_append(fd_win, EWL_CALLBACK_DELETE_WINDOW, fd_win_del_cb, fd_win);
+ ewl_widget_show(fd_win);
+
+ fd = ewl_filedialog_new(EWL_FILEDIALOG_TYPE_OPEN);
+ ewl_container_child_append(EWL_CONTAINER(fd_win), fd);
+ ewl_callback_append(fd, EWL_CALLBACK_VALUE_CHANGED, open_file_cb, fd_win);
+ ewl_widget_show(fd);
+
+ return;
+ w = NULL;
+ event = NULL;
+ data = NULL;
}
void save_cb(Ewl_Widget *w, void *event, void *data) {
- if (db_file == NULL)
- return;
+ if (db_file == NULL)
+ return;
- e_db_close(db_file);
- db_file = NULL;
- e_db_flush();
+ e_db_close(db_file);
+ db_file = NULL;
+ e_db_flush();
- return;
- w = NULL;
- event = NULL;
- data = NULL;
+ return;
+ w = NULL;
+ event = NULL;
+ data = NULL;
}
void type_sel_cb(Ewl_Widget *w, void *event, void *data) {
- current_type = (Ewl_Edb_Type)data;
+ current_type = (Ewl_Edb_Type)data;
- return;
- w = NULL;
- event = NULL;
+ return;
+ w = NULL;
+ event = NULL;
}
void add_cb(Ewl_Widget *w, void *event, void *data) {
- char *key = ewl_text_text_get(EWL_TEXT(key_name_box));
- char *val = ewl_text_text_get(EWL_TEXT(val_box));
- Ewl_Widget *widgets[3];
-
- if ((key == NULL) || (val == NULL))
- return;
-
- switch(current_type) {
- case EWL_EDB_TYPE_INT:
- {
- int ival = atoi(val);
- widgets[0] = ewl_text_new("int");
- ewl_widget_show(widgets[0]);
- e_db_int_set(db_file, key, ival);
- }
- break;
-
- case EWL_EDB_TYPE_STR:
- widgets[0] = ewl_text_new("str");
- ewl_widget_show(widgets[0]);
- e_db_str_set(db_file, key, val);
- break;
-
- case EWL_EDB_TYPE_FLOAT:
- {
- float fval = atof(val);
- widgets[0] = ewl_text_new("float");
- ewl_widget_show(widgets[0]);
- e_db_float_set(db_file, key, fval);
- }
- break;
-
- case EWL_EDB_TYPE_DATA:
- widgets[0] = ewl_text_new("data");
- ewl_widget_show(widgets[0]);
- e_db_data_set(db_file, key, val, strlen(val));
- free(val);
- val = strdup("");
- break;
-
- default:
- printf("No type selected\n");
- break;
- }
-
- widgets[1] = ewl_text_new(key);
- ewl_widget_show(widgets[1]);
-
- widgets[2] = ewl_text_new(val);
- ewl_widget_show(widgets[2]);
-
- ewl_tree_row_add(EWL_TREE(tree), NULL, widgets);
-
- return;
- w = NULL;
- event = NULL;
- data = NULL;
+ char *key = ewl_text_text_get(EWL_TEXT(key_name_box));
+ char *val = ewl_text_text_get(EWL_TEXT(val_box));
+ Ewl_Widget *widgets[3];
+
+ if ((key == NULL) || (val == NULL))
+ return;
+
+ switch(current_type) {
+ case EWL_EDB_TYPE_INT:
+ {
+ int ival = atoi(val);
+ widgets[0] = ewl_text_new("int");
+ ewl_widget_show(widgets[0]);
+ e_db_int_set(db_file, key, ival);
+ }
+ break;
+
+ case EWL_EDB_TYPE_STR:
+ widgets[0] = ewl_text_new("str");
+ ewl_widget_show(widgets[0]);
+ e_db_str_set(db_file, key, val);
+ break;
+
+ case EWL_EDB_TYPE_FLOAT:
+ {
+ float fval = atof(val);
+ widgets[0] = ewl_text_new("float");
+ ewl_widget_show(widgets[0]);
+ e_db_float_set(db_file, key, fval);
+ }
+ break;
+
+ case EWL_EDB_TYPE_DATA:
+ widgets[0] = ewl_text_new("data");
+ ewl_widget_show(widgets[0]);
+ e_db_data_set(db_file, key, val, strlen(val));
+ free(val);
+ val = strdup("");
+ break;
+
+ default:
+ printf("No type selected\n");
+ break;
+ }
+
+ widgets[1] = ewl_text_new(key);
+ ewl_widget_show(widgets[1]);
+
+ widgets[2] = ewl_text_new(val);
+ ewl_widget_show(widgets[2]);
+
+ ewl_tree_row_add(EWL_TREE(tree), NULL, widgets);
+
+ return;
+ w = NULL;
+ event = NULL;
+ data = NULL;
}
void delete_cb(Ewl_Widget *w, void *event, void *data) {
- char *current_key = NULL;
-// char *current_key = ewl_table_get_selected(EWL_TABLE(table));
+ char *current_key = NULL;
+// char *current_key = ewl_table_get_selected(EWL_TABLE(table));
- if (current_key == NULL)
- return;
+ if (current_key == NULL)
+ return;
- e_db_data_del(db_file, current_key);
+ e_db_data_del(db_file, current_key);
- return;
- w = NULL;
- event = NULL;
- data = NULL;
+ return;
+ w = NULL;
+ event = NULL;
+ data = NULL;
}
--
Enlightenment DR17 toolkit based (based on the EFL)
More information about the Pkg-e-commits
mailing list