summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Oleksak <l.oleksak@samsung.com>2019-10-02 15:36:14 +0200
committerXavi Artigas <xavierartigas@yahoo.es>2019-10-02 16:24:48 +0200
commit9f0eebb54f26c21a860863519deca83f1989b1c5 (patch)
tree245bb013274fde3ca341b63c3446dfaf1c7d6866
parent670a6bc9022e6764c7c56b0f8eba3512aac84e89 (diff)
Example code for Efl.Ui.* widgets
Reviewers: segfaultxavi, woohyun Reviewed By: segfaultxavi Differential Revision: https://phab.enlightenment.org/D10269
-rw-r--r--reference/csharp/snippets/Efl.Ui.AlertPopup.cs17
-rw-r--r--reference/csharp/snippets/Efl.Ui.Bg.cs6
-rw-r--r--reference/csharp/snippets/Efl.Ui.Box.cs9
-rw-r--r--reference/csharp/snippets/Efl.Ui.Button.cs9
-rw-r--r--reference/csharp/snippets/Efl.Ui.Check.cs12
-rw-r--r--reference/csharp/snippets/Efl.Ui.Datepicker.cs11
-rw-r--r--reference/csharp/snippets/Efl.Ui.Image.cs4
-rw-r--r--reference/csharp/snippets/Efl.Ui.Popup.cs12
-rw-r--r--reference/csharp/snippets/Efl.Ui.Progressbar.cs11
-rw-r--r--reference/csharp/snippets/Efl.Ui.RadioBox.cs14
-rw-r--r--reference/csharp/snippets/Efl.Ui.Scroller.cs10
-rw-r--r--reference/csharp/snippets/Efl.Ui.Slider.cs9
-rw-r--r--reference/csharp/snippets/Efl.Ui.SpinButton.cs13
-rw-r--r--reference/csharp/snippets/Efl.Ui.Table.cs10
14 files changed, 147 insertions, 0 deletions
diff --git a/reference/csharp/snippets/Efl.Ui.AlertPopup.cs b/reference/csharp/snippets/Efl.Ui.AlertPopup.cs
new file mode 100644
index 0000000..0621ecc
--- /dev/null
+++ b/reference/csharp/snippets/Efl.Ui.AlertPopup.cs
@@ -0,0 +1,17 @@
1Efl.Ui.AlertPopup alertPopup = new Efl.Ui.AlertPopup(parent);
2
3alertPopup.SetButton(Efl.Ui.AlertPopupButton.Positive, "Accept", null);
4alertPopup.SetButton(Efl.Ui.AlertPopupButton.Negative, "Reject", null);
5
6alertPopup.ButtonClickedEvent += (sender, args) =>
7{
8 if (args.arg.Button_type.Equals(Efl.Ui.AlertPopupButton.Positive))
9 Console.WriteLine("Positive action invoked");
10 else if (args.arg.Button_type.Equals(Efl.Ui.AlertPopupButton.Negative))
11 Console.WriteLine("Negative action invoked");
12};
13
14alertPopup.BackwallClickedEvent += (s, e) =>
15{
16 Console.WriteLine("Backwall clicked");
17};
diff --git a/reference/csharp/snippets/Efl.Ui.Bg.cs b/reference/csharp/snippets/Efl.Ui.Bg.cs
new file mode 100644
index 0000000..380a0a1
--- /dev/null
+++ b/reference/csharp/snippets/Efl.Ui.Bg.cs
@@ -0,0 +1,6 @@
1Efl.Ui.Bg bg = new Efl.Ui.Bg(parent);
2
3bg.SetColor(66, 162, 206, 255);
4
5bg.SetFile(image_path + "background.png");
6bg.Load();
diff --git a/reference/csharp/snippets/Efl.Ui.Box.cs b/reference/csharp/snippets/Efl.Ui.Box.cs
new file mode 100644
index 0000000..48c1488
--- /dev/null
+++ b/reference/csharp/snippets/Efl.Ui.Box.cs
@@ -0,0 +1,9 @@
1Efl.Ui.Box box = new Efl.Ui.Box(parent);
2
3//Creating content which we will pack into the box - it can be any widgets, for example buttons.
4Efl.Ui.Button button1 = new Efl.Ui.Button(box);
5Efl.Ui.Button button2 = new Efl.Ui.Button(box);
6
7//Packing the content to the box, one after another
8box.Pack(button1);
9box.Pack(button2);
diff --git a/reference/csharp/snippets/Efl.Ui.Button.cs b/reference/csharp/snippets/Efl.Ui.Button.cs
new file mode 100644
index 0000000..cb7162e
--- /dev/null
+++ b/reference/csharp/snippets/Efl.Ui.Button.cs
@@ -0,0 +1,9 @@
1Efl.Ui.Button button = new Efl.Ui.Button(parent);
2
3button.SetText("Test Button");
4
5button.ClickedEvent += (sender, args) =>
6{
7 Efl.Ui.Button btn = (Efl.Ui.Button)sender;
8 btn.SetText("Clicked");
9};
diff --git a/reference/csharp/snippets/Efl.Ui.Check.cs b/reference/csharp/snippets/Efl.Ui.Check.cs
new file mode 100644
index 0000000..8d3f47c
--- /dev/null
+++ b/reference/csharp/snippets/Efl.Ui.Check.cs
@@ -0,0 +1,12 @@
1Efl.Ui.Check check = new Efl.Ui.Check(parent);
2
3check.SetText("Test Check");
4check.SetSelected(true);
5
6check.SelectedChangedEvent += (sender, args) =>
7{
8 if (check.Selected)
9 Console.WriteLine("Check is selected");
10 else
11 Console.WriteLine("Check is not selected");
12};
diff --git a/reference/csharp/snippets/Efl.Ui.Datepicker.cs b/reference/csharp/snippets/Efl.Ui.Datepicker.cs
new file mode 100644
index 0000000..4288131
--- /dev/null
+++ b/reference/csharp/snippets/Efl.Ui.Datepicker.cs
@@ -0,0 +1,11 @@
1Efl.Ui.Datepicker datepicker = new Efl.Ui.Datepicker(parent);
2
3datepicker.SetDateMin(2000, 1, 1);
4datepicker.SetDateMax(2030, 1, 1);
5datepicker.SetDate(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
6
7datepicker.DateChangedEvent += (sender, args) =>
8{
9 datepicker.GetDate(out int year, out int month, out int day);
10 Console.WriteLine("Date has been changed! Current date: " + year + "-" + month + "-" + day);
11};
diff --git a/reference/csharp/snippets/Efl.Ui.Image.cs b/reference/csharp/snippets/Efl.Ui.Image.cs
new file mode 100644
index 0000000..81411d8
--- /dev/null
+++ b/reference/csharp/snippets/Efl.Ui.Image.cs
@@ -0,0 +1,4 @@
1Efl.Ui.Image image = new Efl.Ui.Image(parent);
2
3image.SetFile(image_path + "icon.png");
4image.Load();
diff --git a/reference/csharp/snippets/Efl.Ui.Popup.cs b/reference/csharp/snippets/Efl.Ui.Popup.cs
new file mode 100644
index 0000000..ec75e00
--- /dev/null
+++ b/reference/csharp/snippets/Efl.Ui.Popup.cs
@@ -0,0 +1,12 @@
1Efl.Ui.Popup popup = new Efl.Ui.Popup(parent);
2
3Efl.Ui.Button button = new Efl.Ui.Button(parent);
4
5button.SetText("Click to hide the popup");
6
7button.ClickedEvent += (sender, args) =>
8{
9 popup.SetVisible(false);
10};
11
12popup.SetContent(button);
diff --git a/reference/csharp/snippets/Efl.Ui.Progressbar.cs b/reference/csharp/snippets/Efl.Ui.Progressbar.cs
new file mode 100644
index 0000000..a340ae4
--- /dev/null
+++ b/reference/csharp/snippets/Efl.Ui.Progressbar.cs
@@ -0,0 +1,11 @@
1Efl.Ui.Progressbar progressbar = new Efl.Ui.Progressbar(parent);
2
3// You can choose the range limits according to your needs.
4// It can be percentage, but it can be also different value (e.g. number of files to be copied)
5progressbar.SetRangeLimits(0.0, 100.0);
6
7// Setting initial progress value
8progressbar.RangeValue = 0;
9
10// When progress is made you should modify the RangeValue:
11progressbar.RangeValue = 33;
diff --git a/reference/csharp/snippets/Efl.Ui.RadioBox.cs b/reference/csharp/snippets/Efl.Ui.RadioBox.cs
new file mode 100644
index 0000000..e54a5bf
--- /dev/null
+++ b/reference/csharp/snippets/Efl.Ui.RadioBox.cs
@@ -0,0 +1,14 @@
1Efl.Ui.RadioBox radioBox = new Efl.Ui.RadioBox(parent);
2
3for (int i = 1; i <= 3; i++)
4{
5 Efl.Ui.Radio radio = new Efl.Ui.Radio(radioBox);
6 radio.SetText("Choice no. " + i);
7 radio.SetStateValue(i);
8 radioBox.Pack(radio);
9}
10
11radioBox.ValueChangedEvent += (sender, args) =>
12{
13 System.Console.WriteLine("RadioBox value changed! Current choice value: " + args.arg);
14};
diff --git a/reference/csharp/snippets/Efl.Ui.Scroller.cs b/reference/csharp/snippets/Efl.Ui.Scroller.cs
new file mode 100644
index 0000000..91f30d5
--- /dev/null
+++ b/reference/csharp/snippets/Efl.Ui.Scroller.cs
@@ -0,0 +1,10 @@
1Efl.Ui.Scroller scroller = new Efl.Ui.Scroller(parent);
2
3// Create a large image to put it inside the scroller
4Efl.Ui.Image image = new Efl.Ui.Image(scroller);
5
6image.SetHintSizeMin(new Eina.Size2D(1000, 1000));
7image.SetFile(image_path + "image.png");
8image.Load();
9
10scroller.SetContent(image);
diff --git a/reference/csharp/snippets/Efl.Ui.Slider.cs b/reference/csharp/snippets/Efl.Ui.Slider.cs
new file mode 100644
index 0000000..5205a7d
--- /dev/null
+++ b/reference/csharp/snippets/Efl.Ui.Slider.cs
@@ -0,0 +1,9 @@
1Efl.Ui.Slider slider = new Efl.Ui.Slider(parent);
2
3slider.SetRangeLimits(0, 100);
4slider.SetRangeValue(50);
5
6slider.ChangedEvent += (sender, args) =>
7{
8 Console.WriteLine("Current slider value is: " + slider.GetRangeValue());
9};
diff --git a/reference/csharp/snippets/Efl.Ui.SpinButton.cs b/reference/csharp/snippets/Efl.Ui.SpinButton.cs
new file mode 100644
index 0000000..d253adf
--- /dev/null
+++ b/reference/csharp/snippets/Efl.Ui.SpinButton.cs
@@ -0,0 +1,13 @@
1Efl.Ui.SpinButton spinButton = new Efl.Ui.SpinButton(parent);
2
3spinButton.SetOrientation(Efl.Ui.LayoutOrientation.Vertical);
4
5spinButton.SetRangeLimits(0, 100);
6spinButton.SetRangeStep(2);
7spinButton.SetRangeValue(50);
8
9spinButton.ChangedEvent += (sender, args) =>
10{
11 Efl.Ui.SpinButton spnBtn = (Efl.Ui.SpinButton)sender;
12 Console.WriteLine("Range value changed to: " + spnBtn.RangeValue);
13};
diff --git a/reference/csharp/snippets/Efl.Ui.Table.cs b/reference/csharp/snippets/Efl.Ui.Table.cs
new file mode 100644
index 0000000..ab7240f
--- /dev/null
+++ b/reference/csharp/snippets/Efl.Ui.Table.cs
@@ -0,0 +1,10 @@
1Efl.Ui.Table table = new Efl.Ui.Table(parent);
2
3table.SetTableSize(2, 2);
4
5Efl.Ui.Button button1 = new Efl.Ui.Button(table);
6Efl.Ui.Button button2 = new Efl.Ui.Button(table);
7
8// The first column and row have indexes = 0.
9table.PackTable(button1, 0, 0, 1, 1);
10table.PackTable(button2, 1, 1, 1, 1);