summaryrefslogtreecommitdiff
path: root/tutorial/csharp/hello-gui/src/gui_main.cs
diff options
context:
space:
mode:
Diffstat (limited to 'tutorial/csharp/hello-gui/src/gui_main.cs')
-rw-r--r--tutorial/csharp/hello-gui/src/gui_main.cs64
1 files changed, 30 insertions, 34 deletions
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();