summaryrefslogtreecommitdiff
path: root/reference/csharp/ui
diff options
context:
space:
mode:
authorXavi Artigas <xavierartigas@yahoo.es>2018-11-06 10:39:14 +0100
committerXavi Artigas <xavierartigas@yahoo.es>2018-12-19 16:51:15 +0100
commitd74a4df9946b69f769cd0ad40d4414c90d19a515 (patch)
tree7d4de6983ac9b319085fd84f559d2f592fc215b3 /reference/csharp/ui
parent656b746be7ffb834a31d0a693071f9eebba186c6 (diff)
csharp examples: Adapt to new classes syntax
Summary: Mainly use PascalCase Namespaces and Classes and proper event names. Test Plan: Check all examples still build. Reviewers: lauromoura, vitor.sousa, felipealmeida, bu5hm4n Reviewed By: bu5hm4n Differential Revision: https://phab.enlightenment.org/D7479
Diffstat (limited to 'reference/csharp/ui')
-rw-r--r--reference/csharp/ui/src/focus_main.cs34
-rw-r--r--reference/csharp/ui/src/ui_container.cs52
-rw-r--r--reference/csharp/ui/src/ui_sizing.cs24
3 files changed, 55 insertions, 55 deletions
diff --git a/reference/csharp/ui/src/focus_main.cs b/reference/csharp/ui/src/focus_main.cs
index f5a87a5..5cf6463 100644
--- a/reference/csharp/ui/src/focus_main.cs
+++ b/reference/csharp/ui/src/focus_main.cs
@@ -4,7 +4,7 @@ public class Example
4{ 4{
5 public static void FocusChangedCb(object sender, EventArgs e) 5 public static void FocusChangedCb(object sender, EventArgs e)
6 { 6 {
7 Console.WriteLine($"Focus for object {((efl.IText)sender).GetText()} changed to {((efl.ui.IWidget)sender).GetFocus()}"); 7 Console.WriteLine($"Focus for object {((Efl.Text)sender).GetText()} changed to {((Efl.Ui.Widget)sender).GetFocus()}");
8 } 8 }
9 9
10#if WIN32 10#if WIN32
@@ -13,29 +13,29 @@ public class Example
13 public static void Main() 13 public static void Main()
14 { 14 {
15 // Initialize EFL and all UI components 15 // Initialize EFL and all UI components
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.IWin ewin) => { 19 var win = new Efl.Ui.Win(null, (Efl.Ui.Win ewin) => {
20 ewin.SetWinType(efl.ui.Win_Type.Basic); 20 ewin.SetWinType(Efl.Ui.WinType.Basic);
21 ewin.SetText("Focus example"); 21 ewin.SetText("Focus example");
22 ewin.SetAutohide(true); 22 ewin.SetAutohide(true);
23 ewin.HideEvt += (object sender, EventArgs e) => { 23 ewin.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.IBox ebox) => { 30 var vbox = new Efl.Ui.Box(win, (Efl.Ui.Box ebox) => {
31 ebox.SetHintMin(new eina.Size2D(360, 240)); 31 ebox.SetHintMin(new Eina.Size2D(360, 240));
32 win.SetContent(ebox); 32 win.SetContent(ebox);
33 }); 33 });
34 34
35 // Create some check boxes 35 // Create some check boxes
36 efl.ui.ICheck first_checkbox = null; 36 Efl.Ui.Check first_checkbox = null;
37 for (int i = 0; i< 5; i++) { 37 for (int i = 0; i< 5; i++) {
38 var checkbox = new efl.ui.Check(vbox, (efl.ui.ICheck echeck) => { 38 var checkbox = new Efl.Ui.Check(vbox, (Efl.Ui.Check echeck) => {
39 echeck.SetText("Check " + i); 39 echeck.SetText("Check " + i);
40 echeck.SetHintAlign(0.5, 0.5); 40 echeck.SetHintAlign(0.5, 0.5);
41 echeck.FocusChangedEvt += FocusChangedCb; 41 echeck.FocusChangedEvt += FocusChangedCb;
@@ -45,30 +45,30 @@ public class Example
45 }; 45 };
46 46
47 // Create an horizontal box to contain the two buttons 47 // Create an horizontal box to contain the two buttons
48 var hbox = new efl.ui.Box(vbox, (efl.ui.IBox ebox) => { 48 var hbox = new Efl.Ui.Box(vbox, (Efl.Ui.Box ebox) => {
49 ebox.SetDirection(efl.ui.Dir.Horizontal); 49 ebox.SetDirection(Efl.Ui.Dir.Horizontal);
50 vbox.DoPack(ebox); 50 vbox.DoPack(ebox);
51 }); 51 });
52 52
53 // Create a "Focus Mover" button 53 // Create a "Focus Mover" button
54 new efl.ui.Button(hbox, (efl.ui.IButton ebutton) => { 54 new Efl.Ui.Button(hbox, (Efl.Ui.Button ebutton) => {
55 ebutton.SetText("Focus mover"); 55 ebutton.SetText("Focus mover");
56 ebutton.FocusChangedEvt += FocusChangedCb; 56 ebutton.FocusChangedEvt += FocusChangedCb;
57 ebutton.ClickedEvt += (object sender, EventArgs e) => { 57 ebutton.ClickedEvt += (object sender, EventArgs e) => {
58 Console.WriteLine("Clicked Focus Mover"); 58 Console.WriteLine("Clicked Focus Mover");
59 // Manually transfer focus to the first check box 59 // Manually transfer focus to the first check box
60 efl.ui.focus.Util.Focus(first_checkbox); 60 Efl.Ui.Focus.Util.Focus(first_checkbox);
61 }; 61 };
62 hbox.DoPack(ebutton); 62 hbox.DoPack(ebutton);
63 }); 63 });
64 64
65 // Create a Quit button 65 // Create a Quit button
66 new efl.ui.Button(hbox, (efl.ui.IButton ebutton) => { 66 new Efl.Ui.Button(hbox, (Efl.Ui.Button ebutton) => {
67 ebutton.SetText("Quit"); 67 ebutton.SetText("Quit");
68 ebutton.FocusChangedEvt += FocusChangedCb; 68 ebutton.FocusChangedEvt += FocusChangedCb;
69 ebutton.ClickedEvt += (object sender, EventArgs e) => { 69 ebutton.ClickedEvt += (object sender, EventArgs e) => {
70 Console.WriteLine("Clicked Quit"); 70 Console.WriteLine("Clicked Quit");
71 efl.ui.Config.Exit(); 71 Efl.Ui.Config.Exit();
72 }; 72 };
73 hbox.DoPack(ebutton); 73 hbox.DoPack(ebutton);
74 }); 74 });
@@ -77,10 +77,10 @@ public class Example
77 win.SetFocusHighlightEnabled(true); 77 win.SetFocusHighlightEnabled(true);
78 78
79 // Start the EFL main loop 79 // Start the EFL main loop
80 efl.ui.Config.Run(); 80 Efl.Ui.Config.Run();
81 81
82 // Shutdown EFL 82 // Shutdown EFL
83 efl.All.Shutdown(); 83 Efl.All.Shutdown();
84 } 84 }
85} 85}
86 86
diff --git a/reference/csharp/ui/src/ui_container.cs b/reference/csharp/ui/src/ui_container.cs
index fe5cc97..81e883b 100644
--- a/reference/csharp/ui/src/ui_container.cs
+++ b/reference/csharp/ui/src/ui_container.cs
@@ -10,9 +10,9 @@ using System;
10public class Example 10public class Example
11{ 11{
12 // Create a box container full of buttons 12 // Create a box container full of buttons
13 static efl.ui.IBox CreateBox(efl.ui.IWin win) 13 static Efl.Ui.Box CreateBox(Efl.Ui.Win win)
14 { 14 {
15 efl.ui.IBox box = new efl.ui.Box(win, (efl.ui.IBox ebox) => { 15 Efl.Ui.Box box = new Efl.Ui.Box(win, (Efl.Ui.Box ebox) => {
16 // Set distance between contained elements 16 // Set distance between contained elements
17 ebox.SetPackPadding(5, 0, true); 17 ebox.SetPackPadding(5, 0, true);
18 }); 18 });
@@ -20,12 +20,12 @@ public class Example
20 for (int i = 1; i <= 4; ++i) 20 for (int i = 1; i <= 4; ++i)
21 { 21 {
22 // Add 4 buttons, one below the other 22 // Add 4 buttons, one below the other
23 new efl.ui.Button(win, (efl.ui.IButton ebutton) => { 23 new Efl.Ui.Button(win, (Efl.Ui.Button ebutton) => {
24 ebutton.SetText($"Boxed {i}"); 24 ebutton.SetText($"Boxed {i}");
25 if (i == 2) 25 if (i == 2)
26 { 26 {
27 // Button 2 has its maximum size limited, so it will be smaller 27 // Button 2 has its maximum size limited, so it will be smaller
28 ebutton.SetHintMax(new eina.Size2D(100,50)); 28 ebutton.SetHintMax(new Eina.Size2D(100,50));
29 } 29 }
30 box.DoPack(ebutton); 30 box.DoPack(ebutton);
31 }); 31 });
@@ -35,25 +35,25 @@ public class Example
35 } 35 }
36 36
37 // Create a simple table layout 37 // Create a simple table layout
38 static efl.ui.ITable CreateTable(efl.ui.IWin win) 38 static Efl.Ui.Table CreateTable(Efl.Ui.Win win)
39 { 39 {
40 efl.ui.ITable table = new efl.ui.Table(win, (efl.ui.ITable etable) => { 40 Efl.Ui.Table table = new Efl.Ui.Table(win, (Efl.Ui.Table etable) => {
41 // Table with two columns, that get filled left to right, and then top to bottom 41 // Table with two columns, that get filled left to right, and then top to bottom
42 etable.SetTableColumns(2); 42 etable.SetTableColumns(2);
43 etable.SetTableDirection(efl.ui.Dir.Right, efl.ui.Dir.Down); 43 etable.SetTableDirection(Efl.Ui.Dir.Right, Efl.Ui.Dir.Down);
44 }); 44 });
45 45
46 for (int i = 1; i <= 4; ++i) 46 for (int i = 1; i <= 4; ++i)
47 { 47 {
48 // Add 4 buttons, following the defined table flow 48 // Add 4 buttons, following the defined table flow
49 new efl.ui.Button(win, (efl.ui.IButton ebutton) => { 49 new Efl.Ui.Button(win, (Efl.Ui.Button ebutton) => {
50 ebutton.SetText($"Table {i}"); 50 ebutton.SetText($"Table {i}");
51 table.DoPack(ebutton); 51 table.DoPack(ebutton);
52 }); 52 });
53 } 53 }
54 54
55 // Last button spans two table cells 55 // Last button spans two table cells
56 new efl.ui.Button(win, (efl.ui.IButton ebutton) => { 56 new Efl.Ui.Button(win, (Efl.Ui.Button ebutton) => {
57 ebutton.SetText("Long Button"); 57 ebutton.SetText("Long Button");
58 table.PackTable(ebutton, 0, 2, 2, 1); 58 table.PackTable(ebutton, 0, 2, 2, 1);
59 }); 59 });
@@ -67,62 +67,62 @@ public class Example
67 public static void Main() 67 public static void Main()
68 { 68 {
69 // Initialize EFL and all UI components 69 // Initialize EFL and all UI components
70 efl.All.Init(efl.Components.Ui); 70 Efl.All.Init(Efl.Components.Ui);
71 71
72 // Create a window and initialize it 72 // Create a window and initialize it
73 efl.ui.IWin win = new efl.ui.Win(null, (efl.ui.IWin ewin) => { 73 Efl.Ui.Win win = new Efl.Ui.Win(null, (Efl.Ui.Win ewin) => {
74 ewin.SetWinType(efl.ui.Win_Type.Basic); 74 ewin.SetWinType(Efl.Ui.WinType.Basic);
75 ewin.SetText("Container demo"); 75 ewin.SetText("Container demo");
76 ewin.SetAutohide(true); 76 ewin.SetAutohide(true);
77 ewin.HideEvt += (object sender, EventArgs e) => { 77 ewin.HideEvt += (object sender, EventArgs e) => {
78 // Exit the EFL main loop 78 // Exit the EFL main loop
79 efl.ui.Config.Exit(); 79 Efl.Ui.Config.Exit();
80 }; 80 };
81 }); 81 });
82 // Give the window an initial size so there is room to resize the panes. 82 // Give the window an initial size so there is room to resize the panes.
83 // Otherwise, all widgets are tightly packed 83 // Otherwise, all widgets are tightly packed
84 win.SetSize(new eina.Size2D(350,250)); 84 win.SetSize(new Eina.Size2D(350,250));
85 85
86 // Create a vertically-split panes container 86 // Create a vertically-split panes container
87 efl.ui.IPanes vsplit = new efl.ui.Panes(win, (efl.ui.IPanes epanes) => { 87 Efl.Ui.Panes vsplit = new Efl.Ui.Panes(win, (Efl.Ui.Panes epanes) => {
88 epanes.SetSplitRatio(0.75); 88 epanes.SetSplitRatio(0.75);
89 win.SetContent(epanes); 89 win.SetContent(epanes);
90 }); 90 });
91 91
92 // Create some boxes and set them as the content of the first pane of the container 92 // Create some boxes and set them as the content of the first pane of the container
93 var box = CreateBox(win); 93 var box = CreateBox(win);
94 efl.Content.static_cast(vsplit.GetPart("first")).SetContent(box); 94 Efl.ContentConcrete.static_cast(vsplit.GetPart("first")).SetContent(box);
95 95
96 // Create a second, horizontally-split panes container and set it as the content of 96 // Create a second, horizontally-split panes container and set it as the content of
97 // the second pane of the first container 97 // the second pane of the first container
98 efl.ui.IPanes hsplit = new efl.ui.Panes(win, (efl.ui.IPanes epanes) => { 98 Efl.Ui.Panes hsplit = new Efl.Ui.Panes(win, (Efl.Ui.Panes epanes) => {
99 epanes.SetDirection(efl.ui.Dir.Horizontal); 99 epanes.SetDirection(Efl.Ui.Dir.Horizontal);
100 epanes.SetSplitRatio(0.85); 100 epanes.SetSplitRatio(0.85);
101 }); 101 });
102 efl.Content.static_cast(vsplit.GetPart("second")).SetContent(hsplit); 102 Efl.ContentConcrete.static_cast(vsplit.GetPart("second")).SetContent(hsplit);
103 103
104 // Create a table and set it as the content of the first pane of the horizontal 104 // Create a table and set it as the content of the first pane of the horizontal
105 // container 105 // container
106 var table = CreateTable(win); 106 var table = CreateTable(win);
107 efl.Content.static_cast(hsplit.GetPart("first")).SetContent(table); 107 Efl.ContentConcrete.static_cast(hsplit.GetPart("first")).SetContent(table);
108 108
109 // Create a button and set it as the content of the second pane of the horizontal 109 // Create a button and set it as the content of the second pane of the horizontal
110 // container 110 // container
111 efl.ui.IButton quit_btn = new efl.ui.Button(win, (efl.ui.IButton ebutton) => { 111 Efl.Ui.Button quit_btn = new Efl.Ui.Button(win, (Efl.Ui.Button ebutton) => {
112 ebutton.SetText("Quit"); 112 ebutton.SetText("Quit");
113 ebutton.SetHintMax(new eina.Size2D(150, 30)); 113 ebutton.SetHintMax(new Eina.Size2D(150, 30));
114 ebutton.ClickedEvt += (object sender, EventArgs e) => { 114 ebutton.ClickedEvt += (object sender, EventArgs e) => {
115 // Exit the EFL main loop 115 // Exit the EFL main loop
116 efl.ui.Config.Exit(); 116 Efl.Ui.Config.Exit();
117 }; 117 };
118 }); 118 });
119 efl.Content.static_cast(hsplit.GetPart("second")).SetContent(quit_btn); 119 Efl.ContentConcrete.static_cast(hsplit.GetPart("second")).SetContent(quit_btn);
120 120
121 // Start the EFL main loop 121 // Start the EFL main loop
122 efl.ui.Config.Run(); 122 Efl.Ui.Config.Run();
123 123
124 // Shutdown EFL 124 // Shutdown EFL
125 efl.All.Shutdown(); 125 Efl.All.Shutdown();
126 } 126 }
127} 127}
128 128
diff --git a/reference/csharp/ui/src/ui_sizing.cs b/reference/csharp/ui/src/ui_sizing.cs
index b56cf48..dd6e5ff 100644
--- a/reference/csharp/ui/src/ui_sizing.cs
+++ b/reference/csharp/ui/src/ui_sizing.cs
@@ -16,49 +16,49 @@ public class Example
16 public static void Main() 16 public static void Main()
17 { 17 {
18 // Initialize EFL and all UI components 18 // Initialize EFL and all UI components
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.IWin win = new efl.ui.Win(null, (efl.ui.IWin ewin) => { 22 Efl.Ui.Win win = new Efl.Ui.Win(null, (Efl.Ui.Win ewin) => {
23 ewin.SetWinType(efl.ui.Win_Type.Basic); 23 ewin.SetWinType(Efl.Ui.WinType.Basic);
24 ewin.SetText("Size Control"); 24 ewin.SetText("Size Control");
25 ewin.SetAutohide(true); 25 ewin.SetAutohide(true);
26 ewin.HideEvt += (object sender, EventArgs e) => { 26 ewin.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 }); 30 });
31 31
32 // Create a box container 32 // Create a box container
33 efl.ui.IBox box = new efl.ui.Box(win, (efl.ui.IBox ebox) => { 33 Efl.Ui.Box box = new Efl.Ui.Box(win, (Efl.Ui.Box ebox) => {
34 win.SetContent(ebox); 34 win.SetContent(ebox);
35 }); 35 });
36 36
37 // Create a regular button (without size hints) 37 // Create a regular button (without size hints)
38 new efl.ui.Button(win, (efl.ui.IButton ebutton) => { 38 new Efl.Ui.Button(win, (Efl.Ui.Button ebutton) => {
39 ebutton.SetText("Button"); 39 ebutton.SetText("Button");
40 box.DoPack(ebutton); 40 box.DoPack(ebutton);
41 }); 41 });
42 42
43 // Create a small button (max size is limited) 43 // Create a small button (max size is limited)
44 new efl.ui.Button(win, (efl.ui.IButton ebutton) => { 44 new Efl.Ui.Button(win, (Efl.Ui.Button ebutton) => {
45 ebutton.SetText("Small"); 45 ebutton.SetText("Small");
46 ebutton.SetHintMax(new eina.Size2D(50,50)); 46 ebutton.SetHintMax(new Eina.Size2D(50,50));
47 box.DoPack(ebutton); 47 box.DoPack(ebutton);
48 }); 48 });
49 49
50 // Create a big button (min size is limited) 50 // Create a big button (min size is limited)
51 new efl.ui.Button(win, (efl.ui.IButton ebutton) => { 51 new Efl.Ui.Button(win, (Efl.Ui.Button ebutton) => {
52 ebutton.SetText("Big button"); 52 ebutton.SetText("Big button");
53 ebutton.SetHintMin(new eina.Size2D(100,100)); 53 ebutton.SetHintMin(new Eina.Size2D(100,100));
54 box.DoPack(ebutton); 54 box.DoPack(ebutton);
55 }); 55 });
56 56
57 // Start the EFL main loop 57 // Start the EFL main loop
58 efl.ui.Config.Run(); 58 Efl.Ui.Config.Run();
59 59
60 // Shutdown EFL 60 // Shutdown EFL
61 efl.All.Shutdown(); 61 Efl.All.Shutdown();
62 } 62 }
63} 63}
64 64