tmp: added use_table.diff to tmp. use it later.

This commit is contained in:
Daniel Juyung Seo 2013-04-16 20:51:35 +09:00
parent 1a4e94ec01
commit 3be4593a97
1 changed files with 151 additions and 0 deletions

151
data/tmp/use_table.diff Normal file
View File

@ -0,0 +1,151 @@
diff --git a/src/gui.c b/src/gui.c
index ca83150..b7f4351 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -44,7 +44,8 @@ _preview_create(Widget_Type widget, const char *style)
if (widget && style)
{
o = widget_create(widget, style);
- elm_box_pack_end(preview_box, o);
+ //elm_box_pack_end(preview_box, o);
+ elm_layout_content_set(preview_box, "elm.swallow.icon", o);
preview_obj = o;
}
}
@@ -121,7 +122,7 @@ _size_height_changed_cb(void *data EINA_UNUSED, Evas_Object *obj,
if (v != val) elm_slider_value_set(obj, v);
if (preview_obj)
- widget_resize(preview_obj);
+ widget_force_resize(preview_obj);
INF("size height changed : %f %f", val, v);
}
@@ -307,13 +308,17 @@ Evas_Object *
gui_preview_create(Evas_Object *parent)
{
Evas_Object *o, *preview_frame;
+ char path[PATH_MAX];
preview_frame = o = elm_frame_add(parent);
elm_object_text_set(o, "Preview");
evas_object_show(o);
- preview_box = o = elm_box_add(win);
+ //preview_box = o = elm_box_add(win);
+ preview_box = o = elm_layout_add(win);
+ snprintf(path, sizeof(path), "%s/themes/layout.edj", elm_app_data_dir_get());
+ elm_layout_file_set(o, path, "etv/preview/layout");
elm_object_content_set(preview_frame, o);
evas_object_show(o);
diff --git a/src/widget.c b/src/widget.c
index 6b15ad0..0e976d6 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -1249,23 +1249,74 @@ _widget_tooltip_create(const char *style)
return box;
}
+/*
+ * Evas_Object *o is expected to be a preview object container which is a
+ * table.
+ */
void
-widget_resize(Evas_Object *o)
+widget_force_resize(Evas_Object *o)
{
Evas_Coord w = 0, h = 0;
+ Evas_Object *rect;
+
+ if (!option_is_force_resize()) return;
+
+ rect = evas_object_data_get(o, "rect");
+ if (!rect) return;
+
+ option_preview_size_get(&w, &h);
+ evas_object_size_hint_min_set(rect, w, h);
+ evas_object_size_hint_max_set(rect, w, h);
+}
+
+Evas_Object *
+_widget_resize(Evas_Object *o)
+{
+ Evas_Object *table = NULL, *rect;
+ Evas_Coord w = 0, h = 0, rect_w = 0;
+
+ table = elm_table_add(win);
+ evas_object_show(table);
+
+ rect = evas_object_rectangle_add(evas_object_evas_get(table));
+ EXPAND(rect); FILL(rect);
+ elm_table_pack(table, rect, 0, 0, 1, 1);
+ evas_object_data_set(table, "rect", rect);
+
+ EXPAND(o); FILL(o);
+ elm_table_pack(table, o, 0, 0, 1, 1);
if (option_is_force_resize())
+ widget_force_resize(table);
+ else
{
- option_preview_size_get(&w, &h);
- evas_object_size_hint_min_set(o, w, h);
- evas_object_size_hint_max_set(o, w, h);
+ // set min width
+ evas_object_size_hint_min_get(o, &w, &h);
+ if (w == 0)
+ {
+ evas_object_size_hint_min_set(rect, WIDGET_DEFAULT_WIDTH, h);
+ evas_object_size_hint_max_set(rect, WIDGET_DEFAULT_WIDTH, h);
+ }
+
+ // set min height
+ if (h == 0)
+ {
+ evas_object_size_hint_min_get(rect, &rect_w, NULL);
+ evas_object_size_hint_min_set(rect, rect_w, WIDGET_DEFAULT_HEIGHT);
+ evas_object_size_hint_max_set(rect, rect_w, WIDGET_DEFAULT_HEIGHT);
+ }
+
+ evas_object_size_hint_min_get(o, &w, &h);
+ printf("min %d %d\n", w, h);
}
+
+ return table;
}
Evas_Object *
widget_create(Widget_Type widget, const char *orig_style)
{
- Evas_Object *o = NULL;
+ Evas_Object *o = NULL, *table = NULL;
const char *style = NULL;
if (orig_style)
@@ -1315,9 +1366,9 @@ widget_create(Widget_Type widget, const char *orig_style)
o = _widget_not_implemented_create(widget);
elm_object_theme_set(o, th);
- widget_resize(o);
+ table = _widget_resize(o);
- return o;
+ return table;
}
const char *
diff --git a/src/widget.h b/src/widget.h
index eaf1441..44910d6 100644
--- a/src/widget.h
+++ b/src/widget.h
@@ -83,7 +83,7 @@ struct _Widget_Data
Widget widgets[WIDGET_COUNT];
Evas_Object *widget_create(Widget_Type widget, const char *style);
-void widget_resize(Evas_Object *o);
+void widget_force_resize(Evas_Object *o);
const char *widget_name_get_by_type(Widget_Type type);
const char *widget_desc_get_by_type(Widget_Type type);
Eina_Bool option_is_force_resize(void);