Compare commits
3 Commits
master
...
devs/bu5hm
Author | SHA1 | Date |
---|---|---|
Marcel Hollerbach | c01800d968 | |
Marcel Hollerbach | 1464e011db | |
Marcel Hollerbach | 2402ed91e7 |
|
@ -1,7 +0,0 @@
|
||||||
{
|
|
||||||
"project_id" : "examples",
|
|
||||||
"projects" : "examples",
|
|
||||||
"conduit_uri" : "https://phab.enlightenment.org/",
|
|
||||||
"phabricator.uri" : "https://phab.enlightenment.org/",
|
|
||||||
"repository.callsign" : "examples"
|
|
||||||
}
|
|
|
@ -1,5 +1,4 @@
|
||||||
build
|
build
|
||||||
*.pot
|
*.pot
|
||||||
.*.swp
|
|
||||||
subprojects
|
subprojects
|
||||||
/meson.build
|
meson.build
|
||||||
|
|
17
README
17
README
|
@ -19,20 +19,3 @@ the appropriate steps automatically.
|
||||||
Directory naming is <type>/<language>/<name> please be careful to
|
Directory naming is <type>/<language>/<name> please be careful to
|
||||||
namespace example binaries in case they are installed by the user.
|
namespace example binaries in case they are installed by the user.
|
||||||
|
|
||||||
Building the whole set of Examples
|
|
||||||
==================================
|
|
||||||
|
|
||||||
You can build all examples at once, all you have to do is:
|
|
||||||
|
|
||||||
./setup.py
|
|
||||||
|
|
||||||
This will create a folder called subprojects, all examples are
|
|
||||||
then sym-linked into this directory, a corresponding meson.build
|
|
||||||
file is generated, which uses every example as a subproject.
|
|
||||||
|
|
||||||
After that you can build the meson project with:
|
|
||||||
|
|
||||||
* mkdir build
|
|
||||||
* meson build/
|
|
||||||
* cd build
|
|
||||||
* ninja all
|
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
project(
|
|
||||||
'efl-example-calculator', 'c',
|
|
||||||
version : '0.0.1',
|
|
||||||
default_options: [ 'c_std=gnu99', 'warning_level=2' ],
|
|
||||||
meson_version : '>= 0.38.0')
|
|
||||||
|
|
||||||
eina = dependency('eina', version : '>=1.20.99')
|
|
||||||
efl = dependency('efl-ui', version : '>=1.20.99')
|
|
||||||
elm = dependency('elementary', version : '>=1.20.99')
|
|
||||||
|
|
||||||
inc = include_directories('.')
|
|
||||||
subdir('src')
|
|
||||||
|
|
|
@ -1,212 +0,0 @@
|
||||||
#define EFL_BETA_API_SUPPORT 1
|
|
||||||
|
|
||||||
#include <Elementary.h>
|
|
||||||
#include <Efl_Ui.h>
|
|
||||||
|
|
||||||
static Efl_Ui_Textbox *_screen = NULL; // Text widget showing current value
|
|
||||||
static int _prev_value = 0; // Value introduced before an operation (first operand
|
|
||||||
static int _curr_value = 0; // Value currently being introduced (second operand)
|
|
||||||
static char _operation = '='; // Last operation button pressed
|
|
||||||
static Eina_Bool _must_overwrite = EINA_FALSE; // Whether next number must be appended to current input
|
|
||||||
// or overwrite it
|
|
||||||
|
|
||||||
// Quits the application
|
|
||||||
static void
|
|
||||||
_gui_quit_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
|
|
||||||
{
|
|
||||||
efl_exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Performs "operation" on "currValue" and "prevValue" and leaves result in "currValue"
|
|
||||||
static void
|
|
||||||
_operate()
|
|
||||||
{
|
|
||||||
switch (_operation)
|
|
||||||
{
|
|
||||||
case '+':
|
|
||||||
_curr_value += _prev_value;
|
|
||||||
break;
|
|
||||||
case '-':
|
|
||||||
_curr_value = _prev_value - _curr_value;
|
|
||||||
break;
|
|
||||||
case '*':
|
|
||||||
_curr_value *= _prev_value;
|
|
||||||
break;
|
|
||||||
case '/':
|
|
||||||
_curr_value = _prev_value / _curr_value;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called every time a button is pressed
|
|
||||||
static void
|
|
||||||
_button_pressed_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
|
||||||
{
|
|
||||||
char button = ((const char *)data)[0];
|
|
||||||
// If it is a number, append it to current input (or replace it)
|
|
||||||
if (button >= '0' && button <= '9')
|
|
||||||
{
|
|
||||||
char str[2] = { button, '\0' };
|
|
||||||
if (_must_overwrite)
|
|
||||||
{
|
|
||||||
efl_text_set(_screen, "");
|
|
||||||
_must_overwrite = EINA_FALSE;
|
|
||||||
}
|
|
||||||
Efl_Text_Cursor_Object *cursor = efl_text_interactive_main_cursor_get(_screen);
|
|
||||||
efl_text_cursor_object_text_insert(cursor, str);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char str[32] = "";
|
|
||||||
// No need to sanitize these values, so do not emit "text changed" events
|
|
||||||
efl_event_freeze(_screen);
|
|
||||||
switch (button)
|
|
||||||
{
|
|
||||||
case 'C':
|
|
||||||
// Clear current input
|
|
||||||
efl_text_set(_screen, "0");
|
|
||||||
break;
|
|
||||||
case '+':
|
|
||||||
case '-':
|
|
||||||
case '*':
|
|
||||||
case '/':
|
|
||||||
case '=':
|
|
||||||
// If there was a pending operation, perform it
|
|
||||||
if (_operation != '=')
|
|
||||||
{
|
|
||||||
_operate();
|
|
||||||
snprintf(str, sizeof(str), "%d", _curr_value);
|
|
||||||
efl_text_set(_screen, str);
|
|
||||||
}
|
|
||||||
// Store this operation
|
|
||||||
_operation = button;
|
|
||||||
_must_overwrite = EINA_TRUE;
|
|
||||||
_prev_value = _curr_value;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
efl_event_thaw(_screen);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called every time the content of the screen changes
|
|
||||||
// We use it to sanitize input (remove leading zeros, for example)
|
|
||||||
// This makes more sense when the Text widget is editable, since the user
|
|
||||||
// is free to type anything.
|
|
||||||
static void
|
|
||||||
_screen_changed_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
|
|
||||||
{
|
|
||||||
char _text[32] = "";
|
|
||||||
const char *str = efl_text_get(_screen);
|
|
||||||
int d;
|
|
||||||
if ((strcmp(str, "") == 0) || (strcmp(str, "-") == 0))
|
|
||||||
{
|
|
||||||
snprintf(_text, sizeof(_text), "0");
|
|
||||||
}
|
|
||||||
else if (sscanf(str, "%d", &d) == 1)
|
|
||||||
{
|
|
||||||
snprintf(_text, sizeof(_text), "%d", d);
|
|
||||||
_curr_value = d;
|
|
||||||
}
|
|
||||||
if (strncmp(_text, str, sizeof(_text)))
|
|
||||||
{
|
|
||||||
// Avoid infinite recursion when setting the text from the
|
|
||||||
// "text changed" callback
|
|
||||||
efl_event_freeze(_screen);
|
|
||||||
efl_text_set(_screen, _text);
|
|
||||||
efl_event_thaw(_screen);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Creates an Efl.Ui.Button and positions it in the given position inside the table
|
|
||||||
// The button text is colored with "r, g, b"
|
|
||||||
// "text" is what is drawn on the button, which might be a multi-byte unicode string.
|
|
||||||
// "command" is a single-char id for the button.
|
|
||||||
static void
|
|
||||||
_button_add(Efl_Ui_Table *table, const char *text, const char *command, int posx, int posy, int r, int g, int b)
|
|
||||||
{
|
|
||||||
Efl_Ui_Button *button =
|
|
||||||
efl_add(EFL_UI_BUTTON_CLASS, table,
|
|
||||||
efl_pack_table(table, efl_added, posx, posy, 1, 1),
|
|
||||||
efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED, _button_pressed_cb, command));
|
|
||||||
// Buttons can only have simple text (no font, styles or markup) but can swallow
|
|
||||||
// any other object we want.
|
|
||||||
// Therefore we create a more complex Efl_Ui_Text object and use it as content for the button.
|
|
||||||
Efl_Ui_Textbox *label =
|
|
||||||
efl_add(EFL_UI_TEXTBOX_CLASS, button,
|
|
||||||
efl_text_interactive_editable_set(efl_added, EINA_FALSE),
|
|
||||||
efl_text_horizontal_align_set(efl_added, 0.5),
|
|
||||||
efl_text_vertical_align_set(efl_added, 0.5),
|
|
||||||
efl_gfx_color_set(efl_added, r, g, b, 255),
|
|
||||||
efl_text_set(efl_added, text));
|
|
||||||
efl_text_font_family_set(label, "Sans");
|
|
||||||
efl_text_font_size_set(label, 36);
|
|
||||||
efl_content_set(button, label);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Creates the UI
|
|
||||||
static void
|
|
||||||
_gui_setup()
|
|
||||||
{
|
|
||||||
Eo *win, *table;
|
|
||||||
|
|
||||||
// The window
|
|
||||||
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
|
|
||||||
efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
|
|
||||||
efl_text_set(efl_added, "EFL Calculator"),
|
|
||||||
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
|
|
||||||
|
|
||||||
// when the user clicks "close" on a window there is a request to delete
|
|
||||||
efl_event_callback_add(win, EFL_UI_WIN_EVENT_DELETE_REQUEST, _gui_quit_cb, NULL);
|
|
||||||
|
|
||||||
// The table is the main layout
|
|
||||||
table = efl_add(EFL_UI_TABLE_CLASS, win,
|
|
||||||
efl_content_set(win, efl_added),
|
|
||||||
efl_pack_table_size_set(efl_added, 4, 5),
|
|
||||||
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(300, 400)));
|
|
||||||
|
|
||||||
// Create all buttons using the _button_add helper
|
|
||||||
_button_add(table, "1", "1", 0, 3, 255, 255, 255);
|
|
||||||
_button_add(table, "2", "2", 1, 3, 255, 255, 255);
|
|
||||||
_button_add(table, "3", "3", 2, 3, 255, 255, 255);
|
|
||||||
_button_add(table, "4", "4", 0, 2, 255, 255, 255);
|
|
||||||
_button_add(table, "5", "5", 1, 2, 255, 255, 255);
|
|
||||||
_button_add(table, "6", "6", 2, 2, 255, 255, 255);
|
|
||||||
_button_add(table, "7", "7", 0, 1, 255, 255, 255);
|
|
||||||
_button_add(table, "8", "8", 1, 1, 255, 255, 255);
|
|
||||||
_button_add(table, "9", "9", 2, 1, 255, 255, 255);
|
|
||||||
_button_add(table, "0", "0", 1, 4, 255, 255, 255);
|
|
||||||
_button_add(table, "+", "+", 3, 1, 128, 128, 128);
|
|
||||||
_button_add(table, "−", "-", 3, 2, 128, 128, 128);
|
|
||||||
_button_add(table, "×", "*", 3, 3, 128, 128, 128);
|
|
||||||
_button_add(table, "÷", "/", 3, 4, 128, 128, 128);
|
|
||||||
_button_add(table, "=", "=", 2, 4, 128, 128, 128);
|
|
||||||
_button_add(table, "C", "C", 0, 4, 0, 0, 0);
|
|
||||||
|
|
||||||
// Create a big Efl.Ui.Textbox screen to display the current input
|
|
||||||
_screen = efl_add(EFL_UI_TEXTBOX_CLASS, table,
|
|
||||||
efl_text_set(efl_added, "0"),
|
|
||||||
efl_text_multiline_set(efl_added, EINA_FALSE),
|
|
||||||
efl_text_interactive_editable_set(efl_added, EINA_FALSE),
|
|
||||||
efl_text_interactive_selection_allowed_set(efl_added, EINA_FALSE),
|
|
||||||
efl_pack_table(table, efl_added, 0, 0, 4, 1),
|
|
||||||
efl_text_horizontal_align_set(efl_added, 0.9),
|
|
||||||
efl_text_vertical_align_set(efl_added, 0.5),
|
|
||||||
efl_text_effect_type_set(efl_added, EFL_TEXT_STYLE_EFFECT_TYPE_GLOW),
|
|
||||||
efl_text_glow_color_set(efl_added, 128, 128, 128, 128),
|
|
||||||
efl_event_callback_add(efl_added, EFL_UI_TEXTBOX_EVENT_CHANGED,
|
|
||||||
_screen_changed_cb, NULL));
|
|
||||||
efl_text_font_family_set(_screen, "Sans");
|
|
||||||
efl_text_font_size_set(_screen, 48);
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI_MAIN void
|
|
||||||
efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
|
|
||||||
{
|
|
||||||
_gui_setup();
|
|
||||||
}
|
|
||||||
EFL_MAIN()
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
src = files([
|
|
||||||
'calculator.c',
|
|
||||||
])
|
|
||||||
|
|
||||||
deps = [eina, efl, elm]
|
|
||||||
|
|
||||||
executable('efl_example_calculator', src,
|
|
||||||
dependencies : deps,
|
|
||||||
include_directories : inc,
|
|
||||||
install : true
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
project(
|
|
||||||
'efl-example-homescreen', 'c',
|
|
||||||
version : '0.0.1',
|
|
||||||
default_options: [ 'c_std=gnu99', 'warning_level=2' ],
|
|
||||||
meson_version : '>= 0.38.0')
|
|
||||||
|
|
||||||
eina = dependency('eina', version : '>=1.20.99')
|
|
||||||
efl = dependency('efl-ui', version : '>=1.20.99')
|
|
||||||
elm = dependency('elementary', version : '>=1.20.99')
|
|
||||||
|
|
||||||
inc = include_directories('.')
|
|
||||||
subdir('src')
|
|
||||||
|
|
Binary file not shown.
|
@ -1,311 +0,0 @@
|
||||||
#define EFL_BETA_API_SUPPORT
|
|
||||||
#include <Efl_Ui.h>
|
|
||||||
#include <Eio.h>
|
|
||||||
|
|
||||||
#define TABLE_COLUMNS 4
|
|
||||||
#define TABLE_ROWS 5
|
|
||||||
|
|
||||||
typedef struct _Build_Data
|
|
||||||
{
|
|
||||||
Eo *over_container;
|
|
||||||
Efl_Io_Manager *io_manager;
|
|
||||||
Eo *table;
|
|
||||||
int x, y;
|
|
||||||
} Build_Data;
|
|
||||||
|
|
||||||
static const char *launcher_apps[][3] =
|
|
||||||
{ { "Call", "", "call-start" },
|
|
||||||
{ "Contacts", "", "contact-new" },
|
|
||||||
{ "Home", "xdg-open $HOME", "user-home" },
|
|
||||||
{ "Mail", "xdg-email 'info@enlightenment.org'", "mail-send-receive" },
|
|
||||||
{ "Documents", "xdg-open $(xdg-user-dir DOCUMENTS)", "folder-documents" } };
|
|
||||||
|
|
||||||
static void
|
|
||||||
_icon_clicked_cb(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
|
|
||||||
{
|
|
||||||
const char *command = data;
|
|
||||||
printf("%s\n", command);
|
|
||||||
efl_add(EFL_EXE_CLASS, efl_main_loop_get(),
|
|
||||||
efl_core_command_line_command_string_set(efl_added, command),
|
|
||||||
efl_task_run(efl_added));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_icon_deleted_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
|
||||||
{
|
|
||||||
free(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If "string" begins with the "key" prefix, sets "value" to whatever comes after "key"
|
|
||||||
// up until the next \n, replacing it with a \0, in a newly allocated string
|
|
||||||
// (which must be freed).
|
|
||||||
// Returns 1 if key was found.
|
|
||||||
static int
|
|
||||||
_parse_token(const char *string, const char *key, char **value)
|
|
||||||
{
|
|
||||||
if (eina_str_has_prefix(string, key))
|
|
||||||
{
|
|
||||||
int key_len = strlen(key);
|
|
||||||
const char *end = strchr(string + key_len, '\n');
|
|
||||||
if (!end)
|
|
||||||
end = string + strlen(string); // Point to EOF '\0'
|
|
||||||
int len = end - string - key_len;
|
|
||||||
if (*value) free(*value);
|
|
||||||
*value = eina_strndup(string + key_len, len + 1);
|
|
||||||
*((*value) + len) = '\0';
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reads a .desktop file and returns the app name, the command to launch and the icon name.
|
|
||||||
// Returns 0 if it didn't work.
|
|
||||||
// Free the strings after usage.
|
|
||||||
static int
|
|
||||||
_parse_desktop_file(const char *desktop_file_path, char **app_name, char **app_command, char **app_icon_name)
|
|
||||||
{
|
|
||||||
EINA_RW_SLICE_DECLARE(slice, 1024);
|
|
||||||
Efl_Io_File *desktop_file;
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
desktop_file = efl_new(EFL_IO_FILE_CLASS,
|
|
||||||
efl_file_set(efl_added, desktop_file_path),
|
|
||||||
efl_io_closer_close_on_invalidate_set(efl_added, EINA_TRUE));
|
|
||||||
|
|
||||||
if (!desktop_file)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
char *name = NULL, *command = NULL, *icon = NULL, *onlyshow = NULL, *nodisplay = NULL;
|
|
||||||
while (!efl_io_reader_eos_get(desktop_file) &&
|
|
||||||
efl_io_reader_read(desktop_file, &slice) == EINA_ERROR_NO_ERROR)
|
|
||||||
{
|
|
||||||
char *content = eina_rw_slice_strdup(slice);
|
|
||||||
char *ptr = content;
|
|
||||||
while ((ptr = strchr(ptr, '\n')))
|
|
||||||
{
|
|
||||||
ptr++;
|
|
||||||
_parse_token(ptr, "Name=", &name);
|
|
||||||
_parse_token(ptr, "Exec=", &command);
|
|
||||||
_parse_token(ptr, "Icon=", &icon);
|
|
||||||
_parse_token(ptr, "OnlyShowIn=", &onlyshow);
|
|
||||||
_parse_token(ptr, "NoDisplay=", &nodisplay);
|
|
||||||
}
|
|
||||||
free(content);
|
|
||||||
}
|
|
||||||
if (name && command && icon && !onlyshow && (!nodisplay || eina_streq(nodisplay, "false")))
|
|
||||||
{
|
|
||||||
*app_name = name;
|
|
||||||
*app_command = command;
|
|
||||||
*app_icon_name = icon;
|
|
||||||
ret = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (name)
|
|
||||||
free(name);
|
|
||||||
if (command)
|
|
||||||
free(command);
|
|
||||||
if (icon)
|
|
||||||
free(icon);
|
|
||||||
}
|
|
||||||
if (onlyshow)
|
|
||||||
free(onlyshow);
|
|
||||||
if (nodisplay)
|
|
||||||
free(nodisplay);
|
|
||||||
|
|
||||||
efl_unref(desktop_file);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Creates a widget "button" with the specified name, icon and command
|
|
||||||
// to execute on click.
|
|
||||||
// These buttons are actually just an image with a label below.
|
|
||||||
static Efl_Ui_Widget *
|
|
||||||
_create_icon(Eo *parent, const char *name, const char *command, const char *icon)
|
|
||||||
{
|
|
||||||
Eo *box = efl_add(EFL_UI_BOX_CLASS, parent);
|
|
||||||
// Icon
|
|
||||||
efl_add(EFL_UI_IMAGE_CLASS, box,
|
|
||||||
efl_ui_image_icon_set(efl_added, icon),
|
|
||||||
efl_gfx_hint_weight_set(efl_added, 1.0, 1.0),
|
|
||||||
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(64, 64)),
|
|
||||||
efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED, _icon_clicked_cb, command),
|
|
||||||
efl_event_callback_add(efl_added, EFL_EVENT_DEL, _icon_deleted_cb, command),
|
|
||||||
efl_pack(box, efl_added));
|
|
||||||
|
|
||||||
// Label
|
|
||||||
efl_add(EFL_UI_TEXTBOX_CLASS, box,
|
|
||||||
efl_text_set(efl_added, name),
|
|
||||||
efl_text_multiline_set(efl_added, EINA_TRUE),
|
|
||||||
efl_canvas_textblock_style_apply(efl_added,
|
|
||||||
"effect_type=soft_shadow shadow_color=#444 wrap=word font_size=10 align=center ellipsis=1"),
|
|
||||||
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(0, 40)),
|
|
||||||
efl_text_interactive_editable_set(efl_added, EINA_FALSE),
|
|
||||||
efl_text_interactive_selection_allowed_set(efl_added, EINA_FALSE),
|
|
||||||
efl_pack(box, efl_added));
|
|
||||||
|
|
||||||
return box;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Creates a widget "button" for the specified .desktop file.
|
|
||||||
// These buttons are actually just an image with a label below.
|
|
||||||
static Efl_Ui_Widget *
|
|
||||||
_create_app_icon(Eo *parent, const char *desktop_file_path)
|
|
||||||
{
|
|
||||||
char *name = NULL, *command = NULL, *icon = NULL;
|
|
||||||
Eo *widget = NULL;
|
|
||||||
|
|
||||||
if (!_parse_desktop_file(desktop_file_path, &name, &command, &icon))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
widget = _create_icon(parent, name, command, icon);
|
|
||||||
|
|
||||||
free(name);
|
|
||||||
free(icon);
|
|
||||||
return widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adds a new empty page to the homescreen
|
|
||||||
static void
|
|
||||||
_add_page(Build_Data *bdata)
|
|
||||||
{
|
|
||||||
bdata->table = efl_add(EFL_UI_TABLE_CLASS, bdata->over_container,
|
|
||||||
efl_pack_table_size_set(efl_added, TABLE_COLUMNS, TABLE_ROWS));
|
|
||||||
efl_pack_end(bdata->over_container, bdata->table);
|
|
||||||
bdata->x = bdata->y = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adds all files in the array to the homescreen, adding pages as they become full.
|
|
||||||
static void
|
|
||||||
_app_found(void *data, Eina_Array *files)
|
|
||||||
{
|
|
||||||
unsigned int i;
|
|
||||||
const char *item;
|
|
||||||
Eina_Array_Iterator iterator;
|
|
||||||
Build_Data *bdata = data;
|
|
||||||
|
|
||||||
EINA_ARRAY_ITER_NEXT(files, i, item, iterator)
|
|
||||||
{
|
|
||||||
Eo *app = _create_app_icon(bdata->over_container, item);
|
|
||||||
if (app)
|
|
||||||
{
|
|
||||||
if (!bdata->table)
|
|
||||||
_add_page(bdata);
|
|
||||||
efl_pack_table(bdata->table, app, bdata->x, bdata->y, 1, 1);
|
|
||||||
bdata->x++;
|
|
||||||
if (bdata->x == TABLE_COLUMNS)
|
|
||||||
{
|
|
||||||
bdata->x = 0;
|
|
||||||
bdata->y++;
|
|
||||||
if (bdata->y == TABLE_ROWS)
|
|
||||||
bdata->table = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called when directory listing has finished
|
|
||||||
static Eina_Value
|
|
||||||
_file_listing_done_cb (void *data, const Eina_Value file, const Eina_Future *dead EINA_UNUSED)
|
|
||||||
{
|
|
||||||
Build_Data *bdata = data;
|
|
||||||
// Fill any remaining empty cells with invisible rectangles so the rest of the cells
|
|
||||||
// keep the same size as other pages
|
|
||||||
while (bdata->y < TABLE_ROWS)
|
|
||||||
{
|
|
||||||
while (bdata->x < TABLE_COLUMNS)
|
|
||||||
{
|
|
||||||
efl_add(EFL_CANVAS_RECTANGLE_CLASS, bdata->table,
|
|
||||||
efl_gfx_color_set(efl_added, 0, 0, 0, 0),
|
|
||||||
efl_pack_table(bdata->table, efl_added, bdata->x, bdata->y, 1, 1));
|
|
||||||
bdata->x++;
|
|
||||||
}
|
|
||||||
bdata->x = 0;
|
|
||||||
bdata->y++;
|
|
||||||
}
|
|
||||||
return file;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create Spotlight widget and start populating it with user apps.
|
|
||||||
static void
|
|
||||||
_build_homescreen(Efl_Ui_Win *win, Build_Data *bdata)
|
|
||||||
{
|
|
||||||
Efl_Ui_Spotlight_Indicator *indicator = efl_new(EFL_UI_SPOTLIGHT_ICON_INDICATOR_CLASS);
|
|
||||||
Efl_Ui_Spotlight_Manager *scroll = efl_new(EFL_UI_SPOTLIGHT_SCROLL_MANAGER_CLASS);
|
|
||||||
bdata->over_container = efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, win,
|
|
||||||
efl_ui_spotlight_manager_set(efl_added, scroll),
|
|
||||||
efl_ui_spotlight_indicator_set(efl_added, indicator)
|
|
||||||
);
|
|
||||||
bdata->table = NULL;
|
|
||||||
|
|
||||||
Eina_Future *future = efl_io_manager_ls(bdata->io_manager, "/usr/share/applications", bdata, _app_found, NULL);
|
|
||||||
eina_future_then(future, _file_listing_done_cb, bdata, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// The main box, with an upper space for the apps list and a lower space
|
|
||||||
// for the quick-action buttons.
|
|
||||||
static Efl_Ui_Widget*
|
|
||||||
_build_overall_structure(Efl_Ui_Win *win, Efl_Ui_Widget *homescreen)
|
|
||||||
{
|
|
||||||
Efl_Ui_Widget *box, *start_line;
|
|
||||||
|
|
||||||
box = efl_add(EFL_UI_BOX_CLASS, win);
|
|
||||||
|
|
||||||
// Set box background
|
|
||||||
// Objects retrieved with efl_part() only survive one function call, so we ref it
|
|
||||||
Eo *background = efl_ref(efl_part(box, "background"));
|
|
||||||
efl_file_key_set(background, "e/desktop/background");
|
|
||||||
efl_file_set(background, "../src/Hills.edj");
|
|
||||||
efl_file_load(background);
|
|
||||||
efl_unref(background);
|
|
||||||
|
|
||||||
efl_pack_end(box, homescreen);
|
|
||||||
|
|
||||||
// Start line
|
|
||||||
start_line = efl_add(EFL_UI_BOX_CLASS, win,
|
|
||||||
efl_gfx_color_set(efl_part(efl_added, "background"), 128, 128, 128, 128));
|
|
||||||
efl_gfx_hint_weight_set(start_line, 1.0, 0.0);
|
|
||||||
efl_ui_layout_orientation_set(start_line, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL);
|
|
||||||
efl_pack_end(box, start_line);
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < sizeof(launcher_apps)/sizeof(launcher_apps[0]); ++i)
|
|
||||||
{
|
|
||||||
efl_pack_end(start_line, _create_icon(start_line,
|
|
||||||
launcher_apps[i][0],
|
|
||||||
strdup(launcher_apps[i][1]),
|
|
||||||
launcher_apps[i][2]));
|
|
||||||
}
|
|
||||||
|
|
||||||
return box;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called when the app is closed
|
|
||||||
static void
|
|
||||||
_gui_quit_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
|
||||||
{
|
|
||||||
Build_Data *bdata = data;
|
|
||||||
if (bdata->io_manager)
|
|
||||||
efl_del(bdata->io_manager);
|
|
||||||
free(bdata);
|
|
||||||
efl_exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI_MAIN void
|
|
||||||
efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
|
|
||||||
{
|
|
||||||
Eo *win, *desktop;
|
|
||||||
Build_Data *bdata = calloc (1, sizeof(Build_Data));
|
|
||||||
|
|
||||||
bdata->io_manager = efl_add(EFL_IO_MANAGER_CLASS, efl_main_loop_get());
|
|
||||||
|
|
||||||
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
|
|
||||||
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
|
|
||||||
// when the user clicks "close" on a window there is a request to delete
|
|
||||||
efl_event_callback_add(win, EFL_UI_WIN_EVENT_DELETE_REQUEST, _gui_quit_cb, bdata);
|
|
||||||
|
|
||||||
_build_homescreen(win, bdata);
|
|
||||||
desktop = _build_overall_structure(win, bdata->over_container);
|
|
||||||
efl_content_set(win, desktop);
|
|
||||||
}
|
|
||||||
EFL_MAIN()
|
|
|
@ -1,11 +0,0 @@
|
||||||
src = files([
|
|
||||||
'homescreen.c',
|
|
||||||
])
|
|
||||||
|
|
||||||
deps = [eina, efl, elm]
|
|
||||||
|
|
||||||
executable('efl_example_homescreen', src,
|
|
||||||
dependencies : deps,
|
|
||||||
include_directories : inc,
|
|
||||||
install : true
|
|
||||||
)
|
|
|
@ -1,5 +1,7 @@
|
||||||
|
#define EFL_EO_API_SUPPORT 1
|
||||||
#define EFL_BETA_API_SUPPORT 1
|
#define EFL_BETA_API_SUPPORT 1
|
||||||
|
|
||||||
|
#include <Elementary.h>
|
||||||
#include <Efl_Ui.h>
|
#include <Efl_Ui.h>
|
||||||
|
|
||||||
#include "life_private.h"
|
#include "life_private.h"
|
||||||
|
@ -65,7 +67,7 @@ life_board_run(Efl_Ui_Win *win)
|
||||||
_life_timer = efl_add(EFL_LOOP_TIMER_CLASS, efl_main_loop_get(),
|
_life_timer = efl_add(EFL_LOOP_TIMER_CLASS, efl_main_loop_get(),
|
||||||
efl_loop_timer_interval_set(efl_added, 0.1));
|
efl_loop_timer_interval_set(efl_added, 0.1));
|
||||||
|
|
||||||
efl_event_callback_add(_life_timer, EFL_LOOP_TIMER_EVENT_TIMER_TICK, _life_tick, win);
|
efl_event_callback_add(_life_timer, EFL_LOOP_TIMER_EVENT_TICK, _life_tick, win);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
|
#define EFL_EO_API_SUPPORT 1
|
||||||
#define EFL_BETA_API_SUPPORT 1
|
#define EFL_BETA_API_SUPPORT 1
|
||||||
|
|
||||||
|
#include <Elementary.h>
|
||||||
#include <Efl_Ui.h>
|
#include <Efl_Ui.h>
|
||||||
|
|
||||||
#include "life_private.h"
|
#include "life_private.h"
|
||||||
|
@ -47,19 +49,19 @@ _life_win_key_down(void *data EINA_UNUSED, const Efl_Event *event)
|
||||||
ev = event->info;
|
ev = event->info;
|
||||||
win = event->object;
|
win = event->object;
|
||||||
|
|
||||||
if (!strcmp(efl_input_key_sym_get(ev), "space"))
|
if (!strcmp(efl_input_key_get(ev), "space"))
|
||||||
life_board_pause_toggle(win);
|
life_board_pause_toggle(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Efl_Ui_Win *
|
static Evas_Object *
|
||||||
_life_win_setup(void)
|
_life_win_setup(void)
|
||||||
{
|
{
|
||||||
Efl_Ui_Win *win;
|
Efl_Ui_Win *win;
|
||||||
int w;
|
Evas_Coord w;
|
||||||
int h;
|
Evas_Coord h;
|
||||||
|
|
||||||
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
|
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
|
||||||
efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
|
efl_ui_win_type_set(efl_added, EFL_UI_WIN_BASIC),
|
||||||
efl_text_set(efl_added, "EFL Life"),
|
efl_text_set(efl_added, "EFL Life"),
|
||||||
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
|
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
|
||||||
if (!win) return NULL;
|
if (!win) return NULL;
|
||||||
|
@ -74,7 +76,7 @@ _life_win_setup(void)
|
||||||
life_render_init(win);
|
life_render_init(win);
|
||||||
life_render_refresh(win);
|
life_render_refresh(win);
|
||||||
|
|
||||||
efl_event_callback_add(win, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _life_win_resize, NULL);
|
efl_event_callback_add(win, EFL_GFX_ENTITY_EVENT_RESIZE, _life_win_resize, NULL);
|
||||||
efl_event_callback_add(win, EFL_EVENT_POINTER_DOWN, _life_win_touch, NULL);
|
efl_event_callback_add(win, EFL_EVENT_POINTER_DOWN, _life_win_touch, NULL);
|
||||||
efl_event_callback_add(win, EFL_EVENT_KEY_DOWN, _life_win_key_down, NULL);
|
efl_event_callback_add(win, EFL_EVENT_KEY_DOWN, _life_win_key_down, NULL);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef LIFE_PRIVATE_H_
|
#ifndef LIFE_PRIVATE_H_
|
||||||
# define LIFE_PRIVATE_H_
|
# define LIFE_PRIVATE_H_
|
||||||
|
|
||||||
|
#include <Elementary.h>
|
||||||
#include <Efl_Ui.h>
|
#include <Efl_Ui.h>
|
||||||
|
|
||||||
#define LIFE_BOARD_WIDTH 47
|
#define LIFE_BOARD_WIDTH 47
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
|
#define EFL_EO_API_SUPPORT 1
|
||||||
#define EFL_BETA_API_SUPPORT 1
|
#define EFL_BETA_API_SUPPORT 1
|
||||||
|
|
||||||
|
#include <Elementary.h>
|
||||||
#include <Efl_Ui.h>
|
#include <Efl_Ui.h>
|
||||||
|
|
||||||
#include "life_private.h"
|
#include "life_private.h"
|
||||||
|
@ -46,7 +48,7 @@ life_render_layout(Efl_Ui_Win *win)
|
||||||
{
|
{
|
||||||
Eina_Size2D size;
|
Eina_Size2D size;
|
||||||
double cw, ch;
|
double cw, ch;
|
||||||
Efl_Canvas_Rectangle *rect;
|
Evas_Object *rect;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
size = efl_gfx_entity_size_get(win);
|
size = efl_gfx_entity_size_get(win);
|
||||||
|
@ -67,7 +69,7 @@ life_render_layout(Efl_Ui_Win *win)
|
||||||
void
|
void
|
||||||
life_render_cell(Efl_Ui_Win *win EINA_UNUSED, int x, int y)
|
life_render_cell(Efl_Ui_Win *win EINA_UNUSED, int x, int y)
|
||||||
{
|
{
|
||||||
Efl_Canvas_Rectangle *rect;
|
Evas_Object *rect;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
i = life_render_index_for_position(x, y);
|
i = life_render_index_for_position(x, y);
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
|
#define EFL_EO_API_SUPPORT 1
|
||||||
#define EFL_BETA_API_SUPPORT 1
|
#define EFL_BETA_API_SUPPORT 1
|
||||||
|
|
||||||
|
#include <Eina.h>
|
||||||
#include <Elementary.h>
|
#include <Elementary.h>
|
||||||
#include <Efl_Ui.h>
|
#include <Efl_Ui.h>
|
||||||
|
|
||||||
Efl_Ui_Textbox *_editor;
|
Efl_Ui_Text *_editor;
|
||||||
Efl_Ui_Button *_toolbar_new;
|
Efl_Ui_Button *_toolbar_new;
|
||||||
|
|
||||||
Eina_Bool _edited = EINA_FALSE;
|
Eina_Bool _edited = EINA_FALSE;
|
||||||
|
@ -40,12 +42,12 @@ _gui_toolbar_button_add(Efl_Ui_Box *toolbar, const char *name,
|
||||||
button = efl_add(EFL_UI_BUTTON_CLASS, toolbar,
|
button = efl_add(EFL_UI_BUTTON_CLASS, toolbar,
|
||||||
efl_text_set(efl_added, name),
|
efl_text_set(efl_added, name),
|
||||||
efl_pack(toolbar, efl_added),
|
efl_pack(toolbar, efl_added),
|
||||||
efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED,
|
efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED,
|
||||||
func, efl_added));
|
func, efl_added));
|
||||||
|
|
||||||
efl_add(EFL_UI_IMAGE_CLASS, toolbar,
|
efl_add(EFL_UI_IMAGE_CLASS, toolbar,
|
||||||
efl_ui_image_icon_set(efl_added, icon_name),
|
efl_ui_image_icon_set(efl_added, icon_name),
|
||||||
efl_content_set(button, efl_added));
|
efl_content_set(efl_part(button, "efl.content"), efl_added));
|
||||||
|
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
@ -57,15 +59,15 @@ _gui_toolbar_setup(Efl_Ui_Box *parent)
|
||||||
|
|
||||||
bar = efl_add(EFL_UI_BOX_CLASS, parent,
|
bar = efl_add(EFL_UI_BOX_CLASS, parent,
|
||||||
efl_pack(parent, efl_added),
|
efl_pack(parent, efl_added),
|
||||||
efl_gfx_hint_weight_set(efl_added, 1, 0),
|
efl_gfx_size_hint_weight_set(efl_added, 1, 0),
|
||||||
efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL));
|
efl_ui_direction_set(efl_added, EFL_UI_DIR_HORIZONTAL));
|
||||||
|
|
||||||
_toolbar_new = _gui_toolbar_button_add(bar, "New", "document-new", _gui_new_clicked_cb);
|
_toolbar_new = _gui_toolbar_button_add(bar, "New", "document-new", _gui_new_clicked_cb);
|
||||||
|
|
||||||
// spacer box
|
// spacer box
|
||||||
efl_add(EFL_UI_BOX_CLASS, parent,
|
efl_add(EFL_UI_BOX_CLASS, parent,
|
||||||
efl_pack(bar, efl_added),
|
efl_pack(bar, efl_added),
|
||||||
efl_gfx_hint_weight_set(efl_added, 10, 0));
|
efl_gfx_size_hint_weight_set(efl_added, 10, 0));
|
||||||
_gui_toolbar_button_add(bar, "Quit", "application-exit", _gui_quit_cb);
|
_gui_toolbar_button_add(bar, "Quit", "application-exit", _gui_quit_cb);
|
||||||
|
|
||||||
_gui_toolbar_refresh();
|
_gui_toolbar_refresh();
|
||||||
|
@ -78,8 +80,8 @@ _gui_toolbar_refresh(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
EFL_CALLBACKS_ARRAY_DEFINE(_editor_callbacks,
|
EFL_CALLBACKS_ARRAY_DEFINE(_editor_callbacks,
|
||||||
{ EFL_UI_TEXTBOX_EVENT_CHANGED, _editor_changed_cb },
|
{ EFL_UI_TEXT_EVENT_CHANGED, _editor_changed_cb },
|
||||||
{ EFL_TEXT_INTERACTIVE_EVENT_CHANGED_USER, _editor_changed_cb });
|
{ EFL_UI_TEXT_EVENT_CHANGED_USER, _editor_changed_cb });
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_gui_setup()
|
_gui_setup()
|
||||||
|
@ -87,7 +89,7 @@ _gui_setup()
|
||||||
Eo *win, *box;
|
Eo *win, *box;
|
||||||
|
|
||||||
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
|
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
|
||||||
efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
|
efl_ui_win_type_set(efl_added, EFL_UI_WIN_BASIC),
|
||||||
efl_text_set(efl_added, "Text Editor"),
|
efl_text_set(efl_added, "Text Editor"),
|
||||||
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
|
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
|
||||||
|
|
||||||
|
@ -96,18 +98,17 @@ _gui_setup()
|
||||||
|
|
||||||
box = efl_add(EFL_UI_BOX_CLASS, win,
|
box = efl_add(EFL_UI_BOX_CLASS, win,
|
||||||
efl_content_set(win, efl_added),
|
efl_content_set(win, efl_added),
|
||||||
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(360, 240)));
|
efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(360, 240)));
|
||||||
|
|
||||||
_gui_toolbar_setup(box);
|
_gui_toolbar_setup(box);
|
||||||
|
|
||||||
_editor = efl_add(EFL_UI_TEXTBOX_CLASS, box,
|
_editor = efl_add(EFL_UI_TEXT_CLASS, box,
|
||||||
|
efl_text_font_set(efl_added, "Mono", 14),
|
||||||
efl_text_multiline_set(efl_added, EINA_TRUE),
|
efl_text_multiline_set(efl_added, EINA_TRUE),
|
||||||
efl_text_interactive_editable_set(efl_added, EINA_TRUE),
|
efl_text_interactive_editable_set(efl_added, EINA_TRUE),
|
||||||
|
efl_ui_text_scrollable_set(efl_added, EINA_TRUE),
|
||||||
efl_event_callback_array_add(efl_added, _editor_callbacks(), NULL),
|
efl_event_callback_array_add(efl_added, _editor_callbacks(), NULL),
|
||||||
efl_pack(box, efl_added));
|
efl_pack(box, efl_added));
|
||||||
efl_ui_textbox_scrollable_set(_editor, EINA_TRUE);
|
|
||||||
efl_text_font_family_set(_editor, "Mono");
|
|
||||||
efl_text_font_size_set(_editor, 14);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI_MAIN void
|
EAPI_MAIN void
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
project(
|
|
||||||
'efl-example-calculator', 'cs',
|
|
||||||
version : '0.0.1',
|
|
||||||
meson_version : '>= 0.38.0')
|
|
||||||
|
|
||||||
efl_mono = dependency('efl-mono', version : '>=1.20.99')
|
|
||||||
efl_mono_libs = efl_mono.get_pkgconfig_variable('mono_libs')
|
|
||||||
|
|
||||||
subdir('src')
|
|
||||||
|
|
|
@ -1,198 +0,0 @@
|
||||||
/* Simple calculator using an Efl.Ui.Table to place the buttons
|
|
||||||
*/
|
|
||||||
using System;
|
|
||||||
|
|
||||||
public class Calculator : Efl.Csharp.Application
|
|
||||||
{
|
|
||||||
private Efl.Ui.Textbox screen; // Text widget showing current value
|
|
||||||
private int prevValue = 0; // Value introduced before an operation (first operand)
|
|
||||||
private int currValue = 0; // Value currently being introduced (second operand)
|
|
||||||
private char operation = '='; // Last operation button pressed
|
|
||||||
private bool mustOverwrite = false; // Whether next number must be appended to current input
|
|
||||||
// or overwrite it
|
|
||||||
|
|
||||||
// Quits the application
|
|
||||||
private void GUIQuitCb(object sender, Efl.Gfx.EntityVisibilityChangedEventArgs ea)
|
|
||||||
{
|
|
||||||
if (ea.Arg == false)
|
|
||||||
Efl.App.AppMain.Quit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Performs "operation" on "currValue" and "prevValue" and leaves result in "currValue"
|
|
||||||
private void Operate()
|
|
||||||
{
|
|
||||||
switch (operation)
|
|
||||||
{
|
|
||||||
case '+':
|
|
||||||
currValue += prevValue;
|
|
||||||
break;
|
|
||||||
case '-':
|
|
||||||
currValue = prevValue - currValue;
|
|
||||||
break;
|
|
||||||
case '*':
|
|
||||||
currValue *= prevValue;
|
|
||||||
break;
|
|
||||||
case '/':
|
|
||||||
currValue = prevValue / currValue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called every time a button is pressed
|
|
||||||
private void ButtonPressedCb(char button)
|
|
||||||
{
|
|
||||||
// If it is a number, append it to current input (or replace it)
|
|
||||||
if (button >= '0' && button <= '9')
|
|
||||||
{
|
|
||||||
if (mustOverwrite)
|
|
||||||
{
|
|
||||||
screen.Text = "";
|
|
||||||
mustOverwrite = false;
|
|
||||||
}
|
|
||||||
screen.Text = screen.Text + button.ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch (button)
|
|
||||||
{
|
|
||||||
case 'C':
|
|
||||||
// Clear current input
|
|
||||||
screen.Text = "0";
|
|
||||||
break;
|
|
||||||
case '+':
|
|
||||||
case '-':
|
|
||||||
case '*':
|
|
||||||
case '/':
|
|
||||||
case '=':
|
|
||||||
// If there was a pending operation, perform it
|
|
||||||
if (operation != '=')
|
|
||||||
{
|
|
||||||
Operate();
|
|
||||||
screen.Text = currValue.ToString();
|
|
||||||
}
|
|
||||||
// Store this operation
|
|
||||||
operation = button;
|
|
||||||
mustOverwrite = true;
|
|
||||||
prevValue = currValue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called every time the content of the screen changes
|
|
||||||
// We use it to sanitize input (remove heading zeros, for example)
|
|
||||||
// This makes more sense when the Text widget is editable, since the user
|
|
||||||
// is free to type anything.
|
|
||||||
private void ScreenChangedCb(object sender, EventArgs ea)
|
|
||||||
{
|
|
||||||
string text = "";
|
|
||||||
string str = screen.Text;
|
|
||||||
int d;
|
|
||||||
if (str == "" || str == "-")
|
|
||||||
{
|
|
||||||
text = "0";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
d = Convert.ToInt32(str);
|
|
||||||
text = d.ToString();
|
|
||||||
currValue = d;
|
|
||||||
}
|
|
||||||
catch {}
|
|
||||||
}
|
|
||||||
if (text != str) screen.Text = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Creates an Efl.Ui.Button and positions it in the given position inside the table
|
|
||||||
// The button text is colored with "r, g, b"
|
|
||||||
// "text" is what is drawn on the button, which might be a multi-byte unicode string.
|
|
||||||
// "command" is a single-char id for the button.
|
|
||||||
private void AddButton(Efl.Ui.Table table, string text, char command, int posx, int posy, int r, int g, int b)
|
|
||||||
{
|
|
||||||
var button = new Efl.Ui.Button(table);
|
|
||||||
table.PackTable(button, posx, posy, 1, 1);
|
|
||||||
button.ClickedEvent += (object sender, Efl.Input.ClickableClickedEventArgs ea) => {
|
|
||||||
ButtonPressedCb(command);
|
|
||||||
};
|
|
||||||
// Buttons can only have simple text (no font, styles or markup) but can swallow
|
|
||||||
// any other object we want.
|
|
||||||
// Therefore we create a more complex Efl.Ui.Text object and use it as content for the button.
|
|
||||||
var label = new Efl.Ui.Textbox(table);
|
|
||||||
label.Editable = false;
|
|
||||||
label.TextHorizontalAlign = 0.5;
|
|
||||||
label.TextVerticalAlign = 0.5;
|
|
||||||
label.Color = (r, g, b, 255);
|
|
||||||
label.Text = text;
|
|
||||||
label.FontFamily = "Sans";
|
|
||||||
label.FontSize = 36;
|
|
||||||
button.Content = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called on start up. We use it to create the UI.
|
|
||||||
protected override void OnInitialize(string[] args)
|
|
||||||
{
|
|
||||||
// The window
|
|
||||||
var win = new Efl.Ui.Win(Efl.App.AppMain);
|
|
||||||
win.Text = "EFL Calculator";
|
|
||||||
win.Autohide = true;
|
|
||||||
win.VisibilityChangedEvent += GUIQuitCb;
|
|
||||||
|
|
||||||
// The table is the main layout
|
|
||||||
var table = new Efl.Ui.Table(win);
|
|
||||||
win.Content = table;
|
|
||||||
table.TableSize = (4, 5);
|
|
||||||
table.HintSizeMin = new Eina.Size2D(300, 400);
|
|
||||||
|
|
||||||
// Create all buttons using the AddButton helper
|
|
||||||
AddButton(table, "1", '1', 0, 3, 255, 255, 255);
|
|
||||||
AddButton(table, "2", '2', 1, 3, 255, 255, 255);
|
|
||||||
AddButton(table, "3", '3', 2, 3, 255, 255, 255);
|
|
||||||
AddButton(table, "4", '4', 0, 2, 255, 255, 255);
|
|
||||||
AddButton(table, "5", '5', 1, 2, 255, 255, 255);
|
|
||||||
AddButton(table, "6", '6', 2, 2, 255, 255, 255);
|
|
||||||
AddButton(table, "7", '7', 0, 1, 255, 255, 255);
|
|
||||||
AddButton(table, "8", '8', 1, 1, 255, 255, 255);
|
|
||||||
AddButton(table, "9", '9', 2, 1, 255, 255, 255);
|
|
||||||
AddButton(table, "0", '0', 1, 4, 255, 255, 255);
|
|
||||||
AddButton(table, "+", '+', 3, 1, 128, 128, 128);
|
|
||||||
AddButton(table, "−", '-', 3, 2, 128, 128, 128);
|
|
||||||
AddButton(table, "×", '*', 3, 3, 128, 128, 128);
|
|
||||||
AddButton(table, "÷", '/', 3, 4, 128, 128, 128);
|
|
||||||
AddButton(table, "=", '=', 2, 4, 128, 128, 128);
|
|
||||||
AddButton(table, "C", 'C', 0, 4, 0, 0, 0);
|
|
||||||
|
|
||||||
// Create a big Efl.Ui.Text screen to display the current input
|
|
||||||
screen = new Efl.Ui.Textbox(table);
|
|
||||||
screen.Text = "0";
|
|
||||||
screen.Multiline = false;
|
|
||||||
screen.Editable = false;
|
|
||||||
screen.SelectionAllowed = false;
|
|
||||||
screen.TextHorizontalAlign = 0.9;
|
|
||||||
screen.TextVerticalAlign = 0.5;
|
|
||||||
screen.TextEffectType = Efl.TextStyleEffectType.Glow;
|
|
||||||
screen.TextGlowColor = (128, 128, 128, 128);
|
|
||||||
screen.FontFamily = "Sans";
|
|
||||||
screen.FontSize = 48;
|
|
||||||
screen.ChangedEvent += ScreenChangedCb;
|
|
||||||
table.PackTable(screen, 0, 0, 4, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Example
|
|
||||||
{
|
|
||||||
#if WIN32
|
|
||||||
[STAThreadAttribute()]
|
|
||||||
#endif
|
|
||||||
public static void Main()
|
|
||||||
{
|
|
||||||
var calculator = new Calculator();
|
|
||||||
calculator.Launch();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
src = files([
|
|
||||||
'calculator.cs',
|
|
||||||
])
|
|
||||||
|
|
||||||
deps = [efl_mono]
|
|
||||||
|
|
||||||
executable('efl_example_calculator', src,
|
|
||||||
dependencies : deps,
|
|
||||||
cs_args : efl_mono_libs,
|
|
||||||
install : true
|
|
||||||
)
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class LifeBoard
|
||||||
|
|
||||||
private bool[] board;
|
private bool[] board;
|
||||||
private bool[] board1, board2;
|
private bool[] board1, board2;
|
||||||
private Efl.LoopTimer lifeTimer = null;
|
private efl.ILoop_Timer lifeTimer = null;
|
||||||
private LifeRender lifeRender = null;
|
private LifeRender lifeRender = null;
|
||||||
|
|
||||||
private void CellOn(int x, int y)
|
private void CellOn(int x, int y)
|
||||||
|
@ -58,11 +58,13 @@ public class LifeBoard
|
||||||
board = board1;
|
board = board1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run(Efl.Ui.Win win)
|
public void Run(efl.ui.IWin win)
|
||||||
{
|
{
|
||||||
lifeTimer = new Efl.LoopTimer(win, 0.1);
|
lifeTimer = new efl.Loop_Timer(win, (efl.ILoop_Timer etimer) => {
|
||||||
|
etimer.SetInterval(0.1);
|
||||||
|
});
|
||||||
|
|
||||||
lifeTimer.TimerTickEvent += (object sender, EventArgs ev) => {
|
lifeTimer.TickEvt += (object sender, EventArgs ev) => {
|
||||||
Nextgen();
|
Nextgen();
|
||||||
if (this.lifeRender != null)
|
if (this.lifeRender != null)
|
||||||
this.lifeRender.Refresh(win);
|
this.lifeRender.Refresh(win);
|
||||||
|
@ -139,11 +141,12 @@ public class LifeBoard
|
||||||
board = work;
|
board = work;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TogglePause(Efl.Ui.Win win)
|
public void TogglePause(efl.ui.IWin win)
|
||||||
{
|
{
|
||||||
if (lifeTimer != null)
|
if (lifeTimer != null)
|
||||||
{
|
{
|
||||||
lifeTimer.Del();
|
lifeTimer.SetParent(null);
|
||||||
|
lifeTimer.Dispose();
|
||||||
lifeTimer = null;
|
lifeTimer = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,27 +1,26 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
public class LifeWindow : Efl.Csharp.Application
|
public class LifeWindow
|
||||||
{
|
{
|
||||||
private LifeBoard lifeBoard;
|
private LifeBoard lifeBoard;
|
||||||
private LifeRender lifeRender;
|
private LifeRender lifeRender;
|
||||||
private Efl.Ui.Win win;
|
|
||||||
|
|
||||||
void ResizeEvent(object sender, EventArgs ev)
|
void ResizeEvt(object sender, EventArgs ev)
|
||||||
{
|
{
|
||||||
lifeRender.RenderLayout((Efl.Ui.Win)sender);
|
lifeRender.RenderLayout((efl.ui.IWin)sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuitEvent(object sender, Efl.Gfx.EntityVisibilityChangedEventArgs ev)
|
void QuitEvt(object sender, EventArgs ev)
|
||||||
{
|
{
|
||||||
// quit the mainloop
|
// quit the mainloop
|
||||||
if (ev.Arg == false)
|
efl.ui.Config.Exit();
|
||||||
Efl.App.AppMain.Quit(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TouchEvent(object sender, Efl.Input.InterfacePointerDownEventArgs ev)
|
void TouchEvt(object sender, efl.input.Interface.PointerDownEvt_Args ev)
|
||||||
{
|
{
|
||||||
int cellx, celly;
|
int cellx, celly;
|
||||||
var position = ev.Arg.Position;
|
efl.ui.IWin win = (efl.ui.IWin)sender;
|
||||||
|
var position = ev.arg.GetPosition();
|
||||||
lifeRender.CellForCoords(win, position, out cellx, out celly);
|
lifeRender.CellForCoords(win, position, out cellx, out celly);
|
||||||
|
|
||||||
int i = LifeBoard.IndexForPosition(cellx, celly);
|
int i = LifeBoard.IndexForPosition(cellx, celly);
|
||||||
|
@ -29,58 +28,53 @@ public class LifeWindow : Efl.Csharp.Application
|
||||||
lifeRender.RenderCell(win, cellx, celly);
|
lifeRender.RenderCell(win, cellx, celly);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyDownEvent(object sender, Efl.Input.InterfaceKeyDownEventArgs ev)
|
void KeyDownEvt(object sender, efl.input.Interface.KeyDownEvt_Args ev)
|
||||||
{
|
{
|
||||||
if (ev.Arg.KeySym == "space")
|
efl.ui.IWin win = (efl.ui.IWin)sender;
|
||||||
|
if (ev.arg.GetKey() == "space")
|
||||||
lifeBoard.TogglePause(win);
|
lifeBoard.TogglePause(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnInitialize(string[] args)
|
public LifeWindow()
|
||||||
{
|
{
|
||||||
win = new Efl.Ui.Win(parent: null, winName: "Life", winType: Efl.Ui.WinType.Basic);
|
efl.ui.IWin win = new efl.ui.Win(null, (efl.ui.IWin ewin) => {
|
||||||
win.Text = "EFL Life";
|
ewin.SetWinType(efl.ui.Win_Type.Basic);
|
||||||
win.Autohide = true;
|
ewin.SetText("EFL Life");
|
||||||
|
ewin.SetAutohide(true);
|
||||||
|
});
|
||||||
|
|
||||||
// when the user clicks "close" on a window there is a request to hide
|
// when the user clicks "close" on a window there is a request to hide
|
||||||
((Efl.Gfx.IEntity)win).VisibilityChangedEvent += QuitEvent;
|
win.HideEvt += QuitEvt;
|
||||||
|
|
||||||
|
eina.Size2D sz;
|
||||||
|
sz.W = (int)(10 * LifeBoard.Width * win.GetScale());
|
||||||
|
sz.H = (int)(10 * LifeBoard.Height * win.GetScale());
|
||||||
|
|
||||||
lifeBoard = new LifeBoard();
|
lifeBoard = new LifeBoard();
|
||||||
lifeRender = new LifeRender(win, lifeBoard);
|
lifeRender = new LifeRender(win, lifeBoard);
|
||||||
lifeRender.Refresh(win);
|
lifeRender.Refresh(win);
|
||||||
|
|
||||||
((Efl.Gfx.IEntity)win).SizeChangedEvent += ResizeEvent;
|
win.ResizeEvt += ResizeEvt;
|
||||||
((Efl.Input.IInterface)win).PointerDownEvent += TouchEvent;
|
win.PointerDownEvt += TouchEvt;
|
||||||
((Efl.Input.IInterface)win).KeyDownEvent += KeyDownEvent;
|
win.KeyDownEvt += KeyDownEvt;
|
||||||
|
|
||||||
win.Size = new Eina.Size2D((int)(10 * LifeBoard.Width * win.Scale),
|
win.SetSize(sz);
|
||||||
(int)(10 * LifeBoard.Height * win.Scale));
|
|
||||||
|
|
||||||
lifeBoard.Run(win);
|
lifeBoard.Run(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnPause() {
|
|
||||||
if (win != null) {
|
|
||||||
lifeBoard.TogglePause(win);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnResume() {
|
|
||||||
if (win != null) {
|
|
||||||
lifeBoard.TogglePause(win);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnTerminate() {
|
|
||||||
Console.WriteLine("Goodbye.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Example
|
public class Example
|
||||||
{
|
{
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
|
efl.All.Init(efl.Components.Ui);
|
||||||
|
|
||||||
var lifeWin = new LifeWindow();
|
var lifeWin = new LifeWindow();
|
||||||
|
|
||||||
lifeWin.Launch();
|
// start the mainloop
|
||||||
|
efl.ui.Config.Run();
|
||||||
|
|
||||||
|
efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,34 +2,34 @@ using System;
|
||||||
|
|
||||||
public class LifeRender
|
public class LifeRender
|
||||||
{
|
{
|
||||||
private Efl.Canvas.Rectangle[] lifeCells;
|
private efl.canvas.IRectangle[] lifeCells;
|
||||||
private LifeBoard lifeBoard;
|
private LifeBoard lifeBoard;
|
||||||
|
|
||||||
public LifeRender(Efl.Ui.Win win, LifeBoard board)
|
public LifeRender(efl.ui.IWin win, LifeBoard board)
|
||||||
{
|
{
|
||||||
lifeBoard = board;
|
lifeBoard = board;
|
||||||
lifeBoard.SetRender(this);
|
lifeBoard.SetRender(this);
|
||||||
|
|
||||||
lifeCells = new Efl.Canvas.Rectangle[LifeBoard.Height * LifeBoard.Width];
|
lifeCells = new efl.canvas.Rectangle[LifeBoard.Height * LifeBoard.Width];
|
||||||
|
|
||||||
for (int y = 0; y < LifeBoard.Height; ++y)
|
for (int y = 0; y < LifeBoard.Height; ++y)
|
||||||
for (int x = 0; x < LifeBoard.Width; ++x)
|
for (int x = 0; x < LifeBoard.Width; ++x)
|
||||||
lifeCells[LifeBoard.IndexForPosition(x, y)] = new Efl.Canvas.Rectangle(win);
|
lifeCells[LifeBoard.IndexForPosition(x, y)] = new efl.canvas.Rectangle(win);
|
||||||
|
|
||||||
RenderLayout(win);
|
RenderLayout(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CellForCoords(Efl.Ui.Win win, Eina.Position2D coord, out int x, out int y)
|
public void CellForCoords(efl.ui.IWin win, eina.Position2D coord, out int x, out int y)
|
||||||
{
|
{
|
||||||
Eina.Size2D size = win.Size;
|
eina.Size2D size = win.GetSize();
|
||||||
|
|
||||||
x = coord.X * LifeBoard.Width / size.W;
|
x = coord.X * LifeBoard.Width / size.W;
|
||||||
y = coord.Y * LifeBoard.Height / size.H;
|
y = coord.Y * LifeBoard.Height / size.H;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RenderLayout(Efl.Ui.Win win)
|
public void RenderLayout(efl.ui.IWin win)
|
||||||
{
|
{
|
||||||
Eina.Size2D size = win.Size;
|
eina.Size2D size = win.GetSize();
|
||||||
double cw = (double) size.W / LifeBoard.Width;
|
double cw = (double) size.W / LifeBoard.Width;
|
||||||
double ch = (double) size.H / LifeBoard.Height;
|
double ch = (double) size.H / LifeBoard.Height;
|
||||||
|
|
||||||
|
@ -39,24 +39,30 @@ public class LifeRender
|
||||||
var rect = lifeCells[LifeBoard.IndexForPosition(x, y)];
|
var rect = lifeCells[LifeBoard.IndexForPosition(x, y)];
|
||||||
|
|
||||||
// the little +1 here will avoid tearing as we layout non-multiple sizes
|
// the little +1 here will avoid tearing as we layout non-multiple sizes
|
||||||
rect.Size = new Eina.Size2D((int)(cw + 1), (int)(ch + 1));
|
eina.Size2D sz;
|
||||||
|
sz.W = (int)(cw + 1);
|
||||||
|
sz.H = (int)(ch + 1);
|
||||||
|
rect.SetSize(sz);
|
||||||
|
|
||||||
rect.Position = new Eina.Position2D((int)(x * cw), (int)(y * ch));
|
eina.Position2D pos;
|
||||||
|
pos.X = (int)(x * cw);
|
||||||
|
pos.Y = (int)(y * ch);
|
||||||
|
rect.SetPosition(pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RenderCell(Efl.Ui.Win win, int x, int y)
|
public void RenderCell(efl.ui.IWin win, int x, int y)
|
||||||
{
|
{
|
||||||
int i = LifeBoard.IndexForPosition(x, y);
|
int i = LifeBoard.IndexForPosition(x, y);
|
||||||
var rect = lifeCells[i];
|
var rect = lifeCells[i];
|
||||||
|
|
||||||
if (lifeBoard.Cells[i])
|
if (lifeBoard.Cells[i])
|
||||||
rect.Color = (0, 0, 0, 255);
|
rect.SetColor(0, 0, 0, 255);
|
||||||
else
|
else
|
||||||
rect.Color = (255, 255, 255, 255);
|
rect.SetColor(255, 255, 255, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Refresh(Efl.Ui.Win win)
|
public void Refresh(efl.ui.IWin win)
|
||||||
{
|
{
|
||||||
for (int y = 0; y < LifeBoard.Height; ++y)
|
for (int y = 0; y < LifeBoard.Height; ++y)
|
||||||
for (int x = 0; x < LifeBoard.Width; ++x)
|
for (int x = 0; x < LifeBoard.Width; ++x)
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
project(
|
|
||||||
'efl-example-mvvm', 'cs',
|
|
||||||
version : '0.0.1',
|
|
||||||
meson_version : '>= 0.49.0')
|
|
||||||
|
|
||||||
efl_mono = dependency('efl-mono', version : '>=1.23.99')
|
|
||||||
efl_mono_libs = efl_mono.get_pkgconfig_variable('mono_libs')
|
|
||||||
|
|
||||||
subdir('src')
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
src = files([
|
|
||||||
'mvvm_basic.cs',
|
|
||||||
])
|
|
||||||
|
|
||||||
deps = [efl_mono]
|
|
||||||
|
|
||||||
executable('efl_example_mvvm', src,
|
|
||||||
dependencies : deps,
|
|
||||||
cs_args : efl_mono_libs,
|
|
||||||
install : true
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,69 +0,0 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
class WeatherStation
|
|
||||||
{
|
|
||||||
public String Nick { get; set; }
|
|
||||||
public float Temperature { get; set; }
|
|
||||||
|
|
||||||
public static Efl.UserModel<WeatherStation> CreateModel(Efl.Loop loop)
|
|
||||||
{
|
|
||||||
Efl.UserModel<WeatherStation> stations = new Efl.UserModel<WeatherStation>(loop);
|
|
||||||
stations.Add (new WeatherStation{ Nick="FLN", Temperature=20 });
|
|
||||||
stations.Add (new WeatherStation{ Nick="SAO", Temperature=25 });
|
|
||||||
stations.Add (new WeatherStation{ Nick="RIO", Temperature=35 });
|
|
||||||
stations.Add (new WeatherStation{ Nick="BSB", Temperature=30 });
|
|
||||||
|
|
||||||
return stations;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class WeatherServer
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
class Application : Efl.Csharp.Application
|
|
||||||
{
|
|
||||||
private Efl.Ui.Win win;
|
|
||||||
|
|
||||||
protected override void OnInitialize(string[] args)
|
|
||||||
{
|
|
||||||
win = new Efl.Ui.Win(parent: null, winName: "MVVM Example",
|
|
||||||
winType: Efl.Ui.WinType.Basic);
|
|
||||||
win.Text = "EFL Life";
|
|
||||||
win.Autohide = true;
|
|
||||||
|
|
||||||
win.VisibilityChangedEvent += QuitEvt;
|
|
||||||
|
|
||||||
var factory = new Efl.Ui.ItemFactory<Efl.Ui.ListDefaultItem>(win);
|
|
||||||
// Text property is temporarily excluded from the extension method generation
|
|
||||||
// due to conflicts with the text classes.
|
|
||||||
factory.BindProperty("text", "Nick");
|
|
||||||
|
|
||||||
var model = WeatherStation.CreateModel(Efl.App.AppMain);
|
|
||||||
|
|
||||||
var manager = new Efl.Ui.PositionManager.List(win);
|
|
||||||
var list = new Efl.Ui.CollectionView(win);
|
|
||||||
|
|
||||||
list.PositionManager = manager;
|
|
||||||
list.Model = model;
|
|
||||||
list.Factory = factory;
|
|
||||||
|
|
||||||
win.SetContent(list);
|
|
||||||
win.Size = new Eina.Size2D(640, 480);
|
|
||||||
win.Visible = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QuitEvt(object sender, Efl.Gfx.EntityVisibilityChangedEventArgs ev)
|
|
||||||
{
|
|
||||||
if (ev.Arg == false)
|
|
||||||
{
|
|
||||||
Efl.App.AppMain.Quit(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Main()
|
|
||||||
{
|
|
||||||
var app = new Application();
|
|
||||||
app.Launch();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -17,36 +17,35 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
public class TextEditor : Efl.Csharp.Application
|
public class TextEditor
|
||||||
{
|
{
|
||||||
private Efl.Ui.Win win; // The main window
|
private efl.ui.IWin win; // The main window
|
||||||
private Efl.Ui.Textbox editorTextBox; // The main text entry
|
private efl.ui.IText editorTextBox; // The main text entry
|
||||||
private Efl.Ui.Button toolbarButtonNew; // The "New" button in the toolbar
|
private efl.ui.IButton toolbarButtonNew; // The "New" button in the toolbar
|
||||||
private Efl.Ui.Button toolbarButtonSave; // The "Save" button in the toolbar
|
private efl.ui.IButton toolbarButtonSave; // The "Save" button in the toolbar
|
||||||
private Efl.Ui.Button toolbarButtonLoad; // The "Load" button in the toolbar
|
private efl.ui.IButton toolbarButtonLoad; // The "Load" button in the toolbar
|
||||||
|
|
||||||
private bool edited = false; // Document was edited since last save
|
private bool edited = false; // Document was edited since last save
|
||||||
|
|
||||||
// File to load and save is fixed since we do not use a file selection dialog
|
// File to load and save is fixed since we do not use a file selection dialog
|
||||||
private readonly string filename = System.IO.Path.Combine(System.IO.Path.GetTempPath(),
|
private readonly string filename = System.IO.Path.Combine(System.IO.Path.GetTempPath(),
|
||||||
"texteditor_example.txt");
|
"texteditor_example.txt");
|
||||||
|
|
||||||
// Quits the application
|
// Quits the application
|
||||||
private void GUIQuitCb(object sender, Efl.Gfx.EntityVisibilityChangedEventArgs ea)
|
private void GUIQuitCb(object sender, EventArgs ea)
|
||||||
{
|
{
|
||||||
if (ea.Arg == false)
|
efl.ui.Config.Exit();
|
||||||
Efl.App.AppMain.Quit(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enables or disables buttons on the toolbar as required
|
// Enables or disables buttons on the toolbar as required
|
||||||
private void GUIToolbarRefresh()
|
private void GUIToolbarRefresh()
|
||||||
{
|
{
|
||||||
// "New" is enabled if there is text in the text box
|
// "New" is enabled if there is text in the text box
|
||||||
toolbarButtonNew.Disabled = string.IsNullOrEmpty(editorTextBox.Text);
|
toolbarButtonNew.SetDisabled(string.IsNullOrEmpty(editorTextBox.GetText()));
|
||||||
// "Save" is enabled if the text has been modified since last save or load
|
// "Save" is enabled if the text has been modified since last save or load
|
||||||
toolbarButtonSave.Disabled = !edited;
|
toolbarButtonSave.SetDisabled(!edited);
|
||||||
// "Load" is enabled if there is a file to load
|
// "Load" is enabled if there is a file to load
|
||||||
toolbarButtonLoad.Disabled = !System.IO.File.Exists(filename);
|
toolbarButtonLoad.SetDisabled(!System.IO.File.Exists(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the text in the editor has changed
|
// Called when the text in the editor has changed
|
||||||
|
@ -59,61 +58,65 @@ public class TextEditor : Efl.Csharp.Application
|
||||||
// Shows a modal message popup with an "OK" button
|
// Shows a modal message popup with an "OK" button
|
||||||
private void ShowMessage(string message)
|
private void ShowMessage(string message)
|
||||||
{
|
{
|
||||||
var popup = new Efl.Ui.AlertPopup (win);
|
new efl.ui.Popup_Alert_Text (win, (efl.ui.IPopup_Alert_Text epopup) => {
|
||||||
popup.ScrollableText = message;
|
epopup.SetText(message);
|
||||||
popup.HintSizeMax = new Eina.Size2D(200, 200);
|
epopup.SetExpandable(new eina.Size2D(200,200));
|
||||||
popup.SetButton(Efl.Ui.AlertPopupButton.Positive, "OK", null);
|
epopup.SetButton(efl.ui.Popup_Alert_Button.Positive, "OK", null);
|
||||||
popup.ButtonClickedEvent +=
|
epopup.ButtonClickedEvt +=
|
||||||
(object sender, Efl.Ui.AlertPopupButtonClickedEventArgs ea) => {
|
(object sender, efl.ui.Popup_Alert.ButtonClickedEvt_Args ea) => {
|
||||||
// Dismiss popup when the button is clicked
|
// Dismiss popup when the button is clicked
|
||||||
((Efl.Ui.AlertPopup)sender).Del();
|
((efl.ui.IPopup_Alert_Text)sender).SetParent(null);
|
||||||
};
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adds a button to the toolbar, with the given text, icon and click event handler
|
// Adds a button to the toolbar, with the given text, icon and click event handler
|
||||||
private Efl.Ui.Button GUIToolbarButtonAdd(Efl.Ui.Box toolbar, string name,
|
private efl.ui.IButton GUIToolbarButtonAdd(efl.ui.IBox toolbar, string name,
|
||||||
string iconName, EventHandler<Efl.Input.ClickableClickedEventArgs> func)
|
string iconName, EventHandler func)
|
||||||
{
|
{
|
||||||
var button = new Efl.Ui.Button(toolbar);
|
return new efl.ui.Button(toolbar, (efl.ui.IButton ebutton) => {
|
||||||
button.Text = name;
|
ebutton.SetText(name);
|
||||||
button.ClickedEvent += func;
|
ebutton.ClickedEvt += func;
|
||||||
button.HintWeight = (0, 1);
|
ebutton.SetHintWeight(0, 1);
|
||||||
|
toolbar.DoPack(ebutton);
|
||||||
|
|
||||||
// Set the content of the button, which is an image
|
// Set the content of the button
|
||||||
var image = new Efl.Ui.Image(toolbar);
|
efl.Content.static_cast(ebutton.GetPart("efl.content")).SetContent(
|
||||||
image.SetIcon(iconName);
|
// Which is an image
|
||||||
button.SetContent(image);
|
new efl.ui.Image(toolbar, (efl.ui.IImage eimage) => {
|
||||||
|
eimage.SetIcon(iconName);
|
||||||
toolbar.Pack(button);
|
})
|
||||||
return button;
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a new toolbar, with all its buttons
|
// Creates a new toolbar, with all its buttons
|
||||||
private void GUIToolbarSetup(Efl.Ui.Box parent)
|
private void GUIToolbarSetup(efl.ui.IBox parent)
|
||||||
{
|
{
|
||||||
// Create a horizontal box container for the buttons
|
// Create a horizontal box container for the buttons
|
||||||
var bar = new Efl.Ui.Box(parent);
|
efl.ui.IBox bar = new efl.ui.Box(parent, (efl.ui.IBox ebox) => {
|
||||||
// 0 vertical weight means that the toolbar will have the minimum height
|
// 0 vertical weight means that the toolbar will have the minimum height
|
||||||
// to accommodate all its buttons and not a pixel more. The rest of the
|
// to accommodate all its buttons and not a pixel more. The rest of the
|
||||||
// space will be given to the other object in the parent container.
|
// space will be given to the other object in the parent container.
|
||||||
bar.HintWeight = (1, 0);
|
ebox.SetHintWeight(1, 0);
|
||||||
bar.Orientation = Efl.Ui.LayoutOrientation.Horizontal;
|
ebox.SetDirection(efl.ui.Dir.Horizontal);
|
||||||
parent.Pack(bar);
|
parent.DoPack(ebox);
|
||||||
|
});
|
||||||
|
|
||||||
// "New" button
|
// "New" button
|
||||||
toolbarButtonNew = GUIToolbarButtonAdd(bar, "New", "document-new",
|
toolbarButtonNew = GUIToolbarButtonAdd(bar, "New", "document-new",
|
||||||
(object sender, Efl.Input.ClickableClickedEventArgs ea) => {
|
(object sender, EventArgs ea) => {
|
||||||
// When this button is clicked, remove content and refresh toolbar
|
// When this button is clicked, remove content and refresh toolbar
|
||||||
editorTextBox.Text = "";
|
editorTextBox.SetText("");
|
||||||
GUIToolbarRefresh();
|
GUIToolbarRefresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
// "Save" button
|
// "Save" button
|
||||||
toolbarButtonSave = GUIToolbarButtonAdd(bar, "Save", "document-save",
|
toolbarButtonSave = GUIToolbarButtonAdd(bar, "Save", "document-save",
|
||||||
(object sender, Efl.Input.ClickableClickedEventArgs ea) => {
|
(object sender, EventArgs ea) => {
|
||||||
// When this button is clicked, try to save content and refresh toolbar
|
// When this button is clicked, try to save content and refresh toolbar
|
||||||
try {
|
try {
|
||||||
System.IO.File.WriteAllText(filename, editorTextBox.Text);
|
System.IO.File.WriteAllText(filename, editorTextBox.GetText());
|
||||||
edited = false;
|
edited = false;
|
||||||
GUIToolbarRefresh();
|
GUIToolbarRefresh();
|
||||||
ShowMessage("Saved!");
|
ShowMessage("Saved!");
|
||||||
|
@ -125,10 +128,10 @@ public class TextEditor : Efl.Csharp.Application
|
||||||
|
|
||||||
// "Load" button
|
// "Load" button
|
||||||
toolbarButtonLoad = GUIToolbarButtonAdd(bar, "Load", "document-open",
|
toolbarButtonLoad = GUIToolbarButtonAdd(bar, "Load", "document-open",
|
||||||
(object sender, Efl.Input.ClickableClickedEventArgs ea) => {
|
(object sender, EventArgs ea) => {
|
||||||
// When this button is clicked, try to load content and refresh toolbar
|
// When this button is clicked, try to load content and refresh toolbar
|
||||||
try {
|
try {
|
||||||
editorTextBox.Text = System.IO.File.ReadAllText(filename);
|
editorTextBox.SetText(System.IO.File.ReadAllText(filename));
|
||||||
edited = false;
|
edited = false;
|
||||||
GUIToolbarRefresh();
|
GUIToolbarRefresh();
|
||||||
ShowMessage("Loaded!");
|
ShowMessage("Loaded!");
|
||||||
|
@ -143,44 +146,52 @@ public class TextEditor : Efl.Csharp.Application
|
||||||
// a horizontal weight of 0).
|
// a horizontal weight of 0).
|
||||||
// As a result, it pushes the "Quit" button to the right margin and
|
// As a result, it pushes the "Quit" button to the right margin and
|
||||||
// the rest to the left.
|
// the rest to the left.
|
||||||
Efl.Ui.Box box = new Efl.Ui.Box(parent);
|
efl.ui.IBox box = new efl.ui.Box(parent);
|
||||||
bar.Pack(box);
|
bar.DoPack(box);
|
||||||
|
|
||||||
// "Quit" button
|
// "Quit" button
|
||||||
GUIToolbarButtonAdd(bar, "Quit", "application-exit", (object sender, Efl.Input.ClickableClickedEventArgs e) => { Efl.Ui.Config.Exit(); } );
|
GUIToolbarButtonAdd(bar, "Quit", "application-exit", GUIQuitCb);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Builds the user interface for the text editor
|
// Builds the user interface for the text editor
|
||||||
protected override void OnInitialize(string[] args)
|
public TextEditor()
|
||||||
{
|
{
|
||||||
// Create a window and initialize it
|
// Create a window and initialize it
|
||||||
win = new Efl.Ui.Win(parent: Efl.App.AppMain);
|
win = new efl.ui.Win(efl.App.GetLoopMain(), (efl.ui.IWin ewin) => {
|
||||||
win.Text = "Text Editor";
|
ewin.SetText("Text Editor");
|
||||||
win.Autohide = true;
|
ewin.SetAutohide(true);
|
||||||
win.VisibilityChangedEvent += GUIQuitCb;
|
ewin.HideEvt += GUIQuitCb;
|
||||||
|
});
|
||||||
|
|
||||||
// Create a vertical box container
|
// Create a vertical box container
|
||||||
Efl.Ui.Box box = new Efl.Ui.Box(win);
|
efl.ui.IBox box = new efl.ui.Box(win);
|
||||||
win.SetContent(box);
|
win.SetContent(box);
|
||||||
|
|
||||||
// Create the toolbar and add it to the box
|
// Create the toolbar and add it to the box
|
||||||
GUIToolbarSetup(box);
|
GUIToolbarSetup(box);
|
||||||
|
|
||||||
// Create the main text entry
|
// Create the main text entry
|
||||||
editorTextBox = new Efl.Ui.Textbox(box);
|
editorTextBox = new efl.ui.Text(box, (efl.ui.IText etext) => {
|
||||||
editorTextBox.FontFamily = "Mono";
|
etext.SetFont("Mono", 14);
|
||||||
editorTextBox.FontSize = 14;
|
etext.SetMultiline(true);
|
||||||
editorTextBox.Multiline = true;
|
etext.SetEditable(true);
|
||||||
editorTextBox.Editable = true;
|
etext.SetScrollable(true);
|
||||||
editorTextBox.Scrollable = true;
|
etext.SetHintMin(new eina.Size2D(360, 240));
|
||||||
editorTextBox.HintSizeMin = new Eina.Size2D(360, 240);
|
etext.ChangedEvt += EditorChangedCb;
|
||||||
editorTextBox.ChangedEvent += EditorChangedCb;
|
etext.ChangedUserEvt += EditorChangedCb;
|
||||||
editorTextBox.ChangedUserEvent += EditorChangedCb;
|
box.DoPack(etext);
|
||||||
box.Pack(editorTextBox);
|
});
|
||||||
|
|
||||||
// Initial refresh of the toolbar buttons
|
// Initial refresh of the toolbar buttons
|
||||||
GUIToolbarRefresh();
|
GUIToolbarRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This method won't return until the application quits
|
||||||
|
public void Run()
|
||||||
|
{
|
||||||
|
// Start the EFL main loop
|
||||||
|
efl.ui.Config.Run();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Example
|
public class Example
|
||||||
|
@ -190,8 +201,14 @@ public class Example
|
||||||
#endif
|
#endif
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
TextEditor editor = new TextEditor();
|
// Initialize EFL and all UI components
|
||||||
editor.Launch();
|
efl.All.Init(efl.Components.Ui);
|
||||||
|
|
||||||
|
var textEditor = new TextEditor();
|
||||||
|
textEditor.Run();
|
||||||
|
|
||||||
|
// Shutdown EFL
|
||||||
|
efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -235,7 +235,7 @@ efl_main(void *data EINA_UNUSED,
|
||||||
/* The TCP client to use to send/receive network data */
|
/* The TCP client to use to send/receive network data */
|
||||||
dialer = efl_add(EFL_NET_DIALER_TCP_CLASS, ev->object,
|
dialer = efl_add(EFL_NET_DIALER_TCP_CLASS, ev->object,
|
||||||
efl_name_set(efl_added, "dialer"),
|
efl_name_set(efl_added, "dialer"),
|
||||||
efl_event_callback_add(efl_added, EFL_NET_DIALER_EVENT_DIALER_CONNECTED, _dialer_connected, NULL));
|
efl_event_callback_add(efl_added, EFL_NET_DIALER_EVENT_CONNECTED, _dialer_connected, NULL));
|
||||||
if (!dialer)
|
if (!dialer)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ERROR: could not create Efl_Net_Dialer_Tcp\n");
|
fprintf(stderr, "ERROR: could not create Efl_Net_Dialer_Tcp\n");
|
|
@ -78,7 +78,7 @@ _dialer_connected(void *data EINA_UNUSED, const Efl_Event *event)
|
||||||
EFL_CALLBACKS_ARRAY_DEFINE(dialer_cbs,
|
EFL_CALLBACKS_ARRAY_DEFINE(dialer_cbs,
|
||||||
{ EFL_NET_DIALER_EVENT_RESOLVED, _dialer_resolved },
|
{ EFL_NET_DIALER_EVENT_RESOLVED, _dialer_resolved },
|
||||||
{ EFL_NET_DIALER_EVENT_ERROR, _dialer_error },
|
{ EFL_NET_DIALER_EVENT_ERROR, _dialer_error },
|
||||||
{ EFL_NET_DIALER_EVENT_DIALER_CONNECTED, _dialer_connected });
|
{ EFL_NET_DIALER_EVENT_CONNECTED, _dialer_connected });
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_http_headers_done(void *data EINA_UNUSED, const Efl_Event *event)
|
_http_headers_done(void *data EINA_UNUSED, const Efl_Event *event)
|
|
@ -304,7 +304,7 @@ efl_main(void *data EINA_UNUSED,
|
||||||
/* The TCP client to use to send/receive network data */
|
/* The TCP client to use to send/receive network data */
|
||||||
dialer = efl_add(EFL_NET_DIALER_TCP_CLASS, loop,
|
dialer = efl_add(EFL_NET_DIALER_TCP_CLASS, loop,
|
||||||
efl_name_set(efl_added, "dialer"),
|
efl_name_set(efl_added, "dialer"),
|
||||||
efl_event_callback_add(efl_added, EFL_NET_DIALER_EVENT_DIALER_CONNECTED, _dialer_connected, NULL));
|
efl_event_callback_add(efl_added, EFL_NET_DIALER_EVENT_CONNECTED, _dialer_connected, NULL));
|
||||||
if (!dialer)
|
if (!dialer)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ERROR: could not create Efl_Net_Dialer_Tcp\n");
|
fprintf(stderr, "ERROR: could not create Efl_Net_Dialer_Tcp\n");
|
|
@ -70,7 +70,7 @@ _http_headers_done(void *data EINA_UNUSED, const Efl_Event *event)
|
||||||
|
|
||||||
EFL_CALLBACKS_ARRAY_DEFINE(dialer_cbs,
|
EFL_CALLBACKS_ARRAY_DEFINE(dialer_cbs,
|
||||||
{ EFL_NET_DIALER_HTTP_EVENT_HEADERS_DONE, _http_headers_done },
|
{ EFL_NET_DIALER_HTTP_EVENT_HEADERS_DONE, _http_headers_done },
|
||||||
{ EFL_NET_DIALER_EVENT_DIALER_CONNECTED, _connected },
|
{ EFL_NET_DIALER_EVENT_CONNECTED, _connected },
|
||||||
{ EFL_NET_DIALER_EVENT_RESOLVED, _resolved },
|
{ EFL_NET_DIALER_EVENT_RESOLVED, _resolved },
|
||||||
{ EFL_NET_DIALER_EVENT_ERROR, _error },
|
{ EFL_NET_DIALER_EVENT_ERROR, _error },
|
||||||
{ EFL_IO_CLOSER_EVENT_CLOSED, _closed },
|
{ EFL_IO_CLOSER_EVENT_CLOSED, _closed },
|
|
@ -175,7 +175,7 @@ _done(void *data EINA_UNUSED, const Efl_Event *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
EFL_CALLBACKS_ARRAY_DEFINE(dialer_cbs,
|
EFL_CALLBACKS_ARRAY_DEFINE(dialer_cbs,
|
||||||
{ EFL_NET_DIALER_EVENT_DIALER_CONNECTED, _connected }, /* optional */
|
{ EFL_NET_DIALER_EVENT_CONNECTED, _connected }, /* optional */
|
||||||
{ EFL_NET_DIALER_EVENT_RESOLVED, _resolved }, /* optional */
|
{ EFL_NET_DIALER_EVENT_RESOLVED, _resolved }, /* optional */
|
||||||
{ EFL_IO_READER_EVENT_CAN_READ_CHANGED, _can_read }, /* optional, can be used to read data, here just for monitoring */
|
{ EFL_IO_READER_EVENT_CAN_READ_CHANGED, _can_read }, /* optional, can be used to read data, here just for monitoring */
|
||||||
{ EFL_IO_READER_EVENT_EOS, _eos }, /* recommended, notifies no more incoming data */
|
{ EFL_IO_READER_EVENT_EOS, _eos }, /* recommended, notifies no more incoming data */
|
|
@ -155,7 +155,7 @@ _error(void *data EINA_UNUSED, const Efl_Event *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
EFL_CALLBACKS_ARRAY_DEFINE(dialer_cbs,
|
EFL_CALLBACKS_ARRAY_DEFINE(dialer_cbs,
|
||||||
{ EFL_NET_DIALER_EVENT_DIALER_CONNECTED, _connected },
|
{ EFL_NET_DIALER_EVENT_CONNECTED, _connected },
|
||||||
{ EFL_NET_DIALER_EVENT_RESOLVED, _resolved },
|
{ EFL_NET_DIALER_EVENT_RESOLVED, _resolved },
|
||||||
{ EFL_NET_DIALER_EVENT_ERROR, _error },
|
{ EFL_NET_DIALER_EVENT_ERROR, _error },
|
||||||
{ EFL_IO_READER_EVENT_CAN_READ_CHANGED, _can_read },
|
{ EFL_IO_READER_EVENT_CAN_READ_CHANGED, _can_read },
|
|
@ -107,7 +107,7 @@ _error(void *data EINA_UNUSED, const Efl_Event *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
EFL_CALLBACKS_ARRAY_DEFINE(dialer_cbs,
|
EFL_CALLBACKS_ARRAY_DEFINE(dialer_cbs,
|
||||||
{ EFL_NET_DIALER_EVENT_DIALER_CONNECTED, _connected },
|
{ EFL_NET_DIALER_EVENT_CONNECTED, _connected },
|
||||||
{ EFL_NET_DIALER_EVENT_RESOLVED, _resolved },
|
{ EFL_NET_DIALER_EVENT_RESOLVED, _resolved },
|
||||||
{ EFL_NET_DIALER_EVENT_ERROR, _error },
|
{ EFL_NET_DIALER_EVENT_ERROR, _error },
|
||||||
{ EFL_IO_READER_EVENT_EOS, _eos },
|
{ EFL_IO_READER_EVENT_EOS, _eos },
|
|
@ -246,7 +246,7 @@ EFL_CALLBACKS_ARRAY_DEFINE(dialer_cbs,
|
||||||
{ EFL_NET_DIALER_WEBSOCKET_EVENT_CLOSED_REASON, _ws_closed_reason },
|
{ EFL_NET_DIALER_WEBSOCKET_EVENT_CLOSED_REASON, _ws_closed_reason },
|
||||||
{ EFL_NET_DIALER_WEBSOCKET_EVENT_MESSAGE_TEXT, _ws_message_text },
|
{ EFL_NET_DIALER_WEBSOCKET_EVENT_MESSAGE_TEXT, _ws_message_text },
|
||||||
{ EFL_NET_DIALER_WEBSOCKET_EVENT_MESSAGE_BINARY, _ws_message_binary },
|
{ EFL_NET_DIALER_WEBSOCKET_EVENT_MESSAGE_BINARY, _ws_message_binary },
|
||||||
{ EFL_NET_DIALER_EVENT_DIALER_CONNECTED, _connected },
|
{ EFL_NET_DIALER_EVENT_CONNECTED, _connected },
|
||||||
{ EFL_NET_DIALER_EVENT_ERROR, _error },
|
{ EFL_NET_DIALER_EVENT_ERROR, _error },
|
||||||
{ EFL_IO_CLOSER_EVENT_CLOSED, _closed },
|
{ EFL_IO_CLOSER_EVENT_CLOSED, _closed },
|
||||||
{ EFL_IO_READER_EVENT_EOS, _eos },
|
{ EFL_IO_READER_EVENT_EOS, _eos },
|
|
@ -144,7 +144,7 @@ EFL_CALLBACKS_ARRAY_DEFINE(dialer_cbs,
|
||||||
{ EFL_NET_DIALER_WEBSOCKET_EVENT_CLOSED_REASON, _ws_closed_reason },
|
{ EFL_NET_DIALER_WEBSOCKET_EVENT_CLOSED_REASON, _ws_closed_reason },
|
||||||
{ EFL_NET_DIALER_WEBSOCKET_EVENT_MESSAGE_TEXT, _ws_message_text },
|
{ EFL_NET_DIALER_WEBSOCKET_EVENT_MESSAGE_TEXT, _ws_message_text },
|
||||||
{ EFL_NET_DIALER_WEBSOCKET_EVENT_MESSAGE_BINARY, _ws_message_binary },
|
{ EFL_NET_DIALER_WEBSOCKET_EVENT_MESSAGE_BINARY, _ws_message_binary },
|
||||||
{ EFL_NET_DIALER_EVENT_DIALER_CONNECTED, _connected },
|
{ EFL_NET_DIALER_EVENT_CONNECTED, _connected },
|
||||||
{ EFL_NET_DIALER_EVENT_RESOLVED, _resolved },
|
{ EFL_NET_DIALER_EVENT_RESOLVED, _resolved },
|
||||||
{ EFL_NET_DIALER_EVENT_ERROR, _error },
|
{ EFL_NET_DIALER_EVENT_ERROR, _error },
|
||||||
{ EFL_IO_CLOSER_EVENT_CLOSED, _closed },
|
{ EFL_IO_CLOSER_EVENT_CLOSED, _closed },
|
|
@ -106,7 +106,7 @@ _error(void *data EINA_UNUSED, const Efl_Event *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
EFL_CALLBACKS_ARRAY_DEFINE(dialer_cbs,
|
EFL_CALLBACKS_ARRAY_DEFINE(dialer_cbs,
|
||||||
{ EFL_NET_DIALER_EVENT_DIALER_CONNECTED, _connected },
|
{ EFL_NET_DIALER_EVENT_CONNECTED, _connected },
|
||||||
{ EFL_NET_DIALER_EVENT_RESOLVED, _resolved },
|
{ EFL_NET_DIALER_EVENT_RESOLVED, _resolved },
|
||||||
{ EFL_NET_DIALER_EVENT_ERROR, _error },
|
{ EFL_NET_DIALER_EVENT_ERROR, _error },
|
||||||
{ EFL_IO_READER_EVENT_EOS, _eos },
|
{ EFL_IO_READER_EVENT_EOS, _eos },
|
|
@ -1,4 +1,5 @@
|
||||||
#define EFL_BETA_API_SUPPORT 1
|
#define EFL_BETA_API_SUPPORT 1
|
||||||
|
#define EFL_EO_API_SUPPORT 1
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
|
@ -176,7 +176,7 @@ _error(void *data EINA_UNUSED, const Efl_Event *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
EFL_CALLBACKS_ARRAY_DEFINE(dialer_cbs,
|
EFL_CALLBACKS_ARRAY_DEFINE(dialer_cbs,
|
||||||
{ EFL_NET_DIALER_EVENT_DIALER_CONNECTED, _connected },
|
{ EFL_NET_DIALER_EVENT_CONNECTED, _connected },
|
||||||
{ EFL_NET_DIALER_EVENT_RESOLVED, _resolved },
|
{ EFL_NET_DIALER_EVENT_RESOLVED, _resolved },
|
||||||
{ EFL_NET_DIALER_EVENT_ERROR, _error });
|
{ EFL_NET_DIALER_EVENT_ERROR, _error });
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
ecore_examples = [
|
||||||
|
'efl_io_buffered_stream_example',
|
||||||
|
'efl_io_copier_example',
|
||||||
|
'efl_io_copier_simple_example',
|
||||||
|
'efl_io_queue_example',
|
||||||
|
'efl_net_control_example',
|
||||||
|
'efl_net_dialer_http_example',
|
||||||
|
'efl_net_dialer_simple_example',
|
||||||
|
'efl_net_dialer_udp_example',
|
||||||
|
'efl_net_dialer_unix_example',
|
||||||
|
'efl_net_dialer_websocket_autobahntestee',
|
||||||
|
'efl_net_dialer_websocket_example',
|
||||||
|
'efl_net_ip_address_example',
|
||||||
|
'efl_net_server_example',
|
||||||
|
'efl_net_server_simple_example',
|
||||||
|
'efl_net_session_example',
|
||||||
|
'efl_net_socket_ssl_dialer_example',
|
||||||
|
'efl_net_socket_ssl_server_example',
|
||||||
|
]
|
||||||
|
|
||||||
|
if build_machine.system() == 'windows'
|
||||||
|
ecore_examples += 'efl_net_dialer_windows_example'
|
||||||
|
endif
|
||||||
|
|
||||||
|
ecore = dependency('ecore-con')
|
||||||
|
|
||||||
|
foreach example_src : ecore_examples
|
||||||
|
file = example_src + '.c'
|
||||||
|
executable(example_src,
|
||||||
|
file,
|
||||||
|
dependencies: ecore,
|
||||||
|
c_args : beta_defines
|
||||||
|
)
|
||||||
|
endforeach
|
|
@ -0,0 +1,16 @@
|
||||||
|
eio_examples = [
|
||||||
|
'efl_io_manager_ls',
|
||||||
|
'efl_io_manager_open',
|
||||||
|
'efl_io_manager_open_multi',
|
||||||
|
]
|
||||||
|
|
||||||
|
eio = [dependency('eio'), dependency('ecore')]
|
||||||
|
|
||||||
|
foreach example_src : eio_examples
|
||||||
|
file = example_src + '.c'
|
||||||
|
executable(example_src,
|
||||||
|
file,
|
||||||
|
dependencies: eio,
|
||||||
|
c_args : beta_defines
|
||||||
|
)
|
||||||
|
endforeach
|
|
@ -5,6 +5,7 @@
|
||||||
# include "elementary_config.h"
|
# include "elementary_config.h"
|
||||||
#else
|
#else
|
||||||
# define EFL_BETA_API_SUPPORT 1
|
# define EFL_BETA_API_SUPPORT 1
|
||||||
|
# define EFL_EO_API_SUPPORT 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Elementary.h>
|
#include <Elementary.h>
|
||||||
|
@ -113,16 +114,16 @@ elm_main(int argc, char **argv)
|
||||||
efl_gfx_entity_size_set(win, EINA_SIZE2D(400, 800));
|
efl_gfx_entity_size_set(win, EINA_SIZE2D(400, 800));
|
||||||
|
|
||||||
wbox = efl_add(EFL_UI_BOX_CLASS, win);
|
wbox = efl_add(EFL_UI_BOX_CLASS, win);
|
||||||
efl_ui_layout_orientation_set(wbox, EFL_UI_LAYOUT_ORIENTATION_VERTICAL);
|
efl_ui_direction_set(wbox, EFL_UI_DIR_VERTICAL);
|
||||||
efl_gfx_hint_weight_set(wbox, EFL_GFX_SIZE_HINT_EXPAND, EFL_GFX_SIZE_HINT_EXPAND);
|
efl_gfx_size_hint_weight_set(wbox, EFL_GFX_SIZE_HINT_EXPAND, EFL_GFX_SIZE_HINT_EXPAND);
|
||||||
efl_gfx_hint_align_set(wbox, EFL_GFX_SIZE_HINT_FILL, EFL_GFX_SIZE_HINT_FILL);
|
efl_gfx_size_hint_align_set(wbox, EFL_GFX_SIZE_HINT_FILL, EFL_GFX_SIZE_HINT_FILL);
|
||||||
|
|
||||||
if ((argv[1] != NULL) &&
|
if ((argv[1] != NULL) &&
|
||||||
(!strcmp(argv[1], "empty")))
|
(!strcmp(argv[1], "empty")))
|
||||||
emptystyle = EINA_TRUE;
|
emptystyle = EINA_TRUE;
|
||||||
|
|
||||||
priv_d.list = list = efl_add(EFL_UI_LIST_CLASS, wbox);
|
priv_d.list = list = efl_add(EFL_UI_LIST_CLASS, wbox);
|
||||||
efl_gfx_hint_weight_set(list, EFL_GFX_SIZE_HINT_EXPAND, 0.9);
|
efl_gfx_size_hint_weight_set(list, EFL_GFX_SIZE_HINT_EXPAND, 0.9);
|
||||||
|
|
||||||
efl_event_callback_add(list, EFL_UI_EVENT_SELECTED, _list_selected, NULL);
|
efl_event_callback_add(list, EFL_UI_EVENT_SELECTED, _list_selected, NULL);
|
||||||
efl_event_callback_add(list, EFL_UI_EVENT_UNSELECTED, _list_unselected, NULL);
|
efl_event_callback_add(list, EFL_UI_EVENT_UNSELECTED, _list_unselected, NULL);
|
||||||
|
@ -141,10 +142,10 @@ elm_main(int argc, char **argv)
|
||||||
if (emptystyle)
|
if (emptystyle)
|
||||||
{
|
{
|
||||||
ibox = efl_add(EFL_UI_BOX_CLASS, item);
|
ibox = efl_add(EFL_UI_BOX_CLASS, item);
|
||||||
efl_ui_layout_orientation_set(ibox, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL);
|
efl_ui_direction_set(ibox, EFL_UI_DIR_HORIZONTAL);
|
||||||
|
|
||||||
txt = efl_add(EFL_UI_TEXT_CLASS, ibox);
|
txt = efl_add(EFL_UI_TEXT_CLASS, ibox);
|
||||||
efl_gfx_hint_weight_set(txt, 0.95, EFL_GFX_SIZE_HINT_EXPAND);
|
efl_gfx_size_hint_weight_set(txt, 0.95, EFL_GFX_SIZE_HINT_EXPAND);
|
||||||
efl_text_halign_set(txt, 0.2);
|
efl_text_halign_set(txt, 0.2);
|
||||||
efl_text_interactive_selection_allowed_set(txt, EINA_FALSE);
|
efl_text_interactive_selection_allowed_set(txt, EINA_FALSE);
|
||||||
snprintf(buf, sizeof(buf), "empty style item [%d]", i);
|
snprintf(buf, sizeof(buf), "empty style item [%d]", i);
|
||||||
|
@ -152,7 +153,7 @@ elm_main(int argc, char **argv)
|
||||||
efl_pack_end(ibox, txt);
|
efl_pack_end(ibox, txt);
|
||||||
|
|
||||||
check = efl_add(EFL_UI_CHECK_CLASS, ibox);
|
check = efl_add(EFL_UI_CHECK_CLASS, ibox);
|
||||||
efl_gfx_hint_weight_set(check, 0.05, EFL_GFX_SIZE_HINT_EXPAND);
|
efl_gfx_size_hint_weight_set(check, 0.05, EFL_GFX_SIZE_HINT_EXPAND);
|
||||||
efl_pack_end(ibox, check);
|
efl_pack_end(ibox, check);
|
||||||
|
|
||||||
if (i % 2)
|
if (i % 2)
|
||||||
|
@ -222,15 +223,15 @@ elm_main(int argc, char **argv)
|
||||||
|
|
||||||
/*select mode */
|
/*select mode */
|
||||||
txt = efl_add(EFL_UI_TEXT_CLASS, wbox);
|
txt = efl_add(EFL_UI_TEXT_CLASS, wbox);
|
||||||
efl_gfx_hint_weight_set(txt, EFL_GFX_SIZE_HINT_EXPAND, 0.01);
|
efl_gfx_size_hint_weight_set(txt, EFL_GFX_SIZE_HINT_EXPAND, 0.01);
|
||||||
efl_text_halign_set(txt, 0.02);
|
efl_text_halign_set(txt, 0.02);
|
||||||
efl_text_interactive_selection_allowed_set(txt, EINA_FALSE);
|
efl_text_interactive_selection_allowed_set(txt, EINA_FALSE);
|
||||||
efl_text_set(txt, "Select Mode");
|
efl_text_set(txt, "Select Mode");
|
||||||
efl_pack_end(wbox, txt);
|
efl_pack_end(wbox, txt);
|
||||||
|
|
||||||
bbox = efl_add(EFL_UI_BOX_CLASS, wbox);
|
bbox = efl_add(EFL_UI_BOX_CLASS, wbox);
|
||||||
efl_ui_layout_orientation_set(bbox, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL);
|
efl_ui_direction_set(bbox, EFL_UI_DIR_HORIZONTAL);
|
||||||
efl_gfx_hint_weight_set(bbox, EFL_GFX_SIZE_HINT_EXPAND, 0.05);
|
efl_gfx_size_hint_weight_set(bbox, EFL_GFX_SIZE_HINT_EXPAND, 0.05);
|
||||||
|
|
||||||
select_radio = radio = efl_add(EFL_UI_RADIO_CLASS, wbox);
|
select_radio = radio = efl_add(EFL_UI_RADIO_CLASS, wbox);
|
||||||
efl_text_set(radio, "SINGLE");
|
efl_text_set(radio, "SINGLE");
|
||||||
|
@ -259,35 +260,35 @@ elm_main(int argc, char **argv)
|
||||||
|
|
||||||
/* scroll mode */
|
/* scroll mode */
|
||||||
txt = efl_add(EFL_UI_TEXT_CLASS, wbox);
|
txt = efl_add(EFL_UI_TEXT_CLASS, wbox);
|
||||||
efl_gfx_hint_weight_set(txt, EFL_GFX_SIZE_HINT_EXPAND, 0.01);
|
efl_gfx_size_hint_weight_set(txt, EFL_GFX_SIZE_HINT_EXPAND, 0.01);
|
||||||
efl_text_interactive_selection_allowed_set(txt, EINA_FALSE);
|
efl_text_interactive_selection_allowed_set(txt, EINA_FALSE);
|
||||||
efl_text_halign_set(txt, 0.02);
|
efl_text_halign_set(txt, 0.02);
|
||||||
efl_text_set(txt, "Item Scroll");
|
efl_text_set(txt, "Item Scroll");
|
||||||
efl_pack_end(wbox, txt);
|
efl_pack_end(wbox, txt);
|
||||||
|
|
||||||
priv_d.slider = slider = efl_add(EFL_UI_SLIDER_CLASS, wbox);
|
priv_d.slider = slider = efl_add(EFL_UI_SLIDER_CLASS, wbox);
|
||||||
efl_ui_layout_orientation_set(slider, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL);
|
efl_ui_direction_set(slider, EFL_UI_DIR_HORIZONTAL);
|
||||||
efl_gfx_hint_weight_set(slider, 0.0, 0.05);
|
efl_gfx_size_hint_weight_set(slider, 0.0, 0.05);
|
||||||
efl_gfx_hint_align_set(slider, 0.5, 0.5);
|
efl_gfx_size_hint_align_set(slider, 0.5, 0.5);
|
||||||
efl_gfx_hint_size_min_set(slider, EINA_SIZE2D(380, 20));
|
efl_gfx_size_hint_min_set(slider, EINA_SIZE2D(380, 20));
|
||||||
efl_ui_range_min_max_set(slider, 0.0, 1.0);
|
efl_ui_range_min_max_set(slider, 0.0, 1.0);
|
||||||
efl_pack_end(wbox, slider);
|
efl_pack_end(wbox, slider);
|
||||||
|
|
||||||
bbox = efl_add(EFL_UI_BOX_CLASS, wbox);
|
bbox = efl_add(EFL_UI_BOX_CLASS, wbox);
|
||||||
efl_ui_layout_orientation_set(bbox, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL);
|
efl_ui_direction_set(bbox, EFL_UI_DIR_HORIZONTAL);
|
||||||
efl_gfx_hint_weight_set(bbox, EFL_GFX_SIZE_HINT_EXPAND, 0.05);
|
efl_gfx_size_hint_weight_set(bbox, EFL_GFX_SIZE_HINT_EXPAND, 0.05);
|
||||||
|
|
||||||
rbox = efl_add(EFL_UI_BOX_CLASS, bbox);
|
rbox = efl_add(EFL_UI_BOX_CLASS, bbox);
|
||||||
efl_ui_layout_orientation_set(rbox, EFL_UI_LAYOUT_ORIENTATION_VERTICAL);
|
efl_ui_direction_set(rbox, EFL_UI_DIR_VERTICAL);
|
||||||
|
|
||||||
anim_radio = radio = efl_add(EFL_UI_RADIO_CLASS, rbox);
|
anim_radio = radio = efl_add(EFL_UI_RADIO_CLASS, rbox);
|
||||||
efl_gfx_hint_align_set(radio, 0.5, 0.5);
|
efl_gfx_size_hint_align_set(radio, 0.5, 0.5);
|
||||||
efl_text_set(radio, "ANIMATION OFF");
|
efl_text_set(radio, "ANIMATION OFF");
|
||||||
efl_ui_radio_state_value_set(radio, 0);
|
efl_ui_radio_state_value_set(radio, 0);
|
||||||
efl_event_callback_add(radio, EFL_UI_RADIO_EVENT_CHANGED, _anim_radio_changed, NULL);
|
efl_event_callback_add(radio, EFL_UI_RADIO_EVENT_CHANGED, _anim_radio_changed, NULL);
|
||||||
efl_pack_end(rbox, radio);
|
efl_pack_end(rbox, radio);
|
||||||
radio = efl_add(EFL_UI_RADIO_CLASS, rbox);
|
radio = efl_add(EFL_UI_RADIO_CLASS, rbox);
|
||||||
efl_gfx_hint_align_set(radio, 0.5, 0.5);
|
efl_gfx_size_hint_align_set(radio, 0.5, 0.5);
|
||||||
efl_text_set(radio, "ANIMATION ON");
|
efl_text_set(radio, "ANIMATION ON");
|
||||||
efl_ui_radio_state_value_set(radio, 1);
|
efl_ui_radio_state_value_set(radio, 1);
|
||||||
efl_ui_radio_group_add(radio, anim_radio);
|
efl_ui_radio_group_add(radio, anim_radio);
|
||||||
|
@ -296,20 +297,20 @@ elm_main(int argc, char **argv)
|
||||||
efl_pack_end(bbox, rbox);
|
efl_pack_end(bbox, rbox);
|
||||||
|
|
||||||
rbox = efl_add(EFL_UI_BOX_CLASS, bbox);
|
rbox = efl_add(EFL_UI_BOX_CLASS, bbox);
|
||||||
efl_ui_layout_orientation_set(rbox, EFL_UI_LAYOUT_ORIENTATION_VERTICAL);
|
efl_ui_direction_set(rbox, EFL_UI_DIR_VERTICAL);
|
||||||
|
|
||||||
scrl_btn = efl_add(EFL_UI_BUTTON_CLASS, rbox);
|
scrl_btn = efl_add(EFL_UI_BUTTON_CLASS, rbox);
|
||||||
efl_text_set(scrl_btn, "Scroll Item");
|
efl_text_set(scrl_btn, "Scroll Item");
|
||||||
efl_gfx_hint_align_set(scrl_btn, 0.5, 0.5);
|
efl_gfx_size_hint_align_set(scrl_btn, 0.5, 0.5);
|
||||||
efl_gfx_hint_size_min_set(scrl_btn, EINA_SIZE2D(200, 25));
|
efl_gfx_size_hint_min_set(scrl_btn, EINA_SIZE2D(200, 25));
|
||||||
efl_event_callback_add(scrl_btn, EFL_INPUT_EVENT_CLICKED, _scrl_btn_clicked, NULL);
|
efl_event_callback_add(scrl_btn, EFL_UI_EVENT_CLICKED, _scrl_btn_clicked, NULL);
|
||||||
efl_pack_end(rbox, scrl_btn);
|
efl_pack_end(rbox, scrl_btn);
|
||||||
|
|
||||||
scrl_btn = efl_add(EFL_UI_BUTTON_CLASS, rbox);
|
scrl_btn = efl_add(EFL_UI_BUTTON_CLASS, rbox);
|
||||||
efl_text_set(scrl_btn, "Scroll Item Align");
|
efl_text_set(scrl_btn, "Scroll Item Align");
|
||||||
efl_gfx_hint_align_set(scrl_btn, 0.5, 0.5);
|
efl_gfx_size_hint_align_set(scrl_btn, 0.5, 0.5);
|
||||||
efl_gfx_hint_size_min_set(scrl_btn, EINA_SIZE2D(200, 25));
|
efl_gfx_size_hint_min_set(scrl_btn, EINA_SIZE2D(200, 25));
|
||||||
efl_event_callback_add(scrl_btn, EFL_INPUT_EVENT_CLICKED, _scrl_align_btn_clicked, NULL);
|
efl_event_callback_add(scrl_btn, EFL_UI_EVENT_CLICKED, _scrl_align_btn_clicked, NULL);
|
||||||
efl_pack_end(rbox, scrl_btn);
|
efl_pack_end(rbox, scrl_btn);
|
||||||
|
|
||||||
efl_pack_end(bbox, rbox);
|
efl_pack_end(bbox, rbox);
|
|
@ -2,6 +2,7 @@
|
||||||
//gcc -g efl_ui_scroller_example.c -o efl_ui_scroller_example `pkg-config --cflags --libs elementary`
|
//gcc -g efl_ui_scroller_example.c -o efl_ui_scroller_example `pkg-config --cflags --libs elementary`
|
||||||
|
|
||||||
#define EFL_BETA_API_SUPPORT
|
#define EFL_BETA_API_SUPPORT
|
||||||
|
#define EFL_EO_API_SUPPORT
|
||||||
|
|
||||||
#include <Elementary.h>
|
#include <Elementary.h>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
# include "elementary_config.h"
|
# include "elementary_config.h"
|
||||||
#else
|
#else
|
||||||
# define EFL_BETA_API_SUPPORT 1
|
# define EFL_BETA_API_SUPPORT 1
|
||||||
|
# define EFL_EO_API_SUPPORT 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Elementary.h>
|
#include <Elementary.h>
|
|
@ -4,6 +4,7 @@
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#else
|
#else
|
||||||
# define EFL_BETA_API_SUPPORT 1
|
# define EFL_BETA_API_SUPPORT 1
|
||||||
|
# define EFL_EO_API_SUPPORT 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Elementary.h>
|
#include <Elementary.h>
|
|
@ -4,6 +4,7 @@
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#else
|
#else
|
||||||
# define EFL_BETA_API_SUPPORT 1
|
# define EFL_BETA_API_SUPPORT 1
|
||||||
|
# define EFL_EO_API_SUPPORT 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ELM_INTERFACE_ATSPI_SELECTION_PROTECTED
|
#define ELM_INTERFACE_ATSPI_SELECTION_PROTECTED
|
|
@ -0,0 +1,20 @@
|
||||||
|
elementary_examples = [
|
||||||
|
'efl_ui_list_example_1',
|
||||||
|
'efl_ui_scroller_example',
|
||||||
|
'efl_ui_view_list_example_1',
|
||||||
|
'efl_ui_view_list_example_2',
|
||||||
|
'efl_ui_view_list_example_3'
|
||||||
|
]
|
||||||
|
|
||||||
|
#'efl_ui_view_list_example.edc'
|
||||||
|
|
||||||
|
elementary = [dependency('elementary')]
|
||||||
|
|
||||||
|
foreach example_src : elementary_examples
|
||||||
|
file = example_src + '.c'
|
||||||
|
executable(example_src,
|
||||||
|
file,
|
||||||
|
dependencies: elementary,
|
||||||
|
c_args : beta_defines
|
||||||
|
)
|
||||||
|
endforeach
|
|
@ -0,0 +1,11 @@
|
||||||
|
project('efl-c-examples',
|
||||||
|
'c',
|
||||||
|
version: '1.0'
|
||||||
|
)
|
||||||
|
|
||||||
|
beta_defines = ['-DEFL_EO_API_SUPPORT=1', '-DEFL_BETA_API_SUPPORT=1']
|
||||||
|
|
||||||
|
subdir('ecore')
|
||||||
|
subdir('eio')
|
||||||
|
subdir('elementary')
|
||||||
|
|
|
@ -4,18 +4,18 @@ using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
class TestMain
|
class TestMain
|
||||||
{
|
{
|
||||||
/* private Efl.Loop loop; */
|
/* private efl.Loop loop; */
|
||||||
|
|
||||||
public TestMain(Efl.Loop loop)
|
public TestMain(efl.Loop loop)
|
||||||
{
|
{
|
||||||
/* this.loop = loop; */
|
/* this.loop = loop; */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Efl.All.Init();
|
efl.All.Init();
|
||||||
|
|
||||||
Efl.Loop loop = new Efl.LoopConcrete();
|
efl.Loop loop = new efl.LoopConcrete();
|
||||||
|
|
||||||
TestMain listener = new TestMain(loop);
|
TestMain listener = new TestMain(loop);
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ class TestMain
|
||||||
|
|
||||||
loop.IDLE += listener.on_idle_enter; // Will trigger CALLBACK_ADD
|
loop.IDLE += listener.on_idle_enter; // Will trigger CALLBACK_ADD
|
||||||
|
|
||||||
Efl.All.Shutdown();
|
efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void on_idle_enter(object sender, EventArgs e)
|
public void on_idle_enter(object sender, EventArgs e)
|
|
@ -4,10 +4,10 @@ using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
class TestMain
|
class TestMain
|
||||||
{
|
{
|
||||||
private Efl.Loop loop;
|
private efl.Loop loop;
|
||||||
private int count;
|
private int count;
|
||||||
|
|
||||||
public TestMain(Efl.Loop loop)
|
public TestMain(efl.Loop loop)
|
||||||
{
|
{
|
||||||
this.loop = loop;
|
this.loop = loop;
|
||||||
this.count = 0;
|
this.count = 0;
|
||||||
|
@ -15,10 +15,10 @@ class TestMain
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Efl.All.Init();
|
efl.All.Init();
|
||||||
|
|
||||||
Efl.Loop loop = new Efl.LoopConcrete();
|
efl.Loop loop = new efl.LoopConcrete();
|
||||||
Efl.loop.Timer timer = new Efl.loop.TimerConcrete(loop);
|
efl.loop.Timer timer = new efl.loop.TimerConcrete(loop);
|
||||||
|
|
||||||
TestMain listener = new TestMain(loop);
|
TestMain listener = new TestMain(loop);
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class TestMain
|
||||||
|
|
||||||
loop.begin();
|
loop.begin();
|
||||||
|
|
||||||
Efl.All.Shutdown();
|
efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void on_tick(object sender, EventArgs e)
|
public void on_tick(object sender, EventArgs e)
|
|
@ -4,7 +4,7 @@ public class ExampleEinaArray01
|
||||||
{
|
{
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
Eina.Config.Init();
|
eina.Config.Init();
|
||||||
|
|
||||||
var strings = new string[]{
|
var strings = new string[]{
|
||||||
"helo", "hera", "starbuck", "kat", "boomer",
|
"helo", "hera", "starbuck", "kat", "boomer",
|
||||||
|
@ -13,7 +13,7 @@ public class ExampleEinaArray01
|
||||||
"skulls", "bulldog", "flat top", "hammerhead", "gonzo"
|
"skulls", "bulldog", "flat top", "hammerhead", "gonzo"
|
||||||
};
|
};
|
||||||
|
|
||||||
var array = new Eina.Array<string>(20U);
|
var array = new eina.Array<string>(20U);
|
||||||
|
|
||||||
// Push new elements
|
// Push new elements
|
||||||
foreach (string s in strings)
|
foreach (string s in strings)
|
|
@ -4,11 +4,11 @@ public class ExampleEinaBinbuf01
|
||||||
{
|
{
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
Eina.Config.Init();
|
eina.Config.Init();
|
||||||
|
|
||||||
var bytes = new byte[]{0, 1, 2, 3, 4, 5, 6};
|
var bytes = new byte[]{0, 1, 2, 3, 4, 5, 6};
|
||||||
|
|
||||||
var bb = new Eina.Binbuf();
|
var bb = new eina.Binbuf();
|
||||||
|
|
||||||
// Append initial bytes
|
// Append initial bytes
|
||||||
bb.Append(bytes);
|
bb.Append(bytes);
|
|
@ -3,73 +3,73 @@ using static System.Console;
|
||||||
public class ExampleEinaError01
|
public class ExampleEinaError01
|
||||||
{
|
{
|
||||||
private static bool RegisteredErrors = false;
|
private static bool RegisteredErrors = false;
|
||||||
private static Eina.Error MyErrorNegative;
|
private static eina.Error MyErrorNegative;
|
||||||
private static Eina.Error MyErrorNull;
|
private static eina.Error MyErrorNull;
|
||||||
|
|
||||||
private static void testFunc(int n, string s)
|
private static void testFunc(int n, string s)
|
||||||
{
|
{
|
||||||
if (!RegisteredErrors)
|
if (!RegisteredErrors)
|
||||||
{
|
{
|
||||||
MyErrorNegative = Eina.Error.Register("Negative number");
|
MyErrorNegative = eina.Error.Register("Negative number");
|
||||||
MyErrorNull = Eina.Error.Register("NULL pointer");
|
MyErrorNull = eina.Error.Register("NULL pointer");
|
||||||
RegisteredErrors = true;
|
RegisteredErrors = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
{
|
{
|
||||||
Eina.Error.Set(MyErrorNegative);
|
eina.Error.Set(MyErrorNegative);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s == null)
|
if (s == null)
|
||||||
{
|
{
|
||||||
Eina.Error.Set(MyErrorNull);
|
eina.Error.Set(MyErrorNull);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
Eina.Config.Init();
|
eina.Config.Init();
|
||||||
Efl.eo.Config.Init();
|
efl.eo.Config.Init();
|
||||||
|
|
||||||
// Handling Eina_Error with exception
|
// Handling Eina_Error with exception
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
testFunc(-1, "abc");
|
testFunc(-1, "abc");
|
||||||
Eina.Error.RaiseIfOccurred();
|
eina.Error.RaiseIfOccurred();
|
||||||
}
|
}
|
||||||
catch(Efl.EflException e)
|
catch(efl.EflException e)
|
||||||
{
|
{
|
||||||
WriteLine($"Caught error: {e.Message}");
|
WriteLine($"Caught error: {e.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handling Eina_Error directly
|
// Handling Eina_Error directly
|
||||||
testFunc(42, null);
|
testFunc(42, null);
|
||||||
Eina.Error err = Eina.Error.Get();
|
eina.Error err = eina.Error.Get();
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
{
|
{
|
||||||
WriteLine($"Error set: {err.Message}");
|
WriteLine($"Error set: {err.Message}");
|
||||||
}
|
}
|
||||||
Eina.Error.Clear();
|
eina.Error.Clear();
|
||||||
|
|
||||||
// No error set
|
// No error set
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
testFunc(42, "abc");
|
testFunc(42, "abc");
|
||||||
|
|
||||||
Eina.Error.RaiseIfOccurred();
|
eina.Error.RaiseIfOccurred();
|
||||||
|
|
||||||
err = Eina.Error.Get();
|
err = eina.Error.Get();
|
||||||
WriteLine($"Really no error? {err == Eina.Error.NO_ERROR}.");
|
WriteLine($"Really no error? {err == eina.Error.NO_ERROR}.");
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
WriteLine("Unspected error!!!");
|
WriteLine("Unspected error!!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteLine("No error message is empty string: \"{0}\"", Eina.Error.NO_ERROR.Message);
|
WriteLine("No error message is empty string: \"{0}\"", eina.Error.NO_ERROR.Message);
|
||||||
WriteLine("No error message is empty string: \"{0}\"", Eina.Error.MsgGet(0));
|
WriteLine("No error message is empty string: \"{0}\"", eina.Error.MsgGet(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ public class ExampleEinaHash01
|
||||||
{
|
{
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
Eina.Config.Init();
|
eina.Config.Init();
|
||||||
|
|
||||||
var phone_book = new Eina.Hash<string, string>();
|
var phone_book = new eina.Hash<string, string>();
|
||||||
|
|
||||||
// Add initial entries to our hash
|
// Add initial entries to our hash
|
||||||
phone_book.Add("Wolfgang Amadeus Mozart", "+01 23 456-78910");
|
phone_book.Add("Wolfgang Amadeus Mozart", "+01 23 456-78910");
|
|
@ -2,20 +2,20 @@ using System;
|
||||||
|
|
||||||
public class Example
|
public class Example
|
||||||
{
|
{
|
||||||
public static Efl.Ui.Button CreateButton(Efl.Object parent,
|
public static efl.ui.IButton CreateButton(efl.IObject parent,
|
||||||
string text,
|
string text,
|
||||||
int w, int h,
|
int w, int h,
|
||||||
EventHandler callback) {
|
EventHandler callback) {
|
||||||
Efl.Ui.Button button = new Efl.Ui.Button(parent);
|
efl.ui.IButton button = new efl.ui.Button(parent);
|
||||||
button.Text = text;
|
button.SetText(text);
|
||||||
button.Size = new Eina.Size2D(w, h);
|
button.SetSize(new eina.Size2D(w, h));
|
||||||
|
|
||||||
button.ClickedEvent += callback;
|
button.ClickedEvt += callback;
|
||||||
|
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Formatter(Eina.Strbuf buf, Eina.Value val){
|
public static void Formatter(eina.Strbuf buf, eina.Value val){
|
||||||
double ratio;
|
double ratio;
|
||||||
if (val.Get(out ratio)) {
|
if (val.Get(out ratio)) {
|
||||||
buf.Append($"{(int)(ratio*100)}%");
|
buf.Append($"{(int)(ratio*100)}%");
|
||||||
|
@ -34,29 +34,29 @@ public class Example
|
||||||
int W = 120;
|
int W = 120;
|
||||||
int H = 30;
|
int H = 30;
|
||||||
|
|
||||||
Efl.All.Init(Efl.Components.Ui);
|
efl.All.Init(efl.Components.Ui);
|
||||||
|
|
||||||
Efl.Ui.Win win = new Efl.Ui.Win(null);
|
efl.ui.Win win = new efl.ui.Win(null);
|
||||||
win.Text = "Hello, C#!!";
|
win.SetText("Hello, C#!!");
|
||||||
win.Autohide = true;
|
win.SetAutohide(true);
|
||||||
|
|
||||||
Efl.Ui.Box_Flow box = new Efl.Ui.Box_Flow(win);
|
efl.ui.Box_Flow box = new efl.ui.Box_Flow(win);
|
||||||
|
|
||||||
Efl.Ui.Button button = CreateButton(box, "Click to exit", 120, 30,
|
efl.ui.IButton button = CreateButton(box, "Click to exit", 120, 30,
|
||||||
(object sender, EventArgs e) => {
|
(object sender, EventArgs e) => {
|
||||||
Efl.Ui.Config.Exit();
|
efl.ui.Config.Exit();
|
||||||
});
|
});
|
||||||
|
|
||||||
box.DoPack(button);
|
box.DoPack(button);
|
||||||
|
|
||||||
Efl.Ui.Progressbar bar = new Efl.Ui.Progressbar(box);
|
efl.ui.Progressbar bar = new efl.ui.Progressbar(box);
|
||||||
bar.Size = new Eina.Size2D(W, H);
|
bar.SetSize(new eina.Size2D(W, H));
|
||||||
bar.SetFormatCb(Formatter);
|
bar.SetFormatCb(Formatter);
|
||||||
|
|
||||||
Efl.Ui.Slider slider = new Efl.Ui.Slider(box);
|
efl.ui.ISlider slider = new efl.ui.Slider(box);
|
||||||
slider.Size = new Eina.Size2D(W, H);
|
slider.SetSize(new eina.Size2D(W, H));
|
||||||
|
|
||||||
slider.ChangedEvent += (object sender, EventArgs e) => {
|
slider.ChangedEvt += (object sender, EventArgs e) => {
|
||||||
bar.SetRangeValue(slider.GetRangeValue());
|
bar.SetRangeValue(slider.GetRangeValue());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -66,12 +66,12 @@ public class Example
|
||||||
button.SetVisible(true);
|
button.SetVisible(true);
|
||||||
box.SetVisible(true);
|
box.SetVisible(true);
|
||||||
|
|
||||||
win.Size = new Eina.Size2D(W, 3 * H);
|
win.SetSize(new eina.Size2D(W, 3 * H));
|
||||||
win.SetVisible(true);
|
win.SetVisible(true);
|
||||||
|
|
||||||
Efl.Ui.Config.Run();
|
efl.ui.Config.Run();
|
||||||
|
|
||||||
Efl.All.Shutdown();
|
efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,150 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
public class Example
|
||||||
|
{
|
||||||
|
|
||||||
|
private static double KMS_PER_MILE = 1.609344;
|
||||||
|
|
||||||
|
private static double KmsToMiles(double kms)
|
||||||
|
{
|
||||||
|
return kms / KMS_PER_MILE;
|
||||||
|
}
|
||||||
|
private static double MilesToKms(double miles)
|
||||||
|
{
|
||||||
|
return miles * KMS_PER_MILE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ShowErrorPopup(efl.ui.Win win, string message)
|
||||||
|
{
|
||||||
|
efl.ui.IPopup_Alert popup = new efl.ui.Popup_Alert(win);
|
||||||
|
efl.ui.Text popup_text = new efl.ui.Text(popup);
|
||||||
|
popup_text.SetText($"Error: {message}");
|
||||||
|
popup.SetContent(popup_text);
|
||||||
|
popup.SetVisible(true);
|
||||||
|
popup.SetButton(efl.ui.Popup_Alert_Button.Positive, "Ok");
|
||||||
|
popup.SetSize(new eina.Size2D(150, 30));
|
||||||
|
popup.ButtonClickedEvt += (object sender, efl.ui.Popup_Alert.ButtonClickedEvt_Args e) => {
|
||||||
|
popup.SetParent(null);
|
||||||
|
popup.Invalidate();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#if WIN32 // Passed to the C# compiler with -define:WIN32
|
||||||
|
// Mono on Windows by default uses multi-thread apartments for COM stuff while
|
||||||
|
// OLE - used by ecore win32 DnD requires single threading for COM.
|
||||||
|
[STAThreadAttribute()]
|
||||||
|
#endif
|
||||||
|
public static void Main() {
|
||||||
|
int W = 120;
|
||||||
|
int H = 30;
|
||||||
|
eina.Size2D size = new eina.Size2D(W, H);
|
||||||
|
|
||||||
|
efl.All.Init(efl.Components.Ui);
|
||||||
|
|
||||||
|
efl.ui.Win win = new efl.ui.Win(null);
|
||||||
|
win.SetText("C# Unit Converter");
|
||||||
|
win.SetAutohide(true);
|
||||||
|
|
||||||
|
efl.ui.Box_Flow box = new efl.ui.Box_Flow(win);
|
||||||
|
box.SetDirection(efl.ui.Dir.Horizontal);
|
||||||
|
|
||||||
|
efl.ui.Box_Flow miles_box = new efl.ui.Box_Flow(box);
|
||||||
|
miles_box.SetDirection(efl.ui.Dir.Down);
|
||||||
|
|
||||||
|
box.DoPack(miles_box);
|
||||||
|
|
||||||
|
efl.ui.Text miles_label = new efl.ui.Text(miles_box);
|
||||||
|
miles_label.SetText("Miles:");
|
||||||
|
miles_label.SetSize(size);
|
||||||
|
miles_label.SetVisible(true);
|
||||||
|
|
||||||
|
efl.ui.Text_Editable miles_input = new efl.ui.Text_Editable(miles_box);
|
||||||
|
miles_input.SetText("");
|
||||||
|
miles_input.SetScrollable(true);
|
||||||
|
miles_input.SetSize(size);
|
||||||
|
miles_input.SetVisible(true);
|
||||||
|
|
||||||
|
efl.ui.IButton miles_button = new efl.ui.Button(miles_box);
|
||||||
|
miles_button.SetText("To Km");
|
||||||
|
miles_button.SetSize(size);
|
||||||
|
miles_button.SetVisible(true);
|
||||||
|
|
||||||
|
miles_box.DoPack(miles_label);
|
||||||
|
miles_box.DoPack(miles_input);
|
||||||
|
miles_box.DoPack(miles_button);
|
||||||
|
|
||||||
|
|
||||||
|
efl.ui.Box_Flow kms_box = new efl.ui.Box_Flow(box);
|
||||||
|
kms_box.SetDirection(efl.ui.Dir.Down);
|
||||||
|
|
||||||
|
box.DoPack(kms_box);
|
||||||
|
|
||||||
|
efl.ui.Text kms_label = new efl.ui.Text(kms_box);
|
||||||
|
kms_label.SetText("Kilometers:");
|
||||||
|
kms_label.SetSize(size);
|
||||||
|
kms_label.SetVisible(true);
|
||||||
|
|
||||||
|
efl.ui.Text_Editable kms_input = new efl.ui.Text_Editable(kms_box);
|
||||||
|
kms_input.SetText("");
|
||||||
|
kms_input.SetScrollable(true);
|
||||||
|
kms_input.SetSize(size);
|
||||||
|
kms_input.SetVisible(true);
|
||||||
|
|
||||||
|
efl.ui.IButton kms_button = new efl.ui.Button(kms_box);
|
||||||
|
kms_button.SetText("To Miles");
|
||||||
|
kms_button.SetSize(size);
|
||||||
|
kms_button.SetVisible(true);
|
||||||
|
|
||||||
|
kms_box.DoPack(kms_label);
|
||||||
|
kms_box.DoPack(kms_input);
|
||||||
|
kms_box.DoPack(kms_button);
|
||||||
|
|
||||||
|
kms_button.ClickedEvt += (object sender, EventArgs e) => {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string text = kms_input.GetText();
|
||||||
|
Console.WriteLine("Text is [{0}]", text);
|
||||||
|
double val = double.Parse(text);
|
||||||
|
miles_input.SetText(String.Format("{0:f3}", KmsToMiles(val)));
|
||||||
|
kms_input.SetFocus(true);
|
||||||
|
}
|
||||||
|
catch (FormatException ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Exception {0} caught", ex);
|
||||||
|
ShowErrorPopup(win, "Invalid number");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
miles_button.ClickedEvt += (object sender, EventArgs e) => {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string text = miles_input.GetText();
|
||||||
|
Console.WriteLine("Text is [{0}]", text);
|
||||||
|
double val = double.Parse(text);
|
||||||
|
kms_input.SetText(String.Format("{0:f3}", MilesToKms(val)));
|
||||||
|
miles_input.SetFocus(true);
|
||||||
|
}
|
||||||
|
catch (FormatException ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Exception {0} cautght", ex);
|
||||||
|
ShowErrorPopup(win, "Invalid number");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
kms_box.SetVisible(true);
|
||||||
|
miles_box.SetVisible(true);
|
||||||
|
|
||||||
|
box.SetPosition(new eina.Position2D(20, 30));
|
||||||
|
box.SetVisible(true);
|
||||||
|
|
||||||
|
win.SetPosition(new eina.Position2D(200, 200));
|
||||||
|
|
||||||
|
win.SetSize(new eina.Size2D(400, 120));
|
||||||
|
win.SetVisible(true);
|
||||||
|
|
||||||
|
efl.ui.Config.Run();
|
||||||
|
|
||||||
|
efl.All.Shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -2,7 +2,7 @@ using static System.Console;
|
||||||
|
|
||||||
class PlusTenNumberWrapper : example.NumberwrapperInherit
|
class PlusTenNumberWrapper : example.NumberwrapperInherit
|
||||||
{
|
{
|
||||||
public PlusTenNumberWrapper(Efl.Object parent = null)
|
public PlusTenNumberWrapper(efl.IObject parent = null)
|
||||||
: base(parent)
|
: base(parent)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -20,8 +20,8 @@ public class ExampleEoInherit01
|
||||||
{
|
{
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
Eina.Config.Init();
|
eina.Config.Init();
|
||||||
Efl.eo.Config.Init();
|
efl.eo.Config.Init();
|
||||||
|
|
||||||
var inheritObj = new PlusTenNumberWrapper();
|
var inheritObj = new PlusTenNumberWrapper();
|
||||||
|
|
|
@ -12,8 +12,8 @@ public class ExampleFunctionPointer01
|
||||||
|
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
Eina.Config.Init();
|
eina.Config.Init();
|
||||||
Efl.eo.Config.Init();
|
efl.eo.Config.Init();
|
||||||
|
|
||||||
var obj = new example.Numberwrapper();
|
var obj = new example.Numberwrapper();
|
||||||
|
|
|
@ -4,7 +4,7 @@ using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
public class MyBox : evas.BoxInherit
|
public class MyBox : evas.BoxInherit
|
||||||
{
|
{
|
||||||
public MyBox(Efl.Object parent) : base(parent) {}
|
public MyBox(efl.IObject parent) : base(parent) {}
|
||||||
|
|
||||||
[DllImport("evas")] static extern void evas_obj_box_layout_vertical(IntPtr obj, IntPtr data, IntPtr privdata);
|
[DllImport("evas")] static extern void evas_obj_box_layout_vertical(IntPtr obj, IntPtr data, IntPtr privdata);
|
||||||
[DllImport("evas")] static extern void evas_obj_box_layout_horizontal(IntPtr obj, IntPtr data, IntPtr privdata);
|
[DllImport("evas")] static extern void evas_obj_box_layout_horizontal(IntPtr obj, IntPtr data, IntPtr privdata);
|
||||||
|
@ -30,44 +30,44 @@ class TestMain
|
||||||
{
|
{
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Efl.All.Init();
|
efl.All.Init();
|
||||||
|
|
||||||
Efl.Loop loop = new Efl.Loop();
|
efl.Loop loop = new efl.Loop();
|
||||||
|
|
||||||
|
|
||||||
EcoreEvas ecore_evas = new EcoreEvas();
|
EcoreEvas ecore_evas = new EcoreEvas();
|
||||||
|
|
||||||
Efl.Canvas.Object canvas = ecore_evas.canvas;
|
efl.canvas.IObject canvas = ecore_evas.canvas;
|
||||||
canvas.SetVisible(true);
|
canvas.SetVisible(true);
|
||||||
|
|
||||||
Efl.Object parent = canvas.GetParent();
|
efl.IObject parent = canvas.GetParent();
|
||||||
System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);
|
System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);
|
||||||
|
|
||||||
evas.IBox box = new MyBox(canvas);
|
evas.IBox box = new MyBox(canvas);
|
||||||
Eina.Size2D size = new Eina.Size2D();
|
eina.Size2D size = new eina.Size2D();
|
||||||
|
|
||||||
size.W = 320;
|
size.W = 320;
|
||||||
size.H = 240;
|
size.H = 240;
|
||||||
|
|
||||||
box.Size = size;
|
box.SetSize(size);
|
||||||
box.SetVisible(true);
|
box.SetVisible(true);
|
||||||
|
|
||||||
Efl.Canvas.Rectangle rect = new Efl.Canvas.Rectangle(canvas);
|
efl.canvas.Rectangle rect = new efl.canvas.Rectangle(canvas);
|
||||||
rect.Color = (0, 0, 255, 255);
|
rect.SetColor(0, 0, 255, 255);
|
||||||
size.W = 320;
|
size.W = 320;
|
||||||
size.H = 120;
|
size.H = 120;
|
||||||
rect.Size = size;
|
rect.SetSize(size);
|
||||||
rect.SetVisible(true);
|
rect.SetVisible(true);
|
||||||
box.Append(rect);
|
box.Append(rect);
|
||||||
|
|
||||||
Efl.Canvas.Rectangle rect2 = new Efl.Canvas.Rectangle(canvas);
|
efl.canvas.Rectangle rect2 = new efl.canvas.Rectangle(canvas);
|
||||||
rect2.Color = (0, 255, 0, 255);
|
rect2.SetColor(0, 255, 0, 255);
|
||||||
rect2.Size = size;
|
rect2.SetSize(size);
|
||||||
rect2.SetVisible(true);
|
rect2.SetVisible(true);
|
||||||
box.Append(rect2);
|
box.Append(rect2);
|
||||||
|
|
||||||
loop.Begin();
|
loop.Begin();
|
||||||
|
|
||||||
Efl.All.Shutdown();
|
efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -21,24 +21,24 @@ class TestMain
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Efl.All.Init();
|
efl.All.Init();
|
||||||
|
|
||||||
Efl.Loop loop = new Efl.Loop();
|
efl.Loop loop = new efl.Loop();
|
||||||
|
|
||||||
EcoreEvas ecore_evas = new EcoreEvas();
|
EcoreEvas ecore_evas = new EcoreEvas();
|
||||||
Eina.Size2D size = new Eina.Size2D();
|
eina.Size2D size = new eina.Size2D();
|
||||||
|
|
||||||
Efl.Canvas.Object canvas = ecore_evas.canvas;
|
efl.canvas.IObject canvas = ecore_evas.canvas;
|
||||||
canvas.SetVisible(true);
|
canvas.SetVisible(true);
|
||||||
|
|
||||||
Efl.Object parent = canvas.GetParent();
|
efl.IObject parent = canvas.GetParent();
|
||||||
System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);
|
System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);
|
||||||
|
|
||||||
Efl.Canvas.Rectangle bg = new Efl.Canvas.Rectangle(canvas);
|
efl.canvas.Rectangle bg = new efl.canvas.Rectangle(canvas);
|
||||||
bg.Color = (255, 255, 255, 255);
|
bg.SetColor(255, 255, 255, 255);
|
||||||
size.W = WIDTH;
|
size.W = WIDTH;
|
||||||
size.H = HEIGHT;
|
size.H = HEIGHT;
|
||||||
bg.Size = size;
|
bg.SetSize(size);
|
||||||
bg.SetVisible(true);
|
bg.SetVisible(true);
|
||||||
|
|
||||||
string valid_path = args[0];
|
string valid_path = args[0];
|
||||||
|
@ -47,10 +47,10 @@ class TestMain
|
||||||
|
|
||||||
/* FIXME evas-image uses error handling code from
|
/* FIXME evas-image uses error handling code from
|
||||||
* evas_object_image_load_error_get, which seems to be not available
|
* evas_object_image_load_error_get, which seems to be not available
|
||||||
* Efl.image.load.State state = image.load_error_get(); */
|
* efl.image.load.State state = image.load_error_get(); */
|
||||||
|
|
||||||
// FIXME missing move
|
// FIXME missing move
|
||||||
Eina.Rect rect = new Eina.Rect();
|
eina.Rect rect = new eina.Rect();
|
||||||
|
|
||||||
rect.X = 0;
|
rect.X = 0;
|
||||||
rect.Y = 0;
|
rect.Y = 0;
|
||||||
|
@ -60,7 +60,7 @@ class TestMain
|
||||||
|
|
||||||
size.W = WIDTH / 2;
|
size.W = WIDTH / 2;
|
||||||
size.H = HEIGHT / 2;
|
size.H = HEIGHT / 2;
|
||||||
image.Size = size;
|
image.SetSize(size);
|
||||||
image.SetVisible(true);
|
image.SetVisible(true);
|
||||||
|
|
||||||
rect = image.GetFill();
|
rect = image.GetFill();
|
||||||
|
@ -76,12 +76,12 @@ class TestMain
|
||||||
|
|
||||||
/* bg.key_focus_set(true); */
|
/* bg.key_focus_set(true); */
|
||||||
/* bg.event_callback_priority_add(evas.Callback_Type.Key_down, */
|
/* bg.event_callback_priority_add(evas.Callback_Type.Key_down, */
|
||||||
/* Efl.Callback_Priority.Default, */
|
/* efl.Callback_Priority.Default, */
|
||||||
/* callback, null); */
|
/* callback, null); */
|
||||||
|
|
||||||
loop.Begin();
|
loop.Begin();
|
||||||
|
|
||||||
Efl.All.Shutdown();
|
efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void on_key_down(object sender, EventArgs e)
|
public void on_key_down(object sender, EventArgs e)
|
|
@ -10,26 +10,26 @@ class TestMain
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Efl.All.Init();
|
efl.All.Init();
|
||||||
|
|
||||||
Efl.Loop loop = new Efl.Loop();
|
efl.Loop loop = new efl.Loop();
|
||||||
|
|
||||||
EcoreEvas ecore_evas = new EcoreEvas();
|
EcoreEvas ecore_evas = new EcoreEvas();
|
||||||
|
|
||||||
Eina.Size2D size = new Eina.Size2D();
|
eina.Size2D size = new eina.Size2D();
|
||||||
Eina.Position2D pos = new Eina.Position2D();
|
eina.Position2D pos = new eina.Position2D();
|
||||||
|
|
||||||
Efl.Canvas.Object canvas = ecore_evas.canvas;
|
efl.canvas.IObject canvas = ecore_evas.canvas;
|
||||||
canvas.SetVisible(true);
|
canvas.SetVisible(true);
|
||||||
|
|
||||||
Efl.Canvas.Rectangle bg = new Efl.Canvas.Rectangle(canvas);
|
efl.canvas.Rectangle bg = new efl.canvas.Rectangle(canvas);
|
||||||
bg.Color = (255, 255, 255, 255);
|
bg.SetColor(255, 255, 255, 255);
|
||||||
pos.X = 0;
|
pos.X = 0;
|
||||||
pos.Y = 0;
|
pos.Y = 0;
|
||||||
bg.SetPosition(pos);
|
bg.SetPosition(pos);
|
||||||
size.W = WIDTH;
|
size.W = WIDTH;
|
||||||
size.H = HEIGHT;
|
size.H = HEIGHT;
|
||||||
bg.Size = size;
|
bg.SetSize(size);
|
||||||
bg.SetVisible(true);
|
bg.SetVisible(true);
|
||||||
|
|
||||||
string path = args[0];
|
string path = args[0];
|
||||||
|
@ -41,7 +41,7 @@ class TestMain
|
||||||
logo.SetFile(path, null);
|
logo.SetFile(path, null);
|
||||||
size.W = WIDTH / 2;
|
size.W = WIDTH / 2;
|
||||||
size.H = HEIGHT / 2;
|
size.H = HEIGHT / 2;
|
||||||
logo.Size = size;
|
logo.SetSize(size);
|
||||||
|
|
||||||
// TODO add a bunch of key/mouse handlers
|
// TODO add a bunch of key/mouse handlers
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ class TestMain
|
||||||
evas.Image noise_img = new evas.Image(canvas);
|
evas.Image noise_img = new evas.Image(canvas);
|
||||||
size.W = WIDTH / 4;
|
size.W = WIDTH / 4;
|
||||||
size.H = HEIGHT / 4;
|
size.H = HEIGHT / 4;
|
||||||
noise_img.Size = size;
|
noise_img.SetSize(size);
|
||||||
// FIXME Add a way to set the pixels.
|
// FIXME Add a way to set the pixels.
|
||||||
// noise_img.data_set(pixels);
|
// noise_img.data_set(pixels);
|
||||||
noise_img.SetFillAuto(true);
|
noise_img.SetFillAuto(true);
|
||||||
|
@ -66,14 +66,14 @@ class TestMain
|
||||||
noise_img.SetVisible(true);
|
noise_img.SetVisible(true);
|
||||||
Console.WriteLine("Creating noise image with sizez %d, %d", WIDTH/4, HEIGHT/4);
|
Console.WriteLine("Creating noise image with sizez %d, %d", WIDTH/4, HEIGHT/4);
|
||||||
|
|
||||||
Efl.Canvas.Proxy proxy_img = new Efl.Canvas.Proxy(canvas);
|
efl.canvas.Proxy proxy_img = new efl.canvas.Proxy(canvas);
|
||||||
proxy_img.SetSource(noise_img);
|
proxy_img.SetSource(noise_img);
|
||||||
pos.X = WIDTH / 2;
|
pos.X = WIDTH / 2;
|
||||||
pos.Y = HEIGHT / 2;
|
pos.Y = HEIGHT / 2;
|
||||||
proxy_img.SetPosition(pos);
|
proxy_img.SetPosition(pos);
|
||||||
size.W = WIDTH / 2;
|
size.W = WIDTH / 2;
|
||||||
size.H = HEIGHT / 2;
|
size.H = HEIGHT / 2;
|
||||||
proxy_img.Size = size;
|
proxy_img.SetSize(size);
|
||||||
proxy_img.SetVisible(true);
|
proxy_img.SetVisible(true);
|
||||||
|
|
||||||
loop.Begin();
|
loop.Begin();
|
|
@ -12,25 +12,25 @@ class TestMain
|
||||||
{
|
{
|
||||||
int color_index = 0;
|
int color_index = 0;
|
||||||
|
|
||||||
Efl.All.Init();
|
efl.All.Init();
|
||||||
|
|
||||||
Efl.Loop loop = new Efl.Loop();
|
efl.Loop loop = new efl.Loop();
|
||||||
EcoreEvas ecore_evas = new EcoreEvas();
|
EcoreEvas ecore_evas = new EcoreEvas();
|
||||||
Efl.Canvas.Object canvas = ecore_evas.canvas;
|
efl.canvas.IObject canvas = ecore_evas.canvas;
|
||||||
canvas.SetVisible(true);
|
canvas.SetVisible(true);
|
||||||
|
|
||||||
Efl.Object parent = canvas.GetParent();
|
efl.IObject parent = canvas.GetParent();
|
||||||
System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);
|
System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);
|
||||||
|
|
||||||
Efl.Canvas.Rectangle rect = new Efl.Canvas.Rectangle(canvas);
|
efl.canvas.Rectangle rect = new efl.canvas.Rectangle(canvas);
|
||||||
rect.Color = (colors[0, 0], colors[0, 1], colors[0, 2], 255);
|
rect.SetColor(colors[0, 0], colors[0, 1], colors[0, 2], 255);
|
||||||
Eina.Size2D size = new Eina.Size2D();
|
eina.Size2D size = new eina.Size2D();
|
||||||
size.W = 640;
|
size.W = 640;
|
||||||
size.H = 480;
|
size.H = 480;
|
||||||
rect.Size = size;
|
rect.SetSize(size);
|
||||||
rect.SetVisible(true);
|
rect.SetVisible(true);
|
||||||
|
|
||||||
canvas.KeyDownEvent += (object sender, Efl.Input.Interface.KeyDownEventArgs e) => {
|
canvas.KeyDownEvt += (object sender, efl.input.Interface.KeyDownEvt_Args e) => {
|
||||||
color_index = (color_index + 1) % 3;
|
color_index = (color_index + 1) % 3;
|
||||||
Console.WriteLine("Key Down");
|
Console.WriteLine("Key Down");
|
||||||
Console.WriteLine("Got key obj at {0}", e.arg.raw_handle.ToString("X"));
|
Console.WriteLine("Got key obj at {0}", e.arg.raw_handle.ToString("X"));
|
||||||
|
@ -42,6 +42,6 @@ class TestMain
|
||||||
|
|
||||||
loop.Begin();
|
loop.Begin();
|
||||||
|
|
||||||
Efl.All.Shutdown();
|
efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,69 +9,69 @@ class TestMain
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Efl.All.Init();
|
efl.All.Init();
|
||||||
|
|
||||||
Efl.Loop loop = new Efl.Loop();
|
efl.Loop loop = new efl.Loop();
|
||||||
|
|
||||||
EcoreEvas ecore_evas = new EcoreEvas();
|
EcoreEvas ecore_evas = new EcoreEvas();
|
||||||
|
|
||||||
Eina.Size2D size = new Eina.Size2D();
|
eina.Size2D size = new eina.Size2D();
|
||||||
size.W = WIDTH;
|
size.W = WIDTH;
|
||||||
size.H = HEIGHT;
|
size.H = HEIGHT;
|
||||||
|
|
||||||
Eina.Size2D hint = new Eina.Size2D();
|
eina.Size2D hint = new eina.Size2D();
|
||||||
|
|
||||||
Efl.Canvas.Object canvas = ecore_evas.canvas;
|
efl.canvas.IObject canvas = ecore_evas.canvas;
|
||||||
canvas.SetVisible(true);
|
canvas.SetVisible(true);
|
||||||
|
|
||||||
Efl.Object parent = canvas.GetParent();
|
efl.IObject parent = canvas.GetParent();
|
||||||
System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);
|
System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);
|
||||||
|
|
||||||
Efl.Canvas.Rectangle bg = new Efl.Canvas.Rectangle(canvas);
|
efl.canvas.Rectangle bg = new efl.canvas.Rectangle(canvas);
|
||||||
bg.Color = (255, 255, 255, 255);
|
bg.SetColor(255, 255, 255, 255);
|
||||||
bg.Size = size;
|
bg.SetSize(size);
|
||||||
bg.SetVisible(true);
|
bg.SetVisible(true);
|
||||||
|
|
||||||
|
|
||||||
evas.Table table = new evas.Table(canvas);
|
evas.Table table = new evas.Table(canvas);
|
||||||
table.SetHomogeneous(evas.object_table.Homogeneous_Mode.None);
|
table.SetHomogeneous(evas.object_table.Homogeneous_Mode.None);
|
||||||
table.SetPadding(0, 0);
|
table.SetPadding(0, 0);
|
||||||
table.Size = size;
|
table.SetSize(size);
|
||||||
table.SetVisible(true);
|
table.SetVisible(true);
|
||||||
|
|
||||||
Efl.Canvas.Rectangle rect = new Efl.Canvas.Rectangle(canvas);
|
efl.canvas.Rectangle rect = new efl.canvas.Rectangle(canvas);
|
||||||
rect.Color = (255, 0, 0, 255);
|
rect.SetColor(255, 0, 0, 255);
|
||||||
hint.W = 100;
|
hint.W = 100;
|
||||||
hint.H = 50;
|
hint.H = 50;
|
||||||
rect.SetHintMin(hint);
|
rect.SetHintMin(hint);
|
||||||
rect.SetVisible(true);
|
rect.SetVisible(true);
|
||||||
table.Pack(rect, 1, 1, 2, 1);
|
table.Pack(rect, 1, 1, 2, 1);
|
||||||
|
|
||||||
rect = new Efl.Canvas.Rectangle(canvas);
|
rect = new efl.canvas.Rectangle(canvas);
|
||||||
rect.Color = (0, 255, 0, 255);
|
rect.SetColor(0, 255, 0, 255);
|
||||||
hint.W = 50;
|
hint.W = 50;
|
||||||
hint.H = 100;
|
hint.H = 100;
|
||||||
rect.SetHintMin(hint);
|
rect.SetHintMin(hint);
|
||||||
rect.SetVisible(true);
|
rect.SetVisible(true);
|
||||||
table.Pack(rect, 1, 2, 1, 2);
|
table.Pack(rect, 1, 2, 1, 2);
|
||||||
|
|
||||||
rect = new Efl.Canvas.Rectangle(canvas);
|
rect = new efl.canvas.Rectangle(canvas);
|
||||||
rect.Color = (0, 0, 255, 255);
|
rect.SetColor(0, 0, 255, 255);
|
||||||
hint.W = 50;
|
hint.W = 50;
|
||||||
hint.H = 50;
|
hint.H = 50;
|
||||||
rect.SetHintMin(hint);
|
rect.SetHintMin(hint);
|
||||||
rect.SetVisible(true);
|
rect.SetVisible(true);
|
||||||
table.Pack(rect, 2, 2, 1, 1);
|
table.Pack(rect, 2, 2, 1, 1);
|
||||||
|
|
||||||
rect = new Efl.Canvas.Rectangle(canvas);
|
rect = new efl.canvas.Rectangle(canvas);
|
||||||
rect.Color = (255, 255, 0, 255);
|
rect.SetColor(255, 255, 0, 255);
|
||||||
rect.SetHintMin(hint);
|
rect.SetHintMin(hint);
|
||||||
rect.SetVisible(true);
|
rect.SetVisible(true);
|
||||||
table.Pack(rect, 2, 3, 1, 1);
|
table.Pack(rect, 2, 3, 1, 1);
|
||||||
|
|
||||||
loop.Begin();
|
loop.Begin();
|
||||||
|
|
||||||
Efl.All.Shutdown();
|
efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,50 +22,50 @@ class TestMain
|
||||||
static int HEIGHT = 240;
|
static int HEIGHT = 240;
|
||||||
|
|
||||||
private EcoreEvas ecore_evas;
|
private EcoreEvas ecore_evas;
|
||||||
private Efl.Canvas.Object canvas;
|
private efl.canvas.IObject canvas;
|
||||||
private Efl.Canvas.Rectangle bg;
|
private efl.canvas.IRectangle bg;
|
||||||
private evas.Text text;
|
private evas.Text text;
|
||||||
private evas.Image border;
|
private evas.Image border;
|
||||||
|
|
||||||
public TestMain(String border_file) {
|
public TestMain(String border_file) {
|
||||||
ecore_evas = new EcoreEvas();
|
ecore_evas = new EcoreEvas();
|
||||||
Eina.Size2D size = new Eina.Size2D();
|
eina.Size2D size = new eina.Size2D();
|
||||||
Eina.Position2D position = new Eina.Position2D();
|
eina.Position2D position = new eina.Position2D();
|
||||||
canvas = ecore_evas.canvas;
|
canvas = ecore_evas.canvas;
|
||||||
canvas.SetVisible(true);
|
canvas.SetVisible(true);
|
||||||
|
|
||||||
bg = new Efl.Canvas.Rectangle(canvas);
|
bg = new efl.canvas.Rectangle(canvas);
|
||||||
bg.Color = (255, 255, 255, 255);
|
bg.SetColor(255, 255, 255, 255);
|
||||||
position.X = 0;
|
position.X = 0;
|
||||||
position.Y = 0;
|
position.Y = 0;
|
||||||
bg.SetPosition(position);
|
bg.SetPosition(position);
|
||||||
size.W = WIDTH;
|
size.W = WIDTH;
|
||||||
size.H = HEIGHT;
|
size.H = HEIGHT;
|
||||||
bg.Size = size;
|
bg.SetSize(size);
|
||||||
bg.SetVisible(true);
|
bg.SetVisible(true);
|
||||||
bg.SetKeyFocus(true);
|
bg.SetKeyFocus(true);
|
||||||
|
|
||||||
bg.KeyDownEvent += On_KeyDown;
|
bg.KeyDownEvt += On_KeyDown;
|
||||||
|
|
||||||
text = new evas.Text(canvas);
|
text = new evas.Text(canvas);
|
||||||
text.SetStyle(evas.Text_Style_Type.OutlineSoftShadow);
|
text.SetStyle(evas.Text_Style_Type.OutlineSoftShadow);
|
||||||
|
|
||||||
text.Color = (0, 0, 0, 255);
|
text.SetColor(0, 0, 0, 255);
|
||||||
text.SetGlowColor(255, 0, 0, 255);
|
text.SetGlowColor(255, 0, 0, 255);
|
||||||
text.SetOutlineColor(0, 0, 255, 255);
|
text.SetOutlineColor(0, 0, 255, 255);
|
||||||
text.SetShadowColor(0, 255,255, 255);
|
text.SetShadowColor(0, 255,255, 255);
|
||||||
text.SetFont("Courier", 30);
|
text.SetFont("Courier", 30);
|
||||||
|
|
||||||
text.Text = "sample text";
|
text.SetText("sample text");
|
||||||
size.W = 3*WIDTH / 4;
|
size.W = 3*WIDTH / 4;
|
||||||
size.H = HEIGHT / 4;
|
size.H = HEIGHT / 4;
|
||||||
text.Size = size;
|
text.SetSize(size);
|
||||||
position.X = WIDTH / 8;
|
position.X = WIDTH / 8;
|
||||||
position.Y = 3 * HEIGHT / 8;
|
position.Y = 3 * HEIGHT / 8;
|
||||||
text.SetPosition(position);
|
text.SetPosition(position);
|
||||||
text.SetVisible(true);
|
text.SetVisible(true);
|
||||||
|
|
||||||
Efl.font.Size font_size = 0;
|
efl.font.Size font_size = 0;
|
||||||
String font = String.Empty;
|
String font = String.Empty;
|
||||||
text.GetFont(out font, out font_size);
|
text.GetFont(out font, out font_size);
|
||||||
Console.WriteLine("Adding text object with font {0} and size {1}", font, size);
|
Console.WriteLine("Adding text object with font {0} and size {1}", font, size);
|
||||||
|
@ -78,7 +78,7 @@ class TestMain
|
||||||
|
|
||||||
size.W = 3 * WIDTH / 4 + 3;
|
size.W = 3 * WIDTH / 4 + 3;
|
||||||
size.H = HEIGHT / 4 + 3;
|
size.H = HEIGHT / 4 + 3;
|
||||||
border.Size = size;
|
border.SetSize(size);
|
||||||
position.X = WIDTH / 8 - 3;
|
position.X = WIDTH / 8 - 3;
|
||||||
position.Y = 3 * HEIGHT / 8 - 3;
|
position.Y = 3 * HEIGHT / 8 - 3;
|
||||||
border.SetPosition(position);
|
border.SetPosition(position);
|
||||||
|
@ -87,7 +87,7 @@ class TestMain
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void On_KeyDown(object sender, Efl.Input.Interface.KeyDownEventArgs e)
|
private void On_KeyDown(object sender, efl.input.Interface.KeyDownEvt_Args e)
|
||||||
{
|
{
|
||||||
var key = e.arg.GetKey();
|
var key = e.arg.GetKey();
|
||||||
|
|
||||||
|
@ -107,19 +107,19 @@ class TestMain
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Efl.All.Init();
|
efl.All.Init();
|
||||||
|
|
||||||
String border_path = "./src/examples/evas/resources/images/red.png";
|
String border_path = "./src/examples/evas/resources/images/red.png";
|
||||||
|
|
||||||
if (args.Length >= 1)
|
if (args.Length >= 1)
|
||||||
border_path = args[0];
|
border_path = args[0];
|
||||||
|
|
||||||
Efl.Loop loop = new Efl.Loop();
|
efl.Loop loop = new efl.Loop();
|
||||||
TestMain t = new TestMain(border_path);
|
TestMain t = new TestMain(border_path);
|
||||||
|
|
||||||
loop.Begin();
|
loop.Begin();
|
||||||
|
|
||||||
Efl.All.Shutdown();
|
efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <Eina.hh>
|
#include <Eina.hh>
|
||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
src = [
|
||||||
|
'eina_cxx_list_01',
|
||||||
|
'eina_cxx_thread_01',
|
||||||
|
]
|
||||||
|
|
||||||
|
eina_cxx = [dependency('eina-cxx'), dependency('eo-cxx'), dependency('ecore')]
|
||||||
|
|
||||||
|
foreach file : src
|
||||||
|
executable(file,
|
||||||
|
file + '.cc',
|
||||||
|
dependencies: eina_cxx,
|
||||||
|
cpp_args : beta_defines
|
||||||
|
)
|
||||||
|
endforeach
|
|
@ -0,0 +1,32 @@
|
||||||
|
src = [
|
||||||
|
'bg_cxx_example_01',
|
||||||
|
'bg_cxx_example_02',
|
||||||
|
'box_cxx_example_02',
|
||||||
|
'button_cxx_example_00',
|
||||||
|
'button_cxx_example_01',
|
||||||
|
'calendar_cxx_example_01',
|
||||||
|
'calendar_cxx_example_02',
|
||||||
|
'calendar_cxx_example_03',
|
||||||
|
'calendar_cxx_example_04',
|
||||||
|
'calendar_cxx_example_05',
|
||||||
|
'clock_cxx_example',
|
||||||
|
'icon_cxx_example_01',
|
||||||
|
'menu_cxx_example_01',
|
||||||
|
'popup_cxx_example',
|
||||||
|
'radio_cxx_example_01',
|
||||||
|
'slider_cxx_example',
|
||||||
|
'spinner_cxx_example',
|
||||||
|
'table_cxx_example_01',
|
||||||
|
'table_cxx_example_02',
|
||||||
|
'toolbar_cxx_example_01',
|
||||||
|
]
|
||||||
|
|
||||||
|
dep = [dependency('elementary-cxx')]
|
||||||
|
|
||||||
|
foreach file : src
|
||||||
|
executable(file,
|
||||||
|
file + '.cc',
|
||||||
|
dependencies: dep,
|
||||||
|
cpp_args : beta_defines
|
||||||
|
)
|
||||||
|
endforeach
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue