forked from enlightenment/efl
edje: add function on embryo to control focus
Add set_focus(part_id) and unset_focus(). Both functions accept an optional argument "seat_name". If not provided default seat will be assumed.
This commit is contained in:
parent
d57d17723e
commit
9bc9fde90e
|
@ -141,6 +141,12 @@ native set_mask_flags (part_id, flags);
|
||||||
native get_mask_flags (part_id);
|
native get_mask_flags (part_id);
|
||||||
native part_swallow (part_id, GROUP:str[]);
|
native part_swallow (part_id, GROUP:str[]);
|
||||||
|
|
||||||
|
/* set_focus() and unset_focus() may receive an optional parameter
|
||||||
|
seat_name[], as set_focus(part_id, seat_name[]) and
|
||||||
|
unset_focus(seat_name[]) */
|
||||||
|
native set_focus (part_id, ...);
|
||||||
|
native unset_focus (...);
|
||||||
|
|
||||||
native external_param_get_int(id, param_name[]);
|
native external_param_get_int(id, param_name[]);
|
||||||
native external_param_set_int(id, param_name[], value);
|
native external_param_set_int(id, param_name[], value);
|
||||||
native Float:external_param_get_float(id, param_name[]);
|
native Float:external_param_get_float(id, param_name[]);
|
||||||
|
|
|
@ -196,6 +196,9 @@
|
||||||
* set_clip(part_id, clip_part_id)
|
* set_clip(part_id, clip_part_id)
|
||||||
* get_clip(part_id)
|
* get_clip(part_id)
|
||||||
*
|
*
|
||||||
|
* set_focus(part_id, seat_name[])
|
||||||
|
* unset_focus(seat_name[])
|
||||||
|
*
|
||||||
* part_swallow(part_id, group_name)
|
* part_swallow(part_id, group_name)
|
||||||
*
|
*
|
||||||
* external_param_get_int(id, param_name[])
|
* external_param_get_int(id, param_name[])
|
||||||
|
@ -3771,6 +3774,59 @@ _edje_embryo_fn_part_swallow(Embryo_Program *ep, Embryo_Cell *params)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* set_focus(part_id, seat_name[]) */
|
||||||
|
static Embryo_Cell
|
||||||
|
_edje_embryo_fn_set_focus(Embryo_Program *ep, Embryo_Cell *params)
|
||||||
|
{
|
||||||
|
Edje *ed;
|
||||||
|
int part_id;
|
||||||
|
Edje_Real_Part *rp;
|
||||||
|
char *seat_name = NULL;
|
||||||
|
|
||||||
|
if (!(HASNPARAMS(1) || HASNPARAMS(2))) return -1;
|
||||||
|
ed = embryo_program_data_get(ep);
|
||||||
|
|
||||||
|
part_id = params[1];
|
||||||
|
if (part_id < 0) return 0;
|
||||||
|
rp = ed->table_parts[part_id % ed->table_parts_size];
|
||||||
|
if (!rp) return 0;
|
||||||
|
|
||||||
|
/* if no seat name is passed, that's fine. it means
|
||||||
|
it should be applied to default seat */
|
||||||
|
if (HASNPARAMS(2))
|
||||||
|
{
|
||||||
|
GETSTR(seat_name, params[2]);
|
||||||
|
if (!seat_name) return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
_edje_part_focus_set(ed, seat_name, rp);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* unset_focus(seat_name[]) */
|
||||||
|
static Embryo_Cell
|
||||||
|
_edje_embryo_fn_unset_focus(Embryo_Program *ep, Embryo_Cell *params)
|
||||||
|
{
|
||||||
|
Edje *ed;
|
||||||
|
char *seat_name = NULL;
|
||||||
|
|
||||||
|
if (!(HASNPARAMS(0) || HASNPARAMS(1))) return -1;
|
||||||
|
ed = embryo_program_data_get(ep);
|
||||||
|
|
||||||
|
/* seat name is optional. no seat means
|
||||||
|
it should be applied to default seat */
|
||||||
|
if (HASNPARAMS(1))
|
||||||
|
{
|
||||||
|
GETSTR(seat_name, params[1]);
|
||||||
|
if (!seat_name) return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
_edje_part_focus_set(ed, seat_name, NULL);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* external_param_get_int(id, param_name[]) */
|
/* external_param_get_int(id, param_name[]) */
|
||||||
static Embryo_Cell
|
static Embryo_Cell
|
||||||
_edje_embryo_fn_external_param_get_int(Embryo_Program *ep, Embryo_Cell *params)
|
_edje_embryo_fn_external_param_get_int(Embryo_Program *ep, Embryo_Cell *params)
|
||||||
|
@ -4510,6 +4566,9 @@ _edje_embryo_script_init(Edje_Part_Collection *edc)
|
||||||
embryo_program_native_call_add(ep, "set_mask_flags", _edje_embryo_fn_set_mask_flags);
|
embryo_program_native_call_add(ep, "set_mask_flags", _edje_embryo_fn_set_mask_flags);
|
||||||
embryo_program_native_call_add(ep, "get_mask_flags", _edje_embryo_fn_get_mask_flags);
|
embryo_program_native_call_add(ep, "get_mask_flags", _edje_embryo_fn_get_mask_flags);
|
||||||
|
|
||||||
|
embryo_program_native_call_add(ep, "set_focus", _edje_embryo_fn_set_focus);
|
||||||
|
embryo_program_native_call_add(ep, "unset_focus", _edje_embryo_fn_unset_focus);
|
||||||
|
|
||||||
embryo_program_native_call_add(ep, "part_swallow", _edje_embryo_fn_part_swallow);
|
embryo_program_native_call_add(ep, "part_swallow", _edje_embryo_fn_part_swallow);
|
||||||
|
|
||||||
embryo_program_native_call_add(ep, "external_param_get_int", _edje_embryo_fn_external_param_get_int);
|
embryo_program_native_call_add(ep, "external_param_get_int", _edje_embryo_fn_external_param_get_int);
|
||||||
|
|
|
@ -2491,6 +2491,7 @@ void _edje_signals_sources_patterns_clean(Edje_Signals_Sources_Patterns *ssp);
|
||||||
|
|
||||||
void _edje_focused_part_set(Edje *ed, const char *seat_name, Edje_Real_Part *rp);
|
void _edje_focused_part_set(Edje *ed, const char *seat_name, Edje_Real_Part *rp);
|
||||||
Edje_Real_Part *_edje_focused_part_get(Edje *ed, const char *seat_name);
|
Edje_Real_Part *_edje_focused_part_get(Edje *ed, const char *seat_name);
|
||||||
|
void _edje_part_focus_set(Edje *ed, const char *seat_name, Edje_Real_Part *rp);
|
||||||
|
|
||||||
Eina_Stringshare *_edje_seat_name_get(Edje *ed, Efl_Input_Device *device);
|
Eina_Stringshare *_edje_seat_name_get(Edje *ed, Efl_Input_Device *device);
|
||||||
Efl_Input_Device *_edje_seat_get(Edje *ed, Eina_Stringshare *name);
|
Efl_Input_Device *_edje_seat_get(Edje *ed, Eina_Stringshare *name);
|
||||||
|
|
|
@ -641,7 +641,7 @@ _edje_seat_name_emit(Edje *ed, const char *name, const char *sig, const char *sr
|
||||||
_edje_emit_full(ed, buf, src, NULL, NULL);
|
_edje_emit_full(ed, buf, src, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
_edje_part_focus_set(Edje *ed, const char *seat_name, Edje_Real_Part *rp)
|
_edje_part_focus_set(Edje *ed, const char *seat_name, Edje_Real_Part *rp)
|
||||||
{
|
{
|
||||||
Edje_Real_Part *focused_part;
|
Edje_Real_Part *focused_part;
|
||||||
|
|
Loading…
Reference in New Issue