controls: add shortcut to do grouped input

This commit is contained in:
Boris Faure 2020-04-11 10:41:52 +02:00
parent 537af736e8
commit 87ce2720d5
Signed by untrusted user who does not match committer: borisfaure
GPG Key ID: 35C0410516166BE8
1 changed files with 29 additions and 0 deletions

View File

@ -12,8 +12,10 @@ static Eina_Hash *controls = NULL;
typedef struct _Controls_Ctx {
Evas_Object *frame;
Evas_Object *group_input_cx;
Evas_Object *over;
Evas_Object *win;
Win *wn;
Evas_Object *base;
Evas_Object *bg;
Evas_Object *term;
@ -223,6 +225,17 @@ _cb_ct_about(void *data,
controls_hide(ctx, EINA_FALSE);
}
static void
_cb_group_input_changed(void *data, Evas_Object *obj EINA_UNUSED,
void *_event EINA_UNUSED)
{
Controls_Ctx *ctx = data;
Win *wn = ctx->wn;
controls_hide(ctx, EINA_TRUE);
win_toggle_visible_group(wn);
}
static void
_cb_mouse_down(void *data,
Evas *_e EINA_UNUSED,
@ -344,6 +357,7 @@ controls_show(Evas_Object *win, Evas_Object *base, Evas_Object *bg,
ctx = malloc(sizeof(*ctx));
assert(ctx);
ctx->win = win;
ctx->wn = win_evas_object_to_win(win);
ctx->base = base;
ctx->bg = bg;
ctx->term = term;
@ -431,6 +445,21 @@ controls_show(Evas_Object *win, Evas_Object *base, Evas_Object *bg,
o = _sep_add_h(win);
elm_box_pack_end(ct_boxv, o);
o = elm_check_add(win);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
elm_object_text_set(o, _("Grouped input"));
elm_object_disabled_set(o, win_has_single_child(ctx->wn));
elm_check_state_set(o, win_is_group_input(ctx->wn));
elm_box_pack_end(ct_boxv, o);
evas_object_show(o);
ctx->group_input_cx = o;
evas_object_smart_callback_add(o, "changed",
_cb_group_input_changed, ctx);
o = _sep_add_h(win);
elm_box_pack_end(ct_boxv, o);
o = _button_add(win, _("Close Terminal"), "window-close", _cb_ct_close, ctx);
elm_box_pack_end(ct_boxv, o);