gui: refactoring. added widget option area.

This commit is contained in:
Daniel Juyung Seo 2013-08-12 13:06:10 +09:00
parent cea2c4eeb2
commit ebdaded06c
3 changed files with 78 additions and 41 deletions

View File

@ -34,4 +34,12 @@ extern ETV_Data *ed;
#define ETV_SAFE_FREE(_h, _fn) do { if (_h) { _fn((void*)_h); _h = NULL; } } while (0)
#if (ELM_VERSION_MAJOR == 1) && (ELM_VERSION_MINOR < 8)
#define PANES_TOP "top"
#define PANES_BOTTOM "bottom"
#else
#define PANES_TOP "left"
#define PANES_BOTTOM "right"
#endif
#endif

View File

@ -169,13 +169,64 @@ _toolbar_exit_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
elm_exit();
}
static void
_left_panes_content_create(Evas_Object *box)
{
Evas_Object *o = NULL, *fr = NULL;
o = gui_widget_menu_create(box);
EXPAND(o); FILL(o);
elm_box_pack_end(box, o);
// description
fr = o = elm_frame_add(box);
elm_object_text_set(o, "Widget Description");
evas_object_show(o);
gd->desc_scr = o = elm_scroller_add(fr);
elm_scroller_bounce_set(o, EINA_FALSE, EINA_FALSE);
elm_object_content_set(fr, o);
evas_object_show(o);
gd->desc_lbl = o = elm_label_add(gd->desc_scr);
elm_label_line_wrap_set(o, ELM_WRAP_MIXED);
elm_object_content_set(gd->desc_scr, o);
evas_object_show(o);
o = util_elm_min_set(fr, 0, WIDGET_DESC_HEIGHT);
WEIGHT(o, EVAS_HINT_EXPAND, 0.0); FILL(o);
elm_box_pack_end(box, o);
}
static void
_right_panes_content_create(Evas_Object *panes)
{
Evas_Object *o = NULL, *fr = NULL;
// preview
elm_object_part_content_set(panes, PANES_TOP, gui_preview_create(panes));
// description
fr = o = elm_frame_add(panes);
elm_object_text_set(o, "Widget Option");
evas_object_show(o);
o = elm_scroller_add(fr);
elm_scroller_bounce_set(o, EINA_FALSE, EINA_FALSE);
//elm_object_content_set(o, gui_widget_option_create(o));
evas_object_show(o);
elm_object_content_set(fr, o);
elm_object_part_content_set(panes, PANES_BOTTOM, fr);
}
void
gui_create(const char *edje_file, Evas_Coord width, Evas_Coord height,
Eina_Bool fullscreen)
{
Evas_Object *o = NULL, *conform = NULL, *box = NULL;
Evas_Object *panes = NULL, *widget_box = NULL;
Evas_Object *desc_fr = NULL;
Evas_Object *panes = NULL;
char path[PATH_MAX];
const char *theme = NULL;
@ -185,6 +236,7 @@ gui_create(const char *edje_file, Evas_Coord width, Evas_Coord height,
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
// Window
gd->win = o = elm_win_util_standard_add("elm-theme-viewer", "Elm Theme Viewer");
elm_win_autodel_set(o, EINA_TRUE);
if (fullscreen)
@ -193,11 +245,13 @@ gui_create(const char *edje_file, Evas_Coord width, Evas_Coord height,
evas_object_resize(o, width, height);
evas_object_show(o);
// Conformant
conform = o = elm_conformant_add(gd->win);
EXPAND(o);
elm_win_resize_object_add(gd->win, o);
evas_object_show(o);
// Outer Vertical Box
box = o = elm_box_add(conform);
elm_object_content_set(conform, o);
evas_object_show(o);
@ -214,6 +268,7 @@ gui_create(const char *edje_file, Evas_Coord width, Evas_Coord height,
elm_box_pack_end(box, o);
evas_object_show(o);
// Main Layout
gd->gui_layout = o = elm_layout_add(gd->win);
snprintf(path, sizeof(path), "%s/themes/layout.edj", elm_app_data_dir_get());
@ -231,7 +286,7 @@ gui_create(const char *edje_file, Evas_Coord width, Evas_Coord height,
// title text
elm_layout_text_set(gd->gui_layout, "edje_name_txt", edje_file);
// panes for preview and menu
// Panes for preview and menu
panes = o = elm_panes_add(gd->gui_layout);
elm_panes_content_left_size_set(o, 0.4);
evas_object_show(o);
@ -239,37 +294,19 @@ gui_create(const char *edje_file, Evas_Coord width, Evas_Coord height,
gui_panes_clicked_double_cb, o);
elm_layout_content_set(gd->gui_layout, "preview", o);
// widget box
widget_box = elm_box_add(panes);
{
o = gui_widget_menu_create(widget_box);
EXPAND(o); FILL(o);
elm_box_pack_end(widget_box, o);
// Widget Box (Left)
o = elm_box_add(panes);
_left_panes_content_create(o);
evas_object_show(o);
elm_object_part_content_set(panes, "left", o);
// description
desc_fr = o = elm_frame_add(widget_box);
elm_object_text_set(o, "Widget Description");
evas_object_show(o);
gd->desc_scr = o = elm_scroller_add(desc_fr);
elm_scroller_bounce_set(o, EINA_FALSE, EINA_FALSE);
elm_object_content_set(desc_fr, o);
evas_object_show(o);
gd->desc_lbl = o = elm_label_add(gd->desc_scr);
elm_label_line_wrap_set(o, ELM_WRAP_MIXED);
elm_object_content_set(gd->desc_scr, o);
evas_object_show(o);
o = util_elm_min_set(desc_fr, 0, WIDGET_DESC_HEIGHT);
WEIGHT(o, EVAS_HINT_EXPAND, 0.0); FILL(o);
elm_box_pack_end(widget_box, o);
}
evas_object_show(widget_box);
elm_object_part_content_set(panes, "left", widget_box);
// preview
elm_object_part_content_set(panes, "right", gui_preview_create(panes));
// Preview Box (Right)
o = elm_panes_add(panes);
elm_panes_horizontal_set(o, EINA_TRUE);
elm_panes_content_left_size_set(o, 0.6);
_right_panes_content_create(o);
evas_object_show(o);
elm_object_part_content_set(panes, "right", o);
INF("GUI Creation Done");

View File

@ -6,14 +6,6 @@
#include "gui.h"
#include "gui_option.h"
#if (ELM_VERSION_MAJOR == 1) && (ELM_VERSION_MINOR < 8)
#define PANES_TOP "top"
#define PANES_BOTTOM "bottom"
#else
#define PANES_TOP "left"
#define PANES_BOTTOM "right"
#endif
void gui_mobile_description_set(void);
Evas_Object *bt_desc;
extern Gui_Data *gd;