Example code for Efl.Ui.* widgets
Reviewers: segfaultxavi, woohyun Reviewed By: segfaultxavi Differential Revision: https://phab.enlightenment.org/D10269
This commit is contained in:
parent
670a6bc902
commit
9f0eebb54f
|
@ -0,0 +1,17 @@
|
|||
Efl.Ui.AlertPopup alertPopup = new Efl.Ui.AlertPopup(parent);
|
||||
|
||||
alertPopup.SetButton(Efl.Ui.AlertPopupButton.Positive, "Accept", null);
|
||||
alertPopup.SetButton(Efl.Ui.AlertPopupButton.Negative, "Reject", null);
|
||||
|
||||
alertPopup.ButtonClickedEvent += (sender, args) =>
|
||||
{
|
||||
if (args.arg.Button_type.Equals(Efl.Ui.AlertPopupButton.Positive))
|
||||
Console.WriteLine("Positive action invoked");
|
||||
else if (args.arg.Button_type.Equals(Efl.Ui.AlertPopupButton.Negative))
|
||||
Console.WriteLine("Negative action invoked");
|
||||
};
|
||||
|
||||
alertPopup.BackwallClickedEvent += (s, e) =>
|
||||
{
|
||||
Console.WriteLine("Backwall clicked");
|
||||
};
|
|
@ -0,0 +1,6 @@
|
|||
Efl.Ui.Bg bg = new Efl.Ui.Bg(parent);
|
||||
|
||||
bg.SetColor(66, 162, 206, 255);
|
||||
|
||||
bg.SetFile(image_path + "background.png");
|
||||
bg.Load();
|
|
@ -0,0 +1,9 @@
|
|||
Efl.Ui.Box box = new Efl.Ui.Box(parent);
|
||||
|
||||
//Creating content which we will pack into the box - it can be any widgets, for example buttons.
|
||||
Efl.Ui.Button button1 = new Efl.Ui.Button(box);
|
||||
Efl.Ui.Button button2 = new Efl.Ui.Button(box);
|
||||
|
||||
//Packing the content to the box, one after another
|
||||
box.Pack(button1);
|
||||
box.Pack(button2);
|
|
@ -0,0 +1,9 @@
|
|||
Efl.Ui.Button button = new Efl.Ui.Button(parent);
|
||||
|
||||
button.SetText("Test Button");
|
||||
|
||||
button.ClickedEvent += (sender, args) =>
|
||||
{
|
||||
Efl.Ui.Button btn = (Efl.Ui.Button)sender;
|
||||
btn.SetText("Clicked");
|
||||
};
|
|
@ -0,0 +1,12 @@
|
|||
Efl.Ui.Check check = new Efl.Ui.Check(parent);
|
||||
|
||||
check.SetText("Test Check");
|
||||
check.SetSelected(true);
|
||||
|
||||
check.SelectedChangedEvent += (sender, args) =>
|
||||
{
|
||||
if (check.Selected)
|
||||
Console.WriteLine("Check is selected");
|
||||
else
|
||||
Console.WriteLine("Check is not selected");
|
||||
};
|
|
@ -0,0 +1,11 @@
|
|||
Efl.Ui.Datepicker datepicker = new Efl.Ui.Datepicker(parent);
|
||||
|
||||
datepicker.SetDateMin(2000, 1, 1);
|
||||
datepicker.SetDateMax(2030, 1, 1);
|
||||
datepicker.SetDate(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
|
||||
|
||||
datepicker.DateChangedEvent += (sender, args) =>
|
||||
{
|
||||
datepicker.GetDate(out int year, out int month, out int day);
|
||||
Console.WriteLine("Date has been changed! Current date: " + year + "-" + month + "-" + day);
|
||||
};
|
|
@ -0,0 +1,4 @@
|
|||
Efl.Ui.Image image = new Efl.Ui.Image(parent);
|
||||
|
||||
image.SetFile(image_path + "icon.png");
|
||||
image.Load();
|
|
@ -0,0 +1,12 @@
|
|||
Efl.Ui.Popup popup = new Efl.Ui.Popup(parent);
|
||||
|
||||
Efl.Ui.Button button = new Efl.Ui.Button(parent);
|
||||
|
||||
button.SetText("Click to hide the popup");
|
||||
|
||||
button.ClickedEvent += (sender, args) =>
|
||||
{
|
||||
popup.SetVisible(false);
|
||||
};
|
||||
|
||||
popup.SetContent(button);
|
|
@ -0,0 +1,11 @@
|
|||
Efl.Ui.Progressbar progressbar = new Efl.Ui.Progressbar(parent);
|
||||
|
||||
// You can choose the range limits according to your needs.
|
||||
// It can be percentage, but it can be also different value (e.g. number of files to be copied)
|
||||
progressbar.SetRangeLimits(0.0, 100.0);
|
||||
|
||||
// Setting initial progress value
|
||||
progressbar.RangeValue = 0;
|
||||
|
||||
// When progress is made you should modify the RangeValue:
|
||||
progressbar.RangeValue = 33;
|
|
@ -0,0 +1,14 @@
|
|||
Efl.Ui.RadioBox radioBox = new Efl.Ui.RadioBox(parent);
|
||||
|
||||
for (int i = 1; i <= 3; i++)
|
||||
{
|
||||
Efl.Ui.Radio radio = new Efl.Ui.Radio(radioBox);
|
||||
radio.SetText("Choice no. " + i);
|
||||
radio.SetStateValue(i);
|
||||
radioBox.Pack(radio);
|
||||
}
|
||||
|
||||
radioBox.ValueChangedEvent += (sender, args) =>
|
||||
{
|
||||
System.Console.WriteLine("RadioBox value changed! Current choice value: " + args.arg);
|
||||
};
|
|
@ -0,0 +1,10 @@
|
|||
Efl.Ui.Scroller scroller = new Efl.Ui.Scroller(parent);
|
||||
|
||||
// Create a large image to put it inside the scroller
|
||||
Efl.Ui.Image image = new Efl.Ui.Image(scroller);
|
||||
|
||||
image.SetHintSizeMin(new Eina.Size2D(1000, 1000));
|
||||
image.SetFile(image_path + "image.png");
|
||||
image.Load();
|
||||
|
||||
scroller.SetContent(image);
|
|
@ -0,0 +1,9 @@
|
|||
Efl.Ui.Slider slider = new Efl.Ui.Slider(parent);
|
||||
|
||||
slider.SetRangeLimits(0, 100);
|
||||
slider.SetRangeValue(50);
|
||||
|
||||
slider.ChangedEvent += (sender, args) =>
|
||||
{
|
||||
Console.WriteLine("Current slider value is: " + slider.GetRangeValue());
|
||||
};
|
|
@ -0,0 +1,13 @@
|
|||
Efl.Ui.SpinButton spinButton = new Efl.Ui.SpinButton(parent);
|
||||
|
||||
spinButton.SetOrientation(Efl.Ui.LayoutOrientation.Vertical);
|
||||
|
||||
spinButton.SetRangeLimits(0, 100);
|
||||
spinButton.SetRangeStep(2);
|
||||
spinButton.SetRangeValue(50);
|
||||
|
||||
spinButton.ChangedEvent += (sender, args) =>
|
||||
{
|
||||
Efl.Ui.SpinButton spnBtn = (Efl.Ui.SpinButton)sender;
|
||||
Console.WriteLine("Range value changed to: " + spnBtn.RangeValue);
|
||||
};
|
|
@ -0,0 +1,10 @@
|
|||
Efl.Ui.Table table = new Efl.Ui.Table(parent);
|
||||
|
||||
table.SetTableSize(2, 2);
|
||||
|
||||
Efl.Ui.Button button1 = new Efl.Ui.Button(table);
|
||||
Efl.Ui.Button button2 = new Efl.Ui.Button(table);
|
||||
|
||||
// The first column and row have indexes = 0.
|
||||
table.PackTable(button1, 0, 0, 1, 1);
|
||||
table.PackTable(button2, 1, 1, 1, 1);
|
Loading…
Reference in New Issue