forked from enlightenment/edi
Add some layout and dummy content
This commit is contained in:
parent
97f3e99c06
commit
476c6c5d9c
|
@ -17,17 +17,161 @@
|
|||
|
||||
#define COPYRIGHT "Copyright © 2014 Andy Williams <andy@andyilliams.me> and various contributors (see AUTHORS)."
|
||||
|
||||
static Elm_Genlist_Item_Class itc;
|
||||
|
||||
static void
|
||||
_edi_win_del(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
elm_exit();
|
||||
}
|
||||
|
||||
static char *
|
||||
_text_get(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *source EINA_UNUSED)
|
||||
{
|
||||
return strdup(data);
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_content_get(void *data, Evas_Object *obj, const char *source)
|
||||
{
|
||||
if (!strcmp(source, "elm.swallow.icon"))
|
||||
{
|
||||
Evas_Object *ic;
|
||||
|
||||
ic = elm_icon_add(obj);
|
||||
if (!strcmp(data, "Dir"))
|
||||
elm_icon_standard_set(ic, "folder");
|
||||
else
|
||||
elm_icon_standard_set(ic, "file");
|
||||
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
|
||||
evas_object_show(ic);
|
||||
return ic;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
edi_filetree_setup(Evas_Object *win)
|
||||
{
|
||||
Evas_Object *list;
|
||||
|
||||
list = elm_genlist_add(win);
|
||||
evas_object_size_hint_min_set(list, 100, -1);
|
||||
evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_show(list);
|
||||
|
||||
itc.item_style = "default";
|
||||
itc.func.text_get = _text_get;
|
||||
itc.func.content_get = _content_get;
|
||||
// itc.func.state_get = _state_get;
|
||||
// itc.func.del = _item_del;
|
||||
|
||||
elm_genlist_item_append(list, &itc, "File 1",
|
||||
NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
|
||||
elm_genlist_item_append(list, &itc, "File 2",
|
||||
NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
|
||||
elm_genlist_item_append(list, &itc, "Dir",
|
||||
NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
edi_content_setup(Evas_Object *win)
|
||||
{
|
||||
Evas_Object *panes, *panes_h, *txt;
|
||||
|
||||
panes = elm_panes_add(win);
|
||||
evas_object_size_hint_weight_set(panes, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
|
||||
// add file list
|
||||
elm_object_part_content_set(panes, "left", edi_filetree_setup(win));
|
||||
elm_panes_content_left_size_set(panes, 0.2);
|
||||
|
||||
// add panes
|
||||
panes_h = elm_panes_add(win);
|
||||
elm_panes_horizontal_set(panes_h, EINA_TRUE);
|
||||
evas_object_size_hint_weight_set(panes_h, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(panes_h, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_show(panes_h);
|
||||
elm_panes_content_right_size_set(panes_h, 0.15);
|
||||
elm_object_part_content_set(panes, "right", panes_h);
|
||||
|
||||
// add main content
|
||||
txt = elm_entry_add(win);
|
||||
elm_entry_scrollable_set(txt, EINA_TRUE);
|
||||
elm_object_text_set(txt, "Main");
|
||||
evas_object_size_hint_weight_set(txt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(txt, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_show(txt);
|
||||
elm_object_part_content_set(panes_h, "top", txt);
|
||||
|
||||
// add lower panel
|
||||
txt = elm_label_add(win);
|
||||
elm_object_text_set(txt, "Info");
|
||||
evas_object_size_hint_weight_set(txt, EVAS_HINT_EXPAND, 0.1);
|
||||
evas_object_size_hint_align_set(txt, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_show(txt);
|
||||
elm_object_part_content_set(panes_h, "bottom", txt);
|
||||
|
||||
evas_object_show(panes);
|
||||
return panes;
|
||||
}
|
||||
|
||||
static void
|
||||
_tb_sel_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
printf("Toolbar button pressed\n");
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
edi_toolbar_setup(Evas_Object *win)
|
||||
{
|
||||
Evas_Object *tb, *menu;
|
||||
Elm_Object_Item *tb_it, *menu_it;
|
||||
|
||||
tb = elm_toolbar_add(win);
|
||||
elm_toolbar_homogeneous_set(tb, EINA_FALSE);
|
||||
elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_SCROLL);
|
||||
evas_object_size_hint_weight_set(tb, 0.0, 0.0);
|
||||
evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0);
|
||||
|
||||
tb_it = elm_toolbar_item_append(tb, "document-print", "Hello", _tb_sel_cb, NULL);
|
||||
elm_object_item_disabled_set(tb_it, EINA_TRUE);
|
||||
elm_toolbar_item_priority_set(tb_it, -100);
|
||||
|
||||
tb_it = elm_toolbar_item_append(tb, "folder-new", "World", _tb_sel_cb, NULL);
|
||||
elm_toolbar_item_priority_set(tb_it, 100);
|
||||
|
||||
tb_it = elm_toolbar_item_append(tb, "object-rotate-right", "H", _tb_sel_cb, NULL);
|
||||
elm_toolbar_item_priority_set(tb_it, -150);
|
||||
|
||||
tb_it = elm_toolbar_item_append(tb, "mail-send", "Comes", _tb_sel_cb, NULL);
|
||||
elm_toolbar_item_priority_set(tb_it, -200);
|
||||
|
||||
tb_it = elm_toolbar_item_append(tb, "clock", "Elementary", _tb_sel_cb, NULL);
|
||||
elm_toolbar_item_priority_set(tb_it, 0);
|
||||
|
||||
tb_it = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL);
|
||||
elm_toolbar_item_menu_set(tb_it, EINA_TRUE);
|
||||
elm_toolbar_item_priority_set(tb_it, -9999);
|
||||
elm_toolbar_menu_parent_set(tb, win);
|
||||
menu = elm_toolbar_item_menu_get(tb_it);
|
||||
|
||||
elm_menu_item_add(menu, NULL, "edit-cut", "Shrink", _tb_sel_cb, NULL);
|
||||
menu_it = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", _tb_sel_cb, NULL);
|
||||
elm_menu_item_add(menu, menu_it, "edit-paste", "is set to", _tb_sel_cb, NULL);
|
||||
elm_menu_item_add(menu, NULL, "edit-delete", "Scroll", _tb_sel_cb, NULL);
|
||||
|
||||
evas_object_show(tb);
|
||||
return tb;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
edi_win_setup(void)
|
||||
{
|
||||
Evas_Object *win;
|
||||
Evas_Object *label;
|
||||
Evas_Object *win, *content, *tb;
|
||||
|
||||
win = elm_win_util_standard_add("main", "Edi");
|
||||
if (!win) return NULL;
|
||||
|
@ -35,14 +179,13 @@ edi_win_setup(void)
|
|||
elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
|
||||
evas_object_smart_callback_add(win, "delete,request", _edi_win_del, NULL);
|
||||
|
||||
label = elm_label_add(win);
|
||||
elm_object_text_set(label, " Hello World !");
|
||||
evas_object_size_hint_weight_set(label, 0.0, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(label, 0.0, EVAS_HINT_FILL);
|
||||
evas_object_show(label);
|
||||
content = edi_content_setup(win);
|
||||
elm_win_resize_object_add(win, content);
|
||||
|
||||
elm_win_resize_object_add(win, label);
|
||||
tb = edi_toolbar_setup(win);
|
||||
elm_box_pack_end(content, tb);
|
||||
|
||||
evas_object_resize(win, 420, 300);
|
||||
evas_object_show(win);
|
||||
|
||||
return win;
|
||||
|
@ -54,7 +197,7 @@ static const Ecore_Getopt optdesc = {
|
|||
PACKAGE_VERSION,
|
||||
COPYRIGHT,
|
||||
"BSD with advertisement clause",
|
||||
"An EFL edi program",
|
||||
"The EFL IDE",
|
||||
0,
|
||||
{
|
||||
ECORE_GETOPT_LICENSE('L', "license"),
|
||||
|
|
|
@ -30,7 +30,7 @@ edi_init(void)
|
|||
|
||||
return _edi_init;
|
||||
|
||||
shutdown_eina:
|
||||
shutdown_eina:
|
||||
eina_shutdown();
|
||||
_edi_init--;
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ static const Ecore_Getopt optdesc = {
|
|||
PACKAGE_VERSION,
|
||||
COPYRIGHT,
|
||||
"BSD with advertisement clause",
|
||||
"An EFL edi program",
|
||||
"The EFL IDE",
|
||||
0,
|
||||
{
|
||||
ECORE_GETOPT_STORE_TRUE('l', "list", "list available tests"),
|
||||
|
|
Loading…
Reference in New Issue