summaryrefslogtreecommitdiff
path: root/src/examples/evas
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-02-25 19:16:19 -0300
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-02-25 19:21:04 -0300
commit401f69564481ecd13dbe959ba700117766da7c85 (patch)
tree3138464532c7c65e43e947b1713f41700a05fb37 /src/examples/evas
parente7ebf92c9209ceb93b6a89d210c15af5260a7b21 (diff)
efl-csharp: Remove legacy Evas bindings.
Summary: Pave the way to correct beta classes handling. Reviewers: vitor.sousa, segfaultxavi, bu5hm4n Reviewed By: vitor.sousa, bu5hm4n Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8004
Diffstat (limited to 'src/examples/evas')
-rw-r--r--src/examples/evas/evas_mono_box.cs73
-rw-r--r--src/examples/evas/evas_mono_image.cs93
-rw-r--r--src/examples/evas/evas_mono_image2.cs83
-rw-r--r--src/examples/evas/evas_mono_rectangle.cs47
-rw-r--r--src/examples/evas/evas_mono_table.cs77
-rw-r--r--src/examples/evas/evas_mono_text.cs127
6 files changed, 0 insertions, 500 deletions
diff --git a/src/examples/evas/evas_mono_box.cs b/src/examples/evas/evas_mono_box.cs
deleted file mode 100644
index dbfd15e372..0000000000
--- a/src/examples/evas/evas_mono_box.cs
+++ /dev/null
@@ -1,73 +0,0 @@
1using System;
2using System.Runtime.InteropServices;
3using System.Runtime.CompilerServices;
4
5public class MyBox : Evas.Box
6{
7 public MyBox(Efl.Object parent) : base(parent) {}
8
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);
11 [DllImport("evas")] static extern void evas_object_box_layout_horizontal(IntPtr obj, IntPtr data, IntPtr privdata);
12 [DllImport("evas")] static extern IntPtr evas_object_evas_get(IntPtr obj);
13 [DllImport("evas")] static extern void evas_event_freeze(IntPtr obj);
14 [DllImport("evas")] static extern void evas_event_thaw(IntPtr obj);
15
16 override public void CalculateGroup()
17 {
18 IntPtr evas = evas_object_evas_get(NativeHandle);
19 evas_event_freeze(evas);
20 Console.WriteLine("called group_calculate");
21 /* layouting_set(true); */
22 evas_obj_box_layout_vertical(NativeHandle, IntPtr.Zero, IntPtr.Zero);
23 /* layouting_set(false); */
24 /* children_changed_set(false); */
25 evas_event_thaw(evas);
26 }
27}
28
29class TestMain
30{
31 static void Main(string[] args)
32 {
33 Efl.All.Init();
34
35 Efl.Loop loop = new Efl.Loop();
36
37
38 EcoreEvas ecore_evas = new EcoreEvas();
39
40 Efl.Canvas.Object canvas = ecore_evas.canvas;
41 canvas.SetVisible(true);
42
43 Efl.Object parent = canvas.GetParent();
44 System.Diagnostics.Debug.Assert(parent.NativeHandle != IntPtr.Zero);
45
46 Evas.Box box = new MyBox(canvas);
47 Eina.Size2D size = new Eina.Size2D();
48
49 size.W = 320;
50 size.H = 240;
51
52 box.SetSize(size);
53 box.SetVisible(true);
54
55 Efl.Canvas.Rectangle rect = new Efl.Canvas.Rectangle(canvas);
56 rect.SetColor(0, 0, 255, 255);
57 size.W = 320;
58 size.H = 120;
59 rect.SetSize(size);
60 rect.SetVisible(true);
61 box.Append(rect);
62
63 Efl.Canvas.Rectangle rect2 = new Efl.Canvas.Rectangle(canvas);
64 rect2.SetColor(0, 255, 0, 255);
65 rect2.SetSize(size);
66 rect2.SetVisible(true);
67 box.Append(rect2);
68
69 loop.Begin();
70
71 Efl.All.Shutdown();
72 }
73}
diff --git a/src/examples/evas/evas_mono_image.cs b/src/examples/evas/evas_mono_image.cs
deleted file mode 100644
index 865aa42502..0000000000
--- a/src/examples/evas/evas_mono_image.cs
+++ /dev/null
@@ -1,93 +0,0 @@
1using System;
2using System.Runtime.CompilerServices;
3
4class TestMain
5{
6 static int WIDTH = 320;
7 static int HEIGHT = 240;
8
9 Evas.Image image;
10
11
12 static string ImagePath([CallerFilePath] string folder="")
13 {
14 return System.IO.Path.GetDirectoryName(folder);
15 }
16
17 public TestMain(Evas.Image image)
18 {
19 this.image = image;
20 }
21
22 static void Main(string[] args)
23 {
24 Efl.All.Init();
25
26 Efl.Loop loop = new Efl.Loop();
27
28 EcoreEvas ecore_evas = new EcoreEvas();
29 Eina.Size2D size = new Eina.Size2D();
30
31 Efl.Canvas.Object canvas = ecore_evas.canvas;
32 canvas.SetVisible(true);
33
34 Efl.Object parent = canvas.GetParent();
35 System.Diagnostics.Debug.Assert(parent.NativeHandle != IntPtr.Zero);
36
37 Efl.Canvas.Rectangle bg = new Efl.Canvas.Rectangle(canvas);
38 bg.SetColor(255, 255, 255, 255);
39 size.W = WIDTH;
40 size.H = HEIGHT;
41 bg.SetSize(size);
42 bg.SetVisible(true);
43
44 string valid_path = args[0];
45 Evas.Image image = new Evas.Image(canvas);
46 image.SetFile(valid_path, null);
47
48 /* FIXME evas-image uses error handling code from
49 * evas_object_image_load_error_get, which seems to be not available
50 * Efl.image.load.State state = image.load_error_get(); */
51
52 // FIXME missing move
53 Eina.Rect rect = new Eina.Rect();
54
55 rect.X = 0;
56 rect.Y = 0;
57 rect.W = WIDTH / 2;
58 rect.H = HEIGHT / 2;
59 image.SetFill(rect);
60
61 size.W = WIDTH / 2;
62 size.H = HEIGHT / 2;
63 image.SetSize(size);
64 image.SetVisible(true);
65
66 rect = image.GetFill();
67 rect.Y -= 50;
68 rect.W += 100;
69 image.SetFill(rect);
70
71 TestMain listener = new TestMain(image);
72
73 // TODO handle key events in order to alter the image like the C
74 // example. Meanwhile, just set some w fill
75 /* EventListener callback = new EventListener(); */
76
77 /* bg.key_focus_set(true); */
78 /* bg.event_callback_priority_add(Evas.Callback_Type.Key_down, */
79 /* Efl.Callback_Priority.Default, */
80 /* callback, null); */
81
82 loop.Begin();
83
84 Efl.All.Shutdown();
85 }
86
87 public void on_key_down(object sender, EventArgs e)
88 {
89 Console.WriteLine("on_key_down called");
90 }
91}
92
93
diff --git a/src/examples/evas/evas_mono_image2.cs b/src/examples/evas/evas_mono_image2.cs
deleted file mode 100644
index 0ad8fb0872..0000000000
--- a/src/examples/evas/evas_mono_image2.cs
+++ /dev/null
@@ -1,83 +0,0 @@
1using System;
2using System.Runtime.InteropServices;
3using System.Runtime.CompilerServices;
4
5class TestMain
6{
7 static int WIDTH = 320;
8 static int HEIGHT = 240;
9
10
11 static void Main(string[] args)
12 {
13 Efl.All.Init();
14
15 Efl.Loop loop = new Efl.Loop();
16
17 EcoreEvas ecore_evas = new EcoreEvas();
18
19 Eina.Size2D size = new Eina.Size2D();
20 Eina.Position2D pos = new Eina.Position2D();
21
22 Efl.Canvas.Object canvas = ecore_evas.canvas;
23 canvas.SetVisible(true);
24
25 Efl.Canvas.Rectangle bg = new Efl.Canvas.Rectangle(canvas);
26 bg.SetColor(255, 255, 255, 255);
27 pos.X = 0;
28 pos.Y = 0;
29 bg.SetPosition(pos);
30 size.W = WIDTH;
31 size.H = HEIGHT;
32 bg.SetSize(size);
33 bg.SetVisible(true);
34
35 string path = args[0];
36 Evas.Image logo = new Evas.Image(canvas);
37 logo.SetFillAuto(true);
38
39 // TODO add preloaded support (depends on events)
40
41 logo.SetFile(path, null);
42 size.W = WIDTH / 2;
43 size.H = HEIGHT / 2;
44 logo.SetSize(size);
45
46 // TODO add a bunch of key/mouse handlers
47
48 logo.SetVisible(true);
49
50 int[] pixels = new int[(WIDTH/4) * (HEIGHT / 4)];
51 System.Random generator = new System.Random();
52 for (int i = 0; i < pixels.Length; i++) {
53 pixels[i] = generator.Next();
54 }
55
56 Evas.Image noise_img = new Evas.Image(canvas);
57 size.W = WIDTH / 4;
58 size.H = HEIGHT / 4;
59 noise_img.SetSize(size);
60 // FIXME Add a way to set the pixels.
61 // noise_img.data_set(pixels);
62 noise_img.SetFillAuto(true);
63 pos.X = WIDTH * 5 / 8;
64 pos.Y = HEIGHT / 8;
65 noise_img.SetPosition(pos);
66 noise_img.SetVisible(true);
67 Console.WriteLine("Creating noise image with sizez %d, %d", WIDTH/4, HEIGHT/4);
68
69 Efl.Canvas.Proxy proxy_img = new Efl.Canvas.Proxy(canvas);
70 proxy_img.SetSource(noise_img);
71 pos.X = WIDTH / 2;
72 pos.Y = HEIGHT / 2;
73 proxy_img.SetPosition(pos);
74 size.W = WIDTH / 2;
75 size.H = HEIGHT / 2;
76 proxy_img.SetSize(size);
77 proxy_img.SetVisible(true);
78
79 loop.Begin();
80 }
81}
82
83
diff --git a/src/examples/evas/evas_mono_rectangle.cs b/src/examples/evas/evas_mono_rectangle.cs
deleted file mode 100644
index 85afbd2e61..0000000000
--- a/src/examples/evas/evas_mono_rectangle.cs
+++ /dev/null
@@ -1,47 +0,0 @@
1using System;
2
3class TestMain
4{
5 private static int[,] colors = new int[,] {
6 {255, 0, 0},
7 {0, 255, 0},
8 {0, 0, 255}
9 };
10
11 static void Main(string[] args)
12 {
13 int color_index = 0;
14
15 Efl.All.Init();
16
17 Efl.Loop loop = new Efl.Loop();
18 EcoreEvas ecore_evas = new EcoreEvas();
19 Efl.Canvas.Object canvas = ecore_evas.canvas;
20 canvas.SetVisible(true);
21
22 Efl.Object parent = canvas.GetParent();
23 System.Diagnostics.Debug.Assert(parent.NativeHandle != IntPtr.Zero);
24
25 Efl.Canvas.Rectangle rect = new Efl.Canvas.Rectangle(canvas);
26 rect.SetColor(colors[0, 0], colors[0, 1], colors[0, 2], 255);
27 Eina.Size2D size = new Eina.Size2D();
28 size.W = 640;
29 size.H = 480;
30 rect.SetSize(size);
31 rect.SetVisible(true);
32
33 canvas.KeyDownEvt += (object sender, Efl.Input.InterfaceKeyDownEvt_Args e) => {
34 color_index = (color_index + 1) % 3;
35 Console.WriteLine("Key Down");
36 Console.WriteLine("Got key obj at {0}", e.arg.NativeHandle.ToString("X"));
37 Console.WriteLine("Got key_get() == [{0}]", e.arg.GetKey());
38 rect.SetColor(colors[color_index, 0],
39 colors[color_index, 1],
40 colors[color_index, 2], 255);
41 };
42
43 loop.Begin();
44
45 Efl.All.Shutdown();
46 }
47}
diff --git a/src/examples/evas/evas_mono_table.cs b/src/examples/evas/evas_mono_table.cs
deleted file mode 100644
index 25c3d5e78a..0000000000
--- a/src/examples/evas/evas_mono_table.cs
+++ /dev/null
@@ -1,77 +0,0 @@
1using System;
2using System.Runtime.InteropServices;
3using System.Runtime.CompilerServices;
4
5class TestMain
6{
7 static int WIDTH = 100;
8 static int HEIGHT = 150;
9
10 static void Main(string[] args)
11 {
12 Efl.All.Init();
13
14 Efl.Loop loop = new Efl.Loop();
15
16 EcoreEvas ecore_evas = new EcoreEvas();
17
18 Eina.Size2D size = new Eina.Size2D();
19 size.W = WIDTH;
20 size.H = HEIGHT;
21
22 Eina.Size2D hint = new Eina.Size2D();
23
24 Efl.Canvas.Object canvas = ecore_evas.canvas;
25 canvas.SetVisible(true);
26
27 Efl.Object parent = canvas.GetParent();
28 System.Diagnostics.Debug.Assert(parent.NativeHandle != IntPtr.Zero);
29
30 Efl.Canvas.Rectangle bg = new Efl.Canvas.Rectangle(canvas);
31 bg.SetColor(255, 255, 255, 255);
32 bg.SetSize(size);
33 bg.SetVisible(true);
34
35
36 Evas.Table table = new Evas.Table(canvas);
37 table.SetHomogeneous(Evas.ObjectTable.HomogeneousMode.None);
38 table.SetPadding(0, 0);
39 table.SetSize(size);
40 table.SetVisible(true);
41
42 Efl.Canvas.Rectangle rect = new Efl.Canvas.Rectangle(canvas);
43 rect.SetColor(255, 0, 0, 255);
44 hint.W = 100;
45 hint.H = 50;
46 rect.SetHintSizeMin(hint);
47 rect.SetVisible(true);
48 table.Pack(rect, 1, 1, 2, 1);
49
50 rect = new Efl.Canvas.Rectangle(canvas);
51 rect.SetColor(0, 255, 0, 255);
52 hint.W = 50;
53 hint.H = 100;
54 rect.SetHintSizeMin(hint);
55 rect.SetVisible(true);
56 table.Pack(rect, 1, 2, 1, 2);
57
58 rect = new Efl.Canvas.Rectangle(canvas);
59 rect.SetColor(0, 0, 255, 255);
60 hint.W = 50;
61 hint.H = 50;
62 rect.SetHintSizeMin(hint);
63 rect.SetVisible(true);
64 table.Pack(rect, 2, 2, 1, 1);
65
66 rect = new Efl.Canvas.Rectangle(canvas);
67 rect.SetColor(255, 255, 0, 255);
68 rect.SetHintSizeMin(hint);
69 rect.SetVisible(true);
70 table.Pack(rect, 2, 3, 1, 1);
71
72 loop.Begin();
73
74 Efl.All.Shutdown();
75 }
76}
77
diff --git a/src/examples/evas/evas_mono_text.cs b/src/examples/evas/evas_mono_text.cs
deleted file mode 100644
index 52b89f2f10..0000000000
--- a/src/examples/evas/evas_mono_text.cs
+++ /dev/null
@@ -1,127 +0,0 @@
1using System;
2using System.Linq;
3using System.Collections.Generic;
4
5static class Extensions
6{
7 public static IEnumerable<T> Circle<T>(this IEnumerable<T> list, int index=0)
8 {
9 var count = list.Count();
10 index = index % count;
11
12 while (true) {
13 yield return list.ElementAt(index);
14 index = (index + 1) % count;
15 }
16 }
17}
18
19class TestMain
20{
21 static int WIDTH = 320;
22 static int HEIGHT = 240;
23
24 private EcoreEvas ecore_evas;
25 private Efl.Canvas.Object canvas;
26 private Efl.Canvas.Rectangle bg;
27 private Evas.Text text;
28 private Evas.Image border;
29
30 public TestMain(String border_file) {
31 ecore_evas = new EcoreEvas();
32 Eina.Size2D size = new Eina.Size2D();
33 Eina.Position2D position = new Eina.Position2D();
34 canvas = ecore_evas.canvas;
35 canvas.SetVisible(true);
36
37 bg = new Efl.Canvas.Rectangle(canvas);
38 bg.SetColor(255, 255, 255, 255);
39 position.X = 0;
40 position.Y = 0;
41 bg.SetPosition(position);
42 size.W = WIDTH;
43 size.H = HEIGHT;
44 bg.SetSize(size);
45 bg.SetVisible(true);
46 bg.SetKeyFocus(true);
47
48 /* ((Efl.Input.Interface)bg).KeyDownEvt += On_KeyDown; */
49 bg.KeyDownEvt += On_KeyDown;
50
51 text = new Evas.Text(canvas);
52 text.SetStyle(Evas.TextStyleType.OutlineSoftShadow);
53
54 text.SetColor(0, 0, 0, 255);
55 text.SetGlowColor(255, 0, 0, 255);
56 text.SetOutlineColor(0, 0, 255, 255);
57 text.SetShadowColor(0, 255,255, 255);
58 text.SetFont("Courier", 30);
59
60 text.SetText("sample text");
61 size.W = 3*WIDTH / 4;
62 size.H = HEIGHT / 4;
63 text.SetSize(size);
64 position.X = WIDTH / 8;
65 position.Y = 3 * HEIGHT / 8;
66 text.SetPosition(position);
67 text.SetVisible(true);
68
69 Efl.Font.Size font_size = 0;
70 String font = String.Empty;
71 text.GetFont(out font, out font_size);
72 Console.WriteLine("Adding text object with font {0} and size {1}", font, size);
73
74 // setup border
75 border = new Evas.Image(canvas);
76 border.SetFile(border_file, null);
77 border.SetBorder(3, 3, 3, 3);
78 border.SetBorderCenterFill(0);
79
80 size.W = 3 * WIDTH / 4 + 3;
81 size.H = HEIGHT / 4 + 3;
82 border.SetSize(size);
83 position.X = WIDTH / 8 - 3;
84 position.Y = 3 * HEIGHT / 8 - 3;
85 border.SetPosition(position);
86 border.SetVisible(true);
87
88
89 }
90
91 private void On_KeyDown(object sender, Efl.Input.InterfaceKeyDownEvt_Args e)
92 {
93 var key = e.arg.GetKey();
94
95 if (key == "h") {
96 Console.WriteLine(commands);
97 } else if (key == "t") {
98 Evas.TextStyleType type = text.GetStyle();
99 type = (Evas.TextStyleType)(((int)type + 1) % 10); // 10 hardcoded from C example
100 text.SetStyle(type);
101 }
102 }
103
104 static string commands = @"commands are:
105 t - change text's current style
106 h - print help";
107
108
109 static void Main(string[] args)
110 {
111 Efl.All.Init();
112
113 String border_path = "./src/examples/evas/resources/images/red.png";
114
115 if (args.Length >= 1)
116 border_path = args[0];
117
118 Efl.Loop loop = new Efl.Loop();
119 TestMain t = new TestMain(border_path);
120
121 loop.Begin();
122
123 Efl.All.Shutdown();
124 }
125}
126
127