This commit is contained in:
Marcel Hollerbach 2019-11-15 15:45:25 +01:00
parent 8df2666e64
commit e3ff3453f3
3 changed files with 95 additions and 11 deletions

View File

@ -0,0 +1,62 @@
#define FN_COL_DEFAULT 255 255 255 255; color3: 0 0 0 128
collections {
color_classes {
color_class { name: "button_text";
color: FN_COL_DEFAULT;
desc: "Text of a button";
}
}
group { name: "efl/button:homescreen_icon"; data.item: "version" "123";
parts {
swallow { "efl.content"; nomouse;
required;
desc { "default";
fixed: 1 0;
rel2.relative: 1.0 0.0;
rel2.to: "sizer_content";
fixed: 1 0;
aspect: 1.0 1.0;
aspect_preference: BOTH;
}
}
text { "sizer_content"; nomouse;
scale: 1;
desc { "default";
rel1.relative: 0.0 1.0;
rel2.relative: 1.0 1.0;
align: 0.0 1.0;
text {
size: 10;
min: 1 1;
ellipsis: -1;
text: "Masdfasdfsaf";
text_class: "button_text";
}
visible: 0;
}
}
text { "efl.text"; nomouse;
scale;
required;
desc { "default"
rel1.relative: 0.0 1.0;
rel2.relative: 1.0 1.0;
align: 0.0 1.0;
color3: 255 255 255 255;
text { font: "sans"; size: 10;;
align: 0.5 0.5;
min: 1 1;
text_class: "button";
ellipsis: -1;
}
visible: 1;
fixed: 0 0;
}
desc { "visible";
inherit: "default";
}
}
}
}
}

View File

@ -1,5 +1,3 @@
//Compile with:
//gcc -g efl_ui_scroller_example.c -o efl_ui_scroller_example `pkg-config --cflags --libs elementary`
#include <Efl_Ui.h>
#include <Efreet.h>
@ -11,13 +9,13 @@ typedef struct
{
Eina_Position2D position;
const char *name;
const char *icon_path;
const char *icon;
Efl_Event_Cb cb;
} Icon;
static Icon workspace1[] = {
{ EINA_POSITION2D(0, 0), "bla", "ic", NULL},
{ EINA_POSITION2D(0, 0), "Chrome", "/usr/share/icons/hicolor/128x128/apps/chromium.png", NULL},
{ EINA_POSITION2D(0, 1), "bla", "ic2", NULL},
{ EINA_POSITION2D(2, 0), NULL, NULL, NULL},
};
@ -58,11 +56,11 @@ static Icon* workspaces[] = {workspace1, workspace2, workspace3};
static void _home_screen_cb(void *data, const Efl_Event *cb);
static Icon start_line_config[] = {
{ EINA_POSITION2D(0, 0), "Call", "ic", NULL},
{ EINA_POSITION2D(0, 0), "Contact", "ic2", NULL},
{ EINA_POSITION2D(0, 0), "Home", "ic2", _home_screen_cb},
{ EINA_POSITION2D(0, 0), "Whatzup", "ic2", NULL},
{ EINA_POSITION2D(0, 0), "Tölegram", "ic2", NULL},
{ EINA_POSITION2D(0, 0), "Call", "call-start", NULL},
{ EINA_POSITION2D(0, 0), "Contact", "contact-new", NULL},
{ EINA_POSITION2D(0, 0), "Home", "applications-internet", _home_screen_cb},
{ EINA_POSITION2D(0, 0), "Mail", "emblem-mail", NULL},
{ EINA_POSITION2D(0, 0), "Documents", "emblem-documents", NULL},
{ EINA_POSITION2D(0, 0), NULL, NULL, NULL},
};
@ -72,10 +70,15 @@ static Eo *compositor;
static Efl_Ui_Widget*
_create_icon(Icon *icon, Eo *parent)
{
Eo *ret = efl_add(EFL_UI_BUTTON_CLASS, parent);
Eo *ret = efl_add(EFL_UI_BUTTON_CLASS, parent, efl_ui_widget_style_set(efl_added, "homescreen_icon"));
Eo *ic = efl_add(EFL_UI_IMAGE_CLASS, parent);
efl_ui_image_icon_set(ic, icon->icon);
efl_content_set(ret, ic);
efl_text_set(ret, icon->name);
if (icon->cb)
efl_event_callback_add(ret, EFL_INPUT_EVENT_CLICKED, icon->cb, icon);
return ret;
}
@ -175,6 +178,8 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
Eo *win, *over_container, *desktop;
efl_ui_theme_extension_add(efl_ui_theme_default_get(), "/home/marcel/git/efl/build/src/examples/elementary/homescreen/button_theme.edj");
win = efl_new(EFL_UI_WIN_CLASS,
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
efl_gfx_entity_size_set(win, EINA_SIZE2D(720*SCALE+15, 1280*SCALE));

View File

@ -1,4 +1,21 @@
foreach edc_file : ['button_theme.edc']
themes += custom_target('edje_cc_' + edc_file,
depends : edje_depends,
input : edc_file,
output : '@BASENAME@.edj',
command : edje_cc_exe + ['-beta',
'-id', meson.current_source_dir(),
'-fd', meson.current_source_dir(),
'-sd', meson.current_source_dir(),
'-vd', meson.current_source_dir(),
'-dd', meson.current_source_dir(),
'-md', meson.current_source_dir(),
'-td', meson.current_source_dir(),
'@INPUT@', '@OUTPUT@'],
)
endforeach
executable('homescreen',
'homescreen.c',
['homescreen.c', themes],
dependencies: elementary,
)