summaryrefslogtreecommitdiff
path: root/reference/csharp/ui
diff options
context:
space:
mode:
authorVitor Sousa <vitorsousasilva@gmail.com>2018-02-09 19:07:12 -0200
committerVitor Sousa <vitorsousasilva@gmail.com>2018-02-09 19:07:12 -0200
commit66dd51dc4baa3db406a751d024ec4c812b9b30d7 (patch)
tree4968421d18ddecefbce36bc92af5bde892d4373d /reference/csharp/ui
parent0e7a34e0747ae7fb36502a919e1abe493bd4ca33 (diff)
ui_mono: add ui_sizing reference for C#devs/vitorsousa/csharp
Diffstat (limited to 'reference/csharp/ui')
-rw-r--r--reference/csharp/ui/meson.build10
-rw-r--r--reference/csharp/ui/src/meson.build8
-rw-r--r--reference/csharp/ui/src/ui_sizing.cs59
3 files changed, 77 insertions, 0 deletions
diff --git a/reference/csharp/ui/meson.build b/reference/csharp/ui/meson.build
new file mode 100644
index 0000000..0552d44
--- /dev/null
+++ b/reference/csharp/ui/meson.build
@@ -0,0 +1,10 @@
1project(
2 'efl-reference-ui', 'cs',
3 version : '0.0.1',
4 meson_version : '>= 0.38.0')
5
6efl_mono = dependency('efl-mono', version : '>=1.20.99')
7efl_mono_libs = efl_mono.get_pkgconfig_variable('mono_libs')
8
9subdir('src')
10
diff --git a/reference/csharp/ui/src/meson.build b/reference/csharp/ui/src/meson.build
new file mode 100644
index 0000000..3adaecf
--- /dev/null
+++ b/reference/csharp/ui/src/meson.build
@@ -0,0 +1,8 @@
1deps = [efl_mono]
2
3executable('efl_reference_ui_sizing',
4 files(['ui_sizing.cs']),
5 dependencies : deps,
6 cs_args : efl_mono_libs,
7 install : true
8)
diff --git a/reference/csharp/ui/src/ui_sizing.cs b/reference/csharp/ui/src/ui_sizing.cs
new file mode 100644
index 0000000..94a2872
--- /dev/null
+++ b/reference/csharp/ui/src/ui_sizing.cs
@@ -0,0 +1,59 @@
1/*
2 * Efl.UI sizing examples.
3 *
4 * Demonstrate how to use the sizing api from Efl.Gfx.
5 * We load a box with 3 buttons, one with default sizing, one that has a max
6 * and the last has a min size. Try resizing the window to see how this changes.
7 */
8
9using System;
10
11public class Example
12{
13 public static void Main()
14 {
15 efl.All.Init(efl.Components.Ui);
16
17 efl.ui.Win win = new efl.ui.WinConcrete(null, (efl.ui.Win ewin) => {
18 ewin.SetWinType(efl.ui.win.Type.Basic);
19 ewin.SetText("Size Control");
20 ewin.SetAutohide(true);
21 });
22 eina.Size2D sz;
23 sz.W = 320;
24 sz.H = 320;
25 win.SetSize(sz);
26
27 // when the user clicks "close" on a window there is a request to hide
28 win.HIDE += (object sender, EventArgs e) => {
29 // quit the app, called if the window is hidden
30 efl.ui.Config.Exit();
31 };
32
33 efl.ui.Box box = new efl.ui.BoxConcrete(win);
34 win.SetContent(box);
35
36 efl.ui.Button button = new efl.ui.ButtonConcrete(win);
37 button.SetText("Button");
38 box.Pack(button);
39
40 efl.ui.Button small_btn = new efl.ui.ButtonConcrete(win);
41 small_btn.SetText("Small");
42 sz.W = 50;
43 sz.H = 50;
44 small_btn.SetHintMax(sz);
45 box.Pack(small_btn);
46
47 efl.ui.Button big_btn = new efl.ui.ButtonConcrete(win);
48 big_btn.SetText("Big Button");
49 sz.W = 100;
50 sz.H = 100;
51 big_btn.SetHintMin(sz);
52 box.Pack(big_btn);
53
54 efl.ui.Config.Run();
55
56 efl.All.Shutdown();
57 }
58}
59