summaryrefslogtreecommitdiff
path: root/src/examples/evas/evas_mono_text.cs
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2018-11-29 21:04:37 -0200
committerChristopher Michael <cp.michael@samsung.com>2018-12-06 12:06:16 -0500
commitd90bb5d28cef646daf3eb3dbd5524755b272e8f2 (patch)
tree03095a761afd3fc480ecae3ed05fddff49a1bd01 /src/examples/evas/evas_mono_text.cs
parent3813b158795fe79e1680f23729bb5a385569fa51 (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 '')
-rw-r--r--src/examples/evas/evas_mono_text.cs35
1 files changed, 18 insertions, 17 deletions
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