icon: size..

This commit is contained in:
Alastair Poole 2021-02-06 09:57:58 +00:00
parent 5bc6f2984a
commit 1aa6b40bab
6 changed files with 41 additions and 36 deletions

View File

@ -237,13 +237,7 @@ static Evas_Object *
_btn_create(Evas_Object *parent, const char *icon, const char *text, void *cb,
void *data)
{
Evas_Object *ot, *or, *btn, *ic;
ot = elm_table_add(parent);
evas_object_show(ot);
or = evas_object_rectangle_add(evas_object_evas_get(parent));
elm_table_pack(ot, or, 0, 0, 1, 1);
Evas_Object *btn, *ic;
btn = elm_button_add(parent);
evas_object_size_hint_weight_set(btn, 0, 0);
@ -252,18 +246,14 @@ _btn_create(Evas_Object *parent, const char *icon, const char *text, void *cb,
ic = elm_icon_add(btn);
elm_icon_standard_set(ic, evisum_icon_path_get(icon));
elm_object_part_content_set(btn, "icon", ic);
evas_object_size_hint_min_set(or,
24 * elm_config_scale_get(),
24 * elm_config_scale_get());
evisum_ui_icon_size_set(ic, ELM_SCALE_SIZE(ICON_SIZE));
evas_object_show(ic);
elm_object_part_content_set(btn, "icon", ic);
elm_object_tooltip_text_set(btn, text);
evas_object_smart_callback_add(btn, "clicked", cb, data);
elm_table_pack(ot, btn, 0, 0, 1, 1);
return ot;
return btn;
}
static void

View File

@ -423,15 +423,16 @@ _sort_by_total(const void *p1, const void *p2)
static void
_btn_icon_state_set(Evas_Object *button, Eina_Bool reverse)
{
Evas_Object *icon = elm_icon_add(button);
Evas_Object *ic = elm_icon_add(button);
if (reverse)
elm_icon_standard_set(icon, evisum_icon_path_get("go-down"));
elm_icon_standard_set(ic, evisum_icon_path_get("go-down"));
else
elm_icon_standard_set(icon, evisum_icon_path_get("go-up"));
elm_icon_standard_set(ic, evisum_icon_path_get("go-up"));
elm_object_part_content_set(button, "icon", icon);
evas_object_show(icon);
evisum_ui_icon_size_set(ic, ELM_SCALE_SIZE(ICON_SIZE));
elm_object_part_content_set(button, "icon", ic);
evas_object_show(ic);
}
static void

View File

@ -640,30 +640,32 @@ _process_list_update(Ui_Data *pd)
static void
_btn_icon_state_update(Evas_Object *btn, Eina_Bool reverse)
{
Evas_Object *icon = elm_icon_add(btn);
Evas_Object *ic = elm_icon_add(btn);
if (reverse)
elm_icon_standard_set(icon, evisum_icon_path_get("go-down"));
elm_icon_standard_set(ic, evisum_icon_path_get("go-down"));
else
elm_icon_standard_set(icon, evisum_icon_path_get("go-up"));
elm_icon_standard_set(ic, evisum_icon_path_get("go-up"));
elm_object_part_content_set(btn, "icon", icon);
evas_object_show(icon);
evisum_ui_icon_size_set(ic, ELM_SCALE_SIZE(ICON_SIZE));
elm_object_part_content_set(btn, "icon", ic);
evas_object_show(ic);
}
static void
_btn_icon_state_init(Evas_Object *btn, Eina_Bool reverse,
Eina_Bool selected EINA_UNUSED)
{
Evas_Object *icon = elm_icon_add(btn);
Evas_Object *ic = elm_icon_add(btn);
if (reverse)
elm_icon_standard_set(icon, evisum_icon_path_get("go-down"));
elm_icon_standard_set(ic, evisum_icon_path_get("go-down"));
else
elm_icon_standard_set(icon, evisum_icon_path_get("go-up"));
elm_icon_standard_set(ic, evisum_icon_path_get("go-up"));
elm_object_part_content_set(btn, "icon", icon);
evas_object_show(icon);
evisum_ui_icon_size_set(ic, ELM_SCALE_SIZE(ICON_SIZE));
elm_object_part_content_set(btn, "icon", ic);
evas_object_show(ic);
}
static void
@ -1139,8 +1141,8 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
pd->btn_menu = btn = _btn_create(tb, "menu", _("Menu"),
_btn_menu_clicked_cb, pd);
rec = evas_object_rectangle_add(evas_object_evas_get(parent));
evas_object_size_hint_min_set(rec, ELM_SCALE_SIZE(20), 1);
evas_object_size_hint_max_set(rec, ELM_SCALE_SIZE(20), -1);
evas_object_size_hint_min_set(rec, ELM_SCALE_SIZE(24), ELM_SCALE_SIZE(22));
evas_object_size_hint_max_set(rec, ELM_SCALE_SIZE(24), ELM_SCALE_SIZE(22));
elm_table_pack(tb, rec, i, 1, 1, 1);
elm_table_pack(tb, btn, i++, 1, 1, 1);

View File

@ -1191,14 +1191,16 @@ _process_tab_add(Evas_Object *parent, Ui_Data *pd)
static void
_btn_icon_state_set(Evas_Object *btn, Eina_Bool reverse)
{
Evas_Object *icon = elm_icon_add(btn);
Evas_Object *ic = elm_icon_add(btn);
if (reverse)
elm_icon_standard_set(icon, evisum_icon_path_get("go-down"));
elm_icon_standard_set(ic, evisum_icon_path_get("go-down"));
else
elm_icon_standard_set(icon, evisum_icon_path_get("go-up"));
elm_object_part_content_set(btn, "icon", icon);
evas_object_show(icon);
elm_icon_standard_set(ic, evisum_icon_path_get("go-up"));
evisum_ui_icon_size_set(ic, ELM_SCALE_SIZE(ICON_SIZE));
elm_object_part_content_set(btn, "icon", ic);
evas_object_show(ic);
}
static void

View File

@ -628,3 +628,9 @@ evisum_ui_backgrounds_enabled_set(Eina_Bool enabled)
_backgrounds_enabled = enabled;
}
void
evisum_ui_icon_size_set(Evas_Object *ic, int size)
{
evas_object_size_hint_min_set(ic, size, size);
evas_object_size_hint_max_set(ic, size, size);
}

View File

@ -11,6 +11,7 @@
#define TAB_BTN_HEIGHT 2
#define BTN_WIDTH 68
#define BTN_HEIGHT 1
#define ICON_SIZE 14
#define UI_CHILD_WIN_WIDTH 360
#define UI_CHILD_WIN_HEIGHT 360
@ -32,6 +33,9 @@ Evas_Object *
evisum_ui_button_add(Evas_Object *parent, Evas_Object **alias, const char *text,
const char *icon, Evas_Smart_Cb clicked_cb, void *data);
void
evisum_ui_icon_size_set(Evas_Object *ic, int size);
const char *
evisum_size_format(unsigned long long bytes);