summaryrefslogtreecommitdiff
path: root/src/examples/evas
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2018-11-29 21:04:37 -0200
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2018-11-29 21:29:48 -0200
commit3623753c1d6b893955a1c31e8559a2312f674192 (patch)
treee862682ff92d34ce4ebf44c95efa24ba3a57fe7a /src/examples/evas
parenteec7bc458eee333fd7237a3bd43e8c2c884f21ca (diff)
csharp: Change to new class API.
Summary: As discussed in T7204: - Eo Interfaces/mixins -> C# Interfaces with concrete class implementations - Eo Regular/Abstracts -> Proper C# classes - Added some new generators and helper methods. - Refactored the class generator, splitting into helper methods Eo handles now are stored only in the "root" class in any given inheritance tree (generally, Efl.Object), and accessible to each child. Methods also are defined in a single place instead of repeatedly generated in everyfile, reducing the size of the generated .dll from 30MB to around 4.5MB. Mixins are generated as C# interfaces but any regular class it inherits from is lost, as we can't have interfaces inheriting from regular classes. This will be dealt with in a later commit. Summary of API Changes: - Merged Inherit/Concrete classes. (These suffixes disappear from regular classes). - Interface still have implementations with 'Concrete' suffix for when they are returned from methods. - Removed 'I' from interface names. - Removed interfaces for regular/abstract Eo classes. - Concrete classes for interfaces/mixins hold the event argument struct. - Removed '_' from classes, enums, structs, etc, as indicated in C# naming conventions. - Namespaces are now Camel.Cased. - Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass Also renamed the test classes as after the namespace change, the test namespace Test can conflict with the helper Test namespace. (And use more meaningful names than Test.Testing...) Also Fixes T7336 by removing a deprecated example and adding efl_loop_timer_example to build system. Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper fields. The native handlers are used in the manual binding. Still need to work: - As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize" from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on the interface and implemented "namespaced" in the classes, requiring the cast to the interface to access the event. - The Mixin Conundrum. Mixin inheritance will be dealt in a future commit. Depends on D7260 Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho Reviewed By: vitor.sousa Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T7451, T7336 Differential Revision: https://phab.enlightenment.org/D7262
Diffstat (limited to 'src/examples/evas')
-rw-r--r--src/examples/evas/evas_mono_box.cs28
-rw-r--r--src/examples/evas/evas_mono_image.cs30
-rw-r--r--src/examples/evas/evas_mono_image2.cs18
-rw-r--r--src/examples/evas/evas_mono_rectangle.cs20
-rw-r--r--src/examples/evas/evas_mono_table.cs30
-rw-r--r--src/examples/evas/evas_mono_text.cs35
6 files changed, 81 insertions, 80 deletions
diff --git a/src/examples/evas/evas_mono_box.cs b/src/examples/evas/evas_mono_box.cs
index 97c161c536..dbfd15e372 100644
--- a/src/examples/evas/evas_mono_box.cs
+++ b/src/examples/evas/evas_mono_box.cs
@@ -2,9 +2,9 @@ using System;
2using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
3using System.Runtime.CompilerServices; 3using System.Runtime.CompilerServices;
4 4
5public class MyBox : evas.BoxInherit 5public class MyBox : Evas.Box
6{ 6{
7 public MyBox(efl.IObject parent) : base(parent) {} 7 public MyBox(Efl.Object parent) : base(parent) {}
8 8
9 [DllImport("evas")] static extern void evas_obj_box_layout_vertical(IntPtr obj, IntPtr data, IntPtr privdata); 9 [DllImport("evas")] static extern void evas_obj_box_layout_vertical(IntPtr obj, IntPtr data, IntPtr privdata);
10 [DllImport("evas")] static extern void evas_obj_box_layout_horizontal(IntPtr obj, IntPtr data, IntPtr privdata); 10 [DllImport("evas")] static extern void evas_obj_box_layout_horizontal(IntPtr obj, IntPtr data, IntPtr privdata);
@@ -15,11 +15,11 @@ public class MyBox : evas.BoxInherit
15 15
16 override public void CalculateGroup() 16 override public void CalculateGroup()
17 { 17 {
18 IntPtr evas = evas_object_evas_get(raw_handle); 18 IntPtr evas = evas_object_evas_get(NativeHandle);
19 evas_event_freeze(evas); 19 evas_event_freeze(evas);
20 Console.WriteLine("called group_calculate"); 20 Console.WriteLine("called group_calculate");
21 /* layouting_set(true); */ 21 /* layouting_set(true); */
22 evas_obj_box_layout_vertical(raw_handle, IntPtr.Zero, IntPtr.Zero); 22 evas_obj_box_layout_vertical(NativeHandle, IntPtr.Zero, IntPtr.Zero);
23 /* layouting_set(false); */ 23 /* layouting_set(false); */
24 /* children_changed_set(false); */ 24 /* children_changed_set(false); */
25 evas_event_thaw(evas); 25 evas_event_thaw(evas);
@@ -30,21 +30,21 @@ class TestMain
30{ 30{
31 static void Main(string[] args) 31 static void Main(string[] args)
32 { 32 {
33 efl.All.Init(); 33 Efl.All.Init();
34 34
35 efl.Loop loop = new efl.Loop(); 35 Efl.Loop loop = new Efl.Loop();
36 36
37 37
38 EcoreEvas ecore_evas = new EcoreEvas(); 38 EcoreEvas ecore_evas = new EcoreEvas();
39 39
40 efl.canvas.IObject canvas = ecore_evas.canvas; 40 Efl.Canvas.Object canvas = ecore_evas.canvas;
41 canvas.SetVisible(true); 41 canvas.SetVisible(true);
42 42
43 efl.IObject parent = canvas.GetParent(); 43 Efl.Object parent = canvas.GetParent();
44 System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero); 44 System.Diagnostics.Debug.Assert(parent.NativeHandle != IntPtr.Zero);
45 45
46 evas.IBox box = new MyBox(canvas); 46 Evas.Box box = new MyBox(canvas);
47 eina.Size2D size = new eina.Size2D(); 47 Eina.Size2D size = new Eina.Size2D();
48 48
49 size.W = 320; 49 size.W = 320;
50 size.H = 240; 50 size.H = 240;
@@ -52,7 +52,7 @@ class TestMain
52 box.SetSize(size); 52 box.SetSize(size);
53 box.SetVisible(true); 53 box.SetVisible(true);
54 54
55 efl.canvas.Rectangle rect = new efl.canvas.Rectangle(canvas); 55 Efl.Canvas.Rectangle rect = new Efl.Canvas.Rectangle(canvas);
56 rect.SetColor(0, 0, 255, 255); 56 rect.SetColor(0, 0, 255, 255);
57 size.W = 320; 57 size.W = 320;
58 size.H = 120; 58 size.H = 120;
@@ -60,7 +60,7 @@ class TestMain
60 rect.SetVisible(true); 60 rect.SetVisible(true);
61 box.Append(rect); 61 box.Append(rect);
62 62
63 efl.canvas.Rectangle rect2 = new efl.canvas.Rectangle(canvas); 63 Efl.Canvas.Rectangle rect2 = new Efl.Canvas.Rectangle(canvas);
64 rect2.SetColor(0, 255, 0, 255); 64 rect2.SetColor(0, 255, 0, 255);
65 rect2.SetSize(size); 65 rect2.SetSize(size);
66 rect2.SetVisible(true); 66 rect2.SetVisible(true);
@@ -68,6 +68,6 @@ class TestMain
68 68
69 loop.Begin(); 69 loop.Begin();
70 70
71 efl.All.Shutdown(); 71 Efl.All.Shutdown();
72 } 72 }
73} 73}
diff --git a/src/examples/evas/evas_mono_image.cs b/src/examples/evas/evas_mono_image.cs
index 47f9b36023..865aa42502 100644
--- a/src/examples/evas/evas_mono_image.cs
+++ b/src/examples/evas/evas_mono_image.cs
@@ -6,7 +6,7 @@ class TestMain
6 static int WIDTH = 320; 6 static int WIDTH = 320;
7 static int HEIGHT = 240; 7 static int HEIGHT = 240;
8 8
9 evas.IImage image; 9 Evas.Image image;
10 10
11 11
12 static string ImagePath([CallerFilePath] string folder="") 12 static string ImagePath([CallerFilePath] string folder="")
@@ -14,27 +14,27 @@ class TestMain
14 return System.IO.Path.GetDirectoryName(folder); 14 return System.IO.Path.GetDirectoryName(folder);
15 } 15 }
16 16
17 public TestMain(evas.IImage image) 17 public TestMain(Evas.Image image)
18 { 18 {
19 this.image = image; 19 this.image = image;
20 } 20 }
21 21
22 static void Main(string[] args) 22 static void Main(string[] args)
23 { 23 {
24 efl.All.Init(); 24 Efl.All.Init();
25 25
26 efl.Loop loop = new efl.Loop(); 26 Efl.Loop loop = new Efl.Loop();
27 27
28 EcoreEvas ecore_evas = new EcoreEvas(); 28 EcoreEvas ecore_evas = new EcoreEvas();
29 eina.Size2D size = new eina.Size2D(); 29 Eina.Size2D size = new Eina.Size2D();
30 30
31 efl.canvas.IObject canvas = ecore_evas.canvas; 31 Efl.Canvas.Object canvas = ecore_evas.canvas;
32 canvas.SetVisible(true); 32 canvas.SetVisible(true);
33 33
34 efl.IObject parent = canvas.GetParent(); 34 Efl.Object parent = canvas.GetParent();
35 System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero); 35 System.Diagnostics.Debug.Assert(parent.NativeHandle != IntPtr.Zero);
36 36
37 efl.canvas.Rectangle bg = new efl.canvas.Rectangle(canvas); 37 Efl.Canvas.Rectangle bg = new Efl.Canvas.Rectangle(canvas);
38 bg.SetColor(255, 255, 255, 255); 38 bg.SetColor(255, 255, 255, 255);
39 size.W = WIDTH; 39 size.W = WIDTH;
40 size.H = HEIGHT; 40 size.H = HEIGHT;
@@ -42,15 +42,15 @@ class TestMain
42 bg.SetVisible(true); 42 bg.SetVisible(true);
43 43
44 string valid_path = args[0]; 44 string valid_path = args[0];
45 evas.Image image = new evas.Image(canvas); 45 Evas.Image image = new Evas.Image(canvas);
46 image.SetFile(valid_path, null); 46 image.SetFile(valid_path, null);
47 47
48 /* FIXME evas-image uses error handling code from 48 /* FIXME evas-image uses error handling code from
49 * evas_object_image_load_error_get, which seems to be not available 49 * evas_object_image_load_error_get, which seems to be not available
50 * efl.image.load.State state = image.load_error_get(); */ 50 * Efl.image.load.State state = image.load_error_get(); */
51 51
52 // FIXME missing move 52 // FIXME missing move
53 eina.Rect rect = new eina.Rect(); 53 Eina.Rect rect = new Eina.Rect();
54 54
55 rect.X = 0; 55 rect.X = 0;
56 rect.Y = 0; 56 rect.Y = 0;
@@ -75,13 +75,13 @@ class TestMain
75 /* EventListener callback = new EventListener(); */ 75 /* EventListener callback = new EventListener(); */
76 76
77 /* bg.key_focus_set(true); */ 77 /* bg.key_focus_set(true); */
78 /* bg.event_callback_priority_add(evas.Callback_Type.Key_down, */ 78 /* bg.event_callback_priority_add(Evas.Callback_Type.Key_down, */
79 /* efl.Callback_Priority.Default, */ 79 /* Efl.Callback_Priority.Default, */
80 /* callback, null); */ 80 /* callback, null); */
81 81
82 loop.Begin(); 82 loop.Begin();
83 83
84 efl.All.Shutdown(); 84 Efl.All.Shutdown();
85 } 85 }
86 86
87 public void on_key_down(object sender, EventArgs e) 87 public void on_key_down(object sender, EventArgs e)
diff --git a/src/examples/evas/evas_mono_image2.cs b/src/examples/evas/evas_mono_image2.cs
index 1f0e52ac62..0ad8fb0872 100644
--- a/src/examples/evas/evas_mono_image2.cs
+++ b/src/examples/evas/evas_mono_image2.cs
@@ -10,19 +10,19 @@ class TestMain
10 10
11 static void Main(string[] args) 11 static void Main(string[] args)
12 { 12 {
13 efl.All.Init(); 13 Efl.All.Init();
14 14
15 efl.Loop loop = new efl.Loop(); 15 Efl.Loop loop = new Efl.Loop();
16 16
17 EcoreEvas ecore_evas = new EcoreEvas(); 17 EcoreEvas ecore_evas = new EcoreEvas();
18 18
19 eina.Size2D size = new eina.Size2D(); 19 Eina.Size2D size = new Eina.Size2D();
20 eina.Position2D pos = new eina.Position2D(); 20 Eina.Position2D pos = new Eina.Position2D();
21 21
22 efl.canvas.IObject canvas = ecore_evas.canvas; 22 Efl.Canvas.Object canvas = ecore_evas.canvas;
23 canvas.SetVisible(true); 23 canvas.SetVisible(true);
24 24
25 efl.canvas.Rectangle bg = new efl.canvas.Rectangle(canvas); 25 Efl.Canvas.Rectangle bg = new Efl.Canvas.Rectangle(canvas);
26 bg.SetColor(255, 255, 255, 255); 26 bg.SetColor(255, 255, 255, 255);
27 pos.X = 0; 27 pos.X = 0;
28 pos.Y = 0; 28 pos.Y = 0;
@@ -33,7 +33,7 @@ class TestMain
33 bg.SetVisible(true); 33 bg.SetVisible(true);
34 34
35 string path = args[0]; 35 string path = args[0];
36 evas.Image logo = new evas.Image(canvas); 36 Evas.Image logo = new Evas.Image(canvas);
37 logo.SetFillAuto(true); 37 logo.SetFillAuto(true);
38 38
39 // TODO add preloaded support (depends on events) 39 // TODO add preloaded support (depends on events)
@@ -53,7 +53,7 @@ class TestMain
53 pixels[i] = generator.Next(); 53 pixels[i] = generator.Next();
54 } 54 }
55 55
56 evas.Image noise_img = new evas.Image(canvas); 56 Evas.Image noise_img = new Evas.Image(canvas);
57 size.W = WIDTH / 4; 57 size.W = WIDTH / 4;
58 size.H = HEIGHT / 4; 58 size.H = HEIGHT / 4;
59 noise_img.SetSize(size); 59 noise_img.SetSize(size);
@@ -66,7 +66,7 @@ class TestMain
66 noise_img.SetVisible(true); 66 noise_img.SetVisible(true);
67 Console.WriteLine("Creating noise image with sizez %d, %d", WIDTH/4, HEIGHT/4); 67 Console.WriteLine("Creating noise image with sizez %d, %d", WIDTH/4, HEIGHT/4);
68 68
69 efl.canvas.Proxy proxy_img = new efl.canvas.Proxy(canvas); 69 Efl.Canvas.Proxy proxy_img = new Efl.Canvas.Proxy(canvas);
70 proxy_img.SetSource(noise_img); 70 proxy_img.SetSource(noise_img);
71 pos.X = WIDTH / 2; 71 pos.X = WIDTH / 2;
72 pos.Y = HEIGHT / 2; 72 pos.Y = HEIGHT / 2;
diff --git a/src/examples/evas/evas_mono_rectangle.cs b/src/examples/evas/evas_mono_rectangle.cs
index c31c24785e..85afbd2e61 100644
--- a/src/examples/evas/evas_mono_rectangle.cs
+++ b/src/examples/evas/evas_mono_rectangle.cs
@@ -12,28 +12,28 @@ class TestMain
12 { 12 {
13 int color_index = 0; 13 int color_index = 0;
14 14
15 efl.All.Init(); 15 Efl.All.Init();
16 16
17 efl.Loop loop = new efl.Loop(); 17 Efl.Loop loop = new Efl.Loop();
18 EcoreEvas ecore_evas = new EcoreEvas(); 18 EcoreEvas ecore_evas = new EcoreEvas();
19 efl.canvas.IObject canvas = ecore_evas.canvas; 19 Efl.Canvas.Object canvas = ecore_evas.canvas;
20 canvas.SetVisible(true); 20 canvas.SetVisible(true);
21 21
22 efl.IObject parent = canvas.GetParent(); 22 Efl.Object parent = canvas.GetParent();
23 System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero); 23 System.Diagnostics.Debug.Assert(parent.NativeHandle != IntPtr.Zero);
24 24
25 efl.canvas.Rectangle rect = new efl.canvas.Rectangle(canvas); 25 Efl.Canvas.Rectangle rect = new Efl.Canvas.Rectangle(canvas);
26 rect.SetColor(colors[0, 0], colors[0, 1], colors[0, 2], 255); 26 rect.SetColor(colors[0, 0], colors[0, 1], colors[0, 2], 255);
27 eina.Size2D size = new eina.Size2D(); 27 Eina.Size2D size = new Eina.Size2D();
28 size.W = 640; 28 size.W = 640;
29 size.H = 480; 29 size.H = 480;
30 rect.SetSize(size); 30 rect.SetSize(size);
31 rect.SetVisible(true); 31 rect.SetVisible(true);
32 32
33 canvas.KeyDownEvt += (object sender, efl.input.Interface.KeyDownEvt_Args e) => { 33 canvas.KeyDownEvt += (object sender, Efl.Input.InterfaceKeyDownEvt_Args e) => {
34 color_index = (color_index + 1) % 3; 34 color_index = (color_index + 1) % 3;
35 Console.WriteLine("Key Down"); 35 Console.WriteLine("Key Down");
36 Console.WriteLine("Got key obj at {0}", e.arg.raw_handle.ToString("X")); 36 Console.WriteLine("Got key obj at {0}", e.arg.NativeHandle.ToString("X"));
37 Console.WriteLine("Got key_get() == [{0}]", e.arg.GetKey()); 37 Console.WriteLine("Got key_get() == [{0}]", e.arg.GetKey());
38 rect.SetColor(colors[color_index, 0], 38 rect.SetColor(colors[color_index, 0],
39 colors[color_index, 1], 39 colors[color_index, 1],
@@ -42,6 +42,6 @@ class TestMain
42 42
43 loop.Begin(); 43 loop.Begin();
44 44
45 efl.All.Shutdown(); 45 Efl.All.Shutdown();
46 } 46 }
47} 47}
diff --git a/src/examples/evas/evas_mono_table.cs b/src/examples/evas/evas_mono_table.cs
index db329b22cd..b42057d651 100644
--- a/src/examples/evas/evas_mono_table.cs
+++ b/src/examples/evas/evas_mono_table.cs
@@ -9,37 +9,37 @@ class TestMain
9 9
10 static void Main(string[] args) 10 static void Main(string[] args)
11 { 11 {
12 efl.All.Init(); 12 Efl.All.Init();
13 13
14 efl.Loop loop = new efl.Loop(); 14 Efl.Loop loop = new Efl.Loop();
15 15
16 EcoreEvas ecore_evas = new EcoreEvas(); 16 EcoreEvas ecore_evas = new EcoreEvas();
17 17
18 eina.Size2D size = new eina.Size2D(); 18 Eina.Size2D size = new Eina.Size2D();
19 size.W = WIDTH; 19 size.W = WIDTH;
20 size.H = HEIGHT; 20 size.H = HEIGHT;
21 21
22 eina.Size2D hint = new eina.Size2D(); 22 Eina.Size2D hint = new Eina.Size2D();
23 23
24 efl.canvas.IObject canvas = ecore_evas.canvas; 24 Efl.Canvas.Object canvas = ecore_evas.canvas;
25 canvas.SetVisible(true); 25 canvas.SetVisible(true);
26 26
27 efl.IObject parent = canvas.GetParent(); 27 Efl.Object parent = canvas.GetParent();
28 System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero); 28 System.Diagnostics.Debug.Assert(parent.NativeHandle != IntPtr.Zero);
29 29
30 efl.canvas.Rectangle bg = new efl.canvas.Rectangle(canvas); 30 Efl.Canvas.Rectangle bg = new Efl.Canvas.Rectangle(canvas);
31 bg.SetColor(255, 255, 255, 255); 31 bg.SetColor(255, 255, 255, 255);
32 bg.SetSize(size); 32 bg.SetSize(size);
33 bg.SetVisible(true); 33 bg.SetVisible(true);
34 34
35 35
36 evas.Table table = new evas.Table(canvas); 36 Evas.Table table = new Evas.Table(canvas);
37 table.SetHomogeneous(evas.object_table.Homogeneous_Mode.None); 37 table.SetHomogeneous(Evas.ObjectTable.HomogeneousMode.None);
38 table.SetPadding(0, 0); 38 table.SetPadding(0, 0);
39 table.SetSize(size); 39 table.SetSize(size);
40 table.SetVisible(true); 40 table.SetVisible(true);
41 41
42 efl.canvas.Rectangle rect = new efl.canvas.Rectangle(canvas); 42 Efl.Canvas.Rectangle rect = new Efl.Canvas.Rectangle(canvas);
43 rect.SetColor(255, 0, 0, 255); 43 rect.SetColor(255, 0, 0, 255);
44 hint.W = 100; 44 hint.W = 100;
45 hint.H = 50; 45 hint.H = 50;
@@ -47,7 +47,7 @@ class TestMain
47 rect.SetVisible(true); 47 rect.SetVisible(true);
48 table.Pack(rect, 1, 1, 2, 1); 48 table.Pack(rect, 1, 1, 2, 1);
49 49
50 rect = new efl.canvas.Rectangle(canvas); 50 rect = new Efl.Canvas.Rectangle(canvas);
51 rect.SetColor(0, 255, 0, 255); 51 rect.SetColor(0, 255, 0, 255);
52 hint.W = 50; 52 hint.W = 50;
53 hint.H = 100; 53 hint.H = 100;
@@ -55,7 +55,7 @@ class TestMain
55 rect.SetVisible(true); 55 rect.SetVisible(true);
56 table.Pack(rect, 1, 2, 1, 2); 56 table.Pack(rect, 1, 2, 1, 2);
57 57
58 rect = new efl.canvas.Rectangle(canvas); 58 rect = new Efl.Canvas.Rectangle(canvas);
59 rect.SetColor(0, 0, 255, 255); 59 rect.SetColor(0, 0, 255, 255);
60 hint.W = 50; 60 hint.W = 50;
61 hint.H = 50; 61 hint.H = 50;
@@ -63,7 +63,7 @@ class TestMain
63 rect.SetVisible(true); 63 rect.SetVisible(true);
64 table.Pack(rect, 2, 2, 1, 1); 64 table.Pack(rect, 2, 2, 1, 1);
65 65
66 rect = new efl.canvas.Rectangle(canvas); 66 rect = new Efl.Canvas.Rectangle(canvas);
67 rect.SetColor(255, 255, 0, 255); 67 rect.SetColor(255, 255, 0, 255);
68 rect.SetHintMin(hint); 68 rect.SetHintMin(hint);
69 rect.SetVisible(true); 69 rect.SetVisible(true);
@@ -71,7 +71,7 @@ class TestMain
71 71
72 loop.Begin(); 72 loop.Begin();
73 73
74 efl.All.Shutdown(); 74 Efl.All.Shutdown();
75 } 75 }
76} 76}
77 77
diff --git a/src/examples/evas/evas_mono_text.cs b/src/examples/evas/evas_mono_text.cs
index a1532a4583..52b89f2f10 100644
--- a/src/examples/evas/evas_mono_text.cs
+++ b/src/examples/evas/evas_mono_text.cs
@@ -22,19 +22,19 @@ class TestMain
22 static int HEIGHT = 240; 22 static int HEIGHT = 240;
23 23
24 private EcoreEvas ecore_evas; 24 private EcoreEvas ecore_evas;
25 private efl.canvas.IObject canvas; 25 private Efl.Canvas.Object canvas;
26 private efl.canvas.IRectangle bg; 26 private Efl.Canvas.Rectangle bg;
27 private evas.Text text; 27 private Evas.Text text;
28 private evas.Image border; 28 private Evas.Image border;
29 29
30 public TestMain(String border_file) { 30 public TestMain(String border_file) {
31 ecore_evas = new EcoreEvas(); 31 ecore_evas = new EcoreEvas();
32 eina.Size2D size = new eina.Size2D(); 32 Eina.Size2D size = new Eina.Size2D();
33 eina.Position2D position = new eina.Position2D(); 33 Eina.Position2D position = new Eina.Position2D();
34 canvas = ecore_evas.canvas; 34 canvas = ecore_evas.canvas;
35 canvas.SetVisible(true); 35 canvas.SetVisible(true);
36 36
37 bg = new efl.canvas.Rectangle(canvas); 37 bg = new Efl.Canvas.Rectangle(canvas);
38 bg.SetColor(255, 255, 255, 255); 38 bg.SetColor(255, 255, 255, 255);
39 position.X = 0; 39 position.X = 0;
40 position.Y = 0; 40 position.Y = 0;
@@ -45,10 +45,11 @@ class TestMain
45 bg.SetVisible(true); 45 bg.SetVisible(true);
46 bg.SetKeyFocus(true); 46 bg.SetKeyFocus(true);
47 47
48 /* ((Efl.Input.Interface)bg).KeyDownEvt += On_KeyDown; */
48 bg.KeyDownEvt += On_KeyDown; 49 bg.KeyDownEvt += On_KeyDown;
49 50
50 text = new evas.Text(canvas); 51 text = new Evas.Text(canvas);
51 text.SetStyle(evas.Text_Style_Type.OutlineSoftShadow); 52 text.SetStyle(Evas.TextStyleType.OutlineSoftShadow);
52 53
53 text.SetColor(0, 0, 0, 255); 54 text.SetColor(0, 0, 0, 255);
54 text.SetGlowColor(255, 0, 0, 255); 55 text.SetGlowColor(255, 0, 0, 255);
@@ -65,13 +66,13 @@ class TestMain
65 text.SetPosition(position); 66 text.SetPosition(position);
66 text.SetVisible(true); 67 text.SetVisible(true);
67 68
68 efl.font.Size font_size = 0; 69 Efl.Font.Size font_size = 0;
69 String font = String.Empty; 70 String font = String.Empty;
70 text.GetFont(out font, out font_size); 71 text.GetFont(out font, out font_size);
71 Console.WriteLine("Adding text object with font {0} and size {1}", font, size); 72 Console.WriteLine("Adding text object with font {0} and size {1}", font, size);
72 73
73 // setup border 74 // setup border
74 border = new evas.Image(canvas); 75 border = new Evas.Image(canvas);
75 border.SetFile(border_file, null); 76 border.SetFile(border_file, null);
76 border.SetBorder(3, 3, 3, 3); 77 border.SetBorder(3, 3, 3, 3);
77 border.SetBorderCenterFill(0); 78 border.SetBorderCenterFill(0);
@@ -87,15 +88,15 @@ class TestMain
87 88
88 } 89 }
89 90
90 private void On_KeyDown(object sender, efl.input.Interface.KeyDownEvt_Args e) 91 private void On_KeyDown(object sender, Efl.Input.InterfaceKeyDownEvt_Args e)
91 { 92 {
92 var key = e.arg.GetKey(); 93 var key = e.arg.GetKey();
93 94
94 if (key == "h") { 95 if (key == "h") {
95 Console.WriteLine(commands); 96 Console.WriteLine(commands);
96 } else if (key == "t") { 97 } else if (key == "t") {
97 evas.Text_Style_Type type = text.GetStyle(); 98 Evas.TextStyleType type = text.GetStyle();
98 type = (evas.Text_Style_Type)(((int)type + 1) % 10); // 10 hardcoded from C example 99 type = (Evas.TextStyleType)(((int)type + 1) % 10); // 10 hardcoded from C example
99 text.SetStyle(type); 100 text.SetStyle(type);
100 } 101 }
101 } 102 }
@@ -107,19 +108,19 @@ class TestMain
107 108
108 static void Main(string[] args) 109 static void Main(string[] args)
109 { 110 {
110 efl.All.Init(); 111 Efl.All.Init();
111 112
112 String border_path = "./src/examples/evas/resources/images/red.png"; 113 String border_path = "./src/examples/evas/resources/images/red.png";
113 114
114 if (args.Length >= 1) 115 if (args.Length >= 1)
115 border_path = args[0]; 116 border_path = args[0];
116 117
117 efl.Loop loop = new efl.Loop(); 118 Efl.Loop loop = new Efl.Loop();
118 TestMain t = new TestMain(border_path); 119 TestMain t = new TestMain(border_path);
119 120
120 loop.Begin(); 121 loop.Begin();
121 122
122 efl.All.Shutdown(); 123 Efl.All.Shutdown();
123 } 124 }
124} 125}
125 126