forked from enlightenment/efl
example of message handler in test.edc... a start.
SVN revision: 10657
This commit is contained in:
parent
41b8b1cf4d
commit
4c90cb8d2a
|
@ -82,4 +82,17 @@ native stop_programs_on (part_id);
|
||||||
native set_min_size (part_id, Float:w, Float:h);
|
native set_min_size (part_id, Float:w, Float:h);
|
||||||
native set_max_size (part_id, Float:w, Float:h);
|
native set_max_size (part_id, Float:w, Float:h);
|
||||||
|
|
||||||
|
enum Msg_Type
|
||||||
|
{
|
||||||
|
MSG_NONE = 0,
|
||||||
|
MSG_STRING = 2,
|
||||||
|
MSG_INT = 3,
|
||||||
|
MSG_FLOAT = 4,
|
||||||
|
MSG_STRING_SET = 5,
|
||||||
|
MSG_INT_SET = 6,
|
||||||
|
MSG_FLOAT_SET = 7,
|
||||||
|
MSG_STRING_INT = 8,
|
||||||
|
MSG_INT_FLOAT = 9,
|
||||||
|
MSG_STRING_INT_SET = 10,
|
||||||
|
MSG_INT_FLOAT_SET = 11
|
||||||
|
};
|
||||||
|
|
|
@ -56,6 +56,40 @@ collections
|
||||||
emit("SMELLY", "Fish");
|
emit("SMELLY", "Fish");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tst()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// a special function for handling app messages - put it here if you want to
|
||||||
|
// handle messages from apps
|
||||||
|
public message(Msg_Type:type, id, ...)
|
||||||
|
{
|
||||||
|
if (type == MSG_NONE)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else if (type == MSG_STRING)
|
||||||
|
{
|
||||||
|
new str[100];
|
||||||
|
|
||||||
|
for (new j = 0; j < (sizeof(str) - 1); j++)
|
||||||
|
{
|
||||||
|
str[j] = getarg(2, j);
|
||||||
|
if (str[j] == 0) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (type == MSG_INT_SET)
|
||||||
|
{
|
||||||
|
for (new i = 2; i < numargs(); i++)
|
||||||
|
{
|
||||||
|
new val;
|
||||||
|
|
||||||
|
val = getarg(i);
|
||||||
|
if (val > 9999) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
parts
|
parts
|
||||||
{
|
{
|
||||||
|
@ -225,7 +259,7 @@ collections
|
||||||
// for this group or functions exported
|
// for this group or functions exported
|
||||||
script
|
script
|
||||||
{
|
{
|
||||||
var i = 5;
|
new i = 5;
|
||||||
|
|
||||||
while (i > 0)
|
while (i > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,23 +13,23 @@ typedef enum _Edje_Queue
|
||||||
|
|
||||||
typedef enum _Edje_Message_Type
|
typedef enum _Edje_Message_Type
|
||||||
{
|
{
|
||||||
EDJE_MESSAGE_NONE,
|
EDJE_MESSAGE_NONE = 0,
|
||||||
|
|
||||||
EDJE_MESSAGE_SIGNAL,
|
EDJE_MESSAGE_SIGNAL = 1,
|
||||||
|
|
||||||
EDJE_MESSAGE_STRING,
|
EDJE_MESSAGE_STRING = 2,
|
||||||
EDJE_MESSAGE_INT,
|
EDJE_MESSAGE_INT = 3,
|
||||||
EDJE_MESSAGE_FLOAT,
|
EDJE_MESSAGE_FLOAT = 4,
|
||||||
|
|
||||||
EDJE_MESSAGE_STRING_SET,
|
EDJE_MESSAGE_STRING_SET = 5,
|
||||||
EDJE_MESSAGE_INT_SET,
|
EDJE_MESSAGE_INT_SET = 6,
|
||||||
EDJE_MESSAGE_FLOAT_SET,
|
EDJE_MESSAGE_FLOAT_SET = 7,
|
||||||
|
|
||||||
EDJE_MESSAGE_STRING_INT,
|
EDJE_MESSAGE_STRING_INT = 8,
|
||||||
EDJE_MESSAGE_STRING_FLOAT,
|
EDJE_MESSAGE_STRING_FLOAT = 9,
|
||||||
|
|
||||||
EDJE_MESSAGE_STRING_INT_SET,
|
EDJE_MESSAGE_STRING_INT_SET = 10,
|
||||||
EDJE_MESSAGE_STRING_FLOAT_SET
|
EDJE_MESSAGE_STRING_FLOAT_SET = 11
|
||||||
} Edje_Message_Type;
|
} Edje_Message_Type;
|
||||||
|
|
||||||
#define EDJE_DRAG_DIR_NONE 0
|
#define EDJE_DRAG_DIR_NONE 0
|
||||||
|
|
|
@ -255,13 +255,16 @@ _edje_message_process(Edje_Message *em)
|
||||||
Embryo_Function fn;
|
Embryo_Function fn;
|
||||||
|
|
||||||
_edje_embryo_script_reset(em->edje);
|
_edje_embryo_script_reset(em->edje);
|
||||||
fn = embryo_program_function_find(em->edje->collection->script, "_msg");
|
fn = embryo_program_function_find(em->edje->collection->script, "message");
|
||||||
if (fn != EMBRYO_FUNCTION_NONE)
|
if (fn != EMBRYO_FUNCTION_NONE)
|
||||||
{
|
{
|
||||||
void *pdata;
|
void *pdata;
|
||||||
Embryo_Cell cell;
|
Embryo_Cell cell;
|
||||||
|
|
||||||
// embryo_parameter_string_push(em->edje->collection->script, sig);
|
// embryo_parameter_string_push(em->edje->collection->script, sig);
|
||||||
|
/* first param is the message type - always */
|
||||||
|
cell = em->type;
|
||||||
|
embryo_parameter_cell_push(em->edje->collection->script, cell);
|
||||||
/* first param is the integer of the event id - always there */
|
/* first param is the integer of the event id - always there */
|
||||||
cell = em->id;
|
cell = em->id;
|
||||||
embryo_parameter_cell_push(em->edje->collection->script, cell);
|
embryo_parameter_cell_push(em->edje->collection->script, cell);
|
||||||
|
|
Loading…
Reference in New Issue