summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/csharp/life/src/life_main.cs9
-rw-r--r--apps/csharp/texteditor/src/texteditor_main.cs88
-rw-r--r--reference/csharp/core/src/core_event.cs48
-rw-r--r--reference/csharp/core/src/core_idler.cs10
-rw-r--r--reference/csharp/core/src/core_poll.cs10
-rw-r--r--reference/csharp/ui/src/focus_main.cs69
-rw-r--r--reference/csharp/ui/src/ui_container.cs90
-rw-r--r--reference/csharp/ui/src/ui_sizing.cs47
-rw-r--r--tutorial/csharp/eo-intro/src/eo_intro_main.cs15
-rw-r--r--tutorial/csharp/hello-gui/src/gui_main.cs64
-rw-r--r--tutorial/csharp/hello-world/src/hello-world.cs13
11 files changed, 215 insertions, 248 deletions
diff --git a/apps/csharp/life/src/life_main.cs b/apps/csharp/life/src/life_main.cs
index e59b61d..4dd34dd 100644
--- a/apps/csharp/life/src/life_main.cs
+++ b/apps/csharp/life/src/life_main.cs
@@ -37,11 +37,10 @@ public class LifeWindow
37 37
38 public LifeWindow() 38 public LifeWindow()
39 { 39 {
40 Efl.Ui.Win win = new Efl.Ui.Win(null, (Efl.Ui.Win ewin) => { 40 Efl.Ui.Win win = new Efl.Ui.Win(null);
41 ewin.SetWinType(Efl.Ui.WinType.Basic); 41 win.SetWinType(Efl.Ui.WinType.Basic);
42 ewin.SetText("EFL Life"); 42 win.SetText("EFL Life");
43 ewin.SetAutohide(true); 43 win.SetAutohide(true);
44 });
45 44
46 // when the user clicks "close" on a window there is a request to hide 45 // when the user clicks "close" on a window there is a request to hide
47 ((Efl.Gfx.Entity)win).HideEvt += QuitEvt; 46 ((Efl.Gfx.Entity)win).HideEvt += QuitEvt;
diff --git a/apps/csharp/texteditor/src/texteditor_main.cs b/apps/csharp/texteditor/src/texteditor_main.cs
index 69e95bf..6f52e6b 100644
--- a/apps/csharp/texteditor/src/texteditor_main.cs
+++ b/apps/csharp/texteditor/src/texteditor_main.cs
@@ -58,50 +58,46 @@ public class TextEditor
58 // Shows a modal message popup with an "OK" button 58 // Shows a modal message popup with an "OK" button
59 private void ShowMessage(string message) 59 private void ShowMessage(string message)
60 { 60 {
61 new Efl.Ui.TextAlertPopup (win, (Efl.Ui.TextAlertPopup epopup) => { 61 var popup = new Efl.Ui.TextAlertPopup (win);
62 epopup.SetText(message); 62 popup.SetText(message);
63 epopup.SetExpandable(new Eina.Size2D(200,200)); 63 popup.SetExpandable(new Eina.Size2D(200, 200));
64 epopup.SetButton(Efl.Ui.AlertPopupButton.Positive, "OK", null); 64 popup.SetButton(Efl.Ui.AlertPopupButton.Positive, "OK", null);
65 epopup.ButtonClickedEvt += 65 popup.ButtonClickedEvt +=
66 (object sender, Efl.Ui.AlertPopupButtonClickedEvt_Args ea) => { 66 (object sender, Efl.Ui.AlertPopupButtonClickedEvt_Args ea) => {
67 // Dismiss popup when the button is clicked 67 // Dismiss popup when the button is clicked
68 ((Efl.Ui.TextAlertPopup)sender).SetParent(null); 68 ((Efl.Ui.TextAlertPopup)sender).SetParent(null);
69 }; 69 };
70 });
71 } 70 }
72 71
73 // Adds a button to the toolbar, with the given text, icon and click event handler 72 // Adds a button to the toolbar, with the given text, icon and click event handler
74 private Efl.Ui.Button GUIToolbarButtonAdd(Efl.Ui.Box toolbar, string name, 73 private Efl.Ui.Button GUIToolbarButtonAdd(Efl.Ui.Box toolbar, string name,
75 string iconName, EventHandler func) 74 string iconName, EventHandler func)
76 { 75 {
77 return new Efl.Ui.Button(toolbar, (Efl.Ui.Button ebutton) => { 76 var button = new Efl.Ui.Button(toolbar);
78 ebutton.SetText(name); 77 button.SetText(name);
79 ebutton.ClickedEvt += func; 78 button.ClickedEvt += func;
80 ebutton.SetHintWeight(0, 1); 79 button.SetHintWeight(0, 1);
81 toolbar.DoPack(ebutton); 80
82 81 // Set the content of the button, which is an image
83 // Set the content of the button 82 var image = new Efl.Ui.Image(toolbar);
84 ebutton.SetContent( 83 image.SetIcon(iconName);
85 // Which is an image 84 button.SetContent(image);
86 new Efl.Ui.Image(toolbar, (Efl.Ui.Image eimage) => { 85
87 eimage.SetIcon(iconName); 86 toolbar.DoPack(button);
88 }) 87 return button;
89 );
90 });
91 } 88 }
92 89
93 // Creates a new toolbar, with all its buttons 90 // Creates a new toolbar, with all its buttons
94 private void GUIToolbarSetup(Efl.Ui.Box parent) 91 private void GUIToolbarSetup(Efl.Ui.Box parent)
95 { 92 {
96 // Create a horizontal box container for the buttons 93 // Create a horizontal box container for the buttons
97 Efl.Ui.Box bar = new Efl.Ui.Box(parent, (Efl.Ui.Box ebox) => { 94 var bar = new Efl.Ui.Box(parent);
98 // 0 vertical weight means that the toolbar will have the minimum height 95 // 0 vertical weight means that the toolbar will have the minimum height
99 // to accommodate all its buttons and not a pixel more. The rest of the 96 // to accommodate all its buttons and not a pixel more. The rest of the
100 // space will be given to the other object in the parent container. 97 // space will be given to the other object in the parent container.
101 ebox.SetHintWeight(1, 0); 98 bar.SetHintWeight(1, 0);
102 ebox.SetDirection(Efl.Ui.Dir.Horizontal); 99 bar.SetDirection(Efl.Ui.Dir.Horizontal);
103 parent.DoPack(ebox); 100 parent.DoPack(bar);
104 });
105 101
106 // "New" button 102 // "New" button
107 toolbarButtonNew = GUIToolbarButtonAdd(bar, "New", "document-new", 103 toolbarButtonNew = GUIToolbarButtonAdd(bar, "New", "document-new",
@@ -157,11 +153,10 @@ public class TextEditor
157 public TextEditor() 153 public TextEditor()
158 { 154 {
159 // Create a window and initialize it 155 // Create a window and initialize it
160 win = new Efl.Ui.Win(Efl.App.AppMain, (Efl.Ui.Win ewin) => { 156 win = new Efl.Ui.Win(Efl.App.AppMain);
161 ewin.SetText("Text Editor"); 157 win.SetText("Text Editor");
162 ewin.SetAutohide(true); 158 win.SetAutohide(true);
163 ewin.HideEvt += GUIQuitCb; 159 win.HideEvt += GUIQuitCb;
164 });
165 160
166 // Create a vertical box container 161 // Create a vertical box container
167 Efl.Ui.Box box = new Efl.Ui.Box(win); 162 Efl.Ui.Box box = new Efl.Ui.Box(win);
@@ -171,16 +166,15 @@ public class TextEditor
171 GUIToolbarSetup(box); 166 GUIToolbarSetup(box);
172 167
173 // Create the main text entry 168 // Create the main text entry
174 editorTextBox = new Efl.Ui.Text(box, (Efl.Ui.Text etext) => { 169 editorTextBox = new Efl.Ui.Text(box);
175 etext.SetFont("Mono", 14); 170 editorTextBox.SetFont("Mono", 14);
176 etext.SetMultiline(true); 171 editorTextBox.SetMultiline(true);
177 etext.SetEditable(true); 172 editorTextBox.SetEditable(true);
178 etext.SetScrollable(true); 173 editorTextBox.SetScrollable(true);
179 etext.SetHintMin(new Eina.Size2D(360, 240)); 174 editorTextBox.SetHintMin(new Eina.Size2D(360, 240));
180 etext.ChangedEvt += EditorChangedCb; 175 editorTextBox.ChangedEvt += EditorChangedCb;
181 etext.ChangedUserEvt += EditorChangedCb; 176 editorTextBox.ChangedUserEvt += EditorChangedCb;
182 box.DoPack(etext); 177 box.DoPack(editorTextBox);
183 });
184 178
185 // Initial refresh of the toolbar buttons 179 // Initial refresh of the toolbar buttons
186 GUIToolbarRefresh(); 180 GUIToolbarRefresh();
diff --git a/reference/csharp/core/src/core_event.cs b/reference/csharp/core/src/core_event.cs
index 20f38b7..2cb6d8e 100644
--- a/reference/csharp/core/src/core_event.cs
+++ b/reference/csharp/core/src/core_event.cs
@@ -31,33 +31,33 @@ public class Example
31 mainloop.PollHighEvt += PollCb; 31 mainloop.PollHighEvt += PollCb;
32 32
33 // This timer will control events fired by the main loop 33 // This timer will control events fired by the main loop
34 new Efl.LoopTimer(mainloop, (Efl.LoopTimer etimer) => { 34 var timer = new Efl.LoopTimer(mainloop, (Efl.LoopTimer etimer) => {
35 etimer.SetName("Timer");
36 // Trigger every 100ms 35 // Trigger every 100ms
37 etimer.SetInterval(0.1); 36 etimer.SetInterval(0.1);
38 // To count number of timer triggers
39 int tick_count = 0;
40 etimer.TickEvt += (object sender, EventArgs e) => {
41 string message = "Tick {0} from {1}: ";
42 // Depending on the number of timer ticks, it does a different thing
43 switch (tick_count) {
44 case 0:
45 message += "Freezing Mainloop events";
46 mainloop.FreezeEvent();
47 break;
48 case 1:
49 message += "Thawing Mainloop events";
50 mainloop.ThawEvent();
51 break;
52 default:
53 message += "Quitting";
54 mainloop.Quit(new Eina.Value(0));
55 break;
56 }
57 Console.WriteLine(message, tick_count, ((Efl.Object)sender).GetName());
58 tick_count++;
59 };
60 }); 37 });
38 timer.SetName("Timer");
39 // To count number of timer triggers
40 int tick_count = 0;
41 timer.TickEvt += (object sender, EventArgs e) => {
42 string message = "Tick {0} from {1}: ";
43 // Depending on the number of timer ticks, it does a different thing
44 switch (tick_count) {
45 case 0:
46 message += "Freezing Mainloop events";
47 mainloop.FreezeEvent();
48 break;
49 case 1:
50 message += "Thawing Mainloop events";
51 mainloop.ThawEvent();
52 break;
53 default:
54 message += "Quitting";
55 mainloop.Quit(new Eina.Value(0));
56 break;
57 }
58 Console.WriteLine(message, tick_count, ((Efl.Object)sender).GetName());
59 tick_count++;
60 };
61 61
62 Console.WriteLine("Waiting for Timer to call back..."); 62 Console.WriteLine("Waiting for Timer to call back...");
63 63
diff --git a/reference/csharp/core/src/core_idler.cs b/reference/csharp/core/src/core_idler.cs
index 85c5f45..e8853e5 100644
--- a/reference/csharp/core/src/core_idler.cs
+++ b/reference/csharp/core/src/core_idler.cs
@@ -34,14 +34,14 @@ public class Example
34 }; 34 };
35 35
36 // Use a timer to exit the application 36 // Use a timer to exit the application
37 new Efl.LoopTimer(mainloop, (Efl.LoopTimer etimer) => { 37 var timer = new Efl.LoopTimer(mainloop, (Efl.LoopTimer etimer) => {
38 // Trigger after 10ms 38 // Trigger after 10ms
39 etimer.SetInterval(0.01); 39 etimer.SetInterval(0.01);
40 etimer.TickEvt += (object sender, EventArgs e) => {
41 Console.WriteLine("TIMER: timer callback called, exiting.");
42 mainloop.Quit(new Eina.Value(0));
43 };
44 }); 40 });
41 timer.TickEvt += (object sender, EventArgs e) => {
42 Console.WriteLine("TIMER: timer callback called, exiting.");
43 mainloop.Quit(new Eina.Value(0));
44 };
45 45
46 // Start the EFL main loop (and the experiment) 46 // Start the EFL main loop (and the experiment)
47 mainloop.Begin(); 47 mainloop.Begin();
diff --git a/reference/csharp/core/src/core_poll.cs b/reference/csharp/core/src/core_poll.cs
index 6c7c16a..3ecf7bc 100644
--- a/reference/csharp/core/src/core_poll.cs
+++ b/reference/csharp/core/src/core_poll.cs
@@ -33,14 +33,14 @@ public class Example
33 }; 33 };
34 34
35 // Use a timer to exit the application 35 // Use a timer to exit the application
36 new Efl.LoopTimer(mainloop, (Efl.LoopTimer etimer) => { 36 var timer = new Efl.LoopTimer(mainloop, (Efl.LoopTimer etimer) => {
37 // Trigger after 30s 37 // Trigger after 30s
38 etimer.SetInterval(30); 38 etimer.SetInterval(30);
39 etimer.TickEvt += (object sender, EventArgs e) => {
40 Console.WriteLine("\nTIMER: timer callback called, exiting.");
41 mainloop.Quit(new Eina.Value(0));
42 };
43 }); 39 });
40 timer.TickEvt += (object sender, EventArgs e) => {
41 Console.WriteLine("\nTIMER: timer callback called, exiting.");
42 mainloop.Quit(new Eina.Value(0));
43 };
44 44
45 // Start the EFL main loop (and the experiment) 45 // Start the EFL main loop (and the experiment)
46 mainloop.Begin(); 46 mainloop.Begin();
diff --git a/reference/csharp/ui/src/focus_main.cs b/reference/csharp/ui/src/focus_main.cs
index 5cf6463..700172f 100644
--- a/reference/csharp/ui/src/focus_main.cs
+++ b/reference/csharp/ui/src/focus_main.cs
@@ -16,62 +16,57 @@ public class Example
16 Efl.All.Init(Efl.Components.Ui); 16 Efl.All.Init(Efl.Components.Ui);
17 17
18 // Create a window and initialize it 18 // Create a window and initialize it
19 var win = new Efl.Ui.Win(null, (Efl.Ui.Win ewin) => { 19 var win = new Efl.Ui.Win(null);
20 ewin.SetWinType(Efl.Ui.WinType.Basic); 20 win.SetWinType(Efl.Ui.WinType.Basic);
21 ewin.SetText("Focus example"); 21 win.SetText("Focus example");
22 ewin.SetAutohide(true); 22 win.SetAutohide(true);
23 ewin.HideEvt += (object sender, EventArgs e) => { 23 win.HideEvt += (object sender, EventArgs e) => {
24 // Exit the EFL main loop 24 // Exit the EFL main loop
25 Efl.Ui.Config.Exit(); 25 Efl.Ui.Config.Exit();
26 }; 26 };
27 }); 27
28 28
29 // Create the main box container 29 // Create the main box container
30 var vbox = new Efl.Ui.Box(win, (Efl.Ui.Box ebox) => { 30 var vbox = new Efl.Ui.Box(win);
31 ebox.SetHintMin(new Eina.Size2D(360, 240)); 31 vbox.SetHintMin(new Eina.Size2D(360, 240));
32 win.SetContent(ebox); 32 win.SetContent(vbox);
33 });
34 33
35 // Create some check boxes 34 // Create some check boxes
36 Efl.Ui.Check first_checkbox = null; 35 Efl.Ui.Check first_checkbox = null;
37 for (int i = 0; i< 5; i++) { 36 for (int i = 0; i< 5; i++) {
38 var checkbox = new Efl.Ui.Check(vbox, (Efl.Ui.Check echeck) => { 37 var checkbox = new Efl.Ui.Check(vbox);
39 echeck.SetText("Check " + i); 38 checkbox.SetText("Check " + i);
40 echeck.SetHintAlign(0.5, 0.5); 39 checkbox.SetHintAlign(0.5, 0.5);
41 echeck.FocusChangedEvt += FocusChangedCb; 40 checkbox.FocusChangedEvt += FocusChangedCb;
42 vbox.DoPack(echeck); 41 vbox.DoPack(checkbox);
43 });
44 if (i == 0) first_checkbox = checkbox; 42 if (i == 0) first_checkbox = checkbox;
45 }; 43 };
46 44
47 // Create an horizontal box to contain the two buttons 45 // Create an horizontal box to contain the two buttons
48 var hbox = new Efl.Ui.Box(vbox, (Efl.Ui.Box ebox) => { 46 var hbox = new Efl.Ui.Box(vbox);
49 ebox.SetDirection(Efl.Ui.Dir.Horizontal); 47 hbox.SetDirection(Efl.Ui.Dir.Horizontal);
50 vbox.DoPack(ebox); 48 vbox.DoPack(hbox);
51 });
52 49
53 // Create a "Focus Mover" button 50 // Create a "Focus Mover" button
54 new Efl.Ui.Button(hbox, (Efl.Ui.Button ebutton) => { 51 var button = new Efl.Ui.Button(hbox);
55 ebutton.SetText("Focus mover"); 52 button.SetText("Focus mover");
56 ebutton.FocusChangedEvt += FocusChangedCb; 53 button.FocusChangedEvt += FocusChangedCb;
57 ebutton.ClickedEvt += (object sender, EventArgs e) => { 54 button.ClickedEvt += (object sender, EventArgs e) => {
58 Console.WriteLine("Clicked Focus Mover"); 55 Console.WriteLine("Clicked Focus Mover");
59 // Manually transfer focus to the first check box 56 // Manually transfer focus to the first check box
60 Efl.Ui.Focus.Util.Focus(first_checkbox); 57 Efl.Ui.Focus.Util.Focus(first_checkbox);
61 }; 58 };
62 hbox.DoPack(ebutton); 59 hbox.DoPack(button);
63 });
64 60
65 // Create a Quit button 61 // Create a Quit button
66 new Efl.Ui.Button(hbox, (Efl.Ui.Button ebutton) => { 62 button = new Efl.Ui.Button(hbox);
67 ebutton.SetText("Quit"); 63 button.SetText("Quit");
68 ebutton.FocusChangedEvt += FocusChangedCb; 64 button.FocusChangedEvt += FocusChangedCb;
69 ebutton.ClickedEvt += (object sender, EventArgs e) => { 65 button.ClickedEvt += (object sender, EventArgs e) => {
70 Console.WriteLine("Clicked Quit"); 66 Console.WriteLine("Clicked Quit");
71 Efl.Ui.Config.Exit(); 67 Efl.Ui.Config.Exit();
72 }; 68 };
73 hbox.DoPack(ebutton); 69 hbox.DoPack(button);
74 });
75 70
76 // Show the focus highlight 71 // Show the focus highlight
77 win.SetFocusHighlightEnabled(true); 72 win.SetFocusHighlightEnabled(true);
diff --git a/reference/csharp/ui/src/ui_container.cs b/reference/csharp/ui/src/ui_container.cs
index 81e883b..88dc3d0 100644
--- a/reference/csharp/ui/src/ui_container.cs
+++ b/reference/csharp/ui/src/ui_container.cs
@@ -12,23 +12,21 @@ public class Example
12 // Create a box container full of buttons 12 // Create a box container full of buttons
13 static Efl.Ui.Box CreateBox(Efl.Ui.Win win) 13 static Efl.Ui.Box CreateBox(Efl.Ui.Win win)
14 { 14 {
15 Efl.Ui.Box box = new Efl.Ui.Box(win, (Efl.Ui.Box ebox) => { 15 Efl.Ui.Box box = new Efl.Ui.Box(win);
16 // Set distance between contained elements 16 // Set distance between contained elements
17 ebox.SetPackPadding(5, 0, true); 17 box.SetPackPadding(5, 0, true);
18 });
19 18
20 for (int i = 1; i <= 4; ++i) 19 for (int i = 1; i <= 4; ++i)
21 { 20 {
22 // Add 4 buttons, one below the other 21 // Add 4 buttons, one below the other
23 new Efl.Ui.Button(win, (Efl.Ui.Button ebutton) => { 22 var button = new Efl.Ui.Button(win);
24 ebutton.SetText($"Boxed {i}"); 23 button.SetText($"Boxed {i}");
25 if (i == 2) 24 if (i == 2)
26 { 25 {
27 // Button 2 has its maximum size limited, so it will be smaller 26 // Button 2 has its maximum size limited, so it will be smaller
28 ebutton.SetHintMax(new Eina.Size2D(100,50)); 27 button.SetHintMax(new Eina.Size2D(100,50));
29 } 28 }
30 box.DoPack(ebutton); 29 box.DoPack(button);
31 });
32 } 30 }
33 31
34 return box; 32 return box;
@@ -37,26 +35,24 @@ public class Example
37 // Create a simple table layout 35 // Create a simple table layout
38 static Efl.Ui.Table CreateTable(Efl.Ui.Win win) 36 static Efl.Ui.Table CreateTable(Efl.Ui.Win win)
39 { 37 {
40 Efl.Ui.Table table = new Efl.Ui.Table(win, (Efl.Ui.Table etable) => { 38 Efl.Ui.Table table = new Efl.Ui.Table(win);
41 // Table with two columns, that get filled left to right, and then top to bottom 39 // Table with two columns, that get filled left to right, and then top to bottom
42 etable.SetTableColumns(2); 40 table.SetTableColumns(2);
43 etable.SetTableDirection(Efl.Ui.Dir.Right, Efl.Ui.Dir.Down); 41 table.SetTableDirection(Efl.Ui.Dir.Right, Efl.Ui.Dir.Down);
44 }); 42 Efl.Ui.Button button;
45 43
46 for (int i = 1; i <= 4; ++i) 44 for (int i = 1; i <= 4; ++i)
47 { 45 {
48 // Add 4 buttons, following the defined table flow 46 // Add 4 buttons, following the defined table flow
49 new Efl.Ui.Button(win, (Efl.Ui.Button ebutton) => { 47 button = new Efl.Ui.Button(win);
50 ebutton.SetText($"Table {i}"); 48 button.SetText($"Table {i}");
51 table.DoPack(ebutton); 49 table.DoPack(button);
52 });
53 } 50 }
54 51
55 // Last button spans two table cells 52 // Last button spans two table cells
56 new Efl.Ui.Button(win, (Efl.Ui.Button ebutton) => { 53 button = new Efl.Ui.Button(win);
57 ebutton.SetText("Long Button"); 54 button.SetText("Long Button");
58 table.PackTable(ebutton, 0, 2, 2, 1); 55 table.PackTable(button, 0, 2, 2, 1);
59 });
60 56
61 return table; 57 return table;
62 } 58 }
@@ -70,24 +66,22 @@ public class Example
70 Efl.All.Init(Efl.Components.Ui); 66 Efl.All.Init(Efl.Components.Ui);
71 67
72 // Create a window and initialize it 68 // Create a window and initialize it
73 Efl.Ui.Win win = new Efl.Ui.Win(null, (Efl.Ui.Win ewin) => { 69 Efl.Ui.Win win = new Efl.Ui.Win(null);
74 ewin.SetWinType(Efl.Ui.WinType.Basic); 70 win.SetWinType(Efl.Ui.WinType.Basic);
75 ewin.SetText("Container demo"); 71 win.SetText("Container demo");
76 ewin.SetAutohide(true); 72 win.SetAutohide(true);
77 ewin.HideEvt += (object sender, EventArgs e) => { 73 win.HideEvt += (object sender, EventArgs e) => {
78 // Exit the EFL main loop 74 // Exit the EFL main loop
79 Efl.Ui.Config.Exit(); 75 Efl.Ui.Config.Exit();
80 }; 76 };
81 });
82 // Give the window an initial size so there is room to resize the panes. 77 // Give the window an initial size so there is room to resize the panes.
83 // Otherwise, all widgets are tightly packed 78 // Otherwise, all widgets are tightly packed
84 win.SetSize(new Eina.Size2D(350,250)); 79 win.SetSize(new Eina.Size2D(350,250));
85 80
86 // Create a vertically-split panes container 81 // Create a vertically-split panes container
87 Efl.Ui.Panes vsplit = new Efl.Ui.Panes(win, (Efl.Ui.Panes epanes) => { 82 Efl.Ui.Panes vsplit = new Efl.Ui.Panes(win);
88 epanes.SetSplitRatio(0.75); 83 vsplit.SetSplitRatio(0.75);
89 win.SetContent(epanes); 84 win.SetContent(vsplit);
90 });
91 85
92 // Create some boxes and set them as the content of the first pane of the container 86 // Create some boxes and set them as the content of the first pane of the container
93 var box = CreateBox(win); 87 var box = CreateBox(win);
@@ -95,10 +89,9 @@ public class Example
95 89
96 // Create a second, horizontally-split panes container and set it as the content of 90 // Create a second, horizontally-split panes container and set it as the content of
97 // the second pane of the first container 91 // the second pane of the first container
98 Efl.Ui.Panes hsplit = new Efl.Ui.Panes(win, (Efl.Ui.Panes epanes) => { 92 Efl.Ui.Panes hsplit = new Efl.Ui.Panes(win);
99 epanes.SetDirection(Efl.Ui.Dir.Horizontal); 93 hsplit.SetDirection(Efl.Ui.Dir.Horizontal);
100 epanes.SetSplitRatio(0.85); 94 hsplit.SetSplitRatio(0.85);
101 });
102 Efl.ContentConcrete.static_cast(vsplit.GetPart("second")).SetContent(hsplit); 95 Efl.ContentConcrete.static_cast(vsplit.GetPart("second")).SetContent(hsplit);
103 96
104 // Create a table and set it as the content of the first pane of the horizontal 97 // Create a table and set it as the content of the first pane of the horizontal
@@ -108,14 +101,13 @@ public class Example
108 101
109 // Create a button and set it as the content of the second pane of the horizontal 102 // Create a button and set it as the content of the second pane of the horizontal
110 // container 103 // container
111 Efl.Ui.Button quit_btn = new Efl.Ui.Button(win, (Efl.Ui.Button ebutton) => { 104 Efl.Ui.Button quit_btn = new Efl.Ui.Button(win);
112 ebutton.SetText("Quit"); 105 quit_btn.SetText("Quit");
113 ebutton.SetHintMax(new Eina.Size2D(150, 30)); 106 quit_btn.SetHintMax(new Eina.Size2D(150, 30));
114 ebutton.ClickedEvt += (object sender, EventArgs e) => { 107 quit_btn.ClickedEvt += (object sender, EventArgs e) => {
115 // Exit the EFL main loop 108 // Exit the EFL main loop
116 Efl.Ui.Config.Exit(); 109 Efl.Ui.Config.Exit();
117 }; 110 };
118 });
119 Efl.ContentConcrete.static_cast(hsplit.GetPart("second")).SetContent(quit_btn); 111 Efl.ContentConcrete.static_cast(hsplit.GetPart("second")).SetContent(quit_btn);
120 112
121 // Start the EFL main loop 113 // Start the EFL main loop
diff --git a/reference/csharp/ui/src/ui_sizing.cs b/reference/csharp/ui/src/ui_sizing.cs
index dd6e5ff..ac25283 100644
--- a/reference/csharp/ui/src/ui_sizing.cs
+++ b/reference/csharp/ui/src/ui_sizing.cs
@@ -19,40 +19,35 @@ public class Example
19 Efl.All.Init(Efl.Components.Ui); 19 Efl.All.Init(Efl.Components.Ui);
20 20
21 // Create a window and initialize it 21 // Create a window and initialize it
22 Efl.Ui.Win win = new Efl.Ui.Win(null, (Efl.Ui.Win ewin) => { 22 Efl.Ui.Win win = new Efl.Ui.Win(null);
23 ewin.SetWinType(Efl.Ui.WinType.Basic); 23 win.SetWinType(Efl.Ui.WinType.Basic);
24 ewin.SetText("Size Control"); 24 win.SetText("Size Control");
25 ewin.SetAutohide(true); 25 win.SetAutohide(true);
26 ewin.HideEvt += (object sender, EventArgs e) => { 26 win.HideEvt += (object sender, EventArgs e) => {
27 // Exit the EFL main loop 27 // Exit the EFL main loop
28 Efl.Ui.Config.Exit(); 28 Efl.Ui.Config.Exit();
29 }; 29 };
30 });
31 30
32 // Create a box container 31 // Create a box container
33 Efl.Ui.Box box = new Efl.Ui.Box(win, (Efl.Ui.Box ebox) => { 32 Efl.Ui.Box box = new Efl.Ui.Box(win);
34 win.SetContent(ebox); 33 win.SetContent(box);
35 });
36 34
37 // Create a regular button (without size hints) 35 // Create a regular button (without size hints)
38 new Efl.Ui.Button(win, (Efl.Ui.Button ebutton) => { 36 var button = new Efl.Ui.Button(win);
39 ebutton.SetText("Button"); 37 button.SetText("Button");
40 box.DoPack(ebutton); 38 box.DoPack(button);
41 });
42 39
43 // Create a small button (max size is limited) 40 // Create a small button (max size is limited)
44 new Efl.Ui.Button(win, (Efl.Ui.Button ebutton) => { 41 button = new Efl.Ui.Button(win);
45 ebutton.SetText("Small"); 42 button.SetText("Small");
46 ebutton.SetHintMax(new Eina.Size2D(50,50)); 43 button.SetHintMax(new Eina.Size2D(50,50));
47 box.DoPack(ebutton); 44 box.DoPack(button);
48 });
49 45
50 // Create a big button (min size is limited) 46 // Create a big button (min size is limited)
51 new Efl.Ui.Button(win, (Efl.Ui.Button ebutton) => { 47 button = new Efl.Ui.Button(win);
52 ebutton.SetText("Big button"); 48 button.SetText("Big button");
53 ebutton.SetHintMin(new Eina.Size2D(100,100)); 49 button.SetHintMin(new Eina.Size2D(100,100));
54 box.DoPack(ebutton); 50 box.DoPack(button);
55 });
56 51
57 // Start the EFL main loop 52 // Start the EFL main loop
58 Efl.Ui.Config.Run(); 53 Efl.Ui.Config.Run();
diff --git a/tutorial/csharp/eo-intro/src/eo_intro_main.cs b/tutorial/csharp/eo-intro/src/eo_intro_main.cs
index 0a7779a..5972919 100644
--- a/tutorial/csharp/eo-intro/src/eo_intro_main.cs
+++ b/tutorial/csharp/eo-intro/src/eo_intro_main.cs
@@ -8,19 +8,16 @@ public class Example
8 static void ObjCreate() 8 static void ObjCreate()
9 { 9 {
10 // First create a root element 10 // First create a root element
11 root = new Efl.ModelItem(null, (Efl.ModelItem eroot) => { 11 root = new Efl.ModelItem(null);
12 eroot.SetName("Root"); 12 root.SetName("Root");
13 });
14 13
15 // Create the first child element 14 // Create the first child element
16 new Efl.ModelItem(root, (Efl.ModelItem eroot) => { 15 var child = new Efl.ModelItem(root);
17 eroot.SetName("Child1"); 16 child.SetName("Child1");
18 });
19 17
20 // Create the second child element, this time, with an extra reference 18 // Create the second child element, this time, with an extra reference
21 child2 = new Efl.ModelItem(root, (Efl.ModelItem eroot) => { 19 child2 = new Efl.ModelItem(root);
22 eroot.SetName("Child2"); 20 child2.SetName("Child2");
23 });
24 } 21 }
25 22
26 // Destroy the test hierarchy 23 // Destroy the test hierarchy
diff --git a/tutorial/csharp/hello-gui/src/gui_main.cs b/tutorial/csharp/hello-gui/src/gui_main.cs
index c5d13e2..8a30430 100644
--- a/tutorial/csharp/hello-gui/src/gui_main.cs
+++ b/tutorial/csharp/hello-gui/src/gui_main.cs
@@ -18,46 +18,42 @@ public class Example
18 Efl.All.Init(Efl.Components.Ui); 18 Efl.All.Init(Efl.Components.Ui);
19 19
20 // Create a window and initialize it 20 // Create a window and initialize it
21 Efl.Ui.Win win = new Efl.Ui.Win(Efl.App.AppMain, (Efl.Ui.Win ewin) => { 21 Efl.Ui.Win win = new Efl.Ui.Win(Efl.App.AppMain);
22 // Set the window's title 22 // Set the window's title
23 ewin.SetText("Hello World"); 23 win.SetText("Hello World");
24 // Request that the window is automatically hidden when the "close" 24 // Request that the window is automatically hidden when the "close"
25 // button is pressed 25 // button is pressed
26 ewin.SetAutohide(true); 26 win.SetAutohide(true);
27 // Hook to the Hide event 27 // Hook to the Hide event
28 ewin.HideEvt += QuitCb; 28 win.HideEvt += QuitCb;
29 });
30 29
31 // Create a box container 30 // Create a box container
32 Efl.Ui.Box box = new Efl.Ui.Box(win, (Efl.Ui.Box ebox) => { 31 var box = new Efl.Ui.Box(win);
33 // Set its minimum size 32 // Set its minimum size
34 ebox.SetHintMin(new Eina.Size2D(360, 240)); 33 box.SetHintMin(new Eina.Size2D(360, 240));
35 // Set the box as the content for the window 34 // Set the box as the content for the window
36 // The window size will adapt to the box size 35 // The window size will adapt to the box size
37 win.SetContent(ebox); 36 win.SetContent(box);
38 });
39 37
40 // Create a text label widget 38 // Create a text label widget
41 new Efl.Ui.Text(box, (Efl.Ui.Text etext) => { 39 var label = new Efl.Ui.Text(box);
42 // Set its content and customize it 40 // Set its content and customize it
43 etext.SetText("Hello World. This is an Efl.Ui application!"); 41 label.SetText("Hello World. This is an Efl.Ui application!");
44 etext.SetSelectionAllowed(false); 42 label.SetSelectionAllowed(false);
45 etext.SetHintWeight(1.0, 0.9); 43 label.SetHintWeight(1.0, 0.9);
46 etext.SetHintAlign(0.5, 0.5); 44 label.SetHintAlign(0.5, 0.5);
47 // Add the text to the box container 45 // Add the text to the box container
48 box.DoPack(etext); 46 box.DoPack(label);
49 });
50 47
51 // Create a button widget 48 // Create a button widget
52 new Efl.Ui.Button(box, (Efl.Ui.Button ebutton) => { 49 var button = new Efl.Ui.Button(box);
53 // Customize it 50 // Customize it
54 ebutton.SetText("Quit"); 51 button.SetText("Quit");
55 ebutton.SetHintWeight(1.0, 0.1); 52 button.SetHintWeight(1.0, 0.1);
56 // Set the method to be called when the button is pressed 53 // Set the method to be called when the button is pressed
57 ebutton.ClickedEvt += QuitCb; 54 button.ClickedEvt += QuitCb;
58 // Add the button to the box container 55 // Add the button to the box container
59 box.DoPack(ebutton); 56 box.DoPack(button);
60 });
61 57
62 // Start the EFL main loop 58 // Start the EFL main loop
63 Efl.Ui.Config.Run(); 59 Efl.Ui.Config.Run();
diff --git a/tutorial/csharp/hello-world/src/hello-world.cs b/tutorial/csharp/hello-world/src/hello-world.cs
index 123b799..a490f92 100644
--- a/tutorial/csharp/hello-world/src/hello-world.cs
+++ b/tutorial/csharp/hello-world/src/hello-world.cs
@@ -11,13 +11,12 @@ public class Example
11 Efl.All.Init(Efl.Components.Ui); 11 Efl.All.Init(Efl.Components.Ui);
12 12
13 // Create a window and initialize it 13 // Create a window and initialize it
14 Efl.Ui.Win win = new Efl.Ui.Win(Efl.App.AppMain, (Efl.Ui.Win ewin) => { 14 Efl.Ui.Win win = new Efl.Ui.Win(Efl.App.AppMain);
15 // Set the window's title 15 // Set the window's title
16 ewin.SetText("Hello World"); 16 win.SetText("Hello World");
17 // Request that the window is automatically hidden when the "close" 17 // Request that the window is automatically hidden when the "close"
18 // button is pressed 18 // button is pressed
19 ewin.SetAutohide(true); 19 win.SetAutohide(true);
20 });
21 // Window size must be explicitly set, otherwise it will be invisible 20 // Window size must be explicitly set, otherwise it will be invisible
22 // due to its lack of content. 21 // due to its lack of content.
23 win.SetSize(new Eina.Size2D(360, 240)); 22 win.SetSize(new Eina.Size2D(360, 240));